flowgrid-sdk 1.2.0 → 1.3.0
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 +224 -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.d.ts +2 -2
- 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.d.ts +2 -2
- 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 @@
|
|
|
1
|
+
{"version":3,"file":"cart.js","sourceRoot":"","sources":["../../../../src/lib/features/ecommerce/cart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAyH3D,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,OAAO,YAAa,SAAQ,iBAAiB;IACjD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,KAAK,CAAC,OAAO,CAAC,MAAuB;QACnC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,MAAM,CAAC,QAAQ,GAAG,CAAC,MAAM,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AC;IACL,CAAC;CAEF;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
* ```
|
|
46
46
|
*/
|
|
47
47
|
import { FlowGridTransport } from "../../client/transport";
|
|
48
|
-
import { Cart, CheckoutStep, ShippingInfo, PaymentInfo,
|
|
48
|
+
import { Cart, CheckoutStep, ShippingInfo, PaymentInfo, TimeSeriesData } from "../../types";
|
|
49
49
|
/**
|
|
50
50
|
* Configuration for beginning checkout.
|
|
51
51
|
*/
|
|
@@ -293,32 +293,5 @@ export declare class Checkout extends FlowGridTransport {
|
|
|
293
293
|
* @returns Promise resolving to checkout response
|
|
294
294
|
*/
|
|
295
295
|
paymentAttempt(success: boolean, cart: Cart, payment: PaymentInfo, errorCode?: string): Promise<CheckoutResponse>;
|
|
296
|
-
/**
|
|
297
|
-
* Retrieves checkout analytics data for dashboards and charts.
|
|
298
|
-
*
|
|
299
|
-
* @param filter - Date range filter
|
|
300
|
-
* @returns Promise resolving to checkout analytics
|
|
301
|
-
*
|
|
302
|
-
* @example
|
|
303
|
-
* ```typescript
|
|
304
|
-
* const analytics = await checkout.getAnalytics({
|
|
305
|
-
* range: 'last30days'
|
|
306
|
-
* });
|
|
307
|
-
*
|
|
308
|
-
* // Funnel chart
|
|
309
|
-
* const funnelData = analytics.funnel.map(step => ({
|
|
310
|
-
* name: step.step,
|
|
311
|
-
* value: step.started,
|
|
312
|
-
* conversion: step.conversionRate
|
|
313
|
-
* }));
|
|
314
|
-
*
|
|
315
|
-
* // Pie chart - payment methods
|
|
316
|
-
* const paymentData = analytics.paymentMethods.map(p => ({
|
|
317
|
-
* name: p.method,
|
|
318
|
-
* value: p.count
|
|
319
|
-
* }));
|
|
320
|
-
* ```
|
|
321
|
-
*/
|
|
322
|
-
getAnalytics(filter?: DateRangeFilter): Promise<CheckoutAnalyticsData>;
|
|
323
296
|
}
|
|
324
297
|
export default Checkout;
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Ecommerce - Checkout Tracking
|
|
3
|
+
* @module features/ecommerce/checkout
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* Track checkout flow progress, payment attempts, and checkout
|
|
7
|
+
* optimization opportunities.
|
|
8
|
+
*
|
|
9
|
+
* @useCases
|
|
10
|
+
* - Track checkout step progression
|
|
11
|
+
* - Identify checkout drop-off points
|
|
12
|
+
* - Monitor payment success rates
|
|
13
|
+
* - Analyze shipping method preferences
|
|
14
|
+
* - Optimize checkout UX
|
|
15
|
+
*
|
|
16
|
+
* @metrics
|
|
17
|
+
* - Checkout initiation rate
|
|
18
|
+
* - Step completion rates
|
|
19
|
+
* - Payment success rate
|
|
20
|
+
* - Checkout abandonment rate
|
|
21
|
+
* - Average time to complete
|
|
22
|
+
*
|
|
23
|
+
* @chartData
|
|
24
|
+
* - Funnel chart: Checkout steps
|
|
25
|
+
* - Bar chart: Abandonment by step
|
|
26
|
+
* - Pie chart: Payment methods
|
|
27
|
+
* - Line chart: Checkout completions over time
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const checkout = new Checkout(webId, endpoint, apiKey);
|
|
32
|
+
*
|
|
33
|
+
* // Begin checkout
|
|
34
|
+
* await checkout.begin({
|
|
35
|
+
* cart: shoppingCart,
|
|
36
|
+
* userId: 'user_123'
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* // Track step progress
|
|
40
|
+
* await checkout.step({
|
|
41
|
+
* step: 'add_payment_info',
|
|
42
|
+
* stepNumber: 3,
|
|
43
|
+
* cart: shoppingCart
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
import { FlowGridTransport } from "../../client/transport";
|
|
48
|
+
// ============================================================================
|
|
49
|
+
// CHECKOUT CLASS
|
|
50
|
+
// ============================================================================
|
|
51
|
+
/**
|
|
52
|
+
* Checkout - Track checkout flow and payments.
|
|
53
|
+
*
|
|
54
|
+
* @extends FlowGridTransport
|
|
55
|
+
*
|
|
56
|
+
* @description
|
|
57
|
+
* Provides checkout tracking capabilities including:
|
|
58
|
+
* - Checkout initiation
|
|
59
|
+
* - Step-by-step progress
|
|
60
|
+
* - Shipping info capture
|
|
61
|
+
* - Payment info capture
|
|
62
|
+
* - Checkout abandonment
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* const checkout = new Checkout(webId, endpoint, apiKey);
|
|
67
|
+
*
|
|
68
|
+
* // Start checkout
|
|
69
|
+
* await checkout.begin({ cart: shoppingCart });
|
|
70
|
+
*
|
|
71
|
+
* // Track shipping step
|
|
72
|
+
* await checkout.addShipping({
|
|
73
|
+
* cart: shoppingCart,
|
|
74
|
+
* shipping: {
|
|
75
|
+
* method: 'express',
|
|
76
|
+
* carrier: 'FedEx',
|
|
77
|
+
* cost: 9.99
|
|
78
|
+
* }
|
|
79
|
+
* });
|
|
80
|
+
*
|
|
81
|
+
* // Track payment step
|
|
82
|
+
* await checkout.addPayment({
|
|
83
|
+
* cart: shoppingCart,
|
|
84
|
+
* payment: {
|
|
85
|
+
* method: 'credit_card',
|
|
86
|
+
* cardBrand: 'Visa'
|
|
87
|
+
* }
|
|
88
|
+
* });
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export class Checkout extends FlowGridTransport {
|
|
92
|
+
/**
|
|
93
|
+
* Tracks checkout initiation.
|
|
94
|
+
*
|
|
95
|
+
* @param config - Begin checkout configuration
|
|
96
|
+
* @returns Promise resolving to checkout response
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* await checkout.begin({
|
|
101
|
+
* cart: {
|
|
102
|
+
* cartId: 'cart_123',
|
|
103
|
+
* items: cartItems,
|
|
104
|
+
* total: 199.99,
|
|
105
|
+
* currency: 'USD',
|
|
106
|
+
* itemCount: 3
|
|
107
|
+
* }
|
|
108
|
+
* });
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
async begin(config) {
|
|
112
|
+
return await this.init("begin_checkout", {
|
|
113
|
+
type: "ecommerce",
|
|
114
|
+
subtype: "begin_checkout",
|
|
115
|
+
cart: config.cart,
|
|
116
|
+
cartValue: config.cart.total,
|
|
117
|
+
itemCount: config.cart.itemCount,
|
|
118
|
+
userId: config.userId,
|
|
119
|
+
sessionId: config.sessionId,
|
|
120
|
+
...config.properties,
|
|
121
|
+
timestamp: new Date().toISOString()
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Tracks checkout step progress.
|
|
126
|
+
*
|
|
127
|
+
* @param config - Checkout step configuration
|
|
128
|
+
* @returns Promise resolving to checkout response
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* await checkout.step({
|
|
133
|
+
* step: 'add_shipping_info',
|
|
134
|
+
* stepNumber: 2,
|
|
135
|
+
* cart: shoppingCart,
|
|
136
|
+
* option: 'express_shipping'
|
|
137
|
+
* });
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
async step(config) {
|
|
141
|
+
return await this.init("checkout_step", {
|
|
142
|
+
type: "ecommerce",
|
|
143
|
+
subtype: "checkout_step",
|
|
144
|
+
step: config.step,
|
|
145
|
+
stepNumber: config.stepNumber,
|
|
146
|
+
cart: config.cart,
|
|
147
|
+
option: config.option,
|
|
148
|
+
userId: config.userId,
|
|
149
|
+
timestamp: new Date().toISOString()
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Tracks adding shipping information.
|
|
154
|
+
*
|
|
155
|
+
* @param config - Shipping info configuration
|
|
156
|
+
* @returns Promise resolving to checkout response
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```typescript
|
|
160
|
+
* await checkout.addShipping({
|
|
161
|
+
* cart: shoppingCart,
|
|
162
|
+
* shipping: {
|
|
163
|
+
* method: 'standard',
|
|
164
|
+
* carrier: 'USPS',
|
|
165
|
+
* cost: 5.99,
|
|
166
|
+
* estimatedDelivery: '2026-02-07'
|
|
167
|
+
* }
|
|
168
|
+
* });
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
async addShipping(config) {
|
|
172
|
+
return await this.init("add_shipping_info", {
|
|
173
|
+
type: "ecommerce",
|
|
174
|
+
subtype: "shipping_info",
|
|
175
|
+
cart: config.cart,
|
|
176
|
+
shipping: config.shipping,
|
|
177
|
+
shippingMethod: config.shipping.method,
|
|
178
|
+
shippingCost: config.shipping.cost,
|
|
179
|
+
userId: config.userId,
|
|
180
|
+
timestamp: new Date().toISOString()
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Tracks adding payment information.
|
|
185
|
+
*
|
|
186
|
+
* @param config - Payment info configuration
|
|
187
|
+
* @returns Promise resolving to checkout response
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```typescript
|
|
191
|
+
* await checkout.addPayment({
|
|
192
|
+
* cart: shoppingCart,
|
|
193
|
+
* payment: {
|
|
194
|
+
* method: 'credit_card',
|
|
195
|
+
* provider: 'stripe',
|
|
196
|
+
* cardBrand: 'Mastercard',
|
|
197
|
+
* cardLast4: '4242'
|
|
198
|
+
* }
|
|
199
|
+
* });
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
async addPayment(config) {
|
|
203
|
+
return await this.init("add_payment_info", {
|
|
204
|
+
type: "ecommerce",
|
|
205
|
+
subtype: "payment_info",
|
|
206
|
+
cart: config.cart,
|
|
207
|
+
payment: config.payment,
|
|
208
|
+
paymentMethod: config.payment.method,
|
|
209
|
+
userId: config.userId,
|
|
210
|
+
timestamp: new Date().toISOString()
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Tracks checkout abandonment.
|
|
215
|
+
*
|
|
216
|
+
* @param cart - Cart at abandonment
|
|
217
|
+
* @param step - Last completed step
|
|
218
|
+
* @param reason - Abandonment reason (if known)
|
|
219
|
+
* @returns Promise resolving to checkout response
|
|
220
|
+
*/
|
|
221
|
+
async abandon(cart, step, reason) {
|
|
222
|
+
return await this.init("checkout_abandoned", {
|
|
223
|
+
type: "ecommerce",
|
|
224
|
+
subtype: "checkout_abandoned",
|
|
225
|
+
cart,
|
|
226
|
+
step,
|
|
227
|
+
cartValue: cart.total,
|
|
228
|
+
reason,
|
|
229
|
+
timestamp: new Date().toISOString()
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Tracks payment attempt (success or failure).
|
|
234
|
+
*
|
|
235
|
+
* @param success - Whether payment succeeded
|
|
236
|
+
* @param cart - Cart being paid for
|
|
237
|
+
* @param payment - Payment information
|
|
238
|
+
* @param errorCode - Error code (if failed)
|
|
239
|
+
* @returns Promise resolving to checkout response
|
|
240
|
+
*/
|
|
241
|
+
async paymentAttempt(success, cart, payment, errorCode) {
|
|
242
|
+
return await this.init("payment_attempt", {
|
|
243
|
+
type: "ecommerce",
|
|
244
|
+
subtype: "payment_attempt",
|
|
245
|
+
success,
|
|
246
|
+
cart,
|
|
247
|
+
payment,
|
|
248
|
+
errorCode,
|
|
249
|
+
timestamp: new Date().toISOString()
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
export default Checkout;
|
|
254
|
+
//# sourceMappingURL=checkout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkout.js","sourceRoot":"","sources":["../../../../src/lib/features/ecommerce/checkout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAiI3D,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,OAAO,QAAS,SAA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,CAAC,CAAC;IACL,CAAC;CAEF;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -11,7 +11,6 @@ export { Promotions } from './promotions';
|
|
|
11
11
|
export { WishlistTracking } from './wishlist';
|
|
12
12
|
export { CustomerLTV } from './ltv';
|
|
13
13
|
export { SearchAnalytics } from './search';
|
|
14
|
-
export { Inventory } from './inventory';
|
|
15
14
|
export { Subscriptions } from './subscriptions';
|
|
16
15
|
export type { ProductViewConfig, ProductImpressionConfig, ProductClickConfig, ProductResponse, ProductAnalyticsData } from './products';
|
|
17
16
|
export type { AddToCartConfig, RemoveFromCartConfig, UpdateCartItemConfig, ViewCartConfig, CartResponse, CartAnalyticsData } from './cart';
|
|
@@ -22,5 +21,4 @@ export type { PromotionViewConfig, PromotionClickConfig, CouponUsageConfig, Prom
|
|
|
22
21
|
export type { AddToWishlistConfig, RemoveFromWishlistConfig, WishlistResponse, WishlistAnalyticsData } from './wishlist';
|
|
23
22
|
export type { CustomerValueData, AcquisitionCostConfig, LTVResponse, LTVAnalyticsData } from './ltv';
|
|
24
23
|
export type { SearchConfig, SearchClickConfig, SearchResponse, SearchAnalyticsData } from './search';
|
|
25
|
-
export type { StockUpdateConfig, OutOfStockConfig, InventoryResponse, InventoryAnalyticsData } from './inventory';
|
|
26
24
|
export type { SubscriptionStartConfig, SubscriptionChangeConfig, SubscriptionCancelConfig, SubscriptionResponse, SubscriptionAnalyticsData } from './subscriptions';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Ecommerce features barrel export
|
|
3
|
+
* @module features/ecommerce
|
|
4
|
+
*/
|
|
5
|
+
export { Products } from './products';
|
|
6
|
+
export { CartTracking } from './cart';
|
|
7
|
+
export { Checkout } from './checkout';
|
|
8
|
+
export { Purchases } from './purchases';
|
|
9
|
+
export { Refunds } from './refunds';
|
|
10
|
+
export { Promotions } from './promotions';
|
|
11
|
+
export { WishlistTracking } from './wishlist';
|
|
12
|
+
export { CustomerLTV } from './ltv';
|
|
13
|
+
export { SearchAnalytics } from './search';
|
|
14
|
+
export { Subscriptions } from './subscriptions';
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/features/ecommerce/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -29,16 +29,10 @@
|
|
|
29
29
|
* @example
|
|
30
30
|
* ```typescript
|
|
31
31
|
* const ltv = new CustomerLTV(webId, endpoint, apiKey);
|
|
32
|
-
*
|
|
33
|
-
* // Get customer LTV
|
|
34
|
-
* const customerValue = await ltv.getCustomerValue('user_123');
|
|
35
|
-
*
|
|
36
|
-
* // Get LTV analytics
|
|
37
|
-
* const analytics = await ltv.getAnalytics({ range: 'last90days' });
|
|
38
32
|
* ```
|
|
39
33
|
*/
|
|
40
34
|
import { FlowGridTransport } from "../../client/transport";
|
|
41
|
-
import { MoneyValue,
|
|
35
|
+
import { MoneyValue, TimeSeriesData } from "../../types";
|
|
42
36
|
/**
|
|
43
37
|
* Customer value data.
|
|
44
38
|
*/
|
|
@@ -164,30 +158,9 @@ export interface LTVAnalyticsData {
|
|
|
164
158
|
* channel: 'facebook_ads',
|
|
165
159
|
* campaign: 'spring_campaign'
|
|
166
160
|
* });
|
|
167
|
-
*
|
|
168
|
-
* // Get LTV analytics
|
|
169
|
-
* const analytics = await ltv.getAnalytics();
|
|
170
|
-
* console.log(`LTV:CAC Ratio: ${analytics.summary.ltvCacRatio}`);
|
|
171
161
|
* ```
|
|
172
162
|
*/
|
|
173
163
|
export declare class CustomerLTV extends FlowGridTransport {
|
|
174
|
-
/**
|
|
175
|
-
* Gets lifetime value data for a specific customer.
|
|
176
|
-
*
|
|
177
|
-
* @param userId - Customer/user identifier
|
|
178
|
-
* @returns Promise resolving to customer value data
|
|
179
|
-
*
|
|
180
|
-
* @example
|
|
181
|
-
* ```typescript
|
|
182
|
-
* const value = await ltv.getCustomerValue('user_123');
|
|
183
|
-
*
|
|
184
|
-
* console.log(`Total Revenue: $${value.totalRevenue.amount / 100}`);
|
|
185
|
-
* console.log(`Orders: ${value.orderCount}`);
|
|
186
|
-
* console.log(`Segment: ${value.segment}`);
|
|
187
|
-
* console.log(`Predicted LTV: $${value.predictedLTV.amount / 100}`);
|
|
188
|
-
* ```
|
|
189
|
-
*/
|
|
190
|
-
getCustomerValue(userId: string): Promise<CustomerValueData>;
|
|
191
164
|
/**
|
|
192
165
|
* Records customer acquisition cost.
|
|
193
166
|
*
|
|
@@ -213,46 +186,5 @@ export declare class CustomerLTV extends FlowGridTransport {
|
|
|
213
186
|
* @returns Promise resolving to LTV response
|
|
214
187
|
*/
|
|
215
188
|
updateSegment(userId: string, segment: 'low' | 'medium' | 'high' | 'vip'): Promise<LTVResponse>;
|
|
216
|
-
/**
|
|
217
|
-
* Gets high-value customers.
|
|
218
|
-
*
|
|
219
|
-
* @param limit - Number of customers to return
|
|
220
|
-
* @returns Promise resolving to list of high-value customers
|
|
221
|
-
*/
|
|
222
|
-
getTopCustomers(limit?: number): Promise<CustomerValueData[]>;
|
|
223
|
-
/**
|
|
224
|
-
* Retrieves LTV analytics for dashboards and charts.
|
|
225
|
-
*
|
|
226
|
-
* @param filter - Date range filter
|
|
227
|
-
* @returns Promise resolving to LTV analytics
|
|
228
|
-
*
|
|
229
|
-
* @example
|
|
230
|
-
* ```typescript
|
|
231
|
-
* const analytics = await ltv.getAnalytics({
|
|
232
|
-
* range: 'last90days'
|
|
233
|
-
* });
|
|
234
|
-
*
|
|
235
|
-
* // KPI cards
|
|
236
|
-
* const kpis = [
|
|
237
|
-
* { label: 'Avg LTV', value: analytics.summary.averageLTV.amount },
|
|
238
|
-
* { label: 'LTV:CAC', value: analytics.summary.ltvCacRatio },
|
|
239
|
-
* { label: 'Avg AOV', value: analytics.summary.averageOrderValue.amount }
|
|
240
|
-
* ];
|
|
241
|
-
*
|
|
242
|
-
* // Bar chart - LTV by channel
|
|
243
|
-
* const channelChart = analytics.byChannel.map(c => ({
|
|
244
|
-
* name: c.channel,
|
|
245
|
-
* ltv: c.averageLTV.amount,
|
|
246
|
-
* cac: c.averageCAC.amount
|
|
247
|
-
* }));
|
|
248
|
-
*
|
|
249
|
-
* // Histogram - value distribution
|
|
250
|
-
* const distribution = analytics.distribution.map(d => ({
|
|
251
|
-
* range: d.range,
|
|
252
|
-
* count: d.count
|
|
253
|
-
* }));
|
|
254
|
-
* ```
|
|
255
|
-
*/
|
|
256
|
-
getAnalytics(filter?: DateRangeFilter): Promise<LTVAnalyticsData>;
|
|
257
189
|
}
|
|
258
190
|
export default CustomerLTV;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Ecommerce - Customer Lifetime Value (LTV)
|
|
3
|
+
* @module features/ecommerce/ltv
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* Calculate and track customer lifetime value to understand
|
|
7
|
+
* customer worth and optimize acquisition costs.
|
|
8
|
+
*
|
|
9
|
+
* @useCases
|
|
10
|
+
* - Calculate customer LTV
|
|
11
|
+
* - Segment customers by value
|
|
12
|
+
* - Track LTV trends over time
|
|
13
|
+
* - Identify high-value customers
|
|
14
|
+
* - Optimize acquisition spend (LTV:CAC)
|
|
15
|
+
*
|
|
16
|
+
* @metrics
|
|
17
|
+
* - Average LTV
|
|
18
|
+
* - LTV by cohort
|
|
19
|
+
* - LTV by segment
|
|
20
|
+
* - LTV:CAC ratio
|
|
21
|
+
* - Customer value distribution
|
|
22
|
+
*
|
|
23
|
+
* @chartData
|
|
24
|
+
* - Line chart: LTV by cohort over time
|
|
25
|
+
* - Bar chart: LTV by segment
|
|
26
|
+
* - Histogram: Customer value distribution
|
|
27
|
+
* - KPI: Average LTV, LTV:CAC
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const ltv = new CustomerLTV(webId, endpoint, apiKey);
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
import { FlowGridTransport } from "../../client/transport";
|
|
35
|
+
// ============================================================================
|
|
36
|
+
// CUSTOMER LTV CLASS
|
|
37
|
+
// ============================================================================
|
|
38
|
+
/**
|
|
39
|
+
* CustomerLTV - Calculate and track customer lifetime value.
|
|
40
|
+
*
|
|
41
|
+
* @extends FlowGridTransport
|
|
42
|
+
*
|
|
43
|
+
* @description
|
|
44
|
+
* Provides LTV tracking capabilities including:
|
|
45
|
+
* - Customer value calculation
|
|
46
|
+
* - Acquisition cost tracking
|
|
47
|
+
* - LTV:CAC ratio analysis
|
|
48
|
+
* - Customer segmentation by value
|
|
49
|
+
* - Cohort-based LTV analysis
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const ltv = new CustomerLTV(webId, endpoint, apiKey);
|
|
54
|
+
*
|
|
55
|
+
* // Get individual customer value
|
|
56
|
+
* const value = await ltv.getCustomerValue('user_123');
|
|
57
|
+
* console.log(`LTV: $${value.totalRevenue.amount / 100}`);
|
|
58
|
+
*
|
|
59
|
+
* // Record acquisition cost
|
|
60
|
+
* await ltv.recordAcquisitionCost({
|
|
61
|
+
* userId: 'user_123',
|
|
62
|
+
* cost: { amount: 5000, currency: 'USD' },
|
|
63
|
+
* channel: 'facebook_ads',
|
|
64
|
+
* campaign: 'spring_campaign'
|
|
65
|
+
* });
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export class CustomerLTV extends FlowGridTransport {
|
|
69
|
+
/**
|
|
70
|
+
* Records customer acquisition cost.
|
|
71
|
+
*
|
|
72
|
+
* @param config - Acquisition cost configuration
|
|
73
|
+
* @returns Promise resolving to LTV response
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* await ltv.recordAcquisitionCost({
|
|
78
|
+
* userId: 'user_123',
|
|
79
|
+
* cost: { amount: 2500, currency: 'USD' }, // $25.00
|
|
80
|
+
* channel: 'google_ads',
|
|
81
|
+
* campaign: 'brand_terms'
|
|
82
|
+
* });
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
async recordAcquisitionCost(config) {
|
|
86
|
+
return await this.init("record_acquisition_cost", {
|
|
87
|
+
type: "ecommerce",
|
|
88
|
+
subtype: "acquisition_cost",
|
|
89
|
+
userId: config.userId,
|
|
90
|
+
cost: config.cost,
|
|
91
|
+
channel: config.channel,
|
|
92
|
+
campaign: config.campaign,
|
|
93
|
+
timestamp: new Date().toISOString()
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Updates customer segment based on value.
|
|
98
|
+
*
|
|
99
|
+
* @param userId - Customer/user identifier
|
|
100
|
+
* @param segment - New segment
|
|
101
|
+
* @returns Promise resolving to LTV response
|
|
102
|
+
*/
|
|
103
|
+
async updateSegment(userId, segment) {
|
|
104
|
+
return await this.init("update_customer_segment", {
|
|
105
|
+
type: "ecommerce",
|
|
106
|
+
subtype: "update_customer_segment",
|
|
107
|
+
userId,
|
|
108
|
+
segment,
|
|
109
|
+
timestamp: new Date().toISOString()
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
export default CustomerLTV;
|
|
114
|
+
//# sourceMappingURL=ltv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ltv.js","sourceRoot":"","sources":["../../../../src/lib/features/ecommerce/ltv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAiH3D,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IAChD;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,qBAAqB,CAAC,MAA6B;QACvD,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,yBAAyB,EAAE;YAChD,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,kBAAkB;YAC3B,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,aAAa,CACjB,MAAc,EACd,OAA0C;QAE1C,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,yBAAyB,EAAE;YAChD,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,yBAAyB;YAClC,MAAM;YACN,OAAO;YACP,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;CAEF;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
43
|
import { FlowGridTransport } from "../../client/transport";
|
|
44
|
-
import { Product, ProductList, ProductPerformance,
|
|
44
|
+
import { Product, ProductList, ProductPerformance, TimeSeriesData } from "../../types";
|
|
45
45
|
/**
|
|
46
46
|
* Configuration for tracking a product view.
|
|
47
47
|
*/
|
|
@@ -232,37 +232,5 @@ export declare class Products extends FlowGridTransport {
|
|
|
232
232
|
* @returns Promise resolving to interaction response
|
|
233
233
|
*/
|
|
234
234
|
interaction(productId: string, action: 'zoom' | 'read_reviews' | 'size_guide' | 'compare' | 'share' | 'notify_stock', properties?: Record<string, unknown>): Promise<ProductResponse>;
|
|
235
|
-
/**
|
|
236
|
-
* Retrieves product analytics data for dashboards and charts.
|
|
237
|
-
*
|
|
238
|
-
* @param filter - Date range filter
|
|
239
|
-
* @param pagination - Pagination options
|
|
240
|
-
* @returns Promise resolving to product analytics
|
|
241
|
-
*
|
|
242
|
-
* @example
|
|
243
|
-
* ```typescript
|
|
244
|
-
* const analytics = await products.getAnalytics({
|
|
245
|
-
* range: 'last30days'
|
|
246
|
-
* });
|
|
247
|
-
*
|
|
248
|
-
* // Bar chart - top products by views
|
|
249
|
-
* const topByViews = analytics.topProducts.byViews.map(p => ({
|
|
250
|
-
* name: p.product.name,
|
|
251
|
-
* value: p.views
|
|
252
|
-
* }));
|
|
253
|
-
*
|
|
254
|
-
* // Line chart - views over time
|
|
255
|
-
* const viewsTrend = analytics.viewsTimeSeries.data;
|
|
256
|
-
* ```
|
|
257
|
-
*/
|
|
258
|
-
getAnalytics(filter?: DateRangeFilter, pagination?: PaginationParams): Promise<ProductAnalyticsData>;
|
|
259
|
-
/**
|
|
260
|
-
* Gets performance data for a specific product.
|
|
261
|
-
*
|
|
262
|
-
* @param productId - Product identifier
|
|
263
|
-
* @param filter - Date range filter
|
|
264
|
-
* @returns Promise resolving to product performance
|
|
265
|
-
*/
|
|
266
|
-
getProductPerformance(productId: string, filter?: DateRangeFilter): Promise<ProductPerformance>;
|
|
267
235
|
}
|
|
268
236
|
export default Products;
|