zmp-sdk 2.23.2 → 2.23.4-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/CHANGELOG.json +54 -4
- package/dist/browser.min.js +87 -18
- package/dist/index.es.js +87 -18
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/types/src/apis/index.d.ts +2 -0
- package/dist/types/src/constants.d.ts +4 -1
- package/dist/types/src/services/mock-mp-service.d.ts +1 -0
- package/dist/types/src/services/zalo-mp-service.d.ts +2 -1
- package/dist/types/src/types/callbackData.d.ts +12 -0
- package/dist/types/src/types/entity.d.ts +1 -2
- package/dist/types/src/types/inputData.d.ts +3 -0
- package/dist/types/src/types/interface.d.ts +1 -0
- package/dist/types/src/zaloJsBridge.d.ts +1 -0
- package/package.json +1 -1
- package/changelog/dist/changelog-setup.dev.js +0 -24
package/CHANGELOG.json
CHANGED
|
@@ -2,18 +2,68 @@
|
|
|
2
2
|
{
|
|
3
3
|
"isoDate": "2022-12-02",
|
|
4
4
|
"niceDate": "2 December 2022",
|
|
5
|
-
"diff": "v2.23.2
|
|
6
|
-
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/compare/v2.23.2
|
|
5
|
+
"diff": "v2.23.2..",
|
|
6
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/compare/v2.23.2...v2.23.2",
|
|
7
7
|
"major": false,
|
|
8
8
|
"minor": false,
|
|
9
9
|
"tag": null,
|
|
10
|
-
"title": "v2.23.2
|
|
11
|
-
"date": "2022-12-
|
|
10
|
+
"title": "v2.23.2",
|
|
11
|
+
"date": "2022-12-02T06:14:17.785Z",
|
|
12
|
+
"summary": null,
|
|
13
|
+
"commits": [],
|
|
14
|
+
"merges": [],
|
|
15
|
+
"fixes": []
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"isoDate": "2022-12-02",
|
|
19
|
+
"niceDate": "2 December 2022",
|
|
20
|
+
"diff": "v2.23.2-1..v2.23.2",
|
|
21
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/compare/v2.23.2-1...v2.23.2",
|
|
22
|
+
"major": false,
|
|
23
|
+
"minor": false,
|
|
24
|
+
"tag": "v2.23.2",
|
|
25
|
+
"date": "2022-12-02",
|
|
26
|
+
"title": "v2.23.2",
|
|
27
|
+
"version": "v2.23.2",
|
|
12
28
|
"summary": null,
|
|
13
29
|
"commits": [],
|
|
14
30
|
"merges": [],
|
|
15
31
|
"fixes": []
|
|
16
32
|
},
|
|
33
|
+
{
|
|
34
|
+
"isoDate": "2022-12-02",
|
|
35
|
+
"niceDate": "2 December 2022",
|
|
36
|
+
"diff": "v2.23.2-0..v2.23.2-1",
|
|
37
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/compare/v2.23.2-0...v2.23.2-1",
|
|
38
|
+
"major": false,
|
|
39
|
+
"minor": false,
|
|
40
|
+
"tag": "v2.23.2-1",
|
|
41
|
+
"date": "2022-12-02",
|
|
42
|
+
"title": "v2.23.2-1",
|
|
43
|
+
"version": "v2.23.2-1",
|
|
44
|
+
"summary": null,
|
|
45
|
+
"commits": [
|
|
46
|
+
{
|
|
47
|
+
"hash": "818e164d577d150f6d36fc417b3e6b85b100c020",
|
|
48
|
+
"shorthash": "818e164",
|
|
49
|
+
"author": "Kidataek",
|
|
50
|
+
"email": "tuankiet.hcmc@gmail.com",
|
|
51
|
+
"date": "2022-12-02T05:40:25.000Z",
|
|
52
|
+
"niceDate": "2 December 2022",
|
|
53
|
+
"subject": "feat: allow more option media picker",
|
|
54
|
+
"message": "feat: allow more option media picker",
|
|
55
|
+
"fixes": null,
|
|
56
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/commit/818e164d577d150f6d36fc417b3e6b85b100c020",
|
|
57
|
+
"breaking": false,
|
|
58
|
+
"files": 2,
|
|
59
|
+
"insertions": 58,
|
|
60
|
+
"deletions": 7,
|
|
61
|
+
"merge": null
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"merges": [],
|
|
65
|
+
"fixes": []
|
|
66
|
+
},
|
|
17
67
|
{
|
|
18
68
|
"isoDate": "2022-12-02",
|
|
19
69
|
"niceDate": "2 December 2022",
|
package/dist/browser.min.js
CHANGED
|
@@ -2250,13 +2250,16 @@
|
|
|
2250
2250
|
DEVICE_ID: `h5.zdn.vn_deviceID`,
|
|
2251
2251
|
CONTEXT_ID: `h5.zdn.vn_contextID`,
|
|
2252
2252
|
CONTEXT_TYPE: `h5.zdn.vn_contextType`,
|
|
2253
|
+
UTOKEN_ZPI: 'h5.zdn.vn_utoken_zpi',
|
|
2254
|
+
GTOKEN_ZPI: 'h5.zdn.vn_gtoken_zpi',
|
|
2255
|
+
ZPP_ZPI: 'h5.zdn.vn_zpp_zpi',
|
|
2253
2256
|
};
|
|
2254
2257
|
const APIS = {
|
|
2255
2258
|
GET_USER_INFO: 'https://graph.zalo.me/v2.0/me',
|
|
2256
2259
|
GET_ACCESS_TOKEN: 'https://h5.zalo.me/openapi/access_token',
|
|
2257
2260
|
GET_ACCESS_TOKEN_V3: 'https://oauth.zaloapp.com/v3/access_token',
|
|
2258
2261
|
GET_LIST_USER_INFO: 'https://graph.zalo.me/v2.0/me/friends/list',
|
|
2259
|
-
CREATE_ORDER: 'https://
|
|
2262
|
+
CREATE_ORDER: 'https://stgpayment-mini.zalo.me/api/order/create',
|
|
2260
2263
|
GET_APP_INFO: 'https://h5.zalo.me/apps/get-info',
|
|
2261
2264
|
SEND_ACTION_LOG: 'https://h5.zalo.me/log/async'
|
|
2262
2265
|
};
|
|
@@ -2890,11 +2893,11 @@
|
|
|
2890
2893
|
const SHOW_ACTION_BAR = 5;
|
|
2891
2894
|
const HIDE_ACTION_BAR = 6;
|
|
2892
2895
|
const PAYMENT_APIS = {
|
|
2893
|
-
CREATE_ORDER: 'https://
|
|
2894
|
-
GET_TRANSACTION: 'https://
|
|
2895
|
-
GET_ORDER_STATUS: 'https://
|
|
2896
|
+
CREATE_ORDER: 'https://stgpayment-mini.zalo.me/api/order/create',
|
|
2897
|
+
GET_TRANSACTION: 'https://stgpayment-mini.zalo.me/api/transaction',
|
|
2898
|
+
GET_ORDER_STATUS: 'https://stgpayment-mini.zalo.me/api/transaction/get-status'
|
|
2896
2899
|
};
|
|
2897
|
-
const PAYMENT_H5_URL = 'https://
|
|
2900
|
+
const PAYMENT_H5_URL = 'https://stgpayment-mini.zalo.me';
|
|
2898
2901
|
|
|
2899
2902
|
class AppError {
|
|
2900
2903
|
constructor(code, msg, api) {
|
|
@@ -3747,7 +3750,7 @@
|
|
|
3747
3750
|
}
|
|
3748
3751
|
}
|
|
3749
3752
|
|
|
3750
|
-
var version = "2.23.
|
|
3753
|
+
var version = "2.23.4-0";
|
|
3751
3754
|
|
|
3752
3755
|
class Basics {
|
|
3753
3756
|
/**
|
|
@@ -5050,7 +5053,9 @@
|
|
|
5050
5053
|
const logData = data.map((item) => {
|
|
5051
5054
|
return {
|
|
5052
5055
|
action: item.action,
|
|
5053
|
-
error: item.error
|
|
5056
|
+
error: item.error,
|
|
5057
|
+
message: item.message,
|
|
5058
|
+
data: item.data
|
|
5054
5059
|
};
|
|
5055
5060
|
});
|
|
5056
5061
|
CORSRequest.execute(APIS.SEND_ACTION_LOG, 'post', {
|
|
@@ -5070,7 +5075,9 @@
|
|
|
5070
5075
|
try {
|
|
5071
5076
|
this.debug('onJSCall', key, data);
|
|
5072
5077
|
const parsedData = parseJSON(data);
|
|
5078
|
+
let inputData;
|
|
5073
5079
|
if (this._jsCallFuncCallbacks[key]) {
|
|
5080
|
+
inputData = this._jsCallFuncCallbacks[key].inputData;
|
|
5074
5081
|
const callback = this._jsCallFuncCallbacks[key].callback;
|
|
5075
5082
|
const timeout = this._jsCallFuncCallbacks[key].timeout;
|
|
5076
5083
|
if (!!callback) {
|
|
@@ -5085,11 +5092,24 @@
|
|
|
5085
5092
|
delete this._jsCallFuncCallbacks[key];
|
|
5086
5093
|
}
|
|
5087
5094
|
}
|
|
5088
|
-
|
|
5095
|
+
const logData = {
|
|
5089
5096
|
action: parsedData.action,
|
|
5090
5097
|
error: parsedData.error_code,
|
|
5091
|
-
message: parsedData.error_message
|
|
5092
|
-
|
|
5098
|
+
message: parsedData.error_message,
|
|
5099
|
+
data: {}
|
|
5100
|
+
};
|
|
5101
|
+
try {
|
|
5102
|
+
if (parsedData.action === ACTION.OPEN_INAPP.name ||
|
|
5103
|
+
parsedData.action === ACTION.OPEN_OUTAPP.name) {
|
|
5104
|
+
const url = new URL(inputData.url);
|
|
5105
|
+
const path = `${url.protocol}//${url.host}${url.pathname}`;
|
|
5106
|
+
logData.data = {
|
|
5107
|
+
url: path
|
|
5108
|
+
};
|
|
5109
|
+
}
|
|
5110
|
+
}
|
|
5111
|
+
catch (error) { }
|
|
5112
|
+
this.results.push(logData);
|
|
5093
5113
|
}
|
|
5094
5114
|
catch (e) {
|
|
5095
5115
|
console.log('onJSCall', 'error', e);
|
|
@@ -5099,7 +5119,9 @@
|
|
|
5099
5119
|
try {
|
|
5100
5120
|
this.debug('onMultiJSCall', key, data);
|
|
5101
5121
|
const parsedData = parseJSON(data);
|
|
5122
|
+
let inputData;
|
|
5102
5123
|
if (this._jsCallFuncCallbacks[key]) {
|
|
5124
|
+
inputData = this._jsCallFuncCallbacks[key].inputData;
|
|
5103
5125
|
const callback = this._jsCallFuncCallbacks[key].callback;
|
|
5104
5126
|
const timeout = this._jsCallFuncCallbacks[key].timeout;
|
|
5105
5127
|
if (!!callback) {
|
|
@@ -5112,11 +5134,24 @@
|
|
|
5112
5134
|
!!timeout && clearTimeout(timeout);
|
|
5113
5135
|
}
|
|
5114
5136
|
}
|
|
5115
|
-
|
|
5137
|
+
const logData = {
|
|
5116
5138
|
action: parsedData.action,
|
|
5117
5139
|
error: parsedData.error_code,
|
|
5118
|
-
message: parsedData.error_message
|
|
5119
|
-
|
|
5140
|
+
message: parsedData.error_message,
|
|
5141
|
+
data: {}
|
|
5142
|
+
};
|
|
5143
|
+
try {
|
|
5144
|
+
if (parsedData.action === ACTION.OPEN_INAPP.name ||
|
|
5145
|
+
parsedData.action === ACTION.OPEN_OUTAPP.name) {
|
|
5146
|
+
const url = new URL(inputData.url);
|
|
5147
|
+
const path = `${url.protocol}//${url.host}${url.pathname}`;
|
|
5148
|
+
logData.data = {
|
|
5149
|
+
url: path
|
|
5150
|
+
};
|
|
5151
|
+
}
|
|
5152
|
+
}
|
|
5153
|
+
catch (error) { }
|
|
5154
|
+
this.results.push(logData);
|
|
5120
5155
|
}
|
|
5121
5156
|
catch (e) {
|
|
5122
5157
|
console.log('onMultiJSCall', 'error', e);
|
|
@@ -5254,6 +5289,7 @@
|
|
|
5254
5289
|
action: actionName
|
|
5255
5290
|
};
|
|
5256
5291
|
this._jsCallFuncCallbacks[key] = {
|
|
5292
|
+
inputData: options,
|
|
5257
5293
|
timeout: haveTimeout &&
|
|
5258
5294
|
action.have_callback &&
|
|
5259
5295
|
setTimeout(() => {
|
|
@@ -5633,22 +5669,21 @@
|
|
|
5633
5669
|
static getUserInfo(object) {
|
|
5634
5670
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5635
5671
|
const accessToken = yield this.getAccessToken();
|
|
5636
|
-
let fields = 'id,name,picture';
|
|
5672
|
+
let fields = 'id,name,user_id_by_oa,picture';
|
|
5637
5673
|
if (object === null || object === void 0 ? void 0 : object.avatarType) {
|
|
5638
5674
|
fields = `${fields}.type(${object === null || object === void 0 ? void 0 : object.avatarType})`;
|
|
5639
5675
|
}
|
|
5640
5676
|
const userInfo = yield fetch(`${APIS.GET_USER_INFO}?fields=${fields}`, {
|
|
5641
5677
|
headers: {
|
|
5642
|
-
access_token: accessToken || ''
|
|
5678
|
+
access_token: accessToken || ''
|
|
5643
5679
|
}
|
|
5644
5680
|
}).then((response) => __awaiter(this, void 0, void 0, function* () {
|
|
5645
5681
|
const resData = yield response.json();
|
|
5646
5682
|
const userInfo = {
|
|
5647
5683
|
id: resData.id,
|
|
5648
5684
|
name: resData.name,
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
avatar: resData.picture && resData.picture.data && resData.picture.data.url
|
|
5685
|
+
avatar: resData.picture && resData.picture.data && resData.picture.data.url,
|
|
5686
|
+
idByOA: resData.user_id_by_oa
|
|
5652
5687
|
};
|
|
5653
5688
|
console.warn("'birthday' and 'gender' are deprecated");
|
|
5654
5689
|
return userInfo;
|
|
@@ -6323,6 +6358,17 @@
|
|
|
6323
6358
|
authCodeVerify
|
|
6324
6359
|
};
|
|
6325
6360
|
});
|
|
6361
|
+
this.getZPIToken = () => __awaiter(this, void 0, void 0, function* () {
|
|
6362
|
+
var _v, _w, _x;
|
|
6363
|
+
const utoken = (_v = (yield __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_bridge, "f").getCookie(COOKIE_NAME.UTOKEN_ZPI))) === null || _v === void 0 ? void 0 : _v.value;
|
|
6364
|
+
const gtoken = (_w = (yield __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_bridge, "f").getCookie(COOKIE_NAME.GTOKEN_ZPI))) === null || _w === void 0 ? void 0 : _w.value;
|
|
6365
|
+
const zpp = (_x = (yield __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_bridge, "f").getCookie(COOKIE_NAME.ZPP_ZPI))) === null || _x === void 0 ? void 0 : _x.value;
|
|
6366
|
+
return {
|
|
6367
|
+
utoken,
|
|
6368
|
+
gtoken,
|
|
6369
|
+
zpp
|
|
6370
|
+
};
|
|
6371
|
+
});
|
|
6326
6372
|
this.setAccessToken = (accessToken) => {
|
|
6327
6373
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_autoLogin, false, "f");
|
|
6328
6374
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_accessToken, accessToken, "f");
|
|
@@ -6931,6 +6977,13 @@
|
|
|
6931
6977
|
authCodeVerify: ''
|
|
6932
6978
|
});
|
|
6933
6979
|
};
|
|
6980
|
+
this.getZPIToken = () => {
|
|
6981
|
+
return Promise.resolve({
|
|
6982
|
+
utoken: '',
|
|
6983
|
+
gtoken: '',
|
|
6984
|
+
zpp: ''
|
|
6985
|
+
});
|
|
6986
|
+
};
|
|
6934
6987
|
}
|
|
6935
6988
|
getContext() {
|
|
6936
6989
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -7664,9 +7717,19 @@
|
|
|
7664
7717
|
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").getAuthCode();
|
|
7665
7718
|
});
|
|
7666
7719
|
}
|
|
7720
|
+
getZPIToken(object) {
|
|
7721
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
7722
|
+
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").getZPIToken();
|
|
7723
|
+
});
|
|
7724
|
+
}
|
|
7667
7725
|
setAccessToken(accessToken) {
|
|
7668
7726
|
return __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").setAccessToken(accessToken);
|
|
7669
7727
|
}
|
|
7728
|
+
openOutApp(object) {
|
|
7729
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
7730
|
+
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openOutApp(encodeURI(object.url));
|
|
7731
|
+
});
|
|
7732
|
+
}
|
|
7670
7733
|
};
|
|
7671
7734
|
_SDKCreator_sdkService = new WeakMap();
|
|
7672
7735
|
__decorate([
|
|
@@ -7916,6 +7979,12 @@
|
|
|
7916
7979
|
description: ''
|
|
7917
7980
|
}))
|
|
7918
7981
|
], SDKCreator.prototype, "getShareableLink", null);
|
|
7982
|
+
__decorate([
|
|
7983
|
+
__param(0, required(['url'])),
|
|
7984
|
+
__param(0, checkType('object', {
|
|
7985
|
+
url: checkData('url'),
|
|
7986
|
+
}))
|
|
7987
|
+
], SDKCreator.prototype, "openOutApp", null);
|
|
7919
7988
|
SDKCreator = __decorate([
|
|
7920
7989
|
DecorateAll(centralizedFunctionHandler)
|
|
7921
7990
|
], SDKCreator);
|
package/dist/index.es.js
CHANGED
|
@@ -2247,13 +2247,16 @@ const COOKIE_NAME = {
|
|
|
2247
2247
|
DEVICE_ID: `h5.zdn.vn_deviceID`,
|
|
2248
2248
|
CONTEXT_ID: `h5.zdn.vn_contextID`,
|
|
2249
2249
|
CONTEXT_TYPE: `h5.zdn.vn_contextType`,
|
|
2250
|
+
UTOKEN_ZPI: 'h5.zdn.vn_utoken_zpi',
|
|
2251
|
+
GTOKEN_ZPI: 'h5.zdn.vn_gtoken_zpi',
|
|
2252
|
+
ZPP_ZPI: 'h5.zdn.vn_zpp_zpi',
|
|
2250
2253
|
};
|
|
2251
2254
|
const APIS = {
|
|
2252
2255
|
GET_USER_INFO: 'https://graph.zalo.me/v2.0/me',
|
|
2253
2256
|
GET_ACCESS_TOKEN: 'https://h5.zalo.me/openapi/access_token',
|
|
2254
2257
|
GET_ACCESS_TOKEN_V3: 'https://oauth.zaloapp.com/v3/access_token',
|
|
2255
2258
|
GET_LIST_USER_INFO: 'https://graph.zalo.me/v2.0/me/friends/list',
|
|
2256
|
-
CREATE_ORDER: 'https://
|
|
2259
|
+
CREATE_ORDER: 'https://stgpayment-mini.zalo.me/api/order/create',
|
|
2257
2260
|
GET_APP_INFO: 'https://h5.zalo.me/apps/get-info',
|
|
2258
2261
|
SEND_ACTION_LOG: 'https://h5.zalo.me/log/async'
|
|
2259
2262
|
};
|
|
@@ -2887,11 +2890,11 @@ const ACTION_LEFT_BUTTON_TYPE = {
|
|
|
2887
2890
|
const SHOW_ACTION_BAR = 5;
|
|
2888
2891
|
const HIDE_ACTION_BAR = 6;
|
|
2889
2892
|
const PAYMENT_APIS = {
|
|
2890
|
-
CREATE_ORDER: 'https://
|
|
2891
|
-
GET_TRANSACTION: 'https://
|
|
2892
|
-
GET_ORDER_STATUS: 'https://
|
|
2893
|
+
CREATE_ORDER: 'https://stgpayment-mini.zalo.me/api/order/create',
|
|
2894
|
+
GET_TRANSACTION: 'https://stgpayment-mini.zalo.me/api/transaction',
|
|
2895
|
+
GET_ORDER_STATUS: 'https://stgpayment-mini.zalo.me/api/transaction/get-status'
|
|
2893
2896
|
};
|
|
2894
|
-
const PAYMENT_H5_URL = 'https://
|
|
2897
|
+
const PAYMENT_H5_URL = 'https://stgpayment-mini.zalo.me';
|
|
2895
2898
|
|
|
2896
2899
|
class AppError {
|
|
2897
2900
|
constructor(code, msg, api) {
|
|
@@ -3744,7 +3747,7 @@ class ZMPEEmitter extends eventemitter3 {
|
|
|
3744
3747
|
}
|
|
3745
3748
|
}
|
|
3746
3749
|
|
|
3747
|
-
var version$1 = "2.23.
|
|
3750
|
+
var version$1 = "2.23.4-0";
|
|
3748
3751
|
|
|
3749
3752
|
class Basics {
|
|
3750
3753
|
/**
|
|
@@ -5047,7 +5050,9 @@ class ZaloJSBridge extends eventemitter3 {
|
|
|
5047
5050
|
const logData = data.map((item) => {
|
|
5048
5051
|
return {
|
|
5049
5052
|
action: item.action,
|
|
5050
|
-
error: item.error
|
|
5053
|
+
error: item.error,
|
|
5054
|
+
message: item.message,
|
|
5055
|
+
data: item.data
|
|
5051
5056
|
};
|
|
5052
5057
|
});
|
|
5053
5058
|
CORSRequest.execute(APIS.SEND_ACTION_LOG, 'post', {
|
|
@@ -5067,7 +5072,9 @@ class ZaloJSBridge extends eventemitter3 {
|
|
|
5067
5072
|
try {
|
|
5068
5073
|
this.debug('onJSCall', key, data);
|
|
5069
5074
|
const parsedData = parseJSON(data);
|
|
5075
|
+
let inputData;
|
|
5070
5076
|
if (this._jsCallFuncCallbacks[key]) {
|
|
5077
|
+
inputData = this._jsCallFuncCallbacks[key].inputData;
|
|
5071
5078
|
const callback = this._jsCallFuncCallbacks[key].callback;
|
|
5072
5079
|
const timeout = this._jsCallFuncCallbacks[key].timeout;
|
|
5073
5080
|
if (!!callback) {
|
|
@@ -5082,11 +5089,24 @@ class ZaloJSBridge extends eventemitter3 {
|
|
|
5082
5089
|
delete this._jsCallFuncCallbacks[key];
|
|
5083
5090
|
}
|
|
5084
5091
|
}
|
|
5085
|
-
|
|
5092
|
+
const logData = {
|
|
5086
5093
|
action: parsedData.action,
|
|
5087
5094
|
error: parsedData.error_code,
|
|
5088
|
-
message: parsedData.error_message
|
|
5089
|
-
|
|
5095
|
+
message: parsedData.error_message,
|
|
5096
|
+
data: {}
|
|
5097
|
+
};
|
|
5098
|
+
try {
|
|
5099
|
+
if (parsedData.action === ACTION.OPEN_INAPP.name ||
|
|
5100
|
+
parsedData.action === ACTION.OPEN_OUTAPP.name) {
|
|
5101
|
+
const url = new URL(inputData.url);
|
|
5102
|
+
const path = `${url.protocol}//${url.host}${url.pathname}`;
|
|
5103
|
+
logData.data = {
|
|
5104
|
+
url: path
|
|
5105
|
+
};
|
|
5106
|
+
}
|
|
5107
|
+
}
|
|
5108
|
+
catch (error) { }
|
|
5109
|
+
this.results.push(logData);
|
|
5090
5110
|
}
|
|
5091
5111
|
catch (e) {
|
|
5092
5112
|
console.log('onJSCall', 'error', e);
|
|
@@ -5096,7 +5116,9 @@ class ZaloJSBridge extends eventemitter3 {
|
|
|
5096
5116
|
try {
|
|
5097
5117
|
this.debug('onMultiJSCall', key, data);
|
|
5098
5118
|
const parsedData = parseJSON(data);
|
|
5119
|
+
let inputData;
|
|
5099
5120
|
if (this._jsCallFuncCallbacks[key]) {
|
|
5121
|
+
inputData = this._jsCallFuncCallbacks[key].inputData;
|
|
5100
5122
|
const callback = this._jsCallFuncCallbacks[key].callback;
|
|
5101
5123
|
const timeout = this._jsCallFuncCallbacks[key].timeout;
|
|
5102
5124
|
if (!!callback) {
|
|
@@ -5109,11 +5131,24 @@ class ZaloJSBridge extends eventemitter3 {
|
|
|
5109
5131
|
!!timeout && clearTimeout(timeout);
|
|
5110
5132
|
}
|
|
5111
5133
|
}
|
|
5112
|
-
|
|
5134
|
+
const logData = {
|
|
5113
5135
|
action: parsedData.action,
|
|
5114
5136
|
error: parsedData.error_code,
|
|
5115
|
-
message: parsedData.error_message
|
|
5116
|
-
|
|
5137
|
+
message: parsedData.error_message,
|
|
5138
|
+
data: {}
|
|
5139
|
+
};
|
|
5140
|
+
try {
|
|
5141
|
+
if (parsedData.action === ACTION.OPEN_INAPP.name ||
|
|
5142
|
+
parsedData.action === ACTION.OPEN_OUTAPP.name) {
|
|
5143
|
+
const url = new URL(inputData.url);
|
|
5144
|
+
const path = `${url.protocol}//${url.host}${url.pathname}`;
|
|
5145
|
+
logData.data = {
|
|
5146
|
+
url: path
|
|
5147
|
+
};
|
|
5148
|
+
}
|
|
5149
|
+
}
|
|
5150
|
+
catch (error) { }
|
|
5151
|
+
this.results.push(logData);
|
|
5117
5152
|
}
|
|
5118
5153
|
catch (e) {
|
|
5119
5154
|
console.log('onMultiJSCall', 'error', e);
|
|
@@ -5251,6 +5286,7 @@ _ZaloJSBridge_jumpRunning = new WeakMap(), _ZaloJSBridge_cookies = new WeakMap()
|
|
|
5251
5286
|
action: actionName
|
|
5252
5287
|
};
|
|
5253
5288
|
this._jsCallFuncCallbacks[key] = {
|
|
5289
|
+
inputData: options,
|
|
5254
5290
|
timeout: haveTimeout &&
|
|
5255
5291
|
action.have_callback &&
|
|
5256
5292
|
setTimeout(() => {
|
|
@@ -5630,22 +5666,21 @@ class OpenApi {
|
|
|
5630
5666
|
static getUserInfo(object) {
|
|
5631
5667
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5632
5668
|
const accessToken = yield this.getAccessToken();
|
|
5633
|
-
let fields = 'id,name,picture';
|
|
5669
|
+
let fields = 'id,name,user_id_by_oa,picture';
|
|
5634
5670
|
if (object === null || object === void 0 ? void 0 : object.avatarType) {
|
|
5635
5671
|
fields = `${fields}.type(${object === null || object === void 0 ? void 0 : object.avatarType})`;
|
|
5636
5672
|
}
|
|
5637
5673
|
const userInfo = yield fetch(`${APIS.GET_USER_INFO}?fields=${fields}`, {
|
|
5638
5674
|
headers: {
|
|
5639
|
-
access_token: accessToken || ''
|
|
5675
|
+
access_token: accessToken || ''
|
|
5640
5676
|
}
|
|
5641
5677
|
}).then((response) => __awaiter(this, void 0, void 0, function* () {
|
|
5642
5678
|
const resData = yield response.json();
|
|
5643
5679
|
const userInfo = {
|
|
5644
5680
|
id: resData.id,
|
|
5645
5681
|
name: resData.name,
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
avatar: resData.picture && resData.picture.data && resData.picture.data.url
|
|
5682
|
+
avatar: resData.picture && resData.picture.data && resData.picture.data.url,
|
|
5683
|
+
idByOA: resData.user_id_by_oa
|
|
5649
5684
|
};
|
|
5650
5685
|
console.warn("'birthday' and 'gender' are deprecated");
|
|
5651
5686
|
return userInfo;
|
|
@@ -6320,6 +6355,17 @@ class ZaloMiniProgramSDKService {
|
|
|
6320
6355
|
authCodeVerify
|
|
6321
6356
|
};
|
|
6322
6357
|
});
|
|
6358
|
+
this.getZPIToken = () => __awaiter(this, void 0, void 0, function* () {
|
|
6359
|
+
var _v, _w, _x;
|
|
6360
|
+
const utoken = (_v = (yield __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_bridge, "f").getCookie(COOKIE_NAME.UTOKEN_ZPI))) === null || _v === void 0 ? void 0 : _v.value;
|
|
6361
|
+
const gtoken = (_w = (yield __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_bridge, "f").getCookie(COOKIE_NAME.GTOKEN_ZPI))) === null || _w === void 0 ? void 0 : _w.value;
|
|
6362
|
+
const zpp = (_x = (yield __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_bridge, "f").getCookie(COOKIE_NAME.ZPP_ZPI))) === null || _x === void 0 ? void 0 : _x.value;
|
|
6363
|
+
return {
|
|
6364
|
+
utoken,
|
|
6365
|
+
gtoken,
|
|
6366
|
+
zpp
|
|
6367
|
+
};
|
|
6368
|
+
});
|
|
6323
6369
|
this.setAccessToken = (accessToken) => {
|
|
6324
6370
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_autoLogin, false, "f");
|
|
6325
6371
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDKService_accessToken, accessToken, "f");
|
|
@@ -6928,6 +6974,13 @@ class MockSDKService {
|
|
|
6928
6974
|
authCodeVerify: ''
|
|
6929
6975
|
});
|
|
6930
6976
|
};
|
|
6977
|
+
this.getZPIToken = () => {
|
|
6978
|
+
return Promise.resolve({
|
|
6979
|
+
utoken: '',
|
|
6980
|
+
gtoken: '',
|
|
6981
|
+
zpp: ''
|
|
6982
|
+
});
|
|
6983
|
+
};
|
|
6931
6984
|
}
|
|
6932
6985
|
getContext() {
|
|
6933
6986
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -9019,9 +9072,19 @@ let SDKCreator = class SDKCreator {
|
|
|
9019
9072
|
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").getAuthCode();
|
|
9020
9073
|
});
|
|
9021
9074
|
}
|
|
9075
|
+
getZPIToken(object) {
|
|
9076
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9077
|
+
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").getZPIToken();
|
|
9078
|
+
});
|
|
9079
|
+
}
|
|
9022
9080
|
setAccessToken(accessToken) {
|
|
9023
9081
|
return __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").setAccessToken(accessToken);
|
|
9024
9082
|
}
|
|
9083
|
+
openOutApp(object) {
|
|
9084
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9085
|
+
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openOutApp(encodeURI(object.url));
|
|
9086
|
+
});
|
|
9087
|
+
}
|
|
9025
9088
|
};
|
|
9026
9089
|
_SDKCreator_sdkService = new WeakMap();
|
|
9027
9090
|
__decorate([
|
|
@@ -9271,6 +9334,12 @@ __decorate([
|
|
|
9271
9334
|
description: ''
|
|
9272
9335
|
}))
|
|
9273
9336
|
], SDKCreator.prototype, "getShareableLink", null);
|
|
9337
|
+
__decorate([
|
|
9338
|
+
__param(0, required(['url'])),
|
|
9339
|
+
__param(0, checkType('object', {
|
|
9340
|
+
url: checkData('url'),
|
|
9341
|
+
}))
|
|
9342
|
+
], SDKCreator.prototype, "openOutApp", null);
|
|
9274
9343
|
SDKCreator = __decorate([
|
|
9275
9344
|
DecorateAll(centralizedFunctionHandler)
|
|
9276
9345
|
], SDKCreator);
|