zmp-sdk 2.12.0-6 → 2.12.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/dist/browser.min.js +50 -5
- package/dist/index.es.js +50 -5
- package/dist/index.js +3 -3
- package/dist/index.umd.js +3 -3
- package/dist/types/src/constants.d.ts +1 -0
- package/dist/types/src/controller/index.d.ts +1 -0
- package/dist/types/src/controller/interface.d.ts +1 -0
- package/dist/types/src/controller/sdk.d.ts +2 -0
- package/dist/types/src/services/openApi.d.ts +9 -0
- package/dist/types/src/types/callbackData.d.ts +7 -0
- package/package.json +1 -1
package/dist/browser.min.js
CHANGED
|
@@ -17414,7 +17414,8 @@
|
|
|
17414
17414
|
CHANGE_ACTIONBAR: 'action.change.actionbar',
|
|
17415
17415
|
INTERACTIVE_VIBRATION: 'action.interactive.vibration',
|
|
17416
17416
|
ZBROWSER_MPDS: 'action.zbrowser.mpds',
|
|
17417
|
-
WEBVIEW_SET_RESULT: "action.webview.set.result"
|
|
17417
|
+
WEBVIEW_SET_RESULT: "action.webview.set.result",
|
|
17418
|
+
MP_GET_NUMBER: "action.mp.get.number"
|
|
17418
17419
|
};
|
|
17419
17420
|
const ACTION_HAVE_CALLBACK = [
|
|
17420
17421
|
ACTION.GET_DOWNLOADED_STICKER,
|
|
@@ -17676,12 +17677,15 @@
|
|
|
17676
17677
|
const stringToData = (data) => {
|
|
17677
17678
|
try {
|
|
17678
17679
|
if (data) {
|
|
17680
|
+
console.log(data);
|
|
17679
17681
|
const formattedValue = data.replace(/\\/g, '').replace(/'/g, "'");
|
|
17682
|
+
console.log("formattedValue", formattedValue, JSON.parse(formattedValue), typeof JSON.parse(formattedValue));
|
|
17680
17683
|
return JSON.parse(formattedValue);
|
|
17681
17684
|
}
|
|
17682
17685
|
return null;
|
|
17683
17686
|
}
|
|
17684
17687
|
catch (error) {
|
|
17688
|
+
console.log(error);
|
|
17685
17689
|
return data;
|
|
17686
17690
|
}
|
|
17687
17691
|
};
|
|
@@ -35262,7 +35266,7 @@
|
|
|
35262
35266
|
var data = item.split("=");
|
|
35263
35267
|
if (!data || data.length != 2)
|
|
35264
35268
|
return;
|
|
35265
|
-
params[data[0]] = decodeURIComponent(data[1]);
|
|
35269
|
+
params[data[0]] = decodeURIComponent(data[1].replace(/\+/g, " "));
|
|
35266
35270
|
});
|
|
35267
35271
|
return params;
|
|
35268
35272
|
}
|
|
@@ -35782,7 +35786,7 @@
|
|
|
35782
35786
|
}
|
|
35783
35787
|
};
|
|
35784
35788
|
|
|
35785
|
-
var version = "2.12.0
|
|
35789
|
+
var version = "2.12.0";
|
|
35786
35790
|
|
|
35787
35791
|
class Basics {
|
|
35788
35792
|
/**
|
|
@@ -37303,6 +37307,31 @@
|
|
|
37303
37307
|
};
|
|
37304
37308
|
});
|
|
37305
37309
|
}
|
|
37310
|
+
/**
|
|
37311
|
+
* Gets user phone number.
|
|
37312
|
+
*
|
|
37313
|
+
* @async
|
|
37314
|
+
* @function getPhoneNumer
|
|
37315
|
+
* @category OpenAPI
|
|
37316
|
+
*
|
|
37317
|
+
*/
|
|
37318
|
+
static getPhoneNumer(object) {
|
|
37319
|
+
return new Promise((resolve, reject) => {
|
|
37320
|
+
this.callNative(ACTION.MP_GET_NUMBER, {}, {
|
|
37321
|
+
isMultiCallback: true,
|
|
37322
|
+
callback: (nativeData, error) => {
|
|
37323
|
+
if (error)
|
|
37324
|
+
reject(error);
|
|
37325
|
+
if (nativeData.error_code === 0) {
|
|
37326
|
+
const res = {
|
|
37327
|
+
number: nativeData.data
|
|
37328
|
+
};
|
|
37329
|
+
resolve(res);
|
|
37330
|
+
}
|
|
37331
|
+
}
|
|
37332
|
+
});
|
|
37333
|
+
});
|
|
37334
|
+
}
|
|
37306
37335
|
}
|
|
37307
37336
|
|
|
37308
37337
|
class Window {
|
|
@@ -37729,6 +37758,7 @@
|
|
|
37729
37758
|
const res = {
|
|
37730
37759
|
data: stringToData(eventData)
|
|
37731
37760
|
};
|
|
37761
|
+
console.log(typeof res.data);
|
|
37732
37762
|
callback(res);
|
|
37733
37763
|
});
|
|
37734
37764
|
});
|
|
@@ -37798,7 +37828,8 @@
|
|
|
37798
37828
|
const jsToken = cookies.find((cookie) => cookie.name === CONT.COOKIE_NAME.JS_TOKEN);
|
|
37799
37829
|
if (jsToken) {
|
|
37800
37830
|
this.setJSToken(jsToken.value);
|
|
37801
|
-
window.ZJSBridge.setJSToken &&
|
|
37831
|
+
window.ZJSBridge.setJSToken &&
|
|
37832
|
+
window.ZJSBridge.setJSToken(jsToken.value);
|
|
37802
37833
|
}
|
|
37803
37834
|
resolve(cookies);
|
|
37804
37835
|
})
|
|
@@ -37864,6 +37895,7 @@
|
|
|
37864
37895
|
this.getAppInfo = Basics.getAppInfo;
|
|
37865
37896
|
this.redirectToPreviousMiniApp = Routing.redirectToPreviousMiniApp;
|
|
37866
37897
|
this.onCallbackData = Routing.onCallbackData;
|
|
37898
|
+
this.getPhoneNumber = OpenApi.getPhoneNumer;
|
|
37867
37899
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDK_zOAuth, null);
|
|
37868
37900
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDK_accessToken, null);
|
|
37869
37901
|
this.isShowNavBar = true;
|
|
@@ -37915,7 +37947,8 @@
|
|
|
37915
37947
|
__classPrivateFieldGet(this, _ZaloMiniProgramSDK_cache).timer.getToken = window.setInterval(runTimer, expiredIn);
|
|
37916
37948
|
}
|
|
37917
37949
|
this.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken) || '');
|
|
37918
|
-
window.ZJSBridge.setZAccSession &&
|
|
37950
|
+
window.ZJSBridge.setZAccSession &&
|
|
37951
|
+
window.ZJSBridge.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken) || '');
|
|
37919
37952
|
return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken);
|
|
37920
37953
|
}
|
|
37921
37954
|
return null;
|
|
@@ -38227,6 +38260,12 @@
|
|
|
38227
38260
|
callback(res);
|
|
38228
38261
|
return Promise.resolve();
|
|
38229
38262
|
};
|
|
38263
|
+
this.getPhoneNumber = () => {
|
|
38264
|
+
console.warn('This api only works on zalo app');
|
|
38265
|
+
return Promise.resolve({
|
|
38266
|
+
number: ''
|
|
38267
|
+
});
|
|
38268
|
+
};
|
|
38230
38269
|
}
|
|
38231
38270
|
}
|
|
38232
38271
|
_MockSDK_appId = new WeakMap(), _MockSDK_appConfig = new WeakMap(), _MockSDK_zOAuth = new WeakMap(), _MockSDK_accessToken = new WeakMap(), _MockSDK_cache = new WeakMap();
|
|
@@ -39865,6 +39904,9 @@
|
|
|
39865
39904
|
return yield __classPrivateFieldGet(this, _SDKCreator_sdk).onCallbackData(callback);
|
|
39866
39905
|
});
|
|
39867
39906
|
}
|
|
39907
|
+
getPhoneNumber(object) {
|
|
39908
|
+
return __classPrivateFieldGet(this, _SDKCreator_sdk).getPhoneNumber();
|
|
39909
|
+
}
|
|
39868
39910
|
}
|
|
39869
39911
|
_SDKCreator_sdk = new WeakMap();
|
|
39870
39912
|
__decorate([
|
|
@@ -40195,6 +40237,9 @@
|
|
|
40195
40237
|
__decorate([
|
|
40196
40238
|
handleError
|
|
40197
40239
|
], SDKCreator.prototype, "onCallbackData", null);
|
|
40240
|
+
__decorate([
|
|
40241
|
+
handleError
|
|
40242
|
+
], SDKCreator.prototype, "getPhoneNumber", null);
|
|
40198
40243
|
class ZaloMiniAppSDKCreator extends SDKCreator {
|
|
40199
40244
|
getInstance() {
|
|
40200
40245
|
return ZaloMiniProgramSDK.getInstance();
|
package/dist/index.es.js
CHANGED
|
@@ -17411,7 +17411,8 @@ const ACTION = {
|
|
|
17411
17411
|
CHANGE_ACTIONBAR: 'action.change.actionbar',
|
|
17412
17412
|
INTERACTIVE_VIBRATION: 'action.interactive.vibration',
|
|
17413
17413
|
ZBROWSER_MPDS: 'action.zbrowser.mpds',
|
|
17414
|
-
WEBVIEW_SET_RESULT: "action.webview.set.result"
|
|
17414
|
+
WEBVIEW_SET_RESULT: "action.webview.set.result",
|
|
17415
|
+
MP_GET_NUMBER: "action.mp.get.number"
|
|
17415
17416
|
};
|
|
17416
17417
|
const ACTION_HAVE_CALLBACK = [
|
|
17417
17418
|
ACTION.GET_DOWNLOADED_STICKER,
|
|
@@ -17673,12 +17674,15 @@ const stringifyData = (data) => {
|
|
|
17673
17674
|
const stringToData = (data) => {
|
|
17674
17675
|
try {
|
|
17675
17676
|
if (data) {
|
|
17677
|
+
console.log(data);
|
|
17676
17678
|
const formattedValue = data.replace(/\\/g, '').replace(/'/g, "'");
|
|
17679
|
+
console.log("formattedValue", formattedValue, JSON.parse(formattedValue), typeof JSON.parse(formattedValue));
|
|
17677
17680
|
return JSON.parse(formattedValue);
|
|
17678
17681
|
}
|
|
17679
17682
|
return null;
|
|
17680
17683
|
}
|
|
17681
17684
|
catch (error) {
|
|
17685
|
+
console.log(error);
|
|
17682
17686
|
return data;
|
|
17683
17687
|
}
|
|
17684
17688
|
};
|
|
@@ -35259,7 +35263,7 @@ function getParamsAsObject(query) {
|
|
|
35259
35263
|
var data = item.split("=");
|
|
35260
35264
|
if (!data || data.length != 2)
|
|
35261
35265
|
return;
|
|
35262
|
-
params[data[0]] = decodeURIComponent(data[1]);
|
|
35266
|
+
params[data[0]] = decodeURIComponent(data[1].replace(/\+/g, " "));
|
|
35263
35267
|
});
|
|
35264
35268
|
return params;
|
|
35265
35269
|
}
|
|
@@ -35779,7 +35783,7 @@ const apiResponse = {
|
|
|
35779
35783
|
}
|
|
35780
35784
|
};
|
|
35781
35785
|
|
|
35782
|
-
var version = "2.12.0
|
|
35786
|
+
var version = "2.12.0";
|
|
35783
35787
|
|
|
35784
35788
|
class Basics {
|
|
35785
35789
|
/**
|
|
@@ -37300,6 +37304,31 @@ class OpenApi {
|
|
|
37300
37304
|
};
|
|
37301
37305
|
});
|
|
37302
37306
|
}
|
|
37307
|
+
/**
|
|
37308
|
+
* Gets user phone number.
|
|
37309
|
+
*
|
|
37310
|
+
* @async
|
|
37311
|
+
* @function getPhoneNumer
|
|
37312
|
+
* @category OpenAPI
|
|
37313
|
+
*
|
|
37314
|
+
*/
|
|
37315
|
+
static getPhoneNumer(object) {
|
|
37316
|
+
return new Promise((resolve, reject) => {
|
|
37317
|
+
this.callNative(ACTION.MP_GET_NUMBER, {}, {
|
|
37318
|
+
isMultiCallback: true,
|
|
37319
|
+
callback: (nativeData, error) => {
|
|
37320
|
+
if (error)
|
|
37321
|
+
reject(error);
|
|
37322
|
+
if (nativeData.error_code === 0) {
|
|
37323
|
+
const res = {
|
|
37324
|
+
number: nativeData.data
|
|
37325
|
+
};
|
|
37326
|
+
resolve(res);
|
|
37327
|
+
}
|
|
37328
|
+
}
|
|
37329
|
+
});
|
|
37330
|
+
});
|
|
37331
|
+
}
|
|
37303
37332
|
}
|
|
37304
37333
|
|
|
37305
37334
|
class Window {
|
|
@@ -37726,6 +37755,7 @@ class Routing {
|
|
|
37726
37755
|
const res = {
|
|
37727
37756
|
data: stringToData(eventData)
|
|
37728
37757
|
};
|
|
37758
|
+
console.log(typeof res.data);
|
|
37729
37759
|
callback(res);
|
|
37730
37760
|
});
|
|
37731
37761
|
});
|
|
@@ -37795,7 +37825,8 @@ class ZaloMiniProgramSDK extends ZJSBridgeProvider {
|
|
|
37795
37825
|
const jsToken = cookies.find((cookie) => cookie.name === CONT.COOKIE_NAME.JS_TOKEN);
|
|
37796
37826
|
if (jsToken) {
|
|
37797
37827
|
this.setJSToken(jsToken.value);
|
|
37798
|
-
window.ZJSBridge.setJSToken &&
|
|
37828
|
+
window.ZJSBridge.setJSToken &&
|
|
37829
|
+
window.ZJSBridge.setJSToken(jsToken.value);
|
|
37799
37830
|
}
|
|
37800
37831
|
resolve(cookies);
|
|
37801
37832
|
})
|
|
@@ -37861,6 +37892,7 @@ class ZaloMiniProgramSDK extends ZJSBridgeProvider {
|
|
|
37861
37892
|
this.getAppInfo = Basics.getAppInfo;
|
|
37862
37893
|
this.redirectToPreviousMiniApp = Routing.redirectToPreviousMiniApp;
|
|
37863
37894
|
this.onCallbackData = Routing.onCallbackData;
|
|
37895
|
+
this.getPhoneNumber = OpenApi.getPhoneNumer;
|
|
37864
37896
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDK_zOAuth, null);
|
|
37865
37897
|
__classPrivateFieldSet(this, _ZaloMiniProgramSDK_accessToken, null);
|
|
37866
37898
|
this.isShowNavBar = true;
|
|
@@ -37912,7 +37944,8 @@ class ZaloMiniProgramSDK extends ZJSBridgeProvider {
|
|
|
37912
37944
|
__classPrivateFieldGet(this, _ZaloMiniProgramSDK_cache).timer.getToken = window.setInterval(runTimer, expiredIn);
|
|
37913
37945
|
}
|
|
37914
37946
|
this.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken) || '');
|
|
37915
|
-
window.ZJSBridge.setZAccSession &&
|
|
37947
|
+
window.ZJSBridge.setZAccSession &&
|
|
37948
|
+
window.ZJSBridge.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken) || '');
|
|
37916
37949
|
return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken);
|
|
37917
37950
|
}
|
|
37918
37951
|
return null;
|
|
@@ -38224,6 +38257,12 @@ class MockSDK {
|
|
|
38224
38257
|
callback(res);
|
|
38225
38258
|
return Promise.resolve();
|
|
38226
38259
|
};
|
|
38260
|
+
this.getPhoneNumber = () => {
|
|
38261
|
+
console.warn('This api only works on zalo app');
|
|
38262
|
+
return Promise.resolve({
|
|
38263
|
+
number: ''
|
|
38264
|
+
});
|
|
38265
|
+
};
|
|
38227
38266
|
}
|
|
38228
38267
|
}
|
|
38229
38268
|
_MockSDK_appId = new WeakMap(), _MockSDK_appConfig = new WeakMap(), _MockSDK_zOAuth = new WeakMap(), _MockSDK_accessToken = new WeakMap(), _MockSDK_cache = new WeakMap();
|
|
@@ -39862,6 +39901,9 @@ class SDKCreator {
|
|
|
39862
39901
|
return yield __classPrivateFieldGet(this, _SDKCreator_sdk).onCallbackData(callback);
|
|
39863
39902
|
});
|
|
39864
39903
|
}
|
|
39904
|
+
getPhoneNumber(object) {
|
|
39905
|
+
return __classPrivateFieldGet(this, _SDKCreator_sdk).getPhoneNumber();
|
|
39906
|
+
}
|
|
39865
39907
|
}
|
|
39866
39908
|
_SDKCreator_sdk = new WeakMap();
|
|
39867
39909
|
__decorate([
|
|
@@ -40192,6 +40234,9 @@ __decorate([
|
|
|
40192
40234
|
__decorate([
|
|
40193
40235
|
handleError
|
|
40194
40236
|
], SDKCreator.prototype, "onCallbackData", null);
|
|
40237
|
+
__decorate([
|
|
40238
|
+
handleError
|
|
40239
|
+
], SDKCreator.prototype, "getPhoneNumber", null);
|
|
40195
40240
|
class ZaloMiniAppSDKCreator extends SDKCreator {
|
|
40196
40241
|
getInstance() {
|
|
40197
40242
|
return ZaloMiniProgramSDK.getInstance();
|