@encorekit/web-sdk 1.1.20 → 2.0.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 (44) hide show
  1. package/README.md +135 -0
  2. package/dist/cjs/index.cjs +1 -1
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/esm/index.js +1 -1
  5. package/dist/esm/index.js.map +1 -1
  6. package/dist/umd/encore.min.js +1 -1
  7. package/dist/umd/encore.min.js.map +1 -1
  8. package/package.json +4 -3
  9. package/types/analytics/AnalyticsClient.d.ts +11 -1
  10. package/types/analytics/AnalyticsClient.d.ts.map +1 -1
  11. package/types/analytics/events.d.ts +215 -3
  12. package/types/analytics/events.d.ts.map +1 -1
  13. package/types/analytics/transport.d.ts.map +1 -1
  14. package/types/api/APIClient.d.ts +32 -7
  15. package/types/api/APIClient.d.ts.map +1 -1
  16. package/types/api/generated/types.d.ts +568 -11
  17. package/types/api/generated/types.d.ts.map +1 -1
  18. package/types/core/DisplayResolver.d.ts +121 -0
  19. package/types/core/DisplayResolver.d.ts.map +1 -0
  20. package/types/core/Encore.d.ts.map +1 -1
  21. package/types/core/OfferManager.d.ts +50 -9
  22. package/types/core/OfferManager.d.ts.map +1 -1
  23. package/types/core/PlacementBuilder.d.ts +24 -1
  24. package/types/core/PlacementBuilder.d.ts.map +1 -1
  25. package/types/core/useCase.d.ts +21 -0
  26. package/types/core/useCase.d.ts.map +1 -0
  27. package/types/core/version.d.ts +1 -1
  28. package/types/core/version.d.ts.map +1 -1
  29. package/types/types.d.ts +118 -8
  30. package/types/types.d.ts.map +1 -1
  31. package/types/ui/OfferCard.d.ts.map +1 -1
  32. package/types/ui/OfferCarousel.d.ts +23 -0
  33. package/types/ui/OfferCarousel.d.ts.map +1 -1
  34. package/types/ui/PrimerScreen.d.ts +34 -0
  35. package/types/ui/PrimerScreen.d.ts.map +1 -0
  36. package/types/ui/RedemptionScreen.d.ts +31 -7
  37. package/types/ui/RedemptionScreen.d.ts.map +1 -1
  38. package/types/ui/ThankYouLayout.d.ts +11 -0
  39. package/types/ui/ThankYouLayout.d.ts.map +1 -1
  40. package/types/ui/brandComponents.d.ts +45 -0
  41. package/types/ui/brandComponents.d.ts.map +1 -0
  42. package/types/ui/safeImageSrc.d.ts +15 -0
  43. package/types/ui/safeImageSrc.d.ts.map +1 -0
  44. package/types/ui/styles.d.ts.map +1 -1
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import type { APIClient } from '../api/APIClient';
6
6
  import type { OfferModel } from '../api/models';
7
- import type { UserAttributes } from '../types';
7
+ import type { UserAttributes, UseCase } from '../types';
8
8
  import type { AnalyticsClient } from '../analytics/AnalyticsClient';
9
9
  export declare class OfferManager {
10
10
  #private;
@@ -12,17 +12,21 @@ export declare class OfferManager {
12
12
  /**
13
13
  * Fetch offers from API with optional caching
14
14
  */
15
- fetchOffers(userAttributes: UserAttributes, useCache?: boolean): Promise<{
15
+ fetchOffers(userAttributes: UserAttributes, useCache?: boolean, placementId?: string): Promise<{
16
16
  offers: OfferModel[];
17
17
  }>;
18
18
  /**
19
- * Begin a new presentation session
19
+ * Begin a new presentation session. `variantId` is the SDUI variant this
20
+ * presentation renders — stamped onto every event the session emits — and
21
+ * `useCase` is retained so the page-lifecycle flush can stamp it too.
20
22
  */
21
- beginPresentation(): string;
23
+ beginPresentation(variantId?: string, useCase?: UseCase): string;
24
+ /** The live presentation's id, or null between presentations. */
25
+ get presentationId(): string | null;
22
26
  /**
23
27
  * Track that an offer was presented (replaces impression logging)
24
28
  */
25
- trackOfferPresented(offer: OfferModel, impressionId: string, offerIndex: number, totalOffers: number): void;
29
+ trackOfferPresented(offer: OfferModel, impressionId: string, offerIndex: number, totalOffers: number, useCase?: UseCase): void;
26
30
  /**
27
31
  * Track that a user navigated away from an offer (pause time tracking)
28
32
  */
@@ -30,19 +34,56 @@ export declare class OfferManager {
30
34
  /**
31
35
  * Track offer claimed
32
36
  */
33
- trackOfferClaimed(offer: OfferModel, impressionId: string, transactionId: string, offerIndex: number, totalOffers: number): void;
37
+ trackOfferClaimed(offer: OfferModel, impressionId: string, transactionId: string, offerIndex: number, totalOffers: number, useCase?: UseCase): void;
34
38
  /**
35
39
  * Track offer declined
36
40
  */
37
- trackOfferDeclined(offer: OfferModel, impressionId: string, offerIndex: number, totalOffers: number, declineReason?: string): void;
41
+ trackOfferDeclined(offer: OfferModel, impressionId: string, offerIndex: number, totalOffers: number, declineReason?: string, useCase?: UseCase): void;
38
42
  /**
39
43
  * End the presentation session and send time tracking + dismissed events
40
44
  */
41
- endPresentation(declineReason?: string): void;
45
+ endPresentation(declineReason?: string, useCase?: UseCase): void;
46
+ /**
47
+ * Flush the live presentation's dwell + dismissal because the PAGE is going
48
+ * away, not because the user dismissed the sheet.
49
+ *
50
+ * This is the fix for `sdk_offer_time_spent` firing 7 times against 512
51
+ * impressions. Those rows were only ever emitted from a modal dismissal
52
+ * handler — close button, backdrop, decline, claim. A user who closes the tab,
53
+ * navigates away, or backgrounds the browser with the sheet open takes the
54
+ * whole presentation's dwell with them, and on the web that is the COMMON exit,
55
+ * not the edge case. The native SDKs have never had this hole because they get
56
+ * the same signal from app lifecycle (`app_backgrounded` / `app_terminated`,
57
+ * whose wire values are reused here verbatim).
58
+ *
59
+ * Delivery is `keepalive` — a plain fetch started during unload is cancelled
60
+ * with the document, so without it the events would be built and then dropped
61
+ * on the floor, which looks identical to never emitting them.
62
+ *
63
+ * The presentation is deliberately NOT torn down: the sheet may still be up
64
+ * (a `visibilitychange` is often just a tab switch). Impressions and claims
65
+ * after a return still carry the same `presentation_id`, and the emit path
66
+ * banks dwell rather than double-counting it.
67
+ *
68
+ * ONLY A TERMINAL SIGNAL EMITS THE DISMISSAL ROW. There is exactly one
69
+ * `sdk_offer_sheet_dismissed` per presentation, so whichever pass emits it
70
+ * decides how the presentation is recorded forever — and a backgrounding is
71
+ * not an ending (iOS labels `app_backgrounded` "Not an ending" for the same
72
+ * reason). Letting it claim the row would mislabel real outcomes wholesale:
73
+ * in IMMEDIATE mode the claim opens the advertiser tab synchronously inside
74
+ * the click gesture, which hides this document and fires
75
+ * `visibilitychange` while the transaction is still in flight — so EVERY
76
+ * successful claim would have been recorded as a backgrounded abandonment
77
+ * with truncated dwell. Dwell still flushes on both signals; that is the data
78
+ * the tab-close was losing, and it is additive rather than labelling.
79
+ */
80
+ flushForPageLifecycle(terminal: boolean, useCase?: UseCase): void;
81
+ /** Detach the page-lifecycle listeners (SDK reset / teardown). */
82
+ destroy(): void;
42
83
  /**
43
84
  * Start a transaction for an offer
44
85
  */
45
- startTransaction(campaignId: string): Promise<string>;
86
+ startTransaction(campaignId: string, useCase?: UseCase): Promise<string>;
46
87
  /**
47
88
  * Clear the offer cache
48
89
  */
@@ -1 +1 @@
1
- {"version":3,"file":"OfferManager.d.ts","sourceRoot":"","sources":["../../src/core/OfferManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAKpE,qBAAa,YAAY;;gBAWX,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,eAAe;IAMnF;;OAEG;IACG,WAAW,CACf,cAAc,EAAE,cAAc,EAC9B,QAAQ,UAAO,GACd,OAAO,CAAC;QAAE,MAAM,EAAE,UAAU,EAAE,CAAA;KAAE,CAAC;IAmCpC;;OAEG;IACH,iBAAiB,IAAI,MAAM;IAQ3B;;OAEG;IACH,mBAAmB,CACjB,KAAK,EAAE,UAAU,EACjB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,IAAI;IA+BP;;OAEG;IACH,iBAAiB,CAAC,OAAO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I;CAKhC"}
@@ -2,12 +2,35 @@
2
2
  * Placement Builder
3
3
  * Fluent API for configuring and presenting offers
4
4
  */
5
- import type { PlacementBuilder as IPlacementBuilder, PlacementOptions, ShowResult, RedeemResult, NotGrantedReason, ShowOptions } from '../types';
5
+ import type { PlacementBuilder as IPlacementBuilder, PlacementOptions, ShowResult, RedeemResult, NotGrantedReason, ShowOptions, UseCase } from '../types';
6
6
  export type PresentationExecutor = (options?: PlacementOptions, showOptions?: ShowOptions) => Promise<ShowResult>;
7
7
  export type RedeemExecutor = (placementId: string) => Promise<RedeemResult>;
8
8
  export declare class PlacementBuilder implements IPlacementBuilder {
9
9
  #private;
10
10
  constructor(id: string, executor: PresentationExecutor, options?: PlacementOptions, redeemExecutor?: RedeemExecutor);
11
+ /**
12
+ * Set this placement's use case (default `'churn-intervention'`) — the same `.useCase(...)` step
13
+ * the native SDKs expose, so a cross-platform integration reads the same here.
14
+ */
15
+ useCase(useCase: UseCase): PlacementBuilder;
16
+ /**
17
+ * Set the sheet's headline for THIS presentation — the same `.headline(...)` step
18
+ * the native SDKs expose.
19
+ *
20
+ * This is the primary way to supply reward copy. It is a per-call override: it
21
+ * wins over whatever the backend resolved, and applies to both use cases (it
22
+ * fills the same slot the `header.title` show option does).
23
+ *
24
+ * A blank or whitespace-only value falls THROUGH to the backend-resolved copy
25
+ * rather than blanking the sheet, so passing an empty string is never a way to
26
+ * clear the headline — omit the call instead.
27
+ */
28
+ headline(headline: string): PlacementBuilder;
29
+ /**
30
+ * Set the sheet's subheadline for THIS presentation — the counterpart to
31
+ * {@link headline}, same precedence and same blank-falls-through rule.
32
+ */
33
+ subheadline(subheadline: string): PlacementBuilder;
11
34
  /**
12
35
  * Set callback for when user declines or offer not granted
13
36
  */
@@ -1 +1 @@
1
- {"version":3,"file":"PlacementBuilder.d.ts","sourceRoot":"","sources":["../../src/core/PlacementBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,gBAAgB,IAAI,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G,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;AAE5E,qBAAa,gBAAiB,YAAW,iBAAiB;;gBAStD,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,CAAC,EAAE,gBAAgB,EAC1B,cAAc,CAAC,EAAE,cAAc;IAQjC;;;OAGG;IACH,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,gBAAgB;IAK3C;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB;IAQ5C;;;OAGG;IACH,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,gBAAgB;IAQlD;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,GAAG,gBAAgB;IAK5E;;OAEG;IACH,oBAAoB,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,GAAG,gBAAgB;IAK9E;;;;OAIG;IACG,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAoDtD;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;CAgBtC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * `useCase` value validation — an allow-list, not a deny-list, on the two canonical
3
+ * values (`churn-intervention`, `post-action-reward`). Deliberately the same design as the closed
4
+ * `feat/reject-streaks-use-case` PR (#21), which refused every non-paywall value
5
+ * outright before this SDK could render any of them: an unrecognised value — a typo,
6
+ * a use case added to the platform before this SDK knows about it, or one that gets
7
+ * RENAMED — must fail closed too. A `!== 'streaks'` deny-list would have kept
8
+ * compiling and silently served the paywall the day that value became `'post-action-reward'`.
9
+ *
10
+ * This is a distinct check from ENABLEMENT (does this app have `reward` turned on) —
11
+ * that's resolved from the config response's `useCases` map at show()-time and fails
12
+ * closed as `no_template`, not `INVALID_REQUEST`. This module only catches a value
13
+ * that isn't a recognised use case at all.
14
+ */
15
+ import { type EncoreError } from '../types';
16
+ /**
17
+ * `null` when `value` is a recognised use case (or omitted, which defaults to
18
+ * `'churn-intervention'` elsewhere), otherwise the error describing the rejection.
19
+ */
20
+ export declare function checkUseCase(value: unknown): EncoreError | null;
21
+ //# sourceMappingURL=useCase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCase.d.ts","sourceRoot":"","sources":["../../src/core/useCase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAa,KAAK,WAAW,EAAgB,MAAM,UAAU,CAAC;AAUrE;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CAS/D"}
@@ -1,3 +1,3 @@
1
1
  /** SDK version — single source of truth (also kept in sync with package.json via scripts/update-version.sh) */
2
- export declare const SDK_VERSION = "1.1.20";
2
+ export declare const SDK_VERSION = "2.0.0";
3
3
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/core/version.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAC/G,eAAO,MAAM,WAAW,WAAW,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/core/version.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAC/G,eAAO,MAAM,WAAW,UAAU,CAAC"}
package/types/types.d.ts CHANGED
@@ -116,6 +116,30 @@ export interface OfferContextConfig {
116
116
  * header + intro copy + carousel + optional trust footer.
117
117
  */
118
118
  export type PlacementLayout = 'list' | 'thankYou';
119
+ /**
120
+ * WHY a placement presents — Encore's platform-wide use-case dimension, distinct from
121
+ * `PlacementLayout` (which composes this SDK's own UI) and from the publisher's free-text
122
+ * placement id. Byte-identical across every Encore SDK — see `contracts/publisher-sdk.json`.
123
+ *
124
+ * Renamed in backend `V107__Use_Case_Value_Driven_Identifiers.sql` (PR #418, merged
125
+ * 2026-08-11, already deployed): `paywall` → `churn-intervention`, `reward` →
126
+ * `post-action-reward`. `paywall`/`reward` no longer exist in the Postgres enum at
127
+ * all — a client sending either is rejected. There is no dual-accept window; the
128
+ * backend went straight from old to new because the SDK had never shipped.
129
+ *
130
+ * - `'churn-intervention'` (default): today's offer sheet. Byte-identical behavior to
131
+ * before this dimension existed.
132
+ * - `'post-action-reward'`: celebrates a user moment (a purchase, a milestone, a
133
+ * streak) — claim-only, no in-app-purchase ask anywhere in it. Rendered here via a
134
+ * bundled UI variant (this SDK has no server-driven-UI renderer, unlike iOS/Android).
135
+ *
136
+ * Requesting a surface the app is not enabled for (or that has no eligible variant) is not
137
+ * an error: it resolves as a no-op (`ShowResult: 'unavailable'`,
138
+ * `sdk_offer_presentation_failed` reason `'no_template'`) and NEVER falls back to another
139
+ * use case's cached copy — see `core/useCase.ts` for the value-level allow-list this is
140
+ * paired with.
141
+ */
142
+ export type UseCase = 'churn-intervention' | 'post-action-reward';
119
143
  /**
120
144
  * The sheet's top heading block — in EVERY layout. In `'list'` it is the modal
121
145
  * title/subtitle above the offers (local override of the remote copy); in
@@ -146,17 +170,65 @@ export interface PlacementFooterConfig {
146
170
  /** Small muted centered line, e.g. "🔒 Secured by Acme". */
147
171
  text?: string;
148
172
  }
149
- export interface PlacementOptions {
173
+ /**
174
+ * Host-product display nouns for the deferred flow's SDK-composed copy (the S1
175
+ * header default, the primer screen, the redemption screen). Every field is optional
176
+ * in the TYPE because each resolves through a chain — local value, else remote
177
+ * /config (app name, native entitlement, app icon) — and requiredness is enforced at
178
+ * RUNTIME by the display contract (see core/DisplayResolver.ts). Display only;
179
+ * nothing here gates behavior.
180
+ */
181
+ export interface HostDisplay {
182
+ /** Host product name, e.g. "PlanetVPN". Falls back to the remote app name. */
183
+ appDisplayName?: string;
184
+ /**
185
+ * Display-only trial length, e.g. "1 month" — never parsed. Falls back to the
186
+ * remote native-entitlement value + unit.
187
+ */
188
+ trialPeriod?: string;
189
+ /** Host logo URL (https). Falls back to the remote app icon when available. */
190
+ logoUrl?: string;
191
+ }
192
+ /**
193
+ * Options shared by every layout. Layout-specific options extend this — see
194
+ * ListPlacementOptions / ThankYouPlacementOptions; PlacementOptions is their union,
195
+ * discriminated on `layout`.
196
+ */
197
+ export interface BasePlacementOptions {
198
+ /**
199
+ * Why this placement presents. Defaults to `'churn-intervention'`, the value
200
+ * every existing caller already got before this dimension shipped (renamed
201
+ * from `'paywall'` in backend PR #418 — see {@link UseCase}). Every existing
202
+ * caller is unaffected.
203
+ */
204
+ useCase?: UseCase;
150
205
  appearance?: AppearanceConfig;
151
- /** Priming pair above the offers — `'thankYou'` only; ignored by `'list'`. */
152
- offerContext?: OfferContextConfig;
153
- /** Layout template. Defaults to `'list'` (today's UI, unchanged). */
154
- layout?: PlacementLayout;
155
206
  /** Top heading block: modal title in `'list'`, payment status in `'thankYou'`. */
156
207
  header?: PlacementHeaderConfig;
157
- /** Trust footer — used by the `'thankYou'` layout only. */
208
+ /** Host display nouns — local override of the remote-config defaults. */
209
+ display?: HostDisplay;
210
+ /**
211
+ * Per-placement override of the configure() redemptionMode. Layout and mode are
212
+ * ORTHOGONAL axes: layout composes the UI; redemptionMode decides whether the
213
+ * claim redirects now ('immediate') or is decoupled from redemption ('deferred'
214
+ * — the host calls redeem() after its own conversion). Unusual combinations
215
+ * (e.g. 'thankYou' + 'deferred') are allowed and warned, not forbidden.
216
+ */
217
+ redemptionMode?: 'deferred' | 'immediate';
218
+ }
219
+ /** The default offer sheet. */
220
+ export interface ListPlacementOptions extends BasePlacementOptions {
221
+ layout?: 'list';
222
+ }
223
+ /** The post-purchase success composition. */
224
+ export interface ThankYouPlacementOptions extends BasePlacementOptions {
225
+ layout: 'thankYou';
226
+ /** Priming pair above the offers. */
227
+ offerContext?: OfferContextConfig;
228
+ /** Trust footer. Omitted → not rendered. */
158
229
  footer?: PlacementFooterConfig;
159
230
  }
231
+ export type PlacementOptions = ListPlacementOptions | ThankYouPlacementOptions;
160
232
  /**
161
233
  * Per-transaction receipt details for the `'thankYou'` layout. Rendered by the SDK as
162
234
  * "You paid {amount} for {purpose}" (or "You paid {amount}" without a purpose) in the
@@ -197,6 +269,22 @@ export interface PresentationOptions extends ShowOptions {
197
269
  * Builder pattern for placement API
198
270
  */
199
271
  export interface PlacementBuilder {
272
+ /**
273
+ * Set this placement's use case (default `'churn-intervention'`) — the same
274
+ * `.useCase(...)` step the native SDKs expose. See {@link UseCase}.
275
+ */
276
+ useCase(useCase: UseCase): PlacementBuilder;
277
+ /**
278
+ * Set the sheet's headline for this presentation — the same `.headline(...)` the
279
+ * native SDKs expose, and the primary way to supply reward copy.
280
+ *
281
+ * A per-call override: it beats the backend-resolved copy, and applies to both
282
+ * use cases. Blank or whitespace-only falls THROUGH to the resolved copy rather
283
+ * than blanking the sheet — omit the call instead of passing `''`.
284
+ */
285
+ headline(headline: string): PlacementBuilder;
286
+ /** Counterpart to {@link PlacementBuilder.headline}, same precedence and rules. */
287
+ subheadline(subheadline: string): PlacementBuilder;
200
288
  /** Fires when the sheet closes without a claim — carries the dismissal reason. */
201
289
  onNotGranted(callback: (reason: NotGrantedReason) => void): PlacementBuilder;
202
290
  onLoadingStateChange(callback: (isLoading: boolean) => void): PlacementBuilder;
@@ -306,6 +394,23 @@ export interface Transaction {
306
394
  /** The placement the offer was claimed at, if any (keys the local placement->transaction map). */
307
395
  placementId?: string;
308
396
  offer: OfferRef;
397
+ /**
398
+ * The layout of the placement the claim happened on — claim provenance (a
399
+ * transactional fact, like placementId). Drives which redemption narrative
400
+ * renders: a 'list' claim earns the activation story (host trial + ledger); a
401
+ * 'thankYou' claim renders the minimal reward story. Absent on legacy
402
+ * transactions → reward (the safe minimal narrative).
403
+ */
404
+ claimLayout?: PlacementLayout;
405
+ /**
406
+ * The use case this claim was made under. Omitted for `'churn-intervention'`
407
+ * (absent means churn-intervention, same convention as everywhere else this
408
+ * dimension appears) — persisted so `redeem()`, which may run on a later page
409
+ * load with only this record in hand, can still tell a post-action-reward claim
410
+ * apart from a churn-intervention one. See {@link UseCase} and
411
+ * `grantsEntitlementOnClaim` in `core/Encore.ts`.
412
+ */
413
+ useCase?: UseCase;
309
414
  status: 'claimed' | 'redeemed';
310
415
  /** ISO-8601 timestamps. */
311
416
  createdAt: string;
@@ -343,9 +448,14 @@ export interface RedeemOptions {
343
448
  * exists for the placement, resolves `none` — it never crosses to another placement.
344
449
  */
345
450
  placement?: string;
346
- /** Optional host product card to render as "Active" above the pending offer. */
451
+ /**
452
+ * Host product row for the redemption screen's deal ledger. Override-only: name
453
+ * and logo default from the same display resolution show() uses (live remote
454
+ * config), so most integrations never pass this. The trial-end detail line is
455
+ * always DERIVED (remote durationDays + the redemption moment) — not settable.
456
+ */
347
457
  host?: {
348
- name: string;
458
+ name?: string;
349
459
  status?: string;
350
460
  logoUrl?: string;
351
461
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;CAAE,GAC/D;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;CAAE,GAClE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,aAAa,GAAG,KAAK,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,aAAa,GAAG,UAAU,CAAC;IAClC,SAAS,EAAE,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AiB;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"}
@@ -1 +1 @@
1
- {"version":3,"file":"OfferCard.d.ts","sourceRoot":"","sources":["../../src/ui/OfferCard.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;AAMpD,UAAU,iBAAkB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzD,KAAK,EAAE;QAAE,KAAK,EAAE,KAAK,CAAA;KAAE,CAAC;IACxB,OAAO,EAAE,IAAI,CAAC;CACf;AAED,qBAAa,SAAS;;;IAUpB;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW;IAkBjC;;OAEG;IACH,EAAE,CAAC,CAAC,SAAS,MAAM,iBAAiB,EAClC,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,KAAK,IAAI,GAC/C,MAAM,IAAI;IA8Jb;;OAEG;IACH,OAAO,IAAI,IAAI;CAUhB"}
1
+ {"version":3,"file":"OfferCard.d.ts","sourceRoot":"","sources":["../../src/ui/OfferCard.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;AAOpD,UAAU,iBAAkB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzD,KAAK,EAAE;QAAE,KAAK,EAAE,KAAK,CAAA;KAAE,CAAC;IACxB,OAAO,EAAE,IAAI,CAAC;CACf;AAED,qBAAa,SAAS;;;IAUpB;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW;IAkBjC;;OAEG;IACH,EAAE,CAAC,CAAC,SAAS,MAAM,iBAAiB,EAClC,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,KAAK,IAAI,GAC/C,MAAM,IAAI;IAgKb;;OAEG;IACH,OAAO,IAAI,IAAI;CAUhB"}
@@ -12,6 +12,17 @@ export interface OfferCarouselOptions {
12
12
  * carousel at every breakpoint, with chevron nav bubbles.
13
13
  */
14
14
  mode?: 'responsive' | 'paged';
15
+ /**
16
+ * Suppress the carousel's own title/subtitle header block entirely (reward
17
+ * composition — see Encore.ts's `#runOfferFlow`). The carousel's header exists to
18
+ * carry paywall-flavored copy (a titleText/customHeadline default, or the hardcoded
19
+ * "Unlock 10 free articles…" fallback when neither is configured) or the thankYou
20
+ * layout's offerContext priming pair — reward has neither: its own headline already
21
+ * renders in the ThankYouLayout chrome above this carousel, and the modal's
22
+ * accessible name is already pointed at THAT title (see THANKYOU_TITLE_ID), so
23
+ * hiding this header is a11y-safe, not just visually tidier.
24
+ */
25
+ hideHeader?: boolean;
15
26
  }
16
27
  interface CarouselEventMap extends Record<string, unknown> {
17
28
  offerClaim: {
@@ -25,6 +36,18 @@ interface CarouselEventMap extends Record<string, unknown> {
25
36
  offer: Offer;
26
37
  index: number;
27
38
  };
39
+ /**
40
+ * The user moved to a different card, by any means (gesture, arrows, keyboard).
41
+ * Distinct from `offerView`, which is an IMPRESSION and stays deduped to
42
+ * once-per-index-per-rest: this is the navigation itself, so a user paging
43
+ * 0→1→0 produces three scrolls and two impressions. `axis` is a real dimension
44
+ * on web — the same carousel is horizontal on desktop and a vertical list on
45
+ * mobile — and is what `sdk_sdui_scroll` reports.
46
+ */
47
+ scroll: {
48
+ axis: 'horizontal' | 'vertical';
49
+ position: number;
50
+ };
28
51
  complete: {
29
52
  claimed: boolean;
30
53
  };
@@ -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;AAMhD,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC;CAC/B;AAED,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,QAAQ,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CAChC;AAED,qBAAa,aAAa;;gBAgDZ,MAAM,EAAE,KAAK,EAAE,EAAE,QAAQ,CAAC,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,oBAAoB;IAcvF;;OAEG;IACH,MAAM,IAAI,WAAW;IAgLrB;;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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8MrB;;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;;OAEG;IACH,QAAQ,IAAI,IAAI;IAsZhB;;OAEG;IACH,OAAO,IAAI,IAAI;CAqBhB"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Primer Screen Component (S1.5 of the deferred flow)
3
+ *
4
+ * Rendered into the open OfferModal immediately after a deferred-mode claim: the
5
+ * handoff moment that converts claim momentum into starting the host's own trial.
6
+ * Dual-brand lockup (partner + host), SDK-composed copy from the resolved display
7
+ * nouns, and a single forward CTA. show()'s promise settles on this screen's CTA
8
+ * or on any modal dismissal — both resolve 'claimed' (the claim is a fact either
9
+ * way); dismissal is the modal's own X-chrome, not a control here.
10
+ */
11
+ import { type ResolvedDisplay } from '../core/DisplayResolver';
12
+ export interface PrimerScreenConfig {
13
+ /** Resolved host display nouns (guard-validated before Screen 1 rendered). */
14
+ display: ResolvedDisplay;
15
+ /** Partner branding from the just-claimed offer. */
16
+ partner: {
17
+ name?: string;
18
+ logoUrl?: string;
19
+ imageUrl?: string;
20
+ };
21
+ }
22
+ interface PrimerScreenEventMap extends Record<string, unknown> {
23
+ /** The user tapped the forward CTA — caller settles 'claimed' and closes. */
24
+ continue: undefined;
25
+ }
26
+ export declare class PrimerScreen {
27
+ #private;
28
+ constructor(config: PrimerScreenConfig);
29
+ render(): HTMLElement;
30
+ on<K extends keyof PrimerScreenEventMap>(event: K, handler: (payload: PrimerScreenEventMap[K]) => void): () => void;
31
+ destroy(): void;
32
+ }
33
+ export {};
34
+ //# sourceMappingURL=PrimerScreen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrimerScreen.d.ts","sourceRoot":"","sources":["../../src/ui/PrimerScreen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG5E,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,OAAO,EAAE,eAAe,CAAC;IACzB,oDAAoD;IACpD,OAAO,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACjE;AAED,UAAU,oBAAqB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC5D,6EAA6E;IAC7E,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,qBAAa,YAAY;;gBAKX,MAAM,EAAE,kBAAkB;IAKtC,MAAM,IAAI,WAAW;IA+CrB,EAAE,CAAC,CAAC,SAAS,MAAM,oBAAoB,EACrC,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,KAAK,IAAI,GAClD,MAAM,IAAI;IAIb,OAAO,IAAI,IAAI;CAQhB"}
@@ -1,13 +1,24 @@
1
1
  /**
2
- * Redemption Screen Component
2
+ * Redemption Screen Component (S2 of the deferred flow)
3
3
  *
4
- * Phase 2 of the two-phase flow: shown by redeem() after the host's own
5
- * conversion. Presents the claimed partner offer as a "Pending" reward card with
6
- * a single clean CTA that sends the user to the advertiser. Intentionally does
7
- * NOT render the host's "active" product block — that content (app suite, perks)
8
- * varies per integrator and isn't worth rendering generically.
4
+ * Phase 2, shown by redeem(). The NARRATIVE is a function of the claim's
5
+ * originating surface (Transaction.claimLayout), expressed as a variant map of
6
+ * separate builders — extensible by adding an entry, never by threading more
7
+ * conditionals through one render path:
8
+ *
9
+ * - 'activation' (claims from the 'list' handoff flow): the host conversion just
10
+ * completed — dual-brand lockup, "your trial is active" copy, and the deal
11
+ * ledger (host row Active with the derived trial-end detail, partner Pending).
12
+ * - 'reward' (claims from 'thankYou' or unknown/legacy provenance): there was no
13
+ * host-unlock moment — minimal congratulations + the pending partner row.
14
+ *
15
+ * Both variants share the same chrome: reassurance note + one CTA ("Claim your
16
+ * reward") that sends the user to the advertiser inside the click gesture.
9
17
  */
18
+ type RedemptionVariant = 'activation' | 'reward';
10
19
  interface RedemptionScreenConfig {
20
+ /** Which narrative to render. Defaults to 'reward' (the safe minimal story). */
21
+ variant?: RedemptionVariant;
11
22
  /** Display reward copy, e.g. "30 days of free Apple Music". */
12
23
  reward?: string;
13
24
  /** Advertiser/partner name, e.g. "Apple Music". */
@@ -15,7 +26,20 @@ interface RedemptionScreenConfig {
15
26
  /** Partner logo (preferred) or a fallback image. */
16
27
  logoUrl?: string;
17
28
  imageUrl?: string;
18
- /** Optional CTA override; otherwise derived from the reward. */
29
+ /**
30
+ * Host product context — consumed by the 'activation' variant only (resolved
31
+ * from live remote config + the redeem() host override by the caller).
32
+ */
33
+ host?: {
34
+ name?: string;
35
+ trialPeriod?: string;
36
+ /** Status chip text; defaults to "Active". */
37
+ status?: string;
38
+ /** Derived trial-end line, e.g. "Free until August 8, 2026". */
39
+ detail?: string;
40
+ logoUrl?: string;
41
+ };
42
+ /** Optional CTA override; default is exactly "Claim your reward". */
19
43
  buttonText?: string;
20
44
  }
21
45
  interface RedemptionScreenEventMap extends Record<string, unknown> {
@@ -1 +1 @@
1
- {"version":3,"file":"RedemptionScreen.d.ts","sourceRoot":"","sources":["../../src/ui/RedemptionScreen.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,UAAU,sBAAsB;IAC9B,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MA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M,CAAC,MAAM,EAAE,OAAO,CAAC;IAChE,4EAA4E;IAC5E,QAAQ,EAAE,SAAS,CAAC;CACrB;AAmED,qBAAa,gBAAgB;;gBAKf,MAAM,EAAE,sBAAsB;IAK1C,MAAM,IAAI,WAAW;IA+BrB,EAAE,CAAC,CAAC,SAAS,MAAM,wBAAwB,EACzC,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAAC,CAAC,KAAK,IAAI,GACtD,MAAM,IAAI;IAIb,OAAO,IAAI,IAAI;CAQhB"}
@@ -26,6 +26,17 @@ export interface ThankYouLayoutOptions {
26
26
  footer?: PlacementFooterConfig;
27
27
  /** Per-transaction receipt — owns the subtitle slot when provided. */
28
28
  receipt?: Receipt;
29
+ /**
30
+ * Marks this as the REWARD composition rather than the payment-status one, adding
31
+ * the `--reward` modifier so the parity styles can be scoped to it.
32
+ *
33
+ * The two share this chrome but are not the same screen. `thankYou` confirms a
34
+ * payment the user just made; reward celebrates an action and offers a gift, and
35
+ * on the native SDKs it is a full-screen surface with its own type scale (see
36
+ * `streaksCarousel.json`). Keeping the modifier off by default means every
37
+ * existing `thankYou` render stays byte-identical.
38
+ */
39
+ reward?: boolean;
29
40
  }
30
41
  /**
31
42
  * Compose the thankYou sheet: status (check → title → subtitle) → carousel → footer.
@@ -1 +1 @@
1
- {"version":3,"file":"ThankYouLayout.d.ts","sourceRoot":"","sources":["../../src/ui/ThankYouLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,OAAO,EACR,MAAM,UAAU,CAAC;AAOlB;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAwB,CAAC;AAEvD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAO7D;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,sEAAsE;IACtE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAqCD;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,WAAW,EAC5B,OAAO,GAAE,qBAA0B,GAClC,WAAW,CAkDb"}
1
+ {"version":3,"file":"ThankYouLayout.d.ts","sourceRoot":"","sources":["../../src/ui/ThankYouLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,OAAO,EACR,MAAM,UAAU,CAAC;AAOlB;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAwB,CAAC;AAEvD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAO7D;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,sEAAsE;IACtE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAqCD;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,WAAW,EAC5B,OAAO,GAAE,qBAA0B,GAClC,WAAW,CAkDb"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Shared brand components for the deferred-flow screens.
3
+ *
4
+ * The dual-brand lockup (partner + host tiles) and the deal-ledger row are the
5
+ * continuity thread between the primer screen (S1.5) and the redemption screen
6
+ * (S2) — one implementation, consumed by both. Pure render functions in the
7
+ * ThankYouLayout style: no state, no events.
8
+ *
9
+ * Rendering hardening lives here once for every consumer:
10
+ * - URL scheme guard via safeImageSrc (reject → monogram tile)
11
+ * - monogram rendered IMMEDIATELY and swapped to the <img> only when it has
12
+ * loaded — a slow remote logo never shows an empty tile mid-animation
13
+ * - explicit dimensions + decoding="async", alt text on every logo
14
+ */
15
+ export interface BrandRef {
16
+ name?: string;
17
+ logoUrl?: string;
18
+ }
19
+ /**
20
+ * The dual-brand lockup: partner tile and host tile, gently overlapped —
21
+ * "two brands, one deal". Rendered at the top of the primer and redemption
22
+ * screens. Motion (the settle) is pure CSS and respects prefers-reduced-motion
23
+ * via the stylesheet's global override.
24
+ */
25
+ export declare function renderDualBrandLockup(partner: BrandRef, host: BrandRef): HTMLElement;
26
+ export interface LedgerRowConfig {
27
+ brand: BrandRef;
28
+ /** Primary line, e.g. "PlanetVPN" or "Apple Music deal". */
29
+ name: string;
30
+ /** Secondary muted line, e.g. "Free until August 3, 2026" or the reward copy. */
31
+ detail?: string;
32
+ /** Status chip text + tone. Active renders in the success color. */
33
+ status: {
34
+ text: string;
35
+ tone: 'active' | 'pending';
36
+ };
37
+ }
38
+ /** The ledger container: rows stacked with hairline dividers. */
39
+ export declare function renderLedger(rows: LedgerRowConfig[]): HTMLElement;
40
+ /**
41
+ * The screens' single forward CTA: the clean pill button (encore-button-claim)
42
+ * made full-width by the given per-screen modifier class.
43
+ */
44
+ export declare function renderCtaButton(text: string, modifierClass: string, onClick: () => void): HTMLButtonElement;
45
+ //# sourceMappingURL=brandComponents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brandComponents.d.ts","sourceRoot":"","sources":["../../src/ui/brandComponents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,MAAM,WAAW,QAAQ;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AA8BD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,GAAG,WAAW,CAmBpF;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,QAAQ,CAAC;IAChB,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAA;KAAE,CAAC;CACtD;AAoCD,iEAAiE;AACjE,wBAAgB,YAAY,CAAC,IAAI,EAAE,eAAe,EAAE,GAAG,WAAW,CAKjE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,IAAI,GAClB,iBAAiB,CAOnB"}