@scayle/storefront-nuxt 7.63.0 → 7.64.1
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 +22 -7
- package/dist/module.json +1 -1
- package/dist/runtime/composables/storefront/useSearch.d.ts +5 -4
- package/dist/runtime/composables/storefront/useSearch.mjs +2 -1
- package/dist/runtime/composables/storefront/useStorefrontSearch.d.ts +15 -0
- package/dist/runtime/composables/storefront/useStorefrontSearch.mjs +64 -0
- package/package.json +9 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @scayle/storefront-nuxt
|
|
2
2
|
|
|
3
|
+
## 7.64.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Format code with dprint
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @scayle/unstorage-compression-driver@0.1.3
|
|
10
|
+
- @scayle/h3-session@0.3.6
|
|
11
|
+
|
|
12
|
+
## 7.64.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- Add `useStorefrontSearch` composable
|
|
17
|
+
|
|
3
18
|
## 7.63.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
|
@@ -8,8 +23,8 @@
|
|
|
8
23
|
|
|
9
24
|
```ts
|
|
10
25
|
const { data: externalIDPRedirects } = await useIDP({
|
|
11
|
-
queryParams: { redirectTo:
|
|
12
|
-
})
|
|
26
|
+
queryParams: { redirectTo: "/account" },
|
|
27
|
+
});
|
|
13
28
|
```
|
|
14
29
|
|
|
15
30
|
Please note that `code` and `state` are not supported as these are used by the SCAYLE Authentication API.
|
|
@@ -428,16 +443,16 @@ There is an `unwrap` function exported by this package (>=7.55.0) that can be us
|
|
|
428
443
|
Before:
|
|
429
444
|
|
|
430
445
|
```typescript
|
|
431
|
-
toCurrency(100, { currency:
|
|
432
|
-
formatPrice(100, { currencyFractionDigits: 2 })
|
|
446
|
+
toCurrency(100, { currency: "EUR" });
|
|
447
|
+
formatPrice(100, { currencyFractionDigits: 2 });
|
|
433
448
|
```
|
|
434
449
|
|
|
435
450
|
After:
|
|
436
451
|
|
|
437
452
|
```typescript
|
|
438
|
-
const { formatCurrency } = useFormatHelpers()
|
|
439
|
-
formatCurrency(100, { currency:
|
|
440
|
-
formatCurrency(100, { style:
|
|
453
|
+
const { formatCurrency } = useFormatHelpers();
|
|
454
|
+
formatCurrency(100, { currency: "EUR" });
|
|
455
|
+
formatCurrency(100, { style: "decimal", currencyFractionDigits: 2 });
|
|
441
456
|
```
|
|
442
457
|
|
|
443
458
|
## 7.44.1
|
package/dist/module.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { type SearchInput, type SearchOptions } from '@scayle/storefront-core';
|
|
1
|
+
import { type SearchInput, type SearchOptions, type TypeaheadSuggestionsEndpointResponseData } from '@scayle/storefront-core';
|
|
2
2
|
type Options = Partial<{
|
|
3
3
|
params: SearchOptions;
|
|
4
4
|
key: string;
|
|
5
5
|
}>;
|
|
6
|
+
/** @deprecated `useSearch` is deprecated. Please, use `useSearchSuggestions` or `useSearchResolve` */
|
|
6
7
|
export declare const useSearch: ({ params, key }?: Options) => {
|
|
7
|
-
data:
|
|
8
|
-
pending:
|
|
9
|
-
searchQuery:
|
|
8
|
+
data: import("vue").Ref<TypeaheadSuggestionsEndpointResponseData | undefined>;
|
|
9
|
+
pending: import("vue").Ref<boolean>;
|
|
10
|
+
searchQuery: import("vue").Ref<string>;
|
|
10
11
|
resetSearch: () => void;
|
|
11
12
|
search: ({ term, slug, productLimit }: SearchInput) => Promise<void>;
|
|
12
13
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { useState } from "nuxt/app";
|
|
1
2
|
import { rpcCall } from "../../rpc/rpcCall.mjs";
|
|
2
3
|
import { useCurrentShop } from "../core/useCurrentShop.mjs";
|
|
3
|
-
import {
|
|
4
|
+
import { useNuxtApp, toValue } from "#imports";
|
|
4
5
|
export const useSearch = ({ params, key = "search" } = {}) => {
|
|
5
6
|
const data = useState(
|
|
6
7
|
`${key}-data`,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type SearchV2SuggestionsEndpointResponseData, type SearchV2With } from '@scayle/storefront-core';
|
|
2
|
+
export type SearchOptions = Partial<{
|
|
3
|
+
params: Partial<{
|
|
4
|
+
categoryId: number;
|
|
5
|
+
with: SearchV2With;
|
|
6
|
+
}>;
|
|
7
|
+
key: string;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const useStorefrontSearch: (searchQuery: Ref<string>, { params, key }?: SearchOptions) => {
|
|
10
|
+
data: import("vue").Ref<SearchV2SuggestionsEndpointResponseData | undefined>;
|
|
11
|
+
pending: import("vue").Ref<boolean>;
|
|
12
|
+
resetSearch: () => void;
|
|
13
|
+
getSearchSuggestions: () => Promise<void>;
|
|
14
|
+
resolveSearch: () => Promise<import("@scayle/storefront-core").SearchEntity | null | undefined>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useState } from "nuxt/app";
|
|
2
|
+
import { rpcCall } from "../../rpc/rpcCall.mjs";
|
|
3
|
+
import { useCurrentShop } from "../core/useCurrentShop.mjs";
|
|
4
|
+
import { useNuxtApp, toValue } from "#imports";
|
|
5
|
+
export const useStorefrontSearch = (searchQuery, { params, key = "search" } = {}) => {
|
|
6
|
+
const data = useState(
|
|
7
|
+
`${key}-data`,
|
|
8
|
+
() => void 0
|
|
9
|
+
);
|
|
10
|
+
const nuxtApp = useNuxtApp();
|
|
11
|
+
const pending = useState(`${key}-pending`, () => false);
|
|
12
|
+
const error = useState(
|
|
13
|
+
`${key}-error`,
|
|
14
|
+
() => void 0
|
|
15
|
+
);
|
|
16
|
+
const status = useState(`${key}-error`, () => "idle");
|
|
17
|
+
const shop = useCurrentShop();
|
|
18
|
+
const getSearchSuggestions = async () => {
|
|
19
|
+
pending.value = true;
|
|
20
|
+
status.value = "pending";
|
|
21
|
+
if (!searchQuery.value) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
data.value = await rpcCall(
|
|
26
|
+
nuxtApp,
|
|
27
|
+
"getSearchSuggestions",
|
|
28
|
+
toValue(shop)
|
|
29
|
+
)({
|
|
30
|
+
term: String(searchQuery.value),
|
|
31
|
+
...params
|
|
32
|
+
});
|
|
33
|
+
} catch (e) {
|
|
34
|
+
error.value = e;
|
|
35
|
+
} finally {
|
|
36
|
+
pending.value = false;
|
|
37
|
+
status.value = error.value ? "error" : "success";
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const resolveSearch = async () => {
|
|
41
|
+
if (!searchQuery.value) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
return await rpcCall(
|
|
45
|
+
nuxtApp,
|
|
46
|
+
"resolveSearch",
|
|
47
|
+
toValue(shop)
|
|
48
|
+
)({
|
|
49
|
+
term: searchQuery.value,
|
|
50
|
+
...params
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
const resetSearch = () => {
|
|
54
|
+
searchQuery.value = "";
|
|
55
|
+
data.value = { suggestions: [] };
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
data,
|
|
59
|
+
pending,
|
|
60
|
+
resetSearch,
|
|
61
|
+
getSearchSuggestions,
|
|
62
|
+
resolveSearch
|
|
63
|
+
};
|
|
64
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.64.1",
|
|
5
5
|
"description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
|
|
6
6
|
"author": "SCAYLE Commerce Engine",
|
|
7
7
|
"license": "MIT",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"dev": "nuxi dev playground",
|
|
50
50
|
"dev:build": "nuxi build playground",
|
|
51
51
|
"prep": "nuxi prepare playground",
|
|
52
|
-
"format": "
|
|
53
|
-
"format:fix": "
|
|
52
|
+
"format": "dprint check",
|
|
53
|
+
"format:fix": "dprint fmt",
|
|
54
54
|
"lint": "eslint . --format gitlab",
|
|
55
55
|
"lint:fix": "eslint . --fix",
|
|
56
56
|
"typecheck": "vue-tsc --noEmit -p tsconfig.check.json",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@nuxt/kit": "3.11.1",
|
|
64
|
-
"@scayle/h3-session": "0.3.
|
|
64
|
+
"@scayle/h3-session": "0.3.6",
|
|
65
65
|
"@scayle/storefront-core": "7.48.0",
|
|
66
|
-
"@scayle/unstorage-compression-driver": "0.1.
|
|
66
|
+
"@scayle/unstorage-compression-driver": "0.1.3",
|
|
67
67
|
"@vueuse/core": "10.9.0",
|
|
68
68
|
"consola": "3.2.3",
|
|
69
69
|
"core-js": "3.36.1",
|
|
@@ -82,19 +82,18 @@
|
|
|
82
82
|
"@nuxt/module-builder": "0.5.5",
|
|
83
83
|
"@nuxt/schema": "3.11.1",
|
|
84
84
|
"@nuxt/test-utils": "3.12.0",
|
|
85
|
-
"@scayle/eslint-config-storefront": "3.2.
|
|
85
|
+
"@scayle/eslint-config-storefront": "3.2.7",
|
|
86
86
|
"@scayle/eslint-plugin-vue-composable": "0.1.1",
|
|
87
|
-
"@
|
|
88
|
-
"
|
|
87
|
+
"@types/node": "20.12.6",
|
|
88
|
+
"dprint": "0.45.1",
|
|
89
89
|
"eslint": "8.57.0",
|
|
90
90
|
"eslint-formatter-gitlab": "5.1.0",
|
|
91
91
|
"h3": "1.11.1",
|
|
92
92
|
"node-mocks-http": "1.14.1",
|
|
93
93
|
"nuxt": "3.11.1",
|
|
94
|
-
"prettier": "3.0.0",
|
|
95
94
|
"publint": "0.2.7",
|
|
96
95
|
"vitest": "1.4.0",
|
|
97
|
-
"vue-tsc": "2.0.
|
|
96
|
+
"vue-tsc": "2.0.11"
|
|
98
97
|
},
|
|
99
98
|
"peerDependencies": {
|
|
100
99
|
"h3": "^1.10.0",
|