@mframework/layer-commerce 0.0.5 → 0.0.8

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.
Files changed (209) hide show
  1. package/app/components/catalog/product/ProductAccordion/ProductAccordion.vue +41 -0
  2. package/app/components/catalog/product/ProductAccordion/__tests__/ProductAccordion.spec.ts +15 -0
  3. package/app/components/catalog/product/ProductAccordion/types.ts +5 -0
  4. package/app/components/catalog/product/ProductProperties/ProductProperties.vue +52 -0
  5. package/app/components/catalog/product/ProductProperties/__tests__/ProductProperties.spec.ts +15 -0
  6. package/app/components/catalog/product/ProductProperties/types.ts +5 -0
  7. package/app/components/catalog/product/ProductSlider/ProductSlider.vue +28 -0
  8. package/app/components/catalog/product/ProductSlider/__tests__/ProductSlider.spec.ts +14 -0
  9. package/app/components/catalog/product/ProductSlider/types.ts +7 -0
  10. package/app/components/catalog/product/RecommendedProducts/RecommendedProducts.vue +12 -0
  11. package/app/components/catalog/product/RecommendedProducts/types.ts +5 -0
  12. package/app/components/catalog/product/RenderContentProductSlider/RenderContentProductSlider.vue +11 -0
  13. package/app/components/catalog/product/add-attribute.vue +54 -0
  14. package/app/components/catalog/product/add-product-type.vue +54 -0
  15. package/app/components/catalog/product/add-product.vue +53 -0
  16. package/app/components/catalog/product/add-showcase.vue +52 -0
  17. package/app/components/catalog/product/add-station.vue +54 -0
  18. package/app/components/catalog/product/bestsellers.vue +69 -0
  19. package/app/components/catalog/product/bidding.vue +93 -0
  20. package/app/components/catalog/product/colorOptions.vue +58 -0
  21. package/app/components/catalog/product/deals.vue +61 -0
  22. package/app/components/catalog/product/exclusives.vue +58 -0
  23. package/app/components/catalog/product/featuredproducts.vue +69 -0
  24. package/app/components/catalog/product/giftCard.vue +63 -0
  25. package/app/components/catalog/product/latestproducts.vue +58 -0
  26. package/app/components/catalog/product/productCard.vue +71 -0
  27. package/app/components/catalog/product/productCompare.vue +60 -0
  28. package/app/components/catalog/product/productCompareTable.vue +441 -0
  29. package/app/components/catalog/product/productDetails.vue +120 -0
  30. package/app/components/catalog/product/productFaqs.vue +17 -0
  31. package/app/components/catalog/product/productGallery.vue +16 -0
  32. package/app/components/catalog/product/productQty.vue +54 -0
  33. package/app/components/catalog/product/productReviews.vue +56 -0
  34. package/app/components/catalog/product/productSpecs.vue +116 -0
  35. package/app/components/catalog/product/radiostation.vue +36 -0
  36. package/app/components/catalog/product/recentlyviewed.vue +43 -0
  37. package/app/components/catalog/product/relatedbrands.vue +54 -0
  38. package/app/components/catalog/product/relatedproducts.vue +58 -0
  39. package/app/components/catalog/product/relatedstations.vue +40 -0
  40. package/app/components/catalog/product/shippingOptions.vue +41 -0
  41. package/app/components/catalog/product/sizeOptions.vue +47 -0
  42. package/app/components/catalog/product/update-attribute-set.vue +209 -0
  43. package/app/components/catalog/product/update-attribute.vue +118 -0
  44. package/app/components/catalog/product/update-product.vue +372 -0
  45. package/app/components/catalog/product/update-showcase.vue +153 -0
  46. package/app/components/catalog/shops/relatedstores.vue +52 -0
  47. package/app/components/catalog/shops/restaurant.vue +66 -0
  48. package/app/components/catalog/shops/stores.vue +44 -0
  49. package/app/components/catalog/vendor/README.md +3 -0
  50. package/app/components/catalog/vendor/blocks/biggestcustomers.vue +33 -0
  51. package/app/components/catalog/vendor/blocks/lowestselling.vue +33 -0
  52. package/app/components/catalog/vendor/blocks/topcategories.vue +33 -0
  53. package/app/components/catalog/vendor/blocks/topproducts.vue +27 -0
  54. package/app/components/catalog/vendor/pages/attributes.vue +43 -0
  55. package/app/components/catalog/vendor/pages/commissions.vue +43 -0
  56. package/app/components/catalog/vendor/pages/crm.vue +67 -0
  57. package/app/components/catalog/vendor/pages/dashboard.vue +46 -0
  58. package/app/components/catalog/vendor/pages/emails.vue +43 -0
  59. package/app/components/catalog/vendor/pages/enquiries.vue +43 -0
  60. package/app/components/catalog/vendor/pages/invoices.vue +43 -0
  61. package/app/components/catalog/vendor/pages/orders.vue +68 -0
  62. package/app/components/catalog/vendor/pages/products.vue +55 -0
  63. package/app/components/catalog/vendor/pages/reviews.vue +48 -0
  64. package/app/components/catalog/vendor/pages/shipments.vue +43 -0
  65. package/app/components/catalog/vendor/pages/stores.vue +43 -0
  66. package/app/components/content/blocks/breadcrumbs.vue +0 -0
  67. package/app/components/content/blocks/currencySwitcher.vue +0 -0
  68. package/app/components/content/blocks/languageSwitcher.vue +0 -0
  69. package/app/components/content/blocks/videoproduct.vue +9 -0
  70. package/app/components/content/pages/checkout.vue +118 -0
  71. package/app/components/content/pages/meeoviGlobal.vue +68 -0
  72. package/app/components/content/pages/pickup-locations.vue +238 -0
  73. package/app/components/content/pages/showcases.vue +90 -0
  74. package/app/components/content/pages/success.vue +60 -0
  75. package/app/components/marketing/add-brand.vue +54 -0
  76. package/app/components/marketing/add-incentive.vue +54 -0
  77. package/app/components/marketing/promotions/giftcards.vue +127 -0
  78. package/app/components/marketing/promotions/subscriptions.vue +134 -0
  79. package/app/components/marketing/update-incentive.vue +326 -0
  80. package/app/components/menus/lowernav.vue +78 -0
  81. package/app/components/partials/LocaleSelector.vue +24 -0
  82. package/app/components/partials/ShoppingCart.vue +128 -0
  83. package/app/components/partials/StripePayment.vue +149 -0
  84. package/app/components/partials/addToCartBtn.vue +40 -0
  85. package/app/components/partials/cartItem.vue +124 -0
  86. package/app/components/partials/checkoutButton.vue +44 -0
  87. package/app/components/partials/compareBtn.vue +68 -0
  88. package/app/components/partials/ratings.vue +13 -0
  89. package/app/components/partials/store/CurrencySelector.vue +133 -0
  90. package/app/components/partials/store/StoreSwitcher.vue +13 -0
  91. package/app/components/related/brandCard.vue +41 -0
  92. package/app/components/related/incentiveCard.vue +44 -0
  93. package/app/components/related/invoiceCard.vue +43 -0
  94. package/app/components/related/orderCard.vue +43 -0
  95. package/app/components/related/relatedproducts.vue +17 -0
  96. package/app/components/sales/CartPageContent/CartPageContent.vue +43 -0
  97. package/app/components/sales/CheckoutAddress/CheckoutAddress.vue +50 -0
  98. package/app/components/sales/CheckoutAddress/__tests__/CheckoutAddress.spec.ts +16 -0
  99. package/app/components/sales/CheckoutAddress/types.ts +16 -0
  100. package/app/components/sales/CheckoutPayment/CheckoutPayment.vue +65 -0
  101. package/app/components/sales/CheckoutPayment/__tests__/CheckoutPayment.spec.ts +14 -0
  102. package/app/components/sales/CheckoutPayment/types.ts +12 -0
  103. package/app/components/sales/OrderSummary/OrderSummary.vue +57 -0
  104. package/app/components/sales/OrderSummary/__tests__/ContactInformation.spec.ts +52 -0
  105. package/app/components/sales/OrderSummary/types.ts +5 -0
  106. package/app/components/sales/incentives.vue +247 -0
  107. package/app/components/sales/invoices.vue +107 -0
  108. package/app/components/sales/orders.vue +378 -0
  109. package/app/components/sales/shipments.vue +65 -0
  110. package/app/components/sales/transactions.vue +109 -0
  111. package/app/components/shop/add-shop.vue +54 -0
  112. package/app/components/shop/cart/cartItem.vue +182 -0
  113. package/app/components/shop/cart/checkout.vue +415 -0
  114. package/app/components/shop/checkout/StripeCardElement.vue +206 -0
  115. package/app/components/shop/checkout/StripeCheckout.vue +49 -0
  116. package/app/components/shop/checkout/addressBilling.vue +263 -0
  117. package/app/components/shop/checkout/addressShipping.vue +175 -0
  118. package/app/components/shop/checkout/cart/ProductItem.vue +56 -0
  119. package/app/components/shop/checkout/cart/PromotionItem.vue +53 -0
  120. package/app/composables/useCustomer/__tests__/useCustomer.spec.ts +1 -1
  121. package/app/composables/useProductReviews/__tests__/useProductReviews.spec.ts +1 -1
  122. package/app/stores/cart.ts +1 -1
  123. package/app/types/Direction.type.ts +1 -1
  124. package/app/types/Global.type.ts +6 -6
  125. package/app/types/Layout.type.ts +1 -1
  126. package/app/types/index.ts +1 -1
  127. package/app/{normalizers → types/normalizers}/Cart.query.ts +1 -1
  128. package/app/{normalizers → types/normalizers}/Cart.type.ts +2 -2
  129. package/app/{normalizers → types/normalizers}/Checkout.query.ts +2 -2
  130. package/app/{normalizers → types/normalizers}/Config.query.ts +1 -1
  131. package/app/{normalizers → types/normalizers}/Config.type.ts +1 -1
  132. package/app/{normalizers → types/normalizers}/ContactForm.query.ts +2 -2
  133. package/app/{normalizers → types/normalizers}/CreditMemo.type.ts +1 -1
  134. package/app/{normalizers → types/normalizers}/GiftCard.type.ts +1 -1
  135. package/app/{normalizers → types/normalizers}/Invoice.type.ts +1 -1
  136. package/app/{normalizers → types/normalizers}/MyAccount.query.ts +1 -1
  137. package/app/{normalizers → types/normalizers}/MyAccount.type.ts +1 -1
  138. package/app/{normalizers → types/normalizers}/NewsletterSubscription.query.ts +1 -1
  139. package/app/{normalizers → types/normalizers}/Order.query.ts +1 -1
  140. package/app/{normalizers → types/normalizers}/Order.type.ts +2 -2
  141. package/app/{normalizers → types/normalizers}/Payment.type.ts +1 -1
  142. package/app/{normalizers → types/normalizers}/ProductCompare.query.ts +1 -1
  143. package/app/{normalizers → types/normalizers}/ProductCompare.type.ts +1 -1
  144. package/app/{normalizers → types/normalizers}/ProductList.query.ts +2 -2
  145. package/app/{normalizers → types/normalizers}/ProductList.type.ts +2 -2
  146. package/app/{normalizers → types/normalizers}/Return.type.ts +1 -1
  147. package/app/{normalizers → types/normalizers}/Review.query.ts +1 -1
  148. package/app/{normalizers → types/normalizers}/Review.type.ts +1 -1
  149. package/app/{normalizers → types/normalizers}/StoreInPickUp.query.ts +1 -1
  150. package/app/{normalizers → types/normalizers}/Subscription.type.ts +1 -1
  151. package/app/{normalizers → types/normalizers}/Transaction.type.ts +1 -1
  152. package/app/{normalizers → types/normalizers}/UrlRewrites.query.ts +1 -1
  153. package/app/{normalizers → types/normalizers}/UrlRewrites.type.ts +1 -1
  154. package/app/{normalizers → types/normalizers}/Wishlist.query.ts +4 -4
  155. package/app/{normalizers → types/normalizers}/Wishlist.type.ts +1 -1
  156. package/app/utils/Address/Address.type.ts +1 -1
  157. package/app/utils/Address/index.ts +5 -5
  158. package/app/utils/Cart/Cart.ts +1 -1
  159. package/app/utils/Currency/Currency.ts +1 -1
  160. package/app/utils/History/History.type.ts +1 -1
  161. package/app/utils/Menu/Menu.ts +1 -1
  162. package/app/utils/Menu/Menu.type.ts +2 -2
  163. package/app/utils/Orders/Orders.ts +1 -1
  164. package/app/utils/Preload/CategoryPreload.ts +2 -2
  165. package/app/utils/Preload/ProductPreload.ts +1 -1
  166. package/app/utils/Preload/index.ts +1 -1
  167. package/app/utils/Price/Price.ts +1 -1
  168. package/app/utils/Product/Extract.ts +1 -1
  169. package/app/utils/Product/Product.ts +1 -1
  170. package/app/utils/Product/Product.type.ts +1 -1
  171. package/app/utils/Product/Transform.ts +1 -1
  172. package/app/utils/Wishlist/Wishlist.ts +1 -1
  173. package/app/utils/client.ts +20 -20
  174. package/package.json +1 -3
  175. package/tsconfig.json +2 -2
  176. package/app/cart/useCart.ts +0 -1
  177. /package/app/{components → composables}/ChevronIcon/ChevronIcon.config.ts +0 -0
  178. /package/app/{components → composables}/DateSelect/DateSelect.config.ts +0 -0
  179. /package/app/{components → composables}/Field/Field.config.ts +0 -0
  180. /package/app/{components → composables}/FieldDate/FieldDate.config.ts +0 -0
  181. /package/app/{components → composables}/Form/Form.type.ts +0 -0
  182. /package/app/{components → composables}/Product/Product.config.ts +0 -0
  183. /package/app/{components → composables}/Product/Stock.config.ts +0 -0
  184. /package/app/{components → composables}/ProductCustomizableOption/ProductCustomizableOption.config.ts +0 -0
  185. /package/app/{components → composables}/ProductGallery/ProductGallery.config.ts +0 -0
  186. /package/app/{components → composables}/ProductReviews/ProductReviews.config.ts +0 -0
  187. /package/app/{normalizers → types/normalizers}/Category.query.ts +0 -0
  188. /package/app/{normalizers → types/normalizers}/Category.type.ts +0 -0
  189. /package/app/{normalizers → types/normalizers}/CheckEmail.query.ts +0 -0
  190. /package/app/{normalizers → types/normalizers}/Checkout.type.ts +0 -0
  191. /package/app/{normalizers → types/normalizers}/CmsBlock.query.ts +0 -0
  192. /package/app/{normalizers → types/normalizers}/CmsBlock.type.ts +0 -0
  193. /package/app/{normalizers → types/normalizers}/CmsPage.query.ts +0 -0
  194. /package/app/{normalizers → types/normalizers}/CmsPage.type.ts +0 -0
  195. /package/app/{normalizers → types/normalizers}/Menu.query.ts +0 -0
  196. /package/app/{normalizers → types/normalizers}/Menu.type.ts +0 -0
  197. /package/app/{normalizers → types/normalizers}/ProductAlerts.query.ts +0 -0
  198. /package/app/{normalizers → types/normalizers}/Region.query.ts +0 -0
  199. /package/app/{normalizers → types/normalizers}/Region.type.ts +0 -0
  200. /package/app/{normalizers → types/normalizers}/Slider.query.ts +0 -0
  201. /package/app/{normalizers → types/normalizers}/Slider.type.ts +0 -0
  202. /package/app/{normalizers → types/normalizers}/StoreInPickUp.type.ts +0 -0
  203. /package/app/{routes → types/routes}/CategoryPage/CategoryPage.config.ts +0 -0
  204. /package/app/{routes → types/routes}/CategoryPage/CategoryPage.type.ts +0 -0
  205. /package/app/{routes → types/routes}/Checkout/Checkout.config.ts +0 -0
  206. /package/app/{routes → types/routes}/Checkout/Checkout.type.ts +0 -0
  207. /package/app/{routes → types/routes}/MyAccount/MyAccount.config.ts +0 -0
  208. /package/app/{routes → types/routes}/SearchPage/SearchPage.config.ts +0 -0
  209. /package/app/{routes → types/routes}/UrlRewrites/UrlRewrites.config.ts +0 -0
@@ -0,0 +1,441 @@
1
+ <template>
2
+ <div class="product-compare-table">
3
+ <div class="sticky-header">
4
+ <div class="compare-header">
5
+ <div class="product-column">
6
+ <h3>Product Details</h3>
7
+ </div>
8
+ <div v-for="product in products" :key="product.uid" class="product-column">
9
+ <div class="product-card">
10
+ <div class="remove-product" @click="removeProduct(product.uid)">
11
+ <SfIconClose size="sm" />
12
+ </div>
13
+ <img :src="product.image?.url" :alt="product.name" class="product-image" />
14
+ <h4>{{ product.name }}</h4>
15
+ <div class="product-price">
16
+ <div class="current-price">
17
+ {{ product.price_range?.minimum_price?.regular_price?.currency }}
18
+ {{ product.price_range?.minimum_price?.regular_price?.value }}
19
+ </div>
20
+ <div v-if="product.price_history" class="price-history">
21
+ <div class="price-change" :class="getPriceChangeClass(product.price_history)">
22
+ {{ getPriceChangeText(product.price_history) }}
23
+ </div>
24
+ </div>
25
+ </div>
26
+ <div class="product-actions">
27
+ <addToCartBtn :productId="product.uid" />
28
+ </div>
29
+ </div>
30
+ </div>
31
+ </div>
32
+ </div>
33
+
34
+ <div class="compare-body">
35
+ <!-- Basic Information -->
36
+ <div class="compare-row">
37
+ <div class="attribute-column">
38
+ <h4>Basic Information</h4>
39
+ </div>
40
+ <div v-for="product in products" :key="product.uid" class="product-column">
41
+ <div class="attribute-value">
42
+ <p>SKU: {{ product.sku }}</p>
43
+ <p>Category: {{ product.categories?.name }}</p>
44
+ <div class="rating-container">
45
+ <Ratings :value="product.rating_summary" :length="5" size="sm" :half-increment="true" />
46
+ <span class="review-count">({{ product.review_count }} reviews)</span>
47
+ </div>
48
+ </div>
49
+ </div>
50
+ </div>
51
+
52
+ <!-- Price History -->
53
+ <div class="compare-row" v-if="hasPriceHistory">
54
+ <div class="attribute-column">
55
+ <h4>Price History</h4>
56
+ </div>
57
+ <div v-for="product in products" :key="product.uid" class="product-column">
58
+ <div class="attribute-value">
59
+ <div v-if="product.price_history" class="price-history-chart">
60
+ <div class="price-points">
61
+ <div v-for="(price, date) in product.price_history" :key="date" class="price-point">
62
+ <div class="price-value">{{ price }}</div>
63
+ <div class="price-date">{{ formatDate(date) }}</div>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ <div v-else>No price history available</div>
68
+ </div>
69
+ </div>
70
+ </div>
71
+
72
+ <!-- Reviews Summary -->
73
+ <div class="compare-row" v-if="hasReviews">
74
+ <div class="attribute-column">
75
+ <h4>Reviews Summary</h4>
76
+ </div>
77
+ <div v-for="product in products" :key="product.uid" class="product-column">
78
+ <div class="attribute-value">
79
+ <div v-if="product.reviews_summary" class="reviews-summary">
80
+ <div v-for="(count, rating) in product.reviews_summary" :key="rating" class="rating-bar">
81
+ <div class="rating-label">{{ rating }} stars</div>
82
+ <div class="rating-bar-container">
83
+ <div class="rating-bar-fill" :style="{ width: `${(count / product.review_count) * 100}%` }"></div>
84
+ </div>
85
+ <div class="rating-count">{{ count }}</div>
86
+ </div>
87
+ </div>
88
+ <div v-else>No reviews available</div>
89
+ </div>
90
+ </div>
91
+ </div>
92
+
93
+ <!-- Specifications -->
94
+ <div class="compare-row" v-if="hasSpecifications">
95
+ <div class="attribute-column">
96
+ <h4>Specifications</h4>
97
+ </div>
98
+ <div v-for="product in products" :key="product.uid" class="product-column">
99
+ <div class="attribute-value">
100
+ <div v-for="(value, key) in product.custom_attributes" :key="key">
101
+ <p><strong>{{ key }}:</strong> {{ value }}</p>
102
+ </div>
103
+ </div>
104
+ </div>
105
+ </div>
106
+
107
+ <!-- Features -->
108
+ <div class="compare-row" v-if="hasFeatures">
109
+ <div class="attribute-column">
110
+ <h4>Features</h4>
111
+ </div>
112
+ <div v-for="product in products" :key="product.uid" class="product-column">
113
+ <div class="attribute-value">
114
+ <ul>
115
+ <li v-for="feature in product.features" :key="feature">{{ feature }}</li>
116
+ </ul>
117
+ </div>
118
+ </div>
119
+ </div>
120
+ </div>
121
+ </div>
122
+ </template>
123
+
124
+ <script setup>
125
+ import { computed } from 'vue';
126
+ import { SfIconClose } from '@storefront-ui/vue';
127
+ import addToCartBtn from '~/components/partials/commerce/addToCartBtn.vue';
128
+ import Ratings from '~/components/partials/commerce/ratings.vue';
129
+
130
+ const props = defineProps({
131
+ products: {
132
+ type: Array,
133
+ required: true,
134
+ default: () => []
135
+ }
136
+ });
137
+
138
+ const emit = defineEmits(['remove-product']);
139
+
140
+ // Computed properties to check if products have certain attributes
141
+ const hasSpecifications = computed(() => {
142
+ return props.products.some(product => product.custom_attributes && Object.keys(product.custom_attributes).length > 0);
143
+ });
144
+
145
+ const hasFeatures = computed(() => {
146
+ return props.products.some(product => product.features && product.features.length > 0);
147
+ });
148
+
149
+ const hasPriceHistory = computed(() => {
150
+ return props.products.some(product => product.price_history && Object.keys(product.price_history).length > 0);
151
+ });
152
+
153
+ const hasReviews = computed(() => {
154
+ return props.products.some(product => product.reviews_summary && Object.keys(product.reviews_summary).length > 0);
155
+ });
156
+
157
+ const removeProduct = (productId) => {
158
+ emit('remove-product', productId);
159
+ };
160
+
161
+ const getPriceChangeClass = (priceHistory) => {
162
+ const prices = Object.values(priceHistory);
163
+ const currentPrice = prices[0];
164
+ const previousPrice = prices[1];
165
+ if (!previousPrice) return '';
166
+ return currentPrice > previousPrice ? 'price-increase' : 'price-decrease';
167
+ };
168
+
169
+ const getPriceChangeText = (priceHistory) => {
170
+ const prices = Object.values(priceHistory);
171
+ const currentPrice = prices[0];
172
+ const previousPrice = prices[1];
173
+ if (!previousPrice) return '';
174
+ const change = ((currentPrice - previousPrice) / previousPrice) * 100;
175
+ return `${change > 0 ? '+' : ''}${change.toFixed(1)}%`;
176
+ };
177
+
178
+ const formatDate = (dateString) => {
179
+ return new Date(dateString).toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
180
+ };
181
+ </script>
182
+
183
+ <style scoped>
184
+ .product-compare-table {
185
+ width: 100%;
186
+ overflow-x: auto;
187
+ margin: 2rem 0;
188
+ -webkit-overflow-scrolling: touch;
189
+ }
190
+
191
+ .sticky-header {
192
+ position: sticky;
193
+ top: 0;
194
+ background: white;
195
+ z-index: 10;
196
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
197
+ }
198
+
199
+ .compare-header {
200
+ display: flex;
201
+ min-width: 800px;
202
+ }
203
+
204
+ .compare-body {
205
+ min-width: 800px;
206
+ }
207
+
208
+ .product-column {
209
+ flex: 1;
210
+ min-width: 250px;
211
+ padding: 1rem;
212
+ border-right: 1px solid #e5e7eb;
213
+ position: relative;
214
+ }
215
+
216
+ .attribute-column {
217
+ flex: 0 0 200px;
218
+ padding: 1rem;
219
+ background: #f9fafb;
220
+ border-right: 1px solid #e5e7eb;
221
+ }
222
+
223
+ .compare-row {
224
+ display: flex;
225
+ border-bottom: 1px solid #e5e7eb;
226
+ }
227
+
228
+ .product-card {
229
+ text-align: center;
230
+ position: relative;
231
+ }
232
+
233
+ .remove-product {
234
+ position: absolute;
235
+ top: 0.5rem;
236
+ right: 0.5rem;
237
+ cursor: pointer;
238
+ color: #6b7280;
239
+ transition: color 0.2s;
240
+ }
241
+
242
+ .remove-product:hover {
243
+ color: #ef4444;
244
+ }
245
+
246
+ .product-image {
247
+ width: 150px;
248
+ height: 150px;
249
+ object-fit: contain;
250
+ margin-bottom: 1rem;
251
+ }
252
+
253
+ .attribute-value {
254
+ padding: 0.5rem;
255
+ }
256
+
257
+ .attribute-value ul {
258
+ list-style: none;
259
+ padding: 0;
260
+ margin: 0;
261
+ }
262
+
263
+ .attribute-value li {
264
+ margin-bottom: 0.5rem;
265
+ }
266
+
267
+ .product-actions {
268
+ margin-top: 1rem;
269
+ }
270
+
271
+ h3, h4 {
272
+ margin: 0 0 1rem 0;
273
+ color: #1f2937;
274
+ }
275
+
276
+ p {
277
+ margin: 0.5rem 0;
278
+ color: #4b5563;
279
+ }
280
+
281
+ .price-history {
282
+ margin-top: 0.5rem;
283
+ font-size: 0.875rem;
284
+ }
285
+
286
+ .price-increase {
287
+ color: #ef4444;
288
+ }
289
+
290
+ .price-decrease {
291
+ color: #10b981;
292
+ }
293
+
294
+ .rating-container {
295
+ display: flex;
296
+ align-items: center;
297
+ gap: 0.5rem;
298
+ margin-top: 0.5rem;
299
+ }
300
+
301
+ .review-count {
302
+ font-size: 0.875rem;
303
+ color: #6b7280;
304
+ }
305
+
306
+ .price-history-chart {
307
+ margin-top: 0.5rem;
308
+ }
309
+
310
+ .price-points {
311
+ display: flex;
312
+ justify-content: space-between;
313
+ gap: 0.5rem;
314
+ }
315
+
316
+ .price-point {
317
+ text-align: center;
318
+ font-size: 0.75rem;
319
+ }
320
+
321
+ .price-value {
322
+ font-weight: 500;
323
+ }
324
+
325
+ .price-date {
326
+ color: #6b7280;
327
+ }
328
+
329
+ .reviews-summary {
330
+ margin-top: 0.5rem;
331
+ }
332
+
333
+ .rating-bar {
334
+ display: flex;
335
+ align-items: center;
336
+ gap: 0.5rem;
337
+ margin-bottom: 0.25rem;
338
+ }
339
+
340
+ .rating-label {
341
+ width: 70px;
342
+ font-size: 0.875rem;
343
+ }
344
+
345
+ .rating-bar-container {
346
+ flex: 1;
347
+ height: 8px;
348
+ background: #e5e7eb;
349
+ border-radius: 4px;
350
+ overflow: hidden;
351
+ }
352
+
353
+ .rating-bar-fill {
354
+ height: 100%;
355
+ background: #f59e0b;
356
+ border-radius: 4px;
357
+ }
358
+
359
+ .rating-count {
360
+ width: 30px;
361
+ text-align: right;
362
+ font-size: 0.875rem;
363
+ }
364
+
365
+ @media (max-width: 768px) {
366
+ .product-column {
367
+ min-width: 200px;
368
+ }
369
+
370
+ .attribute-column {
371
+ flex: 0 0 150px;
372
+ }
373
+
374
+ .product-image {
375
+ width: 120px;
376
+ height: 120px;
377
+ }
378
+
379
+ .price-points {
380
+ flex-direction: column;
381
+ gap: 0.25rem;
382
+ }
383
+
384
+ .rating-bar {
385
+ flex-direction: column;
386
+ align-items: flex-start;
387
+ }
388
+
389
+ .rating-label {
390
+ width: auto;
391
+ }
392
+
393
+ .rating-bar-container {
394
+ width: 100%;
395
+ }
396
+ }
397
+ .rating-bar-fill {
398
+ height: 100%;
399
+ background: #f59e0b;
400
+ border-radius: 4px;
401
+ }
402
+
403
+ .rating-count {
404
+ width: 30px;
405
+ text-align: right;
406
+ font-size: 0.875rem;
407
+ }
408
+
409
+ @media (max-width: 768px) {
410
+ .product-column {
411
+ min-width: 200px;
412
+ }
413
+
414
+ .attribute-column {
415
+ flex: 0 0 150px;
416
+ }
417
+
418
+ .product-image {
419
+ width: 120px;
420
+ height: 120px;
421
+ }
422
+
423
+ .price-points {
424
+ flex-direction: column;
425
+ gap: 0.25rem;
426
+ }
427
+
428
+ .rating-bar {
429
+ flex-direction: column;
430
+ align-items: flex-start;
431
+ }
432
+
433
+ .rating-label {
434
+ width: auto;
435
+ }
436
+
437
+ .rating-bar-container {
438
+ width: 100%;
439
+ }
440
+ }
441
+ </style>
@@ -0,0 +1,120 @@
1
+ <template>
2
+ <section class="product-details">
3
+ <div class="container-fluid">
4
+ <div class="row">
5
+ <div class="col-12 col-md-6">
6
+ <div v-if="product?.image?.filename_disk">
7
+ <img :src="`${$directus.url}assets/${product.image.filename_disk}`" :alt="product.name"
8
+ class="w-full rounded-md" />
9
+ </div>
10
+ </div>
11
+ <div class="col-12 col-md-6">
12
+ <div class="right">
13
+ <h1 class="mb-1 font-bold typography-headline-4"><strong>{{ product?.name }}</strong></h1>
14
+ <div class="price-line">
15
+ <span class="block pb-2 font-bold typography-text-lg">
16
+ {{ product?.price }}
17
+ </span>
18
+ </div>
19
+ <p class="productRatings">
20
+ <v-rating size="lg" :half-increment="true" :value="product?.ratings?.length || 0"
21
+ :max="5" />
22
+ <NuxtLink to="#" variant="secondary" class="ratingReviews ml-2 text-xs text-neutral-500">
23
+ {{ product?.comments?.comments_id?.length || 0 }} reviews
24
+ </NuxtLink>
25
+ </p>
26
+ <div class="py-4 mb-4 border-gray-200 border-y">
27
+ <div class="row items-start xs:flex">
28
+ <div class="col col-6 flex flex-col items-stretch xs:items-center xs:inline-flex">
29
+ <div class="flex border border-neutral-300 rounded-md">
30
+ <v-btn variant="flat" :disabled="count <= min" square class="rounded-r-none p-3"
31
+ :aria-controls="inputId" aria-label="Decrease value" @click="dec()">
32
+ <SfIconRemove />
33
+ </v-btn>
34
+ <input :id="inputId" v-model="count" type="number"
35
+ class="grow appearance-none mx-2 w-8 text-center bg-transparent font-medium"
36
+ :min="min" :max="max" @input="handleOnChange" />
37
+ <v-btn variant="flat" :disabled="count >= max" square class="rounded-l-none p-3"
38
+ :aria-controls="inputId" aria-label="Increase value" @click="inc()">
39
+ <SfIconAdd />
40
+ </v-btn>
41
+ </div>
42
+ <p class="self-center mt-1 mb-4 text-xs text-neutral-500 xs:mb-0">
43
+ <strong class="text-neutral-900">{{ product?.stock }}</strong> in stock
44
+ </p>
45
+ </div>
46
+ <div class="col col-6">
47
+ <addToCartBtn :product="product?.id" :quantity="count" />
48
+ </div>
49
+ </div>
50
+ </div>
51
+ <div class="mbr-section-btn row align-items-stretch justify-content-center">
52
+ <div class="col col-6">
53
+ <createListBtn :lists="product?.id" />
54
+ </div>
55
+ </div>
56
+ <div class="price-line1" v-for="tag in product?.tags" :key="tag.id">
57
+ <p class="desc mbr-fonts-style display-7"><strong>Tags:</strong> <tagCard :tag="tag?.tag_id" />&nbsp;</p>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ </div>
62
+ </div>
63
+ </section>
64
+ </template>
65
+
66
+ <script setup lang="ts">
67
+ import {
68
+ ref
69
+ } from 'vue';
70
+ import {
71
+ SfIconAdd,
72
+ SfIconRemove,
73
+ } from '@storefront-ui/vue';
74
+ import {
75
+ clamp
76
+ } from '@storefront-ui/shared';
77
+ import {
78
+ useCounter
79
+ } from '@vueuse/core';
80
+ import tagCard from '#social/app/components/related/tag.vue';
81
+ import addToCartBtn from '../../partials/addToCartBtn.vue';
82
+ import createListBtn from '#lists/app/components/partials/createListBtn.vue';
83
+
84
+ const {
85
+ $directus,
86
+ } = useNuxtApp()
87
+ const inputId = useId();
88
+ const min = ref(1);
89
+ const max = ref(999);
90
+ const {
91
+ count,
92
+ inc,
93
+ dec,
94
+ set
95
+ } = useCounter(1, {
96
+ min: min.value,
97
+ max: max.value
98
+ });
99
+
100
+ function handleOnChange(event: Event) {
101
+ const currentValue = (event.target as HTMLInputElement)?.value;
102
+ const nextValue = Number.parseFloat(currentValue);
103
+ set(clamp(nextValue, min.value, max.value));
104
+ }
105
+
106
+ const props = defineProps({
107
+ product: {
108
+ type: Object,
109
+ required: true
110
+ },
111
+ });
112
+
113
+ const formatPrice = (amount: number) => {
114
+ if (!amount) return '$0.00';
115
+ return new Intl.NumberFormat('en-US', {
116
+ style: 'currency',
117
+ currency: 'USD',
118
+ }).format(amount / 100);
119
+ };
120
+ </script>
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <div>
3
+ <v-expansion-panels>
4
+ <v-expansion-panel :title="faqs?.question" :text="faqs?.answer">
5
+ </v-expansion-panel>
6
+ </v-expansion-panels>
7
+ </div>
8
+ </template>
9
+
10
+ <script setup>
11
+ const props = defineProps({
12
+ faqs: {
13
+ type: String,
14
+ required: true,
15
+ },
16
+ });
17
+ </script>
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <div class="relative flex w-full max-h-[600px] aspect-4/3">
3
+ <v-carousel>
4
+ <v-carousel-item
5
+ v-for="asset in assets"
6
+ :key="asset.id"
7
+ :src="asset.preview"
8
+ cover
9
+ />
10
+ </v-carousel>
11
+ </div>
12
+ </template>
13
+
14
+ <script setup lang="ts">
15
+ const props = defineProps<{ assets: Array<{ id: string; preview: string }> }>();
16
+ </script>
@@ -0,0 +1,54 @@
1
+ <template>
2
+ <v-row>
3
+ <v-col cols="12">
4
+ <h6>Quantity</h6>
5
+ </v-col>
6
+
7
+ <v-col cols="12">
8
+ <div class="d-flex align-center mb-4">
9
+ <div class="d-flex align-center">
10
+ <v-btn square variant="secondary" :disabled="count <= min" @click="dec()" size="sm">
11
+ <SfIconRemove />
12
+ </v-btn>
13
+ <input :id="inputId" type="number" :min="min" :max="max" class="mx-2 w-16 text-center" :value="count"
14
+ @change="handleOnChange" :disabled="!isValidProduct" />
15
+ <v-btn square variant="secondary" :disabled="count >= max" @click="inc()" size="sm">
16
+ <SfIconAdd />
17
+ </v-btn>
18
+ </div>
19
+ </div>
20
+ </v-col>
21
+ </v-row>
22
+ </template>
23
+
24
+ <script setup>
25
+ import {
26
+ SfIconRemove,
27
+ SfIconAdd,
28
+ useId,
29
+ } from '@storefront-ui/vue';
30
+
31
+ // Counter setup
32
+ const inputId = useId()
33
+ const min = ref(1)
34
+ const max = ref(999)
35
+ const count = ref(1)
36
+ // Counter methods
37
+ function handleOnChange(event) {
38
+ const currentValue = event.target.value
39
+ const nextValue = parseFloat(currentValue)
40
+
41
+ if (isNaN(nextValue)) {
42
+ count.value = min.value
43
+ } else {
44
+ count.value = Math.min(Math.max(nextValue, min.value), max.value)
45
+ }
46
+ }
47
+
48
+ const props = defineProps({
49
+ productQty: {
50
+ type: String,
51
+ required: true,
52
+ },
53
+ });
54
+ </script>
@@ -0,0 +1,56 @@
1
+ <script setup lang="ts">
2
+ import { useVendureQuery } from "../../../composables/useVendureQuery";
3
+ import getProductReviewsQuery from "#graphql/app/commerce/queries/getProductReviews.gql";
4
+
5
+ const props = defineProps<{ productId: string }>();
6
+ const { data } = useVendureQuery(getProductReviewsQuery, {
7
+ productId: props.productId,
8
+ });
9
+ const reviews = computed(() => data.value?.product?.reviews || []);
10
+
11
+ const format: Intl.DateTimeFormatOptions = {
12
+ year: "numeric",
13
+ month: "short",
14
+ day: "numeric",
15
+ hour: "numeric",
16
+ minute: "numeric",
17
+ hour12: true,
18
+ };
19
+ const formatDate = (date: string) =>
20
+ new Date(date).toLocaleDateString("en-us", format);
21
+ </script>
22
+
23
+ <template>
24
+ <div>
25
+ <h4 class="text-xl font-bold dark:text-white mt-3">
26
+ {{ $t("product.reviews") }}
27
+ </h4>
28
+ <div v-if="reviews.length">
29
+ <div v-for="review in reviews" :key="review.id">
30
+ <div
31
+ v-if="review.createdAt"
32
+ class="mt-3 text-gray-600 text-sm"
33
+ >
34
+ <span>{{ formatDate(review.createdAt) }}</span>
35
+ </div>
36
+ <div class="inline-flex items-center mt-2">
37
+ <span
38
+ v-for="n in review.rating"
39
+ :key="n"
40
+ class="w-5 h-5 i-carbon-star-filled"
41
+ ></span>
42
+ <span
43
+ v-for="n in 5 - review.rating"
44
+ :key="n"
45
+ class="w-5 h-5 i-carbon-star"
46
+ ></span>
47
+ <span class="font-semibold ml-2">{{ review.summary }}</span>
48
+ </div>
49
+ <div class="mt-2">
50
+ <p class="wrap-break-word">{{ review.body }}</p>
51
+ </div>
52
+ </div>
53
+ </div>
54
+ <div v-else>{{ $t("product.noReviews") }}</div>
55
+ </div>
56
+ </template>