@wix/site-service-device-info 1.0.2 → 1.0.3
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/cjs/build/definition/index.js.map +1 -1
- package/cjs/build/implementations/deviceInfoService.js.map +1 -1
- package/cjs/package.json +1 -1
- package/definition/package.json +1 -1
- package/dist/definition/index.js.map +1 -1
- package/dist/implementations/deviceInfoService.js.map +1 -1
- package/implementations/package.json +1 -1
- package/package.json +16 -16
- package/src/definition/index.ts +6 -6
- package/src/implementations/deviceInfoService.ts +22 -22
- package/types/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/definition/index.ts"],"names":[],"mappings":";;;AAAA,oEAAyD;AAiB5C,QAAA,oBAAoB,GAAG,IAAA,oCAAa,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/definition/index.ts"],"names":[],"mappings":";;;AAAA,oEAAyD;AAiB5C,QAAA,oBAAoB,GAAG,IAAA,oCAAa,EAChD,+BAA+B,CAC/B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceInfoService.js","sourceRoot":"","sources":["../../../src/implementations/deviceInfoService.ts"],"names":[],"mappings":";;;AAAA,oEAA4D;AAE5D,6EAA0F;AAE1F,8CAAoD;AAGpD,MAAM,mBAAmB,GAAe,SAAS,CAAA;AACjD,MAAM,sBAAsB,GAAG,KAAK,CAAA;AAEvB,QAAA,iBAAiB,GAAG,IAAA,uCAAgB,
|
|
1
|
+
{"version":3,"file":"deviceInfoService.js","sourceRoot":"","sources":["../../../src/implementations/deviceInfoService.ts"],"names":[],"mappings":";;;AAAA,oEAA4D;AAE5D,6EAA0F;AAE1F,8CAAoD;AAGpD,MAAM,mBAAmB,GAAe,SAAS,CAAA;AACjD,MAAM,sBAAsB,GAAG,KAAK,CAAA;AAEvB,QAAA,iBAAiB,GAAG,IAAA,uCAAgB,EAChD,iCAAoB,EACpB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAgD,EAAsB,EAAE;IAC5F,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,kCAAwB,CAAC,CAAA;IACvD,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,IAAI,mBAAmB,CAAC,CAAA;IACpE,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,IAAI,sBAAsB,CAAC,CAAA;IAE7E,OAAO;QACN,IAAI,UAAU;YACb,OAAO,WAAW,CAAC,GAAG,EAAE,CAAA;QACzB,CAAC;QACD,IAAI,aAAa;YAChB,OAAO,cAAc,CAAC,GAAG,EAAE,CAAA;QAC5B,CAAC;QACD,aAAa,CAAC,EAAE,UAAU,EAAE,aAAa,EAAqC;YAC7E,IAAI,OAAO,UAAU,KAAK,WAAW,EAAE,CAAC;gBACvC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;YAC5B,CAAC;YACD,IAAI,OAAO,aAAa,KAAK,WAAW,EAAE,CAAC;gBAC1C,cAAc,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;YAClC,CAAC;QACF,CAAC;KACD,CAAA;AACF,CAAC,CACD,CAAA"}
|
package/cjs/package.json
CHANGED
package/definition/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAiBzD,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAiBzD,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAChD,+BAA+B,CAC/B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceInfoService.js","sourceRoot":"","sources":["../../src/implementations/deviceInfoService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAE5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAA;AAE1F,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAGpD,MAAM,mBAAmB,GAAe,SAAS,CAAA;AACjD,MAAM,sBAAsB,GAAG,KAAK,CAAA;AAEpC,MAAM,CAAC,MAAM,iBAAiB,GAAG,gBAAgB,
|
|
1
|
+
{"version":3,"file":"deviceInfoService.js","sourceRoot":"","sources":["../../src/implementations/deviceInfoService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAE5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAA;AAE1F,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAGpD,MAAM,mBAAmB,GAAe,SAAS,CAAA;AACjD,MAAM,sBAAsB,GAAG,KAAK,CAAA;AAEpC,MAAM,CAAC,MAAM,iBAAiB,GAAG,gBAAgB,CAChD,oBAAoB,EACpB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAgD,EAAsB,EAAE;IAC5F,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,wBAAwB,CAAC,CAAA;IACvD,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,IAAI,mBAAmB,CAAC,CAAA;IACpE,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,IAAI,sBAAsB,CAAC,CAAA;IAE7E,OAAO;QACN,IAAI,UAAU;YACb,OAAO,WAAW,CAAC,GAAG,EAAE,CAAA;QACzB,CAAC;QACD,IAAI,aAAa;YAChB,OAAO,cAAc,CAAC,GAAG,EAAE,CAAA;QAC5B,CAAC;QACD,aAAa,CAAC,EAAE,UAAU,EAAE,aAAa,EAAqC;YAC7E,IAAI,OAAO,UAAU,KAAK,WAAW,EAAE,CAAC;gBACvC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;YAC5B,CAAC;YACD,IAAI,OAAO,aAAa,KAAK,WAAW,EAAE,CAAC;gBAC1C,cAAc,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;YAClC,CAAC;QACF,CAAC;KACD,CAAA;AACF,CAAC,CACD,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/site-service-device-info",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"main": "cjs/build/index.js",
|
|
5
|
-
"module": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
3
|
+
"version": "1.0.3",
|
|
7
4
|
"license": "UNLICENSED",
|
|
8
5
|
"files": [
|
|
9
6
|
"dist",
|
|
@@ -14,6 +11,10 @@
|
|
|
14
11
|
"types",
|
|
15
12
|
"!**/*.tsbuildinfo"
|
|
16
13
|
],
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"main": "cjs/build/index.js",
|
|
16
|
+
"module": "dist/index.js",
|
|
17
|
+
"types": "dist/index.d.ts",
|
|
17
18
|
"exports": {
|
|
18
19
|
".": {
|
|
19
20
|
"types": "./dist/index.d.ts",
|
|
@@ -41,6 +42,16 @@
|
|
|
41
42
|
"require": "./cjs/build/service.js"
|
|
42
43
|
}
|
|
43
44
|
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"registry": "https://registry.npmjs.org/",
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "tsc -b . --force && tsc --project tsconfig.cjs.json",
|
|
51
|
+
"lint": "yarn run -T lint:package $npm_package_name",
|
|
52
|
+
"test": "vitest --run && yarn test-type-check",
|
|
53
|
+
"test-type-check": "echo 'validating typescript in test files' && tsc --project tsconfig.test.json && echo 'Finished validating typescript in test files successfully'"
|
|
54
|
+
},
|
|
44
55
|
"dependencies": {
|
|
45
56
|
"@wix/services-definitions": "^0.1.4",
|
|
46
57
|
"@wix/services-manager": "^0.2.20"
|
|
@@ -49,18 +60,7 @@
|
|
|
49
60
|
"typescript": "^5.3.3",
|
|
50
61
|
"vitest": "4.1.0"
|
|
51
62
|
},
|
|
52
|
-
"scripts": {
|
|
53
|
-
"build": "tsc -b . --force && tsc --project tsconfig.cjs.json",
|
|
54
|
-
"lint": "yarn run -T lint:package $npm_package_name",
|
|
55
|
-
"test": "vitest --run && yarn test-type-check",
|
|
56
|
-
"test-type-check": "echo 'validating typescript in test files' && tsc --project tsconfig.test.json && echo 'Finished validating typescript in test files successfully'"
|
|
57
|
-
},
|
|
58
63
|
"publishUnscoped": false,
|
|
59
|
-
"publishConfig": {
|
|
60
|
-
"registry": "https://registry.npmjs.org/",
|
|
61
|
-
"access": "public"
|
|
62
|
-
},
|
|
63
|
-
"sideEffects": false,
|
|
64
64
|
"wix": {
|
|
65
65
|
"artifact": {
|
|
66
66
|
"groupId": "com.wixpress.npm",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
]
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
|
-
"falconPackageHash": "
|
|
80
|
+
"falconPackageHash": "968ede1b529616a319e844768773f57dd75950881cbd5ff6e449d72e"
|
|
81
81
|
}
|
package/src/definition/index.ts
CHANGED
|
@@ -3,18 +3,18 @@ import type { ServiceDefinition } from '@wix/services-definitions'
|
|
|
3
3
|
import type { DeviceType } from '../types'
|
|
4
4
|
|
|
5
5
|
export type IDeviceInfoServiceConfig = {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
deviceType?: DeviceType
|
|
7
|
+
reducedMotion?: boolean
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export interface IDeviceInfoService {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
readonly deviceType: DeviceType
|
|
12
|
+
readonly reducedMotion: boolean
|
|
13
|
+
_updateConfig: (config: Partial<IDeviceInfoServiceConfig>) => void
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export type IDeviceInfoDefinition = ServiceDefinition<IDeviceInfoService, IDeviceInfoServiceConfig>
|
|
17
17
|
|
|
18
18
|
export const DeviceInfoDefinition = defineService<IDeviceInfoService, IDeviceInfoServiceConfig>(
|
|
19
|
-
|
|
19
|
+
'@wix/site-service-device-info'
|
|
20
20
|
)
|
|
@@ -9,27 +9,27 @@ const DEFAULT_DEVICE_TYPE: DeviceType = 'Desktop'
|
|
|
9
9
|
const DEFAULT_REDUCED_MOTION = false
|
|
10
10
|
|
|
11
11
|
export const DeviceInfoService = implementService(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
DeviceInfoDefinition,
|
|
13
|
+
({ config, getService }: ServiceFactoryOpts<IDeviceInfoServiceConfig>): IDeviceInfoService => {
|
|
14
|
+
const { signal } = getService(SignalsServiceDefinition)
|
|
15
|
+
const _deviceType = signal(config.deviceType ?? DEFAULT_DEVICE_TYPE)
|
|
16
|
+
const _reducedMotion = signal(config.reducedMotion ?? DEFAULT_REDUCED_MOTION)
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
18
|
+
return {
|
|
19
|
+
get deviceType() {
|
|
20
|
+
return _deviceType.get()
|
|
21
|
+
},
|
|
22
|
+
get reducedMotion() {
|
|
23
|
+
return _reducedMotion.get()
|
|
24
|
+
},
|
|
25
|
+
_updateConfig({ deviceType, reducedMotion }: Partial<IDeviceInfoServiceConfig>) {
|
|
26
|
+
if (typeof deviceType !== 'undefined') {
|
|
27
|
+
_deviceType.set(deviceType)
|
|
28
|
+
}
|
|
29
|
+
if (typeof reducedMotion !== 'undefined') {
|
|
30
|
+
_reducedMotion.set(reducedMotion)
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
35
|
)
|
package/types/package.json
CHANGED