apps-sdk 2.0.7 → 2.0.9

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import {NotificationsPush, Networking, Storage, Session, Utils, PayWallLogic, Rating, AdJust, TrackingTransparency, Voice, MixPanel, Adapty, HomeActions, Facebook, Legal} from "./src/libraries";
1
+ import {NotificationsPush, Networking, Storage, Session, Utils, PayWallLogic, Rating, AdJust, TrackingTransparency, Voice, MixPanel, Adapty, HomeActions, Facebook, Firebase, Legal} from "./src/libraries";
2
2
  // import PayWall from "./src/components/PayWall"; // DEPRECATED: Use SDK.adaptyOnboarding or SDK.adapty.showPaywall() instead
3
3
  import AdaptyOnboarding from "./src/components/AdaptyOnboarding";
4
4
 
@@ -63,5 +63,6 @@ export default {
63
63
  adapty: Adapty,
64
64
  homeActions: HomeActions,
65
65
  facebook: Facebook,
66
+ firebase: Firebase,
66
67
  legal: Legal,
67
- }
68
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps-sdk",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "description": "Apps SDK - Compatible with Expo SDK 54 + React 19",
5
5
  "main": "index.js",
6
6
  "author": "ASD",
@@ -4,6 +4,11 @@ import {Session} from "./index";
4
4
  import {createPaywallView, createOnboardingView} from "react-native-adapty/dist/ui";
5
5
 
6
6
  class Adapty {
7
+ constructor() {
8
+ this.currentPaywallView = null;
9
+ this.currentOnboardingView = null;
10
+ }
11
+
7
12
  async initialize(apiKey = null) {
8
13
  try {
9
14
  const isActivated = await this.isActivated();
@@ -64,6 +69,8 @@ class Adapty {
64
69
  return;
65
70
  }
66
71
 
72
+ this.currentPaywallView = paywallView;
73
+
67
74
  paywallView.setEventHandlers({
68
75
  onCloseButtonPress: eventHandlers.onCloseButtonPress || (() => { return true; }),
69
76
  onAndroidSystemBack: eventHandlers.onAndroidSystemBack || (() => { paywallView.dismiss(); return true; }),
@@ -115,12 +122,12 @@ class Adapty {
115
122
  }
116
123
 
117
124
  async closePaywall() {
118
- const paywallView = await adapty.getCurrentPaywallView();
119
125
  try {
120
- if (paywallView) {
121
- paywallView.dismiss();
126
+ if (this.currentPaywallView) {
127
+ await this.currentPaywallView.dismiss();
128
+ this.currentPaywallView = null;
122
129
  } else {
123
- console.warn('Error closing paywall: paywall view is null');
130
+ console.warn('Error closing paywall: no paywall view reference stored');
124
131
  }
125
132
  } catch (error) {
126
133
  console.error('Error closing paywall:', error);
@@ -142,6 +149,8 @@ class Adapty {
142
149
  async showPaywallPreloaded(paywallView, eventHandlers = {}) {
143
150
  try {
144
151
  if (paywallView) {
152
+ this.currentPaywallView = paywallView;
153
+
145
154
  paywallView.setEventHandlers({
146
155
  onCloseButtonPress: eventHandlers.onCloseButtonPress || (() => { return true; }),
147
156
  onAndroidSystemBack: eventHandlers.onAndroidSystemBack || (() => { paywallView.dismiss(); return true; }),
@@ -231,6 +240,9 @@ class Adapty {
231
240
  config.DEBUG_MODE && console.log('Getting onboarding for placement:', placementID, 'and language:', lang, 'onboarding:', onboarding);
232
241
  if (onboarding) {
233
242
  const onboardingView = await this.createOnboardingView(onboarding);
243
+
244
+ this.currentOnboardingView = onboardingView;
245
+
234
246
  onboardingView.setEventHandlers({
235
247
  onAnalytics: eventHandlers.onAnalytics || (() => { }),
236
248
  onClose: eventHandlers.onClose || (async (actionId, meta) => { await onboardingView.dismiss(); return true; }),
@@ -256,12 +268,12 @@ class Adapty {
256
268
 
257
269
 
258
270
  async closeOnboarding() {
259
- const onboardingView = await adapty.getCurrentOnboardingView();
260
271
  try {
261
- if (onboardingView) {
262
- onboardingView.dismiss();
272
+ if (this.currentOnboardingView) {
273
+ await this.currentOnboardingView.dismiss();
274
+ this.currentOnboardingView = null;
263
275
  } else {
264
- console.warn('Error closing onboarding: onboarding view is null');
276
+ console.warn('Error closing onboarding: no onboarding view reference stored');
265
277
  }
266
278
  } catch (error) {
267
279
  console.error('Error closing onboarding:', error);
@@ -271,6 +283,8 @@ class Adapty {
271
283
  async showOnboardingPreloaded(onboardingView, eventHandlers = {}) {
272
284
  try {
273
285
  if (onboardingView) {
286
+ this.currentOnboardingView = onboardingView;
287
+
274
288
  onboardingView.setEventHandlers({
275
289
  onAnalytics: eventHandlers.onAnalytics || (() => { }),
276
290
  onClose: eventHandlers.onClose || (async (actionId, meta) => { await onboardingView.dismiss(); return true; }),
package/types/index.d.ts CHANGED
@@ -35,6 +35,7 @@ declare module 'apps-sdk' {
35
35
  isDevUser: boolean;
36
36
  forcedUpdate: boolean;
37
37
  init(): Promise<void>;
38
+ setDebugMode(debugMode: boolean): void;
38
39
  setConfigEndpoint(endpoint: string): void;
39
40
  initSession(): Promise<void>;
40
41
  storeSessionStructure(): Promise<void>;
@@ -259,6 +260,7 @@ declare module 'apps-sdk' {
259
260
  updateAdjustAttributionData(attribution: any): Promise<void>;
260
261
  setAdjustIntegrationIdentifier(adjustIntegrationIdentifier: string): Promise<void>;
261
262
  setMixpanelIntegrationIdentifier(mixpanelIntegrationIdentifier: string): Promise<void>;
263
+ setFirebaseIntegrationIdentifier(firebaseIntegrationIdentifier: string): Promise<void>;
262
264
  closePaywall(): Promise<void>;
263
265
  getOnboardingForPlacement(placementID: string, lang: string): Promise<any>;
264
266
  createOnboardingView(onboarding: any): Promise<any>;
@@ -295,6 +297,14 @@ declare module 'apps-sdk' {
295
297
  getLegalText(web_id: string, type: 'tc' | 'contact' | 'privacy_policy' | 'refund_policy' | 'faqs', lang: string): Promise<any>;
296
298
  }
297
299
 
300
+ export class Firebase {
301
+ initialize(): Promise<void>;
302
+ getAppInstanceId(): Promise<string | null>;
303
+ logEvent(eventName: string, params?: object): Promise<void>;
304
+ setUserId(userId: string): Promise<void>;
305
+ setUserProperty(name: string, value: string): Promise<void>;
306
+ }
307
+
298
308
  export class AppsSDK {
299
309
  initializePushNotifications(): Promise<string>;
300
310
  }
@@ -318,6 +328,7 @@ declare module 'apps-sdk' {
318
328
  adapty : Adapty;
319
329
  homeActions : HomeActions;
320
330
  facebook : Facebook;
331
+ firebase : Firebase;
321
332
  legal : Legal;
322
333
  }
323
334