@scayle/omnichannel-nuxt 2.1.4 → 3.0.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 +25 -0
- package/README.md +11 -3
- package/dist/chunks/createOmnichannelHandler.mjs +15 -6
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +12 -5
- package/dist/module.d.mts +1 -1
- package/dist/module.d.ts +1 -1
- package/dist/module.json +1 -1
- package/dist/runtime/composables/useStoreLocator.d.ts +2 -1
- package/dist/runtime/composables/useStoreLocator.mjs +5 -4
- package/dist/runtime/composables/useStoreVariantById.d.ts +2 -1
- package/dist/runtime/composables/useStoreVariantById.mjs +3 -2
- package/dist/runtime/composables/useStores.d.ts +2 -2
- package/dist/runtime/composables/useStores.mjs +2 -2
- package/dist/runtime/composables/useVariantStores.d.ts +2 -2
- package/dist/runtime/composables/useVariantStores.mjs +2 -2
- package/dist/runtime/lib/init.d.ts +2 -3
- package/dist/runtime/lib/init.mjs +13 -5
- package/dist/runtime/rpc/storeLocator.d.ts +1 -21
- package/dist/runtime/rpc/storeLocator.mjs +2 -1
- package/dist/shared/{omnichannel-nuxt.9b492196.d.mts → omnichannel-nuxt.773770bd.d.mts} +22 -5
- package/dist/shared/{omnichannel-nuxt.9b492196.d.ts → omnichannel-nuxt.773770bd.d.ts} +22 -5
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @scayle/omnichannel-nuxt
|
|
2
2
|
|
|
3
|
+
## 3.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- Support new version of the SCAYLE Omnichannel API
|
|
8
|
+
|
|
9
|
+
This release implements compatibility with the latest version of the Omnichannel API. The major change is that much of the Store data is no longer included in API responses. Instead, API clients must explicitly request additional data through a `with` parameter.
|
|
10
|
+
|
|
11
|
+
This means that the `openingTimes`, `images`, `settings` and `customData` properties on the `Store` type are now potentially `undefined` and must be checked before usage.
|
|
12
|
+
|
|
13
|
+
If your application depends on these properties, the `with` parameter can be passed to the Omnichannel API through the composables.
|
|
14
|
+
|
|
15
|
+
For example:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
const {
|
|
19
|
+
storesData,
|
|
20
|
+
refreshStores,
|
|
21
|
+
storeVariantData,
|
|
22
|
+
refreshStoreVariant,
|
|
23
|
+
variantStoresData,
|
|
24
|
+
refreshVariantStores,
|
|
25
|
+
} = useStoreLocator("useStoreLocator", ["openingTimes", "setttings"]);
|
|
26
|
+
```
|
|
27
|
+
|
|
3
28
|
## 2.1.4
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -70,7 +70,9 @@ Example:
|
|
|
70
70
|
```typescript
|
|
71
71
|
import { useStoreLocator } from '@scayle/omnichannel-nuxt'
|
|
72
72
|
|
|
73
|
-
const { storesData, refreshStores } = useStoreLocator(
|
|
73
|
+
const { storesData, refreshStores } = useStoreLocator('useStoreLocator', [
|
|
74
|
+
'openingTimes',
|
|
75
|
+
])
|
|
74
76
|
const address = 'Hamburg'
|
|
75
77
|
await refreshStores(address)
|
|
76
78
|
```
|
|
@@ -82,7 +84,10 @@ Example:
|
|
|
82
84
|
```typescript
|
|
83
85
|
import { useStoreLocator } from '@scayle/omnichannel-nuxt'
|
|
84
86
|
|
|
85
|
-
const { variantStoresData, refreshVariantStores } = useStoreLocator(
|
|
87
|
+
const { variantStoresData, refreshVariantStores } = useStoreLocator(
|
|
88
|
+
'useStoreLocator',
|
|
89
|
+
['openingTimes'],
|
|
90
|
+
)
|
|
86
91
|
const address = 'Hamburg'
|
|
87
92
|
const storeId = 12
|
|
88
93
|
await refreshVariantStores(storeId, { address: address })
|
|
@@ -95,7 +100,10 @@ Example:
|
|
|
95
100
|
```typescript
|
|
96
101
|
import { useStoreLocator } from '@scayle/omnichannel-nuxt'
|
|
97
102
|
|
|
98
|
-
const { storeVariantData, refreshStoreVariant } = useStoreLocator(
|
|
103
|
+
const { storeVariantData, refreshStoreVariant } = useStoreLocator(
|
|
104
|
+
'useStoreLocator',
|
|
105
|
+
['openingTimes'],
|
|
106
|
+
)
|
|
99
107
|
const variantId = 1
|
|
100
108
|
const storeId = 12
|
|
101
109
|
await refreshStoreVariant(variantId, storeId)
|
|
@@ -41,9 +41,10 @@ class OmnichannelClient {
|
|
|
41
41
|
...options.filters,
|
|
42
42
|
radius: options.filters.radius ?? DEFAULT_SEARCH_RADIUS
|
|
43
43
|
},
|
|
44
|
-
perPage: options.perPage
|
|
44
|
+
perPage: options.perPage,
|
|
45
|
+
with: options.with
|
|
45
46
|
};
|
|
46
|
-
const params = qs.stringify(fetchOptions, { arrayFormat: "
|
|
47
|
+
const params = qs.stringify(fetchOptions, { arrayFormat: "comma" });
|
|
47
48
|
const response = await fetch(`${this.host}/stores/locator?${params}`, {
|
|
48
49
|
headers: this.headers
|
|
49
50
|
});
|
|
@@ -58,17 +59,24 @@ class OmnichannelClient {
|
|
|
58
59
|
radius: options.filters.radius ?? DEFAULT_SEARCH_RADIUS
|
|
59
60
|
},
|
|
60
61
|
variantId: options.variantId,
|
|
61
|
-
perPage: 10
|
|
62
|
+
perPage: 10,
|
|
63
|
+
with: options.with
|
|
62
64
|
};
|
|
63
|
-
const params = qs.stringify(
|
|
65
|
+
const params = qs.stringify({
|
|
66
|
+
...fetchOptions,
|
|
67
|
+
with: options.with?.map((property) => `store.${property}`)
|
|
68
|
+
}, { arrayFormat: "comma" });
|
|
64
69
|
const response = await fetch(`${this.host}/variants/locator?${params}`, {
|
|
65
70
|
headers: this.headers
|
|
66
71
|
});
|
|
67
72
|
return await this.handleResponse(response);
|
|
68
73
|
}
|
|
69
74
|
async getStoreVariantById(options) {
|
|
75
|
+
const params = qs.stringify({
|
|
76
|
+
with: options.with?.map((property) => `store.${property}`)
|
|
77
|
+
}, { arrayFormat: "comma" });
|
|
70
78
|
const response = await fetch(
|
|
71
|
-
`${this.host}/stores/${options.storeId}/variants/${options.variantId}`,
|
|
79
|
+
`${this.host}/stores/${options.storeId}/variants/${options.variantId}?${params}`,
|
|
72
80
|
{ headers: this.headers }
|
|
73
81
|
);
|
|
74
82
|
return await this.handleResponse(response);
|
|
@@ -96,7 +104,8 @@ const getStoresForVariant = async function getStoresForVariant2(options, storeLo
|
|
|
96
104
|
radius: options.filters.radius
|
|
97
105
|
},
|
|
98
106
|
variantId: options.variantId,
|
|
99
|
-
perPage: 10
|
|
107
|
+
perPage: 10,
|
|
108
|
+
with: options.with
|
|
100
109
|
};
|
|
101
110
|
const omnichannelClient = init(storeLocator);
|
|
102
111
|
if (!omnichannelClient) {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { S as
|
|
2
|
-
export { F as FiltersAddressParams,
|
|
1
|
+
import { S as StoreWithProperty, a as StoreLocationResponse, b as StoreLocatorSearchParams, c as StoreAvailabilityCheck, V as VariantLocation, d as VariantLocatorSearchParams } from './shared/omnichannel-nuxt.773770bd.mjs';
|
|
2
|
+
export { u as FetchStoreVariantByIdParams, t as FetchStoresForVariantParams, F as FiltersAddressParams, s as FiltersCoordinatesParams, G as GeoPoint, n as OmnichannelLinks, m as OmnichannelMeta, f as OpeningTimeException, O as OpeningTimeInterval, k as OpeningTimes, l as Store, h as StoreAddress, q as StoreAvailabilityCheckResponse, g as StoreImage, j as StoreItem, i as StoreItemVariant, o as StoreLocation, e as StoreLocatorConfig, p as StoreVariantLocation, r as VariantLocationResponse } from './shared/omnichannel-nuxt.773770bd.mjs';
|
|
3
3
|
import { ValuesType } from 'utility-types';
|
|
4
4
|
|
|
5
|
-
declare const _default$3: (key?: string) => {
|
|
5
|
+
declare const _default$3: (key?: string, withProperties?: StoreWithProperty[]) => {
|
|
6
6
|
data: globalThis.ComputedRef<StoreLocationResponse | null>;
|
|
7
7
|
getData: (searchParams: StoreLocatorSearchParams) => Promise<void>;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
declare const _default$2: (key?: string) => {
|
|
10
|
+
declare const _default$2: (key?: string, withProperties?: StoreWithProperty[]) => {
|
|
11
11
|
data: globalThis.ComputedRef<StoreAvailabilityCheck | null>;
|
|
12
12
|
getData: (variantId: number, storeId: number) => Promise<void>;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
declare const _default$1: (key?: string) => {
|
|
15
|
+
declare const _default$1: (key?: string, withProperties?: StoreWithProperty[]) => {
|
|
16
16
|
data: globalThis.ComputedRef<VariantLocation | null>;
|
|
17
17
|
getData: (searchParams: VariantLocatorSearchParams) => Promise<void>;
|
|
18
18
|
};
|
|
@@ -37,4 +37,4 @@ declare const OpeningTime: {
|
|
|
37
37
|
};
|
|
38
38
|
type OpeningTime = ValuesType<typeof OpeningTime>;
|
|
39
39
|
|
|
40
|
-
export { OpeningTime, StoreAvailabilityCheck, StoreLocationResponse, StoreLocatorSearchParams, VariantLocation, VariantLocatorSearchParams, _default as useStoreLocator, _default$2 as useStoreVariantById, _default$3 as useStores, _default$1 as useVariantStores };
|
|
40
|
+
export { OpeningTime, StoreAvailabilityCheck, StoreLocationResponse, StoreLocatorSearchParams, StoreWithProperty, VariantLocation, VariantLocatorSearchParams, _default as useStoreLocator, _default$2 as useStoreVariantById, _default$3 as useStores, _default$1 as useVariantStores };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { S as
|
|
2
|
-
export { F as FiltersAddressParams,
|
|
1
|
+
import { S as StoreWithProperty, a as StoreLocationResponse, b as StoreLocatorSearchParams, c as StoreAvailabilityCheck, V as VariantLocation, d as VariantLocatorSearchParams } from './shared/omnichannel-nuxt.773770bd.js';
|
|
2
|
+
export { u as FetchStoreVariantByIdParams, t as FetchStoresForVariantParams, F as FiltersAddressParams, s as FiltersCoordinatesParams, G as GeoPoint, n as OmnichannelLinks, m as OmnichannelMeta, f as OpeningTimeException, O as OpeningTimeInterval, k as OpeningTimes, l as Store, h as StoreAddress, q as StoreAvailabilityCheckResponse, g as StoreImage, j as StoreItem, i as StoreItemVariant, o as StoreLocation, e as StoreLocatorConfig, p as StoreVariantLocation, r as VariantLocationResponse } from './shared/omnichannel-nuxt.773770bd.js';
|
|
3
3
|
import { ValuesType } from 'utility-types';
|
|
4
4
|
|
|
5
|
-
declare const _default$3: (key?: string) => {
|
|
5
|
+
declare const _default$3: (key?: string, withProperties?: StoreWithProperty[]) => {
|
|
6
6
|
data: globalThis.ComputedRef<StoreLocationResponse | null>;
|
|
7
7
|
getData: (searchParams: StoreLocatorSearchParams) => Promise<void>;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
declare const _default$2: (key?: string) => {
|
|
10
|
+
declare const _default$2: (key?: string, withProperties?: StoreWithProperty[]) => {
|
|
11
11
|
data: globalThis.ComputedRef<StoreAvailabilityCheck | null>;
|
|
12
12
|
getData: (variantId: number, storeId: number) => Promise<void>;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
declare const _default$1: (key?: string) => {
|
|
15
|
+
declare const _default$1: (key?: string, withProperties?: StoreWithProperty[]) => {
|
|
16
16
|
data: globalThis.ComputedRef<VariantLocation | null>;
|
|
17
17
|
getData: (searchParams: VariantLocatorSearchParams) => Promise<void>;
|
|
18
18
|
};
|
|
@@ -37,4 +37,4 @@ declare const OpeningTime: {
|
|
|
37
37
|
};
|
|
38
38
|
type OpeningTime = ValuesType<typeof OpeningTime>;
|
|
39
39
|
|
|
40
|
-
export { OpeningTime, StoreAvailabilityCheck, StoreLocationResponse, StoreLocatorSearchParams, VariantLocation, VariantLocatorSearchParams, _default as useStoreLocator, _default$2 as useStoreVariantById, _default$3 as useStores, _default$1 as useVariantStores };
|
|
40
|
+
export { OpeningTime, StoreAvailabilityCheck, StoreLocationResponse, StoreLocatorSearchParams, StoreWithProperty, VariantLocation, VariantLocatorSearchParams, _default as useStoreLocator, _default$2 as useStoreVariantById, _default$3 as useStores, _default$1 as useVariantStores };
|
package/dist/index.mjs
CHANGED
|
@@ -11,11 +11,14 @@ function sharedRef(value, key) {
|
|
|
11
11
|
return newRef;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const useStores = (key = "useStores") => {
|
|
14
|
+
const useStores = (key = "useStores", withProperties = []) => {
|
|
15
15
|
const response = sharedRef(null, key);
|
|
16
16
|
const getData = async (searchParams) => {
|
|
17
17
|
response.value = await fetch("/api/omnichannel/stores", {
|
|
18
|
-
body: JSON.stringify(
|
|
18
|
+
body: JSON.stringify({
|
|
19
|
+
with: withProperties,
|
|
20
|
+
searchParams
|
|
21
|
+
}),
|
|
19
22
|
method: "POST",
|
|
20
23
|
headers: {
|
|
21
24
|
"Content-Type": "application/json"
|
|
@@ -28,11 +31,12 @@ const useStores = (key = "useStores") => {
|
|
|
28
31
|
};
|
|
29
32
|
};
|
|
30
33
|
|
|
31
|
-
const useStoreVariantById = (key = "useStoreVariantById") => {
|
|
34
|
+
const useStoreVariantById = (key = "useStoreVariantById", withProperties = []) => {
|
|
32
35
|
const response = sharedRef(null, key);
|
|
33
36
|
const getData = async (variantId, storeId) => {
|
|
34
37
|
response.value = (await fetch("/api/omnichannel/storeVariantById", {
|
|
35
38
|
body: JSON.stringify({
|
|
39
|
+
with: withProperties,
|
|
36
40
|
storeId,
|
|
37
41
|
variantId
|
|
38
42
|
}),
|
|
@@ -50,11 +54,14 @@ const useStoreVariantById = (key = "useStoreVariantById") => {
|
|
|
50
54
|
};
|
|
51
55
|
};
|
|
52
56
|
|
|
53
|
-
const useVariantStores = (key = "useVariantStores") => {
|
|
57
|
+
const useVariantStores = (key = "useVariantStores", withProperties = []) => {
|
|
54
58
|
const response = sharedRef(null, key);
|
|
55
59
|
const getData = async (searchParams) => {
|
|
56
60
|
response.value = (await fetch("/api/omnichannel/variantStores", {
|
|
57
|
-
body: JSON.stringify(
|
|
61
|
+
body: JSON.stringify({
|
|
62
|
+
with: withProperties,
|
|
63
|
+
searchParams
|
|
64
|
+
}),
|
|
58
65
|
method: "POST",
|
|
59
66
|
headers: {
|
|
60
67
|
"Content-Type": "application/json"
|
package/dist/module.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import {
|
|
2
|
+
import { e as StoreLocatorConfig } from './shared/omnichannel-nuxt.773770bd.mjs';
|
|
3
3
|
|
|
4
4
|
declare const _default: _nuxt_schema.NuxtModule<StoreLocatorConfig>;
|
|
5
5
|
|
package/dist/module.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import {
|
|
2
|
+
import { e as StoreLocatorConfig } from './shared/omnichannel-nuxt.773770bd.js';
|
|
3
3
|
|
|
4
4
|
declare const _default: _nuxt_schema.NuxtModule<StoreLocatorConfig>;
|
|
5
5
|
|
package/dist/module.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import type { StoreWithProperty } from '../../types';
|
|
2
|
+
declare const _default: (key?: string, withProperties?: StoreWithProperty[]) => {
|
|
2
3
|
storesData: any;
|
|
3
4
|
refreshStores: (searchParams: import("../../types").StoreLocatorSearchParams) => Promise<void>;
|
|
4
5
|
storeVariantData: any;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import useStoreVariantById from "./useStoreVariantById.mjs";
|
|
2
2
|
import useStores from "./useStores.mjs";
|
|
3
3
|
import useVariantStores from "./useVariantStores.mjs";
|
|
4
|
-
export default (key = "useStoreLocator") => {
|
|
4
|
+
export default (key = "useStoreLocator", withProperties = []) => {
|
|
5
5
|
const { data: storesData, getData: refreshStores } = useStores(
|
|
6
|
-
`${key}-stores
|
|
6
|
+
`${key}-stores`,
|
|
7
|
+
withProperties
|
|
7
8
|
);
|
|
8
|
-
const { data: variantStoresData, getData: refreshVariantStores } = useVariantStores(`${key}-variant-stores
|
|
9
|
-
const { data: storeVariantData, getData: refreshStoreVariant } = useStoreVariantById(`${key}-variant-by-id
|
|
9
|
+
const { data: variantStoresData, getData: refreshVariantStores } = useVariantStores(`${key}-variant-stores`, withProperties);
|
|
10
|
+
const { data: storeVariantData, getData: refreshStoreVariant } = useStoreVariantById(`${key}-variant-by-id`, withProperties);
|
|
10
11
|
return {
|
|
11
12
|
storesData,
|
|
12
13
|
refreshStores,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { computed, useState } from "#imports";
|
|
2
|
-
export default (key = "useStoreVariantById") => {
|
|
2
|
+
export default (key = "useStoreVariantById", withProperties = []) => {
|
|
3
3
|
const response = useState(key, () => null);
|
|
4
4
|
const getData = async (variantId, storeId) => {
|
|
5
5
|
response.value = (await $fetch(
|
|
@@ -7,7 +7,8 @@ export default (key = "useStoreVariantById") => {
|
|
|
7
7
|
{
|
|
8
8
|
body: {
|
|
9
9
|
storeId,
|
|
10
|
-
variantId
|
|
10
|
+
variantId,
|
|
11
|
+
with: withProperties
|
|
11
12
|
},
|
|
12
13
|
method: "POST"
|
|
13
14
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { StoreLocatorSearchParams } from '../../types';
|
|
2
|
-
declare const _default: (key?: string) => {
|
|
1
|
+
import type { StoreLocatorSearchParams, StoreWithProperty } from '../../types';
|
|
2
|
+
declare const _default: (key?: string, withProperties?: StoreWithProperty[]) => {
|
|
3
3
|
data: any;
|
|
4
4
|
getData: (searchParams: StoreLocatorSearchParams) => Promise<void>;
|
|
5
5
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useState, computed } from "#imports";
|
|
2
|
-
export default (key = "useStores") => {
|
|
2
|
+
export default (key = "useStores", withProperties = []) => {
|
|
3
3
|
const response = useState(key, () => null);
|
|
4
4
|
const getData = async (searchParams) => {
|
|
5
5
|
response.value = await $fetch(
|
|
6
6
|
"/api/omnichannel/stores",
|
|
7
|
-
{ body: searchParams, method: "POST" }
|
|
7
|
+
{ body: { ...searchParams, with: withProperties }, method: "POST" }
|
|
8
8
|
);
|
|
9
9
|
};
|
|
10
10
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { VariantLocatorSearchParams } from '../../types';
|
|
2
|
-
declare const _default: (key?: string) => {
|
|
1
|
+
import type { VariantLocatorSearchParams, StoreWithProperty } from '../../types';
|
|
2
|
+
declare const _default: (key?: string, withProperties?: StoreWithProperty[]) => {
|
|
3
3
|
data: any;
|
|
4
4
|
getData: (searchParams: VariantLocatorSearchParams) => Promise<void>;
|
|
5
5
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useState, computed } from "#imports";
|
|
2
|
-
export default (key = "useVariantStores") => {
|
|
2
|
+
export default (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", {
|
|
6
|
-
body: searchParams,
|
|
6
|
+
body: { ...searchParams, with: withProperties },
|
|
7
7
|
method: "POST"
|
|
8
8
|
})).data;
|
|
9
9
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { StoreLocation, StoreLocatorSearchParams, StoreAvailabilityCheckResponse, VariantLocationResponse } from '../types';
|
|
2
|
-
import type { FetchOptions, FetchStoreVariantByIdParams } from '../rpc/storeLocator';
|
|
1
|
+
import type { StoreLocation, StoreLocatorSearchParams, StoreAvailabilityCheckResponse, VariantLocationResponse, FetchStoresForVariantParams, FetchStoreVariantByIdParams } from '../types';
|
|
3
2
|
export interface PaginatedResponse<DataType> {
|
|
4
3
|
nextPage: null;
|
|
5
4
|
data: DataType;
|
|
@@ -20,7 +19,7 @@ export declare class OmnichannelClient {
|
|
|
20
19
|
get headers(): HeadersInit;
|
|
21
20
|
private handleResponse;
|
|
22
21
|
getStores(options: StoreLocatorSearchParams): Promise<PaginatedResponse<StoreLocation[]>>;
|
|
23
|
-
getStoresForVariant(options:
|
|
22
|
+
getStoresForVariant(options: FetchStoresForVariantParams): Promise<PaginatedResponse<VariantLocationResponse>>;
|
|
24
23
|
getStoreVariantById(options: FetchStoreVariantByIdParams): Promise<StoreAvailabilityCheckResponse>;
|
|
25
24
|
}
|
|
26
25
|
export declare const init: (config?: any) => OmnichannelClient | null;
|
|
@@ -38,9 +38,10 @@ export class OmnichannelClient {
|
|
|
38
38
|
...options.filters,
|
|
39
39
|
radius: options.filters.radius ?? DEFAULT_SEARCH_RADIUS
|
|
40
40
|
},
|
|
41
|
-
perPage: options.perPage
|
|
41
|
+
perPage: options.perPage,
|
|
42
|
+
with: options.with
|
|
42
43
|
};
|
|
43
|
-
const params = qs.stringify(fetchOptions, { arrayFormat: "
|
|
44
|
+
const params = qs.stringify(fetchOptions, { arrayFormat: "comma" });
|
|
44
45
|
const response = await fetch(`${this.host}/stores/locator?${params}`, {
|
|
45
46
|
headers: this.headers
|
|
46
47
|
});
|
|
@@ -55,17 +56,24 @@ export class OmnichannelClient {
|
|
|
55
56
|
radius: options.filters.radius ?? DEFAULT_SEARCH_RADIUS
|
|
56
57
|
},
|
|
57
58
|
variantId: options.variantId,
|
|
58
|
-
perPage: 10
|
|
59
|
+
perPage: 10,
|
|
60
|
+
with: options.with
|
|
59
61
|
};
|
|
60
|
-
const params = qs.stringify(
|
|
62
|
+
const params = qs.stringify({
|
|
63
|
+
...fetchOptions,
|
|
64
|
+
with: options.with?.map((property) => `store.${property}`)
|
|
65
|
+
}, { arrayFormat: "comma" });
|
|
61
66
|
const response = await fetch(`${this.host}/variants/locator?${params}`, {
|
|
62
67
|
headers: this.headers
|
|
63
68
|
});
|
|
64
69
|
return await this.handleResponse(response);
|
|
65
70
|
}
|
|
66
71
|
async getStoreVariantById(options) {
|
|
72
|
+
const params = qs.stringify({
|
|
73
|
+
with: options.with?.map((property) => `store.${property}`)
|
|
74
|
+
}, { arrayFormat: "comma" });
|
|
67
75
|
const response = await fetch(
|
|
68
|
-
`${this.host}/stores/${options.storeId}/variants/${options.variantId}`,
|
|
76
|
+
`${this.host}/stores/${options.storeId}/variants/${options.variantId}?${params}`,
|
|
69
77
|
{ headers: this.headers }
|
|
70
78
|
);
|
|
71
79
|
return await this.handleResponse(response);
|
|
@@ -1,24 +1,4 @@
|
|
|
1
|
-
import type { StoreLocatorConfig, StoreLocatorSearchParams } from '../../types';
|
|
2
|
-
export interface FetchStoresForVariantParams {
|
|
3
|
-
variantId: number;
|
|
4
|
-
filters: {
|
|
5
|
-
address: string;
|
|
6
|
-
radius: number;
|
|
7
|
-
};
|
|
8
|
-
perPage?: number;
|
|
9
|
-
}
|
|
10
|
-
export interface FetchStoreVariantByIdParams {
|
|
11
|
-
storeId: number;
|
|
12
|
-
variantId: number;
|
|
13
|
-
}
|
|
14
|
-
export interface FetchOptions {
|
|
15
|
-
filters: {
|
|
16
|
-
address: string;
|
|
17
|
-
radius: number;
|
|
18
|
-
};
|
|
19
|
-
variantId?: number;
|
|
20
|
-
perPage: number;
|
|
21
|
-
}
|
|
1
|
+
import type { StoreLocatorConfig, StoreLocatorSearchParams, FetchStoresForVariantParams, FetchStoreVariantByIdParams } from '../../types';
|
|
22
2
|
export declare const getStores: (options: StoreLocatorSearchParams, storeLocator: StoreLocatorConfig) => Promise<import("../lib/init").PaginatedResponse<StoreLocation[]>>;
|
|
23
3
|
export declare const getStoresForVariant: (options: FetchStoresForVariantParams, storeLocator: StoreLocatorConfig) => Promise<import("../lib/init").PaginatedResponse<VariantLocationResponse>>;
|
|
24
4
|
export declare const getStoreVariantById: (options: FetchStoreVariantByIdParams, storeLocator: StoreLocatorConfig) => Promise<StoreAvailabilityCheckResponse>;
|
|
@@ -14,7 +14,8 @@ export const getStoresForVariant = async function getStoresForVariant2(options,
|
|
|
14
14
|
radius: options.filters.radius
|
|
15
15
|
},
|
|
16
16
|
variantId: options.variantId,
|
|
17
|
-
perPage: 10
|
|
17
|
+
perPage: 10,
|
|
18
|
+
with: options.with
|
|
18
19
|
};
|
|
19
20
|
const omnichannelClient = init(storeLocator);
|
|
20
21
|
if (!omnichannelClient) {
|
|
@@ -63,16 +63,17 @@ interface Store {
|
|
|
63
63
|
name: string;
|
|
64
64
|
email: string;
|
|
65
65
|
address: StoreAddress;
|
|
66
|
-
openingTimes
|
|
66
|
+
openingTimes?: OpeningTimes;
|
|
67
67
|
geoPoint: GeoPoint;
|
|
68
|
-
customData
|
|
69
|
-
settings
|
|
68
|
+
customData?: object;
|
|
69
|
+
settings?: {
|
|
70
70
|
shipFromStore: boolean;
|
|
71
71
|
clickAndCollect: boolean;
|
|
72
72
|
};
|
|
73
73
|
isActive: boolean;
|
|
74
|
-
images
|
|
74
|
+
images?: StoreImage;
|
|
75
75
|
}
|
|
76
|
+
type StoreWithProperty = 'openingTimes' | 'customData' | 'images' | 'settings';
|
|
76
77
|
interface OmnichannelMeta {
|
|
77
78
|
path: string;
|
|
78
79
|
currentPage: number;
|
|
@@ -136,11 +137,27 @@ interface FiltersCoordinatesParams {
|
|
|
136
137
|
interface StoreLocatorSearchParams {
|
|
137
138
|
filters: FiltersAddressParams | FiltersCoordinatesParams;
|
|
138
139
|
perPage?: number;
|
|
140
|
+
with?: StoreWithProperty[];
|
|
139
141
|
}
|
|
140
142
|
interface VariantLocatorSearchParams {
|
|
141
143
|
variantId: number;
|
|
142
144
|
filters: FiltersAddressParams | FiltersCoordinatesParams;
|
|
143
145
|
perPage?: number;
|
|
146
|
+
with?: StoreWithProperty[];
|
|
147
|
+
}
|
|
148
|
+
interface FetchStoresForVariantParams {
|
|
149
|
+
variantId: number;
|
|
150
|
+
filters: {
|
|
151
|
+
address: string;
|
|
152
|
+
radius: number;
|
|
153
|
+
};
|
|
154
|
+
perPage?: number;
|
|
155
|
+
with?: StoreWithProperty[];
|
|
156
|
+
}
|
|
157
|
+
interface FetchStoreVariantByIdParams {
|
|
158
|
+
storeId: number;
|
|
159
|
+
variantId: number;
|
|
160
|
+
with?: StoreWithProperty[];
|
|
144
161
|
}
|
|
145
162
|
|
|
146
|
-
export type { FiltersAddressParams as F, GeoPoint as G, OpeningTimeInterval as O,
|
|
163
|
+
export type { FiltersAddressParams as F, GeoPoint as G, OpeningTimeInterval as O, StoreWithProperty as S, VariantLocation as V, StoreLocationResponse as a, StoreLocatorSearchParams as b, StoreAvailabilityCheck as c, VariantLocatorSearchParams as d, StoreLocatorConfig as e, OpeningTimeException as f, StoreImage as g, StoreAddress as h, StoreItemVariant as i, StoreItem as j, OpeningTimes as k, Store as l, OmnichannelMeta as m, OmnichannelLinks as n, StoreLocation as o, StoreVariantLocation as p, StoreAvailabilityCheckResponse as q, VariantLocationResponse as r, FiltersCoordinatesParams as s, FetchStoresForVariantParams as t, FetchStoreVariantByIdParams as u };
|
|
@@ -63,16 +63,17 @@ interface Store {
|
|
|
63
63
|
name: string;
|
|
64
64
|
email: string;
|
|
65
65
|
address: StoreAddress;
|
|
66
|
-
openingTimes
|
|
66
|
+
openingTimes?: OpeningTimes;
|
|
67
67
|
geoPoint: GeoPoint;
|
|
68
|
-
customData
|
|
69
|
-
settings
|
|
68
|
+
customData?: object;
|
|
69
|
+
settings?: {
|
|
70
70
|
shipFromStore: boolean;
|
|
71
71
|
clickAndCollect: boolean;
|
|
72
72
|
};
|
|
73
73
|
isActive: boolean;
|
|
74
|
-
images
|
|
74
|
+
images?: StoreImage;
|
|
75
75
|
}
|
|
76
|
+
type StoreWithProperty = 'openingTimes' | 'customData' | 'images' | 'settings';
|
|
76
77
|
interface OmnichannelMeta {
|
|
77
78
|
path: string;
|
|
78
79
|
currentPage: number;
|
|
@@ -136,11 +137,27 @@ interface FiltersCoordinatesParams {
|
|
|
136
137
|
interface StoreLocatorSearchParams {
|
|
137
138
|
filters: FiltersAddressParams | FiltersCoordinatesParams;
|
|
138
139
|
perPage?: number;
|
|
140
|
+
with?: StoreWithProperty[];
|
|
139
141
|
}
|
|
140
142
|
interface VariantLocatorSearchParams {
|
|
141
143
|
variantId: number;
|
|
142
144
|
filters: FiltersAddressParams | FiltersCoordinatesParams;
|
|
143
145
|
perPage?: number;
|
|
146
|
+
with?: StoreWithProperty[];
|
|
147
|
+
}
|
|
148
|
+
interface FetchStoresForVariantParams {
|
|
149
|
+
variantId: number;
|
|
150
|
+
filters: {
|
|
151
|
+
address: string;
|
|
152
|
+
radius: number;
|
|
153
|
+
};
|
|
154
|
+
perPage?: number;
|
|
155
|
+
with?: StoreWithProperty[];
|
|
156
|
+
}
|
|
157
|
+
interface FetchStoreVariantByIdParams {
|
|
158
|
+
storeId: number;
|
|
159
|
+
variantId: number;
|
|
160
|
+
with?: StoreWithProperty[];
|
|
144
161
|
}
|
|
145
162
|
|
|
146
|
-
export type { FiltersAddressParams as F, GeoPoint as G, OpeningTimeInterval as O,
|
|
163
|
+
export type { FiltersAddressParams as F, GeoPoint as G, OpeningTimeInterval as O, StoreWithProperty as S, VariantLocation as V, StoreLocationResponse as a, StoreLocatorSearchParams as b, StoreAvailabilityCheck as c, VariantLocatorSearchParams as d, StoreLocatorConfig as e, OpeningTimeException as f, StoreImage as g, StoreAddress as h, StoreItemVariant as i, StoreItem as j, OpeningTimes as k, Store as l, OmnichannelMeta as m, OmnichannelLinks as n, StoreLocation as o, StoreVariantLocation as p, StoreAvailabilityCheckResponse as q, VariantLocationResponse as r, FiltersCoordinatesParams as s, FetchStoresForVariantParams as t, FetchStoreVariantByIdParams as u };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/omnichannel-nuxt",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Collection of essential utilities to work with omnichannel",
|
|
5
5
|
"author": "SCAYLE Commerce Engine",
|
|
6
6
|
"license": "MIT",
|
|
@@ -52,34 +52,34 @@
|
|
|
52
52
|
"test:ci": "jest --passWithNoTests --runInBand --coverage --reporters=default --reporters=jest-junit"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@nuxtjs/composition-api": "0.
|
|
55
|
+
"@nuxtjs/composition-api": "0.34.0",
|
|
56
56
|
"express": "4.19.2"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@nuxt/kit": "3.11.1",
|
|
60
60
|
"body-parser": "1.20.2",
|
|
61
|
-
"qs": "6.12.
|
|
61
|
+
"qs": "6.12.1",
|
|
62
62
|
"utility-types": "3.11.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@nuxt/module-builder": "0.5.5",
|
|
66
66
|
"@nuxt/schema": "3.11.1",
|
|
67
67
|
"@nuxt/types": "2.17.3",
|
|
68
|
-
"@nuxtjs/composition-api": "0.
|
|
68
|
+
"@nuxtjs/composition-api": "0.34.0",
|
|
69
69
|
"@scayle/eslint-config-storefront": "3.2.7",
|
|
70
70
|
"@types/body-parser": "1.19.5",
|
|
71
71
|
"@types/express": "4.17.21",
|
|
72
|
-
"@types/node": "20.12.
|
|
73
|
-
"@types/qs": "6.9.
|
|
72
|
+
"@types/node": "20.12.7",
|
|
73
|
+
"@types/qs": "6.9.15",
|
|
74
74
|
"dprint": "0.45.1",
|
|
75
75
|
"eslint": "8.57.0",
|
|
76
76
|
"eslint-formatter-gitlab": "5.1.0",
|
|
77
77
|
"h3": "1.11.1",
|
|
78
78
|
"nuxi": "3.11.1",
|
|
79
|
-
"typescript": "5.4.
|
|
79
|
+
"typescript": "5.4.5",
|
|
80
80
|
"vue": "2.7.16"
|
|
81
81
|
},
|
|
82
82
|
"volta": {
|
|
83
|
-
"node": "20.12.
|
|
83
|
+
"node": "20.12.2"
|
|
84
84
|
}
|
|
85
85
|
}
|