zmp-sdk 2.12.0-0 → 2.12.0-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/dist/browser.min.js +33 -8
- package/dist/index.es.js +33 -8
- package/dist/index.js +3 -3
- package/dist/index.umd.js +3 -3
- package/dist/types/src/middleware/error.middleware.d.ts +1 -0
- package/package.json +1 -1
package/dist/browser.min.js
CHANGED
|
@@ -35612,6 +35612,9 @@
|
|
|
35612
35612
|
this.message = msg;
|
|
35613
35613
|
this.api = api;
|
|
35614
35614
|
}
|
|
35615
|
+
toString() {
|
|
35616
|
+
return `api: ${this.api}; code: ${this.code}; message: ${this.message}`;
|
|
35617
|
+
}
|
|
35615
35618
|
}
|
|
35616
35619
|
class NativeError extends CommonError {
|
|
35617
35620
|
constructor(code, msg) {
|
|
@@ -35670,6 +35673,7 @@
|
|
|
35670
35673
|
catch (error) {
|
|
35671
35674
|
const { handler } = catchDecoratorStore;
|
|
35672
35675
|
const errorParsed = handler.call(null, propertyName, error, this);
|
|
35676
|
+
window.zmpSentry && window.zmpSentry.throwError(errorParsed.toString());
|
|
35673
35677
|
if (!lodash.isNull(fail) && lodash.isFunction(fail)) {
|
|
35674
35678
|
fail.call(null, errorParsed, this);
|
|
35675
35679
|
}
|
|
@@ -35726,6 +35730,16 @@
|
|
|
35726
35730
|
}
|
|
35727
35731
|
else if (cb && cb.error_code < 0) {
|
|
35728
35732
|
const error = new NativeError(cb.error_code, `${cb.action}: ${cb.error_message}`);
|
|
35733
|
+
try {
|
|
35734
|
+
window.zmpSentry &&
|
|
35735
|
+
window.zmpSentry.captureMessage(`${action}: call native fail`, {
|
|
35736
|
+
extra: {
|
|
35737
|
+
data: data,
|
|
35738
|
+
rs: cb
|
|
35739
|
+
}
|
|
35740
|
+
});
|
|
35741
|
+
}
|
|
35742
|
+
catch (error) { }
|
|
35729
35743
|
reject(error);
|
|
35730
35744
|
if (option === null || option === void 0 ? void 0 : option.callback) {
|
|
35731
35745
|
option.callback(cb, error);
|
|
@@ -35750,7 +35764,7 @@
|
|
|
35750
35764
|
}
|
|
35751
35765
|
};
|
|
35752
35766
|
|
|
35753
|
-
var version = "2.12.0-
|
|
35767
|
+
var version = "2.12.0-4";
|
|
35754
35768
|
|
|
35755
35769
|
class Basics {
|
|
35756
35770
|
/**
|
|
@@ -37703,12 +37717,18 @@
|
|
|
37703
37717
|
static onCallbackData(callback) {
|
|
37704
37718
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37705
37719
|
yield this.listenerEventNative('h5.event.webview.result', '', (eventData) => {
|
|
37706
|
-
|
|
37707
|
-
|
|
37708
|
-
|
|
37709
|
-
|
|
37710
|
-
|
|
37711
|
-
|
|
37720
|
+
console.log(eventData);
|
|
37721
|
+
// let callbackData = eventData
|
|
37722
|
+
// // try {
|
|
37723
|
+
// // const data = JSON.parse(eventData);
|
|
37724
|
+
// // callbackData = data && data.data;
|
|
37725
|
+
// // } catch (error) {
|
|
37726
|
+
// // console.log(error)
|
|
37727
|
+
// // }
|
|
37728
|
+
// const res: InputDataType.OnCallbackData = {
|
|
37729
|
+
// data: callbackData
|
|
37730
|
+
// };
|
|
37731
|
+
// callback(eventData);
|
|
37712
37732
|
});
|
|
37713
37733
|
});
|
|
37714
37734
|
}
|
|
@@ -37775,7 +37795,10 @@
|
|
|
37775
37795
|
.then((data) => {
|
|
37776
37796
|
const cookies = (data && data.cookiesOAuthLogins) || [];
|
|
37777
37797
|
const jsToken = cookies.find((cookie) => cookie.name === CONT.COOKIE_NAME.JS_TOKEN);
|
|
37778
|
-
|
|
37798
|
+
if (jsToken) {
|
|
37799
|
+
this.setJSToken(jsToken.value);
|
|
37800
|
+
window.ZJSBridge.setJSToken && window.ZJSBridge.setJSToken(jsToken.value);
|
|
37801
|
+
}
|
|
37779
37802
|
resolve(cookies);
|
|
37780
37803
|
})
|
|
37781
37804
|
.catch((error) => {
|
|
@@ -37891,6 +37914,7 @@
|
|
|
37891
37914
|
__classPrivateFieldGet(this, _ZaloMiniProgramSDK_cache).timer.getToken = window.setInterval(runTimer, expiredIn);
|
|
37892
37915
|
}
|
|
37893
37916
|
this.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken) || '');
|
|
37917
|
+
window.ZJSBridge.setZAccSession && window.ZJSBridge.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken) || '');
|
|
37894
37918
|
return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken);
|
|
37895
37919
|
}
|
|
37896
37920
|
return null;
|
|
@@ -38179,6 +38203,7 @@
|
|
|
38179
38203
|
return Promise.resolve();
|
|
38180
38204
|
};
|
|
38181
38205
|
this.openWebview = (object) => {
|
|
38206
|
+
location.replace(object.url);
|
|
38182
38207
|
return Promise.resolve();
|
|
38183
38208
|
};
|
|
38184
38209
|
this.getRouteParams = Routing.getRouteParams;
|
package/dist/index.es.js
CHANGED
|
@@ -35609,6 +35609,9 @@ class CommonError {
|
|
|
35609
35609
|
this.message = msg;
|
|
35610
35610
|
this.api = api;
|
|
35611
35611
|
}
|
|
35612
|
+
toString() {
|
|
35613
|
+
return `api: ${this.api}; code: ${this.code}; message: ${this.message}`;
|
|
35614
|
+
}
|
|
35612
35615
|
}
|
|
35613
35616
|
class NativeError extends CommonError {
|
|
35614
35617
|
constructor(code, msg) {
|
|
@@ -35667,6 +35670,7 @@ const handleError = (target, propertyName, descriptor) => {
|
|
|
35667
35670
|
catch (error) {
|
|
35668
35671
|
const { handler } = catchDecoratorStore;
|
|
35669
35672
|
const errorParsed = handler.call(null, propertyName, error, this);
|
|
35673
|
+
window.zmpSentry && window.zmpSentry.throwError(errorParsed.toString());
|
|
35670
35674
|
if (!lodash.isNull(fail) && lodash.isFunction(fail)) {
|
|
35671
35675
|
fail.call(null, errorParsed, this);
|
|
35672
35676
|
}
|
|
@@ -35723,6 +35727,16 @@ class ZJSBridgeProvider {
|
|
|
35723
35727
|
}
|
|
35724
35728
|
else if (cb && cb.error_code < 0) {
|
|
35725
35729
|
const error = new NativeError(cb.error_code, `${cb.action}: ${cb.error_message}`);
|
|
35730
|
+
try {
|
|
35731
|
+
window.zmpSentry &&
|
|
35732
|
+
window.zmpSentry.captureMessage(`${action}: call native fail`, {
|
|
35733
|
+
extra: {
|
|
35734
|
+
data: data,
|
|
35735
|
+
rs: cb
|
|
35736
|
+
}
|
|
35737
|
+
});
|
|
35738
|
+
}
|
|
35739
|
+
catch (error) { }
|
|
35726
35740
|
reject(error);
|
|
35727
35741
|
if (option === null || option === void 0 ? void 0 : option.callback) {
|
|
35728
35742
|
option.callback(cb, error);
|
|
@@ -35747,7 +35761,7 @@ const apiResponse = {
|
|
|
35747
35761
|
}
|
|
35748
35762
|
};
|
|
35749
35763
|
|
|
35750
|
-
var version = "2.12.0-
|
|
35764
|
+
var version = "2.12.0-4";
|
|
35751
35765
|
|
|
35752
35766
|
class Basics {
|
|
35753
35767
|
/**
|
|
@@ -37700,12 +37714,18 @@ class Routing {
|
|
|
37700
37714
|
static onCallbackData(callback) {
|
|
37701
37715
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37702
37716
|
yield this.listenerEventNative('h5.event.webview.result', '', (eventData) => {
|
|
37703
|
-
|
|
37704
|
-
|
|
37705
|
-
|
|
37706
|
-
|
|
37707
|
-
|
|
37708
|
-
|
|
37717
|
+
console.log(eventData);
|
|
37718
|
+
// let callbackData = eventData
|
|
37719
|
+
// // try {
|
|
37720
|
+
// // const data = JSON.parse(eventData);
|
|
37721
|
+
// // callbackData = data && data.data;
|
|
37722
|
+
// // } catch (error) {
|
|
37723
|
+
// // console.log(error)
|
|
37724
|
+
// // }
|
|
37725
|
+
// const res: InputDataType.OnCallbackData = {
|
|
37726
|
+
// data: callbackData
|
|
37727
|
+
// };
|
|
37728
|
+
// callback(eventData);
|
|
37709
37729
|
});
|
|
37710
37730
|
});
|
|
37711
37731
|
}
|
|
@@ -37772,7 +37792,10 @@ class ZaloMiniProgramSDK extends ZJSBridgeProvider {
|
|
|
37772
37792
|
.then((data) => {
|
|
37773
37793
|
const cookies = (data && data.cookiesOAuthLogins) || [];
|
|
37774
37794
|
const jsToken = cookies.find((cookie) => cookie.name === CONT.COOKIE_NAME.JS_TOKEN);
|
|
37775
|
-
|
|
37795
|
+
if (jsToken) {
|
|
37796
|
+
this.setJSToken(jsToken.value);
|
|
37797
|
+
window.ZJSBridge.setJSToken && window.ZJSBridge.setJSToken(jsToken.value);
|
|
37798
|
+
}
|
|
37776
37799
|
resolve(cookies);
|
|
37777
37800
|
})
|
|
37778
37801
|
.catch((error) => {
|
|
@@ -37888,6 +37911,7 @@ class ZaloMiniProgramSDK extends ZJSBridgeProvider {
|
|
|
37888
37911
|
__classPrivateFieldGet(this, _ZaloMiniProgramSDK_cache).timer.getToken = window.setInterval(runTimer, expiredIn);
|
|
37889
37912
|
}
|
|
37890
37913
|
this.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken) || '');
|
|
37914
|
+
window.ZJSBridge.setZAccSession && window.ZJSBridge.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken) || '');
|
|
37891
37915
|
return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken);
|
|
37892
37916
|
}
|
|
37893
37917
|
return null;
|
|
@@ -38176,6 +38200,7 @@ class MockSDK {
|
|
|
38176
38200
|
return Promise.resolve();
|
|
38177
38201
|
};
|
|
38178
38202
|
this.openWebview = (object) => {
|
|
38203
|
+
location.replace(object.url);
|
|
38179
38204
|
return Promise.resolve();
|
|
38180
38205
|
};
|
|
38181
38206
|
this.getRouteParams = Routing.getRouteParams;
|