@drip-apex/sdk 0.1.0 → 0.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 +5 -0
- package/dist/bundle-report.json +584 -226
- package/dist/define.cjs +123 -0
- package/dist/define.cjs.map +7 -0
- package/dist/define.mjs +102 -0
- package/dist/define.mjs.map +7 -0
- package/dist/drip.cjs +19283 -0
- package/dist/drip.cjs.map +7 -0
- package/dist/drip.debug.js +1 -1
- package/dist/drip.debug.js.map +1 -1
- package/dist/drip.heatmap.js +1 -1
- package/dist/drip.heatmap.js.map +1 -1
- package/dist/drip.js +1 -1
- package/dist/drip.js.map +1 -1
- package/dist/drip.live.js +1 -1
- package/dist/drip.live.js.map +1 -1
- package/dist/drip.mjs +19267 -0
- package/dist/drip.mjs.map +7 -0
- package/dist/drip.replay-recorder.js +2 -0
- package/dist/drip.replay-recorder.js.map +1 -0
- package/dist/editor.js +147 -142
- package/dist/editor.js.map +4 -4
- package/dist/flags.cjs +1788 -0
- package/dist/flags.cjs.map +7 -0
- package/dist/flags.mjs +1765 -0
- package/dist/flags.mjs.map +7 -0
- package/dist/index.mjs +12 -0
- package/dist/index.mjs.map +2 -2
- package/dist/metafiles/define.cjs.meta.json +28 -0
- package/dist/metafiles/define.mjs.meta.json +32 -0
- package/dist/metafiles/drip.cjs.meta.json +3193 -0
- package/dist/metafiles/drip.debug.meta.json +2859 -574
- package/dist/metafiles/drip.heatmap.meta.json +2732 -460
- package/dist/metafiles/drip.live.meta.json +2732 -460
- package/dist/metafiles/drip.meta.json +2859 -574
- package/dist/metafiles/drip.mjs.meta.json +3235 -0
- package/dist/metafiles/drip.replay-recorder.meta.json +82 -0
- package/dist/metafiles/editor.meta.json +67 -27
- package/dist/metafiles/flags.cjs.meta.json +220 -0
- package/dist/metafiles/flags.mjs.meta.json +225 -0
- package/dist/metafiles/index.meta.json +2717 -491
- package/dist/metafiles/index.mjs.meta.json +14 -4
- package/dist/react/index.js +16636 -13533
- package/dist/react/index.js.map +4 -4
- package/dist/sri.json +20 -15
- package/dist/types/activation-runtime.d.ts +91 -0
- package/dist/types/analytics-runtime.d.ts +166 -0
- package/dist/types/antiflicker.d.ts +9 -3
- package/dist/types/assignment-cookie-sync.d.ts +31 -0
- package/dist/types/assignment-runtime.d.ts +257 -0
- package/dist/types/assignment-store.d.ts +4 -8
- package/dist/types/bucket.d.ts +1 -2
- package/dist/types/compact-store.d.ts +1 -0
- package/dist/types/config-runtime.d.ts +313 -0
- package/dist/types/consent-evaluation.d.ts +28 -0
- package/dist/types/css.d.ts +5 -3
- package/dist/types/debug-loader.d.ts +2 -0
- package/dist/types/decide-assignments.d.ts +31 -0
- package/dist/types/delivery-timing.d.ts +8 -0
- package/dist/types/early-interaction-capture.d.ts +79 -0
- package/dist/types/early-reassert.d.ts +32 -0
- package/dist/types/edge-runtime.d.ts +11 -0
- package/dist/types/editor/api.d.ts +3 -0
- package/dist/types/editor/controller.d.ts +3 -1
- package/dist/types/editor/publication-result.d.ts +11 -0
- package/dist/types/editor/types.d.ts +2 -1
- package/dist/types/editor/view-kit.d.ts +1 -1
- package/dist/types/endpoint.d.ts +8 -0
- package/dist/types/exclusion-groups.d.ts +4 -7
- package/dist/types/flags.d.ts +2 -0
- package/dist/types/goal-eligibility.d.ts +4 -0
- package/dist/types/goals.d.ts +10 -1
- package/dist/types/guards.d.ts +7 -7
- package/dist/types/handover.d.ts +12 -1
- package/dist/types/hash.d.ts +8 -4
- package/dist/types/hydration.d.ts +2 -1
- package/dist/types/index.d.ts +24 -128
- package/dist/types/init-test-helpers.d.ts +48 -0
- package/dist/types/inline-bootstrap.d.ts +26 -0
- package/dist/types/js.d.ts +3 -1
- package/dist/types/money.d.ts +12 -0
- package/dist/types/mutate.d.ts +45 -6
- package/dist/types/performance.d.ts +2 -0
- package/dist/types/persistence-decoders.d.ts +12 -0
- package/dist/types/public-api.d.ts +209 -0
- package/dist/types/qa-assistant-state.d.ts +34 -0
- package/dist/types/react/index.d.ts +28 -3
- package/dist/types/reassert-sentinel.d.ts +6 -0
- package/dist/types/redirect.d.ts +48 -0
- package/dist/types/replay-recorder-entry.d.ts +1 -0
- package/dist/types/replay-signal-state.d.ts +6 -0
- package/dist/types/replay-signals.d.ts +13 -0
- package/dist/types/replay.d.ts +110 -0
- package/dist/types/router.d.ts +12 -2
- package/dist/types/runtime-state.d.ts +166 -0
- package/dist/types/sanitize.d.ts +1 -0
- package/dist/types/shadow.d.ts +3 -0
- package/dist/types/shopify-cart.d.ts +25 -1
- package/dist/types/storefront-vitals.d.ts +24 -0
- package/dist/types/targeting-diagnostics.d.ts +1 -0
- package/dist/types/targeting.d.ts +16 -2
- package/dist/types/track.d.ts +15 -1
- package/dist/types/types.d.ts +115 -9
- package/dist/types/wait.d.ts +14 -1
- package/dist/types/weekday-schedule.d.ts +3 -0
- package/package.json +17 -8
- package/src/activation-runtime.ts +2737 -0
- package/src/analytics-runtime.ts +2175 -0
- package/src/antiflicker.test.ts +216 -44
- package/src/antiflicker.ts +103 -28
- package/src/artifact-concurrency.test.ts +1091 -0
- package/src/assignment-cookie-sync.test.ts +202 -0
- package/src/assignment-cookie-sync.ts +189 -0
- package/src/assignment-runtime.ts +3204 -0
- package/src/assignment-store.test.ts +56 -0
- package/src/assignment-store.ts +7 -38
- package/src/bucket.ts +3 -18
- package/src/commerce-analytics-lifecycle.test.ts +75 -15
- package/src/commerce-config-lifecycle.test.ts +81 -1
- package/src/commerce-price-preserve.test.ts +133 -0
- package/src/commerce-price.test.ts +97 -0
- package/src/commerce-price.ts +74 -20
- package/src/commerce-shipping.test.ts +53 -0
- package/src/commerce-shipping.ts +5 -11
- package/src/compact-store.ts +15 -0
- package/src/config-fetch.test.ts +480 -9
- package/src/config-runtime.ts +2071 -0
- package/src/consent-evaluation-borlabs.test.ts +41 -0
- package/src/consent-evaluation-cookiescript.test.ts +50 -0
- package/src/consent-evaluation.ts +151 -0
- package/src/css.test.ts +30 -0
- package/src/css.ts +120 -6
- package/src/cwv.test.ts +60 -77
- package/src/debug-loader.test.ts +214 -0
- package/src/debug-loader.ts +41 -0
- package/src/decide-assignments.test.ts +196 -0
- package/src/decide-assignments.ts +204 -0
- package/src/delivery-timing.test.ts +104 -0
- package/src/delivery-timing.ts +89 -0
- package/src/early-interaction-capture.test.ts +451 -0
- package/src/early-interaction-capture.ts +230 -0
- package/src/early-reassert.test.ts +207 -0
- package/src/early-reassert.ts +152 -0
- package/src/edge-adoption.test.ts +435 -0
- package/src/edge-runtime.ts +30 -0
- package/src/editor/api.test.ts +109 -0
- package/src/editor/api.ts +34 -3
- package/src/editor/controller.test.ts +297 -14
- package/src/editor/controller.ts +69 -5
- package/src/editor/index.test.ts +2 -0
- package/src/editor/index.ts +1 -0
- package/src/editor/publication-result.ts +58 -0
- package/src/editor/types.ts +10 -1
- package/src/editor/view-kit.ts +2 -1
- package/src/editor/view.test.ts +108 -0
- package/src/editor/view.ts +49 -7
- package/src/endpoint.test.ts +15 -0
- package/src/endpoint.ts +10 -0
- package/src/exclusion-groups.ts +8 -18
- package/src/flags.test.ts +88 -1
- package/src/flags.ts +29 -29
- package/src/global-runtime-reconciler.test.ts +271 -0
- package/src/goal-eligibility.test.ts +29 -0
- package/src/goal-eligibility.ts +17 -0
- package/src/goals.test.ts +144 -1
- package/src/goals.ts +97 -18
- package/src/guards.test.ts +99 -1
- package/src/guards.ts +34 -15
- package/src/handover-cache-order.test.ts +6 -3
- package/src/handover.test.ts +154 -8
- package/src/handover.ts +122 -12
- package/src/hash.ts +29 -54
- package/src/holdout.test.ts +26 -0
- package/src/hydration.test.ts +73 -2
- package/src/hydration.ts +18 -9
- package/src/index.ts +130 -7287
- package/src/init-analytics.test.ts +1694 -0
- package/src/init-anti-flicker.test.ts +1211 -0
- package/src/init-cart-attributes.test.ts +2003 -0
- package/src/init-config-resolution.test.ts +999 -0
- package/src/init-consent.test.ts +971 -0
- package/src/init-empty.test.ts +11 -5406
- package/src/init-integrations.test.ts +846 -0
- package/src/init-page-activation.test.ts +5064 -0
- package/src/init-qa-loading.test.ts +740 -0
- package/src/init-redirects.test.ts +2156 -0
- package/src/init-test-helpers.ts +287 -0
- package/src/inline-bootstrap.test.ts +184 -0
- package/src/inline-bootstrap.ts +73 -0
- package/src/js.test.ts +51 -1
- package/src/js.ts +86 -2
- package/src/money.test.ts +55 -1
- package/src/money.ts +104 -2
- package/src/money.web-parity.contract.test.ts +85 -0
- package/src/mutate.test.ts +474 -10
- package/src/mutate.ts +739 -230
- package/src/page-trigger.test.ts +218 -8
- package/src/performance.ts +10 -0
- package/src/persistence-decoders.ts +18 -0
- package/src/public-api.ts +1828 -0
- package/src/qa-assistant-state.test.ts +249 -3
- package/src/qa-assistant-state.ts +146 -6
- package/src/qa-assistant-view.test.ts +220 -2
- package/src/qa-assistant-view.ts +102 -5
- package/src/react/index.test.tsx +37 -0
- package/src/react/index.tsx +19 -3
- package/src/reassert-sentinel.test.ts +155 -1
- package/src/reassert-sentinel.ts +168 -8
- package/src/redirect.test.ts +541 -0
- package/src/redirect.ts +572 -0
- package/src/replay-recorder-entry.ts +115 -0
- package/src/replay-signal-state.ts +100 -0
- package/src/replay-signals.test.ts +249 -0
- package/src/replay-signals.ts +151 -0
- package/src/replay.test.ts +764 -0
- package/src/replay.ts +514 -0
- package/src/router.test.ts +61 -2
- package/src/router.ts +50 -12
- package/src/runtime-state.ts +507 -0
- package/src/runtime.test.ts +174 -7
- package/src/runtime.ts +88 -14
- package/src/sanitize.test.ts +34 -0
- package/src/sanitize.ts +23 -12
- package/src/shadow.test.ts +187 -0
- package/src/shadow.ts +99 -0
- package/src/shopify-cart.test.ts +733 -23
- package/src/shopify-cart.ts +402 -49
- package/src/storefront-vitals.test.ts +217 -0
- package/src/storefront-vitals.ts +206 -0
- package/src/surface-signals.ts +6 -0
- package/src/targeting-conformance.test.ts +9 -0
- package/src/targeting-diagnostics.ts +38 -8
- package/src/targeting-parity-corpus.json +559 -0
- package/src/targeting-parity-corpus.test.ts +18 -0
- package/src/targeting.detailed.test.ts +105 -0
- package/src/targeting.test.ts +211 -0
- package/src/targeting.ts +88 -207
- package/src/track.test.ts +147 -0
- package/src/track.ts +125 -26
- package/src/types.ts +120 -13
- package/src/wait.test.ts +23 -0
- package/src/wait.ts +129 -13
- package/src/weekday-delivery.test.ts +56 -0
- package/src/weekday-schedule-parity-corpus.json +92 -0
- package/src/weekday-schedule.test.ts +69 -0
- package/src/weekday-schedule.ts +20 -0
package/dist/types/types.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface UrlRule {
|
|
|
20
20
|
}
|
|
21
21
|
export interface AttributeRule {
|
|
22
22
|
attribute: string;
|
|
23
|
-
operator: "equals" | "contains" | "exists" | "in";
|
|
23
|
+
operator: "equals" | "contains" | "exists" | "in" | "not_in";
|
|
24
24
|
value?: string | string[];
|
|
25
25
|
}
|
|
26
26
|
export type SegmentConditionOperator = "equals" | "not_equals" | "contains" | "not_contains" | "starts_with" | "ends_with" | "is_set" | "is_empty" | "in" | "not_in" | "matches_wildcard" | "matches_regex" | "greater_than" | "greater_than_or_equal" | "less_than" | "less_than_or_equal";
|
|
@@ -61,7 +61,6 @@ export interface PageTargetingRule {
|
|
|
61
61
|
advancedCondition?: {
|
|
62
62
|
code?: string;
|
|
63
63
|
description?: string;
|
|
64
|
-
pollOnRules?: boolean;
|
|
65
64
|
} | null;
|
|
66
65
|
trigger?: {
|
|
67
66
|
mode?: "immediate" | "history" | "polling" | "dom" | "manual-callback" | "manual-api";
|
|
@@ -90,6 +89,8 @@ export interface Targeting {
|
|
|
90
89
|
segmentRules?: SegmentTargetingRule[];
|
|
91
90
|
lifecycle?: {
|
|
92
91
|
mode?: "reset" | "deactivate" | "force_reset" | "persistent";
|
|
92
|
+
explicit?: boolean;
|
|
93
|
+
source?: "author" | "page";
|
|
93
94
|
};
|
|
94
95
|
}
|
|
95
96
|
export interface CaptureRule {
|
|
@@ -102,11 +103,14 @@ export interface CaptureRule {
|
|
|
102
103
|
}
|
|
103
104
|
export interface Goal {
|
|
104
105
|
id: string;
|
|
106
|
+
name?: string;
|
|
105
107
|
type: "click" | "pageview" | "custom" | "revenue";
|
|
106
108
|
selector?: string;
|
|
107
109
|
/** Case-insensitive text content match. When set, the clicked element's textContent must include this string. */
|
|
108
110
|
textMatch?: string;
|
|
109
111
|
urlPattern?: string;
|
|
112
|
+
/** Optional Page scope. The goal is active only while this Page matches. */
|
|
113
|
+
pageId?: string;
|
|
110
114
|
/** Custom analytics event name that should count as this goal. */
|
|
111
115
|
eventName?: string;
|
|
112
116
|
countOnce?: boolean;
|
|
@@ -136,11 +140,20 @@ export interface SnippetDeliveryManifest {
|
|
|
136
140
|
deliveryState?: "no_visual_tests" | "non_critical_visual" | "critical_visual" | "edge_managed" | string;
|
|
137
141
|
criticalMutationPlan?: SnippetCriticalMutationPlanItem[];
|
|
138
142
|
}
|
|
143
|
+
export interface UrlBlock {
|
|
144
|
+
id: string;
|
|
145
|
+
name: string;
|
|
146
|
+
urlRules: UrlRule[];
|
|
147
|
+
mutations: Mutation[];
|
|
148
|
+
css?: string;
|
|
149
|
+
js?: string;
|
|
150
|
+
}
|
|
139
151
|
export interface Variation {
|
|
140
152
|
id: string;
|
|
141
153
|
name?: string;
|
|
142
154
|
weight: number;
|
|
143
155
|
mutations: Mutation[];
|
|
156
|
+
urlBlocks?: UrlBlock[];
|
|
144
157
|
value?: unknown;
|
|
145
158
|
css?: string;
|
|
146
159
|
js?: string;
|
|
@@ -150,6 +163,10 @@ export interface Variation {
|
|
|
150
163
|
externalJsUrl?: string;
|
|
151
164
|
harnessSession?: HarnessSessionInfo;
|
|
152
165
|
isControl?: boolean;
|
|
166
|
+
/** Destination for redirect experiments; absent on the control variation. */
|
|
167
|
+
redirectUrl?: string;
|
|
168
|
+
/** Persistence provenance used by runtime safety policy. */
|
|
169
|
+
artifactSource?: string;
|
|
153
170
|
}
|
|
154
171
|
export interface HarnessSessionInfo {
|
|
155
172
|
token?: string;
|
|
@@ -163,7 +180,14 @@ export interface Experiment {
|
|
|
163
180
|
kind?: "experiment" | "feature_flag" | "personalization";
|
|
164
181
|
name?: string;
|
|
165
182
|
status?: string;
|
|
183
|
+
runtime_disabled?: boolean | null;
|
|
184
|
+
environment_key?: string | null;
|
|
185
|
+
weekdaySchedule?: import("./weekday-schedule").WeekdaySchedule;
|
|
186
|
+
/** Delivery classification authored by Apex (`mutation` or `redirect`). */
|
|
187
|
+
experimentType?: "mutation" | "redirect";
|
|
166
188
|
targeting?: Targeting;
|
|
189
|
+
/** Page definitions used only to decide whether page-scoped goals listen. */
|
|
190
|
+
goalPageRules?: PageTargetingRule[];
|
|
167
191
|
trafficAllocation?: number;
|
|
168
192
|
assignmentEpoch?: number;
|
|
169
193
|
assignmentEpochStartedAt?: string | null;
|
|
@@ -177,6 +201,10 @@ export interface Experiment {
|
|
|
177
201
|
moves?: boolean;
|
|
178
202
|
sampleRate?: number;
|
|
179
203
|
};
|
|
204
|
+
replayCapture?: {
|
|
205
|
+
enabled?: boolean;
|
|
206
|
+
sampleRate?: number;
|
|
207
|
+
};
|
|
180
208
|
variations: Variation[];
|
|
181
209
|
hashAttribute?: string;
|
|
182
210
|
goals?: Goal[];
|
|
@@ -215,6 +243,10 @@ export interface Assignment {
|
|
|
215
243
|
experimentId: string;
|
|
216
244
|
experimentName?: string;
|
|
217
245
|
variationId: string;
|
|
246
|
+
/** Whether this assignment may render and activate page-scoped behavior here. */
|
|
247
|
+
pageActive: boolean;
|
|
248
|
+
/** Identifies the selected per-URL artifact without retaining its content. */
|
|
249
|
+
activeUrlBlockId?: string;
|
|
218
250
|
index: number;
|
|
219
251
|
mutations: Mutation[];
|
|
220
252
|
value?: unknown;
|
|
@@ -231,18 +263,20 @@ export interface Assignment {
|
|
|
231
263
|
externalJsUrl?: string;
|
|
232
264
|
harnessSession?: HarnessSessionInfo;
|
|
233
265
|
isControl: boolean;
|
|
266
|
+
redirectUrl?: string;
|
|
267
|
+
artifactSource?: string;
|
|
234
268
|
hashValue: string;
|
|
235
269
|
assignmentEpoch?: number;
|
|
236
270
|
}
|
|
237
271
|
export type ExecutionMode = "auto" | "edge" | "client";
|
|
238
272
|
export type AntiFlickerMode = "scoped" | "full" | "off" | "custom";
|
|
239
273
|
export type TrackingStart = "idle" | "immediate";
|
|
240
|
-
export type CustomJsPolicy = "strict" | "hybrid"
|
|
274
|
+
export type CustomJsPolicy = "strict" | "hybrid";
|
|
241
275
|
export type PlatformHint = "auto" | "shopify" | "spa" | "shopware";
|
|
242
|
-
export type RouterMode = "auto" | "history" | "navigation" | "none";
|
|
276
|
+
export type RouterMode = "auto" | "history" | "navigation" | "polling" | "none";
|
|
243
277
|
export type ActivationMode = "auto" | "observer" | "manual";
|
|
244
278
|
export type PageTriggerMode = "direct" | "url_change" | "dom_change" | "manual";
|
|
245
|
-
export type PerfFeatureFlag = "
|
|
279
|
+
export type PerfFeatureFlag = "perf_empty_project_v1";
|
|
246
280
|
export type PerfFeatureFlags = Partial<Record<PerfFeatureFlag, boolean>>;
|
|
247
281
|
export interface ProjectPrerequisites {
|
|
248
282
|
showVariationsRule?: string;
|
|
@@ -250,7 +284,7 @@ export interface ProjectPrerequisites {
|
|
|
250
284
|
}
|
|
251
285
|
export interface ConsentModeSettings {
|
|
252
286
|
enabled?: boolean;
|
|
253
|
-
provider?: "custom" | "onetrust" | "usercentrics" | "cookiebot" | "ccm19" | "pandectes";
|
|
287
|
+
provider?: "custom" | "onetrust" | "usercentrics" | "cookiebot" | "ccm19" | "pandectes" | "cookiescript" | "borlabs";
|
|
254
288
|
getter?: string;
|
|
255
289
|
requiredGroup?: string;
|
|
256
290
|
}
|
|
@@ -259,6 +293,7 @@ export interface DebugSettings {
|
|
|
259
293
|
restrictMode?: "off" | "query_param" | "user_ids" | "always";
|
|
260
294
|
queryParam?: string;
|
|
261
295
|
token?: string;
|
|
296
|
+
tokenRequired?: boolean;
|
|
262
297
|
allowedUserIds?: string[];
|
|
263
298
|
persist?: boolean;
|
|
264
299
|
disableCache?: boolean;
|
|
@@ -273,11 +308,14 @@ export interface SpaSettings {
|
|
|
273
308
|
domChangeTrigger?: boolean;
|
|
274
309
|
debounceMs?: number;
|
|
275
310
|
allowIframes?: boolean;
|
|
276
|
-
applyTiming?: "immediate" | "after_hydration";
|
|
311
|
+
applyTiming?: "immediate" | "after_hydration" | "early_reassert";
|
|
277
312
|
hydrationTimeoutMs?: number;
|
|
278
313
|
}
|
|
279
314
|
export interface PageTriggerSettings {
|
|
280
315
|
defaultMode?: PageTriggerMode;
|
|
316
|
+
urlPollIntervalMs?: number;
|
|
317
|
+
rulePollWindowMs?: number;
|
|
318
|
+
rulePollIntervalMs?: number;
|
|
281
319
|
}
|
|
282
320
|
export interface ExternalTrackingSettings {
|
|
283
321
|
domains?: string[];
|
|
@@ -435,6 +473,21 @@ export interface ActivationDiagnostics {
|
|
|
435
473
|
};
|
|
436
474
|
experiments: ExperimentActivationDiagnostic[];
|
|
437
475
|
}
|
|
476
|
+
export type PageDeactivationMode = "reset" | "deactivate" | "force_reset" | "persistent";
|
|
477
|
+
export interface PageActivationDiagnostic {
|
|
478
|
+
pageId: string;
|
|
479
|
+
pageName?: string;
|
|
480
|
+
active: boolean;
|
|
481
|
+
appliedArtifactCount: number;
|
|
482
|
+
alwaysEmbedInSnippet?: boolean;
|
|
483
|
+
lastTransitionMode?: PageDeactivationMode;
|
|
484
|
+
isolationFallback?: "whole_experiment";
|
|
485
|
+
isolationFallbackExperimentId?: string;
|
|
486
|
+
triggerDetector?: "history" | "polling" | "dom";
|
|
487
|
+
triggerPollAttempts?: number;
|
|
488
|
+
triggerOutcome?: "activated" | "condition_failed" | "window_expired";
|
|
489
|
+
triggerElapsedMs?: number;
|
|
490
|
+
}
|
|
438
491
|
export interface SdkDiagnostics {
|
|
439
492
|
/** Public diagnostics redact consent and tracking-gate internals unless SDK debug mode is enabled. */
|
|
440
493
|
mode: "public" | "debug";
|
|
@@ -457,6 +510,7 @@ export interface SdkDiagnostics {
|
|
|
457
510
|
personalizationStopAfterMatch?: boolean;
|
|
458
511
|
value?: unknown;
|
|
459
512
|
}>;
|
|
513
|
+
pageActivation: PageActivationDiagnostic[];
|
|
460
514
|
experimentsLoaded: number;
|
|
461
515
|
analyticsStarted: boolean;
|
|
462
516
|
trackerStarted: boolean;
|
|
@@ -527,11 +581,20 @@ export interface SdkDiagnostics {
|
|
|
527
581
|
mappedSignals: string[];
|
|
528
582
|
gtagNormalized?: boolean;
|
|
529
583
|
};
|
|
584
|
+
observerErrors: {
|
|
585
|
+
count: number;
|
|
586
|
+
last?: {
|
|
587
|
+
source: "route" | "data_layer" | "dom";
|
|
588
|
+
message: string;
|
|
589
|
+
at: number;
|
|
590
|
+
};
|
|
591
|
+
};
|
|
530
592
|
lastShopifyAssignmentSync?: {
|
|
531
593
|
at: number;
|
|
532
|
-
status: "pending" | "sent" | "skipped" | "failed";
|
|
594
|
+
status: "pending" | "sent" | "cookie_fallback" | "skipped" | "failed";
|
|
533
595
|
reason?: string;
|
|
534
596
|
assignmentCount: number;
|
|
597
|
+
truncatedAssignmentCount?: number;
|
|
535
598
|
};
|
|
536
599
|
lastShopifyCartSync?: {
|
|
537
600
|
at: number;
|
|
@@ -679,7 +742,26 @@ export interface CommerceOfferExperiment {
|
|
|
679
742
|
control: true;
|
|
680
743
|
} | Record<string, unknown>>;
|
|
681
744
|
}
|
|
745
|
+
export interface AggregateModeSettings {
|
|
746
|
+
enabled?: boolean;
|
|
747
|
+
constructions?: {
|
|
748
|
+
loggedInSegment?: boolean;
|
|
749
|
+
};
|
|
750
|
+
}
|
|
682
751
|
export interface InitConfig {
|
|
752
|
+
/** QA-only diagnostics for forced experiments omitted from the served config. */
|
|
753
|
+
qa_warnings?: Array<{
|
|
754
|
+
code: "forced_experiment_unavailable" | "edge_device_audience_unsupported";
|
|
755
|
+
experiment_id: string;
|
|
756
|
+
reason?: "archived" | "runtime_disabled" | "not_found" | "environment_mismatch";
|
|
757
|
+
/** Named audience that the edge runtime cannot reproduce. */
|
|
758
|
+
audience_name?: string;
|
|
759
|
+
}>;
|
|
760
|
+
/** Global program holdout. Missing or malformed values fail open. */
|
|
761
|
+
holdout_v1_enabled?: boolean;
|
|
762
|
+
holdout_pct?: number;
|
|
763
|
+
/** ISO timestamp for the reporting epoch that produced the holdout cohort. */
|
|
764
|
+
holdout_config_updated_at?: string | null;
|
|
683
765
|
/** Provide experiments inline OR use shopId to auto-fetch from API. */
|
|
684
766
|
experiments?: Experiment[];
|
|
685
767
|
/** Request-scoped edge geography used for targeting. */
|
|
@@ -698,18 +780,32 @@ export interface InitConfig {
|
|
|
698
780
|
};
|
|
699
781
|
/** Shop ID – when provided (without experiments), the SDK fetches running experiments from the API. */
|
|
700
782
|
shopId?: string;
|
|
783
|
+
/** Canonical storefront origin used to scope host-agnostic redirect source rules. */
|
|
784
|
+
storeOrigin?: string;
|
|
785
|
+
/** Registered public storefront origins accepted for host-agnostic redirect source rules. */
|
|
786
|
+
storeOrigins?: string[];
|
|
701
787
|
/** Base URL for event tracking & config API (e.g. "https://events.drip-apex.com"). */
|
|
702
788
|
endpoint?: string;
|
|
789
|
+
/** Prefer same-origin Shopify App Proxy delivery, with direct-worker fallback. */
|
|
790
|
+
proxyEventDelivery?: {
|
|
791
|
+
enabled: boolean;
|
|
792
|
+
path?: string;
|
|
793
|
+
};
|
|
794
|
+
assetFallback?: boolean;
|
|
703
795
|
/** Optional endpoint for signed storefront audit snapshots. Defaults to Apex production. */
|
|
704
796
|
auditEndpoint?: string;
|
|
705
797
|
/** Versioned editor bundle URL emitted by the Apex snippet. */
|
|
706
798
|
editorBundleUrl?: string;
|
|
799
|
+
/** Versioned replay recorder URL emitted by the Apex snippet. */
|
|
800
|
+
replayRecorderUrl?: string;
|
|
707
801
|
ingestShopId?: string;
|
|
708
802
|
ingestSignature?: string;
|
|
709
803
|
attributes?: Record<string, unknown>;
|
|
710
804
|
userId?: string;
|
|
711
805
|
url?: string;
|
|
712
806
|
autoTrack?: boolean;
|
|
807
|
+
/** Per-page storefront Core Web Vitals sample rate. Defaults to 0.1. */
|
|
808
|
+
storefrontVitalsSampleRate?: number;
|
|
713
809
|
/** Persist fetched config in localStorage for faster repeat loads. Default: true. */
|
|
714
810
|
configCache?: boolean;
|
|
715
811
|
/** Fresh cache window in ms for local config cache. Default: 300000 (5m). */
|
|
@@ -780,12 +876,22 @@ export interface InitConfig {
|
|
|
780
876
|
semanticTracking?: SemanticTrackingSettings;
|
|
781
877
|
/** Server-authoritative runtime kill switch state. */
|
|
782
878
|
runtimeControl?: RuntimeControlSettings;
|
|
879
|
+
/** Write assignment sync to a shared-domain cookie when Shopify's analytics bus is unavailable. Default: true. */
|
|
880
|
+
assignmentCookieSync?: boolean;
|
|
881
|
+
/** Legal-gated server-side aggregate-mode constructions. Missing values are off. */
|
|
882
|
+
aggregateMode?: AggregateModeSettings;
|
|
883
|
+
/** Selects whether the SDK or an external integration owns Shopify cart attribute writes. */
|
|
884
|
+
cartAttributeWrite?: "sdk" | "external";
|
|
885
|
+
/** Selects which assignment labels an external cart integration can read. */
|
|
886
|
+
cartAttributeScope?: "consented" | "all";
|
|
783
887
|
/** Snippet compiler delivery state for SDK performance telemetry. */
|
|
784
888
|
deliveryState?: "no_visual_tests" | "non_critical_visual" | "critical_visual" | "edge_managed" | string;
|
|
785
889
|
/** Worker/cache source label for SDK performance telemetry. */
|
|
786
890
|
scriptCacheSource?: "edge" | "kv" | "origin" | "precompile" | "precompiled" | string;
|
|
787
891
|
/** Install surface that emitted this script. */
|
|
788
892
|
installSurface?: "direct_script" | "shopify_app_embed" | "legacy_shopify_redirect" | string;
|
|
893
|
+
/** Exact snippet URL used for a per-visitor debug-build handoff. */
|
|
894
|
+
snippetUrl?: string;
|
|
789
895
|
/** Immutable SDK artifact version selected by the Worker. */
|
|
790
896
|
sdkVersion?: string;
|
|
791
897
|
/** Resolved SDK policy mode selected by the Worker. */
|
|
@@ -806,6 +912,7 @@ export interface InitConfig {
|
|
|
806
912
|
qa?: boolean;
|
|
807
913
|
harness?: boolean;
|
|
808
914
|
audit?: boolean;
|
|
915
|
+
debugLoader?: boolean;
|
|
809
916
|
};
|
|
810
917
|
/** Runtime kill-switches for staged rollout features. */
|
|
811
918
|
perfFlags?: PerfFeatureFlags;
|
|
@@ -833,7 +940,6 @@ export interface InitConfig {
|
|
|
833
940
|
* Custom JS execution policy. Default: "hybrid".
|
|
834
941
|
* - "strict": no custom JS execution in production.
|
|
835
942
|
* - "hybrid": custom JS allowed with safety guards (sourceURL, error isolation).
|
|
836
|
-
* - "flex": unrestricted custom JS (legacy behavior).
|
|
837
943
|
*/
|
|
838
944
|
customJsPolicy?: CustomJsPolicy;
|
|
839
945
|
/** If true, analytics/goal tracking starts only after consent is granted. */
|
package/dist/types/wait.d.ts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import { Mutation } from "./types";
|
|
2
|
+
import { type CurrencyToken } from "./money";
|
|
2
3
|
export declare function waitForElement(selector: string, callback: (el: Element) => void, options?: {
|
|
3
4
|
ttlMs?: number;
|
|
4
5
|
onMiss?: () => void;
|
|
6
|
+
ownerKeys?: readonly string[];
|
|
7
|
+
ownerKeysSet?: Set<string>;
|
|
8
|
+
artifactId?: string;
|
|
9
|
+
epoch?: number;
|
|
5
10
|
}): void;
|
|
6
|
-
export declare function applyMutationWithWait(mutation: Mutation, index: number, onApplied?: ((mutation: Mutation, element: Element, index: number) => void) | null, onMiss?: ((mutation: Mutation, index: number) => void) | null
|
|
11
|
+
export declare function applyMutationWithWait(mutation: Mutation, index: number, onApplied?: ((mutation: Mutation, element: Element, index: number, journalSeq?: number) => void) | null, onMiss?: ((mutation: Mutation, index: number) => void) | null, ownerKeys?: readonly string[], artifactId?: string, epoch?: number, pricePreservation?: {
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
onViolation: (input: {
|
|
14
|
+
selector: string;
|
|
15
|
+
originalPriceTokens: CurrencyToken[];
|
|
16
|
+
}) => void;
|
|
17
|
+
}): void;
|
|
18
|
+
export declare function addWaitEntryOwners(existingOwnerKeys: ReadonlySet<string>, ownerKeys: readonly string[], artifactId?: string): void;
|
|
19
|
+
export declare function resetWaitEntriesForOwner(ownerKey: string, artifactId?: string): void;
|
|
7
20
|
export declare function resetWaitEntries(): void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { isWeekdayExcluded, resetWeekdayScheduleWarningsForTests, WEEKDAYS, } from "@drip/shared-runtime/weekday-schedule";
|
|
2
|
+
export type { Weekday, WeekdaySchedule, } from "@drip/shared-runtime/weekday-schedule";
|
|
3
|
+
export declare function weekdayScheduleBlocksDelivery(schedule: unknown, now: Date): boolean;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drip-apex/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"main": "dist/drip.
|
|
5
|
+
"main": "./dist/drip.cjs",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
@@ -10,15 +10,21 @@
|
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./dist/types/index.d.ts",
|
|
13
|
-
"
|
|
13
|
+
"import": "./dist/drip.mjs",
|
|
14
|
+
"require": "./dist/drip.cjs",
|
|
15
|
+
"default": "./dist/drip.mjs"
|
|
14
16
|
},
|
|
15
17
|
"./define": {
|
|
16
18
|
"types": "./dist/types/define.d.ts",
|
|
17
|
-
"
|
|
19
|
+
"import": "./dist/define.mjs",
|
|
20
|
+
"require": "./dist/define.cjs",
|
|
21
|
+
"default": "./dist/define.mjs"
|
|
18
22
|
},
|
|
19
23
|
"./flags": {
|
|
20
24
|
"types": "./dist/types/flags.d.ts",
|
|
21
|
-
"
|
|
25
|
+
"import": "./dist/flags.mjs",
|
|
26
|
+
"require": "./dist/flags.cjs",
|
|
27
|
+
"default": "./dist/flags.mjs"
|
|
22
28
|
},
|
|
23
29
|
"./react": {
|
|
24
30
|
"types": "./dist/types/react/index.d.ts",
|
|
@@ -37,7 +43,7 @@
|
|
|
37
43
|
"scripts": {
|
|
38
44
|
"build": "node build.mjs && npm run build:types",
|
|
39
45
|
"build:types": "tsc -p tsconfig.json --emitDeclarationOnly --outDir dist/types",
|
|
40
|
-
"typecheck": "tsc --noEmit",
|
|
46
|
+
"typecheck": "tsc -p tsconfig.typecheck.json --noEmit",
|
|
41
47
|
"deploy:pages": "npm run build && ../worker/node_modules/.bin/wrangler pages deploy dist --project-name drip-sdk",
|
|
42
48
|
"deploy:pages:staging": "npm run build && ../worker/node_modules/.bin/wrangler pages deploy dist --project-name ${SDK_PAGES_PROJECT_STAGING:-drip-sdk-staging}",
|
|
43
49
|
"test": "vitest run && npm run build && node --test bundle-report.test.mjs package-entry.test.mjs",
|
|
@@ -53,15 +59,18 @@
|
|
|
53
59
|
}
|
|
54
60
|
},
|
|
55
61
|
"devDependencies": {
|
|
56
|
-
"@testing-library/react": "^16.3.1",
|
|
57
62
|
"@drip/event-schema": "file:../event-schema",
|
|
63
|
+
"@drip/shared-runtime": "file:../shared-runtime",
|
|
64
|
+
"@testing-library/react": "^16.3.1",
|
|
58
65
|
"@types/react": "^19.2.14",
|
|
59
66
|
"esbuild": "0.28.1",
|
|
67
|
+
"fflate": "0.8.2",
|
|
60
68
|
"jsdom": "^27.3.0",
|
|
61
69
|
"react": "^19.2.7",
|
|
62
70
|
"react-dom": "^19.2.7",
|
|
71
|
+
"rrweb": "2.1.1",
|
|
63
72
|
"terser": "5.48.0",
|
|
64
|
-
"typescript": "^5.
|
|
73
|
+
"typescript": "^5.9.3",
|
|
65
74
|
"vitest": "^3.2.6"
|
|
66
75
|
},
|
|
67
76
|
"overrides": {
|