cordova-plugin-ymchat 3.0.0 → 3.1.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/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.1.0]
9
+
10
+ ### Added
11
+
12
+ - **Activation Mode** — lets the host app open the widget directly into voice mode instead of chat, via `cordova.plugins.ymchat.setActivationMode('voice')` (or `'chat'`, the default). Bridges the native SDKs' `activationMode` config for the first time (iOS `YMChat` since 2.1.0, Android `YMChatbot-Android` since v3.1.0 — both already pinned since v3.0.0 of this plugin).
13
+
8
14
  ## [3.0.0]
9
15
 
10
16
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-plugin-ymchat",
3
- "version": "3.0.0",
3
+ "version": "3.1.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="3.0.0"
2
+ <plugin id="cordova-plugin-ymchat" version="3.1.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>
@@ -68,6 +68,9 @@ public class YmChatCordova extends CordovaPlugin {
68
68
  case "setVersion":
69
69
  setVersion(args,callbackContext);
70
70
  return true;
71
+ case "setActivationMode":
72
+ setActivationMode(args, callbackContext);
73
+ return true;
71
74
  case "setStatusBarColor":
72
75
  setStatusBarColor(args,callbackContext);
73
76
  return true;
@@ -307,6 +310,15 @@ public class YmChatCordova extends CordovaPlugin {
307
310
  }
308
311
  }
309
312
 
313
+ private void setActivationMode(JSONArray args, CallbackContext callbackContext) {
314
+ try {
315
+ String mode = args.getString(0);
316
+ ymChatService.setActivationMode(mode, callbackContext);
317
+ } catch (Exception e) {
318
+ Utils.genericErrorHelper(e, callbackContext);
319
+ }
320
+ }
321
+
310
322
  public void setCustomLoaderURL(JSONArray args, CallbackContext callbackContext) {
311
323
  try {
312
324
  String customUrl = args.getString(0);
@@ -7,6 +7,7 @@ import android.util.Log;
7
7
  import com.yellow.ai.ymchat.utils.Utils;
8
8
  import com.yellowmessenger.ymchat.YMChat;
9
9
  import com.yellowmessenger.ymchat.YMConfig;
10
+ import com.yellowmessenger.ymchat.models.YMActivationMode;
10
11
  import com.yellowmessenger.ymchat.models.YellowCallback;
11
12
  import com.yellowmessenger.ymchat.models.YellowDataCallback;
12
13
  import com.yellowmessenger.ymchat.models.YellowUnreadMessageResponse;
@@ -198,6 +199,10 @@ public class YmChatService {
198
199
  ymChat.config.version = version;
199
200
  }
200
201
 
202
+ public void setActivationMode(String mode, CallbackContext callbackContext) {
203
+ ymChat.config.activationMode = "voice".equalsIgnoreCase(mode) ? YMActivationMode.VOICE : YMActivationMode.CHAT;
204
+ }
205
+
201
206
  public void setCustomLoaderUrl(String url, CallbackContext callbackContext) {
202
207
  ymChat.config.customLoaderUrl = url;
203
208
  }
package/src/ios/ymchat.m CHANGED
@@ -136,6 +136,13 @@
136
136
  YMChat.shared.config.version = version.integerValue;
137
137
  }
138
138
 
139
+ - (void)setActivationMode:(CDVInvokedUrlCommand*)command
140
+ {
141
+ NSString* mode = [command.arguments objectAtIndex:0];
142
+ assert(YMChat.shared.config != nil);
143
+ YMChat.shared.config.activationMode = [mode isEqualToString:@"voice"] ? YMActivationModeVoice : YMActivationModeChat;
144
+ }
145
+
139
146
  - (void) unlinkDeviceToken:(CDVInvokedUrlCommand*)command {
140
147
  if(YMChat.shared.config) {
141
148
  NSString* apiKey = [command.arguments objectAtIndex:0];
package/www/ymchat.js CHANGED
@@ -50,6 +50,9 @@ const YmChatAPI = {
50
50
  setVersion: (version) => {
51
51
  exec(null, null, "ymchat", "setVersion", [version])
52
52
  },
53
+ setActivationMode: (mode) => {
54
+ exec(null, null, "ymchat", "setActivationMode", [mode]);
55
+ },
53
56
  setCustomLoaderURL: (url) => {
54
57
  exec(null, null, "ymchat", "setCustomLoaderURL", [url]);
55
58
  },