flowgrid-sdk 1.2.1 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +221 -250
- package/dist/237.flowgrid.min.js +2 -0
- package/dist/237.flowgrid.min.js.map +1 -0
- package/dist/546.flowgrid.min.js +3 -0
- package/dist/546.flowgrid.min.js.LICENSE.txt +14 -0
- package/dist/546.flowgrid.min.js.map +1 -0
- package/dist/EXAMPLE.d.ts +1 -0
- package/dist/EXAMPLE.js +55 -0
- package/dist/EXAMPLE.js.map +1 -0
- package/dist/browser.d.ts +46 -103
- package/dist/browser.js +102 -0
- package/dist/browser.js.map +1 -0
- package/dist/flowgrid.min.js +1 -1
- package/dist/flowgrid.min.js.map +1 -1
- package/dist/index.d.ts +7 -8
- package/dist/index.js +64 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/client/transport.d.ts +14 -4
- package/dist/lib/client/transport.js +432 -0
- package/dist/lib/client/transport.js.map +1 -0
- package/dist/lib/consent/index.d.ts +0 -5
- package/dist/lib/consent/index.js +32 -0
- package/dist/lib/consent/index.js.map +1 -0
- package/dist/lib/consent/manager.js +336 -0
- package/dist/lib/consent/manager.js.map +1 -0
- package/dist/lib/consent/types.d.ts +3 -20
- package/dist/lib/consent/types.js +10 -0
- package/dist/lib/consent/types.js.map +1 -0
- package/dist/lib/features/analytics/attribution.d.ts +6 -47
- package/dist/lib/features/analytics/attribution.js +181 -0
- package/dist/lib/features/analytics/attribution.js.map +1 -0
- package/dist/lib/features/analytics/events.d.ts +1 -28
- package/dist/lib/features/analytics/events.js +256 -0
- package/dist/lib/features/analytics/events.js.map +1 -0
- package/dist/lib/features/analytics/funnels.js +260 -0
- package/dist/lib/features/analytics/funnels.js.map +1 -0
- package/dist/lib/features/analytics/heatmaps.d.ts +12 -19
- package/dist/lib/features/analytics/heatmaps.js +258 -0
- package/dist/lib/features/analytics/heatmaps.js.map +1 -0
- package/dist/lib/features/analytics/identify.d.ts +1 -21
- package/dist/lib/features/analytics/identify.js +213 -0
- package/dist/lib/features/analytics/identify.js.map +1 -0
- package/dist/lib/features/analytics/index.d.ts +2 -0
- package/dist/lib/features/analytics/index.js +15 -0
- package/dist/lib/features/analytics/index.js.map +1 -0
- package/dist/lib/features/analytics/page-views.d.ts +13 -30
- package/dist/lib/features/analytics/page-views.js +268 -0
- package/dist/lib/features/analytics/page-views.js.map +1 -0
- package/dist/lib/features/analytics/performance.d.ts +18 -24
- package/dist/lib/features/analytics/performance.js +232 -0
- package/dist/lib/features/analytics/performance.js.map +1 -0
- package/dist/lib/features/analytics/replay.d.ts +170 -0
- package/dist/lib/features/analytics/replay.js +381 -0
- package/dist/lib/features/analytics/replay.js.map +1 -0
- package/dist/lib/features/analytics/retention.d.ts +1 -76
- package/dist/lib/features/analytics/retention.js +135 -0
- package/dist/lib/features/analytics/retention.js.map +1 -0
- package/dist/lib/features/analytics/sessions.d.ts +12 -37
- package/dist/lib/features/analytics/sessions.js +213 -0
- package/dist/lib/features/analytics/sessions.js.map +1 -0
- package/dist/lib/features/core/activation.d.ts +1 -24
- package/dist/lib/features/core/activation.js +175 -0
- package/dist/lib/features/core/activation.js.map +1 -0
- package/dist/lib/features/core/experiment.d.ts +53 -21
- package/dist/lib/features/core/experiment.js +554 -0
- package/dist/lib/features/core/experiment.js.map +1 -0
- package/dist/lib/features/core/index.js +9 -0
- package/dist/lib/features/core/index.js.map +1 -0
- package/dist/lib/features/core/track-feature.d.ts +1 -8
- package/dist/lib/features/core/track-feature.js +119 -0
- package/dist/lib/features/core/track-feature.js.map +1 -0
- package/dist/lib/features/core/track-prompt.d.ts +5 -8
- package/dist/lib/features/core/track-prompt.js +181 -0
- package/dist/lib/features/core/track-prompt.js.map +1 -0
- package/dist/lib/features/ecommerce/cart.d.ts +1 -24
- package/dist/lib/features/ecommerce/cart.js +244 -0
- package/dist/lib/features/ecommerce/cart.js.map +1 -0
- package/dist/lib/features/ecommerce/checkout.d.ts +1 -28
- package/dist/lib/features/ecommerce/checkout.js +254 -0
- package/dist/lib/features/ecommerce/checkout.js.map +1 -0
- package/dist/lib/features/ecommerce/index.d.ts +0 -2
- package/dist/lib/features/ecommerce/index.js +15 -0
- package/dist/lib/features/ecommerce/index.js.map +1 -0
- package/dist/lib/features/ecommerce/ltv.d.ts +1 -69
- package/dist/lib/features/ecommerce/ltv.js +114 -0
- package/dist/lib/features/ecommerce/ltv.js.map +1 -0
- package/dist/lib/features/ecommerce/products.d.ts +1 -33
- package/dist/lib/features/ecommerce/products.js +223 -0
- package/dist/lib/features/ecommerce/products.js.map +1 -0
- package/dist/lib/features/ecommerce/promotions.d.ts +1 -30
- package/dist/lib/features/ecommerce/promotions.js +197 -0
- package/dist/lib/features/ecommerce/promotions.js.map +1 -0
- package/dist/lib/features/ecommerce/purchases.d.ts +1 -48
- package/dist/lib/features/ecommerce/purchases.js +193 -0
- package/dist/lib/features/ecommerce/purchases.js.map +1 -0
- package/dist/lib/features/ecommerce/refunds.d.ts +1 -27
- package/dist/lib/features/ecommerce/refunds.js +195 -0
- package/dist/lib/features/ecommerce/refunds.js.map +1 -0
- package/dist/lib/features/ecommerce/search.d.ts +1 -24
- package/dist/lib/features/ecommerce/search.js +156 -0
- package/dist/lib/features/ecommerce/search.js.map +1 -0
- package/dist/lib/features/ecommerce/subscriptions.d.ts +1 -28
- package/dist/lib/features/ecommerce/subscriptions.js +207 -0
- package/dist/lib/features/ecommerce/subscriptions.js.map +1 -0
- package/dist/lib/features/ecommerce/wishlist.d.ts +1 -28
- package/dist/lib/features/ecommerce/wishlist.js +186 -0
- package/dist/lib/features/ecommerce/wishlist.js.map +1 -0
- package/dist/lib/features/enterprise/acquisition.d.ts +2 -57
- package/dist/lib/features/enterprise/acquisition.js +166 -0
- package/dist/lib/features/enterprise/acquisition.js.map +1 -0
- package/dist/lib/features/enterprise/alerts.d.ts +1 -37
- package/dist/lib/features/enterprise/alerts.js +246 -0
- package/dist/lib/features/enterprise/alerts.js.map +1 -0
- package/dist/lib/features/enterprise/churn.d.ts +1 -42
- package/dist/lib/features/enterprise/churn.js +175 -0
- package/dist/lib/features/enterprise/churn.js.map +1 -0
- package/dist/lib/features/enterprise/cohorts.d.ts +1 -37
- package/dist/lib/features/enterprise/cohorts.js +201 -0
- package/dist/lib/features/enterprise/cohorts.js.map +1 -0
- package/dist/lib/features/enterprise/engagement.d.ts +40 -46
- package/dist/lib/features/enterprise/engagement.js +335 -0
- package/dist/lib/features/enterprise/engagement.js.map +1 -0
- package/dist/lib/features/enterprise/forecasting.d.ts +0 -50
- package/dist/lib/features/enterprise/forecasting.js +232 -0
- package/dist/lib/features/enterprise/forecasting.js.map +1 -0
- package/dist/lib/features/enterprise/index.d.ts +1 -1
- package/dist/lib/features/enterprise/index.js +76 -0
- package/dist/lib/features/enterprise/index.js.map +1 -0
- package/dist/lib/features/enterprise/monetization.d.ts +1 -60
- package/dist/lib/features/enterprise/monetization.js +146 -0
- package/dist/lib/features/enterprise/monetization.js.map +1 -0
- package/dist/lib/features/enterprise/multi-path-funnels.d.ts +1 -17
- package/dist/lib/features/enterprise/multi-path-funnels.js +205 -0
- package/dist/lib/features/enterprise/multi-path-funnels.js.map +1 -0
- package/dist/lib/features/enterprise/paths.d.ts +1 -56
- package/dist/lib/features/enterprise/paths.js +149 -0
- package/dist/lib/features/enterprise/paths.js.map +1 -0
- package/dist/lib/features/enterprise/security.d.ts +8 -57
- package/dist/lib/features/enterprise/security.js +202 -0
- package/dist/lib/features/enterprise/security.js.map +1 -0
- package/dist/lib/features/enterprise/support.d.ts +3 -42
- package/dist/lib/features/enterprise/support.js +162 -0
- package/dist/lib/features/enterprise/support.js.map +1 -0
- package/dist/lib/flowgrid.d.ts +278 -0
- package/dist/lib/flowgrid.js +323 -0
- package/dist/lib/flowgrid.js.map +1 -0
- package/dist/lib/frameworks/index.d.ts +13 -6
- package/dist/lib/frameworks/index.js +18 -0
- package/dist/lib/frameworks/index.js.map +1 -0
- package/dist/lib/frameworks/nextjs/client.js +355 -0
- package/dist/lib/frameworks/nextjs/client.js.map +1 -0
- package/dist/lib/frameworks/nextjs/index.js +31 -0
- package/dist/lib/frameworks/nextjs/index.js.map +1 -0
- package/dist/lib/frameworks/nextjs/server.js +259 -0
- package/dist/lib/frameworks/nextjs/server.js.map +1 -0
- package/dist/lib/frameworks/node/index.js +391 -0
- package/dist/lib/frameworks/node/index.js.map +1 -0
- package/dist/lib/frameworks/nuxt/index.js +288 -0
- package/dist/lib/frameworks/nuxt/index.js.map +1 -0
- package/dist/lib/frameworks/react/CookieBanner.js +166 -0
- package/dist/lib/frameworks/react/CookieBanner.js.map +1 -0
- package/dist/lib/frameworks/react/index.js +271 -0
- package/dist/lib/frameworks/react/index.js.map +1 -0
- package/dist/lib/frameworks/vue/CookieBanner.js +165 -0
- package/dist/lib/frameworks/vue/CookieBanner.js.map +1 -0
- package/dist/lib/frameworks/vue/index.js +390 -0
- package/dist/lib/frameworks/vue/index.js.map +1 -0
- package/dist/lib/tracking/analytics/attribution.d.ts +14 -0
- package/dist/lib/tracking/analytics/attribution.js +18 -0
- package/dist/lib/tracking/analytics/attribution.js.map +1 -0
- package/dist/lib/tracking/analytics/events.d.ts +26 -0
- package/dist/lib/tracking/analytics/events.js +30 -0
- package/dist/lib/tracking/analytics/events.js.map +1 -0
- package/dist/lib/tracking/analytics/funnels.d.ts +16 -0
- package/dist/lib/tracking/analytics/funnels.js +22 -0
- package/dist/lib/tracking/analytics/funnels.js.map +1 -0
- package/dist/lib/tracking/analytics/heatmaps.d.ts +27 -0
- package/dist/lib/tracking/analytics/heatmaps.js +22 -0
- package/dist/lib/tracking/analytics/heatmaps.js.map +1 -0
- package/dist/lib/tracking/analytics/identify.d.ts +16 -0
- package/dist/lib/tracking/analytics/identify.js +22 -0
- package/dist/lib/tracking/analytics/identify.js.map +1 -0
- package/dist/lib/tracking/analytics/index.d.ts +10 -0
- package/dist/lib/tracking/analytics/index.js +11 -0
- package/dist/lib/tracking/analytics/index.js.map +1 -0
- package/dist/lib/tracking/analytics/page-views.d.ts +29 -0
- package/dist/lib/tracking/analytics/page-views.js +50 -0
- package/dist/lib/tracking/analytics/page-views.js.map +1 -0
- package/dist/lib/tracking/analytics/performance.d.ts +22 -0
- package/dist/lib/tracking/analytics/performance.js +22 -0
- package/dist/lib/tracking/analytics/performance.js.map +1 -0
- package/dist/lib/tracking/analytics/replay.d.ts +34 -0
- package/dist/lib/tracking/analytics/replay.js +46 -0
- package/dist/lib/tracking/analytics/replay.js.map +1 -0
- package/dist/lib/tracking/analytics/retention.d.ts +10 -0
- package/dist/lib/tracking/analytics/retention.js +10 -0
- package/dist/lib/tracking/analytics/retention.js.map +1 -0
- package/dist/lib/tracking/analytics/sessions.d.ts +20 -0
- package/dist/lib/tracking/analytics/sessions.js +26 -0
- package/dist/lib/tracking/analytics/sessions.js.map +1 -0
- package/dist/lib/tracking/core/activation.d.ts +23 -0
- package/dist/lib/tracking/core/activation.js +33 -0
- package/dist/lib/tracking/core/activation.js.map +1 -0
- package/dist/lib/tracking/core/experiment.d.ts +122 -0
- package/dist/lib/tracking/core/experiment.js +150 -0
- package/dist/lib/tracking/core/experiment.js.map +1 -0
- package/dist/lib/tracking/core/feature.d.ts +13 -0
- package/dist/lib/tracking/core/feature.js +14 -0
- package/dist/lib/tracking/core/feature.js.map +1 -0
- package/dist/lib/tracking/core/index.d.ts +4 -0
- package/dist/lib/tracking/core/index.js +5 -0
- package/dist/lib/tracking/core/index.js.map +1 -0
- package/dist/lib/tracking/core/prompt.d.ts +18 -0
- package/dist/lib/tracking/core/prompt.js +26 -0
- package/dist/lib/tracking/core/prompt.js.map +1 -0
- package/dist/lib/tracking/ecommerce/cart.d.ts +17 -0
- package/dist/lib/tracking/ecommerce/cart.js +22 -0
- package/dist/lib/tracking/ecommerce/cart.js.map +1 -0
- package/dist/lib/tracking/ecommerce/checkout.d.ts +17 -0
- package/dist/lib/tracking/ecommerce/checkout.js +22 -0
- package/dist/lib/tracking/ecommerce/checkout.js.map +1 -0
- package/dist/lib/tracking/ecommerce/index.d.ts +10 -0
- package/dist/lib/tracking/ecommerce/index.js +11 -0
- package/dist/lib/tracking/ecommerce/index.js.map +1 -0
- package/dist/lib/tracking/ecommerce/ltv.d.ts +15 -0
- package/dist/lib/tracking/ecommerce/ltv.js +14 -0
- package/dist/lib/tracking/ecommerce/ltv.js.map +1 -0
- package/dist/lib/tracking/ecommerce/products.d.ts +15 -0
- package/dist/lib/tracking/ecommerce/products.js +18 -0
- package/dist/lib/tracking/ecommerce/products.js.map +1 -0
- package/dist/lib/tracking/ecommerce/promotions.d.ts +14 -0
- package/dist/lib/tracking/ecommerce/promotions.js +25 -0
- package/dist/lib/tracking/ecommerce/promotions.js.map +1 -0
- package/dist/lib/tracking/ecommerce/purchases.d.ts +11 -0
- package/dist/lib/tracking/ecommerce/purchases.js +10 -0
- package/dist/lib/tracking/ecommerce/purchases.js.map +1 -0
- package/dist/lib/tracking/ecommerce/refunds.d.ts +17 -0
- package/dist/lib/tracking/ecommerce/refunds.js +22 -0
- package/dist/lib/tracking/ecommerce/refunds.js.map +1 -0
- package/dist/lib/tracking/ecommerce/search.d.ts +24 -0
- package/dist/lib/tracking/ecommerce/search.js +22 -0
- package/dist/lib/tracking/ecommerce/search.js.map +1 -0
- package/dist/lib/tracking/ecommerce/subscriptions.d.ts +21 -0
- package/dist/lib/tracking/ecommerce/subscriptions.js +38 -0
- package/dist/lib/tracking/ecommerce/subscriptions.js.map +1 -0
- package/dist/lib/tracking/ecommerce/wishlist.d.ts +19 -0
- package/dist/lib/tracking/ecommerce/wishlist.js +26 -0
- package/dist/lib/tracking/ecommerce/wishlist.js.map +1 -0
- package/dist/lib/tracking/enterprise/acquisition.d.ts +25 -0
- package/dist/lib/tracking/enterprise/acquisition.js +22 -0
- package/dist/lib/tracking/enterprise/acquisition.js.map +1 -0
- package/dist/lib/tracking/enterprise/alerts.d.ts +32 -0
- package/dist/lib/tracking/enterprise/alerts.js +30 -0
- package/dist/lib/tracking/enterprise/alerts.js.map +1 -0
- package/dist/lib/tracking/enterprise/churn.d.ts +23 -0
- package/dist/lib/tracking/enterprise/churn.js +22 -0
- package/dist/lib/tracking/enterprise/churn.js.map +1 -0
- package/dist/lib/tracking/enterprise/cohorts.d.ts +18 -0
- package/dist/lib/tracking/enterprise/cohorts.js +18 -0
- package/dist/lib/tracking/enterprise/cohorts.js.map +1 -0
- package/dist/lib/tracking/enterprise/engagement.d.ts +31 -0
- package/dist/lib/tracking/enterprise/engagement.js +44 -0
- package/dist/lib/tracking/enterprise/engagement.js.map +1 -0
- package/dist/lib/tracking/enterprise/forecasting.d.ts +18 -0
- package/dist/lib/tracking/enterprise/forecasting.js +22 -0
- package/dist/lib/tracking/enterprise/forecasting.js.map +1 -0
- package/dist/lib/tracking/enterprise/index.d.ts +11 -0
- package/dist/lib/tracking/enterprise/index.js +12 -0
- package/dist/lib/tracking/enterprise/index.js.map +1 -0
- package/dist/lib/tracking/enterprise/monetization.d.ts +14 -0
- package/dist/lib/tracking/enterprise/monetization.js +10 -0
- package/dist/lib/tracking/enterprise/monetization.js.map +1 -0
- package/dist/lib/tracking/enterprise/multi-path-funnels.d.ts +20 -0
- package/dist/lib/tracking/enterprise/multi-path-funnels.js +18 -0
- package/dist/lib/tracking/enterprise/multi-path-funnels.js.map +1 -0
- package/dist/lib/tracking/enterprise/paths.d.ts +20 -0
- package/dist/lib/tracking/enterprise/paths.js +18 -0
- package/dist/lib/tracking/enterprise/paths.js.map +1 -0
- package/dist/lib/tracking/enterprise/security.d.ts +28 -0
- package/dist/lib/tracking/enterprise/security.js +26 -0
- package/dist/lib/tracking/enterprise/security.js.map +1 -0
- package/dist/lib/tracking/enterprise/support.d.ts +25 -0
- package/dist/lib/tracking/enterprise/support.js +22 -0
- package/dist/lib/tracking/enterprise/support.js.map +1 -0
- package/dist/lib/tracking/index.d.ts +4 -0
- package/dist/lib/tracking/index.js +5 -0
- package/dist/lib/tracking/index.js.map +1 -0
- package/dist/lib/types/analytics.d.ts +10 -2
- package/dist/lib/types/analytics.js +6 -0
- package/dist/lib/types/analytics.js.map +1 -0
- package/dist/lib/types/common.js +6 -0
- package/dist/lib/types/common.js.map +1 -0
- package/dist/lib/types/ecommerce.js +6 -0
- package/dist/lib/types/ecommerce.js.map +1 -0
- package/dist/lib/types/index.js +8 -0
- package/dist/lib/types/index.js.map +1 -0
- package/dist/lib/utils/browser.d.ts +16 -0
- package/dist/lib/utils/browser.js +32 -0
- package/dist/lib/utils/browser.js.map +1 -0
- package/dist/lib/utils/identity.js +346 -0
- package/dist/lib/utils/identity.js.map +1 -0
- package/dist/lib/utils/storage.js +105 -0
- package/dist/lib/utils/storage.js.map +1 -0
- package/dist/umd/237.index.js +2 -0
- package/dist/umd/237.index.js.map +1 -0
- package/dist/umd/546.index.js +3 -0
- package/dist/umd/546.index.js.LICENSE.txt +14 -0
- package/dist/umd/546.index.js.map +1 -0
- package/dist/umd/index.js +2 -0
- package/dist/umd/index.js.map +1 -0
- package/package.json +27 -80
- package/dist/lib/features/ecommerce/inventory.d.ts +0 -219
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Ecommerce - Product Tracking
|
|
3
|
+
* @module features/ecommerce/products
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* Track product interactions including views, impressions, clicks,
|
|
7
|
+
* and product list interactions.
|
|
8
|
+
*
|
|
9
|
+
* @useCases
|
|
10
|
+
* - Track product page views
|
|
11
|
+
* - Measure product list/search impressions
|
|
12
|
+
* - Analyze product click-through rates
|
|
13
|
+
* - Monitor product detail engagement
|
|
14
|
+
* - Compare product performance
|
|
15
|
+
*
|
|
16
|
+
* @metrics
|
|
17
|
+
* - Product views
|
|
18
|
+
* - Product impressions
|
|
19
|
+
* - Click-through rate
|
|
20
|
+
* - View-to-cart rate
|
|
21
|
+
* - Revenue per product
|
|
22
|
+
*
|
|
23
|
+
* @chartData
|
|
24
|
+
* - Bar chart: Top products by views
|
|
25
|
+
* - Line chart: Product views over time
|
|
26
|
+
* - Table: Product performance comparison
|
|
27
|
+
* - Scatter: Price vs conversion rate
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const products = new Products(webId, endpoint, apiKey);
|
|
32
|
+
*
|
|
33
|
+
* // Track product view
|
|
34
|
+
* await products.view({
|
|
35
|
+
* productId: 'SKU-123',
|
|
36
|
+
* name: 'Premium Headphones',
|
|
37
|
+
* price: 299.99,
|
|
38
|
+
* currency: 'USD',
|
|
39
|
+
* category: 'Electronics/Audio'
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
import { FlowGridTransport } from "../../client/transport";
|
|
44
|
+
// ============================================================================
|
|
45
|
+
// PRODUCTS CLASS
|
|
46
|
+
// ============================================================================
|
|
47
|
+
/**
|
|
48
|
+
* Products - Track product interactions.
|
|
49
|
+
*
|
|
50
|
+
* @extends FlowGridTransport
|
|
51
|
+
*
|
|
52
|
+
* @description
|
|
53
|
+
* Provides product tracking capabilities including:
|
|
54
|
+
* - Product page views
|
|
55
|
+
* - Product list impressions
|
|
56
|
+
* - Product clicks from lists
|
|
57
|
+
* - Product detail interactions
|
|
58
|
+
* - Quick view tracking
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* const products = new Products(webId, endpoint, apiKey);
|
|
63
|
+
*
|
|
64
|
+
* // Track product page view
|
|
65
|
+
* await products.view({
|
|
66
|
+
* productId: 'PROD-001',
|
|
67
|
+
* name: 'Wireless Earbuds',
|
|
68
|
+
* price: 79.99,
|
|
69
|
+
* currency: 'USD',
|
|
70
|
+
* category: 'Electronics/Audio',
|
|
71
|
+
* brand: 'AudioTech'
|
|
72
|
+
* });
|
|
73
|
+
*
|
|
74
|
+
* // Track list impressions
|
|
75
|
+
* await products.impression({
|
|
76
|
+
* list: {
|
|
77
|
+
* listId: 'search-results',
|
|
78
|
+
* listName: 'Search Results',
|
|
79
|
+
* products: searchResults
|
|
80
|
+
* }
|
|
81
|
+
* });
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export class Products extends FlowGridTransport {
|
|
85
|
+
/**
|
|
86
|
+
* Tracks a product page view.
|
|
87
|
+
*
|
|
88
|
+
* @param config - Product view configuration
|
|
89
|
+
* @returns Promise resolving to product response
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* await products.view({
|
|
94
|
+
* productId: 'SKU-12345',
|
|
95
|
+
* name: 'Premium Widget',
|
|
96
|
+
* price: 49.99,
|
|
97
|
+
* currency: 'USD',
|
|
98
|
+
* category: 'Widgets/Premium',
|
|
99
|
+
* brand: 'WidgetCo',
|
|
100
|
+
* source: 'search',
|
|
101
|
+
* searchQuery: 'premium widget'
|
|
102
|
+
* });
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
async view(config) {
|
|
106
|
+
return await this.init("product_view", {
|
|
107
|
+
type: "ecommerce",
|
|
108
|
+
subtype: "product_view",
|
|
109
|
+
product: {
|
|
110
|
+
productId: config.productId,
|
|
111
|
+
name: config.name,
|
|
112
|
+
brand: config.brand,
|
|
113
|
+
category: config.category,
|
|
114
|
+
variant: config.variant,
|
|
115
|
+
price: config.price,
|
|
116
|
+
currency: config.currency,
|
|
117
|
+
url: config.url,
|
|
118
|
+
imageUrl: config.imageUrl,
|
|
119
|
+
rating: config.rating,
|
|
120
|
+
reviewCount: config.reviewCount,
|
|
121
|
+
stockStatus: config.stockStatus,
|
|
122
|
+
attributes: config.attributes
|
|
123
|
+
},
|
|
124
|
+
source: config.source,
|
|
125
|
+
searchQuery: config.searchQuery,
|
|
126
|
+
userId: config.userId,
|
|
127
|
+
sessionId: config.sessionId,
|
|
128
|
+
...config.properties,
|
|
129
|
+
timestamp: new Date().toISOString()
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Tracks product list impressions.
|
|
134
|
+
*
|
|
135
|
+
* @param config - Impression configuration
|
|
136
|
+
* @returns Promise resolving to impression response
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* // Track products shown in search results
|
|
141
|
+
* await products.impression({
|
|
142
|
+
* list: {
|
|
143
|
+
* listId: 'search-results',
|
|
144
|
+
* listName: 'Search Results',
|
|
145
|
+
* products: products.map((p, i) => ({ ...p, position: i + 1 }))
|
|
146
|
+
* }
|
|
147
|
+
* });
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
async impression(config) {
|
|
151
|
+
return await this.init("product_impression", {
|
|
152
|
+
type: "ecommerce",
|
|
153
|
+
subtype: "product_impression",
|
|
154
|
+
list: config.list,
|
|
155
|
+
productCount: config.list.products.length,
|
|
156
|
+
userId: config.userId,
|
|
157
|
+
sessionId: config.sessionId,
|
|
158
|
+
timestamp: new Date().toISOString()
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Tracks a product click from a list.
|
|
163
|
+
*
|
|
164
|
+
* @param config - Click configuration
|
|
165
|
+
* @returns Promise resolving to click response
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```typescript
|
|
169
|
+
* await products.click({
|
|
170
|
+
* product: selectedProduct,
|
|
171
|
+
* listId: 'homepage-featured',
|
|
172
|
+
* position: 3
|
|
173
|
+
* });
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
async click(config) {
|
|
177
|
+
return await this.init("product_click", {
|
|
178
|
+
type: "ecommerce",
|
|
179
|
+
subtype: "product_click",
|
|
180
|
+
product: config.product,
|
|
181
|
+
listId: config.listId,
|
|
182
|
+
position: config.position,
|
|
183
|
+
userId: config.userId,
|
|
184
|
+
timestamp: new Date().toISOString()
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Tracks a quick view interaction (modal product view).
|
|
189
|
+
*
|
|
190
|
+
* @param product - Product being quick-viewed
|
|
191
|
+
* @param listId - List where quick view was triggered
|
|
192
|
+
* @returns Promise resolving to quick view response
|
|
193
|
+
*/
|
|
194
|
+
async quickView(product, listId) {
|
|
195
|
+
return await this.init("product_quick_view", {
|
|
196
|
+
type: "ecommerce",
|
|
197
|
+
subtype: "product_quick_view",
|
|
198
|
+
product,
|
|
199
|
+
listId,
|
|
200
|
+
timestamp: new Date().toISOString()
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Tracks product detail interaction (zoom, read reviews, etc.).
|
|
205
|
+
*
|
|
206
|
+
* @param productId - Product identifier
|
|
207
|
+
* @param action - Interaction type
|
|
208
|
+
* @param properties - Additional properties
|
|
209
|
+
* @returns Promise resolving to interaction response
|
|
210
|
+
*/
|
|
211
|
+
async interaction(productId, action, properties) {
|
|
212
|
+
return await this.init("product_interaction", {
|
|
213
|
+
type: "ecommerce",
|
|
214
|
+
subtype: "product_interaction",
|
|
215
|
+
productId,
|
|
216
|
+
action,
|
|
217
|
+
...properties,
|
|
218
|
+
timestamp: new Date().toISOString()
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
export default Products;
|
|
223
|
+
//# sourceMappingURL=products.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../../../src/lib/features/ecommerce/products.ts"],"names":[],"mappings":"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"}
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
* ```
|
|
47
47
|
*/
|
|
48
48
|
import { FlowGridTransport } from "../../client/transport";
|
|
49
|
-
import { Promotion, MoneyValue,
|
|
49
|
+
import { Promotion, MoneyValue, TimeSeriesData } from "../../types";
|
|
50
50
|
/**
|
|
51
51
|
* Configuration for tracking promotion view.
|
|
52
52
|
*/
|
|
@@ -233,34 +233,5 @@ export declare class Promotions extends FlowGridTransport {
|
|
|
233
233
|
* @returns Promise resolving to attempt response
|
|
234
234
|
*/
|
|
235
235
|
couponAttempt(code: string, success: boolean, failureReason?: 'expired' | 'invalid' | 'minimum_not_met' | 'already_used' | 'not_applicable'): Promise<PromotionResponse>;
|
|
236
|
-
/**
|
|
237
|
-
* Retrieves promotion analytics for dashboards and charts.
|
|
238
|
-
*
|
|
239
|
-
* @param filter - Date range filter
|
|
240
|
-
* @returns Promise resolving to promotion analytics
|
|
241
|
-
*
|
|
242
|
-
* @example
|
|
243
|
-
* ```typescript
|
|
244
|
-
* const analytics = await promotions.getAnalytics({
|
|
245
|
-
* range: 'last30days'
|
|
246
|
-
* });
|
|
247
|
-
*
|
|
248
|
-
* // Bar chart - top promotions
|
|
249
|
-
* const topPromoChart = analytics.topPromotions.map(p => ({
|
|
250
|
-
* name: p.name,
|
|
251
|
-
* value: p.revenue
|
|
252
|
-
* }));
|
|
253
|
-
*
|
|
254
|
-
* // Table - coupon performance
|
|
255
|
-
* const couponTable = analytics.coupons;
|
|
256
|
-
*
|
|
257
|
-
* // Pie chart - promoted vs non-promoted revenue
|
|
258
|
-
* const revenuePie = [
|
|
259
|
-
* { name: 'Promoted', value: analytics.revenueImpact.promotedRevenue.amount },
|
|
260
|
-
* { name: 'Non-Promoted', value: analytics.revenueImpact.nonPromotedRevenue.amount }
|
|
261
|
-
* ];
|
|
262
|
-
* ```
|
|
263
|
-
*/
|
|
264
|
-
getAnalytics(filter?: DateRangeFilter): Promise<PromotionAnalyticsData>;
|
|
265
236
|
}
|
|
266
237
|
export default Promotions;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Ecommerce - Promotion Tracking
|
|
3
|
+
* @module features/ecommerce/promotions
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* Track promotional content, coupon usage, and discount
|
|
7
|
+
* effectiveness across your ecommerce store.
|
|
8
|
+
*
|
|
9
|
+
* @useCases
|
|
10
|
+
* - Track promotional banner views
|
|
11
|
+
* - Measure promotion click-through rates
|
|
12
|
+
* - Analyze coupon usage and effectiveness
|
|
13
|
+
* - Monitor discount impact on revenue
|
|
14
|
+
* - Compare promotion performance
|
|
15
|
+
*
|
|
16
|
+
* @metrics
|
|
17
|
+
* - Promotion impressions
|
|
18
|
+
* - Promotion CTR
|
|
19
|
+
* - Coupon redemption rate
|
|
20
|
+
* - Revenue attributed to promotions
|
|
21
|
+
* - Discount impact on margins
|
|
22
|
+
*
|
|
23
|
+
* @chartData
|
|
24
|
+
* - Bar chart: Top promotions by revenue
|
|
25
|
+
* - Line chart: Coupon usage over time
|
|
26
|
+
* - Table: Promotion performance comparison
|
|
27
|
+
* - Pie chart: Revenue by promotion type
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const promotions = new Promotions(webId, endpoint, apiKey);
|
|
32
|
+
*
|
|
33
|
+
* // Track promotion view
|
|
34
|
+
* await promotions.view({
|
|
35
|
+
* promotionId: 'PROMO-SUMMER',
|
|
36
|
+
* name: 'Summer Sale 20% Off',
|
|
37
|
+
* creative: 'homepage-banner'
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* // Track coupon usage
|
|
41
|
+
* await promotions.couponUsed({
|
|
42
|
+
* code: 'SAVE20',
|
|
43
|
+
* discountValue: 20,
|
|
44
|
+
* orderId: 'ORD-123'
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
import { FlowGridTransport } from "../../client/transport";
|
|
49
|
+
// ============================================================================
|
|
50
|
+
// PROMOTIONS CLASS
|
|
51
|
+
// ============================================================================
|
|
52
|
+
/**
|
|
53
|
+
* Promotions - Track promotions and coupons.
|
|
54
|
+
*
|
|
55
|
+
* @extends FlowGridTransport
|
|
56
|
+
*
|
|
57
|
+
* @description
|
|
58
|
+
* Provides promotion tracking capabilities including:
|
|
59
|
+
* - Promotion/banner impressions
|
|
60
|
+
* - Promotion clicks
|
|
61
|
+
* - Coupon applications
|
|
62
|
+
* - Coupon success/failure
|
|
63
|
+
* - Revenue attribution
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* const promotions = new Promotions(webId, endpoint, apiKey);
|
|
68
|
+
*
|
|
69
|
+
* // Track banner impression
|
|
70
|
+
* await promotions.view({
|
|
71
|
+
* promotionId: 'FLASH-SALE',
|
|
72
|
+
* name: 'Flash Sale - 30% Off',
|
|
73
|
+
* creative: 'hero-banner',
|
|
74
|
+
* position: 'homepage-top'
|
|
75
|
+
* });
|
|
76
|
+
*
|
|
77
|
+
* // Track banner click
|
|
78
|
+
* await promotions.click({
|
|
79
|
+
* promotionId: 'FLASH-SALE',
|
|
80
|
+
* name: 'Flash Sale - 30% Off',
|
|
81
|
+
* destinationUrl: '/sale'
|
|
82
|
+
* });
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export class Promotions extends FlowGridTransport {
|
|
86
|
+
/**
|
|
87
|
+
* Tracks promotion view/impression.
|
|
88
|
+
*
|
|
89
|
+
* @param config - Promotion view configuration
|
|
90
|
+
* @returns Promise resolving to promotion response
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* await promotions.view({
|
|
95
|
+
* promotionId: 'SUMMER-2026',
|
|
96
|
+
* name: 'Summer Collection Launch',
|
|
97
|
+
* creative: 'collection-banner',
|
|
98
|
+
* position: 'homepage-hero',
|
|
99
|
+
* page: '/home'
|
|
100
|
+
* });
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
async view(config) {
|
|
104
|
+
return await this.init("promotion_view", {
|
|
105
|
+
type: "ecommerce",
|
|
106
|
+
subtype: "promotion_view",
|
|
107
|
+
promotionId: config.promotionId,
|
|
108
|
+
name: config.name,
|
|
109
|
+
creative: config.creative,
|
|
110
|
+
position: config.position,
|
|
111
|
+
page: config.page,
|
|
112
|
+
userId: config.userId,
|
|
113
|
+
timestamp: new Date().toISOString()
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Tracks promotion click.
|
|
118
|
+
*
|
|
119
|
+
* @param config - Promotion click configuration
|
|
120
|
+
* @returns Promise resolving to promotion response
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```typescript
|
|
124
|
+
* await promotions.click({
|
|
125
|
+
* promotionId: 'SUMMER-2026',
|
|
126
|
+
* name: 'Summer Collection Launch',
|
|
127
|
+
* destinationUrl: '/collections/summer-2026'
|
|
128
|
+
* });
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
async click(config) {
|
|
132
|
+
return await this.init("promotion_click", {
|
|
133
|
+
type: "ecommerce",
|
|
134
|
+
subtype: "promotion_click",
|
|
135
|
+
promotionId: config.promotionId,
|
|
136
|
+
name: config.name,
|
|
137
|
+
creative: config.creative,
|
|
138
|
+
position: config.position,
|
|
139
|
+
destinationUrl: config.destinationUrl,
|
|
140
|
+
userId: config.userId,
|
|
141
|
+
timestamp: new Date().toISOString()
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Tracks successful coupon usage.
|
|
146
|
+
*
|
|
147
|
+
* @param config - Coupon usage configuration
|
|
148
|
+
* @returns Promise resolving to coupon response
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* await promotions.couponUsed({
|
|
153
|
+
* code: 'SAVE20',
|
|
154
|
+
* orderId: 'ORD-12345',
|
|
155
|
+
* discountValue: 20,
|
|
156
|
+
* discountType: 'percentage',
|
|
157
|
+
* orderValueBefore: 100,
|
|
158
|
+
* orderValueAfter: 80
|
|
159
|
+
* });
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
async couponUsed(config) {
|
|
163
|
+
return await this.init("coupon_used", {
|
|
164
|
+
type: "ecommerce",
|
|
165
|
+
subtype: "coupon_used",
|
|
166
|
+
code: config.code,
|
|
167
|
+
orderId: config.orderId,
|
|
168
|
+
discountValue: config.discountValue,
|
|
169
|
+
discountType: config.discountType,
|
|
170
|
+
orderValueBefore: config.orderValueBefore,
|
|
171
|
+
orderValueAfter: config.orderValueAfter,
|
|
172
|
+
savings: config.orderValueBefore - config.orderValueAfter,
|
|
173
|
+
userId: config.userId,
|
|
174
|
+
timestamp: new Date().toISOString()
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Tracks coupon application attempt (including failures).
|
|
179
|
+
*
|
|
180
|
+
* @param code - Coupon code attempted
|
|
181
|
+
* @param success - Whether coupon was valid
|
|
182
|
+
* @param failureReason - Reason for failure (if failed)
|
|
183
|
+
* @returns Promise resolving to attempt response
|
|
184
|
+
*/
|
|
185
|
+
async couponAttempt(code, success, failureReason) {
|
|
186
|
+
return await this.init("coupon_attempt", {
|
|
187
|
+
type: "ecommerce",
|
|
188
|
+
subtype: "coupon_attempt",
|
|
189
|
+
code,
|
|
190
|
+
success,
|
|
191
|
+
failureReason,
|
|
192
|
+
timestamp: new Date().toISOString()
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
export default Promotions;
|
|
197
|
+
//# sourceMappingURL=promotions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promotions.js","sourceRoot":"","sources":["../../../../src/lib/features/ecommerce/promotions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AA2G3D,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,OAAO,UAAW,SAAQ,iBAAiB;IAC/C;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,IAAI,CAAC,MAA2B;QACpC,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;YACvC,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,gBAAgB;YACzB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,KAAK,CAAC,MAA4B;QACtC,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE;YACxC,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,iBAAiB;YAC1B,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,UAAU,CAAC,MAAyB;QACxC,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;YACpC,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,aAAa;YACtB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;YACzC,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,OAAO,EAAE,MAAM,CAAC,gBAAgB,GAAG,MAAM,CAAC,eAAe;YACzD,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,aAAa,CACjB,IAAY,EACZ,OAAgB,EAChB,aAA6F;QAE7F,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;YACvC,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,gBAAgB;YACzB,IAAI;YACJ,OAAO;YACP,aAAa;YACb,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;CAEF;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
* ```
|
|
43
43
|
*/
|
|
44
44
|
import { FlowGridTransport } from "../../client/transport";
|
|
45
|
-
import { Order, ShippingInfo, MoneyValue,
|
|
45
|
+
import { Order, ShippingInfo, MoneyValue, TimeSeriesData } from "../../types";
|
|
46
46
|
/**
|
|
47
47
|
* Configuration for tracking a purchase.
|
|
48
48
|
*/
|
|
@@ -178,9 +178,6 @@ export interface RecentOrdersData {
|
|
|
178
178
|
* },
|
|
179
179
|
* userId: 'user_123'
|
|
180
180
|
* });
|
|
181
|
-
*
|
|
182
|
-
* // Get revenue analytics
|
|
183
|
-
* const revenue = await purchases.getRevenue({ range: 'thisMonth' });
|
|
184
181
|
* ```
|
|
185
182
|
*/
|
|
186
183
|
export declare class Purchases extends FlowGridTransport {
|
|
@@ -239,49 +236,5 @@ export declare class Purchases extends FlowGridTransport {
|
|
|
239
236
|
* @returns Promise resolving to delivered response
|
|
240
237
|
*/
|
|
241
238
|
delivered(orderId: string, deliveredAt?: string): Promise<PurchaseResponse>;
|
|
242
|
-
/**
|
|
243
|
-
* Retrieves revenue analytics for dashboards and charts.
|
|
244
|
-
*
|
|
245
|
-
* @param filter - Date range filter
|
|
246
|
-
* @returns Promise resolving to revenue analytics
|
|
247
|
-
*
|
|
248
|
-
* @example
|
|
249
|
-
* ```typescript
|
|
250
|
-
* const revenue = await purchases.getRevenue({
|
|
251
|
-
* range: 'last30days'
|
|
252
|
-
* });
|
|
253
|
-
*
|
|
254
|
-
* // KPI cards
|
|
255
|
-
* const kpis = [
|
|
256
|
-
* { label: 'Revenue', value: revenue.summary.totalRevenue.amount },
|
|
257
|
-
* { label: 'Orders', value: revenue.summary.totalOrders },
|
|
258
|
-
* { label: 'AOV', value: revenue.summary.averageOrderValue.amount }
|
|
259
|
-
* ];
|
|
260
|
-
*
|
|
261
|
-
* // Revenue chart
|
|
262
|
-
* const revenueChart = revenue.revenueTimeSeries.data;
|
|
263
|
-
*
|
|
264
|
-
* // Category breakdown
|
|
265
|
-
* const categoryPie = revenue.byCategory.map(c => ({
|
|
266
|
-
* name: c.category,
|
|
267
|
-
* value: c.revenue
|
|
268
|
-
* }));
|
|
269
|
-
* ```
|
|
270
|
-
*/
|
|
271
|
-
getRevenue(filter?: DateRangeFilter): Promise<RevenueAnalyticsData>;
|
|
272
|
-
/**
|
|
273
|
-
* Gets recent orders for display.
|
|
274
|
-
*
|
|
275
|
-
* @param pagination - Pagination options
|
|
276
|
-
* @returns Promise resolving to recent orders
|
|
277
|
-
*/
|
|
278
|
-
getRecentOrders(pagination?: PaginationParams): Promise<RecentOrdersData>;
|
|
279
|
-
/**
|
|
280
|
-
* Gets order details by ID.
|
|
281
|
-
*
|
|
282
|
-
* @param orderId - Order identifier
|
|
283
|
-
* @returns Promise resolving to order details
|
|
284
|
-
*/
|
|
285
|
-
getOrder(orderId: string): Promise<Order>;
|
|
286
239
|
}
|
|
287
240
|
export default Purchases;
|