@encorekit/web-sdk 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +102 -4
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/umd/encore.min.js +1 -1
- package/dist/umd/encore.min.js.map +1 -1
- package/package.json +2 -1
- package/types/analytics/DiagnosticsOutbox.d.ts +22 -0
- package/types/analytics/DiagnosticsOutbox.d.ts.map +1 -0
- package/types/analytics/ReliableOutbox.d.ts +40 -0
- package/types/analytics/ReliableOutbox.d.ts.map +1 -0
- package/types/analytics/events.d.ts +120 -3
- package/types/analytics/events.d.ts.map +1 -1
- package/types/analytics/placementResolved.d.ts +150 -0
- package/types/analytics/placementResolved.d.ts.map +1 -0
- package/types/api/APIClient.d.ts +7 -1
- package/types/api/APIClient.d.ts.map +1 -1
- package/types/api/generated/types.d.ts +6 -1
- package/types/api/generated/types.d.ts.map +1 -1
- package/types/core/Configuration.d.ts +5 -0
- package/types/core/Configuration.d.ts.map +1 -1
- package/types/core/Encore.d.ts +40 -1
- package/types/core/Encore.d.ts.map +1 -1
- package/types/core/OfferManager.d.ts +29 -3
- package/types/core/OfferManager.d.ts.map +1 -1
- package/types/core/PlacementBuilder.d.ts +12 -0
- package/types/core/PlacementBuilder.d.ts.map +1 -1
- package/types/core/StrictUnlock.d.ts +20 -0
- package/types/core/StrictUnlock.d.ts.map +1 -0
- package/types/core/StrictUnlockReconciler.d.ts +94 -0
- package/types/core/StrictUnlockReconciler.d.ts.map +1 -0
- package/types/core/useCase.d.ts +21 -0
- package/types/core/useCase.d.ts.map +1 -1
- package/types/core/version.d.ts +1 -1
- package/types/experiments/ExposureOutbox.d.ts +4 -28
- package/types/experiments/ExposureOutbox.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/types.d.ts +92 -3
- package/types/types.d.ts.map +1 -1
- package/types/ui/OfferCard.d.ts +3 -1
- package/types/ui/OfferCard.d.ts.map +1 -1
- package/types/ui/OfferCarousel.d.ts +13 -0
- package/types/ui/OfferCarousel.d.ts.map +1 -1
- package/types/ui/OfferModal.d.ts +25 -1
- package/types/ui/OfferModal.d.ts.map +1 -1
- package/types/ui/RewardActions.d.ts +24 -0
- package/types/ui/RewardActions.d.ts.map +1 -1
- package/types/ui/RewardLayout.d.ts +16 -0
- package/types/ui/RewardLayout.d.ts.map +1 -1
- package/types/ui/appearance.d.ts +168 -0
- package/types/ui/appearance.d.ts.map +1 -0
- package/types/ui/cssSafe.d.ts +34 -0
- package/types/ui/cssSafe.d.ts.map +1 -0
- package/types/ui/styles.d.ts +21 -1
- package/types/ui/styles.d.ts.map +1 -1
- package/types/utils/text.d.ts +14 -0
- package/types/utils/text.d.ts.map +1 -1
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Publisher appearance slots — how a publisher replaces what the reward sheet renders.
|
|
3
|
+
*
|
|
4
|
+
* THE SHAPE OF THE API. This is a vanilla-DOM SDK, so "component" here means what it
|
|
5
|
+
* means in the DOM: an `HTMLElement`, or a function that is handed context and returns
|
|
6
|
+
* one. Each overridable slot therefore accepts a three-member union, from easiest to
|
|
7
|
+
* most powerful:
|
|
8
|
+
*
|
|
9
|
+
* 1. a STYLE CONFIG object — `{ text, color, fontFamily, … }`, the 90% case, no DOM
|
|
10
|
+
* knowledge required and the SDK's own element (and its accessibility wiring)
|
|
11
|
+
* is kept;
|
|
12
|
+
* 2. an `HTMLElement` — render whatever you want, once;
|
|
13
|
+
* 3. a `(ctx) => HTMLElement` RENDERER — the same, but per presentation, with the
|
|
14
|
+
* resolved copy, the use case and the SDK's own default element in hand so you
|
|
15
|
+
* can decorate rather than replace.
|
|
16
|
+
*
|
|
17
|
+
* A union rather than one object with a `render?` member: the three are genuinely
|
|
18
|
+
* exclusive, and a union makes "you styled it AND replaced it" unrepresentable instead
|
|
19
|
+
* of a silently-ignored field.
|
|
20
|
+
*
|
|
21
|
+
* TWO INVARIANTS THIS FILE EXISTS TO HOLD.
|
|
22
|
+
*
|
|
23
|
+
* 1. **A publisher can never crash the sheet.** Every renderer runs inside
|
|
24
|
+
* `safeRender`, every value goes through `cssSafe`, and every failure — a throw, a
|
|
25
|
+
* non-element return, a malformed colour — falls back to the SDK's default element.
|
|
26
|
+
* An SDK that takes down the host page it monetises is worse than an unstyled one.
|
|
27
|
+
*
|
|
28
|
+
* 2. **The SDK owns the action.** For the CTA and decline slots the publisher supplies
|
|
29
|
+
* APPEARANCE ONLY. Their element is mounted inside an SDK-owned host that is the
|
|
30
|
+
* real control: the host carries the role, the tab stop and the listener, and the
|
|
31
|
+
* listener runs in the CAPTURE phase and then stops propagation — so it fires
|
|
32
|
+
* strictly BEFORE any handler the publisher attached to their own element, and
|
|
33
|
+
* theirs never runs at all. Capture at an ancestor always precedes listeners on the
|
|
34
|
+
* target, so this is not a race we win by ordering, it is one the DOM cannot let us
|
|
35
|
+
* lose. `pointer-events: none` on their element closes the same door for real
|
|
36
|
+
* pointer input. See `createActionSlot`.
|
|
37
|
+
*/
|
|
38
|
+
import type { UseCase } from '../types';
|
|
39
|
+
/** What a renderer is handed. Everything the SDK knows about the slot it is filling. */
|
|
40
|
+
export interface AppearanceSlotContext {
|
|
41
|
+
/**
|
|
42
|
+
* The copy the SDK resolved for this slot, after its own priority chain
|
|
43
|
+
* (per-call override > backend-resolved copy > built-in fallback). Empty string
|
|
44
|
+
* when the slot has no text (a decorative slot, or copy that resolved to nothing).
|
|
45
|
+
*/
|
|
46
|
+
text: string;
|
|
47
|
+
/** Why the sheet is presenting. */
|
|
48
|
+
useCase: UseCase;
|
|
49
|
+
/**
|
|
50
|
+
* The element the SDK would have rendered. Mutate and return it to decorate rather
|
|
51
|
+
* than replace — that keeps the SDK's classes, and with them every default style and
|
|
52
|
+
* accessibility attribute.
|
|
53
|
+
*/
|
|
54
|
+
defaultElement: HTMLElement;
|
|
55
|
+
}
|
|
56
|
+
/** A per-presentation renderer. Returning nothing keeps the SDK's default. */
|
|
57
|
+
export type AppearanceRenderer = (context: AppearanceSlotContext) => HTMLElement | null | undefined;
|
|
58
|
+
/** Styled-text override for a text slot. Every field is optional. */
|
|
59
|
+
export interface TextAppearance {
|
|
60
|
+
/** Replacement copy. Blank or whitespace-only falls through to the resolved copy. */
|
|
61
|
+
text?: string;
|
|
62
|
+
color?: string;
|
|
63
|
+
fontFamily?: string;
|
|
64
|
+
fontSize?: string;
|
|
65
|
+
fontWeight?: string | number;
|
|
66
|
+
letterSpacing?: string;
|
|
67
|
+
textAlign?: 'left' | 'center' | 'right' | 'start' | 'end';
|
|
68
|
+
}
|
|
69
|
+
/** Styled override for a button slot — the text fields plus the button's own box. */
|
|
70
|
+
export interface ButtonAppearance extends TextAppearance {
|
|
71
|
+
backgroundColor?: string;
|
|
72
|
+
borderColor?: string;
|
|
73
|
+
borderRadius?: string;
|
|
74
|
+
}
|
|
75
|
+
/** A headline / subheadline slot. */
|
|
76
|
+
export type TextSlot = TextAppearance | HTMLElement | AppearanceRenderer;
|
|
77
|
+
/** A CTA / decline slot. The SDK always keeps the action — see the file header. */
|
|
78
|
+
export type ButtonSlot = ButtonAppearance | HTMLElement | AppearanceRenderer;
|
|
79
|
+
/** Apply the text fields of a style config to an element. Copy is handled by callers. */
|
|
80
|
+
export declare function applyTextAppearance(el: HTMLElement, cfg: TextAppearance): void;
|
|
81
|
+
/** Apply a button style config: the text fields plus the button's own box. */
|
|
82
|
+
export declare function applyButtonAppearance(el: HTMLElement, cfg: ButtonAppearance): void;
|
|
83
|
+
/**
|
|
84
|
+
* Fill a text slot.
|
|
85
|
+
*
|
|
86
|
+
* The SDK's semantic element (an `h2` / `p` carrying the class, and for the headline
|
|
87
|
+
* the id the dialog's `aria-labelledby` points at) is ALWAYS the element that gets
|
|
88
|
+
* returned. A custom element is mounted INSIDE it rather than replacing it, because
|
|
89
|
+
* the id and role are load-bearing: `RewardLayout` warns that a reward sheet without a
|
|
90
|
+
* heading is a dialog with no accessible name, and letting a publisher delete that
|
|
91
|
+
* element is letting them delete the accessible name.
|
|
92
|
+
*
|
|
93
|
+
* A custom element is announced by its own content; when it has none — an image, an
|
|
94
|
+
* SVG, a canvas — the wrapper takes the resolved copy as its `aria-label` so the
|
|
95
|
+
* dialog is still named. The SDK's default typography is dropped in that case
|
|
96
|
+
* (`--custom` modifier) so it cannot fight the publisher's own.
|
|
97
|
+
*
|
|
98
|
+
* @param element the SDK's default element, already carrying its class/id and text
|
|
99
|
+
* @param text the copy the SDK resolved, for the renderer context and the a11y fallback
|
|
100
|
+
*/
|
|
101
|
+
export declare function fillTextSlot(element: HTMLElement, text: string, useCase: UseCase, slot: TextSlot | undefined): HTMLElement;
|
|
102
|
+
/**
|
|
103
|
+
* The copy a text slot will actually render, WITHOUT building anything.
|
|
104
|
+
*
|
|
105
|
+
* Needed because the headline is the dialog's accessible name and is resolved before
|
|
106
|
+
* the layout exists. A style config's `text` is the top tier of the same chain
|
|
107
|
+
* `PlacementOptions.headline` sits in; an element or renderer slot contributes no
|
|
108
|
+
* string, so the resolved copy stands as the a11y fallback.
|
|
109
|
+
*/
|
|
110
|
+
export declare function textSlotOverride(slot: TextSlot | undefined): string | undefined;
|
|
111
|
+
export interface ActionSlotOptions {
|
|
112
|
+
/** The SDK class that carries the slot's default styling. */
|
|
113
|
+
className: string;
|
|
114
|
+
/** The SDK's copy for the button, and the accessible name a custom element falls back to. */
|
|
115
|
+
label: string;
|
|
116
|
+
/** The SDK behaviour. Runs on every activation, before anything the publisher wired up. */
|
|
117
|
+
onActivate: () => void;
|
|
118
|
+
/**
|
|
119
|
+
* Whether the control acts. Defaults true. `false` renders it visibly unavailable and
|
|
120
|
+
* attaches NO activation listener, which is what makes the gate real rather than
|
|
121
|
+
* cosmetic — there is no handler to reach, so no publisher element, stray dispatch or
|
|
122
|
+
* synthetic `.click()` can claim through a disabled CTA.
|
|
123
|
+
*
|
|
124
|
+
* The two paths express it differently because they have to. A `<button>` gets the
|
|
125
|
+
* native `disabled` property, which the `:disabled` rules already style and which
|
|
126
|
+
* drops the tab stop for free. A host `<div role="button">` cannot be `disabled` at
|
|
127
|
+
* all — the attribute is meaningless on a non-form element and `:disabled` never
|
|
128
|
+
* matches it — so it gets `aria-disabled="true"`, styled through the matching
|
|
129
|
+
* `[aria-disabled='true']` rule, and its tab stop removed by hand.
|
|
130
|
+
*/
|
|
131
|
+
enabled?: boolean;
|
|
132
|
+
useCase: UseCase;
|
|
133
|
+
slot?: ButtonSlot;
|
|
134
|
+
}
|
|
135
|
+
/** A built action slot. `setAccessibleName` re-points the control's `aria-label`. */
|
|
136
|
+
export interface ActionSlot {
|
|
137
|
+
element: HTMLElement;
|
|
138
|
+
setAccessibleName: (name: string | undefined) => void;
|
|
139
|
+
/**
|
|
140
|
+
* Detach the SDK's listeners and release the publisher's element.
|
|
141
|
+
*
|
|
142
|
+
* Not optional housekeeping: the host's listener closes over `onActivate`, which
|
|
143
|
+
* reaches the carousel, the modal and the whole offer graph. A publisher who caches
|
|
144
|
+
* the element they passed would otherwise keep one presentation's entire object
|
|
145
|
+
* graph alive for the life of the page.
|
|
146
|
+
*/
|
|
147
|
+
destroy: () => void;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Build the claim / decline control.
|
|
151
|
+
*
|
|
152
|
+
* ABSENT OR STYLE-CONFIG SLOT → the SDK's own `<button>`, byte-identical to what it
|
|
153
|
+
* has always rendered (plus inline styles, when a config was given).
|
|
154
|
+
*
|
|
155
|
+
* ELEMENT OR RENDERER SLOT → the publisher's element mounted inside an SDK-owned host
|
|
156
|
+
* that IS the control:
|
|
157
|
+
* - the host carries `role="button"`, the single tab stop, and the accessible name;
|
|
158
|
+
* - the SDK's listener is registered on the host in the CAPTURE phase and calls
|
|
159
|
+
* `stopImmediatePropagation()`, so it runs before — and instead of — anything the
|
|
160
|
+
* publisher attached to their own element or its descendants. This is a property
|
|
161
|
+
* of DOM dispatch (capture at an ancestor precedes the target's own listeners),
|
|
162
|
+
* not a convention, so a publisher cannot swallow or pre-empt the claim;
|
|
163
|
+
* - the publisher's element gets `pointer-events: none` and every focusable node
|
|
164
|
+
* inside it is taken out of the tab order, so real input never reaches it either
|
|
165
|
+
* and the sheet keeps exactly one tab stop per control.
|
|
166
|
+
*/
|
|
167
|
+
export declare function createActionSlot(options: ActionSlotOptions): ActionSlot;
|
|
168
|
+
//# sourceMappingURL=appearance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appearance.d.ts","sourceRoot":"","sources":["../../src/ui/appearance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAgBxC,wFAAwF;AACxF,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,cAAc,EAAE,WAAW,CAAC;CAC7B;AAED,8EAA8E;AAC9E,MAAM,MAAM,kBAAkB,GAAG,CAC/B,OAAO,EAAE,qBAAqB,KAC3B,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;AAEpC,qEAAqE;AACrE,MAAM,WAAW,cAAc;IAC7B,qFAAqF;IACrF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC;CAC3D;AAED,qFAAqF;AACrF,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACtD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,qCAAqC;AACrC,MAAM,MAAM,QAAQ,GAAG,cAAc,GAAG,WAAW,GAAG,kBAAkB,CAAC;AAEzE,mFAAmF;AACnF,MAAM,MAAM,UAAU,GAAG,gBAAgB,GAAG,WAAW,GAAG,kBAAkB,CAAC;AAwF7E,yFAAyF;AACzF,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,cAAc,GAAG,IAAI,CAO9E;AAED,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,gBAAgB,GAAG,IAAI,CASlF;AAmBD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,QAAQ,GAAG,SAAS,GACzB,WAAW,CAoBb;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAE/E;AAMD,MAAM,WAAW,iBAAiB;IAChC,6DAA6D;IAC7D,SAAS,EAAE,MAAM,CAAC;IAClB,6FAA6F;IAC7F,KAAK,EAAE,MAAM,CAAC;IACd,2FAA2F;IAC3F,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,qFAAqF;AACrF,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,WAAW,CAAC;IACrB,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IACtD;;;;;;;OAOG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,UAAU,CAoGvE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Value guards for every CSS value a PUBLISHER hands the SDK — appearance colours,
|
|
3
|
+
* fonts, sizes. The same role `safeImageSrc.ts` plays for remote image URLs, and the
|
|
4
|
+
* same contract: recognised values pass through UNCHANGED, everything else returns
|
|
5
|
+
* `undefined` and the caller keeps its default.
|
|
6
|
+
*
|
|
7
|
+
* WHY THIS IS NOT PARANOIA. `styles.ts`'s `getBaseStyles()` interpolates theme values
|
|
8
|
+
* into a template literal that becomes a `<style>` element's textContent, so a value
|
|
9
|
+
* containing `;` or `}` does not produce a broken declaration — it CLOSES ours and
|
|
10
|
+
* opens a new rule in the host page's stylesheet. `appearance.backgroundColor` has
|
|
11
|
+
* been reaching that literal unfiltered. Publisher config is not attacker input in the
|
|
12
|
+
* usual sense, but it is frequently *remote* config a publisher renders from their own
|
|
13
|
+
* CMS, and an SDK that lets a CMS field rewrite the host page's CSS is a supply-chain
|
|
14
|
+
* hole regardless of who typed it.
|
|
15
|
+
*
|
|
16
|
+
* The grammars below are ALLOW-lists, deliberately narrower than CSS. A rejected value
|
|
17
|
+
* is a publisher typo or an attack; either way falling back to the SDK default is the
|
|
18
|
+
* right answer, and it is the one that cannot take the sheet down.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* A colour the SDK is willing to write into a stylesheet or an inline style.
|
|
22
|
+
* Returns the ORIGINAL trimmed string on success — never a normalised rewrite, so a
|
|
23
|
+
* publisher's value renders as the publisher wrote it.
|
|
24
|
+
*/
|
|
25
|
+
export declare function sanitizeColor(value: unknown): string | undefined;
|
|
26
|
+
/** A font stack. */
|
|
27
|
+
export declare function sanitizeFontFamily(value: unknown): string | undefined;
|
|
28
|
+
/** A length with an explicit unit (`16px`, `1.25rem`, `100%`). Unitless is rejected. */
|
|
29
|
+
export declare function sanitizeLength(value: unknown): string | undefined;
|
|
30
|
+
/** A font weight: a keyword, or a number in [1, 1000]. */
|
|
31
|
+
export declare function sanitizeFontWeight(value: unknown): string | undefined;
|
|
32
|
+
/** One of the alignment keywords the sheet's text slots support. */
|
|
33
|
+
export declare function sanitizeTextAlign(value: unknown): string | undefined;
|
|
34
|
+
//# sourceMappingURL=cssSafe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cssSafe.d.ts","sourceRoot":"","sources":["../../src/ui/cssSafe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAmGH;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAQhE;AAED,oBAAoB;AACpB,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAKrE;AAED,wFAAwF;AACxF,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAKjE;AAED,0DAA0D;AAC1D,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAerE;AAED,oEAAoE;AACpE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAKpE"}
|
package/types/ui/styles.d.ts
CHANGED
|
@@ -73,6 +73,26 @@ export declare const BREAKPOINTS: {
|
|
|
73
73
|
* z-index 1 so it clears the confetti canvas, matching the variant's zStack order
|
|
74
74
|
* (confetti → content).
|
|
75
75
|
*/
|
|
76
|
+
/**
|
|
77
|
+
* APPEARANCE_SLOT_NOTES — why the `slot-custom` / `slot-host` rules look the way they
|
|
78
|
+
* do. A JS comment, not a CSS one, for the reason REWARD_VISUAL_NOTES gives above:
|
|
79
|
+
* prose inside the template literal is payload every user downloads.
|
|
80
|
+
*
|
|
81
|
+
* Both classes exist ONLY when a publisher supplied a custom element for a slot (see
|
|
82
|
+
* `ui/appearance.ts`), so nothing here can reach a default sheet.
|
|
83
|
+
*
|
|
84
|
+
* `slot-custom` wraps custom headline/subheadline content in the SDK's own `h2`/`p` —
|
|
85
|
+
* the heading id is the dialog's accessible name and must survive — so it resets that
|
|
86
|
+
* element's typography to `inherit`, letting the publisher's content define its own
|
|
87
|
+
* type without the SDK's title scale fighting it.
|
|
88
|
+
*
|
|
89
|
+
* `slot-host` is the SDK-owned control that wraps a custom CTA/decline element. It
|
|
90
|
+
* KEEPS the `reward-cta-*` class for layout (the CTA stack's full-width box) and strips
|
|
91
|
+
* that class's paint — gradient, border, height, padding — so the publisher's element
|
|
92
|
+
* is what the user sees. The `:hover`/`:active` resets are needed because
|
|
93
|
+
* `.reward-cta-primary:hover` is a two-class selector: same specificity as the reset,
|
|
94
|
+
* so the block MUST stay after the CTA rules in source order.
|
|
95
|
+
*/
|
|
76
96
|
/**
|
|
77
97
|
* The reward sheet's brand pair, read off the Figma (frame 18304:2399).
|
|
78
98
|
*
|
|
@@ -128,7 +148,7 @@ export declare function removeStyles(): void;
|
|
|
128
148
|
/**
|
|
129
149
|
* Update theme variables dynamically
|
|
130
150
|
*/
|
|
131
|
-
export declare function updateTheme(
|
|
151
|
+
export declare function updateTheme(rawTheme: ThemeVariables): void;
|
|
132
152
|
/**
|
|
133
153
|
* Get class name with prefix
|
|
134
154
|
*/
|
package/types/ui/styles.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/ui/styles.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/ui/styles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,eAAO,MAAM,OAAO;;;CAGV,CAAC;AAGX,eAAO,MAAM,WAAW;;;;CAId,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,YAAY,CAAC;AACtC,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAC3C,6DAA6D;AAC7D,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAE1C;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB;;;;IAI/B,0FAA0F;;CAElF,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAyuDD;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,GAAE,cAAmB,GAAG,IAAI,CAgB7D;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAMnC;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAe1D;AAED;;GAEG;AACH,wBAAgB,EAAE,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAE/C;AAED;;GAEG;AACH,wBAAgB,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7C"}
|
package/types/utils/text.d.ts
CHANGED
|
@@ -21,4 +21,18 @@
|
|
|
21
21
|
* consume its 4px gap.
|
|
22
22
|
*/
|
|
23
23
|
export declare function firstNonBlank(...values: (string | null | undefined)[]): string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* The placement id as it goes on the wire — trimmed, capped at 64 chars, and
|
|
26
|
+
* `undefined` when nothing usable is left.
|
|
27
|
+
*
|
|
28
|
+
* ONE function because the id travels TWO paths that must agree byte for byte: the
|
|
29
|
+
* `/offers/search` request body (which the backend stamps onto `sdk_offer_requested`)
|
|
30
|
+
* and the `placement_id` property on every offer-funnel event. If one trims and the
|
|
31
|
+
* other does not, `Encore.placement(' cancel_flow ')` writes `" cancel_flow "` on
|
|
32
|
+
* the request row and `"cancel_flow"` on the funnel rows — two warehouse buckets for
|
|
33
|
+
* one placement, which is exactly the split the cap exists to prevent. Worse for a
|
|
34
|
+
* blank-but-not-empty id: `' '` survives the backend's `NULLIF(...,'')` on one path
|
|
35
|
+
* and folds to `(unlabeled)` on the other.
|
|
36
|
+
*/
|
|
37
|
+
export declare function normalizePlacementId(placementId: string | undefined): string | undefined;
|
|
24
38
|
//# sourceMappingURL=text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/utils/text.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAAC,GAAG,MAAM,EAAE,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,GAAG,MAAM,GAAG,SAAS,CAM1F"}
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/utils/text.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAAC,GAAG,MAAM,EAAE,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,GAAG,MAAM,GAAG,SAAS,CAM1F;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAMxF"}
|