webtonative 1.0.79 → 1.0.80

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.
@@ -0,0 +1,25 @@
1
+ type ICb = {
2
+ callback?: (response: {
3
+ type: string;
4
+ } & Record<string, any>) => void;
5
+ };
6
+ export declare const onUnreadChatCountsChange: (options?: ICb) => void;
7
+ export declare const openConnectWidget: (data?: ICb & {
8
+ chatId?: string;
9
+ }) => void;
10
+ export declare const widgetLogin: (data?: Record<string, any>) => void;
11
+ export declare const setUserDetails: (data?: Record<string, any>) => void;
12
+ export declare const widgetLogout: () => void;
13
+ export declare const isInitializationDone: (options?: ICb) => void;
14
+ export declare const setAppId: (options: ICb & {
15
+ appId: string;
16
+ }) => void;
17
+ export declare const setExternalUserid: (options: ICb & {
18
+ externalUserId: string;
19
+ }) => void;
20
+ export declare const isUserLoggedIn: (options: ICb) => void;
21
+ export declare const getUser: (options: ICb) => void;
22
+ export declare const setWidgetConfig: (data: Record<string, any>) => void;
23
+ export declare const getUnreadChatsCount: (options: ICb) => void;
24
+ export declare const sendChatMessage: (data: ICb) => void;
25
+ export {};
@@ -0,0 +1,218 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendChatMessage = exports.getUnreadChatsCount = exports.setWidgetConfig = exports.getUser = exports.isUserLoggedIn = exports.setExternalUserid = exports.setAppId = exports.isInitializationDone = exports.widgetLogout = exports.setUserDetails = exports.widgetLogin = exports.openConnectWidget = exports.onUnreadChatCountsChange = void 0;
4
+ var index_1 = require("../index");
5
+ var utills_1 = require("../utills");
6
+ var onUnreadChatCountsChange = function (options) {
7
+ var callback = (options || {}).callback;
8
+ (0, utills_1.registerCb)(function (response) {
9
+ var type = response.type;
10
+ if (type === "onUnreadChatCountsChange") {
11
+ callback && callback(response);
12
+ }
13
+ });
14
+ if (index_1.isAndroidApp) {
15
+ utills_1.webToNative.onUnreadChatCountsChange();
16
+ }
17
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
18
+ utills_1.webToNativeIos.postMessage({
19
+ action: "onUnreadChatCountsChange",
20
+ });
21
+ }
22
+ };
23
+ exports.onUnreadChatCountsChange = onUnreadChatCountsChange;
24
+ var openConnectWidget = function (data) {
25
+ var callback = (data || {}).callback;
26
+ (0, utills_1.registerCb)(function (response) {
27
+ var type = response.type;
28
+ if (type === "openConnectWidget") {
29
+ callback && callback(response);
30
+ }
31
+ });
32
+ if (index_1.isAndroidApp) {
33
+ utills_1.webToNative.openConnectWidget(JSON.stringify({ data: data }));
34
+ }
35
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
36
+ utills_1.webToNativeIos.postMessage({
37
+ action: "openConnectWidget",
38
+ data: data,
39
+ });
40
+ }
41
+ };
42
+ exports.openConnectWidget = openConnectWidget;
43
+ var widgetLogin = function (data) {
44
+ if (index_1.isAndroidApp) {
45
+ utills_1.webToNative.widgetLogin(JSON.stringify({ data: data }));
46
+ }
47
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
48
+ utills_1.webToNativeIos.postMessage({
49
+ action: "widgetLogin",
50
+ data: data,
51
+ });
52
+ }
53
+ };
54
+ exports.widgetLogin = widgetLogin;
55
+ var setUserDetails = function (data) {
56
+ if (index_1.isAndroidApp) {
57
+ utills_1.webToNative.setUserDetails(JSON.stringify({ data: data }));
58
+ }
59
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
60
+ utills_1.webToNativeIos.postMessage({
61
+ action: "setUserDetails",
62
+ data: data,
63
+ });
64
+ }
65
+ };
66
+ exports.setUserDetails = setUserDetails;
67
+ var widgetLogout = function () {
68
+ if (index_1.isAndroidApp) {
69
+ utills_1.webToNative.widgetLogout();
70
+ }
71
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
72
+ utills_1.webToNativeIos.postMessage({
73
+ action: "widgetLogout",
74
+ });
75
+ }
76
+ };
77
+ exports.widgetLogout = widgetLogout;
78
+ var isInitializationDone = function (options) {
79
+ var callback = (options || {}).callback;
80
+ (0, utills_1.registerCb)(function (response) {
81
+ var type = response.type;
82
+ if (type === "isInitializationDone") {
83
+ callback && callback(response);
84
+ }
85
+ });
86
+ if (index_1.isAndroidApp) {
87
+ utills_1.webToNative.isInitializationDone();
88
+ }
89
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
90
+ utills_1.webToNativeIos.postMessage({
91
+ action: "isInitializationDone",
92
+ });
93
+ }
94
+ };
95
+ exports.isInitializationDone = isInitializationDone;
96
+ var setAppId = function (options) {
97
+ var _a = options || {}, callback = _a.callback, appId = _a.appId;
98
+ (0, utills_1.registerCb)(function (response) {
99
+ var type = response.type;
100
+ if (type === "setAppId") {
101
+ callback && callback(response);
102
+ }
103
+ });
104
+ if (index_1.isAndroidApp) {
105
+ utills_1.webToNative.setAppId(JSON.stringify({ data: appId }));
106
+ }
107
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
108
+ utills_1.webToNativeIos.postMessage({
109
+ action: "setAppId",
110
+ appId: appId,
111
+ });
112
+ }
113
+ };
114
+ exports.setAppId = setAppId;
115
+ var setExternalUserid = function (options) {
116
+ var _a = options || {}, callback = _a.callback, externalUserId = _a.externalUserId;
117
+ (0, utills_1.registerCb)(function (response) {
118
+ var type = response.type;
119
+ if (type === "setExternalUserid") {
120
+ callback && callback(response);
121
+ }
122
+ });
123
+ if (index_1.isAndroidApp) {
124
+ utills_1.webToNative.setExternalUserid(JSON.stringify({ data: externalUserId }));
125
+ }
126
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
127
+ utills_1.webToNativeIos.postMessage({
128
+ action: "setExternalUserid",
129
+ externalUserId: externalUserId,
130
+ });
131
+ }
132
+ };
133
+ exports.setExternalUserid = setExternalUserid;
134
+ var isUserLoggedIn = function (options) {
135
+ var callback = (options || {}).callback;
136
+ (0, utills_1.registerCb)(function (response) {
137
+ var type = response.type;
138
+ if (type === "isUserLoggedIn") {
139
+ callback && callback(response);
140
+ }
141
+ });
142
+ if (index_1.isAndroidApp) {
143
+ utills_1.webToNative.isUserLoggedIn();
144
+ }
145
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
146
+ utills_1.webToNativeIos.postMessage({
147
+ action: "isUserLoggedIn",
148
+ });
149
+ }
150
+ };
151
+ exports.isUserLoggedIn = isUserLoggedIn;
152
+ var getUser = function (options) {
153
+ var callback = (options || {}).callback;
154
+ (0, utills_1.registerCb)(function (response) {
155
+ var type = response.type;
156
+ if (type === "getUser") {
157
+ callback && callback(response);
158
+ }
159
+ });
160
+ if (index_1.isAndroidApp) {
161
+ utills_1.webToNative.getUser();
162
+ }
163
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
164
+ utills_1.webToNativeIos.postMessage({
165
+ action: "getUser",
166
+ });
167
+ }
168
+ };
169
+ exports.getUser = getUser;
170
+ var setWidgetConfig = function (data) {
171
+ if (index_1.isAndroidApp) {
172
+ utills_1.webToNative.setWidgetConfig(JSON.stringify({ data: data }));
173
+ }
174
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
175
+ utills_1.webToNativeIos.postMessage({
176
+ action: "setWidgetConfig",
177
+ data: data,
178
+ });
179
+ }
180
+ };
181
+ exports.setWidgetConfig = setWidgetConfig;
182
+ var getUnreadChatsCount = function (options) {
183
+ var callback = (options || {}).callback;
184
+ (0, utills_1.registerCb)(function (response) {
185
+ var type = response.type;
186
+ if (type === "getUnreadChatsCount") {
187
+ callback && callback(response);
188
+ }
189
+ });
190
+ if (index_1.isAndroidApp) {
191
+ utills_1.webToNative.getUnreadChatsCount();
192
+ }
193
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
194
+ utills_1.webToNativeIos.postMessage({
195
+ action: "getUnreadChatsCount",
196
+ });
197
+ }
198
+ };
199
+ exports.getUnreadChatsCount = getUnreadChatsCount;
200
+ var sendChatMessage = function (data) {
201
+ var callback = (data || {}).callback;
202
+ (0, utills_1.registerCb)(function (response) {
203
+ var type = response.type;
204
+ if (type === "sendChatMessage") {
205
+ callback && callback(response);
206
+ }
207
+ });
208
+ if (index_1.isAndroidApp) {
209
+ utills_1.webToNative.sendChatMessage(JSON.stringify({ data: data }));
210
+ }
211
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
212
+ utills_1.webToNativeIos.postMessage({
213
+ action: "sendChatMessage",
214
+ data: data,
215
+ });
216
+ }
217
+ };
218
+ exports.sendChatMessage = sendChatMessage;
package/README.md CHANGED
@@ -15,14 +15,11 @@ This package includes TypeScript type definitions. You can use it in your TypeSc
15
15
  ```typescript
16
16
  import webtonative from 'webtonative';
17
17
 
18
- // Initialize the SDK
19
- const wtn = webtonative();
20
-
21
18
  // Use with TypeScript type checking
22
- wtn.statusBar({ color: '#FFFFFF', style: 'dark' });
19
+ webtonative.statusBar({ color: '#FFFFFF', style: 'dark' });
23
20
 
24
21
  // Access device information with typed response
25
- wtn.deviceInfo().then(info => {
22
+ webtonative.deviceInfo().then(info => {
26
23
  console.log(info);
27
24
  });
28
25
  ```
@@ -0,0 +1,7 @@
1
+ export declare const configure: (options: any) => void;
2
+ export declare const isInitialized: (options: any) => void;
3
+ export declare const setUserId: (options: any) => void;
4
+ export declare const getCustomerInfo: (options: any) => void;
5
+ export declare const showPaywall: (options: any) => void;
6
+ export declare const makePurchase: (options: any) => void;
7
+ export declare const restorePurchase: (options: any) => void;
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.restorePurchase = exports.makePurchase = exports.showPaywall = exports.getCustomerInfo = exports.setUserId = exports.isInitialized = exports.configure = void 0;
4
+ var index_1 = require("./../index");
5
+ var utills_1 = require("../utills");
6
+ var configure = function (options) {
7
+ var _a = options || {}, apiKey = _a.apiKey, userId = _a.userId, callback = _a.callback;
8
+ (0, utills_1.registerCb)(function (response) {
9
+ var type = response.type;
10
+ if (type === "configure") {
11
+ callback && callback(response);
12
+ }
13
+ });
14
+ if (index_1.isAndroidApp) {
15
+ utills_1.webToNative.configure(JSON.stringify(options));
16
+ }
17
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
18
+ utills_1.webToNativeIos.postMessage({
19
+ action: "configure",
20
+ apiKey: apiKey,
21
+ userId: userId,
22
+ });
23
+ }
24
+ };
25
+ exports.configure = configure;
26
+ var isInitialized = function (options) {
27
+ var callback = (options || {}).callback;
28
+ (0, utills_1.registerCb)(function (response) {
29
+ var type = response.type;
30
+ if (type === "isInitialized") {
31
+ callback && callback(response);
32
+ }
33
+ });
34
+ if (index_1.isAndroidApp) {
35
+ utills_1.webToNative.isInitialized();
36
+ }
37
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
38
+ utills_1.webToNativeIos.postMessage({
39
+ action: "isInitialized",
40
+ });
41
+ }
42
+ };
43
+ exports.isInitialized = isInitialized;
44
+ var setUserId = function (options) {
45
+ var _a = options || {}, userId = _a.userId, callback = _a.callback;
46
+ (0, utills_1.registerCb)(function (response) {
47
+ var type = response.type;
48
+ if (type === "setUserId") {
49
+ callback && callback(response);
50
+ }
51
+ });
52
+ if (index_1.isAndroidApp) {
53
+ utills_1.webToNative.setUserId(JSON.stringify(options));
54
+ }
55
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
56
+ utills_1.webToNativeIos.postMessage({
57
+ action: "setUserId",
58
+ userId: userId,
59
+ });
60
+ }
61
+ };
62
+ exports.setUserId = setUserId;
63
+ var getCustomerInfo = function (options) {
64
+ var callback = (options || {}).callback;
65
+ (0, utills_1.registerCb)(function (response) {
66
+ var type = response.type;
67
+ if (type === "getCustomerInfo") {
68
+ callback && callback(response);
69
+ }
70
+ });
71
+ if (index_1.isAndroidApp) {
72
+ utills_1.webToNative.getCustomerInfo();
73
+ }
74
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
75
+ utills_1.webToNativeIos.postMessage({
76
+ action: "getCustomerInfo",
77
+ });
78
+ }
79
+ };
80
+ exports.getCustomerInfo = getCustomerInfo;
81
+ var showPaywall = function (options) {
82
+ var _a = options || {}, offeringId = _a.offeringId, callback = _a.callback;
83
+ (0, utills_1.registerCb)(function (response) {
84
+ var type = response.type;
85
+ if (type === "showPaywall") {
86
+ callback && callback(response);
87
+ }
88
+ });
89
+ if (index_1.isAndroidApp) {
90
+ utills_1.webToNative.showPaywall(JSON.stringify(options));
91
+ }
92
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
93
+ utills_1.webToNativeIos.postMessage({
94
+ action: "showPaywall",
95
+ offeringId: offeringId,
96
+ });
97
+ }
98
+ };
99
+ exports.showPaywall = showPaywall;
100
+ var makePurchase = function (options) {
101
+ var _a = options || {}, productId = _a.productId, callback = _a.callback;
102
+ (0, utills_1.registerCb)(function (response) {
103
+ var type = response.type;
104
+ if (type === "makePurchase") {
105
+ callback && callback(response);
106
+ }
107
+ });
108
+ if (index_1.isAndroidApp) {
109
+ utills_1.webToNative.makePurchase(JSON.stringify(options));
110
+ }
111
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
112
+ utills_1.webToNativeIos.postMessage({
113
+ action: "makePurchase",
114
+ productId: productId,
115
+ });
116
+ }
117
+ };
118
+ exports.makePurchase = makePurchase;
119
+ var restorePurchase = function (options) {
120
+ var callback = (options || {}).callback;
121
+ (0, utills_1.registerCb)(function (response) {
122
+ var type = response.type;
123
+ if (type === "restorePurchase") {
124
+ callback && callback(response);
125
+ }
126
+ });
127
+ if (index_1.isAndroidApp) {
128
+ utills_1.webToNative.restorePurchase();
129
+ }
130
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
131
+ utills_1.webToNativeIos.postMessage({
132
+ action: "restorePurchase",
133
+ });
134
+ }
135
+ };
136
+ exports.restorePurchase = restorePurchase;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webtonative",
3
- "version": "1.0.79",
3
+ "version": "1.0.80",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -131,10 +131,18 @@
131
131
  "import": "./OneSignal/index.js",
132
132
  "types": "./OneSignal/index.d.ts"
133
133
  },
134
+ "./OrufyConnect": {
135
+ "import": "./OrufyConnect/index.js",
136
+ "types": "./OrufyConnect/index.d.ts"
137
+ },
134
138
  "./Printing": {
135
139
  "import": "./Printing/index.js",
136
140
  "types": "./Printing/index.d.ts"
137
141
  },
142
+ "./RevenueCat": {
143
+ "import": "./RevenueCat/index.js",
144
+ "types": "./RevenueCat/index.d.ts"
145
+ },
138
146
  "./Screen": {
139
147
  "import": "./Screen/index.js",
140
148
  "types": "./Screen/index.d.ts"