@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.
Files changed (110) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +23 -35
  3. package/dist/chunks/createOmnichannelHandler.mjs +790 -0
  4. package/dist/index.d.mts +40 -0
  5. package/dist/index.d.ts +40 -9
  6. package/dist/index.mjs +96 -0
  7. package/dist/module.cjs +5 -0
  8. package/dist/module.d.mts +6 -0
  9. package/dist/module.d.ts +6 -0
  10. package/dist/module.json +4 -0
  11. package/dist/module.mjs +36 -0
  12. package/dist/runtime/composables/useStoreLocator.d.ts +9 -0
  13. package/dist/runtime/composables/useStoreLocator.mjs +18 -0
  14. package/dist/{composables → runtime/composables}/useStoreVariantById.d.ts +1 -2
  15. package/dist/runtime/composables/useStoreVariantById.mjs +20 -0
  16. package/dist/runtime/composables/useStores.d.ts +6 -0
  17. package/dist/runtime/composables/useStores.mjs +14 -0
  18. package/dist/runtime/composables/useVariantStores.d.ts +6 -0
  19. package/dist/runtime/composables/useVariantStores.mjs +14 -0
  20. package/dist/{constants → runtime/constants}/httpStatus.d.ts +1 -2
  21. package/dist/runtime/constants/httpStatus.mjs +629 -0
  22. package/dist/runtime/constants/index.d.ts +1 -0
  23. package/dist/runtime/constants/index.mjs +1 -0
  24. package/dist/{error → runtime/error}/errorHandler.d.ts +0 -1
  25. package/dist/runtime/error/errorHandler.mjs +20 -0
  26. package/dist/runtime/handler.d.ts +2 -0
  27. package/dist/runtime/handler.mjs +48 -0
  28. package/dist/runtime/lib/init.d.ts +26 -0
  29. package/dist/runtime/lib/init.mjs +72 -0
  30. package/dist/{rpc → runtime/rpc}/storeLocator.d.ts +4 -11
  31. package/dist/runtime/rpc/storeLocator.mjs +32 -0
  32. package/dist/{types/omnichannel.d.ts → shared/omnichannel-nuxt.9b492196.d.mts} +25 -24
  33. package/dist/shared/omnichannel-nuxt.9b492196.d.ts +146 -0
  34. package/dist/types.d.mts +8 -0
  35. package/dist/types.d.ts +8 -0
  36. package/package.json +42 -17
  37. package/dist/composables/sharedRef.d.ts +0 -3
  38. package/dist/composables/sharedRef.d.ts.map +0 -1
  39. package/dist/composables/sharedRef.js +0 -16
  40. package/dist/composables/sharedRef.js.map +0 -1
  41. package/dist/composables/useGeocode.d.ts +0 -7
  42. package/dist/composables/useGeocode.d.ts.map +0 -1
  43. package/dist/composables/useGeocode.js +0 -17
  44. package/dist/composables/useGeocode.js.map +0 -1
  45. package/dist/composables/useStoreLocator.d.ts +0 -10
  46. package/dist/composables/useStoreLocator.d.ts.map +0 -1
  47. package/dist/composables/useStoreLocator.js +0 -17
  48. package/dist/composables/useStoreLocator.js.map +0 -1
  49. package/dist/composables/useStoreVariantById.d.ts.map +0 -1
  50. package/dist/composables/useStoreVariantById.js +0 -20
  51. package/dist/composables/useStoreVariantById.js.map +0 -1
  52. package/dist/composables/useStores.d.ts +0 -7
  53. package/dist/composables/useStores.d.ts.map +0 -1
  54. package/dist/composables/useStores.js +0 -17
  55. package/dist/composables/useStores.js.map +0 -1
  56. package/dist/composables/useVariantStores.d.ts +0 -7
  57. package/dist/composables/useVariantStores.d.ts.map +0 -1
  58. package/dist/composables/useVariantStores.js +0 -17
  59. package/dist/composables/useVariantStores.js.map +0 -1
  60. package/dist/constants/httpStatus.d.ts.map +0 -1
  61. package/dist/constants/httpStatus.js +0 -634
  62. package/dist/constants/httpStatus.js.map +0 -1
  63. package/dist/constants/index.d.ts +0 -2
  64. package/dist/constants/index.d.ts.map +0 -1
  65. package/dist/constants/index.js +0 -5
  66. package/dist/constants/index.js.map +0 -1
  67. package/dist/constants/omnichannel.d.ts +0 -12
  68. package/dist/constants/omnichannel.d.ts.map +0 -1
  69. package/dist/constants/omnichannel.js +0 -13
  70. package/dist/constants/omnichannel.js.map +0 -1
  71. package/dist/error/errorHandler.d.ts.map +0 -1
  72. package/dist/error/errorHandler.js +0 -27
  73. package/dist/error/errorHandler.js.map +0 -1
  74. package/dist/index.d.ts.map +0 -1
  75. package/dist/index.js +0 -18
  76. package/dist/index.js.map +0 -1
  77. package/dist/lib/init.d.ts +0 -11
  78. package/dist/lib/init.d.ts.map +0 -1
  79. package/dist/lib/init.js +0 -49
  80. package/dist/lib/init.js.map +0 -1
  81. package/dist/module/createOmnichannelHandler.d.ts +0 -3
  82. package/dist/module/createOmnichannelHandler.d.ts.map +0 -1
  83. package/dist/module/createOmnichannelHandler.js +0 -56
  84. package/dist/module/createOmnichannelHandler.js.map +0 -1
  85. package/dist/module/register.d.ts +0 -6
  86. package/dist/module/register.d.ts.map +0 -1
  87. package/dist/module/register.js +0 -12
  88. package/dist/module/register.js.map +0 -1
  89. package/dist/rpc/geocode.d.ts +0 -23
  90. package/dist/rpc/geocode.d.ts.map +0 -1
  91. package/dist/rpc/geocode.js +0 -46
  92. package/dist/rpc/geocode.js.map +0 -1
  93. package/dist/rpc/index.d.ts +0 -3
  94. package/dist/rpc/index.d.ts.map +0 -1
  95. package/dist/rpc/index.js +0 -6
  96. package/dist/rpc/index.js.map +0 -1
  97. package/dist/rpc/storeLocator.d.ts.map +0 -1
  98. package/dist/rpc/storeLocator.js +0 -69
  99. package/dist/rpc/storeLocator.js.map +0 -1
  100. package/dist/types/geocode.d.ts +0 -8
  101. package/dist/types/geocode.d.ts.map +0 -1
  102. package/dist/types/geocode.js +0 -3
  103. package/dist/types/geocode.js.map +0 -1
  104. package/dist/types/index.d.ts +0 -3
  105. package/dist/types/index.d.ts.map +0 -1
  106. package/dist/types/index.js +0 -6
  107. package/dist/types/index.js.map +0 -1
  108. package/dist/types/omnichannel.d.ts.map +0 -1
  109. package/dist/types/omnichannel.js +0 -3
  110. 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 nuxt.
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 `omnichannel-nuxt`, make sure to
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/register',
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
- ```