@tagadapay/headless-sdk 1.16.0 → 1.18.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.
Files changed (157) hide show
  1. package/README.md +22 -0
  2. package/dist/core/client.d.ts +5 -0
  3. package/dist/core/client.d.ts.map +1 -1
  4. package/dist/core/client.js +6 -1
  5. package/dist/core/client.js.map +1 -1
  6. package/dist/core/http.d.ts +2 -0
  7. package/dist/core/http.d.ts.map +1 -1
  8. package/dist/core/http.js +21 -5
  9. package/dist/core/http.js.map +1 -1
  10. package/dist/core/index.d.ts +4 -0
  11. package/dist/core/index.d.ts.map +1 -1
  12. package/dist/core/index.js +2 -0
  13. package/dist/core/index.js.map +1 -1
  14. package/dist/core/modules/checkout.d.ts.map +1 -1
  15. package/dist/core/modules/checkout.js +12 -0
  16. package/dist/core/modules/checkout.js.map +1 -1
  17. package/dist/core/modules/commerce.d.ts +4 -0
  18. package/dist/core/modules/commerce.d.ts.map +1 -0
  19. package/dist/core/modules/commerce.js +5 -0
  20. package/dist/core/modules/commerce.js.map +1 -0
  21. package/dist/core/modules/customer.d.ts +73 -5
  22. package/dist/core/modules/customer.d.ts.map +1 -1
  23. package/dist/core/modules/customer.js +110 -19
  24. package/dist/core/modules/customer.js.map +1 -1
  25. package/dist/core/modules/experiments.d.ts +21 -0
  26. package/dist/core/modules/experiments.d.ts.map +1 -0
  27. package/dist/core/modules/experiments.js +85 -0
  28. package/dist/core/modules/experiments.js.map +1 -0
  29. package/dist/core/modules/funnel.d.ts +2 -1
  30. package/dist/core/modules/funnel.d.ts.map +1 -1
  31. package/dist/core/modules/funnel.js +6 -1
  32. package/dist/core/modules/funnel.js.map +1 -1
  33. package/dist/core/modules/lazyCommerce.d.ts +16 -0
  34. package/dist/core/modules/lazyCommerce.d.ts.map +1 -0
  35. package/dist/core/modules/lazyCommerce.js +20 -0
  36. package/dist/core/modules/lazyCommerce.js.map +1 -0
  37. package/dist/core/modules/offers.d.ts +30 -5
  38. package/dist/core/modules/offers.d.ts.map +1 -1
  39. package/dist/core/modules/offers.js +66 -7
  40. package/dist/core/modules/offers.js.map +1 -1
  41. package/dist/core/modules/portal/index.d.ts +102 -0
  42. package/dist/core/modules/portal/index.d.ts.map +1 -0
  43. package/dist/core/modules/portal/index.js +166 -0
  44. package/dist/core/modules/portal/index.js.map +1 -0
  45. package/dist/core/modules/portal/types.d.ts +617 -0
  46. package/dist/core/modules/portal/types.d.ts.map +1 -0
  47. package/dist/core/modules/portal/types.js +11 -0
  48. package/dist/core/modules/portal/types.js.map +1 -0
  49. package/dist/core/modules/track.d.ts +8 -0
  50. package/dist/core/modules/track.d.ts.map +1 -1
  51. package/dist/core/modules/track.js +49 -8
  52. package/dist/core/modules/track.js.map +1 -1
  53. package/dist/core/types.d.ts +11 -0
  54. package/dist/core/types.d.ts.map +1 -1
  55. package/dist/core/types.js +0 -3
  56. package/dist/core/types.js.map +1 -1
  57. package/dist/core/version.d.ts +1 -1
  58. package/dist/core/version.js +1 -1
  59. package/dist/pixels/pixelTracker.d.ts.map +1 -1
  60. package/dist/pixels/pixelTracker.js +4 -2
  61. package/dist/pixels/pixelTracker.js.map +1 -1
  62. package/dist/react/index.d.ts +1 -1
  63. package/dist/react/index.d.ts.map +1 -1
  64. package/dist/react/provider.d.ts +13 -2
  65. package/dist/react/provider.d.ts.map +1 -1
  66. package/dist/react/provider.js +35 -7
  67. package/dist/react/provider.js.map +1 -1
  68. package/dist/tagada-headless-commerce.min.js +8 -0
  69. package/dist/tagada-headless-commerce.min.js.map +7 -0
  70. package/dist/tagada-headless-react.min.js +2 -2
  71. package/dist/tagada-headless-react.min.js.map +4 -4
  72. package/dist/tagada-headless.js +299 -288
  73. package/dist/tagada-headless.min.js +2 -2
  74. package/dist/tagada-headless.min.js.map +4 -4
  75. package/dist/tagada-pixels.min.js +2 -2
  76. package/dist/tagada-pixels.min.js.map +3 -3
  77. package/dist/tgd/contract/attribution.d.ts +28 -0
  78. package/dist/tgd/contract/attribution.d.ts.map +1 -0
  79. package/dist/tgd/contract/attribution.js +44 -0
  80. package/dist/tgd/contract/attribution.js.map +1 -0
  81. package/dist/tgd/contract/browser-api.d.ts +57 -0
  82. package/dist/tgd/contract/browser-api.d.ts.map +1 -0
  83. package/dist/tgd/contract/browser-api.js +2 -0
  84. package/dist/tgd/contract/browser-api.js.map +1 -0
  85. package/dist/tgd/contract/canvas.d.ts +120 -0
  86. package/dist/tgd/contract/canvas.d.ts.map +1 -0
  87. package/dist/tgd/contract/canvas.js +12 -0
  88. package/dist/tgd/contract/canvas.js.map +1 -0
  89. package/dist/tgd/contract/dedup-keys.d.ts +24 -0
  90. package/dist/tgd/contract/dedup-keys.d.ts.map +1 -0
  91. package/dist/tgd/contract/dedup-keys.js +23 -0
  92. package/dist/tgd/contract/dedup-keys.js.map +1 -0
  93. package/dist/tgd/contract/destination-names.d.ts +4 -0
  94. package/dist/tgd/contract/destination-names.d.ts.map +1 -0
  95. package/dist/tgd/contract/destination-names.js +66 -0
  96. package/dist/tgd/contract/destination-names.js.map +1 -0
  97. package/dist/tgd/contract/destinations.d.ts +124 -0
  98. package/dist/tgd/contract/destinations.d.ts.map +1 -0
  99. package/dist/tgd/contract/destinations.js +63 -0
  100. package/dist/tgd/contract/destinations.js.map +1 -0
  101. package/dist/tgd/contract/envelope.d.ts +203 -0
  102. package/dist/tgd/contract/envelope.d.ts.map +1 -0
  103. package/dist/tgd/contract/envelope.js +103 -0
  104. package/dist/tgd/contract/envelope.js.map +1 -0
  105. package/dist/tgd/contract/experiments.d.ts +87 -0
  106. package/dist/tgd/contract/experiments.d.ts.map +1 -0
  107. package/dist/tgd/contract/experiments.js +2 -0
  108. package/dist/tgd/contract/experiments.js.map +1 -0
  109. package/dist/tgd/contract/index.d.ts +20 -0
  110. package/dist/tgd/contract/index.d.ts.map +1 -0
  111. package/dist/tgd/contract/index.js +20 -0
  112. package/dist/tgd/contract/index.js.map +1 -0
  113. package/dist/tgd/contract/is-test.d.ts +2 -0
  114. package/dist/tgd/contract/is-test.d.ts.map +1 -0
  115. package/dist/tgd/contract/is-test.js +3 -0
  116. package/dist/tgd/contract/is-test.js.map +1 -0
  117. package/dist/tgd/contract/junk-ids.d.ts +4 -0
  118. package/dist/tgd/contract/junk-ids.d.ts.map +1 -0
  119. package/dist/tgd/contract/junk-ids.js +7 -0
  120. package/dist/tgd/contract/junk-ids.js.map +1 -0
  121. package/dist/tgd/contract/limits.d.ts +19 -0
  122. package/dist/tgd/contract/limits.d.ts.map +1 -0
  123. package/dist/tgd/contract/limits.js +20 -0
  124. package/dist/tgd/contract/limits.js.map +1 -0
  125. package/dist/tgd/contract/names.d.ts +13 -0
  126. package/dist/tgd/contract/names.d.ts.map +1 -0
  127. package/dist/tgd/contract/names.js +15 -0
  128. package/dist/tgd/contract/names.js.map +1 -0
  129. package/dist/tgd/contract/registry.d.ts +116 -0
  130. package/dist/tgd/contract/registry.d.ts.map +1 -0
  131. package/dist/tgd/contract/registry.js +59 -0
  132. package/dist/tgd/contract/registry.js.map +1 -0
  133. package/dist/tgd/contract/signed-ids.d.ts +33 -0
  134. package/dist/tgd/contract/signed-ids.d.ts.map +1 -0
  135. package/dist/tgd/contract/signed-ids.js +26 -0
  136. package/dist/tgd/contract/signed-ids.js.map +1 -0
  137. package/dist/tgd/contract/snapshots.d.ts +69 -0
  138. package/dist/tgd/contract/snapshots.d.ts.map +1 -0
  139. package/dist/tgd/contract/snapshots.js +2 -0
  140. package/dist/tgd/contract/snapshots.js.map +1 -0
  141. package/dist/tgd/contract/time.d.ts +9 -0
  142. package/dist/tgd/contract/time.d.ts.map +1 -0
  143. package/dist/tgd/contract/time.js +9 -0
  144. package/dist/tgd/contract/time.js.map +1 -0
  145. package/dist/tgd/contract/unions.d.ts +21 -0
  146. package/dist/tgd/contract/unions.d.ts.map +1 -0
  147. package/dist/tgd/contract/unions.js +17 -0
  148. package/dist/tgd/contract/unions.js.map +1 -0
  149. package/dist/tgd/contract/unit.d.ts +12 -0
  150. package/dist/tgd/contract/unit.d.ts.map +1 -0
  151. package/dist/tgd/contract/unit.js +18 -0
  152. package/dist/tgd/contract/unit.js.map +1 -0
  153. package/dist/tgd/contract/wire.d.ts +59 -0
  154. package/dist/tgd/contract/wire.d.ts.map +1 -0
  155. package/dist/tgd/contract/wire.js +2 -0
  156. package/dist/tgd/contract/wire.js.map +1 -0
  157. package/package.json +6 -3
@@ -0,0 +1,28 @@
1
+ /** The 12 channels a merchant sees. Order = display order. */
2
+ export declare const VISIBLE_CHANNELS: readonly ["direct", "organic_search", "paid_search", "organic_social", "paid_social", "email", "sms", "affiliate", "referral", "ai", "display", "other"];
3
+ export type VisibleChannel = (typeof VISIBLE_CHANNELS)[number];
4
+ /** Channels whose touches can carry ad spend and count as "paid" for the last-paid-touch shortcut. */
5
+ export declare const PAID_CHANNELS: readonly VisibleChannel[];
6
+ export declare const ATTRIBUTION_MODELS: readonly ["first_touch", "last_touch", "last_non_direct", "linear", "position_based", "time_decay"];
7
+ export type AttributionModel = (typeof ATTRIBUTION_MODELS)[number];
8
+ export declare const DEFAULT_ATTRIBUTION_MODEL: AttributionModel;
9
+ /** Lookback values offered in the UI and accepted by `v3.analyticsV2Settings.set` for `lookback_days`. */
10
+ export declare const ATTRIBUTION_LOOKBACK_DAYS: readonly [7, 14, 30, 90];
11
+ export type AttributionLookbackDays = (typeof ATTRIBUTION_LOOKBACK_DAYS)[number];
12
+ export declare const DEFAULT_ATTRIBUTION_LOOKBACK_DAYS: AttributionLookbackDays;
13
+ /** The freeze stores touches of this many days before the conversion. Equals the largest lookback. */
14
+ export declare const ATTRIBUTION_MAX_LOOKBACK_DAYS = 90;
15
+ /** Keep at most this many touches per order: the first one plus the latest 49. */
16
+ export declare const ATTRIBUTION_MAX_TOUCHES = 50;
17
+ /** Keep at most this many resolved visitors per order. */
18
+ export declare const ATTRIBUTION_MAX_VISITORS = 20;
19
+ /** The attribution-rate bar (Hyros and Polar use 85 %; research/attribution-hyros.md:7,13). */
20
+ export declare const ATTRIBUTION_RATE_BAR = 0.85;
21
+ /**
22
+ * Ad-account providers: the values of av2_ad_spend.provider and of analytics_v2_destinations.provider
23
+ * when kind = 'ad_account'. Underscores only: the Postgres CHECK is ^[a-z0-9_]{1,40}$ (postgres-schema.md).
24
+ * destinations.md §2-§3 reads this constant from here.
25
+ */
26
+ export declare const AD_SPEND_PROVIDERS: readonly ["meta", "google_ads", "tiktok"];
27
+ export type AdSpendProvider = (typeof AD_SPEND_PROVIDERS)[number];
28
+ //# sourceMappingURL=attribution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribution.d.ts","sourceRoot":"","sources":["../../../src/tgd/contract/attribution.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,eAAO,MAAM,gBAAgB,0JAanB,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D,sGAAsG;AACtG,eAAO,MAAM,aAAa,EAAE,SAAS,cAAc,EAA8C,CAAC;AAElG,eAAO,MAAM,kBAAkB,qGAOrB,CAAC;AACX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AACnE,eAAO,MAAM,yBAAyB,EAAE,gBAAoC,CAAC;AAE7E,0GAA0G;AAC1G,eAAO,MAAM,yBAAyB,0BAA2B,CAAC;AAClE,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AACjF,eAAO,MAAM,iCAAiC,EAAE,uBAA4B,CAAC;AAC7E,sGAAsG;AACtG,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAChD,kFAAkF;AAClF,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,0DAA0D;AAC1D,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,+FAA+F;AAC/F,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAEzC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,2CAA4C,CAAC;AAC5E,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,44 @@
1
+ /** The 12 channels a merchant sees. Order = display order. */
2
+ export const VISIBLE_CHANNELS = [
3
+ 'direct',
4
+ 'organic_search',
5
+ 'paid_search',
6
+ 'organic_social',
7
+ 'paid_social',
8
+ 'email',
9
+ 'sms',
10
+ 'affiliate',
11
+ 'referral',
12
+ 'ai',
13
+ 'display',
14
+ 'other',
15
+ ];
16
+ /** Channels whose touches can carry ad spend and count as "paid" for the last-paid-touch shortcut. */
17
+ export const PAID_CHANNELS = ['paid_search', 'paid_social', 'display'];
18
+ export const ATTRIBUTION_MODELS = [
19
+ 'first_touch',
20
+ 'last_touch',
21
+ 'last_non_direct',
22
+ 'linear',
23
+ 'position_based',
24
+ 'time_decay',
25
+ ];
26
+ export const DEFAULT_ATTRIBUTION_MODEL = 'last_non_direct';
27
+ /** Lookback values offered in the UI and accepted by `v3.analyticsV2Settings.set` for `lookback_days`. */
28
+ export const ATTRIBUTION_LOOKBACK_DAYS = [7, 14, 30, 90];
29
+ export const DEFAULT_ATTRIBUTION_LOOKBACK_DAYS = 30;
30
+ /** The freeze stores touches of this many days before the conversion. Equals the largest lookback. */
31
+ export const ATTRIBUTION_MAX_LOOKBACK_DAYS = 90;
32
+ /** Keep at most this many touches per order: the first one plus the latest 49. */
33
+ export const ATTRIBUTION_MAX_TOUCHES = 50;
34
+ /** Keep at most this many resolved visitors per order. */
35
+ export const ATTRIBUTION_MAX_VISITORS = 20;
36
+ /** The attribution-rate bar (Hyros and Polar use 85 %; research/attribution-hyros.md:7,13). */
37
+ export const ATTRIBUTION_RATE_BAR = 0.85;
38
+ /**
39
+ * Ad-account providers: the values of av2_ad_spend.provider and of analytics_v2_destinations.provider
40
+ * when kind = 'ad_account'. Underscores only: the Postgres CHECK is ^[a-z0-9_]{1,40}$ (postgres-schema.md).
41
+ * destinations.md §2-§3 reads this constant from here.
42
+ */
43
+ export const AD_SPEND_PROVIDERS = ['meta', 'google_ads', 'tiktok'];
44
+ //# sourceMappingURL=attribution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribution.js","sourceRoot":"","sources":["../../../src/tgd/contract/attribution.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,QAAQ;IACR,gBAAgB;IAChB,aAAa;IACb,gBAAgB;IAChB,aAAa;IACb,OAAO;IACP,KAAK;IACL,WAAW;IACX,UAAU;IACV,IAAI;IACJ,SAAS;IACT,OAAO;CACC,CAAC;AAGX,sGAAsG;AACtG,MAAM,CAAC,MAAM,aAAa,GAA8B,CAAC,aAAa,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;AAElG,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,aAAa;IACb,YAAY;IACZ,iBAAiB;IACjB,QAAQ;IACR,gBAAgB;IAChB,YAAY;CACJ,CAAC;AAEX,MAAM,CAAC,MAAM,yBAAyB,GAAqB,iBAAiB,CAAC;AAE7E,0GAA0G;AAC1G,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAU,CAAC;AAElE,MAAM,CAAC,MAAM,iCAAiC,GAA4B,EAAE,CAAC;AAC7E,sGAAsG;AACtG,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,CAAC;AAChD,kFAAkF;AAClF,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAC1C,0DAA0D;AAC1D,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAC3C,+FAA+F;AAC/F,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAEzC;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,CAAU,CAAC"}
@@ -0,0 +1,57 @@
1
+ import type { JsonValue, TgdBrowserIds } from './envelope.js';
2
+ import type { TargetingAttributes } from './experiments.js';
3
+ import type { AssignResponse } from './wire.js';
4
+ export interface TgdInitOptions {
5
+ storeId?: string;
6
+ /** Absolute origin of the API, e.g. 'https://api.tagada.io'. Overrides section 2.1. */
7
+ apiHost?: string;
8
+ /** Variants decided before load (node-sdk getBootstrap(), section 6.4). */
9
+ bootstrap?: TgdBootstrap;
10
+ /** Targeting attributes the merchant knows (custom.*). country/device are never read in the browser. */
11
+ attributes?: Pick<TargetingAttributes, 'custom'>;
12
+ debug?: boolean;
13
+ /** @internal headless-sdk only */ _source?: 'browser' | 'headless';
14
+ /** @internal headless-sdk only: no automatic page_view; page views come from page() */ _manualPages?: boolean;
15
+ }
16
+ export interface TgdBootstrap {
17
+ v: 1;
18
+ /** The node-sdk distinctId the variants were computed for. Exposures of bootstrap keys use unit_type 'external'. */
19
+ distinctId: string;
20
+ experiments: AssignResponse['experiments'];
21
+ flags: AssignResponse['flags'];
22
+ }
23
+ export interface TgdIds {
24
+ visitorId: string | null;
25
+ clientId: string | null;
26
+ sessionId: string;
27
+ pageViewId: string | null;
28
+ funnelSessionId: string | null;
29
+ externalId: string | null;
30
+ browser: TgdBrowserIds;
31
+ }
32
+ export interface TgdPublicApi {
33
+ init(options?: TgdInitOptions): void;
34
+ page(props?: Record<string, JsonValue>): void;
35
+ track(name: string, props?: Record<string, JsonValue>): void;
36
+ identify(externalId: string | null, traits?: {
37
+ email?: string;
38
+ phone?: string;
39
+ customerId?: string;
40
+ [k: string]: string | number | boolean | undefined;
41
+ }): void;
42
+ ids(): TgdIds;
43
+ getVariant(key: string): string | null;
44
+ getPayload(key: string): JsonValue | null;
45
+ onVariant(key: string, cb: (variant: string | null) => void): () => void;
46
+ isEnabled(flagKey: string): boolean;
47
+ ready(): Promise<void>;
48
+ /** @internal headless-sdk only */ _link(funnelSessionId: string): void;
49
+ }
50
+ /** Value of cookie tgd_xb = base64url(JSON.stringify(XbCookieV1)), no padding. */
51
+ export interface XbCookieV1 {
52
+ v: 1;
53
+ u: string;
54
+ e: Record<string, [arm: string | null, expId: string, phase: number, inExperiment: 0 | 1, unitType: 'visitor' | 'external']>;
55
+ f: Record<string, [variant: string | null, flagId: string, enabled: 0 | 1]>;
56
+ }
57
+ //# sourceMappingURL=browser-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-api.d.ts","sourceRoot":"","sources":["../../../src/tgd/contract/browser-api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uFAAuF;IACvF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,wGAAwG;IACxG,UAAU,CAAC,EAAE,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;IACjD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kCAAkC,CAAC,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IACpE,uFAAuF,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;CAChH;AAED,MAAM,WAAW,YAAY;IAC3B,CAAC,EAAE,CAAC,CAAC;IACL,oHAAoH;IACpH,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IAC3C,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,MAAM;IACrB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB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CACzE;AAED,kFAAkF;AAClF,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,CAAC,CAAC;IACL,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC;IAC7H,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC7E"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=browser-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-api.js","sourceRoot":"","sources":["../../../src/tgd/contract/browser-api.ts"],"names":[],"mappings":""}
@@ -0,0 +1,120 @@
1
+ import type { ExperimentStatus, Goal, Guardrail, TargetingCondition } from './experiments.js';
2
+ /** `node.metadata.canvasSplit`, `node.metadata.canvasPageTest`, `node.metadata.canvasPageVariantOf`,
3
+ * `edge.metadata.splitArm`, `edge.metadata.pageVariantEdgeOf` (A11). The canvas compile is their only writer. */
4
+ export declare const CANVAS_SPLIT_KEY: "canvasSplit";
5
+ export declare const CANVAS_PAGE_TEST_KEY: "canvasPageTest";
6
+ export declare const CANVAS_PAGE_VARIANT_OF_KEY: "canvasPageVariantOf";
7
+ export declare const SPLIT_ARM_KEY: "splitArm";
8
+ export declare const PAGE_VARIANT_EDGE_OF_KEY: "pageVariantEdgeOf";
9
+ /** Arm keys the canvas mints, in order. The first one is always the control. */
10
+ export declare const CANVAS_ARM_KEYS: readonly ["control", "b", "c", "d", "e"];
11
+ export declare const ARM_KEY_PATTERN: RegExp;
12
+ export declare const MAX_ARMS = 5;
13
+ export interface CompiledExperimentCore {
14
+ experimentId: string;
15
+ status: ExperimentStatus;
16
+ phase: number;
17
+ seed: string;
18
+ controlArm: string;
19
+ shippedArm: string | null;
20
+ holdoutBp: number;
21
+ targeting: TargetingCondition[];
22
+ namespace: {
23
+ name: string;
24
+ startBp: number;
25
+ endBp: number;
26
+ } | null;
27
+ goals: Goal[];
28
+ guardrails: Guardrail[];
29
+ conversionWindowHours: number;
30
+ }
31
+ export interface CompiledSplitArm {
32
+ key: string;
33
+ label: string;
34
+ weightBp: number;
35
+ }
36
+ export interface CompiledSplitMeta extends CompiledExperimentCore {
37
+ arms: CompiledSplitArm[];
38
+ }
39
+ export interface CompiledPageTestArm {
40
+ key: string;
41
+ nodeId: string;
42
+ weightBp: number;
43
+ }
44
+ export interface CompiledPageTestMeta extends CompiledExperimentCore {
45
+ arms: CompiledPageTestArm[];
46
+ }
47
+ export interface CompiledPageVariantOf {
48
+ controlNodeId: string;
49
+ armKey: string;
50
+ }
51
+ /**
52
+ * The patch of `set { split }` and `set { pageTest }` (section 5.2). Same name as ab-engine.md §18.1.
53
+ * `phase` is an optional CHECK: the compile derives the phase (section 6.5) and refuses with `stale`
54
+ * when the caller's value differs. `arms` carries weights (both kinds) and labels (split only).
55
+ */
56
+ export interface CanvasExperimentLifecyclePatch {
57
+ status?: Exclude<ExperimentStatus, 'draft'>;
58
+ phase?: number;
59
+ arms?: Array<{
60
+ key: string;
61
+ weightBp?: number;
62
+ label?: string;
63
+ }>;
64
+ shippedArm?: string | null;
65
+ holdoutBp?: number;
66
+ targeting?: TargetingCondition[];
67
+ namespace?: {
68
+ name: string;
69
+ startBp: number;
70
+ endBp: number;
71
+ } | null;
72
+ goals?: Goal[];
73
+ guardrails?: Guardrail[];
74
+ conversionWindowHours?: number;
75
+ name?: string;
76
+ }
77
+ /** Every command of this doc, in the input form (`experimentId` may be omitted: the server mints it). */
78
+ export type CanvasExperimentCommand = {
79
+ type: 'add';
80
+ kind: 'split';
81
+ after?: {
82
+ node: string;
83
+ exit: string;
84
+ };
85
+ props: {
86
+ name: string;
87
+ experimentId?: string;
88
+ };
89
+ } | {
90
+ type: 'add';
91
+ kind: 'page.checkout' | 'page.offer' | 'page.landing' | 'page.thankyou' | 'page.custom';
92
+ variantOf: {
93
+ node: string;
94
+ experimentId?: string;
95
+ };
96
+ props: {
97
+ name: string;
98
+ template?: string;
99
+ path?: string;
100
+ };
101
+ } | {
102
+ type: 'set';
103
+ id: string;
104
+ target?: 'node';
105
+ patch: {
106
+ split: CanvasExperimentLifecyclePatch;
107
+ };
108
+ } | {
109
+ type: 'set';
110
+ id: string;
111
+ target?: 'node';
112
+ patch: {
113
+ pageTest: CanvasExperimentLifecyclePatch;
114
+ };
115
+ } | {
116
+ type: 'remove';
117
+ id: string;
118
+ target?: 'node';
119
+ };
120
+ //# sourceMappingURL=canvas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../../../src/tgd/contract/canvas.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE9F;kHACkH;AAClH,eAAO,MAAM,gBAAgB,EAAG,aAAsB,CAAC;AACvD,eAAO,MAAM,oBAAoB,EAAG,gBAAyB,CAAC;AAC9D,eAAO,MAAM,0BAA0B,EAAG,qBAA8B,CAAC;AACzE,eAAO,MAAM,aAAa,EAAG,UAAmB,CAAC;AACjD,eAAO,MAAM,wBAAwB,EAAG,mBAA4B,CAAC;AAErE,gFAAgF;AAChF,eAAO,MAAM,eAAe,0CAA2C,CAAC;AACxE,eAAO,MAAM,eAAe,QAAuB,CAAC;AACpD,eAAO,MAAM,QAAQ,IAAI,CAAC;AAE1B,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,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A;CAAE,GAC9F;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,8BAA8B,CAAA;KAAE,CAAA;CAAE,GACjG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC"}
@@ -0,0 +1,12 @@
1
+ /** `node.metadata.canvasSplit`, `node.metadata.canvasPageTest`, `node.metadata.canvasPageVariantOf`,
2
+ * `edge.metadata.splitArm`, `edge.metadata.pageVariantEdgeOf` (A11). The canvas compile is their only writer. */
3
+ export const CANVAS_SPLIT_KEY = 'canvasSplit';
4
+ export const CANVAS_PAGE_TEST_KEY = 'canvasPageTest';
5
+ export const CANVAS_PAGE_VARIANT_OF_KEY = 'canvasPageVariantOf';
6
+ export const SPLIT_ARM_KEY = 'splitArm';
7
+ export const PAGE_VARIANT_EDGE_OF_KEY = 'pageVariantEdgeOf';
8
+ /** Arm keys the canvas mints, in order. The first one is always the control. */
9
+ export const CANVAS_ARM_KEYS = ['control', 'b', 'c', 'd', 'e'];
10
+ export const ARM_KEY_PATTERN = /^[a-z0-9_-]{1,32}$/;
11
+ export const MAX_ARMS = 5;
12
+ //# sourceMappingURL=canvas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canvas.js","sourceRoot":"","sources":["../../../src/tgd/contract/canvas.ts"],"names":[],"mappings":"AAGA;kHACkH;AAClH,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAsB,CAAC;AACvD,MAAM,CAAC,MAAM,oBAAoB,GAAG,gBAAyB,CAAC;AAC9D,MAAM,CAAC,MAAM,0BAA0B,GAAG,qBAA8B,CAAC;AACzE,MAAM,CAAC,MAAM,aAAa,GAAG,UAAmB,CAAC;AACjD,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAA4B,CAAC;AAErE,gFAAgF;AAChF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC;AACxE,MAAM,CAAC,MAAM,eAAe,GAAG,oBAAoB,CAAC;AACpD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { UnitType } from './unions.js';
2
+ export declare const dkFsStarted: (fsid: string) => string;
3
+ export declare const dkStepViewed: (fsid: string, stepId: string, tsMs: number) => string;
4
+ export declare const dkStepEntered: (fsid: string, stepId: string, navMs: number) => string;
5
+ export declare const dkCheckoutStarted: (csid: string) => string;
6
+ export declare const dkCheckoutEmail: (csid: string, emailSha256: string) => string;
7
+ export declare const dkAttempt: (paymentId: string) => string;
8
+ export declare const dkOrder: (orderId: string) => string;
9
+ export declare const dkSubCreated: (subscriptionId: string) => string;
10
+ export declare const dkSubCanceled: (subscriptionId: string) => string;
11
+ export declare const dkSubRebilled: (paymentId: string) => string;
12
+ export declare const dkExposure: (expId: string, phase: number, unitType: UnitType, unitId: string) => string;
13
+ export declare const dkExternal: (storeId: string, idempotencyKey: string) => string;
14
+ export declare const dkLegacy: (appEventsRawId: string) => string;
15
+ export declare const dkEmailSent: (m: string) => string;
16
+ export declare const dkEmailDelivered: (m: string) => string;
17
+ export declare const dkEmailBounced: (m: string) => string;
18
+ export declare const dkEmailComplained: (m: string) => string;
19
+ export declare const dkEmailOpened: (m: string, svixId: string) => string;
20
+ export declare const dkEmailClicked: (m: string, linkIndex: number, tsMs: number) => string;
21
+ export declare const dkEmailUnsubscribed: (m: string) => string;
22
+ /** Conversion-key prefixes owned by conversions-ledger.md. Listed so no event key reuses them. */
23
+ export declare const CONVERSION_KEY_PREFIXES: readonly ["payment:", "refund:", "chargeback:"];
24
+ //# sourceMappingURL=dedup-keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dedup-keys.d.ts","sourceRoot":"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,CAAC;AACxE,eAAO,MAAM,aAAa,GAAI,GAAG,MAAM,EAAE,QAAQ,MAAM,WAAkC,CAAC;AAC1F,eAAO,MAAM,cAAc,GAAI,GAAG,MAAM,EAAE,WAAW,MAAM,EAAE,MAAM,MAAM,WAAiE,CAAC;AAC3I,eAAO,MAAM,mBAAmB,GAAI,GAAG,MAAM,WAA8B,CAAC;AAC5E,kGAAkG;AAClG,eAAO,MAAM,uBAAuB,iDAAkD,CAAC"}
@@ -0,0 +1,23 @@
1
+ export const dkFsStarted = (fsid) => `fs_started:${fsid}`;
2
+ export const dkStepViewed = (fsid, stepId, tsMs) => `step_viewed:${fsid}:${stepId}:${Math.floor(tsMs / 1000)}`;
3
+ export const dkStepEntered = (fsid, stepId, navMs) => `step_entered:${fsid}:${stepId}:${navMs}`;
4
+ export const dkCheckoutStarted = (csid) => `checkout_started:${csid}`;
5
+ export const dkCheckoutEmail = (csid, emailSha256) => `checkout_email:${csid}:${emailSha256}`;
6
+ export const dkAttempt = (paymentId) => `attempt:${paymentId}`;
7
+ export const dkOrder = (orderId) => `order:${orderId}`;
8
+ export const dkSubCreated = (subscriptionId) => `sub_created:${subscriptionId}`;
9
+ export const dkSubCanceled = (subscriptionId) => `sub_canceled:${subscriptionId}`;
10
+ export const dkSubRebilled = (paymentId) => `sub_rebilled:${paymentId}`;
11
+ export const dkExposure = (expId, phase, unitType, unitId) => `exp:${expId}:${phase}:${unitType}:${unitId}`;
12
+ export const dkExternal = (storeId, idempotencyKey) => `ext:${storeId}:${idempotencyKey}`;
13
+ export const dkLegacy = (appEventsRawId) => `legacy:${appEventsRawId}`;
14
+ export const dkEmailSent = (m) => `email_sent:${m}`;
15
+ export const dkEmailDelivered = (m) => `email_delivered:${m}`;
16
+ export const dkEmailBounced = (m) => `email_bounced:${m}`;
17
+ export const dkEmailComplained = (m) => `email_complained:${m}`;
18
+ export const dkEmailOpened = (m, svixId) => `email_opened:${m}:${svixId}`;
19
+ export const dkEmailClicked = (m, linkIndex, tsMs) => `email_clicked:${m}:${linkIndex}:${Math.floor(tsMs / 1000)}`;
20
+ export const dkEmailUnsubscribed = (m) => `email_unsubscribed:${m}`;
21
+ /** Conversion-key prefixes owned by conversions-ledger.md. Listed so no event key reuses them. */
22
+ export const CONVERSION_KEY_PREFIXES = ['payment:', 'refund:', 'chargeback:']; // (new name, this lane)
23
+ //# sourceMappingURL=dedup-keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dedup-keys.js","sourceRoot":"","sources":["../../../src/tgd/contract/dedup-keys.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,cAAc,IAAI,EAAE,CAAC;AAClE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,MAAc,EAAE,IAAY,EAAE,EAAE,CAAC,eAAe,IAAI,IAAI,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;AACvI,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,MAAc,EAAE,KAAa,EAAE,EAAE,CAAC,gBAAgB,IAAI,IAAI,MAAM,IAAI,KAAK,EAAE,CAAC;AACxH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,oBAAoB,IAAI,EAAE,CAAC;AAC9E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,WAAmB,EAAE,EAAE,CAAC,kBAAkB,IAAI,IAAI,WAAW,EAAE,CAAC;AAC9G,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,SAAiB,EAAE,EAAE,CAAC,WAAW,SAAS,EAAE,CAAC;AACvE,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,SAAS,OAAO,EAAE,CAAC;AAC/D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,cAAsB,EAAE,EAAE,CAAC,eAAe,c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G,IAAI,CAAC,EAAE,CAAC;AAC3I,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,sBAAsB,CAAC,EAAE,CAAC;AAC5E,kGAAkG;AAClG,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,UAAU,EAAE,SAAS,EAAE,aAAa,CAAU,CAAC,CAAG,wBAAwB"}
@@ -0,0 +1,4 @@
1
+ import type { TgdEventV1 } from './envelope.js';
2
+ export declare const DESTINATION_EVENT_NAMES: Readonly<Record<'meta' | 'ga4' | 'tiktok' | 'snap' | 'pinterest_tag' | 'pinterest_capi', Partial<Record<'page_view' | 'checkout_started' | 'checkout_email_entered' | 'order_completed' | 'subscription_created' | 'lead' | 'product_viewed' | 'added_to_cart', string>>>>;
3
+ export declare function destinationDedupId(ev: TgdEventV1): string | null;
4
+ //# sourceMappingURL=destination-names.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"destination-names.d.ts","sourceRoot":"","sources":["../../../src/tgd/contract/destination-names.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,eAAe,GAAG,gBAAgB,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,GAAG,kBAAkB,GAAG,wBAAwB,GAAG,iBAAiB,GAAG,sBAAsB,GAAG,MAAM,GAAG,gBAAgB,GAAG,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC,CAsD9S,CAAC;AAGF,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAQhE"}
@@ -0,0 +1,66 @@
1
+ export const DESTINATION_EVENT_NAMES = {
2
+ "meta": {
3
+ "page_view": "PageView",
4
+ "checkout_started": "InitiateCheckout",
5
+ "checkout_email_entered": "CheckoutEmailValidated",
6
+ "order_completed": "Purchase",
7
+ "subscription_created": "Subscribe",
8
+ "lead": "Lead",
9
+ "product_viewed": "ViewContent",
10
+ "added_to_cart": "AddToCart"
11
+ },
12
+ "ga4": {
13
+ "page_view": "page_view",
14
+ "checkout_started": "begin_checkout",
15
+ "order_completed": "purchase",
16
+ "lead": "generate_lead",
17
+ "product_viewed": "view_item",
18
+ "added_to_cart": "add_to_cart"
19
+ },
20
+ "tiktok": {
21
+ "page_view": "Pageview",
22
+ "checkout_started": "InitiateCheckout",
23
+ "order_completed": "Purchase",
24
+ "subscription_created": "Subscribe",
25
+ "lead": "SubmitForm",
26
+ "product_viewed": "ViewContent",
27
+ "added_to_cart": "AddToCart"
28
+ },
29
+ "snap": {
30
+ "page_view": "PAGE_VIEW",
31
+ "checkout_started": "START_CHECKOUT",
32
+ "order_completed": "PURCHASE",
33
+ "subscription_created": "SUBSCRIBE",
34
+ "lead": "LEAD",
35
+ "product_viewed": "VIEW_CONTENT",
36
+ "added_to_cart": "ADD_CART"
37
+ },
38
+ "pinterest_tag": {
39
+ "page_view": "pagevisit",
40
+ "checkout_started": "initiatecheckout",
41
+ "order_completed": "checkout",
42
+ "lead": "lead",
43
+ "product_viewed": "viewcontent",
44
+ "added_to_cart": "addtocart"
45
+ },
46
+ "pinterest_capi": {
47
+ "page_view": "page_visit",
48
+ "checkout_started": "initiate_checkout",
49
+ "order_completed": "checkout",
50
+ "subscription_created": "subscribe",
51
+ "lead": "lead",
52
+ "product_viewed": "view_content",
53
+ "added_to_cart": "add_to_cart"
54
+ }
55
+ };
56
+ const makeMetaEventId = (name, id) => `${name}_${id}`;
57
+ export function destinationDedupId(ev) {
58
+ switch (ev.event_name) {
59
+ case 'checkout_started': return ev.checkout_session_id ? makeMetaEventId('InitiateCheckout', ev.checkout_session_id) : null;
60
+ case 'checkout_email_entered': return ev.checkout_session_id ? makeMetaEventId('CheckoutEmailValidated', ev.checkout_session_id) : null;
61
+ case 'order_completed': return ev.order_id ? makeMetaEventId('Purchase', ev.order_id) : null;
62
+ case 'subscription_created': return ev.subscription_id ? makeMetaEventId('Subscribe', ev.subscription_id) : null;
63
+ default: return null;
64
+ }
65
+ }
66
+ //# sourceMappingURL=destination-names.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"destination-names.js","sourceRoot":"","sources":["../../../src/tgd/contract/destination-names.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,uBAAuB,GAA+Q;IACjT,MAAM,EAAE;QACN,WAAW,EAAE,UAAU;QACvB,kBAAkB,EAAE,kBAAkB;QACtC,wBAAwB,EAAE,wBAAwB;QAClD,iBAAiB,EAAE,UAAU;QAC7B,sBAAsB,EAAE,WAAW;QACnC,MAAM,EAAE,MAAM;QACd,gBAAgB,EAAE,aAAa;QAC/B,eAAe,EAAE,WAAW;KAC7B;IACD,KAAK,EAAE;QACL,WAAW,EAAE,WAAW;QACxB,kBAAkB,EAAE,gBAAgB;QACpC,iBAAiB,EAAE,UAAU;QAC7B,MAAM,EAAE,eAAe;QACvB,gBAAgB,EAAE,WAAW;QAC7B,eAAe,EAAE,aAAa;KAC/B;IACD,QAAQ,EAAE;QACR,WAAW,EAAE,UAAU;QACvB,kBAAkB,EAAE,kBAAkB;QACtC,iBAAiB,EAAE,UAAU;QAC7B,sBAAsB,EAAE,WAAW;QACnC,MAAM,EAAE,YAAY;QACpB,gBAAgB,EAAE,aAAa;QAC/B,eAAe,EAAE,WAAW;KAC7B;IACD,MAAM,EAAE;QACN,WAAW,EAAE,WAAW;QACxB,kBAAkB,EAAE,gBAAgB;QACpC,iBAAiB,EAAE,UAAU;QAC7B,sBAAsB,EAAE,WAAW;QACnC,MAAM,EAAE,MAAM;QACd,gBAAgB,EAAE,cAAc;QAChC,eAAe,EAAE,UAAU;KAC5B;IACD,eAAe,EAAE;QACf,WAAW,EAAE,WAAW;QACxB,kBAAkB,EAAE,kBAAkB;QACtC,iBAAiB,EAAE,UAAU;QAC7B,MAAM,EAAE,MAAM;QACd,gBAAg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awin", "converge", "clickflare", "voluum", "binom", "redtrack", "clickmagick", "tiktok", "snap", "pinterest", "reddit", "x", "google_ads", "ga4", "microsoft_ads", "linkedin"];
2
+ export type DestinationAdapterId = (typeof DESTINATION_ADAPTER_IDS)[number];
3
+ /** Values of analytics_v2_destinations.provider when kind = 'ad_account', and of av2_ad_spend.provider (A36, §18).
4
+ * Underscore, never '-': analytics_v2_destinations has CHECK provider ~ '^[a-z0-9_]{1,40}$' (postgres-schema.md §3).
5
+ * Declared once, in attribution.ts (attribution.md §2.2: AD_SPEND_PROVIDERS = ['meta', 'google_ads', 'tiktok']);
6
+ * this file re-exports it under the name this doc uses (P1-L1 kernel decision K2). Test: same array reference. */
7
+ export { AD_SPEND_PROVIDERS as AD_ACCOUNT_PROVIDERS } from './attribution.js';
8
+ export type { AdSpendProvider as AdAccountProvider } from './attribution.js';
9
+ export declare const DESTINATION_TOPICS: readonly ["order/paid", "order/refunded", "checkout/initiated", "checkout/emailValidated", "checkout/abandonedCart", "subscription/created", "subscription/canceled", "subscription/pastDue", "subscription/paused", "subscription/resumed", "subscription/rebillUpcoming", "subscription/rebillSucceeded", "club/membershipActivated"];
10
+ export type DestinationTopic = (typeof DESTINATION_TOPICS)[number];
11
+ /** A zod 3 schema satisfies this. tgd-core never imports zod (A26). */
12
+ export interface ConfigParser<Cfg> {
13
+ parse(input: unknown): Cfg;
14
+ }
15
+ /** What `configSchema.parse` receives. Kind 'integration': integrations.credentials / .settings.
16
+ * Kind 'destination': getDestinationCredentials() / analytics_v2_destinations.config / .provider_account_id. */
17
+ export interface DestinationConfigSource {
18
+ readonly credentials: Readonly<Record<string, unknown>>;
19
+ readonly settings: Readonly<Record<string, unknown>>;
20
+ readonly providerAccountId: string | null;
21
+ }
22
+ /** One HTTP call. It never contains a secret: secrets are added by `authorize` after logging (§8.3). */
23
+ export interface DestinationRequest {
24
+ readonly method: 'GET' | 'POST';
25
+ readonly url: string;
26
+ readonly headers: Readonly<Record<string, string>>;
27
+ readonly body?: unknown;
28
+ readonly eventName: string;
29
+ }
30
+ export declare const SKIP_REASONS: readonly ["not_found", "no_customer", "no_identifier", "no_click_id", "cart_not_priced", "event_disabled", "returning_customer", "order_open", "no_amount", "not_configured", "invalid_config", "already_sent", "unsupported_topic"];
31
+ export type SkipReason = (typeof SKIP_REASONS)[number];
32
+ export type MapResult = {
33
+ readonly kind: 'send';
34
+ readonly requests: readonly DestinationRequest[];
35
+ } | {
36
+ readonly kind: 'skip';
37
+ readonly reason: SkipReason;
38
+ };
39
+ export interface ProviderResponse {
40
+ readonly kind: 'response';
41
+ readonly status: number;
42
+ readonly headers: Readonly<Record<string, string>>;
43
+ readonly body: unknown;
44
+ }
45
+ export interface NetworkFailure {
46
+ readonly kind: 'network';
47
+ readonly code: string;
48
+ readonly message: string;
49
+ }
50
+ export type Verdict = {
51
+ readonly kind: 'success';
52
+ readonly providerRequestId?: string;
53
+ } | {
54
+ readonly kind: 'retry';
55
+ readonly reason: 'throttled' | 'server' | 'network' | 'timeout';
56
+ readonly retryAfterMs?: number;
57
+ readonly message?: string;
58
+ } | {
59
+ readonly kind: 'abort';
60
+ readonly reason: 'auth' | 'payload' | 'too_old' | 'not_found' | 'unknown_4xx';
61
+ readonly message?: string;
62
+ };
63
+ export interface AuthPatch {
64
+ readonly headers?: Readonly<Record<string, string>>;
65
+ readonly query?: Readonly<Record<string, string>>;
66
+ }
67
+ export type ValidationStatus = 'validated' | 'skipped:no-test-key' | 'invalid';
68
+ export interface ValidationResult {
69
+ readonly status: ValidationStatus;
70
+ readonly reason?: string;
71
+ }
72
+ export type FetchLike = (url: string, init: {
73
+ method: 'GET' | 'POST';
74
+ headers: Record<string, string>;
75
+ body?: string;
76
+ signal?: AbortSignal;
77
+ }) => Promise<{
78
+ status: number;
79
+ headers: {
80
+ get(name: string): string | null;
81
+ };
82
+ text(): Promise<string>;
83
+ }>;
84
+ export interface MapContext {
85
+ readonly mode: 'shadow' | 'live';
86
+ readonly attempt: number;
87
+ readonly nowMs: number;
88
+ }
89
+ export interface DestinationAdapter<Cfg = unknown, In = unknown> {
90
+ readonly id: DestinationAdapterId;
91
+ readonly kind: 'integration' | 'destination';
92
+ readonly integrationProvider: string | null;
93
+ readonly integrationType: string | null;
94
+ readonly logService: string | null;
95
+ readonly topics: readonly DestinationTopic[];
96
+ readonly configSchema: ConfigParser<Cfg>;
97
+ /** Pure and synchronous. No I/O, no Date.now(), no Math.random(). */
98
+ map(input: In, config: Cfg, ctx: MapContext): MapResult;
99
+ /** Adds secrets at send time (tokens, api keys, OAuth access token). Called only in live mode and by validate. */
100
+ authorize?(config: Cfg, fetchImpl: FetchLike): Promise<AuthPatch>;
101
+ /** Owns all provider knowledge about responses. Never throws. */
102
+ classify(result: ProviderResponse | NetworkFailure, request: DestinationRequest): Verdict;
103
+ /** A35: calls the provider's test/validation endpoint with `sample`. Never touches production data of the merchant. */
104
+ validate(sample: In, config: Cfg, fetchImpl: FetchLike): Promise<ValidationResult>;
105
+ readonly batch: {
106
+ readonly maxItems: 1;
107
+ };
108
+ readonly verified: 'replay' | 'validated' | 'unverified';
109
+ readonly maxEventAgeSec: number;
110
+ readonly timeoutMs: number;
111
+ }
112
+ export declare const DISPATCH_EVENT_NAME: "analytics-v2/destinations.dispatch";
113
+ export declare function destinationIdempotencyKey(p: {
114
+ provider: DestinationAdapterId;
115
+ targetId: string;
116
+ topic: DestinationTopic;
117
+ entityKey: string;
118
+ }): string;
119
+ /** §6.3. Returns null when the topic data lacks the id the key needs (the observer then skips). */
120
+ export declare function destinationEntityKey(topic: DestinationTopic, data: Readonly<Record<string, unknown>>, event: {
121
+ readonly id: string;
122
+ readonly timestamp: string;
123
+ }): string | null;
124
+ //# sourceMappingURL=destinations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"destinations.d.ts","sourceRoot":"","sources":["../../../src/tgd/contract/destinations.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,sOAK1B,CAAC;AACX,MAAM,MAAM,oBAAoB,GAAG,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