cordova-plugin-ymchat 2.22.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 ADDED
@@ -0,0 +1,23 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
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
+
14
+ ## [3.0.0]
15
+
16
+ ### Added
17
+
18
+ - **V3 widget support** — upgraded the pinned native SDKs to the versions that render the V3 chatbot widget: Android `YMChatbot-Android` v2.22.0 → v3.4.0, iOS `YMChat` ~> 1.24.0 → ~> 2.3.0. Call `setVersion(3)` before `startChatbot()` to use it, same as `setVersion(2)` for the V2 bot.
19
+ - As a side effect of the native SDK bump, voice conversations now automatically keep the screen awake for their duration (native SDK behavior, no plugin API change).
20
+
21
+ ### Changed
22
+
23
+ - No breaking changes — every existing bridged method/config property (`setBotId`, `setPayload`, `speechConfig`, `theme.*`, `revalidateToken`, `sendEventToBot`, etc.) was verified against the new native SDK versions before this bump; none were renamed, removed, or changed signature.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-plugin-ymchat",
3
- "version": "2.22.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="2.22.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>
@@ -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.24.0" swift-version="5.0"/>
36
+ <pod name="YMChat" spec="~> 2.3.0" swift-version="5.0"/>
37
37
  </pods>
38
38
  </podspec>
39
39
  <config-file parent="/*" target="config.xml">
@@ -23,5 +23,5 @@ repositories {
23
23
  dependencies {
24
24
  implementation 'androidx.appcompat:appcompat:1.0.2'
25
25
  implementation 'androidx.annotation:annotation:1.0.2'
26
- implementation 'com.github.yellowmessenger:YMChatbot-Android:v2.22.0'
26
+ implementation 'com.github.yellowmessenger:YMChatbot-Android:v3.4.0'
27
27
  }
@@ -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
  },