@scayle/storefront-nuxt 7.72.2 → 7.72.3
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/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/composables/core/useAvailableShops.d.ts +1 -1
- package/dist/runtime/composables/core/useAvailableShops.mjs +2 -2
- package/dist/runtime/composables/core/useFormatHelpers.d.ts +1 -1
- package/dist/runtime/composables/core/useFormatHelpers.mjs +1 -1
- package/dist/runtime/composables/core/useIDP.d.ts +1 -1
- package/dist/runtime/composables/core/useIDP.mjs +2 -2
- package/dist/runtime/composables/core/useRpc.d.ts +2 -1
- package/dist/runtime/composables/core/useRpc.mjs +2 -2
- package/dist/runtime/composables/storefront/useQueryFilterState.d.ts +2 -2
- package/dist/runtime/composables/storefront/useQueryFilterState.mjs +2 -2
- package/dist/runtime/composables/storefront/useSearch.d.ts +1 -1
- package/dist/runtime/composables/storefront/useSearch.mjs +2 -2
- package/dist/runtime/composables/storefront/useStorefrontSearch.d.ts +2 -1
- package/dist/runtime/composables/storefront/useStorefrontSearch.mjs +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { PublicShopConfig } from '../../../module';
|
|
2
|
-
export declare
|
|
2
|
+
export declare function useAvailableShops(): import("vue").Ref<PublicShopConfig[]>;
|
|
@@ -8,7 +8,7 @@ type FormatCurrencyOptions = {
|
|
|
8
8
|
currencyFractionDigits?: number;
|
|
9
9
|
style: 'decimal';
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export declare function useFormatHelpers(): {
|
|
12
12
|
formatCurrency: (value: number, options?: FormatCurrencyOptions) => string;
|
|
13
13
|
};
|
|
14
14
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getDefaultFractionDigits } from "@scayle/storefront-core";
|
|
2
2
|
import { useCurrentShop } from "./useCurrentShop.mjs";
|
|
3
|
-
export
|
|
3
|
+
export function useFormatHelpers() {
|
|
4
4
|
const currentShop = useCurrentShop();
|
|
5
5
|
const formatCurrency = (value, options) => {
|
|
6
6
|
const locale = options?.locale ?? currentShop.value.locale;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type MaybeRefOrGetter } from 'vue';
|
|
2
2
|
import type { RpcMethodParameters } from '@scayle/storefront-core';
|
|
3
|
-
export declare
|
|
3
|
+
export declare function useIDP(params?: MaybeRefOrGetter<RpcMethodParameters<'getExternalIdpRedirect'>>): Promise<{
|
|
4
4
|
data: import("vue").Ref<{
|
|
5
5
|
[k: string]: string;
|
|
6
6
|
} | undefined>;
|
|
@@ -3,7 +3,7 @@ import { useRpc } from "../core/useRpc.mjs";
|
|
|
3
3
|
import { rpcCall } from "./../../rpc/rpcCall.mjs";
|
|
4
4
|
import { useCurrentShop } from "./useCurrentShop.mjs";
|
|
5
5
|
import { toValue } from "#imports";
|
|
6
|
-
export
|
|
6
|
+
export async function useIDP(params = {}) {
|
|
7
7
|
const nuxtApp = useNuxtApp();
|
|
8
8
|
const shop = useCurrentShop();
|
|
9
9
|
const { data, fetching, fetch, error, status } = await useRpc(
|
|
@@ -25,4 +25,4 @@ export const useIDP = async (params = {}) => {
|
|
|
25
25
|
// TODO: Deprecate the property here and remove it with the next major release
|
|
26
26
|
handleIDPLoginCallback
|
|
27
27
|
};
|
|
28
|
-
}
|
|
28
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RpcContext, RpcMethodName, RpcMethodParameters, RpcMethodReturnType } from '@scayle/storefront-core';
|
|
2
2
|
import type { AsyncDataOptions, NuxtError } from 'nuxt/app';
|
|
3
|
+
import { type MaybeRefOrGetter } from '#imports';
|
|
3
4
|
type KeysOf<T> = Array<T extends T ? (keyof T extends string ? keyof T : never) : never>;
|
|
4
5
|
export type RpcAsyncDataOptions<TResult> = AsyncDataOptions<TResult, TResult, KeysOf<TResult>, TResult>;
|
|
5
6
|
export interface RpcOptions {
|
|
@@ -7,7 +8,7 @@ export interface RpcOptions {
|
|
|
7
8
|
lazy?: boolean;
|
|
8
9
|
}
|
|
9
10
|
export type Status = 'idle' | 'pending' | 'success' | 'error';
|
|
10
|
-
export declare
|
|
11
|
+
export declare function useRpc<N extends RpcMethodName, P extends RpcMethodParameters<N>, TResult extends Exclude<Awaited<RpcMethodReturnType<N>>, Response>, TParams = P extends RpcContext ? undefined : P>(method: N, key: string, params?: MaybeRefOrGetter<TParams>, options?: RpcOptions): Promise<{
|
|
11
12
|
data: import("vue").Ref<TResult | undefined>;
|
|
12
13
|
fetching: import("vue").Ref<boolean>;
|
|
13
14
|
fetch: () => Promise<void>;
|
|
@@ -15,7 +15,7 @@ const handleError = (error) => {
|
|
|
15
15
|
const data = resolveError(error);
|
|
16
16
|
return createError(data);
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export async function useRpc(method, key, params, options = { autoFetch: true, lazy: false }) {
|
|
19
19
|
const currentShop = useCurrentShop();
|
|
20
20
|
const log = useCoreLog("rpc");
|
|
21
21
|
const nuxtApp = useNuxtApp();
|
|
@@ -73,4 +73,4 @@ export const useRpc = async (method, key, params, options = { autoFetch: true, l
|
|
|
73
73
|
error,
|
|
74
74
|
status
|
|
75
75
|
};
|
|
76
|
-
}
|
|
76
|
+
}
|
|
@@ -2,11 +2,11 @@ import type { FilterParams, SortingValueKey, TransformedFilter, Filter } from '@
|
|
|
2
2
|
type Options = {
|
|
3
3
|
defaultSort?: SortingValueKey;
|
|
4
4
|
};
|
|
5
|
-
declare
|
|
5
|
+
export declare function useQueryFilterState(options?: Options): {
|
|
6
6
|
activeFilters: import("vue").ComputedRef<Filter>;
|
|
7
7
|
applyFilters: (filter?: Filter, scrollToTop?: boolean) => Promise<void>;
|
|
8
8
|
isActiveFilter: (filter?: TransformedFilter) => any;
|
|
9
9
|
resetFilterUrl: () => Promise<void>;
|
|
10
10
|
productConditions: import("vue").ComputedRef<FilterParams>;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export {};
|
|
@@ -10,7 +10,7 @@ import { computed } from "vue";
|
|
|
10
10
|
import { getCurrentPage } from "../../utils/route.mjs";
|
|
11
11
|
import { useRoute, useRouter } from "#imports";
|
|
12
12
|
const DEFAULT_QUERY_KEYS = ["page", "sort", "term"];
|
|
13
|
-
export
|
|
13
|
+
export function useQueryFilterState(options = {}) {
|
|
14
14
|
const router = useRouter();
|
|
15
15
|
const route = useRoute();
|
|
16
16
|
const activeFilters = computed(() => {
|
|
@@ -63,4 +63,4 @@ export default (options = {}) => {
|
|
|
63
63
|
resetFilterUrl,
|
|
64
64
|
productConditions: computed(() => generateFilterParams())
|
|
65
65
|
};
|
|
66
|
-
}
|
|
66
|
+
}
|
|
@@ -4,7 +4,7 @@ type Options = Partial<{
|
|
|
4
4
|
key: string;
|
|
5
5
|
}>;
|
|
6
6
|
/** @deprecated `useSearch` is deprecated. Please, use `useSearchSuggestions` or `useSearchResolve` */
|
|
7
|
-
export declare
|
|
7
|
+
export declare function useSearch({ params, key }?: Options): {
|
|
8
8
|
data: import("vue").Ref<TypeaheadSuggestionsEndpointResponseData | undefined>;
|
|
9
9
|
pending: import("vue").Ref<boolean>;
|
|
10
10
|
searchQuery: import("vue").Ref<string>;
|
|
@@ -2,7 +2,7 @@ import { useState } from "nuxt/app";
|
|
|
2
2
|
import { rpcCall } from "../../rpc/rpcCall.mjs";
|
|
3
3
|
import { useCurrentShop } from "../core/useCurrentShop.mjs";
|
|
4
4
|
import { useNuxtApp, toValue } from "#imports";
|
|
5
|
-
export
|
|
5
|
+
export function useSearch({ params, key = "search" } = {}) {
|
|
6
6
|
const data = useState(
|
|
7
7
|
`${key}-data`,
|
|
8
8
|
() => void 0
|
|
@@ -48,4 +48,4 @@ export const useSearch = ({ params, key = "search" } = {}) => {
|
|
|
48
48
|
resetSearch,
|
|
49
49
|
search
|
|
50
50
|
};
|
|
51
|
-
}
|
|
51
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type SearchV2SuggestionsEndpointResponseData, type SearchV2With } from '@scayle/storefront-core';
|
|
2
|
+
import { type Ref } from '#imports';
|
|
2
3
|
export type SearchOptions = Partial<{
|
|
3
4
|
params: Partial<{
|
|
4
5
|
categoryId: number;
|
|
@@ -6,7 +7,7 @@ export type SearchOptions = Partial<{
|
|
|
6
7
|
}>;
|
|
7
8
|
key: string;
|
|
8
9
|
}>;
|
|
9
|
-
export declare
|
|
10
|
+
export declare function useStorefrontSearch(searchQuery: Ref<string>, { params, key }?: SearchOptions): {
|
|
10
11
|
data: import("vue").Ref<SearchV2SuggestionsEndpointResponseData | undefined>;
|
|
11
12
|
pending: import("vue").Ref<boolean>;
|
|
12
13
|
resetSearch: () => void;
|
|
@@ -2,7 +2,7 @@ import { useState } from "nuxt/app";
|
|
|
2
2
|
import { rpcCall } from "../../rpc/rpcCall.mjs";
|
|
3
3
|
import { useCurrentShop } from "../core/useCurrentShop.mjs";
|
|
4
4
|
import { useNuxtApp, toValue } from "#imports";
|
|
5
|
-
export
|
|
5
|
+
export function useStorefrontSearch(searchQuery, { params, key = "search" } = {}) {
|
|
6
6
|
const data = useState(
|
|
7
7
|
`${key}-data`,
|
|
8
8
|
() => void 0
|
|
@@ -61,4 +61,4 @@ export const useStorefrontSearch = (searchQuery, { params, key = "search" } = {}
|
|
|
61
61
|
getSearchSuggestions,
|
|
62
62
|
resolveSearch
|
|
63
63
|
};
|
|
64
|
-
}
|
|
64
|
+
}
|
package/package.json
CHANGED