@encorekit/web-sdk 2.2.1 → 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 +108 -8
- 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 +70 -33
- 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 +994 -17
- package/types/api/generated/types.d.ts.map +1 -1
- package/types/api/models.d.ts +29 -8
- package/types/api/models.d.ts.map +1 -1
- package/types/api/offerBuilder.d.ts +51 -0
- package/types/api/offerBuilder.d.ts.map +1 -0
- package/types/core/Configuration.d.ts +9 -0
- package/types/core/Configuration.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 +27 -5
- 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/claimScreenVariant.d.ts +3 -0
- package/types/core/claimScreenVariant.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 +12 -2
- 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 +420 -4
- package/types/types.d.ts.map +1 -1
- package/types/ui/ClaimScreen.d.ts +62 -0
- package/types/ui/ClaimScreen.d.ts.map +1 -0
- package/types/ui/CodeUnlock.d.ts +26 -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 -6
- 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,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The on-device claim log: the claims this browser saw a user make in any Encore
|
|
3
|
+
* sheet, so a GiftsButton spot can turn into the claim reminder right after a claim and
|
|
4
|
+
* after a reload. INTERNAL. Never sent to the server; once the claims API is bound its
|
|
5
|
+
* list wins for the same transaction (see `mergeReminderClaims`).
|
|
6
|
+
*
|
|
7
|
+
* Kept per user id, at most 50 rows each, for 720 hours. localStorage when it works,
|
|
8
|
+
* and always a copy in memory, so a page whose storage throws still remembers its own
|
|
9
|
+
* claims. `reset()` clears it; an anonymous user's rows move to the id they identify as.
|
|
10
|
+
*/
|
|
11
|
+
import type { ReminderClaim } from '../triggers/claimReminder/source';
|
|
12
|
+
/** One claim as the log keeps it. */
|
|
13
|
+
export interface ClaimLogRow {
|
|
14
|
+
/** The transaction id, or `campaign:<campaignId>` when the claim had none. */
|
|
15
|
+
id: string;
|
|
16
|
+
transactionId?: string;
|
|
17
|
+
campaignId: string;
|
|
18
|
+
advertiserName: string;
|
|
19
|
+
logoUrl?: string;
|
|
20
|
+
/** The offer's perk as the sheet showed it ("3 months free"), in the language of that sheet. */
|
|
21
|
+
perk?: string;
|
|
22
|
+
/** Epoch ms. */
|
|
23
|
+
claimedAt: number;
|
|
24
|
+
useCase: string;
|
|
25
|
+
placement?: string;
|
|
26
|
+
/** Ended (completed, expired or failed): no longer a claim to remind about. */
|
|
27
|
+
finished?: true;
|
|
28
|
+
/** Epoch ms the claim was completed (verified or granted). Absent when open, or when it only ended. */
|
|
29
|
+
completedAt?: number;
|
|
30
|
+
/** Epoch ms the thanks look (or `Encore.claim`'s thanks state) for this completion was tapped. */
|
|
31
|
+
thanksTappedAt?: number;
|
|
32
|
+
}
|
|
33
|
+
/** Where the log persists. StorageManager's `get` and `set`; either may fail silently. */
|
|
34
|
+
export interface ClaimLogStore {
|
|
35
|
+
get<T>(key: string): T | null;
|
|
36
|
+
set<T>(key: string, value: T): void;
|
|
37
|
+
remove(key: string): void;
|
|
38
|
+
}
|
|
39
|
+
export declare const CLAIM_LOG_KEY = "claim_log";
|
|
40
|
+
export declare const CLAIM_LOG_MAX_ROWS = 50;
|
|
41
|
+
export declare const CLAIM_LOG_RETENTION_MS: number;
|
|
42
|
+
/** A local row the server's fresh list leaves out is dropped once it is this old. */
|
|
43
|
+
export declare const SERVER_LAG_MS: number;
|
|
44
|
+
export declare class ClaimLog {
|
|
45
|
+
#private;
|
|
46
|
+
constructor(store: ClaimLogStore, now?: () => number);
|
|
47
|
+
/** Note a claim. A claim with no advertiser name is kept but never reminded about. */
|
|
48
|
+
record(userId: string, claim: Omit<ClaimLogRow, 'id' | 'claimedAt'> & {
|
|
49
|
+
claimedAt?: number;
|
|
50
|
+
}): void;
|
|
51
|
+
/**
|
|
52
|
+
* Mark a claim ended: the reminder no longer shows it. `completed` (verified, granted)
|
|
53
|
+
* also stamps when, for what a spot shows after a completion; expired and failed end it
|
|
54
|
+
* without one.
|
|
55
|
+
* Returns whether anything changed.
|
|
56
|
+
*/
|
|
57
|
+
finish(transactionId: string, completed?: boolean): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* This user completed a claim on `now`'s local day and has made none since
|
|
60
|
+
* (an `Encore.claim` view whose rules say `afterComplete: hide`).
|
|
61
|
+
*/
|
|
62
|
+
completedToday(userId: string, now: number): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* As `completedToday`, and the thanks look for that completion has not been tapped
|
|
65
|
+
* yet: a trigger's `completed` state, and an `Encore.claim` view whose rules say `afterComplete: thanks`.
|
|
66
|
+
*/
|
|
67
|
+
thanksDue(userId: string, now: number): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* The completion `thanksDue` is for, so each completion counts its own view and marks
|
|
70
|
+
* its own hide: its claim's transaction id, else its completion time in epoch ms. Else null.
|
|
71
|
+
*/
|
|
72
|
+
thanksFor(userId: string, now: number): string | null;
|
|
73
|
+
/** The thanks look was tapped: it ends for this user's latest completion. */
|
|
74
|
+
thanksTapped(userId: string): void;
|
|
75
|
+
/** This user's open claims (not finished), newest first. */
|
|
76
|
+
open(userId: string): ClaimLogRow[];
|
|
77
|
+
/** Whether this user's claim for `transactionId` is in the log and ended. */
|
|
78
|
+
finished(userId: string, transactionId: string): boolean;
|
|
79
|
+
/** An anonymous user identified: their rows become the identified user's. */
|
|
80
|
+
carryOver(fromUserId: string, toUserId: string): void;
|
|
81
|
+
/**
|
|
82
|
+
* Forget every row (reset). Another tab's in-memory copy can write its rows back on
|
|
83
|
+
* its next write; accepted, since that tab is the same browser and its next reset or
|
|
84
|
+
* reload clears it.
|
|
85
|
+
*/
|
|
86
|
+
clear(): void;
|
|
87
|
+
/**
|
|
88
|
+
* TEST AND DEMO ONLY: move every row of this user `ms` into the past, so a reminder
|
|
89
|
+
* window can be ended without waiting.
|
|
90
|
+
*/
|
|
91
|
+
age(userId: string, ms: number): void;
|
|
92
|
+
}
|
|
93
|
+
/** A log row as the reminder reads a claim. */
|
|
94
|
+
export declare function reminderClaimOf(row: ClaimLogRow): ReminderClaim;
|
|
95
|
+
/**
|
|
96
|
+
* The reminder's claims: the claims API's list when one is bound, plus local rows it
|
|
97
|
+
* does not have yet. The server wins for the same transaction; a local row the server
|
|
98
|
+
* does not list is kept only while it is younger than `SERVER_LAG_MS` (the server may
|
|
99
|
+
* not have it yet), then dropped. A row without a transaction id matches by campaign.
|
|
100
|
+
*/
|
|
101
|
+
export declare function mergeReminderClaims(local: readonly ClaimLogRow[], server: readonly ReminderClaim[] | null, now: number): ReminderClaim[];
|
|
102
|
+
//# sourceMappingURL=claimLog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claimLog.d.ts","sourceRoot":"","sources":["../../src/core/claimLog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEtE,qCAAqC;AACrC,MAAM,WAAW,WAAW;IAC1B,8EAA8E;IAC9E,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM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,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IAI/C;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAUrD,6EAA6E;IAC7E,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IA4BlC,4DAA4D;IAC5D,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,EAAE;IAQnC,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO;IAQxD,6EAA6E;IAC7E,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAcrD;;;;OAIG;IACH,KAAK,IAAI,IAAI;IASb;;;OAGG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI;CAWtC;AAED,+CAA+C;AAC/C,wBAAgB,eAAe,CAAC,GAAG,EAAE,WAAW,GAAG,aAAa,CAU/D;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,MAAM,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI,EACvC,GAAG,EAAE,MAAM,GACV,aAAa,EAAE,CASjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claimRefusal.d.ts","sourceRoot":"","sources":["../../src/core/claimRefusal.ts"],"names":[],"mappings":"AAeA,iFAAiF;AACjF,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAIjE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claimScreenVariant.d.ts","sourceRoot":"","sources":["../../src/core/claimScreenVariant.ts"],"names":[],"mappings":"AAYA,iEAAiE;AACjE,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAEhF"}
|
|
@@ -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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ers 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,
|
|
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;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C,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,9 +17,19 @@ 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
|
+
/**
|
|
31
|
+
* Does `code` unlock the offers? Placeholder: yes, for any non-empty code. A real check must
|
|
32
|
+
* always settle: with `dismissible: false` the code screen has no other way out.
|
|
33
|
+
*/
|
|
24
34
|
export declare function checkUnlockCode(code: string): Promise<UnlockCodeVerdict>;
|
|
25
35
|
//# sourceMappingURL=unlockCode.d.ts.map
|
|
@@ -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,MA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