@encorekit/web-sdk 2.0.4 → 2.0.7
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 +112 -40
- 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/embed/README.md +82 -367
- package/examples/ios-webview/EncoreURLBuilder.swift +179 -61
- package/examples/ios-webview/README.md +75 -354
- package/examples/ios-webview/SimpleEncoreView.swift +49 -36
- package/examples/ios-webview/SimpleExample.swift +30 -86
- package/package.json +2 -7
- package/types/api/APIClient.d.ts +3 -1
- package/types/api/APIClient.d.ts.map +1 -1
- package/types/api/errorReportLimits.d.ts +50 -0
- package/types/api/errorReportLimits.d.ts.map +1 -0
- package/types/api/generated/types.d.ts +54 -7
- package/types/api/generated/types.d.ts.map +1 -1
- package/types/core/Encore.d.ts +25 -2
- package/types/core/Encore.d.ts.map +1 -1
- package/types/core/PlacementBuilder.d.ts +14 -2
- package/types/core/PlacementBuilder.d.ts.map +1 -1
- package/types/core/TransactionStore.d.ts +57 -13
- package/types/core/TransactionStore.d.ts.map +1 -1
- package/types/core/VerificationPoller.d.ts.map +1 -1
- package/types/core/claimBehavior.d.ts +28 -0
- package/types/core/claimBehavior.d.ts.map +1 -0
- package/types/core/errorContext.d.ts +18 -0
- package/types/core/errorContext.d.ts.map +1 -0
- package/types/core/errorType.d.ts +59 -0
- package/types/core/errorType.d.ts.map +1 -0
- package/types/core/hostDisplay.d.ts +50 -0
- package/types/core/hostDisplay.d.ts.map +1 -0
- package/types/core/version.d.ts +1 -1
- package/types/types.d.ts +146 -1
- package/types/types.d.ts.map +1 -1
- package/types/ui/OfferModal.d.ts +20 -0
- package/types/ui/OfferModal.d.ts.map +1 -1
- package/types/ui/PrimerScreen.d.ts +18 -11
- package/types/ui/PrimerScreen.d.ts.map +1 -1
- package/types/ui/RedemptionScreen.d.ts +15 -19
- package/types/ui/RedemptionScreen.d.ts.map +1 -1
- package/types/ui/RewardActions.d.ts +26 -0
- package/types/ui/RewardActions.d.ts.map +1 -1
- package/types/ui/brandComponents.d.ts.map +1 -1
- package/types/ui/styles.d.ts.map +1 -1
- package/types/utils/logger.d.ts +11 -1
- package/types/utils/logger.d.ts.map +1 -1
- package/embed/index.html +0 -57
- package/embed/styles.css +0 -154
- package/examples/ios-webview/EncoreWebViewBridge.swift +0 -419
- package/examples/ios-webview/ExampleViewController.swift +0 -233
|
@@ -1,35 +1,79 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TransactionStore
|
|
3
3
|
*
|
|
4
|
-
* Local
|
|
5
|
-
*
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
8
|
-
* - latest: transactionId of the most recently created transaction
|
|
4
|
+
* Local record of claims awaiting redemption. Holds:
|
|
5
|
+
* - transactions: transactionId -> Transaction
|
|
6
|
+
* - placements: placementId -> transactionId (the per-placement live-claim map)
|
|
7
|
+
* - latest: the most recently created transaction
|
|
9
8
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* The BACKING is injected, and that is the whole of the difference between the two
|
|
10
|
+
* deferred behaviours: `deferred` writes through StorageManager and survives a
|
|
11
|
+
* reload; `deferredWhileAlive` writes to a plain object that dies with the page.
|
|
12
|
+
* Both then resolve, prune and expire identically — one implementation, so the
|
|
13
|
+
* session-scoped mode cannot quietly drift from the durable one.
|
|
14
|
+
*
|
|
15
|
+
* The server transaction record (keyed by app_account_id) remains the durable
|
|
16
|
+
* source of truth for cross-device recovery; this is the fast path.
|
|
17
|
+
*
|
|
18
|
+
* Expired and redeemed claims are filtered out of the RESOLVING lookups —
|
|
19
|
+
* `getLatest` and `getByPlacement`, the two that answer "what can be redeemed
|
|
20
|
+
* now". `getByTransactionId` deliberately does not filter: it answers "what is on
|
|
21
|
+
* record for this exact id", so it can report that a claim was redeemed.
|
|
22
|
+
*
|
|
23
|
+
* That report is not durable, and callers must not treat it as one: `#prune` drops
|
|
24
|
+
* redeemed and expired entries on the NEXT write, so a redeemed claim is readable
|
|
25
|
+
* only until then. The store is a cache of what is still actionable, not a ledger.
|
|
13
26
|
*/
|
|
14
27
|
import type { Transaction } from '../types';
|
|
15
28
|
import type { StorageManager } from './StorageManager';
|
|
29
|
+
interface TransactionStoreState {
|
|
30
|
+
transactions: Record<string, Transaction>;
|
|
31
|
+
placements: Record<string, string>;
|
|
32
|
+
latest: string | null;
|
|
33
|
+
}
|
|
34
|
+
/** Where a store keeps its state. The only thing the two behaviours disagree on. */
|
|
35
|
+
export interface TransactionBacking {
|
|
36
|
+
read(): TransactionStoreState | null;
|
|
37
|
+
write(state: TransactionStoreState): void;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A claim's creation time in ms, with an unparseable one pinned to 0 (oldest).
|
|
41
|
+
*
|
|
42
|
+
* Sorting on a raw `getTime()` puts NaN into the comparator, and a comparator that
|
|
43
|
+
* returns NaN makes the whole ordering implementation-defined — so ONE undateable
|
|
44
|
+
* record could change which claim is picked as "latest" among perfectly good ones.
|
|
45
|
+
* Deterministic beats correct-looking here: this store already defends against
|
|
46
|
+
* corrupted state, and the ordering has to be defended in the same breath.
|
|
47
|
+
*/
|
|
48
|
+
export declare function createdAtMs(transaction: {
|
|
49
|
+
createdAt: string;
|
|
50
|
+
}): number;
|
|
51
|
+
/** Durable: localStorage via StorageManager. Survives the page load. */
|
|
52
|
+
export declare function persistentBacking(storage: StorageManager): TransactionBacking;
|
|
53
|
+
/**
|
|
54
|
+
* Session-scoped: a closure. Deliberately touches NO storage API at all — not the
|
|
55
|
+
* key, not StorageManager — so `deferredWhileAlive` cannot leak a claim to disk
|
|
56
|
+
* through a shared code path.
|
|
57
|
+
*/
|
|
58
|
+
export declare function ephemeralBacking(): TransactionBacking;
|
|
16
59
|
export declare class TransactionStore {
|
|
17
60
|
#private;
|
|
18
|
-
constructor(
|
|
61
|
+
constructor(backing: TransactionBacking);
|
|
19
62
|
/** Persist a new transaction, updating the placement map and the latest pointer. */
|
|
20
63
|
save(transaction: Transaction): void;
|
|
21
|
-
/** Resolve a transaction by exact
|
|
64
|
+
/** Resolve a transaction by exact id (any status). */
|
|
22
65
|
getByTransactionId(transactionId: string): Transaction | null;
|
|
23
66
|
/**
|
|
24
|
-
*
|
|
67
|
+
* The LIVE transaction claimed at a placement. Null if none/expired/redeemed —
|
|
25
68
|
* never crosses to another placement's transaction.
|
|
26
69
|
*/
|
|
27
70
|
getByPlacement(placementId: string): Transaction | null;
|
|
28
|
-
/**
|
|
71
|
+
/** The single most-recent LIVE transaction (the flat redeem() fallback). */
|
|
29
72
|
getLatest(): Transaction | null;
|
|
30
73
|
/** Mark a transaction redeemed (idempotent). Frees its placement slot. */
|
|
31
74
|
markRedeemed(transactionId: string): void;
|
|
32
|
-
/** Clear
|
|
75
|
+
/** Clear every transaction (reset()). */
|
|
33
76
|
clear(): void;
|
|
34
77
|
}
|
|
78
|
+
export {};
|
|
35
79
|
//# sourceMappingURL=TransactionStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionStore.d.ts","sourceRoot":"","sources":["../../src/core/TransactionStore.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"TransactionStore.d.ts","sourceRoot":"","sources":["../../src/core/TransactionStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKvD,UAAU,qBAAqB;IAC7B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC1C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,oFAAoF;AACpF,MAAM,WAAW,kBAAkB;IACjC,IAAI,IAAI,qBAAqB,GAAG,IAAI,CAAC;IACrC,KAAK,CAAC,KAAK,EAAE,qBAAqB,GAAG,IAAI,CAAC;CAC3C;AAID;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAGtE;AA2BD,wEAAwE;AACxE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG,kBAAkB,CAK7E;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,kBAAkB,CAQrD;AAED,qBAAa,gBAAgB;;gBAGf,OAAO,EAAE,kBAAkB;IAwDvC,oFAAoF;IACpF,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAepC,sDAAsD;IACtD,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAI7D;;;OAGG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAQvD,4EAA4E;IAC5E,SAAS,IAAI,WAAW,GAAG,IAAI;IAa/B,0EAA0E;IAC1E,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;IA2BzC,yCAAyC;IACzC,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VerificationPoller.d.ts","sourceRoot":"","sources":["../../src/core/VerificationPoller.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"VerificationPoller.d.ts","sourceRoot":"","sources":["../../src/core/VerificationPoller.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInD,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,qBAAa,kBAAkB;;gBAYjB,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,yBAAyB;IAMpE;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAkBzC;;OAEG;IACH,IAAI,IAAI,IAAI;CAqGb"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `claimBehavior` — what a claim does with the advertiser handoff.
|
|
3
|
+
*
|
|
4
|
+
* 🔴 NOT A PUBLISHER OPTION. This is data on the VARIANT, the same way the reward
|
|
5
|
+
* sheet's copy and button actions are: `RewardActions.ts` tracks its variant's
|
|
6
|
+
* actions by symbol because web has no SDUI engine, and this file tracks the
|
|
7
|
+
* variant's claim behaviour the same way. It is deliberately absent from
|
|
8
|
+
* `PlacementOptions` and from `configure()` — 2.0.1's `redemptionMode` was a
|
|
9
|
+
* config knob, and making zero-config behaviour depend on a knob is what let a
|
|
10
|
+
* default flip break every integration that never set one.
|
|
11
|
+
*
|
|
12
|
+
* immediate redirect inside the click gesture; nothing is persisted.
|
|
13
|
+
* deferred persist the claim, hold the primer, redirect from redeem()
|
|
14
|
+
* — which may run on a LATER PAGE LOAD.
|
|
15
|
+
* deferredWhileAlive hold the claim in memory for this session only; never
|
|
16
|
+
* touch storage. Gone on reload, by design.
|
|
17
|
+
*
|
|
18
|
+
* The defaults below are the built-in variants' values and restore pre-2.0.2
|
|
19
|
+
* zero-config behaviour: `reduceChurn` is deferred (the host runs its own
|
|
20
|
+
* conversion, then redeems), `rewardUsers` is immediate (matching swift).
|
|
21
|
+
*/
|
|
22
|
+
import type { UseCase } from '../types';
|
|
23
|
+
export type ClaimBehavior = 'immediate' | 'deferred' | 'deferredWhileAlive';
|
|
24
|
+
/** Whether a behaviour keeps the claim past the click — i.e. redeem() has work. */
|
|
25
|
+
export declare function isDeferred(behavior: ClaimBehavior): boolean;
|
|
26
|
+
/** The behaviour for a presentation: the variant's value, else the built-in default. */
|
|
27
|
+
export declare function claimBehaviorFor(useCase: UseCase, variantValues?: unknown): ClaimBehavior;
|
|
28
|
+
//# sourceMappingURL=claimBehavior.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claimBehavior.d.ts","sourceRoot":"","sources":["../../src/core/claimBehavior.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,UAAU,GAAG,oBAAoB,CAAC;AAE5E,mFAAmF;AACnF,wBAAgB,UAAU,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAE3D;AAmCD,wFAAwF;AACxF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,aAAa,CAEzF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where an error happened, as the backend's error-reporting taxonomy.
|
|
3
|
+
*
|
|
4
|
+
* The eleven values are copied verbatim from the Swift and Android SDKs. The
|
|
5
|
+
* backend fingerprints an issue as `[errorType, context]`, so a value invented
|
|
6
|
+
* here would split one cross-platform defect into a separate issue per
|
|
7
|
+
* platform instead of grouping it.
|
|
8
|
+
*
|
|
9
|
+
* Before this, web sent free prose ('Show flow error', 'Offer flow error'),
|
|
10
|
+
* which fingerprinted against nothing the other two SDKs emit.
|
|
11
|
+
*
|
|
12
|
+
* Deliberately not exported from `index.ts`: it is an internal wire vocabulary,
|
|
13
|
+
* not something a publisher passes in. Add a value here only together with the
|
|
14
|
+
* same value in Swift and Android.
|
|
15
|
+
*/
|
|
16
|
+
export declare const ERROR_CONTEXTS: readonly ["configuration", "present_offer_initialization", "fetch_offer_data", "start_transaction", "log_impression", "fetch_entitlements", "verify_transaction", "grant_signal", "api_request", "outbox", "analytics"];
|
|
17
|
+
export type ErrorContext = (typeof ERROR_CONTEXTS)[number];
|
|
18
|
+
//# sourceMappingURL=errorContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorContext.d.ts","sourceRoot":"","sources":["../../src/core/errorContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,yNAYjB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `errorType` half of the error-report fingerprint.
|
|
3
|
+
*
|
|
4
|
+
* The backend groups a Sentry issue by `[errorType, context]`, so this value
|
|
5
|
+
* has to mean the same thing on every SDK. Swift and Android both emit it from
|
|
6
|
+
* a sealed `EncoreError` hierarchy via `typeIdentifier`. web reported
|
|
7
|
+
* `error.constructor.name` instead, which is `"Error"` for essentially
|
|
8
|
+
* everything, so web errors grouped by `context` alone and could never join
|
|
9
|
+
* their iOS and Android counterparts.
|
|
10
|
+
*
|
|
11
|
+
* What was missing was never a taxonomy. web already has `ErrorCode`, and
|
|
12
|
+
* `APIClient` already attaches it to the errors it throws. This maps that
|
|
13
|
+
* existing structure onto the shared wire vocabulary.
|
|
14
|
+
*
|
|
15
|
+
* Deliberately NOT a rewrite into a sealed hierarchy. That is still worth doing
|
|
16
|
+
* (it would make the type intrinsic to the error rather than derived at the
|
|
17
|
+
* boundary, so a throw from outside `APIClient` would carry it too), and it
|
|
18
|
+
* remains its own ticket. This closes the fingerprint gap without waiting for
|
|
19
|
+
* it.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* The wire vocabulary, identical to Swift's and Android's `typeIdentifier`.
|
|
23
|
+
* A value invented here would split one defect into a separate issue per
|
|
24
|
+
* platform, which is the whole thing this exists to prevent.
|
|
25
|
+
*/
|
|
26
|
+
export declare const ERROR_TYPES: readonly ["network_error", "persistence_error", "http_error", "api_error", "decoding_error", "not_configured", "invalid_api_key", "invalid_url", "domain_error"];
|
|
27
|
+
export type ErrorTypeIdentifier = (typeof ERROR_TYPES)[number];
|
|
28
|
+
/**
|
|
29
|
+
* The server's own error code and status, for a report's metadata.
|
|
30
|
+
*
|
|
31
|
+
* Grouping is canonical across platforms; this is how the detail survives that.
|
|
32
|
+
* A backend `UNAUTHORIZED` and a backend `OFFER_EXPIRED` both group as
|
|
33
|
+
* `api_error`, and stay distinguishable by this field in Cloud Logging, or as
|
|
34
|
+
* an indexed tag if the backend ever promotes it.
|
|
35
|
+
*/
|
|
36
|
+
export declare function serverDetailOf(error: unknown): Record<string, string>;
|
|
37
|
+
/**
|
|
38
|
+
* Deliberately NOT mapped, and this is the subtle half.
|
|
39
|
+
*
|
|
40
|
+
* `UNAUTHORIZED` and `NOT_FOUND` arrive as `data.code` in a server error body,
|
|
41
|
+
* so they describe the SERVER's verdict, not a client-side condition. Swift and
|
|
42
|
+
* Android turn any intelligible server rejection into `api_error`, and reserve
|
|
43
|
+
* `invalid_api_key` for their own client-side key validation. Mapping them here
|
|
44
|
+
* made the same backend 401 fingerprint as `[invalid_api_key, api_request]` on
|
|
45
|
+
* web and `[api_error, api_request]` on mobile, which is precisely the split
|
|
46
|
+
* this vocabulary exists to prevent.
|
|
47
|
+
*
|
|
48
|
+
* They fall through to `api_error`. The server's own code is not lost: it is
|
|
49
|
+
* echoed into the report as `serverCode`, where it segments without changing
|
|
50
|
+
* how anything groups.
|
|
51
|
+
*/
|
|
52
|
+
/**
|
|
53
|
+
* Resolves an unknown caught value to a shared `errorType`.
|
|
54
|
+
*
|
|
55
|
+
* Total by construction: anything unrecognised is `domain_error`, matching how
|
|
56
|
+
* Swift and Android wrap a foreign throwable. Reporting must never throw.
|
|
57
|
+
*/
|
|
58
|
+
export declare function errorTypeOf(error: unknown): ErrorTypeIdentifier;
|
|
59
|
+
//# sourceMappingURL=errorType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorType.d.ts","sourceRoot":"","sources":["../../src/core/errorType.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH;;;;GAIG;AACH,eAAO,MAAM,WAAW,kKAUd,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAyB/D;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAWrE;AAED;;;;;;;;;;;;;;GAcG;AAEH;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,CA8B/D"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host display nouns + the deferred flow's composed copy.
|
|
3
|
+
*
|
|
4
|
+
* The nouns name the PUBLISHER's product (the host), as distinct from the
|
|
5
|
+
* advertiser on the offer. They are resolved fresh at each screen from the
|
|
6
|
+
* then-current remote config — nothing about them is persisted on a transaction,
|
|
7
|
+
* which stores transactional facts only.
|
|
8
|
+
*
|
|
9
|
+
* Everything the primer and redemption screens say is composed here. The screens
|
|
10
|
+
* never concatenate nouns themselves, so one sentence has one source.
|
|
11
|
+
*
|
|
12
|
+
* Absent nouns are NEVER an error. 2.0.1 failed the whole presentation with a
|
|
13
|
+
* CONFIGURATION_ERROR when the app icon was unset; an SDK that refuses to present
|
|
14
|
+
* because a logo is missing is worse than one that presents a quieter sentence.
|
|
15
|
+
* The screens degrade instead — see PrimerScreen's 'holding' variant.
|
|
16
|
+
*/
|
|
17
|
+
export interface HostDisplay {
|
|
18
|
+
appDisplayName?: string;
|
|
19
|
+
/** Composed, display-only, e.g. "1 month". Never parsed back into a number. */
|
|
20
|
+
trialPeriod?: string;
|
|
21
|
+
logoUrl?: string;
|
|
22
|
+
}
|
|
23
|
+
/** The remote values the nouns resolve from. All optional — the fetch may not have landed. */
|
|
24
|
+
export interface RemoteHostSource {
|
|
25
|
+
appName?: string;
|
|
26
|
+
entitlementValue?: string;
|
|
27
|
+
entitlementUnit?: string;
|
|
28
|
+
/** `/config` `ui.values.media.appstoreIcon`. */
|
|
29
|
+
appIconUrl?: string;
|
|
30
|
+
/** `entitlements.native.durationDays` — the trial-end line's only input. */
|
|
31
|
+
trialDurationDays?: number;
|
|
32
|
+
}
|
|
33
|
+
/** Resolve the host nouns. Every field independently optional. */
|
|
34
|
+
export declare function resolveHostDisplay(source: RemoteHostSource): HostDisplay;
|
|
35
|
+
/** The deferred flow's sentences, each with exactly one definition. */
|
|
36
|
+
export declare const displayCopy: {
|
|
37
|
+
readonly primerTitle: (app: string, trial?: string) => string;
|
|
38
|
+
readonly primerSubtitle: (app: string) => string;
|
|
39
|
+
readonly primerCta: (app: string, trial?: string) => string;
|
|
40
|
+
/** The holding story: the host is unnamed, so the sentence is about the reward. */
|
|
41
|
+
readonly holdingTitle: () => string;
|
|
42
|
+
readonly holdingSubtitle: (advertiser?: string) => string;
|
|
43
|
+
readonly holdingCta: () => string;
|
|
44
|
+
readonly s2Title: (app: string, trial?: string) => string;
|
|
45
|
+
readonly s2Subtitle: (app: string) => string;
|
|
46
|
+
/** Host-row detail composed from the remote durationDays and the redemption moment. */
|
|
47
|
+
readonly s2HostDetail: (trialEnd: Date) => string;
|
|
48
|
+
readonly s2Cta: () => string;
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=hostDisplay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hostDisplay.d.ts","sourceRoot":"","sources":["../../src/core/hostDisplay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,WAAW;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,8FAA8F;AAC9F,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AA+BD,kEAAkE;AAClE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,WAAW,CASxE;AAED,uEAAuE;AACvE,eAAO,MAAM,WAAW;gCACH,MAAM,UAAU,MAAM,KAAG,MAAM;mCAE5B,MAAM,KAAG,MAAM;8BAEpB,MAAM,UAAU,MAAM,KAAG,MAAM;IAEhD,mFAAmF;iCACjE,MAAM;4CACO,MAAM,KAAG,MAAM;+BAI9B,MAAM;4BACP,MAAM,UAAU,MAAM,KAAG,MAAM;+BAI5B,MAAM,KAAG,MAAM;IACjC,uFAAuF;sCAC9D,IAAI,KAAG,MAAM;0BAM3B,MAAM;CACT,CAAC"}
|
package/types/core/version.d.ts
CHANGED
package/types/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Shared types used across the SDK
|
|
4
4
|
*/
|
|
5
5
|
import type { TextSlot, ButtonSlot } from './ui/appearance';
|
|
6
|
+
import type { LogLevel } from './utils/logger';
|
|
6
7
|
/**
|
|
7
8
|
* Supported entitlement types with optional values
|
|
8
9
|
*/
|
|
@@ -202,6 +203,40 @@ export interface PlacementOptions {
|
|
|
202
203
|
headline?: string;
|
|
203
204
|
/** Counterpart to {@link headline}: same precedence, same blank-falls-through rule. */
|
|
204
205
|
subheadline?: string;
|
|
206
|
+
/**
|
|
207
|
+
* Whether the user can dismiss the sheet. Defaults to `true`, and almost
|
|
208
|
+
* every integration should leave it there.
|
|
209
|
+
*
|
|
210
|
+
* `false` removes every in-sheet way out at once — the ×, the "No thanks"
|
|
211
|
+
* decline CTA, backdrop-click and Escape. Not "fewer ways out": a sheet that
|
|
212
|
+
* still closes on a backdrop tap is dismissable, so the flag would be doing
|
|
213
|
+
* nothing while reading as though it did.
|
|
214
|
+
*
|
|
215
|
+
* ⚠️ ONLY FOR A HOST THAT IS ITSELF THE WAY OUT. The single intended caller
|
|
216
|
+
* is Encore's hosted offer page, which a publisher's app opens in a webview:
|
|
217
|
+
* closing that webview is the dismissal, and it is a better one, because the
|
|
218
|
+
* in-sheet dismissal only ever landed the user on a page they then had to
|
|
219
|
+
* close the webview to leave anyway.
|
|
220
|
+
*
|
|
221
|
+
* On your own site there is no webview to close. A user who cannot dismiss
|
|
222
|
+
* the sheet is stuck on your page, so do not pass this. Nothing about the
|
|
223
|
+
* default changes for an integration that never mentions it.
|
|
224
|
+
*
|
|
225
|
+
* The focus trap is unaffected: Tab still cycles inside the sheet, which is
|
|
226
|
+
* a statement about where focus goes rather than a way out.
|
|
227
|
+
*
|
|
228
|
+
* ⚠️ THE PROMISE `show()` RETURNS THEN SETTLES ONLY ON A CLAIM. Every other
|
|
229
|
+
* resolution came from a dismissal, and there is no longer one — so a user
|
|
230
|
+
* who claims nothing leaves it pending for the life of the page. Correct
|
|
231
|
+
* where the host is the way out, since closing the webview ends the page and
|
|
232
|
+
* the promise with it, and another reason not to pass this anywhere else: on
|
|
233
|
+
* your own site it is a promise that never resolves.
|
|
234
|
+
*
|
|
235
|
+
* On the reward composition the "No thanks" button becomes "Next offer"
|
|
236
|
+
* rather than disappearing — see `RewardActionsOptions.secondary`. A button
|
|
237
|
+
* reading "No thanks" on a sheet with no way out is a control that lies.
|
|
238
|
+
*/
|
|
239
|
+
dismissible?: boolean;
|
|
205
240
|
/**
|
|
206
241
|
* Status icon above the headline. Defaults to `'none'` — nothing renders unless
|
|
207
242
|
* you explicitly ask for `'success'`, which draws a green-circle check.
|
|
@@ -261,6 +296,23 @@ export interface PlacementBuilder {
|
|
|
261
296
|
* `Encore.show()`. Never rejects.
|
|
262
297
|
*/
|
|
263
298
|
show(): Promise<ShowResult>;
|
|
299
|
+
/**
|
|
300
|
+
* Redeem the claim made at this placement — phase 2 of the deferred flow.
|
|
301
|
+
*
|
|
302
|
+
* Scoping follows the placement ID, and only a PUBLISHER-SET one exists to scope
|
|
303
|
+
* by:
|
|
304
|
+
* - `placement('cancel_flow').redeem()` resolves only the claim banked at
|
|
305
|
+
* `'cancel_flow'`, never crossing to another placement's. Nothing there
|
|
306
|
+
* resolves `unavailable`, even when a claim exists elsewhere.
|
|
307
|
+
* - `placement().redeem()` — the no-id form — has no placement to scope by. Its
|
|
308
|
+
* minted `placement_<hex>` is local builder identity that never goes on the
|
|
309
|
+
* wire, so no claim was ever filed under it. It falls back to the flat
|
|
310
|
+
* most-recent-claim rule, i.e. exactly `Encore.redeem()`.
|
|
311
|
+
*
|
|
312
|
+
* Either form resolves `unavailable` when the variant's claim behaviour is
|
|
313
|
+
* `immediate`, since nothing is ever banked.
|
|
314
|
+
*/
|
|
315
|
+
redeem(): Promise<RedeemResult>;
|
|
264
316
|
}
|
|
265
317
|
/**
|
|
266
318
|
* Error codes used throughout the SDK
|
|
@@ -321,7 +373,11 @@ export interface UIConfiguration {
|
|
|
321
373
|
export interface EncoreConfig {
|
|
322
374
|
apiKey: string;
|
|
323
375
|
environment?: 'production' | 'development' | 'staging' | 'localhost';
|
|
324
|
-
|
|
376
|
+
/**
|
|
377
|
+
* Console verbosity. An ordered ladder: `'warn'` shows warnings and errors.
|
|
378
|
+
* Defaults to `'none'`, matching the Swift and Android SDKs.
|
|
379
|
+
*/
|
|
380
|
+
logLevel?: LogLevel;
|
|
325
381
|
/**
|
|
326
382
|
* When a claim is treated as confirmed — the same axis as iOS's and Android's
|
|
327
383
|
* `UnlockMode`, and global for the session (the native SDKs deliberately have no
|
|
@@ -384,6 +440,95 @@ export type ShowResult =
|
|
|
384
440
|
| {
|
|
385
441
|
status: 'unavailable';
|
|
386
442
|
};
|
|
443
|
+
/**
|
|
444
|
+
* The offer descriptor carried on a transaction — enough to render the redemption
|
|
445
|
+
* screen AND to rebuild the advertiser redirect at redeem() time, so a deferred
|
|
446
|
+
* claim never needs the live offer again (it may be redeemed on a page load that
|
|
447
|
+
* fetched no offers at all). `advertiserUrl` may contain a TRANSACTION_ID
|
|
448
|
+
* placeholder, substituted when the redemption fires.
|
|
449
|
+
*/
|
|
450
|
+
export interface OfferRef {
|
|
451
|
+
id: string;
|
|
452
|
+
campaignId: string;
|
|
453
|
+
advertiserUrl: string;
|
|
454
|
+
trackingParameters?: Record<string, string>;
|
|
455
|
+
advertiserName?: string;
|
|
456
|
+
/** Display-only reward copy (e.g. "30 days of Apple Music"). NOT an entitlement. */
|
|
457
|
+
reward?: string;
|
|
458
|
+
imageUrl?: string;
|
|
459
|
+
logoUrl?: string;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* A claimed offer awaiting redemption. Claiming starts a transaction, and `id` is
|
|
463
|
+
* that transaction's durable handle — the same value `didGrant()`,
|
|
464
|
+
* `waitForVerification()` and the backend all key on.
|
|
465
|
+
*
|
|
466
|
+
* Present only for the deferred claim behaviours. An `immediate` claim redeems
|
|
467
|
+
* inside the click and records nothing here.
|
|
468
|
+
*/
|
|
469
|
+
export interface Transaction {
|
|
470
|
+
id: string;
|
|
471
|
+
/** The persistent account identity this transaction is bound to (app_account_id). */
|
|
472
|
+
appAccountId: string;
|
|
473
|
+
/** The placement the offer was claimed at, if any (keys the placement->claim map). */
|
|
474
|
+
placementId?: string;
|
|
475
|
+
offer: OfferRef;
|
|
476
|
+
/**
|
|
477
|
+
* The use case this claim was made under — persisted because redeem() may run on
|
|
478
|
+
* a later page load with only this record in hand, and the entitlement grant and
|
|
479
|
+
* the redemption narrative both turn on it. Stored as the PUBLIC symbol; records
|
|
480
|
+
* written by 2.0.1 and earlier carry the wire value and are normalised on read.
|
|
481
|
+
*/
|
|
482
|
+
useCase?: UseCase;
|
|
483
|
+
status: 'claimed' | 'redeemed';
|
|
484
|
+
/** ISO-8601 timestamps. */
|
|
485
|
+
createdAt: string;
|
|
486
|
+
expiresAt: string;
|
|
487
|
+
redeemedAt?: string;
|
|
488
|
+
}
|
|
489
|
+
/** Options for `redeem()`. */
|
|
490
|
+
export interface RedeemOptions {
|
|
491
|
+
/**
|
|
492
|
+
* Redeem the claim made at this placement. If none exists there it resolves
|
|
493
|
+
* `unavailable` — it never crosses to another placement's claim. Omit to take
|
|
494
|
+
* the single most-recent claim for this user.
|
|
495
|
+
*/
|
|
496
|
+
placement?: string;
|
|
497
|
+
/**
|
|
498
|
+
* Host product row for the redemption screen's ledger. Override-only: name and
|
|
499
|
+
* logo default from the same remote config the primer uses, so most integrations
|
|
500
|
+
* never pass this. The trial-end detail line is always DERIVED (remote
|
|
501
|
+
* durationDays + the redemption moment) and is not settable.
|
|
502
|
+
*/
|
|
503
|
+
host?: {
|
|
504
|
+
name?: string;
|
|
505
|
+
status?: string;
|
|
506
|
+
logoUrl?: string;
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
/** Result of `redeem()`. */
|
|
510
|
+
export type RedeemResult =
|
|
511
|
+
/** The advertiser redirect was performed and the claim is now consumed. */
|
|
512
|
+
{
|
|
513
|
+
status: 'redeemed';
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* The sheet closed without redeeming. `reason` mirrors show(): user-driven
|
|
517
|
+
* closes carry no reason or a user reason; internal failures carry
|
|
518
|
+
* `{ type: 'error', error }` — redeem() never rejects. On an error the claim is
|
|
519
|
+
* untouched, so calling redeem() again later is safe.
|
|
520
|
+
*/
|
|
521
|
+
| {
|
|
522
|
+
status: 'dismissed';
|
|
523
|
+
reason?: NotGrantedReason;
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* STRICTLY "there is no claim to redeem" — never an error in disguise. This is
|
|
527
|
+
* also what an `immediate` integration always gets: nothing was ever held.
|
|
528
|
+
*/
|
|
529
|
+
| {
|
|
530
|
+
status: 'unavailable';
|
|
531
|
+
};
|
|
387
532
|
/**
|
|
388
533
|
* A subscription/conversion event forwarded from the host (Tier-1 client signal).
|
|
389
534
|
* 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":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
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;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,M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
*/
|
|
28
28
|
showCloseButton?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Whether the sheet can be dismissed AT ALL. Defaults to `true`, which is
|
|
31
|
+
* every integration that does not deliberately ask otherwise.
|
|
32
|
+
*
|
|
33
|
+
* `false` removes the ×, backdrop-click and Escape together, because
|
|
34
|
+
* removing any one of them alone leaves the sheet dismissable and the caller
|
|
35
|
+
* did not ask for "fewer ways out", they asked for none. It is a
|
|
36
|
+
* host-capability statement, not a style: the only caller is Encore's own
|
|
37
|
+
* hosted offer page, where the surrounding webview is itself the way out and
|
|
38
|
+
* an in-sheet dismissal lands the user on a page they cannot leave either.
|
|
39
|
+
*
|
|
40
|
+
* ⚠️ A publisher's own site must NEVER pass this. There the sheet sits over
|
|
41
|
+
* the publisher's content with no webview to close, so a user who cannot
|
|
42
|
+
* dismiss is trapped on the page. The default keeps that impossible by
|
|
43
|
+
* omission rather than by convention.
|
|
44
|
+
*
|
|
45
|
+
* THE FOCUS TRAP IS NOT PART OF THIS. Tab still cycles inside the sheet:
|
|
46
|
+
* that is an accessibility guarantee about where focus goes, not a way out.
|
|
47
|
+
*/
|
|
48
|
+
dismissible?: boolean;
|
|
29
49
|
/**
|
|
30
50
|
* Publisher override for the modal container's background, applied INLINE on the
|
|
31
51
|
* modal element. Narrower than the `backgroundColor` theme variable, which also moves
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OfferModal.d.ts","sourceRoot":"","sources":["../../src/ui/OfferModal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,UAAU,aAAc,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACrD,KAAK,EAAE,IAAI,CAAC;IACZ,aAAa,EAAE,IAAI,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;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1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Primer Screen
|
|
2
|
+
* Primer Screen — the holding state a deferred claim lands on.
|
|
3
3
|
*
|
|
4
|
-
* Rendered into the open
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* Rendered into the open modal immediately after a deferred claim: the moment the
|
|
5
|
+
* claim is banked and the user is told it will be waiting. show() settles
|
|
6
|
+
* 'claimed' on this screen's CTA or on ANY modal dismissal — the claim is a fact
|
|
7
|
+
* either way, so the post-claim latch holds here.
|
|
8
|
+
*
|
|
9
|
+
* Two narratives, chosen by whether the host is nameable:
|
|
10
|
+
* - 'activation': the host's own trial is what happens next, so the copy names it.
|
|
11
|
+
* - 'holding': no host nouns resolved, so the sentence is about the reward
|
|
12
|
+
* itself. This is a DEGRADATION, never an error — 2.0.1 refused to
|
|
13
|
+
* present at all here, which is the worse failure for an SDK.
|
|
10
14
|
*/
|
|
11
|
-
import { type
|
|
15
|
+
import { type HostDisplay } from '../core/hostDisplay';
|
|
16
|
+
export type PrimerVariant = 'activation' | 'holding';
|
|
12
17
|
export interface PrimerScreenConfig {
|
|
13
|
-
/**
|
|
14
|
-
|
|
18
|
+
/** Which narrative to render. Defaults to 'holding' (the safe, host-free story). */
|
|
19
|
+
variant?: PrimerVariant;
|
|
20
|
+
/** Resolved host nouns. Empty is legal and selects 'holding'. */
|
|
21
|
+
display: HostDisplay;
|
|
15
22
|
/** Partner branding from the just-claimed offer. */
|
|
16
23
|
partner: {
|
|
17
24
|
name?: string;
|
|
@@ -20,7 +27,7 @@ export interface PrimerScreenConfig {
|
|
|
20
27
|
};
|
|
21
28
|
}
|
|
22
29
|
interface PrimerScreenEventMap extends Record<string, unknown> {
|
|
23
|
-
/** The user tapped the forward CTA — caller settles 'claimed' and closes. */
|
|
30
|
+
/** The user tapped the forward CTA — the caller settles 'claimed' and closes. */
|
|
24
31
|
continue: undefined;
|
|
25
32
|
}
|
|
26
33
|
export declare class PrimerScreen {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimerScreen.d.ts","sourceRoot":"","sources":["../../src/ui/PrimerScreen.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"PrimerScreen.d.ts","sourceRoot":"","sources":["../../src/ui/PrimerScreen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGpE,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,SAAS,CAAC;AAErD,MAAM,WAAW,kBAAkB;IACjC,oFAAoF;IACpF,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,iEAAiE;IACjE,OAAO,EAAE,WAAW,CAAC;IACrB,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,iFAAiF;IACjF,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,qBAAa,YAAY;;gBAKX,MAAM,EAAE,kBAAkB;IAKtC,MAAM,IAAI,WAAW;IAoErB,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"}
|