@scayle/omnichannel-nuxt 3.0.1 → 3.0.2
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 +6 -0
- package/README.md +11 -4
- package/dist/module.json +1 -1
- package/dist/runtime/composables/useStoreLocator.d.ts +1 -2
- package/dist/runtime/composables/useStoreLocator.mjs +5 -5
- package/dist/runtime/composables/useStoreVariantById.d.ts +1 -2
- package/dist/runtime/composables/useStoreVariantById.mjs +2 -2
- package/dist/runtime/composables/useStores.d.ts +1 -2
- package/dist/runtime/composables/useStores.mjs +2 -2
- package/dist/runtime/composables/useVariantStores.d.ts +1 -2
- package/dist/runtime/composables/useVariantStores.mjs +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -58,8 +58,12 @@ which can be used to call the following methods:
|
|
|
58
58
|
|
|
59
59
|
## List of composables
|
|
60
60
|
|
|
61
|
+
When using Nuxt 3, composables are automatically registered and do not need to be imported explicitly.
|
|
62
|
+
The Nuxt 3 composables can optionally be imported using the import alias `#omnichannel/composables`.
|
|
63
|
+
|
|
61
64
|
[note]
|
|
62
|
-
When using Nuxt
|
|
65
|
+
When using Nuxt 2, composables can directly be imported from '@scayle/omnichannel-nuxt'.
|
|
66
|
+
[/note]
|
|
63
67
|
|
|
64
68
|
### [useStoreLocator](./src/composables/useStoreLocator.ts)
|
|
65
69
|
|
|
@@ -68,7 +72,8 @@ Getting `storesData` based on a provided address
|
|
|
68
72
|
Example:
|
|
69
73
|
|
|
70
74
|
```typescript
|
|
71
|
-
import { useStoreLocator } from '@scayle/omnichannel-nuxt'
|
|
75
|
+
// import { useStoreLocator } from '@scayle/omnichannel-nuxt' // Nuxt 2
|
|
76
|
+
import { useStoreLocator } from '#omnichannel/composables'
|
|
72
77
|
|
|
73
78
|
const { storesData, refreshStores } = useStoreLocator('useStoreLocator', [
|
|
74
79
|
'openingTimes',
|
|
@@ -82,7 +87,8 @@ Getting `variantStoresData` based on a provided address
|
|
|
82
87
|
Example:
|
|
83
88
|
|
|
84
89
|
```typescript
|
|
85
|
-
import { useStoreLocator } from '@scayle/omnichannel-nuxt'
|
|
90
|
+
// import { useStoreLocator } from '@scayle/omnichannel-nuxt' // Nuxt 2
|
|
91
|
+
import { useStoreLocator } from '#omnichannel/composables'
|
|
86
92
|
|
|
87
93
|
const { variantStoresData, refreshVariantStores } = useStoreLocator(
|
|
88
94
|
'useStoreLocator',
|
|
@@ -98,7 +104,8 @@ Getting `storeVariantData` based on a provided store ID and variant ID
|
|
|
98
104
|
Example:
|
|
99
105
|
|
|
100
106
|
```typescript
|
|
101
|
-
import { useStoreLocator } from '@scayle/omnichannel-nuxt'
|
|
107
|
+
// import { useStoreLocator } from '@scayle/omnichannel-nuxt' // Nuxt 2
|
|
108
|
+
import { useStoreLocator } from '#omnichannel/composables'
|
|
102
109
|
|
|
103
110
|
const { storeVariantData, refreshStoreVariant } = useStoreLocator(
|
|
104
111
|
'useStoreLocator',
|
package/dist/module.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StoreWithProperty } from '../../types';
|
|
2
|
-
declare
|
|
2
|
+
export declare function useStoreLocator(key?: string, withProperties?: StoreWithProperty[]): {
|
|
3
3
|
storesData: any;
|
|
4
4
|
refreshStores: (searchParams: import("../../types").StoreLocatorSearchParams) => Promise<void>;
|
|
5
5
|
storeVariantData: any;
|
|
@@ -7,4 +7,3 @@ declare const _default: (key?: string, withProperties?: StoreWithProperty[]) =>
|
|
|
7
7
|
variantStoresData: any;
|
|
8
8
|
refreshVariantStores: (searchParams: import("../../types").VariantLocatorSearchParams) => Promise<void>;
|
|
9
9
|
};
|
|
10
|
-
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import useStoreVariantById from "./useStoreVariantById.mjs";
|
|
2
|
-
import useStores from "./useStores.mjs";
|
|
3
|
-
import useVariantStores from "./useVariantStores.mjs";
|
|
4
|
-
export
|
|
1
|
+
import { useStoreVariantById } from "./useStoreVariantById.mjs";
|
|
2
|
+
import { useStores } from "./useStores.mjs";
|
|
3
|
+
import { useVariantStores } from "./useVariantStores.mjs";
|
|
4
|
+
export function useStoreLocator(key = "useStoreLocator", withProperties = []) {
|
|
5
5
|
const { data: storesData, getData: refreshStores } = useStores(
|
|
6
6
|
`${key}-stores`,
|
|
7
7
|
withProperties
|
|
@@ -16,4 +16,4 @@ export default (key = "useStoreLocator", withProperties = []) => {
|
|
|
16
16
|
variantStoresData,
|
|
17
17
|
refreshVariantStores
|
|
18
18
|
};
|
|
19
|
-
}
|
|
19
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { StoreWithProperty } from '../../types';
|
|
2
|
-
declare
|
|
2
|
+
export declare function useStoreVariantById(key?: string, withProperties?: StoreWithProperty[]): {
|
|
3
3
|
data: any;
|
|
4
4
|
getData: (variantId: number, storeId: number) => Promise<void>;
|
|
5
5
|
};
|
|
6
|
-
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { computed, useState } from "#imports";
|
|
2
|
-
export
|
|
2
|
+
export function useStoreVariantById(key = "useStoreVariantById", withProperties = []) {
|
|
3
3
|
const response = useState(key, () => null);
|
|
4
4
|
const getData = async (variantId, storeId) => {
|
|
5
5
|
response.value = (await $fetch(
|
|
@@ -18,4 +18,4 @@ export default (key = "useStoreVariantById", withProperties = []) => {
|
|
|
18
18
|
data: computed(() => response.value),
|
|
19
19
|
getData
|
|
20
20
|
};
|
|
21
|
-
}
|
|
21
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { StoreLocatorSearchParams, StoreWithProperty } from '../../types';
|
|
2
|
-
declare
|
|
2
|
+
export declare function useStores(key?: string, withProperties?: StoreWithProperty[]): {
|
|
3
3
|
data: any;
|
|
4
4
|
getData: (searchParams: StoreLocatorSearchParams) => Promise<void>;
|
|
5
5
|
};
|
|
6
|
-
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, computed } from "#imports";
|
|
2
|
-
export
|
|
2
|
+
export function useStores(key = "useStores", withProperties = []) {
|
|
3
3
|
const response = useState(key, () => null);
|
|
4
4
|
const getData = async (searchParams) => {
|
|
5
5
|
response.value = await $fetch(
|
|
@@ -11,4 +11,4 @@ export default (key = "useStores", withProperties = []) => {
|
|
|
11
11
|
data: computed(() => response.value?.data),
|
|
12
12
|
getData
|
|
13
13
|
};
|
|
14
|
-
}
|
|
14
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { VariantLocatorSearchParams, StoreWithProperty } from '../../types';
|
|
2
|
-
declare
|
|
2
|
+
export declare function useVariantStores(key?: string, withProperties?: StoreWithProperty[]): {
|
|
3
3
|
data: any;
|
|
4
4
|
getData: (searchParams: VariantLocatorSearchParams) => Promise<void>;
|
|
5
5
|
};
|
|
6
|
-
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, computed } from "#imports";
|
|
2
|
-
export
|
|
2
|
+
export function useVariantStores(key = "useVariantStores", withProperties = []) {
|
|
3
3
|
const response = useState(key, () => null);
|
|
4
4
|
const getData = async (searchParams) => {
|
|
5
5
|
response.value = (await $fetch("/api/omnichannel/variantStores", {
|
|
@@ -11,4 +11,4 @@ export default (key = "useVariantStores", withProperties = []) => {
|
|
|
11
11
|
data: computed(() => response.value),
|
|
12
12
|
getData
|
|
13
13
|
};
|
|
14
|
-
}
|
|
14
|
+
}
|