zmp-sdk 2.23.2-1 → 2.23.3
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 +56 -13
- package/dist/index.es.js +56 -13
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/types/src/apis/index.d.ts +1 -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/zaloJsBridge.d.ts +1 -0
- package/package.json +1 -1
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
|
@@ -3747,7 +3747,7 @@
|
|
|
3747
3747
|
}
|
|
3748
3748
|
}
|
|
3749
3749
|
|
|
3750
|
-
var version = "2.23.
|
|
3750
|
+
var version = "2.23.3";
|
|
3751
3751
|
|
|
3752
3752
|
class Basics {
|
|
3753
3753
|
/**
|
|
@@ -5050,7 +5050,9 @@
|
|
|
5050
5050
|
const logData = data.map((item) => {
|
|
5051
5051
|
return {
|
|
5052
5052
|
action: item.action,
|
|
5053
|
-
error: item.error
|
|
5053
|
+
error: item.error,
|
|
5054
|
+
message: item.message,
|
|
5055
|
+
data: item.data
|
|
5054
5056
|
};
|
|
5055
5057
|
});
|
|
5056
5058
|
CORSRequest.execute(APIS.SEND_ACTION_LOG, 'post', {
|
|
@@ -5070,7 +5072,9 @@
|
|
|
5070
5072
|
try {
|
|
5071
5073
|
this.debug('onJSCall', key, data);
|
|
5072
5074
|
const parsedData = parseJSON(data);
|
|
5075
|
+
let inputData;
|
|
5073
5076
|
if (this._jsCallFuncCallbacks[key]) {
|
|
5077
|
+
inputData = this._jsCallFuncCallbacks[key].inputData;
|
|
5074
5078
|
const callback = this._jsCallFuncCallbacks[key].callback;
|
|
5075
5079
|
const timeout = this._jsCallFuncCallbacks[key].timeout;
|
|
5076
5080
|
if (!!callback) {
|
|
@@ -5085,11 +5089,24 @@
|
|
|
5085
5089
|
delete this._jsCallFuncCallbacks[key];
|
|
5086
5090
|
}
|
|
5087
5091
|
}
|
|
5088
|
-
|
|
5092
|
+
const logData = {
|
|
5089
5093
|
action: parsedData.action,
|
|
5090
5094
|
error: parsedData.error_code,
|
|
5091
|
-
message: parsedData.error_message
|
|
5092
|
-
|
|
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);
|
|
5093
5110
|
}
|
|
5094
5111
|
catch (e) {
|
|
5095
5112
|
console.log('onJSCall', 'error', e);
|
|
@@ -5099,7 +5116,9 @@
|
|
|
5099
5116
|
try {
|
|
5100
5117
|
this.debug('onMultiJSCall', key, data);
|
|
5101
5118
|
const parsedData = parseJSON(data);
|
|
5119
|
+
let inputData;
|
|
5102
5120
|
if (this._jsCallFuncCallbacks[key]) {
|
|
5121
|
+
inputData = this._jsCallFuncCallbacks[key].inputData;
|
|
5103
5122
|
const callback = this._jsCallFuncCallbacks[key].callback;
|
|
5104
5123
|
const timeout = this._jsCallFuncCallbacks[key].timeout;
|
|
5105
5124
|
if (!!callback) {
|
|
@@ -5112,11 +5131,24 @@
|
|
|
5112
5131
|
!!timeout && clearTimeout(timeout);
|
|
5113
5132
|
}
|
|
5114
5133
|
}
|
|
5115
|
-
|
|
5134
|
+
const logData = {
|
|
5116
5135
|
action: parsedData.action,
|
|
5117
5136
|
error: parsedData.error_code,
|
|
5118
|
-
message: parsedData.error_message
|
|
5119
|
-
|
|
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);
|
|
5120
5152
|
}
|
|
5121
5153
|
catch (e) {
|
|
5122
5154
|
console.log('onMultiJSCall', 'error', e);
|
|
@@ -5254,6 +5286,7 @@
|
|
|
5254
5286
|
action: actionName
|
|
5255
5287
|
};
|
|
5256
5288
|
this._jsCallFuncCallbacks[key] = {
|
|
5289
|
+
inputData: options,
|
|
5257
5290
|
timeout: haveTimeout &&
|
|
5258
5291
|
action.have_callback &&
|
|
5259
5292
|
setTimeout(() => {
|
|
@@ -5633,22 +5666,21 @@
|
|
|
5633
5666
|
static getUserInfo(object) {
|
|
5634
5667
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5635
5668
|
const accessToken = yield this.getAccessToken();
|
|
5636
|
-
let fields = 'id,name,picture';
|
|
5669
|
+
let fields = 'id,name,user_id_by_oa,picture';
|
|
5637
5670
|
if (object === null || object === void 0 ? void 0 : object.avatarType) {
|
|
5638
5671
|
fields = `${fields}.type(${object === null || object === void 0 ? void 0 : object.avatarType})`;
|
|
5639
5672
|
}
|
|
5640
5673
|
const userInfo = yield fetch(`${APIS.GET_USER_INFO}?fields=${fields}`, {
|
|
5641
5674
|
headers: {
|
|
5642
|
-
access_token: accessToken || ''
|
|
5675
|
+
access_token: accessToken || ''
|
|
5643
5676
|
}
|
|
5644
5677
|
}).then((response) => __awaiter(this, void 0, void 0, function* () {
|
|
5645
5678
|
const resData = yield response.json();
|
|
5646
5679
|
const userInfo = {
|
|
5647
5680
|
id: resData.id,
|
|
5648
5681
|
name: resData.name,
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
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
|
|
5652
5684
|
};
|
|
5653
5685
|
console.warn("'birthday' and 'gender' are deprecated");
|
|
5654
5686
|
return userInfo;
|
|
@@ -7667,6 +7699,11 @@
|
|
|
7667
7699
|
setAccessToken(accessToken) {
|
|
7668
7700
|
return __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").setAccessToken(accessToken);
|
|
7669
7701
|
}
|
|
7702
|
+
openOutApp(object) {
|
|
7703
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
7704
|
+
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openOutApp(encodeURI(object.url));
|
|
7705
|
+
});
|
|
7706
|
+
}
|
|
7670
7707
|
};
|
|
7671
7708
|
_SDKCreator_sdkService = new WeakMap();
|
|
7672
7709
|
__decorate([
|
|
@@ -7916,6 +7953,12 @@
|
|
|
7916
7953
|
description: ''
|
|
7917
7954
|
}))
|
|
7918
7955
|
], SDKCreator.prototype, "getShareableLink", null);
|
|
7956
|
+
__decorate([
|
|
7957
|
+
__param(0, required(['url'])),
|
|
7958
|
+
__param(0, checkType('object', {
|
|
7959
|
+
url: checkData('url'),
|
|
7960
|
+
}))
|
|
7961
|
+
], SDKCreator.prototype, "openOutApp", null);
|
|
7919
7962
|
SDKCreator = __decorate([
|
|
7920
7963
|
DecorateAll(centralizedFunctionHandler)
|
|
7921
7964
|
], SDKCreator);
|
package/dist/index.es.js
CHANGED
|
@@ -3744,7 +3744,7 @@ class ZMPEEmitter extends eventemitter3 {
|
|
|
3744
3744
|
}
|
|
3745
3745
|
}
|
|
3746
3746
|
|
|
3747
|
-
var version$1 = "2.23.
|
|
3747
|
+
var version$1 = "2.23.3";
|
|
3748
3748
|
|
|
3749
3749
|
class Basics {
|
|
3750
3750
|
/**
|
|
@@ -5047,7 +5047,9 @@ class ZaloJSBridge extends eventemitter3 {
|
|
|
5047
5047
|
const logData = data.map((item) => {
|
|
5048
5048
|
return {
|
|
5049
5049
|
action: item.action,
|
|
5050
|
-
error: item.error
|
|
5050
|
+
error: item.error,
|
|
5051
|
+
message: item.message,
|
|
5052
|
+
data: item.data
|
|
5051
5053
|
};
|
|
5052
5054
|
});
|
|
5053
5055
|
CORSRequest.execute(APIS.SEND_ACTION_LOG, 'post', {
|
|
@@ -5067,7 +5069,9 @@ class ZaloJSBridge extends eventemitter3 {
|
|
|
5067
5069
|
try {
|
|
5068
5070
|
this.debug('onJSCall', key, data);
|
|
5069
5071
|
const parsedData = parseJSON(data);
|
|
5072
|
+
let inputData;
|
|
5070
5073
|
if (this._jsCallFuncCallbacks[key]) {
|
|
5074
|
+
inputData = this._jsCallFuncCallbacks[key].inputData;
|
|
5071
5075
|
const callback = this._jsCallFuncCallbacks[key].callback;
|
|
5072
5076
|
const timeout = this._jsCallFuncCallbacks[key].timeout;
|
|
5073
5077
|
if (!!callback) {
|
|
@@ -5082,11 +5086,24 @@ class ZaloJSBridge extends eventemitter3 {
|
|
|
5082
5086
|
delete this._jsCallFuncCallbacks[key];
|
|
5083
5087
|
}
|
|
5084
5088
|
}
|
|
5085
|
-
|
|
5089
|
+
const logData = {
|
|
5086
5090
|
action: parsedData.action,
|
|
5087
5091
|
error: parsedData.error_code,
|
|
5088
|
-
message: parsedData.error_message
|
|
5089
|
-
|
|
5092
|
+
message: parsedData.error_message,
|
|
5093
|
+
data: {}
|
|
5094
|
+
};
|
|
5095
|
+
try {
|
|
5096
|
+
if (parsedData.action === ACTION.OPEN_INAPP.name ||
|
|
5097
|
+
parsedData.action === ACTION.OPEN_OUTAPP.name) {
|
|
5098
|
+
const url = new URL(inputData.url);
|
|
5099
|
+
const path = `${url.protocol}//${url.host}${url.pathname}`;
|
|
5100
|
+
logData.data = {
|
|
5101
|
+
url: path
|
|
5102
|
+
};
|
|
5103
|
+
}
|
|
5104
|
+
}
|
|
5105
|
+
catch (error) { }
|
|
5106
|
+
this.results.push(logData);
|
|
5090
5107
|
}
|
|
5091
5108
|
catch (e) {
|
|
5092
5109
|
console.log('onJSCall', 'error', e);
|
|
@@ -5096,7 +5113,9 @@ class ZaloJSBridge extends eventemitter3 {
|
|
|
5096
5113
|
try {
|
|
5097
5114
|
this.debug('onMultiJSCall', key, data);
|
|
5098
5115
|
const parsedData = parseJSON(data);
|
|
5116
|
+
let inputData;
|
|
5099
5117
|
if (this._jsCallFuncCallbacks[key]) {
|
|
5118
|
+
inputData = this._jsCallFuncCallbacks[key].inputData;
|
|
5100
5119
|
const callback = this._jsCallFuncCallbacks[key].callback;
|
|
5101
5120
|
const timeout = this._jsCallFuncCallbacks[key].timeout;
|
|
5102
5121
|
if (!!callback) {
|
|
@@ -5109,11 +5128,24 @@ class ZaloJSBridge extends eventemitter3 {
|
|
|
5109
5128
|
!!timeout && clearTimeout(timeout);
|
|
5110
5129
|
}
|
|
5111
5130
|
}
|
|
5112
|
-
|
|
5131
|
+
const logData = {
|
|
5113
5132
|
action: parsedData.action,
|
|
5114
5133
|
error: parsedData.error_code,
|
|
5115
|
-
message: parsedData.error_message
|
|
5116
|
-
|
|
5134
|
+
message: parsedData.error_message,
|
|
5135
|
+
data: {}
|
|
5136
|
+
};
|
|
5137
|
+
try {
|
|
5138
|
+
if (parsedData.action === ACTION.OPEN_INAPP.name ||
|
|
5139
|
+
parsedData.action === ACTION.OPEN_OUTAPP.name) {
|
|
5140
|
+
const url = new URL(inputData.url);
|
|
5141
|
+
const path = `${url.protocol}//${url.host}${url.pathname}`;
|
|
5142
|
+
logData.data = {
|
|
5143
|
+
url: path
|
|
5144
|
+
};
|
|
5145
|
+
}
|
|
5146
|
+
}
|
|
5147
|
+
catch (error) { }
|
|
5148
|
+
this.results.push(logData);
|
|
5117
5149
|
}
|
|
5118
5150
|
catch (e) {
|
|
5119
5151
|
console.log('onMultiJSCall', 'error', e);
|
|
@@ -5251,6 +5283,7 @@ _ZaloJSBridge_jumpRunning = new WeakMap(), _ZaloJSBridge_cookies = new WeakMap()
|
|
|
5251
5283
|
action: actionName
|
|
5252
5284
|
};
|
|
5253
5285
|
this._jsCallFuncCallbacks[key] = {
|
|
5286
|
+
inputData: options,
|
|
5254
5287
|
timeout: haveTimeout &&
|
|
5255
5288
|
action.have_callback &&
|
|
5256
5289
|
setTimeout(() => {
|
|
@@ -5630,22 +5663,21 @@ class OpenApi {
|
|
|
5630
5663
|
static getUserInfo(object) {
|
|
5631
5664
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5632
5665
|
const accessToken = yield this.getAccessToken();
|
|
5633
|
-
let fields = 'id,name,picture';
|
|
5666
|
+
let fields = 'id,name,user_id_by_oa,picture';
|
|
5634
5667
|
if (object === null || object === void 0 ? void 0 : object.avatarType) {
|
|
5635
5668
|
fields = `${fields}.type(${object === null || object === void 0 ? void 0 : object.avatarType})`;
|
|
5636
5669
|
}
|
|
5637
5670
|
const userInfo = yield fetch(`${APIS.GET_USER_INFO}?fields=${fields}`, {
|
|
5638
5671
|
headers: {
|
|
5639
|
-
access_token: accessToken || ''
|
|
5672
|
+
access_token: accessToken || ''
|
|
5640
5673
|
}
|
|
5641
5674
|
}).then((response) => __awaiter(this, void 0, void 0, function* () {
|
|
5642
5675
|
const resData = yield response.json();
|
|
5643
5676
|
const userInfo = {
|
|
5644
5677
|
id: resData.id,
|
|
5645
5678
|
name: resData.name,
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
avatar: resData.picture && resData.picture.data && resData.picture.data.url
|
|
5679
|
+
avatar: resData.picture && resData.picture.data && resData.picture.data.url,
|
|
5680
|
+
idByOA: resData.user_id_by_oa
|
|
5649
5681
|
};
|
|
5650
5682
|
console.warn("'birthday' and 'gender' are deprecated");
|
|
5651
5683
|
return userInfo;
|
|
@@ -9022,6 +9054,11 @@ let SDKCreator = class SDKCreator {
|
|
|
9022
9054
|
setAccessToken(accessToken) {
|
|
9023
9055
|
return __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").setAccessToken(accessToken);
|
|
9024
9056
|
}
|
|
9057
|
+
openOutApp(object) {
|
|
9058
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9059
|
+
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openOutApp(encodeURI(object.url));
|
|
9060
|
+
});
|
|
9061
|
+
}
|
|
9025
9062
|
};
|
|
9026
9063
|
_SDKCreator_sdkService = new WeakMap();
|
|
9027
9064
|
__decorate([
|
|
@@ -9271,6 +9308,12 @@ __decorate([
|
|
|
9271
9308
|
description: ''
|
|
9272
9309
|
}))
|
|
9273
9310
|
], SDKCreator.prototype, "getShareableLink", null);
|
|
9311
|
+
__decorate([
|
|
9312
|
+
__param(0, required(['url'])),
|
|
9313
|
+
__param(0, checkType('object', {
|
|
9314
|
+
url: checkData('url'),
|
|
9315
|
+
}))
|
|
9316
|
+
], SDKCreator.prototype, "openOutApp", null);
|
|
9274
9317
|
SDKCreator = __decorate([
|
|
9275
9318
|
DecorateAll(centralizedFunctionHandler)
|
|
9276
9319
|
], SDKCreator);
|