@encorekit/web-sdk 1.1.19 → 1.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +63 -3
  2. package/dist/cjs/index.cjs +1 -1
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/esm/index.js +1 -1
  5. package/dist/esm/index.js.map +1 -1
  6. package/dist/umd/encore.min.js +1 -1
  7. package/dist/umd/encore.min.js.map +1 -1
  8. package/embed/README.md +1 -1
  9. package/examples/angular/src/app/app.component.ts +0 -1
  10. package/examples/angular/src/app/encore.service.ts +1 -2
  11. package/examples/ios-webview/EncoreWebViewBridge.swift +3 -10
  12. package/examples/ios-webview/README.md +0 -20
  13. package/examples/react/src/App.tsx +1 -1
  14. package/examples/svelte/src/App.svelte +0 -2
  15. package/examples/vanilla-js/index.html +0 -2
  16. package/examples/vue/src/App.vue +0 -2
  17. package/package.json +10 -8
  18. package/types/analytics/AnalyticsClient.d.ts +11 -3
  19. package/types/analytics/AnalyticsClient.d.ts.map +1 -1
  20. package/types/analytics/events.d.ts +12 -1
  21. package/types/analytics/events.d.ts.map +1 -1
  22. package/types/analytics/models.d.ts +11 -8
  23. package/types/analytics/models.d.ts.map +1 -1
  24. package/types/analytics/transport.d.ts +23 -0
  25. package/types/analytics/transport.d.ts.map +1 -0
  26. package/types/api/APIClient.d.ts +1 -1
  27. package/types/api/APIClient.d.ts.map +1 -1
  28. package/types/api/contract.d.ts +32 -0
  29. package/types/api/contract.d.ts.map +1 -0
  30. package/types/api/generated/types.d.ts +4509 -0
  31. package/types/api/generated/types.d.ts.map +1 -0
  32. package/types/api/models.d.ts +45 -128
  33. package/types/api/models.d.ts.map +1 -1
  34. package/types/core/Configuration.d.ts +2 -2
  35. package/types/core/Configuration.d.ts.map +1 -1
  36. package/types/core/Encore.d.ts +77 -4
  37. package/types/core/Encore.d.ts.map +1 -1
  38. package/types/core/PlacementBuilder.d.ts +14 -9
  39. package/types/core/PlacementBuilder.d.ts.map +1 -1
  40. package/types/core/TransactionStore.d.ts +35 -0
  41. package/types/core/TransactionStore.d.ts.map +1 -0
  42. package/types/core/version.d.ts +1 -1
  43. package/types/experiments/ExperimentManager.d.ts +43 -0
  44. package/types/experiments/ExperimentManager.d.ts.map +1 -0
  45. package/types/experiments/ExposureOutbox.d.ts +37 -0
  46. package/types/experiments/ExposureOutbox.d.ts.map +1 -0
  47. package/types/experiments/bucketing.d.ts +33 -0
  48. package/types/experiments/bucketing.d.ts.map +1 -0
  49. package/types/experiments/types.d.ts +60 -0
  50. package/types/experiments/types.d.ts.map +1 -0
  51. package/types/index.d.ts +1 -0
  52. package/types/index.d.ts.map +1 -1
  53. package/types/react.d.ts +1 -3
  54. package/types/react.d.ts.map +1 -1
  55. package/types/types.d.ts +229 -17
  56. package/types/types.d.ts.map +1 -1
  57. package/types/ui/OfferCarousel.d.ts +14 -3
  58. package/types/ui/OfferCarousel.d.ts.map +1 -1
  59. package/types/ui/OfferModal.d.ts +6 -0
  60. package/types/ui/OfferModal.d.ts.map +1 -1
  61. package/types/ui/RedemptionScreen.d.ts +33 -0
  62. package/types/ui/RedemptionScreen.d.ts.map +1 -0
  63. package/types/ui/ThankYouLayout.d.ts +35 -0
  64. package/types/ui/ThankYouLayout.d.ts.map +1 -0
  65. package/types/ui/styles.d.ts.map +1 -1
  66. package/examples/react/.env.local +0 -1
  67. package/types/__tests__/PlacementBuilder.test.d.ts +0 -2
  68. package/types/__tests__/PlacementBuilder.test.d.ts.map +0 -1
  69. package/types/__tests__/SuccessScreen.test.d.ts +0 -2
  70. package/types/__tests__/SuccessScreen.test.d.ts.map +0 -1
  71. package/types/__tests__/react.test.d.ts +0 -2
  72. package/types/__tests__/react.test.d.ts.map +0 -1
  73. package/types/__tests__/styles.test.d.ts +0 -2
  74. package/types/__tests__/styles.test.d.ts.map +0 -1
  75. package/types/ui/SuccessScreen.d.ts +0 -35
  76. package/types/ui/SuccessScreen.d.ts.map +0 -1
@@ -0,0 +1,35 @@
1
+ /**
2
+ * TransactionStore
3
+ *
4
+ * Local persistence for the two-phase (transaction -> redeem) flow. Backed by
5
+ * StorageManager (localStorage-first), it holds:
6
+ * - transactions: transactionId -> Transaction
7
+ * - placements: placementId -> transactionId (the per-placement live-transaction map)
8
+ * - latest: transactionId of the most recently created transaction
9
+ *
10
+ * This is the fast path; the server transaction record (keyed by app_account_id, carrying
11
+ * placementId) is the durable source of truth for cross-page / post-localStorage-loss
12
+ * recovery. Expired or redeemed transactions are filtered out of the lookups.
13
+ */
14
+ import type { Transaction } from '../types';
15
+ import type { StorageManager } from './StorageManager';
16
+ export declare class TransactionStore {
17
+ #private;
18
+ constructor(storage: StorageManager);
19
+ /** Persist a new transaction, updating the placement map and the latest pointer. */
20
+ save(transaction: Transaction): void;
21
+ /** Resolve a transaction by exact transaction id (any status). */
22
+ getByTransactionId(transactionId: string): Transaction | null;
23
+ /**
24
+ * Resolve the LIVE transaction made at a placement. Returns null if none/expired/redeemed —
25
+ * never crosses to another placement's transaction.
26
+ */
27
+ getByPlacement(placementId: string): Transaction | null;
28
+ /** Resolve the single most-recent LIVE transaction for this user (the flat redeem() fallback). */
29
+ getLatest(): Transaction | null;
30
+ /** Mark a transaction redeemed (idempotent). Frees its placement slot. */
31
+ markRedeemed(transactionId: string): void;
32
+ /** Clear all transactions (used by reset()). */
33
+ clear(): void;
34
+ }
35
+ //# sourceMappingURL=TransactionStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransactionStore.d.ts","sourceRoot":"","sources":["../../src/core/TransactionStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAavD,qBAAa,gBAAgB;;gBAGf,OAAO,EAAE,cAAc;IAwBnC,oFAAoF;IACpF,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAepC,kEAAkE;IAClE,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAI7D;;;OAGG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAQvD,kGAAkG;IAClG,SAAS,IAAI,WAAW,GAAG,IAAI;IAa/B,0EAA0E;IAC1E,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;IA8BzC,gDAAgD;IAChD,KAAK,IAAI,IAAI;CAGd"}
@@ -1,3 +1,3 @@
1
1
  /** SDK version — single source of truth (also kept in sync with package.json via scripts/update-version.sh) */
2
- export declare const SDK_VERSION = "1.1.19";
2
+ export declare const SDK_VERSION = "1.1.20";
3
3
  //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Owns NCL (Net Conversion Lift) cohort assignment + exposure logging for the web SDK.
3
+ *
4
+ * Cohort is deterministic in (appAccountId, assignmentVersion) — the same person
5
+ * gets the same cohort across devices and reloads (see `bucketing.ts` for the
6
+ * byte-exact cross-platform contract). Bumping `assignmentVersion` server-side
7
+ * re-buckets everyone (a clean epoch).
8
+ *
9
+ * Mirrors iOS `ExperimentManager.swift` / Android `ExperimentManager.kt`.
10
+ */
11
+ import type { StorageManager } from '../core/StorageManager';
12
+ import type { Cohort, NCLExperimentConfig, NCLExperimentState } from './types';
13
+ import type { ExposureOutbox } from './ExposureOutbox';
14
+ export declare class ExperimentManager {
15
+ #private;
16
+ constructor(storage: StorageManager, getAppAccountId: () => string | null, exposureOutbox: ExposureOutbox);
17
+ /** Route the remote config's `experiments.ncl` block into the manager. */
18
+ setConfig(config: NCLExperimentConfig | null | undefined): void;
19
+ /**
20
+ * Resolve the current NCL cohort. Returns `notEnrolled` (→ normal offer flow,
21
+ * no exposure) when there is no appAccountId, no NCL config, or the experiment
22
+ * is disabled. Any unexpected error also degrades to `notEnrolled`.
23
+ */
24
+ getCohort(): Promise<Cohort>;
25
+ /**
26
+ * Log the exposure for `treatment`/`control` at the offer trigger — the A/B
27
+ * denominator. No-op for `notEnrolled`. Deduped per assignment epoch so reloads
28
+ * don't double-count: emits once per (user, assignmentVersion), re-emitting only
29
+ * when the server bumps the epoch. (Deliberately stronger than mobile, which
30
+ * emits per show; web reloads would otherwise inflate the denominator.)
31
+ */
32
+ logExposure(cohort: Cohort): void;
33
+ /**
34
+ * Read-only diagnostic snapshot (host apps / the demo harness). Reports the
35
+ * authoritative `cohort` (via `getCohort`, so it reflects exactly what the
36
+ * offer flow uses) alongside the computed `bucket` and the per-epoch exposure
37
+ * marker. Recomputing the bucket re-runs the SHA-256 purely for display — it
38
+ * never logs exposure or alters the rollout. `bucket` is `null` whenever a
39
+ * cohort can't be bucketed (no appAccountId, disabled, or no WebCrypto).
40
+ */
41
+ getState(): Promise<NCLExperimentState>;
42
+ }
43
+ //# sourceMappingURL=ExperimentManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExperimentManager.d.ts","sourceRoot":"","sources":["../../src/experiments/ExperimentManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAK7D,OAAO,KAAK,EAAE,MAAM,EAAiB,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC9F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AASvD,qBAAa,iBAAiB;;gBAO1B,OAAO,EAAE,cAAc,EACvB,eAAe,EAAE,MAAM,MAAM,GAAG,IAAI,EACpC,cAAc,EAAE,cAAc;IAOhC,0EAA0E;IAG1E,SAAS,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI;IAI/D;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAmDlC;;;;;;OAMG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAgCjC;;;;;;;OAOG;IACG,QAAQ,IAAI,OAAO,CAAC,kBAAkB,CAAC;CA+B9C"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Reliable delivery for the NCL exposure event — the A/B denominator.
3
+ *
4
+ * Exposure MUST survive tab-close, so unlike the fire-and-forget AnalyticsClient
5
+ * this path is storage-backed and retried.
6
+ *
7
+ * Delivery primitive: `fetch(url, { keepalive: true })` — NOT `navigator.sendBeacon`.
8
+ * The ingest endpoint authenticates on the `X-Analytics-Key` request header, and
9
+ * sendBeacon cannot set headers (a beacon would arrive unauthenticated). keepalive
10
+ * fetch survives document unload like a beacon AND carries the auth header.
11
+ *
12
+ * Reliability model:
13
+ * - enqueue: persist the envelope, then keepalive-POST; remove on 2xx.
14
+ * - flush: replay every persisted envelope (on SDK init + on pagehide /
15
+ * visibilitychange:hidden) so a send that died with the tab retries.
16
+ * - envelopes carry a STABLE event_id → retries are idempotent backend-side.
17
+ * - an in-memory in-flight set avoids duplicate concurrent sends.
18
+ * - all storage / window / document access is SSR- and failure-guarded (fail-open).
19
+ */
20
+ import type { AnalyticsEvent } from '../analytics/models';
21
+ import type { StorageManager } from '../core/StorageManager';
22
+ export declare class ExposureOutbox {
23
+ #private;
24
+ constructor(apiKey: string, analyticsBaseURL: string, storage: StorageManager);
25
+ /**
26
+ * Persist an exposure event and attempt delivery. `eventId` must be stable for a
27
+ * given (user, epoch) so retries de-duplicate backend-side. Returns whether the
28
+ * envelope durably landed in the configured storage tier: a quota-driven
29
+ * fallback-to-memory write is invisible to a fresh read, so the caller can avoid
30
+ * marking the epoch logged (and re-enqueue on the next trigger) instead of
31
+ * silently dropping the exposure.
32
+ */
33
+ enqueue(event: AnalyticsEvent, eventId: string): boolean;
34
+ /** Replay every persisted envelope (init recovery + unload flush). */
35
+ flush(): void;
36
+ }
37
+ //# sourceMappingURL=ExposureOutbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExposureOutbox.d.ts","sourceRoot":"","sources":["../../src/experiments/ExposureOutbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,qBAAqB,CAAC;AAEzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAK7D,qBAAa,cAAc;;gBAMb,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc;IAO7E;;;;;;;OAOG;IACH,OAAO,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAaxD,sEAAsE;IACtE,KAAK,IAAI,IAAI;CAoDd"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Deterministic NCL cohort bucketing — the byte-exact cross-platform core.
3
+ *
4
+ * Same (appAccountId, assignmentVersion) MUST land in the same bucket on web,
5
+ * iOS, and Android, or the NCL revenue-lift math breaks cross-platform.
6
+ *
7
+ * Verified byte-for-byte against:
8
+ * - iOS Encore/.../Experiments/ExperimentManager.swift:81-87
9
+ * - Android features/experiments/ExperimentManager.kt:88-98
10
+ * - Fixture android/.../ExperimentManagerTest.kt:40-75 (15 reference pairs)
11
+ *
12
+ * Algorithm:
13
+ * input = "<appAccountId>:<version>" (UTF-8)
14
+ * digest = SHA-256(input) (via crypto.subtle)
15
+ * hash64 = digest[0..7] as big-endian UInt64 (BigInt — Number can't hold it)
16
+ * bucket = hash64 mod 100 (∈ [0, 99])
17
+ */
18
+ import type { Cohort } from './types';
19
+ /**
20
+ * Compute the deterministic bucket [0, 99] for (appAccountId, version).
21
+ *
22
+ * Uses BigInt for the 64-bit accumulation: the top 8 bytes of a SHA-256 digest
23
+ * routinely exceed `Number.MAX_SAFE_INTEGER` (2^53), so a plain `number` would
24
+ * silently lose precision and diverge from iOS/Android. This is the footgun the
25
+ * BigInt path exists to avoid.
26
+ */
27
+ export declare function computeBucket(appAccountId: string, version: number): Promise<number>;
28
+ /**
29
+ * Classify a bucket into a cohort: `bucket < rolloutPct` → treatment, else control.
30
+ * (rolloutPct 0 → always control, 100 → always treatment.)
31
+ */
32
+ export declare function cohortForBucket(bucket: number, rolloutPct: number): Cohort;
33
+ //# sourceMappingURL=bucketing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bucketing.d.ts","sourceRoot":"","sources":["../../src/experiments/bucketing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAU1F;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAE1E"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Experiment domain types (NCL — Net Conversion Lift A/B).
3
+ *
4
+ * Cohort string values are the cross-platform BigQuery join literals and MUST
5
+ * match iOS/Android verbatim ('treatment' | 'control' | 'notEnrolled').
6
+ */
7
+ import type * as Contract from '../api/contract';
8
+ /**
9
+ * NCL cohort assignment.
10
+ *
11
+ * - `treatment`: user sees the Encore offer (normal flow).
12
+ * - `control`: Ghost Trigger — no UI shown, exposure logged (the A/B denominator).
13
+ * - `notEnrolled`: experiment disabled, config unavailable, or no appAccountId —
14
+ * falls back to normal behaviour (offers shown, NO exposure logged).
15
+ */
16
+ export type Cohort = 'treatment' | 'control' | 'notEnrolled';
17
+ /**
18
+ * The `experiments.ncl` block of the remote config response.
19
+ * `enabled === false` makes the manager a no-op (everyone notEnrolled → normal flow).
20
+ *
21
+ * Derived from the contract (not hand-declared): it is fed verbatim from
22
+ * fetchConfig().experiments.ncl with no mapping, so a field going optional/
23
+ * nullable in the backend contract should surface here as a compile error rather
24
+ * than silent drift. `null` (contract "not configured") is handled by consumers.
25
+ */
26
+ export type NCLExperimentConfig = NonNullable<NonNullable<Contract.ConfigResponse['experiments']>['ncl']>;
27
+ /**
28
+ * Persisted assignment cache. Cohort is a pure function of
29
+ * (appAccountId, assignmentVersion); this only avoids re-hashing on every show.
30
+ * Both keys are stored so a mismatch on EITHER forces a re-bucket: a bumped
31
+ * `assignmentVersion` (new epoch) or a changed `appAccountId` (e.g. an anonymous
32
+ * visitor calling `identify()` mid-session — web storage is per-origin and
33
+ * shared across identities, unlike the device-stable mobile id).
34
+ */
35
+ export interface NCLAssignment {
36
+ cohort: Cohort;
37
+ appAccountId: string;
38
+ assignmentVersion: number;
39
+ }
40
+ /**
41
+ * Read-only diagnostic snapshot of the NCL experiment state, surfaced by
42
+ * `Encore.getExperimentState()` for host apps and the demo harness. Exposes the
43
+ * full deterministic chain — the config epoch (`assignmentVersion`, `rolloutPct`),
44
+ * the resolved `appAccountId`, its computed `bucket` ∈ [0, 99], the resulting
45
+ * `cohort`, and whether the A/B `exposure` has been logged this epoch — without
46
+ * mutating any of it. `enabled: false` / `cohort: 'notEnrolled'` when no NCL
47
+ * experiment is active for the app. `bucket` is `null` when it can't be computed
48
+ * (no appAccountId, experiment disabled, or an insecure context with no WebCrypto).
49
+ */
50
+ export interface NCLExperimentState {
51
+ experiment: string;
52
+ enabled: boolean;
53
+ rolloutPct: number | null;
54
+ assignmentVersion: number | null;
55
+ appAccountId: string | null;
56
+ bucket: number | null;
57
+ cohort: Cohort;
58
+ exposureLogged: boolean;
59
+ }
60
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/experiments/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,MAAM,MAAM,GAAG,WAAW,GAAG,SAAS,GAAG,aAAa,CAAC;AAE7D;;;;;;;;GAQG;AACH,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAC3C,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAC3D,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,OAAO,CAAC;CACzB"}
package/types/index.d.ts CHANGED
@@ -7,4 +7,5 @@ export { Encore, Encore as default } from './core/Encore';
7
7
  export type * from './types';
8
8
  export type * from './api/models';
9
9
  export type { EntitlementChangedEvent, EntitlementEventMap } from './core/EntitlementManager';
10
+ export type { Cohort, NCLExperimentState } from './experiments/types';
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,eAAe,CAAC;AAG1D,mBAAmB,SAAS,CAAC;AAG7B,mBAAmB,cAAc,CAAC;AAGlC,YAAY,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,eAAe,CAAC;AAG1D,mBAAmB,SAAS,CAAC;AAG7B,mBAAmB,cAAc,CAAC;AAGlC,YAAY,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAG9F,YAAY,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
package/types/react.d.ts CHANGED
@@ -2,9 +2,7 @@ import { type ReactNode } from 'react';
2
2
  import type { EncoreConfig } from '@encorekit/web-sdk';
3
3
  type EncoreProviderProps = {
4
4
  children: ReactNode;
5
- } & Omit<EncoreConfig, 'userId'> & {
6
- userId?: string;
7
- };
5
+ } & EncoreConfig;
8
6
  export declare function EncoreProvider({ children, ...config }: EncoreProviderProps): import("react/jsx-runtime").JSX.Element;
9
7
  export declare function useEncore(): import("./core/Encore").EncoreSDK;
10
8
  export { Encore } from '@encorekit/web-sdk';
@@ -1 +1 @@
1
- {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,KAAK,mBAAmB,GAAG;IACzB,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAIvD,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,EAAE,mBAAmB,2CAa1E;AAED,wBAAgB,SAAS,sCAExB;AAGD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,mBAAmB,oBAAoB,CAAC"}
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,KAAK,mBAAmB,GAAG;IACzB,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,YAAY,CAAC;AAIjB,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,EAAE,mBAAmB,2CAa1E;AAED,wBAAgB,SAAS,sCAExB;AAGD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,mBAAmB,oBAAoB,CAAC"}
package/types/types.d.ts CHANGED
@@ -71,6 +71,18 @@ export type NotGrantedReason = 'userClosedModal' | 'userClickedOutside' | 'userD
71
71
  */
72
72
  export interface PresentationResult {
73
73
  granted: boolean;
74
+ /**
75
+ * Human-readable reward text for display only (e.g. "3 months of Ahead free"),
76
+ * derived from the campaign's UI copy. NEVER use this for access control —
77
+ * entitlements are server-authoritative (verify on your backend).
78
+ */
79
+ reward?: string;
80
+ /**
81
+ * @deprecated Web entitlements are server-authoritative. Verify access on your backend via
82
+ * Encore's server-side entitlements API (`/entitlements/server`, HMAC-signed) — not from the
83
+ * client. This field is no longer populated from a trusted source and will be removed in the
84
+ * next major version. For display, use `reward`.
85
+ */
74
86
  entitlement?: EntitlementType;
75
87
  reason?: NotGrantedReason;
76
88
  }
@@ -83,29 +95,101 @@ export interface AppearanceConfig {
83
95
  accentColor?: string;
84
96
  }
85
97
  /**
86
- * Options for placement configuration
98
+ * `'thankYou'`-only priming copy shown ABOVE the offers — the lead-in pair between
99
+ * the payment status and the carousel, context for why offers are being shown (never
100
+ * any one offer's own copy). Ignored by the `'list'` layout, whose top heading is
101
+ * `header` instead: one name means one thing in every layout.
87
102
  */
88
- export interface OfferConfig {
103
+ export interface OfferContextConfig {
89
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
+ */
90
110
  subtitle?: string;
91
111
  }
92
- export interface CompletionConfig {
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
+ * The sheet's top heading block — in EVERY layout. In `'list'` it is the modal
121
+ * title/subtitle above the offers (local override of the remote copy); in
122
+ * `'thankYou'` it is the payment-status block (check + title + subtitle). The host
123
+ * supplies the copy — the SDK never invents payment facts.
124
+ */
125
+ export interface PlacementHeaderConfig {
126
+ /**
127
+ * Status icon (`'thankYou'` only). `'success'` (default) renders a green-circle
128
+ * check; `'none'` hides it. Ignored by `'list'`.
129
+ */
130
+ icon?: 'success' | 'none';
131
+ /**
132
+ * Heading title. In `'list'` the sheet title (falls back to remote copy when
133
+ * omitted); in `'thankYou'` the status title, e.g. "Payment Successful"
134
+ * (omitted → not rendered).
135
+ */
93
136
  title?: string;
137
+ /**
138
+ * Heading subtitle (a plain constant string). In `'list'` the sheet subtitle; in
139
+ * `'thankYou'` the muted status line, where a `receipt` passed to `show()` takes
140
+ * precedence over this slot.
141
+ */
94
142
  subtitle?: string;
95
- buttonText?: string;
96
- typeText?: string;
97
- amountText?: string;
143
+ }
144
+ /** Trust footer for the `'thankYou'` layout. Omitted → not rendered. */
145
+ export interface PlacementFooterConfig {
146
+ /** Small muted centered line, e.g. "🔒 Secured by Acme". */
147
+ text?: string;
98
148
  }
99
149
  export interface PlacementOptions {
100
150
  appearance?: AppearanceConfig;
101
- offer?: OfferConfig;
102
- completion?: CompletionConfig;
151
+ /** Priming pair above the offers — `'thankYou'` only; ignored by `'list'`. */
152
+ offerContext?: OfferContextConfig;
153
+ /** Layout template. Defaults to `'list'` (today's UI, unchanged). */
154
+ layout?: PlacementLayout;
155
+ /** Top heading block: modal title in `'list'`, payment status in `'thankYou'`. */
156
+ header?: PlacementHeaderConfig;
157
+ /** Trust footer — used by the `'thankYou'` layout only. */
158
+ footer?: PlacementFooterConfig;
159
+ }
160
+ /**
161
+ * Per-transaction receipt details for the `'thankYou'` layout. Rendered by the SDK as
162
+ * "You paid {amount} for {purpose}" (or "You paid {amount}" without a purpose) in the
163
+ * payment-status subtitle slot. Values are rendered verbatim as text — pre-format the
164
+ * currency on your side.
165
+ */
166
+ export interface Receipt {
167
+ /** Pre-formatted amount, e.g. "NGN 100". */
168
+ amount: string;
169
+ /** What was paid for, e.g. "Demo". */
170
+ purpose?: string;
171
+ }
172
+ /**
173
+ * Per-call options for show().
174
+ */
175
+ export interface ShowOptions {
176
+ /**
177
+ * Per-transaction receipt for the `'thankYou'` layout. When provided it owns the
178
+ * payment-status subtitle (overriding `header.subtitle`). Ignored by `'list'`.
179
+ */
180
+ receipt?: Receipt;
103
181
  }
104
182
  /**
105
- * Optional callbacks for presentation events
183
+ * Presentation callbacks and show-time options
106
184
  */
107
- export interface PresentationOptions {
108
- onGranted?: (entitlement: EntitlementType) => void;
185
+ export interface PresentationOptions extends ShowOptions {
186
+ /**
187
+ * Fires when the user completes the offer flow (provisional grant). The argument is the
188
+ * deprecated, display-derived entitlement and may be `undefined`.
189
+ * @deprecated The structured `entitlement` argument is no longer trustworthy. Read
190
+ * `PresentationResult.reward` for display, and verify real access server-side. Removed next major.
191
+ */
192
+ onGranted?: (entitlement?: EntitlementType) => void;
109
193
  onNotGranted?: (reason: NotGrantedReason) => void;
110
194
  onError?: (error: EncoreError) => void;
111
195
  }
@@ -113,10 +197,13 @@ export interface PresentationOptions {
113
197
  * Builder pattern for placement API
114
198
  */
115
199
  export interface PlacementBuilder {
116
- onGranted(callback: (entitlement: EntitlementType) => void): PlacementBuilder;
200
+ /** Fires when the sheet closes without a claim — carries the dismissal reason. */
117
201
  onNotGranted(callback: (reason: NotGrantedReason) => void): PlacementBuilder;
118
202
  onLoadingStateChange(callback: (isLoading: boolean) => void): PlacementBuilder;
119
- show(): Promise<PresentationResult>;
203
+ /** Same bare ShowResult contract as Encore.show(). Never rejects. */
204
+ show(options?: ShowOptions): Promise<ShowResult>;
205
+ /** Redeem the transaction made at this placement — phase 2 of the two-phase flow. */
206
+ redeem(): Promise<RedeemResult>;
120
207
  }
121
208
  /**
122
209
  * Error codes used throughout the SDK
@@ -148,7 +235,9 @@ export interface EncoreError {
148
235
  */
149
236
  export type VerificationStatus = 'pending' | 'verified' | 'failed' | 'timeout' | 'cancelled';
150
237
  /**
151
- * UI Configuration options
238
+ * Presentation copy slots consumed by the offer UI. Populated from the remote
239
+ * /config payload and overridden per-call via placement options — NOT part of
240
+ * EncoreConfig (configure() is connection/behavior settings only).
152
241
  */
153
242
  export interface UIConfiguration {
154
243
  titleText?: string;
@@ -162,17 +251,140 @@ export interface UIConfiguration {
162
251
  creditClaimedTitleText?: string;
163
252
  creditClaimedSubtitleText?: string;
164
253
  applyCreditsButtonText?: string;
254
+ /** App name for reward template substitution (e.g. "Tinder Plus"). Display only. */
255
+ appName?: string;
256
+ /** Reward value for template substitution (e.g. "3"). Display only — not an entitlement. */
257
+ entitlementValue?: string;
258
+ /** Reward unit for template substitution (e.g. "months"). Display only — not an entitlement. */
259
+ entitlementUnit?: string;
165
260
  }
166
261
  /**
167
262
  * Main SDK configuration options
168
263
  */
169
264
  export interface EncoreConfig {
170
265
  apiKey: string;
171
- userId?: string | undefined;
172
- baseURL?: string;
173
266
  environment?: 'production' | 'development' | 'staging' | 'localhost';
174
267
  logLevel?: 'none' | 'debug';
175
- uiConfiguration?: UIConfiguration;
268
+ /**
269
+ * Redemption flow:
270
+ * - 'deferred' (default): show() resolves when the user CLAIMS an offer (a transaction
271
+ * record is created, NO redirect). The host runs its own conversion, then calls
272
+ * redeem() to render the redemption screen + send the user to the advertiser.
273
+ * - 'immediate': the legacy one-step flow — claiming an offer redirects to the
274
+ * advertiser and shows the success screen inline (no separate redeem() call).
275
+ * This is a control-flow contract (it changes what host code must call), so it is
276
+ * a LOCAL config value, not remote.
277
+ */
278
+ redemptionMode?: 'deferred' | 'immediate';
279
+ }
280
+ /**
281
+ * Offer descriptor carried on a transaction — enough to render the redemption screen AND
282
+ * to rebuild the advertiser redirect at redeem() time (so the deferred flow never
283
+ * needs the live offer again). `advertiserUrl` may contain a TRANSACTION_ID
284
+ * placeholder, substituted with the transaction id when the redemption fires.
285
+ */
286
+ export interface OfferRef {
287
+ id: string;
288
+ campaignId: string;
289
+ advertiserUrl: string;
290
+ trackingParameters?: Record<string, string>;
291
+ advertiserName?: string;
292
+ /** Display-only reward copy (e.g. "30 days of Apple Music"). NOT an entitlement. */
293
+ reward?: string;
294
+ imageUrl?: string;
295
+ logoUrl?: string;
296
+ }
297
+ /**
298
+ * A claimed offer awaiting redemption. Claiming starts a transaction, and the
299
+ * returned `transactionId` is this transaction's durable handle (the same id used by
300
+ * `didGrant`, `waitForVerification`, and the backend).
301
+ */
302
+ export interface Transaction {
303
+ id: string;
304
+ /** The persistent account identity this transaction is bound to (app_account_id). */
305
+ appAccountId: string;
306
+ /** The placement the offer was claimed at, if any (keys the local placement->transaction map). */
307
+ placementId?: string;
308
+ offer: OfferRef;
309
+ status: 'claimed' | 'redeemed';
310
+ /** ISO-8601 timestamps. */
311
+ createdAt: string;
312
+ expiresAt: string;
313
+ redeemedAt?: string;
314
+ }
315
+ /** Result of `show()` / `present()`. */
316
+ export type ShowResult =
317
+ /**
318
+ * The user claimed an offer. A transaction was recorded SDK-side, and in
319
+ * 'immediate' mode the advertiser was also opened in a new tab; the SDK
320
+ * renders nothing after a claim — the host owns that moment. Deliberately
321
+ * NOT a conversion claim: advertiser conversion is asynchronous and
322
+ * server-authoritative; check it server-side by user (never from the client).
323
+ * In 'deferred' mode, call redeem() after your own conversion work — the SDK
324
+ * resolves the pending transaction internally; no handle needed.
325
+ */
326
+ {
327
+ status: 'claimed';
328
+ }
329
+ /** The user dismissed the carousel without claiming. */
330
+ | {
331
+ status: 'dismissed';
332
+ reason?: NotGrantedReason;
333
+ }
334
+ /** No eligible offers (or a control-cohort ghost trigger). */
335
+ | {
336
+ status: 'unavailable';
337
+ };
338
+ /** Options for `redeem()`. */
339
+ export interface RedeemOptions {
340
+ /**
341
+ * Resolve the transaction made at this placement (the local placement->transaction map). When
342
+ * passed via Encore.placement(id).redeem() this is the placement id. If no transaction
343
+ * exists for the placement, resolves `none` — it never crosses to another placement.
344
+ */
345
+ placement?: string;
346
+ /** Optional host product card to render as "Active" above the pending offer. */
347
+ host?: {
348
+ name: string;
349
+ status?: string;
350
+ logoUrl?: string;
351
+ };
352
+ }
353
+ /** Result of `redeem()`. */
354
+ export type RedeemResult =
355
+ /** The advertiser redirect was performed for the pending transaction. */
356
+ {
357
+ status: 'redeemed';
358
+ }
359
+ /**
360
+ * The sheet closed without redeeming. `reason` mirrors show(): user-driven
361
+ * closes carry no reason or a user reason; internal failures carry
362
+ * `{ type: 'error', error }` — redeem() never rejects. On an error the pending
363
+ * transaction is untouched, so calling redeem() again later is safe.
364
+ */
365
+ | {
366
+ status: 'dismissed';
367
+ reason?: NotGrantedReason;
368
+ } | {
369
+ status: 'expired';
370
+ }
371
+ /** STRICTLY "no pending transaction to redeem" — never an error disguise. */
372
+ | {
373
+ status: 'none';
374
+ };
375
+ /**
376
+ * A subscription/conversion event forwarded from the host (Tier-1 client signal).
377
+ * NON-AUTHORITATIVE — posted via the pk-authed analytics channel, never the HMAC
378
+ * webhook. Use server-to-server webhooks (apple/google/revenuecat/superwall/encore)
379
+ * for authoritative revenue truth.
380
+ */
381
+ export interface SubscriptionEvent {
382
+ type: 'did_subscribe' | 'did_renew' | 'did_cancel' | 'did_convert' | (string & {});
383
+ plan?: string;
384
+ price?: number;
385
+ currency?: string;
386
+ productId?: string;
387
+ [key: string]: unknown;
176
388
  }
177
389
  /**
178
390
  * Event handler function type
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;GAEG;AACH,MAAM,M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AAE,aAAa,CAAA;CAAE,CAAC;AAE9B,8BAA8B;AAC9B,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,IAAI,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5D;AAED,4BAA4B;AAC5B,MAAM,MAAM,YAAY;AACtB,yEAAyE;AACvE;IAAE,MAAM,EAAE,UAAU,CAAA;CAAE;AACxB;;;;;GAKG;GACD;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAAE,GAClD;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE;AACvB,6EAA6E;GAC3E;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvB;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,eAAe,GAAG,WAAW,GAAG,YAAY,GAAG,aAAa,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IACnF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAMD;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC"}
@@ -4,6 +4,15 @@
4
4
  */
5
5
  import type { OfferModel as Offer } from '../api/models';
6
6
  import type { UIConfiguration } from '../types';
7
+ export interface OfferCarouselOptions {
8
+ /**
9
+ * 'responsive' (default): today's behavior — horizontal carousel on desktop, vertical
10
+ * full-screen list on mobile (viewport-derived).
11
+ * 'paged' (thankYou layout): always-horizontal, one-card-per-view, scroll-snap paged
12
+ * carousel at every breakpoint, with chevron nav bubbles.
13
+ */
14
+ mode?: 'responsive' | 'paged';
15
+ }
7
16
  interface CarouselEventMap extends Record<string, unknown> {
8
17
  offerClaim: {
9
18
  offer: Offer;
@@ -22,7 +31,7 @@ interface CarouselEventMap extends Record<string, unknown> {
22
31
  }
23
32
  export declare class OfferCarousel {
24
33
  #private;
25
- constructor(offers: Offer[], uiConfig?: UIConfiguration);
34
+ constructor(offers: Offer[], uiConfig?: UIConfiguration, options?: OfferCarouselOptions);
26
35
  /**
27
36
  * Render the carousel
28
37
  */
@@ -40,11 +49,13 @@ export declare class OfferCarousel {
40
49
  */
41
50
  getTotalOffers(): number;
42
51
  /**
43
- * Navigate to next offer
52
+ * Navigate to next offer. A user INTENT: commits domain state immediately (so
53
+ * semantic UI updates once, and rapid clicks chain naturally), then runs the
54
+ * scroll as an effect. The highlight is not touched — it follows the motion.
44
55
  */
45
56
  next(): void;
46
57
  /**
47
- * Navigate to previous offer
58
+ * Navigate to previous offer — see next().
48
59
  */
49
60
  previous(): void;
50
61
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"OfferCarousel.d.ts","sourceRoot":"","sources":["../../src/ui/OfferCarousel.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAMhD,UAAU,gBAAiB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACxD,UAAU,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,YAAY,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAChC,SAAS,EAAE;QAAE,K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