apps-sdk 1.1.5 → 1.1.7
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/app.json +2 -1
- package/package.json +2 -1
- package/src/libraries/Adapty.js +44 -0
- package/src/libraries/MixPanel.js +12 -6
- package/src/libraries/QuickActions.js +26 -0
- package/types/index.d.ts +2 -0
package/app.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apps-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"description": "Apps SDK",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"expo-localization": "~16.0.1",
|
|
26
26
|
"expo-media-library": "~17.0.6",
|
|
27
27
|
"expo-notifications": "~0.29.14",
|
|
28
|
+
"expo-quick-actions": "^4.0.2",
|
|
28
29
|
"expo-sharing": "~13.0.1",
|
|
29
30
|
"expo-speech": "~13.0.1",
|
|
30
31
|
"expo-store-review": "~8.0.1",
|
package/src/libraries/Adapty.js
CHANGED
|
@@ -81,6 +81,50 @@ class Adapty {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
async preloadPaywall(placementID, lang) {
|
|
85
|
+
try {
|
|
86
|
+
const paywall = await this.getPaywallForPlacement(placementID, lang);
|
|
87
|
+
if (paywall) {
|
|
88
|
+
const paywallView = await this.createPaywallView(paywall);
|
|
89
|
+
if (paywallView) {
|
|
90
|
+
return paywallView;
|
|
91
|
+
} else {
|
|
92
|
+
console.warn('Error preloading paywall: paywall view not created for placement', placementID, 'and language', lang);
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
console.warn('Error preloading paywall: paywall not found for placement', placementID, 'and language', lang);
|
|
97
|
+
}
|
|
98
|
+
} catch (error) {
|
|
99
|
+
console.error('Error preloading paywall:', error);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async showPaywallPreloaded(paywallView, eventHandlers = {}) {
|
|
104
|
+
try {
|
|
105
|
+
if (paywallView) {
|
|
106
|
+
paywallView.registerEventHandlers({
|
|
107
|
+
onCloseButtonPress: eventHandlers.onCloseButtonPress || (() => { return true; }),
|
|
108
|
+
onAndroidSystemBack: eventHandlers.onAndroidSystemBack || (() => { paywallView.dismiss(); return true; }),
|
|
109
|
+
onPurchaseCompleted: eventHandlers.onPurchaseCompleted || (() => { paywallView.dismiss(); return true; }),
|
|
110
|
+
onPurchaseStarted: eventHandlers.onPurchaseStarted || (() => { }),
|
|
111
|
+
onPurchaseFailed: eventHandlers.onPurchaseFailed || (() => { paywallView.dismiss(); return true; }),
|
|
112
|
+
onRestoreCompleted: eventHandlers.onRestoreCompleted || (() => { paywallView.dismiss(); return true; }),
|
|
113
|
+
onRestoreFailed: eventHandlers.onRestoreFailed || (() => { paywallView.dismiss(); return true; }),
|
|
114
|
+
onProductSelected: eventHandlers.onProductSelected || (() => { }),
|
|
115
|
+
onRenderingFailed: eventHandlers.onRenderingFailed || (() => { return true; }),
|
|
116
|
+
onLoadingProductsFailed: eventHandlers.onLoadingProductsFailed || (() => { paywallView.dismiss(); return true; }),
|
|
117
|
+
onUrlPress: eventHandlers.onUrlPress || (() => { return true; }),
|
|
118
|
+
});
|
|
119
|
+
await paywallView.present();
|
|
120
|
+
} else {
|
|
121
|
+
console.warn('Error showing preloaded paywall: paywall view is null');
|
|
122
|
+
}
|
|
123
|
+
} catch (error) {
|
|
124
|
+
console.error('Error showing preloaded paywall:', error);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
84
128
|
async getProfile() {
|
|
85
129
|
try {
|
|
86
130
|
return await adapty.getProfile();
|
|
@@ -81,8 +81,10 @@ class MixPanel {
|
|
|
81
81
|
if (!this.devMode) {
|
|
82
82
|
const trackingPermissionAnswered = await Storage.getData('TRACKING_PERMISSION_ANSWERED');
|
|
83
83
|
if (config.TRACKING_ACTIVE || !trackingPermissionAnswered) {
|
|
84
|
-
await this.
|
|
85
|
-
|
|
84
|
+
const distinctId = await this.getDistinctID();
|
|
85
|
+
const superProperties = { ...properties, distinct_id: distinctId };
|
|
86
|
+
await this.mixpanel.registerSuperProperties(superProperties);
|
|
87
|
+
config.DEBUG_MODE && console.log('MixPanel Super Properties registered:', superProperties);
|
|
86
88
|
} else {
|
|
87
89
|
config.DEBUG_MODE && console.log('MixPanel Super Properties not registered due to tracking permission:', properties);
|
|
88
90
|
}
|
|
@@ -102,8 +104,10 @@ class MixPanel {
|
|
|
102
104
|
|
|
103
105
|
try {
|
|
104
106
|
if (!this.devMode) {
|
|
105
|
-
await this.
|
|
106
|
-
|
|
107
|
+
const distinctId = await this.getDistinctID();
|
|
108
|
+
const superProperties = { ...properties, distinct_id: distinctId };
|
|
109
|
+
await this.mixpanel.registerSuperPropertiesOnce(superProperties);
|
|
110
|
+
config.DEBUG_MODE && console.log('MixPanel Super Properties appended:', superProperties);
|
|
107
111
|
} else {
|
|
108
112
|
config.DEBUG_MODE && console.log('MixPanel Super Properties appended but not send (DEV_MODE ON):', properties);
|
|
109
113
|
}
|
|
@@ -138,8 +142,10 @@ class MixPanel {
|
|
|
138
142
|
|
|
139
143
|
try {
|
|
140
144
|
if (!this.devMode) {
|
|
141
|
-
await this.
|
|
142
|
-
|
|
145
|
+
const distinctId = await this.getDistinctID();
|
|
146
|
+
const userProperties = { [propertyName]: propertyValue, distinct_id: distinctId };
|
|
147
|
+
await this.mixpanel.getPeople().set(userProperties);
|
|
148
|
+
config.DEBUG_MODE && console.log(`MixPanel User property set: ${propertyName} = ${propertyValue}, distinct_id = ${distinctId}`);
|
|
143
149
|
} else {
|
|
144
150
|
config.DEBUG_MODE && console.log(`MixPanel User property set but not send (DEV_MODE ON): ${propertyName} = ${propertyValue}`);
|
|
145
151
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as config from '../../config';
|
|
2
|
+
import * as QuickActions from "expo-quick-actions";
|
|
3
|
+
import {useQuickActionCallback} from "expo-quick-actions/hooks";
|
|
4
|
+
|
|
5
|
+
class HmeActions {
|
|
6
|
+
constructor() {
|
|
7
|
+
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async setItems(items) {
|
|
11
|
+
await QuickActions.setItems(items);
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async itemCallback(itemCallbackFunction) {
|
|
16
|
+
console.log("itemCallback", itemCallback);
|
|
17
|
+
useQuickActionCallback(action => {
|
|
18
|
+
if (action) {
|
|
19
|
+
console.log("action", action);
|
|
20
|
+
itemCallbackFunction(action);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default new HmeActions();
|
package/types/index.d.ts
CHANGED
|
@@ -213,6 +213,8 @@ declare module 'apps-sdk' {
|
|
|
213
213
|
isActivated(): Promise<boolean>;
|
|
214
214
|
createPaywallView(paywall: any): Promise<any>;
|
|
215
215
|
showPaywall(placementID: any, lang: any, eventHandlers?: PaywallEventHandlers): Promise<void>;
|
|
216
|
+
preloadPaywall(placementID: any, lang: any): Promise<any>
|
|
217
|
+
showPaywallPreloaded(paywallView: any, eventHandlers?: PaywallEventHandlers): Promise<void>;
|
|
216
218
|
getProfile(): Promise<any>;
|
|
217
219
|
}
|
|
218
220
|
|