zmp-sdk 2.23.4-0 → 2.23.5-rc.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 +209 -6
- package/changelog/dist/changelog-setup.dev.js +24 -0
- package/dist/browser.min.js +86 -21
- package/dist/index.es.js +86 -21
- 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/constants.d.ts +1 -1
- package/dist/types/src/types/callbackData.d.ts +7 -5
- package/dist/types/src/types/inputData.d.ts +5 -0
- package/package.json +1 -1
package/CHANGELOG.json
CHANGED
|
@@ -1,19 +1,222 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
|
-
"isoDate": "
|
|
4
|
-
"niceDate": "2
|
|
5
|
-
"diff": "v2.23.
|
|
6
|
-
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/compare/v2.23.
|
|
3
|
+
"isoDate": "2023-02-02",
|
|
4
|
+
"niceDate": "2 February 2023",
|
|
5
|
+
"diff": "v2.23.4..",
|
|
6
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/compare/v2.23.4...v2.23.4",
|
|
7
7
|
"major": false,
|
|
8
8
|
"minor": false,
|
|
9
9
|
"tag": null,
|
|
10
|
-
"title": "v2.23.
|
|
11
|
-
"date": "
|
|
10
|
+
"title": "v2.23.4",
|
|
11
|
+
"date": "2023-02-02T10:08:46.365Z",
|
|
12
12
|
"summary": null,
|
|
13
13
|
"commits": [],
|
|
14
14
|
"merges": [],
|
|
15
15
|
"fixes": []
|
|
16
16
|
},
|
|
17
|
+
{
|
|
18
|
+
"isoDate": "2023-02-02",
|
|
19
|
+
"niceDate": "2 February 2023",
|
|
20
|
+
"diff": "v2.23.4-0..v2.23.4",
|
|
21
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/compare/v2.23.4-0...v2.23.4",
|
|
22
|
+
"major": false,
|
|
23
|
+
"minor": false,
|
|
24
|
+
"tag": "v2.23.4",
|
|
25
|
+
"date": "2023-02-02",
|
|
26
|
+
"title": "v2.23.4",
|
|
27
|
+
"version": "v2.23.4",
|
|
28
|
+
"summary": null,
|
|
29
|
+
"commits": [
|
|
30
|
+
{
|
|
31
|
+
"hash": "2754e96150e2e20e2262e3c1a741d7ba682bd864",
|
|
32
|
+
"shorthash": "2754e96",
|
|
33
|
+
"author": "Kidataek",
|
|
34
|
+
"email": "tuankiet.hcmc@gmail.com",
|
|
35
|
+
"date": "2023-01-05T09:42:01.000Z",
|
|
36
|
+
"niceDate": "5 January 2023",
|
|
37
|
+
"subject": "feat: add api chooseImage",
|
|
38
|
+
"message": "feat: add api chooseImage",
|
|
39
|
+
"fixes": null,
|
|
40
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/commit/2754e96150e2e20e2262e3c1a741d7ba682bd864",
|
|
41
|
+
"breaking": false,
|
|
42
|
+
"files": 3,
|
|
43
|
+
"insertions": 80,
|
|
44
|
+
"deletions": 1,
|
|
45
|
+
"merge": null
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"hash": "8b67a00ab4d4842b60c7374ecb3f064e4adfffb2",
|
|
49
|
+
"shorthash": "8b67a00",
|
|
50
|
+
"author": "duongvh",
|
|
51
|
+
"email": "hdvu98@gmail.com",
|
|
52
|
+
"date": "2023-01-04T10:33:33.000Z",
|
|
53
|
+
"niceDate": "4 January 2023",
|
|
54
|
+
"subject": "feat: api getZPIToken",
|
|
55
|
+
"message": "feat: api getZPIToken",
|
|
56
|
+
"fixes": null,
|
|
57
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/commit/8b67a00ab4d4842b60c7374ecb3f064e4adfffb2",
|
|
58
|
+
"breaking": false,
|
|
59
|
+
"files": 6,
|
|
60
|
+
"insertions": 53,
|
|
61
|
+
"deletions": 6,
|
|
62
|
+
"merge": null
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"hash": "de9b6ce2554b11852220dc6e23fe3741ab4f7497",
|
|
66
|
+
"shorthash": "de9b6ce",
|
|
67
|
+
"author": "Kidataek",
|
|
68
|
+
"email": "tuankiet.hcmc@gmail.com",
|
|
69
|
+
"date": "2023-02-02T09:57:31.000Z",
|
|
70
|
+
"niceDate": "2 February 2023",
|
|
71
|
+
"subject": "fix: convert stgpayment to payment",
|
|
72
|
+
"message": "fix: convert stgpayment to payment",
|
|
73
|
+
"fixes": null,
|
|
74
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/commit/de9b6ce2554b11852220dc6e23fe3741ab4f7497",
|
|
75
|
+
"breaking": false,
|
|
76
|
+
"files": 1,
|
|
77
|
+
"insertions": 5,
|
|
78
|
+
"deletions": 5,
|
|
79
|
+
"merge": null
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
"merges": [],
|
|
83
|
+
"fixes": []
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"isoDate": "2023-01-05",
|
|
87
|
+
"niceDate": "5 January 2023",
|
|
88
|
+
"diff": "v2.23.3..v2.23.4-0",
|
|
89
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/compare/v2.23.3...v2.23.4-0",
|
|
90
|
+
"major": false,
|
|
91
|
+
"minor": false,
|
|
92
|
+
"tag": "v2.23.4-0",
|
|
93
|
+
"date": "2023-01-05",
|
|
94
|
+
"title": "v2.23.4-0",
|
|
95
|
+
"version": "v2.23.4-0",
|
|
96
|
+
"summary": null,
|
|
97
|
+
"commits": [
|
|
98
|
+
{
|
|
99
|
+
"hash": "47115575d5ad3d143afb4368b7dfafafaf0e05ae",
|
|
100
|
+
"shorthash": "4711557",
|
|
101
|
+
"author": "duongvh",
|
|
102
|
+
"email": "hdvu98@gmail.com",
|
|
103
|
+
"date": "2023-01-04T10:35:50.000Z",
|
|
104
|
+
"niceDate": "4 January 2023",
|
|
105
|
+
"subject": "feat: api getZPIToken",
|
|
106
|
+
"message": "feat: api getZPIToken",
|
|
107
|
+
"fixes": null,
|
|
108
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/commit/47115575d5ad3d143afb4368b7dfafafaf0e05ae",
|
|
109
|
+
"breaking": false,
|
|
110
|
+
"files": 6,
|
|
111
|
+
"insertions": 53,
|
|
112
|
+
"deletions": 6,
|
|
113
|
+
"merge": null
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
"merges": [],
|
|
117
|
+
"fixes": []
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"isoDate": "2022-12-09",
|
|
121
|
+
"niceDate": "9 December 2022",
|
|
122
|
+
"diff": "v2.23.3-rc.0..v2.23.3",
|
|
123
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/compare/v2.23.3-rc.0...v2.23.3",
|
|
124
|
+
"major": false,
|
|
125
|
+
"minor": false,
|
|
126
|
+
"tag": "v2.23.3",
|
|
127
|
+
"date": "2022-12-09",
|
|
128
|
+
"title": "v2.23.3",
|
|
129
|
+
"version": "v2.23.3",
|
|
130
|
+
"summary": null,
|
|
131
|
+
"commits": [],
|
|
132
|
+
"merges": [],
|
|
133
|
+
"fixes": []
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"isoDate": "2023-02-02",
|
|
137
|
+
"niceDate": "2 February 2023",
|
|
138
|
+
"diff": "v2.23.2..v2.23.3-rc.0",
|
|
139
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/compare/v2.23.2...v2.23.3-rc.0",
|
|
140
|
+
"major": false,
|
|
141
|
+
"minor": false,
|
|
142
|
+
"tag": "v2.23.3-rc.0",
|
|
143
|
+
"date": "2023-02-02",
|
|
144
|
+
"title": "v2.23.3-rc.0",
|
|
145
|
+
"version": "v2.23.3-rc.0",
|
|
146
|
+
"summary": null,
|
|
147
|
+
"commits": [
|
|
148
|
+
{
|
|
149
|
+
"hash": "2754e96150e2e20e2262e3c1a741d7ba682bd864",
|
|
150
|
+
"shorthash": "2754e96",
|
|
151
|
+
"author": "Kidataek",
|
|
152
|
+
"email": "tuankiet.hcmc@gmail.com",
|
|
153
|
+
"date": "2023-01-05T09:42:01.000Z",
|
|
154
|
+
"niceDate": "5 January 2023",
|
|
155
|
+
"subject": "feat: add api chooseImage",
|
|
156
|
+
"message": "feat: add api chooseImage",
|
|
157
|
+
"fixes": null,
|
|
158
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/commit/2754e96150e2e20e2262e3c1a741d7ba682bd864",
|
|
159
|
+
"breaking": false,
|
|
160
|
+
"files": 3,
|
|
161
|
+
"insertions": 80,
|
|
162
|
+
"deletions": 1,
|
|
163
|
+
"merge": null
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"hash": "f4933aed31d13a01b7fe61b4d8c66af800ca13b7",
|
|
167
|
+
"shorthash": "f4933ae",
|
|
168
|
+
"author": "Kidataek",
|
|
169
|
+
"email": "tuankiet.hcmc@gmail.com",
|
|
170
|
+
"date": "2022-12-09T09:56:49.000Z",
|
|
171
|
+
"niceDate": "9 December 2022",
|
|
172
|
+
"subject": "feat: release api openOutApp",
|
|
173
|
+
"message": "feat: release api openOutApp",
|
|
174
|
+
"fixes": null,
|
|
175
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/commit/f4933aed31d13a01b7fe61b4d8c66af800ca13b7",
|
|
176
|
+
"breaking": false,
|
|
177
|
+
"files": 3,
|
|
178
|
+
"insertions": 58,
|
|
179
|
+
"deletions": 10,
|
|
180
|
+
"merge": null
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"hash": "860f2c914d99108cbf533cbd312679436f9297fe",
|
|
184
|
+
"shorthash": "860f2c9",
|
|
185
|
+
"author": "Kidataek",
|
|
186
|
+
"email": "tuankiet.hcmc@gmail.com",
|
|
187
|
+
"date": "2022-12-08T07:04:35.000Z",
|
|
188
|
+
"niceDate": "8 December 2022",
|
|
189
|
+
"subject": "chore: update changelog",
|
|
190
|
+
"message": "chore: update changelog",
|
|
191
|
+
"fixes": null,
|
|
192
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/commit/860f2c914d99108cbf533cbd312679436f9297fe",
|
|
193
|
+
"breaking": false,
|
|
194
|
+
"files": 1,
|
|
195
|
+
"insertions": 54,
|
|
196
|
+
"deletions": 4,
|
|
197
|
+
"merge": null
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"hash": "5919b8ec58bc7aab3ecef2b0818bd93eb1243cea",
|
|
201
|
+
"shorthash": "5919b8e",
|
|
202
|
+
"author": "Kidataek",
|
|
203
|
+
"email": "tuankiet.hcmc@gmail.com",
|
|
204
|
+
"date": "2022-12-08T07:03:35.000Z",
|
|
205
|
+
"niceDate": "8 December 2022",
|
|
206
|
+
"subject": "feat: add field idByOA for getUserInfo",
|
|
207
|
+
"message": "feat: add field idByOA for getUserInfo",
|
|
208
|
+
"fixes": null,
|
|
209
|
+
"href": "https://zalogit2.zing.vn/ZaloMiniPrograms/zmp-sdk/commit/5919b8ec58bc7aab3ecef2b0818bd93eb1243cea",
|
|
210
|
+
"breaking": false,
|
|
211
|
+
"files": 2,
|
|
212
|
+
"insertions": 11,
|
|
213
|
+
"deletions": 10,
|
|
214
|
+
"merge": null
|
|
215
|
+
}
|
|
216
|
+
],
|
|
217
|
+
"merges": [],
|
|
218
|
+
"fixes": []
|
|
219
|
+
},
|
|
17
220
|
{
|
|
18
221
|
"isoDate": "2022-12-02",
|
|
19
222
|
"niceDate": "2 December 2022",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
module.exports = function (Handlebars) {
|
|
4
|
+
Handlebars.registerHelper('validTag', function (tag, commits, options) {
|
|
5
|
+
if (!tag || tag.indexOf('-') >= 0 || commits.length <= 0) return false;
|
|
6
|
+
var version = tag.split('v')[1];
|
|
7
|
+
return version.localeCompare('2.21.2', undefined, {
|
|
8
|
+
numeric: true,
|
|
9
|
+
sensitivity: 'base'
|
|
10
|
+
}) > 0;
|
|
11
|
+
});
|
|
12
|
+
Handlebars.registerHelper('commitFormat', function (options) {
|
|
13
|
+
var string = options.fn(this);
|
|
14
|
+
var mapObj = {
|
|
15
|
+
'breaking change:': '',
|
|
16
|
+
'fix:': '',
|
|
17
|
+
'feat:': ''
|
|
18
|
+
};
|
|
19
|
+
return string.replace(/('breaking change:|fix:|feat:)(.*)/gi, function (matched, a, b) {
|
|
20
|
+
var g2 = b.trim();
|
|
21
|
+
return "".concat(mapObj[a]).concat(g2.charAt(0).toUpperCase() + g2.slice(1));
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
};
|
package/dist/browser.min.js
CHANGED
|
@@ -2259,7 +2259,7 @@
|
|
|
2259
2259
|
GET_ACCESS_TOKEN: 'https://h5.zalo.me/openapi/access_token',
|
|
2260
2260
|
GET_ACCESS_TOKEN_V3: 'https://oauth.zaloapp.com/v3/access_token',
|
|
2261
2261
|
GET_LIST_USER_INFO: 'https://graph.zalo.me/v2.0/me/friends/list',
|
|
2262
|
-
CREATE_ORDER: 'https://
|
|
2262
|
+
CREATE_ORDER: 'https://payment-mini.zalo.me/api/order/create',
|
|
2263
2263
|
GET_APP_INFO: 'https://h5.zalo.me/apps/get-info',
|
|
2264
2264
|
SEND_ACTION_LOG: 'https://h5.zalo.me/log/async'
|
|
2265
2265
|
};
|
|
@@ -2893,11 +2893,11 @@
|
|
|
2893
2893
|
const SHOW_ACTION_BAR = 5;
|
|
2894
2894
|
const HIDE_ACTION_BAR = 6;
|
|
2895
2895
|
const PAYMENT_APIS = {
|
|
2896
|
-
CREATE_ORDER: 'https://
|
|
2897
|
-
GET_TRANSACTION: 'https://
|
|
2898
|
-
GET_ORDER_STATUS: 'https://
|
|
2896
|
+
CREATE_ORDER: 'https://payment-mini.zalo.me/api/order/create',
|
|
2897
|
+
GET_TRANSACTION: 'https://payment-mini.zalo.me/api/transaction',
|
|
2898
|
+
GET_ORDER_STATUS: 'https://payment-mini.zalo.me/api/transaction/get-status'
|
|
2899
2899
|
};
|
|
2900
|
-
const PAYMENT_H5_URL = 'https://
|
|
2900
|
+
const PAYMENT_H5_URL = 'https://payment-mini.zalo.me';
|
|
2901
2901
|
|
|
2902
2902
|
class AppError {
|
|
2903
2903
|
constructor(code, msg, api) {
|
|
@@ -3310,6 +3310,12 @@
|
|
|
3310
3310
|
}
|
|
3311
3311
|
if (option) {
|
|
3312
3312
|
if (Array.isArray(option === null || option === void 0 ? void 0 : option.values)) {
|
|
3313
|
+
if (Array.isArray(data)) {
|
|
3314
|
+
return {
|
|
3315
|
+
error: data.some((item) => { var _a; return !((_a = option === null || option === void 0 ? void 0 : option.values) === null || _a === void 0 ? void 0 : _a.includes(item)); }),
|
|
3316
|
+
errorMessage: option === null || option === void 0 ? void 0 : option.values.toString()
|
|
3317
|
+
};
|
|
3318
|
+
}
|
|
3313
3319
|
return {
|
|
3314
3320
|
error: !(option === null || option === void 0 ? void 0 : option.values.includes(data)),
|
|
3315
3321
|
errorMessage: option === null || option === void 0 ? void 0 : option.values.toString()
|
|
@@ -3750,7 +3756,7 @@
|
|
|
3750
3756
|
}
|
|
3751
3757
|
}
|
|
3752
3758
|
|
|
3753
|
-
var version = "2.23.
|
|
3759
|
+
var version = "2.23.5-rc.0";
|
|
3754
3760
|
|
|
3755
3761
|
class Basics {
|
|
3756
3762
|
/**
|
|
@@ -5685,7 +5691,6 @@
|
|
|
5685
5691
|
avatar: resData.picture && resData.picture.data && resData.picture.data.url,
|
|
5686
5692
|
idByOA: resData.user_id_by_oa
|
|
5687
5693
|
};
|
|
5688
|
-
console.warn("'birthday' and 'gender' are deprecated");
|
|
5689
5694
|
return userInfo;
|
|
5690
5695
|
}));
|
|
5691
5696
|
return {
|
|
@@ -5706,9 +5711,12 @@
|
|
|
5706
5711
|
return yield this.getJSBridge().callNative(ACTION.MP_GET_NUMBER, {}, {
|
|
5707
5712
|
isMultiCallback: true,
|
|
5708
5713
|
successCallback: (data) => {
|
|
5709
|
-
const res = {
|
|
5710
|
-
|
|
5711
|
-
|
|
5714
|
+
const res = {};
|
|
5715
|
+
if (data.token) {
|
|
5716
|
+
res.token = data.token;
|
|
5717
|
+
return Promise.resolve(res);
|
|
5718
|
+
}
|
|
5719
|
+
res.number = data;
|
|
5712
5720
|
return Promise.resolve(res);
|
|
5713
5721
|
},
|
|
5714
5722
|
delay: this.isIOS ? 400 : 0
|
|
@@ -5825,16 +5833,15 @@
|
|
|
5825
5833
|
isMultiCallback: true,
|
|
5826
5834
|
haveTimeout: false,
|
|
5827
5835
|
successCallback: (data) => {
|
|
5828
|
-
const res = {
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
};
|
|
5836
|
+
const res = {};
|
|
5837
|
+
if (data.token) {
|
|
5838
|
+
res.token = data.token;
|
|
5839
|
+
return Promise.resolve(res);
|
|
5840
|
+
}
|
|
5841
|
+
res.latitude = data.latitude;
|
|
5842
|
+
res.longitude = data.longitude;
|
|
5843
|
+
res.timestamp = data.timestamp;
|
|
5844
|
+
res.provider = data.provider;
|
|
5838
5845
|
return Promise.resolve(res);
|
|
5839
5846
|
},
|
|
5840
5847
|
delay: this.isIOS ? 400 : 0
|
|
@@ -7549,7 +7556,7 @@
|
|
|
7549
7556
|
openWebview(object) {
|
|
7550
7557
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7551
7558
|
const url = new URL(object.url);
|
|
7552
|
-
const isVNPayLink = url.href.includes(
|
|
7559
|
+
const isVNPayLink = url.href.includes('vnpay');
|
|
7553
7560
|
const typeInapp = url.searchParams.get('typeInapp');
|
|
7554
7561
|
if (!isVNPayLink && _.isEmpty(typeInapp)) {
|
|
7555
7562
|
url.searchParams.set('typeInapp', '1');
|
|
@@ -7730,6 +7737,51 @@
|
|
|
7730
7737
|
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openOutApp(encodeURI(object.url));
|
|
7731
7738
|
});
|
|
7732
7739
|
}
|
|
7740
|
+
chooseImage(object) {
|
|
7741
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
7742
|
+
const sourceType = object.sourceType || ['album', 'camera'];
|
|
7743
|
+
const cameraType = object.cameraType || 'front';
|
|
7744
|
+
const count = object.count || 1;
|
|
7745
|
+
const inputEl = document.createElement('input');
|
|
7746
|
+
inputEl.type = 'file';
|
|
7747
|
+
inputEl.multiple = count > 1;
|
|
7748
|
+
inputEl.accept = 'image/*';
|
|
7749
|
+
inputEl.style.display = 'none';
|
|
7750
|
+
if (sourceType.length === 1 && sourceType.includes('camera')) {
|
|
7751
|
+
inputEl.accept =
|
|
7752
|
+
cameraType === 'front'
|
|
7753
|
+
? 'zcamera/photo-frontfacing'
|
|
7754
|
+
: 'zcamera/photo-backfacing';
|
|
7755
|
+
inputEl.capture =
|
|
7756
|
+
cameraType === 'front' ? 'user' : 'environment';
|
|
7757
|
+
}
|
|
7758
|
+
return new Promise((resolve, reject) => {
|
|
7759
|
+
inputEl.addEventListener('change', (event) => {
|
|
7760
|
+
var _a;
|
|
7761
|
+
const fileList = ((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.files) || [];
|
|
7762
|
+
if (fileList.length > count) {
|
|
7763
|
+
reject(new Error(`You are only allowed to choose a maximum of ${count} images at a time`));
|
|
7764
|
+
}
|
|
7765
|
+
else {
|
|
7766
|
+
const result = {
|
|
7767
|
+
filePaths: [],
|
|
7768
|
+
tempFiles: []
|
|
7769
|
+
};
|
|
7770
|
+
Array.from(fileList).forEach((file) => {
|
|
7771
|
+
result.filePaths.push(URL.createObjectURL(file));
|
|
7772
|
+
result.tempFiles.push({
|
|
7773
|
+
path: URL.createObjectURL(file),
|
|
7774
|
+
size: file.size
|
|
7775
|
+
});
|
|
7776
|
+
});
|
|
7777
|
+
resolve(result);
|
|
7778
|
+
}
|
|
7779
|
+
});
|
|
7780
|
+
document.body.appendChild(inputEl);
|
|
7781
|
+
inputEl.click();
|
|
7782
|
+
});
|
|
7783
|
+
});
|
|
7784
|
+
}
|
|
7733
7785
|
};
|
|
7734
7786
|
_SDKCreator_sdkService = new WeakMap();
|
|
7735
7787
|
__decorate([
|
|
@@ -7985,6 +8037,19 @@
|
|
|
7985
8037
|
url: checkData('url'),
|
|
7986
8038
|
}))
|
|
7987
8039
|
], SDKCreator.prototype, "openOutApp", null);
|
|
8040
|
+
__decorate([
|
|
8041
|
+
__param(0, checkType('object', {
|
|
8042
|
+
'count?': checkData('number', { min: 1, default: 1 }),
|
|
8043
|
+
'sourceType?': checkData('array<string>', {
|
|
8044
|
+
values: ['album', 'camera'],
|
|
8045
|
+
default: ['album', 'camera']
|
|
8046
|
+
}),
|
|
8047
|
+
'cameraType?': checkData('string', {
|
|
8048
|
+
values: ['back', 'front'],
|
|
8049
|
+
default: ['front']
|
|
8050
|
+
})
|
|
8051
|
+
}))
|
|
8052
|
+
], SDKCreator.prototype, "chooseImage", null);
|
|
7988
8053
|
SDKCreator = __decorate([
|
|
7989
8054
|
DecorateAll(centralizedFunctionHandler)
|
|
7990
8055
|
], SDKCreator);
|
package/dist/index.es.js
CHANGED
|
@@ -2256,7 +2256,7 @@ const APIS = {
|
|
|
2256
2256
|
GET_ACCESS_TOKEN: 'https://h5.zalo.me/openapi/access_token',
|
|
2257
2257
|
GET_ACCESS_TOKEN_V3: 'https://oauth.zaloapp.com/v3/access_token',
|
|
2258
2258
|
GET_LIST_USER_INFO: 'https://graph.zalo.me/v2.0/me/friends/list',
|
|
2259
|
-
CREATE_ORDER: 'https://
|
|
2259
|
+
CREATE_ORDER: 'https://payment-mini.zalo.me/api/order/create',
|
|
2260
2260
|
GET_APP_INFO: 'https://h5.zalo.me/apps/get-info',
|
|
2261
2261
|
SEND_ACTION_LOG: 'https://h5.zalo.me/log/async'
|
|
2262
2262
|
};
|
|
@@ -2890,11 +2890,11 @@ const ACTION_LEFT_BUTTON_TYPE = {
|
|
|
2890
2890
|
const SHOW_ACTION_BAR = 5;
|
|
2891
2891
|
const HIDE_ACTION_BAR = 6;
|
|
2892
2892
|
const PAYMENT_APIS = {
|
|
2893
|
-
CREATE_ORDER: 'https://
|
|
2894
|
-
GET_TRANSACTION: 'https://
|
|
2895
|
-
GET_ORDER_STATUS: 'https://
|
|
2893
|
+
CREATE_ORDER: 'https://payment-mini.zalo.me/api/order/create',
|
|
2894
|
+
GET_TRANSACTION: 'https://payment-mini.zalo.me/api/transaction',
|
|
2895
|
+
GET_ORDER_STATUS: 'https://payment-mini.zalo.me/api/transaction/get-status'
|
|
2896
2896
|
};
|
|
2897
|
-
const PAYMENT_H5_URL = 'https://
|
|
2897
|
+
const PAYMENT_H5_URL = 'https://payment-mini.zalo.me';
|
|
2898
2898
|
|
|
2899
2899
|
class AppError {
|
|
2900
2900
|
constructor(code, msg, api) {
|
|
@@ -3307,6 +3307,12 @@ const checkData = (types, option) => (data) => {
|
|
|
3307
3307
|
}
|
|
3308
3308
|
if (option) {
|
|
3309
3309
|
if (Array.isArray(option === null || option === void 0 ? void 0 : option.values)) {
|
|
3310
|
+
if (Array.isArray(data)) {
|
|
3311
|
+
return {
|
|
3312
|
+
error: data.some((item) => { var _a; return !((_a = option === null || option === void 0 ? void 0 : option.values) === null || _a === void 0 ? void 0 : _a.includes(item)); }),
|
|
3313
|
+
errorMessage: option === null || option === void 0 ? void 0 : option.values.toString()
|
|
3314
|
+
};
|
|
3315
|
+
}
|
|
3310
3316
|
return {
|
|
3311
3317
|
error: !(option === null || option === void 0 ? void 0 : option.values.includes(data)),
|
|
3312
3318
|
errorMessage: option === null || option === void 0 ? void 0 : option.values.toString()
|
|
@@ -3747,7 +3753,7 @@ class ZMPEEmitter extends eventemitter3 {
|
|
|
3747
3753
|
}
|
|
3748
3754
|
}
|
|
3749
3755
|
|
|
3750
|
-
var version$1 = "2.23.
|
|
3756
|
+
var version$1 = "2.23.5-rc.0";
|
|
3751
3757
|
|
|
3752
3758
|
class Basics {
|
|
3753
3759
|
/**
|
|
@@ -5682,7 +5688,6 @@ class OpenApi {
|
|
|
5682
5688
|
avatar: resData.picture && resData.picture.data && resData.picture.data.url,
|
|
5683
5689
|
idByOA: resData.user_id_by_oa
|
|
5684
5690
|
};
|
|
5685
|
-
console.warn("'birthday' and 'gender' are deprecated");
|
|
5686
5691
|
return userInfo;
|
|
5687
5692
|
}));
|
|
5688
5693
|
return {
|
|
@@ -5703,9 +5708,12 @@ class OpenApi {
|
|
|
5703
5708
|
return yield this.getJSBridge().callNative(ACTION.MP_GET_NUMBER, {}, {
|
|
5704
5709
|
isMultiCallback: true,
|
|
5705
5710
|
successCallback: (data) => {
|
|
5706
|
-
const res = {
|
|
5707
|
-
|
|
5708
|
-
|
|
5711
|
+
const res = {};
|
|
5712
|
+
if (data.token) {
|
|
5713
|
+
res.token = data.token;
|
|
5714
|
+
return Promise.resolve(res);
|
|
5715
|
+
}
|
|
5716
|
+
res.number = data;
|
|
5709
5717
|
return Promise.resolve(res);
|
|
5710
5718
|
},
|
|
5711
5719
|
delay: this.isIOS ? 400 : 0
|
|
@@ -5822,16 +5830,15 @@ class Location {
|
|
|
5822
5830
|
isMultiCallback: true,
|
|
5823
5831
|
haveTimeout: false,
|
|
5824
5832
|
successCallback: (data) => {
|
|
5825
|
-
const res = {
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
};
|
|
5833
|
+
const res = {};
|
|
5834
|
+
if (data.token) {
|
|
5835
|
+
res.token = data.token;
|
|
5836
|
+
return Promise.resolve(res);
|
|
5837
|
+
}
|
|
5838
|
+
res.latitude = data.latitude;
|
|
5839
|
+
res.longitude = data.longitude;
|
|
5840
|
+
res.timestamp = data.timestamp;
|
|
5841
|
+
res.provider = data.provider;
|
|
5835
5842
|
return Promise.resolve(res);
|
|
5836
5843
|
},
|
|
5837
5844
|
delay: this.isIOS ? 400 : 0
|
|
@@ -8904,7 +8911,7 @@ let SDKCreator = class SDKCreator {
|
|
|
8904
8911
|
openWebview(object) {
|
|
8905
8912
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8906
8913
|
const url = new URL(object.url);
|
|
8907
|
-
const isVNPayLink = url.href.includes(
|
|
8914
|
+
const isVNPayLink = url.href.includes('vnpay');
|
|
8908
8915
|
const typeInapp = url.searchParams.get('typeInapp');
|
|
8909
8916
|
if (!isVNPayLink && _.isEmpty(typeInapp)) {
|
|
8910
8917
|
url.searchParams.set('typeInapp', '1');
|
|
@@ -9085,6 +9092,51 @@ let SDKCreator = class SDKCreator {
|
|
|
9085
9092
|
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openOutApp(encodeURI(object.url));
|
|
9086
9093
|
});
|
|
9087
9094
|
}
|
|
9095
|
+
chooseImage(object) {
|
|
9096
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9097
|
+
const sourceType = object.sourceType || ['album', 'camera'];
|
|
9098
|
+
const cameraType = object.cameraType || 'front';
|
|
9099
|
+
const count = object.count || 1;
|
|
9100
|
+
const inputEl = document.createElement('input');
|
|
9101
|
+
inputEl.type = 'file';
|
|
9102
|
+
inputEl.multiple = count > 1;
|
|
9103
|
+
inputEl.accept = 'image/*';
|
|
9104
|
+
inputEl.style.display = 'none';
|
|
9105
|
+
if (sourceType.length === 1 && sourceType.includes('camera')) {
|
|
9106
|
+
inputEl.accept =
|
|
9107
|
+
cameraType === 'front'
|
|
9108
|
+
? 'zcamera/photo-frontfacing'
|
|
9109
|
+
: 'zcamera/photo-backfacing';
|
|
9110
|
+
inputEl.capture =
|
|
9111
|
+
cameraType === 'front' ? 'user' : 'environment';
|
|
9112
|
+
}
|
|
9113
|
+
return new Promise((resolve, reject) => {
|
|
9114
|
+
inputEl.addEventListener('change', (event) => {
|
|
9115
|
+
var _a;
|
|
9116
|
+
const fileList = ((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.files) || [];
|
|
9117
|
+
if (fileList.length > count) {
|
|
9118
|
+
reject(new Error(`You are only allowed to choose a maximum of ${count} images at a time`));
|
|
9119
|
+
}
|
|
9120
|
+
else {
|
|
9121
|
+
const result = {
|
|
9122
|
+
filePaths: [],
|
|
9123
|
+
tempFiles: []
|
|
9124
|
+
};
|
|
9125
|
+
Array.from(fileList).forEach((file) => {
|
|
9126
|
+
result.filePaths.push(URL.createObjectURL(file));
|
|
9127
|
+
result.tempFiles.push({
|
|
9128
|
+
path: URL.createObjectURL(file),
|
|
9129
|
+
size: file.size
|
|
9130
|
+
});
|
|
9131
|
+
});
|
|
9132
|
+
resolve(result);
|
|
9133
|
+
}
|
|
9134
|
+
});
|
|
9135
|
+
document.body.appendChild(inputEl);
|
|
9136
|
+
inputEl.click();
|
|
9137
|
+
});
|
|
9138
|
+
});
|
|
9139
|
+
}
|
|
9088
9140
|
};
|
|
9089
9141
|
_SDKCreator_sdkService = new WeakMap();
|
|
9090
9142
|
__decorate([
|
|
@@ -9340,6 +9392,19 @@ __decorate([
|
|
|
9340
9392
|
url: checkData('url'),
|
|
9341
9393
|
}))
|
|
9342
9394
|
], SDKCreator.prototype, "openOutApp", null);
|
|
9395
|
+
__decorate([
|
|
9396
|
+
__param(0, checkType('object', {
|
|
9397
|
+
'count?': checkData('number', { min: 1, default: 1 }),
|
|
9398
|
+
'sourceType?': checkData('array<string>', {
|
|
9399
|
+
values: ['album', 'camera'],
|
|
9400
|
+
default: ['album', 'camera']
|
|
9401
|
+
}),
|
|
9402
|
+
'cameraType?': checkData('string', {
|
|
9403
|
+
values: ['back', 'front'],
|
|
9404
|
+
default: ['front']
|
|
9405
|
+
})
|
|
9406
|
+
}))
|
|
9407
|
+
], SDKCreator.prototype, "chooseImage", null);
|
|
9343
9408
|
SDKCreator = __decorate([
|
|
9344
9409
|
DecorateAll(centralizedFunctionHandler)
|
|
9345
9410
|
], SDKCreator);
|