@app-swiss-knife/react-native-sdk 0.1.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.
- package/README.md +182 -0
- package/SwissKnifePurchases.podspec +40 -0
- package/android/build.gradle +89 -0
- package/android/gradle.properties +3 -0
- package/android/src/main/AndroidManifest.xml +26 -0
- package/android/src/main/java/com/swissknife/crashreporting/SKCrashReportingModule.kt +216 -0
- package/android/src/main/java/com/swissknife/crashreporting/SKCrashReportingPackage.kt +17 -0
- package/android/src/main/java/com/swissknife/purchases/Conversions.kt +15 -0
- package/android/src/main/java/com/swissknife/purchases/SwissKnifeJson.kt +371 -0
- package/android/src/main/java/com/swissknife/purchases/SwissKnifePurchasesModule.kt +497 -0
- package/android/src/main/java/com/swissknife/purchases/SwissKnifePurchasesPackage.kt +25 -0
- package/android/vendor/GENERATED.md +10 -0
- package/android/vendor/java/com/appswissknife/SwissKnife.kt +533 -0
- package/android/vendor/java/com/appswissknife/analytics/EventQueueStore.kt +326 -0
- package/android/vendor/java/com/appswissknife/analytics/FlushEventsWorker.kt +296 -0
- package/android/vendor/java/com/appswissknife/analytics/SKAnalytics.kt +503 -0
- package/android/vendor/java/com/appswissknife/attributes/AttributesClient.kt +188 -0
- package/android/vendor/java/com/appswissknife/attributes/SetAttributesWorker.kt +204 -0
- package/android/vendor/java/com/appswissknife/attribution/Attribution.kt +447 -0
- package/android/vendor/java/com/appswissknife/context/AppLifecycle.kt +120 -0
- package/android/vendor/java/com/appswissknife/context/Clock.kt +70 -0
- package/android/vendor/java/com/appswissknife/context/DeviceContext.kt +138 -0
- package/android/vendor/java/com/appswissknife/context/IDs.kt +55 -0
- package/android/vendor/java/com/appswissknife/context/Reachability.kt +145 -0
- package/android/vendor/java/com/appswissknife/context/Session.kt +192 -0
- package/android/vendor/java/com/appswissknife/crashreporting/SKCrashReporting.kt +945 -0
- package/android/vendor/java/com/appswissknife/crashreporting/SKScreenshot.kt +201 -0
- package/android/vendor/java/com/appswissknife/device/DeviceID.kt +172 -0
- package/android/vendor/java/com/appswissknife/diagnostics/SKLog.kt +97 -0
- package/android/vendor/java/com/appswissknife/entitlements/EntitlementsRepository.kt +495 -0
- package/android/vendor/java/com/appswissknife/identity/Identity.kt +522 -0
- package/android/vendor/java/com/appswissknife/models/CustomerInfo.kt +67 -0
- package/android/vendor/java/com/appswissknife/models/Enums.kt +35 -0
- package/android/vendor/java/com/appswissknife/models/Offerings.kt +80 -0
- package/android/vendor/java/com/appswissknife/models/PurchasesError.kt +89 -0
- package/android/vendor/java/com/appswissknife/models/StoreTransaction.kt +17 -0
- package/android/vendor/java/com/appswissknife/net/BackendHttpClient.kt +507 -0
- package/android/vendor/java/com/appswissknife/net/ExponentialBackoff.kt +69 -0
- package/android/vendor/java/com/appswissknife/net/IngestClient.kt +582 -0
- package/android/vendor/java/com/appswissknife/net/OfflineQueueStore.kt +320 -0
- package/android/vendor/java/com/appswissknife/offerings/OfferingsRepository.kt +219 -0
- package/android/vendor/java/com/appswissknife/performance/SKFrameTracker.kt +94 -0
- package/android/vendor/java/com/appswissknife/performance/SKPerformance.kt +428 -0
- package/android/vendor/java/com/appswissknife/purchases/BillingClientGateway.kt +560 -0
- package/android/vendor/java/com/appswissknife/purchases/PlayPriceEnrichmentProvider.kt +100 -0
- package/android/vendor/java/com/appswissknife/purchases/PriceEnrichmentProvider.kt +36 -0
- package/android/vendor/java/com/appswissknife/purchases/PurchasesGateway.kt +120 -0
- package/android/vendor/res/xml/swissknife_data_extraction_rules.xml +20 -0
- package/ios/SwissKnifeCrashReporting.m +32 -0
- package/ios/SwissKnifeCrashReporting.swift +186 -0
- package/ios/SwissKnifeJSON.swift +347 -0
- package/ios/SwissKnifePurchases.m +124 -0
- package/ios/SwissKnifePurchases.swift +523 -0
- package/ios/vendor/GENERATED.md +10 -0
- package/ios/vendor/SwissKnifeiOS/Analytics/SKAnalytics.swift +488 -0
- package/ios/vendor/SwissKnifeiOS/AttributesClient.swift +460 -0
- package/ios/vendor/SwissKnifeiOS/Attribution/Attribution.swift +307 -0
- package/ios/vendor/SwissKnifeiOS/Attribution/AttributionNetwork.swift +92 -0
- package/ios/vendor/SwissKnifeiOS/Attribution/AttributionState.swift +141 -0
- package/ios/vendor/SwissKnifeiOS/Context/AppLifecycle.swift +130 -0
- package/ios/vendor/SwissKnifeiOS/Context/Clock.swift +100 -0
- package/ios/vendor/SwissKnifeiOS/Context/DeviceContext.swift +190 -0
- package/ios/vendor/SwissKnifeiOS/Context/IDs.swift +64 -0
- package/ios/vendor/SwissKnifeiOS/Context/Reachability.swift +121 -0
- package/ios/vendor/SwissKnifeiOS/Context/Session.swift +223 -0
- package/ios/vendor/SwissKnifeiOS/CrashReporting/SKCrashReporting.swift +1287 -0
- package/ios/vendor/SwissKnifeiOS/CrashReporting/SKScreenshot.swift +175 -0
- package/ios/vendor/SwissKnifeiOS/DeviceID.swift +161 -0
- package/ios/vendor/SwissKnifeiOS/Diagnostics/SKLog.swift +128 -0
- package/ios/vendor/SwissKnifeiOS/Identity/Identity.swift +323 -0
- package/ios/vendor/SwissKnifeiOS/Identity/IdentityNetwork.swift +70 -0
- package/ios/vendor/SwissKnifeiOS/Net/BackendHttpClient.swift +329 -0
- package/ios/vendor/SwissKnifeiOS/Net/ExponentialBackoff.swift +87 -0
- package/ios/vendor/SwissKnifeiOS/Net/IngestClient.swift +681 -0
- package/ios/vendor/SwissKnifeiOS/Net/OfflineQueueStore.swift +409 -0
- package/ios/vendor/SwissKnifeiOS/Performance/SKFrameTracker.swift +89 -0
- package/ios/vendor/SwissKnifeiOS/Performance/SKPerformance.swift +440 -0
- package/ios/vendor/SwissKnifeiOS/Performance/SKURLSessionDelegate.swift +87 -0
- package/ios/vendor/SwissKnifeiOS/Services/EntitlementsService.swift +646 -0
- package/ios/vendor/SwissKnifeiOS/Services/OfferingsService.swift +458 -0
- package/ios/vendor/SwissKnifeiOS/Services/PurchaseService.swift +374 -0
- package/ios/vendor/SwissKnifeiOS/SwissKnife+Analytics.swift +46 -0
- package/ios/vendor/SwissKnifeiOS/SwissKnife+DeviceID.swift +30 -0
- package/ios/vendor/SwissKnifeiOS/SwissKnife+Session.swift +47 -0
- package/ios/vendor/SwissKnifeiOS/SwissKnife.swift +417 -0
- package/ios/vendor/SwissKnifeiOS/Types.swift +496 -0
- package/lib/commonjs/attribution.js +55 -0
- package/lib/commonjs/attribution.js.map +1 -0
- package/lib/commonjs/identity.js +126 -0
- package/lib/commonjs/identity.js.map +1 -0
- package/lib/commonjs/index.js +118 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/modules/analytics.js +646 -0
- package/lib/commonjs/modules/analytics.js.map +1 -0
- package/lib/commonjs/modules/attachments.js +169 -0
- package/lib/commonjs/modules/attachments.js.map +1 -0
- package/lib/commonjs/modules/crash-reporting.js +1327 -0
- package/lib/commonjs/modules/crash-reporting.js.map +1 -0
- package/lib/commonjs/modules/ids.js +50 -0
- package/lib/commonjs/modules/ids.js.map +1 -0
- package/lib/commonjs/modules/log.js +59 -0
- package/lib/commonjs/modules/log.js.map +1 -0
- package/lib/commonjs/modules/offline-store.js +44 -0
- package/lib/commonjs/modules/offline-store.js.map +1 -0
- package/lib/commonjs/modules/performance.js +494 -0
- package/lib/commonjs/modules/performance.js.map +1 -0
- package/lib/commonjs/native/module.js +41 -0
- package/lib/commonjs/native/module.js.map +1 -0
- package/lib/commonjs/native/spec.js +26 -0
- package/lib/commonjs/native/spec.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/purchases.js +194 -0
- package/lib/commonjs/purchases.js.map +1 -0
- package/lib/commonjs/types.js +236 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/attribution.js +51 -0
- package/lib/module/attribution.js.map +1 -0
- package/lib/module/identity.js +122 -0
- package/lib/module/identity.js.map +1 -0
- package/lib/module/index.js +36 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/modules/analytics.js +642 -0
- package/lib/module/modules/analytics.js.map +1 -0
- package/lib/module/modules/attachments.js +162 -0
- package/lib/module/modules/attachments.js.map +1 -0
- package/lib/module/modules/crash-reporting.js +1320 -0
- package/lib/module/modules/crash-reporting.js.map +1 -0
- package/lib/module/modules/ids.js +44 -0
- package/lib/module/modules/ids.js.map +1 -0
- package/lib/module/modules/log.js +54 -0
- package/lib/module/modules/log.js.map +1 -0
- package/lib/module/modules/offline-store.js +39 -0
- package/lib/module/modules/offline-store.js.map +1 -0
- package/lib/module/modules/performance.js +491 -0
- package/lib/module/modules/performance.js.map +1 -0
- package/lib/module/native/module.js +34 -0
- package/lib/module/native/module.js.map +1 -0
- package/lib/module/native/spec.js +22 -0
- package/lib/module/native/spec.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/purchases.js +187 -0
- package/lib/module/purchases.js.map +1 -0
- package/lib/module/types.js +230 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/commonjs/attribution.d.ts +24 -0
- package/lib/typescript/commonjs/attribution.d.ts.map +1 -0
- package/lib/typescript/commonjs/identity.d.ts +37 -0
- package/lib/typescript/commonjs/identity.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +15 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/modules/analytics.d.ts +127 -0
- package/lib/typescript/commonjs/modules/analytics.d.ts.map +1 -0
- package/lib/typescript/commonjs/modules/attachments.d.ts +50 -0
- package/lib/typescript/commonjs/modules/attachments.d.ts.map +1 -0
- package/lib/typescript/commonjs/modules/crash-reporting.d.ts +175 -0
- package/lib/typescript/commonjs/modules/crash-reporting.d.ts.map +1 -0
- package/lib/typescript/commonjs/modules/ids.d.ts +17 -0
- package/lib/typescript/commonjs/modules/ids.d.ts.map +1 -0
- package/lib/typescript/commonjs/modules/log.d.ts +12 -0
- package/lib/typescript/commonjs/modules/log.d.ts.map +1 -0
- package/lib/typescript/commonjs/modules/offline-store.d.ts +9 -0
- package/lib/typescript/commonjs/modules/offline-store.d.ts.map +1 -0
- package/lib/typescript/commonjs/modules/performance.d.ts +75 -0
- package/lib/typescript/commonjs/modules/performance.d.ts.map +1 -0
- package/lib/typescript/commonjs/native/module.d.ts +6 -0
- package/lib/typescript/commonjs/native/module.d.ts.map +1 -0
- package/lib/typescript/commonjs/native/spec.d.ts +119 -0
- package/lib/typescript/commonjs/native/spec.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/purchases.d.ts +68 -0
- package/lib/typescript/commonjs/purchases.d.ts.map +1 -0
- package/lib/typescript/commonjs/types.d.ts +384 -0
- package/lib/typescript/commonjs/types.d.ts.map +1 -0
- package/lib/typescript/module/attribution.d.ts +24 -0
- package/lib/typescript/module/attribution.d.ts.map +1 -0
- package/lib/typescript/module/identity.d.ts +37 -0
- package/lib/typescript/module/identity.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +15 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/modules/analytics.d.ts +127 -0
- package/lib/typescript/module/modules/analytics.d.ts.map +1 -0
- package/lib/typescript/module/modules/attachments.d.ts +50 -0
- package/lib/typescript/module/modules/attachments.d.ts.map +1 -0
- package/lib/typescript/module/modules/crash-reporting.d.ts +175 -0
- package/lib/typescript/module/modules/crash-reporting.d.ts.map +1 -0
- package/lib/typescript/module/modules/ids.d.ts +17 -0
- package/lib/typescript/module/modules/ids.d.ts.map +1 -0
- package/lib/typescript/module/modules/log.d.ts +12 -0
- package/lib/typescript/module/modules/log.d.ts.map +1 -0
- package/lib/typescript/module/modules/offline-store.d.ts +9 -0
- package/lib/typescript/module/modules/offline-store.d.ts.map +1 -0
- package/lib/typescript/module/modules/performance.d.ts +75 -0
- package/lib/typescript/module/modules/performance.d.ts.map +1 -0
- package/lib/typescript/module/native/module.d.ts +6 -0
- package/lib/typescript/module/native/module.d.ts.map +1 -0
- package/lib/typescript/module/native/spec.d.ts +119 -0
- package/lib/typescript/module/native/spec.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/purchases.d.ts +68 -0
- package/lib/typescript/module/purchases.d.ts.map +1 -0
- package/lib/typescript/module/types.d.ts +384 -0
- package/lib/typescript/module/types.d.ts.map +1 -0
- package/package.json +115 -0
- package/react-native.config.js +23 -0
- package/src/attribution.ts +56 -0
- package/src/identity.ts +133 -0
- package/src/index.ts +54 -0
- package/src/modules/analytics.ts +689 -0
- package/src/modules/attachments.ts +222 -0
- package/src/modules/crash-reporting.ts +1577 -0
- package/src/modules/ids.ts +41 -0
- package/src/modules/log.ts +56 -0
- package/src/modules/offline-store.ts +51 -0
- package/src/modules/performance.ts +589 -0
- package/src/native/module.ts +47 -0
- package/src/native/spec.ts +183 -0
- package/src/purchases.ts +214 -0
- package/src/types.ts +470 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// src/purchases.ts
|
|
4
|
+
import { getNativeModule, getEventEmitter } from "./native/module.js";
|
|
5
|
+
import { CUSTOMER_INFO_UPDATED_EVENT } from "./native/spec.js";
|
|
6
|
+
import { UninitializedPurchasesError } from "./types.js";
|
|
7
|
+
let configured = false;
|
|
8
|
+
let configuredApiKey = null;
|
|
9
|
+
|
|
10
|
+
// Maps a caller's listener fn to its native subscription so we can remove it.
|
|
11
|
+
const customerInfoSubscriptions = new Map();
|
|
12
|
+
function throwIfNotConfigured() {
|
|
13
|
+
if (!configured) {
|
|
14
|
+
throw new UninitializedPurchasesError();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* RC-compatible subscriptions SDK entry point. Process-wide singleton; call
|
|
20
|
+
* `Purchases.configure(...)` once at app start, then use the static methods.
|
|
21
|
+
*/
|
|
22
|
+
export class Purchases {
|
|
23
|
+
/**
|
|
24
|
+
* Configure the SDK. Must be called before any other method. Calling again
|
|
25
|
+
* with the same API key is a no-op (matches the common "configure once" guard);
|
|
26
|
+
* the native layer owns full reconfiguration.
|
|
27
|
+
*/
|
|
28
|
+
static configure(options) {
|
|
29
|
+
if (configured && configuredApiKey === options.apiKey) return;
|
|
30
|
+
const native = getNativeModule();
|
|
31
|
+
const nativeOptions = {
|
|
32
|
+
apiKey: options.apiKey,
|
|
33
|
+
appUserID: options.appUserID ?? null,
|
|
34
|
+
// proxyURL points the native SDK at the Swiss Knife backend. Without it the
|
|
35
|
+
// native layer falls back to its hardcoded default host (api.swiss-knife.dev),
|
|
36
|
+
// which is unreachable for self-hosted tenants. Forward it so callers can
|
|
37
|
+
// target their own backend (e.g. https://swiss.remneys.com).
|
|
38
|
+
proxyURL: options.proxyURL ?? null,
|
|
39
|
+
// Hardening pass (spec): diagnostics opt-in only — default OFF.
|
|
40
|
+
diagnosticsEnabled: options.diagnosticsEnabled ?? false,
|
|
41
|
+
storeKitVersion: options.storeKitVersion,
|
|
42
|
+
useAmazon: options.useAmazon,
|
|
43
|
+
// iOS ATT — default off (no tracking prompt) unless the host opts in.
|
|
44
|
+
autoPromptATT: options.autoPromptATT,
|
|
45
|
+
sendInstallOnFirstLaunch: options.sendInstallOnFirstLaunch,
|
|
46
|
+
logLevel: options.logLevel
|
|
47
|
+
};
|
|
48
|
+
// Fire-and-forget: native configure resolves async but RC's configure is sync.
|
|
49
|
+
void native.configure(nativeOptions);
|
|
50
|
+
configured = true;
|
|
51
|
+
configuredApiKey = options.apiKey;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Whether the SDK has been configured. Delegates to native. */
|
|
55
|
+
static isConfigured() {
|
|
56
|
+
if (!configured) return Promise.resolve(false);
|
|
57
|
+
return getNativeModule().isConfigured();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Latest CustomerInfo (entitlements + subscriptions), computed server-side. */
|
|
61
|
+
static async getCustomerInfo() {
|
|
62
|
+
throwIfNotConfigured();
|
|
63
|
+
return getNativeModule().getCustomerInfo();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Current + all offerings configured for this app. */
|
|
67
|
+
static async getOfferings() {
|
|
68
|
+
throwIfNotConfigured();
|
|
69
|
+
return getNativeModule().getOfferings();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Purchase a package from an offering. Drives the native store payment sheet. */
|
|
73
|
+
static async purchasePackage(pkg) {
|
|
74
|
+
throwIfNotConfigured();
|
|
75
|
+
const offeringId = pkg.presentedOfferingContext?.offeringIdentifier ?? '';
|
|
76
|
+
return getNativeModule().purchasePackage(pkg.identifier, offeringId);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Purchase a store product directly by its store SKU. */
|
|
80
|
+
static async purchaseStoreProduct(product) {
|
|
81
|
+
throwIfNotConfigured();
|
|
82
|
+
return getNativeModule().purchaseStoreProduct(product.identifier);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Restore purchases tied to the underlying store account. */
|
|
86
|
+
static async restorePurchases() {
|
|
87
|
+
throwIfNotConfigured();
|
|
88
|
+
return getNativeModule().restorePurchases();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Identify the user. Aliases/merges anonymous purchases server-side.
|
|
93
|
+
*
|
|
94
|
+
* @deprecated Wave 1 — prefer `Identity.logIn(userId)`. Routes through
|
|
95
|
+
* the unified Identity surface natively, so the bug fix (Android now
|
|
96
|
+
* POSTs `/api/sdk/users/identify`) applies whether you call this or
|
|
97
|
+
* `Identity.logIn(...)`.
|
|
98
|
+
*/
|
|
99
|
+
static async logIn(appUserID) {
|
|
100
|
+
throwIfNotConfigured();
|
|
101
|
+
return getNativeModule().logIn(appUserID);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Log out the current user and revert to anonymous.
|
|
106
|
+
*
|
|
107
|
+
* @deprecated Wave 1 — prefer `Identity.logOut()`.
|
|
108
|
+
*/
|
|
109
|
+
static async logOut() {
|
|
110
|
+
throwIfNotConfigured();
|
|
111
|
+
return getNativeModule().logOut();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** The current app user id (anonymous or identified). */
|
|
115
|
+
static async getAppUserID() {
|
|
116
|
+
throwIfNotConfigured();
|
|
117
|
+
return getNativeModule().getAppUserID();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Whether the current user id is an SDK-generated anonymous id. */
|
|
121
|
+
static async isAnonymous() {
|
|
122
|
+
throwIfNotConfigured();
|
|
123
|
+
return getNativeModule().isAnonymous();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** Set arbitrary subscriber attributes. null clears an attribute. */
|
|
127
|
+
static async setAttributes(attributes) {
|
|
128
|
+
throwIfNotConfigured();
|
|
129
|
+
return getNativeModule().setAttributes(attributes);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** Reserved attribute: email. */
|
|
133
|
+
static async setEmail(email) {
|
|
134
|
+
throwIfNotConfigured();
|
|
135
|
+
return getNativeModule().setEmail(email);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** Reserved attribute: display name. */
|
|
139
|
+
static async setDisplayName(displayName) {
|
|
140
|
+
throwIfNotConfigured();
|
|
141
|
+
return getNativeModule().setDisplayName(displayName);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** Reserved attribute: phone number. */
|
|
145
|
+
static async setPhoneNumber(phoneNumber) {
|
|
146
|
+
throwIfNotConfigured();
|
|
147
|
+
return getNativeModule().setPhoneNumber(phoneNumber);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** Reserved attribute: push token. */
|
|
151
|
+
static async setPushToken(pushToken) {
|
|
152
|
+
throwIfNotConfigured();
|
|
153
|
+
return getNativeModule().setPushToken(pushToken);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** Set the native log level. Accepts a LOG_LEVEL enum value. */
|
|
157
|
+
static async setLogLevel(level) {
|
|
158
|
+
return getNativeModule().setLogLevel(level);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** Subscribe to CustomerInfo changes (purchase, renewal, dashboard grant). */
|
|
162
|
+
static addCustomerInfoUpdateListener(listener) {
|
|
163
|
+
const sub = getEventEmitter().addListener(CUSTOMER_INFO_UPDATED_EVENT, event => listener(event));
|
|
164
|
+
customerInfoSubscriptions.set(listener, sub);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** Remove a previously-registered CustomerInfo update listener. */
|
|
168
|
+
static removeCustomerInfoUpdateListener(listener) {
|
|
169
|
+
const sub = customerInfoSubscriptions.get(listener);
|
|
170
|
+
if (sub) {
|
|
171
|
+
sub.remove();
|
|
172
|
+
customerInfoSubscriptions.delete(listener);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** @internal Test seam: reset singleton state between tests. */
|
|
177
|
+
static __resetForTests() {
|
|
178
|
+
configured = false;
|
|
179
|
+
configuredApiKey = null;
|
|
180
|
+
customerInfoSubscriptions.clear();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Internal helper shared with the rest of the class (defined across SP-2a tasks).
|
|
185
|
+
export { throwIfNotConfigured as __throwIfNotConfigured };
|
|
186
|
+
export default Purchases;
|
|
187
|
+
//# sourceMappingURL=purchases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getNativeModule","getEventEmitter","CUSTOMER_INFO_UPDATED_EVENT","UninitializedPurchasesError","configured","configuredApiKey","customerInfoSubscriptions","Map","throwIfNotConfigured","Purchases","configure","options","apiKey","native","nativeOptions","appUserID","proxyURL","diagnosticsEnabled","storeKitVersion","useAmazon","autoPromptATT","sendInstallOnFirstLaunch","logLevel","isConfigured","Promise","resolve","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"],"sourceRoot":"../../src","sources":["purchases.ts"],"mappings":";;AAAA;AACA,SAASA,eAAe,EAAEC,eAAe,QAAQ,oBAAiB;AAClE,SAASC,2BAA2B,QAAQ,kBAAe;AAC3D,SAASC,2BAA2B,QAAQ,YAAS;AAerD,IAAIC,UAAU,GAAG,KAAK;AACtB,IAAIC,gBAA+B,GAAG,IAAI;;AAE1C;AACA,MAAMC,yBAAyB,GAAG,IAAIC,GAAG,CAGvC,CAAC;AAEH,SAASC,oBAAoBA,CAAA,EAAS;EACpC,IAAI,CAACJ,UAAU,EAAE;IACf,MAAM,IAAID,2BAA2B,CAAC,CAAC;EACzC;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMM,SAAS,CAAC;EACrB;AACF;AACA;AACA;AACA;EACE,OAAOC,SAASA,CACdC,OAA0D,EACpD;IACN,IAAIP,UAAU,IAAIC,gBAAgB,KAAKM,OAAO,CAACC,MAAM,EAAE;IACvD,MAAMC,MAAM,GAAGb,eAAe,CAAC,CAAC;IAChC,MAAMc,aAAqC,GAAG;MAC5CF,MAAM,EAAED,OAAO,CAACC,MAAM;MACtBG,SAAS,EAAEJ,OAAO,CAACI,SAAS,IAAI,IAAI;MACpC;MACA;MACA;MACA;MACAC,QAAQ,EAAEL,OAAO,CAACK,QAAQ,IAAI,IAAI;MAClC;MACAC,kBAAkB,EAAEN,OAAO,CAACM,kBAAkB,IAAI,KAAK;MACvDC,eAAe,EAAEP,OAAO,CAACO,eAAqC;MAC9DC,SAAS,EAAER,OAAO,CAACQ,SAAS;MAC5B;MACAC,aAAa,EAAET,OAAO,CAACS,aAAa;MACpCC,wBAAwB,EAAEV,OAAO,CAACU,wBAAwB;MAC1DC,QAAQ,EAAEX,OAAO,CAACW;IACpB,CAAC;IACD;IACA,KAAKT,MAAM,CAACH,SAAS,CAACI,aAAa,CAAC;IACpCV,UAAU,GAAG,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,CAACC,KAA0B,CAAC;EAClE;;EAEA;EACA,OAAOC,6BAA6BA,CAClCC,QAAoC,EAC9B;IACN,MAAMC,GAAG,GAAGtD,eAAe,CAAC,CAAC,CAACuD,WAAW,CACvCtD,2BAA2B,EAC1BuD,KAAK,IAAKH,QAAQ,CAACG,KAAkD,CACxE,CAAC;IACDnD,yBAAyB,CAACoD,GAAG,CAACJ,QAAQ,EAAEC,GAAG,CAAC;EAC9C;;EAEA;EACA,OAAOI,gCAAgCA,CACrCL,QAAoC,EAC9B;IACN,MAAMC,GAAG,GAAGjD,yBAAyB,CAACsD,GAAG,CAACN,QAAQ,CAAC;IACnD,IAAIC,GAAG,EAAE;MACPA,GAAG,CAACM,MAAM,CAAC,CAAC;MACZvD,yBAAyB,CAACwD,MAAM,CAACR,QAAQ,CAAC;IAC5C;EACF;;EAEA;EACA,OAAOS,eAAeA,CAAA,EAAS;IAC7B3D,UAAU,GAAG,KAAK;IAClBC,gBAAgB,GAAG,IAAI;IACvBC,yBAAyB,CAAC0D,KAAK,CAAC,CAAC;EACnC;AACF;;AAEA;AACA,SAASxD,oBAAoB,IAAIyD,sBAAsB;AAEvD,eAAexD,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// packages/react-native-sdk/src/types.ts
|
|
4
|
+
//
|
|
5
|
+
// Phase 7 of the RC rip-and-replace: own TypeScript type definitions that
|
|
6
|
+
// REPLACE the previous star-export of `@revenuecat/purchases-typescript-internal`.
|
|
7
|
+
// Shape mirrors RC's public API (same field names, same semantics) per the
|
|
8
|
+
// user-locked decision in the Phase 7 plan, so consumers of this SDK keep
|
|
9
|
+
// working without any source change.
|
|
10
|
+
//
|
|
11
|
+
// Why mirror RC names?
|
|
12
|
+
// - The public JS surface (`Purchases.configure`, `Purchases.getCustomerInfo`,
|
|
13
|
+
// etc.) MUST stay byte-compatible with `react-native-purchases`. The native
|
|
14
|
+
// bridges in `ios/SwissKnifePurchases.swift` and
|
|
15
|
+
// `android/.../SwissKnifePurchasesModule.kt` JSON-encode our Swift/Kotlin
|
|
16
|
+
// types (defined in `packages/swiss-knife-{ios,android}`) into payloads
|
|
17
|
+
// that match these TS shapes. One contract on both sides of the bridge.
|
|
18
|
+
//
|
|
19
|
+
// What's gone:
|
|
20
|
+
// - The dep on `@revenuecat/purchases-typescript-internal` — removed from
|
|
21
|
+
// package.json. No more PHC-licensed code ships in the SDK.
|
|
22
|
+
//
|
|
23
|
+
// What's preserved:
|
|
24
|
+
// - Re-exported names (`PurchasesEntitlementInfo`, `PurchasesOfferings`,
|
|
25
|
+
// `MakePurchaseResult`, …) so existing callers `import { Foo } from
|
|
26
|
+
// '@app-swiss-knife/react-native-sdk'` still compile unchanged.
|
|
27
|
+
// - The string-numeric `PURCHASES_ERROR_CODE` values RC uses ("0", "1", "10")
|
|
28
|
+
// — that's what the native bridge `reject(...)` callsite emits, so the JS
|
|
29
|
+
// mapper has to keep matching.
|
|
30
|
+
|
|
31
|
+
// MARK: - Value enums (must remain runtime objects, not type-only)
|
|
32
|
+
//
|
|
33
|
+
// RC's TS package exposes these as TS `enum` declarations, which means callers
|
|
34
|
+
// can use them as runtime values (`if (lvl === LOG_LEVEL.DEBUG) …`). We
|
|
35
|
+
// preserve that shape with `as const` objects so consumers don't see a behavior
|
|
36
|
+
// change.
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* SDK log level. String values match `RC.LogLevel` so the native bridge keeps
|
|
40
|
+
* parsing the same vocabulary on iOS and Android.
|
|
41
|
+
*/
|
|
42
|
+
export const LOG_LEVEL = {
|
|
43
|
+
VERBOSE: "VERBOSE",
|
|
44
|
+
DEBUG: "DEBUG",
|
|
45
|
+
INFO: "INFO",
|
|
46
|
+
WARN: "WARN",
|
|
47
|
+
ERROR: "ERROR"
|
|
48
|
+
};
|
|
49
|
+
/** Subscription package shape — same names as RC's `PACKAGE_TYPE`. */
|
|
50
|
+
export const PACKAGE_TYPE = {
|
|
51
|
+
UNKNOWN: "UNKNOWN",
|
|
52
|
+
CUSTOM: "CUSTOM",
|
|
53
|
+
LIFETIME: "LIFETIME",
|
|
54
|
+
ANNUAL: "ANNUAL",
|
|
55
|
+
SIX_MONTH: "SIX_MONTH",
|
|
56
|
+
THREE_MONTH: "THREE_MONTH",
|
|
57
|
+
TWO_MONTH: "TWO_MONTH",
|
|
58
|
+
MONTHLY: "MONTHLY",
|
|
59
|
+
WEEKLY: "WEEKLY"
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* StoreKit version selection on iOS. We only support StoreKit 2 in Phase 5+,
|
|
63
|
+
* but the enum stays for source compatibility — `configure({ storeKitVersion:
|
|
64
|
+
* STOREKIT_VERSION.STOREKIT_2 })` is a no-op now.
|
|
65
|
+
*/
|
|
66
|
+
export const STOREKIT_VERSION = {
|
|
67
|
+
DEFAULT: "DEFAULT",
|
|
68
|
+
STOREKIT_1: "STOREKIT_1",
|
|
69
|
+
STOREKIT_2: "STOREKIT_2"
|
|
70
|
+
};
|
|
71
|
+
/** JWS / signed-response verification status. RC parity. */
|
|
72
|
+
export const VERIFICATION_RESULT = {
|
|
73
|
+
NOT_REQUESTED: "NOT_REQUESTED",
|
|
74
|
+
VERIFIED: "VERIFIED",
|
|
75
|
+
FAILED: "FAILED",
|
|
76
|
+
VERIFIED_ON_DEVICE: "VERIFIED_ON_DEVICE"
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Public error-code catalog. Values are string-numeric ("0", "1", "10", …)
|
|
80
|
+
* so they match what RC's TS package previously emitted. The native bridges
|
|
81
|
+
* `reject(code, ...)` with these stringified numeric codes and the JS mapper
|
|
82
|
+
* picks them up by string compare — DO NOT renumber.
|
|
83
|
+
*
|
|
84
|
+
* Code → name mapping is the RC catalog the platform-native sealed classes
|
|
85
|
+
* already mirror (see `PurchasesError.kt`/`Types.swift`). New codes go at the
|
|
86
|
+
* end, never reorder.
|
|
87
|
+
*/
|
|
88
|
+
export const PURCHASES_ERROR_CODE = {
|
|
89
|
+
UNKNOWN_ERROR: "0",
|
|
90
|
+
PURCHASE_CANCELLED_ERROR: "1",
|
|
91
|
+
STORE_PROBLEM_ERROR: "2",
|
|
92
|
+
PURCHASE_NOT_ALLOWED_ERROR: "3",
|
|
93
|
+
PURCHASE_INVALID_ERROR: "4",
|
|
94
|
+
PRODUCT_NOT_AVAILABLE_FOR_PURCHASE_ERROR: "5",
|
|
95
|
+
PRODUCT_ALREADY_PURCHASED_ERROR: "6",
|
|
96
|
+
RECEIPT_ALREADY_IN_USE_ERROR: "7",
|
|
97
|
+
INVALID_RECEIPT_ERROR: "8",
|
|
98
|
+
MISSING_RECEIPT_FILE_ERROR: "9",
|
|
99
|
+
NETWORK_ERROR: "10",
|
|
100
|
+
INVALID_CREDENTIALS_ERROR: "11",
|
|
101
|
+
UNEXPECTED_BACKEND_RESPONSE_ERROR: "12",
|
|
102
|
+
RECEIPT_IN_USE_BY_OTHER_SUBSCRIBER_ERROR: "13",
|
|
103
|
+
INVALID_APP_USER_ID_ERROR: "14",
|
|
104
|
+
OPERATION_ALREADY_IN_PROGRESS_ERROR: "15",
|
|
105
|
+
UNKNOWN_BACKEND_ERROR: "16",
|
|
106
|
+
INVALID_APPLE_SUBSCRIPTION_KEY_ERROR: "17",
|
|
107
|
+
INELIGIBLE_ERROR: "18",
|
|
108
|
+
INSUFFICIENT_PERMISSIONS_ERROR: "19",
|
|
109
|
+
PAYMENT_PENDING_ERROR: "20",
|
|
110
|
+
INVALID_SUBSCRIBER_ATTRIBUTES_ERROR: "21",
|
|
111
|
+
LOG_OUT_ANONYMOUS_USER_ERROR: "22",
|
|
112
|
+
CONFIGURATION_ERROR: "23",
|
|
113
|
+
UNSUPPORTED_ERROR: "24",
|
|
114
|
+
EMPTY_SUBSCRIBER_ATTRIBUTES_ERROR: "25",
|
|
115
|
+
CUSTOMER_INFO_ERROR: "28"
|
|
116
|
+
};
|
|
117
|
+
// MARK: - Errors thrown / referenced by the Purchases class
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Thrown by `Purchases.<method>()` when called before `Purchases.configure(...)`.
|
|
121
|
+
* Matches the name + shape of RC's `UninitializedPurchasesError` so callers
|
|
122
|
+
* catching by class name keep working.
|
|
123
|
+
*/
|
|
124
|
+
export class UninitializedPurchasesError extends Error {
|
|
125
|
+
constructor(message = "Purchases is not configured. Call Purchases.configure() first.") {
|
|
126
|
+
super(message);
|
|
127
|
+
this.name = "UninitializedPurchasesError";
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Thrown when an API is called on an unsupported platform (e.g. web). Kept
|
|
133
|
+
* for source compatibility with RC.
|
|
134
|
+
*/
|
|
135
|
+
export class UnsupportedPlatformError extends Error {
|
|
136
|
+
constructor(message = "This method is not supported on the current platform.") {
|
|
137
|
+
super(message);
|
|
138
|
+
this.name = "UnsupportedPlatformError";
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Plain-object error contract used on callback args and rejected promises.
|
|
144
|
+
* NOT an Error subclass — RC surfaces this as a value, not something thrown
|
|
145
|
+
* as a JS Error. Promise rejections from the native bridge come through as
|
|
146
|
+
* `Error` objects whose `code` and `message` fields match this shape.
|
|
147
|
+
*/
|
|
148
|
+
|
|
149
|
+
// MARK: - Customer / Entitlement domain
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Per-entitlement state. Field names match RC's `PurchasesEntitlementInfo`
|
|
153
|
+
* 1:1; populated by the native bridge from our own `EntitlementInfo` Swift /
|
|
154
|
+
* Kotlin types (see `packages/swiss-knife-{ios,android}`).
|
|
155
|
+
*
|
|
156
|
+
* Dates are ISO-8601 strings on the wire — JS doesn't get a native `Date`
|
|
157
|
+
* across the RN bridge.
|
|
158
|
+
*/
|
|
159
|
+
|
|
160
|
+
/** All entitlements the user has ever owned + the currently-active subset. */
|
|
161
|
+
|
|
162
|
+
/** Subscription-only state per product (renewal status, period, etc.). */
|
|
163
|
+
|
|
164
|
+
/** One non-subscription IAP transaction (consumable/non-consumable). */
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Top-level user-level state, populated from our own `CustomerInfo` types on
|
|
168
|
+
* the native side. Field names track RC's `CustomerInfo` shape.
|
|
169
|
+
*/
|
|
170
|
+
|
|
171
|
+
// MARK: - Products / packages / offerings
|
|
172
|
+
|
|
173
|
+
/** Localized price + currency on a store product. Mirror of RC's `PurchasesStoreProductPrice`. */
|
|
174
|
+
|
|
175
|
+
/** Subscription period on a store product. */
|
|
176
|
+
|
|
177
|
+
/** Intro / promotional offer on a store product. */
|
|
178
|
+
|
|
179
|
+
/** One store product (subscription or non-subscription). */
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* The offering / package / target context surfaced when a package is presented.
|
|
183
|
+
* `targetingContext` is RC-server-driven A/B test metadata; preserved for parity.
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
/** A purchasable package inside an offering. */
|
|
187
|
+
|
|
188
|
+
/** A named group of packages — a paywall variant. */
|
|
189
|
+
|
|
190
|
+
/** Top-level offerings container. */
|
|
191
|
+
|
|
192
|
+
// MARK: - Public-method result types
|
|
193
|
+
|
|
194
|
+
/** Returned by `Purchases.logIn(appUserID)`. */
|
|
195
|
+
|
|
196
|
+
// MARK: - Identity (Wave 1)
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Immutable snapshot of the current identity. Mirrors
|
|
200
|
+
* `SwissKnife.Identity.Snapshot` (iOS) and
|
|
201
|
+
* `com.appswissknife.identity.Identity.Snapshot` (Android).
|
|
202
|
+
*
|
|
203
|
+
* The `anonymousId` carries the unified `$SKAnonymousID:` prefix as of
|
|
204
|
+
* Wave 1 (was `$RCAnonymousID:` on Android pre-Wave-1).
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
/** Delivered to `Identity.addObserver` callbacks on every transition. */
|
|
208
|
+
|
|
209
|
+
// MARK: - Attribution (Wave 2)
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Resolved attribution for the install. Mirrors
|
|
213
|
+
* `SwissKnife.Attribution.ResolvedAttribution` (iOS) and
|
|
214
|
+
* `Attribution.ResolvedAttribution` (Android).
|
|
215
|
+
*/
|
|
216
|
+
|
|
217
|
+
/** Returned by `Purchases.purchasePackage(...)` / `purchaseStoreProduct(...)`. */
|
|
218
|
+
|
|
219
|
+
// MARK: - Configuration
|
|
220
|
+
|
|
221
|
+
/** Options accepted by `Purchases.configure(...)`. Mirror of `PurchasesConfiguration`. */
|
|
222
|
+
|
|
223
|
+
// MARK: - Event listeners
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Callback signature for `Purchases.addCustomerInfoUpdateListener(fn)`. Fires
|
|
227
|
+
* on every CustomerInfo refresh (post-purchase, post-restore, dashboard-grant
|
|
228
|
+
* silent-push, etc.).
|
|
229
|
+
*/
|
|
230
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +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;A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AMC,wBAAwB,SAASJ,KAAK,CAAC;EAClDC,WAAWA,CACTC,OAAe,GAAG,uDAAuD,EACzE;IACA,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,0BAA0B;EACxC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAQA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiCA;;AAOA;;AAmBA;;AASA;AACA;AACA;AACA;;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;;AAgCA;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ResolvedAttribution } from "./types";
|
|
2
|
+
export declare const Attribution: {
|
|
3
|
+
/**
|
|
4
|
+
* The most recent resolved attribution from the native disk-backed
|
|
5
|
+
* cache. Returns `null` when no install POST has succeeded yet.
|
|
6
|
+
* Cheap — does not hit the network.
|
|
7
|
+
*/
|
|
8
|
+
resolved(): Promise<ResolvedAttribution | null>;
|
|
9
|
+
/**
|
|
10
|
+
* Auto-collect (ATT prompt + IDFA on iOS; advertising_id +
|
|
11
|
+
* install_referrer on Android) and POST `/api/sdk/attribution/install`.
|
|
12
|
+
* Idempotent — second call returns the cached resolution WITHOUT
|
|
13
|
+
* re-prompting or re-POSTing.
|
|
14
|
+
*/
|
|
15
|
+
requestAndRegister(): Promise<ResolvedAttribution | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Manual install registration for hosts that prompt for tracking
|
|
18
|
+
* consent themselves or collect the advertising id outside the SDK.
|
|
19
|
+
* Pass `null` when consent was denied. Idempotent.
|
|
20
|
+
*/
|
|
21
|
+
registerInstall(advertisingId?: string | null): Promise<ResolvedAttribution | null>;
|
|
22
|
+
};
|
|
23
|
+
export type { ResolvedAttribution } from "./types";
|
|
24
|
+
//# sourceMappingURL=attribution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attribution.d.ts","sourceRoot":"","sources":["../../../src/attribution.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,eAAO,MAAM,WAAW;IACtB;;;;OAIG;gBACe,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAIrD;;;;;OAKG;0BACyB,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAI/D;;;;OAIG;oCAEe,MAAM,GAAG,IAAI,GAC5B,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;CAGvC,CAAC;AAEF,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { IdentityChange, IdentitySnapshot, LogInResult } from "./types";
|
|
2
|
+
type Observer = (change: IdentityChange) => void;
|
|
3
|
+
export declare const Identity: {
|
|
4
|
+
/**
|
|
5
|
+
* Latest known identity snapshot. The first call hits the bridge;
|
|
6
|
+
* subsequent calls return the cached value updated by
|
|
7
|
+
* `logIn` / `logOut` / `reset` / `wipe`. Returns `null` only before
|
|
8
|
+
* the bridge has resolved.
|
|
9
|
+
*/
|
|
10
|
+
current(): Promise<IdentitySnapshot>;
|
|
11
|
+
/**
|
|
12
|
+
* Identify this device as a known user. Native posts the
|
|
13
|
+
* `(anonymous_id, user_id)` pair to `/api/sdk/users/identify` (the
|
|
14
|
+
* Wave 1 bug-fix; pre-Wave-1 Android did NOT post). Resolves once
|
|
15
|
+
* the backend ack + post-identify entitlements refresh complete.
|
|
16
|
+
*/
|
|
17
|
+
logIn(userId: string): Promise<LogInResult>;
|
|
18
|
+
/** Revert to anonymous. DeviceID stays stable across logout. */
|
|
19
|
+
logOut(): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Rotate in-memory state but keep persistent storage. Matches the
|
|
22
|
+
* "switch test user" UX semantic.
|
|
23
|
+
*/
|
|
24
|
+
reset(): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Hard wipe: clear Keychain (iOS) / EncryptedSharedPreferences
|
|
27
|
+
* (Android) DeviceID. GDPR-delete / test-build cleanup.
|
|
28
|
+
*/
|
|
29
|
+
wipe(): Promise<void>;
|
|
30
|
+
/** Subscribe to identity changes. Returns an unsubscribe token. */
|
|
31
|
+
addObserver(block: Observer): string;
|
|
32
|
+
removeObserver(token: string): void;
|
|
33
|
+
/** @internal Test seam — reset the cached snapshot + observers. */
|
|
34
|
+
__resetForTests(): void;
|
|
35
|
+
};
|
|
36
|
+
export type { IdentitySnapshot, IdentityChange } from "./types";
|
|
37
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/identity.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE7E,KAAK,QAAQ,GAAG,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;AAmCjD,eAAO,MAAM,QAAQ;IACnB;;;;;OAKG;eACc,OAAO,CAAC,gBAAgB,CAAC;IAM1C;;;;;OAKG;kBACiB,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAMjD,gEAAgE;cAChD,OAAO,CAAC,IAAI,CAAC;IAK7B;;;OAGG;aACY,OAAO,CAAC,IAAI,CAAC;IAK5B;;;OAGG;YACW,OAAO,CAAC,IAAI,CAAC;IAK3B,mEAAmE;uBAChD,QAAQ,GAAG,MAAM;0BAMd,MAAM,GAAG,IAAI;IAInC,mEAAmE;uBAChD,IAAI;CAIxB,CAAC;AAEF,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Purchases from "./purchases";
|
|
2
|
+
export default Purchases;
|
|
3
|
+
export { Purchases };
|
|
4
|
+
export * from "./types";
|
|
5
|
+
export { Identity } from "./identity";
|
|
6
|
+
export type { IdentitySnapshot, IdentityChange } from "./identity";
|
|
7
|
+
export { Attribution } from "./attribution";
|
|
8
|
+
export type { ResolvedAttribution } from "./attribution";
|
|
9
|
+
export { Analytics, SKIdentify, SKRevenue } from "./modules/analytics";
|
|
10
|
+
export type { SKAnalyticsConfig, SKEvent } from "./modules/analytics";
|
|
11
|
+
export { CrashReporting, SKErrorBoundary, parseStackTrace, } from "./modules/crash-reporting";
|
|
12
|
+
export type { CrashReportingConfig, SKCrashEvent, SKCrashBreadcrumb, SKCrashUser, } from "./modules/crash-reporting";
|
|
13
|
+
export { Performance } from "./modules/performance";
|
|
14
|
+
export type { PerformanceConfig, SKTransaction, SKSpan, SKStallMeasurements, } from "./modules/performance";
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAMzD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACvE,YAAY,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EACL,cAAc,EACd,eAAe,EACf,eAAe,GAChB,MAAM,2BAA2B,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,127 @@
|
|
|
1
|
+
export interface SKAnalyticsConfig {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
serverURL?: string;
|
|
4
|
+
flushQueueSize?: number;
|
|
5
|
+
flushIntervalMs?: number;
|
|
6
|
+
optOut?: boolean;
|
|
7
|
+
trackingSessionEvents?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface SKEvent {
|
|
10
|
+
/**
|
|
11
|
+
* Client-supplied idempotency key (UUID). Generated in JS at event-create
|
|
12
|
+
* time so the key is stable across bridge crashes and the backend dedupes
|
|
13
|
+
* via the `(app_project_id, event_id)` unique index. See the module
|
|
14
|
+
* doc-comment for the rationale.
|
|
15
|
+
*/
|
|
16
|
+
event_id: string;
|
|
17
|
+
event_type: string;
|
|
18
|
+
event_properties?: Record<string, unknown>;
|
|
19
|
+
user_id?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Wave 1: derived from the native Identity snapshot at event-build
|
|
22
|
+
* time. Carries the unified `$SKAnonymousID:` prefix on both iOS and
|
|
23
|
+
* Android.
|
|
24
|
+
*/
|
|
25
|
+
anonymous_id?: string;
|
|
26
|
+
device_id?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Post-#136 audit: now a UUID string sourced from the native
|
|
29
|
+
* `Session.shared` primitive (was `Date.now()` number which diverged
|
|
30
|
+
* from envelope-level `ContextSnapshot.session_id`). Optional so
|
|
31
|
+
* synthetic events constructed by callers (tests / overrides) can
|
|
32
|
+
* still omit it without a typecheck error.
|
|
33
|
+
*/
|
|
34
|
+
session_id?: string;
|
|
35
|
+
time?: number;
|
|
36
|
+
platform?: string;
|
|
37
|
+
os_name?: string;
|
|
38
|
+
user_properties?: Record<string, unknown>;
|
|
39
|
+
groups?: Record<string, unknown>;
|
|
40
|
+
}
|
|
41
|
+
export declare class SKIdentify {
|
|
42
|
+
private operations;
|
|
43
|
+
set(property: string, value: unknown): this;
|
|
44
|
+
setOnce(property: string, value: unknown): this;
|
|
45
|
+
unset(property: string): this;
|
|
46
|
+
add(property: string, value: number): this;
|
|
47
|
+
append(property: string, value: unknown): this;
|
|
48
|
+
prepend(property: string, value: unknown): this;
|
|
49
|
+
remove(property: string, value: unknown): this;
|
|
50
|
+
union(property: string, values: unknown[]): this;
|
|
51
|
+
clearAll(): this;
|
|
52
|
+
/** @internal */
|
|
53
|
+
_getOperations(): {
|
|
54
|
+
op: string;
|
|
55
|
+
key?: string;
|
|
56
|
+
value?: unknown;
|
|
57
|
+
}[];
|
|
58
|
+
}
|
|
59
|
+
export declare class SKRevenue {
|
|
60
|
+
productId: string;
|
|
61
|
+
quantity: number;
|
|
62
|
+
price: number;
|
|
63
|
+
revenueType?: string;
|
|
64
|
+
receipt?: string;
|
|
65
|
+
eventProperties?: Record<string, unknown>;
|
|
66
|
+
}
|
|
67
|
+
export declare const Analytics: {
|
|
68
|
+
/**
|
|
69
|
+
* Configure the analytics SDK. Kicks off (but does not block on) the native
|
|
70
|
+
* `device_id` fetch — callers do not need to `await init()`. Events tracked
|
|
71
|
+
* before the native promise resolves are still sent with `device_id`
|
|
72
|
+
* stamped because `track()` internally awaits the native promise before
|
|
73
|
+
* crossing the bridge.
|
|
74
|
+
*/
|
|
75
|
+
init(config: SKAnalyticsConfig): Promise<void>;
|
|
76
|
+
track(eventType: string, eventProperties?: Record<string, unknown>): void;
|
|
77
|
+
trackScreen(name: string, properties?: Record<string, unknown>): void;
|
|
78
|
+
setUserId(userId: string | undefined): void;
|
|
79
|
+
getUserId(): string | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Override the device id. Useful for tests and for consumers who want to
|
|
82
|
+
* tie analytics to an external identity. Once called, the native bridge
|
|
83
|
+
* value is ignored for the lifetime of this Analytics module (until
|
|
84
|
+
* `reset()`).
|
|
85
|
+
*/
|
|
86
|
+
setDeviceId(deviceId: string): void;
|
|
87
|
+
/**
|
|
88
|
+
* Returns the resolved device id, or `null` if the native bridge has not yet
|
|
89
|
+
* resolved AND no explicit override has been set. Most callers should await
|
|
90
|
+
* `init()` first.
|
|
91
|
+
*/
|
|
92
|
+
getDeviceId(): string | null;
|
|
93
|
+
/**
|
|
94
|
+
* Current session id from the native `Session.shared` primitive.
|
|
95
|
+
* Returns `null` until the first `track()` (or explicit await on
|
|
96
|
+
* `init()`'s session warm) has resolved the native call. Pre-audit
|
|
97
|
+
* this returned a `Date.now()` number; the new return type is `string |
|
|
98
|
+
* null` reflecting both the native UUID format and the lazy resolution.
|
|
99
|
+
*/
|
|
100
|
+
getSessionId(): string | null;
|
|
101
|
+
identify(identify: SKIdentify): void;
|
|
102
|
+
registerSuperProperties(properties: Record<string, unknown>): void;
|
|
103
|
+
registerSuperPropertiesOnce(properties: Record<string, unknown>): void;
|
|
104
|
+
getSuperProperties(): Record<string, unknown>;
|
|
105
|
+
unregisterSuperProperty(property: string): void;
|
|
106
|
+
clearSuperProperties(): void;
|
|
107
|
+
timeEvent(eventName: string): void;
|
|
108
|
+
addGroup(groupType: string, groupName: string): void;
|
|
109
|
+
reset(): void;
|
|
110
|
+
setGroup(groupType: string, groupName: string | string[]): void;
|
|
111
|
+
groupIdentify(groupType: string, groupName: string, identify: SKIdentify): void;
|
|
112
|
+
revenue(revenue: SKRevenue): void;
|
|
113
|
+
trackCharge(amount: number, properties?: Record<string, unknown>): void;
|
|
114
|
+
/**
|
|
115
|
+
* Ask the native side to flush its disk-backed queue. Fire-and-forget — the
|
|
116
|
+
* actual HTTP work runs natively (iOS GCD with back-off; Android
|
|
117
|
+
* WorkManager). This promise resolves as soon as the flush job is scheduled.
|
|
118
|
+
*
|
|
119
|
+
* No-op when the bridge is not linked (we don't keep a JS-side queue any
|
|
120
|
+
* more — there's nothing to send). Errors are swallowed with a single warning
|
|
121
|
+
* so background flushers don't crash the host app.
|
|
122
|
+
*/
|
|
123
|
+
flush(): Promise<void>;
|
|
124
|
+
setOptOut(optOut: boolean): void;
|
|
125
|
+
shutdown(): void;
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=analytics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../../../src/modules/analytics.ts"],"names":[],"mappings":"AAuEA,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,OAAO;IACtB;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CA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