@encorekit/web-sdk 2.3.0 → 2.4.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 +66 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/preview.cjs +2 -0
- package/dist/cjs/preview.cjs.map +1 -0
- package/dist/cjs/react.cjs +1 -1
- package/dist/cjs/react.cjs.map +1 -1
- package/dist/esm/chunks/ClaimReminder-DFyrm5bJ.js +2 -0
- package/dist/esm/chunks/ClaimReminder-DFyrm5bJ.js.map +1 -0
- package/dist/esm/chunks/GiftsButton-B0lVB463.js +2 -0
- package/dist/esm/chunks/GiftsButton-B0lVB463.js.map +1 -0
- package/dist/esm/chunks/TriggerHost-CNTiNrTH.js +2 -0
- package/dist/esm/chunks/TriggerHost-CNTiNrTH.js.map +1 -0
- package/dist/esm/chunks/autoPops-CngtK_R0.js +2 -0
- package/dist/esm/chunks/autoPops-CngtK_R0.js.map +1 -0
- package/dist/esm/chunks/customClaim-B4uj-aOc.js +2 -0
- package/dist/esm/chunks/customClaim-B4uj-aOc.js.map +1 -0
- package/dist/esm/chunks/eligibility-BY7fL8Ve.js +2 -0
- package/dist/esm/chunks/eligibility-BY7fL8Ve.js.map +1 -0
- package/dist/esm/chunks/index-CaBSqauy.js +2 -0
- package/dist/esm/chunks/index-CaBSqauy.js.map +1 -0
- package/dist/esm/chunks/lookValues-B9z2VWpH.js +2 -0
- package/dist/esm/chunks/lookValues-B9z2VWpH.js.map +1 -0
- package/dist/esm/chunks/sduiView-Ds7QtFId.js +2 -0
- package/dist/esm/chunks/sduiView-Ds7QtFId.js.map +1 -0
- package/dist/esm/chunks/spot-DkKMLpB-.js +2 -0
- package/dist/esm/chunks/spot-DkKMLpB-.js.map +1 -0
- package/dist/esm/chunks/template-B9p4CbPD.js +2 -0
- package/dist/esm/chunks/template-B9p4CbPD.js.map +1 -0
- package/dist/esm/chunks/textSlots-BnwxUg9V.js +2 -0
- package/dist/esm/chunks/textSlots-BnwxUg9V.js.map +1 -0
- package/dist/esm/chunks/timers-Bva4yoGM.js +2 -0
- package/dist/esm/chunks/timers-Bva4yoGM.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/preview.js +2 -0
- package/dist/esm/preview.js.map +1 -0
- package/dist/esm/react.js +1 -1
- package/dist/esm/react.js.map +1 -1
- package/dist/umd/encore.min.js +1 -1
- package/dist/umd/encore.min.js.map +1 -1
- package/package.json +9 -1
- package/types/analytics/DiagnosticsOutbox.d.ts +1 -0
- package/types/analytics/DiagnosticsOutbox.d.ts.map +1 -1
- package/types/analytics/events.d.ts +105 -5
- package/types/analytics/events.d.ts.map +1 -1
- package/types/analytics/models.d.ts +2 -0
- package/types/analytics/models.d.ts.map +1 -1
- package/types/analytics/transport.d.ts +6 -0
- package/types/analytics/transport.d.ts.map +1 -1
- package/types/api/APIClient.d.ts +58 -3
- package/types/api/APIClient.d.ts.map +1 -1
- package/types/api/contract.d.ts +4 -1
- package/types/api/contract.d.ts.map +1 -1
- package/types/api/generated/types.d.ts +420 -39
- package/types/api/generated/types.d.ts.map +1 -1
- package/types/api/models.d.ts +18 -2
- package/types/api/models.d.ts.map +1 -1
- package/types/api/offerBuilder.d.ts +10 -4
- package/types/api/offerBuilder.d.ts.map +1 -1
- package/types/core/Encore.d.ts +145 -3
- package/types/core/Encore.d.ts.map +1 -1
- package/types/core/OfferManager.d.ts +25 -3
- package/types/core/OfferManager.d.ts.map +1 -1
- package/types/core/PlacementBuilder.d.ts +6 -1
- package/types/core/PlacementBuilder.d.ts.map +1 -1
- package/types/core/SignalManager.d.ts.map +1 -1
- package/types/core/StorageManager.d.ts +3 -2
- package/types/core/StorageManager.d.ts.map +1 -1
- package/types/core/StrictUnlockReconciler.d.ts +1 -1
- package/types/core/StrictUnlockReconciler.d.ts.map +1 -1
- package/types/core/claimHandle.d.ts +44 -0
- package/types/core/claimHandle.d.ts.map +1 -0
- package/types/core/claimLog.d.ts +102 -0
- package/types/core/claimLog.d.ts.map +1 -0
- package/types/core/claimRefusal.d.ts +3 -0
- package/types/core/claimRefusal.d.ts.map +1 -0
- package/types/core/claimStatusCheck.d.ts +62 -0
- package/types/core/claimStatusCheck.d.ts.map +1 -0
- package/types/core/giftVariant.d.ts +5 -0
- package/types/core/giftVariant.d.ts.map +1 -1
- package/types/core/hostDisplay.d.ts +9 -2
- package/types/core/hostDisplay.d.ts.map +1 -1
- package/types/core/sduiVariables.d.ts +20 -0
- package/types/core/sduiVariables.d.ts.map +1 -0
- package/types/core/strings.d.ts +114 -0
- package/types/core/strings.d.ts.map +1 -0
- package/types/core/unlockCode.d.ts +8 -1
- package/types/core/unlockCode.d.ts.map +1 -1
- package/types/core/userKeys.d.ts +7 -0
- package/types/core/userKeys.d.ts.map +1 -0
- package/types/core/version.d.ts +1 -1
- package/types/experiments/ExposureOutbox.d.ts +1 -0
- package/types/experiments/ExposureOutbox.d.ts.map +1 -1
- package/types/preview.d.ts +51 -0
- package/types/preview.d.ts.map +1 -0
- package/types/react.d.ts +53 -1
- package/types/react.d.ts.map +1 -1
- package/types/sdui/actions.d.ts +93 -0
- package/types/sdui/actions.d.ts.map +1 -0
- package/types/sdui/bindings.d.ts +63 -0
- package/types/sdui/bindings.d.ts.map +1 -0
- package/types/sdui/compile.d.ts +88 -0
- package/types/sdui/compile.d.ts.map +1 -0
- package/types/sdui/conditions.d.ts +22 -0
- package/types/sdui/conditions.d.ts.map +1 -0
- package/types/sdui/context.d.ts +132 -0
- package/types/sdui/context.d.ts.map +1 -0
- package/types/sdui/countdown.d.ts +31 -0
- package/types/sdui/countdown.d.ts.map +1 -0
- package/types/sdui/decode.d.ts +35 -0
- package/types/sdui/decode.d.ts.map +1 -0
- package/types/sdui/deps.d.ts +43 -0
- package/types/sdui/deps.d.ts.map +1 -0
- package/types/sdui/dominantColor.d.ts +24 -0
- package/types/sdui/dominantColor.d.ts.map +1 -0
- package/types/sdui/elements/confetti.d.ts +38 -0
- package/types/sdui/elements/confetti.d.ts.map +1 -0
- package/types/sdui/elements/content.d.ts +27 -0
- package/types/sdui/elements/content.d.ts.map +1 -0
- package/types/sdui/elements/interactive.d.ts +48 -0
- package/types/sdui/elements/interactive.d.ts.map +1 -0
- package/types/sdui/elements/layout.d.ts +41 -0
- package/types/sdui/elements/layout.d.ts.map +1 -0
- package/types/sdui/elements/marquee.d.ts +17 -0
- package/types/sdui/elements/marquee.d.ts.map +1 -0
- package/types/sdui/elements/progress.d.ts +10 -0
- package/types/sdui/elements/progress.d.ts.map +1 -0
- package/types/sdui/elements/shared.d.ts +138 -0
- package/types/sdui/elements/shared.d.ts.map +1 -0
- package/types/sdui/elements/symbols.d.ts +22 -0
- package/types/sdui/elements/symbols.d.ts.map +1 -0
- package/types/sdui/elements/triggerText.d.ts +55 -0
- package/types/sdui/elements/triggerText.d.ts.map +1 -0
- package/types/sdui/host.d.ts +274 -0
- package/types/sdui/host.d.ts.map +1 -0
- package/types/sdui/inlineMarkup.d.ts +22 -0
- package/types/sdui/inlineMarkup.d.ts.map +1 -0
- package/types/sdui/lookValues.d.ts +50 -0
- package/types/sdui/lookValues.d.ts.map +1 -0
- package/types/sdui/model.d.ts +130 -0
- package/types/sdui/model.d.ts.map +1 -0
- package/types/sdui/motion.d.ts +37 -0
- package/types/sdui/motion.d.ts.map +1 -0
- package/types/sdui/precheck.d.ts +94 -0
- package/types/sdui/precheck.d.ts.map +1 -0
- package/types/sdui/scrollMath.d.ts +32 -0
- package/types/sdui/scrollMath.d.ts.map +1 -0
- package/types/sdui/style.d.ts +99 -0
- package/types/sdui/style.d.ts.map +1 -0
- package/types/sdui/triggerKit.d.ts +24 -0
- package/types/sdui/triggerKit.d.ts.map +1 -0
- package/types/sdui/unrunnable.d.ts +11 -0
- package/types/sdui/unrunnable.d.ts.map +1 -0
- package/types/sdui/vocabulary.d.ts +119 -0
- package/types/sdui/vocabulary.d.ts.map +1 -0
- package/types/triggers/claimReminder/ClaimReminder.d.ts +65 -0
- package/types/triggers/claimReminder/ClaimReminder.d.ts.map +1 -0
- package/types/triggers/claimReminder/bindings.d.ts +40 -0
- package/types/triggers/claimReminder/bindings.d.ts.map +1 -0
- package/types/triggers/claimReminder/config.d.ts +56 -0
- package/types/triggers/claimReminder/config.d.ts.map +1 -0
- package/types/triggers/claimReminder/eligibility.d.ts +37 -0
- package/types/triggers/claimReminder/eligibility.d.ts.map +1 -0
- package/types/triggers/claimReminder/servedWindow.d.ts +15 -0
- package/types/triggers/claimReminder/servedWindow.d.ts.map +1 -0
- package/types/triggers/claimReminder/source.d.ts +29 -0
- package/types/triggers/claimReminder/source.d.ts.map +1 -0
- package/types/triggers/giftsButton/GiftsButton.d.ts +60 -0
- package/types/triggers/giftsButton/GiftsButton.d.ts.map +1 -0
- package/types/triggers/giftsButton/config.d.ts +53 -0
- package/types/triggers/giftsButton/config.d.ts.map +1 -0
- package/types/triggers/giftsButton/spot.d.ts +54 -0
- package/types/triggers/giftsButton/spot.d.ts.map +1 -0
- package/types/triggers/host/TriggerHost.d.ts +127 -0
- package/types/triggers/host/TriggerHost.d.ts.map +1 -0
- package/types/triggers/host/autoPops.d.ts +16 -0
- package/types/triggers/host/autoPops.d.ts.map +1 -0
- package/types/triggers/host/configCache.d.ts +29 -0
- package/types/triggers/host/configCache.d.ts.map +1 -0
- package/types/triggers/host/customClaim.d.ts +85 -0
- package/types/triggers/host/customClaim.d.ts.map +1 -0
- package/types/triggers/host/dismissStore.d.ts +37 -0
- package/types/triggers/host/dismissStore.d.ts.map +1 -0
- package/types/triggers/host/readThrottle.d.ts +15 -0
- package/types/triggers/host/readThrottle.d.ts.map +1 -0
- package/types/triggers/host/registry.d.ts +17 -0
- package/types/triggers/host/registry.d.ts.map +1 -0
- package/types/triggers/host/sduiView.d.ts +31 -0
- package/types/triggers/host/sduiView.d.ts.map +1 -0
- package/types/triggers/host/template.d.ts +28 -0
- package/types/triggers/host/template.d.ts.map +1 -0
- package/types/triggers/host/textSlots.d.ts +35 -0
- package/types/triggers/host/textSlots.d.ts.map +1 -0
- package/types/triggers/host/theme.d.ts +87 -0
- package/types/triggers/host/theme.d.ts.map +1 -0
- package/types/triggers/host/timers.d.ts +11 -0
- package/types/triggers/host/timers.d.ts.map +1 -0
- package/types/triggers/host/types.d.ts +278 -0
- package/types/triggers/host/types.d.ts.map +1 -0
- package/types/triggers/host/wire.d.ts +55 -0
- package/types/triggers/host/wire.d.ts.map +1 -0
- package/types/triggers/preview.d.ts +78 -0
- package/types/triggers/preview.d.ts.map +1 -0
- package/types/triggers/request.d.ts +53 -0
- package/types/triggers/request.d.ts.map +1 -0
- package/types/types.d.ts +329 -1
- package/types/types.d.ts.map +1 -1
- package/types/ui/ClaimScreen.d.ts +1 -1
- package/types/ui/ClaimScreen.d.ts.map +1 -1
- package/types/ui/CodeUnlock.d.ts +12 -2
- package/types/ui/CodeUnlock.d.ts.map +1 -1
- package/types/ui/GiftHero.d.ts.map +1 -1
- package/types/ui/GiftList.d.ts.map +1 -1
- package/types/ui/GiftPicker.d.ts.map +1 -1
- package/types/ui/GiftPickerHero.d.ts.map +1 -1
- package/types/ui/GiftReveal.d.ts.map +1 -1
- package/types/ui/GiftSheet.d.ts +5 -5
- package/types/ui/GiftSheet.d.ts.map +1 -1
- package/types/ui/GiftUnwrap.d.ts.map +1 -1
- package/types/ui/OfferCard.d.ts.map +1 -1
- package/types/ui/OfferCarousel.d.ts.map +1 -1
- package/types/ui/OfferModal.d.ts +31 -0
- package/types/ui/OfferModal.d.ts.map +1 -1
- package/types/ui/PrimerScreen.d.ts +2 -0
- package/types/ui/PrimerScreen.d.ts.map +1 -1
- package/types/ui/RedemptionScreen.d.ts +5 -0
- package/types/ui/RedemptionScreen.d.ts.map +1 -1
- package/types/ui/RewardActions.d.ts.map +1 -1
- package/types/ui/RewardCard.d.ts.map +1 -1
- package/types/ui/SduiRewardSurface.d.ts +145 -0
- package/types/ui/SduiRewardSurface.d.ts.map +1 -0
- package/types/ui/Tooltip.d.ts.map +1 -1
- package/types/ui/brandComponents.d.ts.map +1 -1
- package/types/ui/brandTint.d.ts.map +1 -1
- package/types/ui/colorScheme.d.ts +15 -0
- package/types/ui/colorScheme.d.ts.map +1 -0
- package/types/ui/covered.d.ts +12 -0
- package/types/ui/covered.d.ts.map +1 -0
- package/types/ui/giftCategoryGroups.d.ts +13 -0
- package/types/ui/giftCategoryGroups.d.ts.map +1 -1
- package/types/ui/giftCopy.d.ts +14 -9
- package/types/ui/giftCopy.d.ts.map +1 -1
- package/types/ui/giftUnwrapCopy.d.ts.map +1 -1
- package/types/ui/imageURL.d.ts +44 -0
- package/types/ui/imageURL.d.ts.map +1 -0
- package/types/ui/impressionGate.d.ts +9 -0
- package/types/ui/impressionGate.d.ts.map +1 -1
- package/types/ui/offerBadge.d.ts.map +1 -1
- package/types/ui/rewardSurface.d.ts +11 -1
- package/types/ui/rewardSurface.d.ts.map +1 -1
- package/types/ui/sduiTheme.d.ts +48 -0
- package/types/ui/sduiTheme.d.ts.map +1 -0
- package/types/ui/sheetDetents.d.ts +28 -0
- package/types/ui/sheetDetents.d.ts.map +1 -0
- package/types/ui/styles.d.ts +11 -8
- package/types/ui/styles.d.ts.map +1 -1
- package/types/ui/termsLine.d.ts +3 -3
- package/types/ui/termsLine.d.ts.map +1 -1
- package/types/ui/toast.d.ts +11 -0
- package/types/ui/toast.d.ts.map +1 -0
- package/types/utils/logger.d.ts +10 -0
- package/types/utils/logger.d.ts.map +1 -1
- package/types/utils/text.d.ts +17 -0
- package/types/utils/text.d.ts.map +1 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the user's open claims ended, asked of the server
|
|
3
|
+
* (`GET /transactions/{id}/status`, the stored status: never `verify`, which would call
|
|
4
|
+
* the advertiser; the server's poller keeps the stored status current) and written to
|
|
5
|
+
* the claim log. INTERNAL.
|
|
6
|
+
*
|
|
7
|
+
* Callers run it before the reminder draws (a mount, a page visible again, and a
|
|
8
|
+
* GiftsButton spot's own re-reads at a window's end or midnight) and when a tap re-opens
|
|
9
|
+
* the sheet for a claim (without waiting: on the web the
|
|
10
|
+
* sheet must open inside the click, where native waits up to 1.5 s). It asks about the
|
|
11
|
+
* newest open claims only, each at most once per 5 minutes (jittered; a failed ask
|
|
12
|
+
* counts), until the claim is past its 720 hour window, one claim at a time. Callers at
|
|
13
|
+
* the same time share one request per claim, and a 429 stops the round and pauses every
|
|
14
|
+
* check. The answers' times and the pause are kept in storage, so they hold across page
|
|
15
|
+
* loads and tabs. The bounds are in
|
|
16
|
+
* {@link CLAIM_CHECK_BOUNDS}, the same on every platform.
|
|
17
|
+
*/
|
|
18
|
+
import type { ClaimLog } from './claimLog';
|
|
19
|
+
export interface ClaimCheckBounds {
|
|
20
|
+
/** The newest open claims asked about per check. */
|
|
21
|
+
maxPerCheck: number;
|
|
22
|
+
/** How long one claim's answer (or failure) stands before it is asked again. Jittered. */
|
|
23
|
+
cacheMs: number;
|
|
24
|
+
/** No check once the claim is this old (its longest reminder window). */
|
|
25
|
+
windowMs: number;
|
|
26
|
+
/** Every check pauses this long after a 429. */
|
|
27
|
+
rateLimitPauseMs: number;
|
|
28
|
+
}
|
|
29
|
+
export declare const CLAIM_CHECK_BOUNDS: Readonly<ClaimCheckBounds>;
|
|
30
|
+
/** The server's status for a transaction (the backend's raw value), or null. Rejects on failure. */
|
|
31
|
+
export type ClaimStatusRead = (transactionId: string) => Promise<string | null | undefined>;
|
|
32
|
+
/**
|
|
33
|
+
* Where the per-claim answers and the 429 pause are kept across page loads and tabs, so
|
|
34
|
+
* the 5 minutes and the pause hold for the browser, not one page. StorageManager's slot.
|
|
35
|
+
*/
|
|
36
|
+
export interface ClaimStatusStore {
|
|
37
|
+
get(): unknown;
|
|
38
|
+
set(value: unknown): void;
|
|
39
|
+
}
|
|
40
|
+
export declare class ClaimStatusCheck {
|
|
41
|
+
#private;
|
|
42
|
+
/** Called whenever a check ends a claim, even one answered after its caller stopped waiting. */
|
|
43
|
+
onEnded: (() => void) | null;
|
|
44
|
+
constructor(status: ClaimStatusRead, now?: () => number, jitter?: () => number, bounds?: Readonly<ClaimCheckBounds>, store?: ClaimStatusStore | null);
|
|
45
|
+
/**
|
|
46
|
+
* Before the reminder draws: ask about the newest open claims that are due (skipping
|
|
47
|
+
* the ones `dismissed` names), and finish
|
|
48
|
+
* the ones that ended. Resolves true when one of them ended (here, or in a request
|
|
49
|
+
* this check joined). Never rejects.
|
|
50
|
+
*/
|
|
51
|
+
run(log: ClaimLog, userId: string, dismissed?: (transactionId: string) => boolean): Promise<boolean>;
|
|
52
|
+
/**
|
|
53
|
+
* A tap on a reminder for this claim, about to open the sheet: false when the log
|
|
54
|
+
* already knows it ended. Otherwise true, and the claim is asked about now if it is
|
|
55
|
+
* due, without waiting: the sheet must open inside the click, so an answer lands
|
|
56
|
+
* through `onEnded`. Never throws.
|
|
57
|
+
*/
|
|
58
|
+
beforeTap(transactionId: string, log: ClaimLog, userId: string): boolean;
|
|
59
|
+
/** Another person: what this page knew about the last one's claims no longer applies. */
|
|
60
|
+
forget(): void;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=claimStatusCheck.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claimStatusCheck.d.ts","sourceRoot":"","sources":["../../src/core/claimStatusCheck.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,MAAM,WAAW,gBAAgB;IAC/B,oDAAoD;IACpD,WAAW,EAAE,MAAM,CAAC;IACpB,0FAA0F;IAC1F,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,QAAQ,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,gBAAgB,CAKxD,CAAC;AAOH,oGAAoG;AACpG,MAAM,MAAM,eAAe,GAAG,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;AAQ5F;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,GAAG,IAAI,OAAO,CAAC;IACf,GAAG,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAC3B;AAiCD,qBAAa,gBAAgB;;IAa3B,gGAAgG;IAChG,OAAO,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAQ;gBAGlC,MAAM,EAAE,eAAe,EACvB,GAAG,GAAE,MAAM,MAAyB,EACpC,MAAM,GAAE,MAAM,MAAwC,EACtD,MAAM,GAAE,QAAQ,CAAC,gBAAgB,CAAsB,EACvD,KAAK,GAAE,gBAAgB,GAAG,IAAW;IAoCvC;;;;;OAKG;IACG,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IA6B1G;;;;;OAKG;IACH,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAcxE,yFAAyF;IACzF,MAAM,IAAI,IAAI;CAoDf"}
|
|
@@ -70,4 +70,9 @@ export declare function rewardSurfaceKind(variantName: string | null | undefined
|
|
|
70
70
|
* callers pass one argument.
|
|
71
71
|
*/
|
|
72
72
|
table?: Readonly<Record<string, RewardSurfaceKind>>): RewardSurfaceKind | null;
|
|
73
|
+
/**
|
|
74
|
+
* The web control arm. The backend serves it with a placeholder tree and says web
|
|
75
|
+
* draws its default carousel, so control cells carry a real variant id.
|
|
76
|
+
*/
|
|
77
|
+
export declare function isCarouselControlArm(variantName: string | null | undefined): boolean;
|
|
73
78
|
//# sourceMappingURL=giftVariant.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"giftVariant.d.ts","sourceRoot":"","sources":["../../src/core/giftVariant.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,gEAAgE;AAChE,MAAM,MAAM,iBAAiB,GACzB,YAAY,GACZ,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,iBAAiB,GACjB,eAAe,CAAC;AAEpB;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAU3E,CAAC;AAEH;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;AACtC;;;;;;GAMG;AACH,KAAK,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAwB,GACxE,iBAAiB,GAAG,IAAI,CAO1B"}
|
|
1
|
+
{"version":3,"file":"giftVariant.d.ts","sourceRoot":"","sources":["../../src/core/giftVariant.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,gEAAgE;AAChE,MAAM,MAAM,iBAAiB,GACzB,YAAY,GACZ,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,iBAAiB,GACjB,eAAe,CAAC;AAEpB;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAU3E,CAAC;AAEH;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;AACtC;;;;;;GAMG;AACH,KAAK,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAwB,GACxE,iBAAiB,GAAG,IAAI,CAO1B;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAEpF"}
|
|
@@ -29,22 +29,29 @@ export interface RemoteHostSource {
|
|
|
29
29
|
appIconUrl?: string;
|
|
30
30
|
/** `entitlements.native.durationDays` — the trial-end line's only input. */
|
|
31
31
|
trialDurationDays?: number;
|
|
32
|
+
/**
|
|
33
|
+
* `entitlements.iap.premiumTierName` — the publisher's own name for its paid
|
|
34
|
+
* tier, which served variants address as `${premiumTierName}`.
|
|
35
|
+
*/
|
|
36
|
+
premiumTierName?: string;
|
|
32
37
|
}
|
|
33
38
|
/** Resolve the host nouns. Every field independently optional. */
|
|
34
39
|
export declare function resolveHostDisplay(source: RemoteHostSource): HostDisplay;
|
|
35
40
|
/** The deferred flow's sentences, each with exactly one definition. */
|
|
36
41
|
export declare const displayCopy: {
|
|
37
42
|
readonly primerTitle: (app: string, trial?: string) => string;
|
|
38
|
-
readonly primerSubtitle: (app: string) => string;
|
|
43
|
+
readonly primerSubtitle: (app: string, knownTrial?: boolean) => string;
|
|
39
44
|
readonly primerCta: (app: string, trial?: string) => string;
|
|
40
45
|
/** The holding story: the host is unnamed, so the sentence is about the reward. */
|
|
41
46
|
readonly holdingTitle: () => string;
|
|
42
|
-
readonly holdingSubtitle: (advertiser?: string) => string;
|
|
47
|
+
readonly holdingSubtitle: (advertiser?: string, knownTrial?: boolean) => string;
|
|
43
48
|
readonly holdingCta: () => string;
|
|
44
49
|
readonly s2Title: (app: string, trial?: string) => string;
|
|
45
50
|
readonly s2Subtitle: (app: string) => string;
|
|
46
51
|
/** Host-row detail composed from the remote durationDays and the redemption moment. */
|
|
47
52
|
readonly s2HostDetail: (trialEnd: Date) => string;
|
|
48
53
|
readonly s2Cta: () => string;
|
|
54
|
+
/** The line above the redemption CTA; undefined when there is nothing true to say. */
|
|
55
|
+
readonly redemptionNote: (advertiser: string | undefined, knownTrial: boolean) => string | undefined;
|
|
49
56
|
};
|
|
50
57
|
//# sourceMappingURL=hostDisplay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hostDisplay.d.ts","sourceRoot":"","sources":["../../src/core/hostDisplay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"hostDisplay.d.ts","sourceRoot":"","sources":["../../src/core/hostDisplay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,MAAM,WAAW,WAAW;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,8FAA8F;AAC9F,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AA4CD,kEAAkE;AAClE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,WAAW,CASxE;AAED,uEAAuE;AACvE,eAAO,MAAM,WAAW;gCACH,MAAM,UAAU,MAAM,KAAG,MAAM;mCAW5B,MAAM,2BAAuB,MAAM;8BAMxC,MAAM,UAAU,MAAM,KAAG,MAAM;IAIhD,mFAAmF;iCACjE,MAAM;4CACO,MAAM,2BAAuB,MAAM;+BAgBlD,MAAM;4BACP,MAAM,UAAU,MAAM,KAAG,MAAM;+BAI5B,MAAM,KAAG,MAAM;IAEjC,uFAAuF;sCAC9D,IAAI,KAAG,MAAM;0BAK3B,MAAM;IACjB,sFAAsF;0CACzD,MAAM,GAAG,SAAS,cAAc,OAAO,KAAG,MAAM,GAAG,SAAS;CAYjF,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RemoteHostSource } from './hostDisplay';
|
|
2
|
+
/**
|
|
3
|
+
* The `${token}` variables a served template reads, built as Swift's
|
|
4
|
+
* `OfferContext.allVariables` builds them. Web has no purchases, so the IAP
|
|
5
|
+
* variables Swift adds are absent.
|
|
6
|
+
*/
|
|
7
|
+
export interface SduiVariableSources {
|
|
8
|
+
/** `values.text`. Loosely typed, so a null can reach here. */
|
|
9
|
+
text: Readonly<Record<string, unknown>> | null | undefined;
|
|
10
|
+
/** `values.appearance`. */
|
|
11
|
+
appearance: Readonly<Record<string, unknown>> | null | undefined;
|
|
12
|
+
host: RemoteHostSource;
|
|
13
|
+
/** Churn reads `customHeadline`; reward reads `rewardHeadline`. */
|
|
14
|
+
churn: boolean;
|
|
15
|
+
/** The placement's own `headline` and `subheadline`, already blank-checked. */
|
|
16
|
+
headline: string | undefined;
|
|
17
|
+
subheadline: string | undefined;
|
|
18
|
+
}
|
|
19
|
+
export declare function sduiTemplateVariables(src: SduiVariableSources): Record<string, string>;
|
|
20
|
+
//# sourceMappingURL=sduiVariables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sduiVariables.d.ts","sourceRoot":"","sources":["../../src/core/sduiVariables.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtD;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,8DAA8D;IAC9D,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;IAC3D,2BAA2B;IAC3B,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;IACjE,IAAI,EAAE,gBAAgB,CAAC;IACvB,mEAAmE;IACnE,KAAK,EAAE,OAAO,CAAC;IACf,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAgBD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAsCtF"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE strings provider: every sentence the SDK itself says, looked up by a stable
|
|
3
|
+
* string id, with the shipped English as the fallback.
|
|
4
|
+
*
|
|
5
|
+
* WHY THIS SHAPE. SDK-owned copy is served by the backend in a `strings` block on
|
|
6
|
+
* `/config`, and the English literals stay in code as the last fallback. No per-language dictionary is bundled, so the
|
|
7
|
+
* bundle stays flat however many languages Encore turns on.
|
|
8
|
+
*
|
|
9
|
+
* `/config` serves the block as `ui.values.strings` and `ui.values.plurals`, holding
|
|
10
|
+
* only the ids the resolved locale has an APPROVED translation for; every other id
|
|
11
|
+
* keeps its English here. {@link setServedCopy} adopts both maps together with the
|
|
12
|
+
* locale they were resolved in. Nothing is served for English, so an English session
|
|
13
|
+
* renders byte-identically to before.
|
|
14
|
+
*
|
|
15
|
+
* TEMPLATES use `${name}` placeholders, the token syntax the backend's copy tokens and
|
|
16
|
+
* its machine-translation token protection already use, so a served string survives
|
|
17
|
+
* translation with its holes intact. A placeholder with no value is left visible
|
|
18
|
+
* rather than printed as `undefined`.
|
|
19
|
+
*
|
|
20
|
+
* PLURALS are CLDR forms (`zero`, `one`, `two`, `few`, `many`, `other`; only `other`
|
|
21
|
+
* is required). The category is chosen with `Intl.PluralRules` in the SERVED locale
|
|
22
|
+
* when the served block supplied the forms, and in English when the fallback is
|
|
23
|
+
* used: Arabic rules over English forms would pick "few" and land on the wrong one.
|
|
24
|
+
*
|
|
25
|
+
* Module state, not instance state, because `Encore` is itself a module singleton
|
|
26
|
+
* and the UI modules read copy at render time without a handle to it.
|
|
27
|
+
*/
|
|
28
|
+
export type Vars = Record<string, string | number>;
|
|
29
|
+
/** CLDR plural forms. `other` is the only one every language has. */
|
|
30
|
+
export interface PluralForms {
|
|
31
|
+
zero?: string;
|
|
32
|
+
one?: string;
|
|
33
|
+
two?: string;
|
|
34
|
+
few?: string;
|
|
35
|
+
many?: string;
|
|
36
|
+
other: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Adopt a served strings block. TOLERANT by design, because it is remote data: only a
|
|
40
|
+
* non-blank string or a well-formed plural (with `other`) is kept; anything else
|
|
41
|
+
* falls through to English for that id alone. Replaces the previous block wholesale,
|
|
42
|
+
* so a language change never leaves the old language's strings behind.
|
|
43
|
+
*/
|
|
44
|
+
export declare function setServedStrings(...blocks: unknown[]): void;
|
|
45
|
+
/**
|
|
46
|
+
* Adopt one `/config` answer: the locale it resolved and, when it carries `values`,
|
|
47
|
+
* that locale's `strings` and `plurals` (one id namespace). The maps live and die with
|
|
48
|
+
* their locale: an answer with no `values` keeps the maps only while the locale is
|
|
49
|
+
* unchanged, so strings of one language never sit under another's `lang`.
|
|
50
|
+
*/
|
|
51
|
+
export declare function setServedCopy(tag: unknown, values: {
|
|
52
|
+
strings?: unknown;
|
|
53
|
+
plurals?: unknown;
|
|
54
|
+
} | null | undefined): void;
|
|
55
|
+
/** The locale the backend says it served (`/config` `locale`), or undefined. */
|
|
56
|
+
export declare function setServedLocale(tag: unknown): void;
|
|
57
|
+
export declare function servedLocale(): string | undefined;
|
|
58
|
+
/** Forget every served string and the served locale. */
|
|
59
|
+
export declare function resetStrings(): void;
|
|
60
|
+
/** One sentence by id: the served string when there is one, else `fallback`. */
|
|
61
|
+
export declare function str(id: string, fallback: string, vars?: Vars): string;
|
|
62
|
+
/**
|
|
63
|
+
* A count-dependent sentence. `${count}` is always available to the template.
|
|
64
|
+
* The served forms are chosen by the served locale's rules, the English fallback by
|
|
65
|
+
* English rules.
|
|
66
|
+
*/
|
|
67
|
+
export declare function plural(id: string, count: number, fallback: PluralForms, vars?: Vars): string;
|
|
68
|
+
/** A count-dependent string only when the server sent its forms, as Swift's `servedPlural`. */
|
|
69
|
+
export declare function servedPlural(id: string, count: number): string | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* A sentence whose holes hold ELEMENTS (a link, a styled amount), as DOM nodes in
|
|
72
|
+
* reading order. The sentence is ONE template (`'By proceeding you agree to our
|
|
73
|
+
* ${link}'`), so a translation can put the element anywhere in it; splitting it into
|
|
74
|
+
* a lead and a tail would fix English word order into every language.
|
|
75
|
+
*
|
|
76
|
+
* A `${name}` in `nodes` becomes that node (its first occurrence); one in `vars` is
|
|
77
|
+
* filled as text; any other stays visible, as in {@link str}. A node the template
|
|
78
|
+
* never places is appended after a space, so a translation that dropped the
|
|
79
|
+
* placeholder never loses the control. `text` wraps each text run (to style it);
|
|
80
|
+
* by default runs are plain text nodes. Empty runs are skipped.
|
|
81
|
+
*/
|
|
82
|
+
export declare function fillNodes(template: string, nodes: Record<string, Node>, vars?: Vars, text?: (run: string) => Node): Node[];
|
|
83
|
+
/**
|
|
84
|
+
* A copy table whose every key reads through {@link str} under `namespace`, so
|
|
85
|
+
* `GIFT_COPY.headline` is the id `gift.headline` with its English beside it. Keeps
|
|
86
|
+
* the property-access shape the UI modules and their tests already use.
|
|
87
|
+
*/
|
|
88
|
+
export declare function copyTable<T extends Record<string, string>>(namespace: string, english: T): T;
|
|
89
|
+
/**
|
|
90
|
+
* Languages written right to left, by language subtag: the same 18 as iOS and Android
|
|
91
|
+
* (`ServedLayoutDirection` on both), so a served locale mirrors the sheet on every
|
|
92
|
+
* platform or on none.
|
|
93
|
+
*/
|
|
94
|
+
export declare const RTL_LANGUAGES: ReadonlySet<string>;
|
|
95
|
+
export declare function isRtlLocale(tag: string | undefined): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Stamp `lang` and `dir` on an SDK root from the served locale. With no served
|
|
98
|
+
* locale the attributes are REMOVED, so the host page's own language and direction
|
|
99
|
+
* apply exactly as before.
|
|
100
|
+
*/
|
|
101
|
+
export declare function applyLocaleAttributes(el: HTMLElement): void;
|
|
102
|
+
/** Whether `el` renders right to left, by the nearest `dir` attribute. */
|
|
103
|
+
export declare function isRtlElement(el: Element | null): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* A keydown's key in READING order: ArrowLeft and ArrowRight swap inside a
|
|
106
|
+
* right-to-left subtree, so "ArrowRight means next" holds for every handler without
|
|
107
|
+
* each one knowing about direction. Every other key passes through.
|
|
108
|
+
*/
|
|
109
|
+
export declare function logicalArrowKey(key: string, el: Element | null): string;
|
|
110
|
+
/** A date in the served locale (the browser's when none was served). */
|
|
111
|
+
export declare function formatDate(date: Date, options: Intl.DateTimeFormatOptions): string;
|
|
112
|
+
/** A number in the served locale (the browser's when none was served). */
|
|
113
|
+
export declare function formatNumber(value: number): string;
|
|
114
|
+
//# sourceMappingURL=strings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/core/strings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAEnD,qEAAqE;AACrE,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAyBD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAQ3D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAClE,IAAI,CAKN;AAED,gFAAgF;AAChF,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAElD;AAED,wBAAgB,YAAY,IAAI,MAAM,GAAG,SAAS,CAEjD;AAED,wDAAwD;AACxD,wBAAgB,YAAY,IAAI,IAAI,CAGnC;AAED,gFAAgF;AAChF,wBAAgB,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAGrE;AAUD;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAQ5F;AAED,+FAA+F;AAC/F,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG1E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CACvB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EAC3B,IAAI,CAAC,EAAE,IAAI,EACX,IAAI,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAA4C,GAClE,IAAI,EAAE,CAgCR;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAS5F;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,MAAM,CAG5C,CAAC;AAEH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAG5D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,CAQ3D;AAED,0EAA0E;AAC1E,wBAAgB,YAAY,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,GAAG,OAAO,CAExD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,GAAG,IAAI,GAAG,MAAM,CAKvE;AAaD,wEAAwE;AACxE,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,qBAAqB,GAAG,MAAM,CAElF;AAED,0EAA0E;AAC1E,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD"}
|
|
@@ -17,7 +17,14 @@ export declare function normalizeUnlockCode(raw: unknown): string;
|
|
|
17
17
|
/**
|
|
18
18
|
* The "Up to {amount} in rewards" amount, or null for no line. Page-supplied: a campaign's
|
|
19
19
|
* oldPrice/newPrice are free-text display prices with no currency or period, so nothing on
|
|
20
|
-
* an offer states a reward value. Only a short money amount is accepted, never free text
|
|
20
|
+
* an offer states a reward value. Only a short money amount is accepted, never free text:
|
|
21
|
+
* a currency symbol or code before or after a number of up to five digits and optional
|
|
22
|
+
* cents.
|
|
23
|
+
*
|
|
24
|
+
* Returned verbatim unless the server named a locale; then it is written the way that
|
|
25
|
+
* locale writes money. A symbol the page wrote stays narrow, so "$" stays "$" rather
|
|
26
|
+
* than "US$"; a currency CODE keeps its currency visible ("CA$", "AU$"), because the
|
|
27
|
+
* narrow symbol would print CAD and AUD as a bare "$".
|
|
21
28
|
*/
|
|
22
29
|
export declare function unlockValueAmount(raw: unknown): string | null;
|
|
23
30
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unlockCode.d.ts","sourceRoot":"","sources":["../../src/core/unlockCode.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"unlockCode.d.ts","sourceRoot":"","sources":["../../src/core/unlockCode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,6EAA6E;AAC7E,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,MAAM,MAAM,iBAAiB,GACzB;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE;AACd,8EAA8E;GAC5E;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,OAAO,GAAG,UAAU,CAAA;CAAE,CAAC;AAEhD,qFAAqF;AACrF,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAGxD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAqB7D;AAOD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAExE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** One user's pending grant signals (SignalManager). */
|
|
2
|
+
export declare function signalQueueKey(userId: string): string;
|
|
3
|
+
/** One user's strict-mode claim awaiting verification (StrictUnlockReconciler). */
|
|
4
|
+
export declare function strictPendingKey(userId: string): string;
|
|
5
|
+
/** Whether `key` holds some user's still-owed record: queued grant signals or a strict claim. */
|
|
6
|
+
export declare function isUserPendingKey(key: string): boolean;
|
|
7
|
+
//# sourceMappingURL=userKeys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userKeys.d.ts","sourceRoot":"","sources":["../../src/core/userKeys.ts"],"names":[],"mappings":"AAKA,wDAAwD;AACxD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,mFAAmF;AACnF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,iGAAiG;AACjG,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAErD"}
|
package/types/core/version.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { ReliableOutbox } from '../analytics/ReliableOutbox';
|
|
9
9
|
import type { StorageManager } from '../core/StorageManager';
|
|
10
|
+
export declare const EXPOSURE_OUTBOX_KEY = "ncl_exposure_outbox";
|
|
10
11
|
export declare class ExposureOutbox extends ReliableOutbox {
|
|
11
12
|
constructor(apiKey: string, analyticsBaseURL: string, storage: StorageManager);
|
|
12
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExposureOutbox.d.ts","sourceRoot":"","sources":["../../src/experiments/ExposureOutbox.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"ExposureOutbox.d.ts","sourceRoot":"","sources":["../../src/experiments/ExposureOutbox.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AAEzD,qBAAa,cAAe,SAAQ,cAAc;gBACpC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc;CAG9E"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@encorekit/web-sdk/preview` — 🔴 INTERNAL, for the Encore admin portal only. Not a
|
|
3
|
+
* public API: no semver promise, and it may change with any release.
|
|
4
|
+
*
|
|
5
|
+
* Renders the SDK's REAL churn or reward sheet inline, from what the portal already
|
|
6
|
+
* has: the `/config` `ui` object (strings and plurals included) and the `/offers/search`
|
|
7
|
+
* `offers`. It is the live presentation code with its I/O replaced, so the preview is
|
|
8
|
+
* what users see. Guarantees:
|
|
9
|
+
*
|
|
10
|
+
* - no fetch, XHR or beacon: /config and /offers/search answer from the input;
|
|
11
|
+
* - no analytics and no storage write, from import to destroy();
|
|
12
|
+
* - claim, decline, share and close do nothing, and nothing navigates;
|
|
13
|
+
* - inline in `container` (an element or a shadow root), stylesheet included; nothing
|
|
14
|
+
* is added to `document.head` or `document.body`, and no global is created;
|
|
15
|
+
* - after destroy(), no window or document listener, timer or node is left behind;
|
|
16
|
+
* - no React.
|
|
17
|
+
*
|
|
18
|
+
* LIMITS. Served strings are module state, so render one locale per page at a time (an
|
|
19
|
+
* iframe per locale for side by side). The mobile/desktop layout follows the viewport,
|
|
20
|
+
* so preview a phone in an iframe that width. Offer images load from their URLs. While
|
|
21
|
+
* mounted, the churn carousel listens for arrow keys on the document, as it does live.
|
|
22
|
+
*
|
|
23
|
+
* TRIGGERS. `renderTriggerPreview` draws one trigger look (a GiftsButton or ClaimReminder
|
|
24
|
+
* variant file) with sample offers and claims, in a device state, through the live
|
|
25
|
+
* plug-ins, under the same guarantees. See `triggers/preview.ts`.
|
|
26
|
+
*/
|
|
27
|
+
import type { ConfigResponse, OffersSearchResponse } from './api/contract';
|
|
28
|
+
export { renderTriggerPreview, type TriggerPreviewClaim, type TriggerPreviewHandle, type TriggerPreviewInput, type TriggerPreviewOffer, type TriggerPreviewResult, type TriggerPreviewState, } from './triggers/preview';
|
|
29
|
+
/** What one preview renders. */
|
|
30
|
+
export interface PreviewInput {
|
|
31
|
+
/** BCP 47 locale the payload was resolved in: drives `lang`/`dir`, Intl and plurals. */
|
|
32
|
+
locale: string;
|
|
33
|
+
/**
|
|
34
|
+
* The `/publisher/sdk/v1/config` response's `ui`: `useCase` (wire value, e.g.
|
|
35
|
+
* `'churn-intervention'`, `'post-action-reward'`), `variantName` (picks the reward
|
|
36
|
+
* surface), `template`, and `values` with `text`, `strings` and `plurals`.
|
|
37
|
+
*/
|
|
38
|
+
ui: NonNullable<ConfigResponse['ui']>;
|
|
39
|
+
/** The `/offers/search` response's `offers` (campaigns with creatives). */
|
|
40
|
+
offers: OffersSearchResponse['offers'];
|
|
41
|
+
}
|
|
42
|
+
/** A mounted preview. */
|
|
43
|
+
export interface PreviewHandle {
|
|
44
|
+
/** Re-render with new input in the same container. */
|
|
45
|
+
update(input: PreviewInput): void;
|
|
46
|
+
/** Remove everything the preview added. Safe to call more than once. */
|
|
47
|
+
destroy(): void;
|
|
48
|
+
}
|
|
49
|
+
/** Mount a preview of the sheet `input` describes in `container`. */
|
|
50
|
+
export declare function renderPreview(container: HTMLElement | ShadowRoot, input: PreviewInput): PreviewHandle;
|
|
51
|
+
//# sourceMappingURL=preview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../src/preview.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAQH,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3E,OAAO,EACL,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,oBAAoB,CAAC;AAE5B,gCAAgC;AAChC,MAAM,WAAW,YAAY;IAC3B,wFAAwF;IACxF,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,EAAE,EAAE,WAAW,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,2EAA2E;IAC3E,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC;CACxC;AAED,yBAAyB;AACzB,MAAM,WAAW,aAAa;IAC5B,sDAAsD;IACtD,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,wEAAwE;IACxE,OAAO,IAAI,IAAI,CAAC;CACjB;AAKD,qEAAqE;AACrE,wBAAgB,aAAa,CAC3B,SAAS,EAAE,WAAW,GAAG,UAAU,EACnC,KAAK,EAAE,YAAY,GAClB,aAAa,CAqEf"}
|
package/types/react.d.ts
CHANGED
|
@@ -1,10 +1,62 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import type { EncoreConfig } from '@encorekit/web-sdk';
|
|
2
|
+
import type { ClaimTarget, EncoreClaimOptions, EncoreClaimState, ClaimReminderOptions, TriggerMountOptions, EncoreConfig, GiftsButtonOptions, ShowResult } from '@encorekit/web-sdk';
|
|
3
3
|
type EncoreProviderProps = {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
} & EncoreConfig;
|
|
6
6
|
export declare function EncoreProvider({ children, ...config }: EncoreProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export declare function useEncore(): import("./core/Encore").EncoreSDK;
|
|
8
|
+
export type EncoreTriggerProps = TriggerMountOptions & {
|
|
9
|
+
/** The trigger id, such as `'claimReminder'`. */
|
|
10
|
+
id: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* An Encore trigger. Render it inside your `EncoreProvider`, where it should sit.
|
|
14
|
+
* It takes no space until it has something to show, and renders nothing for an id
|
|
15
|
+
* this SDK version does not ship.
|
|
16
|
+
*
|
|
17
|
+
* Remounts when `id`, `placement`, `useCase`, `autoOpen`, `icon`, an `appearance` field a trigger reads, the prize, an `options` entry or a `values` entry
|
|
18
|
+
* changes; a new `appearance`, `options` or
|
|
19
|
+
* `publisherReward` object with the same values does not. A new `alignment` only moves it, and new
|
|
20
|
+
* `headline`, `subheadline` or `cta` only redraws it, with no request.
|
|
21
|
+
*/
|
|
22
|
+
export declare function EncoreTrigger({ id, ...rest }: EncoreTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export type ClaimReminderProps = ClaimReminderOptions;
|
|
24
|
+
/**
|
|
25
|
+
* The claim reminder card: `<EncoreTrigger id="claimReminder" ... />`. It takes no
|
|
26
|
+
* space until there is a claim to remind about, and a tap opens the Encore sheet for
|
|
27
|
+
* `useCase` (default `'rewardUsers'`) at `placement`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function ClaimReminder(props: ClaimReminderProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export type GiftsButtonProps = GiftsButtonOptions;
|
|
31
|
+
/**
|
|
32
|
+
* The gifts button: `<EncoreTrigger id="giftsButton" ... />`. A tap opens the Encore
|
|
33
|
+
* sheet for `useCase` (default `'rewardUsers'`) at `placement`. It takes no space while
|
|
34
|
+
* that sheet has no offers.
|
|
35
|
+
*/
|
|
36
|
+
export declare function GiftsButton(props: GiftsButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
8
37
|
export { Encore } from '@encorekit/web-sdk';
|
|
9
38
|
export type * from '@encorekit/web-sdk';
|
|
39
|
+
/** What `useEncoreClaim` gives you. */
|
|
40
|
+
export interface UseEncoreClaim {
|
|
41
|
+
/** What to draw now. */
|
|
42
|
+
state: EncoreClaimState;
|
|
43
|
+
/** Put on your view's element: Encore counts its impression and opens the sheet on a click. */
|
|
44
|
+
ref: (element: HTMLElement | null) => void;
|
|
45
|
+
/** Open the sheet yourself (a view with its own buttons). */
|
|
46
|
+
tap: (target?: ClaimTarget) => Promise<ShowResult>;
|
|
47
|
+
/** Hide the reminder. */
|
|
48
|
+
dismiss: () => void;
|
|
49
|
+
/** Report how much of your view is visible (0 to 1), when you do not use `ref`. */
|
|
50
|
+
setVisible: (fraction: number) => void;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Your own gifts button or claim reminder, as `Encore.claim()` in React. Draw from
|
|
54
|
+
* `state`, and put `ref` on the element that should count as seen and open the sheet.
|
|
55
|
+
* Starts over when `placement`, `useCase`, `autoOpen` or the prize changes; the newest
|
|
56
|
+
* `onResult` is called without starting over.
|
|
57
|
+
*/
|
|
58
|
+
export declare function useEncoreClaim(options: EncoreClaimOptions & {
|
|
59
|
+
target?: ClaimTarget;
|
|
60
|
+
tap?: boolean;
|
|
61
|
+
}): UseEncoreClaim;
|
|
10
62
|
//# sourceMappingURL=react.d.ts.map
|
package/types/react.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgF,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAErH,OAAO,KAAK,EAEV,WAAW,EAEX,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EAGpB,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACX,MAAM,oBAAoB,CAAC;AAE5B,KAAK,mBAAmB,GAAG;IACzB,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,YAAY,CAAC;AAIjB,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,EAAE,mBAAmB,2CAa1E;AAED,wBAAgB,SAAS,sCAExB;AAED,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,GAAG;IACrD,iDAAiD;IACjD,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA4KF;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,EAAE,kBAAkB,2CAShE;AAED,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEtD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CAGtD;AAED,MAAM,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAElD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAElD;AAGD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,mBAAmB,oBAAoB,CAAC;AAIxC,uCAAuC;AACvC,MAAM,WAAW,cAAc;IAC7B,wBAAwB;IACxB,KAAK,EAAE,gBAAgB,CAAC;IACxB,+FAA+F;IAC/F,GAAG,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3C,6DAA6D;IAC7D,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACnD,yBAAyB;IACzB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,mFAAmF;IACnF,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,kBAAkB,GAAG;IAAE,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,GACpE,cAAc,CAmGhB"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dispatching the 11 actions, and the no-op an unknown one becomes.
|
|
3
|
+
*
|
|
4
|
+
* The engine resolves WHAT to do and the host does it. Everything here is a
|
|
5
|
+
* lookup against the evaluation context; nothing touches the network, the
|
|
6
|
+
* claim path or the sheet, because those belong to `Encore.ts` and differ
|
|
7
|
+
* between the surfaces this engine renders on.
|
|
8
|
+
*
|
|
9
|
+
* 🔴 ONE RULE WORTH STATING. `openUrl` names an OFFER ATTRIBUTE to read its link
|
|
10
|
+
* from. When that attribute is absent the action does NOTHING: it must never
|
|
11
|
+
* fall back to a literal URL, because a terms link pointing at the wrong
|
|
12
|
+
* advertiser is worse than no link. Swift's `openOfferLink` is a bare `guard let
|
|
13
|
+
* attribute = action.urlAttribute else { return }`.
|
|
14
|
+
*
|
|
15
|
+
* `share` is NOT that shape, and treating it as one gave both served share
|
|
16
|
+
* variants a dead button. Neither native reads `urlAttribute` for it: Swift
|
|
17
|
+
* delegates to `handleShare(offer, onSuccessState:)`, which resolves the link
|
|
18
|
+
* from the offer itself and fires a terminal event even when there is none, and
|
|
19
|
+
* Android calls `handler.share(offer, onSuccessState)`. `shareFromHeader` and
|
|
20
|
+
* `shareForLater` author `{"type": "share"}` with no attribute at all.
|
|
21
|
+
*/
|
|
22
|
+
import type { SduiAction } from "./model";
|
|
23
|
+
import type { SduiEvaluationContext } from "./context";
|
|
24
|
+
/** Implemented by the host. Every method is optional so a surface may ignore one. */
|
|
25
|
+
export interface ActionHost {
|
|
26
|
+
close?(): void;
|
|
27
|
+
/**
|
|
28
|
+
* `onSuccessState` is the state the sheet moves to once the claim lands.
|
|
29
|
+
* Swift holds it as `pendingClaimSuccessState` and transitions on return, so
|
|
30
|
+
* a host that drops it can never show the post-claim screen. `streaksCarousel`
|
|
31
|
+
* is at rollout weight 100 and gates its whole success branch on this.
|
|
32
|
+
*/
|
|
33
|
+
claimOffer?(offerId: string | undefined, onSuccessState: string | undefined): void;
|
|
34
|
+
openUrl?(url: string): void;
|
|
35
|
+
setState?(state: string): void;
|
|
36
|
+
setValue?(key: string, value: string): void;
|
|
37
|
+
selectOffer?(offerId: string, targetKey: string): void;
|
|
38
|
+
/**
|
|
39
|
+
* Move an offer to `index` BEFORE the selection is written.
|
|
40
|
+
*
|
|
41
|
+
* Swift promotes first so `selectOffer` resolves `currentIndex` against the
|
|
42
|
+
* list the user will see rather than the one it is replacing.
|
|
43
|
+
*/
|
|
44
|
+
promoteOffer?(offerId: string, index: number): void;
|
|
45
|
+
setOfferIndex?(index: number, targetKey: string): void;
|
|
46
|
+
/** `onCancelAction` is the state to move to when the purchase is cancelled. */
|
|
47
|
+
triggerIAP?(onSuccessState: string | undefined, onCancelAction: string | undefined): void;
|
|
48
|
+
submitLead?(values: Readonly<Record<string, string>>, onSuccessState: string | undefined): void;
|
|
49
|
+
/**
|
|
50
|
+
* The HOST resolves the link, from the offer. The engine cannot: the SDK's
|
|
51
|
+
* offer carries no `shareUrl`, and the natives do not read one off the action.
|
|
52
|
+
*/
|
|
53
|
+
share?(offerId: string | undefined, onSuccessState: string | undefined): void;
|
|
54
|
+
/**
|
|
55
|
+
* Trigger mounts only: open the sheet for this trigger, reporting `target`
|
|
56
|
+
* (`card`, `arrow` or `button`) on `sdk_trigger_clicked`. A sheet host leaves
|
|
57
|
+
* it unset, so the action stays the no-op it always was there.
|
|
58
|
+
*/
|
|
59
|
+
trigger?(target: string): void;
|
|
60
|
+
/** Trigger mounts only: the host's dismiss (store plus `sdk_trigger_dismissed`). */
|
|
61
|
+
dismissTrigger?(): void;
|
|
62
|
+
/** The user says they finished the claimed offer. Only a TAP means this. */
|
|
63
|
+
reportCompletion?(offerId: string | undefined, onSuccessState: string | undefined): void;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Only http and https may be navigated to.
|
|
67
|
+
*
|
|
68
|
+
* This is the engine's job, not the host's: the engine is the layer that knows
|
|
69
|
+
* the string came from a served template. Images already go through
|
|
70
|
+
* `safeImageSrc` and colours through `sanitizeColor`; an action URL had no
|
|
71
|
+
* guard at all, so `javascript:alert(1)` reached the host verbatim.
|
|
72
|
+
*/
|
|
73
|
+
export declare function safeActionUrl(raw: string | undefined): string | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Resolve the link an `openUrl` or `share` should use.
|
|
76
|
+
*
|
|
77
|
+
* `urlAttribute` reads the scoped offer and returns undefined when the offer
|
|
78
|
+
* carries nothing. A literal `url` is used ONLY when no attribute was named.
|
|
79
|
+
*/
|
|
80
|
+
export declare function resolveActionUrl(action: SduiAction, ctx: SduiEvaluationContext): string | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* The index a `setOfferIndex` moves to, or undefined for a no-op.
|
|
83
|
+
*
|
|
84
|
+
* `offerIndex` is absolute and out of range is a no-op. `offerIndexDelta` is
|
|
85
|
+
* relative to the focused card and clamped into the list.
|
|
86
|
+
*/
|
|
87
|
+
export declare function resolveOfferIndex(action: SduiAction, ctx: SduiEvaluationContext): number | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Runs an action. Returns whether the host actually handled it. An error in the
|
|
90
|
+
* action or the host is logged here, never thrown into the host page's click.
|
|
91
|
+
*/
|
|
92
|
+
export declare function dispatch(action: SduiAction, ctx: SduiEvaluationContext, host: ActionHost): boolean;
|
|
93
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/sdui/actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAMvD,qFAAqF;AACrF,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,IAAI,IAAI,CAAC;IACf;;;;;OAKG;IACH,UAAU,CAAC,CACT,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC,IAAI,CAAC;IACR,OAAO,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,WAAW,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACvD;;;;;OAKG;IACH,YAAY,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACpD,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACvD,+EAA+E;IAC/E,UAAU,CAAC,CACT,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC,IAAI,CAAC;IACR,UAAU,CAAC,CACT,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACxC,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC,IAAI,CAAC;IACR;;;OAGG;IACH,KAAK,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,cAAc,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC9E;;;;OAIG;IACH,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,oFAAoF;IACpF,cAAc,CAAC,IAAI,IAAI,CAAC;IACxB,4EAA4E;IAC5E,gBAAgB,CAAC,CACf,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC,IAAI,CAAC;CACT;AAWD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAazE;AAOD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,qBAAqB,GACzB,MAAM,GAAG,SAAS,CAapB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,qBAAqB,GACzB,MAAM,GAAG,SAAS,CAcpB;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,qBAAqB,EAC1B,IAAI,EAAE,UAAU,GACf,OAAO,CAOT"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text and image binding resolution, and `${variable}` substitution.
|
|
3
|
+
*
|
|
4
|
+
* The fallbacks here are not decoration. A binding that resolves to nothing
|
|
5
|
+
* returns `""` for offer copy (the element simply renders empty) but a real
|
|
6
|
+
* string for the three context bindings, because a sheet with no title reads as
|
|
7
|
+
* a broken integration rather than as an offer without a perk.
|
|
8
|
+
*/
|
|
9
|
+
import type { SduiCreativeBinding, SduiTextBinding } from "./vocabulary";
|
|
10
|
+
import type { SduiInstructionStep, SduiOfferBindingData, SduiTextDefaults } from "./context";
|
|
11
|
+
export declare const FALLBACK_CTA_TEXT = "Get";
|
|
12
|
+
export declare const FALLBACK_CLAIM_TEXT = "Claim";
|
|
13
|
+
export declare const FALLBACK_TITLE_TEXT = "Get 1 month";
|
|
14
|
+
/** Leading space is deliberate: this is concatenated onto the title. */
|
|
15
|
+
export declare const FALLBACK_ACCENT_TITLE_TEXT = " for free";
|
|
16
|
+
export declare const FALLBACK_SUBTITLE_TEXT = "Claim an exclusive offer and get free access to all features";
|
|
17
|
+
/**
|
|
18
|
+
* `${variable}` substitution, in two passes.
|
|
19
|
+
*
|
|
20
|
+
* 1. `variables`, the immutable session context (remote config, entitlements,
|
|
21
|
+
* IAP product data).
|
|
22
|
+
* 2. `values`, the mutable state dictionary, so a variant can write
|
|
23
|
+
* `${selectedAdvertiserName}` in bottom copy and have it follow the tap.
|
|
24
|
+
*
|
|
25
|
+
* The second pass is skipped unless a token survives the first, which is the
|
|
26
|
+
* common case. The guard avoids scanning every value for every string.
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveTemplate(text: string, variables: Readonly<Record<string, string>>, values?: Readonly<Record<string, string>>): string;
|
|
29
|
+
/**
|
|
30
|
+
* Resolve a text binding.
|
|
31
|
+
*
|
|
32
|
+
* The offer-scoped bindings read `offer`; inside a `forEach` the caller passes
|
|
33
|
+
* the ROW offer, elsewhere the current one. The context bindings ignore it.
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveTextBinding(binding: SduiTextBinding, offer: SduiOfferBindingData | undefined, defaults: SduiTextDefaults, category?: string, step?: SduiInstructionStep): string;
|
|
36
|
+
export declare function resolveCreativeUrl(binding: SduiCreativeBinding, offer: SduiOfferBindingData | undefined, step?: SduiInstructionStep): string | undefined;
|
|
37
|
+
/** Inputs to {@link resolveText}, gathered so the signature stays readable. */
|
|
38
|
+
export interface TextResolutionInput {
|
|
39
|
+
readonly valueKey?: string;
|
|
40
|
+
readonly textMapKey?: string;
|
|
41
|
+
readonly textMapValueKey?: string;
|
|
42
|
+
readonly textBinding?: SduiTextBinding;
|
|
43
|
+
readonly text?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Full text resolution for a `text` node. First match wins:
|
|
47
|
+
*
|
|
48
|
+
* 1. `valueKey` into `values`, then template-resolved.
|
|
49
|
+
* 2. `textMapKey` into `textMaps[map][values[textMapValueKey ?? map]]`, then
|
|
50
|
+
* template-resolved. A MISS falls through rather than rendering empty.
|
|
51
|
+
* 3. `textBinding`.
|
|
52
|
+
* 4. template-resolved static `text`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function resolveText(config: TextResolutionInput, args: {
|
|
55
|
+
readonly values: Readonly<Record<string, string>>;
|
|
56
|
+
readonly textMaps: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
57
|
+
readonly variables: Readonly<Record<string, string>>;
|
|
58
|
+
readonly offer?: SduiOfferBindingData;
|
|
59
|
+
readonly defaults: SduiTextDefaults;
|
|
60
|
+
readonly category?: string;
|
|
61
|
+
readonly step?: SduiInstructionStep;
|
|
62
|
+
}): string;
|
|
63
|
+
//# sourceMappingURL=bindings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bindings.d.ts","sourceRoot":"","sources":["../../src/sdui/bindings.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,WAAW,CAAC;AAEnB,eAAO,MAAM,iBAAiB,QAAQ,CAAC;AACvC,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAC3C,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AACjD,wEAAwE;AACxE,eAAO,MAAM,0BAA0B,cAAc,CAAC;AACtD,eAAO,MAAM,sBAAsB,iEAC6B,CAAC;AAIjE;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC3C,MAAM,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM,GAC5C,MAAM,CAYR;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,oBAAoB,GAAG,SAAS,EACvC,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,CAAC,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,mBAAmB,GACzB,MAAM,CAqCR;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,mBAAmB,EAC5B,KAAK,EAAE,oBAAoB,GAAG,SAAS,EACvC,IAAI,CAAC,EAAE,mBAAmB,GACzB,MAAM,GAAG,SAAS,CAYpB;AAED,+EAA+E;AAC/E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,WAAW,CAAC,EAAE,eAAe,CAAC;IACvC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,mBAAmB,EAC3B,IAAI,EAAE;IACJ,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAClD,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CACzB,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CACjD,CAAC;IACF,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,KAAK,CAAC,EAAE,oBAAoB,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,mBAAmB,CAAC;CACrC,GACA,MAAM,CA2BR"}
|