@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,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GiftsButton, trigger plug-in #2: a button the app shows at a reward moment instead
|
|
3
|
+
* of popping the Encore sheet itself. A tap opens the sheet for the mount's use case and
|
|
4
|
+
* placement.
|
|
5
|
+
*
|
|
6
|
+
* Opening by itself is the served look's (`behavior.autoOpen: on`, an experiment arm
|
|
7
|
+
* only), on a mount that may (`mayOpenByItself`: it neither said `autoOpen: 'off'` nor
|
|
8
|
+
* pinned a layout). Such a look draws nothing until it pops the sheet, once per mount and
|
|
9
|
+
* at most once per placement per local day across mounts, then draws itself, its events
|
|
10
|
+
* keeping its own layout and ids. Every look is its served SDUI tree (host/sduiView.ts).
|
|
11
|
+
* Everything every trigger shares is the host's.
|
|
12
|
+
*/
|
|
13
|
+
import type { UseCase } from '../../types';
|
|
14
|
+
import type { SduiHostListItem } from '../../sdui/context';
|
|
15
|
+
import type { TriggerMountState, SheetCheck, TriggerPlugin } from '../host/types';
|
|
16
|
+
import { type TriggerRequest } from '../request';
|
|
17
|
+
import { type TriggerSduiModel } from '../host/sduiView';
|
|
18
|
+
import { type GiftsButtonConfig } from './config';
|
|
19
|
+
export declare const GIFTS_BUTTON_ID: "giftsButton";
|
|
20
|
+
export { AUTO_POP_STORAGE_KEY, forgetAutoPops } from '../host/autoPops';
|
|
21
|
+
/**
|
|
22
|
+
* A spot drew another look (the reminder, a thanks look) on a mount that may open the
|
|
23
|
+
* sheet by itself: it never pops after that, so its one decision is spent as given up and
|
|
24
|
+
* it draws its own look when it is the gifts button again.
|
|
25
|
+
*/
|
|
26
|
+
export declare function giveUpAutoOpen(mountState: TriggerMountState, request: TriggerRequest): void;
|
|
27
|
+
export interface GiftsButtonDeps {
|
|
28
|
+
/**
|
|
29
|
+
* Whether the sheet for `useCase` at `placement` would open with offers, by the SDK's
|
|
30
|
+
* own path: the sheet's config (`sheet_unavailable` when it has nothing to serve),
|
|
31
|
+
* then an offer search sent with the sheet's variant and `purpose: 'prefetch'`, held
|
|
32
|
+
* for the tap. `fresh` skips the held search (after a claim). `none` for no offers or
|
|
33
|
+
* any failure.
|
|
34
|
+
*/
|
|
35
|
+
checkSheet(useCase: UseCase, placement: string | undefined, fresh: boolean): Promise<SheetCheck>;
|
|
36
|
+
storage(): Storage | null;
|
|
37
|
+
/** The thanks look was tapped: it ends for the user's latest completion. */
|
|
38
|
+
thanksTapped?(): void;
|
|
39
|
+
}
|
|
40
|
+
interface GiftsButtonContent {
|
|
41
|
+
useCase: UseCase;
|
|
42
|
+
/** The held offers' logos, for `offerLogos`. */
|
|
43
|
+
offerLogos: readonly SduiHostListItem[];
|
|
44
|
+
/**
|
|
45
|
+
* A completion today, not yet thanked (the request's `completed` state): its claim's id.
|
|
46
|
+
* The thanks look, when Encore serves it for this state, is keyed by it, so each
|
|
47
|
+
* completion counts its own view.
|
|
48
|
+
*/
|
|
49
|
+
thanks?: string;
|
|
50
|
+
}
|
|
51
|
+
/** One render: a served look and what it binds, or nothing (`template` null). */
|
|
52
|
+
export interface GiftsButtonModel extends Omit<TriggerSduiModel, 'template'> {
|
|
53
|
+
useCase: UseCase;
|
|
54
|
+
placement: string | undefined;
|
|
55
|
+
template: Record<string, unknown> | null;
|
|
56
|
+
/** The thanks look is drawn: a tap on it ends the thanks state. */
|
|
57
|
+
thanks?: true;
|
|
58
|
+
}
|
|
59
|
+
export declare function giftsButtonPlugin(deps: GiftsButtonDeps): TriggerPlugin<GiftsButtonContent, GiftsButtonConfig, GiftsButtonModel>;
|
|
60
|
+
//# sourceMappingURL=GiftsButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GiftsButton.d.ts","sourceRoot":"","sources":["../../../src/triggers/giftsButton/GiftsButton.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,aAAa,EAGd,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAuC,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAEt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+
* Reading GiftsButton's served template. The host has already checked the envelope
|
|
3
|
+
* (`template.trigger == 'giftsButton'`), run the strict pre-check, and owns the variant
|
|
4
|
+
* ids and the served locale.
|
|
5
|
+
*
|
|
6
|
+
* { trigger: 'giftsButton', version, layout, colors, strings: { title, subtitle, cta }, root }
|
|
7
|
+
*
|
|
8
|
+
* `root` is drawn by the SDUI engine; `layout` is a label (events, `${layout}`). Whether
|
|
9
|
+
* the look opens the sheet by itself is its `behavior.autoOpen` (§2.8), never its layout.
|
|
10
|
+
*/
|
|
11
|
+
import type { TriggerColors } from '../host/theme';
|
|
12
|
+
export interface GiftsButtonStrings {
|
|
13
|
+
title?: string;
|
|
14
|
+
subtitle?: string;
|
|
15
|
+
cta?: string;
|
|
16
|
+
offersTitle?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface GiftsButtonConfig {
|
|
19
|
+
/** The served template, drawn by the SDUI engine. */
|
|
20
|
+
template: Record<string, unknown>;
|
|
21
|
+
/** The served layout name: a label, never a code path. */
|
|
22
|
+
layout: string;
|
|
23
|
+
/** The look's dark colours (`colors`). */
|
|
24
|
+
colors: TriggerColors;
|
|
25
|
+
/** The look's light colours (`lightColors`), used in the light scheme. */
|
|
26
|
+
lightColors: TriggerColors;
|
|
27
|
+
/** Only the served, non-blank strings; the look's own English fills the rest. */
|
|
28
|
+
strings: GiftsButtonStrings;
|
|
29
|
+
/**
|
|
30
|
+
* The look's `behavior.autoOpen` is `on`: it opens the sheet once by itself, then draws
|
|
31
|
+
* itself. Applied only on a mount that may (`mayOpenByItself`), within the device's bounds.
|
|
32
|
+
*/
|
|
33
|
+
autoOpen: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare function decodeGiftsButtonTemplate(template: Record<string, unknown>): GiftsButtonConfig;
|
|
36
|
+
/** The copy one look binds. */
|
|
37
|
+
export interface GiftsButtonCopy {
|
|
38
|
+
title: string;
|
|
39
|
+
subtitle: string;
|
|
40
|
+
cta: string;
|
|
41
|
+
/** The title over the held offers' logos (offerMarquee). */
|
|
42
|
+
offersTitle: string;
|
|
43
|
+
}
|
|
44
|
+
/** The built-in English for `offersTitle`, on every look. */
|
|
45
|
+
export declare const DEFAULT_OFFERS_TITLE = "Pick a gift, on us";
|
|
46
|
+
/**
|
|
47
|
+
* Built-in English per look, used per key when the variant has none. Never names a
|
|
48
|
+
* reward, an amount, "free" or an expiry; no dash punctuation. A look this table does
|
|
49
|
+
* not name takes the card's.
|
|
50
|
+
*/
|
|
51
|
+
export declare const GIFTS_BUTTON_COPY: Readonly<Record<string, Omit<GiftsButtonCopy, 'offersTitle'>>>;
|
|
52
|
+
export declare function giftsButtonCopy(layout: string, strings: GiftsButtonStrings): GiftsButtonCopy;
|
|
53
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/triggers/giftsButton/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAInD,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,MAAM,EAAE,aAAa,CAAC;IACtB,0EAA0E;IAC1E,WAAW,EAAE,aAAa,CAAC;IAC3B,iFAAiF;IACjF,OAAO,EAAE,kBAAkB,CAAC;IAC5B;;;OAGG;IACH,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,iBAAiB,CAe9F;AAED,+BAA+B;AAC/B,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,6DAA6D;AAC7D,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AAEzD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC,CAM3F,CAAC;AAEH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,eAAe,CAU5F"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A GiftsButton spot: one mount, one `/config` request, and whatever look Encore answers
|
|
3
|
+
* it with (§2.8). The spot tells Encore what happened on the device (`state`): a claim
|
|
4
|
+
* the reminder could show (`claimOpen`) or an offer finished today and not yet thanked
|
|
5
|
+
* (`completed`). The served look's behavior decides the step, so the answer may be the
|
|
6
|
+
* gifts button, its thanks look, nothing, or the claim reminder's look
|
|
7
|
+
* (`ui.template.trigger` claimReminder). This plug-in draws whichever arrives with the
|
|
8
|
+
* GiftsButton or ClaimReminder plug-in, so the two are one spot with one request.
|
|
9
|
+
*/
|
|
10
|
+
import type { ReminderConfig } from '../claimReminder/config';
|
|
11
|
+
import type { ReminderContent, ReminderModel } from '../claimReminder/ClaimReminder';
|
|
12
|
+
import type { TriggerPlugin } from '../host/types';
|
|
13
|
+
type Plugin<C, F, M> = TriggerPlugin<C, F, M>;
|
|
14
|
+
export interface GiftsSpotDeps {
|
|
15
|
+
/**
|
|
16
|
+
* Ask the server whether the claims the reminder would draw ended (bounded, cached),
|
|
17
|
+
* before the spot says what happened. `dismissed`: the reminder's dismissed claims,
|
|
18
|
+
* never asked about. Absent: the claim log alone decides.
|
|
19
|
+
*/
|
|
20
|
+
checkClaims?(dismissed: (transactionId: string) => boolean): Promise<void>;
|
|
21
|
+
/** An offer finished today, none claimed since, not thanked yet: its claim's id. */
|
|
22
|
+
thanksFor?(): string | null;
|
|
23
|
+
}
|
|
24
|
+
export interface GiftsSpotContent<G> {
|
|
25
|
+
/** The gifts button's content (its offers), with the completion when there is one. */
|
|
26
|
+
gifts: G;
|
|
27
|
+
/** The reminder's content, when the user has a claim it could show. */
|
|
28
|
+
reminder: ReminderContent | null;
|
|
29
|
+
/** The completion the `completed` state is about, when there is no claim to show. */
|
|
30
|
+
completion: string | null;
|
|
31
|
+
}
|
|
32
|
+
export type GiftsSpotConfig<F> = {
|
|
33
|
+
of: 'gifts';
|
|
34
|
+
config: F;
|
|
35
|
+
} | {
|
|
36
|
+
of: 'reminder';
|
|
37
|
+
config: ReminderConfig;
|
|
38
|
+
};
|
|
39
|
+
export type GiftsSpotModel<M> = {
|
|
40
|
+
of: 'gifts';
|
|
41
|
+
model: M;
|
|
42
|
+
} | {
|
|
43
|
+
of: 'reminder';
|
|
44
|
+
model: ReminderModel;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* The spot over the two plug-ins. `gifts` is the GiftsButton plug-in (its content takes
|
|
48
|
+
* an optional `thanks` completion), `reminder` the ClaimReminder plug-in.
|
|
49
|
+
*/
|
|
50
|
+
export declare function giftsSpotPlugin<G extends {
|
|
51
|
+
thanks?: string;
|
|
52
|
+
}, F, M>(gifts: Plugin<G, F, M>, reminder: Plugin<ReminderContent, ReminderConfig, ReminderModel>, deps: GiftsSpotDeps): Plugin<GiftsSpotContent<G>, GiftsSpotConfig<F>, GiftsSpotModel<M>>;
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=spot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spot.d.ts","sourceRoot":"","sources":["../../../src/triggers/giftsButton/spot.ts"],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AAE,CAAC,EACjE,KAAK,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACtB,QAAQ,EAAE,MAAM,CAAC,eAAe,EAAE,cAAc,EAAE,aAAa,CAAC,EAChE,IAAI,EAAE,aAAa,GAClB,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,CAyHpE"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one trigger host: mounts any registered trigger plug-in into an element.
|
|
3
|
+
*
|
|
4
|
+
* Owns everything triggers share (generic-contract.md, "Host responsibilities"):
|
|
5
|
+
* the pre-config gate (`prepare`), `/config?trigger=<id>&useCase=<real>` once per
|
|
6
|
+
* identity, the envelope check, decode, present, the served locale, visibility and the
|
|
7
|
+
* `sdk_trigger_*` events with their common fields, one tap at a time, the
|
|
8
|
+
* per-trigger dismiss store, foreground re-prepare, and a full re-run on identity
|
|
9
|
+
* or language change (`reload()`).
|
|
10
|
+
*
|
|
11
|
+
* It never throws into the host page and renders nothing (no element, so zero height)
|
|
12
|
+
* whenever there is nothing to show.
|
|
13
|
+
*/
|
|
14
|
+
import type { AnalyticsEvent } from '../../analytics/models';
|
|
15
|
+
import type { EncoreAlignment, TriggerHandle, TriggerMountOptions, ShowResult } from '../../types';
|
|
16
|
+
import { type TriggerRequest } from '../request';
|
|
17
|
+
import type { TriggerPortalTheme } from './theme';
|
|
18
|
+
import type { AnyTriggerPlugin, TriggerEntry, HostSheetRequest } from './types';
|
|
19
|
+
/** What the host needs from the SDK. Encore builds one per mount. */
|
|
20
|
+
export interface TriggerHostDeps {
|
|
21
|
+
/** `GET /config?trigger=<id>&useCase=…` for this placement and request. Rejects on failure. */
|
|
22
|
+
fetchConfig(triggerId: string, placementId: string | undefined, request: TriggerRequest): Promise<unknown>;
|
|
23
|
+
track(build: (distinctId: string) => AnalyticsEvent): void;
|
|
24
|
+
/** Where dismissals persist. May throw (blocked storage) or return null. */
|
|
25
|
+
storage(): Storage | null;
|
|
26
|
+
/** The SDK's sheet, for a plug-in whose tap presents it. Absent: resolves unavailable. */
|
|
27
|
+
presentSheet?(request: HostSheetRequest): Promise<ShowResult>;
|
|
28
|
+
/** Whether a sheet the app opened itself is up now. An automatic tap waits while it is. */
|
|
29
|
+
sheetBusy?(): boolean;
|
|
30
|
+
}
|
|
31
|
+
/** What a reload starts over for: another person, or the same person in another language. */
|
|
32
|
+
export type ReloadScope = 'identity' | 'language';
|
|
33
|
+
/** The public handle, plus the SDK's own hook for an identity or language change. */
|
|
34
|
+
export interface HostHandle extends TriggerHandle {
|
|
35
|
+
/** The mounted trigger's id. */
|
|
36
|
+
readonly triggerId: string;
|
|
37
|
+
/**
|
|
38
|
+
* INTERNAL: start over (fresh prepare and /config). Encore calls it from reset() and
|
|
39
|
+
* identify() (`identity`), and from setLanguage() and clearLanguage() (`language`).
|
|
40
|
+
*/
|
|
41
|
+
reload(scope?: ReloadScope): void;
|
|
42
|
+
/** INTERNAL: read the content again, keeping the variant (targeting attributes changed). */
|
|
43
|
+
refresh(): void;
|
|
44
|
+
}
|
|
45
|
+
export declare const NOOP_HANDLE: HostHandle;
|
|
46
|
+
/** A handle that does nothing, for a mount that never started. */
|
|
47
|
+
export declare function noopHandle(): TriggerHandle;
|
|
48
|
+
/** The alignment a mount asked for; anything else is the default, centre. */
|
|
49
|
+
export declare function triggerAlignmentOf(value: unknown): EncoreAlignment;
|
|
50
|
+
/** What the served response says, once checked. */
|
|
51
|
+
interface Served {
|
|
52
|
+
config: unknown;
|
|
53
|
+
variantId?: string;
|
|
54
|
+
experimentId?: string;
|
|
55
|
+
/** The step a look's behavior chose this for (`ui.step`), with the experiment that decided it. */
|
|
56
|
+
step?: 'afterClaim' | 'afterComplete';
|
|
57
|
+
stepExperimentId?: string | null;
|
|
58
|
+
locale?: string;
|
|
59
|
+
/** The app's theme from the portal (`ui.values`). */
|
|
60
|
+
portal?: TriggerPortalTheme;
|
|
61
|
+
/** The text slots this mount's text replaced in the served look, sorted. */
|
|
62
|
+
textSlots?: readonly string[];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* A sheet the app opened itself ended in a claim: a pop held behind it is dropped, as
|
|
66
|
+
* after a trigger's own sheet. Encore calls it, once the host is loaded.
|
|
67
|
+
*/
|
|
68
|
+
export declare function appSheetClaimed(): void;
|
|
69
|
+
/**
|
|
70
|
+
* A custom claim handle's tap (`Encore.claim`) takes the same page-wide lock as a
|
|
71
|
+
* trigger's: one sheet at a time. Null when another tap is in flight.
|
|
72
|
+
*/
|
|
73
|
+
export declare function takePageTap(): symbol | null;
|
|
74
|
+
/**
|
|
75
|
+
* The sheet a custom handle's tap opened closed: release the lock as a trigger's tap
|
|
76
|
+
* does (a held pop is dropped after a claim, else the first one runs), and every
|
|
77
|
+
* mounted trigger reads again, afresh after a claim.
|
|
78
|
+
*/
|
|
79
|
+
export declare function settlePageTap(token: symbol, claimed: boolean): void;
|
|
80
|
+
/** Hear every dismiss in a trigger mount. Returns an unsubscribe. */
|
|
81
|
+
export declare function onTriggerDismissed(listener: (triggerId: string) => void): () => void;
|
|
82
|
+
/**
|
|
83
|
+
* A custom handle dismissed `triggerId`'s content: every mount that draws it (its own, or a
|
|
84
|
+
* spot drawing its look) catches up, and every other custom handle hears it. `source`, the
|
|
85
|
+
* handle's own listener, is not told again.
|
|
86
|
+
*/
|
|
87
|
+
export declare function dismissedByCustom(triggerId: string, source?: (triggerId: string) => void): void;
|
|
88
|
+
/** Test hook: forget a tap a previous test left in flight. */
|
|
89
|
+
export declare function forgetPageTap(): void;
|
|
90
|
+
type Dict = Record<string, unknown>;
|
|
91
|
+
/**
|
|
92
|
+
* The served config for `triggerId`, or null to render nothing: no template (the
|
|
93
|
+
* holdout, or no experiment), or a template for another trigger (a server that does
|
|
94
|
+
* not know `trigger` answers with the sheet's own config, which names none).
|
|
95
|
+
*/
|
|
96
|
+
export declare function readTriggerResponse(response: unknown,
|
|
97
|
+
/** The triggers whose looks may answer: the mounted one first, then those it may render. */
|
|
98
|
+
drawable: string | readonly string[], decode: (template: Dict) => unknown): Served | null;
|
|
99
|
+
/** The fade when the spot switches between its components (the gifts button and its reminder). */
|
|
100
|
+
export declare const SWITCH_FADE_MS = 200;
|
|
101
|
+
/**
|
|
102
|
+
* Whether `key` (placement and reason) was already reported today for this trigger,
|
|
103
|
+
* marking it reported if not. localStorage when it works, a page-wide record always.
|
|
104
|
+
* Only today's entries are kept.
|
|
105
|
+
*/
|
|
106
|
+
export declare function claimNotShownToday(storage: Storage | null, triggerId: string, key: string): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Mount a trigger (a plug-in, or a registry entry that loads it) into `element`.
|
|
109
|
+
* `deps` is null when the SDK is not configured, which renders nothing. Never throws.
|
|
110
|
+
*/
|
|
111
|
+
export declare function mountTrigger(trigger: AnyTriggerPlugin | TriggerEntry, element: HTMLElement | null | undefined, options: TriggerMountOptions, deps: TriggerHostDeps | null,
|
|
112
|
+
/** Called once when the mount is torn down by any path, including the host removing it. */
|
|
113
|
+
onReleased?: () => void): HostHandle;
|
|
114
|
+
/**
|
|
115
|
+
* reset(): forget what this page holds for the previous person beside storage: the
|
|
116
|
+
* dismissals and the day's not-shown reports kept while storage could not take them.
|
|
117
|
+
*/
|
|
118
|
+
export declare function forgetTriggerMemory(): void;
|
|
119
|
+
/**
|
|
120
|
+
* The user's claims changed (a claim just happened, a completion landed, or the claims
|
|
121
|
+
* API was bound): every mount reads again, afresh. Its device state may have changed
|
|
122
|
+
* (a GiftsButton spot now has a claim to remind about, or a completed one to thank for),
|
|
123
|
+
* and a held set may still list the claimed offer. Encore calls it.
|
|
124
|
+
*/
|
|
125
|
+
export declare function claimsChanged(): void;
|
|
126
|
+
export {};
|
|
127
|
+
//# sourceMappingURL=TriggerHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TriggerHost.d.ts","sourceRoot":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jB,4FAA4F;AAC5F,QAAQ,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EACpC,MAAM,EAAE,CAAC,QAAQ,EAAE,IAAI,KAAK,OAAO,GAClC,MAAM,GAAG,IAAI,CA+Bf;AAiED,kGAAkG;AAClG,eAAO,MAAM,cAAc,MAAM,CAAC;AA6ClC;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CA2BnG;AAs5CD;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,gBAAgB,GAAG,YAAY,EACxC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,EACvC,OAAO,EAAE,mBAAmB,EAC5B,IAAI,EAAE,eAAe,GAAG,IAAI;AAC5B,2FAA2F;AAC3F,UAAU,CAAC,EAAE,MAAM,IAAI,GACtB,UAAU,CA4BZ;AAgBD;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAG1C;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAEpC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The device's one pop a day per placement: a GiftsButton look and an `Encore.claim`
|
|
3
|
+
* view whose rules open the sheet by themselves share it, so a placement opens by itself
|
|
4
|
+
* at most once per local day whichever drew it.
|
|
5
|
+
*/
|
|
6
|
+
/** Where the pops are remembered: `{ [placement]: 'YYYY-MM-DD' }`, local days. */
|
|
7
|
+
export declare const AUTO_POP_STORAGE_KEY = "encore.trigger.giftsButton.autoPopped";
|
|
8
|
+
/** Forget the page-wide pops: reset(), and tests. */
|
|
9
|
+
export declare function forgetAutoPops(): void;
|
|
10
|
+
export declare function localDay(ms: number): string;
|
|
11
|
+
/** The pop store over `storage` (read at each call; null or throwing falls back to the page). */
|
|
12
|
+
export declare function autoPops(storage: () => Storage | null): {
|
|
13
|
+
reservePop: (placement: string | undefined, now: number) => boolean;
|
|
14
|
+
releasePop: (placement: string | undefined, day: string) => void;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=autoPops.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoPops.d.ts","sourceRoot":"","sources":["../../../src/triggers/host/autoPops.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,kFAAkF;AAClF,eAAO,MAAM,oBAAoB,0CAA0C,CAAC;AAU5E,qDAAqD;AACrD,wBAAgB,cAAc,IAAI,IAAI,CAGrC;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAI3C;AAuBD,iGAAiG;AACjG,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,GAAG,IAAI,GAAG;IACvD,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IACpE,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAClE,CA2DA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trigger /config answers, kept in memory for the page and shared by every mount on
|
|
3
|
+
* every platform. Keyed by trigger, use case, placement, identity, language, pinned
|
|
4
|
+
* layout, the mount's `autoOpen=off` and the device state (§2.8), so an off mount never
|
|
5
|
+
* reuses an allowed mount's answer (a look that opens the sheet by itself). A null template
|
|
6
|
+
* (holdout, no experiment, version-gated) is an answer and is kept: re-asking would
|
|
7
|
+
* record the assignment again for nothing. So is a template this build cannot read. A
|
|
8
|
+
* failed request, or a malformed answer (no success envelope with a `ui` object), is
|
|
9
|
+
* never kept. The SDK clears the whole cache on identify, reset and
|
|
10
|
+
* setLanguage / clearLanguage; a page reload starts empty.
|
|
11
|
+
*/
|
|
12
|
+
export declare class TriggerConfigCache {
|
|
13
|
+
#private;
|
|
14
|
+
static key(parts: {
|
|
15
|
+
triggerId: string;
|
|
16
|
+
useCase: string;
|
|
17
|
+
placementId: string | undefined;
|
|
18
|
+
userId: string;
|
|
19
|
+
language: string | undefined;
|
|
20
|
+
layout: string | undefined;
|
|
21
|
+
/** The mount's opt-out as sent: `'off'`, or absent. */
|
|
22
|
+
autoOpen: 'off' | undefined;
|
|
23
|
+
state?: string;
|
|
24
|
+
}): string;
|
|
25
|
+
/** The kept answer for `key`, or `load()`'s, kept unless it rejects. Concurrent asks share one request. */
|
|
26
|
+
get(key: string, load: () => Promise<unknown>): Promise<unknown>;
|
|
27
|
+
clear(): void;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=configCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configCache.d.ts","sourceRoot":"","sources":["../../../src/triggers/host/configCache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,qBAAa,kBAAkB;;IAG7B,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;QAChC,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;QAC7B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;QAC3B,uDAAuD;QACvD,QAAQ,EAAE,KAAK,GAAG,SAAS,CAAC;QAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,MAAM;IAaV,2GAA2G;IAC3G,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAWhE,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The controller behind `Encore.claim()`: a publisher's own gifts button or claim
|
|
3
|
+
* reminder, counted and driven by Encore. INTERNAL; loaded on the first `claim()`.
|
|
4
|
+
*
|
|
5
|
+
* It never asks for a look to draw. Once the app's view is first on screen it asks for
|
|
6
|
+
* its rules, once per person: `GET /config?trigger=customClaim`, a behavior-only look
|
|
7
|
+
* (`afterClaim`, `afterComplete`, `autoOpen`) that Encore can test. Until they arrive,
|
|
8
|
+
* and whenever they cannot be read, it behaves as the default rules do (the reminder
|
|
9
|
+
* after a claim, gifts after a completion, never opening by itself), so a failure never
|
|
10
|
+
* hides the app's view. What it shows is decided locally, from the same sources a
|
|
11
|
+
* GiftsButton spot uses: the sheet's gate (its config and held offer search; the sheet's
|
|
12
|
+
* own holdout makes it `hidden`) and the claim log. Its `sdk_trigger_*` events go out as
|
|
13
|
+
* `trigger: "customClaim"`, `layout: "custom"`, with the rules' `variant_id` and
|
|
14
|
+
* `experiment_id` (none when no rules were read).
|
|
15
|
+
*/
|
|
16
|
+
import type { ClaimController } from '../../core/claimHandle';
|
|
17
|
+
import type { EncoreClaimOptions, EncoreClaimState, UseCase } from '../../types';
|
|
18
|
+
import type { ReminderClaim } from '../claimReminder/source';
|
|
19
|
+
import { type TriggerHostDeps } from './TriggerHost';
|
|
20
|
+
import type { SheetCheck } from './types';
|
|
21
|
+
/** The layout every custom event reports. */
|
|
22
|
+
export declare const CUSTOM_LAYOUT = "custom";
|
|
23
|
+
/** The reminder's window for a custom view: the one every served look ships with. */
|
|
24
|
+
export declare const CUSTOM_WINDOW_HOURS = 24;
|
|
25
|
+
export interface CustomClaimDeps {
|
|
26
|
+
/** The sheet's gate, as a GiftsButton's: offers held for the tap, or none. */
|
|
27
|
+
checkSheet(useCase: UseCase, placement: string | undefined, fresh: boolean): Promise<SheetCheck>;
|
|
28
|
+
/** The user's claims (the claim log, merged with the claims API). */
|
|
29
|
+
claims(): Promise<ReminderClaim[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Ask the server whether the user's open claims ended (bounded, cached; the claim log
|
|
32
|
+
* is updated and every handle told). Run at start and when the page is visible again.
|
|
33
|
+
*/
|
|
34
|
+
checkClaims?(dismissed?: (transactionId: string) => boolean): Promise<void>;
|
|
35
|
+
/** Whether the user completed a claim today and made none since, for `afterComplete: 'hide'`. */
|
|
36
|
+
completedToday?(): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* For `afterComplete: 'thanks'`: the completion (as `completedToday`) whose thanks is not
|
|
39
|
+
* yet tapped, by its claim's id, else null. Each completion counts its own view.
|
|
40
|
+
*/
|
|
41
|
+
thanksFor?(): string | null;
|
|
42
|
+
/** The thanks state was tapped: it ends for that completion. */
|
|
43
|
+
thanksTapped?(): void;
|
|
44
|
+
/**
|
|
45
|
+
* A reminder tap about to open the sheet: false when the claim is known to have ended
|
|
46
|
+
* (synchronous: the sheet opens inside the click). Absent: always open.
|
|
47
|
+
*/
|
|
48
|
+
claimTapped?(transactionId: string): boolean;
|
|
49
|
+
/** The rules request, analytics, storage, the sheet, and whether a sheet is up. */
|
|
50
|
+
host: Pick<TriggerHostDeps, 'track' | 'storage' | 'presentSheet' | 'sheetBusy'> & Partial<Pick<TriggerHostDeps, 'fetchConfig'>>;
|
|
51
|
+
}
|
|
52
|
+
/** The user's claims changed: every custom handle reads again, afresh. */
|
|
53
|
+
export declare function claimsChangedForCustom(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Another person (`identity`): every custom handle starts over. The same person in
|
|
56
|
+
* another language: each reads again, keeping what it already counted.
|
|
57
|
+
*/
|
|
58
|
+
export declare function reloadCustom(scope?: 'identity' | 'language'): void;
|
|
59
|
+
/** The targeting changed: every custom handle checks its sheet's offers again, at most once per 30 s. */
|
|
60
|
+
export declare function refreshCustom(): void;
|
|
61
|
+
/** The rules arm a read named: its look id and experiment (null on the default). */
|
|
62
|
+
interface RulesArm {
|
|
63
|
+
variantId?: string;
|
|
64
|
+
experimentId: string | null;
|
|
65
|
+
}
|
|
66
|
+
/** The steps the handle follows: the default rules until a read says otherwise. */
|
|
67
|
+
interface ClaimRules {
|
|
68
|
+
showReminder: boolean;
|
|
69
|
+
hide: boolean;
|
|
70
|
+
thanks: boolean;
|
|
71
|
+
autoOpen: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A customClaim `/config` answer's rules, or null to keep the default rules: no template
|
|
75
|
+
* (not configured, switched off), or one for another trigger. An unknown step or value
|
|
76
|
+
* keeps that step's default.
|
|
77
|
+
*/
|
|
78
|
+
export declare function readClaimRules(ui: unknown): {
|
|
79
|
+
rules: ClaimRules;
|
|
80
|
+
arm: RulesArm;
|
|
81
|
+
} | null;
|
|
82
|
+
/** Start the controller for a handle. Never throws. */
|
|
83
|
+
export declare function startCustomClaim(options: EncoreClaimOptions, deps: CustomClaimDeps, setState: (state: EncoreClaimState) => void): ClaimController;
|
|
84
|
+
export {};
|
|
85
|
+
//# sourceMappingURL=customClaim.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customClaim.d.ts","sourceRoot":"","sources":["../../../src/triggers/host/customClaim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAe,kBAAkB,EAAE,gBAAgB,EAAc,OAAO,EAAE,MAAM,aAAa,CAAC;AAM1G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAQ7D,OAAO,EAML,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C,6CAA6C;AAC7C,eAAO,MAAM,aAAa,WAAW,CAAC;AACtC,qFAAqF;AACrF,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAMtC,MAAM,WAAW,eAAe;IAC9B,8EAA8E;IAC9E,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EA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AC,GAAG,EAAE,QAAQ,CAAA;CAAE,GAAG,IAAI,CAmBvF;AA0lBD,uDAAuD;AACvD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,kBAAkB,EAC3B,IAAI,EAAE,eAAe,EACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,GAC1C,eAAe,CAQjB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A trigger's dismissed content keys on this device. No server write. Each
|
|
3
|
+
* trigger has its own list; the plug-in chooses the key (ClaimReminder: the
|
|
4
|
+
* transaction id) through its presentation's `contentKey`.
|
|
5
|
+
*
|
|
6
|
+
* Stored as `[key, dismissedAtMs]` pairs, oldest first, at most {@link MAX_DISMISSED},
|
|
7
|
+
* each forgotten {@link DISMISS_RETENTION_MS} after it was dismissed (the same
|
|
8
|
+
* retention on every platform; expired entries go on the next write). localStorage is
|
|
9
|
+
* the record whenever it can be read, so every mount and tab agrees on one ordered
|
|
10
|
+
* list and a stale copy can never bring an aged-out key back. When it cannot be read
|
|
11
|
+
* (private mode, a blocked frame), a page-wide list stands in, so the mounts on one
|
|
12
|
+
* page still agree. A key whose write failed while reads still work (quota) is held
|
|
13
|
+
* for the page too, so the dismiss sticks until the page closes.
|
|
14
|
+
*/
|
|
15
|
+
/** The storage key for one trigger's list, the same on every platform. */
|
|
16
|
+
export declare function dismissStorageKey(triggerId: string): string;
|
|
17
|
+
/** Bound on stored keys. Oldest go first. */
|
|
18
|
+
export declare const MAX_DISMISSED = 100;
|
|
19
|
+
/** How long a dismissal lasts: 720 hours, the longest window any trigger serves. */
|
|
20
|
+
export declare const DISMISS_RETENTION_MS: number;
|
|
21
|
+
/** Test hook: how many failed-write keys are held, over every trigger. */
|
|
22
|
+
export declare function heldCount(): number;
|
|
23
|
+
/** Forget the page-wide state: reset(), and tests. */
|
|
24
|
+
export declare function forgetDismissalMemory(): void;
|
|
25
|
+
export declare class DismissStore {
|
|
26
|
+
#private;
|
|
27
|
+
constructor(storage: Storage | null, triggerId: string);
|
|
28
|
+
/** How many keys are held. */
|
|
29
|
+
get size(): number;
|
|
30
|
+
has(key: string): boolean;
|
|
31
|
+
/** The dismissed keys as of the last sync() or add(). */
|
|
32
|
+
keys(): ReadonlySet<string>;
|
|
33
|
+
/** Re-read the record: another mount on this page, or another tab, may have dismissed since. */
|
|
34
|
+
sync(): void;
|
|
35
|
+
add(key: string): void;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=dismissStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dismissStore.d.ts","sourceRoot":"","sources":["../../../src/triggers/host/dismissStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,6CAA6C;AAC7C,eAAO,MAAM,aAAa,MAAM,CAAC;AAEjC,oFAAoF;AACpF,eAAO,MAAM,oBAAoB,QAAuB,CAAC;AAkBzD,0EAA0E;AAC1E,wBAAgB,SAAS,IAAI,MAAM,CAIlC;AAED,sDAAsD;AACtD,wBAAgB,qBAAqB,IAAI,IAAI,CAG5C;AAkCD,qBAAa,YAAY;;gBAKX,OAAO,EAAE,OAAO,GAAG,IAAI,EAAE,SAAS,EAAE,MAAM;IAMtD,8BAA8B;IAC9B,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,yDAAyD;IACzD,IAAI,IAAI,WAAW,CAAC,MAAM,CAAC;IAI3B,gGAAgG;IAChG,IAAI,IAAI,IAAI;IAIZ,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CA0DvB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* At most one gate re-read per {@link READ_THROTTLE_MS} from the page becoming visible
|
|
3
|
+
* again or the targeting attributes changing, per mount. A trigger inside the window
|
|
4
|
+
* is not dropped: one read runs when the window ends (on a visible page), so the last
|
|
5
|
+
* change always lands. A claim, a dismissal or a new person reads at once, outside this.
|
|
6
|
+
*/
|
|
7
|
+
export declare const READ_THROTTLE_MS = 30000;
|
|
8
|
+
export declare class ReadThrottle {
|
|
9
|
+
#private;
|
|
10
|
+
constructor(read: () => void, now?: () => number);
|
|
11
|
+
/** Read now, or once the window ends. */
|
|
12
|
+
request(): void;
|
|
13
|
+
cancel(): void;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=readThrottle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readThrottle.d.ts","sourceRoot":"","sources":["../../../src/triggers/host/readThrottle.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,gBAAgB,QAAS,CAAC;AAEvC,qBAAa,YAAY;;gBAMX,IAAI,EAAE,MAAM,IAAI,EAAE,GAAG,GAAE,MAAM,MAAyB;IAKlE,yCAAyC;IACzC,OAAO,IAAI,IAAI;IAmBf,MAAM,IAAI,IAAI;CAQf"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The triggers this SDK build ships, by id. INTERNAL: a host app names an id, it
|
|
3
|
+
* cannot register one (generic-contract.md, v1).
|
|
4
|
+
*/
|
|
5
|
+
import type { TriggerEntry } from './types';
|
|
6
|
+
export declare class TriggerRegistry {
|
|
7
|
+
#private;
|
|
8
|
+
/** `entries` load their plug-in on first use; each loads once, however many mounts ask. */
|
|
9
|
+
constructor(entries: readonly TriggerEntry[]);
|
|
10
|
+
/**
|
|
11
|
+
* The entry for `id`, or null for an id this build does not ship. An unknown id
|
|
12
|
+
* renders nothing and sends nothing; it is logged once per id, so a typo is
|
|
13
|
+
* findable without a log line per render.
|
|
14
|
+
*/
|
|
15
|
+
get(id: unknown): TriggerEntry | null;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/triggers/host/registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAoB,YAAY,EAAE,MAAM,SAAS,CAAC;AAE9D,qBAAa,eAAe;;IAI1B,2FAA2F;gBAC/E,OAAO,EAAE,SAAS,YAAY,EAAE;IAiB5C;;;;OAIG;IACH,GAAG,CAAC,EAAE,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI;CAUtC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How every trigger draws: the served `ui.template.root`, through the SDUI engine,
|
|
3
|
+
* inline in the host's element (trigger SDUI vocabulary contract v1). The plug-in
|
|
4
|
+
* supplies the bindings (values, time keys, lists) and the resolved palette; the
|
|
5
|
+
* tree decides the look, including the height (§3.7).
|
|
6
|
+
*
|
|
7
|
+
* The engine owns drawing and the countdown and loop timing; this view owns what the
|
|
8
|
+
* host feeds it: the clock on each present, the palette as appearance tokens, the
|
|
9
|
+
* busy state, and the motion flags (§2.4, §2.6).
|
|
10
|
+
*/
|
|
11
|
+
import type { SduiHostListItem } from '../../sdui/context';
|
|
12
|
+
import { type TriggerTheme } from './theme';
|
|
13
|
+
import type { TriggerRenderScope, TriggerView } from './types';
|
|
14
|
+
/** What a trigger hands the engine for one render. */
|
|
15
|
+
export interface TriggerSduiModel {
|
|
16
|
+
/** `ui.template` as served, already through the host's pre-check. */
|
|
17
|
+
template: Record<string, unknown>;
|
|
18
|
+
theme: TriggerTheme;
|
|
19
|
+
/** `${key}` values (§2.2). They win over the template's own values. */
|
|
20
|
+
values: Readonly<Record<string, string>>;
|
|
21
|
+
/** Time keys in ms since the epoch (§2.3). */
|
|
22
|
+
times?: Readonly<Record<string, number>>;
|
|
23
|
+
/** Host lists (§2.5). */
|
|
24
|
+
lists?: Readonly<Record<string, readonly SduiHostListItem[]>>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Mount `model` and return the host's view of it. Throws when the engine cannot
|
|
28
|
+
* mount the tree; the host reports that as `unrenderable`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function renderTriggerSdui(model: TriggerSduiModel, scope: TriggerRenderScope): TriggerView<TriggerSduiModel>;
|
|
31
|
+
//# sourceMappingURL=sduiView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sduiView.d.ts","sourceRoot":"","sources":["../../../src/triggers/host/sduiView.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAwC,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAClF,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE/D,sDAAsD;AACtD,MAAM,WAAW,gBAAgB;IAC/B,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,KAAK,EAAE,YAAY,CAAC;IACpB,uEAAuE;IACvE,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACzC,8CAA8C;IAC9C,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACzC,yBAAyB;IACzB,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,gBAAgB,EAAE,CAAC,CAAC,CAAC;CAC/D;AAqBD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,kBAAkB,GACxB,WAAW,CAAC,gBAAgB,CAAC,CA+H/B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading the parts of a served template every trigger shares: `colors` and
|
|
3
|
+
* `strings`. Tolerant: a missing or malformed field is skipped, and the caller's
|
|
4
|
+
* default answers.
|
|
5
|
+
*/
|
|
6
|
+
import type { TriggerColors } from './theme';
|
|
7
|
+
import type { SduiHostListItem } from '../../sdui/context';
|
|
8
|
+
import type { HeldOffer } from './types';
|
|
9
|
+
type Dict = Record<string, unknown>;
|
|
10
|
+
export declare function isDict(value: unknown): value is Dict;
|
|
11
|
+
/** The first character, uppercased; a whole code point, so an astral letter is not split. */
|
|
12
|
+
export declare function initialOf(name: string): string;
|
|
13
|
+
/** A non-blank string, or undefined. */
|
|
14
|
+
export declare function text(value: unknown): string | undefined;
|
|
15
|
+
/** `template.colors`: the three colours, each kept only when it is a non-blank string. */
|
|
16
|
+
export declare function readColors(value: unknown): TriggerColors;
|
|
17
|
+
/**
|
|
18
|
+
* `template.strings`, already localized by the server, then `defaults` per key: a
|
|
19
|
+
* blank or missing key takes the built-in English.
|
|
20
|
+
*/
|
|
21
|
+
export declare function readStrings<K extends string>(value: unknown, defaults: Readonly<Record<K, string>>): Record<K, string>;
|
|
22
|
+
/**
|
|
23
|
+
* The held offers' logos: one per advertiser with a safe image, in sheet order, at
|
|
24
|
+
* most eight. Items carry `logoUrl`, `advertiserName` and `advertiserInitial`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function offerLogosOf(offers: readonly HeldOffer[]): SduiHostListItem[];
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../src/triggers/host/template.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGzC,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpC,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,IAAI,CAEpD;AAED,6FAA6F;AAC7F,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG9C;AAED,wCAAwC;AACxC,wBAAgB,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAEvD;AAED,0FAA0F;AAC1F,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAQxD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAC1C,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GACpC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAKnB;AAKD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,GAAG,gBAAgB,EAAE,CAgB7E"}
|