@encorekit/web-sdk 2.1.4 → 2.2.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 +20 -0
- 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 +54 -2
- package/types/analytics/events.d.ts.map +1 -1
- package/types/api/APIClient.d.ts +15 -1
- package/types/api/APIClient.d.ts.map +1 -1
- package/types/api/generated/types.d.ts +94 -7
- package/types/api/generated/types.d.ts.map +1 -1
- package/types/api/models.d.ts +7 -0
- package/types/api/models.d.ts.map +1 -1
- package/types/core/Configuration.d.ts +2 -0
- package/types/core/Configuration.d.ts.map +1 -1
- package/types/core/Encore.d.ts.map +1 -1
- package/types/core/giftVariant.d.ts +11 -6
- package/types/core/giftVariant.d.ts.map +1 -1
- package/types/core/share.d.ts +58 -0
- package/types/core/share.d.ts.map +1 -0
- package/types/core/unlockCode.d.ts +25 -0
- package/types/core/unlockCode.d.ts.map +1 -0
- package/types/core/version.d.ts +1 -1
- package/types/types.d.ts +61 -8
- package/types/types.d.ts.map +1 -1
- package/types/ui/CodeUnlock.d.ts +151 -0
- package/types/ui/CodeUnlock.d.ts.map +1 -0
- package/types/ui/GiftSheet.d.ts +47 -3
- package/types/ui/GiftSheet.d.ts.map +1 -1
- package/types/ui/GiftUnwrap.d.ts +70 -0
- package/types/ui/GiftUnwrap.d.ts.map +1 -1
- package/types/ui/OfferModal.d.ts +30 -0
- package/types/ui/OfferModal.d.ts.map +1 -1
- package/types/ui/giftUnwrapArt.d.ts +6 -0
- package/types/ui/giftUnwrapArt.d.ts.map +1 -1
- package/types/ui/giftUnwrapCopy.d.ts +20 -0
- package/types/ui/giftUnwrapCopy.d.ts.map +1 -1
- package/types/ui/styles.d.ts.map +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `share` action: hand the link the backend minted for an offer to the user.
|
|
3
|
+
*
|
|
4
|
+
* THE LINK IS THE SERVER'S, NEVER THIS SDK'S. It arrives as `OfferModel.shareUrl` and
|
|
5
|
+
* is shared exactly as served. An offer without one shares nothing and reports
|
|
6
|
+
* `missing_share_link`; there is no fallback to the advertiser URL or to any link this
|
|
7
|
+
* SDK could assemble, because a client-built link is forgeable and unattributed. Same
|
|
8
|
+
* rule as iOS (swift#156) and Android (android#93).
|
|
9
|
+
*
|
|
10
|
+
* TWO ROUTES, in order:
|
|
11
|
+
* 1. `navigator.share`, the system share sheet. It resolves when the user sent the
|
|
12
|
+
* link and rejects when they backed out, so web, like iOS, can tell a completed
|
|
13
|
+
* share from a cancel. A cancel is reported as `completed=false`, never as a
|
|
14
|
+
* failure, and it is not always spelled `AbortError`: `NotAllowedError` and
|
|
15
|
+
* `InvalidStateError` count too (see `CANCEL_NAMES`).
|
|
16
|
+
* 2. The clipboard, where there is no share sheet (most desktop browsers) or the
|
|
17
|
+
* sheet rejected the data itself. The caller shows a visible confirmation; the
|
|
18
|
+
* completed event says `clipboard`.
|
|
19
|
+
* When neither takes the link the tap fails with `share_unavailable`.
|
|
20
|
+
*
|
|
21
|
+
* 🔴 CALLED INSIDE THE CLICK. `navigator.share` and, on Safari, the clipboard need
|
|
22
|
+
* transient user activation, so nothing may be awaited before the first call. An
|
|
23
|
+
* `async` function runs synchronously up to its first `await`, which is what keeps
|
|
24
|
+
* the `navigator.share` call inside the gesture.
|
|
25
|
+
*
|
|
26
|
+
* NEVER THROWS. Every browser call is guarded; the worst outcome is a reported failure.
|
|
27
|
+
*/
|
|
28
|
+
import { type ShareDestinationValue, type ShareFailureReasonValue } from '../analytics/events';
|
|
29
|
+
export type ShareOutcome = {
|
|
30
|
+
status: 'shared';
|
|
31
|
+
destination: ShareDestinationValue;
|
|
32
|
+
} | {
|
|
33
|
+
status: 'cancelled';
|
|
34
|
+
} | {
|
|
35
|
+
status: 'failed';
|
|
36
|
+
reason: ShareFailureReasonValue;
|
|
37
|
+
};
|
|
38
|
+
/** Send `url` through the share sheet, else the clipboard. Resolves; never rejects. */
|
|
39
|
+
export declare function sendShareLink(url: string): Promise<ShareOutcome>;
|
|
40
|
+
/** Receives the three share events. Thrown errors are contained, never surfaced. */
|
|
41
|
+
export interface ShareReporter<C> {
|
|
42
|
+
tapped(ctx: C): void;
|
|
43
|
+
failed(ctx: C, reason: ShareFailureReasonValue): void;
|
|
44
|
+
completed(ctx: C, destination: ShareDestinationValue | undefined, completed: boolean): void;
|
|
45
|
+
}
|
|
46
|
+
export interface ShareAction<C> {
|
|
47
|
+
/**
|
|
48
|
+
* Share `link` for the offer `ctx` describes. Returns null, reporting nothing, when a
|
|
49
|
+
* share is already in flight or the action is locked: a double tap must not stack two
|
|
50
|
+
* share sheets or count one tap twice. Otherwise every call reports `tapped` and then
|
|
51
|
+
* exactly one of `completed` or `failed`, before the returned promise settles.
|
|
52
|
+
*/
|
|
53
|
+
run(link: string | undefined, ctx: C): Promise<ShareOutcome> | null;
|
|
54
|
+
/** Refuse every later call. For a presentation that is closing after a share. */
|
|
55
|
+
lock(): void;
|
|
56
|
+
}
|
|
57
|
+
export declare function createShareAction<C>(reporter: ShareReporter<C>, send?: (url: string) => Promise<ShareOutcome>): ShareAction<C>;
|
|
58
|
+
//# sourceMappingURL=share.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../../src/core/share.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC7B,MAAM,qBAAqB,CAAC;AAG7B,MAAM,MAAM,YAAY,GACpB;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,WAAW,EAAE,qBAAqB,CAAA;CAAE,GACxD;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,GACvB;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,uBAAuB,CAAA;CAAE,CAAC;AAW1D,uFAAuF;AACvF,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAgBtE;AAwDD,oFAAoF;AACpF,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC;IACrB,MAAM,CAAC,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,uBAAuB,GAAG,IAAI,CAAC;IACtD,SAAS,CAAC,GAAG,EAAE,CAAC,EAAE,WAAW,EAAE,qBAAqB,GAAG,SAAS,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI,CAAC;CAC7F;AAED,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B;;;;;OAKG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;IACpE,iFAAiF;IACjF,IAAI,IAAI,IAAI,CAAC;CACd;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,IAAI,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAiB,GAC3D,WAAW,CAAC,CAAC,CAAC,CA6ChB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one place a `codeUnlock` code is judged. PLACEHOLDER: any non-empty code passes.
|
|
3
|
+
* The code is never sent anywhere; a real check replaces `checkUnlockCode` alone.
|
|
4
|
+
*/
|
|
5
|
+
/** Longest code the input accepts. A code is a short word, not a payload. */
|
|
6
|
+
export declare const UNLOCK_CODE_MAX_LENGTH = 64;
|
|
7
|
+
export type UnlockCodeVerdict = {
|
|
8
|
+
ok: true;
|
|
9
|
+
}
|
|
10
|
+
/** `rejected` is for a real check; the placeholder only ever says `empty`. */
|
|
11
|
+
| {
|
|
12
|
+
ok: false;
|
|
13
|
+
reason: 'empty' | 'rejected';
|
|
14
|
+
};
|
|
15
|
+
/** A code as typed or linked, trimmed and capped. Anything but a string is empty. */
|
|
16
|
+
export declare function normalizeUnlockCode(raw: unknown): string;
|
|
17
|
+
/**
|
|
18
|
+
* The "Up to {amount} in rewards" amount, or null for no line. Page-supplied: a campaign's
|
|
19
|
+
* oldPrice/newPrice are free-text display prices with no currency or period, so nothing on
|
|
20
|
+
* an offer states a reward value. Only a short money amount is accepted, never free text.
|
|
21
|
+
*/
|
|
22
|
+
export declare function unlockValueAmount(raw: unknown): string | null;
|
|
23
|
+
/** Does `code` unlock the offers? Placeholder: yes, for any non-empty code. */
|
|
24
|
+
export declare function checkUnlockCode(code: string): Promise<UnlockCodeVerdict>;
|
|
25
|
+
//# sourceMappingURL=unlockCode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unlockCode.d.ts","sourceRoot":"","sources":["../../src/core/unlockCode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,6EAA6E;AAC7E,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,MAAM,MAAM,iBAAiB,GACzB;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE;AACd,8EAA8E;GAC5E;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,OAAO,GAAG,UAAU,CAAA;CAAE,CAAC;AAEhD,qFAAqF;AACrF,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAGxD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAQ7D;AAED,+EAA+E;AAC/E,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAExE"}
|
package/types/core/version.d.ts
CHANGED
package/types/types.d.ts
CHANGED
|
@@ -254,6 +254,10 @@ export interface PlacementOptions {
|
|
|
254
254
|
* On the reward composition the "No thanks" button becomes "Next offer"
|
|
255
255
|
* rather than disappearing — see `RewardActionsOptions.secondary`. A button
|
|
256
256
|
* reading "No thanks" on a sheet with no way out is a control that lies.
|
|
257
|
+
*
|
|
258
|
+
* The `codeUnlock` code screen ignores `false` while it is showing: its × and
|
|
259
|
+
* Escape stay, so a code that is not accepted can never trap the user on a
|
|
260
|
+
* full-screen page. The option applies from the moment the offers show.
|
|
257
261
|
*/
|
|
258
262
|
dismissible?: boolean;
|
|
259
263
|
/**
|
|
@@ -272,6 +276,25 @@ export interface PlacementOptions {
|
|
|
272
276
|
*/
|
|
273
277
|
statusIcon?: 'success' | 'none';
|
|
274
278
|
appearance?: AppearanceConfig;
|
|
279
|
+
/**
|
|
280
|
+
* A code to type into the `codeUnlock` screen ahead of time — the code a link or an
|
|
281
|
+
* email carried. The user still presses Unlock. Ignored by every other surface.
|
|
282
|
+
*
|
|
283
|
+
* The SDK never reads the page URL for it: the page that owns the URL decides which
|
|
284
|
+
* parameter holds the code and passes it here. The code is not sent anywhere; see
|
|
285
|
+
* `core/unlockCode.ts`. Trimmed and capped at 64 characters; a non-string is ignored.
|
|
286
|
+
*/
|
|
287
|
+
unlockCode?: string;
|
|
288
|
+
/**
|
|
289
|
+
* The most the `codeUnlock` offers are worth, as a short amount: `'$45'`, `'£20'`,
|
|
290
|
+
* `'45 USD'`. Shown as "Up to $45 in rewards" on the code screen. Anything that is not
|
|
291
|
+
* a short money amount shows no line, so a link cannot put its own text on the page.
|
|
292
|
+
*
|
|
293
|
+
* Supplied by the page, not derived: no offer field states a reward value today
|
|
294
|
+
* (`oldPrice`/`newPrice` are free-text display prices with no currency). Ignored by
|
|
295
|
+
* every other surface.
|
|
296
|
+
*/
|
|
297
|
+
unlockValueLabel?: string;
|
|
275
298
|
}
|
|
276
299
|
/**
|
|
277
300
|
* Presentation callbacks for the bare `Encore.show()` form.
|
|
@@ -434,14 +457,15 @@ export interface EncoreConfig {
|
|
|
434
457
|
* `'giftUnwrap'` — so a tester can pick a flow instead of taking whichever one the
|
|
435
458
|
* server would have picked.
|
|
436
459
|
*
|
|
437
|
-
* **It never affects live traffic.** All it does is add a
|
|
438
|
-
* parameter to the two `/config` fetches. The backend honours
|
|
439
|
-
* on a TEST KEY (`pk_test_*`) — where it works for any app, so you
|
|
440
|
-
* our reward variants against your own test key — and
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
*
|
|
444
|
-
*
|
|
460
|
+
* **It never affects a publisher's live traffic.** All it does is add a
|
|
461
|
+
* `demoVariant` query parameter to the two `/config` fetches. The backend honours
|
|
462
|
+
* that parameter on a TEST KEY (`pk_test_*`) — where it works for any app, so you
|
|
463
|
+
* can preview our reward variants against your own test key — and on a live key
|
|
464
|
+
* only for Encore's own demo apps. For every other app it is ignored on a live
|
|
465
|
+
* key: set it on a `pk_live_*` key and you get exactly the response, and exactly
|
|
466
|
+
* the surface, you would have got without it; the SDK logs one `[DEMO]` line
|
|
467
|
+
* saying so rather than leaving you to wonder. It never renders anything the
|
|
468
|
+
* server did not serve.
|
|
445
469
|
*
|
|
446
470
|
* Changing it between presentations drops every in-memory answer the previous
|
|
447
471
|
* flow produced, so the next `show()` asks the server again. Blank,
|
|
@@ -458,6 +482,35 @@ export interface EncoreConfig {
|
|
|
458
482
|
* was honoured. Absent for everyone else.
|
|
459
483
|
*/
|
|
460
484
|
demoVariant?: string;
|
|
485
|
+
/**
|
|
486
|
+
* Let a labelled reward placement resolve its own variant. Defaults to `false`.
|
|
487
|
+
*
|
|
488
|
+
* Encore can serve a different reward variant per placement label (for example
|
|
489
|
+
* one flow for `'email_code'` and another for `'email'`). The variant the SDK
|
|
490
|
+
* prefetches at `configure()` is chosen before any placement is known, so it
|
|
491
|
+
* cannot carry that choice. With this on, a `rewardUsers` presentation that has a
|
|
492
|
+
* placement label — `Encore.placement('email_code', { useCase: 'rewardUsers' })`,
|
|
493
|
+
* or `show(options, { useCase: 'rewardUsers' }, 'email_code')` — makes one
|
|
494
|
+
* `GET /config?useCase=post-action-reward&placementId=<label>` before the sheet
|
|
495
|
+
* renders and presents the variant that response names. Analytics for that
|
|
496
|
+
* presentation carry that variant's id.
|
|
497
|
+
*
|
|
498
|
+
* - The label is trimmed and capped at 64 characters, exactly as it is on the
|
|
499
|
+
* offers request and on analytics.
|
|
500
|
+
* - A settled answer is reused for every presentation of that label for the rest
|
|
501
|
+
* of the session (until `reset()`), while a failed or discarded request is
|
|
502
|
+
* retried on the next presentation.
|
|
503
|
+
* - It never blocks or breaks a presentation. If the request fails, is slow, or
|
|
504
|
+
* resolves nothing, the surface resolves exactly as it would with this off:
|
|
505
|
+
* the prefetched variant when there is one, otherwise the SDK's usual
|
|
506
|
+
* on-demand `/config?useCase=` fetch.
|
|
507
|
+
* - Paywall (`reduceChurn`) presentations and unlabelled ones are unaffected.
|
|
508
|
+
*
|
|
509
|
+
* Off, the SDK's requests are exactly what they were before the option existed.
|
|
510
|
+
* Only a literal `true` turns it on. Like the other options it is read from the
|
|
511
|
+
* first `configure()` call.
|
|
512
|
+
*/
|
|
513
|
+
resolveVariantsByPlacement?: boolean;
|
|
461
514
|
}
|
|
462
515
|
/** Result of `show()` / `present()`. */
|
|
463
516
|
export type ShowResult =
|
package/types/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAM/C;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IA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AAC,KAAK,IAAI,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code unlock — the screen the `codeUnlock` variant puts in front of the gift picker.
|
|
3
|
+
*
|
|
4
|
+
* Two screens in one root, in the order the user meets them:
|
|
5
|
+
*
|
|
6
|
+
* 1. CODE. A full-screen landing page at every width, the way a page reached from an
|
|
7
|
+
* email should read: the host's name, a value card ("Up to $45 in rewards" when the
|
|
8
|
+
* page supplies an amount, `PlacementOptions.unlockValueLabel`), "Your rewards are
|
|
9
|
+
* waiting", one line and an inline code field with "Unlock my rewards" attached;
|
|
10
|
+
* then a preview of the loaded offers (logos and names, no count),
|
|
11
|
+
* then three short steps. Two columns from 900px, stacked below. A code from the
|
|
12
|
+
* link (`PlacementOptions.unlockCode`) is already typed in; the user still
|
|
13
|
+
* presses Unlock, because pressing it is the moment.
|
|
14
|
+
* 2. OFFERS. THE SAME PAGE. The header and the value card stay where they were (the
|
|
15
|
+
* card now open), the code form gives way to "Your exclusive offers" under an
|
|
16
|
+
* "Exclusive offers unlocked" badge, and the picker's own rows, "More gifts", CTA
|
|
17
|
+
* and terms line render INLINE where the preview strip was. No modal frame and no
|
|
18
|
+
* backdrop: `Encore` hands this class the picker's surface and action block
|
|
19
|
+
* ({@link CodeUnlockParts}) and it lays them out on the page, under the picker's
|
|
20
|
+
* own class names so the styling is the picker's rather than a copy of it.
|
|
21
|
+
*
|
|
22
|
+
* ## The keyboard
|
|
23
|
+
*
|
|
24
|
+
* The screen fills the layout viewport, which an on-screen keyboard covers without
|
|
25
|
+
* resizing on iOS and on Android's default. While the code screen shows, the gate follows
|
|
26
|
+
* `visualViewport` and pads the screen by the covered height (`--encore-cu-kb`), so the
|
|
27
|
+
* centred content moves up and the input and Unlock stay above the keyboard.
|
|
28
|
+
*
|
|
29
|
+
* 🔴 THIS IS A GATE, NOT A SURFACE. It never selects, claims or reports an offer: the
|
|
30
|
+
* picker behind it does all of that through the one claim path (see `rewardSurface.ts`),
|
|
31
|
+
* so a `codeUnlock` claim is byte-for-byte a `giftPicker` claim.
|
|
32
|
+
*
|
|
33
|
+
* ## The code goes nowhere
|
|
34
|
+
*
|
|
35
|
+
* The typed code is read by {@link checkUnlockCode} in `core/unlockCode.ts` and nothing
|
|
36
|
+
* else. It is not an analytics property and not a request parameter. Today that check
|
|
37
|
+
* is a placeholder that accepts any non-empty code; making codes real means changing
|
|
38
|
+
* that one function (it is injectable here only so tests can stand in for it).
|
|
39
|
+
*
|
|
40
|
+
* ## Impressions wait for the unlock
|
|
41
|
+
*
|
|
42
|
+
* The offers screen is `hidden` (display: none) until the reveal ends, so the shared
|
|
43
|
+
* impression gate's paint check refuses every row behind the code screen, and the
|
|
44
|
+
* offers' entrance fade holds them until it finishes. An offer is billed only once the
|
|
45
|
+
* user can actually see it, which is the same rule every other surface keeps.
|
|
46
|
+
*
|
|
47
|
+
* ## The reveal (see codeUnlockStyles in styles.ts)
|
|
48
|
+
*
|
|
49
|
+
* One timeline in two halves, about 850ms in all. On the code screen the shackle lifts
|
|
50
|
+
* and swings open while the form fades away ({@link CODE_UNLOCK_REVEAL_MS}); then the
|
|
51
|
+
* screens swap and the badge pops in as the offers slide up ({@link CODE_UNLOCK_ENTER_MS}). The swap is a
|
|
52
|
+
* timer, not `animationend`, so a hidden tab or disabled animations still arrive at the
|
|
53
|
+
* offers. Every base rule is the finished state; reduced motion swaps at once.
|
|
54
|
+
*/
|
|
55
|
+
import type { OfferModel as Offer } from '../api/models';
|
|
56
|
+
import { type UnlockCodeVerdict } from '../core/unlockCode';
|
|
57
|
+
/** The code screen's half of the reveal. The stylesheet carries the same number. */
|
|
58
|
+
export declare const CODE_UNLOCK_REVEAL_MS = 450;
|
|
59
|
+
/** The offers' entrance after the swap. The stylesheet carries the same number. */
|
|
60
|
+
export declare const CODE_UNLOCK_ENTER_MS = 400;
|
|
61
|
+
/**
|
|
62
|
+
* How long both screens are on screen together at the swap.
|
|
63
|
+
*
|
|
64
|
+
* THE TWO SCREENS CROSS-FADE, they do not take turns. Hiding the code screen and then
|
|
65
|
+
* fading the offers in leaves a beat with neither on screen, which reads as a white
|
|
66
|
+
* flash; for that beat the outgoing screen is laid over the incoming one and fades out
|
|
67
|
+
* while it rises. The stylesheet carries the same number.
|
|
68
|
+
*/
|
|
69
|
+
export declare const CODE_UNLOCK_CROSSFADE_MS = 220;
|
|
70
|
+
/** The id on the code screen's heading, which names the dialog while it shows. */
|
|
71
|
+
export declare const CODE_UNLOCK_TITLE_ID: string;
|
|
72
|
+
/** Forget that a code was accepted. Called by `Encore.reset()`, and by tests. */
|
|
73
|
+
export declare function forgetUnlock(): void;
|
|
74
|
+
/** Every sentence the gate says. */
|
|
75
|
+
export declare const CODE_UNLOCK_COPY: {
|
|
76
|
+
readonly title: "Your rewards are waiting";
|
|
77
|
+
readonly inputLabel: "Your code";
|
|
78
|
+
readonly inputPlaceholder: "Enter your code";
|
|
79
|
+
readonly cta: "Unlock my rewards";
|
|
80
|
+
readonly emptyError: "Enter your code to continue.";
|
|
81
|
+
readonly rejectedError: "That code didn’t work. Check it and try again.";
|
|
82
|
+
readonly unlocked: "Exclusive offers unlocked";
|
|
83
|
+
readonly cardFallback: "Rewards picked for you";
|
|
84
|
+
readonly previewTitle: "Rewards you can choose from";
|
|
85
|
+
readonly previewNote: "Unlock to pick yours.";
|
|
86
|
+
readonly howTitle: "How it works";
|
|
87
|
+
readonly steps: readonly [readonly ["Enter your code", "It’s in the email we sent you."], readonly ["Pick a reward", "Choose the one you like best."], readonly ["Enjoy it", "Finish on the brand’s site."]];
|
|
88
|
+
/** The picker's headline behind the gate, in place of the served one. */
|
|
89
|
+
readonly offersHeadline: "Your exclusive offers";
|
|
90
|
+
readonly offersSubline: "Pick one, it’s on us";
|
|
91
|
+
};
|
|
92
|
+
/** The line under the heading, naming the amount when the page supplied one. */
|
|
93
|
+
export declare function unlockSubline(amount: string | null): string;
|
|
94
|
+
export interface CodeUnlockOptions {
|
|
95
|
+
/** The code from the link, typed in ahead of time. Trimmed and capped; not checked until Unlock. */
|
|
96
|
+
initialCode?: string;
|
|
97
|
+
/**
|
|
98
|
+
* The most the offers are worth, as the page states it ("$45"). Publisher-supplied;
|
|
99
|
+
* see {@link unlockValueAmount} for why and for what is accepted. No valid amount, no line.
|
|
100
|
+
*/
|
|
101
|
+
valueLabel?: string;
|
|
102
|
+
/**
|
|
103
|
+
* The offers the picker behind the gate will show. The landing page previews them
|
|
104
|
+
* (logo and name) and counts them; it never links, selects or reports them.
|
|
105
|
+
*/
|
|
106
|
+
offers?: readonly Offer[];
|
|
107
|
+
/** The host app's name for the page header (`values.text.appName`). No name, no header. */
|
|
108
|
+
hostName?: string;
|
|
109
|
+
/** The host app's icon beside that name. */
|
|
110
|
+
hostIconUrl?: string;
|
|
111
|
+
/** Called once, when the offers screen is showing. */
|
|
112
|
+
onUnlock?: () => void;
|
|
113
|
+
/** The code check. Tests only: production always uses {@link checkUnlockCode}. */
|
|
114
|
+
check?: (code: string) => Promise<UnlockCodeVerdict>;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The unlocked screen's content, built by `Encore`: the picker's surface element and
|
|
118
|
+
* its action block, plus the copy the reward chain resolved. The gate lays them out; it
|
|
119
|
+
* never builds a row or claims anything itself.
|
|
120
|
+
*/
|
|
121
|
+
export interface CodeUnlockParts {
|
|
122
|
+
/** The resolved headline, which also names the dialog once unlocked. */
|
|
123
|
+
title: string;
|
|
124
|
+
subtitle?: string;
|
|
125
|
+
/** `GiftPicker.render()`: the rows, "More gifts" and its sheet. */
|
|
126
|
+
surface: HTMLElement;
|
|
127
|
+
/** `RewardActions.render()`: the CTA and the terms line. */
|
|
128
|
+
actions?: HTMLElement;
|
|
129
|
+
}
|
|
130
|
+
export interface CodeUnlockComposeOptions {
|
|
131
|
+
/**
|
|
132
|
+
* Point the dialog's `aria-labelledby` at `id`: the code screen's heading while it
|
|
133
|
+
* shows, `REWARD_TITLE_ID` after the unlock. A callback because the modal is Encore's.
|
|
134
|
+
*/
|
|
135
|
+
setLabelledBy?: (id: string) => void;
|
|
136
|
+
}
|
|
137
|
+
export declare class CodeUnlock {
|
|
138
|
+
#private;
|
|
139
|
+
constructor(options?: CodeUnlockOptions);
|
|
140
|
+
isUnlocked(): boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Build both screens of the page and return the root to hand the modal.
|
|
143
|
+
*
|
|
144
|
+
* The code screen shows; the unlocked screen is built now and kept `hidden`, so the
|
|
145
|
+
* picker's rows are laid out but painted by nothing until the unlock — which is what
|
|
146
|
+
* keeps their impressions until then.
|
|
147
|
+
*/
|
|
148
|
+
compose(parts: CodeUnlockParts, options?: CodeUnlockComposeOptions): HTMLElement;
|
|
149
|
+
destroy(): void;
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=CodeUnlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeUnlock.d.ts","sourceRoot":"","sources":["../../src/ui/CodeUnlock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAWH,OAAO,KAAK,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAKL,KAAK,iBAAiB,EACvB,MAAM,oBAAoB,CAAC;AAE5B,oFAAoF;AACpF,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,mFAAmF;AACnF,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,kFAAkF;AAClF,eAAO,MAAM,oBAAoB,QAA2B,CAAC;AAgB7D,iFAAiF;AACjF,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAKD,oCAAoC;AACpC,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;IAiB3B,yEAAyE;;;CAGjE,CAAC;AAEX,gFAAgF;AAChF,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAI3D;AAiBD,MAAM,WAAW,iBAAiB;IAChC,oGAAoG;IACpG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,KAAK,EAAE,CAAC;IAC1B,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,kFAAkF;IAClF,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACtD;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,OAAO,EAAE,WAAW,CAAC;IACrB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAED,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAED,qBAAa,UAAU;;gBAsBT,OAAO,GAAE,iBAAsB;IAI3C,UAAU,IAAI,OAAO;IAIrB;;;;;;OAMG;IACH,OAAO,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,GAAE,wBAA6B,GAAG,WAAW;IAifpF,OAAO,IAAI,IAAI;CAkBhB"}
|
package/types/ui/GiftSheet.d.ts
CHANGED
|
@@ -63,10 +63,16 @@ export interface GiftSheetOptions {
|
|
|
63
63
|
onCommit: (index: number) => void;
|
|
64
64
|
/** The pick changed: the picked offer, or null once cleared. The footer follows it. */
|
|
65
65
|
onPick?: (offer: Offer | null) => void;
|
|
66
|
-
/**
|
|
67
|
-
|
|
66
|
+
/**
|
|
67
|
+
* The surface's impression gate. Cards are registered only while the sheet is open.
|
|
68
|
+
* Omitted, the sheet reports no impressions at all: `giftUnwrap`'s keep-for-later
|
|
69
|
+
* panel lists gifts the rows already reported, and the variant marks it
|
|
70
|
+
* `impressionProbe: none`. Registering there would spend the gate's once-per-offer
|
|
71
|
+
* budget on a card that must not count.
|
|
72
|
+
*/
|
|
73
|
+
impressions?: ImpressionGate;
|
|
68
74
|
/** The gate judged the card for `index` shown. The surface emits the impression. */
|
|
69
|
-
onShown
|
|
75
|
+
onShown?: (index: number) => void;
|
|
70
76
|
/** The surface's listener lifetime; aborting it detaches every sheet listener. */
|
|
71
77
|
signal: AbortSignal;
|
|
72
78
|
/** The sheet's heading and group name. Defaults to `GIFT_COPY.sheetTitle` ("Other gifts"). */
|
|
@@ -92,6 +98,30 @@ export interface GiftSheetOptions {
|
|
|
92
98
|
* passes a label that does not promise a claim.
|
|
93
99
|
*/
|
|
94
100
|
ctaLabel?: (offer: Offer) => string;
|
|
101
|
+
/** A line under the heading. Newlines are kept. Absent by default. */
|
|
102
|
+
subtitle?: string;
|
|
103
|
+
/**
|
|
104
|
+
* What the close control AND Escape do. Defaults to closing the sheet. The
|
|
105
|
+
* keep-for-later panel's close is the presentation's real close, so it passes one
|
|
106
|
+
* that dismisses. The scrim always just closes the sheet.
|
|
107
|
+
*/
|
|
108
|
+
onClose?: () => void;
|
|
109
|
+
/** An extra class on the layer, for a sheet styled as something else (the panel). */
|
|
110
|
+
layerClass?: string;
|
|
111
|
+
/**
|
|
112
|
+
* `false` never draws the category tab strip. The keep-for-later panel lists a
|
|
113
|
+
* handful of gifts in one row, as the native panel does, and a strip would hide the
|
|
114
|
+
* selection it opens on behind another tab. Defaults to the data-driven strip.
|
|
115
|
+
*/
|
|
116
|
+
tabs?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Whether the CTA is drawn for this pick. Defaults to always. The keep-for-later
|
|
119
|
+
* panel draws it only for a gift with a share link, as the native CTA's
|
|
120
|
+
* `hasOfferAttribute: shareUrl` gate does.
|
|
121
|
+
*/
|
|
122
|
+
ctaFor?: (offer: Offer) => boolean;
|
|
123
|
+
/** Called once the sheet has closed, whatever closed it: the scrim or `close()`. */
|
|
124
|
+
onClosed?: () => void;
|
|
95
125
|
}
|
|
96
126
|
export declare class GiftSheet {
|
|
97
127
|
#private;
|
|
@@ -119,7 +149,21 @@ export declare class GiftSheet {
|
|
|
119
149
|
* categories the sheet holds; the selected tab survives when it still exists.
|
|
120
150
|
*/
|
|
121
151
|
renderList(): void;
|
|
152
|
+
/**
|
|
153
|
+
* Pick the card for `index` from outside, as the keep-for-later panel does with the
|
|
154
|
+
* surface's selection so its CTA can act at once. Ignored when that card is not
|
|
155
|
+
* listed: the CTA must never name an offer the sheet does not show.
|
|
156
|
+
*/
|
|
157
|
+
pick(index: number): void;
|
|
122
158
|
open(opener?: HTMLElement): void;
|
|
159
|
+
/**
|
|
160
|
+
* Freeze the sheet while something it started finishes (the keep-for-later panel's
|
|
161
|
+
* wait before it closes): every card and the CTA are disabled and the scrim does
|
|
162
|
+
* nothing. The close control and Escape still work, as ways out. `true` restores.
|
|
163
|
+
*/
|
|
164
|
+
setInteractive(interactive: boolean): void;
|
|
165
|
+
/** True from `open()` until `close()`: whether the sheet is up, or on its way up. */
|
|
166
|
+
isOpen(): boolean;
|
|
123
167
|
close(): void;
|
|
124
168
|
destroy(): void;
|
|
125
169
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GiftSheet.d.ts","sourceRoot":"","sources":["../../src/ui/GiftSheet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;AAKzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB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AM,CAAC;IACpC,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,qFAAqF;IACrF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC;IACnC,oFAAoF;IACpF,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,qBAAa,SAAS;;gBAmCR,OAAO,EAAE,gBAAgB;IAKrC;;;;;;;;;;;;OAYG;IACH,MAAM,IAAI,WAAW;IAoIrB;;;;;;;OAOG;IACH,UAAU,IAAI,IAAI;IA+QlB;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAwDzB,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI;IAuChC;;;;OAIG;IACH,cAAc,CAAC,WAAW,EAAE,OAAO,GAAG,IAAI;IAe1C,qFAAqF;IACrF,MAAM,IAAI,OAAO;IAIjB,KAAK,IAAI,IAAI;IA0Db,OAAO,IAAI,IAAI;CAahB"}
|
package/types/ui/GiftUnwrap.d.ts
CHANGED
|
@@ -47,6 +47,23 @@
|
|
|
47
47
|
* neither (see `api/models.ts`). Inventing either from list order or brand names would
|
|
48
48
|
* be a guess that looks like data, so both wait on a real field.
|
|
49
49
|
*
|
|
50
|
+
* ## Share designs (backend#659)
|
|
51
|
+
*
|
|
52
|
+
* `shareFromHeader` and `shareForLater` derive from the same `threeLightSteps` file this
|
|
53
|
+
* surface renders, so they are this surface plus a `share` design, not new surfaces:
|
|
54
|
+
*
|
|
55
|
+
* - `'header'`: a share control at the top right of screen 1, sharing the selection.
|
|
56
|
+
* `Encore` moves the × to the top left. A share leaves the user on the sheet.
|
|
57
|
+
* - `'forLater'`: the "Keep your gift for later" panel, a second `GiftSheet` over a
|
|
58
|
+
* scrim with the first {@link KEEP_PANEL_LIMIT} gifts and a "Share {gift}" CTA.
|
|
59
|
+
* `Encore` opens it from the ×, Escape and the backdrop; its own close (and Escape
|
|
60
|
+
* inside it) is the presentation's real close; the scrim returns to the sheet.
|
|
61
|
+
*
|
|
62
|
+
* Both emit `offerShare` (subscribe with `onShareEvent`) for the SELECTED offer, synchronously inside the click. The
|
|
63
|
+
* surface shares nothing itself: the link, the events and what a completed share does
|
|
64
|
+
* are `Encore`'s. The panel's cards report no impressions (the variant's
|
|
65
|
+
* `impressionProbe: none`); the rows already did.
|
|
66
|
+
*
|
|
50
67
|
* ## The reveal (see giftUnwrapStyles in styles.ts)
|
|
51
68
|
*
|
|
52
69
|
* Four elements, four tracks, one 1752ms timeline with the design's keyframe stops on
|
|
@@ -58,6 +75,19 @@ import type { OfferModel as Offer } from '../api/models';
|
|
|
58
75
|
import { type ButtonSlot } from './appearance';
|
|
59
76
|
import type { RewardSurface, RewardSurfaceEventMap } from './rewardSurface';
|
|
60
77
|
import { ImpressionGate } from './impressionGate';
|
|
78
|
+
/**
|
|
79
|
+
* The shared surface events plus the two only the share designs emit. Kept off
|
|
80
|
+
* `RewardSurfaceEventMap`, which the carousel implements too.
|
|
81
|
+
*/
|
|
82
|
+
export type GiftUnwrapEventMap = RewardSurfaceEventMap & {
|
|
83
|
+
/** Share this offer's link. Emitted synchronously inside the click. */
|
|
84
|
+
offerShare: {
|
|
85
|
+
offer: Offer;
|
|
86
|
+
index: number;
|
|
87
|
+
};
|
|
88
|
+
/** The keep-for-later panel's close, which is the presentation's real close. */
|
|
89
|
+
closeRequest: undefined;
|
|
90
|
+
};
|
|
61
91
|
/** How many gifts screen 1 shows as rows. The rest go behind "Show more gifts". */
|
|
62
92
|
export declare const UNWRAP_ROW_LIMIT = 3;
|
|
63
93
|
/**
|
|
@@ -66,6 +96,12 @@ export declare const UNWRAP_ROW_LIMIT = 3;
|
|
|
66
96
|
*/
|
|
67
97
|
export declare const UNWRAP_REVEAL_MS = 1752;
|
|
68
98
|
export type UnwrapScreen = 'pick' | 'ready';
|
|
99
|
+
/** Which "share for later" design this surface carries, if any. See the header. */
|
|
100
|
+
export type ShareDesign = 'header' | 'forLater';
|
|
101
|
+
/** How many gifts the keep-for-later panel lists: the variant's `limit: 5`. */
|
|
102
|
+
export declare const KEEP_PANEL_LIMIT = 5;
|
|
103
|
+
/** How long "Link copied" stays up. `Encore` closes `forLater` after the same wait. */
|
|
104
|
+
export declare const SHARE_NOTICE_MS = 1500;
|
|
69
105
|
/** The id on "Your gift is ready", which names the dialog while screen 2 is showing. */
|
|
70
106
|
export declare const UNWRAP_READY_TITLE_ID: string;
|
|
71
107
|
export interface GiftUnwrapComposeOptions {
|
|
@@ -76,6 +112,11 @@ export interface GiftUnwrapComposeOptions {
|
|
|
76
112
|
* screen the user is no longer on. A callback because the modal is Encore's.
|
|
77
113
|
*/
|
|
78
114
|
setLabelledBy?: (id: string) => void;
|
|
115
|
+
/**
|
|
116
|
+
* Called with the screen on every switch. The share designs hide the modal's × on the
|
|
117
|
+
* ready screen, whose Back takes the corner the × would otherwise share.
|
|
118
|
+
*/
|
|
119
|
+
onScreenChange?: (screen: UnwrapScreen) => void;
|
|
79
120
|
}
|
|
80
121
|
export interface GiftUnwrapOptions {
|
|
81
122
|
/**
|
|
@@ -97,11 +138,18 @@ export interface GiftUnwrapOptions {
|
|
|
97
138
|
* unarmed gate, which never fires.
|
|
98
139
|
*/
|
|
99
140
|
impressions?: ImpressionGate;
|
|
141
|
+
/** The "share for later" design to add, from the served variant. Absent: none. */
|
|
142
|
+
share?: ShareDesign;
|
|
100
143
|
}
|
|
101
144
|
export declare class GiftUnwrap implements RewardSurface {
|
|
102
145
|
#private;
|
|
103
146
|
constructor(offers: readonly Offer[], options?: GiftUnwrapOptions);
|
|
104
147
|
on<E extends keyof RewardSurfaceEventMap>(event: E, handler: (payload: RewardSurfaceEventMap[E]) => void): () => void;
|
|
148
|
+
/**
|
|
149
|
+
* The share designs' own events, off `on()` so its signature stays the one every
|
|
150
|
+
* `RewardSurface` shares (a union of surfaces must stay callable).
|
|
151
|
+
*/
|
|
152
|
+
onShareEvent<E extends 'offerShare' | 'closeRequest'>(event: E, handler: (payload: GiftUnwrapEventMap[E]) => void): () => void;
|
|
105
153
|
getTotalOffers(): number;
|
|
106
154
|
getCurrentIndex(): number;
|
|
107
155
|
getSelectedOffer(): Offer | undefined;
|
|
@@ -125,6 +173,28 @@ export declare class GiftUnwrap implements RewardSurface {
|
|
|
125
173
|
* {@link render} and the action block.
|
|
126
174
|
*/
|
|
127
175
|
compose(pickScreen: HTMLElement, options?: GiftUnwrapComposeOptions): HTMLElement;
|
|
176
|
+
/**
|
|
177
|
+
* Open the keep-for-later panel with the selection picked, so its CTA can share at
|
|
178
|
+
* once. Focus returns to `opener` when the scrim closes it.
|
|
179
|
+
*
|
|
180
|
+
* Returns false, opening nothing, on a surface without one, once the surface has left
|
|
181
|
+
* the page (a deferred claim swaps in the primer), and on the ready screen. That last
|
|
182
|
+
* one matters: the panel commits a SELECTION, and the ready screen is filled once on
|
|
183
|
+
* entry, so a pick made over it would leave the screen naming one gift while its CTA
|
|
184
|
+
* claims another. The variant's panel is only reachable from the list, too.
|
|
185
|
+
*/
|
|
186
|
+
openKeepForLater(opener?: HTMLElement): boolean;
|
|
187
|
+
isKeepForLaterOpen(): boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Freeze the panel while a completed share waits to close the presentation, so a
|
|
190
|
+
* second gift cannot be picked or shared in that window. Its close still works.
|
|
191
|
+
*/
|
|
192
|
+
lockKeepForLater(): void;
|
|
193
|
+
/**
|
|
194
|
+
* Say `text` in the surface's status line, then clear it after {@link SHARE_NOTICE_MS}.
|
|
195
|
+
* A live region, so a screen reader announces it too.
|
|
196
|
+
*/
|
|
197
|
+
showShareNotice(text: string): void;
|
|
128
198
|
/**
|
|
129
199
|
* Select the offer at `index` into the full array. Out of range is IGNORED rather
|
|
130
200
|
* than clamped: claiming a neighbouring advertiser would hide a caller's bug behind a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GiftUnwrap.d.ts","sourceRoot":"","sources":["../../src/ui/GiftUnwrap.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"GiftUnwrap.d.ts","sourceRoot":"","sources":["../../src/ui/GiftUnwrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AAEH,OAAO,KAAK,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;AAgBzD,OAAO,EAAqC,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAWlF,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAmB,MAAM,kBAAkB,CAAC;AAEnE;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,qBAAqB,GAAG;IACvD,uEAAuE;IACvE,UAAU,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,gFAAgF;IAChF,YAAY,EAAE,SAAS,CAAC;CACzB,CAAC;AAEF,mFAAmF;AACnF,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC;;;GAGG;AACH,eAAO,MAAM,gBAAgB,OAAO,CAAC;AASrC,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5C,mFAAmF;AACnF,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEhD,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,uFAAuF;AACvF,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC,wFAAwF;AACxF,eAAO,MAAM,qBAAqB,QAA4B,CAAC;AAE/D,MAAM,WAAW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