zmp-sdk 2.35.1 → 2.35.2-beta.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/apis/apis/checkCameraPermission.js +1 -0
- package/apis/apis/fetchFile.js +1 -0
- package/apis/apis/getFileInfo.js +1 -1
- package/apis/apis/getSavedFileList.js +1 -1
- package/apis/apis/index.js +1 -1
- package/apis/apis/removeSavedFile.js +1 -1
- package/apis/apis/saveFile.js +1 -1
- package/apis/common/apis/general/checkCameraPermission.js +1 -0
- package/apis/common/apis/general/fetchFile.js +1 -0
- package/apis/common/apis/general/getSavedFileList.js +1 -1
- package/apis/common/apis/general/getUserInfo.js +1 -1
- package/apis/common/apis/general/lfsSaveFile.js +1 -1
- package/apis/common/token.js +1 -1
- package/apis/package.json.js +1 -1
- package/browser.min.js +2 -2
- package/index.es.js +2 -2
- package/index.js +2 -2
- package/index.umd.js +2 -2
- package/package.json +1 -1
- package/zmp-sdk-v2.35.0-beta.1.tgz +0 -0
- package/zmp-sdk-v2.35.0-beta.2.tgz +0 -0
- package/apis/apis/fetch.js +0 -1
- package/zmp-sdk-v2.35.0.tgz +0 -0
- /package/apis/apis/{interactOA.js → interactOa.js} +0 -0
- /package/apis/common/apis/general/{interactOA.js → interactOa.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from'./../external/@swc/helpers/src/_async_to_generator.mjs.js';import{functionHandler as r}from"../utils/decorator.js";import o from"../common/apis/general/checkCameraPermission.js";import{__generator as s}from'./../external/tslib/tslib.es6.js';function t(t){return r("checkCameraPermission",[],[t],e((function(){return s(this,(function(e){switch(e.label){case 0:return console.log("DUNGNN 1"),[4,o()];case 1:return[2,e.sent()]}}))})))}export{t as checkCameraPermission};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from'./../external/@swc/helpers/src/_async_to_generator.mjs.js';import r from"../appEnv/index.js";import t from"../common/notFound.js";import{functionHandler as o}from"../utils/decorator.js";import n from"../common/apis/general/fetchFile.js";import{__generator as s}from'./../external/tslib/tslib.es6.js';function i(e){return m.apply(this,arguments)}function m(){return m=e((function(i){return s(this,(function(m){return[2,o("fetchFile",[],[i],(c=e((function(e){return s(this,(function(e){switch(e.label){case 0:return r.isMp?[4,n()]:[3,2];case 1:return[2,e.sent()];case 2:return r.isMpWeb?[2,Promise.resolve({size:"",digest:"",type:""})]:[2,Promise.reject(t("getFileInfo",{}))]}}))})),function(e){return c.apply(this,arguments)}))];var c}))})),m.apply(this,arguments)}export{i as fetchFile};
|
package/apis/apis/getFileInfo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from'./../external/@swc/helpers/src/_async_to_generator.mjs.js';import t,{object as o}from'./../external/zod/lib/index.mjs.js';import r from"../appEnv/index.js";import i from"../common/notFound.js";import{functionHandler as n}from"../utils/decorator.js";import s from"../common/apis/general/getFileInfo.js";import{__generator as m}from'./../external/tslib/tslib.es6.js';var
|
|
1
|
+
import e from'./../external/@swc/helpers/src/_async_to_generator.mjs.js';import t,{object as o}from'./../external/zod/lib/index.mjs.js';import r from"../appEnv/index.js";import i from"../common/notFound.js";import{functionHandler as n}from"../utils/decorator.js";import s from"../common/apis/general/getFileInfo.js";import{__generator as m}from'./../external/tslib/tslib.es6.js';var l=[o({filePath:t.string(),digestAlgorithm:t.enum(["sha1","md5"])}).optional()];function p(e){return u.apply(this,arguments)}function u(){return u=e((function(t){return m(this,(function(o){return[2,n("getFileInfo",l,[t],(p=e((function(e){return m(this,(function(t){switch(t.label){case 0:return r.isMp?[4,s(e.filePath,e.digestAlgorithm)]:[3,2];case 1:return[2,t.sent()];case 2:return r.isMpWeb?[2,Promise.resolve({size:"",digest:"",type:""})]:[2,Promise.reject(i("getFileInfo",{}))]}}))})),function(e){return p.apply(this,arguments)}))];var p}))})),u.apply(this,arguments)}export{p as getFileInfo};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from'./../external/@swc/helpers/src/_async_to_generator.mjs.js';import t from"../appEnv/index.js";import r from"../common/notFound.js";import{functionHandler as o}from"../utils/decorator.js";import s from"../common/apis/general/getSavedFileList.js";import{__generator as
|
|
1
|
+
import e from'./../external/@swc/helpers/src/_async_to_generator.mjs.js';import t from"../appEnv/index.js";import r from"../common/notFound.js";import{functionHandler as o}from"../utils/decorator.js";import s from"../common/apis/general/getSavedFileList.js";import{__generator as i}from'./../external/tslib/tslib.es6.js';function n(e){return m.apply(this,arguments)}function m(){return m=e((function(n){return i(this,(function(m){return[2,o("getSavedFileList",[],[n],(u=e((function(e){return i(this,(function(e){switch(e.label){case 0:return t.isMp?(console.log("DUNGNN getSavedFileList 11"),[4,s()]):[3,2];case 1:return[2,e.sent()];case 2:return t.isMpWeb?[2,Promise.resolve()]:[2,Promise.reject(r("getSavedFileList",{}))]}}))})),function(e){return u.apply(this,arguments)}))];var u}))})),m.apply(this,arguments)}export{n as getSavedFileList};
|
package/apis/apis/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{login}from"./login.js";export{getAccessToken}from"./getAccessToken.js";export{getVersion}from"./getVersion.js";export{getSystemInfo}from"./getSystemInfo.js";export{setNavigationBarTitle}from"./setNavigationBarTitle.js";export{setNavigationBarColor}from"./setNavigationBarColor.js";export{setNavigationBarLeftButton}from"./setNavigationBarLeftButton.js";export{setStorage}from"./setStorage.js";export{getStorage}from"./getStorage.js";export{getStorageInfo}from"./getStorageInfo.js";export{removeStorage}from"./removeStorage.js";export{clearStorage}from"./clearStorage.js";export{getUserInfo}from"./getUserInfo.js";export{getNetworkType}from"./getNetworkType.js";export{onNetworkStatusChange}from"./onNetworkStatusChange.js";export{startBeaconDiscovery}from"./startBeaconDiscovery.js";export{stopBeaconDiscovery}from"./stopBeaconDiscovery.js";export{getBeacons}from"./getBeacons.js";export{closeApp}from"./closeApp.js";export{scanQRCode}from"./scanQRCode.js";export{openProfile}from"./openProfile.js";export{openChat}from"./openChat.js";export{openPostFeed}from"./openPostFeed.js";export{followOA}from"./followOA.js";export{unfollowOA}from"./unfollowOA.js";export{openShareSheet}from"./openShareSheet.js";export{requestCameraPermission}from"./requestCameraPermission.js";export{createShortcut}from"./createShortcut.js";export{openBioAuthentication}from"./openBioAuthentication.js";export{checkStateBioAuthentication}from"./checkStateBioAuthentication.js";export{showToast}from"./showToast.js";export{hideKeyboard}from"./hideKeyboard.js";export{openPhone}from"./openPhone.js";export{openSMS}from"./openSMS.js";export{viewOAQr}from"./viewOAQr.js";export{keepScreen}from"./keepScreen.js";export{onKeepScreen}from"./onKeepScreen.js";export{offKeepScreen}from"./offKeepScreen.js";export{saveImageToGallery}from"./saveImageToGallery.js";export{openMiniApp}from"./openMiniApp.js";export{vibrate}from"./vibrate.js";export{openWebview}from"./openWebview.js";export{getRouteParams}from"./getRouteParams.js";export{getAppInfo}from"./getAppInfo.js";export{sendDataToPreviousMiniApp}from"./sendDataToPreviousMiniApp.js";export{getPhoneNumber}from"./getPhoneNumber.js";export{openProfilePicker}from"./openProfilePicker.js";export{connectWifi}from"./connectWifi.js";export{openMediaPicker}from"./openMediaPicker.js";export{getShareableLink}from"./getShareableLink.js";export{closeLoading}from"./closeLoading.js";export{requestUpdateZalo}from"./requestUpdateZalo.js";export{onConfirmToExit}from"./onConfirmToExit.js";export{offConfirmToExit}from"./offConfirmToExit.js";export{getDeviceId}from"./getDeviceId.js";export{getDeviceIdAsync}from"./getDeviceIdAsync.js";export{getContext}from"./getContext.js";export{getContextAsync}from"./getContextAsync.js";export{getAuthCode}from"./getAuthCode.js";export{getZPIToken}from"./getZPIToken.js";export{setAccessToken}from"./setAccessToken.js";export{openOutApp}from"./openOutApp.js";export{chooseImage}from"./chooseImage.js";export{getLocation}from"./getLocation.js";export{onCallbackData}from"./onCallbackData.js";export{createOrder}from"./createOrder.js";export{checkTransaction}from"./checkTransaction.js";export{events}from"./events.js";export{setAndroidBottomNavigationBar}from"./setAndroidBottomNavigationBar.js";export{setIOSBottomSafeArea}from"./setIOSBottomSafeArea.js";export{setStatusBar}from"./setStatusBar.js";export{configAppView}from"./configAppView.js";export{createOrderIAP}from"./createOrderIAP.js";export{minimizeApp}from"./minimizeApp.js";export{openPermissionSetting}from"./openPermissionSetting.js";export{favoriteApp}from"./favoriteApp.js";export{openGroupList}from"./openGroupList.js";export{requestSendNotification}from"./requestSendNotification.js";export{addRating}from"./addRating.js";export{interactOA,interactOA as interactOa}from"./interactOA.js";export{checkIsAllowedInteractWithOA as isAllowedInteractWithOA}from"./checkIsAllowedInteractWithOA.js";
|
|
1
|
+
export{login}from"./login.js";export{getAccessToken}from"./getAccessToken.js";export{getVersion}from"./getVersion.js";export{getSystemInfo}from"./getSystemInfo.js";export{setNavigationBarTitle}from"./setNavigationBarTitle.js";export{setNavigationBarColor}from"./setNavigationBarColor.js";export{setNavigationBarLeftButton}from"./setNavigationBarLeftButton.js";export{setStorage}from"./setStorage.js";export{getStorage}from"./getStorage.js";export{getStorageInfo}from"./getStorageInfo.js";export{removeStorage}from"./removeStorage.js";export{clearStorage}from"./clearStorage.js";export{getUserInfo}from"./getUserInfo.js";export{getNetworkType}from"./getNetworkType.js";export{onNetworkStatusChange}from"./onNetworkStatusChange.js";export{startBeaconDiscovery}from"./startBeaconDiscovery.js";export{stopBeaconDiscovery}from"./stopBeaconDiscovery.js";export{getBeacons}from"./getBeacons.js";export{closeApp}from"./closeApp.js";export{scanQRCode}from"./scanQRCode.js";export{openProfile}from"./openProfile.js";export{openChat}from"./openChat.js";export{openPostFeed}from"./openPostFeed.js";export{followOA}from"./followOA.js";export{unfollowOA}from"./unfollowOA.js";export{openShareSheet}from"./openShareSheet.js";export{requestCameraPermission}from"./requestCameraPermission.js";export{createShortcut}from"./createShortcut.js";export{openBioAuthentication}from"./openBioAuthentication.js";export{checkStateBioAuthentication}from"./checkStateBioAuthentication.js";export{showToast}from"./showToast.js";export{hideKeyboard}from"./hideKeyboard.js";export{openPhone}from"./openPhone.js";export{openSMS}from"./openSMS.js";export{viewOAQr}from"./viewOAQr.js";export{keepScreen}from"./keepScreen.js";export{onKeepScreen}from"./onKeepScreen.js";export{offKeepScreen}from"./offKeepScreen.js";export{saveImageToGallery}from"./saveImageToGallery.js";export{openMiniApp}from"./openMiniApp.js";export{vibrate}from"./vibrate.js";export{openWebview}from"./openWebview.js";export{getRouteParams}from"./getRouteParams.js";export{getAppInfo}from"./getAppInfo.js";export{sendDataToPreviousMiniApp}from"./sendDataToPreviousMiniApp.js";export{getPhoneNumber}from"./getPhoneNumber.js";export{openProfilePicker}from"./openProfilePicker.js";export{connectWifi}from"./connectWifi.js";export{openMediaPicker}from"./openMediaPicker.js";export{getShareableLink}from"./getShareableLink.js";export{closeLoading}from"./closeLoading.js";export{requestUpdateZalo}from"./requestUpdateZalo.js";export{onConfirmToExit}from"./onConfirmToExit.js";export{offConfirmToExit}from"./offConfirmToExit.js";export{getDeviceId}from"./getDeviceId.js";export{getDeviceIdAsync}from"./getDeviceIdAsync.js";export{getContext}from"./getContext.js";export{getContextAsync}from"./getContextAsync.js";export{getAuthCode}from"./getAuthCode.js";export{getZPIToken}from"./getZPIToken.js";export{setAccessToken}from"./setAccessToken.js";export{openOutApp}from"./openOutApp.js";export{chooseImage}from"./chooseImage.js";export{getLocation}from"./getLocation.js";export{onCallbackData}from"./onCallbackData.js";export{createOrder}from"./createOrder.js";export{checkTransaction}from"./checkTransaction.js";export{events}from"./events.js";export{setAndroidBottomNavigationBar}from"./setAndroidBottomNavigationBar.js";export{setIOSBottomSafeArea}from"./setIOSBottomSafeArea.js";export{setStatusBar}from"./setStatusBar.js";export{configAppView}from"./configAppView.js";export{createOrderIAP}from"./createOrderIAP.js";export{minimizeApp}from"./minimizeApp.js";export{openPermissionSetting}from"./openPermissionSetting.js";export{favoriteApp}from"./favoriteApp.js";export{openGroupList}from"./openGroupList.js";export{requestSendNotification}from"./requestSendNotification.js";export{addRating}from"./addRating.js";export{interactOA,interactOA as interactOa}from"./interactOA.js";export{checkIsAllowedInteractWithOA as isAllowedInteractWithOA}from"./checkIsAllowedInteractWithOA.js";export{getSetting}from"./getSetting.js";export{authorize}from"./authorize.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from'./../external/@swc/helpers/src/_async_to_generator.mjs.js';import r,{object as o}from'./../external/zod/lib/index.mjs.js';import t from"../appEnv/index.js";import n from"../common/notFound.js";import{functionHandler as i}from"../utils/decorator.js";import s from"../common/apis/general/removeSavedFile.js";import{__generator as m}from'./../external/tslib/tslib.es6.js';var
|
|
1
|
+
import e from'./../external/@swc/helpers/src/_async_to_generator.mjs.js';import r,{object as o}from'./../external/zod/lib/index.mjs.js';import t from"../appEnv/index.js";import n from"../common/notFound.js";import{functionHandler as i}from"../utils/decorator.js";import s from"../common/apis/general/removeSavedFile.js";import{__generator as m}from'./../external/tslib/tslib.es6.js';var a=[o({filePath:r.string()}).optional()];function l(e){return p.apply(this,arguments)}function p(){return p=e((function(r){return m(this,(function(o){return[2,i("removeSavedFile",a,[r],(l=e((function(e){return m(this,(function(r){switch(r.label){case 0:return t.isMp?[4,s(e.filePath)]:[3,2];case 1:return[2,r.sent()];case 2:return t.isMpWeb?[2,Promise.resolve()]:[2,Promise.reject(n("removeSavedFile",{}))]}}))})),function(e){return l.apply(this,arguments)}))];var l}))})),p.apply(this,arguments)}export{l as removeSavedFile};
|
package/apis/apis/saveFile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import r from'./../external/@swc/helpers/src/_async_to_generator.mjs.js';import e,{object as o}from'./../external/zod/lib/index.mjs.js';import t from"../appEnv/index.js";import s from"../common/notFound.js";import{functionHandler as n}from"../utils/decorator.js";import i from"../common/apis/general/lfsSaveFile.js";import{__generator as m}from'./../external/tslib/tslib.es6.js';var a=[o({
|
|
1
|
+
import r from'./../external/@swc/helpers/src/_async_to_generator.mjs.js';import e,{object as o}from'./../external/zod/lib/index.mjs.js';import t from"../appEnv/index.js";import s from"../common/notFound.js";import{functionHandler as n}from"../utils/decorator.js";import i from"../common/apis/general/lfsSaveFile.js";import{__generator as m}from'./../external/tslib/tslib.es6.js';var a=[o({filePath:e.string()}).optional()];function l(r){return p.apply(this,arguments)}function p(){return p=r((function(e){return m(this,(function(o){return[2,n("saveFile",a,[e],(l=r((function(r){var e;return m(this,(function(o){switch(o.label){case 0:return t.isMp?(e=r.filePath,[4,i(e)]):[3,2];case 1:return[2,o.sent()];case 2:return t.isMpWeb?[2,Promise.resolve()]:[2,Promise.reject(s("saveFile",{}))]}}))})),function(r){return l.apply(this,arguments)}))];var l}))})),p.apply(this,arguments)}export{l as saveFile};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from'./../../../external/@swc/helpers/src/_async_to_generator.mjs.js';import r from"../../notFound.js";import{__generator as t}from'./../../../external/tslib/tslib.es6.js';var n=e((function(){return t(this,(function(n){return[2,new Promise((o=e((function(e,n){var o;return t(this,(function(t){switch(t.label){case 0:return console.log("DUNGNN 2",ZaloJavaScriptInterface),ZaloJavaScriptInterface&&"function"==typeof ZaloJavaScriptInterface.checkCameraPermission?[4,ZaloJavaScriptInterface.checkCameraPermission()]:[3,2];case 1:return o=t.sent(),console.log("DUNGNN 3",JSON.stringify(o)),[2,e({userAllow:"grant"===o})];case 2:return n(r("checkCameraPermission",{})),[2]}}))})),function(e,r){return o.apply(this,arguments)}))];var o}))}));export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import o from'./../../../external/@swc/helpers/src/_async_to_generator.mjs.js';import s from"../../call/index.js";import{__generator as n}from'./../../../external/tslib/tslib.es6.js';var e=o((function(){return n(this,(function(o){return[2,new Promise((function(o,n){s("LFS_FETCH",{},{success:function(s){o(s)},fail:function(o){n(o)}},{})}))]}))}));export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from'./../../../external/@swc/helpers/src/_async_to_generator.mjs.js';import t from'./../../../external/@swc/helpers/src/_object_spread.mjs.js';import r from"../../call/index.js";import{__generator as o}from'./../../../external/tslib/tslib.es6.js';var s=e((function(){return o(this,(function(e){return[2,new Promise((function(e,o){r("LFS_LIST",{},{success:function(r){console.log("DUNGNN LFS_LIST",r);var o=r.map((function(e){var r=t({},e);try{r.filePath=r.file_path,r.createTime=r.created_time,delete r.file_path,delete r.created_time}catch(e){}return r}));e({list:o})},fail:function(e){o(e)}},{})}))]}))}));export{s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from'./../../../external/@swc/helpers/src/_async_to_generator.mjs.js';import t from"../../token.js";import{APIS as n}from"../../../constants.js";import{__generator as s}from'./../../../external/tslib/tslib.es6.js';var i,r=(i=e((function(i){var r,o;return s(this,(function(c){switch(c.label){case 0:return[4,t.getAccessToken()];case 1:return r=c.sent(),o="id,name,user_id_by_oa,is_sensitive",o=i?"".concat(o,",picture.type(").concat(i,")"):"".concat(o,",picture"),[4,fetch("".concat(n.GET_USER_INFO,"?fields=").concat(o),{headers:{access_token:r||""}}).then(function(){var t=e((function(e){var t,n,i,r;return s(this,(function(s){switch(s.label){case 0:return[4,e.json()];case 1:return i=s.sent(),r=null==i?void 0:i.user_id_by_oa,[2,{id:null==i?void 0:i.id,name:(null==i?void 0:i.name)||"",avatar:(null==i||null===(t=i.picture)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.url)||"",idByOA:r,followedOA:!!r,isSensitive:null==i?void 0:i.is_sensitive}]}}))}));return function(e){return t.apply(this,arguments)}}())];case 2:return[2,c.sent()]}}))})),function(e){return i.apply(this,arguments)});export{r as default};
|
|
1
|
+
import e from'./../../../external/@swc/helpers/src/_async_to_generator.mjs.js';import t from"../../token.js";import{APIS as n}from"../../../constants.js";import{__generator as s}from'./../../../external/tslib/tslib.es6.js';var i,r=(i=e((function(i){var r,o;return s(this,(function(c){switch(c.label){case 0:return[4,t.getAccessToken(!0)];case 1:return r=c.sent(),o="id,name,user_id_by_oa,is_sensitive",o=i?"".concat(o,",picture.type(").concat(i,")"):"".concat(o,",picture"),[4,fetch("".concat(n.GET_USER_INFO,"?fields=").concat(o),{headers:{access_token:r||""}}).then(function(){var t=e((function(e){var t,n,i,r;return s(this,(function(s){switch(s.label){case 0:return[4,e.json()];case 1:return i=s.sent(),r=null==i?void 0:i.user_id_by_oa,[2,{id:null==i?void 0:i.id,name:(null==i?void 0:i.name)||"",avatar:(null==i||null===(t=i.picture)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.url)||"",idByOA:r,followedOA:!!r,isSensitive:null==i?void 0:i.is_sensitive}]}}))}));return function(e){return t.apply(this,arguments)}}())];case 2:return[2,c.sent()]}}))})),function(e){return i.apply(this,arguments)});export{r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from'./../../../external/@swc/helpers/src/_async_to_generator.mjs.js';import n from"../../call/index.js";import{__generator as s}from'./../../../external/tslib/tslib.es6.js';var e,o=(e=t((function(t){return s(this,(function(s){return[2,new Promise((function(s,e){n("LFS_FILE_SAVE",{file_path:t},{success:function(t){s({
|
|
1
|
+
import t from'./../../../external/@swc/helpers/src/_async_to_generator.mjs.js';import n from"../../call/index.js";import{__generator as s}from'./../../../external/tslib/tslib.es6.js';var e,o=(e=t((function(t){return s(this,(function(s){return[2,new Promise((function(s,e){n("LFS_FILE_SAVE",{file_path:t},{success:function(t){s({savedPath:t})},fail:function(t){e(t)}},{})}))]}))})),function(t){return e.apply(this,arguments)});export{o as default};
|
package/apis/common/token.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from'./../external/@swc/helpers/src/_async_to_generator.mjs.js';import n from'./../external/@swc/helpers/src/_class_call_check.mjs.js';import t from'./../external/@swc/helpers/src/_create_class.mjs.js';import s from'./../external/@swc/helpers/src/_object_spread.mjs.js';import r from"../utils/lodash.js";import{COOKIE_NAME as o,APIS as i,APP_ID as c,ZAPP_ID as a,ApiCallStage as u,MINI_APP_INTERNAL_LINK as l}from"../constants.js";import{logger as m}from"./logger.js";import p from"./call/zaloNative.js";import{apiResponse as f}from"../utils/response.js";import{sendLogData as d}from"./utils.js";import{getDynamicAPIByAction as h}from"../utils/common.js";import g from"./apis/general/authorize.js";import _ from"./apis/general/getSetting.js";import{__generator as T}from'./../external/tslib/tslib.es6.js';import{JumpStatus as k}from"../types/enum.js";var v=function(){function v(){n(this,v),this._jumpStatus=void 0,this.WAITING_QUEUE=[],this.getAccessTokenCount=0,this._accessToken="",this._jsAccessToken="",this.refreshToken="",this._cookies=[],this.accessTokenExpiresIn=0,this.prevGetAccessTokenTimestamp=(new Date).getTime(),this.manualSetAccessToken=!1,this._miniProgramConfig={}}var A=v.prototype;return A.jump=function(){var n=this;return e((function(){return T(this,(function(e){return[2,new Promise((function(e,t){n._jumpStatus?n._jumpStatus===k.DONE?e(k.DONE):e(k.DOING):(n._jumpStatus=k.DOING,m({stage:u.REQUEST,type:"log",name:"jump"}),p("JUMP_LOGIN",{},{success:function(t){var s=t.data;n._miniProgramConfig=(null==s?void 0:s.miniProgramConfig)||{};var r=(null==s?void 0:s.cookiesOAuthLogins)||[],i=r.find((function(e){return e.name===o.JS_TOKEN}));i&&(n._jsAccessToken=i.value,window.ZJSBridge.setJSToken&&window.ZJSBridge.setJSToken(i.value)),n._cookies=r;var c=n._cookies.find((function(e){return e.name===o.ZOAUTH}));(null==c?void 0:c.value)||d([{action:"action.jump.login",error:-102,message:"no zoauth",data:{}}]),e(k.DONE)},fail:function(e){d([{action:"action.jump.login",error:-101,message:e.message||"jump error",data:{}}]),t(e)}},{skipJump:!0}))}))]}))}))()},A.loginZaloV3=function(n,t,s){var r=this;return e((function(){var o;return T(this,(function(c){switch(c.label){case 0:return o="".concat(i.GET_ACCESS_TOKEN_V3,"?app_id=").concat(t,"&redirect_uri=").concat(l,"/").concat(n,"/&code=").concat(s,"&isSDK=true"),[4,fetch(o).then((a=e((function(e){var n,t,s;return T(this,(function(o){switch(o.label){case 0:return[4,e.json()];case 1:return n=o.sent(),t=null==n?void 0:n.access_token,r._accessToken=t,s=1e3*parseInt(n.expires_in),r.accessTokenExpiresIn=s,r.prevGetAccessTokenTimestamp=(new Date).getTime(),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(r._accessToken||""),[2,t]}}))})),function(e){return a.apply(this,arguments)}))];case 1:return[2,c.sent()]}var a}))}))()},A.loginZaloV4=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",c=this;return e((function(){var a,u;return T(this,(function(l){switch(l.label){case 0:return(a=new URLSearchParams).append("app_id",n),a.append("code",t),a.append("code_verifier",o),r.isNull(c.refreshToken)||0===c.refreshToken.length?a.append("grant_type","authorization_code"):(a.append("grant_type","refresh_token"),a.append("refresh_token",c.refreshToken||"")),u={headers:{"Content-Type":"application/x-www-form-urlencoded"}},[4,fetch(i.GET_ACCESS_TOKEN,s({method:"POST",body:a},u)).then((m=e((function(e){var n,t,s,r;return T(this,(function(o){switch(o.label){case 0:return[4,e.json()];case 1:return n=o.sent(),t=(null==n?void 0:n.access_token)||"",s=(null==n?void 0:n.refresh_token)||"",c.refreshToken=s,c._accessToken=t,r=1e3*parseInt(null==n?void 0:n.expires_in),c.accessTokenExpiresIn=r,c.prevGetAccessTokenTimestamp=(new Date).getTime(),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(t),[2,t]}}))})),function(e){return m.apply(this,arguments)}))];case 1:return[2,l.sent()]}var m}))}))()},A.getAccessToken=function(){var n
|
|
1
|
+
import e from'./../external/@swc/helpers/src/_async_to_generator.mjs.js';import n from'./../external/@swc/helpers/src/_class_call_check.mjs.js';import t from'./../external/@swc/helpers/src/_create_class.mjs.js';import s from'./../external/@swc/helpers/src/_object_spread.mjs.js';import r from"../utils/lodash.js";import{COOKIE_NAME as o,APIS as i,APP_ID as c,ZAPP_ID as a,ApiCallStage as u,MINI_APP_INTERNAL_LINK as l}from"../constants.js";import{logger as m}from"./logger.js";import p from"./call/zaloNative.js";import{apiResponse as f}from"../utils/response.js";import{sendLogData as d}from"./utils.js";import{getDynamicAPIByAction as h}from"../utils/common.js";import g from"./apis/general/authorize.js";import _ from"./apis/general/getSetting.js";import{__generator as T}from'./../external/tslib/tslib.es6.js';import{JumpStatus as k}from"../types/enum.js";var v=function(){function v(){n(this,v),this._jumpStatus=void 0,this.WAITING_QUEUE=[],this.getAccessTokenCount=0,this._accessToken="",this._jsAccessToken="",this.refreshToken="",this._cookies=[],this.accessTokenExpiresIn=0,this.prevGetAccessTokenTimestamp=(new Date).getTime(),this.manualSetAccessToken=!1,this._miniProgramConfig={}}var A=v.prototype;return A.jump=function(){var n=this;return e((function(){return T(this,(function(e){return[2,new Promise((function(e,t){n._jumpStatus?n._jumpStatus===k.DONE?e(k.DONE):e(k.DOING):(n._jumpStatus=k.DOING,m({stage:u.REQUEST,type:"log",name:"jump"}),p("JUMP_LOGIN",{},{success:function(t){var s=t.data;n._miniProgramConfig=(null==s?void 0:s.miniProgramConfig)||{};var r=(null==s?void 0:s.cookiesOAuthLogins)||[],i=r.find((function(e){return e.name===o.JS_TOKEN}));i&&(n._jsAccessToken=i.value,window.ZJSBridge.setJSToken&&window.ZJSBridge.setJSToken(i.value)),n._cookies=r;var c=n._cookies.find((function(e){return e.name===o.ZOAUTH}));(null==c?void 0:c.value)||d([{action:"action.jump.login",error:-102,message:"no zoauth",data:{}}]),e(k.DONE)},fail:function(e){d([{action:"action.jump.login",error:-101,message:e.message||"jump error",data:{}}]),t(e)}},{skipJump:!0}))}))]}))}))()},A.loginZaloV3=function(n,t,s){var r=this;return e((function(){var o;return T(this,(function(c){switch(c.label){case 0:return o="".concat(i.GET_ACCESS_TOKEN_V3,"?app_id=").concat(t,"&redirect_uri=").concat(l,"/").concat(n,"/&code=").concat(s,"&isSDK=true"),[4,fetch(o).then((a=e((function(e){var n,t,s;return T(this,(function(o){switch(o.label){case 0:return[4,e.json()];case 1:return n=o.sent(),t=null==n?void 0:n.access_token,r._accessToken=t,s=1e3*parseInt(n.expires_in),r.accessTokenExpiresIn=s,r.prevGetAccessTokenTimestamp=(new Date).getTime(),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(r._accessToken||""),[2,t]}}))})),function(e){return a.apply(this,arguments)}))];case 1:return[2,c.sent()]}var a}))}))()},A.loginZaloV4=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",c=this;return e((function(){var a,u;return T(this,(function(l){switch(l.label){case 0:return(a=new URLSearchParams).append("app_id",n),a.append("code",t),a.append("code_verifier",o),r.isNull(c.refreshToken)||0===c.refreshToken.length?a.append("grant_type","authorization_code"):(a.append("grant_type","refresh_token"),a.append("refresh_token",c.refreshToken||"")),u={headers:{"Content-Type":"application/x-www-form-urlencoded"}},[4,fetch(i.GET_ACCESS_TOKEN,s({method:"POST",body:a},u)).then((m=e((function(e){var n,t,s,r;return T(this,(function(o){switch(o.label){case 0:return[4,e.json()];case 1:return n=o.sent(),t=(null==n?void 0:n.access_token)||"",s=(null==n?void 0:n.refresh_token)||"",c.refreshToken=s,c._accessToken=t,r=1e3*parseInt(null==n?void 0:n.expires_in),c.accessTokenExpiresIn=r,c.prevGetAccessTokenTimestamp=(new Date).getTime(),window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(t),[2,t]}}))})),function(e){return m.apply(this,arguments)}))];case 1:return[2,l.sent()]}var m}))}))()},A.getAccessToken=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this;return e((function(){var s,r,i,u,l,m,p,h,g;function _(){return k.apply(this,arguments)}function k(){return(k=e((function(){return T(this,(function(e){switch(e.label){case 0:return[4,new Promise((function(e){var n=setInterval((function(){(i.getAccessTokenCount<=1||i._accessToken)&&(e("done"),clearInterval(n))}),200)}))];case 1:return[2,e.sent()]}}))}))).apply(this,arguments)}return T(this,(function(e){switch(e.label){case 0:return r=(new Date).getTime()-t.prevGetAccessTokenTimestamp,(i=t).getAccessTokenCount++,t.getAccessTokenCount>1?[4,_()]:[3,2];case 1:e.sent(),e.label=2;case 2:return t.manualSetAccessToken||t._accessToken.length>0&&r<t.accessTokenExpiresIn&&(null===(s=t._miniProgramConfig)||void 0===s?void 0:s.userAuthorized)?(i.getAccessTokenCount--,[2,Promise.resolve(t._accessToken)]):(t.accessToken="",[4,t.jumpAndGetToken(o.ZOAUTH)]);case 3:return u=e.sent(),[4,t.jumpAndGetToken(o.ZOAUTH_VRF)];case 4:return l=e.sent(),m="zmp.getaccesstoken.fail",n?[4,t.verifyUserAuthorized()]:[3,6];case 5:return p=e.sent(),[3,7];case 6:p=!0,e.label=7;case 7:if(!p)throw i.getAccessTokenCount--,d([{action:m,error:-104,message:"no user auth",data:{}}]),f.error.loginFailed("User Authentication Required");if(!u)return[3,15];e.label=8;case 8:return e.trys.push([8,13,,14]),l?[4,t.loginZaloV4(c,u,l)]:[3,10];case 9:return h=e.sent(),[3,12];case 10:return[4,t.loginZaloV3(c,a,u)];case 11:h=e.sent(),e.label=12;case 12:return[3,14];case 13:return g=e.sent(),h="",console.log("Can not get access token",g),d([{action:m,error:-103,message:String(g)||"Can not get access token",data:{}}]),[3,14];case 14:return i.getAccessTokenCount--,h||d([{action:m,error:-101,message:"no accessToken",data:{}}]),[2,Promise.resolve(t._accessToken)];case 15:throw i.getAccessTokenCount--,d([{action:m,error:-102,message:"no oauth",data:{}}]),f.error.loginFailed("Zalo app has not been activated")}}))}))()},A.verifyUserAuthorized=function(){var n=this;return e((function(){var e,t,s,r,o,i;return T(this,(function(c){switch(c.label){case 0:if(t=!0,!1!==(null===(e=n._miniProgramConfig)||void 0===e?void 0:e.userAuthorized))return[3,6];c.label=1;case 1:return c.trys.push([1,5,,6]),(s=h("action.mp.user.authorize"))&&s.isSupported?[4,_()]:[3,4];case 2:return!1!==(null==(o=c.sent())||null===(r=o.authSetting)||void 0===r?void 0:r["scope.userInfo"])?[3,4]:[4,g()];case 3:i=c.sent(),t=(null==i?void 0:i["scope.userInfo"])||!1,c.label=4;case 4:return[3,6];case 5:return c.sent(),t=!1,[3,6];case 6:return[2,t]}}))}))()},A.setAccessToken=function(e){this.manualSetAccessToken=!0,this._accessToken=e,window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(e)},A.getJSAccessToken=function(){var n=this;return e((function(){var e;return T(this,(function(t){switch(t.label){case 0:return n._jsAccessToken.length>0?[2,Promise.resolve(n._jsAccessToken)]:[4,n.jumpAndGetToken(o.JS_TOKEN)];case 1:return e=t.sent(),[2,Promise.resolve(e)]}}))}))()},A.getSync=function(e){var n;return null===(n=this._cookies.find((function(n){return n.name===e})))||void 0===n?void 0:n.value},A.jumpAndGetToken=function(n){var t,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=this;return new Promise((t=e((function(e){var t,i,c,a;return T(this,(function(u){switch(u.label){case 0:return!s&&o._cookies.length>0?r.isString(n)?(t=o._cookies.find((function(e){return e.name===n})),[2,e(null==t?void 0:t.value)]):[2,e("")]:(s&&o._jumpStatus===k.DONE&&(o._jumpStatus=void 0),i={name:n,cb:function(n){return e(n)}},[4,o.jump()]);case 1:return(c=u.sent())===k.DONE?(o._jumpStatus=c,o.WAITING_QUEUE.length&&(o.WAITING_QUEUE.forEach((function(e){var n=o._cookies.find((function(n){return n.name===e.name}));e.cb(null==n?void 0:n.value)})),o.WAITING_QUEUE=[]),a=o._cookies.find((function(e){return e.name===i.name})),i.cb(null==a?void 0:a.value)):o.WAITING_QUEUE.push(i),[2]}}))})),function(e){return t.apply(this,arguments)}))},v.getInstance=function(){return v.instance||(v.instance=new v),v.instance},t(v,[{key:"jumpStatus",get:function(){return this._jumpStatus}},{key:"accessToken",set:function(e){this._accessToken=e,window.ZJSBridge.setZAccSession&&window.ZJSBridge.setZAccSession(e)}},{key:"miniProgramConfig",get:function(){return this._miniProgramConfig}}]),v}(),A=v.getInstance();export{A as default};
|
package/apis/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var a="2.35.2-beta.0";export{a as version};
|