cordova-plugin-ymchat 2.9.0 → 2.10.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.9.0",
3
+ "version": "2.10.0",
4
4
  "description": "Cordova plugin to integrate yellow.ai chatbot",
5
5
  "cordova": {
6
6
  "id": "cordova-plugin-ymchat",
@@ -18,7 +18,7 @@
18
18
  "cordova-android",
19
19
  "cordova-plugin-ymchat"
20
20
  ],
21
- "author": "Purushottam",
21
+ "author": "Sankalp",
22
22
  "license": "ISC",
23
23
  "homepage": "https://github.com/yellowmessenger/cordova-plugin-ymchat.git",
24
24
  "bugs": {
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.9.0"
2
+ <plugin id="cordova-plugin-ymchat" version="2.10.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>
@@ -34,7 +34,7 @@
34
34
  <source url="https://github.com/CocoaPods/Specs.git" branch="master"/>
35
35
  </config>
36
36
  <pods use-frameworks="true">
37
- <pod name="YMChat" spec="~> 1.14.1" swift-version="5.0"/>
37
+ <pod name="YMChat" spec="~> 1.15" swift-version="5.0"/>
38
38
  </pods>
39
39
  </podspec>
40
40
  <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.9.+'
27
+ implementation 'com.github.yellowmessenger:YMChatbot-Android:v2.10.+'
28
28
  }
@@ -303,6 +303,60 @@ public class YmChatCordova extends CordovaPlugin {
303
303
  }
304
304
  }
305
305
 
306
+ public void setThemeBotName(JSONArray args, CallbackContext callbackContext) {
307
+ try {
308
+ String botName = args.getString(0);
309
+ ymChatService.setThemeBotName(botName, callbackContext);
310
+ } catch (Exception e) {
311
+ Utils.genericErrorHelper(e, callbackContext);
312
+ }
313
+ }
314
+
315
+ public void setThemeBotDescription(JSONArray args, CallbackContext callbackContext) {
316
+ try {
317
+ String botDesc = args.getString(0);
318
+ ymChatService.setThemeBotDescription(botDesc, callbackContext);
319
+ } catch (Exception e) {
320
+ Utils.genericErrorHelper(e, callbackContext);
321
+ }
322
+ }
323
+
324
+ public void setThemePrimaryColor(JSONArray args, CallbackContext callbackContext) {
325
+ try {
326
+ String color = args.getString(0);
327
+ ymChatService.setThemePrimaryColor(color, callbackContext);
328
+ } catch (Exception e) {
329
+ Utils.genericErrorHelper(e, callbackContext);
330
+ }
331
+ }
332
+
333
+ public void setThemeSecondaryColor(JSONArray args, CallbackContext callbackContext) {
334
+ try {
335
+ String color = args.getString(0);
336
+ ymChatService.setThemeSecondaryColor(color, callbackContext);
337
+ } catch (Exception e) {
338
+ Utils.genericErrorHelper(e, callbackContext);
339
+ }
340
+ }
341
+
342
+ public void setThemeBotIcon(JSONArray args, CallbackContext callbackContext) {
343
+ try {
344
+ String iconUrl = args.getString(0);
345
+ ymChatService.setThemeBotIcon(iconUrl, callbackContext);
346
+ } catch (Exception e) {
347
+ Utils.genericErrorHelper(e, callbackContext);
348
+ }
349
+ }
350
+
351
+ public void setThemeBotClickIcon(JSONArray args, CallbackContext callbackContext) {
352
+ try {
353
+ String iconUrl = args.getString(0);
354
+ ymChatService.setThemeBotClickIcon(iconUrl, callbackContext);
355
+ } catch (Exception e) {
356
+ Utils.genericErrorHelper(e, callbackContext);
357
+ }
358
+ }
359
+
306
360
  private void revalidateToken(JSONArray args, CallbackContext callbackContext) {
307
361
  try {
308
362
  String token = args.getString(0);
@@ -217,6 +217,30 @@ public class YmChatService {
217
217
  ymChat.config.useSecureYmAuth = shouldUseSecureYmAuth;
218
218
  }
219
219
 
220
+ public void setThemeBotName(String name, CallbackContext callbackContext) {
221
+ ymChat.config.theme.botName = name;
222
+ }
223
+
224
+ public void setThemeBotDescription(String description, CallbackContext callbackContext) {
225
+ ymChat.config.theme.botDesc = description;
226
+ }
227
+
228
+ public void setThemePrimaryColor(String color, CallbackContext callbackContext) {
229
+ ymChat.config.theme.primaryColor = color;
230
+ }
231
+
232
+ public void setThemeSecondaryColor(String color, CallbackContext callbackContext) {
233
+ ymChat.config.theme.secondaryColor = color;
234
+ }
235
+
236
+ public void setThemeBotIcon(String iconUrl, CallbackContext callbackContext) {
237
+ ymChat.config.theme.botIcon = iconUrl;
238
+ }
239
+
240
+ public void setThemeBotClickIcon(String iconUrl, CallbackContext callbackContext) {
241
+ ymChat.config.theme.botClickIcon = iconUrl;
242
+ }
243
+
220
244
  public void revalidateToken(String token, boolean refreshSession, CallbackContext callbackContext) {
221
245
  try {
222
246
  ymChat.revalidateToken(token, refreshSession);
package/src/ios/ymchat.m CHANGED
@@ -235,6 +235,48 @@
235
235
  YMChat.shared.config.useSecureYmAuth = shouldUseSecureYmAuth;
236
236
  }
237
237
 
238
+ - (void)setThemeBotName:(CDVInvokedUrlCommand*)command
239
+ {
240
+ NSString* name = [command.arguments objectAtIndex:0];
241
+ assert(YMChat.shared.config != nil);
242
+ YMChat.shared.config.theme.botName = name;
243
+ }
244
+
245
+ - (void)setThemeBotDescription:(CDVInvokedUrlCommand*)command
246
+ {
247
+ NSString* description = [command.arguments objectAtIndex:0];
248
+ assert(YMChat.shared.config != nil);
249
+ YMChat.shared.config.theme.botDescription = description;
250
+ }
251
+
252
+ - (void)setThemePrimaryColor:(CDVInvokedUrlCommand*)command
253
+ {
254
+ NSString* color = [command.arguments objectAtIndex:0];
255
+ assert(YMChat.shared.config != nil);
256
+ YMChat.shared.config.theme.primaryColor = [self getColorFromHexString:color];
257
+ }
258
+
259
+ - (void)setThemeSecondaryColor:(CDVInvokedUrlCommand*)command
260
+ {
261
+ NSString* color = [command.arguments objectAtIndex:0];
262
+ assert(YMChat.shared.config != nil);
263
+ YMChat.shared.config.theme.secondaryColor = [self getColorFromHexString:color];
264
+ }
265
+
266
+ - (void)setThemeBotIcon:(CDVInvokedUrlCommand*)command
267
+ {
268
+ NSString* iconUrl = [command.arguments objectAtIndex:0];
269
+ assert(YMChat.shared.config != nil);
270
+ YMChat.shared.config.theme.botIcon = iconUrl;
271
+ }
272
+
273
+ - (void)setThemeBotClickIcon:(CDVInvokedUrlCommand*)command
274
+ {
275
+ NSString* iconUrl = [command.arguments objectAtIndex:0];
276
+ assert(YMChat.shared.config != nil);
277
+ YMChat.shared.config.theme.botClickIcon = iconUrl;
278
+ }
279
+
238
280
  - (void)revalidateToken:(CDVInvokedUrlCommand*)command
239
281
  {
240
282
  NSString* token = [command.arguments objectAtIndex:0];
package/www/ymchat.js CHANGED
@@ -74,6 +74,24 @@ const YmChatAPI = {
74
74
  useSecureYmAuth: (shouldUseSecureYmAuth) => {
75
75
  exec(null, null, "ymchat", "useSecureYmAuth", [shouldUseSecureYmAuth]);
76
76
  },
77
+ setThemeBotName: (name) => {
78
+ exec(null, null, "ymchat", "setThemeBotName", [name]);
79
+ },
80
+ setThemeBotDescription: (description) => {
81
+ exec(null, null, "ymchat", "setThemeBotDescription", [description]);
82
+ },
83
+ setThemePrimaryColor: (color) => {
84
+ exec(null, null, "ymchat", "setThemePrimaryColor", [color]);
85
+ },
86
+ setThemeSecondaryColor: (color) => {
87
+ exec(null, null, "ymchat", "setThemeSecondaryColor", [color]);
88
+ },
89
+ setThemeBotIcon: (iconUrl) => {
90
+ exec(null, null, "ymchat", "setThemeBotIcon", [iconUrl]);
91
+ },
92
+ setThemeBotClickIcon: (iconUrl) => {
93
+ exec(null, null, "ymchat", "setThemeBotClickIcon", [iconUrl]);
94
+ },
77
95
  revalidateToken: (token, refreshSession) => {
78
96
  exec(null, null, "ymchat", "revalidateToken", [token, refreshSession]);
79
97
  },