cordova-plugin-ymchat 2.19.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.19.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.19.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.22.1" 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">
@@ -24,5 +24,5 @@ repositories {
24
24
  dependencies {
25
25
  implementation 'androidx.appcompat:appcompat:1.0.2'
26
26
  implementation 'androidx.annotation:annotation:1.0.2'
27
- implementation 'com.github.yellowmessenger:YMChatbot-Android:v2.20.0'
27
+ implementation 'com.github.yellowmessenger:YMChatbot-Android:v2.21.0'
28
28
  }
@@ -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;
@@ -128,6 +131,9 @@ public class YmChatCordova extends CordovaPlugin {
128
131
  case "setChatContainerTheme":
129
132
  setChatContainerTheme(args,callbackContext);
130
133
  return true;
134
+ case "setThemeLinkColor":
135
+ setThemeLinkColor(args,callbackContext);
136
+ return true;
131
137
  }
132
138
  return false;
133
139
  }
@@ -261,6 +267,10 @@ public class YmChatCordova extends CordovaPlugin {
261
267
  ymChatService.onBotClose(onBotCloseEvent);
262
268
  }
263
269
 
270
+ public void onBotLoadFailed(CallbackContext onBotLoadFailedEvent) {
271
+ ymChatService.onBotLoadFailed(onBotLoadFailedEvent);
272
+ }
273
+
264
274
  private void unlinkDeviceToken(JSONArray args, CallbackContext callbackContext) {
265
275
  try {
266
276
  String apiKey = args.getString(0);
@@ -423,6 +433,15 @@ public class YmChatCordova extends CordovaPlugin {
423
433
  }
424
434
  }
425
435
 
436
+ public void setThemeLinkColor(JSONArray args, CallbackContext callbackContext) {
437
+ try {
438
+ String color = args.getString(0);
439
+ ymChatService.setThemeLinkColor(color, callbackContext);
440
+ } catch (Exception e) {
441
+ Utils.genericErrorHelper(e, callbackContext);
442
+ }
443
+ }
444
+
426
445
  private void revalidateToken(JSONArray args, CallbackContext callbackContext) {
427
446
  try {
428
447
  String token = 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() {
@@ -257,6 +270,10 @@ public class YmChatService {
257
270
  ymChat.config.theme.chatBotTheme = theme;
258
271
  }
259
272
 
273
+ public void setThemeLinkColor(String color, CallbackContext callbackContext) {
274
+ ymChat.config.theme.linkColor = color;
275
+ }
276
+
260
277
  public void revalidateToken(String token, boolean refreshSession, CallbackContext callbackContext) {
261
278
  try {
262
279
  ymChat.revalidateToken(token, refreshSession);
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);
@@ -306,6 +319,13 @@
306
319
  YMChat.shared.config.theme.chatBotTheme = theme;
307
320
  }
308
321
 
322
+ - (void)setThemeLinkColor:(CDVInvokedUrlCommand*)command
323
+ {
324
+ NSString* color = [command.arguments objectAtIndex:0];
325
+ assert(YMChat.shared.config != nil);
326
+ YMChat.shared.config.theme.linkColor = [self getColorFromHexString:color];
327
+ }
328
+
309
329
  - (void)revalidateToken:(CDVInvokedUrlCommand*)command
310
330
  {
311
331
  NSString* token = [command.arguments objectAtIndex:0];
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
  },
@@ -104,6 +107,9 @@ const YmChatAPI = {
104
107
  setChatContainerTheme: (theme) => {
105
108
  exec(null, null, "ymchat", "setChatContainerTheme", [theme]);
106
109
  },
110
+ setThemeLinkColor: (color) => {
111
+ exec(null, null, "ymchat", "setThemeLinkColor", [color]);
112
+ },
107
113
  revalidateToken: (token, refreshSession) => {
108
114
  exec(null, null, "ymchat", "revalidateToken", [token, refreshSession]);
109
115
  },