zmp-sdk 2.23.5-rc.0 → 2.24.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.
@@ -2353,7 +2353,8 @@
2353
2353
  name: 'action.open.share.sticker'
2354
2354
  },
2355
2355
  OPEN_PROFILE: {
2356
- name: 'action.open.profile'
2356
+ name: 'action.open.profile',
2357
+ require_access_token: true
2357
2358
  },
2358
2359
  OPEN_FEED_DETAIL: {
2359
2360
  name: 'action.open.feeddetail'
@@ -2365,7 +2366,8 @@
2365
2366
  name: 'action.open.inapp'
2366
2367
  },
2367
2368
  OPEN_OUTAPP: {
2368
- name: 'action.open.outapp'
2369
+ name: 'action.open.outapp',
2370
+ require_access_token: true
2369
2371
  },
2370
2372
  OPEN_PAGE: {
2371
2373
  name: 'action.open.page'
@@ -2413,7 +2415,8 @@
2413
2415
  name: 'action.request.buy.sticker'
2414
2416
  },
2415
2417
  OPEN_CHAT: {
2416
- name: 'action.open.chat'
2418
+ name: 'action.open.chat',
2419
+ require_access_token: true
2417
2420
  },
2418
2421
  OPEN_TAB_CHAT: {
2419
2422
  name: 'action.open.tab.chat'
@@ -2428,7 +2431,8 @@
2428
2431
  name: 'action.open.tab.more'
2429
2432
  },
2430
2433
  OPEN_POSTFEED: {
2431
- name: 'action.open.postfeed'
2434
+ name: 'action.open.postfeed',
2435
+ require_access_token: true
2432
2436
  },
2433
2437
  OPEN_LOGINDEVICES: {
2434
2438
  name: 'action.open.logindevices'
@@ -2442,18 +2446,21 @@
2442
2446
  },
2443
2447
  FOLLOW_OA: {
2444
2448
  name: 'action.follow.oa',
2445
- have_callback: true
2449
+ have_callback: true,
2450
+ require_access_token: true
2446
2451
  },
2447
2452
  UNFOLLOW_OA: {
2448
2453
  name: 'action.unfollow.oa',
2449
- have_callback: true
2454
+ have_callback: true,
2455
+ require_access_token: true
2450
2456
  },
2451
2457
  OPEN_GAMEDETAIL: {
2452
2458
  name: 'action.open.gamedetail'
2453
2459
  },
2454
2460
  OPEN_SHARESHEET: {
2455
2461
  name: 'action.open.sharesheet',
2456
- have_callback: true
2462
+ have_callback: true,
2463
+ require_access_token: true
2457
2464
  },
2458
2465
  REQUEST_PERMISSION_CAMERA: {
2459
2466
  name: 'action.request.permission.camera',
@@ -2496,7 +2503,8 @@
2496
2503
  have_callback: true
2497
2504
  },
2498
2505
  CREATE_SHORTCUT: {
2499
- name: 'action.create.shortcut'
2506
+ name: 'action.create.shortcut',
2507
+ require_access_token: true
2500
2508
  },
2501
2509
  CHANGE_ACTIONBAR_LEFTBUTTON_TYPE: {
2502
2510
  name: 'action.change.actionbar.leftbutton.type',
@@ -2576,7 +2584,8 @@
2576
2584
  },
2577
2585
  VIEW_MYQR: {
2578
2586
  name: 'action.view.myqr',
2579
- have_callback: true
2587
+ have_callback: true,
2588
+ require_access_token: true
2580
2589
  },
2581
2590
  KEEP_SCREEN: {
2582
2591
  name: 'action.keep.screen',
@@ -2717,6 +2726,7 @@
2717
2726
  },
2718
2727
  MP_OPEN_PROFILE_PICKER: {
2719
2728
  name: 'action.mp.open.profile.picker',
2729
+ require_access_token: true,
2720
2730
  version_live: { iOS: 432 },
2721
2731
  error_list: {
2722
2732
  android: {
@@ -2743,6 +2753,7 @@
2743
2753
  },
2744
2754
  PICK_MEDIA: {
2745
2755
  name: 'action.pick.media',
2756
+ require_access_token: true,
2746
2757
  version_live: { iOS: 440 },
2747
2758
  error_list: {
2748
2759
  android: {
@@ -3756,7 +3767,7 @@
3756
3767
  }
3757
3768
  }
3758
3769
 
3759
- var version = "2.23.5-rc.0";
3770
+ var version = "2.24.0";
3760
3771
 
3761
3772
  class Basics {
3762
3773
  /**
@@ -4931,7 +4942,7 @@
4931
4942
  _ZaloJSBridge_instances.add(this);
4932
4943
  this.debug = Debug('zmp:ZaloJSBridge');
4933
4944
  this.events = ZMPEEmitter.getInstance();
4934
- this._accessTk = getToken('zacc_session') || 'DEFAULT_ACCESS_TOKEN';
4945
+ this._accessTk = getToken('zacc_session') || '';
4935
4946
  this._jsAccessTk = getToken('zlink3rd') || 'DEFAULT_JS_TOKEN';
4936
4947
  this.results = [];
4937
4948
  this._userAgent = getUserAgent();
@@ -5248,10 +5259,13 @@
5248
5259
  if (!action.skip_jump) {
5249
5260
  yield this.jump();
5250
5261
  }
5262
+ if (action.require_access_token && !this._accessTk) {
5263
+ yield ZaloMiniProgramSDKService.getInstance().getAccessToken();
5264
+ }
5251
5265
  const isIOS = checkPlatform().isIOS;
5252
5266
  const isSupportAction = checkIOSSupportAction(action);
5253
5267
  if (isIOS && !isSupportAction) {
5254
- const error = new AppError(-5, `Client isn't support this action`);
5268
+ const error = new AppError(-5, `Client doesn't support this action`);
5255
5269
  return reject(error);
5256
5270
  }
5257
5271
  else if (option === null || option === void 0 ? void 0 : option.delay) {
@@ -6456,7 +6470,7 @@
6456
6470
  __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_context, null, "f");
6457
6471
  __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_bridge, ZaloJSBridge.getInstance(), "f");
6458
6472
  __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_loginRunning, 0, "f");
6459
- __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_autoLogin, false, "f");
6473
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_autoLogin, true, "f");
6460
6474
  const showHomeButton = ((_b = (_a = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig, "f")) === null || _a === void 0 ? void 0 : _a.app) === null || _b === void 0 ? void 0 : _b.leftButton) === 'home' ||
6461
6475
  ((_d = (_c = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig, "f")) === null || _c === void 0 ? void 0 : _c.app) === null || _d === void 0 ? void 0 : _d.leftButton) === 'both'
6462
6476
  ? ACTION_LEFT_BUTTON_TYPE.SHOW_HOME
package/dist/index.es.js CHANGED
@@ -2350,7 +2350,8 @@ const ACTION = {
2350
2350
  name: 'action.open.share.sticker'
2351
2351
  },
2352
2352
  OPEN_PROFILE: {
2353
- name: 'action.open.profile'
2353
+ name: 'action.open.profile',
2354
+ require_access_token: true
2354
2355
  },
2355
2356
  OPEN_FEED_DETAIL: {
2356
2357
  name: 'action.open.feeddetail'
@@ -2362,7 +2363,8 @@ const ACTION = {
2362
2363
  name: 'action.open.inapp'
2363
2364
  },
2364
2365
  OPEN_OUTAPP: {
2365
- name: 'action.open.outapp'
2366
+ name: 'action.open.outapp',
2367
+ require_access_token: true
2366
2368
  },
2367
2369
  OPEN_PAGE: {
2368
2370
  name: 'action.open.page'
@@ -2410,7 +2412,8 @@ const ACTION = {
2410
2412
  name: 'action.request.buy.sticker'
2411
2413
  },
2412
2414
  OPEN_CHAT: {
2413
- name: 'action.open.chat'
2415
+ name: 'action.open.chat',
2416
+ require_access_token: true
2414
2417
  },
2415
2418
  OPEN_TAB_CHAT: {
2416
2419
  name: 'action.open.tab.chat'
@@ -2425,7 +2428,8 @@ const ACTION = {
2425
2428
  name: 'action.open.tab.more'
2426
2429
  },
2427
2430
  OPEN_POSTFEED: {
2428
- name: 'action.open.postfeed'
2431
+ name: 'action.open.postfeed',
2432
+ require_access_token: true
2429
2433
  },
2430
2434
  OPEN_LOGINDEVICES: {
2431
2435
  name: 'action.open.logindevices'
@@ -2439,18 +2443,21 @@ const ACTION = {
2439
2443
  },
2440
2444
  FOLLOW_OA: {
2441
2445
  name: 'action.follow.oa',
2442
- have_callback: true
2446
+ have_callback: true,
2447
+ require_access_token: true
2443
2448
  },
2444
2449
  UNFOLLOW_OA: {
2445
2450
  name: 'action.unfollow.oa',
2446
- have_callback: true
2451
+ have_callback: true,
2452
+ require_access_token: true
2447
2453
  },
2448
2454
  OPEN_GAMEDETAIL: {
2449
2455
  name: 'action.open.gamedetail'
2450
2456
  },
2451
2457
  OPEN_SHARESHEET: {
2452
2458
  name: 'action.open.sharesheet',
2453
- have_callback: true
2459
+ have_callback: true,
2460
+ require_access_token: true
2454
2461
  },
2455
2462
  REQUEST_PERMISSION_CAMERA: {
2456
2463
  name: 'action.request.permission.camera',
@@ -2493,7 +2500,8 @@ const ACTION = {
2493
2500
  have_callback: true
2494
2501
  },
2495
2502
  CREATE_SHORTCUT: {
2496
- name: 'action.create.shortcut'
2503
+ name: 'action.create.shortcut',
2504
+ require_access_token: true
2497
2505
  },
2498
2506
  CHANGE_ACTIONBAR_LEFTBUTTON_TYPE: {
2499
2507
  name: 'action.change.actionbar.leftbutton.type',
@@ -2573,7 +2581,8 @@ const ACTION = {
2573
2581
  },
2574
2582
  VIEW_MYQR: {
2575
2583
  name: 'action.view.myqr',
2576
- have_callback: true
2584
+ have_callback: true,
2585
+ require_access_token: true
2577
2586
  },
2578
2587
  KEEP_SCREEN: {
2579
2588
  name: 'action.keep.screen',
@@ -2714,6 +2723,7 @@ const ACTION = {
2714
2723
  },
2715
2724
  MP_OPEN_PROFILE_PICKER: {
2716
2725
  name: 'action.mp.open.profile.picker',
2726
+ require_access_token: true,
2717
2727
  version_live: { iOS: 432 },
2718
2728
  error_list: {
2719
2729
  android: {
@@ -2740,6 +2750,7 @@ const ACTION = {
2740
2750
  },
2741
2751
  PICK_MEDIA: {
2742
2752
  name: 'action.pick.media',
2753
+ require_access_token: true,
2743
2754
  version_live: { iOS: 440 },
2744
2755
  error_list: {
2745
2756
  android: {
@@ -3753,7 +3764,7 @@ class ZMPEEmitter extends eventemitter3 {
3753
3764
  }
3754
3765
  }
3755
3766
 
3756
- var version$1 = "2.23.5-rc.0";
3767
+ var version$1 = "2.24.0";
3757
3768
 
3758
3769
  class Basics {
3759
3770
  /**
@@ -4928,7 +4939,7 @@ class ZaloJSBridge extends eventemitter3 {
4928
4939
  _ZaloJSBridge_instances.add(this);
4929
4940
  this.debug = Debug('zmp:ZaloJSBridge');
4930
4941
  this.events = ZMPEEmitter.getInstance();
4931
- this._accessTk = getToken('zacc_session') || 'DEFAULT_ACCESS_TOKEN';
4942
+ this._accessTk = getToken('zacc_session') || '';
4932
4943
  this._jsAccessTk = getToken('zlink3rd') || 'DEFAULT_JS_TOKEN';
4933
4944
  this.results = [];
4934
4945
  this._userAgent = getUserAgent();
@@ -5245,10 +5256,13 @@ class ZaloJSBridge extends eventemitter3 {
5245
5256
  if (!action.skip_jump) {
5246
5257
  yield this.jump();
5247
5258
  }
5259
+ if (action.require_access_token && !this._accessTk) {
5260
+ yield ZaloMiniProgramSDKService.getInstance().getAccessToken();
5261
+ }
5248
5262
  const isIOS = checkPlatform().isIOS;
5249
5263
  const isSupportAction = checkIOSSupportAction(action);
5250
5264
  if (isIOS && !isSupportAction) {
5251
- const error = new AppError(-5, `Client isn't support this action`);
5265
+ const error = new AppError(-5, `Client doesn't support this action`);
5252
5266
  return reject(error);
5253
5267
  }
5254
5268
  else if (option === null || option === void 0 ? void 0 : option.delay) {
@@ -6453,7 +6467,7 @@ class ZaloMiniProgramSDKService {
6453
6467
  __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_context, null, "f");
6454
6468
  __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_bridge, ZaloJSBridge.getInstance(), "f");
6455
6469
  __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_loginRunning, 0, "f");
6456
- __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_autoLogin, false, "f");
6470
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_autoLogin, true, "f");
6457
6471
  const showHomeButton = ((_b = (_a = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig, "f")) === null || _a === void 0 ? void 0 : _a.app) === null || _b === void 0 ? void 0 : _b.leftButton) === 'home' ||
6458
6472
  ((_d = (_c = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig, "f")) === null || _c === void 0 ? void 0 : _c.app) === null || _d === void 0 ? void 0 : _d.leftButton) === 'both'
6459
6473
  ? ACTION_LEFT_BUTTON_TYPE.SHOW_HOME