@drip-apex/sdk 0.1.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/LICENSE +21 -0
- package/README.md +46 -0
- package/dist/_headers +3 -0
- package/dist/bundle-report.json +564 -0
- package/dist/drip.debug.js +2 -0
- package/dist/drip.debug.js.map +1 -0
- package/dist/drip.heatmap.js +2 -0
- package/dist/drip.heatmap.js.map +1 -0
- package/dist/drip.js +2 -0
- package/dist/drip.js.map +1 -0
- package/dist/drip.live.js +2 -0
- package/dist/drip.live.js.map +1 -0
- package/dist/editor.js +480 -0
- package/dist/editor.js.map +7 -0
- package/dist/index.mjs +645 -0
- package/dist/index.mjs.map +7 -0
- package/dist/metafiles/drip.debug.meta.json +973 -0
- package/dist/metafiles/drip.heatmap.meta.json +918 -0
- package/dist/metafiles/drip.live.meta.json +918 -0
- package/dist/metafiles/drip.meta.json +973 -0
- package/dist/metafiles/editor.meta.json +321 -0
- package/dist/metafiles/index.meta.json +1039 -0
- package/dist/metafiles/index.mjs.meta.json +78 -0
- package/dist/react/index.js +16973 -0
- package/dist/react/index.js.map +7 -0
- package/dist/sri.json +27 -0
- package/dist/types/analytics.d.ts +15 -0
- package/dist/types/antiflicker.d.ts +14 -0
- package/dist/types/assignment-store.d.ts +30 -0
- package/dist/types/audit.d.ts +9 -0
- package/dist/types/bucket.d.ts +2 -0
- package/dist/types/bucketing-cleanup.d.ts +5 -0
- package/dist/types/commerce-gift.d.ts +41 -0
- package/dist/types/commerce-price.d.ts +22 -0
- package/dist/types/commerce-shipping.d.ts +28 -0
- package/dist/types/css.d.ts +5 -0
- package/dist/types/cwv.d.ts +10 -0
- package/dist/types/data-layer-normalize.d.ts +1 -0
- package/dist/types/debug.d.ts +23 -0
- package/dist/types/define.d.ts +87 -0
- package/dist/types/devtools.d.ts +32 -0
- package/dist/types/dom-trigger.d.ts +3 -0
- package/dist/types/editor/api.d.ts +37 -0
- package/dist/types/editor/artifacts.d.ts +15 -0
- package/dist/types/editor/command-runtime.d.ts +48 -0
- package/dist/types/editor/controller.d.ts +97 -0
- package/dist/types/editor/device-preview.d.ts +23 -0
- package/dist/types/editor/index.d.ts +9 -0
- package/dist/types/editor/operator.d.ts +39 -0
- package/dist/types/editor/picker.d.ts +23 -0
- package/dist/types/editor/selector.d.ts +2 -0
- package/dist/types/editor/types.d.ts +55 -0
- package/dist/types/editor/view-kit.d.ts +33 -0
- package/dist/types/editor/view.d.ts +5 -0
- package/dist/types/editor-bootstrap.d.ts +37 -0
- package/dist/types/exclusion-groups.d.ts +59 -0
- package/dist/types/exposure-signals.d.ts +7 -0
- package/dist/types/flags.d.ts +65 -0
- package/dist/types/goals.d.ts +16 -0
- package/dist/types/guards.d.ts +39 -0
- package/dist/types/handover.d.ts +10 -0
- package/dist/types/hash.d.ts +19 -0
- package/dist/types/heatmap.d.ts +8 -0
- package/dist/types/hideflicker.d.ts +15 -0
- package/dist/types/hydration.d.ts +11 -0
- package/dist/types/index.d.ts +144 -0
- package/dist/types/js.d.ts +6 -0
- package/dist/types/module.d.ts +4 -0
- package/dist/types/money.d.ts +14 -0
- package/dist/types/mutate.d.ts +34 -0
- package/dist/types/observer-mute.d.ts +3 -0
- package/dist/types/pii-keys.d.ts +1 -0
- package/dist/types/prerequisites.d.ts +12 -0
- package/dist/types/qa-assistant-state.d.ts +68 -0
- package/dist/types/qa-assistant-view.d.ts +6 -0
- package/dist/types/qa-assistant.d.ts +9 -0
- package/dist/types/qa-toolbar.d.ts +19 -0
- package/dist/types/react/index.d.ts +84 -0
- package/dist/types/reassert-sentinel.d.ts +6 -0
- package/dist/types/router.d.ts +9 -0
- package/dist/types/runtime-tools.d.ts +50 -0
- package/dist/types/runtime.d.ts +22 -0
- package/dist/types/safe-regex.d.ts +6 -0
- package/dist/types/sanitize.d.ts +5 -0
- package/dist/types/semantic.d.ts +7 -0
- package/dist/types/shopify-cart-events.d.ts +7 -0
- package/dist/types/shopify-cart.d.ts +62 -0
- package/dist/types/signals.d.ts +31 -0
- package/dist/types/surface-signals.d.ts +6 -0
- package/dist/types/targeting-diagnostics.d.ts +5 -0
- package/dist/types/targeting.d.ts +50 -0
- package/dist/types/test-fixtures/commerce.d.ts +12 -0
- package/dist/types/track.d.ts +79 -0
- package/dist/types/types.d.ts +859 -0
- package/dist/types/wait.d.ts +7 -0
- package/package.json +74 -0
- package/src/analytics.ts +146 -0
- package/src/antiflicker.test.ts +127 -0
- package/src/antiflicker.ts +147 -0
- package/src/assignment-store.test.ts +171 -0
- package/src/assignment-store.ts +208 -0
- package/src/audit.test.ts +17 -0
- package/src/audit.ts +362 -0
- package/src/bucket.test.ts +65 -0
- package/src/bucket.ts +18 -0
- package/src/bucketing-cleanup.test.ts +30 -0
- package/src/bucketing-cleanup.ts +72 -0
- package/src/bucketing-parity.test.ts +41 -0
- package/src/commerce-analytics-lifecycle.test.ts +1416 -0
- package/src/commerce-config-lifecycle.test.ts +274 -0
- package/src/commerce-epoch-lifecycle.test.ts +62 -0
- package/src/commerce-gift.test.ts +1293 -0
- package/src/commerce-gift.ts +979 -0
- package/src/commerce-offers-display.test.ts +154 -0
- package/src/commerce-price.test.ts +1145 -0
- package/src/commerce-price.ts +941 -0
- package/src/commerce-revocation-lifecycle.test.ts +78 -0
- package/src/commerce-shipping.test.ts +630 -0
- package/src/commerce-shipping.ts +447 -0
- package/src/config-fetch.test.ts +325 -0
- package/src/css.ts +54 -0
- package/src/cwv.test.ts +95 -0
- package/src/cwv.ts +129 -0
- package/src/data-layer-normalize.ts +21 -0
- package/src/debug.test.ts +83 -0
- package/src/debug.ts +138 -0
- package/src/define.test.ts +327 -0
- package/src/define.ts +208 -0
- package/src/devtools.ts +582 -0
- package/src/dom-trigger.test.ts +70 -0
- package/src/dom-trigger.ts +55 -0
- package/src/editor/api.test.ts +154 -0
- package/src/editor/api.ts +185 -0
- package/src/editor/artifacts.test.ts +57 -0
- package/src/editor/artifacts.ts +115 -0
- package/src/editor/command-runtime.test.ts +225 -0
- package/src/editor/command-runtime.ts +572 -0
- package/src/editor/controller.test.ts +371 -0
- package/src/editor/controller.ts +596 -0
- package/src/editor/device-preview.test.ts +60 -0
- package/src/editor/device-preview.ts +120 -0
- package/src/editor/index.test.ts +161 -0
- package/src/editor/index.ts +169 -0
- package/src/editor/operator.test.ts +148 -0
- package/src/editor/operator.ts +256 -0
- package/src/editor/picker.test.ts +58 -0
- package/src/editor/picker.ts +152 -0
- package/src/editor/selector.test.ts +44 -0
- package/src/editor/selector.ts +110 -0
- package/src/editor/types.ts +92 -0
- package/src/editor/view-kit.ts +162 -0
- package/src/editor/view.test.ts +535 -0
- package/src/editor/view.ts +1395 -0
- package/src/editor-bootstrap.test.ts +116 -0
- package/src/editor-bootstrap.ts +213 -0
- package/src/event-schema-contract.test.ts +35 -0
- package/src/exclusion-groups.test.ts +383 -0
- package/src/exclusion-groups.ts +270 -0
- package/src/exposure-signals.test.ts +182 -0
- package/src/exposure-signals.ts +110 -0
- package/src/flags.test.ts +322 -0
- package/src/flags.ts +201 -0
- package/src/goals.test.ts +42 -0
- package/src/goals.ts +200 -0
- package/src/guards.test.ts +249 -0
- package/src/guards.ts +250 -0
- package/src/handover-cache-order.test.ts +32 -0
- package/src/handover.test.ts +349 -0
- package/src/handover.ts +309 -0
- package/src/hash.ts +214 -0
- package/src/heatmap.test.ts +305 -0
- package/src/heatmap.ts +373 -0
- package/src/hideflicker.ts +21 -0
- package/src/hydration.test.ts +252 -0
- package/src/hydration.ts +203 -0
- package/src/index.ts +7513 -0
- package/src/init-empty.test.ts +5572 -0
- package/src/js.test.ts +26 -0
- package/src/js.ts +61 -0
- package/src/module.ts +50 -0
- package/src/money.test.ts +35 -0
- package/src/money.ts +53 -0
- package/src/mutate.test.ts +304 -0
- package/src/mutate.ts +469 -0
- package/src/observer-mute.test.ts +88 -0
- package/src/observer-mute.ts +45 -0
- package/src/page-trigger.test.ts +84 -0
- package/src/personalization.test.ts +68 -0
- package/src/pii-keys.ts +17 -0
- package/src/prerequisites.test.ts +39 -0
- package/src/prerequisites.ts +94 -0
- package/src/qa-assistant-state.test.ts +471 -0
- package/src/qa-assistant-state.ts +505 -0
- package/src/qa-assistant-view.test.ts +185 -0
- package/src/qa-assistant-view.ts +768 -0
- package/src/qa-assistant.ts +40 -0
- package/src/qa-toolbar.ts +444 -0
- package/src/react/index.test.tsx +177 -0
- package/src/react/index.tsx +252 -0
- package/src/reassert-sentinel.test.ts +314 -0
- package/src/reassert-sentinel.ts +191 -0
- package/src/router.test.ts +78 -0
- package/src/router.ts +92 -0
- package/src/runtime-tools.test.ts +112 -0
- package/src/runtime-tools.ts +403 -0
- package/src/runtime.test.ts +217 -0
- package/src/runtime.ts +268 -0
- package/src/safe-regex.ts +35 -0
- package/src/sanitize.ts +34 -0
- package/src/semantic.ts +245 -0
- package/src/shopify-cart-events.test.ts +76 -0
- package/src/shopify-cart-events.ts +115 -0
- package/src/shopify-cart.test.ts +2823 -0
- package/src/shopify-cart.ts +1256 -0
- package/src/signals.ts +226 -0
- package/src/surface-signals.test.ts +83 -0
- package/src/surface-signals.ts +165 -0
- package/src/targeting-diagnostics.ts +560 -0
- package/src/targeting.detailed.test.ts +443 -0
- package/src/targeting.test.ts +1054 -0
- package/src/targeting.ts +1024 -0
- package/src/test-fixtures/commerce.ts +65 -0
- package/src/track.test.ts +817 -0
- package/src/track.ts +519 -0
- package/src/types.ts +991 -0
- package/src/wait.test.ts +96 -0
- package/src/wait.ts +238 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
type PickerOverlay = {
|
|
2
|
+
box: HTMLElement;
|
|
3
|
+
label: HTMLElement;
|
|
4
|
+
};
|
|
5
|
+
export declare class ElementPicker {
|
|
6
|
+
private readonly overlay;
|
|
7
|
+
private readonly onSelect;
|
|
8
|
+
private readonly onActiveChange;
|
|
9
|
+
private readonly onUnsupported?;
|
|
10
|
+
private active;
|
|
11
|
+
private hovered;
|
|
12
|
+
private selected;
|
|
13
|
+
constructor(overlay: PickerOverlay, onSelect: (element: Element, selector: string) => void, onActiveChange: (active: boolean) => void, onUnsupported?: (() => void) | undefined);
|
|
14
|
+
setActive(active: boolean): void;
|
|
15
|
+
setSelected(element: Element | null): void;
|
|
16
|
+
destroy(): void;
|
|
17
|
+
private onPointerMove;
|
|
18
|
+
private onClick;
|
|
19
|
+
private onKeyDown;
|
|
20
|
+
private refresh;
|
|
21
|
+
private renderOverlay;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Mutation } from "../types";
|
|
2
|
+
export type ActiveEditorSession = {
|
|
3
|
+
sid: string;
|
|
4
|
+
bearer: string;
|
|
5
|
+
expiresAt: string;
|
|
6
|
+
shopId: string;
|
|
7
|
+
experimentId: string;
|
|
8
|
+
experimentName?: string | null;
|
|
9
|
+
initialVariationId: string;
|
|
10
|
+
targetUrl: string;
|
|
11
|
+
targetOrigin: string;
|
|
12
|
+
variations: Array<{
|
|
13
|
+
id: string;
|
|
14
|
+
name?: string | null;
|
|
15
|
+
slug?: string | null;
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
18
|
+
export type EditorArtifacts = {
|
|
19
|
+
mutations: Mutation[];
|
|
20
|
+
customCss: string;
|
|
21
|
+
customJs: string;
|
|
22
|
+
};
|
|
23
|
+
export type EditorVariation = {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
artifactHash: string;
|
|
27
|
+
reviewStatus: string | null;
|
|
28
|
+
};
|
|
29
|
+
export type EditorBrowserCommand = "navigate" | "reload" | "back" | "forward" | "click" | "type" | "wait_for" | "snapshot" | "screenshot" | "eval_readonly" | "console_logs" | "network_logs" | "network_probe" | "current_url" | "select_element" | "apply_artifacts";
|
|
30
|
+
export type ClaimedEditorCommand = {
|
|
31
|
+
commandId: string;
|
|
32
|
+
command: EditorBrowserCommand;
|
|
33
|
+
args: Record<string, unknown>;
|
|
34
|
+
expiresAt: string | null;
|
|
35
|
+
};
|
|
36
|
+
export type EditorSaveState = "idle" | "saving" | "saved" | "conflict" | "error";
|
|
37
|
+
export type EditorDeviceState = "closed" | "loading" | "active" | "blocked";
|
|
38
|
+
export type EditorState = {
|
|
39
|
+
variation: EditorVariation | null;
|
|
40
|
+
artifacts: EditorArtifacts;
|
|
41
|
+
artifactsEnabled: boolean;
|
|
42
|
+
pickerActive: boolean;
|
|
43
|
+
selectedElement: Element | null;
|
|
44
|
+
selectedSelector: string | null;
|
|
45
|
+
saveState: EditorSaveState;
|
|
46
|
+
saveMessage: string | null;
|
|
47
|
+
dock: "top" | "bottom";
|
|
48
|
+
canUndo: boolean;
|
|
49
|
+
canRedo: boolean;
|
|
50
|
+
jsApplied: boolean;
|
|
51
|
+
reloadRequired: boolean;
|
|
52
|
+
deviceState: EditorDeviceState;
|
|
53
|
+
};
|
|
54
|
+
export declare const EMPTY_EDITOR_ARTIFACTS: EditorArtifacts;
|
|
55
|
+
export declare function cloneArtifacts(artifacts: EditorArtifacts): EditorArtifacts;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const ICONS: {
|
|
2
|
+
readonly pointer: "M4 3l7.6 18 2.3-7.4L21 11.5zM13.9 13.9L19 19";
|
|
3
|
+
readonly undo: "M9 14L4 9l5-5M4 9h10.5a5.5 5.5 0 015.5 5.5v0a5.5 5.5 0 01-5.5 5.5H11";
|
|
4
|
+
readonly redo: "M15 14l5-5-5-5M20 9H9.5A5.5 5.5 0 004 14.5v0A5.5 5.5 0 009.5 20H13";
|
|
5
|
+
readonly monitor: "M3 4h18a1 1 0 011 1v11a1 1 0 01-1 1H3a1 1 0 01-1-1V5a1 1 0 011-1zM8 21h8M12 17v4";
|
|
6
|
+
readonly tablet: "M6 2h12a2 2 0 012 2v16a2 2 0 01-2 2H6a2 2 0 01-2-2V4a2 2 0 012-2zM12 18h.01";
|
|
7
|
+
readonly phone: "M8 2h8a2 2 0 012 2v16a2 2 0 01-2 2H8a2 2 0 01-2-2V4a2 2 0 012-2zM11 18h2";
|
|
8
|
+
readonly wifiOff: "M2 2l20 20M8.5 16.5a5 5 0 015.6-1M5 12.5a10 10 0 015.2-2.7M2 8.8a15 15 0 014.2-2.5M16.6 6.6A15 15 0 0122 8.8M12 20h.01";
|
|
9
|
+
readonly braces: "M8 3H7a2 2 0 00-2 2v4a2 2 0 01-2 2 2 2 0 012 2v4a2 2 0 002 2h1M16 3h1a2 2 0 012 2v4a2 2 0 002 2 2 2 0 00-2 2v4a2 2 0 01-2 2h-1";
|
|
10
|
+
readonly collapse: "M9 3v18M3 5a2 2 0 012-2h14a2 2 0 012 2v14a2 2 0 01-2 2H5a2 2 0 01-2-2zM13 10l3 2-3 2";
|
|
11
|
+
readonly history: "M3 12a9 9 0 113 6.7M3 12H1.5M3 12l-1.8 2M12 7v5l3.5 2";
|
|
12
|
+
readonly send: "M22 2L11 13M22 2l-7 20-4-9-9-4z";
|
|
13
|
+
readonly stop: "M6 6h12v12H6z";
|
|
14
|
+
readonly cursorBox: "M3 3h8M3 3v8M21 13v8h-8M9 9l7 7M16 9v7h-7";
|
|
15
|
+
readonly check: "M5 13l4 4L19 7";
|
|
16
|
+
readonly x: "M18 6L6 18M6 6l12 12";
|
|
17
|
+
readonly chevD: "M6 9l6 6 6-6";
|
|
18
|
+
readonly chevR: "M9 6l6 6-6 6";
|
|
19
|
+
readonly refresh: "M3 12a9 9 0 0114.5-7L21 8M21 3v5h-5M21 12a9 9 0 01-14.5 7L3 16M3 21v-5h5";
|
|
20
|
+
readonly external: "M15 3h6v6M21 3l-9 9M10 5H5a2 2 0 00-2 2v12a2 2 0 002 2h12a2 2 0 002-2v-5";
|
|
21
|
+
readonly code: "M16 18l6-6-6-6M8 6l-6 6 6 6";
|
|
22
|
+
readonly clock: "M12 22a10 10 0 100-20 10 10 0 000 20zM12 7v5l3 2";
|
|
23
|
+
readonly eye: "M2 12s4-7 10-7 10 7 10 7-4 7-10 7-10-7-10-7zM12 15a3 3 0 100-6 3 3 0 000 6z";
|
|
24
|
+
readonly alert: "M10.3 3.9L1.8 18a2 2 0 001.7 3h17a2 2 0 001.7-3L13.7 3.9a2 2 0 00-3.4 0zM12 9v4M12 17h.01";
|
|
25
|
+
readonly globe: "M12 2a10 10 0 100 20 10 10 0 000-20zM2 12h20M12 2a15 15 0 010 20M12 2a15 15 0 000 20";
|
|
26
|
+
readonly play: "M6 4l14 8-14 8z";
|
|
27
|
+
readonly dot: "M12 12h.01";
|
|
28
|
+
};
|
|
29
|
+
export type IconName = keyof typeof ICONS;
|
|
30
|
+
export declare function icon(name: IconName, size?: number, extra?: string): string;
|
|
31
|
+
export declare function operatorMark(size?: number, color?: string): string;
|
|
32
|
+
export declare function esc(value: string): string;
|
|
33
|
+
export declare const KIT_CSS = "\n:host {\n --bg0:#08080A;--bg1:#0A0A0C;--raised:#141419;--raised-hi:#1A1A21;--inset:#0B0B0E;\n --border:rgba(255,255,255,0.06);--border-hi:rgba(255,255,255,0.10);--border-px:rgba(255,255,255,0.14);\n --text1:#FAFAFA;--text2:rgba(255,255,255,0.66);--text3:rgba(255,255,255,0.42);--text4:rgba(255,255,255,0.26);\n --purple500:#5B29FF;--purple400:#7C54FF;--purple300:#9B6FFF;--purple200:#C8B4FF;\n --purple-soft:rgba(91,41,255,0.14);--purple-bd:rgba(124,84,255,0.34);\n --positive:#3DD68C;--warning:#FACC15;--negative:#EB5252;--negative-soft:#F39797;\n all:initial;font-family:Inter,system-ui,sans-serif;color:var(--text1);letter-spacing:0;\n position:fixed;inset:0;z-index:2147483647;pointer-events:none;font-size:12.5px;line-height:1.5;\n}\n*{box-sizing:border-box;letter-spacing:0;margin:0;padding:0}\nbutton,input,select,textarea{font:inherit;color:inherit;font-family:inherit}\nbutton{cursor:pointer;background:none;border:none}\nbutton:disabled{cursor:not-allowed}\n:is(button,textarea,input,a):focus-visible{outline:2px solid var(--purple400);outline-offset:2px}\n@keyframes ee-spin{to{transform:rotate(360deg)}}\n@keyframes ee-pulse{0%{transform:scale(0.7);opacity:0.9}100%{transform:scale(1.6);opacity:0}}\n@keyframes ee-in{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}\n.ee-in{animation:ee-in 160ms ease-out}\n.spin{animation:ee-spin 1s linear infinite}\n@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:0.01ms!important;animation-iteration-count:1!important;transition-duration:0.01ms!important}}\n\n/* Buttons */\n.btn{display:inline-flex;align-items:center;gap:7px;justify-content:center;padding:7px 12px;font-size:13px;font-weight:550;border-radius:8px;border:1px solid transparent;line-height:1.2;white-space:nowrap;transition:background 120ms,border-color 120ms,color 120ms;pointer-events:auto}\n.btn.sm{padding:5px 10px;font-size:12px}\n.btn:disabled{opacity:0.45}\n.btn.primary{background:var(--purple500);color:#fff;border-color:rgba(255,255,255,0.14)}\n.btn.soft{background:var(--purple-soft);color:var(--purple200);border-color:var(--purple-bd)}\n.btn.ghost{background:transparent;color:var(--text2);border-color:var(--border)}\n.btn.ghost:hover{background:var(--raised-hi);color:var(--text1)}\n.btn.bare{background:transparent;color:var(--text2);border-color:transparent}\n.btn.danger{background:rgba(235,82,82,0.14);color:var(--negative-soft);border-color:rgba(235,82,82,0.3)}\n.iconbtn{width:30px;height:30px;display:inline-flex;align-items:center;justify-content:center;border-radius:8px;border:1px solid transparent;background:transparent;color:var(--text2);flex-shrink:0;transition:background 120ms,color 120ms;pointer-events:auto}\n.iconbtn:hover{background:var(--raised-hi);color:var(--text1)}\n.iconbtn.active{background:var(--purple-soft);color:var(--purple200);border-color:var(--purple-bd)}\n.iconbtn:disabled{opacity:0.4}\n.iconbtn.xs{width:22px;height:22px}\n\n/* Status dot */\n.dot{position:relative;width:7px;height:7px;flex-shrink:0;display:inline-block}\n.dot i{position:absolute;inset:0;border-radius:50%}\n.dot.ok i{background:var(--positive)}.dot.warn i{background:var(--warning)}.dot.err i{background:var(--negative)}.dot.purple i{background:var(--purple300)}\n.dot b{position:absolute;inset:-3px;border-radius:50%;border:1px solid currentColor}\n.dot.ok b{color:var(--positive)}.dot.warn b{color:var(--warning)}.dot.err b{color:var(--negative)}.dot.purple b{color:var(--purple300)}\n.dot b{animation:ee-pulse 1.4s ease-out infinite}\n\n/* Save chip */\n.save-chip{display:inline-flex;align-items:center;gap:7px;font-size:12px;font-weight:550;padding:4px 9px;border-radius:7px;background:rgba(255,255,255,0.04);border:1px solid var(--border);white-space:nowrap}\n.save-chip.unsaved{color:var(--warning)}\n.save-chip.saving{color:var(--purple200)}\n.save-chip.saved{color:var(--positive)}\n.save-chip.failed,.save-chip.conflict{color:var(--negative-soft);background:rgba(235,82,82,0.10);border-color:rgba(235,82,82,0.25)}\n.save-chip .retry{border:none;background:rgba(255,255,255,0.1);color:#fff;font-size:11.5px;font-weight:600;border-radius:5px;padding:2px 7px;margin-left:2px;pointer-events:auto}\n\n/* Segmented control */\n.seg{display:inline-flex;background:var(--inset);border-radius:8px;padding:2px;gap:2px;border:1px solid var(--border);pointer-events:auto}\n.seg button{display:inline-flex;align-items:center;gap:6px;justify-content:center;padding:5px 11px;border-radius:6px;border:none;background:transparent;color:var(--text3);font-size:12px;font-weight:550;transition:background 120ms,color 120ms}\n.seg button.sm{padding:4px 8px}\n.seg button[aria-checked=\"true\"]{background:var(--raised-hi);color:var(--text1);box-shadow:inset 0 0 0 1px var(--border-px)}\n\n/* Pills & chips */\n.draft-pill{display:inline-flex;align-items:center;gap:6px;padding:2px 8px;border-radius:999px;background:rgba(250,204,21,0.10);border:1px solid rgba(250,204,21,0.3);font-size:11px;font-weight:600;color:var(--warning);white-space:nowrap}\n.session-chip{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:550;color:var(--warning);padding:4px 9px;border-radius:7px;border:1px solid rgba(250,204,21,0.35);background:rgba(250,204,21,0.08);white-space:nowrap;font-variant-numeric:tabular-nums}\n.session-chip .extend{border:none;background:rgba(250,204,21,0.16);color:var(--warning);font-size:11.5px;font-weight:600;border-radius:5px;padding:2px 7px;pointer-events:auto}\n.session-note{font-size:11px;color:var(--text4);white-space:nowrap}\n.conn-chip{display:inline-flex;align-items:center;gap:7px;font-size:12px;font-weight:550;white-space:nowrap;color:var(--text3)}\n.conn-chip.offline{color:var(--negative-soft)}\n.conn-chip.connecting{color:var(--warning)}\n.ctx-chip{display:inline-flex;align-items:center;gap:7px;max-width:100%;background:var(--purple-soft);border:1px solid var(--purple-bd);border-radius:8px;padding:5px 8px;font-size:11.5px;color:var(--purple200);font-weight:550}\n.ctx-chip .name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.ctx-chip .replace{border:none;background:rgba(255,255,255,0.08);color:var(--text2);font-size:10.5px;font-weight:600;border-radius:5px;padding:2px 7px;pointer-events:auto}\n.ctx-chip .clear{border:none;background:none;color:var(--text3);padding:2px;display:inline-flex;pointer-events:auto}\n\n/* Fields */\n.field{width:100%;background:var(--inset);color:var(--text1);border:1px solid var(--border-hi);border-radius:8px;padding:8px 10px;font-size:12.5px;line-height:1.5;outline:none;resize:vertical;pointer-events:auto}\n.field::placeholder{color:rgba(255,255,255,0.28)}\n.field.code{white-space:pre;font-variant-numeric:tabular-nums;min-height:150px}\n.flabel{display:block;font-size:11.5px;font-weight:550;color:var(--text3);margin-bottom:5px}\n.fhint{display:block;font-size:11px;color:var(--text4);margin-top:4px}\n\n/* Banners */\n.banner{display:flex;align-items:center;gap:9px;padding:8px 12px;border-radius:10px;color:var(--text1);font-size:12.5px;box-shadow:0 12px 32px rgba(0,0,0,0.4);pointer-events:auto;max-width:560px}\n.banner .body{flex:1;min-width:0}\n.banner.info{background:linear-gradient(0deg,rgba(91,41,255,0.16),rgba(91,41,255,0.16)),var(--bg1);border:1px solid var(--purple-bd)}\n.banner.info svg{color:var(--purple200)}\n.banner.warn{background:linear-gradient(0deg,rgba(250,204,21,0.10),rgba(250,204,21,0.10)),var(--bg1);border:1px solid rgba(250,204,21,0.35)}\n.banner.warn svg{color:var(--warning)}\n.banner.error{background:linear-gradient(0deg,rgba(235,82,82,0.12),rgba(235,82,82,0.12)),var(--bg1);border:1px solid rgba(235,82,82,0.35)}\n.banner.error svg{color:var(--negative-soft)}\n\n/* Modal */\n.modal-backdrop{position:fixed;inset:0;z-index:300;display:flex;align-items:center;justify-content:center;background:rgba(5,5,8,0.55);backdrop-filter:blur(3px);pointer-events:auto}\n.modal{width:430px;max-width:calc(100vw - 40px);background:var(--bg1);border:1px solid var(--border-px);border-radius:14px;box-shadow:0 32px 80px rgba(0,0,0,0.55);overflow:hidden;color:var(--text1)}\n.modal .m-head{display:flex;gap:10px;align-items:flex-start;padding:18px 18px 0}\n.modal .m-icon{width:30px;height:30px;border-radius:8px;background:rgba(255,255,255,0.05);border:1px solid var(--border);display:flex;align-items:center;justify-content:center;flex-shrink:0}\n.modal .m-icon.warn{color:var(--warning)}.modal .m-icon.purple{color:var(--purple300)}.modal .m-icon.ok{color:var(--positive)}\n.modal .m-title{font-size:15px;font-weight:600;letter-spacing:-0.015em;padding-top:4px}\n.modal .m-body{padding:12px 18px 4px;font-size:13px;line-height:1.6;color:var(--text2)}\n.modal .m-body p{margin:0}\n.modal .m-body p+p{margin-top:10px}\n.modal .m-actions{display:flex;justify-content:flex-end;gap:8px;padding:14px 18px 18px}\n";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const EDITOR_FRAGMENT_KEY = "apex-editor";
|
|
2
|
+
export declare const EDITOR_BUNDLE_FILENAME = "editor.js";
|
|
3
|
+
export declare const EDITOR_DEVICE_FRAME_NAME = "apex-editor-device-preview";
|
|
4
|
+
export type EditorLaunchHint = {
|
|
5
|
+
token: string;
|
|
6
|
+
sid: string;
|
|
7
|
+
apiOrigin: string;
|
|
8
|
+
};
|
|
9
|
+
type LocationLike = Pick<Location, "hash" | "href">;
|
|
10
|
+
type HistoryLike = Pick<History, "replaceState" | "state">;
|
|
11
|
+
export type EditorBundleApi = {
|
|
12
|
+
start: (launch: EditorLaunchHint) => boolean | Promise<boolean>;
|
|
13
|
+
};
|
|
14
|
+
export declare function isEditorDevicePreview(windowLike?: Pick<Window, "name">): boolean;
|
|
15
|
+
export declare function decodeEditorLaunchToken(token: string): Omit<EditorLaunchHint, "token"> | null;
|
|
16
|
+
export declare function consumeEditorLaunchFragment(locationLike?: LocationLike, historyLike?: HistoryLike): EditorLaunchHint | null;
|
|
17
|
+
export declare function resolveEditorBundleUrl(input: {
|
|
18
|
+
configuredUrl?: string;
|
|
19
|
+
scriptSrc?: string;
|
|
20
|
+
pageUrl?: string;
|
|
21
|
+
}): string | null;
|
|
22
|
+
export declare function loadEditorBundle(bundleUrl: string, documentLike?: Document, timeoutMs?: number): Promise<EditorBundleApi>;
|
|
23
|
+
export declare function interceptEditorLaunch(input: {
|
|
24
|
+
configuredBundleUrl?: string;
|
|
25
|
+
scriptSrc?: string;
|
|
26
|
+
pageUrl?: string;
|
|
27
|
+
onBeforeLoad?: () => void;
|
|
28
|
+
onFailure: () => void;
|
|
29
|
+
loadBundle?: (url: string) => Promise<EditorBundleApi>;
|
|
30
|
+
locationLike?: LocationLike;
|
|
31
|
+
historyLike?: HistoryLike;
|
|
32
|
+
}): boolean;
|
|
33
|
+
export declare const __test: {
|
|
34
|
+
getState: () => "idle" | "active" | "starting";
|
|
35
|
+
resetState: () => void;
|
|
36
|
+
};
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Assignment, ExclusionGroupConfig } from "./types";
|
|
2
|
+
/** A remembered group decision: which member won and at what group epoch. */
|
|
3
|
+
export type PersistedGroupSelection = {
|
|
4
|
+
experimentId: string;
|
|
5
|
+
epoch: number;
|
|
6
|
+
};
|
|
7
|
+
/** Pluggable persistence so the runtime uses browser storage and tests use memory. */
|
|
8
|
+
export interface GroupStickyStore {
|
|
9
|
+
read(groupId: string): PersistedGroupSelection | null;
|
|
10
|
+
write(groupId: string, selection: PersistedGroupSelection): void;
|
|
11
|
+
}
|
|
12
|
+
type CompactSelection = [string, number];
|
|
13
|
+
type CompactStore = Record<string, CompactSelection>;
|
|
14
|
+
declare function normalizeEpoch(epoch: number | null | undefined): number;
|
|
15
|
+
declare function parseStore(raw: string | null): CompactStore;
|
|
16
|
+
/** Browser-backed store (localStorage + cookie mirror) used by the live runtime. */
|
|
17
|
+
export declare const browserGroupStickyStore: GroupStickyStore;
|
|
18
|
+
/** Remove consent-gated group stickiness from both browser persistence planes. */
|
|
19
|
+
export declare function clearBrowserGroupStickyStore(): void;
|
|
20
|
+
/** In-memory store for tests and non-persistent (QA / no-consent) contexts. */
|
|
21
|
+
export declare function createMemoryGroupStickyStore(): GroupStickyStore;
|
|
22
|
+
export interface ExclusionGroupDecision {
|
|
23
|
+
groupId: string;
|
|
24
|
+
/** Eligible, non-forced members that overlapped for this visitor. */
|
|
25
|
+
conflictingExperimentIds: string[];
|
|
26
|
+
winnerExperimentId: string | null;
|
|
27
|
+
suppressedExperimentIds: string[];
|
|
28
|
+
/** True when the winner was carried over from a prior sticky selection. */
|
|
29
|
+
sticky: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface ResolveExclusionGroupsResult {
|
|
32
|
+
assignments: Assignment[];
|
|
33
|
+
decisions: ExclusionGroupDecision[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Second pass of the overlap-then-pick model.
|
|
37
|
+
*
|
|
38
|
+
* `assignments` are the pass-one winners (each experiment already evaluated its
|
|
39
|
+
* own status, targeting, exposure, sticky assignment and variation split). Here
|
|
40
|
+
* we detect members of the same exclusion group that BOTH became eligible for
|
|
41
|
+
* this visitor (overlap) and keep exactly one — chosen by a group-deterministic
|
|
42
|
+
* hash weighted by each conflicting member's share, re-normalized across only
|
|
43
|
+
* the conflicting members. A previously assigned member stays sticky while it
|
|
44
|
+
* remains eligible; if it drops out we reselect among the current conflicting
|
|
45
|
+
* members. Forced (QA preview) members bypass exclusion entirely.
|
|
46
|
+
*/
|
|
47
|
+
export declare function resolveExclusionGroups(assignments: Assignment[], groups: ExclusionGroupConfig[] | undefined, ctx: {
|
|
48
|
+
userId: string;
|
|
49
|
+
forcedExperimentIds?: Iterable<string>;
|
|
50
|
+
store?: GroupStickyStore;
|
|
51
|
+
persist?: boolean;
|
|
52
|
+
}): ResolveExclusionGroupsResult;
|
|
53
|
+
export declare const __exclusionGroupInternals: {
|
|
54
|
+
STORAGE_KEY: string;
|
|
55
|
+
COOKIE_NAME: string;
|
|
56
|
+
parseStore: typeof parseStore;
|
|
57
|
+
normalizeEpoch: typeof normalizeEpoch;
|
|
58
|
+
};
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RuntimeSignalDefinition } from "./types";
|
|
2
|
+
type ExposureSignalValue = string | number | boolean;
|
|
3
|
+
export declare function buildExposureSignalContext(input: {
|
|
4
|
+
attributes: Record<string, unknown>;
|
|
5
|
+
customSignals?: RuntimeSignalDefinition[];
|
|
6
|
+
}): Record<string, ExposureSignalValue> | null;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feature flags — thin wrapper over experiment assignments.
|
|
3
|
+
*
|
|
4
|
+
* A feature flag is simply a two-variation experiment where:
|
|
5
|
+
* - control = flag OFF
|
|
6
|
+
* - variant = flag ON
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* import { evaluateFlag, defineFlagExperiment } from "@drip-apex/sdk/flags";
|
|
10
|
+
*
|
|
11
|
+
* const darkMode = defineFlagExperiment({
|
|
12
|
+
* slug: "dark-mode-rollout",
|
|
13
|
+
* name: "Dark Mode Rollout",
|
|
14
|
+
* rolloutPercent: 25,
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* const isEnabled = evaluateFlag("dark-mode-rollout", [darkMode], { userId: "user-123" });
|
|
18
|
+
*/
|
|
19
|
+
import type { Experiment, Assignment } from "./types";
|
|
20
|
+
export interface FlagContext {
|
|
21
|
+
url?: string;
|
|
22
|
+
attributes?: Record<string, unknown>;
|
|
23
|
+
userId?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Evaluate whether a feature flag is enabled.
|
|
27
|
+
*
|
|
28
|
+
* @param flagId - The experiment slug/id of the flag experiment.
|
|
29
|
+
* @param experiments - Array of experiment configs to search (from init or defineExperiment).
|
|
30
|
+
* @param context - Optional user context for targeting/bucketing.
|
|
31
|
+
* @returns `true` if the user is bucketed into a non-control variation.
|
|
32
|
+
*/
|
|
33
|
+
export declare function evaluateFlag(flagId: string, experiments: Experiment[], context?: FlagContext): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Evaluate a flag and return the full assignment (or null if flag is off / not found).
|
|
36
|
+
*/
|
|
37
|
+
export declare function evaluateFlagAssignment(flagId: string, experiments: Experiment[], context?: FlagContext): Assignment | null;
|
|
38
|
+
/**
|
|
39
|
+
* Evaluate a typed feature flag value.
|
|
40
|
+
*
|
|
41
|
+
* Returns the assigned variation value for boolean, string, number, or JSON
|
|
42
|
+
* flags. If the visitor is not eligible, the flag is missing, or no assignment
|
|
43
|
+
* can be made, the fallback is returned.
|
|
44
|
+
*/
|
|
45
|
+
export declare function evaluateFlagValue<T = unknown>(flagId: string, experiments: Experiment[], context?: FlagContext, fallback?: T): T | unknown;
|
|
46
|
+
export interface FlagDefinition {
|
|
47
|
+
/** Unique slug for the flag. */
|
|
48
|
+
slug: string;
|
|
49
|
+
/** Human-readable name. */
|
|
50
|
+
name: string;
|
|
51
|
+
/** Percentage of traffic to enable the flag for (0–100). Default: 0 (off). */
|
|
52
|
+
rolloutPercent?: number;
|
|
53
|
+
/** Targeting rules. */
|
|
54
|
+
targeting?: Experiment["targeting"];
|
|
55
|
+
/** Value returned when the flag is disabled. Default: false. */
|
|
56
|
+
offValue?: unknown;
|
|
57
|
+
/** Value returned when the flag is enabled. Default: true. */
|
|
58
|
+
onValue?: unknown;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Create a flag-style experiment with two variations: control (OFF) and enabled (ON).
|
|
62
|
+
*/
|
|
63
|
+
export declare function defineFlagExperiment(def: FlagDefinition): Experiment & {
|
|
64
|
+
slug: string;
|
|
65
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Goal, Assignment } from "./types";
|
|
2
|
+
type GoalCallback = (goalId: string, assignment: Assignment, data?: Record<string, unknown>) => void;
|
|
3
|
+
export declare function setupGoals(assignments: Assignment[], experiments: {
|
|
4
|
+
id: string;
|
|
5
|
+
goals?: Goal[];
|
|
6
|
+
}[], callback: GoalCallback): void;
|
|
7
|
+
export declare function triggerGoal(goalId: string, assignments: Assignment[], experiments: {
|
|
8
|
+
id: string;
|
|
9
|
+
goals?: Goal[];
|
|
10
|
+
}[], data?: Record<string, unknown>): void;
|
|
11
|
+
export declare function triggerGoalsForEvent(eventName: string, assignments: Assignment[], experiments: {
|
|
12
|
+
id: string;
|
|
13
|
+
goals?: Goal[];
|
|
14
|
+
}[], data?: Record<string, unknown>): void;
|
|
15
|
+
export declare function cleanupGoals(): void;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export declare function isBot(): boolean;
|
|
2
|
+
export declare function isIframe(): boolean;
|
|
3
|
+
export declare function isDuplicate(): boolean;
|
|
4
|
+
export declare function isOptedOut(options?: {
|
|
5
|
+
storageAllowed?: boolean;
|
|
6
|
+
}): boolean;
|
|
7
|
+
export declare function isScreenshotMode(): boolean;
|
|
8
|
+
declare function parseForceParams(params: URLSearchParams): Record<string, string> | null;
|
|
9
|
+
export declare function parseForceParam(options?: {
|
|
10
|
+
cookieFallback?: boolean;
|
|
11
|
+
}): Record<string, string> | null;
|
|
12
|
+
declare function parseForceString(value: string): Record<string, string> | null;
|
|
13
|
+
export declare function isQaMode(options?: {
|
|
14
|
+
cookieFallback?: boolean;
|
|
15
|
+
}): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Persist the force map in a cookie so QA sessions survive navigation.
|
|
18
|
+
* Cookie expires after 30 minutes.
|
|
19
|
+
*/
|
|
20
|
+
export declare function persistQaForce(forceMap: Record<string, string>): void;
|
|
21
|
+
declare function sanitizeQaSessionId(value: string | null): string | null;
|
|
22
|
+
export declare function getQaSessionId(fallback: () => string, options?: {
|
|
23
|
+
storageAllowed?: boolean;
|
|
24
|
+
}): string;
|
|
25
|
+
/**
|
|
26
|
+
* Exit QA mode: clear the force cookie and remove drip_qa/drip_force from URL.
|
|
27
|
+
*/
|
|
28
|
+
export declare function exitQaMode(): void;
|
|
29
|
+
export declare function readCookie(name: string): string | null;
|
|
30
|
+
export declare function writeCookie(name: string, value: string, maxAge: number): void;
|
|
31
|
+
export declare function deleteCookie(name: string): void;
|
|
32
|
+
/** @internal — exposed for unit testing only. Tree-shaken from production build. */
|
|
33
|
+
export declare const __test: {
|
|
34
|
+
parseForceString: typeof parseForceString;
|
|
35
|
+
parseForceParams: typeof parseForceParams;
|
|
36
|
+
sanitizeQaSessionId: typeof sanitizeQaSessionId;
|
|
37
|
+
BOT_RE: RegExp;
|
|
38
|
+
};
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Assignment, ExternalTrackingSettings } from "./types";
|
|
2
|
+
export type HandoverData = {
|
|
3
|
+
visitorId?: string;
|
|
4
|
+
forceMap?: Record<string, string>;
|
|
5
|
+
};
|
|
6
|
+
export declare function handoverMintTimeoutMs(settings?: ExternalTrackingSettings): number;
|
|
7
|
+
export declare function readBucketingHandover(settings: ExternalTrackingSettings | undefined, shopId: string, verifyToken: (token: string) => Promise<unknown>): Promise<HandoverData | null>;
|
|
8
|
+
export declare function hasBucketingHandover(settings?: ExternalTrackingSettings): boolean;
|
|
9
|
+
export declare function createBucketingHandoverPayload(visitorId: string, assignments: Assignment[], settings?: ExternalTrackingSettings): string;
|
|
10
|
+
export declare function installBucketingHandover(settings: ExternalTrackingSettings | undefined, getPayload: () => string | null, mintPayload?: () => Promise<string | null>): () => void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type StorageMode = "localStorage" | "sessionStorage" | "cookie" | "memory";
|
|
2
|
+
export declare function murmurhash3_32_gc(key: string, seed?: number): number;
|
|
3
|
+
export declare function hashToFloat(seed: string, value: string): number;
|
|
4
|
+
export declare function variationHashToFloat(experimentId: string, value: string): number;
|
|
5
|
+
export declare function configureIdentityStorage(settings?: {
|
|
6
|
+
storageMode?: StorageMode;
|
|
7
|
+
encodeStorageValues?: boolean;
|
|
8
|
+
cookieDomain?: string;
|
|
9
|
+
}): void;
|
|
10
|
+
/**
|
|
11
|
+
* Lifetime (cross-session) storage permitted by the configured identity
|
|
12
|
+
* storage mode. Only localStorage mode has one; sessionStorage/memory/cookie
|
|
13
|
+
* modes return null so lifetime counters stay unpersisted under them.
|
|
14
|
+
*/
|
|
15
|
+
export declare function lifetimeIdentityStorage(): Storage | null;
|
|
16
|
+
export declare function getUserId(provided?: string): string;
|
|
17
|
+
export declare function getEphemeralUserId(provided?: string): string;
|
|
18
|
+
export declare function adoptUserId(value: string): void;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Assignment, Experiment } from "./types";
|
|
2
|
+
type TrackFn = (type: string, data: Record<string, unknown>, experimentId: string, variationId: string) => void;
|
|
3
|
+
type HeatmapController = {
|
|
4
|
+
stop: () => void;
|
|
5
|
+
update: (assignments: Assignment[], experiments: Experiment[]) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function startHeatmapCapture(assignments: Assignment[], experiments: Experiment[], track: TrackFn): HeatmapController;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anti-flicker reveal module.
|
|
3
|
+
*
|
|
4
|
+
* The Worker's /s/<shopId>.js snippet injects
|
|
5
|
+
* <style id="drip-hide">…</style> as early as possible.
|
|
6
|
+
* In optimized mode this style is selector-scoped and only falls back
|
|
7
|
+
* to full-page hiding when scoped selectors are unavailable.
|
|
8
|
+
*
|
|
9
|
+
* This module provides revealAll() which the SDK calls once all mutations
|
|
10
|
+
* have been applied, making the page visible with the correct variant.
|
|
11
|
+
* A snippet safety timeout guarantees the page is always revealed even if
|
|
12
|
+
* the SDK encounters an error.
|
|
13
|
+
*/
|
|
14
|
+
/** Remove the anti-flicker style injected by the snippet */
|
|
15
|
+
export declare function revealAll(): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Assignment, CommercePriceSettings } from "./types";
|
|
2
|
+
export declare function detectSsrFramework(): "nuxt" | "next" | "server-rendered" | null;
|
|
3
|
+
export declare function holdMutations(): number;
|
|
4
|
+
export declare function releaseMutations(): number;
|
|
5
|
+
export declare function hasMutationHold(): boolean;
|
|
6
|
+
export declare function signalHydrated(): void;
|
|
7
|
+
export declare function awaitHydration(timeoutMs: number, options?: {
|
|
8
|
+
waitForHydration?: boolean;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
export declare function resetHydrationState(): void;
|
|
11
|
+
export declare function assignmentsHaveVisualWork(assignments: Assignment[], priceSettings?: CommercePriceSettings): boolean;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { type CartAttributeEntry } from "./shopify-cart";
|
|
2
|
+
import { type ApexRuntimeTools } from "./runtime-tools";
|
|
3
|
+
import { ActivationMode, AntiFlickerMode, Assignment, ActivationDiagnostics, ConfigProfile, ConsentModeSettings, CustomJsPolicy, DebugSettings, ExecutionMode, Experiment, ExclusionGroupConfig, ExclusionGroupMemberConfig, Goal, InitConfig, PageTargetingRule, PageTriggerMode, PageTriggerSettings, PerfFeatureFlag, PerfFeatureFlags, PlatformHint, ProjectPrerequisites, RouterMode, SpaSettings, ExternalTrackingSettings, ProjectCodeSettings, RuntimeEnvironmentSettings, SdkDiagnostics, BucketingCleanupSettings, DataProtectionSettings, TrackEvent, TrackingStart, Variation } from "./types";
|
|
4
|
+
type FetchAttemptInfo = {
|
|
5
|
+
attempt: number;
|
|
6
|
+
elapsedMs: number;
|
|
7
|
+
error?: string;
|
|
8
|
+
status?: number;
|
|
9
|
+
timedOut?: boolean;
|
|
10
|
+
};
|
|
11
|
+
type FetchRetryOptions = {
|
|
12
|
+
timeoutMs?: number;
|
|
13
|
+
firstAttemptTimeoutMs?: number;
|
|
14
|
+
slowMs?: number;
|
|
15
|
+
onAttemptStart?: (attempt: number) => void;
|
|
16
|
+
onAttemptEnd?: (info: FetchAttemptInfo) => void;
|
|
17
|
+
onSlow?: (info: {
|
|
18
|
+
attempt: number;
|
|
19
|
+
elapsedMs: number;
|
|
20
|
+
}) => void;
|
|
21
|
+
};
|
|
22
|
+
declare function fetchWithTimeout(url: string, timeoutMs: number): Promise<Response>;
|
|
23
|
+
declare function fetchWithRetry(url: string, retries?: number, delayMs?: number, options?: FetchRetryOptions): Promise<Response>;
|
|
24
|
+
declare function normalizePageApiName(value: unknown): string;
|
|
25
|
+
declare function triggerPage(apiName: unknown, active?: unknown): void;
|
|
26
|
+
declare function installPageTriggerRule(rule: PageTargetingRule, onChange: () => void): () => void;
|
|
27
|
+
type OrderIdentityPlatform = "shopify" | "shopware" | "woocommerce" | "centra" | "custom";
|
|
28
|
+
type QaAssistantRuntimeSnapshot = {
|
|
29
|
+
config: InitConfig | null;
|
|
30
|
+
assignments: Assignment[];
|
|
31
|
+
activationDiagnostics: ActivationDiagnostics;
|
|
32
|
+
forceMap: Record<string, string> | null;
|
|
33
|
+
platform: PlatformHint;
|
|
34
|
+
qaMode: boolean;
|
|
35
|
+
orderIdentity: {
|
|
36
|
+
platform: OrderIdentityPlatform;
|
|
37
|
+
platformOrderId: string | null;
|
|
38
|
+
orderNumber: string | null;
|
|
39
|
+
} | null;
|
|
40
|
+
};
|
|
41
|
+
declare function getConfigCacheKey(shopId: string, environmentKey?: string): string;
|
|
42
|
+
declare function withRuntimeSettings(config: InitConfig, runtime: unknown, profile?: InitConfig["profile"]): InitConfig;
|
|
43
|
+
export declare function evaluate(experiments: Experiment[], context?: {
|
|
44
|
+
url?: string;
|
|
45
|
+
attributes?: Record<string, unknown>;
|
|
46
|
+
userId?: string;
|
|
47
|
+
persistSignals?: boolean;
|
|
48
|
+
exclusionGroups?: ExclusionGroupConfig[];
|
|
49
|
+
}): Assignment[];
|
|
50
|
+
export declare function __getQaAssistantRuntimeSnapshot(): QaAssistantRuntimeSnapshot;
|
|
51
|
+
export declare function __subscribeQaAssistantRuntime(listener: () => void): () => void;
|
|
52
|
+
export declare function __forceQaAssistantVariation(experimentId: string, variationId: string): void;
|
|
53
|
+
export declare function __resetQaAssistantForce(experimentId?: string): void;
|
|
54
|
+
export declare function init(config: InitConfig): Assignment[];
|
|
55
|
+
export declare function track(type: string, data?: Record<string, unknown>, experimentId?: string, variationId?: string): void;
|
|
56
|
+
/**
|
|
57
|
+
* Track a virtual funnel step that has no reliable browser event by default,
|
|
58
|
+
* such as a postcode form submit, embedded quiz step, or third-party handoff.
|
|
59
|
+
*/
|
|
60
|
+
export declare function trackStep(name: string, data?: Record<string, unknown>): void;
|
|
61
|
+
export declare function trackGoal(goalId: string, data?: Record<string, unknown>): void;
|
|
62
|
+
export declare function setConsent(granted: boolean): void;
|
|
63
|
+
export declare function hold(): number;
|
|
64
|
+
export declare function release(): number;
|
|
65
|
+
export declare function hydrated(): void;
|
|
66
|
+
export declare function recheckPrerequisites(): void;
|
|
67
|
+
export declare function reInit(forceReapply?: boolean): Assignment[];
|
|
68
|
+
/**
|
|
69
|
+
* Track a revenue/purchase event. Convenience method that fires a "purchase" event
|
|
70
|
+
* with revenue data for all active experiments.
|
|
71
|
+
*
|
|
72
|
+
* Usage: drip.trackRevenue(49.99) or drip.trackRevenue(49.99, { orderId: "123", currency: "EUR" })
|
|
73
|
+
*/
|
|
74
|
+
export type RevenueEventData = Record<string, unknown> & {
|
|
75
|
+
currency?: string;
|
|
76
|
+
};
|
|
77
|
+
export declare function trackRevenue(revenue: number, data?: RevenueEventData): void;
|
|
78
|
+
export declare function flush(): Promise<void>;
|
|
79
|
+
export declare function getAssignments(): Assignment[];
|
|
80
|
+
export declare function getCartAttributes(): CartAttributeEntry[];
|
|
81
|
+
/**
|
|
82
|
+
* Build cart attributes for a headless Shopify Storefront API cart.
|
|
83
|
+
*
|
|
84
|
+
* Integrator contract: pass the cart's full Storefront Cart GID (including its
|
|
85
|
+
* `?key=` secret), write every returned entry to that same cart, and verify the
|
|
86
|
+
* Storefront API mutation succeeded with no `userErrors`. Only then call
|
|
87
|
+
* {@link confirmCartAttributesWritten} with the same Cart GID. Returning signed
|
|
88
|
+
* attributes does not authorize treatment display or exposure by itself. An
|
|
89
|
+
* empty result is fail-closed and must not be replaced with unsigned attributes.
|
|
90
|
+
* Theme storefronts use the SDK-managed `/cart/update.js` path and do not call
|
|
91
|
+
* either headless API.
|
|
92
|
+
*/
|
|
93
|
+
export declare function getSignedCartAttributes(cartToken?: string): Promise<CartAttributeEntry[]>;
|
|
94
|
+
/**
|
|
95
|
+
* Acknowledge that the latest signed headless cart attributes were persisted.
|
|
96
|
+
*
|
|
97
|
+
* Call this only after the Storefront API cart-attributes mutation succeeded
|
|
98
|
+
* and returned no `userErrors`. The Cart GID must match the one passed to the
|
|
99
|
+
* latest {@link getSignedCartAttributes} call. Stale-generation, mismatched,
|
|
100
|
+
* or repeated acknowledgements are no-ops and cannot grant or change display
|
|
101
|
+
* and exposure authorization. When a staged offer adoption can no longer
|
|
102
|
+
* apply, the acknowledgement is rejected (`false`) with retryable pending
|
|
103
|
+
* state and no authorization is granted.
|
|
104
|
+
*
|
|
105
|
+
* @returns `true` only when the latest matching acknowledgement was accepted.
|
|
106
|
+
*/
|
|
107
|
+
export declare function confirmCartAttributesWritten(cartToken?: string): boolean;
|
|
108
|
+
export declare function getExperiments(): Experiment[];
|
|
109
|
+
export declare function getRuntimeValue(key: string): unknown;
|
|
110
|
+
export declare function getRuntimeTools(): ApexRuntimeTools;
|
|
111
|
+
export declare function evaluateFlag(flagId: string, context?: {
|
|
112
|
+
url?: string;
|
|
113
|
+
attributes?: Record<string, unknown>;
|
|
114
|
+
userId?: string;
|
|
115
|
+
}): boolean;
|
|
116
|
+
export declare function evaluateFlagAssignment(flagId: string, context?: {
|
|
117
|
+
url?: string;
|
|
118
|
+
attributes?: Record<string, unknown>;
|
|
119
|
+
userId?: string;
|
|
120
|
+
}): Assignment | null;
|
|
121
|
+
export declare function evaluateFlagValue<T = unknown>(flagId: string, fallback?: T, context?: {
|
|
122
|
+
url?: string;
|
|
123
|
+
attributes?: Record<string, unknown>;
|
|
124
|
+
userId?: string;
|
|
125
|
+
}): T | unknown;
|
|
126
|
+
export declare function getDiagnostics(): SdkDiagnostics;
|
|
127
|
+
export { defineExperiment, defineExperiments } from "./define";
|
|
128
|
+
export { defineFlagExperiment } from "./flags";
|
|
129
|
+
export { getSignals, rememberProduct, setCartSignals, setSearchSignal, setSignal, } from "./signals";
|
|
130
|
+
export { createApexRuntimeTools } from "./runtime-tools";
|
|
131
|
+
export declare const __test: {
|
|
132
|
+
fetchWithTimeout: typeof fetchWithTimeout;
|
|
133
|
+
fetchWithRetry: typeof fetchWithRetry;
|
|
134
|
+
getConfigCacheKey: typeof getConfigCacheKey;
|
|
135
|
+
installPageTriggerRule: typeof installPageTriggerRule;
|
|
136
|
+
normalizePageApiName: typeof normalizePageApiName;
|
|
137
|
+
triggerPage: typeof triggerPage;
|
|
138
|
+
withRuntimeSettings: typeof withRuntimeSettings;
|
|
139
|
+
};
|
|
140
|
+
export type { ActivationMode, AntiFlickerMode, Assignment, ConfigProfile, ConsentModeSettings, CustomJsPolicy, ExecutionMode, Experiment, ExclusionGroupConfig, ExclusionGroupMemberConfig, Goal, InitConfig, PageTriggerMode, PageTriggerSettings, PerfFeatureFlag, PerfFeatureFlags, PlatformHint, RouterMode, TrackEvent, TrackingStart, Variation, DebugSettings, ProjectPrerequisites, SpaSettings, ExternalTrackingSettings, ProjectCodeSettings, RuntimeEnvironmentSettings, SdkDiagnostics, BucketingCleanupSettings, DataProtectionSettings, };
|
|
141
|
+
export type { ExperimentDefinition, VariationDefinition, GoalDefinition } from "./define";
|
|
142
|
+
export type { FlagDefinition, FlagContext } from "./flags";
|
|
143
|
+
export type { CartAttributeEntry } from "./shopify-cart";
|
|
144
|
+
export type { ApexRuntimeTools, DataLayerOptions, DomChangedOptions, ElementInViewOptions, WaitForElementOptions, } from "./runtime-tools";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CustomJsPolicy } from "./types";
|
|
2
|
+
export declare function setJsPolicy(policy: CustomJsPolicy): void;
|
|
3
|
+
export declare function isStrictJsPolicy(): boolean;
|
|
4
|
+
export declare function execJs(code: string, sourceLabel?: string): void;
|
|
5
|
+
export declare function loadExternalJs(url: string, sourceLabel: string): Promise<void>;
|
|
6
|
+
export declare function removeAllExternalJs(): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type PendingGiftChoice } from "./commerce-gift";
|
|
2
|
+
export declare function getPendingGiftChoices(experimentId?: string): PendingGiftChoice[];
|
|
3
|
+
export declare function selectGiftOption(experimentId: string, variantGid: string): Promise<void>;
|
|
4
|
+
export type { PendingGiftChoice };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type MoneyConvention = {
|
|
2
|
+
decimal: "." | ",";
|
|
3
|
+
group: string;
|
|
4
|
+
decimals: number;
|
|
5
|
+
minorUnits: number;
|
|
6
|
+
};
|
|
7
|
+
export type DisplayedMoney = {
|
|
8
|
+
cents: number;
|
|
9
|
+
convention: MoneyConvention;
|
|
10
|
+
start: number;
|
|
11
|
+
end: number;
|
|
12
|
+
};
|
|
13
|
+
export declare function parseDisplayedCents(text: string, minorUnits?: number): DisplayedMoney | null;
|
|
14
|
+
export declare function formatCentsLike(cents: number, convention: MoneyConvention): string;
|