@app-swiss-knife/react-native-sdk 0.2.1 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/swissknife/crashreporting/SKCrashReportingModule.kt +9 -3
- package/android/vendor/java/com/appswissknife/context/DeviceContext.kt +1 -1
- package/android/vendor/java/com/appswissknife/net/IngestClient.kt +1 -1
- package/android/vendor/java/com/appswissknife/purchases/BillingClientGateway.kt +106 -16
- package/ios/SwissKnifeCrashReporting.swift +19 -3
- package/ios/vendor/SwissKnifeiOS/Context/DeviceContext.swift +1 -1
- package/ios/vendor/SwissKnifeiOS/CrashReporting/SKCrashReporting.swift +153 -6
- package/lib/commonjs/modules/crash-reporting.js +199 -15
- package/lib/commonjs/modules/crash-reporting.js.map +1 -1
- package/lib/commonjs/purchases.js +60 -6
- package/lib/commonjs/purchases.js.map +1 -1
- package/lib/module/modules/crash-reporting.js +199 -15
- package/lib/module/modules/crash-reporting.js.map +1 -1
- package/lib/module/purchases.js +60 -7
- package/lib/module/purchases.js.map +1 -1
- package/lib/typescript/commonjs/modules/crash-reporting.d.ts +89 -0
- package/lib/typescript/commonjs/modules/crash-reporting.d.ts.map +1 -1
- package/lib/typescript/commonjs/purchases.d.ts +32 -1
- package/lib/typescript/commonjs/purchases.d.ts.map +1 -1
- package/lib/typescript/module/modules/crash-reporting.d.ts +89 -0
- package/lib/typescript/module/modules/crash-reporting.d.ts.map +1 -1
- package/lib/typescript/module/purchases.d.ts +32 -1
- package/lib/typescript/module/purchases.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/modules/crash-reporting.ts +297 -25
- package/src/purchases.ts +65 -7
package/lib/module/purchases.js
CHANGED
|
@@ -35,12 +35,49 @@ function nativeBoolean(read) {
|
|
|
35
35
|
|
|
36
36
|
// Maps a caller's listener fn to its native subscription so we can remove it.
|
|
37
37
|
const customerInfoSubscriptions = new Map();
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Guard for surfaces that genuinely need the PURCHASE engine — the store APIs
|
|
41
|
+
* and the RC-parity identity aliases that route through the store gateway on
|
|
42
|
+
* Android. Checks the JS "configure was called" flag.
|
|
43
|
+
*/
|
|
38
44
|
function throwIfNotConfigured() {
|
|
39
45
|
if (!configured) {
|
|
40
46
|
throw new UninitializedPurchasesError();
|
|
41
47
|
}
|
|
42
48
|
}
|
|
43
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Guard for surfaces that only need CORE — the subscriber-attribute setters.
|
|
52
|
+
*
|
|
53
|
+
* Attributes describe the *person*, not the purchase: natively they land in
|
|
54
|
+
* `AttributesClient` → `POST /api/sdk/users/attributes` → `app_users.properties`,
|
|
55
|
+
* which is what the dashboard person card reads. Neither platform's attributes
|
|
56
|
+
* path touches StoreKit or Play Billing — iOS gates on `SwissKnife.isCoreConfigured`
|
|
57
|
+
* (`SwissKnife.currentAnonymousIdForAttributes`), and Android's `configureCore`
|
|
58
|
+
* wires `AttributesClient` with an `Identity`-snapshot id fallback precisely so a
|
|
59
|
+
* store-less app still resolves ids. Gating these on the purchase flag left an app
|
|
60
|
+
* that uses `configureCore` (because another library owns the store) with **no way
|
|
61
|
+
* at all** to populate the person card.
|
|
62
|
+
*
|
|
63
|
+
* Two-step check, and the second step is load-bearing:
|
|
64
|
+
*
|
|
65
|
+
* 1. The JS flag, set by `configure` / `configureCore`. Free, no bridge hop.
|
|
66
|
+
* 2. Native truth. `Analytics.init(...)` wires core natively via
|
|
67
|
+
* `configureObservability` and touches no JS flag, so an analytics-only app
|
|
68
|
+
* has core configured while every JS flag reads `false` — exactly the case
|
|
69
|
+
* {@link isCoreConfigured} documents. Skipping this step would keep the most
|
|
70
|
+
* common core-only integration broken.
|
|
71
|
+
*
|
|
72
|
+
* Never consults the purchase flag. Strictly more permissive than
|
|
73
|
+
* {@link throwIfNotConfigured}, so no existing caller can break.
|
|
74
|
+
*/
|
|
75
|
+
async function throwIfCoreNotConfigured() {
|
|
76
|
+
if (coreConfigured) return;
|
|
77
|
+
if (await nativeBoolean(native => native.isCoreConfigured())) return;
|
|
78
|
+
throw new UninitializedPurchasesError("Purchases core is not configured. Call Purchases.configure(), " + "Purchases.configureCore(), or Analytics.init() first.");
|
|
79
|
+
}
|
|
80
|
+
|
|
44
81
|
/**
|
|
45
82
|
* RC-compatible subscriptions SDK entry point. Process-wide singleton; call
|
|
46
83
|
* `Purchases.configure(...)` once at app start, then use the static methods.
|
|
@@ -179,6 +216,18 @@ export class Purchases {
|
|
|
179
216
|
return getNativeModule().restorePurchases();
|
|
180
217
|
}
|
|
181
218
|
|
|
219
|
+
// The four RC-parity identity aliases below stay on the PURCHASE guard on
|
|
220
|
+
// purpose, even though identity is a core concern natively. The two platforms
|
|
221
|
+
// disagree about what this specific surface does: the iOS bridge's `logIn`
|
|
222
|
+
// reaches `SwissKnife.logIn` → `Identity.logIn`, which is core-gated and POSTs
|
|
223
|
+
// `/api/sdk/users/identify`; the Android bridge's `logIn` reaches
|
|
224
|
+
// `SwissKnife.logIn` → the purchases `gateway`, which only rebinds the local
|
|
225
|
+
// user id and refreshes entitlements. Loosening the guard here would let a
|
|
226
|
+
// core-only app call a method that means different things per platform and
|
|
227
|
+
// silently skips the identify POST on Android. `Identity.logIn` / `logOut` /
|
|
228
|
+
// `current` are the core-safe surface — they route to the unified native
|
|
229
|
+
// Identity on both platforms and carry no configure guard in JS at all.
|
|
230
|
+
|
|
182
231
|
/**
|
|
183
232
|
* Identify the user. Aliases/merges anonymous purchases server-side.
|
|
184
233
|
*
|
|
@@ -214,33 +263,37 @@ export class Purchases {
|
|
|
214
263
|
return getNativeModule().isAnonymous();
|
|
215
264
|
}
|
|
216
265
|
|
|
266
|
+
// Subscriber attributes. CORE, not store — see {@link throwIfCoreNotConfigured}.
|
|
267
|
+
// These work in an app that only called `configureCore` (another library owns
|
|
268
|
+
// the store) or only `Analytics.init`.
|
|
269
|
+
|
|
217
270
|
/** Set arbitrary subscriber attributes. null clears an attribute. */
|
|
218
271
|
static async setAttributes(attributes) {
|
|
219
|
-
|
|
272
|
+
await throwIfCoreNotConfigured();
|
|
220
273
|
return getNativeModule().setAttributes(attributes);
|
|
221
274
|
}
|
|
222
275
|
|
|
223
276
|
/** Reserved attribute: email. */
|
|
224
277
|
static async setEmail(email) {
|
|
225
|
-
|
|
278
|
+
await throwIfCoreNotConfigured();
|
|
226
279
|
return getNativeModule().setEmail(email);
|
|
227
280
|
}
|
|
228
281
|
|
|
229
282
|
/** Reserved attribute: display name. */
|
|
230
283
|
static async setDisplayName(displayName) {
|
|
231
|
-
|
|
284
|
+
await throwIfCoreNotConfigured();
|
|
232
285
|
return getNativeModule().setDisplayName(displayName);
|
|
233
286
|
}
|
|
234
287
|
|
|
235
288
|
/** Reserved attribute: phone number. */
|
|
236
289
|
static async setPhoneNumber(phoneNumber) {
|
|
237
|
-
|
|
290
|
+
await throwIfCoreNotConfigured();
|
|
238
291
|
return getNativeModule().setPhoneNumber(phoneNumber);
|
|
239
292
|
}
|
|
240
293
|
|
|
241
294
|
/** Reserved attribute: push token. */
|
|
242
295
|
static async setPushToken(pushToken) {
|
|
243
|
-
|
|
296
|
+
await throwIfCoreNotConfigured();
|
|
244
297
|
return getNativeModule().setPushToken(pushToken);
|
|
245
298
|
}
|
|
246
299
|
|
|
@@ -273,7 +326,7 @@ export class Purchases {
|
|
|
273
326
|
}
|
|
274
327
|
}
|
|
275
328
|
|
|
276
|
-
// Internal
|
|
277
|
-
export { throwIfNotConfigured as __throwIfNotConfigured };
|
|
329
|
+
// Internal helpers shared with the rest of the class (defined across SP-2a tasks).
|
|
330
|
+
export { throwIfNotConfigured as __throwIfNotConfigured, throwIfCoreNotConfigured as __throwIfCoreNotConfigured };
|
|
278
331
|
export default Purchases;
|
|
279
332
|
//# sourceMappingURL=purchases.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getNativeModule","getEventEmitter","CUSTOMER_INFO_UPDATED_EVENT","UninitializedPurchasesError","configured","configuredApiKey","coreConfigured","nativeBoolean","read","Promise","resolve","catch","customerInfoSubscriptions","Map","throwIfNotConfigured","Purchases","configure","options","apiKey","
|
|
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,OA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C,GAAG,GAAG7D,eAAe,CAAC,CAAC,CAAC8D,WAAW,CACvC7D,2BAA2B,EAC1B8D,KAAK,IAAKH,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,4 +1,36 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Optional native module for crash reporting. If the host app has linked
|
|
4
|
+
* the SwissKnife iOS/Android native crash SDKs, this module delegates
|
|
5
|
+
* init/setUser/addBreadcrumb to the native layer — catching Mach exceptions,
|
|
6
|
+
* signal crashes (iOS), and NDK native crashes (Android) that JS can't see.
|
|
7
|
+
*/
|
|
8
|
+
interface SKCrashReportingNative {
|
|
9
|
+
start(config: {
|
|
10
|
+
apiKey: string;
|
|
11
|
+
serverURL: string;
|
|
12
|
+
ingestURL?: string;
|
|
13
|
+
environment: string;
|
|
14
|
+
release: string;
|
|
15
|
+
}): void;
|
|
16
|
+
setUser(user: {
|
|
17
|
+
id?: string;
|
|
18
|
+
email?: string;
|
|
19
|
+
username?: string;
|
|
20
|
+
} | null): void;
|
|
21
|
+
addBreadcrumb(breadcrumb: {
|
|
22
|
+
category?: string;
|
|
23
|
+
message?: string;
|
|
24
|
+
level?: string;
|
|
25
|
+
}): void;
|
|
26
|
+
setTag(key: string, value: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Wave-2 C1: capture a masked screenshot of the current window. Returns
|
|
29
|
+
* base64 JPEG (no `data:` prefix) or null. Optional — older native SDKs
|
|
30
|
+
* don't implement it, so every call site must feature-detect.
|
|
31
|
+
*/
|
|
32
|
+
captureScreenshot?(): Promise<string | null>;
|
|
33
|
+
}
|
|
2
34
|
export interface CrashReportingConfig {
|
|
3
35
|
apiKey: string;
|
|
4
36
|
serverURL?: string;
|
|
@@ -9,6 +41,54 @@ export interface CrashReportingConfig {
|
|
|
9
41
|
dist?: string;
|
|
10
42
|
maxBreadcrumbs?: number;
|
|
11
43
|
enableAutoBreadcrumbs?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Take over `ErrorUtils`' global JS error handler. Default **true**.
|
|
46
|
+
*
|
|
47
|
+
* We chain — the handler that was installed before us is still invoked —
|
|
48
|
+
* so leaving this on is safe alongside another reporter. Set false if the
|
|
49
|
+
* host wants Swiss Knife's manual APIs (`captureException`, breadcrumbs,
|
|
50
|
+
* sessions) without us touching the global slot at all.
|
|
51
|
+
*/
|
|
52
|
+
enableGlobalErrorHandler?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Track unhandled promise rejections. Default **true**.
|
|
55
|
+
*
|
|
56
|
+
* ⚠️ Unlike every other handler in this SDK, this one CANNOT be chained
|
|
57
|
+
* reliably. Both engines expose a single-slot switch with no getter:
|
|
58
|
+
* Hermes' `HermesInternal.enablePromiseRejectionTracker(options)` and JSC's
|
|
59
|
+
* `promise/setimmediate/rejection-tracking`.`enable(options)` each replace
|
|
60
|
+
* whatever was registered, and neither offers a way to read the incumbent
|
|
61
|
+
* back out. Sentry React Native calls exactly the same APIs.
|
|
62
|
+
*
|
|
63
|
+
* What we do about it:
|
|
64
|
+
* - We install a composing wrapper over the engine's `enable` entry point,
|
|
65
|
+
* so a reporter that initialises AFTER us is merged with us instead of
|
|
66
|
+
* replacing us. Both handlers then run.
|
|
67
|
+
* - The reverse order is unfixable. If another reporter installed BEFORE
|
|
68
|
+
* Swiss Knife and did not itself chain, its handler is unreachable and
|
|
69
|
+
* ours replaces it. Either initialise Swiss Knife first, or set this to
|
|
70
|
+
* false — the rest of the SDK (manual captures, breadcrumbs, sessions,
|
|
71
|
+
* the global error handler, native crashes) is unaffected either way.
|
|
72
|
+
*/
|
|
73
|
+
enablePromiseRejectionTracking?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Subscribe to `AppState` to open/close crash-reporting sessions on
|
|
76
|
+
* foreground/background. Default **true**. Purely additive (RN's AppState
|
|
77
|
+
* is a multi-listener emitter — no slot to fight over); the opt-out exists
|
|
78
|
+
* for hosts that drive session boundaries themselves.
|
|
79
|
+
*/
|
|
80
|
+
enableAppStateTracking?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Start the NATIVE crash handler (iOS Mach/signal + NSException, Android
|
|
83
|
+
* NDK + system ANR) via the native module. Default **true**.
|
|
84
|
+
*
|
|
85
|
+
* Our native handlers chain (they capture and re-invoke the previous
|
|
86
|
+
* `NSSetUncaughtExceptionHandler` / `signal()` / Java
|
|
87
|
+
* `UncaughtExceptionHandler`), so coexisting with Sentry or Crashlytics is
|
|
88
|
+
* supported. Set false if the host's incumbent owns native crash reporting
|
|
89
|
+
* outright and you only want Swiss Knife's JS-level features.
|
|
90
|
+
*/
|
|
91
|
+
enableNativeCrashHandler?: boolean;
|
|
12
92
|
/** Called before sending each event. Return null to drop the event. */
|
|
13
93
|
beforeSend?: (event: SKCrashEvent) => SKCrashEvent | null;
|
|
14
94
|
/**
|
|
@@ -155,6 +235,15 @@ export declare const CrashReporting: {
|
|
|
155
235
|
}>;
|
|
156
236
|
_pendingScreenshotCountForTests(): number;
|
|
157
237
|
_simulateAppState(nextState: string): void;
|
|
238
|
+
/** Test seam: stand in for `NativeModules.SKCrashReporting`.
|
|
239
|
+
* `null` = native absent; `undefined` = resolve from react-native. */
|
|
240
|
+
_setNativeCrashModuleForTests(mod: SKCrashReportingNative | null | undefined): void;
|
|
241
|
+
/** Test seam: stand in for react-native's `AppState`. */
|
|
242
|
+
_setAppStateForTests(appState: {
|
|
243
|
+
addEventListener: (e: string, h: (s: string) => void) => {
|
|
244
|
+
remove: () => void;
|
|
245
|
+
};
|
|
246
|
+
} | null | undefined): void;
|
|
158
247
|
};
|
|
159
248
|
export interface SKErrorBoundaryProps {
|
|
160
249
|
children: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crash-reporting.d.ts","sourceRoot":"","sources":["../../../../src/modules/crash-reporting.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"crash-reporting.d.ts","sourceRoot":"","sources":["../../../../src/modules/crash-reporting.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B;;;;;GAKG;AACH,UAAU,sBAAsB;IAC9B,KAAK,CAAC,MAAM,EAAE;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC;KACjB,GAAG,IAAI,CAAC;IACT,OAAO,CAAC,IAAI,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,GAAG,IAAI,CAAC;IAC/E,aAAa,CAAC,UAAU,EAAE;QACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,C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ACT,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,KACnB;YAAE,MAAM,EAAE,MAAM,IAAI,CAAA;SAAE,CAAC;KAC7B,GACD,IAAI,GACJ,SAAS,GACZ,IAAI;CAGR,CAAC;AAIF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC;CACzD;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAED,qBAAa,eAAgB,SAAQ,KAAK,CAAC,SAAS,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;gBAClF,KAAK,EAAE,oBAAoB;IAKvC,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,oBAAoB;IAInE,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI;IAa5D,MAAM,IAAI,KAAK,CAAC,SAAS;CAM1B"}
|
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
import type { PurchasesConfiguration, LOG_LEVEL, CustomerInfo, PurchasesOfferings, PurchasesPackage, PurchasesStoreProduct, MakePurchaseResult, LogInResult, CustomerInfoUpdateListener } from "./types";
|
|
2
|
+
/**
|
|
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
|
+
*/
|
|
2
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:
|
|
22
|
+
*
|
|
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>;
|
|
3
34
|
/**
|
|
4
35
|
* RC-compatible subscriptions SDK entry point. Process-wide singleton; call
|
|
5
36
|
* `Purchases.configure(...)` once at app start, then use the static methods.
|
|
@@ -108,6 +139,6 @@ export declare class Purchases {
|
|
|
108
139
|
/** @internal Test seam: reset singleton state between tests. */
|
|
109
140
|
static __resetForTests(): void;
|
|
110
141
|
}
|
|
111
|
-
export { throwIfNotConfigured as __throwIfNotConfigured };
|
|
142
|
+
export { throwIfNotConfigured as __throwIfNotConfigured, throwIfCoreNotConfigured as __throwIfCoreNotConfigured, };
|
|
112
143
|
export default Purchases;
|
|
113
144
|
//# sourceMappingURL=purchases.d.ts.map
|
|
@@ -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,iBAAS,oBAAoB,IAAI,IAAI,CAIpC;AAED;;;GAGG;AACH,qBAAa,SAAS;IACpB;;;;OAIG;IACH,MAAM,CAAC,SAAS,CACd,OAAO,EAAE,sBAAsB,GAAG;QAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;KAAE,GACzD,IAAI;IA2BP;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,aAAa,CAClB,OAAO,EAAE,sBAAsB,GAAG;QAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;KAAE,GACzD,IAAI;IAoBP;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC;IAIvC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;IAI3C,gFAAgF;WACnE,eAAe,IAAI,OAAO,CAAC,YAAY,CAAC;IAKrD,uDAAuD;WAC1C,YAAY,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAKxD,kFAAkF;WACrE,eAAe,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAMhF,0DAA0D;WAC7C,oBAAoB,CAC/B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,kBAAkB,CAAC;IAK9B,8DAA8D;WACjD,gBAAgB,IAAI,OAAO,CAAC,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"purchases.d.ts","sourceRoot":"","s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iOS/Android native crash SDKs, this module delegates
|
|
5
|
+
* init/setUser/addBreadcrumb to the native layer — catching Mach exceptions,
|
|
6
|
+
* signal crashes (iOS), and NDK native crashes (Android) that JS can't see.
|
|
7
|
+
*/
|
|
8
|
+
interface SKCrashReportingNative {
|
|
9
|
+
start(config: {
|
|
10
|
+
apiKey: string;
|
|
11
|
+
serverURL: string;
|
|
12
|
+
ingestURL?: string;
|
|
13
|
+
environment: string;
|
|
14
|
+
release: string;
|
|
15
|
+
}): void;
|
|
16
|
+
setUser(user: {
|
|
17
|
+
id?: string;
|
|
18
|
+
email?: string;
|
|
19
|
+
username?: string;
|
|
20
|
+
} | null): void;
|
|
21
|
+
addBreadcrumb(breadcrumb: {
|
|
22
|
+
category?: string;
|
|
23
|
+
message?: string;
|
|
24
|
+
level?: string;
|
|
25
|
+
}): void;
|
|
26
|
+
setTag(key: string, value: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Wave-2 C1: capture a masked screenshot of the current window. Returns
|
|
29
|
+
* base64 JPEG (no `data:` prefix) or null. Optional — older native SDKs
|
|
30
|
+
* don't implement it, so every call site must feature-detect.
|
|
31
|
+
*/
|
|
32
|
+
captureScreenshot?(): Promise<string | null>;
|
|
33
|
+
}
|
|
2
34
|
export interface CrashReportingConfig {
|
|
3
35
|
apiKey: string;
|
|
4
36
|
serverURL?: string;
|
|
@@ -9,6 +41,54 @@ export interface CrashReportingConfig {
|
|
|
9
41
|
dist?: string;
|
|
10
42
|
maxBreadcrumbs?: number;
|
|
11
43
|
enableAutoBreadcrumbs?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Take over `ErrorUtils`' global JS error handler. Default **true**.
|
|
46
|
+
*
|
|
47
|
+
* We chain — the handler that was installed before us is still invoked —
|
|
48
|
+
* so leaving this on is safe alongside another reporter. Set false if the
|
|
49
|
+
* host wants Swiss Knife's manual APIs (`captureException`, breadcrumbs,
|
|
50
|
+
* sessions) without us touching the global slot at all.
|
|
51
|
+
*/
|
|
52
|
+
enableGlobalErrorHandler?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Track unhandled promise rejections. Default **true**.
|
|
55
|
+
*
|
|
56
|
+
* ⚠️ Unlike every other handler in this SDK, this one CANNOT be chained
|
|
57
|
+
* reliably. Both engines expose a single-slot switch with no getter:
|
|
58
|
+
* Hermes' `HermesInternal.enablePromiseRejectionTracker(options)` and JSC's
|
|
59
|
+
* `promise/setimmediate/rejection-tracking`.`enable(options)` each replace
|
|
60
|
+
* whatever was registered, and neither offers a way to read the incumbent
|
|
61
|
+
* back out. Sentry React Native calls exactly the same APIs.
|
|
62
|
+
*
|
|
63
|
+
* What we do about it:
|
|
64
|
+
* - We install a composing wrapper over the engine's `enable` entry point,
|
|
65
|
+
* so a reporter that initialises AFTER us is merged with us instead of
|
|
66
|
+
* replacing us. Both handlers then run.
|
|
67
|
+
* - The reverse order is unfixable. If another reporter installed BEFORE
|
|
68
|
+
* Swiss Knife and did not itself chain, its handler is unreachable and
|
|
69
|
+
* ours replaces it. Either initialise Swiss Knife first, or set this to
|
|
70
|
+
* false — the rest of the SDK (manual captures, breadcrumbs, sessions,
|
|
71
|
+
* the global error handler, native crashes) is unaffected either way.
|
|
72
|
+
*/
|
|
73
|
+
enablePromiseRejectionTracking?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Subscribe to `AppState` to open/close crash-reporting sessions on
|
|
76
|
+
* foreground/background. Default **true**. Purely additive (RN's AppState
|
|
77
|
+
* is a multi-listener emitter — no slot to fight over); the opt-out exists
|
|
78
|
+
* for hosts that drive session boundaries themselves.
|
|
79
|
+
*/
|
|
80
|
+
enableAppStateTracking?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Start the NATIVE crash handler (iOS Mach/signal + NSException, Android
|
|
83
|
+
* NDK + system ANR) via the native module. Default **true**.
|
|
84
|
+
*
|
|
85
|
+
* Our native handlers chain (they capture and re-invoke the previous
|
|
86
|
+
* `NSSetUncaughtExceptionHandler` / `signal()` / Java
|
|
87
|
+
* `UncaughtExceptionHandler`), so coexisting with Sentry or Crashlytics is
|
|
88
|
+
* supported. Set false if the host's incumbent owns native crash reporting
|
|
89
|
+
* outright and you only want Swiss Knife's JS-level features.
|
|
90
|
+
*/
|
|
91
|
+
enableNativeCrashHandler?: boolean;
|
|
12
92
|
/** Called before sending each event. Return null to drop the event. */
|
|
13
93
|
beforeSend?: (event: SKCrashEvent) => SKCrashEvent | null;
|
|
14
94
|
/**
|
|
@@ -155,6 +235,15 @@ export declare const CrashReporting: {
|
|
|
155
235
|
}>;
|
|
156
236
|
_pendingScreenshotCountForTests(): number;
|
|
157
237
|
_simulateAppState(nextState: string): void;
|
|
238
|
+
/** Test seam: stand in for `NativeModules.SKCrashReporting`.
|
|
239
|
+
* `null` = native absent; `undefined` = resolve from react-native. */
|
|
240
|
+
_setNativeCrashModuleForTests(mod: SKCrashReportingNative | null | undefined): void;
|
|
241
|
+
/** Test seam: stand in for react-native's `AppState`. */
|
|
242
|
+
_setAppStateForTests(appState: {
|
|
243
|
+
addEventListener: (e: string, h: (s: string) => void) => {
|
|
244
|
+
remove: () => void;
|
|
245
|
+
};
|
|
246
|
+
} | null | undefined): void;
|
|
158
247
|
};
|
|
159
248
|
export interface SKErrorBoundaryProps {
|
|
160
249
|
children: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crash-reporting.d.ts","sourceRoot":"","sources":["../../../../src/modules/crash-reporting.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"crash-reporting.d.ts","sourceRoot":"","sources":["../../../../src/modules/crash-reporting.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B;;;;;GAKG;AACH,UAAU,sBAAsB;IAC9B,KAAK,CAAC,MAAM,EAAE;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC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
|
import type { PurchasesConfiguration, LOG_LEVEL, CustomerInfo, PurchasesOfferings, PurchasesPackage, PurchasesStoreProduct, MakePurchaseResult, LogInResult, CustomerInfoUpdateListener } from "./types.js";
|
|
2
|
+
/**
|
|
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
|
+
*/
|
|
2
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:
|
|
22
|
+
*
|
|
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>;
|
|
3
34
|
/**
|
|
4
35
|
* RC-compatible subscriptions SDK entry point. Process-wide singleton; call
|
|
5
36
|
* `Purchases.configure(...)` once at app start, then use the static methods.
|
|
@@ -108,6 +139,6 @@ export declare class Purchases {
|
|
|
108
139
|
/** @internal Test seam: reset singleton state between tests. */
|
|
109
140
|
static __resetForTests(): void;
|
|
110
141
|
}
|
|
111
|
-
export { throwIfNotConfigured as __throwIfNotConfigured };
|
|
142
|
+
export { throwIfNotConfigured as __throwIfNotConfigured, throwIfCoreNotConfigured as __throwIfCoreNotConfigured, };
|
|
112
143
|
export default Purchases;
|
|
113
144
|
//# sourceMappingURL=purchases.d.ts.map
|
|
@@ -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,YAAS,CAAC;AA2CjB,iBAAS,oBAAoB,IAAI,IAAI,CAIpC;AAED;;;GAGG;AACH,qBAAa,SAAS;IACpB;;;;OAIG;IACH,MAAM,CAAC,SAAS,CACd,OAAO,EAAE,sBAAsB,GAAG;QAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;KAAE,GACzD,IAAI;IA2BP;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,aAAa,CAClB,OAAO,EAAE,sBAAsB,GAAG;QAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;KAAE,GACzD,IAAI;IAoBP;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC;IAIvC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;IAI3C,g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Q,EAAE,0BAA0B,GACnC,IAAI;IAQP,mEAAmE;IACnE,MAAM,CAAC,gCAAgC,CACrC,QAAQ,EAAE,0BAA0B,GACnC,IAAI;IAQP,gEAAgE;IAChE,MAAM,CAAC,eAAe,IAAI,IAAI;CAM/B;AAGD,OAAO,EACL,oBAAoB,IAAI,sBAAsB,EAC9C,wBAAwB,IAAI,0BAA0B,GACvD,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@app-swiss-knife/react-native-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Subscriptions-only React Native SDK for App Swiss Knife — a drop-in replacement for RevenueCat's react-native-purchases public API.",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./lib/commonjs/index.js",
|