@wix/headless-stores 0.0.22 → 0.0.24
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/cjs/dist/react/Product.d.ts +28 -5
- package/cjs/dist/react/Product.js +18 -4
- package/cjs/dist/services/buy-now-service.d.ts +10 -2
- package/cjs/dist/services/catalog-service.d.ts +4 -3
- package/cjs/dist/services/catalog-service.js +1 -1
- package/cjs/dist/services/collection-service.d.ts +8 -10
- package/cjs/dist/services/collection-service.js +4 -2
- package/cjs/dist/services/pay-now-service.d.ts +9 -14
- package/cjs/dist/services/product-service.d.ts +5 -5
- package/cjs/dist/services/product-service.js +1 -1
- package/cjs/dist/services/related-products-service.d.ts +6 -6
- package/cjs/dist/services/related-products-service.js +3 -1
- package/dist/react/Product.d.ts +28 -5
- package/dist/react/Product.js +18 -4
- package/dist/services/buy-now-service.d.ts +10 -2
- package/dist/services/catalog-service.d.ts +4 -3
- package/dist/services/catalog-service.js +1 -1
- package/dist/services/collection-service.d.ts +8 -10
- package/dist/services/collection-service.js +4 -2
- package/dist/services/pay-now-service.d.ts +9 -14
- package/dist/services/product-service.d.ts +5 -5
- package/dist/services/product-service.js +1 -1
- package/dist/services/related-products-service.d.ts +6 -6
- package/dist/services/related-products-service.js +3 -1
- package/package.json +4 -4
|
@@ -30,14 +30,37 @@ export interface ProductDescriptionProps {
|
|
|
30
30
|
* Render props for ProductDescription component
|
|
31
31
|
*/
|
|
32
32
|
export interface ProductDescriptionRenderProps {
|
|
33
|
-
/** Product description (
|
|
33
|
+
/** Product description using the RICOS (Rich Content Object) format. See https://dev.wix.com/docs/ricos/api-reference/ricos-document */
|
|
34
34
|
description: NonNullable<V3Product["description"]>;
|
|
35
|
-
/** Product plain
|
|
35
|
+
/** Product description with plain html */
|
|
36
36
|
plainDescription: NonNullable<V3Product["plainDescription"]>;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* @component
|
|
39
|
+
* Render props for ProductDescription component
|
|
42
40
|
*/
|
|
41
|
+
export interface ProductDescriptionRenderProps {
|
|
42
|
+
/** Product description using the RICOS (Rich Content Object) format. See https://dev.wix.com/docs/ricos/api-reference/ricos-document */
|
|
43
|
+
description: NonNullable<V3Product["description"]>;
|
|
44
|
+
/** Product description with plain html */
|
|
45
|
+
plainDescription: NonNullable<V3Product["plainDescription"]>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Headless component for product description display
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* <Product.Description>
|
|
52
|
+
* {({ plainDescription }) => (
|
|
53
|
+
* <>
|
|
54
|
+
* {plainDescription && (
|
|
55
|
+
* <p
|
|
56
|
+
* dangerouslySetInnerHTML={{
|
|
57
|
+
* __html: plainDescription,
|
|
58
|
+
* }}
|
|
59
|
+
* />
|
|
60
|
+
* )}
|
|
61
|
+
* </>
|
|
62
|
+
* )}
|
|
63
|
+
* </Product.Description>
|
|
64
|
+
* @component
|
|
65
|
+
*/
|
|
43
66
|
export declare const Description: (props: ProductDescriptionProps) => import("react").ReactNode;
|
|
@@ -14,10 +14,24 @@ export const Name = (props) => {
|
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
* Headless component for product description display
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <Product.Description>
|
|
21
|
+
* {({ plainDescription }) => (
|
|
22
|
+
* <>
|
|
23
|
+
* {plainDescription && (
|
|
24
|
+
* <p
|
|
25
|
+
* dangerouslySetInnerHTML={{
|
|
26
|
+
* __html: plainDescription,
|
|
27
|
+
* }}
|
|
28
|
+
* />
|
|
29
|
+
* )}
|
|
30
|
+
* </>
|
|
31
|
+
* )}
|
|
32
|
+
* </Product.Description>
|
|
33
|
+
* @component
|
|
34
|
+
*/
|
|
21
35
|
export const Description = (props) => {
|
|
22
36
|
const service = useService(ProductServiceDefinition);
|
|
23
37
|
const product = service.product.get();
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ServiceFactoryConfig } from "@wix/services-definitions";
|
|
2
1
|
import { type Signal } from "@wix/services-definitions/core-services/signals";
|
|
3
2
|
export declare const BuyNowServiceDefinition: string & {
|
|
4
3
|
__api: {
|
|
@@ -23,6 +22,15 @@ export declare const BuyNowServiceDefinition: string & {
|
|
|
23
22
|
price: string;
|
|
24
23
|
currency: string;
|
|
25
24
|
};
|
|
25
|
+
export interface BuyNowServiceConfig {
|
|
26
|
+
productId: string;
|
|
27
|
+
variantId?: string;
|
|
28
|
+
productName: string;
|
|
29
|
+
price: string;
|
|
30
|
+
currency: string;
|
|
31
|
+
inStock: boolean;
|
|
32
|
+
preOrderAvailable: boolean;
|
|
33
|
+
}
|
|
26
34
|
export declare const BuyNowServiceImplementation: import("@wix/services-definitions").ServiceFactory<string & {
|
|
27
35
|
__api: {
|
|
28
36
|
redirectToCheckout: () => Promise<void>;
|
|
@@ -67,7 +75,7 @@ export declare const loadBuyNowServiceInitialData: (productSlug: string, variant
|
|
|
67
75
|
}>;
|
|
68
76
|
export declare const buyNowServiceBinding: <T extends {
|
|
69
77
|
[key: string]: Awaited<ReturnType<typeof loadBuyNowServiceInitialData>>[typeof BuyNowServiceDefinition];
|
|
70
|
-
}>(servicesConfigs: T, additionalConfig?: Partial<
|
|
78
|
+
}>(servicesConfigs: T, additionalConfig?: Partial<BuyNowServiceConfig>) => readonly [string & {
|
|
71
79
|
__api: {
|
|
72
80
|
redirectToCheckout: () => Promise<void>;
|
|
73
81
|
loadingSignal: Signal<boolean>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type ServiceFactoryConfig } from "@wix/services-definitions";
|
|
2
1
|
import { type Signal } from "@wix/services-definitions/core-services/signals";
|
|
3
2
|
export interface ProductOption {
|
|
4
3
|
id: string;
|
|
@@ -27,9 +26,11 @@ export declare const CatalogServiceDefinition: string & {
|
|
|
27
26
|
__config: {};
|
|
28
27
|
isServiceDefinition?: boolean;
|
|
29
28
|
} & CatalogServiceAPI;
|
|
29
|
+
export interface CatalogServiceConfig {
|
|
30
|
+
}
|
|
30
31
|
export declare const CatalogService: import("@wix/services-definitions").ServiceFactory<string & {
|
|
31
32
|
__api: CatalogServiceAPI;
|
|
32
33
|
__config: {};
|
|
33
34
|
isServiceDefinition?: boolean;
|
|
34
|
-
} & CatalogServiceAPI,
|
|
35
|
-
export declare function loadCatalogServiceConfig(): Promise<
|
|
35
|
+
} & CatalogServiceAPI, CatalogServiceConfig>;
|
|
36
|
+
export declare function loadCatalogServiceConfig(): Promise<CatalogServiceConfig>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineService, implementService
|
|
1
|
+
import { defineService, implementService } from "@wix/services-definitions";
|
|
2
2
|
import { SignalsServiceDefinition, } from "@wix/services-definitions/core-services/signals";
|
|
3
3
|
import * as productsV3 from "@wix/auto_sdk_stores_products-v-3";
|
|
4
4
|
import * as customizationsV3 from "@wix/auto_sdk_stores_customizations-v-3";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type ServiceFactoryConfig } from "@wix/services-definitions";
|
|
2
1
|
import type { Signal } from "@wix/services-definitions/core-services/signals";
|
|
3
2
|
import { productsV3 } from "@wix/stores";
|
|
4
3
|
import { type Filter } from "./filter-service.js";
|
|
@@ -18,20 +17,19 @@ export declare const CollectionServiceDefinition: string & {
|
|
|
18
17
|
__config: {};
|
|
19
18
|
isServiceDefinition?: boolean;
|
|
20
19
|
} & CollectionServiceAPI;
|
|
21
|
-
export
|
|
22
|
-
__api: CollectionServiceAPI;
|
|
23
|
-
__config: {};
|
|
24
|
-
isServiceDefinition?: boolean;
|
|
25
|
-
} & CollectionServiceAPI, {
|
|
20
|
+
export interface CollectionServiceConfig {
|
|
26
21
|
initialProducts?: productsV3.V3Product[];
|
|
27
22
|
pageSize?: number;
|
|
28
23
|
initialCursor?: string;
|
|
29
24
|
initialHasMore?: boolean;
|
|
30
25
|
categories?: any[];
|
|
31
|
-
}
|
|
32
|
-
export declare
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
}
|
|
27
|
+
export declare const CollectionService: import("@wix/services-definitions").ServiceFactory<string & {
|
|
28
|
+
__api: CollectionServiceAPI;
|
|
29
|
+
__config: {};
|
|
30
|
+
isServiceDefinition?: boolean;
|
|
31
|
+
} & CollectionServiceAPI, CollectionServiceConfig>;
|
|
32
|
+
export declare function loadCollectionServiceConfig(categoryId?: string, searchParams?: URLSearchParams, preloadedCategories?: any[]): Promise<CollectionServiceConfig & {
|
|
35
33
|
initialSort?: SortBy;
|
|
36
34
|
initialFilters?: Filter;
|
|
37
35
|
}>;
|
|
@@ -193,7 +193,8 @@ export const CollectionService = implementService.withConfig()(CollectionService
|
|
|
193
193
|
const currentProducts = productsList.get();
|
|
194
194
|
const productResults = await searchProducts(searchOptions);
|
|
195
195
|
// Update cursor for next pagination
|
|
196
|
-
nextCursor =
|
|
196
|
+
nextCursor =
|
|
197
|
+
productResults.pagingMetadata?.cursors?.next || undefined;
|
|
197
198
|
// Check if there are more products to load
|
|
198
199
|
const hasMore = Boolean(nextCursor &&
|
|
199
200
|
productResults.products &&
|
|
@@ -240,7 +241,8 @@ export const CollectionService = implementService.withConfig()(CollectionService
|
|
|
240
241
|
});
|
|
241
242
|
}
|
|
242
243
|
// Reset pagination state
|
|
243
|
-
nextCursor =
|
|
244
|
+
nextCursor =
|
|
245
|
+
productResults.pagingMetadata?.cursors?.next || undefined;
|
|
244
246
|
const hasMore = Boolean(productResults.pagingMetadata?.cursors?.next &&
|
|
245
247
|
productResults.products &&
|
|
246
248
|
productResults.products.length === pageSize);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ServiceFactoryConfig } from "@wix/services-definitions";
|
|
2
1
|
import { type Signal } from "@wix/services-definitions/core-services/signals";
|
|
3
2
|
export declare const PayNowServiceDefinition: string & {
|
|
4
3
|
__api: {
|
|
@@ -13,6 +12,12 @@ export declare const PayNowServiceDefinition: string & {
|
|
|
13
12
|
loadingSignal: Signal<boolean>;
|
|
14
13
|
errorSignal: Signal<string | null>;
|
|
15
14
|
};
|
|
15
|
+
export interface PayNowServiceConfig {
|
|
16
|
+
customCheckoutAction?: () => Promise<{
|
|
17
|
+
data: string | undefined;
|
|
18
|
+
error: unknown;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
16
21
|
export declare const PayNowServiceImplementation: import("@wix/services-definitions").ServiceFactory<string & {
|
|
17
22
|
__api: {
|
|
18
23
|
redirectToCheckout: () => Promise<void>;
|
|
@@ -25,18 +30,13 @@ export declare const PayNowServiceImplementation: import("@wix/services-definiti
|
|
|
25
30
|
redirectToCheckout: () => Promise<void>;
|
|
26
31
|
loadingSignal: Signal<boolean>;
|
|
27
32
|
errorSignal: Signal<string | null>;
|
|
28
|
-
},
|
|
29
|
-
customCheckoutAction?: () => Promise<{
|
|
30
|
-
data: string | undefined;
|
|
31
|
-
error: unknown;
|
|
32
|
-
}>;
|
|
33
|
-
}>;
|
|
33
|
+
}, PayNowServiceConfig>;
|
|
34
34
|
export declare const loadPayNowServiceInitialData: () => Promise<{
|
|
35
35
|
[PayNowServiceDefinition]: {};
|
|
36
36
|
}>;
|
|
37
37
|
export declare const payNowServiceBinding: <T extends {
|
|
38
38
|
[key: string]: Awaited<ReturnType<typeof loadPayNowServiceInitialData>>[typeof PayNowServiceDefinition];
|
|
39
|
-
}>(servicesConfigs: T, additionalConfig?: Partial<
|
|
39
|
+
}>(servicesConfigs: T, additionalConfig?: Partial<PayNowServiceConfig>) => readonly [string & {
|
|
40
40
|
__api: {
|
|
41
41
|
redirectToCheckout: () => Promise<void>;
|
|
42
42
|
loadingSignal: Signal<boolean>;
|
|
@@ -60,12 +60,7 @@ export declare const payNowServiceBinding: <T extends {
|
|
|
60
60
|
redirectToCheckout: () => Promise<void>;
|
|
61
61
|
loadingSignal: Signal<boolean>;
|
|
62
62
|
errorSignal: Signal<string | null>;
|
|
63
|
-
}, {
|
|
64
|
-
customCheckoutAction?: () => Promise<{
|
|
65
|
-
data: string | undefined;
|
|
66
|
-
error: unknown;
|
|
67
|
-
}>;
|
|
68
|
-
}>, {
|
|
63
|
+
}, PayNowServiceConfig>, {
|
|
69
64
|
customCheckoutAction?: () => Promise<{
|
|
70
65
|
data: string | undefined;
|
|
71
66
|
error: unknown;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type ServiceFactoryConfig } from "@wix/services-definitions";
|
|
2
1
|
import { type Signal } from "@wix/services-definitions/core-services/signals";
|
|
3
2
|
import * as productsV3 from "@wix/auto_sdk_stores_products-v-3";
|
|
4
3
|
export interface ProductServiceAPI {
|
|
@@ -12,16 +11,17 @@ export declare const ProductServiceDefinition: string & {
|
|
|
12
11
|
__config: {};
|
|
13
12
|
isServiceDefinition?: boolean;
|
|
14
13
|
} & ProductServiceAPI;
|
|
14
|
+
export interface ProductServiceConfig {
|
|
15
|
+
product: productsV3.V3Product;
|
|
16
|
+
}
|
|
15
17
|
export declare const ProductService: import("@wix/services-definitions").ServiceFactory<string & {
|
|
16
18
|
__api: ProductServiceAPI;
|
|
17
19
|
__config: {};
|
|
18
20
|
isServiceDefinition?: boolean;
|
|
19
|
-
} & ProductServiceAPI,
|
|
20
|
-
product: productsV3.V3Product;
|
|
21
|
-
}>;
|
|
21
|
+
} & ProductServiceAPI, ProductServiceConfig>;
|
|
22
22
|
export type ProductServiceConfigResult = {
|
|
23
23
|
type: "success";
|
|
24
|
-
config:
|
|
24
|
+
config: ProductServiceConfig;
|
|
25
25
|
} | {
|
|
26
26
|
type: "notFound";
|
|
27
27
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineService, implementService
|
|
1
|
+
import { defineService, implementService } from "@wix/services-definitions";
|
|
2
2
|
import { SignalsServiceDefinition, } from "@wix/services-definitions/core-services/signals";
|
|
3
3
|
import * as productsV3 from "@wix/auto_sdk_stores_products-v-3";
|
|
4
4
|
export const ProductServiceDefinition = defineService("product");
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type ServiceFactoryConfig } from "@wix/services-definitions";
|
|
2
1
|
import { type Signal } from "@wix/services-definitions/core-services/signals";
|
|
3
2
|
import * as productsV3 from "@wix/auto_sdk_stores_products-v-3";
|
|
4
3
|
export interface RelatedProductsServiceAPI {
|
|
@@ -14,12 +13,13 @@ export declare const RelatedProductsServiceDefinition: string & {
|
|
|
14
13
|
__config: {};
|
|
15
14
|
isServiceDefinition?: boolean;
|
|
16
15
|
} & RelatedProductsServiceAPI;
|
|
16
|
+
export interface RelatedProductsServiceConfig {
|
|
17
|
+
productId: string;
|
|
18
|
+
limit?: number;
|
|
19
|
+
}
|
|
17
20
|
export declare const RelatedProductsService: import("@wix/services-definitions").ServiceFactory<string & {
|
|
18
21
|
__api: RelatedProductsServiceAPI;
|
|
19
22
|
__config: {};
|
|
20
23
|
isServiceDefinition?: boolean;
|
|
21
|
-
} & RelatedProductsServiceAPI,
|
|
22
|
-
|
|
23
|
-
limit?: number;
|
|
24
|
-
}>;
|
|
25
|
-
export declare function loadRelatedProductsServiceConfig(productId: string, limit?: number): Promise<ServiceFactoryConfig<typeof RelatedProductsService>>;
|
|
24
|
+
} & RelatedProductsServiceAPI, RelatedProductsServiceConfig>;
|
|
25
|
+
export declare function loadRelatedProductsServiceConfig(productId: string, limit?: number): Promise<RelatedProductsServiceConfig>;
|
|
@@ -18,7 +18,9 @@ export const RelatedProductsService = implementService.withConfig()(RelatedProdu
|
|
|
18
18
|
hasRelatedProducts.set((relatedResult.items || []).length > 0);
|
|
19
19
|
}
|
|
20
20
|
catch (err) {
|
|
21
|
-
const errorMessage = err instanceof Error
|
|
21
|
+
const errorMessage = err instanceof Error
|
|
22
|
+
? err.message
|
|
23
|
+
: "Failed to load related products";
|
|
22
24
|
error.set(errorMessage);
|
|
23
25
|
relatedProducts.set([]);
|
|
24
26
|
hasRelatedProducts.set(false);
|
package/dist/react/Product.d.ts
CHANGED
|
@@ -30,14 +30,37 @@ export interface ProductDescriptionProps {
|
|
|
30
30
|
* Render props for ProductDescription component
|
|
31
31
|
*/
|
|
32
32
|
export interface ProductDescriptionRenderProps {
|
|
33
|
-
/** Product description (
|
|
33
|
+
/** Product description using the RICOS (Rich Content Object) format. See https://dev.wix.com/docs/ricos/api-reference/ricos-document */
|
|
34
34
|
description: NonNullable<V3Product["description"]>;
|
|
35
|
-
/** Product plain
|
|
35
|
+
/** Product description with plain html */
|
|
36
36
|
plainDescription: NonNullable<V3Product["plainDescription"]>;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* @component
|
|
39
|
+
* Render props for ProductDescription component
|
|
42
40
|
*/
|
|
41
|
+
export interface ProductDescriptionRenderProps {
|
|
42
|
+
/** Product description using the RICOS (Rich Content Object) format. See https://dev.wix.com/docs/ricos/api-reference/ricos-document */
|
|
43
|
+
description: NonNullable<V3Product["description"]>;
|
|
44
|
+
/** Product description with plain html */
|
|
45
|
+
plainDescription: NonNullable<V3Product["plainDescription"]>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Headless component for product description display
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* <Product.Description>
|
|
52
|
+
* {({ plainDescription }) => (
|
|
53
|
+
* <>
|
|
54
|
+
* {plainDescription && (
|
|
55
|
+
* <p
|
|
56
|
+
* dangerouslySetInnerHTML={{
|
|
57
|
+
* __html: plainDescription,
|
|
58
|
+
* }}
|
|
59
|
+
* />
|
|
60
|
+
* )}
|
|
61
|
+
* </>
|
|
62
|
+
* )}
|
|
63
|
+
* </Product.Description>
|
|
64
|
+
* @component
|
|
65
|
+
*/
|
|
43
66
|
export declare const Description: (props: ProductDescriptionProps) => import("react").ReactNode;
|
package/dist/react/Product.js
CHANGED
|
@@ -14,10 +14,24 @@ export const Name = (props) => {
|
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
* Headless component for product description display
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <Product.Description>
|
|
21
|
+
* {({ plainDescription }) => (
|
|
22
|
+
* <>
|
|
23
|
+
* {plainDescription && (
|
|
24
|
+
* <p
|
|
25
|
+
* dangerouslySetInnerHTML={{
|
|
26
|
+
* __html: plainDescription,
|
|
27
|
+
* }}
|
|
28
|
+
* />
|
|
29
|
+
* )}
|
|
30
|
+
* </>
|
|
31
|
+
* )}
|
|
32
|
+
* </Product.Description>
|
|
33
|
+
* @component
|
|
34
|
+
*/
|
|
21
35
|
export const Description = (props) => {
|
|
22
36
|
const service = useService(ProductServiceDefinition);
|
|
23
37
|
const product = service.product.get();
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ServiceFactoryConfig } from "@wix/services-definitions";
|
|
2
1
|
import { type Signal } from "@wix/services-definitions/core-services/signals";
|
|
3
2
|
export declare const BuyNowServiceDefinition: string & {
|
|
4
3
|
__api: {
|
|
@@ -23,6 +22,15 @@ export declare const BuyNowServiceDefinition: string & {
|
|
|
23
22
|
price: string;
|
|
24
23
|
currency: string;
|
|
25
24
|
};
|
|
25
|
+
export interface BuyNowServiceConfig {
|
|
26
|
+
productId: string;
|
|
27
|
+
variantId?: string;
|
|
28
|
+
productName: string;
|
|
29
|
+
price: string;
|
|
30
|
+
currency: string;
|
|
31
|
+
inStock: boolean;
|
|
32
|
+
preOrderAvailable: boolean;
|
|
33
|
+
}
|
|
26
34
|
export declare const BuyNowServiceImplementation: import("@wix/services-definitions").ServiceFactory<string & {
|
|
27
35
|
__api: {
|
|
28
36
|
redirectToCheckout: () => Promise<void>;
|
|
@@ -67,7 +75,7 @@ export declare const loadBuyNowServiceInitialData: (productSlug: string, variant
|
|
|
67
75
|
}>;
|
|
68
76
|
export declare const buyNowServiceBinding: <T extends {
|
|
69
77
|
[key: string]: Awaited<ReturnType<typeof loadBuyNowServiceInitialData>>[typeof BuyNowServiceDefinition];
|
|
70
|
-
}>(servicesConfigs: T, additionalConfig?: Partial<
|
|
78
|
+
}>(servicesConfigs: T, additionalConfig?: Partial<BuyNowServiceConfig>) => readonly [string & {
|
|
71
79
|
__api: {
|
|
72
80
|
redirectToCheckout: () => Promise<void>;
|
|
73
81
|
loadingSignal: Signal<boolean>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type ServiceFactoryConfig } from "@wix/services-definitions";
|
|
2
1
|
import { type Signal } from "@wix/services-definitions/core-services/signals";
|
|
3
2
|
export interface ProductOption {
|
|
4
3
|
id: string;
|
|
@@ -27,9 +26,11 @@ export declare const CatalogServiceDefinition: string & {
|
|
|
27
26
|
__config: {};
|
|
28
27
|
isServiceDefinition?: boolean;
|
|
29
28
|
} & CatalogServiceAPI;
|
|
29
|
+
export interface CatalogServiceConfig {
|
|
30
|
+
}
|
|
30
31
|
export declare const CatalogService: import("@wix/services-definitions").ServiceFactory<string & {
|
|
31
32
|
__api: CatalogServiceAPI;
|
|
32
33
|
__config: {};
|
|
33
34
|
isServiceDefinition?: boolean;
|
|
34
|
-
} & CatalogServiceAPI,
|
|
35
|
-
export declare function loadCatalogServiceConfig(): Promise<
|
|
35
|
+
} & CatalogServiceAPI, CatalogServiceConfig>;
|
|
36
|
+
export declare function loadCatalogServiceConfig(): Promise<CatalogServiceConfig>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineService, implementService
|
|
1
|
+
import { defineService, implementService } from "@wix/services-definitions";
|
|
2
2
|
import { SignalsServiceDefinition, } from "@wix/services-definitions/core-services/signals";
|
|
3
3
|
import * as productsV3 from "@wix/auto_sdk_stores_products-v-3";
|
|
4
4
|
import * as customizationsV3 from "@wix/auto_sdk_stores_customizations-v-3";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type ServiceFactoryConfig } from "@wix/services-definitions";
|
|
2
1
|
import type { Signal } from "@wix/services-definitions/core-services/signals";
|
|
3
2
|
import { productsV3 } from "@wix/stores";
|
|
4
3
|
import { type Filter } from "./filter-service.js";
|
|
@@ -18,20 +17,19 @@ export declare const CollectionServiceDefinition: string & {
|
|
|
18
17
|
__config: {};
|
|
19
18
|
isServiceDefinition?: boolean;
|
|
20
19
|
} & CollectionServiceAPI;
|
|
21
|
-
export
|
|
22
|
-
__api: CollectionServiceAPI;
|
|
23
|
-
__config: {};
|
|
24
|
-
isServiceDefinition?: boolean;
|
|
25
|
-
} & CollectionServiceAPI, {
|
|
20
|
+
export interface CollectionServiceConfig {
|
|
26
21
|
initialProducts?: productsV3.V3Product[];
|
|
27
22
|
pageSize?: number;
|
|
28
23
|
initialCursor?: string;
|
|
29
24
|
initialHasMore?: boolean;
|
|
30
25
|
categories?: any[];
|
|
31
|
-
}
|
|
32
|
-
export declare
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
}
|
|
27
|
+
export declare const CollectionService: import("@wix/services-definitions").ServiceFactory<string & {
|
|
28
|
+
__api: CollectionServiceAPI;
|
|
29
|
+
__config: {};
|
|
30
|
+
isServiceDefinition?: boolean;
|
|
31
|
+
} & CollectionServiceAPI, CollectionServiceConfig>;
|
|
32
|
+
export declare function loadCollectionServiceConfig(categoryId?: string, searchParams?: URLSearchParams, preloadedCategories?: any[]): Promise<CollectionServiceConfig & {
|
|
35
33
|
initialSort?: SortBy;
|
|
36
34
|
initialFilters?: Filter;
|
|
37
35
|
}>;
|
|
@@ -193,7 +193,8 @@ export const CollectionService = implementService.withConfig()(CollectionService
|
|
|
193
193
|
const currentProducts = productsList.get();
|
|
194
194
|
const productResults = await searchProducts(searchOptions);
|
|
195
195
|
// Update cursor for next pagination
|
|
196
|
-
nextCursor =
|
|
196
|
+
nextCursor =
|
|
197
|
+
productResults.pagingMetadata?.cursors?.next || undefined;
|
|
197
198
|
// Check if there are more products to load
|
|
198
199
|
const hasMore = Boolean(nextCursor &&
|
|
199
200
|
productResults.products &&
|
|
@@ -240,7 +241,8 @@ export const CollectionService = implementService.withConfig()(CollectionService
|
|
|
240
241
|
});
|
|
241
242
|
}
|
|
242
243
|
// Reset pagination state
|
|
243
|
-
nextCursor =
|
|
244
|
+
nextCursor =
|
|
245
|
+
productResults.pagingMetadata?.cursors?.next || undefined;
|
|
244
246
|
const hasMore = Boolean(productResults.pagingMetadata?.cursors?.next &&
|
|
245
247
|
productResults.products &&
|
|
246
248
|
productResults.products.length === pageSize);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ServiceFactoryConfig } from "@wix/services-definitions";
|
|
2
1
|
import { type Signal } from "@wix/services-definitions/core-services/signals";
|
|
3
2
|
export declare const PayNowServiceDefinition: string & {
|
|
4
3
|
__api: {
|
|
@@ -13,6 +12,12 @@ export declare const PayNowServiceDefinition: string & {
|
|
|
13
12
|
loadingSignal: Signal<boolean>;
|
|
14
13
|
errorSignal: Signal<string | null>;
|
|
15
14
|
};
|
|
15
|
+
export interface PayNowServiceConfig {
|
|
16
|
+
customCheckoutAction?: () => Promise<{
|
|
17
|
+
data: string | undefined;
|
|
18
|
+
error: unknown;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
16
21
|
export declare const PayNowServiceImplementation: import("@wix/services-definitions").ServiceFactory<string & {
|
|
17
22
|
__api: {
|
|
18
23
|
redirectToCheckout: () => Promise<void>;
|
|
@@ -25,18 +30,13 @@ export declare const PayNowServiceImplementation: import("@wix/services-definiti
|
|
|
25
30
|
redirectToCheckout: () => Promise<void>;
|
|
26
31
|
loadingSignal: Signal<boolean>;
|
|
27
32
|
errorSignal: Signal<string | null>;
|
|
28
|
-
},
|
|
29
|
-
customCheckoutAction?: () => Promise<{
|
|
30
|
-
data: string | undefined;
|
|
31
|
-
error: unknown;
|
|
32
|
-
}>;
|
|
33
|
-
}>;
|
|
33
|
+
}, PayNowServiceConfig>;
|
|
34
34
|
export declare const loadPayNowServiceInitialData: () => Promise<{
|
|
35
35
|
[PayNowServiceDefinition]: {};
|
|
36
36
|
}>;
|
|
37
37
|
export declare const payNowServiceBinding: <T extends {
|
|
38
38
|
[key: string]: Awaited<ReturnType<typeof loadPayNowServiceInitialData>>[typeof PayNowServiceDefinition];
|
|
39
|
-
}>(servicesConfigs: T, additionalConfig?: Partial<
|
|
39
|
+
}>(servicesConfigs: T, additionalConfig?: Partial<PayNowServiceConfig>) => readonly [string & {
|
|
40
40
|
__api: {
|
|
41
41
|
redirectToCheckout: () => Promise<void>;
|
|
42
42
|
loadingSignal: Signal<boolean>;
|
|
@@ -60,12 +60,7 @@ export declare const payNowServiceBinding: <T extends {
|
|
|
60
60
|
redirectToCheckout: () => Promise<void>;
|
|
61
61
|
loadingSignal: Signal<boolean>;
|
|
62
62
|
errorSignal: Signal<string | null>;
|
|
63
|
-
}, {
|
|
64
|
-
customCheckoutAction?: () => Promise<{
|
|
65
|
-
data: string | undefined;
|
|
66
|
-
error: unknown;
|
|
67
|
-
}>;
|
|
68
|
-
}>, {
|
|
63
|
+
}, PayNowServiceConfig>, {
|
|
69
64
|
customCheckoutAction?: () => Promise<{
|
|
70
65
|
data: string | undefined;
|
|
71
66
|
error: unknown;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type ServiceFactoryConfig } from "@wix/services-definitions";
|
|
2
1
|
import { type Signal } from "@wix/services-definitions/core-services/signals";
|
|
3
2
|
import * as productsV3 from "@wix/auto_sdk_stores_products-v-3";
|
|
4
3
|
export interface ProductServiceAPI {
|
|
@@ -12,16 +11,17 @@ export declare const ProductServiceDefinition: string & {
|
|
|
12
11
|
__config: {};
|
|
13
12
|
isServiceDefinition?: boolean;
|
|
14
13
|
} & ProductServiceAPI;
|
|
14
|
+
export interface ProductServiceConfig {
|
|
15
|
+
product: productsV3.V3Product;
|
|
16
|
+
}
|
|
15
17
|
export declare const ProductService: import("@wix/services-definitions").ServiceFactory<string & {
|
|
16
18
|
__api: ProductServiceAPI;
|
|
17
19
|
__config: {};
|
|
18
20
|
isServiceDefinition?: boolean;
|
|
19
|
-
} & ProductServiceAPI,
|
|
20
|
-
product: productsV3.V3Product;
|
|
21
|
-
}>;
|
|
21
|
+
} & ProductServiceAPI, ProductServiceConfig>;
|
|
22
22
|
export type ProductServiceConfigResult = {
|
|
23
23
|
type: "success";
|
|
24
|
-
config:
|
|
24
|
+
config: ProductServiceConfig;
|
|
25
25
|
} | {
|
|
26
26
|
type: "notFound";
|
|
27
27
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineService, implementService
|
|
1
|
+
import { defineService, implementService } from "@wix/services-definitions";
|
|
2
2
|
import { SignalsServiceDefinition, } from "@wix/services-definitions/core-services/signals";
|
|
3
3
|
import * as productsV3 from "@wix/auto_sdk_stores_products-v-3";
|
|
4
4
|
export const ProductServiceDefinition = defineService("product");
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type ServiceFactoryConfig } from "@wix/services-definitions";
|
|
2
1
|
import { type Signal } from "@wix/services-definitions/core-services/signals";
|
|
3
2
|
import * as productsV3 from "@wix/auto_sdk_stores_products-v-3";
|
|
4
3
|
export interface RelatedProductsServiceAPI {
|
|
@@ -14,12 +13,13 @@ export declare const RelatedProductsServiceDefinition: string & {
|
|
|
14
13
|
__config: {};
|
|
15
14
|
isServiceDefinition?: boolean;
|
|
16
15
|
} & RelatedProductsServiceAPI;
|
|
16
|
+
export interface RelatedProductsServiceConfig {
|
|
17
|
+
productId: string;
|
|
18
|
+
limit?: number;
|
|
19
|
+
}
|
|
17
20
|
export declare const RelatedProductsService: import("@wix/services-definitions").ServiceFactory<string & {
|
|
18
21
|
__api: RelatedProductsServiceAPI;
|
|
19
22
|
__config: {};
|
|
20
23
|
isServiceDefinition?: boolean;
|
|
21
|
-
} & RelatedProductsServiceAPI,
|
|
22
|
-
|
|
23
|
-
limit?: number;
|
|
24
|
-
}>;
|
|
25
|
-
export declare function loadRelatedProductsServiceConfig(productId: string, limit?: number): Promise<ServiceFactoryConfig<typeof RelatedProductsService>>;
|
|
24
|
+
} & RelatedProductsServiceAPI, RelatedProductsServiceConfig>;
|
|
25
|
+
export declare function loadRelatedProductsServiceConfig(productId: string, limit?: number): Promise<RelatedProductsServiceConfig>;
|
|
@@ -18,7 +18,9 @@ export const RelatedProductsService = implementService.withConfig()(RelatedProdu
|
|
|
18
18
|
hasRelatedProducts.set((relatedResult.items || []).length > 0);
|
|
19
19
|
}
|
|
20
20
|
catch (err) {
|
|
21
|
-
const errorMessage = err instanceof Error
|
|
21
|
+
const errorMessage = err instanceof Error
|
|
22
|
+
? err.message
|
|
23
|
+
: "Failed to load related products";
|
|
22
24
|
error.set(errorMessage);
|
|
23
25
|
relatedProducts.set([]);
|
|
24
26
|
hasRelatedProducts.set(false);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/headless-stores",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prebuild": "cd ../media && yarn build && cd ../ecom && yarn build",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@types/node": "^20.9.0",
|
|
47
47
|
"@vitest/ui": "^3.1.4",
|
|
48
48
|
"jsdom": "^26.1.0",
|
|
49
|
-
"typescript": "^5.
|
|
49
|
+
"typescript": "^5.8.3",
|
|
50
50
|
"vitest": "^3.1.4"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
"@wix/auto_sdk_stores_products-v-3": "^1.0.53",
|
|
58
58
|
"@wix/auto_sdk_stores_read-only-variants-v-3": "^1.0.23",
|
|
59
59
|
"@wix/ecom": "^1.0.1238",
|
|
60
|
-
"@wix/essentials": "^0.1.
|
|
60
|
+
"@wix/essentials": "^0.1.24",
|
|
61
61
|
"@wix/headless-ecom": "^0.0.8",
|
|
62
62
|
"@wix/headless-media": "^0.0.5",
|
|
63
|
-
"@wix/redirects": "^1.0.
|
|
63
|
+
"@wix/redirects": "^1.0.83",
|
|
64
64
|
"@wix/services-definitions": "^0.1.4",
|
|
65
65
|
"@wix/services-manager-react": "^0.1.26"
|
|
66
66
|
}
|