zmp-sdk 2.14.0 → 2.14.4
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 +255 -112
- package/dist/index.es.js +255 -112
- package/dist/index.js +3 -3
- package/dist/index.umd.js +2 -2
- package/dist/types/src/controller/index.d.ts +2 -1
- package/dist/types/src/controller/interface.d.ts +2 -1
- package/dist/types/src/controller/mock-mp-manager.d.ts +1 -0
- package/dist/types/src/controller/zalo-mp-manager.d.ts +1 -0
- package/dist/types/src/services/openApi.d.ts +1 -1
- package/dist/types/src/types/inputData.d.ts +6 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -21807,7 +21807,7 @@ const stringToData = (data) => {
|
|
|
21807
21807
|
return null;
|
|
21808
21808
|
}
|
|
21809
21809
|
catch (error) {
|
|
21810
|
-
|
|
21810
|
+
debug$2(error);
|
|
21811
21811
|
return data;
|
|
21812
21812
|
}
|
|
21813
21813
|
};
|
|
@@ -34671,38 +34671,54 @@ var zlib$2 = /*#__PURE__*/Object.freeze({
|
|
|
34671
34671
|
'default': zlib$1
|
|
34672
34672
|
});
|
|
34673
34673
|
|
|
34674
|
-
var
|
|
34675
|
-
|
|
34676
|
-
|
|
34677
|
-
|
|
34678
|
-
|
|
34679
|
-
|
|
34680
|
-
|
|
34681
|
-
|
|
34682
|
-
|
|
34683
|
-
|
|
34684
|
-
|
|
34685
|
-
|
|
34686
|
-
coveralls: "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
|
|
34687
|
-
fix: "eslint --fix lib/**/*.js"
|
|
34674
|
+
var _args = [
|
|
34675
|
+
[
|
|
34676
|
+
"axios@0.21.1",
|
|
34677
|
+
"/Users/nguyentuankiet/Work/Zalo/Projects/ZaloMiniProgram/TestNewFunction"
|
|
34678
|
+
]
|
|
34679
|
+
];
|
|
34680
|
+
var _from = "axios@0.21.1";
|
|
34681
|
+
var _id = "axios@0.21.1";
|
|
34682
|
+
var _inBundle = false;
|
|
34683
|
+
var _integrity = "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==";
|
|
34684
|
+
var _location = "/zmp-sdk/axios";
|
|
34685
|
+
var _phantomChildren = {
|
|
34688
34686
|
};
|
|
34689
|
-
var
|
|
34690
|
-
type: "
|
|
34691
|
-
|
|
34687
|
+
var _requested = {
|
|
34688
|
+
type: "version",
|
|
34689
|
+
registry: true,
|
|
34690
|
+
raw: "axios@0.21.1",
|
|
34691
|
+
name: "axios",
|
|
34692
|
+
escapedName: "axios",
|
|
34693
|
+
rawSpec: "0.21.1",
|
|
34694
|
+
saveSpec: null,
|
|
34695
|
+
fetchSpec: "0.21.1"
|
|
34692
34696
|
};
|
|
34693
|
-
var
|
|
34694
|
-
"
|
|
34695
|
-
"http",
|
|
34696
|
-
"ajax",
|
|
34697
|
-
"promise",
|
|
34698
|
-
"node"
|
|
34697
|
+
var _requiredBy = [
|
|
34698
|
+
"/zmp-sdk"
|
|
34699
34699
|
];
|
|
34700
|
-
var
|
|
34701
|
-
var
|
|
34700
|
+
var _resolved = "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz";
|
|
34701
|
+
var _spec = "0.21.1";
|
|
34702
|
+
var _where = "/Users/nguyentuankiet/Work/Zalo/Projects/ZaloMiniProgram/TestNewFunction";
|
|
34703
|
+
var author = {
|
|
34704
|
+
name: "Matt Zabriskie"
|
|
34705
|
+
};
|
|
34706
|
+
var browser = {
|
|
34707
|
+
"./lib/adapters/http.js": "./lib/adapters/xhr.js"
|
|
34708
|
+
};
|
|
34702
34709
|
var bugs = {
|
|
34703
34710
|
url: "https://github.com/axios/axios/issues"
|
|
34704
34711
|
};
|
|
34705
|
-
var
|
|
34712
|
+
var bundlesize = [
|
|
34713
|
+
{
|
|
34714
|
+
path: "./dist/axios.min.js",
|
|
34715
|
+
threshold: "5kB"
|
|
34716
|
+
}
|
|
34717
|
+
];
|
|
34718
|
+
var dependencies = {
|
|
34719
|
+
"follow-redirects": "^1.10.0"
|
|
34720
|
+
};
|
|
34721
|
+
var description = "Promise based HTTP client for the browser and node.js";
|
|
34706
34722
|
var devDependencies = {
|
|
34707
34723
|
bundlesize: "^0.17.0",
|
|
34708
34724
|
coveralls: "^3.0.0",
|
|
@@ -34740,62 +34756,101 @@ var devDependencies = {
|
|
|
34740
34756
|
webpack: "^1.13.1",
|
|
34741
34757
|
"webpack-dev-server": "^1.14.1"
|
|
34742
34758
|
};
|
|
34743
|
-
var
|
|
34744
|
-
"./lib/adapters/http.js": "./lib/adapters/xhr.js"
|
|
34745
|
-
};
|
|
34759
|
+
var homepage = "https://github.com/axios/axios";
|
|
34746
34760
|
var jsdelivr = "dist/axios.min.js";
|
|
34747
|
-
var
|
|
34748
|
-
|
|
34749
|
-
|
|
34750
|
-
"
|
|
34751
|
-
|
|
34752
|
-
|
|
34753
|
-
{
|
|
34754
|
-
path: "./dist/axios.min.js",
|
|
34755
|
-
threshold: "5kB"
|
|
34756
|
-
}
|
|
34761
|
+
var keywords = [
|
|
34762
|
+
"xhr",
|
|
34763
|
+
"http",
|
|
34764
|
+
"ajax",
|
|
34765
|
+
"promise",
|
|
34766
|
+
"node"
|
|
34757
34767
|
];
|
|
34768
|
+
var license = "MIT";
|
|
34769
|
+
var main = "index.js";
|
|
34770
|
+
var name = "axios";
|
|
34771
|
+
var repository = {
|
|
34772
|
+
type: "git",
|
|
34773
|
+
url: "git+https://github.com/axios/axios.git"
|
|
34774
|
+
};
|
|
34775
|
+
var scripts = {
|
|
34776
|
+
build: "NODE_ENV=production grunt build",
|
|
34777
|
+
coveralls: "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
|
|
34778
|
+
examples: "node ./examples/server.js",
|
|
34779
|
+
fix: "eslint --fix lib/**/*.js",
|
|
34780
|
+
postversion: "git push && git push --tags",
|
|
34781
|
+
preversion: "npm test",
|
|
34782
|
+
start: "node ./sandbox/server.js",
|
|
34783
|
+
test: "grunt test && bundlesize",
|
|
34784
|
+
version: "npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"
|
|
34785
|
+
};
|
|
34786
|
+
var typings = "./index.d.ts";
|
|
34787
|
+
var unpkg = "dist/axios.min.js";
|
|
34788
|
+
var version$1 = "0.21.1";
|
|
34758
34789
|
var _package = {
|
|
34759
|
-
|
|
34760
|
-
|
|
34761
|
-
|
|
34762
|
-
|
|
34763
|
-
|
|
34764
|
-
|
|
34765
|
-
|
|
34790
|
+
_args: _args,
|
|
34791
|
+
_from: _from,
|
|
34792
|
+
_id: _id,
|
|
34793
|
+
_inBundle: _inBundle,
|
|
34794
|
+
_integrity: _integrity,
|
|
34795
|
+
_location: _location,
|
|
34796
|
+
_phantomChildren: _phantomChildren,
|
|
34797
|
+
_requested: _requested,
|
|
34798
|
+
_requiredBy: _requiredBy,
|
|
34799
|
+
_resolved: _resolved,
|
|
34800
|
+
_spec: _spec,
|
|
34801
|
+
_where: _where,
|
|
34766
34802
|
author: author,
|
|
34767
|
-
|
|
34803
|
+
browser: browser,
|
|
34768
34804
|
bugs: bugs,
|
|
34769
|
-
|
|
34805
|
+
bundlesize: bundlesize,
|
|
34806
|
+
dependencies: dependencies,
|
|
34807
|
+
description: description,
|
|
34770
34808
|
devDependencies: devDependencies,
|
|
34771
|
-
|
|
34809
|
+
homepage: homepage,
|
|
34772
34810
|
jsdelivr: jsdelivr,
|
|
34773
|
-
|
|
34811
|
+
keywords: keywords,
|
|
34812
|
+
license: license,
|
|
34813
|
+
main: main,
|
|
34814
|
+
name: name,
|
|
34815
|
+
repository: repository,
|
|
34816
|
+
scripts: scripts,
|
|
34774
34817
|
typings: typings,
|
|
34775
|
-
|
|
34776
|
-
|
|
34818
|
+
unpkg: unpkg,
|
|
34819
|
+
version: version$1
|
|
34777
34820
|
};
|
|
34778
34821
|
|
|
34779
34822
|
var _package$1 = /*#__PURE__*/Object.freeze({
|
|
34780
34823
|
__proto__: null,
|
|
34781
|
-
|
|
34782
|
-
|
|
34783
|
-
|
|
34784
|
-
|
|
34785
|
-
|
|
34786
|
-
|
|
34787
|
-
|
|
34824
|
+
_args: _args,
|
|
34825
|
+
_from: _from,
|
|
34826
|
+
_id: _id,
|
|
34827
|
+
_inBundle: _inBundle,
|
|
34828
|
+
_integrity: _integrity,
|
|
34829
|
+
_location: _location,
|
|
34830
|
+
_phantomChildren: _phantomChildren,
|
|
34831
|
+
_requested: _requested,
|
|
34832
|
+
_requiredBy: _requiredBy,
|
|
34833
|
+
_resolved: _resolved,
|
|
34834
|
+
_spec: _spec,
|
|
34835
|
+
_where: _where,
|
|
34788
34836
|
author: author,
|
|
34789
|
-
|
|
34837
|
+
browser: browser,
|
|
34790
34838
|
bugs: bugs,
|
|
34791
|
-
|
|
34839
|
+
bundlesize: bundlesize,
|
|
34840
|
+
dependencies: dependencies,
|
|
34841
|
+
description: description,
|
|
34792
34842
|
devDependencies: devDependencies,
|
|
34793
|
-
|
|
34843
|
+
homepage: homepage,
|
|
34794
34844
|
jsdelivr: jsdelivr,
|
|
34795
|
-
|
|
34845
|
+
keywords: keywords,
|
|
34846
|
+
license: license,
|
|
34847
|
+
main: main,
|
|
34848
|
+
name: name,
|
|
34849
|
+
repository: repository,
|
|
34850
|
+
scripts: scripts,
|
|
34796
34851
|
typings: typings,
|
|
34797
|
-
|
|
34798
|
-
|
|
34852
|
+
unpkg: unpkg,
|
|
34853
|
+
version: version$1,
|
|
34799
34854
|
'default': _package
|
|
34800
34855
|
});
|
|
34801
34856
|
|
|
@@ -36095,6 +36150,16 @@ const handleError = (target, propertyName, descriptor) => {
|
|
|
36095
36150
|
}
|
|
36096
36151
|
}
|
|
36097
36152
|
catch (error) {
|
|
36153
|
+
if ((error === null || error === void 0 ? void 0 : error.code) === RESPONSE_CODE.UNAUTHORIZED ||
|
|
36154
|
+
(error === null || error === void 0 ? void 0 : error.code) === RESPONSE_CODE.FORBIDDEN) {
|
|
36155
|
+
let loggedIn = false;
|
|
36156
|
+
if (this instanceof SDKCreator) {
|
|
36157
|
+
loggedIn = this.getLoginStatus();
|
|
36158
|
+
}
|
|
36159
|
+
if (!loggedIn) {
|
|
36160
|
+
error = new CommonError(RESPONSE_CODE.UNAUTHORIZED, MESSAGES.LOGIN_REQUIRED);
|
|
36161
|
+
}
|
|
36162
|
+
}
|
|
36098
36163
|
const { handler } = catchDecoratorStore;
|
|
36099
36164
|
const errorParsed = handler.call(null, propertyName, error, this);
|
|
36100
36165
|
window.zmpSentry && window.zmpSentry.throwError(errorParsed.toString());
|
|
@@ -36117,6 +36182,16 @@ const handleErrorSync = (target, key, descriptor) => {
|
|
|
36117
36182
|
return fn.apply(this, args);
|
|
36118
36183
|
}
|
|
36119
36184
|
catch (error) {
|
|
36185
|
+
if ((error === null || error === void 0 ? void 0 : error.code) === RESPONSE_CODE.UNAUTHORIZED ||
|
|
36186
|
+
(error === null || error === void 0 ? void 0 : error.code) === RESPONSE_CODE.FORBIDDEN) {
|
|
36187
|
+
let loggedIn = false;
|
|
36188
|
+
if (this instanceof SDKCreator) {
|
|
36189
|
+
loggedIn = this.getLoginStatus();
|
|
36190
|
+
}
|
|
36191
|
+
if (!loggedIn) {
|
|
36192
|
+
error = new CommonError(RESPONSE_CODE.UNAUTHORIZED, MESSAGES.LOGIN_REQUIRED);
|
|
36193
|
+
}
|
|
36194
|
+
}
|
|
36120
36195
|
const { handler } = catchDecoratorStore;
|
|
36121
36196
|
if (!lodash.isNull(handler) && lodash.isFunction(handler)) {
|
|
36122
36197
|
handler.call(null, key, error, this);
|
|
@@ -36145,31 +36220,71 @@ class ZJSBridgeProvider {
|
|
|
36145
36220
|
}
|
|
36146
36221
|
callNative(action, data, option) {
|
|
36147
36222
|
return new Promise((resolve, reject) => {
|
|
36148
|
-
const fn = (cb) => {
|
|
36149
|
-
|
|
36150
|
-
resolve(cb.data || {});
|
|
36151
|
-
if (option === null || option === void 0 ? void 0 : option.callback) {
|
|
36152
|
-
option.callback(cb, null);
|
|
36153
|
-
}
|
|
36154
|
-
}
|
|
36155
|
-
else if (cb && cb.error_code < 0) {
|
|
36223
|
+
const fn = (cb) => __awaiter(this, void 0, void 0, function* () {
|
|
36224
|
+
try {
|
|
36156
36225
|
const error = new NativeError(cb.error_code, `${cb.action}: ${cb.error_message}`);
|
|
36157
|
-
|
|
36158
|
-
|
|
36159
|
-
|
|
36160
|
-
|
|
36161
|
-
|
|
36162
|
-
|
|
36226
|
+
if (cb.action === action) {
|
|
36227
|
+
if (option === null || option === void 0 ? void 0 : option.callback) {
|
|
36228
|
+
const res = yield option.callback(cb, error);
|
|
36229
|
+
resolve(res);
|
|
36230
|
+
}
|
|
36231
|
+
else {
|
|
36232
|
+
if (cb && cb.error_code >= 0) {
|
|
36233
|
+
resolve(cb.data || {});
|
|
36234
|
+
}
|
|
36235
|
+
else if (cb && cb.error_code < 0) {
|
|
36236
|
+
try {
|
|
36237
|
+
window.zmpSentry &&
|
|
36238
|
+
window.zmpSentry.captureMessage(`${action}: call native fail`, {
|
|
36239
|
+
extra: {
|
|
36240
|
+
data: data,
|
|
36241
|
+
rs: cb
|
|
36242
|
+
}
|
|
36243
|
+
});
|
|
36163
36244
|
}
|
|
36164
|
-
|
|
36245
|
+
catch (error) { }
|
|
36246
|
+
reject(error);
|
|
36247
|
+
}
|
|
36248
|
+
}
|
|
36165
36249
|
}
|
|
36166
|
-
|
|
36250
|
+
}
|
|
36251
|
+
catch (error) {
|
|
36167
36252
|
reject(error);
|
|
36168
|
-
if (option === null || option === void 0 ? void 0 : option.callback) {
|
|
36169
|
-
option.callback(cb, error);
|
|
36170
|
-
}
|
|
36171
36253
|
}
|
|
36172
|
-
|
|
36254
|
+
// if (cb && cb.error_code >= 0 && cb.action == action) {
|
|
36255
|
+
// resolve(cb.data || {});
|
|
36256
|
+
// if (option?.callback) {
|
|
36257
|
+
// try {
|
|
36258
|
+
// await option.callback(cb, null);
|
|
36259
|
+
// } catch (error) {
|
|
36260
|
+
// reject(error);
|
|
36261
|
+
// }
|
|
36262
|
+
// }
|
|
36263
|
+
// } else if (cb && cb.error_code < 0) {
|
|
36264
|
+
// const error = new NativeError(
|
|
36265
|
+
// cb.error_code,
|
|
36266
|
+
// `${cb.action}: ${cb.error_message}`
|
|
36267
|
+
// );
|
|
36268
|
+
// try {
|
|
36269
|
+
// window.zmpSentry &&
|
|
36270
|
+
// window.zmpSentry.captureMessage(`${action}: call native fail`, {
|
|
36271
|
+
// extra: {
|
|
36272
|
+
// data: data,
|
|
36273
|
+
// rs: cb
|
|
36274
|
+
// }
|
|
36275
|
+
// });
|
|
36276
|
+
// } catch (error) {}
|
|
36277
|
+
// if (option?.callback) {
|
|
36278
|
+
// try {
|
|
36279
|
+
// await option.callback(cb, error);
|
|
36280
|
+
// } catch (error) {
|
|
36281
|
+
// reject(error);
|
|
36282
|
+
// }
|
|
36283
|
+
// } else {
|
|
36284
|
+
// reject(error);
|
|
36285
|
+
// }
|
|
36286
|
+
// }
|
|
36287
|
+
});
|
|
36173
36288
|
__classPrivateFieldGet(this, _ZJSBridgeProvider_bridge).jsCall(action, data, fn, option === null || option === void 0 ? void 0 : option.isMultiCallback, option === null || option === void 0 ? void 0 : option.nRetry, option === null || option === void 0 ? void 0 : option.haveTimeout);
|
|
36174
36289
|
});
|
|
36175
36290
|
}
|
|
@@ -36185,7 +36300,7 @@ const apiResponse = {
|
|
|
36185
36300
|
}
|
|
36186
36301
|
};
|
|
36187
36302
|
|
|
36188
|
-
var version = "
|
|
36303
|
+
var version = "v2.14.4";
|
|
36189
36304
|
|
|
36190
36305
|
class Basics {
|
|
36191
36306
|
/**
|
|
@@ -37654,10 +37769,14 @@ class OpenApi {
|
|
|
37654
37769
|
static getUserInfo(object) {
|
|
37655
37770
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37656
37771
|
const accessToken = yield this.getAccessToken();
|
|
37772
|
+
let fields = 'id,name,picture';
|
|
37773
|
+
if (object === null || object === void 0 ? void 0 : object.avatarType) {
|
|
37774
|
+
fields = `${fields}.type(${object === null || object === void 0 ? void 0 : object.avatarType})`;
|
|
37775
|
+
}
|
|
37657
37776
|
const userInfo = yield axios
|
|
37658
37777
|
.get(CONT.APIS.GET_USER_INFO, {
|
|
37659
37778
|
params: {
|
|
37660
|
-
fields:
|
|
37779
|
+
fields: fields,
|
|
37661
37780
|
access_token: accessToken
|
|
37662
37781
|
}
|
|
37663
37782
|
})
|
|
@@ -37666,8 +37785,8 @@ class OpenApi {
|
|
|
37666
37785
|
const userInfo = {
|
|
37667
37786
|
id: resData.id,
|
|
37668
37787
|
name: resData.name,
|
|
37669
|
-
birthday:
|
|
37670
|
-
gender:
|
|
37788
|
+
birthday: '',
|
|
37789
|
+
gender: '',
|
|
37671
37790
|
avatar: resData.picture && resData.picture.data && resData.picture.data.url
|
|
37672
37791
|
};
|
|
37673
37792
|
console.warn("'birthday' and 'gender' are deprecated");
|
|
@@ -37687,17 +37806,18 @@ class OpenApi {
|
|
|
37687
37806
|
*
|
|
37688
37807
|
*/
|
|
37689
37808
|
static getPhoneNumber(object) {
|
|
37690
|
-
return
|
|
37691
|
-
this.callNative(ACTION.MP_GET_NUMBER, {}, {
|
|
37809
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37810
|
+
return yield this.callNative(ACTION.MP_GET_NUMBER, {}, {
|
|
37692
37811
|
isMultiCallback: true,
|
|
37693
37812
|
callback: (nativeData, error) => {
|
|
37694
|
-
if (error)
|
|
37695
|
-
reject(error);
|
|
37696
37813
|
if (nativeData.error_code === 0) {
|
|
37697
37814
|
const res = {
|
|
37698
37815
|
number: nativeData.data
|
|
37699
37816
|
};
|
|
37700
|
-
resolve(res);
|
|
37817
|
+
return Promise.resolve(res);
|
|
37818
|
+
}
|
|
37819
|
+
else {
|
|
37820
|
+
return Promise.reject(error);
|
|
37701
37821
|
}
|
|
37702
37822
|
}
|
|
37703
37823
|
});
|
|
@@ -37778,16 +37898,14 @@ class Location {
|
|
|
37778
37898
|
*
|
|
37779
37899
|
*/
|
|
37780
37900
|
static getLocation(object) {
|
|
37781
|
-
return
|
|
37782
|
-
this.callNative(ACTION.GET_LOCATION, {
|
|
37901
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37902
|
+
return yield this.callNative(ACTION.GET_LOCATION, {
|
|
37783
37903
|
silent_request: false,
|
|
37784
37904
|
permission_description: 'Cho phép Zalo truy cập vào vị trí của thiết bị này?'
|
|
37785
37905
|
}, {
|
|
37786
37906
|
isMultiCallback: true,
|
|
37787
37907
|
haveTimeout: false,
|
|
37788
37908
|
callback: (nativeData, error) => {
|
|
37789
|
-
if (error)
|
|
37790
|
-
reject(error);
|
|
37791
37909
|
if (nativeData.error_code === 0) {
|
|
37792
37910
|
const data = nativeData.data;
|
|
37793
37911
|
const res = {
|
|
@@ -37800,7 +37918,10 @@ class Location {
|
|
|
37800
37918
|
/** provider */
|
|
37801
37919
|
provider: data.provider
|
|
37802
37920
|
};
|
|
37803
|
-
resolve(res);
|
|
37921
|
+
return Promise.resolve(res);
|
|
37922
|
+
}
|
|
37923
|
+
else {
|
|
37924
|
+
return Promise.reject(error);
|
|
37804
37925
|
}
|
|
37805
37926
|
}
|
|
37806
37927
|
});
|
|
@@ -37835,17 +37956,17 @@ class Media {
|
|
|
37835
37956
|
*
|
|
37836
37957
|
*/
|
|
37837
37958
|
static requestCameraPermission(object) {
|
|
37838
|
-
return
|
|
37839
|
-
this.callNative(ACTION.REQUEST_PERMISSION_CAMERA, {}, {
|
|
37959
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37960
|
+
return yield this.callNative(ACTION.REQUEST_PERMISSION_CAMERA, {}, {
|
|
37840
37961
|
callback: (nativeData, error) => {
|
|
37841
37962
|
if (nativeData.error_code === -2 || nativeData.error_code >= 0) {
|
|
37842
|
-
resolve({
|
|
37963
|
+
return Promise.resolve({
|
|
37843
37964
|
userAllow: nativeData.error_code === -2 ? false : true,
|
|
37844
37965
|
message: nativeData.error_message
|
|
37845
37966
|
});
|
|
37846
37967
|
}
|
|
37847
37968
|
else {
|
|
37848
|
-
reject(error);
|
|
37969
|
+
return Promise.reject(error);
|
|
37849
37970
|
}
|
|
37850
37971
|
}
|
|
37851
37972
|
});
|
|
@@ -38139,7 +38260,7 @@ class Routing {
|
|
|
38139
38260
|
}
|
|
38140
38261
|
}
|
|
38141
38262
|
|
|
38142
|
-
var _ZaloMiniProgramSDK_zAppId, _ZaloMiniProgramSDK_appId, _ZaloMiniProgramSDK_appConfig, _ZaloMiniProgramSDK_zOAuth, _ZaloMiniProgramSDK_accessToken, _ZaloMiniProgramSDK_cache, _ZaloMiniProgramSDK_configWindow, _ZaloMiniProgramSDK_configApp, _ZaloMiniProgramSDK_callJump, _ZaloMiniProgramSDK_setNavigationBarRightButton;
|
|
38263
|
+
var _ZaloMiniProgramSDK_zAppId, _ZaloMiniProgramSDK_appId, _ZaloMiniProgramSDK_appConfig, _ZaloMiniProgramSDK_zOAuth, _ZaloMiniProgramSDK_accessToken, _ZaloMiniProgramSDK_cache, _ZaloMiniProgramSDK_loggedIn, _ZaloMiniProgramSDK_configWindow, _ZaloMiniProgramSDK_configApp, _ZaloMiniProgramSDK_callJump, _ZaloMiniProgramSDK_setNavigationBarRightButton;
|
|
38143
38264
|
class ZaloMiniProgramSDK extends ZJSBridgeProvider {
|
|
38144
38265
|
constructor() {
|
|
38145
38266
|
super();
|
|
@@ -38153,6 +38274,7 @@ class ZaloMiniProgramSDK extends ZJSBridgeProvider {
|
|
|
38153
38274
|
getToken: 0
|
|
38154
38275
|
}
|
|
38155
38276
|
});
|
|
38277
|
+
_ZaloMiniProgramSDK_loggedIn.set(this, false);
|
|
38156
38278
|
this.events = ZMPEEmitter.getInstance();
|
|
38157
38279
|
_ZaloMiniProgramSDK_configWindow.set(this, () => {
|
|
38158
38280
|
const appConfig = __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appConfig).app || null;
|
|
@@ -38282,6 +38404,9 @@ class ZaloMiniProgramSDK extends ZJSBridgeProvider {
|
|
|
38282
38404
|
}
|
|
38283
38405
|
return ZaloMiniProgramSDK.instance;
|
|
38284
38406
|
}
|
|
38407
|
+
getLoginStatus() {
|
|
38408
|
+
return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_loggedIn);
|
|
38409
|
+
}
|
|
38285
38410
|
getAppId() {
|
|
38286
38411
|
return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appId);
|
|
38287
38412
|
}
|
|
@@ -38320,11 +38445,13 @@ class ZaloMiniProgramSDK extends ZJSBridgeProvider {
|
|
|
38320
38445
|
if (!__classPrivateFieldGet(this, _ZaloMiniProgramSDK_cache).timer.getToken) {
|
|
38321
38446
|
__classPrivateFieldGet(this, _ZaloMiniProgramSDK_cache).timer.getToken = window.setInterval(runTimer, expiredIn);
|
|
38322
38447
|
}
|
|
38448
|
+
__classPrivateFieldSet(this, _ZaloMiniProgramSDK_loggedIn, true);
|
|
38323
38449
|
this.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken) || '');
|
|
38324
38450
|
window.ZJSBridge.setZAccSession &&
|
|
38325
38451
|
window.ZJSBridge.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken) || '');
|
|
38326
38452
|
return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken);
|
|
38327
38453
|
}
|
|
38454
|
+
__classPrivateFieldSet(this, _ZaloMiniProgramSDK_loggedIn, false);
|
|
38328
38455
|
return null;
|
|
38329
38456
|
});
|
|
38330
38457
|
});
|
|
@@ -38343,9 +38470,9 @@ class ZaloMiniProgramSDK extends ZJSBridgeProvider {
|
|
|
38343
38470
|
});
|
|
38344
38471
|
}
|
|
38345
38472
|
}
|
|
38346
|
-
_ZaloMiniProgramSDK_zAppId = new WeakMap(), _ZaloMiniProgramSDK_appId = new WeakMap(), _ZaloMiniProgramSDK_appConfig = new WeakMap(), _ZaloMiniProgramSDK_zOAuth = new WeakMap(), _ZaloMiniProgramSDK_accessToken = new WeakMap(), _ZaloMiniProgramSDK_cache = new WeakMap(), _ZaloMiniProgramSDK_configWindow = new WeakMap(), _ZaloMiniProgramSDK_configApp = new WeakMap(), _ZaloMiniProgramSDK_callJump = new WeakMap(), _ZaloMiniProgramSDK_setNavigationBarRightButton = new WeakMap();
|
|
38473
|
+
_ZaloMiniProgramSDK_zAppId = new WeakMap(), _ZaloMiniProgramSDK_appId = new WeakMap(), _ZaloMiniProgramSDK_appConfig = new WeakMap(), _ZaloMiniProgramSDK_zOAuth = new WeakMap(), _ZaloMiniProgramSDK_accessToken = new WeakMap(), _ZaloMiniProgramSDK_cache = new WeakMap(), _ZaloMiniProgramSDK_loggedIn = new WeakMap(), _ZaloMiniProgramSDK_configWindow = new WeakMap(), _ZaloMiniProgramSDK_configApp = new WeakMap(), _ZaloMiniProgramSDK_callJump = new WeakMap(), _ZaloMiniProgramSDK_setNavigationBarRightButton = new WeakMap();
|
|
38347
38474
|
|
|
38348
|
-
var _MockSDK_appId, _MockSDK_appConfig, _MockSDK_zOAuth, _MockSDK_accessToken, _MockSDK_cache;
|
|
38475
|
+
var _MockSDK_appId, _MockSDK_appConfig, _MockSDK_zOAuth, _MockSDK_accessToken, _MockSDK_cache, _MockSDK_loggedId;
|
|
38349
38476
|
class MockSDK {
|
|
38350
38477
|
constructor() {
|
|
38351
38478
|
_MockSDK_appId.set(this, window.zAppID);
|
|
@@ -38357,10 +38484,15 @@ class MockSDK {
|
|
|
38357
38484
|
getToken: 0
|
|
38358
38485
|
}
|
|
38359
38486
|
});
|
|
38487
|
+
_MockSDK_loggedId.set(this, false);
|
|
38488
|
+
this.getLoginStatus = () => {
|
|
38489
|
+
return __classPrivateFieldGet(this, _MockSDK_loggedId);
|
|
38490
|
+
};
|
|
38360
38491
|
this.getAppId = () => {
|
|
38361
38492
|
return __classPrivateFieldGet(this, _MockSDK_appId);
|
|
38362
38493
|
};
|
|
38363
38494
|
this.login = () => {
|
|
38495
|
+
__classPrivateFieldSet(this, _MockSDK_loggedId, true);
|
|
38364
38496
|
return Promise.resolve(__classPrivateFieldGet(this, _MockSDK_zOAuth));
|
|
38365
38497
|
};
|
|
38366
38498
|
this.getAccessToken = () => {
|
|
@@ -38406,7 +38538,7 @@ class MockSDK {
|
|
|
38406
38538
|
return yield storage.clearStorage();
|
|
38407
38539
|
});
|
|
38408
38540
|
this.getUserInfo = () => {
|
|
38409
|
-
console.warn(
|
|
38541
|
+
console.warn('birthday and gender are deprecated');
|
|
38410
38542
|
return Promise.resolve({
|
|
38411
38543
|
userInfo: {
|
|
38412
38544
|
id: '3368637342326461234',
|
|
@@ -38655,7 +38787,7 @@ class MockSDK {
|
|
|
38655
38787
|
throw new Error('Method not implemented.');
|
|
38656
38788
|
}
|
|
38657
38789
|
}
|
|
38658
|
-
_MockSDK_appId = new WeakMap(), _MockSDK_appConfig = new WeakMap(), _MockSDK_zOAuth = new WeakMap(), _MockSDK_accessToken = new WeakMap(), _MockSDK_cache = new WeakMap();
|
|
38790
|
+
_MockSDK_appId = new WeakMap(), _MockSDK_appConfig = new WeakMap(), _MockSDK_zOAuth = new WeakMap(), _MockSDK_accessToken = new WeakMap(), _MockSDK_cache = new WeakMap(), _MockSDK_loggedId = new WeakMap();
|
|
38659
38791
|
|
|
38660
38792
|
/*! *****************************************************************************
|
|
38661
38793
|
Copyright (C) Microsoft. All rights reserved.
|
|
@@ -39896,7 +40028,6 @@ class SDKCreator {
|
|
|
39896
40028
|
_SDKCreator_sdkManager.set(this, void 0);
|
|
39897
40029
|
__classPrivateFieldSet(this, _SDKCreator_sdkManager, this.getInstance());
|
|
39898
40030
|
this.events.addListener = (event, fn, context) => {
|
|
39899
|
-
console.log(123123);
|
|
39900
40031
|
const stringifyEventName = event;
|
|
39901
40032
|
return this.events.addListener(Events[stringifyEventName], fn, context);
|
|
39902
40033
|
};
|
|
@@ -39921,6 +40052,9 @@ class SDKCreator {
|
|
|
39921
40052
|
return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).login(object);
|
|
39922
40053
|
});
|
|
39923
40054
|
}
|
|
40055
|
+
getLoginStatus() {
|
|
40056
|
+
return __classPrivateFieldGet(this, _SDKCreator_sdkManager).getLoginStatus();
|
|
40057
|
+
}
|
|
39924
40058
|
/**
|
|
39925
40059
|
* Get Access Token.
|
|
39926
40060
|
*
|
|
@@ -40293,13 +40427,18 @@ class SDKCreator {
|
|
|
40293
40427
|
});
|
|
40294
40428
|
}
|
|
40295
40429
|
getPhoneNumber(object) {
|
|
40296
|
-
return
|
|
40430
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40431
|
+
return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getPhoneNumber();
|
|
40432
|
+
});
|
|
40297
40433
|
}
|
|
40298
40434
|
}
|
|
40299
40435
|
_SDKCreator_sdkManager = new WeakMap();
|
|
40300
40436
|
__decorate([
|
|
40301
40437
|
handleError
|
|
40302
40438
|
], SDKCreator.prototype, "login", null);
|
|
40439
|
+
__decorate([
|
|
40440
|
+
handleErrorSync
|
|
40441
|
+
], SDKCreator.prototype, "getLoginStatus", null);
|
|
40303
40442
|
__decorate([
|
|
40304
40443
|
handleError
|
|
40305
40444
|
], SDKCreator.prototype, "getAccessToken", null);
|
|
@@ -40383,7 +40522,11 @@ __decorate([
|
|
|
40383
40522
|
handleError
|
|
40384
40523
|
], SDKCreator.prototype, "clearStorage", null);
|
|
40385
40524
|
__decorate([
|
|
40386
|
-
handleError
|
|
40525
|
+
handleError,
|
|
40526
|
+
validate,
|
|
40527
|
+
__param(0, checkType('object', {
|
|
40528
|
+
avatarType: ['small', 'normal', 'large']
|
|
40529
|
+
}))
|
|
40387
40530
|
], SDKCreator.prototype, "getUserInfo", null);
|
|
40388
40531
|
__decorate([
|
|
40389
40532
|
handleError
|