Add page-view analytics, product counters, SSL expiry, and business renewal.
Auto-count storefront page views with 6-month event retention and lifetime counters, track product visit/cart/sale stats, persist SSL cert expiry with daily probes, and support owner titles plus annual contract renewal. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
6cd0b009ef
commit
92601ae729
@@ -21,6 +21,7 @@ import { CurrentUser } from '../auth/decorators/current-user.decorator';
|
||||
import { RequireBusinessPermission } from '../auth/decorators/require-business-permission.decorator';
|
||||
import { BusinessPermissionGuard } from '../auth/guards/business-permission.guard';
|
||||
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
|
||||
import { WebsiteAnalyticsService } from '../website-analytics/website-analytics.service';
|
||||
import {
|
||||
BatchCreateStoreItemsDto,
|
||||
BatchUpdateStoreItemDiscountsDto,
|
||||
@@ -166,20 +167,41 @@ export class StoreItemsController {
|
||||
|
||||
@Controller('tenants/:host/store-items')
|
||||
export class PublicStoreItemsController {
|
||||
constructor(private readonly service: StoreItemsService) {}
|
||||
constructor(
|
||||
private readonly service: StoreItemsService,
|
||||
private readonly analytics: WebsiteAnalyticsService,
|
||||
) {}
|
||||
|
||||
@Get()
|
||||
list(@Param('host') host: string, @Query() query: ListPublicStoreItemsDto) {
|
||||
return this.service.listPublic(host, query);
|
||||
async list(@Param('host') host: string, @Query() query: ListPublicStoreItemsDto) {
|
||||
const result = await this.service.listPublic(host, query);
|
||||
this.analytics.trackPublicPage(host, 'store_item_list');
|
||||
return result;
|
||||
}
|
||||
|
||||
@Get('by-product/:productId')
|
||||
getByProduct(@Param('host') host: string, @Param('productId') productId: string) {
|
||||
return this.service.getPublicByProduct(host, productId);
|
||||
async getByProduct(
|
||||
@Param('host') host: string,
|
||||
@Param('productId') productId: string,
|
||||
) {
|
||||
const result = await this.service.getPublicByProduct(host, productId);
|
||||
if (result.storeItem) {
|
||||
this.analytics.trackPublicPage(host, 'store_item_detail', result.storeItem.id);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Get(':variantId')
|
||||
getVariant(@Param('host') host: string, @Param('variantId') variantId: string) {
|
||||
return this.service.getPublicVariant(host, variantId);
|
||||
async getVariant(
|
||||
@Param('host') host: string,
|
||||
@Param('variantId') variantId: string,
|
||||
) {
|
||||
const result = await this.service.getPublicVariant(host, variantId);
|
||||
this.analytics.trackPublicPage(
|
||||
host,
|
||||
'store_item_detail',
|
||||
result.variant.storeItemId,
|
||||
);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user