@encorekit/web-sdk 2.0.0 → 2.0.1
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 +104 -95
- 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 +7 -28
- package/types/analytics/events.d.ts.map +1 -1
- package/types/api/APIClient.d.ts +10 -6
- package/types/api/APIClient.d.ts.map +1 -1
- package/types/api/models.d.ts +8 -3
- package/types/api/models.d.ts.map +1 -1
- package/types/core/Configuration.d.ts +0 -4
- package/types/core/Configuration.d.ts.map +1 -1
- package/types/core/Encore.d.ts +8 -33
- package/types/core/Encore.d.ts.map +1 -1
- package/types/core/PlacementBuilder.d.ts +7 -31
- package/types/core/PlacementBuilder.d.ts.map +1 -1
- package/types/core/useCase.d.ts +54 -13
- package/types/core/useCase.d.ts.map +1 -1
- package/types/core/version.d.ts +1 -1
- package/types/types.d.ts +85 -272
- package/types/types.d.ts.map +1 -1
- package/types/ui/OfferCarousel.d.ts +59 -1
- package/types/ui/OfferCarousel.d.ts.map +1 -1
- package/types/ui/RewardActions.d.ts +60 -0
- package/types/ui/RewardActions.d.ts.map +1 -0
- package/types/ui/RewardCard.d.ts +49 -0
- package/types/ui/RewardCard.d.ts.map +1 -0
- package/types/ui/RewardConfetti.d.ts +46 -0
- package/types/ui/RewardConfetti.d.ts.map +1 -0
- package/types/ui/RewardLayout.d.ts +55 -0
- package/types/ui/RewardLayout.d.ts.map +1 -0
- package/types/ui/brandTint.d.ts +61 -0
- package/types/ui/brandTint.d.ts.map +1 -0
- package/types/ui/styles.d.ts +86 -0
- package/types/ui/styles.d.ts.map +1 -1
- package/types/utils/text.d.ts +24 -0
- package/types/utils/text.d.ts.map +1 -0
package/types/types.d.ts
CHANGED
|
@@ -95,166 +95,75 @@ export interface AppearanceConfig {
|
|
|
95
95
|
accentColor?: string;
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* `header` instead: one name means one thing in every layout.
|
|
102
|
-
*/
|
|
103
|
-
export interface OfferContextConfig {
|
|
104
|
-
title?: string;
|
|
105
|
-
/**
|
|
106
|
-
* Context subtitle. When the active offer's campaign carries a `perk` line (e.g.
|
|
107
|
-
* "Enjoy 30 days of Apple Music free") the perk takes this slot and follows the
|
|
108
|
-
* carousel as it pages; this value is the per-placement fallback.
|
|
109
|
-
*/
|
|
110
|
-
subtitle?: string;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Layout template for a placement presentation.
|
|
114
|
-
* - `'list'` (default): today's offer sheet — header copy + offer carousel.
|
|
115
|
-
* - `'thankYou'`: post-purchase success composition — status check + payment-status
|
|
116
|
-
* header + intro copy + carousel + optional trust footer.
|
|
117
|
-
*/
|
|
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`.
|
|
98
|
+
* WHY a placement presents — Encore's platform-wide use-case dimension, and the ONLY
|
|
99
|
+
* thing that selects a composition. It is distinct from the publisher's free-text
|
|
100
|
+
* placement id.
|
|
123
101
|
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
102
|
+
* - `'reduceChurn'` (default): the offer carousel — a save attempt at a moment the
|
|
103
|
+
* user is leaving.
|
|
104
|
+
* - `'rewardUsers'`: celebrates a user moment (a purchase, a milestone, a streak) —
|
|
105
|
+
* claim-only, no in-app-purchase ask anywhere in it. Renders the reward
|
|
106
|
+
* composition: its own headline chrome around a paged carousel.
|
|
129
107
|
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
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).
|
|
108
|
+
* These symbols match the native SDKs verbatim — iOS `.reduceChurn`/`.rewardUsers`,
|
|
109
|
+
* Android `REDUCE_CHURN`/`REWARD_USERS` — so a cross-platform integration reads one
|
|
110
|
+
* vocabulary.
|
|
135
111
|
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
* `
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
* `'thankYou'` it is the payment-status block (check + title + subtitle). The host
|
|
147
|
-
* supplies the copy — the SDK never invents payment facts.
|
|
112
|
+
* 🔴 THE WIRE VALUES ARE DIFFERENT STRINGS AND ARE FROZEN. `/config`, `/transactions`
|
|
113
|
+
* and the `use_case` analytics property still carry `churn-intervention` /
|
|
114
|
+
* `post-action-reward`; `core/useCase.ts` is the only place the two meet. You never
|
|
115
|
+
* type a wire value — passing one is rejected as an unrecognised use case.
|
|
116
|
+
*
|
|
117
|
+
* Requesting a surface the app is not enabled for (or that has no resolved copy) is
|
|
118
|
+
* not an error: it resolves as a no-op (`ShowResult: 'unavailable'`,
|
|
119
|
+
* `sdk_offer_presentation_failed` reason `'no_template'`) and NEVER falls back to
|
|
120
|
+
* another use case's cached copy — see `core/useCase.ts` for the value-level
|
|
121
|
+
* allow-list this is paired with.
|
|
148
122
|
*/
|
|
149
|
-
export
|
|
150
|
-
/**
|
|
151
|
-
* Status icon (`'thankYou'` only). `'success'` (default) renders a green-circle
|
|
152
|
-
* check; `'none'` hides it. Ignored by `'list'`.
|
|
153
|
-
*/
|
|
154
|
-
icon?: 'success' | 'none';
|
|
155
|
-
/**
|
|
156
|
-
* Heading title. In `'list'` the sheet title (falls back to remote copy when
|
|
157
|
-
* omitted); in `'thankYou'` the status title, e.g. "Payment Successful"
|
|
158
|
-
* (omitted → not rendered).
|
|
159
|
-
*/
|
|
160
|
-
title?: string;
|
|
161
|
-
/**
|
|
162
|
-
* Heading subtitle (a plain constant string). In `'list'` the sheet subtitle; in
|
|
163
|
-
* `'thankYou'` the muted status line, where a `receipt` passed to `show()` takes
|
|
164
|
-
* precedence over this slot.
|
|
165
|
-
*/
|
|
166
|
-
subtitle?: string;
|
|
167
|
-
}
|
|
168
|
-
/** Trust footer for the `'thankYou'` layout. Omitted → not rendered. */
|
|
169
|
-
export interface PlacementFooterConfig {
|
|
170
|
-
/** Small muted centered line, e.g. "🔒 Secured by Acme". */
|
|
171
|
-
text?: string;
|
|
172
|
-
}
|
|
123
|
+
export type UseCase = 'reduceChurn' | 'rewardUsers';
|
|
173
124
|
/**
|
|
174
|
-
*
|
|
175
|
-
*
|
|
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.
|
|
125
|
+
* Everything a placement can be configured with. One flat shape: the composition is
|
|
126
|
+
* DERIVED from {@link useCase}, never selected separately.
|
|
180
127
|
*/
|
|
181
|
-
export interface
|
|
182
|
-
/** Host product name, e.g. "PlanetVPN". Falls back to the remote app name. */
|
|
183
|
-
appDisplayName?: string;
|
|
128
|
+
export interface PlacementOptions {
|
|
184
129
|
/**
|
|
185
|
-
*
|
|
186
|
-
*
|
|
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.
|
|
130
|
+
* Why this placement presents, which is also what it renders. Defaults to
|
|
131
|
+
* `'reduceChurn'` — the offer carousel. See {@link UseCase}.
|
|
203
132
|
*/
|
|
204
133
|
useCase?: UseCase;
|
|
205
|
-
appearance?: AppearanceConfig;
|
|
206
|
-
/** Top heading block: modal title in `'list'`, payment status in `'thankYou'`. */
|
|
207
|
-
header?: PlacementHeaderConfig;
|
|
208
|
-
/** Host display nouns — local override of the remote-config defaults. */
|
|
209
|
-
display?: HostDisplay;
|
|
210
134
|
/**
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
135
|
+
* The sheet's headline for THIS presentation — the same slot the native SDKs'
|
|
136
|
+
* `.headline(...)` fills, and the primary way to supply reward copy.
|
|
137
|
+
*
|
|
138
|
+
* A per-call override, and it applies to both use cases: it beats the
|
|
139
|
+
* backend-resolved copy, which in turn beats the SDK's built-in fallback. Blank or
|
|
140
|
+
* whitespace-only falls THROUGH to the resolved copy rather than blanking the
|
|
141
|
+
* sheet — omit the field instead of passing `''`.
|
|
216
142
|
*/
|
|
217
|
-
|
|
218
|
-
}
|
|
219
|
-
|
|
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. */
|
|
229
|
-
footer?: PlacementFooterConfig;
|
|
230
|
-
}
|
|
231
|
-
export type PlacementOptions = ListPlacementOptions | ThankYouPlacementOptions;
|
|
232
|
-
/**
|
|
233
|
-
* Per-transaction receipt details for the `'thankYou'` layout. Rendered by the SDK as
|
|
234
|
-
* "You paid {amount} for {purpose}" (or "You paid {amount}" without a purpose) in the
|
|
235
|
-
* payment-status subtitle slot. Values are rendered verbatim as text — pre-format the
|
|
236
|
-
* currency on your side.
|
|
237
|
-
*/
|
|
238
|
-
export interface Receipt {
|
|
239
|
-
/** Pre-formatted amount, e.g. "NGN 100". */
|
|
240
|
-
amount: string;
|
|
241
|
-
/** What was paid for, e.g. "Demo". */
|
|
242
|
-
purpose?: string;
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Per-call options for show().
|
|
246
|
-
*/
|
|
247
|
-
export interface ShowOptions {
|
|
143
|
+
headline?: string;
|
|
144
|
+
/** Counterpart to {@link headline}: same precedence, same blank-falls-through rule. */
|
|
145
|
+
subheadline?: string;
|
|
248
146
|
/**
|
|
249
|
-
*
|
|
250
|
-
*
|
|
147
|
+
* Status icon above the headline. Defaults to `'none'` — nothing renders unless
|
|
148
|
+
* you explicitly ask for `'success'`, which draws a green-circle check.
|
|
149
|
+
*
|
|
150
|
+
* Only the `'rewardUsers'` composition has a status block to put it in;
|
|
151
|
+
* `'reduceChurn'` renders the carousel bare and ignores this.
|
|
152
|
+
*
|
|
153
|
+
* The default is `'none'` deliberately, and it MATCHES THE NATIVE SDKS: the
|
|
154
|
+
* reward variant (`streaksCarousel.json`, the same screen iOS and Android render)
|
|
155
|
+
* contains no checkmark at all — it opens with layered gradients and a confetti
|
|
156
|
+
* burst. A green success check is a payment-status icon; a reward sheet has not
|
|
157
|
+
* finished anything yet, it is still asking the user to choose a gift. Opting in
|
|
158
|
+
* is supported for the rare integration that wants one.
|
|
251
159
|
*/
|
|
252
|
-
|
|
160
|
+
statusIcon?: 'success' | 'none';
|
|
161
|
+
appearance?: AppearanceConfig;
|
|
253
162
|
}
|
|
254
163
|
/**
|
|
255
|
-
* Presentation callbacks
|
|
164
|
+
* Presentation callbacks for the bare `Encore.show()` form.
|
|
256
165
|
*/
|
|
257
|
-
export interface PresentationOptions
|
|
166
|
+
export interface PresentationOptions {
|
|
258
167
|
/**
|
|
259
168
|
* Fires when the user completes the offer flow (provisional grant). The argument is the
|
|
260
169
|
* deprecated, display-derived entitlement and may be `undefined`.
|
|
@@ -270,28 +179,20 @@ export interface PresentationOptions extends ShowOptions {
|
|
|
270
179
|
*/
|
|
271
180
|
export interface PlacementBuilder {
|
|
272
181
|
/**
|
|
273
|
-
* Set this placement's use case (default `'
|
|
182
|
+
* Set this placement's use case (default `'reduceChurn'`) — the same
|
|
274
183
|
* `.useCase(...)` step the native SDKs expose. See {@link UseCase}.
|
|
275
184
|
*/
|
|
276
185
|
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;
|
|
288
186
|
/** Fires when the sheet closes without a claim — carries the dismissal reason. */
|
|
289
187
|
onNotGranted(callback: (reason: NotGrantedReason) => void): PlacementBuilder;
|
|
290
188
|
onLoadingStateChange(callback: (isLoading: boolean) => void): PlacementBuilder;
|
|
291
|
-
/**
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
189
|
+
/**
|
|
190
|
+
* Present the sheet. Takes no arguments — everything a placement can be
|
|
191
|
+
* configured with lives in {@link PlacementOptions}, passed to `placement()` or
|
|
192
|
+
* set through the builder steps above. Same bare ShowResult contract as
|
|
193
|
+
* `Encore.show()`. Never rejects.
|
|
194
|
+
*/
|
|
195
|
+
show(): Promise<ShowResult>;
|
|
295
196
|
}
|
|
296
197
|
/**
|
|
297
198
|
* Error codes used throughout the SDK
|
|
@@ -353,83 +254,37 @@ export interface EncoreConfig {
|
|
|
353
254
|
apiKey: string;
|
|
354
255
|
environment?: 'production' | 'development' | 'staging' | 'localhost';
|
|
355
256
|
logLevel?: 'none' | 'debug';
|
|
356
|
-
/**
|
|
357
|
-
* Redemption flow:
|
|
358
|
-
* - 'deferred' (default): show() resolves when the user CLAIMS an offer (a transaction
|
|
359
|
-
* record is created, NO redirect). The host runs its own conversion, then calls
|
|
360
|
-
* redeem() to render the redemption screen + send the user to the advertiser.
|
|
361
|
-
* - 'immediate': the legacy one-step flow — claiming an offer redirects to the
|
|
362
|
-
* advertiser and shows the success screen inline (no separate redeem() call).
|
|
363
|
-
* This is a control-flow contract (it changes what host code must call), so it is
|
|
364
|
-
* a LOCAL config value, not remote.
|
|
365
|
-
*/
|
|
366
|
-
redemptionMode?: 'deferred' | 'immediate';
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
* Offer descriptor carried on a transaction — enough to render the redemption screen AND
|
|
370
|
-
* to rebuild the advertiser redirect at redeem() time (so the deferred flow never
|
|
371
|
-
* needs the live offer again). `advertiserUrl` may contain a TRANSACTION_ID
|
|
372
|
-
* placeholder, substituted with the transaction id when the redemption fires.
|
|
373
|
-
*/
|
|
374
|
-
export interface OfferRef {
|
|
375
|
-
id: string;
|
|
376
|
-
campaignId: string;
|
|
377
|
-
advertiserUrl: string;
|
|
378
|
-
trackingParameters?: Record<string, string>;
|
|
379
|
-
advertiserName?: string;
|
|
380
|
-
/** Display-only reward copy (e.g. "30 days of Apple Music"). NOT an entitlement. */
|
|
381
|
-
reward?: string;
|
|
382
|
-
imageUrl?: string;
|
|
383
|
-
logoUrl?: string;
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* A claimed offer awaiting redemption. Claiming starts a transaction, and the
|
|
387
|
-
* returned `transactionId` is this transaction's durable handle (the same id used by
|
|
388
|
-
* `didGrant`, `waitForVerification`, and the backend).
|
|
389
|
-
*/
|
|
390
|
-
export interface Transaction {
|
|
391
|
-
id: string;
|
|
392
|
-
/** The persistent account identity this transaction is bound to (app_account_id). */
|
|
393
|
-
appAccountId: string;
|
|
394
|
-
/** The placement the offer was claimed at, if any (keys the local placement->transaction map). */
|
|
395
|
-
placementId?: string;
|
|
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;
|
|
414
|
-
status: 'claimed' | 'redeemed';
|
|
415
|
-
/** ISO-8601 timestamps. */
|
|
416
|
-
createdAt: string;
|
|
417
|
-
expiresAt: string;
|
|
418
|
-
redeemedAt?: string;
|
|
419
257
|
}
|
|
420
258
|
/** Result of `show()` / `present()`. */
|
|
421
259
|
export type ShowResult =
|
|
422
260
|
/**
|
|
423
|
-
* The user claimed an offer
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
* NOT
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
261
|
+
* The user claimed an offer: the advertiser was opened in a new tab. The SDK
|
|
262
|
+
* renders nothing after a claim — the host owns that moment.
|
|
263
|
+
*
|
|
264
|
+
* 🔴 A CLAIM IS NOT A CONVERSION. This reports a presentation fact — the user
|
|
265
|
+
* tapped Claim and was handed off. Advertiser conversion happens later, is
|
|
266
|
+
* asynchronous, and is server-authoritative: check it on your backend, never
|
|
267
|
+
* from the client.
|
|
268
|
+
*
|
|
269
|
+
* The payload mirrors iOS's and Android's `ClaimedOffer` field-for-field so the
|
|
270
|
+
* React Native and Flutter bridges line up:
|
|
271
|
+
*
|
|
272
|
+
* - `transactionId` is the claim's durable handle — the id the backend keys on,
|
|
273
|
+
* and the argument `didGrant()` and `waitForVerification()` take. It is how a
|
|
274
|
+
* completion that lands days later is traced back to this user and app, so
|
|
275
|
+
* keep it. It is OPTIONAL because the transaction write can fail while the
|
|
276
|
+
* claim itself genuinely happened; the SDK logs a warning when that occurs
|
|
277
|
+
* rather than fabricating a placeholder.
|
|
278
|
+
* - `offerId` / `campaignId` identify what was claimed. (On iOS these are the
|
|
279
|
+
* same value; on web they are distinct, and both are reported.)
|
|
280
|
+
* - `advertiserName` is the merchant's display name.
|
|
430
281
|
*/
|
|
431
282
|
{
|
|
432
283
|
status: 'claimed';
|
|
284
|
+
offerId: string;
|
|
285
|
+
campaignId: string;
|
|
286
|
+
advertiserName: string;
|
|
287
|
+
transactionId?: string;
|
|
433
288
|
}
|
|
434
289
|
/** The user dismissed the carousel without claiming. */
|
|
435
290
|
| {
|
|
@@ -440,48 +295,6 @@ export type ShowResult =
|
|
|
440
295
|
| {
|
|
441
296
|
status: 'unavailable';
|
|
442
297
|
};
|
|
443
|
-
/** Options for `redeem()`. */
|
|
444
|
-
export interface RedeemOptions {
|
|
445
|
-
/**
|
|
446
|
-
* Resolve the transaction made at this placement (the local placement->transaction map). When
|
|
447
|
-
* passed via Encore.placement(id).redeem() this is the placement id. If no transaction
|
|
448
|
-
* exists for the placement, resolves `none` — it never crosses to another placement.
|
|
449
|
-
*/
|
|
450
|
-
placement?: string;
|
|
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
|
-
*/
|
|
457
|
-
host?: {
|
|
458
|
-
name?: string;
|
|
459
|
-
status?: string;
|
|
460
|
-
logoUrl?: string;
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
/** Result of `redeem()`. */
|
|
464
|
-
export type RedeemResult =
|
|
465
|
-
/** The advertiser redirect was performed for the pending transaction. */
|
|
466
|
-
{
|
|
467
|
-
status: 'redeemed';
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
* The sheet closed without redeeming. `reason` mirrors show(): user-driven
|
|
471
|
-
* closes carry no reason or a user reason; internal failures carry
|
|
472
|
-
* `{ type: 'error', error }` — redeem() never rejects. On an error the pending
|
|
473
|
-
* transaction is untouched, so calling redeem() again later is safe.
|
|
474
|
-
*/
|
|
475
|
-
| {
|
|
476
|
-
status: 'dismissed';
|
|
477
|
-
reason?: NotGrantedReason;
|
|
478
|
-
} | {
|
|
479
|
-
status: 'expired';
|
|
480
|
-
}
|
|
481
|
-
/** STRICTLY "no pending transaction to redeem" — never an error disguise. */
|
|
482
|
-
| {
|
|
483
|
-
status: 'none';
|
|
484
|
-
};
|
|
485
298
|
/**
|
|
486
299
|
* A subscription/conversion event forwarded from the host (Tier-1 client signal).
|
|
487
300
|
* NON-AUTHORITATIVE — posted via the pk-authed analytics channel, never the HMAC
|
package/types/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":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G;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"}
|
|
@@ -18,11 +18,33 @@ export interface OfferCarouselOptions {
|
|
|
18
18
|
* carry paywall-flavored copy (a titleText/customHeadline default, or the hardcoded
|
|
19
19
|
* "Unlock 10 free articles…" fallback when neither is configured) or the thankYou
|
|
20
20
|
* layout's offerContext priming pair — reward has neither: its own headline already
|
|
21
|
-
* renders in the
|
|
21
|
+
* renders in the reward chrome above this carousel, and the modal's
|
|
22
22
|
* accessible name is already pointed at THAT title (see THANKYOU_TITLE_ID), so
|
|
23
23
|
* hiding this header is a11y-safe, not just visually tidier.
|
|
24
24
|
*/
|
|
25
25
|
hideHeader?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* SELECTION MODE (reward composition). Turns the carousel from "N self-contained
|
|
28
|
+
* offer tiles, each with its own Claim" into "a list you pick ONE offer from",
|
|
29
|
+
* matching `streaksCarousel.json`'s `autoSelectFirstOffer` + `selectOffer` model
|
|
30
|
+
* that iOS and Android already render. Three things change:
|
|
31
|
+
*
|
|
32
|
+
* - Cards lose their per-card Claim button (see OfferCardOptions.selectable) and
|
|
33
|
+
* become selection targets. The host drives the claim via `claimSelected()`.
|
|
34
|
+
* - The prev/next chevrons are replaced by a compact dot page indicator, the
|
|
35
|
+
* variant's `compactPageIndicator`.
|
|
36
|
+
* - The cards container becomes a real `role="listbox"`.
|
|
37
|
+
*
|
|
38
|
+
* SELECTION HAS EXACTLY ONE SOURCE: `#currentIndex`. Paging IS selecting and
|
|
39
|
+
* selecting IS paging — the centered card is the selected card, always. This is
|
|
40
|
+
* deliberate: iOS shipped a version where the CTA's offer and the carousel's
|
|
41
|
+
* position were two independent pieces of state, they diverged, and `claimOffer`
|
|
42
|
+
* silently dropped a nil offer (EncoreKit/swift#106). One index cannot diverge
|
|
43
|
+
* from itself.
|
|
44
|
+
*
|
|
45
|
+
* Off by default, so the churn-intervention and thankYou carousels are untouched.
|
|
46
|
+
*/
|
|
47
|
+
selectable?: boolean;
|
|
26
48
|
}
|
|
27
49
|
interface CarouselEventMap extends Record<string, unknown> {
|
|
28
50
|
offerClaim: {
|
|
@@ -51,6 +73,16 @@ interface CarouselEventMap extends Record<string, unknown> {
|
|
|
51
73
|
complete: {
|
|
52
74
|
claimed: boolean;
|
|
53
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* The selected offer changed (selection mode only). A STATE notification, not an
|
|
78
|
+
* analytics event — it exists so the sheet's single CTA can name what it will
|
|
79
|
+
* claim. It fires once at mount for the auto-selected first offer, which is what
|
|
80
|
+
* makes the CTA correct before the user touches anything.
|
|
81
|
+
*/
|
|
82
|
+
offerSelect: {
|
|
83
|
+
offer: Offer;
|
|
84
|
+
index: number;
|
|
85
|
+
};
|
|
54
86
|
}
|
|
55
87
|
export declare class OfferCarousel {
|
|
56
88
|
#private;
|
|
@@ -77,6 +109,32 @@ export declare class OfferCarousel {
|
|
|
77
109
|
* scroll as an effect. The highlight is not touched — it follows the motion.
|
|
78
110
|
*/
|
|
79
111
|
next(): void;
|
|
112
|
+
/**
|
|
113
|
+
* The offer the sheet's single CTA acts on. In selection mode this is the
|
|
114
|
+
* centered/selected card; elsewhere it is simply the current one. Never
|
|
115
|
+
* undefined for a rendered carousel (the constructor rejects an empty list),
|
|
116
|
+
* but typed honestly so callers cannot assume.
|
|
117
|
+
*/
|
|
118
|
+
getSelectedOffer(): Offer | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* Claim the SELECTED offer — the reward sheet's one bottom CTA (the variant's
|
|
121
|
+
* `claimOffer` action).
|
|
122
|
+
*
|
|
123
|
+
* It emits the SAME `offerClaim` event a per-card Claim button emits, on purpose:
|
|
124
|
+
* every downstream guarantee (transaction creation and its `transactionId`, the
|
|
125
|
+
* `use_case` stamp on claim analytics, the synchronous advertiser-window open that
|
|
126
|
+
* survives mobile popup blockers, the deferred/immediate branch) lives in that one
|
|
127
|
+
* handler in Encore.ts. Routing the new CTA through it means reward inherits all of
|
|
128
|
+
* it rather than growing a second, drifting claim path.
|
|
129
|
+
*/
|
|
130
|
+
claimSelected(): void;
|
|
131
|
+
/**
|
|
132
|
+
* Select the offer at `index` — the variant's `selectOffer` action, reached by
|
|
133
|
+
* tapping a card or by arrowing within the listbox. A user INTENT, so it follows
|
|
134
|
+
* exactly the same path as next()/previous(): commit domain state, render the
|
|
135
|
+
* semantic view, then run the scroll as an effect.
|
|
136
|
+
*/
|
|
137
|
+
selectOffer(index: number): void;
|
|
80
138
|
/**
|
|
81
139
|
* Navigate to previous offer — see next().
|
|
82
140
|
*/
|
|
@@ -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,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B;;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;IAqnBhB;;OAEG;IACH,OAAO,IAAI,IAAI;CA2BhB"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reward action block — the bottom of the post-action-reward sheet.
|
|
3
|
+
*
|
|
4
|
+
* Trust line, then a two-button CTA stack: ONE primary that claims the SELECTED
|
|
5
|
+
* offer, and a secondary that dismisses. This is the interaction model
|
|
6
|
+
* `streaksCarousel.json` describes and that iOS and Android already render; web
|
|
7
|
+
* previously put a Claim button on every card and offered no explicit decline.
|
|
8
|
+
*
|
|
9
|
+
* NOT a renderer. Every value below is read off the variant and hard-coded here —
|
|
10
|
+
* web has no SDUI engine, and the variant JSON is a design spec this file tracks by
|
|
11
|
+
* hand, never something the SDK parses:
|
|
12
|
+
*
|
|
13
|
+
* trust line 14 / regular, onBackground @ 0.55, 2-line clamp
|
|
14
|
+
* primary "Claim gift", 16 / bold, onAccent on accent, radius 12, 16px y-padding
|
|
15
|
+
* secondary "No thanks", 16 / medium, muted, 1px border, radius 12, 14px y-padding
|
|
16
|
+
* stack vStack spacing 8, inside a group of spacing 12, 20px gutters
|
|
17
|
+
*
|
|
18
|
+
* Callbacks rather than an EventEmitter: there are exactly two, both fire at most
|
|
19
|
+
* once per sheet, and neither has a second subscriber. The emitter would be
|
|
20
|
+
* ceremony around a pair of function calls.
|
|
21
|
+
*/
|
|
22
|
+
/** Copy the variant hard-codes. Named so the tests can assert parity by symbol. */
|
|
23
|
+
export declare const REWARD_COPY: {
|
|
24
|
+
readonly trust: "No charges until trial ends, cancel anytime.";
|
|
25
|
+
readonly primary: "Claim gift";
|
|
26
|
+
readonly secondary: "No thanks";
|
|
27
|
+
};
|
|
28
|
+
export interface RewardActionsOptions {
|
|
29
|
+
/** Claim the selected offer (the variant's `claimOffer` action). */
|
|
30
|
+
onClaim: () => void;
|
|
31
|
+
/** Dismiss the sheet (the variant's `close` action). */
|
|
32
|
+
onDecline: () => void;
|
|
33
|
+
/**
|
|
34
|
+
* Overrides the default trust line. Present so a publisher whose reward is not a
|
|
35
|
+
* free trial is not stuck asserting "No charges until trial ends" — the default
|
|
36
|
+
* is the variant's copy, not a universal truth.
|
|
37
|
+
*/
|
|
38
|
+
trustText?: string;
|
|
39
|
+
}
|
|
40
|
+
export declare class RewardActions {
|
|
41
|
+
#private;
|
|
42
|
+
constructor(options: RewardActionsOptions);
|
|
43
|
+
render(): HTMLElement;
|
|
44
|
+
/**
|
|
45
|
+
* Name the offer the CTA will claim.
|
|
46
|
+
*
|
|
47
|
+
* "Claim gift" alone is ambiguous the moment there is more than one card on
|
|
48
|
+
* screen and no per-card button left to disambiguate — a screen-reader user
|
|
49
|
+
* arrowing the listbox has no way to tell what the single bottom button now acts
|
|
50
|
+
* on. The visible label stays exactly "Claim gift" (the variant's copy, and what
|
|
51
|
+
* a sighted user reads), and the accessible name EXTENDS it rather than replacing
|
|
52
|
+
* it, which is what WCAG 2.5.3 Label in Name requires.
|
|
53
|
+
*
|
|
54
|
+
* Falls back to removing the label entirely — never to a half-built sentence —
|
|
55
|
+
* when the offer has no advertiser name, so the button is announced by its text.
|
|
56
|
+
*/
|
|
57
|
+
setSelectedOffer(advertiserName?: string): void;
|
|
58
|
+
destroy(): void;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=RewardActions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RewardActions.d.ts","sourceRoot":"","sources":["../../src/ui/RewardActions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,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;CACpB;AAED,qBAAa,aAAa;;gBAaZ,OAAO,EAAE,oBAAoB;IAIzC,MAAM,IAAI,WAAW;IAmCrB;;;;;;;;;;;;OAYG;IACH,gBAAgB,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI;IAe/C,OAAO,IAAI,IAAI;CAKhB"}
|