@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
package/dist/sri.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"drip.js": {
|
|
3
|
+
"sha384": "sha384-Um2aSsOgGy30oXzHq054QWAey3e6xnQhUpxi6t0DoBLN/vl7L34IluEEDsVDUvy+",
|
|
4
|
+
"bytes": 327176,
|
|
5
|
+
"gzipBytes": 95380
|
|
6
|
+
},
|
|
7
|
+
"drip.live.js": {
|
|
8
|
+
"sha384": "sha384-dP//F37IbyzbnWQ7W/PYVmQVKp+ByihrHT15tpQFISCO10M2C7GI/tmAu7WRmCwi",
|
|
9
|
+
"bytes": 238320,
|
|
10
|
+
"gzipBytes": 69619
|
|
11
|
+
},
|
|
12
|
+
"drip.heatmap.js": {
|
|
13
|
+
"sha384": "sha384-h6Jx5DkyjsdiU0XzIc/2AlH2Xu4qQppeOY6cfVQxrRzrFkYl6VP/g6NDFTdwGppy",
|
|
14
|
+
"bytes": 243757,
|
|
15
|
+
"gzipBytes": 71115
|
|
16
|
+
},
|
|
17
|
+
"drip.debug.js": {
|
|
18
|
+
"sha384": "sha384-eaOKabQEMuuTio8GrmAj5B1sn4qlTqhw3gO+0u9gTKeWBtYmo0LXfTxBN2nEYsEg",
|
|
19
|
+
"bytes": 327182,
|
|
20
|
+
"gzipBytes": 95383
|
|
21
|
+
},
|
|
22
|
+
"editor.js": {
|
|
23
|
+
"sha384": "sha384-WBLo4reMW+GBBHxLB6TpXCsJa2mukHmYMuyqlQpGeMR4OqPSNvNbRgqMXLLDYnr6",
|
|
24
|
+
"bytes": 106433,
|
|
25
|
+
"gzipBytes": 31127
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* analytics.ts — Automatic pageview and engagement tracking.
|
|
3
|
+
*
|
|
4
|
+
* Fires two event types through the existing track() pipeline:
|
|
5
|
+
* - "pageview" on every page load / SPA navigation
|
|
6
|
+
* - "page_exit" on navigation away / tab close (with duration + scroll depth)
|
|
7
|
+
*/
|
|
8
|
+
type TrackFn = (type: string, data?: Record<string, unknown>) => void;
|
|
9
|
+
/** Clean URL: origin + pathname only (strips query params). */
|
|
10
|
+
export declare function cleanUrl(): string;
|
|
11
|
+
/** Called on every page load / SPA navigation. */
|
|
12
|
+
export declare function onPageEnter(trackFn: TrackFn): void;
|
|
13
|
+
/** Called on SPA navigation away / page unload. */
|
|
14
|
+
export declare function onPageExit(trackFn: TrackFn): void;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AntiFlickerMode } from "./types";
|
|
2
|
+
export declare function resolveAntiFlickerCss(mode?: AntiFlickerMode, scopedSelectors?: string[], customCss?: string): string | null;
|
|
3
|
+
/**
|
|
4
|
+
* Apply anti-flicker hiding based on mode.
|
|
5
|
+
* - "scoped": only hides elements matching provided selectors (preferred).
|
|
6
|
+
* - "full": hides entire page with opacity:0 (legacy).
|
|
7
|
+
* - "off": no-op.
|
|
8
|
+
* Scoped mode is a no-op when no selectors are available.
|
|
9
|
+
*
|
|
10
|
+
* Progressive reveal: at 80% of timeout, begins a CSS transition to fade
|
|
11
|
+
* content in gradually rather than a sudden flash at timeout expiry.
|
|
12
|
+
*/
|
|
13
|
+
export declare function applyAntiFlicker(mode?: AntiFlickerMode, timeoutMs?: number, scopedSelectors?: string[], customCss?: string): void;
|
|
14
|
+
export declare function removeAntiFlicker(): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Experiment, Variation } from "./types";
|
|
2
|
+
export type PersistedAssignmentRecord = {
|
|
3
|
+
variationId: string;
|
|
4
|
+
epoch: number;
|
|
5
|
+
assignedAt: number;
|
|
6
|
+
};
|
|
7
|
+
type CompactRecord = [string, number, number];
|
|
8
|
+
type CompactStore = Record<string, CompactRecord>;
|
|
9
|
+
declare function assignmentEpoch(experiment: Experiment): number;
|
|
10
|
+
declare function parseStore(raw: string | null): CompactStore;
|
|
11
|
+
declare function serializeStore(store: CompactStore, maxEntries?: number): string;
|
|
12
|
+
export declare function readPersistedAssignments(): Record<string, PersistedAssignmentRecord>;
|
|
13
|
+
export declare function writePersistedAssignments(records: Record<string, PersistedAssignmentRecord>): void;
|
|
14
|
+
export declare function clearPersistedAssignments(): void;
|
|
15
|
+
export declare function prunePersistedAssignments(experiments: Experiment[], records?: Record<string, PersistedAssignmentRecord>): Record<string, PersistedAssignmentRecord>;
|
|
16
|
+
export declare function findPersistedVariation(experiment: Experiment, records?: Record<string, PersistedAssignmentRecord>): {
|
|
17
|
+
variation: Variation;
|
|
18
|
+
index: number;
|
|
19
|
+
record: PersistedAssignmentRecord;
|
|
20
|
+
} | null;
|
|
21
|
+
export declare function persistAssignmentForExperiment(experiment: Experiment, variationId: string, assignedAt?: number): PersistedAssignmentRecord;
|
|
22
|
+
export declare function removePersistedAssignmentsForExperiments(experimentIds: Iterable<string>): void;
|
|
23
|
+
export declare const __assignmentStoreInternals: {
|
|
24
|
+
STORAGE_KEY: string;
|
|
25
|
+
COOKIE_NAME: string;
|
|
26
|
+
assignmentEpoch: typeof assignmentEpoch;
|
|
27
|
+
parseStore: typeof parseStore;
|
|
28
|
+
serializeStore: typeof serializeStore;
|
|
29
|
+
};
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { InitConfig } from "./types";
|
|
2
|
+
type RuntimeAuditContext = {
|
|
3
|
+
configSource: string;
|
|
4
|
+
trackerStarted: boolean;
|
|
5
|
+
platform: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function isApexScriptSrc(raw: string): boolean;
|
|
8
|
+
export declare function runAuditIfRequested(config: InitConfig, runtime: RuntimeAuditContext): void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type CartAssignment } from "./shopify-cart";
|
|
2
|
+
import type { CommerceOffersSettings } from "./types";
|
|
3
|
+
export type GiftSyncOptions = {
|
|
4
|
+
/** Per-arm proof from the CURRENT stamped offers plane. Insertion requires
|
|
5
|
+
* it: config membership alone can cover an assignment whose offers proof
|
|
6
|
+
* was refused (e.g. shared price+offers experiment with price-only proof),
|
|
7
|
+
* and the Function would charge that "gift" at full price. */
|
|
8
|
+
isArmProven?: (assignment: CartAssignment) => boolean;
|
|
9
|
+
/** A cart mutation invalidates the once-per-page teardown check. */
|
|
10
|
+
recheckTeardown?: boolean;
|
|
11
|
+
/** Fail-closed reconciliation after a FAILED stamp sync: privilege-reducing
|
|
12
|
+
* cleanup only (threshold/currency/orphan removals, quantity normalization)
|
|
13
|
+
* — never insert, because no fresh proof exists for a new line. */
|
|
14
|
+
suppressInsertion?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type PendingGiftChoice = {
|
|
17
|
+
experimentId: string;
|
|
18
|
+
threshold: string;
|
|
19
|
+
options: string[];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Seed durable insertion records from any cart snapshot that passes through
|
|
23
|
+
* the SDK (e.g. the /cart/update.js stamp-write response). Marked lines can
|
|
24
|
+
* only originate from Apex, so seeing one IS the insertion evidence — this is
|
|
25
|
+
* how a fresh device or a cleared-storage session over a persistent (or
|
|
26
|
+
* customer-synced) cart rediscovers gifts it must reconcile or tear down.
|
|
27
|
+
* Returns true when a marked line was found.
|
|
28
|
+
*/
|
|
29
|
+
export declare function noteCartSnapshotForGifts(cart: unknown): boolean;
|
|
30
|
+
export declare function syncGiftWithPurchase(settings: CommerceOffersSettings | undefined, assignments: CartAssignment[], options?: GiftSyncOptions): Promise<void>;
|
|
31
|
+
/** Selects an option previously offered by `apex:gwp:choice`. The next
|
|
32
|
+
* reconciliation validates the current signed arm/tier before mutating. */
|
|
33
|
+
export declare function selectGiftOption(experimentId: string, variantGid: string): Promise<void>;
|
|
34
|
+
/** Returns live, unanswered gift-choice prompts. This replayable query lets a
|
|
35
|
+
* chooser mounted after `apex:gwp:choice` was dispatched discover the same
|
|
36
|
+
* prompt; pass an experiment id to restrict the result. Returned option
|
|
37
|
+
* arrays are copies and may be safely modified by caller code. */
|
|
38
|
+
export declare function getPendingGiftChoices(experimentId?: string): PendingGiftChoice[];
|
|
39
|
+
export declare const __giftManagerInternals: {
|
|
40
|
+
reset(): void;
|
|
41
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Assignment, CommercePriceSettings } from "./types";
|
|
2
|
+
type PriceAssignmentAuthorization = (assignment: Assignment) => boolean;
|
|
3
|
+
export declare const COMMERCE_PRICE_SELECTORS: string[];
|
|
4
|
+
export declare const COMMERCE_PRICE_EXCLUSIONS: string[];
|
|
5
|
+
/** Whether price teardown has state to restore, disconnect, or cancel. */
|
|
6
|
+
export declare function hasCommercePriceState(): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* True when a price treatment is assigned AND the page either is eligible now or could
|
|
9
|
+
* still become eligible (Shopify has not published product metadata yet). The reveal
|
|
10
|
+
* barrier uses this so a metadata-late PDP cannot flash the ORIGINAL price before the
|
|
11
|
+
* swap lands. The anti-flicker timeout still caps how long content can stay hidden.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isCommercePriceWorkPending(settings: CommercePriceSettings | undefined, assignments: Assignment[], isAssignmentAuthorized?: PriceAssignmentAuthorization): boolean;
|
|
14
|
+
export declare function isCommercePriceActive(settings: CommercePriceSettings | undefined, assignments: Assignment[], isAssignmentAuthorized?: PriceAssignmentAuthorization): boolean;
|
|
15
|
+
export declare function applyCommercePrice(settings: CommercePriceSettings | undefined, assignments: Assignment[], isCohortStampedOnCart?: () => boolean | "pending", onResolved?: () => void, isAssignmentAuthorized?: PriceAssignmentAuthorization): void;
|
|
16
|
+
/** Revisit a timed-out activation when the in-flight Shopify cart write lands. */
|
|
17
|
+
export declare function notifyCommerceCartStampConfirmed(): void;
|
|
18
|
+
/** Whether a display-only price assignment has produced shopper-visible framing. */
|
|
19
|
+
export declare function isCommercePriceExposureEligible(settings: CommercePriceSettings | undefined, assignment: Assignment): boolean;
|
|
20
|
+
export declare const setCommercePriceExposureListener: (listener: () => void) => void;
|
|
21
|
+
export declare function cleanupCommercePrice(): void;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Assignment, CommerceShippingSettings } from "./types";
|
|
2
|
+
export declare function isShippingCartEligible(experimentId: string): boolean;
|
|
3
|
+
type ShippingVariantLike = {
|
|
4
|
+
treatment: string;
|
|
5
|
+
threshold: string | null;
|
|
6
|
+
target?: {
|
|
7
|
+
productGids: string[];
|
|
8
|
+
variantGids: string[];
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
/** Shared exposure classification for the sync loop and the exposure fence.
|
|
12
|
+
* Treatments prove eligibility on their OWN target; controls mirror the
|
|
13
|
+
* treatment set — any-targeted for scope (an unscoped sibling keeps the
|
|
14
|
+
* control universal), every-bound for currency (a thresholdless percent
|
|
15
|
+
* sibling keeps the control cross-currency eligible). */
|
|
16
|
+
export declare function classifyShippingExposure(variants: Record<string, ShippingVariantLike>, isControl: boolean, ownVariant: ShippingVariantLike | undefined): {
|
|
17
|
+
eligibilityTarget: {
|
|
18
|
+
productGids: string[];
|
|
19
|
+
variantGids: string[];
|
|
20
|
+
};
|
|
21
|
+
needsTargetProof: boolean;
|
|
22
|
+
isCurrencyBound: boolean;
|
|
23
|
+
};
|
|
24
|
+
/** True only after shipping setup or a successful cart read proves eligibility. */
|
|
25
|
+
export declare function isShippingCartEligibilityConfirmed(experimentId: string): boolean;
|
|
26
|
+
export declare function applyCommerceShipping(settings: CommerceShippingSettings | undefined, assignments: Assignment[], onEligibilityConfirmed?: () => void): void;
|
|
27
|
+
export declare function cleanupCommerceShipping(): void;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function injectCss(css: string, experimentId: string, variationId: string): void;
|
|
2
|
+
export declare function injectExperimentCss(css: string, experimentId: string): void;
|
|
3
|
+
export declare function removeCss(experimentId: string, variationId: string): void;
|
|
4
|
+
export declare function injectExternalCss(url: string, experimentId: string, variationId: string): Promise<void>;
|
|
5
|
+
export declare function removeAllCss(): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type CwvMetrics = {
|
|
2
|
+
cls_total: number;
|
|
3
|
+
cls_after_reveal: number;
|
|
4
|
+
};
|
|
5
|
+
export declare function startCwvMeasurement(disabled?: boolean): void;
|
|
6
|
+
export declare function markCwvReveal(): void;
|
|
7
|
+
export declare function getCwvMetrics(): CwvMetrics;
|
|
8
|
+
export declare function waitForCwvMetrics(): Promise<CwvMetrics | null>;
|
|
9
|
+
export declare function resetCwvMeasurement(): void;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function normalizeDataLayerEntry(item: unknown): Record<string, unknown> | null;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debug console for Drip SDK.
|
|
3
|
+
*
|
|
4
|
+
* Project-configured debug console. By default debug is off; the snippet can
|
|
5
|
+
* enable it for a specific request, query parameter, or user id.
|
|
6
|
+
*/
|
|
7
|
+
import type { DebugSettings } from "./types";
|
|
8
|
+
declare function tokenMatches(value: string | null, token?: string): boolean;
|
|
9
|
+
declare function isExpired(expiresAt?: string | null): boolean;
|
|
10
|
+
export declare function configureDebug(settings?: DebugSettings, userId?: string | null, options?: {
|
|
11
|
+
storageAllowed?: boolean;
|
|
12
|
+
}): boolean;
|
|
13
|
+
export declare function isDebugEnabled(): boolean;
|
|
14
|
+
export declare function debugLog(category: string, message: string, data?: unknown): void;
|
|
15
|
+
export declare function debugWarn(category: string, message: string, data?: unknown): void;
|
|
16
|
+
export declare function debugGroup(label: string): void;
|
|
17
|
+
export declare function debugGroupEnd(): void;
|
|
18
|
+
/** @internal — exposed for unit testing only. Tree-shaken from production build. */
|
|
19
|
+
export declare const __test: {
|
|
20
|
+
isExpired: typeof isExpired;
|
|
21
|
+
tokenMatches: typeof tokenMatches;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* defineExperiment — typed experiment definitions with validation.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* const hero = defineExperiment({
|
|
6
|
+
* slug: "hero-banner-v2",
|
|
7
|
+
* name: "Hero Banner V2",
|
|
8
|
+
* variations: [
|
|
9
|
+
* { id: "control", weight: 0.5, mutations: [], isControl: true },
|
|
10
|
+
* { id: "variant-a", weight: 0.5, mutations: [{ selector: ".hero h1", action: "text", text: "New headline" }] },
|
|
11
|
+
* ],
|
|
12
|
+
* targeting: { url: [{ type: "simple", pattern: "/" }] },
|
|
13
|
+
* goals: [{ id: "cta-click", type: "click", selector: ".hero-cta" }],
|
|
14
|
+
* });
|
|
15
|
+
*/
|
|
16
|
+
import type { Experiment, Mutation, Targeting } from "./types";
|
|
17
|
+
export interface ExperimentDefinition {
|
|
18
|
+
/** Unique slug for GitOps upsert. Required for code-first experiments. */
|
|
19
|
+
slug: string;
|
|
20
|
+
/** Human-readable name. */
|
|
21
|
+
name: string;
|
|
22
|
+
/** Traffic allocation percentage (0–1). Default: 1. */
|
|
23
|
+
trafficAllocation?: number;
|
|
24
|
+
/** Targeting rules. */
|
|
25
|
+
targeting?: Targeting;
|
|
26
|
+
/** Hash attribute override (default: visitor cookie). */
|
|
27
|
+
hashAttribute?: string;
|
|
28
|
+
/** Variation definitions. At least two required. */
|
|
29
|
+
variations: VariationDefinition[];
|
|
30
|
+
/** Goal definitions for conversion tracking. */
|
|
31
|
+
goals?: GoalDefinition[];
|
|
32
|
+
}
|
|
33
|
+
export interface VariationDefinition {
|
|
34
|
+
/** Variation identifier (used as slug within the experiment). */
|
|
35
|
+
id: string;
|
|
36
|
+
/** Display name. Falls back to id if omitted. */
|
|
37
|
+
name?: string;
|
|
38
|
+
/** Traffic weight (0–1). All weights should sum to 1. */
|
|
39
|
+
weight: number;
|
|
40
|
+
/** DOM mutations to apply. Default: []. */
|
|
41
|
+
mutations?: Mutation[];
|
|
42
|
+
/** Optional typed value returned by feature-flag helpers. */
|
|
43
|
+
value?: unknown;
|
|
44
|
+
/** Custom CSS injected when this variation is active. */
|
|
45
|
+
css?: string;
|
|
46
|
+
/** Custom JavaScript executed when this variation is active. */
|
|
47
|
+
js?: string;
|
|
48
|
+
/** Reset JavaScript executed on SPA navigation away. */
|
|
49
|
+
resetJs?: string;
|
|
50
|
+
/** External CSS artifact URL loaded when this variation is active. */
|
|
51
|
+
externalCssUrl?: string;
|
|
52
|
+
/** External JS artifact URL loaded when this variation is active. */
|
|
53
|
+
externalJsUrl?: string;
|
|
54
|
+
/** Mark as control variation. Exactly one variation should be control. */
|
|
55
|
+
isControl?: boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface GoalDefinition {
|
|
58
|
+
/** Goal identifier (used as slug). */
|
|
59
|
+
id: string;
|
|
60
|
+
/** Goal type. */
|
|
61
|
+
type: "click" | "pageview" | "custom" | "revenue";
|
|
62
|
+
/** CSS selector for click/element goals. */
|
|
63
|
+
selector?: string;
|
|
64
|
+
/** URL pattern for pageview goals. */
|
|
65
|
+
urlPattern?: string;
|
|
66
|
+
/** Only count once per session. Default: false. */
|
|
67
|
+
countOnce?: boolean;
|
|
68
|
+
}
|
|
69
|
+
export declare class ExperimentDefinitionError extends Error {
|
|
70
|
+
readonly issues: string[];
|
|
71
|
+
constructor(slug: string, issues: string[]);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Define a typed, validated experiment configuration.
|
|
75
|
+
*
|
|
76
|
+
* Returns a frozen Experiment object ready for use with `init({ experiments: [...] })`.
|
|
77
|
+
* Throws `ExperimentDefinitionError` if the definition is invalid.
|
|
78
|
+
*/
|
|
79
|
+
export declare function defineExperiment(def: ExperimentDefinition): Experiment & {
|
|
80
|
+
slug: string;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Define multiple experiments at once. Validates all, throws on first invalid.
|
|
84
|
+
*/
|
|
85
|
+
export declare function defineExperiments(defs: ExperimentDefinition[]): Array<Experiment & {
|
|
86
|
+
slug: string;
|
|
87
|
+
}>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drip SDK Devtools Overlay
|
|
3
|
+
*
|
|
4
|
+
* Enable via: `?drip_devtools=1`, `?drip_debug=1`, or `localStorage.drip_devtools=1`
|
|
5
|
+
*
|
|
6
|
+
* Renders a draggable panel (shadow DOM) showing:
|
|
7
|
+
* - Active experiments and assignments
|
|
8
|
+
* - Targeting evaluation results
|
|
9
|
+
* - Event log (assignments, mutations, goals, tracking)
|
|
10
|
+
* - Force variation controls
|
|
11
|
+
* - Performance timings
|
|
12
|
+
*/
|
|
13
|
+
import type { Assignment, Experiment, SdkDiagnostics } from "./types";
|
|
14
|
+
export interface DevtoolsEvent {
|
|
15
|
+
ts: number;
|
|
16
|
+
type: string;
|
|
17
|
+
label: string;
|
|
18
|
+
detail?: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
export declare function logDevtoolsEvent(type: string, label: string, detail?: Record<string, unknown>): void;
|
|
21
|
+
export declare function subscribeDevtoolsEvents(listener: (event: DevtoolsEvent) => void): () => void;
|
|
22
|
+
export declare function isDevtoolsEnabled(): boolean;
|
|
23
|
+
interface MountOptions {
|
|
24
|
+
experiments: Experiment[];
|
|
25
|
+
assignments: Assignment[];
|
|
26
|
+
diagnostics?: SdkDiagnostics | null;
|
|
27
|
+
forceMap: Record<string, string> | null;
|
|
28
|
+
onForceVariation: (experimentId: string, variationId: string) => void;
|
|
29
|
+
}
|
|
30
|
+
export declare function mountDevtools(opts: MountOptions): void;
|
|
31
|
+
export declare function unmountDevtools(): void;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ActiveEditorSession, ClaimedEditorCommand, EditorArtifacts, EditorVariation } from "./types";
|
|
2
|
+
export declare class EditorApiError extends Error {
|
|
3
|
+
readonly status: number;
|
|
4
|
+
readonly payload?: (Record<string, unknown> | null) | undefined;
|
|
5
|
+
constructor(message: string, status: number, payload?: (Record<string, unknown> | null) | undefined);
|
|
6
|
+
}
|
|
7
|
+
type FetchLike = typeof fetch;
|
|
8
|
+
export declare class EditorApi {
|
|
9
|
+
private readonly apiOrigin;
|
|
10
|
+
private readonly session;
|
|
11
|
+
private readonly fetchImpl;
|
|
12
|
+
constructor(apiOrigin: string, session: ActiveEditorSession, fetchImpl?: FetchLike);
|
|
13
|
+
private url;
|
|
14
|
+
private request;
|
|
15
|
+
loadArtifacts(variationId: string): Promise<{
|
|
16
|
+
variation: EditorVariation;
|
|
17
|
+
artifacts: EditorArtifacts;
|
|
18
|
+
}>;
|
|
19
|
+
saveArtifacts(variationId: string, artifacts: EditorArtifacts, expectedPriorHash: string): Promise<{
|
|
20
|
+
artifactHash: string;
|
|
21
|
+
reviewStatus: string | null;
|
|
22
|
+
warningIssues: Array<{
|
|
23
|
+
code?: string;
|
|
24
|
+
message?: string;
|
|
25
|
+
}>;
|
|
26
|
+
artifacts: EditorArtifacts;
|
|
27
|
+
}>;
|
|
28
|
+
extendSession(): Promise<string | null>;
|
|
29
|
+
revoke(): Promise<void>;
|
|
30
|
+
claimCommands(limit?: number): Promise<ClaimedEditorCommand[]>;
|
|
31
|
+
completeCommand(commandId: string, completion: {
|
|
32
|
+
result: Record<string, unknown>;
|
|
33
|
+
} | {
|
|
34
|
+
error: string;
|
|
35
|
+
}): Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Mutation } from "../types";
|
|
2
|
+
import { type EditorArtifacts } from "./types";
|
|
3
|
+
export declare function upsertMutation(artifacts: EditorArtifacts, mutation: Mutation): EditorArtifacts;
|
|
4
|
+
export declare function removeSelectorMutations(artifacts: EditorArtifacts, selector: string): EditorArtifacts;
|
|
5
|
+
export declare function removeMutationAt(artifacts: EditorArtifacts, index: number): EditorArtifacts;
|
|
6
|
+
export declare class ArtifactHistory {
|
|
7
|
+
private undoStack;
|
|
8
|
+
private redoStack;
|
|
9
|
+
push(current: EditorArtifacts): void;
|
|
10
|
+
undo(current: EditorArtifacts): EditorArtifacts | null;
|
|
11
|
+
redo(current: EditorArtifacts): EditorArtifacts | null;
|
|
12
|
+
reset(): void;
|
|
13
|
+
get canUndo(): boolean;
|
|
14
|
+
get canRedo(): boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { EditorApi } from "./api";
|
|
2
|
+
import type { EditorController } from "./controller";
|
|
3
|
+
import type { ClaimedEditorCommand } from "./types";
|
|
4
|
+
export type EditorCommandResult = {
|
|
5
|
+
ok: boolean;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
type CommandExecution = {
|
|
9
|
+
result: EditorCommandResult;
|
|
10
|
+
afterAcknowledge?: () => void;
|
|
11
|
+
};
|
|
12
|
+
type NavigationActions = {
|
|
13
|
+
navigate(url: string): void;
|
|
14
|
+
reload(): void;
|
|
15
|
+
back(): void;
|
|
16
|
+
forward(): void;
|
|
17
|
+
};
|
|
18
|
+
export declare class EditorCommandExecutor {
|
|
19
|
+
private readonly controller;
|
|
20
|
+
private readonly navigation;
|
|
21
|
+
private readonly consoleLogs;
|
|
22
|
+
private readonly networkLogs;
|
|
23
|
+
private restoreConsole;
|
|
24
|
+
private performanceObserver;
|
|
25
|
+
constructor(controller: EditorController, navigation?: NavigationActions);
|
|
26
|
+
start(): void;
|
|
27
|
+
stop(): void;
|
|
28
|
+
execute(command: ClaimedEditorCommand): Promise<CommandExecution>;
|
|
29
|
+
private snapshot;
|
|
30
|
+
private click;
|
|
31
|
+
private type;
|
|
32
|
+
private selectElement;
|
|
33
|
+
private waitFor;
|
|
34
|
+
private networkProbe;
|
|
35
|
+
private evaluateReadonly;
|
|
36
|
+
}
|
|
37
|
+
export declare class EditorCommandPoller {
|
|
38
|
+
private readonly api;
|
|
39
|
+
private readonly executor;
|
|
40
|
+
private running;
|
|
41
|
+
private timer;
|
|
42
|
+
private polling;
|
|
43
|
+
constructor(api: EditorApi, executor: EditorCommandExecutor);
|
|
44
|
+
start(): void;
|
|
45
|
+
stop(): void;
|
|
46
|
+
private poll;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { EditorApi } from "./api";
|
|
2
|
+
import { DevicePreview } from "./device-preview";
|
|
3
|
+
import { type ActiveEditorSession, type EditorArtifacts, type EditorDeviceState, type EditorState } from "./types";
|
|
4
|
+
export type ArtifactCommandAudit = {
|
|
5
|
+
ok: boolean;
|
|
6
|
+
mutationAudit: Array<{
|
|
7
|
+
index: number;
|
|
8
|
+
selector: string;
|
|
9
|
+
action: string;
|
|
10
|
+
beforeCount: number;
|
|
11
|
+
afterCount: number;
|
|
12
|
+
effectVerified: boolean;
|
|
13
|
+
error: string | null;
|
|
14
|
+
}>;
|
|
15
|
+
generatedSelectors: string[];
|
|
16
|
+
generatedVisibility: Array<{
|
|
17
|
+
selector: string;
|
|
18
|
+
count: number;
|
|
19
|
+
visibleCount: number;
|
|
20
|
+
matches: Array<{
|
|
21
|
+
text: string;
|
|
22
|
+
visible: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
}>;
|
|
25
|
+
visibleGeneratedCount: number;
|
|
26
|
+
hiddenEffectVerifiedCount: number;
|
|
27
|
+
networkRequired: boolean;
|
|
28
|
+
customJsDeferred: boolean;
|
|
29
|
+
error?: string;
|
|
30
|
+
repairHint?: string;
|
|
31
|
+
};
|
|
32
|
+
export declare class EditorController {
|
|
33
|
+
readonly session: ActiveEditorSession;
|
|
34
|
+
readonly apiOrigin: string;
|
|
35
|
+
private readonly api;
|
|
36
|
+
private readonly reload;
|
|
37
|
+
private state;
|
|
38
|
+
private readonly listeners;
|
|
39
|
+
private readonly history;
|
|
40
|
+
private visualContext;
|
|
41
|
+
private devicePreview;
|
|
42
|
+
private saveTimer;
|
|
43
|
+
private saveQueue;
|
|
44
|
+
private revision;
|
|
45
|
+
private variationRequest;
|
|
46
|
+
private readonly cleanups;
|
|
47
|
+
constructor(session: ActiveEditorSession, apiOrigin: string, api?: EditorApi, reload?: () => void);
|
|
48
|
+
getState(): EditorState;
|
|
49
|
+
subscribe(listener: (state: EditorState) => void): () => void;
|
|
50
|
+
initialize(): Promise<void>;
|
|
51
|
+
selectVariation(variationId: string): Promise<void>;
|
|
52
|
+
setPickerActive(active: boolean): void;
|
|
53
|
+
selectElement(element: Element, selector: string): void;
|
|
54
|
+
clearSelection(): void;
|
|
55
|
+
clearSelectedElement(): void;
|
|
56
|
+
removeSelector(selector: string): void;
|
|
57
|
+
removeMutation(index: number): void;
|
|
58
|
+
restoreArtifacts(artifacts: EditorArtifacts): void;
|
|
59
|
+
extendSession(): Promise<string | null>;
|
|
60
|
+
resolveConflict(choice: "mine" | "theirs"): Promise<void>;
|
|
61
|
+
toggleArtifacts(enabled: boolean): void;
|
|
62
|
+
setDock(dock: "top" | "bottom"): void;
|
|
63
|
+
setText(value: string): void;
|
|
64
|
+
setImageSource(value: string): void;
|
|
65
|
+
setStyle(name: string, value: string): void;
|
|
66
|
+
hideSelected(): void;
|
|
67
|
+
removeSelected(): void;
|
|
68
|
+
setCustomCss(value: string): void;
|
|
69
|
+
setCustomJs(value: string): void;
|
|
70
|
+
applyCustomJs(): void;
|
|
71
|
+
undo(): void;
|
|
72
|
+
redo(): void;
|
|
73
|
+
attachDevicePreview(devicePreview: DevicePreview): void;
|
|
74
|
+
setDeviceState(deviceState: EditorDeviceState): void;
|
|
75
|
+
openDevicePreview(): void;
|
|
76
|
+
closeDevicePreview(): void;
|
|
77
|
+
addCleanup(cleanup: () => void): () => void;
|
|
78
|
+
applyCommandArtifacts(artifacts: EditorArtifacts): ArtifactCommandAudit;
|
|
79
|
+
saveNow(): Promise<void>;
|
|
80
|
+
private performSave;
|
|
81
|
+
exit(): Promise<void>;
|
|
82
|
+
destroy(): void;
|
|
83
|
+
private mutateSelected;
|
|
84
|
+
private commit;
|
|
85
|
+
private replaceFromHistory;
|
|
86
|
+
private applyVisualArtifacts;
|
|
87
|
+
private scheduleSave;
|
|
88
|
+
private cancelSave;
|
|
89
|
+
private patch;
|
|
90
|
+
private emit;
|
|
91
|
+
private selectorElements;
|
|
92
|
+
private selectorCount;
|
|
93
|
+
private isVisible;
|
|
94
|
+
private verifyMutationEffect;
|
|
95
|
+
private runCleanups;
|
|
96
|
+
private withTimeout;
|
|
97
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { EditorArtifacts, EditorDeviceState } from "./types";
|
|
2
|
+
export type DevicePreviewSize = {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
};
|
|
6
|
+
export declare class DevicePreview {
|
|
7
|
+
private readonly frame;
|
|
8
|
+
private readonly onState;
|
|
9
|
+
private context;
|
|
10
|
+
private hiddenChildren;
|
|
11
|
+
private timer;
|
|
12
|
+
private artifacts;
|
|
13
|
+
constructor(frame: HTMLIFrameElement, onState: (state: EditorDeviceState) => void);
|
|
14
|
+
open(artifacts: EditorArtifacts): void;
|
|
15
|
+
update(artifacts: EditorArtifacts, enabled?: boolean): void;
|
|
16
|
+
close(notify?: boolean): void;
|
|
17
|
+
private handleLoad;
|
|
18
|
+
private readDocument;
|
|
19
|
+
private apply;
|
|
20
|
+
private hideStorePage;
|
|
21
|
+
private blocked;
|
|
22
|
+
private restoreStorePage;
|
|
23
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EditorLaunchHint } from "../editor-bootstrap";
|
|
2
|
+
import type { ActiveEditorSession } from "./types";
|
|
3
|
+
export type { ActiveEditorSession } from "./types";
|
|
4
|
+
declare function cleanupActiveEditor(): void;
|
|
5
|
+
export declare function start(launch: EditorLaunchHint): Promise<boolean>;
|
|
6
|
+
export declare function getActiveEditorSession(): ActiveEditorSession | null;
|
|
7
|
+
export declare const __test: {
|
|
8
|
+
reset: typeof cleanupActiveEditor;
|
|
9
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ActiveEditorSession, EditorArtifacts } from "./types";
|
|
2
|
+
export type EditorOperatorMessage = {
|
|
3
|
+
role: "user" | "assistant";
|
|
4
|
+
content: string;
|
|
5
|
+
};
|
|
6
|
+
export type EditorOperatorSelectedElement = {
|
|
7
|
+
selector: string;
|
|
8
|
+
tag?: string;
|
|
9
|
+
textPreview?: string;
|
|
10
|
+
alternatives?: string[];
|
|
11
|
+
};
|
|
12
|
+
export type EditorOperatorResult = {
|
|
13
|
+
artifacts: EditorArtifacts;
|
|
14
|
+
explanation: string;
|
|
15
|
+
artifactCount: number;
|
|
16
|
+
mergeStrategy: "append" | "replace";
|
|
17
|
+
};
|
|
18
|
+
export declare function redactEditorContextUrl(value: string, baseUrl?: string): string;
|
|
19
|
+
export declare function collectEditorDomContext(documentLike?: Document): string;
|
|
20
|
+
export declare function mergeEditorOperatorArtifacts(input: {
|
|
21
|
+
current: EditorArtifacts;
|
|
22
|
+
generatedMutations: unknown;
|
|
23
|
+
generatedCss: unknown;
|
|
24
|
+
generatedJs: unknown;
|
|
25
|
+
mergeStrategy: unknown;
|
|
26
|
+
}): EditorArtifacts;
|
|
27
|
+
export declare function runEditorOperatorTurn(input: {
|
|
28
|
+
apiOrigin: string;
|
|
29
|
+
session: ActiveEditorSession;
|
|
30
|
+
variationId: string;
|
|
31
|
+
prompt: string;
|
|
32
|
+
artifacts: EditorArtifacts;
|
|
33
|
+
conversation: EditorOperatorMessage[];
|
|
34
|
+
pageContext?: string;
|
|
35
|
+
signal?: AbortSignal;
|
|
36
|
+
selectedElement?: EditorOperatorSelectedElement | null;
|
|
37
|
+
documentLike?: Document;
|
|
38
|
+
fetchImpl?: typeof fetch;
|
|
39
|
+
}): Promise<EditorOperatorResult>;
|