zmp-sdk 2.23.0-0 → 2.23.0-rc.2
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/CHANGELOG.json +110 -7
- package/dist/browser.min.js +108 -52
- package/dist/index.es.js +108 -52
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/types/src/zaloJsBridge.d.ts +1 -1
- package/package.json +4 -3
package/CHANGELOG.json
CHANGED
|
@@ -1,16 +1,119 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
|
-
"isoDate": "2022-08-
|
|
4
|
-
"niceDate": "
|
|
5
|
-
"diff": "v2.22.
|
|
6
|
-
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/compare/v2.22.
|
|
3
|
+
"isoDate": "2022-08-18",
|
|
4
|
+
"niceDate": "18 August 2022",
|
|
5
|
+
"diff": "v2.22.2..",
|
|
6
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/compare/v2.22.2...v2.22.2",
|
|
7
7
|
"major": false,
|
|
8
8
|
"minor": false,
|
|
9
9
|
"tag": null,
|
|
10
|
-
"title": "v2.22.
|
|
11
|
-
"date": "2022-08-
|
|
10
|
+
"title": "v2.22.2",
|
|
11
|
+
"date": "2022-08-18T05:18:30.804Z",
|
|
12
12
|
"summary": null,
|
|
13
|
-
"commits": [
|
|
13
|
+
"commits": [
|
|
14
|
+
{
|
|
15
|
+
"hash": "cd947e07dfce4d6981c4a3de17e876d890bb068b",
|
|
16
|
+
"shorthash": "cd947e0",
|
|
17
|
+
"author": "Kidataek",
|
|
18
|
+
"email": "tuankiet.hcmc@gmail.com",
|
|
19
|
+
"date": "2022-08-18T05:11:52.000Z",
|
|
20
|
+
"niceDate": "18 August 2022",
|
|
21
|
+
"subject": "chore: update changelog",
|
|
22
|
+
"message": "chore: update changelog",
|
|
23
|
+
"fixes": null,
|
|
24
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/commit/cd947e07dfce4d6981c4a3de17e876d890bb068b",
|
|
25
|
+
"breaking": false,
|
|
26
|
+
"files": 1,
|
|
27
|
+
"insertions": 91,
|
|
28
|
+
"deletions": 6,
|
|
29
|
+
"merge": null
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"merges": [],
|
|
33
|
+
"fixes": []
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"isoDate": "2022-08-18",
|
|
37
|
+
"niceDate": "18 August 2022",
|
|
38
|
+
"diff": "v2.22.1..v2.22.2",
|
|
39
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/compare/v2.22.1...v2.22.2",
|
|
40
|
+
"major": false,
|
|
41
|
+
"minor": false,
|
|
42
|
+
"tag": "v2.22.2",
|
|
43
|
+
"date": "2022-08-18",
|
|
44
|
+
"title": "v2.22.2",
|
|
45
|
+
"version": "v2.22.2",
|
|
46
|
+
"summary": null,
|
|
47
|
+
"commits": [
|
|
48
|
+
{
|
|
49
|
+
"hash": "19b2357f0acda7817abcceed8ba99143f765289e",
|
|
50
|
+
"shorthash": "19b2357",
|
|
51
|
+
"author": "Kidataek",
|
|
52
|
+
"email": "tuankiet.hcmc@gmail.com",
|
|
53
|
+
"date": "2022-08-18T05:09:08.000Z",
|
|
54
|
+
"niceDate": "18 August 2022",
|
|
55
|
+
"subject": "fix: change version android zalo app that support share multi image",
|
|
56
|
+
"message": "fix: change version android zalo app that support share multi image",
|
|
57
|
+
"fixes": null,
|
|
58
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/commit/19b2357f0acda7817abcceed8ba99143f765289e",
|
|
59
|
+
"breaking": false,
|
|
60
|
+
"files": 1,
|
|
61
|
+
"insertions": 1,
|
|
62
|
+
"deletions": 1,
|
|
63
|
+
"merge": null
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"merges": [],
|
|
67
|
+
"fixes": []
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"isoDate": "2022-08-09",
|
|
71
|
+
"niceDate": "9 August 2022",
|
|
72
|
+
"diff": "v2.22.0..v2.22.1",
|
|
73
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/compare/v2.22.0...v2.22.1",
|
|
74
|
+
"major": false,
|
|
75
|
+
"minor": false,
|
|
76
|
+
"tag": "v2.22.1",
|
|
77
|
+
"date": "2022-08-09",
|
|
78
|
+
"title": "v2.22.1",
|
|
79
|
+
"version": "v2.22.1",
|
|
80
|
+
"summary": null,
|
|
81
|
+
"commits": [
|
|
82
|
+
{
|
|
83
|
+
"hash": "5de163b3dcfa13fdbaf532fea6c12d321ef00fb6",
|
|
84
|
+
"shorthash": "5de163b",
|
|
85
|
+
"author": "Kidataek",
|
|
86
|
+
"email": "tuankiet.hcmc@gmail.com",
|
|
87
|
+
"date": "2022-08-03T08:09:27.000Z",
|
|
88
|
+
"niceDate": "3 August 2022",
|
|
89
|
+
"subject": "fix: fix issue changelog",
|
|
90
|
+
"message": "fix: fix issue changelog",
|
|
91
|
+
"fixes": null,
|
|
92
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/commit/5de163b3dcfa13fdbaf532fea6c12d321ef00fb6",
|
|
93
|
+
"breaking": false,
|
|
94
|
+
"files": 6,
|
|
95
|
+
"insertions": 14625,
|
|
96
|
+
"deletions": 7,
|
|
97
|
+
"merge": null
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"hash": "7cb204bf36f9a8d86f1f11d65d70d7f6c7ca571d",
|
|
101
|
+
"shorthash": "7cb204b",
|
|
102
|
+
"author": "Kidataek",
|
|
103
|
+
"email": "tuankiet.hcmc@gmail.com",
|
|
104
|
+
"date": "2022-08-09T06:51:57.000Z",
|
|
105
|
+
"niceDate": "9 August 2022",
|
|
106
|
+
"subject": "fix: access token invalid when calling login multi time",
|
|
107
|
+
"message": "fix: access token invalid when calling login multi time",
|
|
108
|
+
"fixes": null,
|
|
109
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/commit/7cb204bf36f9a8d86f1f11d65d70d7f6c7ca571d",
|
|
110
|
+
"breaking": false,
|
|
111
|
+
"files": 1,
|
|
112
|
+
"insertions": 5,
|
|
113
|
+
"deletions": 0,
|
|
114
|
+
"merge": null
|
|
115
|
+
}
|
|
116
|
+
],
|
|
14
117
|
"merges": [],
|
|
15
118
|
"fixes": []
|
|
16
119
|
},
|
package/dist/browser.min.js
CHANGED
|
@@ -3743,7 +3743,7 @@
|
|
|
3743
3743
|
}
|
|
3744
3744
|
}
|
|
3745
3745
|
|
|
3746
|
-
var version = "2.23.0-
|
|
3746
|
+
var version = "2.23.0-rc.2";
|
|
3747
3747
|
|
|
3748
3748
|
class Basics {
|
|
3749
3749
|
/**
|
|
@@ -4911,7 +4911,7 @@
|
|
|
4911
4911
|
execute: execute
|
|
4912
4912
|
};
|
|
4913
4913
|
|
|
4914
|
-
var _ZaloJSBridge_instances, _ZaloJSBridge_cookies, _ZaloJSBridge_actionRuntimeInfo, _ZaloJSBridge_jsCall;
|
|
4914
|
+
var _ZaloJSBridge_instances, _ZaloJSBridge_jumpRunning, _ZaloJSBridge_cookies, _ZaloJSBridge_actionRuntimeInfo, _ZaloJSBridge_jsCall;
|
|
4915
4915
|
class ZaloJSBridge extends eventemitter3 {
|
|
4916
4916
|
constructor() {
|
|
4917
4917
|
super();
|
|
@@ -4924,6 +4924,7 @@
|
|
|
4924
4924
|
this._userAgent = getUserAgent();
|
|
4925
4925
|
this._device = checkPlatform();
|
|
4926
4926
|
this.isJumped = false;
|
|
4927
|
+
_ZaloJSBridge_jumpRunning.set(this, void 0);
|
|
4927
4928
|
_ZaloJSBridge_cookies.set(this, []);
|
|
4928
4929
|
_ZaloJSBridge_actionRuntimeInfo.set(this, void 0);
|
|
4929
4930
|
this.getCookie = (name) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -4937,45 +4938,6 @@
|
|
|
4937
4938
|
const cookie = (_a = __classPrivateFieldGet(this, _ZaloJSBridge_cookies, "f")) === null || _a === void 0 ? void 0 : _a.find((cookie) => cookie.name === name);
|
|
4938
4939
|
return cookie;
|
|
4939
4940
|
};
|
|
4940
|
-
this.jump = () => {
|
|
4941
|
-
return new Promise((resolve, reject) => {
|
|
4942
|
-
if (this.isJumped) {
|
|
4943
|
-
resolve(__classPrivateFieldGet(this, _ZaloJSBridge_cookies, "f"));
|
|
4944
|
-
}
|
|
4945
|
-
else {
|
|
4946
|
-
this.debug('******** call jump ********');
|
|
4947
|
-
this.callNative(ACTION.JUMP_LOGIN, {})
|
|
4948
|
-
.then((data) => {
|
|
4949
|
-
const cookies = (data && data.cookiesOAuthLogins) || [];
|
|
4950
|
-
const actionPermission = (data && data.actionPermission) || [];
|
|
4951
|
-
Object.entries(actionPermission).forEach((item) => {
|
|
4952
|
-
const key = item[0];
|
|
4953
|
-
const value = item[1] || { perm: 0, decode: 0 };
|
|
4954
|
-
if (!__classPrivateFieldGet(this, _ZaloJSBridge_actionRuntimeInfo, "f")[key]) {
|
|
4955
|
-
__classPrivateFieldGet(this, _ZaloJSBridge_actionRuntimeInfo, "f")[key] = {
|
|
4956
|
-
permission: false,
|
|
4957
|
-
support: false
|
|
4958
|
-
};
|
|
4959
|
-
}
|
|
4960
|
-
__classPrivateFieldGet(this, _ZaloJSBridge_actionRuntimeInfo, "f")[key].permission = value.perm === 1;
|
|
4961
|
-
});
|
|
4962
|
-
const jsToken = cookies.find((cookie) => cookie.name === COOKIE_NAME.JS_TOKEN);
|
|
4963
|
-
if (jsToken) {
|
|
4964
|
-
this.jsAccessTk = jsToken.value;
|
|
4965
|
-
window.ZJSBridge.setJSToken &&
|
|
4966
|
-
window.ZJSBridge.setJSToken(jsToken.value);
|
|
4967
|
-
}
|
|
4968
|
-
__classPrivateFieldSet(this, _ZaloJSBridge_cookies, cookies, "f");
|
|
4969
|
-
this.isJumped = true;
|
|
4970
|
-
resolve(cookies);
|
|
4971
|
-
})
|
|
4972
|
-
.catch((error) => {
|
|
4973
|
-
this.isJumped = false;
|
|
4974
|
-
reject(error);
|
|
4975
|
-
});
|
|
4976
|
-
}
|
|
4977
|
-
});
|
|
4978
|
-
};
|
|
4979
4941
|
this._jsCallFuncCallbacks = {};
|
|
4980
4942
|
__classPrivateFieldSet(this, _ZaloJSBridge_actionRuntimeInfo, {}, "f");
|
|
4981
4943
|
this.events.on(Events.AppPaused, () => {
|
|
@@ -5003,6 +4965,7 @@
|
|
|
5003
4965
|
}
|
|
5004
4966
|
}, 5000);
|
|
5005
4967
|
}
|
|
4968
|
+
__classPrivateFieldSet(this, _ZaloJSBridge_jumpRunning, 0, "f");
|
|
5006
4969
|
}
|
|
5007
4970
|
static getInstance() {
|
|
5008
4971
|
if (!ZaloJSBridge.instance) {
|
|
@@ -5016,6 +4979,68 @@
|
|
|
5016
4979
|
set jsAccessTk(value) {
|
|
5017
4980
|
this._jsAccessTk = value;
|
|
5018
4981
|
}
|
|
4982
|
+
jump() {
|
|
4983
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4984
|
+
const _this = this;
|
|
4985
|
+
function waiting() {
|
|
4986
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4987
|
+
return yield new Promise((resolve) => {
|
|
4988
|
+
const interval = setInterval(() => {
|
|
4989
|
+
if (__classPrivateFieldGet(_this, _ZaloJSBridge_jumpRunning, "f") <= 1 || _this.isJumped) {
|
|
4990
|
+
resolve('done');
|
|
4991
|
+
clearInterval(interval);
|
|
4992
|
+
}
|
|
4993
|
+
}, 200);
|
|
4994
|
+
});
|
|
4995
|
+
});
|
|
4996
|
+
}
|
|
4997
|
+
__classPrivateFieldSet(this, _ZaloJSBridge_jumpRunning, +__classPrivateFieldGet(this, _ZaloJSBridge_jumpRunning, "f") + 1, "f");
|
|
4998
|
+
if (__classPrivateFieldGet(this, _ZaloJSBridge_jumpRunning, "f") > 1) {
|
|
4999
|
+
yield waiting();
|
|
5000
|
+
}
|
|
5001
|
+
return new Promise((resolve, reject) => {
|
|
5002
|
+
if (this.isJumped) {
|
|
5003
|
+
resolve(__classPrivateFieldGet(this, _ZaloJSBridge_cookies, "f"));
|
|
5004
|
+
__classPrivateFieldSet(this, _ZaloJSBridge_jumpRunning, +__classPrivateFieldGet(this, _ZaloJSBridge_jumpRunning, "f") - 1, "f");
|
|
5005
|
+
}
|
|
5006
|
+
else {
|
|
5007
|
+
this.debug('******** call jump ********');
|
|
5008
|
+
this.callNative(ACTION.JUMP_LOGIN, {})
|
|
5009
|
+
.then((data) => {
|
|
5010
|
+
const cookies = (data && data.cookiesOAuthLogins) || [];
|
|
5011
|
+
const actionPermission = (data && data.actionPermission) || [];
|
|
5012
|
+
Object.entries(actionPermission).forEach((item) => {
|
|
5013
|
+
const key = item[0];
|
|
5014
|
+
const value = item[1] || { perm: 0, decode: 0 };
|
|
5015
|
+
if (!__classPrivateFieldGet(this, _ZaloJSBridge_actionRuntimeInfo, "f")[key]) {
|
|
5016
|
+
__classPrivateFieldGet(this, _ZaloJSBridge_actionRuntimeInfo, "f")[key] = {
|
|
5017
|
+
permission: false,
|
|
5018
|
+
support: false
|
|
5019
|
+
};
|
|
5020
|
+
}
|
|
5021
|
+
__classPrivateFieldGet(this, _ZaloJSBridge_actionRuntimeInfo, "f")[key].permission = value.perm === 1;
|
|
5022
|
+
});
|
|
5023
|
+
const jsToken = cookies.find((cookie) => cookie.name === COOKIE_NAME.JS_TOKEN);
|
|
5024
|
+
if (jsToken) {
|
|
5025
|
+
this.jsAccessTk = jsToken.value;
|
|
5026
|
+
window.ZJSBridge.setJSToken &&
|
|
5027
|
+
window.ZJSBridge.setJSToken(jsToken.value);
|
|
5028
|
+
}
|
|
5029
|
+
__classPrivateFieldSet(this, _ZaloJSBridge_cookies, cookies, "f");
|
|
5030
|
+
this.isJumped = true;
|
|
5031
|
+
resolve(cookies);
|
|
5032
|
+
})
|
|
5033
|
+
.catch((error) => {
|
|
5034
|
+
this.isJumped = false;
|
|
5035
|
+
reject(error);
|
|
5036
|
+
})
|
|
5037
|
+
.finally(() => {
|
|
5038
|
+
__classPrivateFieldSet(this, _ZaloJSBridge_jumpRunning, +__classPrivateFieldGet(this, _ZaloJSBridge_jumpRunning, "f") - 1, "f");
|
|
5039
|
+
});
|
|
5040
|
+
}
|
|
5041
|
+
});
|
|
5042
|
+
});
|
|
5043
|
+
}
|
|
5019
5044
|
sendLogData(data) {
|
|
5020
5045
|
try {
|
|
5021
5046
|
const logData = data.map((item) => {
|
|
@@ -5195,7 +5220,7 @@
|
|
|
5195
5220
|
}));
|
|
5196
5221
|
}
|
|
5197
5222
|
}
|
|
5198
|
-
_ZaloJSBridge_cookies = new WeakMap(), _ZaloJSBridge_actionRuntimeInfo = new WeakMap(), _ZaloJSBridge_instances = new WeakSet(), _ZaloJSBridge_jsCall = function _ZaloJSBridge_jsCall(action, options, callback, isMultiCallback = false, nRetry = 3, haveTimeout = true) {
|
|
5223
|
+
_ZaloJSBridge_jumpRunning = new WeakMap(), _ZaloJSBridge_cookies = new WeakMap(), _ZaloJSBridge_actionRuntimeInfo = new WeakMap(), _ZaloJSBridge_instances = new WeakSet(), _ZaloJSBridge_jsCall = function _ZaloJSBridge_jsCall(action, options, callback, isMultiCallback = false, nRetry = 3, haveTimeout = true) {
|
|
5199
5224
|
try {
|
|
5200
5225
|
const actionName = action.name;
|
|
5201
5226
|
const key = generateUniqueString(actionName);
|
|
@@ -5808,10 +5833,10 @@
|
|
|
5808
5833
|
static requestCameraPermission(object) {
|
|
5809
5834
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5810
5835
|
return yield this.getJSBridge().callNative(ACTION.REQUEST_PERMISSION_CAMERA, {}, {
|
|
5811
|
-
successCallback: () => {
|
|
5836
|
+
successCallback: (data) => {
|
|
5812
5837
|
return Promise.resolve({
|
|
5813
|
-
userAllow:
|
|
5814
|
-
message:
|
|
5838
|
+
userAllow: (data === null || data === void 0 ? void 0 : data['error_code']) >= 0,
|
|
5839
|
+
message: data === null || data === void 0 ? void 0 : data['error_message']
|
|
5815
5840
|
});
|
|
5816
5841
|
}
|
|
5817
5842
|
});
|
|
@@ -6262,7 +6287,7 @@
|
|
|
6262
6287
|
}
|
|
6263
6288
|
}
|
|
6264
6289
|
|
|
6265
|
-
var _ZaloMiniProgramSDKService_zAppId, _ZaloMiniProgramSDKService_appId, _ZaloMiniProgramSDKService_appConfig, _ZaloMiniProgramSDKService_zOAuth, _ZaloMiniProgramSDKService_zOAuthVrf, _ZaloMiniProgramSDKService_accessToken, _ZaloMiniProgramSDKService_refreshToken, _ZaloMiniProgramSDKService_cache, _ZaloMiniProgramSDKService_bridge, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, _ZaloMiniProgramSDKService_tokenExpiresIn, _ZaloMiniProgramSDKService_deviceId, _ZaloMiniProgramSDKService_context, _ZaloMiniProgramSDKService_actionBarConfig, _ZaloMiniProgramSDKService_getActionsSupported;
|
|
6290
|
+
var _ZaloMiniProgramSDKService_zAppId, _ZaloMiniProgramSDKService_appId, _ZaloMiniProgramSDKService_appConfig, _ZaloMiniProgramSDKService_zOAuth, _ZaloMiniProgramSDKService_zOAuthVrf, _ZaloMiniProgramSDKService_accessToken, _ZaloMiniProgramSDKService_refreshToken, _ZaloMiniProgramSDKService_cache, _ZaloMiniProgramSDKService_bridge, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, _ZaloMiniProgramSDKService_tokenExpiresIn, _ZaloMiniProgramSDKService_deviceId, _ZaloMiniProgramSDKService_context, _ZaloMiniProgramSDKService_actionBarConfig, _ZaloMiniProgramSDKService_loginRunning, _ZaloMiniProgramSDKService_autoLogin, _ZaloMiniProgramSDKService_getActionsSupported;
|
|
6266
6291
|
class ZaloMiniProgramSDKService {
|
|
6267
6292
|
constructor() {
|
|
6268
6293
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
@@ -6286,6 +6311,8 @@
|
|
|
6286
6311
|
this.events = ZMPEEmitter.getInstance();
|
|
6287
6312
|
this.isIOS = checkPlatform().isIOS;
|
|
6288
6313
|
_ZaloMiniProgramSDKService_actionBarConfig.set(this, void 0);
|
|
6314
|
+
_ZaloMiniProgramSDKService_loginRunning.set(this, void 0);
|
|
6315
|
+
_ZaloMiniProgramSDKService_autoLogin.set(this, void 0);
|
|
6289
6316
|
this.getActionBarConfig = () => {
|
|
6290
6317
|
return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_actionBarConfig, "f");
|
|
6291
6318
|
};
|
|
@@ -6302,6 +6329,7 @@
|
|
|
6302
6329
|
};
|
|
6303
6330
|
});
|
|
6304
6331
|
this.setAccessToken = (accessToken) => {
|
|
6332
|
+
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_autoLogin, false, "f");
|
|
6305
6333
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_accessToken, accessToken, "f");
|
|
6306
6334
|
__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_bridge, "f").accessTk = accessToken;
|
|
6307
6335
|
window.ZJSBridge.setZAccSession &&
|
|
@@ -6374,11 +6402,13 @@
|
|
|
6374
6402
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_zOAuthVrf, null, "f");
|
|
6375
6403
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_accessToken, null, "f");
|
|
6376
6404
|
this.isShowNavBar = true;
|
|
6377
|
-
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_prevGetTokenTimestamp,
|
|
6405
|
+
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, new Date().getTime(), "f");
|
|
6378
6406
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_tokenExpiresIn, 0, "f");
|
|
6379
6407
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_deviceId, '', "f");
|
|
6380
6408
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_context, null, "f");
|
|
6381
6409
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_bridge, ZaloJSBridge.getInstance(), "f");
|
|
6410
|
+
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_loginRunning, 0, "f");
|
|
6411
|
+
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_autoLogin, false, "f");
|
|
6382
6412
|
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' ||
|
|
6383
6413
|
((_d = (_c = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig, "f")) === null || _c === void 0 ? void 0 : _c.app) === null || _d === void 0 ? void 0 : _d.leftButton) === 'both'
|
|
6384
6414
|
? ACTION_LEFT_BUTTON_TYPE.SHOW_HOME
|
|
@@ -6457,8 +6487,28 @@
|
|
|
6457
6487
|
}
|
|
6458
6488
|
login(object) {
|
|
6459
6489
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6460
|
-
|
|
6490
|
+
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_autoLogin, true, "f");
|
|
6491
|
+
let deltaTime = new Date().getTime() - __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, "f");
|
|
6492
|
+
const _this = this;
|
|
6493
|
+
function waiting() {
|
|
6494
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6495
|
+
return yield new Promise((resolve) => {
|
|
6496
|
+
const interval = setInterval(() => {
|
|
6497
|
+
if (__classPrivateFieldGet(_this, _ZaloMiniProgramSDKService_loginRunning, "f") <= 1 || __classPrivateFieldGet(_this, _ZaloMiniProgramSDKService_accessToken, "f")) {
|
|
6498
|
+
resolve('done');
|
|
6499
|
+
clearInterval(interval);
|
|
6500
|
+
}
|
|
6501
|
+
}, 200);
|
|
6502
|
+
});
|
|
6503
|
+
});
|
|
6504
|
+
}
|
|
6505
|
+
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_loginRunning, +__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_loginRunning, "f") + 1, "f");
|
|
6506
|
+
if (__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_loginRunning, "f") > 1) {
|
|
6507
|
+
yield waiting();
|
|
6508
|
+
}
|
|
6509
|
+
deltaTime = new Date().getTime() - __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, "f");
|
|
6461
6510
|
if (__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken, "f") && deltaTime < __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_tokenExpiresIn, "f")) {
|
|
6511
|
+
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_loginRunning, +__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_loginRunning, "f") - 1, "f");
|
|
6462
6512
|
return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken, "f");
|
|
6463
6513
|
}
|
|
6464
6514
|
const zOAuth = yield (yield this.getAuthCode()).authCode;
|
|
@@ -6472,11 +6522,13 @@
|
|
|
6472
6522
|
else {
|
|
6473
6523
|
yield this.loginZaloV3();
|
|
6474
6524
|
}
|
|
6525
|
+
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_loginRunning, +__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_loginRunning, "f") - 1, "f");
|
|
6475
6526
|
if (!__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken, "f")) {
|
|
6476
6527
|
throw apiResponse.error.loginFailed('Invalid authorization code');
|
|
6477
6528
|
}
|
|
6478
6529
|
return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken, "f");
|
|
6479
6530
|
}
|
|
6531
|
+
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_loginRunning, +__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_loginRunning, "f") - 1, "f");
|
|
6480
6532
|
throw apiResponse.error.loginFailed('Zalo app has not been activated');
|
|
6481
6533
|
});
|
|
6482
6534
|
}
|
|
@@ -6538,16 +6590,20 @@
|
|
|
6538
6590
|
getAccessToken(object) {
|
|
6539
6591
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6540
6592
|
const deltaTime = new Date().getTime() - __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, "f");
|
|
6593
|
+
if (__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_autoLogin, "f")) {
|
|
6594
|
+
if (__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken, "f") && deltaTime < __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_tokenExpiresIn, "f"))
|
|
6595
|
+
return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken, "f");
|
|
6596
|
+
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_accessToken, '', "f");
|
|
6597
|
+
return yield this.login();
|
|
6598
|
+
}
|
|
6541
6599
|
if (!__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken, "f")) {
|
|
6542
6600
|
throw apiResponse.error.loginRequired();
|
|
6543
6601
|
}
|
|
6544
|
-
|
|
6545
|
-
return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken, "f");
|
|
6546
|
-
return yield this.login();
|
|
6602
|
+
return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken, "f");
|
|
6547
6603
|
});
|
|
6548
6604
|
}
|
|
6549
6605
|
}
|
|
6550
|
-
_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_bridge = new WeakMap(), _ZaloMiniProgramSDKService_prevGetTokenTimestamp = new WeakMap(), _ZaloMiniProgramSDKService_tokenExpiresIn = new WeakMap(), _ZaloMiniProgramSDKService_deviceId = new WeakMap(), _ZaloMiniProgramSDKService_context = new WeakMap(), _ZaloMiniProgramSDKService_actionBarConfig = new WeakMap(), _ZaloMiniProgramSDKService_getActionsSupported = new WeakMap();
|
|
6606
|
+
_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_bridge = new WeakMap(), _ZaloMiniProgramSDKService_prevGetTokenTimestamp = new WeakMap(), _ZaloMiniProgramSDKService_tokenExpiresIn = new WeakMap(), _ZaloMiniProgramSDKService_deviceId = new WeakMap(), _ZaloMiniProgramSDKService_context = new WeakMap(), _ZaloMiniProgramSDKService_actionBarConfig = new WeakMap(), _ZaloMiniProgramSDKService_loginRunning = new WeakMap(), _ZaloMiniProgramSDKService_autoLogin = new WeakMap(), _ZaloMiniProgramSDKService_getActionsSupported = new WeakMap();
|
|
6551
6607
|
|
|
6552
6608
|
var _MockSDKService_appId, _MockSDKService_appConfig, _MockSDKService_zOAuth, _MockSDKService_accessToken, _MockSDKService_cache, _MockSDKService_loggedId;
|
|
6553
6609
|
class MockSDKService {
|