zmp-sdk 2.18.7 → 2.18.10
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/dist/browser.min.js +35 -24
- package/dist/index.es.js +35 -24
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/types/src/services/mock-mp-service.d.ts +2 -2
- package/dist/types/src/services/window.d.ts +1 -1
- package/dist/types/src/services/zalo.d.ts +1 -1
- package/dist/types/src/types/enum.d.ts +1 -3
- package/dist/types/src/types/inputData.d.ts +7 -5
- package/dist/types/src/types/interface.d.ts +2 -2
- package/dist/types/src/utils/common.d.ts +1 -0
- package/package.json +1 -1
package/dist/browser.min.js
CHANGED
|
@@ -2170,8 +2170,6 @@
|
|
|
2170
2170
|
MediaPickerType[MediaPickerType["photo"] = 4] = "photo";
|
|
2171
2171
|
MediaPickerType[MediaPickerType["video"] = 5] = "video";
|
|
2172
2172
|
MediaPickerType[MediaPickerType["file"] = 6] = "file";
|
|
2173
|
-
MediaPickerType[MediaPickerType["multi_photo"] = 7] = "multi_photo";
|
|
2174
|
-
MediaPickerType[MediaPickerType["multi_video"] = 8] = "multi_video";
|
|
2175
2173
|
})(MediaPickerType || (MediaPickerType = {}));
|
|
2176
2174
|
|
|
2177
2175
|
const readCookie = (name) => {
|
|
@@ -2262,7 +2260,6 @@
|
|
|
2262
2260
|
'4G': isAndroid ? 13 : 2
|
|
2263
2261
|
});
|
|
2264
2262
|
const MEDIA_PICKER_LIMIT = 1 * MB;
|
|
2265
|
-
const MEDIA_PICKER_UPLOAD_SERVER = 'https://zapi-server.tungnt.xyz/upload/photos';
|
|
2266
2263
|
const ACTION = {
|
|
2267
2264
|
GET_DOWNLOADED_STICKER: {
|
|
2268
2265
|
name: 'action.get.downloaded.sticker',
|
|
@@ -2581,7 +2578,7 @@
|
|
|
2581
2578
|
},
|
|
2582
2579
|
PICK_MEDIA: {
|
|
2583
2580
|
name: 'action.pick.media',
|
|
2584
|
-
version_live: { iOS:
|
|
2581
|
+
version_live: { iOS: 440 }
|
|
2585
2582
|
},
|
|
2586
2583
|
MP_CLOSE_LOADINGVIEW: {
|
|
2587
2584
|
name: 'action.mp.close.loadingview'
|
|
@@ -4057,7 +4054,7 @@
|
|
|
4057
4054
|
}
|
|
4058
4055
|
_ZJSBridgeProvider_bridge = new WeakMap();
|
|
4059
4056
|
|
|
4060
|
-
var version = "2.18.
|
|
4057
|
+
var version = "2.18.10";
|
|
4061
4058
|
|
|
4062
4059
|
class Basics {
|
|
4063
4060
|
/**
|
|
@@ -5533,14 +5530,21 @@
|
|
|
5533
5530
|
return [key, value].join('=');
|
|
5534
5531
|
})
|
|
5535
5532
|
.join('&');
|
|
5536
|
-
|
|
5533
|
+
let appInfo;
|
|
5534
|
+
try {
|
|
5535
|
+
appInfo = yield getAppInfo(appId, 0);
|
|
5536
|
+
}
|
|
5537
|
+
catch (error) { }
|
|
5538
|
+
const mpInfo = {
|
|
5539
|
+
appId: appId
|
|
5540
|
+
};
|
|
5541
|
+
if (appInfo) {
|
|
5542
|
+
mpInfo.appName = appInfo.name;
|
|
5543
|
+
mpInfo.appAvtUrl = appInfo.logoUrl;
|
|
5544
|
+
}
|
|
5537
5545
|
yield this.callNative(ACTION.OPEN_MP, {
|
|
5538
5546
|
mpUrl: `${MINI_APP_INTERNAL_LINK}/${appId}/${queryParamString.length > 0 ? '?' + queryParamString : ''}`,
|
|
5539
|
-
mpInfo:
|
|
5540
|
-
appId: appId,
|
|
5541
|
-
appAvtUrl: appInfo.logoUrl || '',
|
|
5542
|
-
appName: appInfo.name || '',
|
|
5543
|
-
}
|
|
5547
|
+
mpInfo: mpInfo
|
|
5544
5548
|
});
|
|
5545
5549
|
});
|
|
5546
5550
|
}
|
|
@@ -5552,10 +5556,10 @@
|
|
|
5552
5556
|
* @category Window
|
|
5553
5557
|
*
|
|
5554
5558
|
*/
|
|
5555
|
-
static openWebview(
|
|
5559
|
+
static openWebview(url) {
|
|
5556
5560
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5557
5561
|
yield this.callNative(ACTION.OPEN_INAPP, {
|
|
5558
|
-
url:
|
|
5562
|
+
url: url
|
|
5559
5563
|
});
|
|
5560
5564
|
});
|
|
5561
5565
|
}
|
|
@@ -5891,11 +5895,11 @@
|
|
|
5891
5895
|
data: {
|
|
5892
5896
|
ZInstantAPIInfo: {
|
|
5893
5897
|
url: `${zmpShareableInfo.zinstantApi}`,
|
|
5894
|
-
zinstantdata_id: `templateId
|
|
5898
|
+
zinstantdata_id: `templateId=${zmpShareableInfo.ztemplateId}&appId=${this.getAppId()}&shareId=${zmpShareableInfo.shareId}`
|
|
5895
5899
|
},
|
|
5896
5900
|
previewMsgText: {
|
|
5897
5901
|
msg: {
|
|
5898
|
-
en: 'Mini
|
|
5902
|
+
en: 'Zalo Mini Program',
|
|
5899
5903
|
vi: 'Chương trình nhỏ'
|
|
5900
5904
|
}
|
|
5901
5905
|
},
|
|
@@ -6003,12 +6007,12 @@
|
|
|
6003
6007
|
* @category Zalo
|
|
6004
6008
|
*
|
|
6005
6009
|
*/
|
|
6006
|
-
static openMediaPicker(type, editView, silentRequest, maxSelectItem) {
|
|
6010
|
+
static openMediaPicker(type, serverUpload, maxItemSize, editView, silentRequest, maxSelectItem) {
|
|
6007
6011
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6008
6012
|
const uploadSetting = {
|
|
6009
6013
|
type: 0,
|
|
6010
|
-
url:
|
|
6011
|
-
maxSize: MEDIA_PICKER_LIMIT
|
|
6014
|
+
url: serverUpload,
|
|
6015
|
+
maxSize: maxItemSize || MEDIA_PICKER_LIMIT
|
|
6012
6016
|
};
|
|
6013
6017
|
const defaultEditView = {
|
|
6014
6018
|
enable: 1,
|
|
@@ -6641,8 +6645,8 @@
|
|
|
6641
6645
|
this.vibrate = () => {
|
|
6642
6646
|
return Promise.resolve();
|
|
6643
6647
|
};
|
|
6644
|
-
this.openWebview = (
|
|
6645
|
-
location.replace(
|
|
6648
|
+
this.openWebview = (url) => {
|
|
6649
|
+
location.replace(url);
|
|
6646
6650
|
return Promise.resolve();
|
|
6647
6651
|
};
|
|
6648
6652
|
this.getRouteParams = Routing.getRouteParams;
|
|
@@ -6699,7 +6703,7 @@
|
|
|
6699
6703
|
removeAllListeners(event) {
|
|
6700
6704
|
throw new Error('Method not implemented.');
|
|
6701
6705
|
}
|
|
6702
|
-
openMediaPicker(type, editView, silentRequest, maxSelectItem) {
|
|
6706
|
+
openMediaPicker(type, serverUpload, maxItemSize, editView, silentRequest, maxSelectItem) {
|
|
6703
6707
|
console.warn('This api only works on zalo app');
|
|
6704
6708
|
return Promise.resolve({
|
|
6705
6709
|
urls: []
|
|
@@ -7156,7 +7160,12 @@
|
|
|
7156
7160
|
}
|
|
7157
7161
|
openWebview(object) {
|
|
7158
7162
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7159
|
-
|
|
7163
|
+
const url = new URL(object.url);
|
|
7164
|
+
const typeInapp = url.searchParams.get("typeInapp");
|
|
7165
|
+
if (_.isEmpty(typeInapp)) {
|
|
7166
|
+
url.searchParams.set("typeInapp", "1");
|
|
7167
|
+
}
|
|
7168
|
+
yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openWebview(url.href);
|
|
7160
7169
|
});
|
|
7161
7170
|
}
|
|
7162
7171
|
getRouteParams() {
|
|
@@ -7267,7 +7276,7 @@
|
|
|
7267
7276
|
editView.aspect_ratio = (_c = object.editView) === null || _c === void 0 ? void 0 : _c.aspectRatio;
|
|
7268
7277
|
const silentRequest = object.silentRequest === true ? 1 : 0;
|
|
7269
7278
|
const maxSelectItem = object.maxSelectItem;
|
|
7270
|
-
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openMediaPicker(object.type, editView, silentRequest, maxSelectItem);
|
|
7279
|
+
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openMediaPicker(object.type, object.serverUploadUrl, object.maxItemSize, editView, silentRequest, maxSelectItem);
|
|
7271
7280
|
});
|
|
7272
7281
|
}
|
|
7273
7282
|
getShareableLink(object) {
|
|
@@ -7627,7 +7636,7 @@
|
|
|
7627
7636
|
handleError,
|
|
7628
7637
|
validate,
|
|
7629
7638
|
__param(0, checkType('object', {
|
|
7630
|
-
url: checkData('
|
|
7639
|
+
url: checkData('url')
|
|
7631
7640
|
}))
|
|
7632
7641
|
], SDKCreator.prototype, "openWebview", null);
|
|
7633
7642
|
__decorate([
|
|
@@ -7671,6 +7680,8 @@
|
|
|
7671
7680
|
type: checkData('string', {
|
|
7672
7681
|
values: ['photo', 'video', 'file', 'multi_photo', 'multi_video']
|
|
7673
7682
|
}),
|
|
7683
|
+
'serverUploadUrl': checkData('url'),
|
|
7684
|
+
'maxItemSize?': checkData('number', { min: 0 }),
|
|
7674
7685
|
'editView?': checkData('object'),
|
|
7675
7686
|
'editView.enable?': checkData('boolean'),
|
|
7676
7687
|
'editView.aspectRatio?': checkData('string', { regex: /^\d+:\d+$/ }),
|
package/dist/index.es.js
CHANGED
|
@@ -2167,8 +2167,6 @@ var MediaPickerType;
|
|
|
2167
2167
|
MediaPickerType[MediaPickerType["photo"] = 4] = "photo";
|
|
2168
2168
|
MediaPickerType[MediaPickerType["video"] = 5] = "video";
|
|
2169
2169
|
MediaPickerType[MediaPickerType["file"] = 6] = "file";
|
|
2170
|
-
MediaPickerType[MediaPickerType["multi_photo"] = 7] = "multi_photo";
|
|
2171
|
-
MediaPickerType[MediaPickerType["multi_video"] = 8] = "multi_video";
|
|
2172
2170
|
})(MediaPickerType || (MediaPickerType = {}));
|
|
2173
2171
|
|
|
2174
2172
|
const readCookie = (name) => {
|
|
@@ -2259,7 +2257,6 @@ const NETWORK_TYPE = (isAndroid) => ({
|
|
|
2259
2257
|
'4G': isAndroid ? 13 : 2
|
|
2260
2258
|
});
|
|
2261
2259
|
const MEDIA_PICKER_LIMIT = 1 * MB;
|
|
2262
|
-
const MEDIA_PICKER_UPLOAD_SERVER = 'https://zapi-server.tungnt.xyz/upload/photos';
|
|
2263
2260
|
const ACTION = {
|
|
2264
2261
|
GET_DOWNLOADED_STICKER: {
|
|
2265
2262
|
name: 'action.get.downloaded.sticker',
|
|
@@ -2578,7 +2575,7 @@ const ACTION = {
|
|
|
2578
2575
|
},
|
|
2579
2576
|
PICK_MEDIA: {
|
|
2580
2577
|
name: 'action.pick.media',
|
|
2581
|
-
version_live: { iOS:
|
|
2578
|
+
version_live: { iOS: 440 }
|
|
2582
2579
|
},
|
|
2583
2580
|
MP_CLOSE_LOADINGVIEW: {
|
|
2584
2581
|
name: 'action.mp.close.loadingview'
|
|
@@ -4054,7 +4051,7 @@ class ZJSBridgeProvider {
|
|
|
4054
4051
|
}
|
|
4055
4052
|
_ZJSBridgeProvider_bridge = new WeakMap();
|
|
4056
4053
|
|
|
4057
|
-
var version$1 = "2.18.
|
|
4054
|
+
var version$1 = "2.18.10";
|
|
4058
4055
|
|
|
4059
4056
|
class Basics {
|
|
4060
4057
|
/**
|
|
@@ -5530,14 +5527,21 @@ class Window {
|
|
|
5530
5527
|
return [key, value].join('=');
|
|
5531
5528
|
})
|
|
5532
5529
|
.join('&');
|
|
5533
|
-
|
|
5530
|
+
let appInfo;
|
|
5531
|
+
try {
|
|
5532
|
+
appInfo = yield getAppInfo(appId, 0);
|
|
5533
|
+
}
|
|
5534
|
+
catch (error) { }
|
|
5535
|
+
const mpInfo = {
|
|
5536
|
+
appId: appId
|
|
5537
|
+
};
|
|
5538
|
+
if (appInfo) {
|
|
5539
|
+
mpInfo.appName = appInfo.name;
|
|
5540
|
+
mpInfo.appAvtUrl = appInfo.logoUrl;
|
|
5541
|
+
}
|
|
5534
5542
|
yield this.callNative(ACTION.OPEN_MP, {
|
|
5535
5543
|
mpUrl: `${MINI_APP_INTERNAL_LINK}/${appId}/${queryParamString.length > 0 ? '?' + queryParamString : ''}`,
|
|
5536
|
-
mpInfo:
|
|
5537
|
-
appId: appId,
|
|
5538
|
-
appAvtUrl: appInfo.logoUrl || '',
|
|
5539
|
-
appName: appInfo.name || '',
|
|
5540
|
-
}
|
|
5544
|
+
mpInfo: mpInfo
|
|
5541
5545
|
});
|
|
5542
5546
|
});
|
|
5543
5547
|
}
|
|
@@ -5549,10 +5553,10 @@ class Window {
|
|
|
5549
5553
|
* @category Window
|
|
5550
5554
|
*
|
|
5551
5555
|
*/
|
|
5552
|
-
static openWebview(
|
|
5556
|
+
static openWebview(url) {
|
|
5553
5557
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5554
5558
|
yield this.callNative(ACTION.OPEN_INAPP, {
|
|
5555
|
-
url:
|
|
5559
|
+
url: url
|
|
5556
5560
|
});
|
|
5557
5561
|
});
|
|
5558
5562
|
}
|
|
@@ -5888,11 +5892,11 @@ class Zalo {
|
|
|
5888
5892
|
data: {
|
|
5889
5893
|
ZInstantAPIInfo: {
|
|
5890
5894
|
url: `${zmpShareableInfo.zinstantApi}`,
|
|
5891
|
-
zinstantdata_id: `templateId
|
|
5895
|
+
zinstantdata_id: `templateId=${zmpShareableInfo.ztemplateId}&appId=${this.getAppId()}&shareId=${zmpShareableInfo.shareId}`
|
|
5892
5896
|
},
|
|
5893
5897
|
previewMsgText: {
|
|
5894
5898
|
msg: {
|
|
5895
|
-
en: 'Mini
|
|
5899
|
+
en: 'Zalo Mini Program',
|
|
5896
5900
|
vi: 'Chương trình nhỏ'
|
|
5897
5901
|
}
|
|
5898
5902
|
},
|
|
@@ -6000,12 +6004,12 @@ class Zalo {
|
|
|
6000
6004
|
* @category Zalo
|
|
6001
6005
|
*
|
|
6002
6006
|
*/
|
|
6003
|
-
static openMediaPicker(type, editView, silentRequest, maxSelectItem) {
|
|
6007
|
+
static openMediaPicker(type, serverUpload, maxItemSize, editView, silentRequest, maxSelectItem) {
|
|
6004
6008
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6005
6009
|
const uploadSetting = {
|
|
6006
6010
|
type: 0,
|
|
6007
|
-
url:
|
|
6008
|
-
maxSize: MEDIA_PICKER_LIMIT
|
|
6011
|
+
url: serverUpload,
|
|
6012
|
+
maxSize: maxItemSize || MEDIA_PICKER_LIMIT
|
|
6009
6013
|
};
|
|
6010
6014
|
const defaultEditView = {
|
|
6011
6015
|
enable: 1,
|
|
@@ -6638,8 +6642,8 @@ class MockSDKService {
|
|
|
6638
6642
|
this.vibrate = () => {
|
|
6639
6643
|
return Promise.resolve();
|
|
6640
6644
|
};
|
|
6641
|
-
this.openWebview = (
|
|
6642
|
-
location.replace(
|
|
6645
|
+
this.openWebview = (url) => {
|
|
6646
|
+
location.replace(url);
|
|
6643
6647
|
return Promise.resolve();
|
|
6644
6648
|
};
|
|
6645
6649
|
this.getRouteParams = Routing.getRouteParams;
|
|
@@ -6696,7 +6700,7 @@ class MockSDKService {
|
|
|
6696
6700
|
removeAllListeners(event) {
|
|
6697
6701
|
throw new Error('Method not implemented.');
|
|
6698
6702
|
}
|
|
6699
|
-
openMediaPicker(type, editView, silentRequest, maxSelectItem) {
|
|
6703
|
+
openMediaPicker(type, serverUpload, maxItemSize, editView, silentRequest, maxSelectItem) {
|
|
6700
6704
|
console.warn('This api only works on zalo app');
|
|
6701
6705
|
return Promise.resolve({
|
|
6702
6706
|
urls: []
|
|
@@ -8511,7 +8515,12 @@ class SDKCreator {
|
|
|
8511
8515
|
}
|
|
8512
8516
|
openWebview(object) {
|
|
8513
8517
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8514
|
-
|
|
8518
|
+
const url = new URL(object.url);
|
|
8519
|
+
const typeInapp = url.searchParams.get("typeInapp");
|
|
8520
|
+
if (_.isEmpty(typeInapp)) {
|
|
8521
|
+
url.searchParams.set("typeInapp", "1");
|
|
8522
|
+
}
|
|
8523
|
+
yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openWebview(url.href);
|
|
8515
8524
|
});
|
|
8516
8525
|
}
|
|
8517
8526
|
getRouteParams() {
|
|
@@ -8622,7 +8631,7 @@ class SDKCreator {
|
|
|
8622
8631
|
editView.aspect_ratio = (_c = object.editView) === null || _c === void 0 ? void 0 : _c.aspectRatio;
|
|
8623
8632
|
const silentRequest = object.silentRequest === true ? 1 : 0;
|
|
8624
8633
|
const maxSelectItem = object.maxSelectItem;
|
|
8625
|
-
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openMediaPicker(object.type, editView, silentRequest, maxSelectItem);
|
|
8634
|
+
return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openMediaPicker(object.type, object.serverUploadUrl, object.maxItemSize, editView, silentRequest, maxSelectItem);
|
|
8626
8635
|
});
|
|
8627
8636
|
}
|
|
8628
8637
|
getShareableLink(object) {
|
|
@@ -8982,7 +8991,7 @@ __decorate([
|
|
|
8982
8991
|
handleError,
|
|
8983
8992
|
validate,
|
|
8984
8993
|
__param(0, checkType('object', {
|
|
8985
|
-
url: checkData('
|
|
8994
|
+
url: checkData('url')
|
|
8986
8995
|
}))
|
|
8987
8996
|
], SDKCreator.prototype, "openWebview", null);
|
|
8988
8997
|
__decorate([
|
|
@@ -9026,6 +9035,8 @@ __decorate([
|
|
|
9026
9035
|
type: checkData('string', {
|
|
9027
9036
|
values: ['photo', 'video', 'file', 'multi_photo', 'multi_video']
|
|
9028
9037
|
}),
|
|
9038
|
+
'serverUploadUrl': checkData('url'),
|
|
9039
|
+
'maxItemSize?': checkData('number', { min: 0 }),
|
|
9029
9040
|
'editView?': checkData('object'),
|
|
9030
9041
|
'editView.enable?': checkData('boolean'),
|
|
9031
9042
|
'editView.aspectRatio?': checkData('string', { regex: /^\d+:\d+$/ }),
|