@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.
Files changed (269) 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 +108 -8
  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 +70 -33
  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 +994 -17
  56. package/types/api/generated/types.d.ts.map +1 -1
  57. package/types/api/models.d.ts +29 -8
  58. package/types/api/models.d.ts.map +1 -1
  59. package/types/api/offerBuilder.d.ts +51 -0
  60. package/types/api/offerBuilder.d.ts.map +1 -0
  61. package/types/core/Configuration.d.ts +9 -0
  62. package/types/core/Configuration.d.ts.map +1 -1
  63. package/types/core/Encore.d.ts +145 -3
  64. package/types/core/Encore.d.ts.map +1 -1
  65. package/types/core/OfferManager.d.ts +27 -5
  66. package/types/core/OfferManager.d.ts.map +1 -1
  67. package/types/core/PlacementBuilder.d.ts +6 -1
  68. package/types/core/PlacementBuilder.d.ts.map +1 -1
  69. package/types/core/SignalManager.d.ts.map +1 -1
  70. package/types/core/StorageManager.d.ts +3 -2
  71. package/types/core/StorageManager.d.ts.map +1 -1
  72. package/types/core/StrictUnlockReconciler.d.ts +1 -1
  73. package/types/core/StrictUnlockReconciler.d.ts.map +1 -1
  74. package/types/core/claimHandle.d.ts +44 -0
  75. package/types/core/claimHandle.d.ts.map +1 -0
  76. package/types/core/claimLog.d.ts +102 -0
  77. package/types/core/claimLog.d.ts.map +1 -0
  78. package/types/core/claimRefusal.d.ts +3 -0
  79. package/types/core/claimRefusal.d.ts.map +1 -0
  80. package/types/core/claimScreenVariant.d.ts +3 -0
  81. package/types/core/claimScreenVariant.d.ts.map +1 -0
  82. package/types/core/claimStatusCheck.d.ts +62 -0
  83. package/types/core/claimStatusCheck.d.ts.map +1 -0
  84. package/types/core/giftVariant.d.ts +5 -0
  85. package/types/core/giftVariant.d.ts.map +1 -1
  86. package/types/core/hostDisplay.d.ts +9 -2
  87. package/types/core/hostDisplay.d.ts.map +1 -1
  88. package/types/core/sduiVariables.d.ts +20 -0
  89. package/types/core/sduiVariables.d.ts.map +1 -0
  90. package/types/core/strings.d.ts +114 -0
  91. package/types/core/strings.d.ts.map +1 -0
  92. package/types/core/unlockCode.d.ts +12 -2
  93. package/types/core/unlockCode.d.ts.map +1 -1
  94. package/types/core/userKeys.d.ts +7 -0
  95. package/types/core/userKeys.d.ts.map +1 -0
  96. package/types/core/version.d.ts +1 -1
  97. package/types/experiments/ExposureOutbox.d.ts +1 -0
  98. package/types/experiments/ExposureOutbox.d.ts.map +1 -1
  99. package/types/preview.d.ts +51 -0
  100. package/types/preview.d.ts.map +1 -0
  101. package/types/react.d.ts +53 -1
  102. package/types/react.d.ts.map +1 -1
  103. package/types/sdui/actions.d.ts +93 -0
  104. package/types/sdui/actions.d.ts.map +1 -0
  105. package/types/sdui/bindings.d.ts +63 -0
  106. package/types/sdui/bindings.d.ts.map +1 -0
  107. package/types/sdui/compile.d.ts +88 -0
  108. package/types/sdui/compile.d.ts.map +1 -0
  109. package/types/sdui/conditions.d.ts +22 -0
  110. package/types/sdui/conditions.d.ts.map +1 -0
  111. package/types/sdui/context.d.ts +132 -0
  112. package/types/sdui/context.d.ts.map +1 -0
  113. package/types/sdui/countdown.d.ts +31 -0
  114. package/types/sdui/countdown.d.ts.map +1 -0
  115. package/types/sdui/decode.d.ts +35 -0
  116. package/types/sdui/decode.d.ts.map +1 -0
  117. package/types/sdui/deps.d.ts +43 -0
  118. package/types/sdui/deps.d.ts.map +1 -0
  119. package/types/sdui/dominantColor.d.ts +24 -0
  120. package/types/sdui/dominantColor.d.ts.map +1 -0
  121. package/types/sdui/elements/confetti.d.ts +38 -0
  122. package/types/sdui/elements/confetti.d.ts.map +1 -0
  123. package/types/sdui/elements/content.d.ts +27 -0
  124. package/types/sdui/elements/content.d.ts.map +1 -0
  125. package/types/sdui/elements/interactive.d.ts +48 -0
  126. package/types/sdui/elements/interactive.d.ts.map +1 -0
  127. package/types/sdui/elements/layout.d.ts +41 -0
  128. package/types/sdui/elements/layout.d.ts.map +1 -0
  129. package/types/sdui/elements/marquee.d.ts +17 -0
  130. package/types/sdui/elements/marquee.d.ts.map +1 -0
  131. package/types/sdui/elements/progress.d.ts +10 -0
  132. package/types/sdui/elements/progress.d.ts.map +1 -0
  133. package/types/sdui/elements/shared.d.ts +138 -0
  134. package/types/sdui/elements/shared.d.ts.map +1 -0
  135. package/types/sdui/elements/symbols.d.ts +22 -0
  136. package/types/sdui/elements/symbols.d.ts.map +1 -0
  137. package/types/sdui/elements/triggerText.d.ts +55 -0
  138. package/types/sdui/elements/triggerText.d.ts.map +1 -0
  139. package/types/sdui/host.d.ts +274 -0
  140. package/types/sdui/host.d.ts.map +1 -0
  141. package/types/sdui/inlineMarkup.d.ts +22 -0
  142. package/types/sdui/inlineMarkup.d.ts.map +1 -0
  143. package/types/sdui/lookValues.d.ts +50 -0
  144. package/types/sdui/lookValues.d.ts.map +1 -0
  145. package/types/sdui/model.d.ts +130 -0
  146. package/types/sdui/model.d.ts.map +1 -0
  147. package/types/sdui/motion.d.ts +37 -0
  148. package/types/sdui/motion.d.ts.map +1 -0
  149. package/types/sdui/precheck.d.ts +94 -0
  150. package/types/sdui/precheck.d.ts.map +1 -0
  151. package/types/sdui/scrollMath.d.ts +32 -0
  152. package/types/sdui/scrollMath.d.ts.map +1 -0
  153. package/types/sdui/style.d.ts +99 -0
  154. package/types/sdui/style.d.ts.map +1 -0
  155. package/types/sdui/triggerKit.d.ts +24 -0
  156. package/types/sdui/triggerKit.d.ts.map +1 -0
  157. package/types/sdui/unrunnable.d.ts +11 -0
  158. package/types/sdui/unrunnable.d.ts.map +1 -0
  159. package/types/sdui/vocabulary.d.ts +119 -0
  160. package/types/sdui/vocabulary.d.ts.map +1 -0
  161. package/types/triggers/claimReminder/ClaimReminder.d.ts +65 -0
  162. package/types/triggers/claimReminder/ClaimReminder.d.ts.map +1 -0
  163. package/types/triggers/claimReminder/bindings.d.ts +40 -0
  164. package/types/triggers/claimReminder/bindings.d.ts.map +1 -0
  165. package/types/triggers/claimReminder/config.d.ts +56 -0
  166. package/types/triggers/claimReminder/config.d.ts.map +1 -0
  167. package/types/triggers/claimReminder/eligibility.d.ts +37 -0
  168. package/types/triggers/claimReminder/eligibility.d.ts.map +1 -0
  169. package/types/triggers/claimReminder/servedWindow.d.ts +15 -0
  170. package/types/triggers/claimReminder/servedWindow.d.ts.map +1 -0
  171. package/types/triggers/claimReminder/source.d.ts +29 -0
  172. package/types/triggers/claimReminder/source.d.ts.map +1 -0
  173. package/types/triggers/giftsButton/GiftsButton.d.ts +60 -0
  174. package/types/triggers/giftsButton/GiftsButton.d.ts.map +1 -0
  175. package/types/triggers/giftsButton/config.d.ts +53 -0
  176. package/types/triggers/giftsButton/config.d.ts.map +1 -0
  177. package/types/triggers/giftsButton/spot.d.ts +54 -0
  178. package/types/triggers/giftsButton/spot.d.ts.map +1 -0
  179. package/types/triggers/host/TriggerHost.d.ts +127 -0
  180. package/types/triggers/host/TriggerHost.d.ts.map +1 -0
  181. package/types/triggers/host/autoPops.d.ts +16 -0
  182. package/types/triggers/host/autoPops.d.ts.map +1 -0
  183. package/types/triggers/host/configCache.d.ts +29 -0
  184. package/types/triggers/host/configCache.d.ts.map +1 -0
  185. package/types/triggers/host/customClaim.d.ts +85 -0
  186. package/types/triggers/host/customClaim.d.ts.map +1 -0
  187. package/types/triggers/host/dismissStore.d.ts +37 -0
  188. package/types/triggers/host/dismissStore.d.ts.map +1 -0
  189. package/types/triggers/host/readThrottle.d.ts +15 -0
  190. package/types/triggers/host/readThrottle.d.ts.map +1 -0
  191. package/types/triggers/host/registry.d.ts +17 -0
  192. package/types/triggers/host/registry.d.ts.map +1 -0
  193. package/types/triggers/host/sduiView.d.ts +31 -0
  194. package/types/triggers/host/sduiView.d.ts.map +1 -0
  195. package/types/triggers/host/template.d.ts +28 -0
  196. package/types/triggers/host/template.d.ts.map +1 -0
  197. package/types/triggers/host/textSlots.d.ts +35 -0
  198. package/types/triggers/host/textSlots.d.ts.map +1 -0
  199. package/types/triggers/host/theme.d.ts +87 -0
  200. package/types/triggers/host/theme.d.ts.map +1 -0
  201. package/types/triggers/host/timers.d.ts +11 -0
  202. package/types/triggers/host/timers.d.ts.map +1 -0
  203. package/types/triggers/host/types.d.ts +278 -0
  204. package/types/triggers/host/types.d.ts.map +1 -0
  205. package/types/triggers/host/wire.d.ts +55 -0
  206. package/types/triggers/host/wire.d.ts.map +1 -0
  207. package/types/triggers/preview.d.ts +78 -0
  208. package/types/triggers/preview.d.ts.map +1 -0
  209. package/types/triggers/request.d.ts +53 -0
  210. package/types/triggers/request.d.ts.map +1 -0
  211. package/types/types.d.ts +420 -4
  212. package/types/types.d.ts.map +1 -1
  213. package/types/ui/ClaimScreen.d.ts +62 -0
  214. package/types/ui/ClaimScreen.d.ts.map +1 -0
  215. package/types/ui/CodeUnlock.d.ts +26 -2
  216. package/types/ui/CodeUnlock.d.ts.map +1 -1
  217. package/types/ui/GiftHero.d.ts.map +1 -1
  218. package/types/ui/GiftList.d.ts.map +1 -1
  219. package/types/ui/GiftPicker.d.ts.map +1 -1
  220. package/types/ui/GiftPickerHero.d.ts.map +1 -1
  221. package/types/ui/GiftReveal.d.ts.map +1 -1
  222. package/types/ui/GiftSheet.d.ts +5 -5
  223. package/types/ui/GiftSheet.d.ts.map +1 -1
  224. package/types/ui/GiftUnwrap.d.ts.map +1 -1
  225. package/types/ui/OfferCard.d.ts.map +1 -1
  226. package/types/ui/OfferCarousel.d.ts.map +1 -1
  227. package/types/ui/OfferModal.d.ts +31 -6
  228. package/types/ui/OfferModal.d.ts.map +1 -1
  229. package/types/ui/PrimerScreen.d.ts +2 -0
  230. package/types/ui/PrimerScreen.d.ts.map +1 -1
  231. package/types/ui/RedemptionScreen.d.ts +5 -0
  232. package/types/ui/RedemptionScreen.d.ts.map +1 -1
  233. package/types/ui/RewardActions.d.ts.map +1 -1
  234. package/types/ui/RewardCard.d.ts.map +1 -1
  235. package/types/ui/SduiRewardSurface.d.ts +145 -0
  236. package/types/ui/SduiRewardSurface.d.ts.map +1 -0
  237. package/types/ui/Tooltip.d.ts.map +1 -1
  238. package/types/ui/brandComponents.d.ts.map +1 -1
  239. package/types/ui/brandTint.d.ts.map +1 -1
  240. package/types/ui/colorScheme.d.ts +15 -0
  241. package/types/ui/colorScheme.d.ts.map +1 -0
  242. package/types/ui/covered.d.ts +12 -0
  243. package/types/ui/covered.d.ts.map +1 -0
  244. package/types/ui/giftCategoryGroups.d.ts +13 -0
  245. package/types/ui/giftCategoryGroups.d.ts.map +1 -1
  246. package/types/ui/giftCopy.d.ts +14 -9
  247. package/types/ui/giftCopy.d.ts.map +1 -1
  248. package/types/ui/giftUnwrapCopy.d.ts.map +1 -1
  249. package/types/ui/imageURL.d.ts +44 -0
  250. package/types/ui/imageURL.d.ts.map +1 -0
  251. package/types/ui/impressionGate.d.ts +9 -0
  252. package/types/ui/impressionGate.d.ts.map +1 -1
  253. package/types/ui/offerBadge.d.ts.map +1 -1
  254. package/types/ui/rewardSurface.d.ts +11 -1
  255. package/types/ui/rewardSurface.d.ts.map +1 -1
  256. package/types/ui/sduiTheme.d.ts +48 -0
  257. package/types/ui/sduiTheme.d.ts.map +1 -0
  258. package/types/ui/sheetDetents.d.ts +28 -0
  259. package/types/ui/sheetDetents.d.ts.map +1 -0
  260. package/types/ui/styles.d.ts +11 -8
  261. package/types/ui/styles.d.ts.map +1 -1
  262. package/types/ui/termsLine.d.ts +3 -3
  263. package/types/ui/termsLine.d.ts.map +1 -1
  264. package/types/ui/toast.d.ts +11 -0
  265. package/types/ui/toast.d.ts.map +1 -0
  266. package/types/utils/logger.d.ts +10 -0
  267. package/types/utils/logger.d.ts.map +1 -1
  268. package/types/utils/text.d.ts +17 -0
  269. package/types/utils/text.d.ts.map +1 -1
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Dispatching the 11 actions, and the no-op an unknown one becomes.
3
+ *
4
+ * The engine resolves WHAT to do and the host does it. Everything here is a
5
+ * lookup against the evaluation context; nothing touches the network, the
6
+ * claim path or the sheet, because those belong to `Encore.ts` and differ
7
+ * between the surfaces this engine renders on.
8
+ *
9
+ * 🔴 ONE RULE WORTH STATING. `openUrl` names an OFFER ATTRIBUTE to read its link
10
+ * from. When that attribute is absent the action does NOTHING: it must never
11
+ * fall back to a literal URL, because a terms link pointing at the wrong
12
+ * advertiser is worse than no link. Swift's `openOfferLink` is a bare `guard let
13
+ * attribute = action.urlAttribute else { return }`.
14
+ *
15
+ * `share` is NOT that shape, and treating it as one gave both served share
16
+ * variants a dead button. Neither native reads `urlAttribute` for it: Swift
17
+ * delegates to `handleShare(offer, onSuccessState:)`, which resolves the link
18
+ * from the offer itself and fires a terminal event even when there is none, and
19
+ * Android calls `handler.share(offer, onSuccessState)`. `shareFromHeader` and
20
+ * `shareForLater` author `{"type": "share"}` with no attribute at all.
21
+ */
22
+ import type { SduiAction } from "./model";
23
+ import type { SduiEvaluationContext } from "./context";
24
+ /** Implemented by the host. Every method is optional so a surface may ignore one. */
25
+ export interface ActionHost {
26
+ close?(): void;
27
+ /**
28
+ * `onSuccessState` is the state the sheet moves to once the claim lands.
29
+ * Swift holds it as `pendingClaimSuccessState` and transitions on return, so
30
+ * a host that drops it can never show the post-claim screen. `streaksCarousel`
31
+ * is at rollout weight 100 and gates its whole success branch on this.
32
+ */
33
+ claimOffer?(offerId: string | undefined, onSuccessState: string | undefined): void;
34
+ openUrl?(url: string): void;
35
+ setState?(state: string): void;
36
+ setValue?(key: string, value: string): void;
37
+ selectOffer?(offerId: string, targetKey: string): void;
38
+ /**
39
+ * Move an offer to `index` BEFORE the selection is written.
40
+ *
41
+ * Swift promotes first so `selectOffer` resolves `currentIndex` against the
42
+ * list the user will see rather than the one it is replacing.
43
+ */
44
+ promoteOffer?(offerId: string, index: number): void;
45
+ setOfferIndex?(index: number, targetKey: string): void;
46
+ /** `onCancelAction` is the state to move to when the purchase is cancelled. */
47
+ triggerIAP?(onSuccessState: string | undefined, onCancelAction: string | undefined): void;
48
+ submitLead?(values: Readonly<Record<string, string>>, onSuccessState: string | undefined): void;
49
+ /**
50
+ * The HOST resolves the link, from the offer. The engine cannot: the SDK's
51
+ * offer carries no `shareUrl`, and the natives do not read one off the action.
52
+ */
53
+ share?(offerId: string | undefined, onSuccessState: string | undefined): void;
54
+ /**
55
+ * Trigger mounts only: open the sheet for this trigger, reporting `target`
56
+ * (`card`, `arrow` or `button`) on `sdk_trigger_clicked`. A sheet host leaves
57
+ * it unset, so the action stays the no-op it always was there.
58
+ */
59
+ trigger?(target: string): void;
60
+ /** Trigger mounts only: the host's dismiss (store plus `sdk_trigger_dismissed`). */
61
+ dismissTrigger?(): void;
62
+ /** The user says they finished the claimed offer. Only a TAP means this. */
63
+ reportCompletion?(offerId: string | undefined, onSuccessState: string | undefined): void;
64
+ }
65
+ /**
66
+ * Only http and https may be navigated to.
67
+ *
68
+ * This is the engine's job, not the host's: the engine is the layer that knows
69
+ * the string came from a served template. Images already go through
70
+ * `safeImageSrc` and colours through `sanitizeColor`; an action URL had no
71
+ * guard at all, so `javascript:alert(1)` reached the host verbatim.
72
+ */
73
+ export declare function safeActionUrl(raw: string | undefined): string | undefined;
74
+ /**
75
+ * Resolve the link an `openUrl` or `share` should use.
76
+ *
77
+ * `urlAttribute` reads the scoped offer and returns undefined when the offer
78
+ * carries nothing. A literal `url` is used ONLY when no attribute was named.
79
+ */
80
+ export declare function resolveActionUrl(action: SduiAction, ctx: SduiEvaluationContext): string | undefined;
81
+ /**
82
+ * The index a `setOfferIndex` moves to, or undefined for a no-op.
83
+ *
84
+ * `offerIndex` is absolute and out of range is a no-op. `offerIndexDelta` is
85
+ * relative to the focused card and clamped into the list.
86
+ */
87
+ export declare function resolveOfferIndex(action: SduiAction, ctx: SduiEvaluationContext): number | undefined;
88
+ /**
89
+ * Runs an action. Returns whether the host actually handled it. An error in the
90
+ * action or the host is logged here, never thrown into the host page's click.
91
+ */
92
+ export declare function dispatch(action: SduiAction, ctx: SduiEvaluationContext, host: ActionHost): boolean;
93
+ //# sourceMappingURL=actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/sdui/actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAMvD,qFAAqF;AACrF,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,IAAI,IAAI,CAAC;IACf;;;;;OAKG;IACH,UAAU,CAAC,CACT,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC,IAAI,CAAC;IACR,OAAO,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IA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apB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,qBAAqB,GACzB,MAAM,GAAG,SAAS,CAcpB;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,qBAAqB,EAC1B,IAAI,EAAE,UAAU,GACf,OAAO,CAOT"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Text and image binding resolution, and `${variable}` substitution.
3
+ *
4
+ * The fallbacks here are not decoration. A binding that resolves to nothing
5
+ * returns `""` for offer copy (the element simply renders empty) but a real
6
+ * string for the three context bindings, because a sheet with no title reads as
7
+ * a broken integration rather than as an offer without a perk.
8
+ */
9
+ import type { SduiCreativeBinding, SduiTextBinding } from "./vocabulary";
10
+ import type { SduiInstructionStep, SduiOfferBindingData, SduiTextDefaults } from "./context";
11
+ export declare const FALLBACK_CTA_TEXT = "Get";
12
+ export declare const FALLBACK_CLAIM_TEXT = "Claim";
13
+ export declare const FALLBACK_TITLE_TEXT = "Get 1 month";
14
+ /** Leading space is deliberate: this is concatenated onto the title. */
15
+ export declare const FALLBACK_ACCENT_TITLE_TEXT = " for free";
16
+ export declare const FALLBACK_SUBTITLE_TEXT = "Claim an exclusive offer and get free access to all features";
17
+ /**
18
+ * `${variable}` substitution, in two passes.
19
+ *
20
+ * 1. `variables`, the immutable session context (remote config, entitlements,
21
+ * IAP product data).
22
+ * 2. `values`, the mutable state dictionary, so a variant can write
23
+ * `${selectedAdvertiserName}` in bottom copy and have it follow the tap.
24
+ *
25
+ * The second pass is skipped unless a token survives the first, which is the
26
+ * common case. The guard avoids scanning every value for every string.
27
+ */
28
+ export declare function resolveTemplate(text: string, variables: Readonly<Record<string, string>>, values?: Readonly<Record<string, string>>): string;
29
+ /**
30
+ * Resolve a text binding.
31
+ *
32
+ * The offer-scoped bindings read `offer`; inside a `forEach` the caller passes
33
+ * the ROW offer, elsewhere the current one. The context bindings ignore it.
34
+ */
35
+ export declare function resolveTextBinding(binding: SduiTextBinding, offer: SduiOfferBindingData | undefined, defaults: SduiTextDefaults, category?: string, step?: SduiInstructionStep): string;
36
+ export declare function resolveCreativeUrl(binding: SduiCreativeBinding, offer: SduiOfferBindingData | undefined, step?: SduiInstructionStep): string | undefined;
37
+ /** Inputs to {@link resolveText}, gathered so the signature stays readable. */
38
+ export interface TextResolutionInput {
39
+ readonly valueKey?: string;
40
+ readonly textMapKey?: string;
41
+ readonly textMapValueKey?: string;
42
+ readonly textBinding?: SduiTextBinding;
43
+ readonly text?: string;
44
+ }
45
+ /**
46
+ * Full text resolution for a `text` node. First match wins:
47
+ *
48
+ * 1. `valueKey` into `values`, then template-resolved.
49
+ * 2. `textMapKey` into `textMaps[map][values[textMapValueKey ?? map]]`, then
50
+ * template-resolved. A MISS falls through rather than rendering empty.
51
+ * 3. `textBinding`.
52
+ * 4. template-resolved static `text`.
53
+ */
54
+ export declare function resolveText(config: TextResolutionInput, args: {
55
+ readonly values: Readonly<Record<string, string>>;
56
+ readonly textMaps: Readonly<Record<string, Readonly<Record<string, string>>>>;
57
+ readonly variables: Readonly<Record<string, string>>;
58
+ readonly offer?: SduiOfferBindingData;
59
+ readonly defaults: SduiTextDefaults;
60
+ readonly category?: string;
61
+ readonly step?: SduiInstructionStep;
62
+ }): string;
63
+ //# sourceMappingURL=bindings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindings.d.ts","sourceRoot":"","sources":["../../src/sdui/bindings.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,WAAW,CAAC;AAEnB,eAAO,MAAM,iBAAiB,QAAQ,CAAC;AACvC,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAC3C,eAAO,MAAM,mBAAmB,gBAAgB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MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CACjD,CAAC;IACF,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,KAAK,CAAC,EAAE,oBAAoB,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,mBAAmB,CAAC;CACrC,GACA,MAAM,CA2BR"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * The compile pass: tree in, DOM out, plus a registry of update sites.
3
+ *
4
+ * 🔴 WHY THIS IS NOT AN INTERPRETER. Both natives re-read the tree on every
5
+ * render, because SwiftUI and Compose rebuild declaratively and diff for you.
6
+ * The DOM does not. Replacing a subtree destroys state the BROWSER owns: a
7
+ * focused `textField` loses its caret, a `scrollView` loses its offset (which
8
+ * breaks `scrollTargetLayout` and the page indicator), a video restarts, an
9
+ * in-flight drag is dropped, and a CSS transition cannot run because the node it
10
+ * would animate is gone. Diffing instead would mean a virtual DOM, and this SDK
11
+ * ships zero runtime dependencies.
12
+ *
13
+ * 🔴 A SITE CARRIES ITS SCOPE, AND ITS LIFETIME.
14
+ *
15
+ * Both halves were missing at first and both were wrong in the same way: the
16
+ * site list was flat, so a site registered while compiling a `forEach` row ran
17
+ * later against the TREE context. Every row then resolved `scopedOffer` to
18
+ * `offers[currentIndex]` and rendered the same offer, which is every list and
19
+ * carousel variant silently wrong. A site therefore stores the scope it was
20
+ * compiled under, and `run` applies it.
21
+ *
22
+ * Lifetime is the same bug one step on. Sites for a dropped row or an unmounted
23
+ * branch used to stay in the list for ever, running against detached nodes and
24
+ * holding them alive. Sites now belong to a GROUP that can be deactivated or
25
+ * dropped with the DOM it drives.
26
+ */
27
+ import type { SduiNode, SduiTemplate } from "./model";
28
+ import type { SduiElementName } from "./vocabulary";
29
+ import type { SduiEvaluationContext } from "./context";
30
+ import type { Dependency } from "./deps";
31
+ /** Thrown when the tree names an element no renderer has been registered for. */
32
+ export declare class SduiCompileError extends Error {
33
+ constructor(message: string);
34
+ }
35
+ /** Narrows the tree context to what a site was compiled under. */
36
+ export type Scope = (ctx: SduiEvaluationContext) => SduiEvaluationContext;
37
+ interface Group {
38
+ readonly id: number;
39
+ readonly parent: Group | undefined;
40
+ active: boolean;
41
+ }
42
+ interface SiteEntry {
43
+ readonly deps: readonly Dependency[];
44
+ readonly scope: Scope;
45
+ readonly group: Group;
46
+ run(ctx: SduiEvaluationContext): void;
47
+ }
48
+ /** What a renderer returns. `update` is folded into the registry as a site. */
49
+ export interface Rendered {
50
+ readonly node: Node;
51
+ readonly deps?: readonly Dependency[];
52
+ update?(ctx: SduiEvaluationContext): void;
53
+ }
54
+ /** Services a renderer needs from the compiler, so renderers stay leaf-shaped. */
55
+ export interface CompileServices {
56
+ /** Compile a child node, registering its sites under the current scope. */
57
+ compileChild(node: SduiNode, ctx: SduiEvaluationContext): Rendered;
58
+ /**
59
+ * Register an extra site, for a renderer that needs more than the one its
60
+ * `Rendered` carries. It takes the CURRENT scope and group, like any other.
61
+ */
62
+ addSite(site: {
63
+ deps: readonly Dependency[];
64
+ run(ctx: SduiEvaluationContext): void;
65
+ }): void;
66
+ readonly document: Document;
67
+ }
68
+ export type ElementRenderer = (node: SduiNode, ctx: SduiEvaluationContext, services: CompileServices) => Rendered;
69
+ export declare class ElementRegistry {
70
+ #private;
71
+ register(name: SduiElementName, renderer: ElementRenderer): this;
72
+ get(name: SduiElementName): ElementRenderer | undefined;
73
+ get registered(): readonly SduiElementName[];
74
+ }
75
+ /** A compiled tree. `update` re-runs only live sites whose dependencies moved. */
76
+ export declare class CompiledTree {
77
+ #private;
78
+ readonly root: Node;
79
+ constructor(root: Node, sites: SiteEntry[]);
80
+ /** Live sites. A dropped row's sites are gone, not merely skipped. */
81
+ get siteCount(): number;
82
+ /** Sites that would actually run, i.e. whose group chain is active. */
83
+ get activeSiteCount(): number;
84
+ update(ctx: SduiEvaluationContext, changed?: Iterable<Dependency>): number;
85
+ }
86
+ export declare function compile(template: SduiTemplate, ctx: SduiEvaluationContext, registry: ElementRegistry, doc?: Document): CompiledTree;
87
+ export {};
88
+ //# sourceMappingURL=compile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/sdui/compile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAiB,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,qBAAqB,EAAuB,MAAM,WAAW,CAAC;AAK5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEzC,iFAAiF;AACjF,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,OAAO,EAAE,MAAM;CAI5B;AAED,kEAAkE;AAClE,MAAM,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,qBAAqB,KAAK,qBAAqB,CAAC;AAI1E,UAAU,KAAK;IACb,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,KAAK,GAAG,SAAS,CAAC;IACnC,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,UAAU,SAAS;IACjB,QAAQ,CAAC,IAAI,EAAE,SAAS,UAAU,EAAE,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,GAAG,CAAC,GAAG,EAAE,qBAAqB,GAAG,IAAI,CAAC;CACvC;AAKD,+EAA+E;AAC/E,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,I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AG,EAAE,qBAAqB,EAC1B,QAAQ,EAAE,eAAe,EACzB,GAAG,GAAE,QAAmB,GACvB,YAAY,CA+Sd"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Condition evaluation.
3
+ *
4
+ * Pure and total: every branch returns a boolean and nothing throws. Recursion
5
+ * follows the authored JSON, which the backend's variant validation bounds.
6
+ *
7
+ * Three rules carry the weight, and all three are easy to get subtly wrong:
8
+ *
9
+ * 1. `hasValue` tests PRESENCE, not non-emptiness. An empty string counts.
10
+ * 2. `equals` with two UNSET operands is NOT a match. `offerAttribute` made
11
+ * that the common case: most campaigns carry no badge, so comparing a row's
12
+ * badge against an unwritten binding would be true on exactly the rows that
13
+ * have no badge.
14
+ * 3. A value ref that resolves to nothing is `undefined`, never `""`, so an
15
+ * `equals` against an authored empty string is false rather than a match.
16
+ */
17
+ import type { SduiCondition, SduiValueRef } from "./model";
18
+ import type { SduiEvaluationContext } from "./context";
19
+ /** Resolves an operand to a comparable string, or undefined when it holds nothing. */
20
+ export declare function resolveValueRef(ref: SduiValueRef, ctx: SduiEvaluationContext): string | undefined;
21
+ export declare function evaluate(condition: SduiCondition, ctx: SduiEvaluationContext): boolean;
22
+ //# sourceMappingURL=conditions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditions.d.ts","sourceRoot":"","sources":["../../src/sdui/conditions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAO3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAGvD,sFAAsF;AACtF,wBAAgB,eAAe,CAC7B,GAAG,EAAE,YAAY,EACjB,GAAG,EAAE,qBAAqB,GACzB,MAAM,GAAG,SAAS,CAiBpB;AAqCD,wBAAgB,QAAQ,CACtB,SAAS,EAAE,aAAa,EACxB,GAAG,EAAE,qBAAqB,GACzB,OAAO,CA+GT"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Everything a condition or binding can read, as plain data.
3
+ *
4
+ * Offers are held in DISPLAY order, after `offerDisplayOrder` has been applied,
5
+ * so every position predicate operates in the space the user actually sees.
6
+ * They are whole offers rather than ids, because `offerAttribute` reads a row's
7
+ * own campaign fields: passing positions without the attributes that go with
8
+ * them resolved every attribute to null on Android, with nothing to say so.
9
+ *
10
+ * This is the engine's own shape, not the SDK's offer model. Commit 8 maps one
11
+ * to the other at the host boundary, which is what keeps this file pure.
12
+ */
13
+ /** Applied when `initialState` is absent. */
14
+ export declare const DEFAULT_STATE = "default";
15
+ /** Default key written by `selectOffer` when no `targetKey` is given. */
16
+ export declare const DEFAULT_SELECTION_KEY = "selectedOfferId";
17
+ export interface SduiInstructionStep {
18
+ readonly title?: string;
19
+ readonly subtitle?: string;
20
+ readonly ctaButtonText?: string;
21
+ readonly imageUrl?: string;
22
+ /** 1-based, assigned AFTER the blank steps are dropped so there are no gaps. */
23
+ readonly position?: number;
24
+ }
25
+ export interface SduiOfferBindingData {
26
+ readonly id: string;
27
+ readonly advertiserName?: string;
28
+ /** `primaryCreative.description`, the advertiser copy shown on the card. */
29
+ readonly description?: string;
30
+ readonly perk?: string;
31
+ readonly ctaText?: string;
32
+ readonly newPrice?: string;
33
+ readonly oldPrice?: string;
34
+ readonly primaryImageUrl?: string;
35
+ readonly logoUrl?: string;
36
+ /** The promo badge as it arrives, `free_trial` or `discount`. */
37
+ readonly badgeLabel?: string;
38
+ readonly category?: string;
39
+ readonly heroImageUrl?: string;
40
+ readonly shareUrl?: string;
41
+ readonly termsUrl?: string;
42
+ readonly quickInstructions?: string;
43
+ readonly instructions?: readonly SduiInstructionStep[];
44
+ /** Admin copy by key, read by `propertyKey`. Blank values are already absent. */
45
+ readonly displayProperties?: Readonly<Record<string, string>>;
46
+ }
47
+ /** Copy that is not offer-scoped. Absent entries fall back to the constants in `bindings.ts`. */
48
+ export interface SduiTextDefaults {
49
+ readonly titleText?: string;
50
+ readonly accentTitleText?: string;
51
+ readonly subtitleText?: string;
52
+ /** `offerCtaText` with no offer bound (`card.get`), and for an offer with none (`card.claim`). */
53
+ readonly getText?: string;
54
+ readonly claimText?: string;
55
+ /** Chip labels by category group key, as Swift's `giftCategory` translates them. */
56
+ readonly categoryLabels?: Readonly<Record<string, string>>;
57
+ /** The accessible name of a button that holds only this symbol, by symbol name. */
58
+ readonly symbolLabels?: Readonly<Record<string, string>>;
59
+ }
60
+ export interface SduiEvaluationContext {
61
+ readonly offers: readonly SduiOfferBindingData[];
62
+ /** Index of the centred card, or undefined when nothing is current. */
63
+ readonly currentIndex?: number;
64
+ readonly currentState: string;
65
+ readonly values: Readonly<Record<string, string>>;
66
+ /** The flag the renderer threads down for `isCurrentPageBinding`. */
67
+ readonly isCurrentPage: boolean;
68
+ /** The `forEach` row's offer id; undefined outside a row. */
69
+ readonly rowOfferId?: string;
70
+ /** The `categories` forEach chip's category; undefined outside one. */
71
+ readonly rowCategory?: string;
72
+ /** The `instructions` forEach step; undefined outside one. */
73
+ readonly rowStep?: SduiInstructionStep;
74
+ /**
75
+ * IAP product facts. False whenever no product info was fetched, which matches
76
+ * iOS evaluating against a nil product.
77
+ */
78
+ readonly hasIntroOffer: boolean;
79
+ readonly hasFreeTrial: boolean;
80
+ /** Logo URL to extracted brand colour, filled in as extractions land. */
81
+ readonly dominantColors?: Readonly<Record<string, string>>;
82
+ /** The host app's icon, whose colour is `appDominantColor`. */
83
+ readonly appIconUrl?: string;
84
+ /**
85
+ * Trigger mounts only: the host's named lists (`forEach` `hostList`), each a
86
+ * list of string maps, e.g. `marqueeLogos: [{ logoUrl }]`.
87
+ */
88
+ readonly lists?: Readonly<Record<string, readonly SduiHostListItem[]>>;
89
+ /** The `hostList` row's item; undefined outside one. Read as `${item.<field>}`. */
90
+ readonly rowItem?: SduiHostListItem;
91
+ /** Trigger mounts only: the host's time keys (`start`, `deadline`), ms since the epoch. */
92
+ readonly times?: Readonly<Record<string, number>>;
93
+ /** Trigger mounts only: the host's clock, ms since the epoch, advanced by `setNow`. */
94
+ readonly now?: number;
95
+ /** Trigger mounts only, set by the host: loops and marquees hold still. */
96
+ readonly motionPaused?: boolean;
97
+ /** Trigger mounts only: the platform's reduce-motion setting, read by the host. */
98
+ readonly reduceMotion?: boolean;
99
+ }
100
+ /** One entry of a trigger host's list. */
101
+ export type SduiHostListItem = Readonly<Record<string, string>>;
102
+ /** The `${item.<field>}` keys a `hostList` row exposes, as values. */
103
+ export declare function itemValues(item: SduiHostListItem): Record<string, string>;
104
+ export declare function emptyContext(over?: Partial<SduiEvaluationContext>): SduiEvaluationContext;
105
+ /**
106
+ * The row's offer inside a `forEach`, else the SELECTED one, else the current
107
+ * card.
108
+ *
109
+ * Selection beats index, matching Swift's `currentOffer` (`SDUIContext.swift:227`).
110
+ * Resolving index-first is what left a congratulations screen blank and a claim
111
+ * button inert after a pick made somewhere other than the centred card. Android
112
+ * resolves index-first and documents it as a known gap against iOS; Swift is
113
+ * canonical, so this follows Swift.
114
+ */
115
+ export declare function scopedOfferId(ctx: SduiEvaluationContext): string | undefined;
116
+ /**
117
+ * Index of the scoped offer, or undefined outside a row with no current offer,
118
+ * so position predicates are false there rather than accidentally zero.
119
+ */
120
+ export declare function scopedOfferIndex(ctx: SduiEvaluationContext): number | undefined;
121
+ export declare function scopedOffer(ctx: SduiEvaluationContext): SduiOfferBindingData | undefined;
122
+ /** The row-scoped view used when rendering a `forEach` item. */
123
+ export declare function forRow(ctx: SduiEvaluationContext, offerId: string, isCurrentPage?: boolean): SduiEvaluationContext;
124
+ /**
125
+ * The values a colour resolves against: `values`, plus the two logo colours.
126
+ *
127
+ * Swift's `colorValues`. `offerDominantColor` is the row's offer, else the
128
+ * current one, and `selectedOfferDominantColor` is the selected logo. Each is
129
+ * set only once a real colour exists, so the JSON `fallback` paints until then.
130
+ */
131
+ export declare function colorValues(ctx: SduiEvaluationContext): Readonly<Record<string, string>>;
132
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1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AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,qBAAqB,GAAG,MAAM,GAAG,SAAS,CAO5E;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,qBAAqB,GACzB,MAAM,GAAG,SAAS,CAKpB;AAED,wBAAgB,WAAW,CACzB,GAAG,EAAE,qBAAqB,GACzB,oBAAoB,GAAG,SAAS,CAGlC;AAED,gEAAgE;AAChE,wBAAgB,MAAM,CACpB,GAAG,EAAE,qBAAqB,EAC1B,OAAO,EAAE,MAAM,EACf,aAAa,GAAE,OAA2B,GACzC,qBAAqB,CAEvB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,qBAAqB,GACzB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAoBlC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Time arithmetic for a trigger mount's `text.countdown` and `progress` (trigger
3
+ * vocabulary contract v1, §3.1 and §3.2). Pure: the host owns the clock and the
4
+ * time keys, and hands both in.
5
+ */
6
+ /** The host's time keys (`start`, `deadline`), as ms since the epoch. */
7
+ export type SduiTimes = Readonly<Record<string, number>>;
8
+ /**
9
+ * Whole seconds from `now` to `to`, floored and clamped at 0. Non-finite input,
10
+ * or more than ten years left, is 0.
11
+ */
12
+ export declare function remainingSeconds(to: number | undefined, now: number | undefined): number;
13
+ /**
14
+ * The countdown text for `seconds` left. `clock` is `HH:MM:SS` (hours may pass
15
+ * 99); `hoursMinutes` is `HH:MM`, the clock without its seconds (minutes floored); `hours`, `minutes` and `seconds` are that part alone, two digits;
16
+ * `largestUnit` is `"<n> <unit>"` for the largest non-zero part, with the unit
17
+ * text from `units` (already resolved).
18
+ */
19
+ export declare function formatCountdown(format: unknown, seconds: number, units: Readonly<{
20
+ hours?: string;
21
+ minutes?: string;
22
+ seconds?: string;
23
+ }>): string;
24
+ /**
25
+ * A `progress.value`, clamped to 0..1: `{ timeRemaining: { from, to } }` is
26
+ * `(to - now) / (to - from)`, draining to 0; `{ literal: n }` is `n`. Anything
27
+ * the engine cannot read (a missing time key, an empty window, another shape)
28
+ * is 0, so the bar draws empty rather than failing.
29
+ */
30
+ export declare function progressFraction(value: unknown, times: SduiTimes | undefined, now: number | undefined): number;
31
+ //# sourceMappingURL=countdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"countdown.d.ts","sourceRoot":"","sources":["../../src/sdui/countdown.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,yEAAyE;AACzE,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,MAAM,GAAG,SAAS,EACtB,GAAG,EAAE,MAAM,GAAG,SAAS,GACtB,MAAM,CAKR;AAID;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,QAAQ,CAAC;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GACtE,MAAM,CAqBR;AASD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,SAAS,GAAG,SAAS,EAC5B,GAAG,EAAE,MAAM,GAAG,SAAS,GACtB,MAAM,CAiBR"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Strict decode of a served SDUI template.
3
+ *
4
+ * 🔴 THE ONE RULE, and it is asymmetric on purpose:
5
+ *
6
+ * - An unknown enum VALUE, element name or condition name FAILS the whole
7
+ * config. A variant naming something this build cannot render is a variant
8
+ * this build must not render PARTLY: half a sheet is worse than the
9
+ * hard-coded fallback, and it is invisible in analytics.
10
+ * - An unknown FIELD is IGNORED. That is what lets the backend add a field
11
+ * and roll it out before every client ships, which is the whole point of
12
+ * `min_sdk_versions` gating values rather than fields.
13
+ *
14
+ * Both natives behave this way; web must match or the same variant renders on
15
+ * three clients and fails on one.
16
+ *
17
+ * Failure is a throw, not a null. The caller catches, keeps its hard-coded
18
+ * surface, and reports. A null return would invite a silent `?? fallback` at
19
+ * one call site and an unchecked deref at the next.
20
+ */
21
+ import type { SduiTemplate } from "./model";
22
+ /** Thrown for anything the closed sets reject. `path` locates it in the tree. */
23
+ export declare class SduiDecodeError extends Error {
24
+ readonly path: string;
25
+ constructor(message: string, path: string);
26
+ }
27
+ /**
28
+ * Decode a template served under `ui.template` or `useCases[x].template`.
29
+ *
30
+ * @throws {SduiDecodeError} on any closed-set violation.
31
+ */
32
+ export declare function decodeTemplate(raw: unknown, options?: {
33
+ readonly trigger?: boolean;
34
+ }): SduiTemplate;
35
+ //# sourceMappingURL=decode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../src/sdui/decode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAiDH,OAAO,KAAK,EAKV,YAAY,EAEb,MAAM,SAAS,CAAC;AAEjB,iFAAiF;AACjF,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBACV,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAK1C;AAkcD;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,OAAO,EACZ,OAAO,GAAE;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GAC3C,YAAY,CAQd"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * What a binding READS, so an update can touch only what changed.
3
+ *
4
+ * This is the half of "compile once, then bind" that makes the second half
5
+ * cheap. Every update site records its dependencies at compile time, and a
6
+ * state change invalidates only the sites that named the thing that moved.
7
+ * Without this the engine would walk the whole tree per change, which is the
8
+ * interpret model the DOM cannot afford.
9
+ *
10
+ * Dependencies are strings rather than an enum because `value:` is parameterised
11
+ * by key, and a variant may write any key it likes. Over-reporting is safe (a
12
+ * site updates when it need not); under-reporting is a stale screen, so every
13
+ * derivation below errs toward listing more.
14
+ */
15
+ import type { SduiCondition, SduiValueRef } from "./model";
16
+ export type Dependency = string;
17
+ /** The current state name. */
18
+ export declare const DEP_STATE = "state";
19
+ /** The offers list itself: length, order, membership. */
20
+ export declare const DEP_OFFERS = "offers";
21
+ /** Which card is current. */
22
+ export declare const DEP_INDEX = "index";
23
+ /** The row scope a `forEach` item renders under. */
24
+ export declare const DEP_ROW = "row";
25
+ /** IAP product facts. Fetched once, but not always before first paint. */
26
+ export declare const DEP_IAP = "iap";
27
+ /** A trigger host's lists (`hostList`, `listCountAtLeast`). */
28
+ export declare const DEP_LISTS = "lists";
29
+ /** A trigger host's clock and time keys (`countdown`, `progress`). */
30
+ export declare const DEP_TIME = "time";
31
+ /** A trigger host's motion flags (`motionPaused`, `reduceMotion`). */
32
+ export declare const DEP_MOTION = "motion";
33
+ /** One entry of the mutable values dictionary. */
34
+ export declare const depValue: (key: string) => Dependency;
35
+ /**
36
+ * What a colour binding reads. The two logo colours also move with the offer
37
+ * they are scoped to, so they depend on that too.
38
+ */
39
+ export declare function colorKeyDeps(keys: readonly string[]): Dependency[];
40
+ export declare function valueRefDeps(ref: SduiValueRef): Dependency[];
41
+ /** Every dependency a condition tree reads, deduplicated. */
42
+ export declare function conditionDeps(condition: SduiCondition): Dependency[];
43
+ //# sourceMappingURL=deps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../../src/sdui/deps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE3D,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC,8BAA8B;AAC9B,eAAO,MAAM,SAAS,UAAU,CAAC;AACjC,yDAAyD;AACzD,eAAO,MAAM,UAAU,WAAW,CAAC;AACnC,6BAA6B;AAC7B,eAAO,MAAM,SAAS,UAAU,CAAC;AACjC,oDAAoD;AACpD,eAAO,MAAM,OAAO,QAAQ,CAAC;AAC7B,0EAA0E;AAC1E,eAAO,MAAM,OAAO,QAAQ,CAAC;AAC7B,+DAA+D;AAC/D,eAAO,MAAM,SAAS,UAAU,CAAC;AACjC,sEAAsE;AACtE,eAAO,MAAM,QAAQ,SAAS,CAAC;AAC/B,sEAAsE;AACtE,eAAO,MAAM,UAAU,WAAW,CAAC;AACnC,kDAAkD;AAClD,eAAO,MAAM,QAAQ,GAAI,KAAK,MAAM,KAAG,UAA4B,CAAC;AAEpE;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,UAAU,EAAE,CAQlE;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,YAAY,GAAG,UAAU,EAAE,CAe5D;AAED,6DAA6D;AAC7D,wBAAgB,aAAa,CAAC,SAAS,EAAE,aAAa,GAAG,UAAU,EAAE,CAIpE"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Reduce RGBA pixels to `#RRGGBB`, or `null` for a white or transparent logo.
3
+ *
4
+ * The pixels are premultiplied first, because Swift draws into a premultiplied
5
+ * context and a canvas hands back straight alpha.
6
+ */
7
+ export declare function dominantHexFromPixels(data: Uint8ClampedArray): string | null;
8
+ /**
9
+ * Load a logo and reduce it. Resolves `null` on every failure: a host that
10
+ * sends no CORS header, a decode error, a timeout, or no 2D canvas (jsdom).
11
+ */
12
+ export declare function extractDominantHex(url: string, doc?: Document): Promise<string | null>;
13
+ /** The colours already known, so a second presentation paints on frame one. */
14
+ export declare function knownDominantColors(): Record<string, string>;
15
+ /**
16
+ * Extract once per URL, and report each colour that lands.
17
+ *
18
+ * A URL that yields nothing is not cached, which is what Swift does: it tries
19
+ * again on the next presentation.
20
+ */
21
+ export declare function requestDominantColors(urls: readonly string[], extract: (url: string) => Promise<string | null>, onColor: (url: string, hex: string) => void): void;
22
+ /** @internal Tests only. */
23
+ export declare function resetDominantColorsForTests(): void;
24
+ //# sourceMappingURL=dominantColor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dominantColor.d.ts","sourceRoot":"","sources":["../../src/sdui/dominantColor.ts"],"names":[],"mappings":"AAgBA;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAsE5E;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,GAAG,GAAE,QAAmB,GACvB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAuCxB;AAMD,+EAA+E;AAC/E,wBAAgB,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,EAChD,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,GAC1C,IAAI,CAkBN;AAED,4BAA4B;AAC5B,wBAAgB,2BAA2B,IAAI,IAAI,CAGlD"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * The SDUI `confetti` burst, with Swift's `ConfettiEmitterUIView` numbers: it
3
+ * emits `intensity` pieces a second for `duration` seconds, from a line across
4
+ * the top or from a point, and each piece falls for up to 7.5 seconds.
5
+ *
6
+ * The settled `scatter` layer is not drawn. No served variant uses it.
7
+ */
8
+ export interface ConfettiSpec {
9
+ colors: readonly string[];
10
+ intensity: number;
11
+ duration: number;
12
+ originY: number;
13
+ originX: number | undefined;
14
+ }
15
+ interface Piece {
16
+ born: number;
17
+ life: number;
18
+ x: number;
19
+ y: number;
20
+ vx: number;
21
+ vy: number;
22
+ spin: number;
23
+ rotation: number;
24
+ scale: number;
25
+ color: string;
26
+ round: boolean;
27
+ }
28
+ /** Swift's `configure` clamps, applied to the served values. */
29
+ export declare function confettiSpec(props: Readonly<Record<string, unknown>>, color: (hex: string) => string | undefined): ConfettiSpec;
30
+ /** Every piece the burst will emit, with its birth time in seconds. */
31
+ export declare function emitPieces(spec: ConfettiSpec, width: number, height: number): Piece[];
32
+ /**
33
+ * Draw the burst into `host` and remove the canvas when the last piece is gone.
34
+ * Returns a stop function. Does nothing where a canvas cannot run.
35
+ */
36
+ export declare function runConfetti(host: HTMLElement, spec: ConfettiSpec): () => void;
37
+ export {};
38
+ //# sourceMappingURL=confetti.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confetti.d.ts","sourceRoot":"","sources":["../../../src/sdui/elements/confetti.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAgBH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B;AAED,UAAU,KAAK;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB;AAKD,gEAAgE;AAChE,wBAAgB,YAAY,CAC1B,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACxC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GACzC,YAAY,CAkBd;AAED,uEAAuE;AACvE,wBAAgB,UAAU,CACxB,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,KAAK,EAAE,CA+BT;AAKD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM,IAAI,CA6D7E"}