@smart100/spu-web-plugin 0.0.32 → 0.0.34
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/index.d.ts +1 -0
- package/dist/spu-web-plugin.mjs +42 -4
- package/package.json +2 -2
- package/src/index.ts +4 -2
- package/src/location.ts +1 -1
- package/src/types/index.d.ts +1 -0
- package/src/utils.ts +20 -3
package/dist/index.d.ts
CHANGED
|
@@ -83,6 +83,7 @@ export const getUniqueid: () => string
|
|
|
83
83
|
export const getUuid: () => string
|
|
84
84
|
export const functionCheck: (functioncode?: string) => boolean
|
|
85
85
|
export const setTitle: (pagetitle?: string) => void
|
|
86
|
+
export const isInApp: () => boolean
|
|
86
87
|
export const AMapLoader: IAMapLoader
|
|
87
88
|
export const getToken: () => string
|
|
88
89
|
export const getTokenExpires: () => string
|
package/dist/spu-web-plugin.mjs
CHANGED
|
@@ -708,7 +708,7 @@ function _toPropertyKey$1(arg) {
|
|
|
708
708
|
return typeof key === "symbol" ? key : String(key);
|
|
709
709
|
}
|
|
710
710
|
|
|
711
|
-
var version = "0.0.
|
|
711
|
+
var version = "0.0.34";
|
|
712
712
|
|
|
713
713
|
/** Detect free variable `global` from Node.js. */
|
|
714
714
|
var freeGlobal$2 = typeof global == 'object' && global && global.Object === Object && global;
|
|
@@ -14047,7 +14047,7 @@ var getSpuLocation = /*#__PURE__*/function () {
|
|
|
14047
14047
|
var isload = false;
|
|
14048
14048
|
setTimeout(function () {
|
|
14049
14049
|
if (!isload) {
|
|
14050
|
-
console.error('getSpuLocation timeout
|
|
14050
|
+
console.error('getSpuLocation timeout 10000');
|
|
14051
14051
|
resolve(null);
|
|
14052
14052
|
}
|
|
14053
14053
|
}, 10000);
|
|
@@ -52702,6 +52702,43 @@ var setTitle = function setTitle(pagetitle) {
|
|
|
52702
52702
|
// 父级spu容器 且 是APP
|
|
52703
52703
|
((_window = window) === null || _window === void 0 || (_window = _window.Native) === null || _window === void 0 ? void 0 : _window.setNavigationBarTitle) && window.Native.setNavigationBarTitle(pagetitle);
|
|
52704
52704
|
};
|
|
52705
|
+
var getSpuContainerType = /*#__PURE__*/function () {
|
|
52706
|
+
var _ref = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee() {
|
|
52707
|
+
var _window2, _window3;
|
|
52708
|
+
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
52709
|
+
while (1) switch (_context.prev = _context.next) {
|
|
52710
|
+
case 0:
|
|
52711
|
+
if (!((_window2 = window) !== null && _window2 !== void 0 && (_window2 = _window2.aPaaS) !== null && _window2 !== void 0 && _window2.getPhoto)) {
|
|
52712
|
+
_context.next = 4;
|
|
52713
|
+
break;
|
|
52714
|
+
}
|
|
52715
|
+
return _context.abrupt("return", 'app');
|
|
52716
|
+
case 4:
|
|
52717
|
+
if (!((_window3 = window) !== null && _window3 !== void 0 && (_window3 = _window3.Module) !== null && _window3 !== void 0 && _window3.spuContainerType)) {
|
|
52718
|
+
_context.next = 8;
|
|
52719
|
+
break;
|
|
52720
|
+
}
|
|
52721
|
+
return _context.abrupt("return", window.Module.spuContainerType);
|
|
52722
|
+
case 8:
|
|
52723
|
+
return _context.abrupt("return", '');
|
|
52724
|
+
case 9:
|
|
52725
|
+
case "end":
|
|
52726
|
+
return _context.stop();
|
|
52727
|
+
}
|
|
52728
|
+
}, _callee);
|
|
52729
|
+
}));
|
|
52730
|
+
return function getSpuContainerType() {
|
|
52731
|
+
return _ref.apply(this, arguments);
|
|
52732
|
+
};
|
|
52733
|
+
}();
|
|
52734
|
+
var isInApp = function isInApp() {
|
|
52735
|
+
var _window4, _window5;
|
|
52736
|
+
if ((_window4 = window) !== null && _window4 !== void 0 && (_window4 = _window4.aPaaS) !== null && _window4 !== void 0 && _window4.getPhoto || (_window5 = window) !== null && _window5 !== void 0 && (_window5 = _window5.top) !== null && _window5 !== void 0 && (_window5 = _window5.aPaaS) !== null && _window5 !== void 0 && _window5.getPhoto) {
|
|
52737
|
+
return true;
|
|
52738
|
+
} else {
|
|
52739
|
+
return false;
|
|
52740
|
+
}
|
|
52741
|
+
};
|
|
52705
52742
|
|
|
52706
52743
|
function e(e){this.message=e;}e.prototype=new Error,e.prototype.name="InvalidCharacterError";var r="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(r){var t=String(r).replace(/=+$/,"");if(t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,a=0,i=0,c="";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?c+=String.fromCharCode(255&n>>(-2*a&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return c};function t(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw "Illegal base64url string!"}try{return function(e){return decodeURIComponent(r(e).replace(/(.)/g,(function(e,r){var t=r.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t="0"+t),"%"+t})))}(t)}catch(e){return r(t)}}function n(e){this.message=e;}function o(e,r){if("string"!=typeof e)throw new n("Invalid token specified");var o=!0===(r=r||{}).header?0:1;try{return JSON.parse(t(e.split(".")[o]))}catch(e){throw new n("Invalid token specified: "+e.message)}}n.prototype=new Error,n.prototype.name="InvalidTokenError";
|
|
52707
52744
|
|
|
@@ -60650,7 +60687,8 @@ var Module = {
|
|
|
60650
60687
|
getModuleData: core.getModuleData.bind(core),
|
|
60651
60688
|
getEnvname: login.getEnvname.bind(login),
|
|
60652
60689
|
getEnvData: core.getEnvData.bind(core),
|
|
60653
|
-
checkModule: core.checkModule.bind(core)
|
|
60690
|
+
checkModule: core.checkModule.bind(core),
|
|
60691
|
+
getSpuContainerType: getSpuContainerType
|
|
60654
60692
|
};
|
|
60655
60693
|
|
|
60656
|
-
export { AMapLoader, Module, normalAxios as apaasAxios, normalAxios as axios, checkLogin, index as components, SPUWebPlugin as default, downloadService, expandexp, functionCheck, getDistance, getLocation, getRefreshToken, getToken, getTokenExpires, getUniqueid, getUser, v4 as getUuid, globalConfig, globalOptions, lsProxy, setTitle, singleLogin, spuAxios, spuConfig, ssProxy, startRefreshtoken, uploadService, wxworkSuite };
|
|
60694
|
+
export { AMapLoader, Module, normalAxios as apaasAxios, normalAxios as axios, checkLogin, index as components, SPUWebPlugin as default, downloadService, expandexp, functionCheck, getDistance, getLocation, getRefreshToken, getToken, getTokenExpires, getUniqueid, getUser, v4 as getUuid, globalConfig, globalOptions, isInApp, lsProxy, setTitle, singleLogin, spuAxios, spuConfig, ssProxy, startRefreshtoken, uploadService, wxworkSuite };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smart100/spu-web-plugin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.34",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "npm run build:types && rollup -c -w",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@amap/amap-jsapi-loader": "^1.0.1",
|
|
41
|
-
"@smart100/wxworksuite-plugin": "^0.0.
|
|
41
|
+
"@smart100/wxworksuite-plugin": "^0.0.12",
|
|
42
42
|
"axios": "^1.6.0",
|
|
43
43
|
"co": "^4.6.0",
|
|
44
44
|
"dayjs": "^1.11.10",
|
package/src/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { initAxios, spuAxios, axios } from './axios'
|
|
|
9
9
|
import { initSpuConfig, spuConfig } from './spuConfig'
|
|
10
10
|
import { globalConfig } from './globalConfig'
|
|
11
11
|
import { downloadService, uploadService } from './oss'
|
|
12
|
-
import { getUniqueid, functionCheck, setTitle } from './utils'
|
|
12
|
+
import { getUniqueid, functionCheck, setTitle, getSpuContainerType, isInApp } from './utils'
|
|
13
13
|
import urlquery from './urlquery'
|
|
14
14
|
import AMapLoader from './AMapLoader'
|
|
15
15
|
import login from './login'
|
|
@@ -142,7 +142,8 @@ const Module = {
|
|
|
142
142
|
getModuleData: core.getModuleData.bind(core),
|
|
143
143
|
getEnvname: login.getEnvname.bind(login),
|
|
144
144
|
getEnvData: core.getEnvData.bind(core),
|
|
145
|
-
checkModule: core.checkModule.bind(core)
|
|
145
|
+
checkModule: core.checkModule.bind(core),
|
|
146
|
+
getSpuContainerType: getSpuContainerType
|
|
146
147
|
}
|
|
147
148
|
|
|
148
149
|
|
|
@@ -164,6 +165,7 @@ export {
|
|
|
164
165
|
getUuid,
|
|
165
166
|
functionCheck,
|
|
166
167
|
setTitle,
|
|
168
|
+
isInApp,
|
|
167
169
|
AMapLoader,
|
|
168
170
|
getToken,
|
|
169
171
|
getTokenExpires,
|
package/src/location.ts
CHANGED
package/src/types/index.d.ts
CHANGED
|
@@ -83,6 +83,7 @@ export const getUniqueid: () => string
|
|
|
83
83
|
export const getUuid: () => string
|
|
84
84
|
export const functionCheck: (functioncode?: string) => boolean
|
|
85
85
|
export const setTitle: (pagetitle?: string) => void
|
|
86
|
+
export const isInApp: () => boolean
|
|
86
87
|
export const AMapLoader: IAMapLoader
|
|
87
88
|
export const getToken: () => string
|
|
88
89
|
export const getTokenExpires: () => string
|
package/src/utils.ts
CHANGED
|
@@ -42,13 +42,30 @@ const setTitle = (pagetitle?: string) => {
|
|
|
42
42
|
window?.Native?.setNavigationBarTitle && window.Native.setNavigationBarTitle(pagetitle)
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
const getSpuContainerType = async (): Promise<'h5' | 'web' | 'app' | 'smartcenter' | 'smartconfigurationcenter' | ''> => {
|
|
46
|
+
// 只有app端才提供原生拍照能力
|
|
47
|
+
if (window?.aPaaS?.getPhoto) {
|
|
48
|
+
return 'app'
|
|
49
|
+
} else if (window?.Module?.spuContainerType) {
|
|
50
|
+
return window.Module.spuContainerType
|
|
51
|
+
} else {
|
|
52
|
+
return ''
|
|
53
|
+
}
|
|
54
|
+
}
|
|
45
55
|
|
|
46
|
-
|
|
47
|
-
|
|
56
|
+
const isInApp = (): boolean => {
|
|
57
|
+
if (window?.aPaaS?.getPhoto || window?.top?.aPaaS?.getPhoto) {
|
|
58
|
+
return true
|
|
59
|
+
} else {
|
|
60
|
+
return false
|
|
61
|
+
}
|
|
62
|
+
}
|
|
48
63
|
|
|
49
64
|
export {
|
|
50
65
|
isIOS,
|
|
51
66
|
getUniqueid,
|
|
52
67
|
functionCheck,
|
|
53
|
-
setTitle
|
|
68
|
+
setTitle,
|
|
69
|
+
getSpuContainerType,
|
|
70
|
+
isInApp
|
|
54
71
|
}
|