@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,384 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK log level. String values match `RC.LogLevel` so the native bridge keeps
|
|
3
|
+
* parsing the same vocabulary on iOS and Android.
|
|
4
|
+
*/
|
|
5
|
+
export declare const LOG_LEVEL: {
|
|
6
|
+
readonly VERBOSE: "VERBOSE";
|
|
7
|
+
readonly DEBUG: "DEBUG";
|
|
8
|
+
readonly INFO: "INFO";
|
|
9
|
+
readonly WARN: "WARN";
|
|
10
|
+
readonly ERROR: "ERROR";
|
|
11
|
+
};
|
|
12
|
+
export type LOG_LEVEL = (typeof LOG_LEVEL)[keyof typeof LOG_LEVEL];
|
|
13
|
+
/** Subscription package shape — same names as RC's `PACKAGE_TYPE`. */
|
|
14
|
+
export declare const PACKAGE_TYPE: {
|
|
15
|
+
readonly UNKNOWN: "UNKNOWN";
|
|
16
|
+
readonly CUSTOM: "CUSTOM";
|
|
17
|
+
readonly LIFETIME: "LIFETIME";
|
|
18
|
+
readonly ANNUAL: "ANNUAL";
|
|
19
|
+
readonly SIX_MONTH: "SIX_MONTH";
|
|
20
|
+
readonly THREE_MONTH: "THREE_MONTH";
|
|
21
|
+
readonly TWO_MONTH: "TWO_MONTH";
|
|
22
|
+
readonly MONTHLY: "MONTHLY";
|
|
23
|
+
readonly WEEKLY: "WEEKLY";
|
|
24
|
+
};
|
|
25
|
+
export type PACKAGE_TYPE = (typeof PACKAGE_TYPE)[keyof typeof PACKAGE_TYPE];
|
|
26
|
+
/**
|
|
27
|
+
* StoreKit version selection on iOS. We only support StoreKit 2 in Phase 5+,
|
|
28
|
+
* but the enum stays for source compatibility — `configure({ storeKitVersion:
|
|
29
|
+
* STOREKIT_VERSION.STOREKIT_2 })` is a no-op now.
|
|
30
|
+
*/
|
|
31
|
+
export declare const STOREKIT_VERSION: {
|
|
32
|
+
readonly DEFAULT: "DEFAULT";
|
|
33
|
+
readonly STOREKIT_1: "STOREKIT_1";
|
|
34
|
+
readonly STOREKIT_2: "STOREKIT_2";
|
|
35
|
+
};
|
|
36
|
+
export type STOREKIT_VERSION = (typeof STOREKIT_VERSION)[keyof typeof STOREKIT_VERSION];
|
|
37
|
+
/** JWS / signed-response verification status. RC parity. */
|
|
38
|
+
export declare const VERIFICATION_RESULT: {
|
|
39
|
+
readonly NOT_REQUESTED: "NOT_REQUESTED";
|
|
40
|
+
readonly VERIFIED: "VERIFIED";
|
|
41
|
+
readonly FAILED: "FAILED";
|
|
42
|
+
readonly VERIFIED_ON_DEVICE: "VERIFIED_ON_DEVICE";
|
|
43
|
+
};
|
|
44
|
+
export type VERIFICATION_RESULT = (typeof VERIFICATION_RESULT)[keyof typeof VERIFICATION_RESULT];
|
|
45
|
+
/**
|
|
46
|
+
* Public error-code catalog. Values are string-numeric ("0", "1", "10", …)
|
|
47
|
+
* so they match what RC's TS package previously emitted. The native bridges
|
|
48
|
+
* `reject(code, ...)` with these stringified numeric codes and the JS mapper
|
|
49
|
+
* picks them up by string compare — DO NOT renumber.
|
|
50
|
+
*
|
|
51
|
+
* Code → name mapping is the RC catalog the platform-native sealed classes
|
|
52
|
+
* already mirror (see `PurchasesError.kt`/`Types.swift`). New codes go at the
|
|
53
|
+
* end, never reorder.
|
|
54
|
+
*/
|
|
55
|
+
export declare const PURCHASES_ERROR_CODE: {
|
|
56
|
+
readonly UNKNOWN_ERROR: "0";
|
|
57
|
+
readonly PURCHASE_CANCELLED_ERROR: "1";
|
|
58
|
+
readonly STORE_PROBLEM_ERROR: "2";
|
|
59
|
+
readonly PURCHASE_NOT_ALLOWED_ERROR: "3";
|
|
60
|
+
readonly PURCHASE_INVALID_ERROR: "4";
|
|
61
|
+
readonly PRODUCT_NOT_AVAILABLE_FOR_PURCHASE_ERROR: "5";
|
|
62
|
+
readonly PRODUCT_ALREADY_PURCHASED_ERROR: "6";
|
|
63
|
+
readonly RECEIPT_ALREADY_IN_USE_ERROR: "7";
|
|
64
|
+
readonly INVALID_RECEIPT_ERROR: "8";
|
|
65
|
+
readonly MISSING_RECEIPT_FILE_ERROR: "9";
|
|
66
|
+
readonly NETWORK_ERROR: "10";
|
|
67
|
+
readonly INVALID_CREDENTIALS_ERROR: "11";
|
|
68
|
+
readonly UNEXPECTED_BACKEND_RESPONSE_ERROR: "12";
|
|
69
|
+
readonly RECEIPT_IN_USE_BY_OTHER_SUBSCRIBER_ERROR: "13";
|
|
70
|
+
readonly INVALID_APP_USER_ID_ERROR: "14";
|
|
71
|
+
readonly OPERATION_ALREADY_IN_PROGRESS_ERROR: "15";
|
|
72
|
+
readonly UNKNOWN_BACKEND_ERROR: "16";
|
|
73
|
+
readonly INVALID_APPLE_SUBSCRIPTION_KEY_ERROR: "17";
|
|
74
|
+
readonly INELIGIBLE_ERROR: "18";
|
|
75
|
+
readonly INSUFFICIENT_PERMISSIONS_ERROR: "19";
|
|
76
|
+
readonly PAYMENT_PENDING_ERROR: "20";
|
|
77
|
+
readonly INVALID_SUBSCRIBER_ATTRIBUTES_ERROR: "21";
|
|
78
|
+
readonly LOG_OUT_ANONYMOUS_USER_ERROR: "22";
|
|
79
|
+
readonly CONFIGURATION_ERROR: "23";
|
|
80
|
+
readonly UNSUPPORTED_ERROR: "24";
|
|
81
|
+
readonly EMPTY_SUBSCRIBER_ATTRIBUTES_ERROR: "25";
|
|
82
|
+
readonly CUSTOMER_INFO_ERROR: "28";
|
|
83
|
+
};
|
|
84
|
+
export type PURCHASES_ERROR_CODE = (typeof PURCHASES_ERROR_CODE)[keyof typeof PURCHASES_ERROR_CODE];
|
|
85
|
+
/**
|
|
86
|
+
* Thrown by `Purchases.<method>()` when called before `Purchases.configure(...)`.
|
|
87
|
+
* Matches the name + shape of RC's `UninitializedPurchasesError` so callers
|
|
88
|
+
* catching by class name keep working.
|
|
89
|
+
*/
|
|
90
|
+
export declare class UninitializedPurchasesError extends Error {
|
|
91
|
+
constructor(message?: string);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Thrown when an API is called on an unsupported platform (e.g. web). Kept
|
|
95
|
+
* for source compatibility with RC.
|
|
96
|
+
*/
|
|
97
|
+
export declare class UnsupportedPlatformError extends Error {
|
|
98
|
+
constructor(message?: string);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Plain-object error contract used on callback args and rejected promises.
|
|
102
|
+
* NOT an Error subclass — RC surfaces this as a value, not something thrown
|
|
103
|
+
* as a JS Error. Promise rejections from the native bridge come through as
|
|
104
|
+
* `Error` objects whose `code` and `message` fields match this shape.
|
|
105
|
+
*/
|
|
106
|
+
export interface PurchasesError {
|
|
107
|
+
code: PURCHASES_ERROR_CODE;
|
|
108
|
+
message: string;
|
|
109
|
+
underlyingErrorMessage?: string;
|
|
110
|
+
readableErrorCode?: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Per-entitlement state. Field names match RC's `PurchasesEntitlementInfo`
|
|
114
|
+
* 1:1; populated by the native bridge from our own `EntitlementInfo` Swift /
|
|
115
|
+
* Kotlin types (see `packages/swiss-knife-{ios,android}`).
|
|
116
|
+
*
|
|
117
|
+
* Dates are ISO-8601 strings on the wire — JS doesn't get a native `Date`
|
|
118
|
+
* across the RN bridge.
|
|
119
|
+
*/
|
|
120
|
+
export interface PurchasesEntitlementInfo {
|
|
121
|
+
identifier: string;
|
|
122
|
+
isActive: boolean;
|
|
123
|
+
willRenew: boolean;
|
|
124
|
+
latestPurchaseDate: string;
|
|
125
|
+
/** ms-since-epoch convenience field; some RC consumers grep for `_millis`. */
|
|
126
|
+
latestPurchaseDateMillis: number;
|
|
127
|
+
originalPurchaseDate: string | null;
|
|
128
|
+
originalPurchaseDateMillis: number | null;
|
|
129
|
+
expirationDate: string | null;
|
|
130
|
+
expirationDateMillis: number | null;
|
|
131
|
+
productIdentifier: string;
|
|
132
|
+
productPlanIdentifier: string | null;
|
|
133
|
+
isSandbox: boolean;
|
|
134
|
+
unsubscribeDetectedAt: string | null;
|
|
135
|
+
unsubscribeDetectedAtMillis: number | null;
|
|
136
|
+
billingIssueDetectedAt: string | null;
|
|
137
|
+
billingIssueDetectedAtMillis: number | null;
|
|
138
|
+
periodType: "NORMAL" | "INTRO" | "TRIAL" | "PREPAID";
|
|
139
|
+
store: "APP_STORE" | "MAC_APP_STORE" | "PLAY_STORE" | "STRIPE" | "PROMOTIONAL" | "AMAZON" | "RUSTORE" | "UNKNOWN_STORE";
|
|
140
|
+
ownershipType: "PURCHASED" | "FAMILY_SHARED" | "UNKNOWN";
|
|
141
|
+
verification: VERIFICATION_RESULT;
|
|
142
|
+
}
|
|
143
|
+
/** All entitlements the user has ever owned + the currently-active subset. */
|
|
144
|
+
export interface PurchasesEntitlementInfos {
|
|
145
|
+
all: {
|
|
146
|
+
[key: string]: PurchasesEntitlementInfo;
|
|
147
|
+
};
|
|
148
|
+
active: {
|
|
149
|
+
[key: string]: PurchasesEntitlementInfo;
|
|
150
|
+
};
|
|
151
|
+
verification: VERIFICATION_RESULT;
|
|
152
|
+
}
|
|
153
|
+
/** Subscription-only state per product (renewal status, period, etc.). */
|
|
154
|
+
export interface PurchasesSubscriptionInfo {
|
|
155
|
+
productIdentifier: string;
|
|
156
|
+
purchaseDate: string | null;
|
|
157
|
+
originalPurchaseDate: string | null;
|
|
158
|
+
expiresDate: string | null;
|
|
159
|
+
store: PurchasesEntitlementInfo["store"];
|
|
160
|
+
unsubscribeDetectedAt: string | null;
|
|
161
|
+
isSandbox: boolean;
|
|
162
|
+
billingIssuesDetectedAt: string | null;
|
|
163
|
+
gracePeriodExpiresDate: string | null;
|
|
164
|
+
ownershipType: PurchasesEntitlementInfo["ownershipType"];
|
|
165
|
+
periodType: PurchasesEntitlementInfo["periodType"];
|
|
166
|
+
refundedAt: string | null;
|
|
167
|
+
storeTransactionId: string | null;
|
|
168
|
+
isActive: boolean;
|
|
169
|
+
willRenew: boolean;
|
|
170
|
+
}
|
|
171
|
+
/** One non-subscription IAP transaction (consumable/non-consumable). */
|
|
172
|
+
export interface PurchasesStoreTransaction {
|
|
173
|
+
productIdentifier: string;
|
|
174
|
+
revenueCatId: string;
|
|
175
|
+
purchaseDate: string;
|
|
176
|
+
/** Raw store transaction id (App Store `transactionIdentifier` or Play `orderId`). */
|
|
177
|
+
storeTransactionId: string;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Top-level user-level state, populated from our own `CustomerInfo` types on
|
|
181
|
+
* the native side. Field names track RC's `CustomerInfo` shape.
|
|
182
|
+
*/
|
|
183
|
+
export interface CustomerInfo {
|
|
184
|
+
entitlements: PurchasesEntitlementInfos;
|
|
185
|
+
/** Active entitlement identifiers — convenience accessor. */
|
|
186
|
+
activeSubscriptions: string[];
|
|
187
|
+
allPurchasedProductIdentifiers: string[];
|
|
188
|
+
/** Product id → most recent purchase date (ISO-8601). */
|
|
189
|
+
allPurchaseDates: {
|
|
190
|
+
[key: string]: string | null;
|
|
191
|
+
};
|
|
192
|
+
/** Per-product subscription info, keyed by product id. */
|
|
193
|
+
subscriptionsByProductIdentifier: {
|
|
194
|
+
[key: string]: PurchasesSubscriptionInfo;
|
|
195
|
+
};
|
|
196
|
+
/** Non-subscription IAPs (consumables, one-time non-consumables). */
|
|
197
|
+
nonSubscriptionTransactions: PurchasesStoreTransaction[];
|
|
198
|
+
firstSeen: string;
|
|
199
|
+
/** ms-since-epoch convenience field. */
|
|
200
|
+
firstSeenMillis: number;
|
|
201
|
+
originalAppUserId: string;
|
|
202
|
+
requestDate: string;
|
|
203
|
+
requestDateMillis: number;
|
|
204
|
+
latestExpirationDate: string | null;
|
|
205
|
+
latestExpirationDateMillis: number | null;
|
|
206
|
+
originalPurchaseDate: string | null;
|
|
207
|
+
originalPurchaseDateMillis: number | null;
|
|
208
|
+
originalApplicationVersion: string | null;
|
|
209
|
+
managementURL: string | null;
|
|
210
|
+
}
|
|
211
|
+
/** Localized price + currency on a store product. Mirror of RC's `PurchasesStoreProductPrice`. */
|
|
212
|
+
export interface PurchasesStoreProductPrice {
|
|
213
|
+
/** Pre-formatted, localized price string from the store. */
|
|
214
|
+
formatted: string;
|
|
215
|
+
/** Numeric amount in the smallest unit of the currency. */
|
|
216
|
+
amountMicros: number;
|
|
217
|
+
/** ISO-4217 currency code. */
|
|
218
|
+
currencyCode: string;
|
|
219
|
+
}
|
|
220
|
+
/** Subscription period on a store product. */
|
|
221
|
+
export interface PurchasesSubscriptionPeriod {
|
|
222
|
+
unit: "DAY" | "WEEK" | "MONTH" | "YEAR";
|
|
223
|
+
value: number;
|
|
224
|
+
}
|
|
225
|
+
/** Intro / promotional offer on a store product. */
|
|
226
|
+
export interface PurchasesStoreProductDiscount {
|
|
227
|
+
identifier: string | null;
|
|
228
|
+
price: number;
|
|
229
|
+
priceString: string;
|
|
230
|
+
cycles: number;
|
|
231
|
+
period: PurchasesSubscriptionPeriod;
|
|
232
|
+
periodUnit: PurchasesSubscriptionPeriod["unit"];
|
|
233
|
+
periodNumberOfUnits: number;
|
|
234
|
+
}
|
|
235
|
+
/** One store product (subscription or non-subscription). */
|
|
236
|
+
export interface PurchasesStoreProduct {
|
|
237
|
+
identifier: string;
|
|
238
|
+
title: string;
|
|
239
|
+
description: string;
|
|
240
|
+
priceString: string;
|
|
241
|
+
price: number;
|
|
242
|
+
currencyCode: string;
|
|
243
|
+
productCategory: "SUBSCRIPTION" | "NON_SUBSCRIPTION";
|
|
244
|
+
productType: "AUTO_RENEWABLE_SUBSCRIPTION" | "NON_RENEWABLE_SUBSCRIPTION" | "NON_CONSUMABLE" | "CONSUMABLE" | "UNKNOWN";
|
|
245
|
+
subscriptionPeriod: string | null;
|
|
246
|
+
defaultOption: string | null;
|
|
247
|
+
subscriptionOptions: unknown[] | null;
|
|
248
|
+
presentedOfferingContext: PresentedOfferingContext | null;
|
|
249
|
+
introPrice: PurchasesStoreProductDiscount | null;
|
|
250
|
+
discounts: PurchasesStoreProductDiscount[] | null;
|
|
251
|
+
pricePerWeek: PurchasesStoreProductPrice | null;
|
|
252
|
+
pricePerMonth: PurchasesStoreProductPrice | null;
|
|
253
|
+
pricePerYear: PurchasesStoreProductPrice | null;
|
|
254
|
+
pricePerWeekString: string | null;
|
|
255
|
+
pricePerMonthString: string | null;
|
|
256
|
+
pricePerYearString: string | null;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* The offering / package / target context surfaced when a package is presented.
|
|
260
|
+
* `targetingContext` is RC-server-driven A/B test metadata; preserved for parity.
|
|
261
|
+
*/
|
|
262
|
+
export interface PresentedOfferingContext {
|
|
263
|
+
offeringIdentifier: string;
|
|
264
|
+
placementIdentifier: string | null;
|
|
265
|
+
targetingContext: {
|
|
266
|
+
revision: number;
|
|
267
|
+
ruleId: string;
|
|
268
|
+
} | null;
|
|
269
|
+
}
|
|
270
|
+
/** A purchasable package inside an offering. */
|
|
271
|
+
export interface PurchasesPackage {
|
|
272
|
+
identifier: string;
|
|
273
|
+
packageType: PACKAGE_TYPE;
|
|
274
|
+
product: PurchasesStoreProduct;
|
|
275
|
+
presentedOfferingContext: PresentedOfferingContext;
|
|
276
|
+
/** RC legacy: same as `presentedOfferingContext.offeringIdentifier`. */
|
|
277
|
+
offeringIdentifier: string;
|
|
278
|
+
}
|
|
279
|
+
/** A named group of packages — a paywall variant. */
|
|
280
|
+
export interface PurchasesOffering {
|
|
281
|
+
identifier: string;
|
|
282
|
+
serverDescription: string;
|
|
283
|
+
metadata: {
|
|
284
|
+
[key: string]: unknown;
|
|
285
|
+
};
|
|
286
|
+
availablePackages: PurchasesPackage[];
|
|
287
|
+
lifetime: PurchasesPackage | null;
|
|
288
|
+
annual: PurchasesPackage | null;
|
|
289
|
+
sixMonth: PurchasesPackage | null;
|
|
290
|
+
threeMonth: PurchasesPackage | null;
|
|
291
|
+
twoMonth: PurchasesPackage | null;
|
|
292
|
+
monthly: PurchasesPackage | null;
|
|
293
|
+
weekly: PurchasesPackage | null;
|
|
294
|
+
paywall: unknown | null;
|
|
295
|
+
paywallComponents: unknown | null;
|
|
296
|
+
}
|
|
297
|
+
/** Top-level offerings container. */
|
|
298
|
+
export interface PurchasesOfferings {
|
|
299
|
+
all: {
|
|
300
|
+
[key: string]: PurchasesOffering;
|
|
301
|
+
};
|
|
302
|
+
current: PurchasesOffering | null;
|
|
303
|
+
}
|
|
304
|
+
/** Returned by `Purchases.logIn(appUserID)`. */
|
|
305
|
+
export interface LogInResult {
|
|
306
|
+
customerInfo: CustomerInfo;
|
|
307
|
+
/** Whether the backend treated this as a brand-new user record. */
|
|
308
|
+
created: boolean;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Immutable snapshot of the current identity. Mirrors
|
|
312
|
+
* `SwissKnife.Identity.Snapshot` (iOS) and
|
|
313
|
+
* `com.appswissknife.identity.Identity.Snapshot` (Android).
|
|
314
|
+
*
|
|
315
|
+
* The `anonymousId` carries the unified `$SKAnonymousID:` prefix as of
|
|
316
|
+
* Wave 1 (was `$RCAnonymousID:` on Android pre-Wave-1).
|
|
317
|
+
*/
|
|
318
|
+
export interface IdentitySnapshot {
|
|
319
|
+
anonymousId: string;
|
|
320
|
+
userId: string | null;
|
|
321
|
+
isAnonymous: boolean;
|
|
322
|
+
}
|
|
323
|
+
/** Delivered to `Identity.addObserver` callbacks on every transition. */
|
|
324
|
+
export interface IdentityChange {
|
|
325
|
+
previous: IdentitySnapshot;
|
|
326
|
+
current: IdentitySnapshot;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Resolved attribution for the install. Mirrors
|
|
330
|
+
* `SwissKnife.Attribution.ResolvedAttribution` (iOS) and
|
|
331
|
+
* `Attribution.ResolvedAttribution` (Android).
|
|
332
|
+
*/
|
|
333
|
+
export interface ResolvedAttribution {
|
|
334
|
+
/** One of `"advertising_id" | "referrer" | "fingerprint" | "organic"`. */
|
|
335
|
+
method: string;
|
|
336
|
+
/** Backend campaign id when the install matched a campaign; `null` otherwise. */
|
|
337
|
+
campaignId: string | null;
|
|
338
|
+
/** Epoch milliseconds when the SDK persisted the resolution. */
|
|
339
|
+
resolvedAt: number;
|
|
340
|
+
}
|
|
341
|
+
/** Returned by `Purchases.purchasePackage(...)` / `purchaseStoreProduct(...)`. */
|
|
342
|
+
export interface MakePurchaseResult {
|
|
343
|
+
productIdentifier: string;
|
|
344
|
+
customerInfo: CustomerInfo;
|
|
345
|
+
transaction: PurchasesStoreTransaction | null;
|
|
346
|
+
}
|
|
347
|
+
/** Options accepted by `Purchases.configure(...)`. Mirror of `PurchasesConfiguration`. */
|
|
348
|
+
export interface PurchasesConfiguration {
|
|
349
|
+
apiKey: string;
|
|
350
|
+
appUserID?: string | null;
|
|
351
|
+
/** Override the backend host — primarily used in our own configuration to point at our backend rather than RC's. */
|
|
352
|
+
proxyURL?: string | null;
|
|
353
|
+
/** Whether to phone home diagnostics. DEFAULTS TO FALSE in our SDK. */
|
|
354
|
+
diagnosticsEnabled?: boolean;
|
|
355
|
+
storeKitVersion?: STOREKIT_VERSION;
|
|
356
|
+
/**
|
|
357
|
+
* iOS App Tracking Transparency. When `true`, the SDK shows the system ATT
|
|
358
|
+
* prompt on first launch (requires `NSUserTrackingUsageDescription` in
|
|
359
|
+
* Info.plist). **Defaults to `false`** — the SDK never prompts for tracking
|
|
360
|
+
* unless you opt in. iOS-only; ignored on Android.
|
|
361
|
+
*/
|
|
362
|
+
autoPromptATT?: boolean;
|
|
363
|
+
/**
|
|
364
|
+
* Register an organic install on first launch (no IDFA, no prompt) so
|
|
365
|
+
* attribution still resolves without ATT. Default `true`. iOS-only.
|
|
366
|
+
*/
|
|
367
|
+
sendInstallOnFirstLaunch?: boolean;
|
|
368
|
+
/** Reserved for the Amazon flavor — ignored on iOS / Play Android. */
|
|
369
|
+
useAmazon?: boolean;
|
|
370
|
+
/** Reserved for the legacy bridge; ignored. */
|
|
371
|
+
usesStoreKit2IfAvailable?: boolean;
|
|
372
|
+
/** RC-shim — kept so configs the consumer copied from RC docs still compile. */
|
|
373
|
+
userDefaultsSuiteName?: string;
|
|
374
|
+
shouldShowInAppMessagesAutomatically?: boolean;
|
|
375
|
+
entitlementVerificationMode?: string;
|
|
376
|
+
pendingTransactionsForPrepaidPlansEnabled?: boolean;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Callback signature for `Purchases.addCustomerInfoUpdateListener(fn)`. Fires
|
|
380
|
+
* on every CustomerInfo refresh (post-purchase, post-restore, dashboard-grant
|
|
381
|
+
* silent-push, etc.).
|
|
382
|
+
*/
|
|
383
|
+
export type CustomerInfoUpdateListener = (customerInfo: CustomerInfo) => void;
|
|
384
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAmCA;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;CAMZ,CAAC;AACX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAEnE,sEAAsE;AACtE,eAAO,MAAM,YAAY;;;;;;;;;;CAUf,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAE5E;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;;CAInB,CAAC;AACX,MAAM,MAAM,gBAA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,IAAI,CAAC;IACzB,uEAAuE;IACvE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,gBAAgB,CAAC;IACnC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,sEAAsE;IACtE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,+CAA+C;IAC/C,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,gFAAgF;IAChF,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,oCAAoC,CAAC,EAAE,OAAO,CAAC;IAC/C,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,yCAAyC,CAAC,EAAE,OAAO,CAAC;CACrD;AAID;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@app-swiss-knife/react-native-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Subscriptions-only React Native SDK for App Swiss Knife — a drop-in replacement for RevenueCat's react-native-purchases public API.",
|
|
5
|
+
"source": "./src/index.ts",
|
|
6
|
+
"main": "./lib/commonjs/index.js",
|
|
7
|
+
"module": "./lib/module/index.js",
|
|
8
|
+
"types": "./lib/typescript/commonjs/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"react-native": "./lib/module/index.js",
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./lib/typescript/module/index.d.ts",
|
|
14
|
+
"default": "./lib/module/index.js"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./lib/typescript/commonjs/index.d.ts",
|
|
18
|
+
"default": "./lib/commonjs/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json",
|
|
22
|
+
"./*": {
|
|
23
|
+
"react-native": "./lib/module/*.js",
|
|
24
|
+
"import": {
|
|
25
|
+
"types": "./lib/typescript/module/*.d.ts",
|
|
26
|
+
"default": "./lib/module/*.js"
|
|
27
|
+
},
|
|
28
|
+
"require": {
|
|
29
|
+
"types": "./lib/typescript/commonjs/*.d.ts",
|
|
30
|
+
"default": "./lib/commonjs/*.js"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"src",
|
|
36
|
+
"lib",
|
|
37
|
+
"android",
|
|
38
|
+
"ios",
|
|
39
|
+
"SwissKnifePurchases.podspec",
|
|
40
|
+
"react-native.config.js",
|
|
41
|
+
"README.md",
|
|
42
|
+
"!**/__tests__",
|
|
43
|
+
"!**/*.test.ts",
|
|
44
|
+
"!**/*.test.tsx",
|
|
45
|
+
"!**/*.spec.ts",
|
|
46
|
+
"!**/*.spec.tsx",
|
|
47
|
+
"!src/react-native.d.ts",
|
|
48
|
+
"!android/src/test",
|
|
49
|
+
"!**/*.tsbuildinfo"
|
|
50
|
+
],
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"@react-native-async-storage/async-storage": ">=1.19.0",
|
|
53
|
+
"react": ">=18.0.0",
|
|
54
|
+
"react-native": ">=0.73.0"
|
|
55
|
+
},
|
|
56
|
+
"peerDependenciesMeta": {
|
|
57
|
+
"@react-native-async-storage/async-storage": {
|
|
58
|
+
"optional": true
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@types/react": "~19.2.2",
|
|
63
|
+
"react-native-builder-bob": "^0.43.0",
|
|
64
|
+
"typescript": "^5.0.0",
|
|
65
|
+
"vitest": "^4.1.6"
|
|
66
|
+
},
|
|
67
|
+
"publishConfig": {
|
|
68
|
+
"access": "public"
|
|
69
|
+
},
|
|
70
|
+
"react-native-builder-bob": {
|
|
71
|
+
"source": "src",
|
|
72
|
+
"output": "lib",
|
|
73
|
+
"exclude": "**/{__tests__/**,__fixtures__/**,__mocks__/**,*.test.ts,*.test.tsx,*.spec.ts,*.spec.tsx,*.d.ts}",
|
|
74
|
+
"targets": [
|
|
75
|
+
[
|
|
76
|
+
"commonjs",
|
|
77
|
+
{
|
|
78
|
+
"esm": true
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
[
|
|
82
|
+
"module",
|
|
83
|
+
{
|
|
84
|
+
"esm": true
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
[
|
|
88
|
+
"typescript",
|
|
89
|
+
{
|
|
90
|
+
"project": "tsconfig.build.json"
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
"license": "MIT",
|
|
96
|
+
"repository": {
|
|
97
|
+
"type": "git",
|
|
98
|
+
"url": "https://github.com/Remneys/swiss-knife",
|
|
99
|
+
"directory": "packages/react-native-sdk"
|
|
100
|
+
},
|
|
101
|
+
"keywords": [
|
|
102
|
+
"react-native",
|
|
103
|
+
"sdk",
|
|
104
|
+
"subscriptions",
|
|
105
|
+
"in-app-purchases",
|
|
106
|
+
"revenuecat-compatible"
|
|
107
|
+
],
|
|
108
|
+
"scripts": {
|
|
109
|
+
"typecheck": "tsc --noEmit",
|
|
110
|
+
"test": "vitest run",
|
|
111
|
+
"clean": "node -e \"for (const d of ['lib','ios/vendor','android/vendor']) require('fs').rmSync(d,{recursive:true,force:true})\"",
|
|
112
|
+
"vendor:native": "node scripts/vendor-native.mjs",
|
|
113
|
+
"build": "node scripts/vendor-native.mjs && bob build"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Pin Android autolinking to the single, correctly-qualified ReactPackage.
|
|
2
|
+
//
|
|
3
|
+
// The package ships two ReactPackage classes in different sub-packages
|
|
4
|
+
// (com.swissknife.purchases.SwissKnifePurchasesPackage and
|
|
5
|
+
// com.swissknife.crashreporting.SKCrashReportingPackage). RN autolinking wires
|
|
6
|
+
// only ONE package per dependency and derives its FQN from the AndroidManifest
|
|
7
|
+
// namespace (com.swissknife.purchases) — which mis-qualifies the crash package
|
|
8
|
+
// as com.swissknife.purchases.SKCrashReportingPackage (does not exist) and fails
|
|
9
|
+
// the Java compile of the generated PackageList.
|
|
10
|
+
//
|
|
11
|
+
// We pin the core package by its correct FQN; it now registers BOTH native
|
|
12
|
+
// modules (see SwissKnifePurchasesPackage.createNativeModules). iOS is left to
|
|
13
|
+
// auto-detect (modules self-register via RCT_EXPORT_MODULE), so no ios key here.
|
|
14
|
+
module.exports = {
|
|
15
|
+
dependency: {
|
|
16
|
+
platforms: {
|
|
17
|
+
android: {
|
|
18
|
+
packageImportPath: 'import com.swissknife.purchases.SwissKnifePurchasesPackage;',
|
|
19
|
+
packageInstance: 'new SwissKnifePurchasesPackage()',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// packages/react-native-sdk/src/attribution.ts
|
|
2
|
+
//
|
|
3
|
+
// Wave 2 — unified Attribution JS surface. Mirror of
|
|
4
|
+
// `SwissKnife.Attribution` (iOS, Swift) and
|
|
5
|
+
// `com.appswissknife.attribution.Attribution` (Android, Kotlin). All
|
|
6
|
+
// logic lives natively — this module is a thin passthrough.
|
|
7
|
+
//
|
|
8
|
+
// Why JS doesn't keep its own state
|
|
9
|
+
// ---------------------------------
|
|
10
|
+
// Same rationale as Identity: native is the single source of truth for
|
|
11
|
+
// the resolved attribution. JS reads via `resolved()` (cached snapshot
|
|
12
|
+
// from the native disk-backed cache) and writes via
|
|
13
|
+
// `requestAndRegister()` or `registerInstall(...)`. Idempotency lives
|
|
14
|
+
// natively — a second JS call to `registerInstall(...)` returns the
|
|
15
|
+
// cached value from the native cache without a second POST.
|
|
16
|
+
//
|
|
17
|
+
// ATT prompt orchestration is iOS-only and happens natively. JS callers
|
|
18
|
+
// just await `requestAndRegister()` — the native side handles
|
|
19
|
+
// `ATTrackingManager` (iOS) or the no-op Android path.
|
|
20
|
+
|
|
21
|
+
import { getNativeModule } from "./native/module";
|
|
22
|
+
import type { ResolvedAttribution } from "./types";
|
|
23
|
+
|
|
24
|
+
export const Attribution = {
|
|
25
|
+
/**
|
|
26
|
+
* The most recent resolved attribution from the native disk-backed
|
|
27
|
+
* cache. Returns `null` when no install POST has succeeded yet.
|
|
28
|
+
* Cheap — does not hit the network.
|
|
29
|
+
*/
|
|
30
|
+
async resolved(): Promise<ResolvedAttribution | null> {
|
|
31
|
+
return getNativeModule().attributionResolved();
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Auto-collect (ATT prompt + IDFA on iOS; advertising_id +
|
|
36
|
+
* install_referrer on Android) and POST `/api/sdk/attribution/install`.
|
|
37
|
+
* Idempotent — second call returns the cached resolution WITHOUT
|
|
38
|
+
* re-prompting or re-POSTing.
|
|
39
|
+
*/
|
|
40
|
+
async requestAndRegister(): Promise<ResolvedAttribution | null> {
|
|
41
|
+
return getNativeModule().attributionRequestAndRegister();
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Manual install registration for hosts that prompt for tracking
|
|
46
|
+
* consent themselves or collect the advertising id outside the SDK.
|
|
47
|
+
* Pass `null` when consent was denied. Idempotent.
|
|
48
|
+
*/
|
|
49
|
+
async registerInstall(
|
|
50
|
+
advertisingId?: string | null,
|
|
51
|
+
): Promise<ResolvedAttribution | null> {
|
|
52
|
+
return getNativeModule().attributionRegisterInstall(advertisingId ?? null);
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export type { ResolvedAttribution } from "./types";
|