@encorekit/web-sdk 2.0.1 → 2.0.3
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 +1 -1
- package/types/analytics/events.d.ts +20 -3
- package/types/analytics/events.d.ts.map +1 -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/Encore.d.ts +4 -1
- package/types/core/Encore.d.ts.map +1 -1
- package/types/core/OfferManager.d.ts +1 -1
- package/types/core/OfferManager.d.ts.map +1 -1
- package/types/core/version.d.ts +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/types.d.ts +50 -1
- package/types/types.d.ts.map +1 -1
- package/types/ui/OfferCarousel.d.ts +8 -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 +15 -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 +154 -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 +46 -16
- 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
package/types/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":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CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AACH,wDAAwD;GACtD;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAAE;AACpD,8DAA8D;GAC5D;IAAE,MAAM,EAAE,aAAa,CAAA;CAAE,CAAC;AAE9B;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,eAAe,GAAG,WAAW,GAAG,YAAY,GAAG,aAAa,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IACnF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAMD;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC"}
|
|
@@ -45,6 +45,14 @@ export interface OfferCarouselOptions {
|
|
|
45
45
|
* Off by default, so the churn-intervention and thankYou carousels are untouched.
|
|
46
46
|
*/
|
|
47
47
|
selectable?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Publisher colours for the compact page indicator: the inactive dots and the active
|
|
50
|
+
* one. Written as CSS custom properties on the indicator element, so an unset value
|
|
51
|
+
* falls back — in the stylesheet, via `var(…, <default>)` — to exactly the colour the
|
|
52
|
+
* indicator has always used. Sanitized before they are written.
|
|
53
|
+
*/
|
|
54
|
+
dotColor?: string;
|
|
55
|
+
dotActiveColor?: string;
|
|
48
56
|
}
|
|
49
57
|
interface CarouselEventMap extends Record<string, unknown> {
|
|
50
58
|
offerClaim: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OfferCarousel.d.ts","sourceRoot":"","sources":["../../src/ui/OfferCarousel.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"OfferCarousel.d.ts","sourceRoot":"","sources":["../../src/ui/OfferCarousel.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAQhD,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC;IAC9B;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAQD,UAAU,gBAAiB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACxD,UAAU,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,YAAY,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAChC,SAAS,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C;;;;;;;OAOG;IACH,MAAM,EAAE;QAAE,IAAI,EAAE,YAAY,GAAG,UAAU,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9D,QAAQ,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAC/B;;;;;OAKG;IACH,WAAW,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9C;AAED,qBAAa,aAAa;;gBAsEZ,MAAM,EAAE,KAAK,EAAE,EAAE,QAAQ,CAAC,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,oBAAoB;IAmBvF;;OAEG;IACH,MAAM,IAAI,WAAW;IA8PrB;;OAEG;IACH,EAAE,CAAC,CAAC,SAAS,MAAM,gBAAgB,EACjC,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,GAC9C,MAAM,IAAI;IAIb;;OAEG;IACH,eAAe,IAAI,MAAM;IAIzB;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;;;OAIG;IACH,IAAI,IAAI,IAAI;IAUZ;;;;;OAKG;IACH,gBAAgB,IAAI,KAAK,GAAG,SAAS;IAIrC;;;;;;;;;;OAUG;IACH,aAAa,IAAI,IAAI;IASrB;;;;;OAKG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAiBhC;;OAEG;IACH,QAAQ,IAAI,IAAI;IA4nBhB;;OAEG;IACH,OAAO,IAAI,IAAI;CA2BhB"}
|
package/types/ui/OfferModal.d.ts
CHANGED
|
@@ -9,9 +9,33 @@ interface ModalEventMap extends Record<string, unknown> {
|
|
|
9
9
|
show: void;
|
|
10
10
|
hide: void;
|
|
11
11
|
}
|
|
12
|
+
export interface OfferModalOptions {
|
|
13
|
+
/**
|
|
14
|
+
* The floating × in the corner. Defaults to `true` — every composition that has no
|
|
15
|
+
* explicit dismissal control of its own needs it, and `reduceChurn` (per-card Claim,
|
|
16
|
+
* no decline button) is exactly that case.
|
|
17
|
+
*
|
|
18
|
+
* The reward composition passes `false`: `streaksCarousel.json` renders a "No thanks"
|
|
19
|
+
* secondary CTA as its decline affordance, and two dismissal controls on one sheet is
|
|
20
|
+
* one too many — the × sat over the sheet's top-right on mobile, competing with the
|
|
21
|
+
* headline for the same corner. Nothing about dismissal SEMANTICS changes with it:
|
|
22
|
+
* "No thanks" already took the identical `close` path (see `dismissAsClosed` in
|
|
23
|
+
* `Encore.ts`), so the same `sdk_sdui_button_tapped(close)`, the same
|
|
24
|
+
* `endPresentation('userClosedModal')` and the same `decline_reason: 'close_button'`
|
|
25
|
+
* are emitted whichever control is used. Escape and backdrop-click are untouched and
|
|
26
|
+
* remain on every composition.
|
|
27
|
+
*/
|
|
28
|
+
showCloseButton?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Publisher override for the modal container's background, applied INLINE on the
|
|
31
|
+
* modal element. Narrower than the `backgroundColor` theme variable, which also moves
|
|
32
|
+
* every surface derived from it. Sanitized — an unrecognised value is ignored.
|
|
33
|
+
*/
|
|
34
|
+
backgroundColor?: string;
|
|
35
|
+
}
|
|
12
36
|
export declare class OfferModal {
|
|
13
37
|
#private;
|
|
14
|
-
constructor(theme?: ThemeVariables);
|
|
38
|
+
constructor(theme?: ThemeVariables, options?: OfferModalOptions);
|
|
15
39
|
/**
|
|
16
40
|
* Create and show the modal
|
|
17
41
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OfferModal.d.ts","sourceRoot":"","sources":["../../src/ui/OfferModal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"OfferModal.d.ts","sourceRoot":"","sources":["../../src/ui/OfferModal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,UAAU,aAAc,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACrD,KAAK,EAAE,IAAI,CAAC;IACZ,aAAa,EAAE,IAAI,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;;;;;OAcG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,qBAAa,UAAU;;gBAaT,KAAK,GAAE,cAAmB,EAAE,OAAO,GAAE,iBAAsB;IASvE;;OAEG;IACH,IAAI,IAAI,IAAI;IAqCZ;;OAEG;IACH,IAAI,IAAI,IAAI;IAyBZ;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAI/B;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IA4BtC;;OAEG;IACH,EAAE,CAAC,CAAC,SAAS,MAAM,aAAa,EAC9B,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,GAC3C,MAAM,IAAI;IA2Jb;;OAEG;IACH,OAAO,IAAI,IAAI;CAOhB"}
|
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
* once per sheet, and neither has a second subscriber. The emitter would be
|
|
20
20
|
* ceremony around a pair of function calls.
|
|
21
21
|
*/
|
|
22
|
+
import type { UseCase } from '../types';
|
|
23
|
+
import { type ButtonSlot } from './appearance';
|
|
22
24
|
/** Copy the variant hard-codes. Named so the tests can assert parity by symbol. */
|
|
23
25
|
export declare const REWARD_COPY: {
|
|
24
26
|
readonly trust: "No charges until trial ends, cancel anytime.";
|
|
@@ -36,6 +38,19 @@ export interface RewardActionsOptions {
|
|
|
36
38
|
* is the variant's copy, not a universal truth.
|
|
37
39
|
*/
|
|
38
40
|
trustText?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Publisher appearance for the two buttons: styled config, a ready element, or a
|
|
43
|
+
* renderer.
|
|
44
|
+
*
|
|
45
|
+
* APPEARANCE ONLY — `onClaim` and `onDecline` above stay the behaviour, whatever the
|
|
46
|
+
* publisher supplies. A custom element is mounted inside an SDK-owned control whose
|
|
47
|
+
* listener fires in the capture phase, so the claim/decline runs first and any
|
|
48
|
+
* handler on the publisher's element never runs at all. See `createActionSlot`.
|
|
49
|
+
*/
|
|
50
|
+
claimSlot?: ButtonSlot;
|
|
51
|
+
declineSlot?: ButtonSlot;
|
|
52
|
+
/** Context handed to the slot renderers. */
|
|
53
|
+
useCase?: UseCase;
|
|
39
54
|
}
|
|
40
55
|
export declare class RewardActions {
|
|
41
56
|
#private;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RewardActions.d.ts","sourceRoot":"","sources":["../../src/ui/RewardActions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;
|
|
1
|
+
{"version":3,"file":"RewardActions.d.ts","sourceRoot":"","sources":["../../src/ui/RewardActions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAqC,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAElF,mFAAmF;AACnF,eAAO,MAAM,WAAW;;;;CAId,CAAC;AAEX,MAAM,WAAW,oBAAoB;IACnC,oEAAoE;IACpE,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,wDAAwD;IACxD,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,qBAAa,aAAa;;gBAwBZ,OAAO,EAAE,oBAAoB;IAIzC,MAAM,IAAI,WAAW;IA6CrB;;;;;;;;;;;;OAYG;IACH,gBAAgB,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI;IAW/C,OAAO,IAAI,IAAI;CAWhB"}
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* whole visual system — including the `--reward` parity rules that track the native
|
|
13
13
|
* SDKs' `streaksCarousel.json` type scale — for no behavioural gain.
|
|
14
14
|
*/
|
|
15
|
+
import type { UseCase } from '../types';
|
|
16
|
+
import { type TextSlot } from './appearance';
|
|
15
17
|
/**
|
|
16
18
|
* The id given to the status heading so the dialog's accessible name can point at
|
|
17
19
|
* the chrome's real primary heading (the carousel's own header is suppressed in this
|
|
@@ -40,6 +42,20 @@ export interface RewardLayoutOptions {
|
|
|
40
42
|
* listeners and its teardown; this function only positions it.
|
|
41
43
|
*/
|
|
42
44
|
actions?: HTMLElement;
|
|
45
|
+
/**
|
|
46
|
+
* Publisher overrides for the two copy slots — styled text, a ready element, or a
|
|
47
|
+
* renderer. Resolved HERE rather than by the caller so the semantic `h2`/`p` (and
|
|
48
|
+
* with them {@link REWARD_TITLE_ID}, the dialog's accessible name) stay owned by
|
|
49
|
+
* this module: a publisher styles or fills the heading, never deletes it.
|
|
50
|
+
*
|
|
51
|
+
* Taken as CONFIG while `actions` is taken as an ELEMENT, and the split is the same
|
|
52
|
+
* one as before: these slots have no listeners and no teardown, so resolving them
|
|
53
|
+
* costs this pure function nothing.
|
|
54
|
+
*/
|
|
55
|
+
headlineSlot?: TextSlot;
|
|
56
|
+
subheadlineSlot?: TextSlot;
|
|
57
|
+
/** Passed to the slot renderers as context. Defaults to the only use case that composes this chrome. */
|
|
58
|
+
useCase?: UseCase;
|
|
43
59
|
}
|
|
44
60
|
/**
|
|
45
61
|
* Compose the reward sheet: status (optional check → title → subtitle) → carousel.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RewardLayout.d.ts","sourceRoot":"","sources":["../../src/ui/RewardLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;
|
|
1
|
+
{"version":3,"file":"RewardLayout.d.ts","sourceRoot":"","sources":["../../src/ui/RewardLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGxC,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,eAAe,QAAwB,CAAC;AAErD,MAAM,WAAW,mBAAmB;IAClC,oFAAoF;IACpF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAChC;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,QAAQ,CAAC;IACxB,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,wGAAwG;IACxG,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAQD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,WAAW,EAC5B,OAAO,GAAE,mBAAwB,GAChC,WAAW,CA+Db"}
|
|
@@ -0,0 +1,154 @@
|
|
|
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
|
+
useCase: UseCase;
|
|
119
|
+
slot?: ButtonSlot;
|
|
120
|
+
}
|
|
121
|
+
/** A built action slot. `setAccessibleName` re-points the control's `aria-label`. */
|
|
122
|
+
export interface ActionSlot {
|
|
123
|
+
element: HTMLElement;
|
|
124
|
+
setAccessibleName: (name: string | undefined) => void;
|
|
125
|
+
/**
|
|
126
|
+
* Detach the SDK's listeners and release the publisher's element.
|
|
127
|
+
*
|
|
128
|
+
* Not optional housekeeping: the host's listener closes over `onActivate`, which
|
|
129
|
+
* reaches the carousel, the modal and the whole offer graph. A publisher who caches
|
|
130
|
+
* the element they passed would otherwise keep one presentation's entire object
|
|
131
|
+
* graph alive for the life of the page.
|
|
132
|
+
*/
|
|
133
|
+
destroy: () => void;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Build the claim / decline control.
|
|
137
|
+
*
|
|
138
|
+
* ABSENT OR STYLE-CONFIG SLOT → the SDK's own `<button>`, byte-identical to what it
|
|
139
|
+
* has always rendered (plus inline styles, when a config was given).
|
|
140
|
+
*
|
|
141
|
+
* ELEMENT OR RENDERER SLOT → the publisher's element mounted inside an SDK-owned host
|
|
142
|
+
* that IS the control:
|
|
143
|
+
* - the host carries `role="button"`, the single tab stop, and the accessible name;
|
|
144
|
+
* - the SDK's listener is registered on the host in the CAPTURE phase and calls
|
|
145
|
+
* `stopImmediatePropagation()`, so it runs before — and instead of — anything the
|
|
146
|
+
* publisher attached to their own element or its descendants. This is a property
|
|
147
|
+
* of DOM dispatch (capture at an ancestor precedes the target's own listeners),
|
|
148
|
+
* not a convention, so a publisher cannot swallow or pre-empt the claim;
|
|
149
|
+
* - the publisher's element gets `pointer-events: none` and every focusable node
|
|
150
|
+
* inside it is taken out of the tab order, so real input never reaches it either
|
|
151
|
+
* and the sheet keeps exactly one tab stop per control.
|
|
152
|
+
*/
|
|
153
|
+
export declare function createActionSlot(options: ActionSlotOptions): ActionSlot;
|
|
154
|
+
//# 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,G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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
|
@@ -26,16 +26,26 @@ export declare const BREAKPOINTS: {
|
|
|
26
26
|
* track Figma frame 18304:2399 (393×852). Where they disagree the Figma wins — see
|
|
27
27
|
* the PR for the itemised list. Web has no SDUI engine, so every value is hand-tracked.
|
|
28
28
|
*
|
|
29
|
-
* SHEET BACKGROUND
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
29
|
+
* SHEET BACKGROUND IS FLAT — a deliberate divergence from both the Figma and the
|
|
30
|
+
* variant, on Junaid's call. The sheet used to layer the Figma's radial brand glow
|
|
31
|
+
* over the variant's two stacked full-bleed gradients (an accent wash and a
|
|
32
|
+
* surface → background canvas); all of it is gone. `.thankyou--reward` now declares
|
|
33
|
+
* no background at all, exactly like the base `.thankyou`, so the sheet inherits the
|
|
34
|
+
* modal's `--encore-bg-color` and follows a publisher's theme instead of a colour
|
|
35
|
+
* this file paints. The brand custom properties stay — they feed the dot, the arrow
|
|
36
|
+
* focus ring, the CTA gradient and the card tint, none of which are background.
|
|
37
|
+
*
|
|
38
|
+
* `isolation: isolate` went with the layers. It was there so the confetti canvas
|
|
39
|
+
* (z-index 0) and the content (z-index 1) resolved inside the reward root rather than
|
|
40
|
+
* the modal's stacking context. Measured in Chrome after the removal: the topmost
|
|
41
|
+
* element over the title, the close button and the CTA is identical with and without
|
|
42
|
+
* it, because the canvas and the content are positioned siblings whose own z-indexes
|
|
43
|
+
* already order them, and the close button's z-index 10 still wins either way.
|
|
44
|
+
* `position: relative` STAYS — it is the canvas's declared positioning context for
|
|
45
|
+
* `inset: 0`. Its box happens to measure the same without it today only because the
|
|
46
|
+
* reward root exactly fills the modal; that coincidence ends the moment the modal
|
|
47
|
+
* scrolls, at which point `inset: 0` would size to the modal's viewport instead of
|
|
48
|
+
* the sheet.
|
|
39
49
|
*
|
|
40
50
|
* TEXT COLOUR stays on theme tokens rather than the Figma's #292D32 / #051E34. The
|
|
41
51
|
* variant's own dark-mode note is explicit that every mode-derived colour must remain
|
|
@@ -59,17 +69,37 @@ export declare const BREAKPOINTS: {
|
|
|
59
69
|
*
|
|
60
70
|
* DESKTOP WIDTH. The design is a 393-wide phone frame; on the desktop modal
|
|
61
71
|
* (max-width 800) the content column holds 393 and centres, so the hero keeps its
|
|
62
|
-
* proportions instead of stranding a 210px card in an 800px sheet.
|
|
63
|
-
* stays full-bleed — only the content column is constrained. Content sits at
|
|
72
|
+
* proportions instead of stranding a 210px card in an 800px sheet. Content sits at
|
|
64
73
|
* z-index 1 so it clears the confetti canvas, matching the variant's zStack order
|
|
65
|
-
* (
|
|
74
|
+
* (confetti → content).
|
|
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.
|
|
66
95
|
*/
|
|
67
96
|
/**
|
|
68
97
|
* The reward sheet's brand pair, read off the Figma (frame 18304:2399).
|
|
69
98
|
*
|
|
70
99
|
* `#B728F5 → #6515ED` is the primary CTA's gradient (node 18304:2417, 98.22°), and
|
|
71
|
-
* `#B728F5` is also the active dot
|
|
72
|
-
* for the whole surface, which is why it is one variable rather than three
|
|
100
|
+
* `#B728F5` is also the active dot, the arrow focus ring and the card-tint default —
|
|
101
|
+
* one accent for the whole surface, which is why it is one variable rather than three
|
|
102
|
+
* literals. It no longer paints any background: the sheet is flat (see above).
|
|
73
103
|
*
|
|
74
104
|
* NOT `--encore-primary-color`. `streaksCarousel.json` fills this CTA with a FLAT
|
|
75
105
|
* `accent` (the publisher's brand colour) at `cornerRadius: 12`; the Figma shows this
|
|
@@ -118,7 +148,7 @@ export declare function removeStyles(): void;
|
|
|
118
148
|
/**
|
|
119
149
|
* Update theme variables dynamically
|
|
120
150
|
*/
|
|
121
|
-
export declare function updateTheme(
|
|
151
|
+
export declare function updateTheme(rawTheme: ThemeVariables): void;
|
|
122
152
|
/**
|
|
123
153
|
* Get class name with prefix
|
|
124
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;AAotDD;;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"}
|