zmp-sdk 2.23.4-0 → 2.23.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/changelog/dist/changelog-setup.dev.js +24 -0
- package/dist/browser.min.js +71 -7
- package/dist/index.es.js +71 -7
- 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/inputData.d.ts +5 -0
- package/package.json +1 -1
|
@@ -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.4
|
|
3759
|
+
var version = "2.23.4";
|
|
3754
3760
|
|
|
3755
3761
|
class Basics {
|
|
3756
3762
|
/**
|
|
@@ -7549,7 +7555,7 @@
|
|
|
7549
7555
|
openWebview(object) {
|
|
7550
7556
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7551
7557
|
const url = new URL(object.url);
|
|
7552
|
-
const isVNPayLink = url.href.includes(
|
|
7558
|
+
const isVNPayLink = url.href.includes('vnpay');
|
|
7553
7559
|
const typeInapp = url.searchParams.get('typeInapp');
|
|
7554
7560
|
if (!isVNPayLink && _.isEmpty(typeInapp)) {
|
|
7555
7561
|
url.searchParams.set('typeInapp', '1');
|
|
@@ -7730,6 +7736,51 @@
|
|
|
7730
7736
|
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openOutApp(encodeURI(object.url));
|
|
7731
7737
|
});
|
|
7732
7738
|
}
|
|
7739
|
+
chooseImage(object) {
|
|
7740
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
7741
|
+
const sourceType = object.sourceType || ['album', 'camera'];
|
|
7742
|
+
const cameraType = object.cameraType || 'front';
|
|
7743
|
+
const count = object.count || 1;
|
|
7744
|
+
const inputEl = document.createElement('input');
|
|
7745
|
+
inputEl.type = 'file';
|
|
7746
|
+
inputEl.multiple = count > 1;
|
|
7747
|
+
inputEl.accept = 'image/*';
|
|
7748
|
+
inputEl.style.display = 'none';
|
|
7749
|
+
if (sourceType.length === 1 && sourceType.includes('camera')) {
|
|
7750
|
+
inputEl.accept =
|
|
7751
|
+
cameraType === 'front'
|
|
7752
|
+
? 'zcamera/photo-frontfacing'
|
|
7753
|
+
: 'zcamera/photo-backfacing';
|
|
7754
|
+
inputEl.capture =
|
|
7755
|
+
cameraType === 'front' ? 'user' : 'environment';
|
|
7756
|
+
}
|
|
7757
|
+
return new Promise((resolve, reject) => {
|
|
7758
|
+
inputEl.addEventListener('change', (event) => {
|
|
7759
|
+
var _a;
|
|
7760
|
+
const fileList = ((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.files) || [];
|
|
7761
|
+
if (fileList.length > count) {
|
|
7762
|
+
reject(new Error(`You are only allowed to choose a maximum of ${count} images at a time`));
|
|
7763
|
+
}
|
|
7764
|
+
else {
|
|
7765
|
+
const result = {
|
|
7766
|
+
filePaths: [],
|
|
7767
|
+
tempFiles: []
|
|
7768
|
+
};
|
|
7769
|
+
Array.from(fileList).forEach((file) => {
|
|
7770
|
+
result.filePaths.push(URL.createObjectURL(file));
|
|
7771
|
+
result.tempFiles.push({
|
|
7772
|
+
path: URL.createObjectURL(file),
|
|
7773
|
+
size: file.size
|
|
7774
|
+
});
|
|
7775
|
+
});
|
|
7776
|
+
resolve(result);
|
|
7777
|
+
}
|
|
7778
|
+
});
|
|
7779
|
+
document.body.appendChild(inputEl);
|
|
7780
|
+
inputEl.click();
|
|
7781
|
+
});
|
|
7782
|
+
});
|
|
7783
|
+
}
|
|
7733
7784
|
};
|
|
7734
7785
|
_SDKCreator_sdkService = new WeakMap();
|
|
7735
7786
|
__decorate([
|
|
@@ -7985,6 +8036,19 @@
|
|
|
7985
8036
|
url: checkData('url'),
|
|
7986
8037
|
}))
|
|
7987
8038
|
], SDKCreator.prototype, "openOutApp", null);
|
|
8039
|
+
__decorate([
|
|
8040
|
+
__param(0, checkType('object', {
|
|
8041
|
+
'count?': checkData('number', { min: 1, default: 1 }),
|
|
8042
|
+
'sourceType?': checkData('array<string>', {
|
|
8043
|
+
values: ['album', 'camera'],
|
|
8044
|
+
default: ['album', 'camera']
|
|
8045
|
+
}),
|
|
8046
|
+
'cameraType?': checkData('string', {
|
|
8047
|
+
values: ['back', 'front'],
|
|
8048
|
+
default: ['front']
|
|
8049
|
+
})
|
|
8050
|
+
}))
|
|
8051
|
+
], SDKCreator.prototype, "chooseImage", null);
|
|
7988
8052
|
SDKCreator = __decorate([
|
|
7989
8053
|
DecorateAll(centralizedFunctionHandler)
|
|
7990
8054
|
], 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.4
|
|
3756
|
+
var version$1 = "2.23.4";
|
|
3751
3757
|
|
|
3752
3758
|
class Basics {
|
|
3753
3759
|
/**
|
|
@@ -8904,7 +8910,7 @@ let SDKCreator = class SDKCreator {
|
|
|
8904
8910
|
openWebview(object) {
|
|
8905
8911
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8906
8912
|
const url = new URL(object.url);
|
|
8907
|
-
const isVNPayLink = url.href.includes(
|
|
8913
|
+
const isVNPayLink = url.href.includes('vnpay');
|
|
8908
8914
|
const typeInapp = url.searchParams.get('typeInapp');
|
|
8909
8915
|
if (!isVNPayLink && _.isEmpty(typeInapp)) {
|
|
8910
8916
|
url.searchParams.set('typeInapp', '1');
|
|
@@ -9085,6 +9091,51 @@ let SDKCreator = class SDKCreator {
|
|
|
9085
9091
|
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openOutApp(encodeURI(object.url));
|
|
9086
9092
|
});
|
|
9087
9093
|
}
|
|
9094
|
+
chooseImage(object) {
|
|
9095
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9096
|
+
const sourceType = object.sourceType || ['album', 'camera'];
|
|
9097
|
+
const cameraType = object.cameraType || 'front';
|
|
9098
|
+
const count = object.count || 1;
|
|
9099
|
+
const inputEl = document.createElement('input');
|
|
9100
|
+
inputEl.type = 'file';
|
|
9101
|
+
inputEl.multiple = count > 1;
|
|
9102
|
+
inputEl.accept = 'image/*';
|
|
9103
|
+
inputEl.style.display = 'none';
|
|
9104
|
+
if (sourceType.length === 1 && sourceType.includes('camera')) {
|
|
9105
|
+
inputEl.accept =
|
|
9106
|
+
cameraType === 'front'
|
|
9107
|
+
? 'zcamera/photo-frontfacing'
|
|
9108
|
+
: 'zcamera/photo-backfacing';
|
|
9109
|
+
inputEl.capture =
|
|
9110
|
+
cameraType === 'front' ? 'user' : 'environment';
|
|
9111
|
+
}
|
|
9112
|
+
return new Promise((resolve, reject) => {
|
|
9113
|
+
inputEl.addEventListener('change', (event) => {
|
|
9114
|
+
var _a;
|
|
9115
|
+
const fileList = ((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.files) || [];
|
|
9116
|
+
if (fileList.length > count) {
|
|
9117
|
+
reject(new Error(`You are only allowed to choose a maximum of ${count} images at a time`));
|
|
9118
|
+
}
|
|
9119
|
+
else {
|
|
9120
|
+
const result = {
|
|
9121
|
+
filePaths: [],
|
|
9122
|
+
tempFiles: []
|
|
9123
|
+
};
|
|
9124
|
+
Array.from(fileList).forEach((file) => {
|
|
9125
|
+
result.filePaths.push(URL.createObjectURL(file));
|
|
9126
|
+
result.tempFiles.push({
|
|
9127
|
+
path: URL.createObjectURL(file),
|
|
9128
|
+
size: file.size
|
|
9129
|
+
});
|
|
9130
|
+
});
|
|
9131
|
+
resolve(result);
|
|
9132
|
+
}
|
|
9133
|
+
});
|
|
9134
|
+
document.body.appendChild(inputEl);
|
|
9135
|
+
inputEl.click();
|
|
9136
|
+
});
|
|
9137
|
+
});
|
|
9138
|
+
}
|
|
9088
9139
|
};
|
|
9089
9140
|
_SDKCreator_sdkService = new WeakMap();
|
|
9090
9141
|
__decorate([
|
|
@@ -9340,6 +9391,19 @@ __decorate([
|
|
|
9340
9391
|
url: checkData('url'),
|
|
9341
9392
|
}))
|
|
9342
9393
|
], SDKCreator.prototype, "openOutApp", null);
|
|
9394
|
+
__decorate([
|
|
9395
|
+
__param(0, checkType('object', {
|
|
9396
|
+
'count?': checkData('number', { min: 1, default: 1 }),
|
|
9397
|
+
'sourceType?': checkData('array<string>', {
|
|
9398
|
+
values: ['album', 'camera'],
|
|
9399
|
+
default: ['album', 'camera']
|
|
9400
|
+
}),
|
|
9401
|
+
'cameraType?': checkData('string', {
|
|
9402
|
+
values: ['back', 'front'],
|
|
9403
|
+
default: ['front']
|
|
9404
|
+
})
|
|
9405
|
+
}))
|
|
9406
|
+
], SDKCreator.prototype, "chooseImage", null);
|
|
9343
9407
|
SDKCreator = __decorate([
|
|
9344
9408
|
DecorateAll(centralizedFunctionHandler)
|
|
9345
9409
|
], SDKCreator);
|