@altcraft/react-native-sdk 0.0.1 → 0.0.3
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/LICENSE +20 -20
- package/README.md +5 -2
- package/android/build.gradle +2 -3
- package/android/src/main/java/com/altcraft/sdk/SdkModule.kt +493 -896
- package/android/src/main/java/com/altcraft/sdk/utilities/Converter.kt +326 -0
- package/android/src/main/java/com/altcraft/sdk/utilities/Extension.kt +72 -0
- package/ios/Converter.swift +640 -0
- package/ios/Sdk.h +4 -3
- package/ios/Sdk.mm +124 -370
- package/ios/SdkModule.swift +436 -653
- package/lib/module/NativeSdk.js +35 -0
- package/lib/module/NativeSdk.js.map +1 -1
- package/lib/module/Utilities.js +94 -0
- package/lib/module/Utilities.js.map +1 -0
- package/lib/module/index.js +180 -419
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NativeSdk.d.ts +117 -32
- package/lib/typescript/src/NativeSdk.d.ts.map +1 -1
- package/lib/typescript/src/Utilities.d.ts +15 -0
- package/lib/typescript/src/Utilities.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +113 -308
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/NativeSdk.ts +156 -46
- package/src/Utilities.ts +116 -0
- package/src/index.tsx +255 -483
- package/android/src/main/java/com/altcraft/sdk/interfaces/RnFCMProvider.kt +0 -27
- package/android/src/main/java/com/altcraft/sdk/interfaces/RnHMSProvider.kt +0 -32
- package/android/src/main/java/com/altcraft/sdk/interfaces/RnJWTProvider.kt +0 -21
- package/android/src/main/java/com/altcraft/sdk/interfaces/RnRustoreProvider.kt +0 -53
- package/ios/protocols/RNAPNSProvider.swift +0 -15
- package/ios/protocols/RNFCMProvider.swift +0 -24
- package/ios/protocols/RNHMSProvider.swift +0 -24
- package/ios/protocols/RNJWTProvider.swift +0 -15
|
@@ -1,367 +1,177 @@
|
|
|
1
|
-
import { type AltcraftConfig, type CategoryData, type ResponseWithHttpCode, type TokenData } from './NativeSdk';
|
|
2
|
-
/**
|
|
3
|
-
* SDK event payload emitted from the native layer via NativeEventEmitter.
|
|
4
|
-
*
|
|
5
|
-
* Native sources (conceptually):
|
|
6
|
-
* - Android (Kotlin): SDK Events module -> emits "AltcraftSdkEvent"
|
|
7
|
-
* - iOS (Swift): SDKEvents.shared -> bridge -> emits "AltcraftSdkEvent"
|
|
8
|
-
*
|
|
9
|
-
* Fields:
|
|
10
|
-
* - function: origin function/context name in the SDK
|
|
11
|
-
* - code: optional numeric code (HTTP/internal/etc.)
|
|
12
|
-
* - message: human-readable message
|
|
13
|
-
* - type: event category ("event" | "error" | "retryError")
|
|
14
|
-
* - value: optional extra data/context
|
|
15
|
-
*/
|
|
16
|
-
export type SdkEvent = {
|
|
17
|
-
function: string;
|
|
18
|
-
code: number | null;
|
|
19
|
-
message: string;
|
|
20
|
-
type: 'event' | 'error' | 'retryError';
|
|
21
|
-
value?: {
|
|
22
|
-
[key: string]: any;
|
|
23
|
-
} | null;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* JS-side abstraction for handling incoming push payloads.
|
|
27
|
-
*
|
|
28
|
-
* Native analogy:
|
|
29
|
-
* - Android: `AltcraftSDK.PushReceiver` + `PushReceiver.takePush(context, message)`
|
|
30
|
-
*
|
|
31
|
-
* In RN:
|
|
32
|
-
* - `takePush(...)` always forwards the payload to native (`NativeSdk.takePush`)
|
|
33
|
-
* - then optionally dispatches it to registered JS receivers (`PushReceiver`)
|
|
34
|
-
*
|
|
35
|
-
* This provides:
|
|
36
|
-
* - centralized forwarding to the Altcraft native SDK (parsing/internal flows)
|
|
37
|
-
* - optional additional JS-level handling (logging, routing, analytics, debugging)
|
|
38
|
-
*/
|
|
39
|
-
export declare abstract class PushReceiver {
|
|
40
|
-
/**
|
|
41
|
-
* Called when the JS facade receives a push payload.
|
|
42
|
-
*
|
|
43
|
-
* @param message Flat `Record<string, string>` (matches typical data payload shape).
|
|
44
|
-
*/
|
|
45
|
-
abstract pushHandler(message: {
|
|
46
|
-
[key: string]: string;
|
|
47
|
-
}): void;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Registers a JS receiver for incoming push payloads.
|
|
51
|
-
*
|
|
52
|
-
* Typically called once during app startup.
|
|
53
|
-
*
|
|
54
|
-
* @param receiver Implementation of `PushReceiver`.
|
|
55
|
-
*/
|
|
56
|
-
export declare function registerPushReceiver(receiver: PushReceiver): void;
|
|
57
|
-
/**
|
|
58
|
-
* Clears all registered push receivers.
|
|
59
|
-
*
|
|
60
|
-
* Useful for tests or reinitializing the integration layer.
|
|
61
|
-
*/
|
|
62
|
-
export declare function clearPushReceivers(): void;
|
|
63
|
-
/**
|
|
64
|
-
* Forwards an incoming push payload to the native Altcraft SDK and then to JS receivers.
|
|
65
|
-
*
|
|
66
|
-
* Native analogy:
|
|
67
|
-
* - Android: `AltcraftSDK.PushReceiver.takePush(context, message)`
|
|
68
|
-
*
|
|
69
|
-
* Important:
|
|
70
|
-
* - This method does NOT intercept notifications by itself.
|
|
71
|
-
* Platform-level interception must be implemented separately:
|
|
72
|
-
* - Android: FCM/HMS service -> call `takePush(message.data)`
|
|
73
|
-
* - iOS: AppDelegate / UNUserNotificationCenter / Notification Service Extension -> call `takePush(userInfo)`
|
|
74
|
-
*
|
|
75
|
-
* @param message Flat push payload map. Empty payloads are ignored.
|
|
76
|
-
*/
|
|
77
|
-
export declare function takePush(message: {
|
|
78
|
-
[key: string]: string;
|
|
79
|
-
}): void;
|
|
80
|
-
/**
|
|
81
|
-
* Subscribes to Altcraft SDK events and starts streaming them from native to JS.
|
|
82
|
-
*
|
|
83
|
-
* Contract:
|
|
84
|
-
* - If a previous subscription exists, it is removed.
|
|
85
|
-
* - Calls `NativeSdk.subscribeToEvents()` so the native side starts emitting events.
|
|
86
|
-
*
|
|
87
|
-
* @param handler JS handler invoked for each SDK event.
|
|
88
|
-
*/
|
|
89
|
-
export declare function subscribeToEvents(handler: (event: SdkEvent) => void): void;
|
|
90
|
-
/**
|
|
91
|
-
* Unsubscribes from Altcraft SDK events.
|
|
92
|
-
*
|
|
93
|
-
* Behavior:
|
|
94
|
-
* - removes the JS listener
|
|
95
|
-
* - calls `NativeSdk.unsubscribeFromEvent()` to stop native emissions
|
|
96
|
-
*/
|
|
97
|
-
export declare function unsubscribeFromEvent(): void;
|
|
1
|
+
import { type AltcraftConfig, type CategoryData, type ResponseWithHttpCode, type TokenData, type EmailSubscription, type SmsSubscription, type PushSubscription, type CcDataSubscription, type Subscription, type UTM, type SdkEvent } from './NativeSdk';
|
|
98
2
|
/**
|
|
99
3
|
* Initializes the Altcraft SDK.
|
|
100
4
|
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* Promise:
|
|
106
|
-
* - resolves on success
|
|
107
|
-
*
|
|
108
|
-
* ⚠️ Can throw (reject):
|
|
109
|
-
* - configuration mapping/validation errors on native side
|
|
110
|
-
* - native initialization failure (e.g. missing required fields, internal init error)
|
|
111
|
-
*
|
|
112
|
-
* @param config SDK configuration (apiUrl is required).
|
|
5
|
+
* @param config SDK configuration.
|
|
6
|
+
* `apiUrl` is required.
|
|
7
|
+
* Other fields are optional and depend on platform features.
|
|
8
|
+
* @returns Promise that resolves on successful initialization.
|
|
113
9
|
*/
|
|
114
10
|
export declare function initialize(config: AltcraftConfig): Promise<void>;
|
|
115
11
|
/**
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* Native concept:
|
|
119
|
-
* - Android/iOS register a JWT provider; RN uses an internal provider backed by this token.
|
|
120
|
-
*
|
|
121
|
-
* Semantics:
|
|
122
|
-
* - token === null -> clear JWT provider/token
|
|
123
|
-
* - token !== null -> store token and enable provider
|
|
12
|
+
* Sends a push subscribe request.
|
|
124
13
|
*
|
|
125
|
-
* @param
|
|
14
|
+
* @param sync Execution mode:
|
|
15
|
+
* `true` — sends a synchronous request to the server and returns
|
|
16
|
+
* the result of the operation execution.
|
|
17
|
+
* `false` — sends an asynchronous request and returns
|
|
18
|
+
* the result of task enqueueing on the server.
|
|
19
|
+
* `null` — native default behavior.
|
|
20
|
+
* @param profileFields Optional profile fields to attach to the request.
|
|
21
|
+
* @param customFields Optional custom fields to attach to the request.
|
|
22
|
+
* @param cats Optional categories list.
|
|
23
|
+
* @param replace Optional flag to replace an existing subscription.
|
|
24
|
+
* @param skipTriggers Optional flag to skip trigger execution on the server.
|
|
126
25
|
*/
|
|
127
|
-
export declare function
|
|
26
|
+
export declare function pushSubscribe(sync?: boolean | null, profileFields?: Record<string, unknown> | null, customFields?: Record<string, unknown> | null, cats?: CategoryData[] | null, replace?: boolean | null, skipTriggers?: boolean | null): void;
|
|
128
27
|
/**
|
|
129
|
-
*
|
|
28
|
+
* Sends a push suspend request.
|
|
130
29
|
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* @param
|
|
30
|
+
* @param sync Execution mode (see {@link pushSubscribe}).
|
|
31
|
+
* @param profileFields Optional profile fields.
|
|
32
|
+
* @param customFields Optional custom fields.
|
|
33
|
+
* @param cats Optional categories list.
|
|
34
|
+
* @param replace Optional flag to replace an existing subscription.
|
|
35
|
+
* @param skipTriggers Optional flag to skip trigger execution on the server.
|
|
136
36
|
*/
|
|
137
|
-
export declare function
|
|
37
|
+
export declare function pushSuspend(sync?: boolean | null, profileFields?: Record<string, unknown> | null, customFields?: Record<string, unknown> | null, cats?: CategoryData[] | null, replace?: boolean | null, skipTriggers?: boolean | null): void;
|
|
138
38
|
/**
|
|
139
|
-
*
|
|
39
|
+
* Sends a push unsubscribe request.
|
|
140
40
|
*
|
|
141
|
-
* @param
|
|
41
|
+
* @param sync Execution mode (see {@link pushSubscribe}).
|
|
42
|
+
* @param profileFields Optional profile fields.
|
|
43
|
+
* @param customFields Optional custom fields.
|
|
44
|
+
* @param cats Optional categories list.
|
|
45
|
+
* @param replace Optional flag to replace an existing subscription.
|
|
46
|
+
* @param skipTriggers Optional flag to skip trigger execution on the server.
|
|
142
47
|
*/
|
|
143
|
-
export declare function
|
|
48
|
+
export declare function pushUnSubscribe(sync?: boolean | null, profileFields?: Record<string, unknown> | null, customFields?: Record<string, unknown> | null, cats?: CategoryData[] | null, replace?: boolean | null, skipTriggers?: boolean | null): void;
|
|
144
49
|
/**
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
* @param token HMS token or null.
|
|
148
|
-
*/
|
|
149
|
-
export declare function setAndroidHmsToken(token: string | null): void;
|
|
150
|
-
/**
|
|
151
|
-
* iOS-only: kept for API symmetry (may be a no-op on other platforms).
|
|
152
|
-
*
|
|
153
|
-
* @param token iOS HMS token or null.
|
|
154
|
-
*/
|
|
155
|
-
export declare function setIosHmsToken(token: string | null): void;
|
|
156
|
-
/**
|
|
157
|
-
* iOS-only: sets the APNs token (usually forwarded from AppDelegate).
|
|
158
|
-
*
|
|
159
|
-
* Note:
|
|
160
|
-
* - APNs token is commonly represented as a hex string on native side.
|
|
50
|
+
* Unsuspends push subscriptions based on native matching rules.
|
|
161
51
|
*
|
|
162
|
-
* @
|
|
52
|
+
* @returns Promise resolving to response with HTTP code or `null` if unavailable.
|
|
163
53
|
*/
|
|
164
|
-
export declare function
|
|
165
|
-
/**
|
|
166
|
-
* Android-only: sets the RuStore token.
|
|
167
|
-
*
|
|
168
|
-
* @param token RuStore token or null.
|
|
169
|
-
*/
|
|
170
|
-
export declare function setRustoreToken(token: string | null): void;
|
|
171
|
-
/**
|
|
172
|
-
* Performs a push subscribe request.
|
|
173
|
-
*
|
|
174
|
-
* Notes:
|
|
175
|
-
* - fire-and-forget: results/errors are delivered via the SDK Events stream
|
|
176
|
-
* - `sync` is forwarded to the SDK/server semantics
|
|
177
|
-
*/
|
|
178
|
-
export declare function pushSubscribe(sync?: boolean | null, profileFields?: {
|
|
179
|
-
[key: string]: any;
|
|
180
|
-
} | null, customFields?: {
|
|
181
|
-
[key: string]: any;
|
|
182
|
-
} | null, cats?: CategoryData[] | null, replace?: boolean | null, skipTriggers?: boolean | null): void;
|
|
183
|
-
/**
|
|
184
|
-
* Suspends push notifications for the current profile/subscription.
|
|
185
|
-
*
|
|
186
|
-
* Same parameter semantics as `pushSubscribe`.
|
|
187
|
-
* Results/errors are delivered via the SDK Events stream.
|
|
188
|
-
*/
|
|
189
|
-
export declare function pushSuspend(sync?: boolean | null, profileFields?: {
|
|
190
|
-
[key: string]: any;
|
|
191
|
-
} | null, customFields?: {
|
|
192
|
-
[key: string]: any;
|
|
193
|
-
} | null, cats?: CategoryData[] | null, replace?: boolean | null, skipTriggers?: boolean | null): void;
|
|
194
|
-
/**
|
|
195
|
-
* Performs a push unsubscribe request.
|
|
196
|
-
*
|
|
197
|
-
* Same parameter semantics as `pushSubscribe`.
|
|
198
|
-
* Results/errors are delivered via the SDK Events stream.
|
|
199
|
-
*/
|
|
200
|
-
export declare function pushUnSubscribe(sync?: boolean | null, profileFields?: {
|
|
201
|
-
[key: string]: any;
|
|
202
|
-
} | null, customFields?: {
|
|
203
|
-
[key: string]: any;
|
|
204
|
-
} | null, cats?: CategoryData[] | null, replace?: boolean | null, skipTriggers?: boolean | null): void;
|
|
54
|
+
export declare function unSuspendPushSubscription(): Promise<ResponseWithHttpCode | null>;
|
|
205
55
|
/**
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* ⚠️ Can throw (reject):
|
|
209
|
-
* - native validation failure (missing data to create request)
|
|
210
|
-
* - request creation/sending failures
|
|
211
|
-
* - unexpected native exceptions
|
|
56
|
+
* Returns the status of the latest subscription in profile.
|
|
212
57
|
*
|
|
213
|
-
* @returns
|
|
58
|
+
* @returns Promise resolving to response with HTTP code or `null` if unavailable.
|
|
214
59
|
*/
|
|
215
|
-
export declare function
|
|
60
|
+
export declare function getStatusOfLatestSubscription(): Promise<ResponseWithHttpCode | null>;
|
|
216
61
|
/**
|
|
217
|
-
* Returns the status of the
|
|
62
|
+
* Returns the status of the subscription matching the current push token and provider context.
|
|
218
63
|
*
|
|
219
|
-
*
|
|
64
|
+
* @returns Promise resolving to response with HTTP code or `null` if unavailable.
|
|
220
65
|
*/
|
|
221
|
-
export declare function
|
|
66
|
+
export declare function getStatusForCurrentSubscription(): Promise<ResponseWithHttpCode | null>;
|
|
222
67
|
/**
|
|
223
|
-
* Returns the status of the latest subscription for the
|
|
224
|
-
* If provider is null, native SDK may use the current provider (SDK-specific).
|
|
68
|
+
* Returns the status of the latest subscription for the given provider.
|
|
225
69
|
*
|
|
226
|
-
*
|
|
227
|
-
* - invalid provider
|
|
228
|
-
* - native request creation/sending failures
|
|
229
|
-
* - unexpected native exceptions
|
|
70
|
+
* If `provider` is `null`, native side may use the current provider context.
|
|
230
71
|
*
|
|
231
|
-
* @param provider
|
|
72
|
+
* @param provider Optional provider identifier (platform-dependent).
|
|
73
|
+
* @returns Promise resolving to response with HTTP code or `null` if unavailable.
|
|
232
74
|
*/
|
|
233
75
|
export declare function getStatusOfLatestSubscriptionForProvider(provider?: string | null): Promise<ResponseWithHttpCode | null>;
|
|
234
76
|
/**
|
|
235
|
-
* Returns the
|
|
236
|
-
* according to native SDK rules.
|
|
77
|
+
* Returns the current push token data from native side.
|
|
237
78
|
*
|
|
238
|
-
*
|
|
239
|
-
*/
|
|
240
|
-
export declare function getStatusForCurrentSubscription(): Promise<ResponseWithHttpCode | null>;
|
|
241
|
-
/**
|
|
242
|
-
* Returns the current push token selected/managed by the SDK.
|
|
243
|
-
*
|
|
244
|
-
* ⚠️ Can throw (reject) on unexpected native errors.
|
|
245
|
-
*
|
|
246
|
-
* May resolve `null` if token is not yet available or providers are not configured.
|
|
79
|
+
* @returns Promise resolving to token info or `null` if token is not available.
|
|
247
80
|
*/
|
|
248
81
|
export declare function getPushToken(): Promise<TokenData | null>;
|
|
249
82
|
/**
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
* ⚠️ Can throw (reject):
|
|
253
|
-
* - provider is null/invalid
|
|
254
|
-
* - native deletion flow fails
|
|
255
|
-
* - unexpected native exceptions
|
|
83
|
+
* Sets or clears the push token for a specific provider.
|
|
256
84
|
*
|
|
257
|
-
* @param provider Provider identifier (
|
|
85
|
+
* @param provider Provider identifier (e.g. platform push provider name).
|
|
86
|
+
* @param token Token string or `null` to clear.
|
|
87
|
+
* @returns Promise that resolves when the token is saved on native side.
|
|
258
88
|
*/
|
|
259
|
-
export declare function
|
|
89
|
+
export declare function setPushToken(provider: string, token: string | null): Promise<void>;
|
|
260
90
|
/**
|
|
261
|
-
*
|
|
91
|
+
* Clears SDK local state (native).
|
|
262
92
|
*
|
|
263
|
-
*
|
|
93
|
+
* @returns Promise that resolves after cleanup.
|
|
264
94
|
*/
|
|
265
|
-
export declare function
|
|
95
|
+
export declare function clear(): Promise<void>;
|
|
266
96
|
/**
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
* ⚠️ Can throw (reject):
|
|
270
|
-
* - invalid provider list (unknown identifiers)
|
|
271
|
-
* - native update flow failure
|
|
272
|
-
* - unexpected native exceptions
|
|
97
|
+
* Sends a mobile event to the server.
|
|
273
98
|
*
|
|
274
|
-
* @param
|
|
99
|
+
* @param sid Pixel identifier.
|
|
100
|
+
* @param eventName Event name.
|
|
101
|
+
* @param sendMessageId Optional message identifier to link the event.
|
|
102
|
+
* @param payload Optional event payload.
|
|
103
|
+
* @param matching Optional matching parameters.
|
|
104
|
+
* @param matchingType Optional matching mode/type.
|
|
105
|
+
* @param profileFields Optional profile fields.
|
|
106
|
+
* @param subscription Optional subscription info to attach (email/sms/push/cc_data).
|
|
107
|
+
* @param utm Optional UTM tags for attribution.
|
|
275
108
|
*/
|
|
276
|
-
export declare function
|
|
109
|
+
export declare function mobileEvent(sid: string, eventName: string, sendMessageId?: string | null, payload?: Record<string, unknown> | null, matching?: Record<string, unknown> | null, matchingType?: string | null, profileFields?: Record<string, unknown> | null, subscription?: Subscription | null, utm?: UTM | null): void;
|
|
277
110
|
/**
|
|
278
|
-
*
|
|
279
|
-
|
|
111
|
+
* Subscribes to native SDK events and routes them to the provided handler.
|
|
280
112
|
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
* - native set/delete flow fails
|
|
284
|
-
* - unexpected native exceptions
|
|
113
|
+
* The SDK emits events via `NativeEventEmitter` with name {@link ALTCRAFT_SDK_EVENT_NAME}.
|
|
114
|
+
* Calling this function multiple times replaces the previous JS listener.
|
|
285
115
|
*
|
|
286
|
-
* @param
|
|
287
|
-
*
|
|
116
|
+
* @param handler Callback invoked for each incoming SDK event.
|
|
117
|
+
* The event object is produced by native and follows {@link SdkEvent}.
|
|
288
118
|
*/
|
|
289
|
-
export declare function
|
|
119
|
+
export declare function subscribeToEvents(handler: (event: SdkEvent) => void): void;
|
|
290
120
|
/**
|
|
291
|
-
*
|
|
121
|
+
* Unsubscribes from native SDK events.
|
|
292
122
|
*
|
|
293
|
-
*
|
|
123
|
+
* Removes the JS listener and instructs native module to stop emitting events.
|
|
124
|
+
* Safe to call even if not subscribed.
|
|
294
125
|
*/
|
|
295
|
-
export declare function
|
|
126
|
+
export declare function unsubscribeFromEvent(): void;
|
|
296
127
|
/**
|
|
297
|
-
*
|
|
298
|
-
*
|
|
128
|
+
* Forwards a push payload to native SDK (Android-only behavior).
|
|
129
|
+
*
|
|
130
|
+
* @param message Push payload map (string-only).
|
|
299
131
|
*/
|
|
300
|
-
export declare function
|
|
132
|
+
export declare function takePush(message: Record<string, string>): void;
|
|
301
133
|
/**
|
|
302
|
-
* Requests notification permission (
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
* - Usually no Promise here; native may silently no-op if not supported.
|
|
134
|
+
* Requests notification permission (Android-only behavior).
|
|
135
|
+
* On Android it may trigger runtime permission flow,
|
|
136
|
+
* n iOS it can be a no-op or routed to native implementation.
|
|
306
137
|
*/
|
|
307
138
|
export declare function requestNotificationPermission(): void;
|
|
308
139
|
/**
|
|
309
|
-
*
|
|
140
|
+
* Reports an Altcraft push delivery event (Android-only behavior).
|
|
310
141
|
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
* - Any errors are expected to be surfaced via SDK Events stream (if enabled) or native logs.
|
|
142
|
+
* @param message Optional push payload (string-only).
|
|
143
|
+
* @param messageUID Optional Altcraft message UID.
|
|
314
144
|
*/
|
|
315
|
-
export declare function
|
|
316
|
-
[key: string]: any;
|
|
317
|
-
} | null, matching?: {
|
|
318
|
-
[key: string]: any;
|
|
319
|
-
} | null, matchingType?: string | null, profileFields?: {
|
|
320
|
-
[key: string]: any;
|
|
321
|
-
} | null): void;
|
|
145
|
+
export declare function deliveryEvent(message?: Record<string, string> | null, messageUID?: string | null): void;
|
|
322
146
|
/**
|
|
323
|
-
*
|
|
147
|
+
* Reports an Altcraft push open event (Android-only behavior).
|
|
324
148
|
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
149
|
+
* @param message Optional push payload (string-only).
|
|
150
|
+
* @param messageUID Optional Altcraft message UID.
|
|
327
151
|
*/
|
|
328
|
-
export declare function
|
|
329
|
-
[key: string]: string;
|
|
330
|
-
} | null, messageUID?: string | null): void;
|
|
152
|
+
export declare function openEvent(message?: Record<string, string> | null, messageUID?: string | null): void;
|
|
331
153
|
/**
|
|
332
|
-
*
|
|
154
|
+
* Stores a value into native UserDefaults (IOS-only behavior).
|
|
333
155
|
*
|
|
334
|
-
*
|
|
335
|
-
*
|
|
156
|
+
* @param suiteName iOS App Group suite name or `null` to use standard UserDefaults.
|
|
157
|
+
* @param key Storage key.
|
|
158
|
+
* @param value Any JS value; will be converted to string or removed when `null/undefined`.
|
|
336
159
|
*/
|
|
337
|
-
export declare function
|
|
338
|
-
[key: string]: string;
|
|
339
|
-
} | null, messageUID?: string | null): void;
|
|
160
|
+
export declare function setUserDefaultsValue(suiteName: string | null, key: string, value: unknown): void;
|
|
340
161
|
/**
|
|
341
162
|
* Public React Native facade for the Altcraft SDK.
|
|
342
163
|
*
|
|
343
|
-
*
|
|
344
|
-
* -
|
|
345
|
-
* -
|
|
346
|
-
* -
|
|
347
|
-
* -
|
|
348
|
-
* -
|
|
349
|
-
* -
|
|
350
|
-
* -
|
|
351
|
-
* - forcedTokenUpdate
|
|
352
|
-
* - changePushProviderPriorityList
|
|
353
|
-
* - setPushToken
|
|
354
|
-
* - clear
|
|
164
|
+
* Provides:
|
|
165
|
+
* - SDK initialization
|
|
166
|
+
* - Push subscription operations
|
|
167
|
+
* - Subscription status queries
|
|
168
|
+
* - SDK event stream via NativeEventEmitter
|
|
169
|
+
* - Mobile events
|
|
170
|
+
* - Push token access
|
|
171
|
+
* - Local storage bridge (UserDefaults/SharedPreferences)
|
|
355
172
|
*/
|
|
356
173
|
declare const AltcraftSDK: {
|
|
357
174
|
initialize: typeof initialize;
|
|
358
|
-
setJwt: typeof setJwt;
|
|
359
|
-
setAndroidFcmToken: typeof setAndroidFcmToken;
|
|
360
|
-
setIosFcmToken: typeof setIosFcmToken;
|
|
361
|
-
setAndroidHmsToken: typeof setAndroidHmsToken;
|
|
362
|
-
setIosHmsToken: typeof setIosHmsToken;
|
|
363
|
-
setApnsToken: typeof setApnsToken;
|
|
364
|
-
setRustoreToken: typeof setRustoreToken;
|
|
365
175
|
pushSubscribe: typeof pushSubscribe;
|
|
366
176
|
pushSuspend: typeof pushSuspend;
|
|
367
177
|
pushUnSubscribe: typeof pushUnSubscribe;
|
|
@@ -369,23 +179,18 @@ declare const AltcraftSDK: {
|
|
|
369
179
|
getStatusOfLatestSubscription: typeof getStatusOfLatestSubscription;
|
|
370
180
|
getStatusOfLatestSubscriptionForProvider: typeof getStatusOfLatestSubscriptionForProvider;
|
|
371
181
|
getStatusForCurrentSubscription: typeof getStatusForCurrentSubscription;
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
changePushProviderPriorityList: typeof changePushProviderPriorityList;
|
|
182
|
+
subscribeToEvents: typeof subscribeToEvents;
|
|
183
|
+
unsubscribeFromEvent: typeof unsubscribeFromEvent;
|
|
184
|
+
mobileEvent: typeof mobileEvent;
|
|
376
185
|
setPushToken: typeof setPushToken;
|
|
186
|
+
getPushToken: typeof getPushToken;
|
|
377
187
|
clear: typeof clear;
|
|
378
|
-
|
|
379
|
-
requestNotificationPermission: typeof requestNotificationPermission;
|
|
380
|
-
mobileEvent: typeof mobileEvent;
|
|
381
|
-
PushReceiver: typeof PushReceiver;
|
|
382
|
-
registerPushReceiver: typeof registerPushReceiver;
|
|
383
|
-
clearPushReceivers: typeof clearPushReceivers;
|
|
188
|
+
setUserDefaultsValue: typeof setUserDefaultsValue;
|
|
384
189
|
takePush: typeof takePush;
|
|
385
|
-
subscribeToEvents: typeof subscribeToEvents;
|
|
386
|
-
unsubscribeFromEvent: typeof unsubscribeFromEvent;
|
|
387
190
|
deliveryEvent: typeof deliveryEvent;
|
|
388
191
|
openEvent: typeof openEvent;
|
|
192
|
+
requestNotificationPermission: typeof requestNotificationPermission;
|
|
389
193
|
};
|
|
390
194
|
export default AltcraftSDK;
|
|
195
|
+
export type { AltcraftConfig, CategoryData, ResponseWithHttpCode, TokenData, EmailSubscription, SmsSubscription, PushSubscription, CcDataSubscription, Subscription, UTM, SdkEvent, };
|
|
391
196
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAkB,EAChB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,GAAG,EACR,KAAK,QAAQ,EACd,MAAM,aAAa,CAAC;AAMrB;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhE;AAID;;;;;;;;;;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AA6B,IAAI,IAAI,CAEpD;AAID;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAW,EAC7C,UAAU,GAAE,MAAM,GAAG,IAAW,GAC/B,IAAI,CAON;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAW,EAC7C,UAAU,GAAE,MAAM,GAAG,IAAW,GAC/B,IAAI,CAON;AAGD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,OAAO,GACb,IAAI,CAGN;AAID;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;CAqChB,CAAC;AAEF,eAAe,WAAW,CAAC;AAE3B,YAAY,EACV,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,GAAG,EACH,QAAQ,GACT,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altcraft/react-native-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Altcraft Platform SDK for React Native",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"prettier": "^3.0.0",
|
|
73
73
|
"react": "19.1.0",
|
|
74
74
|
"react-native": "0.81.1",
|
|
75
|
-
"react-native-builder-bob": "^0.40.
|
|
75
|
+
"react-native-builder-bob": "^0.40.17",
|
|
76
76
|
"turbo": "^2.5.6",
|
|
77
77
|
"typescript": "^5.9.2"
|
|
78
78
|
},
|