@encorekit/react-native 1.1.15
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 +201 -0
- package/android/build.gradle +80 -0
- package/android/gradle.properties +11 -0
- package/android/src/main/AndroidManifest.xml +9 -0
- package/android/src/main/java/com/encorereactsdk/EncoreReactSDKModule.kt +216 -0
- package/android/src/main/java/com/encorereactsdk/EncoreReactSDKPackage.kt +22 -0
- package/encore-react-sdk.podspec +24 -0
- package/ios/EncoreReactSDK-Bridging-Header.h +7 -0
- package/ios/EncoreReactSDK.m +42 -0
- package/ios/EncoreReactSDK.swift +229 -0
- package/lib/commonjs/hooks.js +38 -0
- package/lib/commonjs/hooks.js.map +1 -0
- package/lib/commonjs/index.js +87 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/hooks.js +29 -0
- package/lib/module/hooks.js.map +1 -0
- package/lib/module/index.js +69 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/src/hooks.d.ts +11 -0
- package/lib/typescript/src/hooks.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +77 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +168 -0
- package/src/hooks.tsx +38 -0
- package/src/index.ts +147 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
// EncoreReactSDK.swift
|
|
2
|
+
// iOS bridge — delegates all calls to the native encore-swift-sdk.
|
|
3
|
+
|
|
4
|
+
import Foundation
|
|
5
|
+
import Encore
|
|
6
|
+
|
|
7
|
+
@objc(EncoreReactSDK)
|
|
8
|
+
class EncoreReactSDK: RCTEventEmitter {
|
|
9
|
+
|
|
10
|
+
private var hasListeners = false
|
|
11
|
+
private var currentContinuation: CheckedContinuation<Void, Error>?
|
|
12
|
+
private let lock = NSLock()
|
|
13
|
+
|
|
14
|
+
@objc
|
|
15
|
+
override static func requiresMainQueueSetup() -> Bool {
|
|
16
|
+
return true
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
override func supportedEvents() -> [String] {
|
|
20
|
+
return ["onPurchaseRequest", "onPurchaseComplete", "onPassthrough"]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
override func startObserving() {
|
|
24
|
+
hasListeners = true
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
override func stopObserving() {
|
|
28
|
+
hasListeners = false
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// MARK: - Configuration
|
|
32
|
+
|
|
33
|
+
@objc
|
|
34
|
+
func configure(_ apiKey: String,
|
|
35
|
+
options: NSDictionary,
|
|
36
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
37
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
38
|
+
DispatchQueue.main.async {
|
|
39
|
+
let logLevel: Encore.LogLevel
|
|
40
|
+
if let opts = options as? [String: Any],
|
|
41
|
+
let levelStr = opts["logLevel"] as? String {
|
|
42
|
+
switch levelStr {
|
|
43
|
+
case "error": logLevel = .error
|
|
44
|
+
case "warn": logLevel = .warn
|
|
45
|
+
case "info": logLevel = .info
|
|
46
|
+
case "debug": logLevel = .debug
|
|
47
|
+
default: logLevel = .none
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
logLevel = .none
|
|
51
|
+
}
|
|
52
|
+
Encore.shared.configure(apiKey: apiKey, logLevel: logLevel)
|
|
53
|
+
resolve(["success": true])
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// MARK: - User Identity
|
|
58
|
+
|
|
59
|
+
@objc
|
|
60
|
+
func identify(_ userId: String,
|
|
61
|
+
attributes: NSDictionary?,
|
|
62
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
63
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
64
|
+
let attrs = Self.parseAttributes(attributes)
|
|
65
|
+
Encore.shared.identify(userId: userId, attributes: attrs)
|
|
66
|
+
resolve(["success": true])
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@objc
|
|
70
|
+
func setUserAttributes(_ attributes: NSDictionary,
|
|
71
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
72
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
73
|
+
let attrs = Self.parseAttributes(attributes)
|
|
74
|
+
if let attrs {
|
|
75
|
+
Encore.shared.setUserAttributes(attrs)
|
|
76
|
+
}
|
|
77
|
+
resolve(["success": true])
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@objc
|
|
81
|
+
func reset(_ resolve: @escaping RCTPromiseResolveBlock,
|
|
82
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
83
|
+
cancelStalePurchase()
|
|
84
|
+
Encore.shared.reset()
|
|
85
|
+
resolve(["success": true])
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// MARK: - Claim Control
|
|
89
|
+
|
|
90
|
+
@objc
|
|
91
|
+
func setClaimEnabled(_ enabled: Bool,
|
|
92
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
93
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
94
|
+
Encore.shared.placements.isClaimEnabled = enabled
|
|
95
|
+
resolve(["success": true])
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// MARK: - Offers
|
|
99
|
+
|
|
100
|
+
@objc
|
|
101
|
+
func show(_ placementId: String,
|
|
102
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
103
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
104
|
+
cancelStalePurchase()
|
|
105
|
+
Task {
|
|
106
|
+
do {
|
|
107
|
+
let result = try await Encore.placement(placementId).show()
|
|
108
|
+
switch result {
|
|
109
|
+
case .granted(let entitlement):
|
|
110
|
+
resolve(["status": "granted", "entitlement": "\(entitlement)"])
|
|
111
|
+
case .notGranted(let reason):
|
|
112
|
+
resolve(["status": "not_granted", "reason": reason.rawValue])
|
|
113
|
+
}
|
|
114
|
+
} catch {
|
|
115
|
+
reject("SHOW_FAILED", error.localizedDescription, error)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// MARK: - Callbacks
|
|
121
|
+
|
|
122
|
+
@objc
|
|
123
|
+
func registerCallbacks(_ resolve: @escaping RCTPromiseResolveBlock,
|
|
124
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
125
|
+
Encore.shared
|
|
126
|
+
.onPurchaseRequest { [weak self] request in
|
|
127
|
+
guard let self = self else { return }
|
|
128
|
+
|
|
129
|
+
self.cancelStalePurchase()
|
|
130
|
+
|
|
131
|
+
try await withCheckedThrowingContinuation { (continuation: CheckedContinuation<Void, Error>) in
|
|
132
|
+
self.lock.lock()
|
|
133
|
+
self.currentContinuation = continuation
|
|
134
|
+
self.lock.unlock()
|
|
135
|
+
|
|
136
|
+
if self.hasListeners {
|
|
137
|
+
self.sendEvent(withName: "onPurchaseRequest", body: [
|
|
138
|
+
"productId": request.productId,
|
|
139
|
+
"placementId": request.placementId as Any,
|
|
140
|
+
"promoOfferId": request.promoOfferId as Any,
|
|
141
|
+
])
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
.onPurchaseComplete { [weak self] transaction, productId in
|
|
146
|
+
guard let self = self, self.hasListeners else { return }
|
|
147
|
+
self.sendEvent(withName: "onPurchaseComplete", body: [
|
|
148
|
+
"productId": productId,
|
|
149
|
+
"transactionId": "\(transaction.id)",
|
|
150
|
+
])
|
|
151
|
+
}
|
|
152
|
+
.onPassthrough { [weak self] placementId in
|
|
153
|
+
guard let self = self, self.hasListeners else { return }
|
|
154
|
+
self.sendEvent(withName: "onPassthrough", body: [
|
|
155
|
+
"placementId": placementId as Any,
|
|
156
|
+
])
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
resolve(["success": true])
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
@objc
|
|
163
|
+
func completePurchaseRequest(_ success: Bool,
|
|
164
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
165
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
166
|
+
lock.lock()
|
|
167
|
+
let continuation = currentContinuation
|
|
168
|
+
currentContinuation = nil
|
|
169
|
+
lock.unlock()
|
|
170
|
+
|
|
171
|
+
if let continuation {
|
|
172
|
+
if success {
|
|
173
|
+
continuation.resume()
|
|
174
|
+
} else {
|
|
175
|
+
continuation.resume(throwing: NSError(
|
|
176
|
+
domain: "EncoreReactSDK",
|
|
177
|
+
code: -2,
|
|
178
|
+
userInfo: [NSLocalizedDescriptionKey: "Purchase failed by JS handler"]
|
|
179
|
+
))
|
|
180
|
+
}
|
|
181
|
+
resolve(["success": true])
|
|
182
|
+
} else {
|
|
183
|
+
resolve(["success": false, "error": "No pending purchase request"])
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// MARK: - Internal
|
|
188
|
+
|
|
189
|
+
private func cancelStalePurchase() {
|
|
190
|
+
lock.lock()
|
|
191
|
+
let stale = currentContinuation
|
|
192
|
+
currentContinuation = nil
|
|
193
|
+
lock.unlock()
|
|
194
|
+
|
|
195
|
+
stale?.resume(throwing: NSError(
|
|
196
|
+
domain: "EncoreReactSDK",
|
|
197
|
+
code: -3,
|
|
198
|
+
userInfo: [NSLocalizedDescriptionKey: "Superseded by new SDK action"]
|
|
199
|
+
))
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// MARK: - Helpers
|
|
203
|
+
|
|
204
|
+
private static func parseAttributes(_ dict: NSDictionary?) -> UserAttributes? {
|
|
205
|
+
guard let dict = dict as? [String: Any] else { return nil }
|
|
206
|
+
return UserAttributes(
|
|
207
|
+
email: dict["email"] as? String,
|
|
208
|
+
firstName: dict["firstName"] as? String,
|
|
209
|
+
lastName: dict["lastName"] as? String,
|
|
210
|
+
phoneNumber: dict["phoneNumber"] as? String,
|
|
211
|
+
postalCode: dict["postalCode"] as? String,
|
|
212
|
+
city: dict["city"] as? String,
|
|
213
|
+
state: dict["state"] as? String,
|
|
214
|
+
countryCode: dict["countryCode"] as? String,
|
|
215
|
+
latitude: dict["latitude"] as? String,
|
|
216
|
+
longitude: dict["longitude"] as? String,
|
|
217
|
+
dateOfBirth: dict["dateOfBirth"] as? String,
|
|
218
|
+
gender: dict["gender"] as? String,
|
|
219
|
+
language: dict["language"] as? String,
|
|
220
|
+
subscriptionTier: dict["subscriptionTier"] as? String,
|
|
221
|
+
monthsSubscribed: dict["monthsSubscribed"] as? String,
|
|
222
|
+
billingCycle: dict["billingCycle"] as? String,
|
|
223
|
+
lastPaymentAmount: dict["lastPaymentAmount"] as? String,
|
|
224
|
+
lastActiveDate: dict["lastActiveDate"] as? String,
|
|
225
|
+
totalSessions: dict["totalSessions"] as? String,
|
|
226
|
+
custom: dict["custom"] as? [String: String] ?? [:]
|
|
227
|
+
)
|
|
228
|
+
}
|
|
229
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EncoreProvider = EncoreProvider;
|
|
7
|
+
exports.useEncoreContext = useEncoreContext;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _index = _interopRequireDefault(require("./index"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
|
+
const EncoreContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
13
|
+
function EncoreProvider({
|
|
14
|
+
apiKey,
|
|
15
|
+
options,
|
|
16
|
+
children
|
|
17
|
+
}) {
|
|
18
|
+
const initialized = (0, _react.useRef)(false);
|
|
19
|
+
if (!initialized.current) {
|
|
20
|
+
initialized.current = true;
|
|
21
|
+
// Fire synchronously during render so configure() lands on the native side
|
|
22
|
+
// before any child useEffect can call identify()/show().
|
|
23
|
+
// The native configure() is synchronous — the Promise is just bridge overhead.
|
|
24
|
+
_index.default.configure(apiKey, options);
|
|
25
|
+
_index.default.registerCallbacks();
|
|
26
|
+
}
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement(EncoreContext.Provider, {
|
|
28
|
+
value: _index.default
|
|
29
|
+
}, children);
|
|
30
|
+
}
|
|
31
|
+
function useEncoreContext() {
|
|
32
|
+
const context = (0, _react.useContext)(EncoreContext);
|
|
33
|
+
if (!context) {
|
|
34
|
+
throw new Error('useEncoreContext must be used within an EncoreProvider');
|
|
35
|
+
}
|
|
36
|
+
return context;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_index","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","EncoreContext","createContext","EncoreProvider","apiKey","options","children","initialized","useRef","current","Encore","configure","registerCallbacks","createElement","Provider","value","useEncoreContext","context","useContext","Error"],"sourceRoot":"../../src","sources":["hooks.tsx"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA6B,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,C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AAW,CAACE,OAAO,GAAG,IAAI;IAC1B;IACA;IACA;IACAC,cAAM,CAACC,SAAS,CAACP,MAAM,EAAEC,OAAO,CAAC;IACjCK,cAAM,CAACE,iBAAiB,CAAC,CAAC;EAC5B;EAEA,oBACEnC,MAAA,CAAAO,OAAA,CAAA6B,aAAA,CAACZ,aAAa,CAACa,QAAQ;IAACC,KAAK,EAAEL;EAAO,GACnCJ,QACqB,CAAC;AAE7B;AAEO,SAASU,gBAAgBA,CAAA,EAAc;EAC5C,MAAMC,OAAO,GAAG,IAAAC,iBAAU,EAACjB,aAAa,CAAC;EACzC,IAAI,CAACgB,OAAO,EAAE;IACZ,MAAM,IAAIE,KAAK,CAAC,wDAAwD,CAAC;EAC3E;EACA,OAAOF,OAAO;AAChB","ignoreList":[]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "EncoreProvider", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _hooks.EncoreProvider;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports.default = void 0;
|
|
13
|
+
Object.defineProperty(exports, "useEncoreContext", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _hooks.useEncoreContext;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
var _reactNative = require("react-native");
|
|
20
|
+
var _hooks = require("./hooks");
|
|
21
|
+
// Encore React Native SDK
|
|
22
|
+
// Bridge-only layer — delegates to native SDKs on each platform.
|
|
23
|
+
// iOS: encore-swift-sdk | Android: encore-android-sdk
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
EncoreReactSDK
|
|
27
|
+
} = _reactNative.NativeModules;
|
|
28
|
+
if (!EncoreReactSDK) {
|
|
29
|
+
throw new Error(`EncoreReactSDK native module not found. Ensure the native ${_reactNative.Platform.OS} SDK is properly linked.`);
|
|
30
|
+
}
|
|
31
|
+
const encoreEmitter = new _reactNative.NativeEventEmitter(EncoreReactSDK);
|
|
32
|
+
async function safeBridgeCall(method, call, fallback) {
|
|
33
|
+
try {
|
|
34
|
+
return await call();
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.warn(`[Encore] ${method} failed:`, error);
|
|
37
|
+
return fallback;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// -- Types --
|
|
42
|
+
|
|
43
|
+
// -- SDK Interface --
|
|
44
|
+
|
|
45
|
+
// -- Typed Export --
|
|
46
|
+
|
|
47
|
+
const Encore = {
|
|
48
|
+
configure: (apiKey, options = {}) => safeBridgeCall('configure', () => EncoreReactSDK.configure(apiKey, options), {
|
|
49
|
+
success: false
|
|
50
|
+
}),
|
|
51
|
+
identify: (userId, attributes) => safeBridgeCall('identify', () => EncoreReactSDK.identify(userId, attributes ?? null), {
|
|
52
|
+
success: false
|
|
53
|
+
}),
|
|
54
|
+
setUserAttributes: attributes => safeBridgeCall('setUserAttributes', () => EncoreReactSDK.setUserAttributes(attributes), {
|
|
55
|
+
success: false
|
|
56
|
+
}),
|
|
57
|
+
reset: () => safeBridgeCall('reset', () => EncoreReactSDK.reset(), {
|
|
58
|
+
success: false
|
|
59
|
+
}),
|
|
60
|
+
show: placementId => safeBridgeCall('show', () => EncoreReactSDK.show(placementId), {
|
|
61
|
+
status: 'not_granted',
|
|
62
|
+
reason: 'sdk_error'
|
|
63
|
+
}),
|
|
64
|
+
setClaimEnabled: enabled => safeBridgeCall('setClaimEnabled', () => EncoreReactSDK.setClaimEnabled(enabled), {
|
|
65
|
+
success: false
|
|
66
|
+
}),
|
|
67
|
+
registerCallbacks: () => safeBridgeCall('registerCallbacks', () => EncoreReactSDK.registerCallbacks(), {
|
|
68
|
+
success: false
|
|
69
|
+
}),
|
|
70
|
+
completePurchaseRequest: success => safeBridgeCall('completePurchaseRequest', () => EncoreReactSDK.completePurchaseRequest(success), {
|
|
71
|
+
success: false
|
|
72
|
+
}),
|
|
73
|
+
onPurchaseRequest: handler => {
|
|
74
|
+
const subscription = encoreEmitter.addListener('onPurchaseRequest', handler);
|
|
75
|
+
return () => subscription.remove();
|
|
76
|
+
},
|
|
77
|
+
onPurchaseComplete: handler => {
|
|
78
|
+
const subscription = encoreEmitter.addListener('onPurchaseComplete', handler);
|
|
79
|
+
return () => subscription.remove();
|
|
80
|
+
},
|
|
81
|
+
onPassthrough: handler => {
|
|
82
|
+
const subscription = encoreEmitter.addListener('onPassthrough', handler);
|
|
83
|
+
return () => subscription.remove();
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
var _default = exports.default = Encore;
|
|
87
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_hooks","EncoreReactSDK","NativeModules","Error","Platform","OS","encoreEmitter","NativeEventEmitter","safeBridgeCall","method","call","fallback","error","console","warn","Encore","configure","apiKey","options","success","identify","userId","attributes","setUserAttributes","reset","show","placementId","status","reason","setClaimEnabled","enabled","registerCallbacks","completePurchaseRequest","onPurchaseRequest","handler","subscription","addListener","remove","onPurchaseComplete","onPassthrough","_default","exports","default"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;AAIA,IAAAA,YAAA,GAAAC,OAAA;AA8IA,IAAAC,MAAA,GAAAD,OAAA;AAlJA;AACA;AACA;;AAIA,MAAM;EAAEE;AAAe,CAAC,GAAGC,0BAAa;AAExC,IAAI,CAACD,cAAc,EAAE;EACnB,MAAM,IAAIE,KAAK,CACb,6DAA6DC,qBAAQ,CAACC,EAAE,0BAC1E,CAAC;AACH;AAEA,MAAMC,aAAa,GAAG,IAAIC,+BAAkB,CAACN,cAAc,CAAC;AAE5D,eAAeO,cAAcA,CAC3BC,MAAc,EACdC,IAAsB,EACtBC,QAAW,EACC;EACZ,IAAI;IACF,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C;EAEtGY,iBAAiB,EAAEA,CAAA,KACjBvB,cAAc,CAAC,mBAAmB,EAAE,MAAMP,cAAc,CAAC8B,iBAAiB,CAAC,CAAC,EAAE;IAAEZ,OAAO,EAAE;EAAM,CAAC,CAAC;EAEnGa,uBAAuB,EAAGb,OAAO,IAC/BX,cAAc,CAAC,yBAAyB,EAAE,MAAMP,cAAc,CAAC+B,uBAAuB,CAACb,OAAO,CAAC,EAAE;IAAEA,OAAO,EAAE;EAAM,CAAC,CAAC;EAEtHc,iBAAiB,EAAGC,OAAO,IAAK;IAC9B,MAAMC,YAAY,GAAG7B,aAAa,CAAC8B,WAAW,CAAC,mBAAmB,EAAEF,OAAO,CAAC;IAC5E,OAAO,MAAMC,YAAY,CAACE,MAAM,CAAC,CAAC;EACpC,CAAC;EAEDC,kBAAkB,EAAGJ,OAAO,IAAK;IAC/B,MAAMC,YAAY,GAAG7B,aAAa,CAAC8B,WAAW,CAAC,oBAAoB,EAAEF,OAAO,CAAC;IAC7E,OAAO,MAAMC,YAAY,CAACE,MAAM,CAAC,CAAC;EACpC,CAAC;EAEDE,aAAa,EAAGL,OAAO,IAAK;IAC1B,MAAMC,YAAY,GAAG7B,aAAa,CAAC8B,WAAW,CAAC,eAAe,EAAEF,OAAO,CAAC;IACxE,OAAO,MAAMC,YAAY,CAACE,MAAM,CAAC,CAAC;EACpC;AACF,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa3B,MAAM","ignoreList":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { createContext, useContext, useRef } from 'react';
|
|
2
|
+
import Encore from './index';
|
|
3
|
+
const EncoreContext = /*#__PURE__*/createContext(null);
|
|
4
|
+
export function EncoreProvider({
|
|
5
|
+
apiKey,
|
|
6
|
+
options,
|
|
7
|
+
children
|
|
8
|
+
}) {
|
|
9
|
+
const initialized = useRef(false);
|
|
10
|
+
if (!initialized.current) {
|
|
11
|
+
initialized.current = true;
|
|
12
|
+
// Fire synchronously during render so configure() lands on the native side
|
|
13
|
+
// before any child useEffect can call identify()/show().
|
|
14
|
+
// The native configure() is synchronous — the Promise is just bridge overhead.
|
|
15
|
+
Encore.configure(apiKey, options);
|
|
16
|
+
Encore.registerCallbacks();
|
|
17
|
+
}
|
|
18
|
+
return /*#__PURE__*/React.createElement(EncoreContext.Provider, {
|
|
19
|
+
value: Encore
|
|
20
|
+
}, children);
|
|
21
|
+
}
|
|
22
|
+
export function useEncoreContext() {
|
|
23
|
+
const context = useContext(EncoreContext);
|
|
24
|
+
if (!context) {
|
|
25
|
+
throw new Error('useEncoreContext must be used within an EncoreProvider');
|
|
26
|
+
}
|
|
27
|
+
return context;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","createContext","useContext","useRef","Encore","EncoreContext","EncoreProvider","apiKey","options","children","initialized","current","configure","registerCallbacks","createElement","Provider","value","useEncoreContext","context","Error"],"sourceRoot":"../../src","sources":["hooks.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,UAAU,EAAEC,MAAM,QAAQ,OAAO;AAChE,OAAOC,MAAM,MAAM,SAAS;AAG5B,MAAMC,aAAa,gBAAGJ,aAAa,CAAmB,IAAI,CAAC;AAQ3D,OAAO,SAASK,cAAcA,CAAC;EAAEC,MAAM;EAAEC,OAAO;EAAEC;AAA8B,CAAC,EAAE;EACjF,MAAMC,WAAW,GAAGP,MAAM,CAAC,KAAK,CAAC;EAEjC,IAAI,CAACO,WAAW,CAACC,OAAO,EAAE;IACxBD,WAAW,CAACC,OAAO,GAAG,IAAI;IAC1B;IACA;IACA;IACAP,MAAM,CAACQ,SAAS,CAACL,MAAM,EAAEC,OAAO,CAAC;IACjCJ,MAAM,CAACS,iBAAiB,CAAC,CAAC;EAC5B;EAEA,oBACEb,KAAA,CAAAc,aAAA,CAACT,aAAa,CAACU,QAAQ;IAACC,KAAK,EAAEZ;EAAO,GACnCK,QACqB,CAAC;AAE7B;AAEA,OAAO,SAASQ,gBAAgBA,CAAA,EAAc;EAC5C,MAAMC,OAAO,GAAGhB,UAAU,CAACG,aAAa,CAAC;EACzC,IAAI,CAACa,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,wDAAwD,CAAC;EAC3E;EACA,OAAOD,OAAO;AAChB","ignoreList":[]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Encore React Native SDK
|
|
2
|
+
// Bridge-only layer — delegates to native SDKs on each platform.
|
|
3
|
+
// iOS: encore-swift-sdk | Android: encore-android-sdk
|
|
4
|
+
|
|
5
|
+
import { NativeModules, NativeEventEmitter, Platform } from 'react-native';
|
|
6
|
+
const {
|
|
7
|
+
EncoreReactSDK
|
|
8
|
+
} = NativeModules;
|
|
9
|
+
if (!EncoreReactSDK) {
|
|
10
|
+
throw new Error(`EncoreReactSDK native module not found. Ensure the native ${Platform.OS} SDK is properly linked.`);
|
|
11
|
+
}
|
|
12
|
+
const encoreEmitter = new NativeEventEmitter(EncoreReactSDK);
|
|
13
|
+
async function safeBridgeCall(method, call, fallback) {
|
|
14
|
+
try {
|
|
15
|
+
return await call();
|
|
16
|
+
} catch (error) {
|
|
17
|
+
console.warn(`[Encore] ${method} failed:`, error);
|
|
18
|
+
return fallback;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// -- Types --
|
|
23
|
+
|
|
24
|
+
// -- SDK Interface --
|
|
25
|
+
|
|
26
|
+
// -- Typed Export --
|
|
27
|
+
|
|
28
|
+
const Encore = {
|
|
29
|
+
configure: (apiKey, options = {}) => safeBridgeCall('configure', () => EncoreReactSDK.configure(apiKey, options), {
|
|
30
|
+
success: false
|
|
31
|
+
}),
|
|
32
|
+
identify: (userId, attributes) => safeBridgeCall('identify', () => EncoreReactSDK.identify(userId, attributes ?? null), {
|
|
33
|
+
success: false
|
|
34
|
+
}),
|
|
35
|
+
setUserAttributes: attributes => safeBridgeCall('setUserAttributes', () => EncoreReactSDK.setUserAttributes(attributes), {
|
|
36
|
+
success: false
|
|
37
|
+
}),
|
|
38
|
+
reset: () => safeBridgeCall('reset', () => EncoreReactSDK.reset(), {
|
|
39
|
+
success: false
|
|
40
|
+
}),
|
|
41
|
+
show: placementId => safeBridgeCall('show', () => EncoreReactSDK.show(placementId), {
|
|
42
|
+
status: 'not_granted',
|
|
43
|
+
reason: 'sdk_error'
|
|
44
|
+
}),
|
|
45
|
+
setClaimEnabled: enabled => safeBridgeCall('setClaimEnabled', () => EncoreReactSDK.setClaimEnabled(enabled), {
|
|
46
|
+
success: false
|
|
47
|
+
}),
|
|
48
|
+
registerCallbacks: () => safeBridgeCall('registerCallbacks', () => EncoreReactSDK.registerCallbacks(), {
|
|
49
|
+
success: false
|
|
50
|
+
}),
|
|
51
|
+
completePurchaseRequest: success => safeBridgeCall('completePurchaseRequest', () => EncoreReactSDK.completePurchaseRequest(success), {
|
|
52
|
+
success: false
|
|
53
|
+
}),
|
|
54
|
+
onPurchaseRequest: handler => {
|
|
55
|
+
const subscription = encoreEmitter.addListener('onPurchaseRequest', handler);
|
|
56
|
+
return () => subscription.remove();
|
|
57
|
+
},
|
|
58
|
+
onPurchaseComplete: handler => {
|
|
59
|
+
const subscription = encoreEmitter.addListener('onPurchaseComplete', handler);
|
|
60
|
+
return () => subscription.remove();
|
|
61
|
+
},
|
|
62
|
+
onPassthrough: handler => {
|
|
63
|
+
const subscription = encoreEmitter.addListener('onPassthrough', handler);
|
|
64
|
+
return () => subscription.remove();
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
export default Encore;
|
|
68
|
+
export { EncoreProvider, useEncoreContext } from './hooks';
|
|
69
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModules","NativeEventEmitter","Platform","EncoreReactSDK","Error","OS","encoreEmitter","safeBridgeCall","method","call","fallback","error","console","warn","Encore","configure","apiKey","options","success","identify","userId","attributes","setUserAttributes","reset","show","placementId","status","reason","setClaimEnabled","enabled","registerCallbacks","completePurchaseRequest","onPurchaseRequest","handler","subscription","addListener","remove","onPurchaseComplete","onPassthrough","EncoreProvider","useEncoreContext"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,aAAa,EAAEC,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAE1E,MAAM;EAAEC;AAAe,CAAC,GAAGH,aAAa;AAExC,IAAI,CAACG,cAAc,EAAE;EACnB,MAAM,IAAIC,KAAK,CACb,6DAA6DF,QAAQ,CAACG,EAAE,0BAC1E,CAAC;AACH;AAEA,MAAMC,aAAa,GAAG,IAAIL,kBAAkB,CAACE,cAAc,CAAC;AAE5D,eAAeI,cAAcA,CAC3BC,MAAc,EACdC,IAAsB,EACtBC,QAAW,EACC;EACZ,IAAI;IACF,OAAO,MAAMD,IAAI,CAAC,CAAC;EACrB,CAAC,CAAC,OAAOE,KAAK,EAAE;IACdC,OAAO,CAACC,IAAI,CAAC,YAAYL,MAAM,UAAU,EAAEG,KAAK,CAAC;IACjD,OAAOD,QAAQ;EACjB;AACF;;AAEA;;AAsDA;;AAgBA;;AAEA,MAAMI,MAAiB,GAAG;EACxBC,SAAS,EAAEA,CAACC,MAAM,EAAEC,OAAO,GAAG,CAAC,CAAC,KAC9BV,cAAc,CAAC,WAAW,EAAE,MAAMJ,cAAc,CAACY,SAAS,CAACC,MAAM,EAAEC,OAAO,CAAC,EAAE;IAAEC,OAAO,EAAE;EAAM,CAAC,CAAC;EAElGC,QAAQ,EAAEA,CAACC,MAAM,EAAEC,UAAU,KAC3Bd,cAAc,CAAC,UAAU,EAAE,MAAMJ,cAAc,CAACgB,QAAQ,CAACC,MAAM,EAAEC,UAAU,IAAI,IAAI,CAAC,EAAE;IAAEH,OAAO,EAAE;EAAM,CAAC,CAAC;EAE3GI,iBAAiB,EAAGD,UAAU,IAC5Bd,cAAc,CAAC,mBAA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EACpC,CAAC;EAEDE,aAAa,EAAGL,OAAO,IAAK;IAC1B,MAAMC,YAAY,GAAG5B,aAAa,CAAC6B,WAAW,CAAC,eAAe,EAAEF,OAAO,CAAC;IACxE,OAAO,MAAMC,YAAY,CAACE,MAAM,CAAC,CAAC;EACpC;AACF,CAAC;AAED,eAAetB,MAAM;AACrB,SAASyB,cAAc,EAAEC,gBAAgB,QAAQ,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ConfigureOptions, EncoreSDK } from './index';
|
|
3
|
+
interface EncoreProviderProps {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
options?: ConfigureOptions;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare function EncoreProvider({ apiKey, options, children }: EncoreProviderProps): React.JSX.Element;
|
|
9
|
+
export declare function useEncoreContext(): EncoreSDK;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAEjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAI3D,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,mBAAmB,qBAiBhF;AAED,wBAAgB,gBAAgB,IAAI,SAAS,CAM5C"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export interface UserAttributes {
|
|
2
|
+
email?: string;
|
|
3
|
+
firstName?: string;
|
|
4
|
+
lastName?: string;
|
|
5
|
+
phoneNumber?: string;
|
|
6
|
+
postalCode?: string;
|
|
7
|
+
city?: string;
|
|
8
|
+
state?: string;
|
|
9
|
+
countryCode?: string;
|
|
10
|
+
latitude?: string;
|
|
11
|
+
longitude?: string;
|
|
12
|
+
dateOfBirth?: string;
|
|
13
|
+
gender?: string;
|
|
14
|
+
language?: string;
|
|
15
|
+
subscriptionTier?: string;
|
|
16
|
+
monthsSubscribed?: string;
|
|
17
|
+
billingCycle?: string;
|
|
18
|
+
lastPaymentAmount?: string;
|
|
19
|
+
lastActiveDate?: string;
|
|
20
|
+
totalSessions?: string;
|
|
21
|
+
custom?: Record<string, string>;
|
|
22
|
+
}
|
|
23
|
+
export interface ConfigureOptions {
|
|
24
|
+
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
25
|
+
}
|
|
26
|
+
export interface PlacementResult {
|
|
27
|
+
status: 'granted' | 'not_granted' | 'completed' | 'dismissed' | 'no_offers';
|
|
28
|
+
reason?: string;
|
|
29
|
+
entitlement?: string;
|
|
30
|
+
offerId?: string;
|
|
31
|
+
campaignId?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface PurchaseRequestEvent {
|
|
34
|
+
productId: string;
|
|
35
|
+
placementId?: string;
|
|
36
|
+
promoOfferId?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface PurchaseCompleteEvent {
|
|
39
|
+
productId: string;
|
|
40
|
+
transactionId?: string;
|
|
41
|
+
purchaseToken?: string;
|
|
42
|
+
orderId?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface PassthroughEvent {
|
|
45
|
+
placementId?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface EncoreSDK {
|
|
48
|
+
configure(apiKey: string, options?: ConfigureOptions): Promise<{
|
|
49
|
+
success: boolean;
|
|
50
|
+
}>;
|
|
51
|
+
identify(userId: string, attributes?: UserAttributes): Promise<{
|
|
52
|
+
success: boolean;
|
|
53
|
+
}>;
|
|
54
|
+
setUserAttributes(attributes: UserAttributes): Promise<{
|
|
55
|
+
success: boolean;
|
|
56
|
+
}>;
|
|
57
|
+
reset(): Promise<{
|
|
58
|
+
success: boolean;
|
|
59
|
+
}>;
|
|
60
|
+
show(placementId: string): Promise<PlacementResult>;
|
|
61
|
+
setClaimEnabled(enabled: boolean): Promise<{
|
|
62
|
+
success: boolean;
|
|
63
|
+
}>;
|
|
64
|
+
registerCallbacks(): Promise<{
|
|
65
|
+
success: boolean;
|
|
66
|
+
}>;
|
|
67
|
+
completePurchaseRequest(success: boolean): Promise<{
|
|
68
|
+
success: boolean;
|
|
69
|
+
}>;
|
|
70
|
+
onPurchaseRequest(handler: (event: PurchaseRequestEvent) => void): () => void;
|
|
71
|
+
onPurchaseComplete(handler: (event: PurchaseCompleteEvent) => void): () => void;
|
|
72
|
+
onPassthrough(handler: (event: PassthroughEvent) => void): () => void;
|
|
73
|
+
}
|
|
74
|
+
declare const Encore: EncoreSDK;
|
|
75
|
+
export default Encore;
|
|
76
|
+
export { EncoreProvider, useEncoreContext } from './hooks';
|
|
77
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AA+BA,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC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