@encorekit/web-sdk 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (265) hide show
  1. package/README.md +66 -1
  2. package/dist/cjs/index.cjs +1 -1
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/cjs/preview.cjs +2 -0
  5. package/dist/cjs/preview.cjs.map +1 -0
  6. package/dist/cjs/react.cjs +1 -1
  7. package/dist/cjs/react.cjs.map +1 -1
  8. package/dist/esm/chunks/ClaimReminder-DFyrm5bJ.js +2 -0
  9. package/dist/esm/chunks/ClaimReminder-DFyrm5bJ.js.map +1 -0
  10. package/dist/esm/chunks/GiftsButton-B0lVB463.js +2 -0
  11. package/dist/esm/chunks/GiftsButton-B0lVB463.js.map +1 -0
  12. package/dist/esm/chunks/TriggerHost-CNTiNrTH.js +2 -0
  13. package/dist/esm/chunks/TriggerHost-CNTiNrTH.js.map +1 -0
  14. package/dist/esm/chunks/autoPops-CngtK_R0.js +2 -0
  15. package/dist/esm/chunks/autoPops-CngtK_R0.js.map +1 -0
  16. package/dist/esm/chunks/customClaim-B4uj-aOc.js +2 -0
  17. package/dist/esm/chunks/customClaim-B4uj-aOc.js.map +1 -0
  18. package/dist/esm/chunks/eligibility-BY7fL8Ve.js +2 -0
  19. package/dist/esm/chunks/eligibility-BY7fL8Ve.js.map +1 -0
  20. package/dist/esm/chunks/index-CaBSqauy.js +2 -0
  21. package/dist/esm/chunks/index-CaBSqauy.js.map +1 -0
  22. package/dist/esm/chunks/lookValues-B9z2VWpH.js +2 -0
  23. package/dist/esm/chunks/lookValues-B9z2VWpH.js.map +1 -0
  24. package/dist/esm/chunks/sduiView-Ds7QtFId.js +2 -0
  25. package/dist/esm/chunks/sduiView-Ds7QtFId.js.map +1 -0
  26. package/dist/esm/chunks/spot-DkKMLpB-.js +2 -0
  27. package/dist/esm/chunks/spot-DkKMLpB-.js.map +1 -0
  28. package/dist/esm/chunks/template-B9p4CbPD.js +2 -0
  29. package/dist/esm/chunks/template-B9p4CbPD.js.map +1 -0
  30. package/dist/esm/chunks/textSlots-BnwxUg9V.js +2 -0
  31. package/dist/esm/chunks/textSlots-BnwxUg9V.js.map +1 -0
  32. package/dist/esm/chunks/timers-Bva4yoGM.js +2 -0
  33. package/dist/esm/chunks/timers-Bva4yoGM.js.map +1 -0
  34. package/dist/esm/index.js +1 -1
  35. package/dist/esm/index.js.map +1 -1
  36. package/dist/esm/preview.js +2 -0
  37. package/dist/esm/preview.js.map +1 -0
  38. package/dist/esm/react.js +1 -1
  39. package/dist/esm/react.js.map +1 -1
  40. package/dist/umd/encore.min.js +1 -1
  41. package/dist/umd/encore.min.js.map +1 -1
  42. package/package.json +9 -1
  43. package/types/analytics/DiagnosticsOutbox.d.ts +1 -0
  44. package/types/analytics/DiagnosticsOutbox.d.ts.map +1 -1
  45. package/types/analytics/events.d.ts +105 -5
  46. package/types/analytics/events.d.ts.map +1 -1
  47. package/types/analytics/models.d.ts +2 -0
  48. package/types/analytics/models.d.ts.map +1 -1
  49. package/types/analytics/transport.d.ts +6 -0
  50. package/types/analytics/transport.d.ts.map +1 -1
  51. package/types/api/APIClient.d.ts +58 -3
  52. package/types/api/APIClient.d.ts.map +1 -1
  53. package/types/api/contract.d.ts +4 -1
  54. package/types/api/contract.d.ts.map +1 -1
  55. package/types/api/generated/types.d.ts +420 -39
  56. package/types/api/generated/types.d.ts.map +1 -1
  57. package/types/api/models.d.ts +18 -2
  58. package/types/api/models.d.ts.map +1 -1
  59. package/types/api/offerBuilder.d.ts +10 -4
  60. package/types/api/offerBuilder.d.ts.map +1 -1
  61. package/types/core/Encore.d.ts +145 -3
  62. package/types/core/Encore.d.ts.map +1 -1
  63. package/types/core/OfferManager.d.ts +25 -3
  64. package/types/core/OfferManager.d.ts.map +1 -1
  65. package/types/core/PlacementBuilder.d.ts +6 -1
  66. package/types/core/PlacementBuilder.d.ts.map +1 -1
  67. package/types/core/SignalManager.d.ts.map +1 -1
  68. package/types/core/StorageManager.d.ts +3 -2
  69. package/types/core/StorageManager.d.ts.map +1 -1
  70. package/types/core/StrictUnlockReconciler.d.ts +1 -1
  71. package/types/core/StrictUnlockReconciler.d.ts.map +1 -1
  72. package/types/core/claimHandle.d.ts +44 -0
  73. package/types/core/claimHandle.d.ts.map +1 -0
  74. package/types/core/claimLog.d.ts +102 -0
  75. package/types/core/claimLog.d.ts.map +1 -0
  76. package/types/core/claimRefusal.d.ts +3 -0
  77. package/types/core/claimRefusal.d.ts.map +1 -0
  78. package/types/core/claimStatusCheck.d.ts +62 -0
  79. package/types/core/claimStatusCheck.d.ts.map +1 -0
  80. package/types/core/giftVariant.d.ts +5 -0
  81. package/types/core/giftVariant.d.ts.map +1 -1
  82. package/types/core/hostDisplay.d.ts +9 -2
  83. package/types/core/hostDisplay.d.ts.map +1 -1
  84. package/types/core/sduiVariables.d.ts +20 -0
  85. package/types/core/sduiVariables.d.ts.map +1 -0
  86. package/types/core/strings.d.ts +114 -0
  87. package/types/core/strings.d.ts.map +1 -0
  88. package/types/core/unlockCode.d.ts +8 -1
  89. package/types/core/unlockCode.d.ts.map +1 -1
  90. package/types/core/userKeys.d.ts +7 -0
  91. package/types/core/userKeys.d.ts.map +1 -0
  92. package/types/core/version.d.ts +1 -1
  93. package/types/experiments/ExposureOutbox.d.ts +1 -0
  94. package/types/experiments/ExposureOutbox.d.ts.map +1 -1
  95. package/types/preview.d.ts +51 -0
  96. package/types/preview.d.ts.map +1 -0
  97. package/types/react.d.ts +53 -1
  98. package/types/react.d.ts.map +1 -1
  99. package/types/sdui/actions.d.ts +93 -0
  100. package/types/sdui/actions.d.ts.map +1 -0
  101. package/types/sdui/bindings.d.ts +63 -0
  102. package/types/sdui/bindings.d.ts.map +1 -0
  103. package/types/sdui/compile.d.ts +88 -0
  104. package/types/sdui/compile.d.ts.map +1 -0
  105. package/types/sdui/conditions.d.ts +22 -0
  106. package/types/sdui/conditions.d.ts.map +1 -0
  107. package/types/sdui/context.d.ts +132 -0
  108. package/types/sdui/context.d.ts.map +1 -0
  109. package/types/sdui/countdown.d.ts +31 -0
  110. package/types/sdui/countdown.d.ts.map +1 -0
  111. package/types/sdui/decode.d.ts +35 -0
  112. package/types/sdui/decode.d.ts.map +1 -0
  113. package/types/sdui/deps.d.ts +43 -0
  114. package/types/sdui/deps.d.ts.map +1 -0
  115. package/types/sdui/dominantColor.d.ts +24 -0
  116. package/types/sdui/dominantColor.d.ts.map +1 -0
  117. package/types/sdui/elements/confetti.d.ts +38 -0
  118. package/types/sdui/elements/confetti.d.ts.map +1 -0
  119. package/types/sdui/elements/content.d.ts +27 -0
  120. package/types/sdui/elements/content.d.ts.map +1 -0
  121. package/types/sdui/elements/interactive.d.ts +48 -0
  122. package/types/sdui/elements/interactive.d.ts.map +1 -0
  123. package/types/sdui/elements/layout.d.ts +41 -0
  124. package/types/sdui/elements/layout.d.ts.map +1 -0
  125. package/types/sdui/elements/marquee.d.ts +17 -0
  126. package/types/sdui/elements/marquee.d.ts.map +1 -0
  127. package/types/sdui/elements/progress.d.ts +10 -0
  128. package/types/sdui/elements/progress.d.ts.map +1 -0
  129. package/types/sdui/elements/shared.d.ts +138 -0
  130. package/types/sdui/elements/shared.d.ts.map +1 -0
  131. package/types/sdui/elements/symbols.d.ts +22 -0
  132. package/types/sdui/elements/symbols.d.ts.map +1 -0
  133. package/types/sdui/elements/triggerText.d.ts +55 -0
  134. package/types/sdui/elements/triggerText.d.ts.map +1 -0
  135. package/types/sdui/host.d.ts +274 -0
  136. package/types/sdui/host.d.ts.map +1 -0
  137. package/types/sdui/inlineMarkup.d.ts +22 -0
  138. package/types/sdui/inlineMarkup.d.ts.map +1 -0
  139. package/types/sdui/lookValues.d.ts +50 -0
  140. package/types/sdui/lookValues.d.ts.map +1 -0
  141. package/types/sdui/model.d.ts +130 -0
  142. package/types/sdui/model.d.ts.map +1 -0
  143. package/types/sdui/motion.d.ts +37 -0
  144. package/types/sdui/motion.d.ts.map +1 -0
  145. package/types/sdui/precheck.d.ts +94 -0
  146. package/types/sdui/precheck.d.ts.map +1 -0
  147. package/types/sdui/scrollMath.d.ts +32 -0
  148. package/types/sdui/scrollMath.d.ts.map +1 -0
  149. package/types/sdui/style.d.ts +99 -0
  150. package/types/sdui/style.d.ts.map +1 -0
  151. package/types/sdui/triggerKit.d.ts +24 -0
  152. package/types/sdui/triggerKit.d.ts.map +1 -0
  153. package/types/sdui/unrunnable.d.ts +11 -0
  154. package/types/sdui/unrunnable.d.ts.map +1 -0
  155. package/types/sdui/vocabulary.d.ts +119 -0
  156. package/types/sdui/vocabulary.d.ts.map +1 -0
  157. package/types/triggers/claimReminder/ClaimReminder.d.ts +65 -0
  158. package/types/triggers/claimReminder/ClaimReminder.d.ts.map +1 -0
  159. package/types/triggers/claimReminder/bindings.d.ts +40 -0
  160. package/types/triggers/claimReminder/bindings.d.ts.map +1 -0
  161. package/types/triggers/claimReminder/config.d.ts +56 -0
  162. package/types/triggers/claimReminder/config.d.ts.map +1 -0
  163. package/types/triggers/claimReminder/eligibility.d.ts +37 -0
  164. package/types/triggers/claimReminder/eligibility.d.ts.map +1 -0
  165. package/types/triggers/claimReminder/servedWindow.d.ts +15 -0
  166. package/types/triggers/claimReminder/servedWindow.d.ts.map +1 -0
  167. package/types/triggers/claimReminder/source.d.ts +29 -0
  168. package/types/triggers/claimReminder/source.d.ts.map +1 -0
  169. package/types/triggers/giftsButton/GiftsButton.d.ts +60 -0
  170. package/types/triggers/giftsButton/GiftsButton.d.ts.map +1 -0
  171. package/types/triggers/giftsButton/config.d.ts +53 -0
  172. package/types/triggers/giftsButton/config.d.ts.map +1 -0
  173. package/types/triggers/giftsButton/spot.d.ts +54 -0
  174. package/types/triggers/giftsButton/spot.d.ts.map +1 -0
  175. package/types/triggers/host/TriggerHost.d.ts +127 -0
  176. package/types/triggers/host/TriggerHost.d.ts.map +1 -0
  177. package/types/triggers/host/autoPops.d.ts +16 -0
  178. package/types/triggers/host/autoPops.d.ts.map +1 -0
  179. package/types/triggers/host/configCache.d.ts +29 -0
  180. package/types/triggers/host/configCache.d.ts.map +1 -0
  181. package/types/triggers/host/customClaim.d.ts +85 -0
  182. package/types/triggers/host/customClaim.d.ts.map +1 -0
  183. package/types/triggers/host/dismissStore.d.ts +37 -0
  184. package/types/triggers/host/dismissStore.d.ts.map +1 -0
  185. package/types/triggers/host/readThrottle.d.ts +15 -0
  186. package/types/triggers/host/readThrottle.d.ts.map +1 -0
  187. package/types/triggers/host/registry.d.ts +17 -0
  188. package/types/triggers/host/registry.d.ts.map +1 -0
  189. package/types/triggers/host/sduiView.d.ts +31 -0
  190. package/types/triggers/host/sduiView.d.ts.map +1 -0
  191. package/types/triggers/host/template.d.ts +28 -0
  192. package/types/triggers/host/template.d.ts.map +1 -0
  193. package/types/triggers/host/textSlots.d.ts +35 -0
  194. package/types/triggers/host/textSlots.d.ts.map +1 -0
  195. package/types/triggers/host/theme.d.ts +87 -0
  196. package/types/triggers/host/theme.d.ts.map +1 -0
  197. package/types/triggers/host/timers.d.ts +11 -0
  198. package/types/triggers/host/timers.d.ts.map +1 -0
  199. package/types/triggers/host/types.d.ts +278 -0
  200. package/types/triggers/host/types.d.ts.map +1 -0
  201. package/types/triggers/host/wire.d.ts +55 -0
  202. package/types/triggers/host/wire.d.ts.map +1 -0
  203. package/types/triggers/preview.d.ts +78 -0
  204. package/types/triggers/preview.d.ts.map +1 -0
  205. package/types/triggers/request.d.ts +53 -0
  206. package/types/triggers/request.d.ts.map +1 -0
  207. package/types/types.d.ts +329 -1
  208. package/types/types.d.ts.map +1 -1
  209. package/types/ui/ClaimScreen.d.ts +1 -1
  210. package/types/ui/ClaimScreen.d.ts.map +1 -1
  211. package/types/ui/CodeUnlock.d.ts +12 -2
  212. package/types/ui/CodeUnlock.d.ts.map +1 -1
  213. package/types/ui/GiftHero.d.ts.map +1 -1
  214. package/types/ui/GiftList.d.ts.map +1 -1
  215. package/types/ui/GiftPicker.d.ts.map +1 -1
  216. package/types/ui/GiftPickerHero.d.ts.map +1 -1
  217. package/types/ui/GiftReveal.d.ts.map +1 -1
  218. package/types/ui/GiftSheet.d.ts +5 -5
  219. package/types/ui/GiftSheet.d.ts.map +1 -1
  220. package/types/ui/GiftUnwrap.d.ts.map +1 -1
  221. package/types/ui/OfferCard.d.ts.map +1 -1
  222. package/types/ui/OfferCarousel.d.ts.map +1 -1
  223. package/types/ui/OfferModal.d.ts +31 -0
  224. package/types/ui/OfferModal.d.ts.map +1 -1
  225. package/types/ui/PrimerScreen.d.ts +2 -0
  226. package/types/ui/PrimerScreen.d.ts.map +1 -1
  227. package/types/ui/RedemptionScreen.d.ts +5 -0
  228. package/types/ui/RedemptionScreen.d.ts.map +1 -1
  229. package/types/ui/RewardActions.d.ts.map +1 -1
  230. package/types/ui/RewardCard.d.ts.map +1 -1
  231. package/types/ui/SduiRewardSurface.d.ts +145 -0
  232. package/types/ui/SduiRewardSurface.d.ts.map +1 -0
  233. package/types/ui/Tooltip.d.ts.map +1 -1
  234. package/types/ui/brandComponents.d.ts.map +1 -1
  235. package/types/ui/brandTint.d.ts.map +1 -1
  236. package/types/ui/colorScheme.d.ts +15 -0
  237. package/types/ui/colorScheme.d.ts.map +1 -0
  238. package/types/ui/covered.d.ts +12 -0
  239. package/types/ui/covered.d.ts.map +1 -0
  240. package/types/ui/giftCategoryGroups.d.ts +13 -0
  241. package/types/ui/giftCategoryGroups.d.ts.map +1 -1
  242. package/types/ui/giftCopy.d.ts +14 -9
  243. package/types/ui/giftCopy.d.ts.map +1 -1
  244. package/types/ui/giftUnwrapCopy.d.ts.map +1 -1
  245. package/types/ui/imageURL.d.ts +44 -0
  246. package/types/ui/imageURL.d.ts.map +1 -0
  247. package/types/ui/impressionGate.d.ts +9 -0
  248. package/types/ui/impressionGate.d.ts.map +1 -1
  249. package/types/ui/offerBadge.d.ts.map +1 -1
  250. package/types/ui/rewardSurface.d.ts +11 -1
  251. package/types/ui/rewardSurface.d.ts.map +1 -1
  252. package/types/ui/sduiTheme.d.ts +48 -0
  253. package/types/ui/sduiTheme.d.ts.map +1 -0
  254. package/types/ui/sheetDetents.d.ts +28 -0
  255. package/types/ui/sheetDetents.d.ts.map +1 -0
  256. package/types/ui/styles.d.ts +11 -8
  257. package/types/ui/styles.d.ts.map +1 -1
  258. package/types/ui/termsLine.d.ts +3 -3
  259. package/types/ui/termsLine.d.ts.map +1 -1
  260. package/types/ui/toast.d.ts +11 -0
  261. package/types/ui/toast.d.ts.map +1 -0
  262. package/types/utils/logger.d.ts +10 -0
  263. package/types/utils/logger.d.ts.map +1 -1
  264. package/types/utils/text.d.ts +17 -0
  265. package/types/utils/text.d.ts.map +1 -1
@@ -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,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACjG,qEAAqE;IACrE,MAAM,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IACnC;;;OAGG;IACH,WAAW,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5E,iGAAiG;IACjG,cAAc,CAAC,IAAI,OAAO,CAAC;IAC3B;;;OAGG;IACH,SAAS,CAAC,IAAI,MAAM,GAAG,IAAI,CAAC;IAC5B,gEAAgE;IAChE,YAAY,CAAC,IAAI,IAAI,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7C,mFAAmF;IACnF,IAAI,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,GAAG,SAAS,GAAG,cAAc,GAAG,WAAW,CAAC,GAC7E,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC,CAAC;CACjD;AAKD,0EAA0E;AAC1E,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,GAAE,UAAU,GAAG,UAAuB,GAAG,IAAI,CAE9E;AAED,yGAAyG;AACzG,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAED,oFAAoF;AACpF,UAAU,QAAQ;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,mFAAmF;AACnF,UAAU,UAAU;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAID;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,OAAO,GAAG;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,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"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * The app's own words on a trigger (`headline`, `subheadline`, `cta`): a look names, in
3
+ * its root `textSlots`, which of its OWN strings each slot replaces, so that string is
4
+ * the slot's default (translated, per variant). App text is cleaned the same way on every
5
+ * platform, never translated, and never leaves the device.
6
+ */
7
+ /** The text slots a mount can set, in wire order. */
8
+ export declare const TEXT_SLOTS: readonly ["headline", "subheadline", "cta"];
9
+ export type TextSlot = (typeof TEXT_SLOTS)[number];
10
+ /** The longest slot text kept, in UTF-16 code units (JavaScript `.length`). */
11
+ export declare const MAX_SLOT_TEXT_LENGTH = 120;
12
+ /**
13
+ * An app's slot text as it may be drawn, or null for the look's own default: not a
14
+ * string, nothing visible after cleaning, or text still holding `${` (the fill pass would
15
+ * expand it). The order is shared by every SDK.
16
+ */
17
+ export declare function sanitizeSlotText(raw: unknown): string | null;
18
+ /** A mount's slot text, cleaned once: only the slots it set with text that survives. */
19
+ export declare function mountSlotText(options: Partial<Record<TextSlot, unknown>> | null | undefined): Partial<Record<TextSlot, string>>;
20
+ /**
21
+ * `template` with the app's text in place of the strings its `textSlots` name, and the
22
+ * slots drawn with app text (sorted; empty when none). Lenient, as a device is with a newer
23
+ * server: an unknown slot, a slot naming a string the look lacks, or a `textSlots` that is
24
+ * not an object is skipped. A state look keeps its own words. The template is never
25
+ * changed in place, so a shared cached answer stays as served.
26
+ */
27
+ export declare function withSlotText(template: unknown, text: Partial<Record<TextSlot, string>>): {
28
+ template: unknown;
29
+ drawn: TextSlot[];
30
+ };
31
+ /** The string a look's headline slot names, for the reminder's spoken title; null when none. */
32
+ export declare function headlineKeyOf(template: unknown): string | null;
33
+ /** Each slot a look declares in the string form, with the string it replaces. */
34
+ export declare function slotKeysOf(template: unknown): Partial<Record<TextSlot, string>>;
35
+ //# sourceMappingURL=textSlots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textSlots.d.ts","sourceRoot":"","sources":["../../../src/triggers/host/textSlots.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,qDAAqD;AACrD,eAAO,MAAM,UAAU,6CAA8C,CAAC;AACtE,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAkCxC;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAc5D;AAED,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAO/H;AAMD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,OAAO,EACjB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,GACtC;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,QAAQ,EAAE,CAAA;CAAE,CAe1C;AAED,gGAAgG;AAChG,wBAAgB,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAI9D;AAED,iFAAiF;AACjF,wBAAgB,UAAU,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAQ/E"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Colour precedence, per token: the publisher's `appearance`, then the app's theme
3
+ * set in the portal (served as `ui.values.appearance`), then the look's colours,
4
+ * then the built-in default. A publisher colour is never overridden. Text follows the background: a
5
+ * background set without a text colour at the same level gets black or white
6
+ * ink for that background, never a text colour picked for another one.
7
+ *
8
+ * Only hex is accepted (`#RGB`, `#RRGGBB`, `#RRGGBBAA`): the formats every platform's
9
+ * AppearanceConfig parses, so one value is one colour everywhere. Anything else is
10
+ * skipped and the next source answers. Values reach the page through
11
+ * `style.setProperty`, never through markup.
12
+ */
13
+ import type { AppearanceConfig } from '../../types';
14
+ /** A template's `colors` block, as every trigger variant serves it. */
15
+ export interface TriggerColors {
16
+ background?: string;
17
+ accent?: string;
18
+ text?: string;
19
+ }
20
+ /** What a trigger reads from `appearance`: its seven colours and `colorScheme`; the sheet's slots do not apply. */
21
+ export type TriggerAppearance = Pick<AppearanceConfig, 'accentColor' | 'backgroundColor' | 'textColor' | 'secondaryTextColor' | 'trackColor' | 'onAccentColor' | 'backgroundEndColor' | 'colorScheme'>;
22
+ /**
23
+ * The app's theme as the portal stores it and `/config` serves it in `ui.values`:
24
+ * hex as the server writes it (8 digits are alpha first, as the sheet reads them).
25
+ */
26
+ export interface TriggerPortalTheme {
27
+ accentColor?: string;
28
+ /** The app's saved appearance mode (`light`, `dark` or `auto`). */
29
+ mode?: string;
30
+ /** The app's store icon (`media.appstoreIcon`). */
31
+ appIconUrl?: string;
32
+ }
33
+ export interface TriggerTheme {
34
+ background: string;
35
+ accent: string;
36
+ text: string;
37
+ /** Set only by the publisher; unset falls back to the text colour at the look's opacity. */
38
+ secondary?: string;
39
+ /** Set only by the publisher; unset falls back to the text colour at the look's opacity. */
40
+ track?: string;
41
+ /** Set only by the publisher; unset is black or white for the accent. */
42
+ onAccent?: string;
43
+ /** Set only by the publisher: a gradient's second stop. Unset is `background` (a solid card). */
44
+ backgroundEnd?: string;
45
+ }
46
+ /** The Figma palette every trigger shares. */
47
+ export declare const DEFAULT_TRIGGER_THEME: Readonly<TriggerTheme>;
48
+ /** Encore's light palette, used in the light scheme when nothing above it sets a colour. */
49
+ export declare const DEFAULT_LIGHT_TRIGGER_THEME: Readonly<TriggerTheme>;
50
+ export type TriggerScheme = 'light' | 'dark';
51
+ /**
52
+ * Light or dark for a trigger: the publisher's `colorScheme`, then the app's saved
53
+ * mode from the portal (`auto` follows the device, as `system` does), then dark. A
54
+ * value it does not know is skipped. Dark stays the default unless someone opts in.
55
+ */
56
+ export declare function resolveTriggerScheme(appearance: Pick<AppearanceConfig, 'colorScheme'> | undefined, portal: TriggerPortalTheme, prefersDark?: () => boolean): TriggerScheme;
57
+ /**
58
+ * `variant` is the look's dark colours (`colors`); `lightVariant` its light ones
59
+ * (`lightColors`). In the light scheme the look's dark colours never apply: the order
60
+ * is publisher, portal, the look's light colours, then Encore's light default.
61
+ */
62
+ export declare function resolveTriggerTheme(appearance: TriggerAppearance | undefined, darkVariant: TriggerColors, portal?: TriggerPortalTheme, scheme?: TriggerScheme, lightVariant?: TriggerColors): TriggerTheme;
63
+ /**
64
+ * The appearance tokens a trigger tree names (trigger SDUI contract §2.1), from the
65
+ * resolved palette. The accent is read as drawn: a translucent accent composited
66
+ * over the surface. `onAccent` is black or white, whichever reads on it;
67
+ * `inkOnAccent` is the surface itself when it is opaque and reaches 3:1 on the
68
+ * accent, as designed, else `onAccent`.
69
+ */
70
+ export declare function triggerTokens(theme: TriggerTheme): Readonly<Record<string, string>>;
71
+ /**
72
+ * The tokens that fell back to the text colour because the publisher left them
73
+ * unset. Only on these does a look's `opacity` apply: a colour the publisher chose is
74
+ * drawn exactly as chosen, never faded.
75
+ */
76
+ export declare function triggerFallbackTokens(theme: TriggerTheme): ReadonlySet<string>;
77
+ export interface TriggerIconValues {
78
+ icon: 'gift' | 'appIcon' | 'none';
79
+ appIconUrl?: string;
80
+ }
81
+ /**
82
+ * The icon a look draws, as host values: `icon` is `gift`, `appIcon` or `none`, and
83
+ * `appIconUrl` is the app's store icon when it is a safe image. `appIcon` without a
84
+ * usable icon draws the gift, and an icon this SDK does not know is the gift too.
85
+ */
86
+ export declare function triggerIconValues(asked: unknown, portal: TriggerPortalTheme): TriggerIconValues;
87
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/triggers/host/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIpD,uEAAuE;AACvE,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,mHAAmH;AACnH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,gBAAgB,EACd,aAAa,GACb,iBAAiB,GACjB,WAAW,GACX,oBAAoB,GACpB,YAAY,GACZ,eAAe,GACf,oBAAoB,GACpB,aAAa,CAChB,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,4FAA4F;IAC5F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4FAA4F;IAC5F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iGAAiG;IACjG,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,8CAA8C;AAC9C,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,YAAY,CAIvD,CAAC;AAEH,4FAA4F;AAC5F,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,YAAY,CAI7D,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC;AAU7C;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,IAAI,CAAC,gBAAgB,EAAE,aAAa,CAAC,GAAG,SAAS,EAC7D,MAAM,EAAE,kBAAkB,EAC1B,WAAW,GAAE,MAAM,OAA2B,GAC7C,aAAa,CAQf;AAyBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,iBAAiB,GAAG,SAAS,EACzC,WAAW,EAAE,aAAa,EAC1B,MAAM,CAAC,EAAE,kBAAkB,EAC3B,MAAM,GAAE,aAAsB,EAC9B,YAAY,GAAE,aAAkB,GAC/B,YAAY,CA6Bd;AA4BD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAoBnF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,YAAY,GAAG,WAAW,CAAC,MAAM,CAAC,CAK9E;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,kBAAkB,GACzB,iBAAiB,CAInB"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The longest any trigger waits before presenting or reading again: a deadline, a
3
+ * local midnight, a plug-in's `readAgainAt`. Further than this, it presents (or reads)
4
+ * at the cap, which works the time out afresh. The same cap on every platform.
5
+ */
6
+ export declare const MAX_REPRESENT_MS: number;
7
+ /** How long to wait for `at` from `now`: never negative, never past the cap. */
8
+ export declare function representDelay(at: number, now: number): number;
9
+ /** Epoch ms of the local midnight after `now`. */
10
+ export declare function nextLocalMidnight(now?: number): number;
11
+ //# sourceMappingURL=timers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timers.d.ts","sourceRoot":"","sources":["../../../src/triggers/host/timers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QAA0B,CAAC;AAExD,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,kDAAkD;AAClD,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,MAAmB,GAAG,MAAM,CAIlE"}