zmp-sdk 2.19.2 → 2.20.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/dist/browser.min.js +53 -57
- package/dist/index.es.js +53 -57
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/types/src/apis/index.d.ts +3 -0
- package/dist/types/src/constants.d.ts +1 -0
- package/dist/types/src/services/mock-mp-service.d.ts +2 -1
- package/dist/types/src/services/navigationBar.d.ts +2 -37
- package/dist/types/src/services/zalo-mp-service.d.ts +1 -0
- package/dist/types/src/types/enum.d.ts +2 -1
- package/dist/types/src/types/inputData.d.ts +5 -0
- package/dist/types/src/types/interface.d.ts +2 -1
- package/package.json +1 -1
package/dist/browser.min.js
CHANGED
|
@@ -2164,6 +2164,7 @@
|
|
|
2164
2164
|
Events["NetworkChanged"] = "h5.event.connection.changed";
|
|
2165
2165
|
Events["OnDataCallback"] = "h5.event.webview.result";
|
|
2166
2166
|
Events["OpenApp"] = "h5.event.open.mp";
|
|
2167
|
+
Events["AppClose"] = "h5.event.action.close";
|
|
2167
2168
|
})(Events || (Events = {}));
|
|
2168
2169
|
var MediaPickerType;
|
|
2169
2170
|
(function (MediaPickerType) {
|
|
@@ -2243,7 +2244,8 @@
|
|
|
2243
2244
|
ZOAUTH: `h5.zdn.vn_zoauth`,
|
|
2244
2245
|
ZACC_SESSiON: `h5.zdn.vn_zacc_session`,
|
|
2245
2246
|
JS_TOKEN: `h5.zdn.vn_zlink3rd`,
|
|
2246
|
-
ZOAUTH_VRF: `h5.zdn.vn_zoauth_vrf
|
|
2247
|
+
ZOAUTH_VRF: `h5.zdn.vn_zoauth_vrf`,
|
|
2248
|
+
DEVICE_ID: `h5.zdn.vn_deviceID`,
|
|
2247
2249
|
};
|
|
2248
2250
|
const APIS = {
|
|
2249
2251
|
GET_USER_INFO: 'https://graph.zalo.me/v2.0/me',
|
|
@@ -4062,7 +4064,7 @@
|
|
|
4062
4064
|
}
|
|
4063
4065
|
_ZJSBridgeProvider_bridge = new WeakMap();
|
|
4064
4066
|
|
|
4065
|
-
var version = "2.
|
|
4067
|
+
var version = "2.20.0";
|
|
4066
4068
|
|
|
4067
4069
|
class Basics {
|
|
4068
4070
|
/**
|
|
@@ -4230,62 +4232,32 @@
|
|
|
4230
4232
|
* @param {string} [object.dialogMessage="Bạn có muốn thoát?"] - Specifies a message that will be shown on native dialog. Only when ```confirmToExit``` is 1
|
|
4231
4233
|
* @param {Function} [object.handleCloseEvent] - Specifies a function that will be called when user click close button. Only when ```confirmToExit``` is 2
|
|
4232
4234
|
*/
|
|
4233
|
-
static setNavigationBarLeftButton(
|
|
4234
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4235
|
+
static setNavigationBarLeftButton(type, confirmToExit) {
|
|
4236
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4237
|
+
let leftButtonType;
|
|
4238
|
+
let showHomeButton;
|
|
4239
|
+
if (_.isString(type)) {
|
|
4240
|
+
leftButtonType =
|
|
4241
|
+
type === 'none' || type === 'home'
|
|
4242
|
+
? ACTION_LEFT_BUTTON_TYPE.HIDE_BACK
|
|
4243
|
+
: ACTION_LEFT_BUTTON_TYPE.SHOW_BACK;
|
|
4244
|
+
showHomeButton =
|
|
4245
|
+
type === 'home' || type === 'both'
|
|
4246
|
+
? ACTION_LEFT_BUTTON_TYPE.SHOW_HOME
|
|
4247
|
+
: ACTION_LEFT_BUTTON_TYPE.HIDE_HOME;
|
|
4248
|
+
}
|
|
4249
|
+
this.setActionBarConfig((state) => (Object.assign(Object.assign({}, state), { buttonType: _.isNumber(leftButtonType) ? leftButtonType : state.buttonType, dataConfig: Object.assign(Object.assign({}, state.dataConfig), { confirmToExit: _.isNumber(confirmToExit) ? confirmToExit : state.dataConfig.confirmToExit, viewInLeftType: _.isNumber(leftButtonType) ? leftButtonType : state.dataConfig.viewInLeftType }), homeConfig: Object.assign(Object.assign({}, state.homeConfig), { enable: _.isNumber(showHomeButton) ? showHomeButton : state.homeConfig.enable }) })));
|
|
4242
4250
|
yield this.callNative(ACTION.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE, Object.assign({}, this.getActionBarConfig()), {
|
|
4243
4251
|
haveTimeout: false
|
|
4244
4252
|
});
|
|
4245
4253
|
});
|
|
4246
4254
|
}
|
|
4247
|
-
|
|
4248
|
-
* @ignore
|
|
4249
|
-
* Dynamically sets the right button of the current page.
|
|
4250
|
-
*
|
|
4251
|
-
* @ignore
|
|
4252
|
-
* @category Navigation Bar
|
|
4253
|
-
*
|
|
4254
|
-
* @example
|
|
4255
|
-
* zmpApis.setNavigationBarRightButton({
|
|
4256
|
-
* supportToolBar: 1,
|
|
4257
|
-
* reset: 0,
|
|
4258
|
-
* menuListItems: [{
|
|
4259
|
-
* title: "Post on timeline",
|
|
4260
|
-
* action: "zalo.web.internal.postfeed",
|
|
4261
|
-
* showAsAction: 0,
|
|
4262
|
-
* iconUrl: "https://cdn3.iconfinder.com/data/icons/user-interface-3-3/34/251-512.png",
|
|
4263
|
-
* type: 0,
|
|
4264
|
-
* data: {}
|
|
4265
|
-
* }],
|
|
4266
|
-
* }).then((res) => {
|
|
4267
|
-
* console.log("Success");
|
|
4268
|
-
* }).catch((error) => {
|
|
4269
|
-
* console.log("Fail");
|
|
4270
|
-
* });
|
|
4271
|
-
*
|
|
4272
|
-
* @param {Object} object
|
|
4273
|
-
* @param {Number} object.title - Title of a menu item
|
|
4274
|
-
* @param {Number} object.action - Native action
|
|
4275
|
-
* @param {string} object.showAsAction
|
|
4276
|
-
* If ```showAsAction``` is 1 and ```iconUrl``` can load,
|
|
4277
|
-
* this item will be shown outside and next to more-button. Maximum 2 item will be shown
|
|
4278
|
-
* @param {Function} object.iconUrl - Specifies icon of a menu item
|
|
4279
|
-
* @param {0} object.type
|
|
4280
|
-
* @param {Object} object.data - Data depends on ```action```
|
|
4281
|
-
*/
|
|
4282
|
-
static setNavigationBarRightButton(object) {
|
|
4255
|
+
static setNavigationBar(data) {
|
|
4283
4256
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4284
|
-
yield this.callNative(ACTION.
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
zapp: this.getAppId()
|
|
4257
|
+
yield this.callNative(ACTION.CHANGE_ACTIONBAR, {
|
|
4258
|
+
data
|
|
4259
|
+
}, {
|
|
4260
|
+
haveTimeout: false
|
|
4289
4261
|
});
|
|
4290
4262
|
});
|
|
4291
4263
|
}
|
|
@@ -5770,6 +5742,7 @@
|
|
|
5770
5742
|
return yield this.callNative(ACTION.OPEN_CHAT, {
|
|
5771
5743
|
uId: object.id,
|
|
5772
5744
|
type: ChatType[object.type],
|
|
5745
|
+
msg: object.message || '',
|
|
5773
5746
|
zapp: this.getZAppId(),
|
|
5774
5747
|
sourceId: object.sourceId,
|
|
5775
5748
|
sourceIndex: object.sourceIndex
|
|
@@ -6133,7 +6106,7 @@
|
|
|
6133
6106
|
}
|
|
6134
6107
|
}
|
|
6135
6108
|
|
|
6136
|
-
var _ZaloMiniProgramSDKService_zAppId, _ZaloMiniProgramSDKService_appId, _ZaloMiniProgramSDKService_appConfig, _ZaloMiniProgramSDKService_zOAuth, _ZaloMiniProgramSDKService_zOAuthVrf, _ZaloMiniProgramSDKService_accessToken, _ZaloMiniProgramSDKService_refreshToken, _ZaloMiniProgramSDKService_cache, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, _ZaloMiniProgramSDKService_tokenExpiresIn, _ZaloMiniProgramSDKService_cookies, _ZaloMiniProgramSDKService_actionBarConfig, _ZaloMiniProgramSDKService_callJump,
|
|
6109
|
+
var _ZaloMiniProgramSDKService_zAppId, _ZaloMiniProgramSDKService_appId, _ZaloMiniProgramSDKService_appConfig, _ZaloMiniProgramSDKService_zOAuth, _ZaloMiniProgramSDKService_zOAuthVrf, _ZaloMiniProgramSDKService_accessToken, _ZaloMiniProgramSDKService_refreshToken, _ZaloMiniProgramSDKService_cache, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, _ZaloMiniProgramSDKService_tokenExpiresIn, _ZaloMiniProgramSDKService_cookies, _ZaloMiniProgramSDKService_deviceId, _ZaloMiniProgramSDKService_actionBarConfig, _ZaloMiniProgramSDKService_callJump, _ZaloMiniProgramSDKService_getActionsSupported;
|
|
6137
6110
|
class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
|
|
6138
6111
|
constructor() {
|
|
6139
6112
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
@@ -6153,6 +6126,7 @@
|
|
|
6153
6126
|
_ZaloMiniProgramSDKService_prevGetTokenTimestamp.set(this, void 0);
|
|
6154
6127
|
_ZaloMiniProgramSDKService_tokenExpiresIn.set(this, void 0);
|
|
6155
6128
|
_ZaloMiniProgramSDKService_cookies.set(this, null);
|
|
6129
|
+
_ZaloMiniProgramSDKService_deviceId.set(this, void 0);
|
|
6156
6130
|
this.events = ZMPEEmitter.getInstance();
|
|
6157
6131
|
this.isIOS = checkPlatform().isIOS;
|
|
6158
6132
|
_ZaloMiniProgramSDKService_actionBarConfig.set(this, void 0);
|
|
@@ -6172,12 +6146,16 @@
|
|
|
6172
6146
|
.then((data) => {
|
|
6173
6147
|
const cookies = (data && data.cookiesOAuthLogins) || [];
|
|
6174
6148
|
const jsToken = cookies.find((cookie) => cookie.name === COOKIE_NAME.JS_TOKEN);
|
|
6149
|
+
const deviceId = cookies.find((cookie) => cookie.name === COOKIE_NAME.DEVICE_ID);
|
|
6175
6150
|
if (jsToken) {
|
|
6176
6151
|
this.setJSToken(jsToken.value);
|
|
6177
6152
|
window.ZJSBridge.setJSToken &&
|
|
6178
6153
|
window.ZJSBridge.setJSToken(jsToken.value);
|
|
6179
6154
|
}
|
|
6180
6155
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_cookies, cookies, "f");
|
|
6156
|
+
if (deviceId) {
|
|
6157
|
+
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_deviceId, deviceId.value, "f");
|
|
6158
|
+
}
|
|
6181
6159
|
resolve(cookies);
|
|
6182
6160
|
})
|
|
6183
6161
|
.catch((error) => {
|
|
@@ -6186,7 +6164,6 @@
|
|
|
6186
6164
|
}
|
|
6187
6165
|
});
|
|
6188
6166
|
});
|
|
6189
|
-
_ZaloMiniProgramSDKService_setNavigationBarRightButton.set(this, NavigationBar.setNavigationBarRightButton);
|
|
6190
6167
|
this.getVersion = Basics.getVersion;
|
|
6191
6168
|
this.getSystemInfo = Basics.getSystemInfo;
|
|
6192
6169
|
this.setNavigationBarTitle = NavigationBar.setNavigationBarTitle;
|
|
@@ -6256,6 +6233,7 @@
|
|
|
6256
6233
|
this.isShowNavBar = true;
|
|
6257
6234
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, 0, "f");
|
|
6258
6235
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_tokenExpiresIn, 0, "f");
|
|
6236
|
+
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_deviceId, '', "f");
|
|
6259
6237
|
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' ||
|
|
6260
6238
|
((_d = (_c = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig, "f")) === null || _c === void 0 ? void 0 : _c.app) === null || _d === void 0 ? void 0 : _d.leftButton) === 'both'
|
|
6261
6239
|
? ACTION_LEFT_BUTTON_TYPE.SHOW_HOME
|
|
@@ -6299,6 +6277,9 @@
|
|
|
6299
6277
|
getZAppId() {
|
|
6300
6278
|
return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_zAppId, "f");
|
|
6301
6279
|
}
|
|
6280
|
+
getDeviceId() {
|
|
6281
|
+
return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_deviceId, "f");
|
|
6282
|
+
}
|
|
6302
6283
|
login(object) {
|
|
6303
6284
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6304
6285
|
const cookies = yield __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_callJump, "f").call(this);
|
|
@@ -6392,7 +6373,7 @@
|
|
|
6392
6373
|
});
|
|
6393
6374
|
}
|
|
6394
6375
|
}
|
|
6395
|
-
_ZaloMiniProgramSDKService_zAppId = new WeakMap(), _ZaloMiniProgramSDKService_appId = new WeakMap(), _ZaloMiniProgramSDKService_appConfig = new WeakMap(), _ZaloMiniProgramSDKService_zOAuth = new WeakMap(), _ZaloMiniProgramSDKService_zOAuthVrf = new WeakMap(), _ZaloMiniProgramSDKService_accessToken = new WeakMap(), _ZaloMiniProgramSDKService_refreshToken = new WeakMap(), _ZaloMiniProgramSDKService_cache = new WeakMap(), _ZaloMiniProgramSDKService_prevGetTokenTimestamp = new WeakMap(), _ZaloMiniProgramSDKService_tokenExpiresIn = new WeakMap(), _ZaloMiniProgramSDKService_cookies = new WeakMap(),
|
|
6376
|
+
_ZaloMiniProgramSDKService_zAppId = new WeakMap(), _ZaloMiniProgramSDKService_appId = new WeakMap(), _ZaloMiniProgramSDKService_appConfig = new WeakMap(), _ZaloMiniProgramSDKService_zOAuth = new WeakMap(), _ZaloMiniProgramSDKService_zOAuthVrf = new WeakMap(), _ZaloMiniProgramSDKService_accessToken = new WeakMap(), _ZaloMiniProgramSDKService_refreshToken = new WeakMap(), _ZaloMiniProgramSDKService_cache = new WeakMap(), _ZaloMiniProgramSDKService_prevGetTokenTimestamp = new WeakMap(), _ZaloMiniProgramSDKService_tokenExpiresIn = new WeakMap(), _ZaloMiniProgramSDKService_cookies = new WeakMap(), _ZaloMiniProgramSDKService_deviceId = new WeakMap(), _ZaloMiniProgramSDKService_actionBarConfig = new WeakMap(), _ZaloMiniProgramSDKService_callJump = new WeakMap(), _ZaloMiniProgramSDKService_getActionsSupported = new WeakMap();
|
|
6396
6377
|
|
|
6397
6378
|
var _MockSDKService_appId, _MockSDKService_appConfig, _MockSDKService_zOAuth, _MockSDKService_accessToken, _MockSDKService_cache, _MockSDKService_loggedId;
|
|
6398
6379
|
class MockSDKService {
|
|
@@ -6413,6 +6394,9 @@
|
|
|
6413
6394
|
this.getAppId = () => {
|
|
6414
6395
|
return __classPrivateFieldGet(this, _MockSDKService_appId, "f");
|
|
6415
6396
|
};
|
|
6397
|
+
this.getDeviceId = () => {
|
|
6398
|
+
return '';
|
|
6399
|
+
};
|
|
6416
6400
|
this.login = () => {
|
|
6417
6401
|
__classPrivateFieldSet(this, _MockSDKService_loggedId, true, "f");
|
|
6418
6402
|
return Promise.resolve(__classPrivateFieldGet(this, _MockSDKService_zOAuth, "f"));
|
|
@@ -6924,7 +6908,7 @@
|
|
|
6924
6908
|
}
|
|
6925
6909
|
setNavigationBarLeftButton(object) {
|
|
6926
6910
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6927
|
-
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").setNavigationBarLeftButton(object);
|
|
6911
|
+
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").setNavigationBarLeftButton(object.type);
|
|
6928
6912
|
});
|
|
6929
6913
|
}
|
|
6930
6914
|
setDeviceOrientation(object) {
|
|
@@ -7323,6 +7307,17 @@
|
|
|
7323
7307
|
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openOutApp(appStoreURL);
|
|
7324
7308
|
});
|
|
7325
7309
|
}
|
|
7310
|
+
onConfirmToExit(callback) {
|
|
7311
|
+
this.events.on(Events.AppClose, callback, '{"handle_h5": 1}');
|
|
7312
|
+
__classPrivateFieldGet(this, _SDKCreator_sdkService, "f").setNavigationBarLeftButton(undefined, 2);
|
|
7313
|
+
}
|
|
7314
|
+
offConfirmToExit() {
|
|
7315
|
+
this.events.off(Events.AppClose);
|
|
7316
|
+
__classPrivateFieldGet(this, _SDKCreator_sdkService, "f").setNavigationBarLeftButton(undefined, 0);
|
|
7317
|
+
}
|
|
7318
|
+
getDeviceId() {
|
|
7319
|
+
return __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").getDeviceId();
|
|
7320
|
+
}
|
|
7326
7321
|
}
|
|
7327
7322
|
_SDKCreator_sdkService = new WeakMap();
|
|
7328
7323
|
__decorate([
|
|
@@ -7478,7 +7473,8 @@
|
|
|
7478
7473
|
validate,
|
|
7479
7474
|
__param(0, checkType('object', {
|
|
7480
7475
|
type: checkData('string', { values: ['user', 'oa'] }),
|
|
7481
|
-
id: checkData('string')
|
|
7476
|
+
id: checkData('string'),
|
|
7477
|
+
'message?': checkData('string')
|
|
7482
7478
|
}))
|
|
7483
7479
|
], SDKCreator.prototype, "openChat", null);
|
|
7484
7480
|
__decorate([
|
package/dist/index.es.js
CHANGED
|
@@ -2161,6 +2161,7 @@ var Events;
|
|
|
2161
2161
|
Events["NetworkChanged"] = "h5.event.connection.changed";
|
|
2162
2162
|
Events["OnDataCallback"] = "h5.event.webview.result";
|
|
2163
2163
|
Events["OpenApp"] = "h5.event.open.mp";
|
|
2164
|
+
Events["AppClose"] = "h5.event.action.close";
|
|
2164
2165
|
})(Events || (Events = {}));
|
|
2165
2166
|
var MediaPickerType;
|
|
2166
2167
|
(function (MediaPickerType) {
|
|
@@ -2240,7 +2241,8 @@ const COOKIE_NAME = {
|
|
|
2240
2241
|
ZOAUTH: `h5.zdn.vn_zoauth`,
|
|
2241
2242
|
ZACC_SESSiON: `h5.zdn.vn_zacc_session`,
|
|
2242
2243
|
JS_TOKEN: `h5.zdn.vn_zlink3rd`,
|
|
2243
|
-
ZOAUTH_VRF: `h5.zdn.vn_zoauth_vrf
|
|
2244
|
+
ZOAUTH_VRF: `h5.zdn.vn_zoauth_vrf`,
|
|
2245
|
+
DEVICE_ID: `h5.zdn.vn_deviceID`,
|
|
2244
2246
|
};
|
|
2245
2247
|
const APIS = {
|
|
2246
2248
|
GET_USER_INFO: 'https://graph.zalo.me/v2.0/me',
|
|
@@ -4059,7 +4061,7 @@ class ZJSBridgeProvider {
|
|
|
4059
4061
|
}
|
|
4060
4062
|
_ZJSBridgeProvider_bridge = new WeakMap();
|
|
4061
4063
|
|
|
4062
|
-
var version$1 = "2.
|
|
4064
|
+
var version$1 = "2.20.0";
|
|
4063
4065
|
|
|
4064
4066
|
class Basics {
|
|
4065
4067
|
/**
|
|
@@ -4227,62 +4229,32 @@ class NavigationBar {
|
|
|
4227
4229
|
* @param {string} [object.dialogMessage="Bạn có muốn thoát?"] - Specifies a message that will be shown on native dialog. Only when ```confirmToExit``` is 1
|
|
4228
4230
|
* @param {Function} [object.handleCloseEvent] - Specifies a function that will be called when user click close button. Only when ```confirmToExit``` is 2
|
|
4229
4231
|
*/
|
|
4230
|
-
static setNavigationBarLeftButton(
|
|
4231
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4232
|
+
static setNavigationBarLeftButton(type, confirmToExit) {
|
|
4233
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4234
|
+
let leftButtonType;
|
|
4235
|
+
let showHomeButton;
|
|
4236
|
+
if (_.isString(type)) {
|
|
4237
|
+
leftButtonType =
|
|
4238
|
+
type === 'none' || type === 'home'
|
|
4239
|
+
? ACTION_LEFT_BUTTON_TYPE.HIDE_BACK
|
|
4240
|
+
: ACTION_LEFT_BUTTON_TYPE.SHOW_BACK;
|
|
4241
|
+
showHomeButton =
|
|
4242
|
+
type === 'home' || type === 'both'
|
|
4243
|
+
? ACTION_LEFT_BUTTON_TYPE.SHOW_HOME
|
|
4244
|
+
: ACTION_LEFT_BUTTON_TYPE.HIDE_HOME;
|
|
4245
|
+
}
|
|
4246
|
+
this.setActionBarConfig((state) => (Object.assign(Object.assign({}, state), { buttonType: _.isNumber(leftButtonType) ? leftButtonType : state.buttonType, dataConfig: Object.assign(Object.assign({}, state.dataConfig), { confirmToExit: _.isNumber(confirmToExit) ? confirmToExit : state.dataConfig.confirmToExit, viewInLeftType: _.isNumber(leftButtonType) ? leftButtonType : state.dataConfig.viewInLeftType }), homeConfig: Object.assign(Object.assign({}, state.homeConfig), { enable: _.isNumber(showHomeButton) ? showHomeButton : state.homeConfig.enable }) })));
|
|
4239
4247
|
yield this.callNative(ACTION.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE, Object.assign({}, this.getActionBarConfig()), {
|
|
4240
4248
|
haveTimeout: false
|
|
4241
4249
|
});
|
|
4242
4250
|
});
|
|
4243
4251
|
}
|
|
4244
|
-
|
|
4245
|
-
* @ignore
|
|
4246
|
-
* Dynamically sets the right button of the current page.
|
|
4247
|
-
*
|
|
4248
|
-
* @ignore
|
|
4249
|
-
* @category Navigation Bar
|
|
4250
|
-
*
|
|
4251
|
-
* @example
|
|
4252
|
-
* zmpApis.setNavigationBarRightButton({
|
|
4253
|
-
* supportToolBar: 1,
|
|
4254
|
-
* reset: 0,
|
|
4255
|
-
* menuListItems: [{
|
|
4256
|
-
* title: "Post on timeline",
|
|
4257
|
-
* action: "zalo.web.internal.postfeed",
|
|
4258
|
-
* showAsAction: 0,
|
|
4259
|
-
* iconUrl: "https://cdn3.iconfinder.com/data/icons/user-interface-3-3/34/251-512.png",
|
|
4260
|
-
* type: 0,
|
|
4261
|
-
* data: {}
|
|
4262
|
-
* }],
|
|
4263
|
-
* }).then((res) => {
|
|
4264
|
-
* console.log("Success");
|
|
4265
|
-
* }).catch((error) => {
|
|
4266
|
-
* console.log("Fail");
|
|
4267
|
-
* });
|
|
4268
|
-
*
|
|
4269
|
-
* @param {Object} object
|
|
4270
|
-
* @param {Number} object.title - Title of a menu item
|
|
4271
|
-
* @param {Number} object.action - Native action
|
|
4272
|
-
* @param {string} object.showAsAction
|
|
4273
|
-
* If ```showAsAction``` is 1 and ```iconUrl``` can load,
|
|
4274
|
-
* this item will be shown outside and next to more-button. Maximum 2 item will be shown
|
|
4275
|
-
* @param {Function} object.iconUrl - Specifies icon of a menu item
|
|
4276
|
-
* @param {0} object.type
|
|
4277
|
-
* @param {Object} object.data - Data depends on ```action```
|
|
4278
|
-
*/
|
|
4279
|
-
static setNavigationBarRightButton(object) {
|
|
4252
|
+
static setNavigationBar(data) {
|
|
4280
4253
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4281
|
-
yield this.callNative(ACTION.
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
zapp: this.getAppId()
|
|
4254
|
+
yield this.callNative(ACTION.CHANGE_ACTIONBAR, {
|
|
4255
|
+
data
|
|
4256
|
+
}, {
|
|
4257
|
+
haveTimeout: false
|
|
4286
4258
|
});
|
|
4287
4259
|
});
|
|
4288
4260
|
}
|
|
@@ -5767,6 +5739,7 @@ class Zalo {
|
|
|
5767
5739
|
return yield this.callNative(ACTION.OPEN_CHAT, {
|
|
5768
5740
|
uId: object.id,
|
|
5769
5741
|
type: ChatType[object.type],
|
|
5742
|
+
msg: object.message || '',
|
|
5770
5743
|
zapp: this.getZAppId(),
|
|
5771
5744
|
sourceId: object.sourceId,
|
|
5772
5745
|
sourceIndex: object.sourceIndex
|
|
@@ -6130,7 +6103,7 @@ class Routing {
|
|
|
6130
6103
|
}
|
|
6131
6104
|
}
|
|
6132
6105
|
|
|
6133
|
-
var _ZaloMiniProgramSDKService_zAppId, _ZaloMiniProgramSDKService_appId, _ZaloMiniProgramSDKService_appConfig, _ZaloMiniProgramSDKService_zOAuth, _ZaloMiniProgramSDKService_zOAuthVrf, _ZaloMiniProgramSDKService_accessToken, _ZaloMiniProgramSDKService_refreshToken, _ZaloMiniProgramSDKService_cache, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, _ZaloMiniProgramSDKService_tokenExpiresIn, _ZaloMiniProgramSDKService_cookies, _ZaloMiniProgramSDKService_actionBarConfig, _ZaloMiniProgramSDKService_callJump,
|
|
6106
|
+
var _ZaloMiniProgramSDKService_zAppId, _ZaloMiniProgramSDKService_appId, _ZaloMiniProgramSDKService_appConfig, _ZaloMiniProgramSDKService_zOAuth, _ZaloMiniProgramSDKService_zOAuthVrf, _ZaloMiniProgramSDKService_accessToken, _ZaloMiniProgramSDKService_refreshToken, _ZaloMiniProgramSDKService_cache, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, _ZaloMiniProgramSDKService_tokenExpiresIn, _ZaloMiniProgramSDKService_cookies, _ZaloMiniProgramSDKService_deviceId, _ZaloMiniProgramSDKService_actionBarConfig, _ZaloMiniProgramSDKService_callJump, _ZaloMiniProgramSDKService_getActionsSupported;
|
|
6134
6107
|
class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
|
|
6135
6108
|
constructor() {
|
|
6136
6109
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
@@ -6150,6 +6123,7 @@ class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
|
|
|
6150
6123
|
_ZaloMiniProgramSDKService_prevGetTokenTimestamp.set(this, void 0);
|
|
6151
6124
|
_ZaloMiniProgramSDKService_tokenExpiresIn.set(this, void 0);
|
|
6152
6125
|
_ZaloMiniProgramSDKService_cookies.set(this, null);
|
|
6126
|
+
_ZaloMiniProgramSDKService_deviceId.set(this, void 0);
|
|
6153
6127
|
this.events = ZMPEEmitter.getInstance();
|
|
6154
6128
|
this.isIOS = checkPlatform().isIOS;
|
|
6155
6129
|
_ZaloMiniProgramSDKService_actionBarConfig.set(this, void 0);
|
|
@@ -6169,12 +6143,16 @@ class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
|
|
|
6169
6143
|
.then((data) => {
|
|
6170
6144
|
const cookies = (data && data.cookiesOAuthLogins) || [];
|
|
6171
6145
|
const jsToken = cookies.find((cookie) => cookie.name === COOKIE_NAME.JS_TOKEN);
|
|
6146
|
+
const deviceId = cookies.find((cookie) => cookie.name === COOKIE_NAME.DEVICE_ID);
|
|
6172
6147
|
if (jsToken) {
|
|
6173
6148
|
this.setJSToken(jsToken.value);
|
|
6174
6149
|
window.ZJSBridge.setJSToken &&
|
|
6175
6150
|
window.ZJSBridge.setJSToken(jsToken.value);
|
|
6176
6151
|
}
|
|
6177
6152
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_cookies, cookies, "f");
|
|
6153
|
+
if (deviceId) {
|
|
6154
|
+
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_deviceId, deviceId.value, "f");
|
|
6155
|
+
}
|
|
6178
6156
|
resolve(cookies);
|
|
6179
6157
|
})
|
|
6180
6158
|
.catch((error) => {
|
|
@@ -6183,7 +6161,6 @@ class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
|
|
|
6183
6161
|
}
|
|
6184
6162
|
});
|
|
6185
6163
|
});
|
|
6186
|
-
_ZaloMiniProgramSDKService_setNavigationBarRightButton.set(this, NavigationBar.setNavigationBarRightButton);
|
|
6187
6164
|
this.getVersion = Basics.getVersion;
|
|
6188
6165
|
this.getSystemInfo = Basics.getSystemInfo;
|
|
6189
6166
|
this.setNavigationBarTitle = NavigationBar.setNavigationBarTitle;
|
|
@@ -6253,6 +6230,7 @@ class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
|
|
|
6253
6230
|
this.isShowNavBar = true;
|
|
6254
6231
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, 0, "f");
|
|
6255
6232
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_tokenExpiresIn, 0, "f");
|
|
6233
|
+
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_deviceId, '', "f");
|
|
6256
6234
|
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' ||
|
|
6257
6235
|
((_d = (_c = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig, "f")) === null || _c === void 0 ? void 0 : _c.app) === null || _d === void 0 ? void 0 : _d.leftButton) === 'both'
|
|
6258
6236
|
? ACTION_LEFT_BUTTON_TYPE.SHOW_HOME
|
|
@@ -6296,6 +6274,9 @@ class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
|
|
|
6296
6274
|
getZAppId() {
|
|
6297
6275
|
return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_zAppId, "f");
|
|
6298
6276
|
}
|
|
6277
|
+
getDeviceId() {
|
|
6278
|
+
return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_deviceId, "f");
|
|
6279
|
+
}
|
|
6299
6280
|
login(object) {
|
|
6300
6281
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6301
6282
|
const cookies = yield __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_callJump, "f").call(this);
|
|
@@ -6389,7 +6370,7 @@ class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
|
|
|
6389
6370
|
});
|
|
6390
6371
|
}
|
|
6391
6372
|
}
|
|
6392
|
-
_ZaloMiniProgramSDKService_zAppId = new WeakMap(), _ZaloMiniProgramSDKService_appId = new WeakMap(), _ZaloMiniProgramSDKService_appConfig = new WeakMap(), _ZaloMiniProgramSDKService_zOAuth = new WeakMap(), _ZaloMiniProgramSDKService_zOAuthVrf = new WeakMap(), _ZaloMiniProgramSDKService_accessToken = new WeakMap(), _ZaloMiniProgramSDKService_refreshToken = new WeakMap(), _ZaloMiniProgramSDKService_cache = new WeakMap(), _ZaloMiniProgramSDKService_prevGetTokenTimestamp = new WeakMap(), _ZaloMiniProgramSDKService_tokenExpiresIn = new WeakMap(), _ZaloMiniProgramSDKService_cookies = new WeakMap(),
|
|
6373
|
+
_ZaloMiniProgramSDKService_zAppId = new WeakMap(), _ZaloMiniProgramSDKService_appId = new WeakMap(), _ZaloMiniProgramSDKService_appConfig = new WeakMap(), _ZaloMiniProgramSDKService_zOAuth = new WeakMap(), _ZaloMiniProgramSDKService_zOAuthVrf = new WeakMap(), _ZaloMiniProgramSDKService_accessToken = new WeakMap(), _ZaloMiniProgramSDKService_refreshToken = new WeakMap(), _ZaloMiniProgramSDKService_cache = new WeakMap(), _ZaloMiniProgramSDKService_prevGetTokenTimestamp = new WeakMap(), _ZaloMiniProgramSDKService_tokenExpiresIn = new WeakMap(), _ZaloMiniProgramSDKService_cookies = new WeakMap(), _ZaloMiniProgramSDKService_deviceId = new WeakMap(), _ZaloMiniProgramSDKService_actionBarConfig = new WeakMap(), _ZaloMiniProgramSDKService_callJump = new WeakMap(), _ZaloMiniProgramSDKService_getActionsSupported = new WeakMap();
|
|
6393
6374
|
|
|
6394
6375
|
var _MockSDKService_appId, _MockSDKService_appConfig, _MockSDKService_zOAuth, _MockSDKService_accessToken, _MockSDKService_cache, _MockSDKService_loggedId;
|
|
6395
6376
|
class MockSDKService {
|
|
@@ -6410,6 +6391,9 @@ class MockSDKService {
|
|
|
6410
6391
|
this.getAppId = () => {
|
|
6411
6392
|
return __classPrivateFieldGet(this, _MockSDKService_appId, "f");
|
|
6412
6393
|
};
|
|
6394
|
+
this.getDeviceId = () => {
|
|
6395
|
+
return '';
|
|
6396
|
+
};
|
|
6413
6397
|
this.login = () => {
|
|
6414
6398
|
__classPrivateFieldSet(this, _MockSDKService_loggedId, true, "f");
|
|
6415
6399
|
return Promise.resolve(__classPrivateFieldGet(this, _MockSDKService_zOAuth, "f"));
|
|
@@ -8279,7 +8263,7 @@ class SDKCreator {
|
|
|
8279
8263
|
}
|
|
8280
8264
|
setNavigationBarLeftButton(object) {
|
|
8281
8265
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8282
|
-
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").setNavigationBarLeftButton(object);
|
|
8266
|
+
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").setNavigationBarLeftButton(object.type);
|
|
8283
8267
|
});
|
|
8284
8268
|
}
|
|
8285
8269
|
setDeviceOrientation(object) {
|
|
@@ -8678,6 +8662,17 @@ class SDKCreator {
|
|
|
8678
8662
|
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openOutApp(appStoreURL);
|
|
8679
8663
|
});
|
|
8680
8664
|
}
|
|
8665
|
+
onConfirmToExit(callback) {
|
|
8666
|
+
this.events.on(Events.AppClose, callback, '{"handle_h5": 1}');
|
|
8667
|
+
__classPrivateFieldGet(this, _SDKCreator_sdkService, "f").setNavigationBarLeftButton(undefined, 2);
|
|
8668
|
+
}
|
|
8669
|
+
offConfirmToExit() {
|
|
8670
|
+
this.events.off(Events.AppClose);
|
|
8671
|
+
__classPrivateFieldGet(this, _SDKCreator_sdkService, "f").setNavigationBarLeftButton(undefined, 0);
|
|
8672
|
+
}
|
|
8673
|
+
getDeviceId() {
|
|
8674
|
+
return __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").getDeviceId();
|
|
8675
|
+
}
|
|
8681
8676
|
}
|
|
8682
8677
|
_SDKCreator_sdkService = new WeakMap();
|
|
8683
8678
|
__decorate([
|
|
@@ -8833,7 +8828,8 @@ __decorate([
|
|
|
8833
8828
|
validate,
|
|
8834
8829
|
__param(0, checkType('object', {
|
|
8835
8830
|
type: checkData('string', { values: ['user', 'oa'] }),
|
|
8836
|
-
id: checkData('string')
|
|
8831
|
+
id: checkData('string'),
|
|
8832
|
+
'message?': checkData('string')
|
|
8837
8833
|
}))
|
|
8838
8834
|
], SDKCreator.prototype, "openChat", null);
|
|
8839
8835
|
__decorate([
|