@faststore/core 3.77.3 → 3.78.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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +49 -49
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/config.json +3 -3
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/prerender-manifest.js +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/react-loadable-manifest.json +71 -57
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/1270.js +1 -0
- package/.next/server/chunks/1911.js +1 -0
- package/.next/server/chunks/2430.js +1 -0
- package/.next/server/chunks/3006.js +1 -1
- package/.next/server/chunks/3836.js +1 -1
- package/.next/server/chunks/3945.js +1 -0
- package/.next/server/chunks/5402.js +1 -0
- package/.next/server/chunks/6698.js +1 -0
- package/.next/server/chunks/6789.js +1 -1
- package/.next/server/chunks/{7178.js → 8071.js} +1 -1
- package/.next/server/chunks/83.js +1 -1
- package/.next/server/chunks/831.js +1 -1
- package/.next/server/chunks/8474.js +9 -0
- package/.next/server/chunks/8563.js +1 -0
- package/.next/server/chunks/9088.js +1 -1
- package/.next/server/chunks/9117.js +1 -0
- package/.next/server/chunks/948.js +1 -1
- package/.next/server/chunks/9563.js +2 -2
- package/.next/server/chunks/9630.js +101 -4
- package/.next/server/chunks/9853.js +1 -1
- package/.next/server/chunks/UIBannerText.js +1 -1
- package/.next/server/chunks/UISKUMatrixSidebar.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/404.js.nft.json +1 -1
- package/.next/server/pages/500.js.nft.json +1 -1
- package/.next/server/pages/[...slug].js +1 -1
- package/.next/server/pages/[...slug].js.nft.json +1 -1
- package/.next/server/pages/[slug]/p.js +1 -1
- package/.next/server/pages/[slug]/p.js.nft.json +1 -1
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/_document.js.nft.json +1 -1
- package/.next/server/pages/_error.js.nft.json +1 -1
- package/.next/server/pages/account/403.js.nft.json +1 -1
- package/.next/server/pages/account/404.js.nft.json +1 -1
- package/.next/server/pages/account/[...unknown].js.nft.json +1 -1
- package/.next/server/pages/account/orders/[id].js.nft.json +1 -1
- package/.next/server/pages/account/orders.js +1 -1
- package/.next/server/pages/account/orders.js.nft.json +1 -1
- package/.next/server/pages/account/profile.js.nft.json +1 -1
- package/.next/server/pages/account/security.js.nft.json +1 -1
- package/.next/server/pages/account/user-details.js.nft.json +1 -1
- package/.next/server/pages/account.js.nft.json +1 -1
- package/.next/server/pages/api/graphql.js +2 -2
- package/.next/server/pages/api/graphql.js.nft.json +1 -1
- package/.next/server/pages/api/health/live.js.nft.json +1 -1
- package/.next/server/pages/api/health/ready.js.nft.json +1 -1
- package/.next/server/pages/api/preview.js.nft.json +1 -1
- package/.next/server/pages/checkout.js.nft.json +1 -1
- package/.next/server/pages/en-US/404.html +1 -1
- package/.next/server/pages/en-US/500.html +1 -1
- package/.next/server/pages/en-US/checkout.html +1 -1
- package/.next/server/pages/en-US/login.html +1 -1
- package/.next/server/pages/en-US/s.html +1 -1
- package/.next/server/pages/en-US.html +1 -1
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/login.js.nft.json +1 -1
- package/.next/server/pages/s.js +1 -1
- package/.next/server/pages/s.js.nft.json +1 -1
- package/.next/server/pages-manifest.json +1 -1
- package/.next/static/{xFgIjKNUaH5r_Yo0uIAnc → 6VSKTBCq7vRe86nXQK6nv}/_buildManifest.js +1 -1
- package/.next/static/chunks/3155.c3fa96f983101956.js +1 -0
- package/.next/static/chunks/3166-a1d98d71987c90d6.js +1 -0
- package/.next/static/chunks/3399.60aae5ddb9123ef5.js +1 -0
- package/.next/static/chunks/3836.a2f49cd66f78bcb2.js +1 -0
- package/.next/static/chunks/4836.ef87204971e182f4.js +1 -0
- package/.next/static/chunks/6789.634a5fcc1ed30b8d.js +1 -0
- package/.next/static/chunks/7026.e990acc86d95259d.js +1 -0
- package/.next/static/chunks/7191-2b424236f6799274.js +1 -0
- package/.next/static/chunks/7351.8ef7b6b1d6e1505a.js +1 -0
- package/.next/static/chunks/83.affac11ef34a0c11.js +1 -0
- package/.next/static/chunks/8325.b3ddbb43feda1a85.js +1 -0
- package/.next/static/chunks/8587.1d6d458c9b697351.js +1 -0
- package/.next/static/chunks/9173-acced9d62b9088c8.js +1 -0
- package/.next/static/chunks/9666-9be3f1e484eeb148.js +1 -0
- package/.next/static/chunks/{7351.e90a4cc21797c136.js → 9714.68af2d4bf27f560b.js} +1 -1
- package/.next/static/chunks/9781.dd4028663db7414b.js +1 -0
- package/.next/static/chunks/BannerNewsletter.d91d065d644d15f3.js +1 -0
- package/.next/static/chunks/BannerText.3bc2f0af3687e984.js +1 -0
- package/.next/static/chunks/CartSidebar.f2f885b6d9a227e2.js +1 -0
- package/.next/static/chunks/ProductShelf.dcdeffe85dca1ace.js +1 -0
- package/.next/static/chunks/ProductTiles.12e553830401871d.js +1 -0
- package/.next/static/chunks/RegionModal.0aff964cb36eb49a.js +1 -0
- package/.next/static/chunks/RegionSlider.cbf2ac28eeac8dbe.js +1 -0
- package/.next/static/chunks/Toast.c06d4e2e2e7913c5.js +1 -0
- package/.next/static/chunks/UIBannerText.08c65db460bd1695.js +1 -0
- package/.next/static/chunks/UIToast.55af19d2eba3d8a1.js +1 -0
- package/.next/static/chunks/pages/{[...slug]-b3a9bdfcf0127006.js → [...slug]-1e68a914dfca7da9.js} +1 -1
- package/.next/static/chunks/pages/[slug]/p-2c73921b1ab00c27.js +1 -0
- package/.next/static/chunks/pages/_app-57478e0d1d2ddf62.js +1 -0
- package/.next/static/chunks/pages/{s-989fccebe1b60a4e.js → s-e7745eef6c834c3e.js} +1 -1
- package/.next/static/chunks/webpack-d29ca7e9684f9a33.js +1 -0
- package/.next/static/css/{70353bf19c496790.css → 297be4be3be36ff0.css} +1 -1
- package/.next/static/css/{0a57ee6c7a57788c.css → 4b8252ed2f23ac67.css} +1 -1
- package/.next/static/css/{6831395ff5fd317a.css → 6d92375b6ee8276a.css} +1 -1
- package/.next/static/css/8f6350925b347380.css +1 -0
- package/.next/trace +136 -135
- package/.turbo/turbo-build.log +19 -19
- package/.turbo/turbo-test.log +5 -5
- package/@generated/gql.ts +20 -4
- package/@generated/graphql.ts +310 -6
- package/@generated/persisted-documents.json +6 -5
- package/@generated/schema.graphql +39 -1
- package/CHANGELOG.md +6 -0
- package/cms/faststore/sections.json +99 -0
- package/package.json +4 -4
- package/src/components/product/ProductCard/ProductCard.tsx +74 -35
- package/src/components/product/ProductGrid/ProductGrid.tsx +16 -0
- package/src/components/sections/ProductDetails/ProductDetails.tsx +4 -0
- package/src/components/sections/ProductGallery/DefaultComponents.ts +15 -0
- package/src/components/sections/ProductGallery/ProductGallery.tsx +1 -0
- package/src/components/sections/ProductGallery/section.module.scss +16 -3
- package/src/components/ui/ProductComparison/ProductComparisonSidebar.tsx +256 -0
- package/src/components/ui/ProductComparison/index.ts +1 -0
- package/src/components/ui/ProductGallery/ProductGallery.tsx +251 -173
- package/src/components/ui/ProductGallery/ProductGalleryPage.tsx +6 -0
- package/src/sdk/product/useProductsSelected.tsx +45 -0
- package/src/typings/overrides.ts +30 -1
- package/test/server/index.test.ts +1 -0
- package/.next/server/chunks/1333.js +0 -1
- package/.next/server/chunks/2295.js +0 -1
- package/.next/server/chunks/2778.js +0 -9
- package/.next/server/chunks/3918.js +0 -1
- package/.next/server/chunks/3963.js +0 -1
- package/.next/server/chunks/5607.js +0 -1
- package/.next/server/chunks/6335.js +0 -1
- package/.next/server/chunks/76.js +0 -1
- package/.next/server/chunks/7794.js +0 -1
- package/.next/server/chunks/839.js +0 -1
- package/.next/static/chunks/3155.243c7558a71f0695.js +0 -1
- package/.next/static/chunks/3166-e2e2d3255aa5f208.js +0 -1
- package/.next/static/chunks/3399.93804fb74f79436c.js +0 -1
- package/.next/static/chunks/3836.c0487aea7bd0c6f0.js +0 -1
- package/.next/static/chunks/5781.28d03feacead66ad.js +0 -1
- package/.next/static/chunks/6355.454b14737c2bf69c.js +0 -1
- package/.next/static/chunks/6857.b2c06171638955ea.js +0 -1
- package/.next/static/chunks/7191-7badbb9888b79ce9.js +0 -1
- package/.next/static/chunks/7481.3c4ad3642e346232.js +0 -1
- package/.next/static/chunks/7498-0dc4f9a9ed199d3a.js +0 -1
- package/.next/static/chunks/83.ee1fdbe283ac65b6.js +0 -1
- package/.next/static/chunks/9173-3a00edf7b695a319.js +0 -1
- package/.next/static/chunks/BannerNewsletter.fe0181162c046991.js +0 -1
- package/.next/static/chunks/BannerText.681f118e9f149f6c.js +0 -1
- package/.next/static/chunks/CartSidebar.55cc31a37ffa6ee6.js +0 -1
- package/.next/static/chunks/ProductShelf.b75a7ab8e313ea07.js +0 -1
- package/.next/static/chunks/ProductTiles.35cd23ada22f5a96.js +0 -1
- package/.next/static/chunks/RegionModal.04b02aafc0836d49.js +0 -1
- package/.next/static/chunks/RegionSlider.d063ccee38bdfdb7.js +0 -1
- package/.next/static/chunks/Toast.75a18f47eb23b703.js +0 -1
- package/.next/static/chunks/UIBannerText.f4167ceafb96cf67.js +0 -1
- package/.next/static/chunks/UIToast.a49584c87d3adc17.js +0 -1
- package/.next/static/chunks/pages/[slug]/p-73a253032aaf8ce2.js +0 -1
- package/.next/static/chunks/pages/_app-df4ba03d82beaf86.js +0 -1
- package/.next/static/chunks/webpack-c996443db6f4fa91.js +0 -1
- package/.next/static/css/4bd5e2314f697713.css +0 -1
- /package/.next/static/{xFgIjKNUaH5r_Yo0uIAnc → 6VSKTBCq7vRe86nXQK6nv}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import React, { useCallback, useEffect } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
type IProductComparison,
|
|
4
|
+
type ProductComparisonSidebarProps as UIProductComparisonSidebarProps,
|
|
5
|
+
ProductComparisonSidebar as UIProductComparisonSidebar,
|
|
6
|
+
useProductComparison,
|
|
7
|
+
} from '@faststore/ui'
|
|
8
|
+
|
|
9
|
+
import { gql } from '@generated/gql'
|
|
10
|
+
import type { ClientManyProductsSelectedQueryQuery } from '@generated/graphql'
|
|
11
|
+
|
|
12
|
+
import { useBuyButton } from 'src/sdk/cart/useBuyButton'
|
|
13
|
+
import { useProductsSelected } from 'src/sdk/product/useProductsSelected'
|
|
14
|
+
|
|
15
|
+
const sortOptions = [
|
|
16
|
+
{
|
|
17
|
+
value: 'productByName',
|
|
18
|
+
label: 'Product Name',
|
|
19
|
+
onChange: (productComparison: IProductComparison[]) =>
|
|
20
|
+
productComparison.sort((a, b) => a.name.localeCompare(b.name)),
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
value: 'productByPrice',
|
|
24
|
+
label: 'Price',
|
|
25
|
+
onChange: (productComparison: IProductComparison[]) =>
|
|
26
|
+
productComparison.sort((a, b) => a.offers.lowPrice - b.offers.lowPrice),
|
|
27
|
+
},
|
|
28
|
+
] as const
|
|
29
|
+
|
|
30
|
+
export type SortOptions = (typeof sortOptions)[number]
|
|
31
|
+
|
|
32
|
+
function ProductComparisonSidebar(props: UIProductComparisonSidebarProps) {
|
|
33
|
+
const { productIds, products, isOpen, handleProductsComparison } =
|
|
34
|
+
useProductComparison()
|
|
35
|
+
const [productIdToBuy, setProductIdToBuy] = React.useState<string | null>(
|
|
36
|
+
null
|
|
37
|
+
)
|
|
38
|
+
const [pendingEvent, setPendingEvent] = React.useState<
|
|
39
|
+
React.MouseEvent<HTMLButtonElement>
|
|
40
|
+
>({
|
|
41
|
+
currentTarget: {} as HTMLButtonElement,
|
|
42
|
+
preventDefault: () => {},
|
|
43
|
+
} as React.MouseEvent<HTMLButtonElement>)
|
|
44
|
+
|
|
45
|
+
function processResponse(data: ClientManyProductsSelectedQueryQuery) {
|
|
46
|
+
const formattedData: IProductComparison[] = data.products.map((product) => {
|
|
47
|
+
const skuSpecifications = product.skuSpecifications.map(
|
|
48
|
+
(skuSpecification) => ({
|
|
49
|
+
field: skuSpecification.field.name,
|
|
50
|
+
values: skuSpecification.values.map((value) => value.name),
|
|
51
|
+
})
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
slug: product.slug,
|
|
56
|
+
sku: product.sku,
|
|
57
|
+
name: product.name,
|
|
58
|
+
gtin: product.gtin,
|
|
59
|
+
id: product.id,
|
|
60
|
+
unitMultiplier: product.unitMultiplier,
|
|
61
|
+
brand: { name: product.brand.name, brandName: product.brand.name },
|
|
62
|
+
isVariantOf: {
|
|
63
|
+
productGroupID: product.isVariantOf.productGroupID,
|
|
64
|
+
name: product.isVariantOf.name,
|
|
65
|
+
skuVariants: product.isVariantOf.skuVariants,
|
|
66
|
+
},
|
|
67
|
+
image: product.image,
|
|
68
|
+
offers: {
|
|
69
|
+
lowPrice: product.offers.lowPrice,
|
|
70
|
+
lowPriceWithTaxes: product.offers.lowPriceWithTaxes,
|
|
71
|
+
offers: product.offers.offers.map((offer) => ({
|
|
72
|
+
availability: offer.availability,
|
|
73
|
+
price: offer.price,
|
|
74
|
+
listPrice: offer.listPrice,
|
|
75
|
+
listPriceWithTaxes: offer.listPriceWithTaxes,
|
|
76
|
+
priceWithTaxes: offer.priceWithTaxes,
|
|
77
|
+
quantity: offer.quantity,
|
|
78
|
+
seller: { identifier: offer.seller.identifier },
|
|
79
|
+
})),
|
|
80
|
+
},
|
|
81
|
+
additionalProperty: product.additionalProperty.map((property) => ({
|
|
82
|
+
propertyID: property.propertyID,
|
|
83
|
+
name: property.name,
|
|
84
|
+
value: property.value,
|
|
85
|
+
valueReference: property.valueReference,
|
|
86
|
+
})),
|
|
87
|
+
advertisement: product.advertisement,
|
|
88
|
+
hasSpecifications: product.hasSpecifications,
|
|
89
|
+
skuSpecifications,
|
|
90
|
+
}
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
handleProductsComparison(formattedData)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const buyButtonProps = React.useMemo(() => {
|
|
97
|
+
return products
|
|
98
|
+
.map((product: IProductComparison) => {
|
|
99
|
+
const {
|
|
100
|
+
id,
|
|
101
|
+
sku,
|
|
102
|
+
gtin,
|
|
103
|
+
unitMultiplier,
|
|
104
|
+
name: variantName,
|
|
105
|
+
brand,
|
|
106
|
+
isVariantOf,
|
|
107
|
+
image: productImages,
|
|
108
|
+
additionalProperty,
|
|
109
|
+
offers: {
|
|
110
|
+
offers: [
|
|
111
|
+
{
|
|
112
|
+
price,
|
|
113
|
+
priceWithTaxes,
|
|
114
|
+
listPrice,
|
|
115
|
+
seller,
|
|
116
|
+
quantity,
|
|
117
|
+
listPriceWithTaxes,
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
} = product
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
id,
|
|
125
|
+
price,
|
|
126
|
+
priceWithTaxes,
|
|
127
|
+
listPrice,
|
|
128
|
+
listPriceWithTaxes,
|
|
129
|
+
seller,
|
|
130
|
+
quantity: productIdToBuy === id ? 1 : 0,
|
|
131
|
+
itemOffered: {
|
|
132
|
+
sku,
|
|
133
|
+
name: variantName,
|
|
134
|
+
gtin,
|
|
135
|
+
image: productImages,
|
|
136
|
+
brand,
|
|
137
|
+
isVariantOf,
|
|
138
|
+
additionalProperty,
|
|
139
|
+
unitMultiplier,
|
|
140
|
+
},
|
|
141
|
+
}
|
|
142
|
+
})
|
|
143
|
+
.filter((product) => product.quantity > 0)
|
|
144
|
+
}, [products, productIdToBuy])
|
|
145
|
+
|
|
146
|
+
const buyProps = useBuyButton(buyButtonProps)
|
|
147
|
+
|
|
148
|
+
React.useEffect(() => {
|
|
149
|
+
if (!productIdToBuy) {
|
|
150
|
+
return
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
buyProps.onClick(pendingEvent as React.MouseEvent<HTMLButtonElement>)
|
|
154
|
+
}, [productIdToBuy, pendingEvent])
|
|
155
|
+
|
|
156
|
+
useProductsSelected(productIds, isOpen, processResponse)
|
|
157
|
+
|
|
158
|
+
return (
|
|
159
|
+
<UIProductComparisonSidebar
|
|
160
|
+
handleProductToBuy={setProductIdToBuy}
|
|
161
|
+
setPendingEvent={setPendingEvent}
|
|
162
|
+
sortOptions={[...sortOptions]}
|
|
163
|
+
{...props}
|
|
164
|
+
/>
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export default ProductComparisonSidebar
|
|
169
|
+
|
|
170
|
+
export const fragment = gql(`
|
|
171
|
+
fragment ProductComparisonFragment_product on StoreProduct {
|
|
172
|
+
id: productID
|
|
173
|
+
sku
|
|
174
|
+
slug
|
|
175
|
+
name
|
|
176
|
+
gtin
|
|
177
|
+
description
|
|
178
|
+
unitMultiplier
|
|
179
|
+
isVariantOf {
|
|
180
|
+
name
|
|
181
|
+
productGroupID
|
|
182
|
+
skuVariants {
|
|
183
|
+
activeVariations
|
|
184
|
+
slugsMap
|
|
185
|
+
availableVariations
|
|
186
|
+
allVariantProducts {
|
|
187
|
+
name
|
|
188
|
+
productID
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
image {
|
|
194
|
+
url
|
|
195
|
+
alternateName
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
brand {
|
|
199
|
+
name
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
offers {
|
|
203
|
+
lowPrice
|
|
204
|
+
lowPriceWithTaxes
|
|
205
|
+
offers {
|
|
206
|
+
availability
|
|
207
|
+
price
|
|
208
|
+
priceWithTaxes
|
|
209
|
+
listPrice
|
|
210
|
+
quantity
|
|
211
|
+
listPriceWithTaxes
|
|
212
|
+
seller {
|
|
213
|
+
identifier
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
additionalProperty {
|
|
219
|
+
propertyID
|
|
220
|
+
name
|
|
221
|
+
value
|
|
222
|
+
valueReference
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
advertisement {
|
|
226
|
+
adId
|
|
227
|
+
adResponseId
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
hasSpecifications
|
|
231
|
+
|
|
232
|
+
skuSpecifications {
|
|
233
|
+
field {
|
|
234
|
+
id
|
|
235
|
+
name
|
|
236
|
+
originalName
|
|
237
|
+
}
|
|
238
|
+
values {
|
|
239
|
+
name
|
|
240
|
+
id
|
|
241
|
+
fieldId
|
|
242
|
+
originalName
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
specificationGroups {
|
|
247
|
+
name
|
|
248
|
+
originalName
|
|
249
|
+
specifications {
|
|
250
|
+
name
|
|
251
|
+
originalName
|
|
252
|
+
values
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
`)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ProductComparisonSidebar'
|