cordova-plugin-ymchat 2.20.0 → 2.21.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-plugin-ymchat",
3
- "version": "2.20.0",
3
+ "version": "2.21.0",
4
4
  "description": "Cordova plugin to integrate yellow.ai chatbot",
5
5
  "cordova": {
6
6
  "id": "cordova-plugin-ymchat",
package/plugin.xml CHANGED
@@ -1,5 +1,5 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
- <plugin id="cordova-plugin-ymchat" version="2.20.0"
2
+ <plugin id="cordova-plugin-ymchat" version="2.21.0"
3
3
  xmlns="http://apache.org/cordova/ns/plugins/1.0"
4
4
  xmlns:android="http://schemas.android.com/apk/res/android">
5
5
  <name>ymchat</name>
@@ -33,7 +33,7 @@
33
33
  <source url="https://github.com/CocoaPods/Specs.git" branch="master"/>
34
34
  </config>
35
35
  <pods use-frameworks="true">
36
- <pod name="YMChat" spec="~> 1.23.0" swift-version="5.0"/>
36
+ <pod name="YMChat" spec="~> 1.24.0" swift-version="5.0"/>
37
37
  </pods>
38
38
  </podspec>
39
39
  <config-file parent="/*" target="config.xml">
@@ -47,6 +47,9 @@ public class YmChatCordova extends CordovaPlugin {
47
47
  case "onBotClose":
48
48
  onBotClose(callbackContext);
49
49
  return true;
50
+ case "onBotLoadFailed":
51
+ onBotLoadFailed(callbackContext);
52
+ return true;
50
53
  case "startChatbot":
51
54
  startChatbot(callbackContext);
52
55
  return true;
@@ -264,6 +267,10 @@ public class YmChatCordova extends CordovaPlugin {
264
267
  ymChatService.onBotClose(onBotCloseEvent);
265
268
  }
266
269
 
270
+ public void onBotLoadFailed(CallbackContext onBotLoadFailedEvent) {
271
+ ymChatService.onBotLoadFailed(onBotLoadFailedEvent);
272
+ }
273
+
267
274
  private void unlinkDeviceToken(JSONArray args, CallbackContext callbackContext) {
268
275
  try {
269
276
  String apiKey = args.getString(0);
@@ -120,6 +120,19 @@ public class YmChatService {
120
120
  });
121
121
  }
122
122
 
123
+ public void onBotLoadFailed(CallbackContext callback) {
124
+ ymChat.onBotLoadFailed(() ->
125
+ {
126
+ try {
127
+ PluginResult result = new PluginResult(PluginResult.Status.OK);
128
+ result.setKeepCallback(true);
129
+ callback.sendPluginResult(result);
130
+ } catch (Exception e) {
131
+ Log.e(Tag, ExceptionString, e);
132
+ }
133
+ });
134
+ }
135
+
123
136
  public void unlinkDeviceToken(String apiKey, CallbackContext callbackContext) {
124
137
  try{
125
138
  ymChat.unlinkDeviceToken(apiKey, ymChat.config, new YellowCallback() {
package/src/ios/ymchat.m CHANGED
@@ -8,6 +8,7 @@
8
8
  {
9
9
  CDVInvokedUrlCommand* onEvent;
10
10
  CDVInvokedUrlCommand* onBotClosed;
11
+ CDVInvokedUrlCommand* onBotLoadFailed;
11
12
  }
12
13
 
13
14
  @end
@@ -80,6 +81,11 @@
80
81
  onBotClosed = command;
81
82
  }
82
83
 
84
+ - (void)onBotLoadFailed:(CDVInvokedUrlCommand*)command
85
+ {
86
+ onBotLoadFailed = command;
87
+ }
88
+
83
89
  - (void)startChatbot:(CDVInvokedUrlCommand*)command
84
90
  {
85
91
  assert(YMChat.shared.config != nil);
@@ -116,6 +122,13 @@
116
122
  [self.commandDelegate sendPluginResult:pluginResult callbackId:onBotClosed.callbackId];
117
123
  }
118
124
 
125
+ - (void) onBotLoadFailed {
126
+ CDVPluginResult* pluginResult = nil;
127
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"Bot Load Failed"];
128
+ [pluginResult setKeepCallbackAsBool:YES];
129
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:onBotLoadFailed.callbackId];
130
+ }
131
+
119
132
  - (void)setVersion:(CDVInvokedUrlCommand*)command
120
133
  {
121
134
  assert(YMChat.shared.config != nil);
package/www/ymchat.js CHANGED
@@ -29,6 +29,9 @@ const YmChatAPI = {
29
29
  onBotClose: (onBotCloseEvent) => {
30
30
  exec(onBotCloseEvent, null, "ymchat", "onBotClose", []);
31
31
  },
32
+ onBotLoadFailed: (onBotLoadFailedEvent) => {
33
+ exec(onBotLoadFailedEvent, null, "ymchat", "onBotLoadFailed", []);
34
+ },
32
35
  startChatbot: (success, failure) => {
33
36
  exec(success, failure, "ymchat", "startChatbot", []);
34
37
  },