@rocapine/react-native-onboarding 1.77.0 → 1.79.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/README.md +38 -10
  2. package/dist/OnboardingStudio.d.ts +14 -1
  3. package/dist/OnboardingStudio.d.ts.map +1 -1
  4. package/dist/OnboardingStudio.js +5 -1
  5. package/dist/OnboardingStudio.js.map +1 -1
  6. package/dist/OnboardingStudioClient.d.ts +31 -0
  7. package/dist/OnboardingStudioClient.d.ts.map +1 -1
  8. package/dist/OnboardingStudioClient.js +80 -19
  9. package/dist/OnboardingStudioClient.js.map +1 -1
  10. package/dist/assignmentId.d.ts +107 -0
  11. package/dist/assignmentId.d.ts.map +1 -0
  12. package/dist/assignmentId.js +215 -0
  13. package/dist/assignmentId.js.map +1 -0
  14. package/dist/index.d.ts +5 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +9 -2
  17. package/dist/index.js.map +1 -1
  18. package/dist/paywalls/PaywallProvider.d.ts +8 -1
  19. package/dist/paywalls/PaywallProvider.d.ts.map +1 -1
  20. package/dist/paywalls/PaywallProvider.js +5 -1
  21. package/dist/paywalls/PaywallProvider.js.map +1 -1
  22. package/dist/paywalls/customScreens.d.ts +7 -0
  23. package/dist/paywalls/customScreens.d.ts.map +1 -1
  24. package/dist/paywalls/devHook.d.ts +26 -0
  25. package/dist/paywalls/devHook.d.ts.map +1 -0
  26. package/dist/paywalls/devHook.js +29 -0
  27. package/dist/paywalls/devHook.js.map +1 -0
  28. package/dist/paywalls/observer.d.ts +2 -0
  29. package/dist/paywalls/observer.d.ts.map +1 -1
  30. package/dist/paywalls/observer.js +21 -9
  31. package/dist/paywalls/observer.js.map +1 -1
  32. package/dist/paywalls/types.d.ts +22 -0
  33. package/dist/paywalls/types.d.ts.map +1 -1
  34. package/dist/products/adapters/expoIap.d.ts +34 -13
  35. package/dist/products/adapters/expoIap.d.ts.map +1 -1
  36. package/dist/products/adapters/expoIap.js +136 -21
  37. package/dist/products/adapters/expoIap.js.map +1 -1
  38. package/dist/steps/ComposableScreen/types.d.ts +21 -0
  39. package/dist/steps/ComposableScreen/types.d.ts.map +1 -1
  40. package/dist/steps/ComposableScreen/types.js +14 -0
  41. package/dist/steps/ComposableScreen/types.js.map +1 -1
  42. package/dist/types.d.ts +47 -0
  43. package/dist/types.d.ts.map +1 -1
  44. package/dist/types.js +6 -0
  45. package/dist/types.js.map +1 -1
  46. package/dist/userProperties/reserved.d.ts +8 -5
  47. package/dist/userProperties/reserved.d.ts.map +1 -1
  48. package/dist/userProperties/reserved.js +9 -4
  49. package/dist/userProperties/reserved.js.map +1 -1
  50. package/dist/version.d.ts +1 -1
  51. package/dist/version.js +1 -1
  52. package/package.json +1 -1
  53. package/src/OnboardingStudio.ts +19 -1
  54. package/src/OnboardingStudioClient.ts +84 -31
  55. package/src/__tests__/assignmentId.clear.test.ts +413 -0
  56. package/src/__tests__/assignmentId.client.test.ts +288 -0
  57. package/src/__tests__/assignmentId.test.ts +195 -0
  58. package/src/__tests__/onboardingMetadata.client.test.ts +76 -0
  59. package/src/assignmentId.ts +278 -0
  60. package/src/index.ts +9 -0
  61. package/src/paywalls/PaywallProvider.tsx +13 -0
  62. package/src/paywalls/__tests__/PaywallProvider.observer.test.tsx +51 -0
  63. package/src/paywalls/__tests__/devHook.test.ts +70 -0
  64. package/src/paywalls/__tests__/getPaywalls.test.ts +77 -2
  65. package/src/paywalls/__tests__/observer.test.ts +37 -0
  66. package/src/paywalls/__tests__/present.test.ts +14 -0
  67. package/src/paywalls/customScreens.ts +7 -0
  68. package/src/paywalls/devHook.ts +48 -0
  69. package/src/paywalls/observer.ts +22 -2
  70. package/src/paywalls/types.ts +22 -0
  71. package/src/products/adapters/__tests__/expoIap.contract.test.ts +305 -0
  72. package/src/products/adapters/expoIap.ts +171 -32
  73. package/src/steps/ComposableScreen/types.ts +21 -0
  74. package/src/types.ts +48 -0
  75. package/src/userProperties/__tests__/primitives.test.ts +1 -1
  76. package/src/userProperties/reserved.ts +9 -4
  77. package/src/version.ts +1 -1
@@ -742,6 +742,57 @@ describe("PaywallProvider observer — observePresentation (the inline step's se
742
742
  });
743
743
  });
744
744
 
745
+ describe("PaywallProvider observer — the served arm reaches start() on both surfaces (#237)", () => {
746
+ const armedCatalog = (arm: Record<string, unknown>) => {
747
+ const catalog = catalogOf("upgrade");
748
+ Object.assign(catalog.paywalls.upgrade, arm);
749
+ return catalog;
750
+ };
751
+ const presentStart = async (arm: Record<string, unknown>) => {
752
+ const { observer, calls } = recordingObserver();
753
+ const { captured } = await mount({ observer, catalog: armedCatalog(arm) });
754
+ await act(async () => void captured.ctx.present("upgrade"));
755
+ await settle();
756
+ await act_(() => captured.ctx.complete({ status: "dismissed" }));
757
+ return calls[0];
758
+ };
759
+ const stepStart = async (arm: Record<string, unknown>) => {
760
+ const { observer, calls } = recordingObserver();
761
+ const { captured } = await mount({ observer });
762
+ captured.ctx.observePresentation({ ...paywall("upgrade"), ...arm });
763
+ return calls[0];
764
+ };
765
+
766
+ it.each([
767
+ ["present()", presentStart],
768
+ ["the paywall step", stepStart],
769
+ ])("%s reports a served variant", async (_label, start) => {
770
+ expect(await start({ variantKey: "b", deploymentId: 42 })).toEqual([
771
+ "start",
772
+ expect.objectContaining({ variantKey: "b", deploymentId: "42" }),
773
+ ]);
774
+ });
775
+
776
+ it.each([
777
+ ["present()", presentStart],
778
+ ["the paywall step", stepStart],
779
+ ])("%s reports the parent paywall as main", async (_label, start) => {
780
+ expect(await start({ variantKey: "main", deploymentId: 7 })).toEqual([
781
+ "start",
782
+ expect.objectContaining({ variantKey: "main", deploymentId: "7" }),
783
+ ]);
784
+ });
785
+
786
+ it.each([
787
+ ["present()", presentStart],
788
+ ["the paywall step", stepStart],
789
+ ])("%s adds no property for an older server", async (_label, start) => {
790
+ const [, info] = (await start({})) as [string, Record<string, unknown>];
791
+ expect(Object.keys(info)).not.toContain("variantKey");
792
+ expect(Object.keys(info)).not.toContain("deploymentId");
793
+ });
794
+ });
795
+
745
796
  describe("PaywallProvider observer — complete() carries a custom screen's transaction (#287)", () => {
746
797
  const tx = { originalTransactionIdentifier: "2000000123", productId: "com.app.annual.ios" };
747
798
 
@@ -0,0 +1,70 @@
1
+ import { describe, it, expect, vi, afterEach } from "vitest";
2
+ import {
3
+ setPaywallDevHook,
4
+ notifyPaywallShown,
5
+ hasPaywallDevHook,
6
+ type PaywallShownInfo,
7
+ } from "../devHook";
8
+
9
+ const info: PaywallShownInfo = {
10
+ paywallId: "p1",
11
+ paywallName: "Spring sale",
12
+ renderMode: "elements",
13
+ customScreenId: null,
14
+ platform: "ios",
15
+ appVersion: "1.0.0",
16
+ sdkVersion: "1.78.0",
17
+ projectId: "proj",
18
+ functionsBaseUrl: "https://example.test/functions/v1",
19
+ viewRef: { current: null },
20
+ };
21
+
22
+ afterEach(() => {
23
+ setPaywallDevHook(null);
24
+ vi.restoreAllMocks();
25
+ });
26
+
27
+ describe("paywall dev hook", () => {
28
+ it("notifyPaywallShown without a hook is a no-op", () => {
29
+ expect(hasPaywallDevHook()).toBe(false);
30
+ expect(() => notifyPaywallShown(info)).not.toThrow();
31
+ });
32
+
33
+ it("calls the registered hook with the info", () => {
34
+ const hook = vi.fn();
35
+ setPaywallDevHook(hook);
36
+ expect(hasPaywallDevHook()).toBe(true);
37
+ notifyPaywallShown(info);
38
+ expect(hook).toHaveBeenCalledWith(info);
39
+ });
40
+
41
+ it("a throwing hook is swallowed and warned", () => {
42
+ const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
43
+ setPaywallDevHook(() => {
44
+ throw new Error("boom");
45
+ });
46
+ expect(() => notifyPaywallShown(info)).not.toThrow();
47
+ expect(warn).toHaveBeenCalledTimes(1);
48
+ expect(String(warn.mock.calls[0][0])).toContain("Spring sale");
49
+ });
50
+
51
+ it("setPaywallDevHook(null) unregisters", () => {
52
+ const hook = vi.fn();
53
+ setPaywallDevHook(hook);
54
+ setPaywallDevHook(null);
55
+ expect(hasPaywallDevHook()).toBe(false);
56
+ notifyPaywallShown(info);
57
+ expect(hook).not.toHaveBeenCalled();
58
+ });
59
+
60
+ it("an async hook that rejects is warned, not left unhandled", async () => {
61
+ const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
62
+ setPaywallDevHook(async () => {
63
+ throw new Error("async boom");
64
+ });
65
+ expect(() => notifyPaywallShown(info)).not.toThrow();
66
+ await new Promise((r) => setTimeout(r, 0));
67
+ expect(warn).toHaveBeenCalledTimes(1);
68
+ expect(String(warn.mock.calls[0][0])).toContain("Spring sale");
69
+ });
70
+ });
@@ -1,4 +1,4 @@
1
- import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
1
+ import { describe, it, expect, expectTypeOf, vi, beforeEach, afterEach } from "vitest";
2
2
 
3
3
  // react-native is mocked so OnboardingStudioClient (which reads `Platform.OS`)
4
4
  // loads under Node — same stub `getOnboarding.query.test.ts` uses.
@@ -26,7 +26,8 @@ import {
26
26
  DEFAULT_PAYWALLS_CACHE_KEY,
27
27
  } from "../../infra/queries/cacheKey";
28
28
  import { getPaywallsQuery } from "../getPaywalls.query";
29
- import type { PaywallCatalog } from "../types";
29
+ import type { Paywall, PaywallCatalog } from "../types";
30
+ import type { CustomPaywallScreenProps } from "../customScreens";
30
31
 
31
32
  const CACHE_KEY = "rocapine-paywalls-studio";
32
33
  const CUSTOM_KEY = "v2";
@@ -383,3 +384,77 @@ describe("getPaywallsQuery cache key and request identity", () => {
383
384
  expect(setItem).toHaveBeenCalledWith(CUSTOM_CACHE_KEY, JSON.stringify(catalog));
384
385
  });
385
386
  });
387
+
388
+ // #235: each resolved paywall carries its own variant identity, PER MOMENT
389
+ // (like `audienceId`). The values are the server's; the SDK passes them through
390
+ // untouched — `null` stays `null`, and a field an older `get-paywalls` never
391
+ // sent stays absent.
392
+ describe("Paywall variant identity (variantKey / deploymentId)", () => {
393
+ const base = {
394
+ name: "pw",
395
+ audienceId: 1,
396
+ audienceName: "default",
397
+ elements: [],
398
+ billing: "store" as const,
399
+ products: [],
400
+ configuration: null,
401
+ };
402
+ const twoArms: PaywallCatalog = {
403
+ metadata: { locale: "en", draft: false },
404
+ paywalls: {
405
+ onboarding_end: {
406
+ ...base,
407
+ id: "pw-a",
408
+ moment: "onboarding_end",
409
+ variantKey: "b",
410
+ deploymentId: 42,
411
+ },
412
+ settings_upgrade: {
413
+ ...base,
414
+ id: "pw-b",
415
+ moment: "settings_upgrade",
416
+ // The parent paywall reports the reserved key.
417
+ variantKey: "main",
418
+ deploymentId: 7,
419
+ },
420
+ // An older `get-paywalls` that predates the fields.
421
+ legacy: { ...base, id: "pw-c", moment: "legacy" },
422
+ },
423
+ fonts: null,
424
+ };
425
+
426
+ const expectArms = (data: PaywallCatalog) => {
427
+ const { onboarding_end, settings_upgrade, legacy } = data.paywalls;
428
+ expect([onboarding_end.variantKey, onboarding_end.deploymentId]).toEqual(["b", 42]);
429
+ expect([settings_upgrade.variantKey, settings_upgrade.deploymentId]).toEqual(["main", 7]);
430
+ expect([legacy.variantKey, legacy.deploymentId]).toEqual([undefined, undefined]);
431
+ };
432
+
433
+ it("is declared on the resolved Paywall type, optional and nullable", () => {
434
+ expectTypeOf<Paywall["variantKey"]>().toEqualTypeOf<string | null | undefined>();
435
+ expectTypeOf<Paywall["deploymentId"]>().toEqualTypeOf<number | null | undefined>();
436
+ // A custom paywall screen gets the same two fields, same types.
437
+ expectTypeOf<CustomPaywallScreenProps["paywall"]["variantKey"]>().toEqualTypeOf<string | null | undefined>();
438
+ expectTypeOf<CustomPaywallScreenProps["paywall"]["deploymentId"]>().toEqualTypeOf<number | null | undefined>();
439
+ });
440
+
441
+ it("getPaywalls passes each moment's own values through, absent stays undefined", async () => {
442
+ const fetchMock = vi.fn().mockResolvedValue(fakeResponse(JSON.parse(JSON.stringify(twoArms))));
443
+ vi.stubGlobal("fetch", fetchMock);
444
+ try {
445
+ const { data } = await new OnboardingStudioClient("proj-1", {}).getPaywalls();
446
+ expectArms(data);
447
+ } finally {
448
+ vi.unstubAllGlobals();
449
+ }
450
+ });
451
+
452
+ it("survives the production cache round-trip (served from AsyncStorage)", async () => {
453
+ getItem.mockReset();
454
+ setItem.mockReset();
455
+ setItem.mockResolvedValue(undefined);
456
+ getItem.mockResolvedValue(JSON.stringify(twoArms));
457
+ const data = await run(makeClient({ isSandbox: false, cacheKey: CUSTOM_KEY, data: catalog }));
458
+ expectArms(data);
459
+ });
460
+ });
@@ -38,6 +38,43 @@ afterEach(() => {
38
38
  vi.restoreAllMocks();
39
39
  });
40
40
 
41
+ describe("openPaywallPresentation — the served arm on start() (#237)", () => {
42
+ const startInfo = (extra: Partial<PaywallPresentationSource>) => {
43
+ const { observer, calls } = recordingObserver();
44
+ openPaywallPresentation(observer, { ...PAYWALL, ...extra }, "present", "ios");
45
+ return calls[0][1] as Record<string, unknown>;
46
+ };
47
+
48
+ it("carries a served variant's key, and its deploymentId as a decimal string", () => {
49
+ expect(startInfo({ variantKey: "b", deploymentId: 42 })).toMatchObject({ variantKey: "b", deploymentId: "42" });
50
+ });
51
+
52
+ it("carries the reserved main key for the parent paywall", () => {
53
+ expect(startInfo({ variantKey: "main", deploymentId: 7 })).toMatchObject({ variantKey: "main", deploymentId: "7" });
54
+ });
55
+
56
+ it("keeps a deploymentId of 0 rather than treating it as absent", () => {
57
+ expect(startInfo({ variantKey: "b", deploymentId: 0 })).toMatchObject({ deploymentId: "0" });
58
+ });
59
+
60
+ it("carries the key alone when the server sent no deploymentId", () => {
61
+ const info = startInfo({ variantKey: "b", deploymentId: null });
62
+ expect(info.variantKey).toBe("b");
63
+ expect(Object.keys(info)).not.toContain("deploymentId");
64
+ });
65
+
66
+ it.each([
67
+ ["an older server (both absent)", {}],
68
+ ["a null variantKey", { variantKey: null, deploymentId: null }],
69
+ ["an empty variantKey", { variantKey: "", deploymentId: 42 }],
70
+ ["a deploymentId with no variantKey", { deploymentId: 42 }],
71
+ ])("sets neither key for %s", (_label, extra) => {
72
+ const info = startInfo(extra as Partial<PaywallPresentationSource>);
73
+ expect(Object.keys(info)).not.toContain("variantKey");
74
+ expect(Object.keys(info)).not.toContain("deploymentId");
75
+ });
76
+ });
77
+
41
78
  describe("openPaywallPresentation — the info handed to start()", () => {
42
79
  it("stringifies audienceId, defaults renderMode to elements, and names the surface", () => {
43
80
  const { observer, calls } = recordingObserver();
@@ -86,6 +86,20 @@ describe("resolvePresentDecision", () => {
86
86
  expect(decision).toEqual({ type: "start", paywall });
87
87
  });
88
88
 
89
+ it("hands present() the moment's own variant identity, per moment (#235)", () => {
90
+ const armed = makePaywall({ id: "a", moment: "end", variantKey: "b", deploymentId: 42 });
91
+ const other = makePaywall({ id: "b", moment: "settings", variantKey: "main", deploymentId: 7 });
92
+ const both = makeCatalog([armed, other]);
93
+
94
+ const pick = (moment: string) => {
95
+ const d = resolvePresentDecision(both, null, moment);
96
+ if (d.type !== "start") throw new Error(`expected start, got ${d.type}`);
97
+ return [d.paywall.variantKey, d.paywall.deploymentId];
98
+ };
99
+ expect(pick("end")).toEqual(["b", 42]);
100
+ expect(pick("settings")).toEqual(["main", 7]);
101
+ });
102
+
89
103
  // Every error below carries a `reason`. The bare `{status:"error"}` these
90
104
  // used to assert is what made two conditions with OPPOSITE correct responses
91
105
  // — "retry later, the catalog may still arrive" vs "do not retry, something
@@ -90,12 +90,19 @@ export type CustomPaywallScreenProps = {
90
90
  * `name` are the studio's, for analytics. Enough to report a conversion
91
91
  * without also handing over the `elements` tree a custom paywall has no use
92
92
  * for.
93
+ *
94
+ * `variantKey` and `deploymentId` are the catalog entry's own, passed
95
+ * through untouched: see `Paywall.variantKey` / `Paywall.deploymentId` for
96
+ * what they mean. `null` and absent are equivalent (no variant or
97
+ * deployment information).
93
98
  */
94
99
  paywall: {
95
100
  id: string;
96
101
  name: string;
97
102
  moment: string;
98
103
  customScreenId: string;
104
+ variantKey?: string | null;
105
+ deploymentId?: number | null;
99
106
  };
100
107
  };
101
108
 
@@ -0,0 +1,48 @@
1
+ import type React from "react";
2
+
3
+ /**
4
+ * Devtools-only seam. A paywall renderer calls `notifyPaywallShown` once the
5
+ * paywall is on screen; a devtools package registers the hook that reacts
6
+ * (e.g. captures the view). Without a registered hook everything here is a
7
+ * no-op, so production bundles pay nothing.
8
+ */
9
+ export type PaywallShownInfo = {
10
+ paywallId: string;
11
+ paywallName: string;
12
+ renderMode: "elements" | "custom";
13
+ customScreenId: string | null;
14
+ platform: "ios" | "android";
15
+ appVersion: string | null;
16
+ sdkVersion: string;
17
+ projectId: string;
18
+ functionsBaseUrl: string;
19
+ viewRef: React.RefObject<unknown>;
20
+ };
21
+
22
+ /** May be async: a rejection is warned, never left unhandled. */
23
+ export type PaywallDevHook = (info: PaywallShownInfo) => void | Promise<void>;
24
+
25
+ let hook: PaywallDevHook | null = null;
26
+
27
+ export function setPaywallDevHook(next: PaywallDevHook | null): void {
28
+ hook = next;
29
+ }
30
+
31
+ /** Lets renderers skip building `PaywallShownInfo` when nobody listens. */
32
+ export function hasPaywallDevHook(): boolean {
33
+ return hook !== null;
34
+ }
35
+
36
+ export function notifyPaywallShown(info: PaywallShownInfo): void {
37
+ if (!hook) return;
38
+ const warn = (e: unknown) => console.warn(`paywall dev hook threw for "${info.paywallName}"`, e);
39
+ try {
40
+ const result: unknown = hook(info);
41
+ // `.then(undefined, …)`, not `.catch`: a bare thenable need not have one.
42
+ if (result && typeof (result as PromiseLike<void>).then === "function") {
43
+ (result as PromiseLike<void>).then(undefined, warn);
44
+ }
45
+ } catch (e) {
46
+ warn(e);
47
+ }
48
+ }
@@ -65,6 +65,8 @@ export type PaywallPresentationSource = {
65
65
  billing?: "store" | "stripe";
66
66
  renderMode?: "elements" | "custom" | null;
67
67
  products?: ReadonlyArray<{ key: string; ios?: string; android?: string }>;
68
+ variantKey?: string | null;
69
+ deploymentId?: number | null;
68
70
  };
69
71
 
70
72
  /**
@@ -132,6 +134,25 @@ const isHandle = (value: unknown): value is PaywallPresentationHandle =>
132
134
  typeof (value as PaywallPresentationHandle).shown === "function" &&
133
135
  typeof (value as PaywallPresentationHandle).end === "function";
134
136
 
137
+ const nonEmptyString = (value: unknown): value is string => typeof value === "string" && value.length > 0;
138
+
139
+ /**
140
+ * The arm this paywall was served as (#237): a variant's key, or the reserved
141
+ * `"main"` for the parent. Both keys are left UNSET, never empty or
142
+ * `"none"`, when the server sent no `variantKey` (an older server), so an app
143
+ * on one sees no new property. `deploymentId` is only sent alongside a key,
144
+ * and as a decimal string because that is the contract's type.
145
+ *
146
+ * `end()` carries no info of its own: an observer attributes a purchase or a
147
+ * dismiss to the presentation `start()` opened, so this covers them too.
148
+ */
149
+ const servedArm = (paywall: PaywallPresentationSource): Pick<PaywallPresentationInfo, "variantKey" | "deploymentId"> => {
150
+ if (!nonEmptyString(paywall.variantKey)) return {};
151
+ return paywall.deploymentId == null
152
+ ? { variantKey: paywall.variantKey }
153
+ : { variantKey: paywall.variantKey, deploymentId: String(paywall.deploymentId) };
154
+ };
155
+
135
156
  export const buildPresentationInfo = (
136
157
  paywall: PaywallPresentationSource,
137
158
  surface: PaywallSurface
@@ -144,6 +165,7 @@ export const buildPresentationInfo = (
144
165
  renderMode: paywall.renderMode === "custom" ? "custom" : "elements",
145
166
  billing: paywall.billing === "stripe" ? "stripe" : "store",
146
167
  surface,
168
+ ...servedArm(paywall),
147
169
  });
148
170
 
149
171
  /**
@@ -164,8 +186,6 @@ const resolveProductId = (
164
186
  return undefined;
165
187
  };
166
188
 
167
- const nonEmptyString = (value: unknown): value is string => typeof value === "string" && value.length > 0;
168
-
169
189
  /**
170
190
  * A custom screen's `complete({ transaction })`, reduced to the contract: the
171
191
  * three ids only when they are non-empty strings, `restored` only when it is
@@ -23,6 +23,28 @@ export type Paywall = {
23
23
  moment: string;
24
24
  audienceId: number | null;
25
25
  audienceName: string | null;
26
+ /**
27
+ * Which variant of the paywall this moment resolved to. Resolved PER MOMENT,
28
+ * for the same reason as `audienceId` above: one moment can serve a variant
29
+ * while another serves the parent paywall, so two entries in one catalog can
30
+ * carry different values.
31
+ *
32
+ * The parent paywall itself reports the reserved key `"main"`; any other
33
+ * value names a variant of it.
34
+ *
35
+ * Passed through exactly as `get-paywalls` sends it; the SDK neither reads
36
+ * nor normalizes it. `null` and ABSENT (`undefined`) are equivalent: both
37
+ * mean "no variant information". Absent is what an older `get-paywalls`
38
+ * that predates the field produces — a device on a new SDK can be talking
39
+ * to one — so a consumer must not treat the two differently.
40
+ */
41
+ variantKey?: string | null;
42
+ /**
43
+ * Which published deployment this moment's paywall was served from. Same
44
+ * per-moment and pass-through rules as `variantKey`, and the same
45
+ * equivalence: `null` and absent both mean "no deployment information".
46
+ */
47
+ deploymentId?: number | null;
26
48
  /** UIElement[] — parsed by the UI adapter (Task 7's `ScreenElementsSchema`), not here. */
27
49
  elements: unknown[];
28
50
  /**