@app-swiss-knife/react-native-sdk 0.2.5 → 0.3.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 (69) hide show
  1. package/README.md +100 -47
  2. package/SwissKnifePurchases.podspec +8 -5
  3. package/android/src/main/java/com/swissknife/purchases/SwissKnifePurchasesModule.kt +18 -1
  4. package/android/vendor/java/com/appswissknife/context/DeviceContext.kt +1 -1
  5. package/android/vendor/java/com/appswissknife/net/IngestClient.kt +1 -1
  6. package/android/vendor/java/com/appswissknife/purchases/BillingClientGateway.kt +53 -9
  7. package/ios/SwissKnifeCrashReporting.swift +59 -18
  8. package/ios/SwissKnifePurchases.swift +16 -1
  9. package/ios/vendor/SwissKnifeiOS/Context/DeviceContext.swift +1 -1
  10. package/ios/vendor/SwissKnifeiOS/Context/Reachability.swift +1 -1
  11. package/ios/vendor/SwissKnifeiOS/CrashReporting/SKCrashReporting.swift +24 -0
  12. package/ios/vendor/SwissKnifeiOS/DeviceID.swift +22 -1
  13. package/ios/vendor/SwissKnifeiOS/Identity/Identity.swift +49 -0
  14. package/ios/vendor/SwissKnifeiOS/Net/IngestClient.swift +14 -0
  15. package/lib/commonjs/attributes.js +103 -0
  16. package/lib/commonjs/attributes.js.map +1 -0
  17. package/lib/commonjs/index.js +31 -2
  18. package/lib/commonjs/index.js.map +1 -1
  19. package/lib/commonjs/internal/config.js +237 -0
  20. package/lib/commonjs/internal/config.js.map +1 -0
  21. package/lib/commonjs/purchases.js +324 -218
  22. package/lib/commonjs/purchases.js.map +1 -1
  23. package/lib/commonjs/swiss-knife.js +115 -0
  24. package/lib/commonjs/swiss-knife.js.map +1 -0
  25. package/lib/commonjs/types.js +11 -0
  26. package/lib/commonjs/types.js.map +1 -1
  27. package/lib/module/attributes.js +100 -0
  28. package/lib/module/attributes.js.map +1 -0
  29. package/lib/module/index.js +19 -2
  30. package/lib/module/index.js.map +1 -1
  31. package/lib/module/internal/config.js +225 -0
  32. package/lib/module/internal/config.js.map +1 -0
  33. package/lib/module/purchases.js +309 -212
  34. package/lib/module/purchases.js.map +1 -1
  35. package/lib/module/swiss-knife.js +112 -0
  36. package/lib/module/swiss-knife.js.map +1 -0
  37. package/lib/module/types.js +11 -0
  38. package/lib/module/types.js.map +1 -1
  39. package/lib/typescript/commonjs/attributes.d.ts +41 -0
  40. package/lib/typescript/commonjs/attributes.d.ts.map +1 -0
  41. package/lib/typescript/commonjs/index.d.ts +2 -0
  42. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  43. package/lib/typescript/commonjs/internal/config.d.ts +121 -0
  44. package/lib/typescript/commonjs/internal/config.d.ts.map +1 -0
  45. package/lib/typescript/commonjs/purchases.d.ts +103 -95
  46. package/lib/typescript/commonjs/purchases.d.ts.map +1 -1
  47. package/lib/typescript/commonjs/swiss-knife.d.ts +56 -0
  48. package/lib/typescript/commonjs/swiss-knife.d.ts.map +1 -0
  49. package/lib/typescript/commonjs/types.d.ts +13 -0
  50. package/lib/typescript/commonjs/types.d.ts.map +1 -1
  51. package/lib/typescript/module/attributes.d.ts +41 -0
  52. package/lib/typescript/module/attributes.d.ts.map +1 -0
  53. package/lib/typescript/module/index.d.ts +2 -0
  54. package/lib/typescript/module/index.d.ts.map +1 -1
  55. package/lib/typescript/module/internal/config.d.ts +121 -0
  56. package/lib/typescript/module/internal/config.d.ts.map +1 -0
  57. package/lib/typescript/module/purchases.d.ts +103 -95
  58. package/lib/typescript/module/purchases.d.ts.map +1 -1
  59. package/lib/typescript/module/swiss-knife.d.ts +56 -0
  60. package/lib/typescript/module/swiss-knife.d.ts.map +1 -0
  61. package/lib/typescript/module/types.d.ts +13 -0
  62. package/lib/typescript/module/types.d.ts.map +1 -1
  63. package/package.json +1 -1
  64. package/src/attributes.ts +97 -0
  65. package/src/index.ts +19 -2
  66. package/src/internal/config.ts +233 -0
  67. package/src/purchases.ts +320 -228
  68. package/src/swiss-knife.ts +134 -0
  69. package/src/types.ts +14 -0
@@ -1,96 +1,55 @@
1
- import type { PurchasesConfiguration, LOG_LEVEL, CustomerInfo, PurchasesOfferings, PurchasesPackage, PurchasesStoreProduct, MakePurchaseResult, LogInResult, CustomerInfoUpdateListener } from "./types";
1
+ import { configure, configureCore, isConfigured, isCoreConfigured, setLogLevel, throwIfCoreNotConfigured, throwIfNotConfigured } from "./internal/config";
2
+ import type { CustomerInfo, PurchasesOfferings, PurchasesPackage, PurchasesStoreProduct, MakePurchaseResult, LogInResult, CustomerInfoUpdateListener } from "./types";
2
3
  /**
3
- * Guard for surfaces that genuinely need the PURCHASE engine — the store APIs
4
- * and the RC-parity identity aliases that route through the store gateway on
5
- * Android. Checks the JS "configure was called" flag.
6
- */
7
- declare function throwIfNotConfigured(): void;
8
- /**
9
- * Guard for surfaces that only need CORE — the subscriber-attribute setters.
10
- *
11
- * Attributes describe the *person*, not the purchase: natively they land in
12
- * `AttributesClient` → `POST /api/sdk/users/attributes` → `app_users.properties`,
13
- * which is what the dashboard person card reads. Neither platform's attributes
14
- * path touches StoreKit or Play Billing — iOS gates on `SwissKnife.isCoreConfigured`
15
- * (`SwissKnife.currentAnonymousIdForAttributes`), and Android's `configureCore`
16
- * wires `AttributesClient` with an `Identity`-snapshot id fallback precisely so a
17
- * store-less app still resolves ids. Gating these on the purchase flag left an app
18
- * that uses `configureCore` (because another library owns the store) with **no way
19
- * at all** to populate the person card.
20
- *
21
- * Two-step check, and the second step is load-bearing:
4
+ * RC-compatible subscriptions SDK entry point. Process-wide singleton.
22
5
  *
23
- * 1. The JS flag, set by `configure` / `configureCore`. Free, no bridge hop.
24
- * 2. Native truth. `Analytics.init(...)` wires core natively via
25
- * `configureObservability` and touches no JS flag, so an analytics-only app
26
- * has core configured while every JS flag reads `false` — exactly the case
27
- * {@link isCoreConfigured} documents. Skipping this step would keep the most
28
- * common core-only integration broken.
29
- *
30
- * Never consults the purchase flag. Strictly more permissive than
31
- * {@link throwIfNotConfigured}, so no existing caller can break.
32
- */
33
- declare function throwIfCoreNotConfigured(): Promise<void>;
34
- /**
35
- * RC-compatible subscriptions SDK entry point. Process-wide singleton; call
36
- * `Purchases.configure(...)` once at app start, then use the static methods.
6
+ * New code should bootstrap through {@link SwissKnife} — `SwissKnife.configure(…)`
7
+ * — and reach the store through this class. Code migrating from
8
+ * `react-native-purchases` can keep calling `Purchases.configure(…)`: it is the
9
+ * same function.
37
10
  */
38
11
  export declare class Purchases {
39
12
  /**
40
13
  * Configure the SDK. Must be called before any other method. Calling again
41
- * with the same API key is a no-op (matches the common "configure once" guard);
42
- * the native layer owns full reconfiguration.
14
+ * with the same API key is a no-op; the native layer owns full reconfiguration.
15
+ *
16
+ * RC-compatibility alias for `SwissKnife.configure(...)` — the same function
17
+ * under the name `react-native-purchases` uses. Neither is deprecated.
43
18
  */
44
- static configure(options: PurchasesConfiguration & {
45
- logLevel?: LOG_LEVEL;
46
- }): void;
19
+ static configure: typeof configure;
47
20
  /**
48
21
  * Configure everything EXCEPT the store: ingest, `Identity`, `Attribution`,
49
- * subscriber attributes.
22
+ * `Attributes`. Use it when another library already owns in-app purchases.
50
23
  *
51
- * Use this when another library already owns in-app purchases. `configure`
52
- * starts a `StoreKit.Transaction.updates` observer on iOS (whose handler
53
- * calls `transaction.finish()`) and builds a `BillingClient` on Android —
54
- * both of which contend with an incumbent IAP SDK. `configureCore` creates
55
- * neither, and registers no install as a side effect.
56
- *
57
- * Analytics-only apps don't even need this: `Analytics.init(...)` already
58
- * wires core natively. Reach for `configureCore` when you want to pass an
59
- * `appUserID`, an attribution configuration, or a log level up front.
24
+ * Alias for `SwissKnife.configureCore(...)`, which is the name that actually
25
+ * describes the call — nothing about this method concerns purchases, and it is
26
+ * only spelled `Purchases.configureCore` here so that no existing call site
27
+ * breaks. Prefer the `SwissKnife` spelling in new code.
60
28
  */
61
- static configureCore(options: PurchasesConfiguration & {
62
- logLevel?: LOG_LEVEL;
63
- }): void;
29
+ static configureCore: typeof configureCore;
64
30
  /**
65
31
  * Whether the PURCHASE engine has been configured — i.e. whether the store
66
- * APIs (`getOfferings`, `purchasePackage`, `restorePurchases`, …) can work.
67
- *
68
- * **Native is the source of truth.** This does not consult the JS-side
69
- * "configure was called" flag: a brownfield app can configure the SDK from
70
- * native code, and `Purchases.configure` itself is fire-and-forget, so the
71
- * JS flag is a request, not a fact.
32
+ * APIs below can work. Native is the source of truth; never throws or rejects.
72
33
  *
73
- * Never throws and never rejects. Resolves `false` when the native module is
74
- * not linked — see {@link nativeBoolean}. Exactly the same failure semantics
75
- * as {@link isCoreConfigured}; the two differ only in which native flag they
76
- * report.
34
+ * RC-compatibility alias for `SwissKnife.isConfigured()`.
77
35
  */
78
- static isConfigured(): Promise<boolean>;
36
+ static isConfigured: typeof isConfigured;
79
37
  /**
80
- * Whether the CORE (ingest / Identity / Attribution / attributes) is
38
+ * Whether the CORE (ingest / Identity / Attribution / Attributes) is
81
39
  * configured. True after `configure`, `configureCore`, or `Analytics.init`.
40
+ * Native is the source of truth; never throws or rejects.
82
41
  *
83
- * **Native is the source of truth**, and here that is load-bearing rather
84
- * than merely principled: `Analytics.init` wires core natively via
85
- * `configureObservability` and touches no JS configure flag, so an
86
- * analytics-only app has core configured while every JS flag reads false.
87
- * Short-circuiting on JS state would report `false` in the single most
88
- * common core-only integration.
42
+ * Alias for `SwissKnife.isCoreConfigured()`.
43
+ */
44
+ static isCoreConfigured: typeof isCoreConfigured;
45
+ /**
46
+ * Set the native log level. Process-wide — it governs the store engine, the
47
+ * ingest client, Identity, Attribution and the observability modules alike.
89
48
  *
90
- * Never throws and never rejects. Resolves `false` when the native module is
91
- * not linked — see {@link nativeBoolean}.
49
+ * Alias for `SwissKnife.setLogLevel(...)`, which is where a process-wide
50
+ * setting belongs (and where both native SDKs already put it).
92
51
  */
93
- static isCoreConfigured(): Promise<boolean>;
52
+ static setLogLevel: typeof setLogLevel;
94
53
  /** Latest CustomerInfo (entitlements + subscriptions), computed server-side. */
95
54
  static getCustomerInfo(): Promise<CustomerInfo>;
96
55
  /** Current + all offerings configured for this app. */
@@ -102,41 +61,90 @@ export declare class Purchases {
102
61
  /** Restore purchases tied to the underlying store account. */
103
62
  static restorePurchases(): Promise<CustomerInfo>;
104
63
  /**
105
- * Identify the user. Aliases/merges anonymous purchases server-side.
64
+ * Identify the user, merging the anonymous subject into `appUserID`
65
+ * server-side.
106
66
  *
107
- * @deprecated Wave 1 — prefer `Identity.logIn(userId)`. Routes through
108
- * the unified Identity surface natively, so the bug fix (Android now
109
- * POSTs `/api/sdk/users/identify`) applies whether you call this or
110
- * `Identity.logIn(...)`.
67
+ * Exactly `Identity.logIn(appUserID)` with the RevenueCat name. On both
68
+ * platforms this POSTs `(anonymous_id, user_id)` to
69
+ * `/api/sdk/users/identify` and resolves once the backend ack and the
70
+ * post-identify entitlements refresh complete; a rejection means the device
71
+ * is NOT merged server-side and the call must be retried. Repeat calls with
72
+ * the id already in effect are free (no bridge hop, no request).
73
+ *
74
+ * Works after `SwissKnife.configure`, `SwissKnife.configureCore`, or
75
+ * `Analytics.init` — the store does not have to be ours.
76
+ *
77
+ * @deprecated Wave 1 — prefer `Identity.logIn(userId)`. This alias exists so
78
+ * RevenueCat migrations compile unchanged; it is a pure delegation, so there
79
+ * is nothing to gain by keeping it and one less name to learn by dropping it.
111
80
  */
112
81
  static logIn(appUserID: string): Promise<LogInResult>;
113
82
  /**
114
- * Log out the current user and revert to anonymous.
83
+ * Log out the current user and revert to anonymous. The device id survives,
84
+ * so analytics continuity for the same physical install is preserved.
85
+ *
86
+ * Exactly `Identity.logOut()` with the RevenueCat name, plus RC's
87
+ * `CustomerInfo` return: after the logout lands, the post-logout customer
88
+ * info is read back from the store engine. **When no store engine is
89
+ * configured** (`configureCore`, `Analytics.init`) there is nothing to read,
90
+ * and you get an entitlement-free `CustomerInfo` for the anonymous subject —
91
+ * the same record, built in JS, on both platforms. Do not read that as a
92
+ * store error; if you want real entitlements, call `getCustomerInfo()`.
115
93
  *
116
- * @deprecated Wave 1 — prefer `Identity.logOut()`.
94
+ * @deprecated Wave 1 — prefer `Identity.logOut()`, which does not pretend to
95
+ * return store state.
117
96
  */
118
97
  static logOut(): Promise<CustomerInfo>;
119
- /** The current app user id (anonymous or identified). */
98
+ /**
99
+ * The current subject id — the identified user id if there is one, else the
100
+ * SDK's anonymous id (`$SKAnonymousID:`-prefixed, stable across launches).
101
+ *
102
+ * Exactly `(await Identity.current()).userId ?? .anonymousId`. Note this is
103
+ * the *Identity* subject on both platforms; on Android the purchase
104
+ * gateway's own anonymous id is a different, per-process value, and this
105
+ * alias deliberately does not report it.
106
+ *
107
+ * @deprecated Wave 1 — prefer `Identity.current()`, which hands back the
108
+ * anonymous id, the user id and `isAnonymous` in one read instead of forcing
109
+ * two calls that can interleave.
110
+ */
120
111
  static getAppUserID(): Promise<string>;
121
- /** Whether the current user id is an SDK-generated anonymous id. */
112
+ /**
113
+ * Whether the current subject is the SDK-generated anonymous id.
114
+ *
115
+ * Exactly `(await Identity.current()).isAnonymous`, so it tracks
116
+ * `Identity.reset()` and `Identity.wipe()` on both platforms.
117
+ *
118
+ * @deprecated Wave 1 — prefer `Identity.current()`; see
119
+ * {@link getAppUserID}.
120
+ */
122
121
  static isAnonymous(): Promise<boolean>;
123
- /** Set arbitrary subscriber attributes. null clears an attribute. */
124
- static setAttributes(attributes: Record<string, string | null>): Promise<void>;
125
- /** Reserved attribute: email. */
126
- static setEmail(email: string | null): Promise<void>;
127
- /** Reserved attribute: display name. */
128
- static setDisplayName(displayName: string | null): Promise<void>;
129
- /** Reserved attribute: phone number. */
130
- static setPhoneNumber(phoneNumber: string | null): Promise<void>;
131
- /** Reserved attribute: push token. */
132
- static setPushToken(pushToken: string | null): Promise<void>;
133
- /** Set the native log level. Accepts a LOG_LEVEL enum value. */
134
- static setLogLevel(level: LOG_LEVEL): Promise<void>;
122
+ /**
123
+ * Set arbitrary subscriber attributes. `null` clears an attribute.
124
+ *
125
+ * RC-compatibility alias for `Attributes.set(...)`. Not deprecated.
126
+ */
127
+ static setAttributes: (attributes: Record<string, string | null>) => Promise<void>;
128
+ /** Reserved attribute: email. Alias for `Attributes.setEmail(...)`. */
129
+ static setEmail: (email: string | null) => Promise<void>;
130
+ /** Reserved attribute: display name. Alias for `Attributes.setDisplayName(...)`. */
131
+ static setDisplayName: (displayName: string | null) => Promise<void>;
132
+ /** Reserved attribute: phone number. Alias for `Attributes.setPhoneNumber(...)`. */
133
+ static setPhoneNumber: (phoneNumber: string | null) => Promise<void>;
134
+ /** Reserved attribute: push token. Alias for `Attributes.setPushToken(...)`. */
135
+ static setPushToken: (pushToken: string | null) => Promise<void>;
135
136
  /** Subscribe to CustomerInfo changes (purchase, renewal, dashboard grant). */
136
137
  static addCustomerInfoUpdateListener(listener: CustomerInfoUpdateListener): void;
137
138
  /** Remove a previously-registered CustomerInfo update listener. */
138
139
  static removeCustomerInfoUpdateListener(listener: CustomerInfoUpdateListener): void;
139
- /** @internal Test seam: reset singleton state between tests. */
140
+ /**
141
+ * @internal Test seam: reset singleton state between tests.
142
+ *
143
+ * Also resets `Identity`'s caches, because the RC-parity aliases delegate
144
+ * there: without it, a `Purchases.logIn("u")` in one test would leave
145
+ * `Identity`'s `lastLogIn` primed and the next test's identical call would
146
+ * short-circuit before reaching the (freshly mocked) bridge.
147
+ */
140
148
  static __resetForTests(): void;
141
149
  }
142
150
  export { throwIfNotConfigured as __throwIfNotConfigured, throwIfCoreNotConfigured as __throwIfCoreNotConfigured, };
@@ -1 +1 @@
1
- {"version":3,"file":"purchases.d.ts","sourceRoot":"","sources":["../../../src/purchases.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,sBAAsB,EACtB,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,WAAW,EACX,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AA2CjB;;;;GAIG;AACH,iBAAS,oBAAoB,IAAI,IAAI,CAIpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,iBAAe,wBAAwB,IAAI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0BAA0B,GACnC,IAAI;IAQP;;;;;;;OAOG;IACH,MAAM,CAAC,eAAe,IAAI,IAAI;CAK/B;AAGD,OAAO,EACL,oBAAoB,IAAI,sBAAsB,EAC9C,wBAAwB,IAAI,0BAA0B,GACvD,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,56 @@
1
+ import { configure, configureCore, isConfigured, isCoreConfigured, setLogLevel } from "./internal/config";
2
+ import { Attributes } from "./attributes";
3
+ import { Attribution } from "./attribution";
4
+ import { Identity } from "./identity";
5
+ import { Purchases } from "./purchases";
6
+ import { Analytics } from "./modules/analytics";
7
+ import { CrashReporting } from "./modules/crash-reporting";
8
+ import { Performance } from "./modules/performance";
9
+ /**
10
+ * The shape of {@link SwissKnife}.
11
+ *
12
+ * Written out rather than inferred because `declaration: true` cannot emit an
13
+ * inferred object type whose members reference types their own module does not
14
+ * export (TS4023) — `CrashReporting`'s internals are the case in point. Every
15
+ * member is a `typeof` query on the thing it re-exports, so this stays a
16
+ * restatement of the wiring and can never disagree with it.
17
+ */
18
+ export interface SwissKnifeSDK {
19
+ configure: typeof configure;
20
+ configureCore: typeof configureCore;
21
+ isConfigured: typeof isConfigured;
22
+ isCoreConfigured: typeof isCoreConfigured;
23
+ setLogLevel: typeof setLogLevel;
24
+ Purchases: typeof Purchases;
25
+ Identity: typeof Identity;
26
+ Attributes: typeof Attributes;
27
+ Attribution: typeof Attribution;
28
+ Analytics: typeof Analytics;
29
+ CrashReporting: typeof CrashReporting;
30
+ Performance: typeof Performance;
31
+ /** @internal */
32
+ __resetForTests(): void;
33
+ }
34
+ /**
35
+ * The Swiss Knife SDK root — bootstrap plus a handle on every namespace.
36
+ *
37
+ * ```ts
38
+ * import { SwissKnife } from "@app-swiss-knife/react-native-sdk";
39
+ *
40
+ * // Full SDK, we own the store:
41
+ * SwissKnife.configure({ apiKey: "sk_live_…", proxyURL: "https://…" });
42
+ *
43
+ * // Another library owns in-app purchases:
44
+ * SwissKnife.configureCore({ apiKey: "sk_live_…", proxyURL: "https://…" });
45
+ *
46
+ * await SwissKnife.Identity.logIn("user_42");
47
+ * await SwissKnife.Attributes.setEmail("ann@example.com");
48
+ * ```
49
+ *
50
+ * `Purchases.configure` / `Purchases.configureCore` are RC-compatibility
51
+ * aliases for the first two and remain fully supported — they are the *same
52
+ * functions*, so an app that mixes the spellings shares one bootstrap state.
53
+ */
54
+ export declare const SwissKnife: SwissKnifeSDK;
55
+ export default SwissKnife;
56
+ //# sourceMappingURL=swiss-knife.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swiss-knife.d.ts","sourceRoot":"","sources":["../../../src/swiss-knife.ts"],"names":[],"mappings":"AAsCA,OAAO,EACL,SAAS,EACT,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,aAAa,EAAE,OAAO,aAAa,CAAC;IACpC,YAAY,EAAE,OAAO,YAAY,CAAC;IAClC,gBAAgB,EAAE,OAAO,gBAAgB,CAAC;IAC1C,WAAW,EAAE,OAAO,WAAW,CAAC;IAChC,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,QAAQ,EAAE,OAAO,QAAQ,CAAC;IAC1B,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,WAAW,EAAE,OAAO,WAAW,CAAC;IAChC,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,cAAc,EAAE,OAAO,cAAc,CAAC;IACtC,WAAW,EAAE,OAAO,WAAW,CAAC;IAChC,gBAAgB;IAChB,eAAe,IAAI,IAAI,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,UAAU,EAAE,aAgCxB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -384,6 +384,19 @@ export interface PurchasesConfiguration {
384
384
  entitlementVerificationMode?: string;
385
385
  pendingTransactionsForPrepaidPlansEnabled?: boolean;
386
386
  }
387
+ /**
388
+ * Options accepted by `SwissKnife.configure(...)` / `SwissKnife.configureCore(...)`
389
+ * — and, identically, by their `Purchases.*` RC-compatibility aliases.
390
+ *
391
+ * A name for what the two bootstrap entry points have always taken:
392
+ * `PurchasesConfiguration & { logLevel?: LOG_LEVEL }`. `logLevel` is not part of
393
+ * RevenueCat's `PurchasesConfiguration`, so it cannot go on that interface
394
+ * without breaking the mirror; it is accepted here because setting the log level
395
+ * *after* configure is too late to debug the configure itself.
396
+ */
397
+ export type ConfigureOptions = PurchasesConfiguration & {
398
+ logLevel?: LOG_LEVEL;
399
+ };
387
400
  /**
388
401
  * Callback signature for `Purchases.addCustomerInfoUpdateListener(fn)`. Fires
389
402
  * on every CustomerInfo refresh (post-purchase, post-restore, dashboard-grant
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAmCA;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;CAMZ,CAAC;AACX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAEnE,sEAAsE;AACtE,eAAO,MAAM,YAAY;;;;;;;;;;CAUf,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY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C;IACnC;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;;;;OAQG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,sEAAsE;IACtE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,+CAA+C;IAC/C,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,gFAAgF;IAChF,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,oCAAoC,CAAC,EAAE,OAAO,CAAC;IAC/C,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,yCAAyC,CAAC,EAAE,OAAO,CAAC;CACrD;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,gBAAgB,GAAG,sBAAsB,GAAG;IACtD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAIF;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Set arbitrary subscriber attributes. `null` clears an attribute.
3
+ *
4
+ * Works after `SwissKnife.configure`, `SwissKnife.configureCore`, or
5
+ * `Analytics.init` — the store does not have to be ours, and does not have to
6
+ * exist.
7
+ */
8
+ declare function set(attributes: Record<string, string | null>): Promise<void>;
9
+ /** Reserved attribute: email. `null` clears it. */
10
+ declare function setEmail(email: string | null): Promise<void>;
11
+ /** Reserved attribute: display name. `null` clears it. */
12
+ declare function setDisplayName(displayName: string | null): Promise<void>;
13
+ /** Reserved attribute: phone number. `null` clears it. */
14
+ declare function setPhoneNumber(phoneNumber: string | null): Promise<void>;
15
+ /** Reserved attribute: push token. `null` clears it. */
16
+ declare function setPushToken(pushToken: string | null): Promise<void>;
17
+ /**
18
+ * Subscriber attributes — the data behind the dashboard person card.
19
+ *
20
+ * ```ts
21
+ * import { Attributes } from "@app-swiss-knife/react-native-sdk";
22
+ *
23
+ * await Attributes.setEmail("ann@example.com");
24
+ * await Attributes.setDisplayName("Ann");
25
+ * await Attributes.set({ plan: "gold", cohort: "2026-08" });
26
+ * await Attributes.set({ cohort: null }); // clear
27
+ * ```
28
+ *
29
+ * Every method requires core to be configured and rejects with
30
+ * `UninitializedPurchasesError` otherwise. None of them touch StoreKit or Play
31
+ * Billing.
32
+ */
33
+ export declare const Attributes: {
34
+ set: typeof set;
35
+ setEmail: typeof setEmail;
36
+ setDisplayName: typeof setDisplayName;
37
+ setPhoneNumber: typeof setPhoneNumber;
38
+ setPushToken: typeof setPushToken;
39
+ };
40
+ export {};
41
+ //# sourceMappingURL=attributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../../src/attributes.ts"],"names":[],"mappings":"AAsCA;;;;;;GAMG;AACH,iBAAe,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAG3E;AAED,mDAAmD;AACnD,iBAAe,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAG3D;AAED,0DAA0D;AAC1D,iBAAe,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvE;AAED,0DAA0D;AAC1D,iBAAe,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvE;AAED,wDAAwD;AACxD,iBAAe,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAGnE;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU;;;;;;CAMtB,CAAC"}
@@ -1,6 +1,8 @@
1
1
  import Purchases from "./purchases.js";
2
2
  export default Purchases;
3
3
  export { Purchases };
4
+ export { SwissKnife } from "./swiss-knife.js";
5
+ export { Attributes } from "./attributes.js";
4
6
  export * from "./types.js";
5
7
  export { Identity } from "./identity.js";
6
8
  export type { IdentitySnapshot, IdentityChange } from "./identity.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,gBAAa,CAAC;AAGpC,eAAe,SAAS,CAAC;AAGzB,OAAO,EAAE,SAAS,EAAE,CAAC;AAKrB,cAAc,YAAS,CAAC;AAOxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAY,CAAC;AACtC,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,eAAY,CAAC;AAOnE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAe,CAAC;AAC5C,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAe,CAAC;AAMzD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,wBAAqB,CAAC;AACvE,YAAY,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,wBAAqB,CAAC;AACtE,OAAO,EACL,cAAc,EACd,eAAe,EACf,eAAe,GAChB,MAAM,8BAA2B,CAAC;AACnC,YAAY,EACV,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,WAAW,GACZ,MAAM,8BAA2B,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAAuB,CAAC;AACpD,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,MAAM,EACN,mBAAmB,GACpB,MAAM,0BAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,gBAAa,CAAC;AAGpC,eAAe,SAAS,CAAC;AAGzB,OAAO,EAAE,SAAS,EAAE,CAAC;AAUrB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAe,CAAC;AAM3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAc,CAAC;AAM1C,cAAc,YAAS,CAAC;AAOxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAY,CAAC;AACtC,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,eAAY,CAAC;AAOnE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAe,CAAC;AAC5C,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAe,CAAC;AAMzD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,wBAAqB,CAAC;AACvE,YAAY,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,wBAAqB,CAAC;AACtE,OAAO,EACL,cAAc,EACd,eAAe,EACf,eAAe,GAChB,MAAM,8BAA2B,CAAC;AACnC,YAAY,EACV,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,WAAW,GACZ,MAAM,8BAA2B,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAAuB,CAAC;AACpD,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,MAAM,EACN,mBAAmB,GACpB,MAAM,0BAAuB,CAAC"}
@@ -0,0 +1,121 @@
1
+ import type { LOG_LEVEL, ConfigureOptions } from "../types.js";
2
+ import type { SwissKnifePurchasesNativeModule } from "../native/spec.js";
3
+ /**
4
+ * Read a boolean off the native module without ever letting a missing native
5
+ * module escape as an exception.
6
+ *
7
+ * `getNativeModule()` THROWS when the module is not linked (Expo Go, a bare RN
8
+ * app that skipped `pod install` / a Gradle sync, web) — precisely the state a
9
+ * developer is in while wiring the SDK up, and precisely when they are most
10
+ * likely to be calling one of these accessors to find out what is wrong. A
11
+ * boolean accessor rejecting with "native module is not linked" is a worse
12
+ * answer than `false`: an unlinked module cannot have configured anything, so
13
+ * `false` is not merely safe, it is correct.
14
+ *
15
+ * The `.catch` covers the adjacent case where the module IS linked but predates
16
+ * the method (JS upgraded without rebuilding the app) — same reasoning, same
17
+ * answer. Mirrors the tolerance `Analytics.init` already applies to
18
+ * `configureObservability`.
19
+ */
20
+ export declare function nativeBoolean(read: (native: SwissKnifePurchasesNativeModule) => Promise<boolean>): Promise<boolean>;
21
+ /**
22
+ * Configure the SDK. Must be called before any other method. Calling again
23
+ * with the same API key is a no-op (matches the common "configure once" guard);
24
+ * the native layer owns full reconfiguration.
25
+ */
26
+ export declare function configure(options: ConfigureOptions): void;
27
+ /**
28
+ * Configure everything EXCEPT the store: ingest, `Identity`, `Attribution`,
29
+ * `Attributes`.
30
+ *
31
+ * Use this when another library already owns in-app purchases. `configure`
32
+ * starts a `StoreKit.Transaction.updates` observer on iOS (whose handler
33
+ * calls `transaction.finish()`) and builds a `BillingClient` on Android —
34
+ * both of which contend with an incumbent IAP SDK. `configureCore` creates
35
+ * neither, and registers no install as a side effect.
36
+ *
37
+ * Analytics-only apps don't even need this: `Analytics.init(...)` already
38
+ * wires core natively. Reach for `configureCore` when you want to pass an
39
+ * `appUserID`, an attribution configuration, or a log level up front.
40
+ */
41
+ export declare function configureCore(options: ConfigureOptions): void;
42
+ /**
43
+ * Whether the PURCHASE engine has been configured — i.e. whether the store
44
+ * APIs (`getOfferings`, `purchasePackage`, `restorePurchases`, …) can work.
45
+ *
46
+ * **Native is the source of truth.** This does not consult the JS-side
47
+ * "configure was called" flag: a brownfield app can configure the SDK from
48
+ * native code, and `configure` itself is fire-and-forget, so the JS flag is a
49
+ * request, not a fact.
50
+ *
51
+ * Never throws and never rejects. Resolves `false` when the native module is
52
+ * not linked — see {@link nativeBoolean}. Exactly the same failure semantics
53
+ * as {@link isCoreConfigured}; the two differ only in which native flag they
54
+ * report.
55
+ */
56
+ export declare function isConfigured(): Promise<boolean>;
57
+ /**
58
+ * Whether the CORE (ingest / Identity / Attribution / Attributes) is
59
+ * configured. True after `configure`, `configureCore`, or `Analytics.init`.
60
+ *
61
+ * **Native is the source of truth**, and here that is load-bearing rather
62
+ * than merely principled: `Analytics.init` wires core natively via
63
+ * `configureObservability` and touches no JS configure flag, so an
64
+ * analytics-only app has core configured while every JS flag reads false.
65
+ * Short-circuiting on JS state would report `false` in the single most
66
+ * common core-only integration.
67
+ *
68
+ * Never throws and never rejects. Resolves `false` when the native module is
69
+ * not linked — see {@link nativeBoolean}.
70
+ */
71
+ export declare function isCoreConfigured(): Promise<boolean>;
72
+ /**
73
+ * Set the native log level. Process-wide: it is read by the store engine, the
74
+ * ingest client, Identity, Attribution and the observability modules alike,
75
+ * which is why it belongs on the SDK root and not on any one namespace.
76
+ *
77
+ * Deliberately ungated — a log level you can only raise *after* a successful
78
+ * configure is useless for debugging a configure that is going wrong. It does
79
+ * still require the native module to be linked, and rejects if it is not.
80
+ */
81
+ export declare function setLogLevel(level: LOG_LEVEL): Promise<void>;
82
+ /**
83
+ * Guard for surfaces that genuinely need the PURCHASE engine — `getOfferings`,
84
+ * `purchasePackage`, `restorePurchases` and friends. Checks the JS "configure
85
+ * was called" flag.
86
+ *
87
+ * The RC-parity identity aliases used to sit here too, on the grounds that the
88
+ * legacy native bridge methods they called meant different things on iOS and
89
+ * Android. They now delegate to `Identity` and sit on
90
+ * {@link throwIfCoreNotConfigured} — see the block above `Purchases.logIn`.
91
+ */
92
+ export declare function throwIfNotConfigured(): void;
93
+ /**
94
+ * Guard for surfaces that only need CORE — the `Attributes` setters.
95
+ *
96
+ * Attributes describe the *person*, not the purchase: natively they land in
97
+ * `AttributesClient` → `POST /api/sdk/users/attributes` → `app_users.properties`,
98
+ * which is what the dashboard person card reads. Neither platform's attributes
99
+ * path touches StoreKit or Play Billing — iOS gates on `SwissKnife.isCoreConfigured`
100
+ * (`SwissKnife.currentAnonymousIdForAttributes`), and Android's `configureCore`
101
+ * wires `AttributesClient` with an `Identity`-snapshot id fallback precisely so a
102
+ * store-less app still resolves ids. Gating these on the purchase flag left an app
103
+ * that uses `configureCore` (because another library owns the store) with **no way
104
+ * at all** to populate the person card.
105
+ *
106
+ * Two-step check, and the second step is load-bearing:
107
+ *
108
+ * 1. The JS flag, set by `configure` / `configureCore`. Free, no bridge hop.
109
+ * 2. Native truth. `Analytics.init(...)` wires core natively via
110
+ * `configureObservability` and touches no JS flag, so an analytics-only app
111
+ * has core configured while every JS flag reads `false` — exactly the case
112
+ * {@link isCoreConfigured} documents. Skipping this step would keep the most
113
+ * common core-only integration broken.
114
+ *
115
+ * Never consults the purchase flag. Strictly more permissive than
116
+ * {@link throwIfNotConfigured}, so no existing caller can break.
117
+ */
118
+ export declare function throwIfCoreNotConfigured(): Promise<void>;
119
+ /** @internal Test seam: drop the process-wide configure state. */
120
+ export declare function resetConfigForTests(): void;
121
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/internal/config.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAU,CAAC;AAC5D,OAAO,KAAK,EAEV,+BAA+B,EAChC,MAAM,mBAAgB,CAAC;AAMxB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,CAAC,MAAM,EAAE,+BAA+B,KAAK,OAAO,CAAC,OAAO,CAAC,GAClE,OAAO,CAAC,OAAO,CAAC,CAMlB;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAyBzD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAkB7D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC,CAE/C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAEnD;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAE3D;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAI3C;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC,CAO9D;AAED,kEAAkE;AAClE,wBAAgB,mBAAmB,IAAI,IAAI,CAI1C"}