@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 +1 @@
1
- {"version":3,"names":["getNativeModule","getEventEmitter","CUSTOMER_INFO_UPDATED_EVENT","UninitializedPurchasesError","configured","configuredApiKey","coreConfigured","nativeBoolean","read","Promise","resolve","catch","customerInfoSubscriptions","Map","throwIfNotConfigured","throwIfCoreNotConfigured","native","isCoreConfigured","Purchases","configure","options","apiKey","nativeOptions","appUserID","proxyURL","diagnosticsEnabled","storeKitVersion","useAmazon","autoPromptATT","sendInstallOnFirstLaunch","logLevel","configureCore","isConfigured","getCustomerInfo","getOfferings","purchasePackage","pkg","offeringId","presentedOfferingContext","offeringIdentifier","identifier","purchaseStoreProduct","product","restorePurchases","logIn","logOut","getAppUserID","isAnonymous","setAttributes","attributes","setEmail","email","setDisplayName","displayName","setPhoneNumber","phoneNumber","setPushToken","pushToken","setLogLevel","level","addCustomerInfoUpdateListener","listener","sub","addListener","event","set","removeCustomerInfoUpdateListener","get","remove","delete","__resetForTests","clear","__throwIfNotConfigured","__throwIfCoreNotConfigured"],"sourceRoot":"../../src","sources":["purchases.ts"],"mappings":";;AAAA;AACA,SAASA,eAAe,EAAEC,eAAe,QAAQ,oBAAiB;AAClE,SAASC,2BAA2B,QAAQ,kBAAe;AAC3D,SAASC,2BAA2B,QAAQ,YAAS;AAkBrD,IAAIC,UAAU,GAAG,KAAK;AACtB,IAAIC,gBAA+B,GAAG,IAAI;AAC1C,IAAIC,cAAc,GAAG,KAAK;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,aAAaA,CACpBC,IAAmE,EACjD;EAClB,IAAI;IACF,OAAOC,OAAO,CAACC,OAAO,CAACF,IAAI,CAACR,eAAe,CAAC,CAAC,CAAC,CAAC,CAACW,KAAK,CAAC,MAAM,KAAK,CAAC;EACpE,CAAC,CAAC,MAAM;IACN,OAAOF,OAAO,CAACC,OAAO,CAAC,KAAK,CAAC;EAC/B;AACF;;AAEA;AACA,MAAME,yBAAyB,GAAG,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KH,QAAQ,CAACG,KAAkD,CACxE,CAAC;IACDpD,yBAAyB,CAACqD,GAAG,CAACJ,QAAQ,EAAEC,GAAG,CAAC;EAC9C;;EAEA;EACA,OAAOI,gCAAgCA,CACrCL,QAAoC,EAC9B;IACN,MAAMC,GAAG,GAAGlD,yBAAyB,CAACuD,GAAG,CAACN,QAAQ,CAAC;IACnD,IAAIC,GAAG,EAAE;MACPA,GAAG,CAACM,MAAM,CAAC,CAAC;MACZxD,yBAAyB,CAACyD,MAAM,CAACR,QAAQ,CAAC;IAC5C;EACF;;EAEA;EACA,OAAOS,eAAeA,CAAA,EAAS;IAC7BlE,UAAU,GAAG,KAAK;IAClBE,cAAc,GAAG,KAAK;IACtBD,gBAAgB,GAAG,IAAI;IACvBO,yBAAyB,CAAC2D,KAAK,CAAC,CAAC;EACnC;AACF;;AAEA;AACA,SACEzD,oBAAoB,IAAI0D,sBAAsB,EAC9CzD,wBAAwB,IAAI0D,0BAA0B;AAGxD,eAAevD,SAAS","ignoreList":[]}
1
+ {"version":3,"names":["Attributes","Identity","configure","configureCore","isConfigured","isCoreConfigured","nativeBoolean","setLogLevel","throwIfCoreNotConfigured","throwIfNotConfigured","resetConfigForTests","getNativeModule","getEventEmitter","CUSTOMER_INFO_UPDATED_EVENT","VERIFICATION_RESULT","customerInfoSubscriptions","Map","customerInfoAfterLogOut","native","getCustomerInfo","snapshot","current","emptyCustomerInfo","userId","anonymousId","subjectId","now","Date","entitlements","all","active","verification","NOT_REQUESTED","activeSubscriptions","allPurchasedProductIdentifiers","allPurchaseDates","subscriptionsByProductIdentifier","nonSubscriptionTransactions","firstSeen","toISOString","firstSeenMillis","getTime","originalAppUserId","requestDate","requestDateMillis","latestExpirationDate","latestExpirationDateMillis","originalPurchaseDate","originalPurchaseDateMillis","originalApplicationVersion","managementURL","Purchases","getOfferings","purchasePackage","pkg","offeringId","presentedOfferingContext","offeringIdentifier","identifier","purchaseStoreProduct","product","restorePurchases","logIn","appUserID","logOut","getAppUserID","isAnonymous","setAttributes","set","setEmail","setDisplayName","setPhoneNumber","setPushToken","addCustomerInfoUpdateListener","listener","sub","addListener","event","removeCustomerInfoUpdateListener","get","remove","delete","__resetForTests","clear","__throwIfNotConfigured","__throwIfCoreNotConfigured"],"sourceRoot":"../../src","sources":["purchases.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,UAAU,QAAQ,iBAAc;AACzC,SAASC,QAAQ,QAAQ,eAAY;AACrC,SACEC,SAAS,EACTC,aAAa,EACbC,YAAY,EACZC,gBAAgB,EAChBC,aAAa,EACbC,WAAW,EACXC,wBAAwB,EACxBC,oBAAoB,EACpBC,mBAAmB,QACd,sBAAmB;AAC1B,SAASC,eAAe,EAAEC,eAAe,QAAQ,oBAAiB;AAClE,SAASC,2BAA2B,QAAQ,kBAAe;AAC3D,SAASC,mBAAmB,QAAQ,YAAS;AAY7C;AACA,MAAMC,yBAAyB,GAAG,IAAIC,GAAG,CAGvC,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeC,uBAAuBA,CAAA,EAA0B;EAC9D,IAAI,MAAMX,aAAa,CAAEY,MAAM,IAAKA,MAAM,CAACd,YAAY,CAAC,CAAC,CAAC,EAAE;IAC1D,IAAI;MACF,OAAO,MAAMO,eAAe,CAAC,CAAC,CAACQ,eAAe,CAAC,CAAC;IAClD,CAAC,CAAC,MAAM;MACN;IAAA;EAEJ;EACA,MAAMC,QAAQ,GAAG,MAAMnB,QAAQ,CAACoB,OAAO,CAAC,CAAC;EACzC,OAAOC,iBAAiB,CAACF,QAAQ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C,YAAY,GAAGxE,UAAU,CAACwE,YAAY;;EAE7C;EACA;EACA;EACA;;EAEA;EACA,OAAOC,6BAA6BA,CAClCC,QAAoC,EAC9B;IACN,MAAMC,GAAG,GAAG/D,eAAe,CAAC,CAAC,CAACgE,WAAW,CACvC/D,2BAA2B,EAC1BgE,KAAK,IAAKH,QAAQ,CAACG,KAAkD,CACxE,CAAC;IACD9D,yBAAyB,CAACqD,GAAG,CAACM,QAAQ,EAAEC,GAAG,CAAC;EAC9C;;EAEA;EACA,OAAOG,gCAAgCA,CACrCJ,QAAoC,EAC9B;IACN,MAAMC,GAAG,GAAG5D,yBAAyB,CAACgE,GAAG,CAACL,QAAQ,CAAC;IACnD,IAAIC,GAAG,EAAE;MACPA,GAAG,CAACK,MAAM,CAAC,CAAC;MACZjE,yBAAyB,CAACkE,MAAM,CAACP,QAAQ,CAAC;IAC5C;EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOQ,eAAeA,CAAA,EAAS;IAC7BxE,mBAAmB,CAAC,CAAC;IACrBK,yBAAyB,CAACoE,KAAK,CAAC,CAAC;IACjClF,QAAQ,CAACiF,eAAe,CAAC,CAAC;EAC5B;AACF;;AAEA;AACA,SACEzE,oBAAoB,IAAI2E,sBAAsB,EAC9C5E,wBAAwB,IAAI6E,0BAA0B;AAGxD,eAAelC,SAAS","ignoreList":[]}
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+
3
+ // packages/react-native-sdk/src/swiss-knife.ts
4
+ //
5
+ // The SDK root. Mirror of `SwissKnife` on iOS (`SwissKnifeiOS`, a public final
6
+ // class with `configure` / `configureCore` / `isConfigured` /
7
+ // `isCoreConfigured` / `setLogLevel` statics and `SwissKnife.Identity`,
8
+ // `SwissKnife.Attribution` extensions) and of `com.appswissknife.SwissKnife` on
9
+ // Android.
10
+ //
11
+ // ## Why this exists
12
+ //
13
+ // Until now JS had no root at all. Both bootstraps lived on `Purchases`, which
14
+ // made `Purchases.configureCore()` — a call whose entire meaning is "I do not
15
+ // want the store" — read as a contradiction, and left the SDK running two
16
+ // organising principles at once: a god-object for some concerns, peer
17
+ // namespaces (`Identity`, `Attribution`, `Analytics`, `CrashReporting`,
18
+ // `Performance`) for the rest. The native SDKs never had that problem. This
19
+ // closes the gap in the direction of the two that were already right.
20
+ //
21
+ // ## What belongs here, and what does not
22
+ //
23
+ // Bootstrap and process-wide settings: the two `configure` entry points, the
24
+ // two readback flags, and `setLogLevel`. `setLogLevel` earns its place three
25
+ // ways — it is on the native root on both platforms; it is read by every
26
+ // subsystem (store engine, ingest client, Identity, Attribution, the
27
+ // observability modules), so no single namespace owns it; and it is the one
28
+ // member of the old `Purchases` surface with no configure guard at all, which
29
+ // is the tell that it was never a purchase method.
30
+ //
31
+ // The store surface stays on `Purchases` and is reachable as
32
+ // `SwissKnife.Purchases`. Hoisting `getOfferings` / `purchasePackage` /
33
+ // `restorePurchases` / the CustomerInfo listeners onto the root would recreate
34
+ // the junk drawer at a new address. (iOS does put them on its root; iOS has no
35
+ // RC-compatibility object competing for the name, and we do.)
36
+ //
37
+ // The namespace handles below make the root the one thing you have to know:
38
+ // typing `SwissKnife.` lists the entire SDK. They are the same objects the
39
+ // package exports by name — `SwissKnife.Identity === Identity` — not copies.
40
+
41
+ import { configure, configureCore, isConfigured, isCoreConfigured, setLogLevel } from "./internal/config.js";
42
+ import { Attributes } from "./attributes.js";
43
+ import { Attribution } from "./attribution.js";
44
+ import { Identity } from "./identity.js";
45
+ import { Purchases } from "./purchases.js";
46
+ import { Analytics } from "./modules/analytics.js";
47
+ import { CrashReporting } from "./modules/crash-reporting.js";
48
+ import { Performance } from "./modules/performance.js";
49
+
50
+ /**
51
+ * The shape of {@link SwissKnife}.
52
+ *
53
+ * Written out rather than inferred because `declaration: true` cannot emit an
54
+ * inferred object type whose members reference types their own module does not
55
+ * export (TS4023) — `CrashReporting`'s internals are the case in point. Every
56
+ * member is a `typeof` query on the thing it re-exports, so this stays a
57
+ * restatement of the wiring and can never disagree with it.
58
+ */
59
+
60
+ /**
61
+ * The Swiss Knife SDK root — bootstrap plus a handle on every namespace.
62
+ *
63
+ * ```ts
64
+ * import { SwissKnife } from "@app-swiss-knife/react-native-sdk";
65
+ *
66
+ * // Full SDK, we own the store:
67
+ * SwissKnife.configure({ apiKey: "sk_live_…", proxyURL: "https://…" });
68
+ *
69
+ * // Another library owns in-app purchases:
70
+ * SwissKnife.configureCore({ apiKey: "sk_live_…", proxyURL: "https://…" });
71
+ *
72
+ * await SwissKnife.Identity.logIn("user_42");
73
+ * await SwissKnife.Attributes.setEmail("ann@example.com");
74
+ * ```
75
+ *
76
+ * `Purchases.configure` / `Purchases.configureCore` are RC-compatibility
77
+ * aliases for the first two and remain fully supported — they are the *same
78
+ * functions*, so an app that mixes the spellings shares one bootstrap state.
79
+ */
80
+ export const SwissKnife = {
81
+ // MARK: - Bootstrap
82
+ configure,
83
+ configureCore,
84
+ isConfigured,
85
+ isCoreConfigured,
86
+ setLogLevel,
87
+ // MARK: - Namespaces
88
+ /** In-app purchases + the RevenueCat-compatible surface. */
89
+ Purchases,
90
+ /** Who this device is. `logIn` / `logOut` / `current` / `reset` / `wipe`. */
91
+ Identity,
92
+ /** Subscriber attributes — the dashboard person card. */
93
+ Attributes,
94
+ /** Install attribution: ATT / IDFA / advertising id / install referrer. */
95
+ Attribution,
96
+ /** Product analytics: `init` / `track` / `identify` / `screen`. */
97
+ Analytics,
98
+ /** Crash + error reporting. */
99
+ CrashReporting,
100
+ /** Performance transactions and spans. */
101
+ Performance,
102
+ /**
103
+ * @internal Test seam: reset the process-wide configure state and `Identity`'s
104
+ * caches. Identical to `Purchases.__resetForTests()` — it is the same call, so
105
+ * a suite written against either namespace resets the same singletons.
106
+ */
107
+ __resetForTests() {
108
+ Purchases.__resetForTests();
109
+ }
110
+ };
111
+ export default SwissKnife;
112
+ //# sourceMappingURL=swiss-knife.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["configure","configureCore","isConfigured","isCoreConfigured","setLogLevel","Attributes","Attribution","Identity","Purchases","Analytics","CrashReporting","Performance","SwissKnife","__resetForTests"],"sourceRoot":"../../src","sources":["swiss-knife.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,SAAS,EACTC,aAAa,EACbC,YAAY,EACZC,gBAAgB,EAChBC,WAAW,QACN,sBAAmB;AAC1B,SAASC,UAAU,QAAQ,iBAAc;AACzC,SAASC,WAAW,QAAQ,kBAAe;AAC3C,SAASC,QAAQ,QAAQ,eAAY;AACrC,SAASC,SAAS,QAAQ,gBAAa;AACvC,SAASC,SAAS,QAAQ,wBAAqB;AAC/C,SAASC,cAAc,QAAQ,8BAA2B;AAC1D,SAASC,WAAW,QAAQ,0BAAuB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAyB,GAAG;EACvC;EACAZ,SAAS;EACTC,aAAa;EACbC,YAAY;EACZC,gBAAgB;EAChBC,WAAW;EAEX;EACA;EACAI,SAAS;EACT;EACAD,QAAQ;EACR;EACAF,UAAU;EACV;EACAC,WAAW;EACX;EACAG,SAAS;EACT;EACAC,cAAc;EACd;EACAC,WAAW;EAEX;AACF;AACA;AACA;AACA;EACEE,eAAeA,CAAA,EAAS;IACtBL,SAAS,CAACK,eAAe,CAAC,CAAC;EAC7B;AACF,CAAC;AAED,eAAeD,UAAU","ignoreList":[]}
@@ -220,6 +220,17 @@ export class UnsupportedPlatformError extends Error {
220
220
 
221
221
  /** Options accepted by `Purchases.configure(...)`. Mirror of `PurchasesConfiguration`. */
222
222
 
223
+ /**
224
+ * Options accepted by `SwissKnife.configure(...)` / `SwissKnife.configureCore(...)`
225
+ * — and, identically, by their `Purchases.*` RC-compatibility aliases.
226
+ *
227
+ * A name for what the two bootstrap entry points have always taken:
228
+ * `PurchasesConfiguration & { logLevel?: LOG_LEVEL }`. `logLevel` is not part of
229
+ * RevenueCat's `PurchasesConfiguration`, so it cannot go on that interface
230
+ * without breaking the mirror; it is accepted here because setting the log level
231
+ * *after* configure is too late to debug the configure itself.
232
+ */
233
+
223
234
  // MARK: - Event listeners
224
235
 
225
236
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["LOG_LEVEL","VERBOSE","DEBUG","INFO","WARN","ERROR","PACKAGE_TYPE","UNKNOWN","CUSTOM","LIFETIME","ANNUAL","SIX_MONTH","THREE_MONTH","TWO_MONTH","MONTHLY","WEEKLY","STOREKIT_VERSION","DEFAULT","STOREKIT_1","STOREKIT_2","VERIFICATION_RESULT","NOT_REQUESTED","VERIFIED","FAILED","VERIFIED_ON_DEVICE","PURCHASES_ERROR_CODE","UNKNOWN_ERROR","PURCHASE_CANCELLED_ERROR","STORE_PROBLEM_ERROR","PURCHASE_NOT_ALLOWED_ERROR","PURCHASE_INVALID_ERROR","PRODUCT_NOT_AVAILABLE_FOR_PURCHASE_ERROR","PRODUCT_ALREADY_PURCHASED_ERROR","RECEIPT_ALREADY_IN_USE_ERROR","INVALID_RECEIPT_ERROR","MISSING_RECEIPT_FILE_ERROR","NETWORK_ERROR","INVALID_CREDENTIALS_ERROR","UNEXPECTED_BACKEND_RESPONSE_ERROR","RECEIPT_IN_USE_BY_OTHER_SUBSCRIBER_ERROR","INVALID_APP_USER_ID_ERROR","OPERATION_ALREADY_IN_PROGRESS_ERROR","UNKNOWN_BACKEND_ERROR","INVALID_APPLE_SUBSCRIPTION_KEY_ERROR","INELIGIBLE_ERROR","INSUFFICIENT_PERMISSIONS_ERROR","PAYMENT_PENDING_ERROR","INVALID_SUBSCRIBER_ATTRIBUTES_ERROR","LOG_OUT_ANONYMOUS_USER_ERROR","CONFIGURATION_ERROR","UNSUPPORTED_ERROR","EMPTY_SUBSCRIBER_ATTRIBUTES_ERROR","CUSTOMER_INFO_ERROR","UninitializedPurchasesError","Error","constructor","message","name","UnsupportedPlatformError"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,GAAG;EACvBC,OAAO,EAAE,SAAS;EAClBC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,KAAK,EAAE;AACT,CAAU;AAGV;AACA,OAAO,MAAMC,YAAY,GAAG;EAC1BC,OAAO,EAAE,SAAS;EAClBC,MAAM,EAAE,QAAQ;EAChBC,QAAQ,EAAE,UAAU;EACpBC,MAAM,EAAE,QAAQ;EAChBC,SAAS,EAAE,WAAW;EACtBC,WAAW,EAAE,aAAa;EAC1BC,SAAS,EAAE,WAAW;EACtBC,OAAO,EAAE,SAAS;EAClBC,MAAM,EAAE;AACV,CAAU;AAGV;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAG;EAC9BC,OAAO,EAAE,SAAS;EAClBC,UAAU,EAAE,YAAY;EACxBC,UAAU,EAAE;AACd,CAAU;AAGV;AACA,OAAO,MAAMC,mBAAmB,GAAG;EACjCC,aAAa,EAAE,eAAe;EAC9BC,QAAQ,EAAE,UAAU;EACpBC,MAAM,EAAE,QAAQ;EAChBC,kBAAkB,EAAE;AACtB,CAAU;AAGV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,GAAG;EAClCC,aAAa,EAAE,GAAG;EAClBC,wBAAwB,EAAE,GA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AA0BA;;AAEA;;AAUA;;AAMA;;AAWA;;AA6BA;AACA;AACA;AACA;;AAOA;;AAUA;;AAiBA;;AAMA;;AAEA;;AAOA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;;AAMA;;AAEA;AACA;AACA;AACA;AACA;;AAUA;;AAOA;;AAEA;;AAyCA;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"names":["LOG_LEVEL","VERBOSE","DEBUG","INFO","WARN","ERROR","PACKAGE_TYPE","UNKNOWN","CUSTOM","LIFETIME","ANNUAL","SIX_MONTH","THREE_MONTH","TWO_MONTH","MONTHLY","WEEKLY","STOREKIT_VERSION","DEFAULT","STOREKIT_1","STOREKIT_2","VERIFICATION_RESULT","NOT_REQUESTED","VERIFIED","FAILED","VERIFIED_ON_DEVICE","PURCHASES_ERROR_CODE","UNKNOWN_ERROR","PURCHASE_CANCELLED_ERROR","STORE_PROBLEM_ERROR","PURCHASE_NOT_ALLOWED_ERROR","PURCHASE_INVALID_ERROR","PRODUCT_NOT_AVAILABLE_FOR_PURCHASE_ERROR","PRODUCT_ALREADY_PURCHASED_ERROR","RECEIPT_ALREADY_IN_USE_ERROR","INVALID_RECEIPT_ERROR","MISSING_RECEIPT_FILE_ERROR","NETWORK_ERROR","INVALID_CREDENTIALS_ERROR","UNEXPECTED_BACKEND_RESPONSE_ERROR","RECEIPT_IN_USE_BY_OTHER_SUBSCRIBER_ERROR","INVALID_APP_USER_ID_ERROR","OPERATION_ALREADY_IN_PROGRESS_ERROR","UNKNOWN_BACKEND_ERROR","INVALID_APPLE_SUBSCRIPTION_KEY_ERROR","INELIGIBLE_ERROR","INSUFFICIENT_PERMISSIONS_ERROR","PAYMENT_PENDING_ERROR","INVALID_SUBSCRIBER_ATTRIBUTES_ERROR","LOG_OUT_ANONYMOUS_USER_ERROR","CONFIGURATION_ERROR","UNSUPPORTED_ERROR","EMPTY_SUBSCRIBER_ATTRIBUTES_ERROR","CUSTOMER_INFO_ERROR","UninitializedPurchasesError","Error","constructor","message","name","UnsupportedPlatformError"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,GAAG;EACvBC,OAAO,EAAE,SAAS;EAClBC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,KAAK,EAAE;AACT,CAAU;AAGV;AACA,OAAO,MAAMC,YAAY,GAAG;EAC1BC,OAAO,EAAE,SAAS;EAClBC,MAAM,EAAE,QAAQ;EAChBC,QAAQ,EAAE,UAAU;EACpBC,MAAM,EAAE,QAAQ;EAChBC,SAAS,EAAE,WAAW;EACtBC,WAAW,EAAE,aAAa;EAC1BC,SAAS,EAAE,WAAW;EACtBC,OAAO,EAAE,SAAS;EAClBC,MAAM,EAAE;AACV,CAAU;AAGV;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAG;EAC9BC,OAAO,EAAE,SAAS;EAClBC,UAAU,EAAE,YAAY;EACxBC,UAAU,EAAE;AACd,CAAU;AAGV;AACA,OAAO,MAAMC,mBAAmB,GAAG;EACjCC,aAAa,EAAE,eAAe;EAC9BC,QAAQ,EAAE,UAAU;EACpBC,MAAM,EAAE,QAAQ;EAChBC,kBAAkB,EAAE;AACtB,CAAU;AAGV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,GAAG;EAClCC,aAAa,EAAE,GAAG;EAClBC,wBAAwB,EAAE,GAAG;EAC7BC,mBAAmB,EAAE,GAAG;EACxBC,0BAA0B,EAAE,GAAG;EAC/BC,sBAAsB,EAAE,GAAG;EAC3BC,wCAAw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;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;;AAMA;;AAEA;AACA;AACA;AACA;AACA;;AAUA;;AAOA;;AAEA;;AAyCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -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";
2
2
  export default Purchases;
3
3
  export { Purchases };
4
+ export { SwissKnife } from "./swiss-knife";
5
+ export { Attributes } from "./attributes";
4
6
  export * from "./types";
5
7
  export { Identity } from "./identity";
6
8
  export type { IdentitySnapshot, IdentityChange } from "./identity";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,aAAa,CAAC;AAGpC,eAAe,SAAS,CAAC;AAGzB,OAAO,EAAE,SAAS,EAAE,CAAC;AAKrB,cAAc,SAAS,CAAC;AAOxB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAOnE,OAAO,EAA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2B,CAAC;AACnC,YAAY,EACV,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,WAAW,GACZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,MAAM,EACN,mBAAmB,GACpB,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,121 @@
1
+ import type { LOG_LEVEL, ConfigureOptions } from "../types";
2
+ import type { SwissKnifePurchasesNativeModule } from "../native/spec";
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,UAAU,CAAC;AAC5D,OAAO,KAAK,EAEV,+BAA+B,EAChC,MAAM,gBAAgB,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"}