webtonative 1.0.78-beta.1 → 1.0.78-beta.2

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,22 @@
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 widgetLogin: (data?: Record<string, any>) => void;
8
+ export declare const setUserDetails: (data?: Record<string, any>) => void;
9
+ export declare const widgetLogout: () => void;
10
+ export declare const isInitializationDone: (options?: ICb) => void;
11
+ export declare const setAppId: (options: ICb & {
12
+ appId: string;
13
+ }) => void;
14
+ export declare const setExternalUserid: (options: ICb & {
15
+ externalUserId: string;
16
+ }) => void;
17
+ export declare const isUserLoggedIn: (options: ICb) => void;
18
+ export declare const getUser: (options: ICb) => void;
19
+ export declare const setWidgetConfig: (options: Record<string, any>) => void;
20
+ export declare const getUnreadChatsCount: (options: ICb) => void;
21
+ export declare const sendChatMessage: (options: ICb) => void;
22
+ export {};
@@ -0,0 +1,199 @@
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.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 widgetLogin = function (data) {
25
+ if (index_1.isAndroidApp) {
26
+ utills_1.webToNative.widgetLogin(JSON.stringify(data));
27
+ }
28
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
29
+ utills_1.webToNativeIos.postMessage({
30
+ action: "widgetLogin",
31
+ data: data,
32
+ });
33
+ }
34
+ };
35
+ exports.widgetLogin = widgetLogin;
36
+ var setUserDetails = function (data) {
37
+ if (index_1.isAndroidApp) {
38
+ utills_1.webToNative.setUserDetails(JSON.stringify(data));
39
+ }
40
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
41
+ utills_1.webToNativeIos.postMessage({
42
+ action: "setUserDetails",
43
+ data: data,
44
+ });
45
+ }
46
+ };
47
+ exports.setUserDetails = setUserDetails;
48
+ var widgetLogout = function () {
49
+ if (index_1.isAndroidApp) {
50
+ utills_1.webToNative.widgetLogout();
51
+ }
52
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
53
+ utills_1.webToNativeIos.postMessage({
54
+ action: "widgetLogout",
55
+ });
56
+ }
57
+ };
58
+ exports.widgetLogout = widgetLogout;
59
+ var isInitializationDone = function (options) {
60
+ var callback = (options || {}).callback;
61
+ (0, utills_1.registerCb)(function (response) {
62
+ var type = response.type;
63
+ if (type === "isInitializationDone") {
64
+ callback && callback(response);
65
+ }
66
+ });
67
+ if (index_1.isAndroidApp) {
68
+ utills_1.webToNative.isInitializationDone();
69
+ }
70
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
71
+ utills_1.webToNativeIos.postMessage({
72
+ action: "isInitializationDone",
73
+ });
74
+ }
75
+ };
76
+ exports.isInitializationDone = isInitializationDone;
77
+ var setAppId = function (options) {
78
+ var _a = options || {}, callback = _a.callback, appId = _a.appId;
79
+ (0, utills_1.registerCb)(function (response) {
80
+ var type = response.type;
81
+ if (type === "setAppId") {
82
+ callback && callback(response);
83
+ }
84
+ });
85
+ if (index_1.isAndroidApp) {
86
+ utills_1.webToNative.setAppId(JSON.stringify(appId));
87
+ }
88
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
89
+ utills_1.webToNativeIos.postMessage({
90
+ action: "setAppId",
91
+ appId: appId,
92
+ });
93
+ }
94
+ };
95
+ exports.setAppId = setAppId;
96
+ var setExternalUserid = function (options) {
97
+ var _a = options || {}, callback = _a.callback, externalUserId = _a.externalUserId;
98
+ (0, utills_1.registerCb)(function (response) {
99
+ var type = response.type;
100
+ if (type === "setExternalUserid") {
101
+ callback && callback(response);
102
+ }
103
+ });
104
+ if (index_1.isAndroidApp) {
105
+ utills_1.webToNative.setExternalUserid(JSON.stringify(externalUserId));
106
+ }
107
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
108
+ utills_1.webToNativeIos.postMessage({
109
+ action: "setExternalUserid",
110
+ externalUserId: externalUserId,
111
+ });
112
+ }
113
+ };
114
+ exports.setExternalUserid = setExternalUserid;
115
+ var isUserLoggedIn = function (options) {
116
+ var callback = (options || {}).callback;
117
+ (0, utills_1.registerCb)(function (response) {
118
+ var type = response.type;
119
+ if (type === "isUserLoggedIn") {
120
+ callback && callback(response);
121
+ }
122
+ });
123
+ if (index_1.isAndroidApp) {
124
+ utills_1.webToNative.isUserLoggedIn();
125
+ }
126
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
127
+ utills_1.webToNativeIos.postMessage({
128
+ action: "isUserLoggedIn",
129
+ });
130
+ }
131
+ };
132
+ exports.isUserLoggedIn = isUserLoggedIn;
133
+ var getUser = function (options) {
134
+ var callback = (options || {}).callback;
135
+ (0, utills_1.registerCb)(function (response) {
136
+ var type = response.type;
137
+ if (type === "getUser") {
138
+ callback && callback(response);
139
+ }
140
+ });
141
+ if (index_1.isAndroidApp) {
142
+ utills_1.webToNative.getUser();
143
+ }
144
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
145
+ utills_1.webToNativeIos.postMessage({
146
+ action: "getUser",
147
+ });
148
+ }
149
+ };
150
+ exports.getUser = getUser;
151
+ var setWidgetConfig = function (options) {
152
+ if (index_1.isAndroidApp) {
153
+ utills_1.webToNative.setWidgetConfig(JSON.stringify(options));
154
+ }
155
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
156
+ utills_1.webToNativeIos.postMessage({
157
+ action: "setWidgetConfig",
158
+ data: options,
159
+ });
160
+ }
161
+ };
162
+ exports.setWidgetConfig = setWidgetConfig;
163
+ var getUnreadChatsCount = function (options) {
164
+ var callback = (options || {}).callback;
165
+ (0, utills_1.registerCb)(function (response) {
166
+ var type = response.type;
167
+ if (type === "getUnreadChatsCount") {
168
+ callback && callback(response);
169
+ }
170
+ });
171
+ if (index_1.isAndroidApp) {
172
+ utills_1.webToNative.getUnreadChatsCount();
173
+ }
174
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
175
+ utills_1.webToNativeIos.postMessage({
176
+ action: "getUnreadChatsCount",
177
+ });
178
+ }
179
+ };
180
+ exports.getUnreadChatsCount = getUnreadChatsCount;
181
+ var sendChatMessage = function (options) {
182
+ var callback = (options || {}).callback;
183
+ (0, utills_1.registerCb)(function (response) {
184
+ var type = response.type;
185
+ if (type === "sendChatMessage") {
186
+ callback && callback(response);
187
+ }
188
+ });
189
+ if (index_1.isAndroidApp) {
190
+ utills_1.webToNative.sendChatMessage(JSON.stringify(options));
191
+ }
192
+ else if (index_1.isIosApp && utills_1.webToNativeIos) {
193
+ utills_1.webToNativeIos.postMessage({
194
+ action: "sendChatMessage",
195
+ data: options,
196
+ });
197
+ }
198
+ };
199
+ exports.sendChatMessage = sendChatMessage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webtonative",
3
- "version": "1.0.78-beta.1",
3
+ "version": "1.0.78-beta.2",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -131,6 +131,10 @@
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"