@altcraft/react-native-sdk 0.0.4 → 1.0.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.
Files changed (53) hide show
  1. package/LICENSE +48 -20
  2. package/README.md +21 -120
  3. package/autolink.js +36 -0
  4. package/lib/commonjs/altcraft_sdk.js +297 -0
  5. package/lib/commonjs/altcraft_sdk.js.map +1 -0
  6. package/lib/commonjs/index.js +192 -0
  7. package/lib/commonjs/index.js.map +1 -0
  8. package/lib/commonjs/package.json +1 -0
  9. package/lib/module/altcraft_sdk.js +292 -0
  10. package/lib/module/altcraft_sdk.js.map +1 -0
  11. package/lib/module/index.js +13 -427
  12. package/lib/module/index.js.map +1 -1
  13. package/lib/typescript/commonjs/package.json +1 -0
  14. package/lib/typescript/commonjs/src/altcraft_sdk.d.ts +143 -0
  15. package/lib/typescript/commonjs/src/altcraft_sdk.d.ts.map +1 -0
  16. package/lib/typescript/commonjs/src/index.d.ts +24 -0
  17. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  18. package/lib/typescript/module/src/altcraft_sdk.d.ts +143 -0
  19. package/lib/typescript/module/src/altcraft_sdk.d.ts.map +1 -0
  20. package/lib/typescript/module/src/index.d.ts +24 -0
  21. package/lib/typescript/module/src/index.d.ts.map +1 -0
  22. package/package.json +49 -95
  23. package/scripts/postinstall.cjs +195 -0
  24. package/src/altcraft_sdk.ts +337 -0
  25. package/src/index.ts +91 -0
  26. package/Sdk.podspec +0 -48
  27. package/android/build.gradle +0 -77
  28. package/android/gradle.properties +0 -5
  29. package/android/src/main/AndroidManifest.xml +0 -2
  30. package/android/src/main/java/com/altcraft/sdk/SdkEventEmitter.kt +0 -50
  31. package/android/src/main/java/com/altcraft/sdk/SdkModule.kt +0 -949
  32. package/android/src/main/java/com/altcraft/sdk/SdkPackage.kt +0 -41
  33. package/android/src/main/java/com/altcraft/sdk/utilities/Converter.kt +0 -326
  34. package/android/src/main/java/com/altcraft/sdk/utilities/Extension.kt +0 -72
  35. package/ios/Converter.swift +0 -640
  36. package/ios/Sdk.h +0 -20
  37. package/ios/Sdk.mm +0 -979
  38. package/ios/SdkModule.swift +0 -778
  39. package/lib/module/NativeSdk.js +0 -48
  40. package/lib/module/NativeSdk.js.map +0 -1
  41. package/lib/module/Utilities.js +0 -178
  42. package/lib/module/Utilities.js.map +0 -1
  43. package/lib/typescript/src/NativeSdk.d.ts +0 -215
  44. package/lib/typescript/src/NativeSdk.d.ts.map +0 -1
  45. package/lib/typescript/src/Utilities.d.ts +0 -47
  46. package/lib/typescript/src/Utilities.d.ts.map +0 -1
  47. package/lib/typescript/src/index.d.ts +0 -252
  48. package/lib/typescript/src/index.d.ts.map +0 -1
  49. package/react-native.config.js +0 -10
  50. package/src/NativeSdk.ts +0 -313
  51. package/src/Utilities.ts +0 -180
  52. package/src/index.tsx +0 -570
  53. /package/lib/typescript/{package.json → module/package.json} +0 -0
package/LICENSE CHANGED
@@ -1,20 +1,48 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Altcraft
4
- Permission is hereby granted, free of charge, to any person obtaining a copy
5
- of this software and associated documentation files (the "Software"), to deal
6
- in the Software without restriction, including without limitation the rights
7
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the Software is
9
- furnished to do so, subject to the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be included in all
12
- copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- SOFTWARE.
1
+ EULA
2
+
3
+ END USER LICENSE AGREEMENT
4
+
5
+ Copyright © 2026 Altcraft LLC. All rights reserved.
6
+
7
+ 1. LICENSE GRANT
8
+ This agreement grants you certain rights to use the Altcraft Mobile SDK (hereinafter referred to as the "Software").
9
+ All rights not expressly granted by this agreement remain with the copyright holder.
10
+
11
+ 2. USE
12
+ You are permitted to use and distribute the Software for both commercial and non-commercial purposes.
13
+
14
+ 3. MODIFICATION WITHOUT PUBLICATION
15
+ You may modify the Software for your own internal purposes without any obligation to publish such modifications.
16
+
17
+ 4. MODIFICATION WITH PUBLICATION
18
+ Publication of modified Software requires prior written permission from the copyright holder.
19
+
20
+ 5. DISCLAIMER OF WARRANTIES
21
+ The Software is provided "as is," without any warranties, express or implied, including but not limited to
22
+ warranties of merchantability, fitness for a particular purpose, and non-infringement of third-party rights.
23
+
24
+ 6. LIMITATION OF LIABILITY
25
+ Under no circumstances shall the copyright holder be liable for any direct, indirect, incidental, special,
26
+ punitive, or consequential damages (including but not limited to: procurement of substitute goods or services;
27
+ loss of data, profits, or business interruption) arising in any way from the use of this Software,
28
+ even if the copyright holder has been advised of the possibility of such damages.
29
+
30
+ 7. DISTRIBUTION
31
+ When distributing the Software, you must provide all recipients with a copy of this license agreement.
32
+
33
+ 8. COPYRIGHT AND THIRD-PARTY COMPONENTS
34
+ This Software may include components distributed under other licenses. The full list of such components
35
+ and their respective licenses is provided below:
36
+
37
+ ### Third-party libraries and licenses
38
+
39
+ **Apache License 2.0**
40
+ Licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
41
+ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
42
+
43
+ * [React Native](https://github.com/facebook/react-native)
44
+ * [TypeScript](https://www.typescriptlang.org/)
45
+
46
+ **MIT License**
47
+
48
+ * [React](https://github.com/facebook/react)
package/README.md CHANGED
@@ -1,138 +1,39 @@
1
- # Altcraft React Native SDK
1
+ # Altcraft React Native SDK — Full SDK
2
2
 
3
- ![Altcraft SDK Logo](https://guides.altcraft.com/img/logo.svg)
3
+ ![Altcraft SDK Logo](https://guides.altcraft.com/img/logo.svg) [![React Native](https://img.shields.io/badge/React_Native-0.75%2B-blue?style=flat-square)](https://reactnative.dev/) [![Platforms](https://img.shields.io/badge/Platforms-Android_iOS-green?style=flat-square)](#) [![npm](https://img.shields.io/npm/v/@altcraft/react-native-sdk.svg?style=flat-square)](https://www.npmjs.com/package/@altcraft/react-native-sdk)
4
4
 
5
- [![npm version](https://img.shields.io/npm/v/react-native-sdk?style=flat-square)](https://www.npmjs.com/package/react-native-sdk)
6
- [![React Native](https://img.shields.io/badge/React_Native-0.70%2B-blue?style=flat-square)](https://reactnative.dev/)
7
- [![Platforms](https://img.shields.io/badge/Platforms-Android_%7C_iOS-green?style=flat-square)](#)
8
- [![Push Providers](https://img.shields.io/badge/Push-FCM_%7C_APNs-orange?style=flat-square)](#)
9
-
10
- Altcraft React Native SDK is a bridge to the native **Altcraft Mobile SDK** for Android and iOS. The SDK automates push notification delivery, event submission, request retries, and supports flexible workflows with JWT or role-based tokens.
5
+ Altcraft React Native SDK is a library for interacting with the **Altcraft Marketing Platform**. The **Full SDK** package combines all modular components into a single dependency.
11
6
 
12
7
  ---
13
8
 
14
- ## Features
15
-
16
- * [x] Compatible with TypeScript and JavaScript.
17
- * [x] Works with anonymous and registered users; supports multiple profiles on one device (JWT).
18
- * [x] Push subscription management: push subscribe, push suspend, push unsubscribe.
19
- * [x] Automatic push token update when it changes.
20
- * [x] Automatic transmission of notification delivery and open events.
21
- * [x] Mobile events registration.
22
- * [x] Update profile fields.
23
- * [x] Automatic retry of failed requests.
24
- * [x] Support for push providers: Firebase FCM (Android), APNs (iOS).
25
- * [x] Secure requests using JWT and flexible identifier matching.
26
- * [x] Support for rToken for simple subscription scenarios.
27
- * [x] SDK data cleanup and background tasks termination.
9
+ ## SDK Modules
28
10
 
29
- ---
11
+ The `@altcraft/react-native-sdk` package includes:
30
12
 
31
- ## Dependency
32
-
33
- `react-native-sdk:1.0.0`
13
+ - **Core**: SDK initialization, authentication, events, and data management.
14
+ - **Push**: push subscriptions, tokens, providers, and notification events.
15
+ - **In-App**: in-app subscriptions, placements, screens, triggers, and JSON content.
16
+ - **Target**: target events with payload, matching, subscriptions, and UTM data.
17
+ - **Profile**: profile field updates.
18
+ - All modules expose their native event catalog through the module event catalog (`moduleEvents`).
34
19
 
35
20
  ---
36
21
 
37
- ## Authorization Types
38
-
39
- ### JWT-Authorization (recommended approach)
40
-
41
- JWT is added to the header of every request. The SDK requests the current token from the app via the `JWTInterface`.
42
-
43
- **Advantages:**
44
-
45
- * Enhanced security of API requests.
46
- * Profile lookup by any identifier (email, phone, custom ID).
47
- * Support for multiple users on a single device.
48
- * Profile persists after app reinstallation.
49
- * Unified user identity across devices.
50
-
51
- ### Authorization with a role token (*rToken*)
22
+ ## Dependencies
52
23
 
53
- The role token is specified in the SDK configuration.
54
- Profile lookup is limited to the push token identifier.
24
+ Add the **Full SDK** package to your React Native application:
55
25
 
56
- **Limitations:**
26
+ ```sh
27
+ npm install @altcraft/react-native-sdk
28
+ ```
57
29
 
58
- * The link to a profile may be lost if the push token changes and the change isn't reflected on the platform.
59
- * No multi-profile support.
60
- * It's not possible to register the same user on another device.
30
+ The package includes all modules and links the native Altcraft SDK components automatically. To depend only on the modules used by the application, use the individual `@altcraft/*` packages instead.
61
31
 
62
32
  ---
63
33
 
64
34
  ## Requirements
65
35
 
66
- * React Native 0.70+.
67
- * Android 7.1+ (API 25).
68
- * iOS 13.0+.
69
- * Push provider integrated in the host app (FCM for Android, APNs for iOS).
70
-
71
- ---
72
-
73
- ## Documentations
74
-
75
- Detailed information on SDK setup, functionality, and usage is available on the Altcraft documentation portal. You can navigate to the required section using the links below:
76
-
77
- - [**Quick Start**](https://guides.altcraft.com/en/developer-guide/sdk/mobile/react-native/quick-start)
78
- - [**SDK Functionality**](https://guides.altcraft.com/en/developer-guide/sdk/mobile/react-native/functionality)
79
- - [**SDK Configuration**](https://guides.altcraft.com/en/developer-guide/sdk/mobile/react-native/setup)
80
- - [**Classes and Structures**](https://guides.altcraft.com/en/developer-guide/sdk/mobile/react-native/api)
81
-
82
- **Provider Setup**
83
-
84
- - [FCM](https://guides.altcraft.com/en/developer-guide/sdk/mobile/android/providers/fcm/)
85
- - [APNs](https://guides.altcraft.com/en/developer-guide/sdk/mobile/ios/providers/apns/)
86
-
87
- ---
88
-
89
- ## License
90
-
91
- ### EULA
92
-
93
- END USER LICENSE AGREEMENT
94
-
95
- Copyright © 2024 Altcraft LLC. All rights reserved.
96
-
97
- 1. LICENSE GRANT
98
- This agreement grants you certain rights to use the Altcraft Mobile SDK (hereinafter referred to as the "Software").
99
- All rights not expressly granted by this agreement remain with the copyright holder.
100
-
101
- 2. USE
102
- You are permitted to use and distribute the Software for both commercial and non-commercial purposes.
103
-
104
- 3. MODIFICATION WITHOUT PUBLICATION
105
- You may modify the Software for your own internal purposes without any obligation to publish such modifications.
106
-
107
- 4. MODIFICATION WITH PUBLICATION
108
- Publication of modified Software requires prior written permission from the copyright holder.
109
-
110
- 5. DISCLAIMER OF WARRANTIES
111
- The Software is provided "as is," without any warranties, express or implied, including but not limited to
112
- warranties of merchantability, fitness for a particular purpose, and non-infringement of third-party rights.
113
-
114
- 6. LIMITATION OF LIABILITY
115
- Under no circumstances shall the copyright holder be liable for any direct, indirect, incidental, special,
116
- punitive, or consequential damages (including but not limited to: procurement of substitute goods or services;
117
- loss of data, profits, or business interruption) arising in any way from the use of this Software,
118
- even if the copyright holder has been advised of the possibility of such damages.
119
-
120
- 7. DISTRIBUTION
121
- When distributing the Software, you must provide all recipients with a copy of this license agreement.
122
-
123
- 8. COPYRIGHT AND THIRD-PARTY COMPONENTS
124
- This Software may include components distributed under other licenses. The full list of such components
125
- and their respective licenses is provided below:
126
-
127
- ### Third-party libraries and licenses
128
-
129
- **Apache License 2.0**
130
- Licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
131
- You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
132
-
133
- * [React Native](https://github.com/facebook/react-native)
134
- * [TypeScript](https://www.typescriptlang.org/)
135
-
136
- **MIT License**
137
-
138
- * [React](https://github.com/facebook/react)
36
+ - React Native 0.75+ (tested with 0.81.1).
37
+ - Android 7.1+ (API 25).
38
+ - iOS 13.0+.
39
+ - A configured push provider (Firebase, Huawei, RuStore on Android; APNs on iOS) when using the Push module.
package/autolink.js ADDED
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ const path = require('path');
4
+
5
+ const packages = [
6
+ '@altcraft/core',
7
+ '@altcraft/push',
8
+ '@altcraft/inapp',
9
+ '@altcraft/target',
10
+ '@altcraft/profile',
11
+ ];
12
+
13
+ function resolvePackageRoot(name) {
14
+ for (const base of [process.cwd(), __dirname]) {
15
+ try {
16
+ return path.dirname(
17
+ require.resolve(`${name}/package.json`, { paths: [base] })
18
+ );
19
+ } catch {
20
+ // Try the next resolution base.
21
+ }
22
+ }
23
+
24
+ return null;
25
+ }
26
+
27
+ const dependencies = {};
28
+
29
+ for (const name of packages) {
30
+ const root = resolvePackageRoot(name);
31
+ if (root) {
32
+ dependencies[name] = { root };
33
+ }
34
+ }
35
+
36
+ module.exports = { packages, dependencies };
@@ -0,0 +1,297 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AltcraftSDK = void 0;
7
+ var _core = require("@altcraft/core");
8
+ var _inapp = require("@altcraft/inapp");
9
+ var _profile = require("@altcraft/profile");
10
+ var _push = require("@altcraft/push");
11
+ var _target = require("@altcraft/target");
12
+ /**
13
+ * Main entry point for the Altcraft SDK.
14
+ *
15
+ * All SDK operations are accessed through this class's static methods.
16
+ * The package is a pure-JS facade: initialization is delegated to
17
+ * `AltcraftCore.initialize`, and all other operations are delegated to the
18
+ * module packages ({@link AltcraftCore}, {@link AltcraftPush},
19
+ * {@link AltcraftInApp}, {@link AltcraftTarget}, {@link AltcraftProfile}).
20
+ * There is no umbrella native module; module options are applied through
21
+ * `AltcraftConfigBuilder` extensions.
22
+ *
23
+ * ```ts
24
+ * import { AltcraftSDK } from 'altcraft';
25
+ *
26
+ * // Initialize
27
+ * await AltcraftSDK.initialize({
28
+ * apiUrl: 'https://your-api.altcraft.com',
29
+ * appInfo: { appID: 'firebase-app-id', appIID: 'firebase-instance-id', appVer: '1.0.0' },
30
+ * });
31
+ *
32
+ * // Subscribe to push
33
+ * AltcraftSDK.pushSubscribe({ sync: true });
34
+ *
35
+ * // Listen to SDK events
36
+ * AltcraftSDK.subscribeToEvents((event) => {
37
+ * console.log(`${event.function}: ${event.message}`);
38
+ * });
39
+ * ```
40
+ *
41
+ * Module-specific options are added through `AltcraftConfigBuilder` extensions
42
+ * and applied by `AltcraftCore.initialize`:
43
+ *
44
+ * ```ts
45
+ * import { AltcraftConfigBuilder, AltcraftCore } from '@altcraft/core';
46
+ * import '@altcraft/inapp';
47
+ * import '@altcraft/push';
48
+ *
49
+ * await AltcraftCore.initialize(
50
+ * new AltcraftConfigBuilder({ apiUrl: 'https://your-api.altcraft.com' })
51
+ * .pushConfig({ providerPriority: ['android-firebase'] })
52
+ * .inAppConfig({ maxPlacements: 50 })
53
+ * .build()
54
+ * );
55
+ * ```
56
+ */
57
+ class AltcraftSDK {
58
+ /** Provides access to In-App placements with JSON content. */
59
+ static jsonContent = _inapp.AltcraftInApp.jsonContent;
60
+
61
+ // ---- Initialization ----
62
+
63
+ /**
64
+ * Initializes the Altcraft SDK with the given configuration.
65
+ *
66
+ * Delegates to `AltcraftCore.initialize`. For module-specific options use
67
+ * `AltcraftConfigBuilder` and the module extensions (`pushConfig`,
68
+ * `inAppConfig`).
69
+ */
70
+ static initialize(config) {
71
+ return _core.AltcraftCore.initialize(config);
72
+ }
73
+
74
+ // ---- Push Subscription ----
75
+
76
+ /** Subscribes to push notifications. */
77
+ static pushSubscribe(options = {}) {
78
+ return _push.AltcraftPush.pushSubscribe(options);
79
+ }
80
+
81
+ /** Suspends push subscription. */
82
+ static pushSuspend(options = {}) {
83
+ return _push.AltcraftPush.pushSuspend(options);
84
+ }
85
+
86
+ /** Unsubscribes from push notifications. */
87
+ static pushUnSubscribe(options = {}) {
88
+ return _push.AltcraftPush.pushUnSubscribe(options);
89
+ }
90
+
91
+ /** UnSuspends a previously suspended push subscription. */
92
+ static unSuspendPushSubscription() {
93
+ return _push.AltcraftPush.unSuspendPushSubscription();
94
+ }
95
+
96
+ // ---- In-App Subscription ----
97
+
98
+ /** Subscribes to In-App notifications. */
99
+ static inAppSubscribe(options = {}) {
100
+ return _inapp.AltcraftInApp.inAppSubscribe(options);
101
+ }
102
+
103
+ /** Unsubscribes from In-App notifications. */
104
+ static inAppUnsubscribe(options = {}) {
105
+ return _inapp.AltcraftInApp.inAppUnsubscribe(options);
106
+ }
107
+
108
+ // ---- Subscription Status ----
109
+
110
+ /** Gets the status of the latest subscription. */
111
+ static getStatusOfLatestSubscription() {
112
+ return _push.AltcraftPush.getStatusOfLatestSubscription();
113
+ }
114
+
115
+ /** Gets the status of the current subscription. */
116
+ static getStatusForCurrentSubscription() {
117
+ return _push.AltcraftPush.getStatusForCurrentSubscription();
118
+ }
119
+
120
+ /** Gets the status of the latest subscription for a specific provider. */
121
+ static getStatusOfLatestSubscriptionForProvider(provider = null) {
122
+ return _push.AltcraftPush.getStatusOfLatestSubscriptionForProvider(provider);
123
+ }
124
+
125
+ // ---- SDK Events ----
126
+
127
+ /** Subscribes to SDK events stream. */
128
+ static subscribeToEvents(handler) {
129
+ _core.AltcraftCore.subscribeToEvents(handler);
130
+ }
131
+
132
+ /** Unsubscribes from SDK events. */
133
+ static unsubscribeFromEvents(handler) {
134
+ _core.AltcraftCore.unsubscribeFromEvents(handler);
135
+ }
136
+
137
+ // ---- Mobile Events ----
138
+
139
+ /** Sends a mobile event to the Altcraft platform. */
140
+ static sendTarget(options) {
141
+ _target.AltcraftTarget.sendTarget(options);
142
+ }
143
+
144
+ // ---- Push Tokens ----
145
+
146
+ /** Gets the current push token data. */
147
+ static getPushToken() {
148
+ return _push.AltcraftPush.getPushToken();
149
+ }
150
+
151
+ /** Sets or clears a push token for the given provider. */
152
+ static setPushToken(provider, token) {
153
+ _push.AltcraftPush.setPushToken(provider, token);
154
+ }
155
+
156
+ // ---- State ----
157
+
158
+ /** Clears all SDK state. */
159
+ static clear() {
160
+ return _core.AltcraftCore.clear();
161
+ }
162
+
163
+ // ---- Push Handling (Android) ----
164
+
165
+ /** Forwards a push payload to the SDK (Android). */
166
+ static takePush(message) {
167
+ _push.AltcraftPush.takePush(message);
168
+ }
169
+
170
+ // ---- Permissions (Android) ----
171
+
172
+ /** Requests notification permission (Android). Returns true if granted. */
173
+ static requestNotificationPermission() {
174
+ return _push.AltcraftPush.requestNotificationPermission();
175
+ }
176
+
177
+ // ---- Push Events (Android) ----
178
+
179
+ /** Reports push delivery (Android). */
180
+ static deliveryEvent(options = {}) {
181
+ _push.AltcraftPush.deliveryEvent(options);
182
+ }
183
+
184
+ /** Reports push open (Android). */
185
+ static openEvent(options = {}) {
186
+ _push.AltcraftPush.openEvent(options);
187
+ }
188
+
189
+ // ---- UserDefaults (iOS) ----
190
+
191
+ /**
192
+ * Stores a string value in native storage (UserDefaults on iOS,
193
+ * SharedPreferences on Android).
194
+ *
195
+ * On iOS, `suiteName` selects the App Group UserDefaults suite.
196
+ * On Android, `suiteName` is ignored.
197
+ */
198
+ static setUserDefaultsValue(suiteName, key, value) {
199
+ _core.AltcraftCore.setUserDefaultsValue(suiteName, key, value);
200
+ }
201
+
202
+ // ---- Profile ----
203
+
204
+ /** Updates profile fields on the server. */
205
+ static updateProfileFields(options = {}) {
206
+ _profile.AltcraftProfile.updateProfileFields(options);
207
+ }
208
+
209
+ // ---- Token Management ----
210
+
211
+ /** Forces a token refresh. */
212
+ static forcedTokenUpdate() {
213
+ return _push.AltcraftPush.forcedTokenUpdate();
214
+ }
215
+
216
+ /** Deletes a device token for the given provider. */
217
+ static deleteDeviceToken(provider) {
218
+ return _push.AltcraftPush.deleteDeviceToken(provider);
219
+ }
220
+
221
+ /** Changes the push provider priority list. */
222
+ static changePushProviderPriorityList(priorityList) {
223
+ return _push.AltcraftPush.changePushProviderPriorityList(priorityList);
224
+ }
225
+
226
+ // ---- Push Identification ----
227
+
228
+ /** Checks if a push message is from Altcraft. */
229
+ static isAltcraftPush(message) {
230
+ return _push.AltcraftPush.isAltcraftPush(message);
231
+ }
232
+
233
+ // ---- Session (Android) ----
234
+
235
+ /** Unlocks initial operations in the current session (Android). */
236
+ static unlockInitialOperationsInThisSession() {
237
+ _core.AltcraftCore.unlockInitialOperationsInThisSession();
238
+ }
239
+
240
+ // ---- App Group (iOS) ----
241
+
242
+ /** Sets the App Group for UserDefaults (iOS). */
243
+ static setAppGroup(groupName) {
244
+ _core.AltcraftCore.setAppGroup(groupName);
245
+ }
246
+
247
+ // ---- Authentication ----
248
+
249
+ /** Registers a JWT provider that the native SDK calls when it needs a token. */
250
+ static setJwtProvider(provider) {
251
+ _core.AltcraftCore.setJwtProvider(provider);
252
+ }
253
+
254
+ /** Starts SDK authentication. */
255
+ static authenticate() {
256
+ _core.AltcraftCore.authenticate();
257
+ }
258
+
259
+ /** Logs the user out. */
260
+ static logOut() {
261
+ _core.AltcraftCore.logOut();
262
+ }
263
+
264
+ /** Returns whether the user is authenticated. */
265
+ static isAuthenticated() {
266
+ return _core.AltcraftCore.isAuthenticated();
267
+ }
268
+
269
+ // ---- InApp ----
270
+
271
+ /** Sets the current screen for In-App placement matching. */
272
+ static setScreen(screen) {
273
+ _inapp.AltcraftInApp.setScreen(screen);
274
+ }
275
+
276
+ /** Fires an In-App trigger by name. */
277
+ static trigger(name) {
278
+ _inapp.AltcraftInApp.trigger(name);
279
+ }
280
+
281
+ /** Requests In-App placements. */
282
+ static getPlacements() {
283
+ _inapp.AltcraftInApp.getPlacements();
284
+ }
285
+
286
+ /** Sets or clears the In-App show animation configuration. */
287
+ static setAnimation(config) {
288
+ _inapp.AltcraftInApp.setAnimation(config);
289
+ }
290
+
291
+ /** Disables the In-App show animation. */
292
+ static clearAnimation() {
293
+ _inapp.AltcraftInApp.clearAnimation();
294
+ }
295
+ }
296
+ exports.AltcraftSDK = AltcraftSDK;
297
+ //# sourceMappingURL=altcraft_sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_core","require","_inapp","_profile","_push","_target","AltcraftSDK","jsonContent","AltcraftInApp","initialize","config","AltcraftCore","pushSubscribe","options","AltcraftPush","pushSuspend","pushUnSubscribe","unSuspendPushSubscription","inAppSubscribe","inAppUnsubscribe","getStatusOfLatestSubscription","getStatusForCurrentSubscription","getStatusOfLatestSubscriptionForProvider","provider","subscribeToEvents","handler","unsubscribeFromEvents","sendTarget","AltcraftTarget","getPushToken","setPushToken","token","clear","takePush","message","requestNotificationPermission","deliveryEvent","openEvent","setUserDefaultsValue","suiteName","key","value","updateProfileFields","AltcraftProfile","forcedTokenUpdate","deleteDeviceToken","changePushProviderPriorityList","priorityList","isAltcraftPush","unlockInitialOperationsInThisSession","setAppGroup","groupName","setJwtProvider","authenticate","logOut","isAuthenticated","setScreen","screen","trigger","name","getPlacements","setAnimation","clearAnimation","exports"],"sourceRoot":"../../src","sources":["altcraft_sdk.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,MAAA,GAAAD,OAAA;AASA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AAMA,IAAAI,OAAA,GAAAJ,OAAA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMK,WAAW,CAAC;EACvB;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