@smart100/spu-web-plugin 0.0.33 → 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.
@@ -1,162 +1,162 @@
1
- {
2
- "_args": [
3
- [
4
- "ali-oss@5.3.2",
5
- "c:\\code\\ImageDoDown"
6
- ]
7
- ],
8
- "_from": "ali-oss@5.3.2",
9
- "_id": "ali-oss@5.3.2",
10
- "_inBundle": false,
11
- "_integrity": "sha1-ESWQYsg4ECFJvWJsrA6CtROrvcE=",
12
- "_location": "/ali-oss",
13
- "_phantomChildren": {},
14
- "_requested": {
15
- "type": "version",
16
- "registry": true,
17
- "raw": "ali-oss@5.3.2",
18
- "name": "ali-oss",
19
- "escapedName": "ali-oss",
20
- "rawSpec": "5.3.2",
21
- "saveSpec": null,
22
- "fetchSpec": "5.3.2"
23
- },
24
- "_requiredBy": [
25
- "/"
26
- ],
27
- "_resolved": "https://registry.npm.taobao.org/ali-oss/download/ali-oss-5.3.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fali-oss%2Fdownload%2Fali-oss-5.3.2.tgz",
28
- "_spec": "5.3.2",
29
- "_where": "c:\\code\\ImageDoDown",
30
- "author": {
31
- "name": "dead_horse"
32
- },
33
- "browser": {
34
- "lib/client.js": "./dist/aliyun-oss-sdk.js",
35
- "mime": "./shims/mime.js",
36
- "urllib": "./shims/xhr.js",
37
- "utility": "./shims/utility.js",
38
- "crypto": "./shims/crypto/crypto.js",
39
- "fs": false,
40
- "child_process": false
41
- },
42
- "bugs": {
43
- "url": "https://github.com/aliyun/oss-nodejs-sdk/issues"
44
- },
45
- "dependencies": {
46
- "address": "^1.0.0",
47
- "agentkeepalive": "^3.4.1",
48
- "any-promise": "^1.3.0",
49
- "bowser": "^1.6.0",
50
- "co": "^4.6.0",
51
- "co-defer": "^1.0.0",
52
- "co-gather": "^0.0.1",
53
- "co-priority-queue": "^1.0.3",
54
- "copy-to": "^2.0.1",
55
- "dateformat": "^2.0.0",
56
- "debug": "^2.2.0",
57
- "destroy": "^1.0.4",
58
- "end-or-error": "^1.0.1",
59
- "get-ready": "^1.0.0",
60
- "humanize-ms": "^1.2.0",
61
- "is-type-of": "^1.0.0",
62
- "jstoxml": "^0.2.3",
63
- "merge-descriptors": "^1.0.1",
64
- "mime": "^1.3.4",
65
- "mz-modules": "^2.1.0",
66
- "platform": "^1.3.1",
67
- "sdk-base": "^2.0.1",
68
- "stream-http": "2.8.2",
69
- "stream-wormhole": "^1.0.4",
70
- "urllib": "^2.17.1",
71
- "utility": "^1.8.0",
72
- "xml2js": "^0.4.16"
73
- },
74
- "description": "aliyun oss(object storage service) node client",
75
- "devDependencies": {
76
- "aliasify": "^2.0.0",
77
- "autod": "^2.6.1",
78
- "babel-plugin-transform-runtime": "^6.8.0",
79
- "babel-preset-es2015": "^6.24.1",
80
- "babel-register": "^6.26.0",
81
- "babel-runtime": "^6.6.1",
82
- "babelify": "^7.3.0",
83
- "beautify-benchmark": "^0.2.4",
84
- "benchmark": "^2.1.1",
85
- "bluebird": "^3.1.5",
86
- "browserify": "^13.3.0",
87
- "co-fs": "^1.2.0",
88
- "co-mocha": "^1.2.1",
89
- "crypto-js": "^3.1.9-1",
90
- "eslint": "^4.18.1",
91
- "eslint-config-airbnb": "^16.1.0",
92
- "eslint-plugin-import": "^2.9.0",
93
- "eslint-plugin-jsx-a11y": "^6.0.3",
94
- "eslint-plugin-react": "^7.7.0",
95
- "filereader": "^0.10.3",
96
- "git-pre-hooks": "^1.2.0",
97
- "istanbul": "^0.4.3",
98
- "karma": "^1.7.1",
99
- "karma-browserify": "^5.1.1",
100
- "karma-chrome-launcher": "^2.2.0",
101
- "karma-firefox-launcher": "^1.0.1",
102
- "karma-ie-launcher": "^1.0.0",
103
- "karma-mocha": "^1.3.0",
104
- "karma-safari-launcher": "^1.0.0",
105
- "mm": "^2.0.0",
106
- "mocha": "^3.5.3",
107
- "promise-polyfill": "^6.0.2",
108
- "should": "^11.0.0",
109
- "sinon": "^1.17.7",
110
- "standard-version": "^4.4.0",
111
- "stream-equal": "^1.1.0",
112
- "thunk-mocha": "^1.0.3",
113
- "timemachine": "^0.3.0",
114
- "uglify-js": "^2.8.29",
115
- "watchify": "^3.9.0"
116
- },
117
- "engines": {
118
- "node": ">=8"
119
- },
120
- "files": [
121
- "lib",
122
- "shims",
123
- "dist"
124
- ],
125
- "git-pre-hooks": {
126
- "pre-release": "npm run build-dist",
127
- "post-release": [
128
- "npm run publish-to-npm",
129
- "npm run publish-to-cdn"
130
- ]
131
- },
132
- "homepage": "https://github.com/aliyun/oss-nodejs-sdk",
133
- "keywords": [
134
- "oss",
135
- "client",
136
- "file",
137
- "aliyun"
138
- ],
139
- "license": "MIT",
140
- "main": "lib/client.js",
141
- "name": "ali-oss",
142
- "publishConfig": {
143
- "tag": "latest-5"
144
- },
145
- "repository": {
146
- "type": "git",
147
- "url": "git://github.com/aliyun/oss-nodejs-sdk.git"
148
- },
149
- "scripts": {
150
- "autod": "autod",
151
- "browser-test": "npm run build-test && karma start",
152
- "build-change-log": "standard-version",
153
- "build-dist": "node browser-build.js > dist/aliyun-oss-sdk.js && MINIFY=1 node browser-build.js > dist/aliyun-oss-sdk.min.js",
154
- "build-test": "node browser-build.js > test/browser/build/aliyun-oss-sdk.js && node task/browser-test-build.js > test/browser/build/tests.js",
155
- "jshint": "jshint .",
156
- "publish-to-cdn": "node publish.js",
157
- "publish-to-npm": "node publish-npm-check.js && npm publish",
158
- "test": "mocha -t 60000 -r thunk-mocha -r should test/node/*.test.js",
159
- "test-cov": "istanbul cover node_modules/.bin/_mocha -- -t 60000 -r thunk-mocha -r should test/node/*.test.js"
160
- },
161
- "version": "5.3.2"
162
- }
1
+ {
2
+ "_args": [
3
+ [
4
+ "ali-oss@5.3.2",
5
+ "c:\\code\\ImageDoDown"
6
+ ]
7
+ ],
8
+ "_from": "ali-oss@5.3.2",
9
+ "_id": "ali-oss@5.3.2",
10
+ "_inBundle": false,
11
+ "_integrity": "sha1-ESWQYsg4ECFJvWJsrA6CtROrvcE=",
12
+ "_location": "/ali-oss",
13
+ "_phantomChildren": {},
14
+ "_requested": {
15
+ "type": "version",
16
+ "registry": true,
17
+ "raw": "ali-oss@5.3.2",
18
+ "name": "ali-oss",
19
+ "escapedName": "ali-oss",
20
+ "rawSpec": "5.3.2",
21
+ "saveSpec": null,
22
+ "fetchSpec": "5.3.2"
23
+ },
24
+ "_requiredBy": [
25
+ "/"
26
+ ],
27
+ "_resolved": "https://registry.npm.taobao.org/ali-oss/download/ali-oss-5.3.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fali-oss%2Fdownload%2Fali-oss-5.3.2.tgz",
28
+ "_spec": "5.3.2",
29
+ "_where": "c:\\code\\ImageDoDown",
30
+ "author": {
31
+ "name": "dead_horse"
32
+ },
33
+ "browser": {
34
+ "lib/client.js": "./dist/aliyun-oss-sdk.js",
35
+ "mime": "./shims/mime.js",
36
+ "urllib": "./shims/xhr.js",
37
+ "utility": "./shims/utility.js",
38
+ "crypto": "./shims/crypto/crypto.js",
39
+ "fs": false,
40
+ "child_process": false
41
+ },
42
+ "bugs": {
43
+ "url": "https://github.com/aliyun/oss-nodejs-sdk/issues"
44
+ },
45
+ "dependencies": {
46
+ "address": "^1.0.0",
47
+ "agentkeepalive": "^3.4.1",
48
+ "any-promise": "^1.3.0",
49
+ "bowser": "^1.6.0",
50
+ "co": "^4.6.0",
51
+ "co-defer": "^1.0.0",
52
+ "co-gather": "^0.0.1",
53
+ "co-priority-queue": "^1.0.3",
54
+ "copy-to": "^2.0.1",
55
+ "dateformat": "^2.0.0",
56
+ "debug": "^2.2.0",
57
+ "destroy": "^1.0.4",
58
+ "end-or-error": "^1.0.1",
59
+ "get-ready": "^1.0.0",
60
+ "humanize-ms": "^1.2.0",
61
+ "is-type-of": "^1.0.0",
62
+ "jstoxml": "^0.2.3",
63
+ "merge-descriptors": "^1.0.1",
64
+ "mime": "^1.3.4",
65
+ "mz-modules": "^2.1.0",
66
+ "platform": "^1.3.1",
67
+ "sdk-base": "^2.0.1",
68
+ "stream-http": "2.8.2",
69
+ "stream-wormhole": "^1.0.4",
70
+ "urllib": "^2.17.1",
71
+ "utility": "^1.8.0",
72
+ "xml2js": "^0.4.16"
73
+ },
74
+ "description": "aliyun oss(object storage service) node client",
75
+ "devDependencies": {
76
+ "aliasify": "^2.0.0",
77
+ "autod": "^2.6.1",
78
+ "babel-plugin-transform-runtime": "^6.8.0",
79
+ "babel-preset-es2015": "^6.24.1",
80
+ "babel-register": "^6.26.0",
81
+ "babel-runtime": "^6.6.1",
82
+ "babelify": "^7.3.0",
83
+ "beautify-benchmark": "^0.2.4",
84
+ "benchmark": "^2.1.1",
85
+ "bluebird": "^3.1.5",
86
+ "browserify": "^13.3.0",
87
+ "co-fs": "^1.2.0",
88
+ "co-mocha": "^1.2.1",
89
+ "crypto-js": "^3.1.9-1",
90
+ "eslint": "^4.18.1",
91
+ "eslint-config-airbnb": "^16.1.0",
92
+ "eslint-plugin-import": "^2.9.0",
93
+ "eslint-plugin-jsx-a11y": "^6.0.3",
94
+ "eslint-plugin-react": "^7.7.0",
95
+ "filereader": "^0.10.3",
96
+ "git-pre-hooks": "^1.2.0",
97
+ "istanbul": "^0.4.3",
98
+ "karma": "^1.7.1",
99
+ "karma-browserify": "^5.1.1",
100
+ "karma-chrome-launcher": "^2.2.0",
101
+ "karma-firefox-launcher": "^1.0.1",
102
+ "karma-ie-launcher": "^1.0.0",
103
+ "karma-mocha": "^1.3.0",
104
+ "karma-safari-launcher": "^1.0.0",
105
+ "mm": "^2.0.0",
106
+ "mocha": "^3.5.3",
107
+ "promise-polyfill": "^6.0.2",
108
+ "should": "^11.0.0",
109
+ "sinon": "^1.17.7",
110
+ "standard-version": "^4.4.0",
111
+ "stream-equal": "^1.1.0",
112
+ "thunk-mocha": "^1.0.3",
113
+ "timemachine": "^0.3.0",
114
+ "uglify-js": "^2.8.29",
115
+ "watchify": "^3.9.0"
116
+ },
117
+ "engines": {
118
+ "node": ">=8"
119
+ },
120
+ "files": [
121
+ "lib",
122
+ "shims",
123
+ "dist"
124
+ ],
125
+ "git-pre-hooks": {
126
+ "pre-release": "npm run build-dist",
127
+ "post-release": [
128
+ "npm run publish-to-npm",
129
+ "npm run publish-to-cdn"
130
+ ]
131
+ },
132
+ "homepage": "https://github.com/aliyun/oss-nodejs-sdk",
133
+ "keywords": [
134
+ "oss",
135
+ "client",
136
+ "file",
137
+ "aliyun"
138
+ ],
139
+ "license": "MIT",
140
+ "main": "lib/client.js",
141
+ "name": "ali-oss",
142
+ "publishConfig": {
143
+ "tag": "latest-5"
144
+ },
145
+ "repository": {
146
+ "type": "git",
147
+ "url": "git://github.com/aliyun/oss-nodejs-sdk.git"
148
+ },
149
+ "scripts": {
150
+ "autod": "autod",
151
+ "browser-test": "npm run build-test && karma start",
152
+ "build-change-log": "standard-version",
153
+ "build-dist": "node browser-build.js > dist/aliyun-oss-sdk.js && MINIFY=1 node browser-build.js > dist/aliyun-oss-sdk.min.js",
154
+ "build-test": "node browser-build.js > test/browser/build/aliyun-oss-sdk.js && node task/browser-test-build.js > test/browser/build/tests.js",
155
+ "jshint": "jshint .",
156
+ "publish-to-cdn": "node publish.js",
157
+ "publish-to-npm": "node publish-npm-check.js && npm publish",
158
+ "test": "mocha -t 60000 -r thunk-mocha -r should test/node/*.test.js",
159
+ "test-cov": "istanbul cover node_modules/.bin/_mocha -- -t 60000 -r thunk-mocha -r should test/node/*.test.js"
160
+ },
161
+ "version": "5.3.2"
162
+ }
@@ -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
- // const inWhichSPU = () => {
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
  }