webtonative 1.0.78-beta.3 → 1.0.78-beta.5

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.
@@ -1,10 +1,12 @@
1
1
  type ICb = {
2
- callback: (response: {
2
+ callback?: (response: {
3
3
  type: string;
4
4
  } & Record<string, any>) => void;
5
5
  };
6
6
  export declare const onUnreadChatCountsChange: (options?: ICb) => void;
7
- export declare const openConnectWidget: (options?: ICb) => void;
7
+ export declare const openConnectWidget: (data?: ICb & {
8
+ chatId?: string;
9
+ }) => void;
8
10
  export declare const widgetLogin: (data?: Record<string, any>) => void;
9
11
  export declare const setUserDetails: (data?: Record<string, any>) => void;
10
12
  export declare const widgetLogout: () => void;
@@ -17,7 +19,7 @@ export declare const setExternalUserid: (options: ICb & {
17
19
  }) => void;
18
20
  export declare const isUserLoggedIn: (options: ICb) => void;
19
21
  export declare const getUser: (options: ICb) => void;
20
- export declare const setWidgetConfig: (options: Record<string, any>) => void;
22
+ export declare const setWidgetConfig: (data: Record<string, any>) => void;
21
23
  export declare const getUnreadChatsCount: (options: ICb) => void;
22
- export declare const sendChatMessage: (options: ICb) => void;
24
+ export declare const sendChatMessage: (data: ICb) => void;
23
25
  export {};
@@ -21,8 +21,8 @@ var onUnreadChatCountsChange = function (options) {
21
21
  }
22
22
  };
23
23
  exports.onUnreadChatCountsChange = onUnreadChatCountsChange;
24
- var openConnectWidget = function (options) {
25
- var callback = (options || {}).callback;
24
+ var openConnectWidget = function (data) {
25
+ var callback = (data || {}).callback;
26
26
  (0, utills_1.registerCb)(function (response) {
27
27
  var type = response.type;
28
28
  if (type === "openConnectWidget") {
@@ -30,18 +30,19 @@ var openConnectWidget = function (options) {
30
30
  }
31
31
  });
32
32
  if (index_1.isAndroidApp) {
33
- utills_1.webToNative.openConnectWidget();
33
+ utills_1.webToNative.openConnectWidget(JSON.stringify({ data: data }));
34
34
  }
35
35
  else if (index_1.isIosApp && utills_1.webToNativeIos) {
36
36
  utills_1.webToNativeIos.postMessage({
37
37
  action: "openConnectWidget",
38
+ data: data,
38
39
  });
39
40
  }
40
41
  };
41
42
  exports.openConnectWidget = openConnectWidget;
42
43
  var widgetLogin = function (data) {
43
44
  if (index_1.isAndroidApp) {
44
- utills_1.webToNative.widgetLogin(JSON.stringify(data));
45
+ utills_1.webToNative.widgetLogin(JSON.stringify({ data: data }));
45
46
  }
46
47
  else if (index_1.isIosApp && utills_1.webToNativeIos) {
47
48
  utills_1.webToNativeIos.postMessage({
@@ -53,7 +54,7 @@ var widgetLogin = function (data) {
53
54
  exports.widgetLogin = widgetLogin;
54
55
  var setUserDetails = function (data) {
55
56
  if (index_1.isAndroidApp) {
56
- utills_1.webToNative.setUserDetails(JSON.stringify(data));
57
+ utills_1.webToNative.setUserDetails(JSON.stringify({ data: data }));
57
58
  }
58
59
  else if (index_1.isIosApp && utills_1.webToNativeIos) {
59
60
  utills_1.webToNativeIos.postMessage({
@@ -101,7 +102,7 @@ var setAppId = function (options) {
101
102
  }
102
103
  });
103
104
  if (index_1.isAndroidApp) {
104
- utills_1.webToNative.setAppId(JSON.stringify(appId));
105
+ utills_1.webToNative.setAppId(JSON.stringify({ data: appId }));
105
106
  }
106
107
  else if (index_1.isIosApp && utills_1.webToNativeIos) {
107
108
  utills_1.webToNativeIos.postMessage({
@@ -120,7 +121,7 @@ var setExternalUserid = function (options) {
120
121
  }
121
122
  });
122
123
  if (index_1.isAndroidApp) {
123
- utills_1.webToNative.setExternalUserid(JSON.stringify(externalUserId));
124
+ utills_1.webToNative.setExternalUserid(JSON.stringify({ data: externalUserId }));
124
125
  }
125
126
  else if (index_1.isIosApp && utills_1.webToNativeIos) {
126
127
  utills_1.webToNativeIos.postMessage({
@@ -166,14 +167,14 @@ var getUser = function (options) {
166
167
  }
167
168
  };
168
169
  exports.getUser = getUser;
169
- var setWidgetConfig = function (options) {
170
+ var setWidgetConfig = function (data) {
170
171
  if (index_1.isAndroidApp) {
171
- utills_1.webToNative.setWidgetConfig(JSON.stringify(options));
172
+ utills_1.webToNative.setWidgetConfig(JSON.stringify({ data: data }));
172
173
  }
173
174
  else if (index_1.isIosApp && utills_1.webToNativeIos) {
174
175
  utills_1.webToNativeIos.postMessage({
175
176
  action: "setWidgetConfig",
176
- data: options,
177
+ data: data,
177
178
  });
178
179
  }
179
180
  };
@@ -196,8 +197,8 @@ var getUnreadChatsCount = function (options) {
196
197
  }
197
198
  };
198
199
  exports.getUnreadChatsCount = getUnreadChatsCount;
199
- var sendChatMessage = function (options) {
200
- var callback = (options || {}).callback;
200
+ var sendChatMessage = function (data) {
201
+ var callback = (data || {}).callback;
201
202
  (0, utills_1.registerCb)(function (response) {
202
203
  var type = response.type;
203
204
  if (type === "sendChatMessage") {
@@ -205,12 +206,12 @@ var sendChatMessage = function (options) {
205
206
  }
206
207
  });
207
208
  if (index_1.isAndroidApp) {
208
- utills_1.webToNative.sendChatMessage(JSON.stringify(options));
209
+ utills_1.webToNative.sendChatMessage(JSON.stringify({ data: data }));
209
210
  }
210
211
  else if (index_1.isIosApp && utills_1.webToNativeIos) {
211
212
  utills_1.webToNativeIos.postMessage({
212
213
  action: "sendChatMessage",
213
- data: options,
214
+ data: data,
214
215
  });
215
216
  }
216
217
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webtonative",
3
- "version": "1.0.78-beta.3",
3
+ "version": "1.0.78-beta.5",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",