@scayle/omnichannel-nuxt 1.1.19 → 2.1.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/CHANGELOG.md +34 -0
- package/README.md +23 -35
- package/dist/chunks/createOmnichannelHandler.mjs +790 -0
- package/dist/index.d.mts +40 -0
- package/dist/index.d.ts +40 -9
- package/dist/index.mjs +96 -0
- package/dist/module.cjs +5 -0
- package/dist/module.d.mts +6 -0
- package/dist/module.d.ts +6 -0
- package/dist/module.json +4 -0
- package/dist/module.mjs +36 -0
- package/dist/runtime/composables/useStoreLocator.d.ts +9 -0
- package/dist/runtime/composables/useStoreLocator.mjs +18 -0
- package/dist/{composables → runtime/composables}/useStoreVariantById.d.ts +1 -2
- package/dist/runtime/composables/useStoreVariantById.mjs +20 -0
- package/dist/runtime/composables/useStores.d.ts +6 -0
- package/dist/runtime/composables/useStores.mjs +14 -0
- package/dist/runtime/composables/useVariantStores.d.ts +6 -0
- package/dist/runtime/composables/useVariantStores.mjs +14 -0
- package/dist/{constants → runtime/constants}/httpStatus.d.ts +1 -2
- package/dist/runtime/constants/httpStatus.mjs +629 -0
- package/dist/runtime/constants/index.d.ts +1 -0
- package/dist/runtime/constants/index.mjs +1 -0
- package/dist/{error → runtime/error}/errorHandler.d.ts +0 -1
- package/dist/runtime/error/errorHandler.mjs +20 -0
- package/dist/runtime/handler.d.ts +2 -0
- package/dist/runtime/handler.mjs +48 -0
- package/dist/runtime/lib/init.d.ts +26 -0
- package/dist/runtime/lib/init.mjs +72 -0
- package/dist/{rpc → runtime/rpc}/storeLocator.d.ts +4 -11
- package/dist/runtime/rpc/storeLocator.mjs +32 -0
- package/dist/{types/omnichannel.d.ts → shared/omnichannel-nuxt.9b492196.d.mts} +25 -24
- package/dist/shared/omnichannel-nuxt.9b492196.d.ts +146 -0
- package/dist/types.d.mts +8 -0
- package/dist/types.d.ts +8 -0
- package/package.json +42 -17
- package/dist/composables/sharedRef.d.ts +0 -3
- package/dist/composables/sharedRef.d.ts.map +0 -1
- package/dist/composables/sharedRef.js +0 -16
- package/dist/composables/sharedRef.js.map +0 -1
- package/dist/composables/useGeocode.d.ts +0 -7
- package/dist/composables/useGeocode.d.ts.map +0 -1
- package/dist/composables/useGeocode.js +0 -17
- package/dist/composables/useGeocode.js.map +0 -1
- package/dist/composables/useStoreLocator.d.ts +0 -10
- package/dist/composables/useStoreLocator.d.ts.map +0 -1
- package/dist/composables/useStoreLocator.js +0 -17
- package/dist/composables/useStoreLocator.js.map +0 -1
- package/dist/composables/useStoreVariantById.d.ts.map +0 -1
- package/dist/composables/useStoreVariantById.js +0 -20
- package/dist/composables/useStoreVariantById.js.map +0 -1
- package/dist/composables/useStores.d.ts +0 -7
- package/dist/composables/useStores.d.ts.map +0 -1
- package/dist/composables/useStores.js +0 -17
- package/dist/composables/useStores.js.map +0 -1
- package/dist/composables/useVariantStores.d.ts +0 -7
- package/dist/composables/useVariantStores.d.ts.map +0 -1
- package/dist/composables/useVariantStores.js +0 -17
- package/dist/composables/useVariantStores.js.map +0 -1
- package/dist/constants/httpStatus.d.ts.map +0 -1
- package/dist/constants/httpStatus.js +0 -634
- package/dist/constants/httpStatus.js.map +0 -1
- package/dist/constants/index.d.ts +0 -2
- package/dist/constants/index.d.ts.map +0 -1
- package/dist/constants/index.js +0 -5
- package/dist/constants/index.js.map +0 -1
- package/dist/constants/omnichannel.d.ts +0 -12
- package/dist/constants/omnichannel.d.ts.map +0 -1
- package/dist/constants/omnichannel.js +0 -13
- package/dist/constants/omnichannel.js.map +0 -1
- package/dist/error/errorHandler.d.ts.map +0 -1
- package/dist/error/errorHandler.js +0 -27
- package/dist/error/errorHandler.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -18
- package/dist/index.js.map +0 -1
- package/dist/lib/init.d.ts +0 -11
- package/dist/lib/init.d.ts.map +0 -1
- package/dist/lib/init.js +0 -49
- package/dist/lib/init.js.map +0 -1
- package/dist/module/createOmnichannelHandler.d.ts +0 -3
- package/dist/module/createOmnichannelHandler.d.ts.map +0 -1
- package/dist/module/createOmnichannelHandler.js +0 -56
- package/dist/module/createOmnichannelHandler.js.map +0 -1
- package/dist/module/register.d.ts +0 -6
- package/dist/module/register.d.ts.map +0 -1
- package/dist/module/register.js +0 -12
- package/dist/module/register.js.map +0 -1
- package/dist/rpc/geocode.d.ts +0 -23
- package/dist/rpc/geocode.d.ts.map +0 -1
- package/dist/rpc/geocode.js +0 -46
- package/dist/rpc/geocode.js.map +0 -1
- package/dist/rpc/index.d.ts +0 -3
- package/dist/rpc/index.d.ts.map +0 -1
- package/dist/rpc/index.js +0 -6
- package/dist/rpc/index.js.map +0 -1
- package/dist/rpc/storeLocator.d.ts.map +0 -1
- package/dist/rpc/storeLocator.js +0 -69
- package/dist/rpc/storeLocator.js.map +0 -1
- package/dist/types/geocode.d.ts +0 -8
- package/dist/types/geocode.d.ts.map +0 -1
- package/dist/types/geocode.js +0 -3
- package/dist/types/geocode.js.map +0 -1
- package/dist/types/index.d.ts +0 -3
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -6
- package/dist/types/index.js.map +0 -1
- package/dist/types/omnichannel.d.ts.map +0 -1
- package/dist/types/omnichannel.js +0 -3
- package/dist/types/omnichannel.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @scayle/omnichannel-nuxt
|
|
2
2
|
|
|
3
|
+
## 2.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Updated to `nuxt@3.10.1` (_For more details check the [Nuxt 3.10.1 Release Notes](https://nuxt.com/blog/v3-10)_)
|
|
8
|
+
|
|
9
|
+
## 2.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- Remove `useGeocode` composable
|
|
14
|
+
- Add support for Nuxt 3
|
|
15
|
+
- **BREAKING**: Change structure of data returned in `useStoreVariantById`, `useStores` and `useVariantStores`
|
|
16
|
+
|
|
17
|
+
The `data` property returned by these composables was previously wrapped in an `AxiosResponse`. This is no longer, the case so to update remove the extra property access. This also affects `useStoreLocator` because it depends on these composables. The typing of these composables has also been fixed, so manual assertions are no longer necessary.
|
|
18
|
+
|
|
19
|
+
Before:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
const { variantStoresData } = useStoreLocator()
|
|
23
|
+
const stores = computed(() => variantStoresData.value?.data.stores as StoreLocation[])
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
After:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
const { variantStoresData } = useStoreLocator()
|
|
30
|
+
const stores = computed(() => variantStoresData.value?.stores)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
- **BREAKING**: Update Nuxt module registration entrypoint
|
|
34
|
+
|
|
35
|
+
When installing this release, you must update your Nuxt config and replace `@scayle/omnichannel-nuxt/dist/module/register` with `@scayle/omnichannel-nuxt/module`
|
|
36
|
+
|
|
3
37
|
## 1.1.19
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
# Omnichannel
|
|
2
2
|
|
|
3
|
-
This is the basis for setting up a new Omnichannel Add On based on
|
|
3
|
+
This is the basis for setting up a new Omnichannel Add On based on Nuxt.
|
|
4
4
|
It provides a reusable composable, that can be used in the actual shop project.
|
|
5
5
|
|
|
6
6
|
## Getting started
|
|
7
7
|
|
|
8
|
-
To start working with
|
|
8
|
+
To start working with `@scayle/omnichannel-nuxt`, make sure to
|
|
9
9
|
register it as a module in your nuxt.config.ts file:
|
|
10
10
|
|
|
11
|
+
Nuxt 2
|
|
12
|
+
|
|
11
13
|
```typescript
|
|
12
14
|
import { NuxtConfig } from '@nuxt/types'
|
|
13
15
|
|
|
@@ -17,11 +19,10 @@ const config: NuxtConfig & { storefront: ModuleOptions } = {
|
|
|
17
19
|
modules: [
|
|
18
20
|
// ...
|
|
19
21
|
[
|
|
20
|
-
'@scayle/omnichannel-nuxt/dist/module
|
|
22
|
+
'@scayle/omnichannel-nuxt/dist/module',
|
|
21
23
|
{
|
|
22
24
|
host: environment.OMNICHANNEL_API_HOST,
|
|
23
25
|
token: environment.OMNICHANNEL_API_TOKEN,
|
|
24
|
-
googleApiKey: environment.OMNICHANNEL_GOOGLE_API_KEY,
|
|
25
26
|
},
|
|
26
27
|
],
|
|
27
28
|
],
|
|
@@ -32,6 +33,21 @@ const config: NuxtConfig & { storefront: ModuleOptions } = {
|
|
|
32
33
|
export default config
|
|
33
34
|
```
|
|
34
35
|
|
|
36
|
+
Nuxt 3
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
export default defineNuxtConfig({
|
|
40
|
+
modules: ['@scayle/omnichannel-nuxt/module'],
|
|
41
|
+
runtimeConfig: {
|
|
42
|
+
/** Omnichannel runtime configuration */
|
|
43
|
+
omnichannel: {
|
|
44
|
+
apiHost: '', // Override: NUXT_OMNICHANNEL_API_HOST
|
|
45
|
+
apiToken: '', // Override: NUXT_OMNICHANNEL_API_TOKEN
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
})
|
|
49
|
+
```
|
|
50
|
+
|
|
35
51
|
## Architecture
|
|
36
52
|
|
|
37
53
|
The Omnichannel Add-On package provides `useStoreLocator` composable,
|
|
@@ -41,11 +57,11 @@ which can be used to call the following methods:
|
|
|
41
57
|
- `refreshVariantStores` to get `variantStoresData` based on provided store ID
|
|
42
58
|
- `refreshStoreVariant` to get `storeVariantData` based on provided store ID and variant ID
|
|
43
59
|
|
|
44
|
-
The Omnichannel Add-On package provides also `useGeocode` composable,
|
|
45
|
-
which can be used to call `getData` to get city location based on given params
|
|
46
|
-
|
|
47
60
|
## List of composables
|
|
48
61
|
|
|
62
|
+
[note]
|
|
63
|
+
When using Nuxt 3, composables are automatically registered and do not need to be imported explicitly. [/note]
|
|
64
|
+
|
|
49
65
|
### [useStoreLocator](./src/composables/useStoreLocator.ts)
|
|
50
66
|
|
|
51
67
|
Getting `storesData` based on provided address
|
|
@@ -85,31 +101,3 @@ const variantId = 1
|
|
|
85
101
|
const storeId = 12
|
|
86
102
|
await refreshStores(variantId, storeId)
|
|
87
103
|
```
|
|
88
|
-
|
|
89
|
-
### [useGeocode](./src/composables/useGeocode.ts)
|
|
90
|
-
|
|
91
|
-
Getting `data` (city) based on provided params
|
|
92
|
-
|
|
93
|
-
- latitude and longitude OR
|
|
94
|
-
- address, zipcode
|
|
95
|
-
|
|
96
|
-
Example 1:
|
|
97
|
-
|
|
98
|
-
```typescript
|
|
99
|
-
import { useGeocode } from '@scayle/omnichannel-nuxt'
|
|
100
|
-
|
|
101
|
-
const { data, getData } = useGeocode()
|
|
102
|
-
const address = 'Berlin'
|
|
103
|
-
await getData(address)
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
Example 2:
|
|
107
|
-
|
|
108
|
-
```typescript
|
|
109
|
-
import { useGeocode } from '@scayle/omnichannel-nuxt'
|
|
110
|
-
|
|
111
|
-
const { data, getData } = useGeocode()
|
|
112
|
-
const lat = 52.520006
|
|
113
|
-
const lng = 13.404954
|
|
114
|
-
await getData({ lat, lng })
|
|
115
|
-
```
|