zmp-sdk 2.16.5 → 2.16.8
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 +24 -18
- package/dist/index.es.js +24 -18
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/types/src/apis/index.d.ts +5 -1
- package/dist/types/src/constants.d.ts +2 -0
- package/dist/types/src/utils/response.d.ts +5 -0
- package/package.json +1 -1
package/dist/browser.min.js
CHANGED
|
@@ -35281,6 +35281,7 @@
|
|
|
35281
35281
|
}
|
|
35282
35282
|
};
|
|
35283
35283
|
const RESPONSE_CODE = {
|
|
35284
|
+
SUCCESS: 0,
|
|
35284
35285
|
BAD_REQUEST: -1400,
|
|
35285
35286
|
INTERNAL_SERVER_ERROR: -1500,
|
|
35286
35287
|
UNAUTHORIZED: -1401,
|
|
@@ -35288,6 +35289,7 @@
|
|
|
35288
35289
|
CLIENT_NOT_SUPPORT: -1404
|
|
35289
35290
|
};
|
|
35290
35291
|
const MESSAGES = {
|
|
35292
|
+
SUCCESS: 'Success',
|
|
35291
35293
|
READ_MORE: 'Read more at: https://miniapp.zalo.me/docs/api',
|
|
35292
35294
|
LOGIN_REQUIRED: 'Please login before to call this api. Read more at: https://miniapp.zalo.me/docs/api/login',
|
|
35293
35295
|
LOGIN_FAILED: 'Login failed.',
|
|
@@ -35524,6 +35526,11 @@
|
|
|
35524
35526
|
};
|
|
35525
35527
|
|
|
35526
35528
|
const apiResponse = {
|
|
35529
|
+
success: (data, message) => ({
|
|
35530
|
+
code: RESPONSE_CODE.SUCCESS,
|
|
35531
|
+
message: message || MESSAGES.SUCCESS,
|
|
35532
|
+
data: data || {}
|
|
35533
|
+
}),
|
|
35527
35534
|
error: {
|
|
35528
35535
|
badRequest: (message) => new CommonError(RESPONSE_CODE.BAD_REQUEST, message),
|
|
35529
35536
|
loginFailed: () => new CommonError(RESPONSE_CODE.BAD_REQUEST, MESSAGES.LOGIN_FAILED),
|
|
@@ -36740,7 +36747,7 @@
|
|
|
36740
36747
|
}
|
|
36741
36748
|
_ZJSBridgeProvider_bridge = new WeakMap();
|
|
36742
36749
|
|
|
36743
|
-
var version = "2.16.
|
|
36750
|
+
var version = "2.16.8";
|
|
36744
36751
|
|
|
36745
36752
|
class Basics {
|
|
36746
36753
|
/**
|
|
@@ -38180,7 +38187,7 @@
|
|
|
38180
38187
|
return Promise.reject(error);
|
|
38181
38188
|
}
|
|
38182
38189
|
},
|
|
38183
|
-
delay: this.isIOS ?
|
|
38190
|
+
delay: this.isIOS ? 400 : 0
|
|
38184
38191
|
});
|
|
38185
38192
|
});
|
|
38186
38193
|
}
|
|
@@ -38287,7 +38294,7 @@
|
|
|
38287
38294
|
return Promise.reject(error);
|
|
38288
38295
|
}
|
|
38289
38296
|
},
|
|
38290
|
-
delay: this.isIOS ?
|
|
38297
|
+
delay: this.isIOS ? 400 : 0
|
|
38291
38298
|
});
|
|
38292
38299
|
});
|
|
38293
38300
|
}
|
|
@@ -38773,7 +38780,7 @@
|
|
|
38773
38780
|
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, _ZaloMiniProgramSDKService_setNavigationBarRightButton, _ZaloMiniProgramSDKService_getActionsSupported;
|
|
38774
38781
|
class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
|
|
38775
38782
|
constructor() {
|
|
38776
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
38783
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
38777
38784
|
super();
|
|
38778
38785
|
_ZaloMiniProgramSDKService_zAppId.set(this, ZAPP_ID);
|
|
38779
38786
|
_ZaloMiniProgramSDKService_appId.set(this, APP_ID);
|
|
@@ -38896,20 +38903,20 @@
|
|
|
38896
38903
|
? ACTION_LEFT_BUTTON_TYPE.SHOW_HOME
|
|
38897
38904
|
: ACTION_LEFT_BUTTON_TYPE.HIDE_HOME;
|
|
38898
38905
|
const currentUrl = new URL(location.href);
|
|
38899
|
-
const actionBarType = lodash.isString(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.headerColor) &&
|
|
38900
|
-
__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.headerColor.length > 0
|
|
38906
|
+
const actionBarType = lodash.isString((_f = (_e = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _e === void 0 ? void 0 : _e.app) === null || _f === void 0 ? void 0 : _f.headerColor) &&
|
|
38907
|
+
((_j = (_h = (_g = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _g === void 0 ? void 0 : _g.app) === null || _h === void 0 ? void 0 : _h.headerColor) === null || _j === void 0 ? void 0 : _j.length) > 0
|
|
38901
38908
|
? SHOW_ACTION_BAR
|
|
38902
38909
|
: HIDE_ACTION_BAR;
|
|
38903
|
-
const leftButtonType = ((
|
|
38904
|
-
((
|
|
38910
|
+
const leftButtonType = ((_l = (_k = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _k === void 0 ? void 0 : _k.app) === null || _l === void 0 ? void 0 : _l.leftButton) === 'none' ||
|
|
38911
|
+
((_o = (_m = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _m === void 0 ? void 0 : _m.app) === null || _o === void 0 ? void 0 : _o.leftButton) === 'home'
|
|
38905
38912
|
? ACTION_LEFT_BUTTON_TYPE.HIDE_BACK
|
|
38906
38913
|
: ACTION_LEFT_BUTTON_TYPE.SHOW_BACK;
|
|
38907
38914
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_actionBarConfig, {
|
|
38908
38915
|
actionbarType: actionBarType,
|
|
38909
38916
|
buttonType: leftButtonType,
|
|
38910
38917
|
dataConfig: {
|
|
38911
|
-
backgroundColor: __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.headerColor || '',
|
|
38912
|
-
textColor: __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.textColor || '',
|
|
38918
|
+
backgroundColor: ((_q = (_p = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _p === void 0 ? void 0 : _p.app) === null || _q === void 0 ? void 0 : _q.headerColor) || '',
|
|
38919
|
+
textColor: ((_s = (_r = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _r === void 0 ? void 0 : _r.app) === null || _s === void 0 ? void 0 : _s.textColor) || '',
|
|
38913
38920
|
viewInLeftType: leftButtonType,
|
|
38914
38921
|
confirmToExit: 1
|
|
38915
38922
|
},
|
|
@@ -40848,13 +40855,10 @@
|
|
|
40848
40855
|
}
|
|
40849
40856
|
createShortcut(object) {
|
|
40850
40857
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40858
|
+
const appInfo = yield getAppInfo(APP_ID, 0);
|
|
40851
40859
|
const isIOS = checkPlatform().isIOS;
|
|
40852
|
-
|
|
40853
|
-
|
|
40854
|
-
if (!(iconURL === null || iconURL === void 0 ? void 0 : iconURL.includes('https'))) {
|
|
40855
|
-
iconURL = `https:${iconURL}`;
|
|
40856
|
-
}
|
|
40857
|
-
const title = document.title;
|
|
40860
|
+
const iconURL = appInfo.logoUrl || getMetaValue('og:image:url') || '';
|
|
40861
|
+
const title = appInfo.name || document.title;
|
|
40858
40862
|
const searchParams = object.params
|
|
40859
40863
|
? new URLSearchParams(object.params)
|
|
40860
40864
|
: new URLSearchParams();
|
|
@@ -40863,10 +40867,12 @@
|
|
|
40863
40867
|
searchParams.append('appName', title);
|
|
40864
40868
|
searchParams.append('appIcon', iconURL);
|
|
40865
40869
|
const iosShortcutURL = `https://mini.zalo.me/shortcut.html?${searchParams.toString()}`;
|
|
40866
|
-
|
|
40870
|
+
yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openOutApp(encodeURI(iosShortcutURL));
|
|
40867
40871
|
}
|
|
40868
|
-
else
|
|
40872
|
+
else {
|
|
40869
40873
|
yield __classPrivateFieldGet(this, _SDKCreator_sdkService).createShortcut(`${MINI_APP_LINK}/${APP_ID}/?${searchParams.toString()}`, title, iconURL);
|
|
40874
|
+
}
|
|
40875
|
+
return apiResponse.success();
|
|
40870
40876
|
});
|
|
40871
40877
|
}
|
|
40872
40878
|
openBioAuthentication(object) {
|
package/dist/index.es.js
CHANGED
|
@@ -35278,6 +35278,7 @@ const ACTION = {
|
|
|
35278
35278
|
}
|
|
35279
35279
|
};
|
|
35280
35280
|
const RESPONSE_CODE = {
|
|
35281
|
+
SUCCESS: 0,
|
|
35281
35282
|
BAD_REQUEST: -1400,
|
|
35282
35283
|
INTERNAL_SERVER_ERROR: -1500,
|
|
35283
35284
|
UNAUTHORIZED: -1401,
|
|
@@ -35285,6 +35286,7 @@ const RESPONSE_CODE = {
|
|
|
35285
35286
|
CLIENT_NOT_SUPPORT: -1404
|
|
35286
35287
|
};
|
|
35287
35288
|
const MESSAGES = {
|
|
35289
|
+
SUCCESS: 'Success',
|
|
35288
35290
|
READ_MORE: 'Read more at: https://miniapp.zalo.me/docs/api',
|
|
35289
35291
|
LOGIN_REQUIRED: 'Please login before to call this api. Read more at: https://miniapp.zalo.me/docs/api/login',
|
|
35290
35292
|
LOGIN_FAILED: 'Login failed.',
|
|
@@ -35521,6 +35523,11 @@ const handleErrorSync = (target, key, descriptor) => {
|
|
|
35521
35523
|
};
|
|
35522
35524
|
|
|
35523
35525
|
const apiResponse = {
|
|
35526
|
+
success: (data, message) => ({
|
|
35527
|
+
code: RESPONSE_CODE.SUCCESS,
|
|
35528
|
+
message: message || MESSAGES.SUCCESS,
|
|
35529
|
+
data: data || {}
|
|
35530
|
+
}),
|
|
35524
35531
|
error: {
|
|
35525
35532
|
badRequest: (message) => new CommonError(RESPONSE_CODE.BAD_REQUEST, message),
|
|
35526
35533
|
loginFailed: () => new CommonError(RESPONSE_CODE.BAD_REQUEST, MESSAGES.LOGIN_FAILED),
|
|
@@ -36737,7 +36744,7 @@ class ZJSBridgeProvider {
|
|
|
36737
36744
|
}
|
|
36738
36745
|
_ZJSBridgeProvider_bridge = new WeakMap();
|
|
36739
36746
|
|
|
36740
|
-
var version = "2.16.
|
|
36747
|
+
var version = "2.16.8";
|
|
36741
36748
|
|
|
36742
36749
|
class Basics {
|
|
36743
36750
|
/**
|
|
@@ -38177,7 +38184,7 @@ class OpenApi {
|
|
|
38177
38184
|
return Promise.reject(error);
|
|
38178
38185
|
}
|
|
38179
38186
|
},
|
|
38180
|
-
delay: this.isIOS ?
|
|
38187
|
+
delay: this.isIOS ? 400 : 0
|
|
38181
38188
|
});
|
|
38182
38189
|
});
|
|
38183
38190
|
}
|
|
@@ -38284,7 +38291,7 @@ class Location {
|
|
|
38284
38291
|
return Promise.reject(error);
|
|
38285
38292
|
}
|
|
38286
38293
|
},
|
|
38287
|
-
delay: this.isIOS ?
|
|
38294
|
+
delay: this.isIOS ? 400 : 0
|
|
38288
38295
|
});
|
|
38289
38296
|
});
|
|
38290
38297
|
}
|
|
@@ -38770,7 +38777,7 @@ class Routing {
|
|
|
38770
38777
|
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, _ZaloMiniProgramSDKService_setNavigationBarRightButton, _ZaloMiniProgramSDKService_getActionsSupported;
|
|
38771
38778
|
class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
|
|
38772
38779
|
constructor() {
|
|
38773
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
38780
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
38774
38781
|
super();
|
|
38775
38782
|
_ZaloMiniProgramSDKService_zAppId.set(this, ZAPP_ID);
|
|
38776
38783
|
_ZaloMiniProgramSDKService_appId.set(this, APP_ID);
|
|
@@ -38893,20 +38900,20 @@ class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
|
|
|
38893
38900
|
? ACTION_LEFT_BUTTON_TYPE.SHOW_HOME
|
|
38894
38901
|
: ACTION_LEFT_BUTTON_TYPE.HIDE_HOME;
|
|
38895
38902
|
const currentUrl = new URL(location.href);
|
|
38896
|
-
const actionBarType = lodash.isString(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.headerColor) &&
|
|
38897
|
-
__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.headerColor.length > 0
|
|
38903
|
+
const actionBarType = lodash.isString((_f = (_e = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _e === void 0 ? void 0 : _e.app) === null || _f === void 0 ? void 0 : _f.headerColor) &&
|
|
38904
|
+
((_j = (_h = (_g = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _g === void 0 ? void 0 : _g.app) === null || _h === void 0 ? void 0 : _h.headerColor) === null || _j === void 0 ? void 0 : _j.length) > 0
|
|
38898
38905
|
? SHOW_ACTION_BAR
|
|
38899
38906
|
: HIDE_ACTION_BAR;
|
|
38900
|
-
const leftButtonType = ((
|
|
38901
|
-
((
|
|
38907
|
+
const leftButtonType = ((_l = (_k = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _k === void 0 ? void 0 : _k.app) === null || _l === void 0 ? void 0 : _l.leftButton) === 'none' ||
|
|
38908
|
+
((_o = (_m = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _m === void 0 ? void 0 : _m.app) === null || _o === void 0 ? void 0 : _o.leftButton) === 'home'
|
|
38902
38909
|
? ACTION_LEFT_BUTTON_TYPE.HIDE_BACK
|
|
38903
38910
|
: ACTION_LEFT_BUTTON_TYPE.SHOW_BACK;
|
|
38904
38911
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_actionBarConfig, {
|
|
38905
38912
|
actionbarType: actionBarType,
|
|
38906
38913
|
buttonType: leftButtonType,
|
|
38907
38914
|
dataConfig: {
|
|
38908
|
-
backgroundColor: __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.headerColor || '',
|
|
38909
|
-
textColor: __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.textColor || '',
|
|
38915
|
+
backgroundColor: ((_q = (_p = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _p === void 0 ? void 0 : _p.app) === null || _q === void 0 ? void 0 : _q.headerColor) || '',
|
|
38916
|
+
textColor: ((_s = (_r = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _r === void 0 ? void 0 : _r.app) === null || _s === void 0 ? void 0 : _s.textColor) || '',
|
|
38910
38917
|
viewInLeftType: leftButtonType,
|
|
38911
38918
|
confirmToExit: 1
|
|
38912
38919
|
},
|
|
@@ -40845,13 +40852,10 @@ class SDKCreator {
|
|
|
40845
40852
|
}
|
|
40846
40853
|
createShortcut(object) {
|
|
40847
40854
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40855
|
+
const appInfo = yield getAppInfo(APP_ID, 0);
|
|
40848
40856
|
const isIOS = checkPlatform().isIOS;
|
|
40849
|
-
|
|
40850
|
-
|
|
40851
|
-
if (!(iconURL === null || iconURL === void 0 ? void 0 : iconURL.includes('https'))) {
|
|
40852
|
-
iconURL = `https:${iconURL}`;
|
|
40853
|
-
}
|
|
40854
|
-
const title = document.title;
|
|
40857
|
+
const iconURL = appInfo.logoUrl || getMetaValue('og:image:url') || '';
|
|
40858
|
+
const title = appInfo.name || document.title;
|
|
40855
40859
|
const searchParams = object.params
|
|
40856
40860
|
? new URLSearchParams(object.params)
|
|
40857
40861
|
: new URLSearchParams();
|
|
@@ -40860,10 +40864,12 @@ class SDKCreator {
|
|
|
40860
40864
|
searchParams.append('appName', title);
|
|
40861
40865
|
searchParams.append('appIcon', iconURL);
|
|
40862
40866
|
const iosShortcutURL = `https://mini.zalo.me/shortcut.html?${searchParams.toString()}`;
|
|
40863
|
-
|
|
40867
|
+
yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openOutApp(encodeURI(iosShortcutURL));
|
|
40864
40868
|
}
|
|
40865
|
-
else
|
|
40869
|
+
else {
|
|
40866
40870
|
yield __classPrivateFieldGet(this, _SDKCreator_sdkService).createShortcut(`${MINI_APP_LINK}/${APP_ID}/?${searchParams.toString()}`, title, iconURL);
|
|
40871
|
+
}
|
|
40872
|
+
return apiResponse.success();
|
|
40867
40873
|
});
|
|
40868
40874
|
}
|
|
40869
40875
|
openBioAuthentication(object) {
|