zmp-sdk 2.19.0 → 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 +56 -59
- package/dist/index.es.js +56 -59
- 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 +7 -2
- 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',
|
|
@@ -3088,7 +3090,8 @@
|
|
|
3088
3090
|
const formattedStr = str
|
|
3089
3091
|
.replace(/\n/g, '\\n')
|
|
3090
3092
|
.replace(/\r/g, '\\r')
|
|
3091
|
-
.replace(/\t/g, '\\t')
|
|
3093
|
+
.replace(/\t/g, '\\t')
|
|
3094
|
+
.replace(/\x00/g, '');
|
|
3092
3095
|
return JSON.parse(formattedStr, (key, value) => {
|
|
3093
3096
|
return value;
|
|
3094
3097
|
});
|
|
@@ -4061,7 +4064,7 @@
|
|
|
4061
4064
|
}
|
|
4062
4065
|
_ZJSBridgeProvider_bridge = new WeakMap();
|
|
4063
4066
|
|
|
4064
|
-
var version = "2.
|
|
4067
|
+
var version = "2.20.0";
|
|
4065
4068
|
|
|
4066
4069
|
class Basics {
|
|
4067
4070
|
/**
|
|
@@ -4229,62 +4232,32 @@
|
|
|
4229
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
|
|
4230
4233
|
* @param {Function} [object.handleCloseEvent] - Specifies a function that will be called when user click close button. Only when ```confirmToExit``` is 2
|
|
4231
4234
|
*/
|
|
4232
|
-
static setNavigationBarLeftButton(
|
|
4233
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
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 }) })));
|
|
4241
4250
|
yield this.callNative(ACTION.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE, Object.assign({}, this.getActionBarConfig()), {
|
|
4242
4251
|
haveTimeout: false
|
|
4243
4252
|
});
|
|
4244
4253
|
});
|
|
4245
4254
|
}
|
|
4246
|
-
|
|
4247
|
-
* @ignore
|
|
4248
|
-
* Dynamically sets the right button of the current page.
|
|
4249
|
-
*
|
|
4250
|
-
* @ignore
|
|
4251
|
-
* @category Navigation Bar
|
|
4252
|
-
*
|
|
4253
|
-
* @example
|
|
4254
|
-
* zmpApis.setNavigationBarRightButton({
|
|
4255
|
-
* supportToolBar: 1,
|
|
4256
|
-
* reset: 0,
|
|
4257
|
-
* menuListItems: [{
|
|
4258
|
-
* title: "Post on timeline",
|
|
4259
|
-
* action: "zalo.web.internal.postfeed",
|
|
4260
|
-
* showAsAction: 0,
|
|
4261
|
-
* iconUrl: "https://cdn3.iconfinder.com/data/icons/user-interface-3-3/34/251-512.png",
|
|
4262
|
-
* type: 0,
|
|
4263
|
-
* data: {}
|
|
4264
|
-
* }],
|
|
4265
|
-
* }).then((res) => {
|
|
4266
|
-
* console.log("Success");
|
|
4267
|
-
* }).catch((error) => {
|
|
4268
|
-
* console.log("Fail");
|
|
4269
|
-
* });
|
|
4270
|
-
*
|
|
4271
|
-
* @param {Object} object
|
|
4272
|
-
* @param {Number} object.title - Title of a menu item
|
|
4273
|
-
* @param {Number} object.action - Native action
|
|
4274
|
-
* @param {string} object.showAsAction
|
|
4275
|
-
* If ```showAsAction``` is 1 and ```iconUrl``` can load,
|
|
4276
|
-
* this item will be shown outside and next to more-button. Maximum 2 item will be shown
|
|
4277
|
-
* @param {Function} object.iconUrl - Specifies icon of a menu item
|
|
4278
|
-
* @param {0} object.type
|
|
4279
|
-
* @param {Object} object.data - Data depends on ```action```
|
|
4280
|
-
*/
|
|
4281
|
-
static setNavigationBarRightButton(object) {
|
|
4255
|
+
static setNavigationBar(data) {
|
|
4282
4256
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4283
|
-
yield this.callNative(ACTION.
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
zapp: this.getAppId()
|
|
4257
|
+
yield this.callNative(ACTION.CHANGE_ACTIONBAR, {
|
|
4258
|
+
data
|
|
4259
|
+
}, {
|
|
4260
|
+
haveTimeout: false
|
|
4288
4261
|
});
|
|
4289
4262
|
});
|
|
4290
4263
|
}
|
|
@@ -5769,6 +5742,7 @@
|
|
|
5769
5742
|
return yield this.callNative(ACTION.OPEN_CHAT, {
|
|
5770
5743
|
uId: object.id,
|
|
5771
5744
|
type: ChatType[object.type],
|
|
5745
|
+
msg: object.message || '',
|
|
5772
5746
|
zapp: this.getZAppId(),
|
|
5773
5747
|
sourceId: object.sourceId,
|
|
5774
5748
|
sourceIndex: object.sourceIndex
|
|
@@ -6042,7 +6016,7 @@
|
|
|
6042
6016
|
edit_view: Object.assign(Object.assign({}, defaultEditView), editView),
|
|
6043
6017
|
silent_request: silentRequest,
|
|
6044
6018
|
upload: uploadSetting,
|
|
6045
|
-
|
|
6019
|
+
max_select_items: maxSelectItem
|
|
6046
6020
|
}, {
|
|
6047
6021
|
isMultiCallback: true,
|
|
6048
6022
|
callback: (nativeData, error) => {
|
|
@@ -6132,7 +6106,7 @@
|
|
|
6132
6106
|
}
|
|
6133
6107
|
}
|
|
6134
6108
|
|
|
6135
|
-
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;
|
|
6136
6110
|
class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
|
|
6137
6111
|
constructor() {
|
|
6138
6112
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
@@ -6152,6 +6126,7 @@
|
|
|
6152
6126
|
_ZaloMiniProgramSDKService_prevGetTokenTimestamp.set(this, void 0);
|
|
6153
6127
|
_ZaloMiniProgramSDKService_tokenExpiresIn.set(this, void 0);
|
|
6154
6128
|
_ZaloMiniProgramSDKService_cookies.set(this, null);
|
|
6129
|
+
_ZaloMiniProgramSDKService_deviceId.set(this, void 0);
|
|
6155
6130
|
this.events = ZMPEEmitter.getInstance();
|
|
6156
6131
|
this.isIOS = checkPlatform().isIOS;
|
|
6157
6132
|
_ZaloMiniProgramSDKService_actionBarConfig.set(this, void 0);
|
|
@@ -6171,12 +6146,16 @@
|
|
|
6171
6146
|
.then((data) => {
|
|
6172
6147
|
const cookies = (data && data.cookiesOAuthLogins) || [];
|
|
6173
6148
|
const jsToken = cookies.find((cookie) => cookie.name === COOKIE_NAME.JS_TOKEN);
|
|
6149
|
+
const deviceId = cookies.find((cookie) => cookie.name === COOKIE_NAME.DEVICE_ID);
|
|
6174
6150
|
if (jsToken) {
|
|
6175
6151
|
this.setJSToken(jsToken.value);
|
|
6176
6152
|
window.ZJSBridge.setJSToken &&
|
|
6177
6153
|
window.ZJSBridge.setJSToken(jsToken.value);
|
|
6178
6154
|
}
|
|
6179
6155
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_cookies, cookies, "f");
|
|
6156
|
+
if (deviceId) {
|
|
6157
|
+
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_deviceId, deviceId.value, "f");
|
|
6158
|
+
}
|
|
6180
6159
|
resolve(cookies);
|
|
6181
6160
|
})
|
|
6182
6161
|
.catch((error) => {
|
|
@@ -6185,7 +6164,6 @@
|
|
|
6185
6164
|
}
|
|
6186
6165
|
});
|
|
6187
6166
|
});
|
|
6188
|
-
_ZaloMiniProgramSDKService_setNavigationBarRightButton.set(this, NavigationBar.setNavigationBarRightButton);
|
|
6189
6167
|
this.getVersion = Basics.getVersion;
|
|
6190
6168
|
this.getSystemInfo = Basics.getSystemInfo;
|
|
6191
6169
|
this.setNavigationBarTitle = NavigationBar.setNavigationBarTitle;
|
|
@@ -6255,6 +6233,7 @@
|
|
|
6255
6233
|
this.isShowNavBar = true;
|
|
6256
6234
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, 0, "f");
|
|
6257
6235
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_tokenExpiresIn, 0, "f");
|
|
6236
|
+
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_deviceId, '', "f");
|
|
6258
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' ||
|
|
6259
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'
|
|
6260
6239
|
? ACTION_LEFT_BUTTON_TYPE.SHOW_HOME
|
|
@@ -6298,6 +6277,9 @@
|
|
|
6298
6277
|
getZAppId() {
|
|
6299
6278
|
return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_zAppId, "f");
|
|
6300
6279
|
}
|
|
6280
|
+
getDeviceId() {
|
|
6281
|
+
return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_deviceId, "f");
|
|
6282
|
+
}
|
|
6301
6283
|
login(object) {
|
|
6302
6284
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6303
6285
|
const cookies = yield __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_callJump, "f").call(this);
|
|
@@ -6391,7 +6373,7 @@
|
|
|
6391
6373
|
});
|
|
6392
6374
|
}
|
|
6393
6375
|
}
|
|
6394
|
-
_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();
|
|
6395
6377
|
|
|
6396
6378
|
var _MockSDKService_appId, _MockSDKService_appConfig, _MockSDKService_zOAuth, _MockSDKService_accessToken, _MockSDKService_cache, _MockSDKService_loggedId;
|
|
6397
6379
|
class MockSDKService {
|
|
@@ -6412,6 +6394,9 @@
|
|
|
6412
6394
|
this.getAppId = () => {
|
|
6413
6395
|
return __classPrivateFieldGet(this, _MockSDKService_appId, "f");
|
|
6414
6396
|
};
|
|
6397
|
+
this.getDeviceId = () => {
|
|
6398
|
+
return '';
|
|
6399
|
+
};
|
|
6415
6400
|
this.login = () => {
|
|
6416
6401
|
__classPrivateFieldSet(this, _MockSDKService_loggedId, true, "f");
|
|
6417
6402
|
return Promise.resolve(__classPrivateFieldGet(this, _MockSDKService_zOAuth, "f"));
|
|
@@ -6923,7 +6908,7 @@
|
|
|
6923
6908
|
}
|
|
6924
6909
|
setNavigationBarLeftButton(object) {
|
|
6925
6910
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6926
|
-
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").setNavigationBarLeftButton(object);
|
|
6911
|
+
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").setNavigationBarLeftButton(object.type);
|
|
6927
6912
|
});
|
|
6928
6913
|
}
|
|
6929
6914
|
setDeviceOrientation(object) {
|
|
@@ -7322,6 +7307,17 @@
|
|
|
7322
7307
|
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openOutApp(appStoreURL);
|
|
7323
7308
|
});
|
|
7324
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
|
+
}
|
|
7325
7321
|
}
|
|
7326
7322
|
_SDKCreator_sdkService = new WeakMap();
|
|
7327
7323
|
__decorate([
|
|
@@ -7477,7 +7473,8 @@
|
|
|
7477
7473
|
validate,
|
|
7478
7474
|
__param(0, checkType('object', {
|
|
7479
7475
|
type: checkData('string', { values: ['user', 'oa'] }),
|
|
7480
|
-
id: checkData('string')
|
|
7476
|
+
id: checkData('string'),
|
|
7477
|
+
'message?': checkData('string')
|
|
7481
7478
|
}))
|
|
7482
7479
|
], SDKCreator.prototype, "openChat", null);
|
|
7483
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',
|
|
@@ -3085,7 +3087,8 @@ const parseJSON = (str) => {
|
|
|
3085
3087
|
const formattedStr = str
|
|
3086
3088
|
.replace(/\n/g, '\\n')
|
|
3087
3089
|
.replace(/\r/g, '\\r')
|
|
3088
|
-
.replace(/\t/g, '\\t')
|
|
3090
|
+
.replace(/\t/g, '\\t')
|
|
3091
|
+
.replace(/\x00/g, '');
|
|
3089
3092
|
return JSON.parse(formattedStr, (key, value) => {
|
|
3090
3093
|
return value;
|
|
3091
3094
|
});
|
|
@@ -4058,7 +4061,7 @@ class ZJSBridgeProvider {
|
|
|
4058
4061
|
}
|
|
4059
4062
|
_ZJSBridgeProvider_bridge = new WeakMap();
|
|
4060
4063
|
|
|
4061
|
-
var version$1 = "2.
|
|
4064
|
+
var version$1 = "2.20.0";
|
|
4062
4065
|
|
|
4063
4066
|
class Basics {
|
|
4064
4067
|
/**
|
|
@@ -4226,62 +4229,32 @@ class NavigationBar {
|
|
|
4226
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
|
|
4227
4230
|
* @param {Function} [object.handleCloseEvent] - Specifies a function that will be called when user click close button. Only when ```confirmToExit``` is 2
|
|
4228
4231
|
*/
|
|
4229
|
-
static setNavigationBarLeftButton(
|
|
4230
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
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 }) })));
|
|
4238
4247
|
yield this.callNative(ACTION.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE, Object.assign({}, this.getActionBarConfig()), {
|
|
4239
4248
|
haveTimeout: false
|
|
4240
4249
|
});
|
|
4241
4250
|
});
|
|
4242
4251
|
}
|
|
4243
|
-
|
|
4244
|
-
* @ignore
|
|
4245
|
-
* Dynamically sets the right button of the current page.
|
|
4246
|
-
*
|
|
4247
|
-
* @ignore
|
|
4248
|
-
* @category Navigation Bar
|
|
4249
|
-
*
|
|
4250
|
-
* @example
|
|
4251
|
-
* zmpApis.setNavigationBarRightButton({
|
|
4252
|
-
* supportToolBar: 1,
|
|
4253
|
-
* reset: 0,
|
|
4254
|
-
* menuListItems: [{
|
|
4255
|
-
* title: "Post on timeline",
|
|
4256
|
-
* action: "zalo.web.internal.postfeed",
|
|
4257
|
-
* showAsAction: 0,
|
|
4258
|
-
* iconUrl: "https://cdn3.iconfinder.com/data/icons/user-interface-3-3/34/251-512.png",
|
|
4259
|
-
* type: 0,
|
|
4260
|
-
* data: {}
|
|
4261
|
-
* }],
|
|
4262
|
-
* }).then((res) => {
|
|
4263
|
-
* console.log("Success");
|
|
4264
|
-
* }).catch((error) => {
|
|
4265
|
-
* console.log("Fail");
|
|
4266
|
-
* });
|
|
4267
|
-
*
|
|
4268
|
-
* @param {Object} object
|
|
4269
|
-
* @param {Number} object.title - Title of a menu item
|
|
4270
|
-
* @param {Number} object.action - Native action
|
|
4271
|
-
* @param {string} object.showAsAction
|
|
4272
|
-
* If ```showAsAction``` is 1 and ```iconUrl``` can load,
|
|
4273
|
-
* this item will be shown outside and next to more-button. Maximum 2 item will be shown
|
|
4274
|
-
* @param {Function} object.iconUrl - Specifies icon of a menu item
|
|
4275
|
-
* @param {0} object.type
|
|
4276
|
-
* @param {Object} object.data - Data depends on ```action```
|
|
4277
|
-
*/
|
|
4278
|
-
static setNavigationBarRightButton(object) {
|
|
4252
|
+
static setNavigationBar(data) {
|
|
4279
4253
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4280
|
-
yield this.callNative(ACTION.
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
zapp: this.getAppId()
|
|
4254
|
+
yield this.callNative(ACTION.CHANGE_ACTIONBAR, {
|
|
4255
|
+
data
|
|
4256
|
+
}, {
|
|
4257
|
+
haveTimeout: false
|
|
4285
4258
|
});
|
|
4286
4259
|
});
|
|
4287
4260
|
}
|
|
@@ -5766,6 +5739,7 @@ class Zalo {
|
|
|
5766
5739
|
return yield this.callNative(ACTION.OPEN_CHAT, {
|
|
5767
5740
|
uId: object.id,
|
|
5768
5741
|
type: ChatType[object.type],
|
|
5742
|
+
msg: object.message || '',
|
|
5769
5743
|
zapp: this.getZAppId(),
|
|
5770
5744
|
sourceId: object.sourceId,
|
|
5771
5745
|
sourceIndex: object.sourceIndex
|
|
@@ -6039,7 +6013,7 @@ class Zalo {
|
|
|
6039
6013
|
edit_view: Object.assign(Object.assign({}, defaultEditView), editView),
|
|
6040
6014
|
silent_request: silentRequest,
|
|
6041
6015
|
upload: uploadSetting,
|
|
6042
|
-
|
|
6016
|
+
max_select_items: maxSelectItem
|
|
6043
6017
|
}, {
|
|
6044
6018
|
isMultiCallback: true,
|
|
6045
6019
|
callback: (nativeData, error) => {
|
|
@@ -6129,7 +6103,7 @@ class Routing {
|
|
|
6129
6103
|
}
|
|
6130
6104
|
}
|
|
6131
6105
|
|
|
6132
|
-
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;
|
|
6133
6107
|
class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
|
|
6134
6108
|
constructor() {
|
|
6135
6109
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
@@ -6149,6 +6123,7 @@ class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
|
|
|
6149
6123
|
_ZaloMiniProgramSDKService_prevGetTokenTimestamp.set(this, void 0);
|
|
6150
6124
|
_ZaloMiniProgramSDKService_tokenExpiresIn.set(this, void 0);
|
|
6151
6125
|
_ZaloMiniProgramSDKService_cookies.set(this, null);
|
|
6126
|
+
_ZaloMiniProgramSDKService_deviceId.set(this, void 0);
|
|
6152
6127
|
this.events = ZMPEEmitter.getInstance();
|
|
6153
6128
|
this.isIOS = checkPlatform().isIOS;
|
|
6154
6129
|
_ZaloMiniProgramSDKService_actionBarConfig.set(this, void 0);
|
|
@@ -6168,12 +6143,16 @@ class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
|
|
|
6168
6143
|
.then((data) => {
|
|
6169
6144
|
const cookies = (data && data.cookiesOAuthLogins) || [];
|
|
6170
6145
|
const jsToken = cookies.find((cookie) => cookie.name === COOKIE_NAME.JS_TOKEN);
|
|
6146
|
+
const deviceId = cookies.find((cookie) => cookie.name === COOKIE_NAME.DEVICE_ID);
|
|
6171
6147
|
if (jsToken) {
|
|
6172
6148
|
this.setJSToken(jsToken.value);
|
|
6173
6149
|
window.ZJSBridge.setJSToken &&
|
|
6174
6150
|
window.ZJSBridge.setJSToken(jsToken.value);
|
|
6175
6151
|
}
|
|
6176
6152
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_cookies, cookies, "f");
|
|
6153
|
+
if (deviceId) {
|
|
6154
|
+
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_deviceId, deviceId.value, "f");
|
|
6155
|
+
}
|
|
6177
6156
|
resolve(cookies);
|
|
6178
6157
|
})
|
|
6179
6158
|
.catch((error) => {
|
|
@@ -6182,7 +6161,6 @@ class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
|
|
|
6182
6161
|
}
|
|
6183
6162
|
});
|
|
6184
6163
|
});
|
|
6185
|
-
_ZaloMiniProgramSDKService_setNavigationBarRightButton.set(this, NavigationBar.setNavigationBarRightButton);
|
|
6186
6164
|
this.getVersion = Basics.getVersion;
|
|
6187
6165
|
this.getSystemInfo = Basics.getSystemInfo;
|
|
6188
6166
|
this.setNavigationBarTitle = NavigationBar.setNavigationBarTitle;
|
|
@@ -6252,6 +6230,7 @@ class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
|
|
|
6252
6230
|
this.isShowNavBar = true;
|
|
6253
6231
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, 0, "f");
|
|
6254
6232
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_tokenExpiresIn, 0, "f");
|
|
6233
|
+
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_deviceId, '', "f");
|
|
6255
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' ||
|
|
6256
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'
|
|
6257
6236
|
? ACTION_LEFT_BUTTON_TYPE.SHOW_HOME
|
|
@@ -6295,6 +6274,9 @@ class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
|
|
|
6295
6274
|
getZAppId() {
|
|
6296
6275
|
return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_zAppId, "f");
|
|
6297
6276
|
}
|
|
6277
|
+
getDeviceId() {
|
|
6278
|
+
return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_deviceId, "f");
|
|
6279
|
+
}
|
|
6298
6280
|
login(object) {
|
|
6299
6281
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6300
6282
|
const cookies = yield __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_callJump, "f").call(this);
|
|
@@ -6388,7 +6370,7 @@ class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
|
|
|
6388
6370
|
});
|
|
6389
6371
|
}
|
|
6390
6372
|
}
|
|
6391
|
-
_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();
|
|
6392
6374
|
|
|
6393
6375
|
var _MockSDKService_appId, _MockSDKService_appConfig, _MockSDKService_zOAuth, _MockSDKService_accessToken, _MockSDKService_cache, _MockSDKService_loggedId;
|
|
6394
6376
|
class MockSDKService {
|
|
@@ -6409,6 +6391,9 @@ class MockSDKService {
|
|
|
6409
6391
|
this.getAppId = () => {
|
|
6410
6392
|
return __classPrivateFieldGet(this, _MockSDKService_appId, "f");
|
|
6411
6393
|
};
|
|
6394
|
+
this.getDeviceId = () => {
|
|
6395
|
+
return '';
|
|
6396
|
+
};
|
|
6412
6397
|
this.login = () => {
|
|
6413
6398
|
__classPrivateFieldSet(this, _MockSDKService_loggedId, true, "f");
|
|
6414
6399
|
return Promise.resolve(__classPrivateFieldGet(this, _MockSDKService_zOAuth, "f"));
|
|
@@ -8278,7 +8263,7 @@ class SDKCreator {
|
|
|
8278
8263
|
}
|
|
8279
8264
|
setNavigationBarLeftButton(object) {
|
|
8280
8265
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8281
|
-
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").setNavigationBarLeftButton(object);
|
|
8266
|
+
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").setNavigationBarLeftButton(object.type);
|
|
8282
8267
|
});
|
|
8283
8268
|
}
|
|
8284
8269
|
setDeviceOrientation(object) {
|
|
@@ -8677,6 +8662,17 @@ class SDKCreator {
|
|
|
8677
8662
|
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openOutApp(appStoreURL);
|
|
8678
8663
|
});
|
|
8679
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
|
+
}
|
|
8680
8676
|
}
|
|
8681
8677
|
_SDKCreator_sdkService = new WeakMap();
|
|
8682
8678
|
__decorate([
|
|
@@ -8832,7 +8828,8 @@ __decorate([
|
|
|
8832
8828
|
validate,
|
|
8833
8829
|
__param(0, checkType('object', {
|
|
8834
8830
|
type: checkData('string', { values: ['user', 'oa'] }),
|
|
8835
|
-
id: checkData('string')
|
|
8831
|
+
id: checkData('string'),
|
|
8832
|
+
'message?': checkData('string')
|
|
8836
8833
|
}))
|
|
8837
8834
|
], SDKCreator.prototype, "openChat", null);
|
|
8838
8835
|
__decorate([
|