cordova-plugin-ymchat 3.3.0 → 3.4.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 +6 -0
- package/package.json +1 -1
- package/plugin.xml +2 -2
- package/src/android/build.gradle +1 -1
- package/src/android/com/yellow/ai/ymchat/YmChatCordova.java +12 -0
- package/src/android/com/yellow/ai/ymchat/YmChatService.java +4 -0
- package/src/ios/ymchat.m +7 -0
- package/www/ymchat.js +3 -0
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.4.0]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Auto-Sent Initial User Message** — lets the host app automatically send a configured message as soon as the chat widget opens, rendered as a real outgoing user message, via `cordova.plugins.ymchat.setInitialUserMessage('...')`. Bridges the native SDKs' `initialUserMessage` config for the first time (`YMChatbot-Android` since v3.5.0, iOS `YMChat` since 2.4.0 — this plugin now requires those versions or newer).
|
|
13
|
+
|
|
8
14
|
## [3.3.0]
|
|
9
15
|
|
|
10
16
|
### Added
|
package/package.json
CHANGED
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.
|
|
2
|
+
<plugin id="cordova-plugin-ymchat" version="3.4.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="~> 2.
|
|
36
|
+
<pod name="YMChat" spec="~> 2.4.0" swift-version="5.0"/>
|
|
37
37
|
</pods>
|
|
38
38
|
</podspec>
|
|
39
39
|
<config-file parent="/*" target="config.xml">
|
package/src/android/build.gradle
CHANGED
|
@@ -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:v3.
|
|
26
|
+
implementation 'com.github.yellowmessenger:YMChatbot-Android:v3.5.0'
|
|
27
27
|
}
|
|
@@ -35,6 +35,9 @@ public class YmChatCordova extends CordovaPlugin {
|
|
|
35
35
|
case "setAuthenticationToken":
|
|
36
36
|
setAuthenticationToken(args, callbackContext);
|
|
37
37
|
return true;
|
|
38
|
+
case "setInitialUserMessage":
|
|
39
|
+
setInitialUserMessage(args, callbackContext);
|
|
40
|
+
return true;
|
|
38
41
|
case "showCloseButton":
|
|
39
42
|
showCloseButton(args, callbackContext);
|
|
40
43
|
return true;
|
|
@@ -261,6 +264,15 @@ public class YmChatCordova extends CordovaPlugin {
|
|
|
261
264
|
}
|
|
262
265
|
}
|
|
263
266
|
|
|
267
|
+
public void setInitialUserMessage(JSONArray args, CallbackContext callbackContext) {
|
|
268
|
+
try {
|
|
269
|
+
String initialUserMessage = args.getString(0);
|
|
270
|
+
ymChatService.setInitialUserMessage(initialUserMessage, callbackContext);
|
|
271
|
+
} catch (Exception e) {
|
|
272
|
+
Utils.genericErrorHelper(e, callbackContext);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
264
276
|
public void showCloseButton(JSONArray args, CallbackContext callbackContext) {
|
|
265
277
|
try {
|
|
266
278
|
boolean closeButton = args.getBoolean(0);
|
|
@@ -74,6 +74,10 @@ public class YmChatService {
|
|
|
74
74
|
ymChat.config.ymAuthenticationToken = token;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
public void setInitialUserMessage(String initialUserMessage, CallbackContext callbackContext) {
|
|
78
|
+
ymChat.config.initialUserMessage = initialUserMessage;
|
|
79
|
+
}
|
|
80
|
+
|
|
77
81
|
public void showCloseButton(boolean show, CallbackContext callbackContext) {
|
|
78
82
|
ymChat.config.showCloseButton = show;
|
|
79
83
|
}
|
package/src/ios/ymchat.m
CHANGED
|
@@ -43,6 +43,13 @@
|
|
|
43
43
|
YMChat.shared.config.ymAuthenticationToken = authToken;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
- (void)setInitialUserMessage:(CDVInvokedUrlCommand*)command
|
|
47
|
+
{
|
|
48
|
+
NSString* initialUserMessage = [command.arguments objectAtIndex:0];
|
|
49
|
+
assert(YMChat.shared.config != nil);
|
|
50
|
+
YMChat.shared.config.initialUserMessage = initialUserMessage;
|
|
51
|
+
}
|
|
52
|
+
|
|
46
53
|
- (void)showCloseButton:(CDVInvokedUrlCommand*)command
|
|
47
54
|
{
|
|
48
55
|
BOOL closeBot = [command.arguments objectAtIndex:0];
|
package/www/ymchat.js
CHANGED
|
@@ -14,6 +14,9 @@ const YmChatAPI = {
|
|
|
14
14
|
setAuthenticationToken: (token) => {
|
|
15
15
|
exec(null, null, "ymchat", "setAuthenticationToken", [token]);
|
|
16
16
|
},
|
|
17
|
+
setInitialUserMessage: (message) => {
|
|
18
|
+
exec(null, null, "ymchat", "setInitialUserMessage", [message]);
|
|
19
|
+
},
|
|
17
20
|
showCloseButton: (closeBot) => {
|
|
18
21
|
exec(null, null, "ymchat", "showCloseButton", [closeBot]);
|
|
19
22
|
},
|