@meeovi/layer-commerce 1.0.4 → 1.0.5

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 (309) hide show
  1. package/app/components/catalog/product/ProductAccordion/types.ts +1 -1
  2. package/app/components/catalog/product/ProductProperties/types.ts +1 -1
  3. package/app/components/catalog/product/ProductSlider/types.ts +1 -1
  4. package/app/components/catalog/product/RecommendedProducts/types.ts +1 -1
  5. package/app/components/sales/CheckoutAddress/types.ts +1 -1
  6. package/app/components/sales/OrderSummary/types.ts +1 -1
  7. package/app/composables/_types.ts +6 -5
  8. package/app/composables/stores/cart.ts +2 -2
  9. package/app/composables/useProductReviews/useProductReviews.ts +1 -1
  10. package/app/modules/vue-head/composables/useHead.ts +3 -0
  11. package/dist/components/catalog/product/ProductAccordion/types.d.ts +4 -0
  12. package/dist/components/catalog/product/ProductAccordion/types.js +1 -0
  13. package/dist/components/catalog/product/ProductProperties/types.d.ts +4 -0
  14. package/dist/components/catalog/product/ProductProperties/types.js +1 -0
  15. package/dist/components/catalog/product/ProductSlider/types.d.ts +6 -0
  16. package/dist/components/catalog/product/ProductSlider/types.js +1 -0
  17. package/dist/components/catalog/product/RecommendedProducts/types.d.ts +4 -0
  18. package/dist/components/catalog/product/RecommendedProducts/types.js +1 -0
  19. package/dist/components/sales/CheckoutAddress/types.d.ts +14 -0
  20. package/dist/components/sales/CheckoutAddress/types.js +1 -0
  21. package/dist/components/sales/CheckoutPayment/types.d.ts +10 -0
  22. package/dist/components/sales/CheckoutPayment/types.js +7 -0
  23. package/dist/components/sales/OrderSummary/types.d.ts +4 -0
  24. package/dist/components/sales/OrderSummary/types.js +1 -0
  25. package/dist/composables/_types.d.ts +11 -0
  26. package/dist/composables/_types.js +1 -0
  27. package/dist/composables/adapters/abstract/cartAdapter.d.ts +0 -0
  28. package/dist/composables/adapters/abstract/cartAdapter.js +0 -0
  29. package/dist/composables/adapters/abstract/categoryAdapter.d.ts +0 -0
  30. package/dist/composables/adapters/abstract/categoryAdapter.js +0 -0
  31. package/dist/composables/adapters/abstract/customerAdapter.d.ts +0 -0
  32. package/dist/composables/adapters/abstract/customerAdapter.js +0 -0
  33. package/dist/composables/adapters/abstract/inventoryAdapter.d.ts +0 -0
  34. package/dist/composables/adapters/abstract/inventoryAdapter.js +0 -0
  35. package/dist/composables/adapters/abstract/orderAdapter.d.ts +0 -0
  36. package/dist/composables/adapters/abstract/orderAdapter.js +0 -0
  37. package/dist/composables/adapters/abstract/productAdapter.d.ts +6 -0
  38. package/dist/composables/adapters/abstract/productAdapter.js +1 -0
  39. package/dist/composables/cart/registry.d.ts +4 -0
  40. package/dist/composables/cart/registry.js +16 -0
  41. package/dist/composables/cart/types.d.ts +16 -0
  42. package/dist/composables/cart/types.js +1 -0
  43. package/dist/composables/cart/useCart.d.ts +6 -0
  44. package/dist/composables/cart/useCart.js +13 -0
  45. package/dist/composables/config.d.ts +7 -0
  46. package/dist/composables/config.js +11 -0
  47. package/dist/composables/defs/apiDefinitions.d.ts +7 -0
  48. package/dist/composables/defs/apiDefinitions.js +39 -0
  49. package/dist/composables/defs/extension.d.ts +91 -0
  50. package/dist/composables/defs/extension.js +154 -0
  51. package/dist/composables/defs/extension.mocks.d.ts +30 -0
  52. package/dist/composables/defs/extension.mocks.js +23 -0
  53. package/dist/composables/defs/extension.test.d.ts +1 -0
  54. package/dist/composables/defs/extension.test.js +233 -0
  55. package/dist/composables/defs/index.d.ts +3 -0
  56. package/dist/composables/defs/index.js +3 -0
  57. package/dist/composables/defs/types.d.ts +81 -0
  58. package/dist/composables/defs/types.js +1 -0
  59. package/dist/composables/domain/cart.d.ts +0 -0
  60. package/dist/composables/domain/cart.js +0 -0
  61. package/dist/composables/domain/category.d.ts +0 -0
  62. package/dist/composables/domain/category.js +0 -0
  63. package/dist/composables/domain/order.d.ts +0 -0
  64. package/dist/composables/domain/order.js +0 -0
  65. package/dist/composables/domain/price.d.ts +0 -0
  66. package/dist/composables/domain/price.js +0 -0
  67. package/dist/composables/domain/product.d.ts +8 -0
  68. package/dist/composables/domain/product.js +1 -0
  69. package/dist/composables/domain/reward.d.ts +0 -0
  70. package/dist/composables/domain/reward.js +0 -0
  71. package/dist/composables/domain/transactions.d.ts +0 -0
  72. package/dist/composables/domain/transactions.js +0 -0
  73. package/dist/composables/helpers/contextualizedNormalizers.d.ts +5 -0
  74. package/dist/composables/helpers/contextualizedNormalizers.js +6 -0
  75. package/dist/composables/helpers/contextualizedNormalizers.test.d.ts +1 -0
  76. package/dist/composables/helpers/contextualizedNormalizers.test.js +62 -0
  77. package/dist/composables/helpers/index.d.ts +1 -0
  78. package/dist/composables/helpers/index.js +1 -0
  79. package/dist/composables/index.d.ts +6 -0
  80. package/dist/composables/index.js +6 -0
  81. package/dist/composables/methods/auth.d.ts +62 -0
  82. package/dist/composables/methods/auth.js +1 -0
  83. package/dist/composables/methods/cart.d.ts +101 -0
  84. package/dist/composables/methods/cart.js +1 -0
  85. package/dist/composables/methods/category.d.ts +22 -0
  86. package/dist/composables/methods/category.js +1 -0
  87. package/dist/composables/methods/checkout.d.ts +42 -0
  88. package/dist/composables/methods/checkout.js +1 -0
  89. package/dist/composables/methods/customer.d.ts +39 -0
  90. package/dist/composables/methods/customer.js +1 -0
  91. package/dist/composables/methods/helpers.d.ts +2 -0
  92. package/dist/composables/methods/helpers.js +3 -0
  93. package/dist/composables/methods/index.d.ts +49 -0
  94. package/dist/composables/methods/index.js +9 -0
  95. package/dist/composables/methods/order.d.ts +29 -0
  96. package/dist/composables/methods/order.js +1 -0
  97. package/dist/composables/methods/product.d.ts +71 -0
  98. package/dist/composables/methods/product.js +1 -0
  99. package/dist/composables/methods/settings.d.ts +12 -0
  100. package/dist/composables/methods/settings.js +1 -0
  101. package/dist/composables/models/cart.d.ts +84 -0
  102. package/dist/composables/models/cart.js +1 -0
  103. package/dist/composables/models/category.d.ts +12 -0
  104. package/dist/composables/models/category.js +1 -0
  105. package/dist/composables/models/checkout.d.ts +15 -0
  106. package/dist/composables/models/checkout.js +1 -0
  107. package/dist/composables/models/customer.d.ts +14 -0
  108. package/dist/composables/models/customer.js +1 -0
  109. package/dist/composables/models/facets.d.ts +21 -0
  110. package/dist/composables/models/facets.js +5 -0
  111. package/dist/composables/models/index.d.ts +62 -0
  112. package/dist/composables/models/index.js +8 -0
  113. package/dist/composables/models/order.d.ts +39 -0
  114. package/dist/composables/models/order.js +1 -0
  115. package/dist/composables/models/product.d.ts +55 -0
  116. package/dist/composables/models/product.js +1 -0
  117. package/dist/composables/models/shared.d.ts +66 -0
  118. package/dist/composables/models/shared.js +1 -0
  119. package/dist/composables/products/registry.d.ts +4 -0
  120. package/dist/composables/products/registry.js +16 -0
  121. package/dist/composables/products/types.d.ts +12 -0
  122. package/dist/composables/products/types.js +1 -0
  123. package/dist/composables/products/useEvents.d.ts +0 -0
  124. package/dist/composables/products/useEvents.js +0 -0
  125. package/dist/composables/products/useGiftCards.d.ts +0 -0
  126. package/dist/composables/products/useGiftCards.js +0 -0
  127. package/dist/composables/products/useProducts.d.ts +4 -0
  128. package/dist/composables/products/useProducts.js +10 -0
  129. package/dist/composables/products/useSubscriptions.d.ts +0 -0
  130. package/dist/composables/products/useSubscriptions.js +0 -0
  131. package/dist/composables/registry.d.ts +9 -0
  132. package/dist/composables/registry.js +13 -0
  133. package/dist/composables/stores/cart.d.ts +1 -0
  134. package/dist/composables/stores/cart.js +203 -0
  135. package/dist/composables/stores/cartStore.d.ts +1 -0
  136. package/dist/composables/stores/cartStore.js +246 -0
  137. package/dist/composables/stores/checkout.d.ts +1 -0
  138. package/dist/composables/stores/checkout.js +17 -0
  139. package/dist/composables/stores/compare.d.ts +1 -0
  140. package/dist/composables/stores/compare.js +50 -0
  141. package/dist/composables/stores/orders.d.ts +1 -0
  142. package/dist/composables/stores/orders.js +156 -0
  143. package/dist/composables/stores/product.d.ts +1 -0
  144. package/dist/composables/stores/product.js +26 -0
  145. package/dist/composables/stores/productList.d.ts +0 -0
  146. package/dist/composables/stores/productList.js +0 -0
  147. package/dist/composables/stores/productListInfo.d.ts +0 -0
  148. package/dist/composables/stores/productListInfo.js +0 -0
  149. package/dist/composables/stores/products.d.ts +1 -0
  150. package/dist/composables/stores/products.js +106 -0
  151. package/dist/composables/stores/recentlyViewedProducts.d.ts +0 -0
  152. package/dist/composables/stores/recentlyViewedProducts.js +0 -0
  153. package/dist/composables/stores/review.d.ts +1 -0
  154. package/dist/composables/stores/review.js +25 -0
  155. package/dist/composables/stores/storeInPickUp.d.ts +1 -0
  156. package/dist/composables/stores/storeInPickUp.js +21 -0
  157. package/dist/composables/stores/user.d.ts +1 -0
  158. package/dist/composables/stores/user.js +16 -0
  159. package/dist/composables/stores/wishlist.d.ts +1 -0
  160. package/dist/composables/stores/wishlist.js +17 -0
  161. package/dist/composables/types/Order.type.d.ts +141 -0
  162. package/dist/composables/types/Order.type.js +1 -0
  163. package/dist/composables/types/index.d.ts +265 -0
  164. package/dist/composables/types/index.js +3 -0
  165. package/dist/composables/types/product.d.ts +13 -0
  166. package/dist/composables/types/product.js +1 -0
  167. package/dist/composables/useBreakpoints/index.d.ts +1 -0
  168. package/dist/composables/useBreakpoints/index.js +1 -0
  169. package/dist/composables/useBreakpoints/useBreakpoints.d.ts +10 -0
  170. package/dist/composables/useBreakpoints/useBreakpoints.js +24 -0
  171. package/dist/composables/useCart/index.d.ts +1 -0
  172. package/dist/composables/useCart/index.js +1 -0
  173. package/dist/composables/useCart/types.d.ts +13 -0
  174. package/dist/composables/useCart/types.js +1 -0
  175. package/dist/composables/useCart/useCart.d.ts +8 -0
  176. package/dist/composables/useCart/useCart.js +43 -0
  177. package/dist/composables/useCartShippingMethods/index.d.ts +1 -0
  178. package/dist/composables/useCartShippingMethods/index.js +1 -0
  179. package/dist/composables/useCartShippingMethods/types.d.ts +13 -0
  180. package/dist/composables/useCartShippingMethods/types.js +1 -0
  181. package/dist/composables/useCartShippingMethods/useCartShippingMethods.d.ts +7 -0
  182. package/dist/composables/useCartShippingMethods/useCartShippingMethods.js +35 -0
  183. package/dist/composables/useCatalog.d.ts +13 -0
  184. package/dist/composables/useCatalog.js +61 -0
  185. package/dist/composables/useContent/index.d.ts +1 -0
  186. package/dist/composables/useContent/index.js +1 -0
  187. package/dist/composables/useContent/types.d.ts +32 -0
  188. package/dist/composables/useContent/types.js +1 -0
  189. package/dist/composables/useContent/useContent.d.ts +9 -0
  190. package/dist/composables/useContent/useContent.js +43 -0
  191. package/dist/composables/useContent.d.ts +14 -0
  192. package/dist/composables/useContent.js +55 -0
  193. package/dist/composables/useCustomer/index.d.ts +2 -0
  194. package/dist/composables/useCustomer/index.js +2 -0
  195. package/dist/composables/useCustomer/types.d.ts +13 -0
  196. package/dist/composables/useCustomer/types.js +1 -0
  197. package/dist/composables/useCustomer/useCustomer.d.ts +8 -0
  198. package/dist/composables/useCustomer/useCustomer.js +34 -0
  199. package/dist/composables/useCustomerAddress/index.d.ts +2 -0
  200. package/dist/composables/useCustomerAddress/index.js +2 -0
  201. package/dist/composables/useCustomerAddress/types.d.ts +13 -0
  202. package/dist/composables/useCustomerAddress/types.js +1 -0
  203. package/dist/composables/useCustomerAddress/useCustomerAddress.d.ts +8 -0
  204. package/dist/composables/useCustomerAddress/useCustomerAddress.js +43 -0
  205. package/dist/composables/useCustomerOrder/adress.d.ts +11 -0
  206. package/dist/composables/useCustomerOrder/adress.js +10 -0
  207. package/dist/composables/useCustomerOrder/index.d.ts +2 -0
  208. package/dist/composables/useCustomerOrder/index.js +2 -0
  209. package/dist/composables/useCustomerOrder/product.d.ts +28 -0
  210. package/dist/composables/useCustomerOrder/product.js +37 -0
  211. package/dist/composables/useCustomerOrder/types.d.ts +32 -0
  212. package/dist/composables/useCustomerOrder/types.js +1 -0
  213. package/dist/composables/useCustomerOrder/useCustomerOrder.d.ts +8 -0
  214. package/dist/composables/useCustomerOrder/useCustomerOrder.js +52 -0
  215. package/dist/composables/useCustomerOrders/index.d.ts +2 -0
  216. package/dist/composables/useCustomerOrders/index.js +2 -0
  217. package/dist/composables/useCustomerOrders/types.d.ts +15 -0
  218. package/dist/composables/useCustomerOrders/types.js +1 -0
  219. package/dist/composables/useCustomerOrders/useCustomerOrders.d.ts +8 -0
  220. package/dist/composables/useCustomerOrders/useCustomerOrders.js +42 -0
  221. package/dist/composables/useCustomerReturns/index.d.ts +2 -0
  222. package/dist/composables/useCustomerReturns/index.js +2 -0
  223. package/dist/composables/useCustomerReturns/types.d.ts +13 -0
  224. package/dist/composables/useCustomerReturns/types.js +1 -0
  225. package/dist/composables/useCustomerReturns/useCustomerReturns.d.ts +8 -0
  226. package/dist/composables/useCustomerReturns/useCustomerReturns.js +32 -0
  227. package/dist/composables/useHandleError/index.d.ts +1 -0
  228. package/dist/composables/useHandleError/index.js +1 -0
  229. package/dist/composables/useHandleError/types.d.ts +7 -0
  230. package/dist/composables/useHandleError/types.js +1 -0
  231. package/dist/composables/useHandleError/useHandleError.d.ts +10 -0
  232. package/dist/composables/useHandleError/useHandleError.js +24 -0
  233. package/dist/composables/usePageTitle.d.ts +5 -0
  234. package/dist/composables/usePageTitle.js +14 -0
  235. package/dist/composables/useProduct/index.d.ts +2 -0
  236. package/dist/composables/useProduct/index.js +2 -0
  237. package/dist/composables/useProduct/types.d.ts +13 -0
  238. package/dist/composables/useProduct/types.js +1 -0
  239. package/dist/composables/useProduct/useProduct.d.ts +9 -0
  240. package/dist/composables/useProduct/useProduct.js +36 -0
  241. package/dist/composables/useProductAttribute/index.d.ts +1 -0
  242. package/dist/composables/useProductAttribute/index.js +1 -0
  243. package/dist/composables/useProductAttribute/useProductAttribute.d.ts +11 -0
  244. package/dist/composables/useProductAttribute/useProductAttribute.js +25 -0
  245. package/dist/composables/useProductRecommended/index.d.ts +1 -0
  246. package/dist/composables/useProductRecommended/index.js +1 -0
  247. package/dist/composables/useProductRecommended/types.d.ts +13 -0
  248. package/dist/composables/useProductRecommended/types.js +1 -0
  249. package/dist/composables/useProductRecommended/useProductRecommended.d.ts +6 -0
  250. package/dist/composables/useProductRecommended/useProductRecommended.js +33 -0
  251. package/dist/composables/useProductReviews/index.d.ts +2 -0
  252. package/dist/composables/useProductReviews/index.js +2 -0
  253. package/dist/composables/useProductReviews/types.d.ts +13 -0
  254. package/dist/composables/useProductReviews/types.js +1 -0
  255. package/dist/composables/useProductReviews/useProductReviews.d.ts +9 -0
  256. package/dist/composables/useProductReviews/useProductReviews.js +36 -0
  257. package/dist/composables/useProducts/types.d.ts +18 -0
  258. package/dist/composables/useProducts/types.js +1 -0
  259. package/dist/composables/useProducts/useProducts.d.ts +8 -0
  260. package/dist/composables/useProducts/useProducts.js +35 -0
  261. package/dist/composables/utils/countryList.d.ts +5 -0
  262. package/dist/composables/utils/countryList.js +14 -0
  263. package/dist/composables/utils/glossary.d.ts +0 -0
  264. package/dist/composables/utils/glossary.js +0 -0
  265. package/dist/composables/utils/importExport.d.ts +0 -0
  266. package/dist/composables/utils/importExport.js +0 -0
  267. package/dist/composables/utils/print.d.ts +0 -0
  268. package/dist/composables/utils/print.js +0 -0
  269. package/dist/composables/utils/shopThemes.d.ts +0 -0
  270. package/dist/composables/utils/shopThemes.js +0 -0
  271. package/dist/composables/utils/statistics.d.ts +0 -0
  272. package/dist/composables/utils/statistics.js +0 -0
  273. package/dist/composables/utils/stock.d.ts +0 -0
  274. package/dist/composables/utils/stock.js +0 -0
  275. package/dist/composables/utils/stripe.d.ts +7 -0
  276. package/dist/composables/utils/stripe.js +14 -0
  277. package/dist/composables/utils/taxation.d.ts +0 -0
  278. package/dist/composables/utils/taxation.js +0 -0
  279. package/dist/composables/utils/tellFriends.d.ts +0 -0
  280. package/dist/composables/utils/tellFriends.js +0 -0
  281. package/dist/composables/validationRules/index.d.ts +1 -0
  282. package/dist/composables/validationRules/index.js +1 -0
  283. package/dist/composables/validationRules/password.d.ts +1 -0
  284. package/dist/composables/validationRules/password.js +20 -0
  285. package/dist/composables/validationRules/password.test.d.ts +1 -0
  286. package/dist/composables/validationRules/password.test.js +68 -0
  287. package/dist/composables/vendors/index.d.ts +0 -0
  288. package/dist/composables/vendors/index.js +0 -0
  289. package/dist/composables/vendors/registry.d.ts +0 -0
  290. package/dist/composables/vendors/registry.js +0 -0
  291. package/dist/composables/vendors/useAffiliates.d.ts +0 -0
  292. package/dist/composables/vendors/useAffiliates.js +0 -0
  293. package/dist/composables/vendors/useCommission.d.ts +0 -0
  294. package/dist/composables/vendors/useCommission.js +0 -0
  295. package/dist/modules/vue-head/composables/useHead.d.ts +1 -0
  296. package/dist/modules/vue-head/composables/useHead.js +3 -0
  297. package/dist/utils/client.d.ts +6 -0
  298. package/dist/utils/client.js +23 -0
  299. package/dist/utils/index.d.ts +15 -0
  300. package/dist/utils/index.js +38 -0
  301. package/dist/utils/normalizer.d.ts +12 -0
  302. package/dist/utils/normalizer.js +13 -0
  303. package/dist/utils/normalizers/magento.d.ts +3 -0
  304. package/dist/utils/normalizers/magento.js +23 -0
  305. package/dist/utils/normalizers/shopify.d.ts +3 -0
  306. package/dist/utils/normalizers/shopify.js +24 -0
  307. package/global.d.ts +135 -0
  308. package/package.json +1 -1
  309. package/tsconfig.json +9 -2
@@ -1,4 +1,4 @@
1
- import type { Product } from '../../../composables/_types'
1
+ import type { Product } from '../../../../composables/_types'
2
2
 
3
3
  export type ProductAccordionPropsType = {
4
4
  product: Product
@@ -1,4 +1,4 @@
1
- import type { Product } from '../../../composables/_types'
1
+ import type { Product } from '../../../../composables/_types'
2
2
 
3
3
  export type ProductPropertiesProps = {
4
4
  product: Product
@@ -1,5 +1,5 @@
1
1
  import type { HTMLAttributes } from 'vue'
2
- import type { Product } from '../../../composables/_types'
2
+ import type { Product } from '../../../../composables/_types'
3
3
 
4
4
  export type ProductSliderProps = {
5
5
  items?: Product[]
@@ -1,4 +1,4 @@
1
- import type { Product } from '../../../composables/_types'
1
+ import type { Product } from '../../../../composables/_types'
2
2
 
3
3
  export type RecommendedProductsProps = {
4
4
  products: Product[]
@@ -1,4 +1,4 @@
1
- import type { Maybe } from '../../composables/_types'
1
+ import type { Maybe } from '../../../composables/_types'
2
2
 
3
3
  export interface Address {
4
4
  streetNumber?: Maybe<string>
@@ -1,4 +1,4 @@
1
- import type { Cart } from '../../composables/_types'
1
+ import type { Cart } from '../../../composables/_types'
2
2
 
3
3
  export type OrderSummaryPropsType = {
4
4
  cart: Cart
@@ -1,10 +1,11 @@
1
1
  export type Maybe<T> = T | null | undefined;
2
2
 
3
3
  // Re-export or alias common legacy names expected by the composables
4
- export type SfProduct = import('@meeovi/commerce').Product;
5
- export type Product = import('@meeovi/commerce').Product;
6
- export type SfCart = import('@meeovi/commerce').Cart;
7
- export type Cart = import('@meeovi/commerce').Cart;
4
+ // Fallback permissive types for isolated builds
5
+ export type SfProduct = any;
6
+ export type Product = any;
7
+ export type SfCart = any;
8
+ export type Cart = any;
8
9
 
9
10
  // No direct equivalents in @meeovi/commerce yet — use permissive any types
10
11
  export type SfCustomer = any;
@@ -14,4 +15,4 @@ export type SfShippingMethods = any;
14
15
  export type SfAttribute = any;
15
16
 
16
17
  // Export additional useful types from the commerce package if needed
17
- export type Category = import('@meeovi/commerce').Category;
18
+ export type Category = any;
@@ -1,6 +1,6 @@
1
1
  import { ref, computed, readonly } from 'vue'
2
2
  import type { Cart, CartItem, Product } from '../types'
3
- import { useCart } from '../composables/cart/useCart'
3
+ import { useCart } from '../cart/useCart'
4
4
  import { defineStore } from 'pinia'
5
5
 
6
6
  export const useCartStore = defineStore('cart', () => {
@@ -19,7 +19,7 @@ export const useCartStore = defineStore('cart', () => {
19
19
  clearCart,
20
20
  setShippingOption: setShippingOptionFn
21
21
  ,createCheckoutSession: createCheckoutSessionFn
22
- } = useCart()
22
+ } = useCart() as any
23
23
 
24
24
  const initializeCart = async () => {
25
25
  loading.value = true
@@ -32,7 +32,7 @@ export const useProductReviews: UseProductReviews = (slug) => {
32
32
  const fetchProductReviews: FetchProductReviews = async (slug) => {
33
33
  state.value.loading = true;
34
34
  const client = getCommerceClient();
35
- const { data, error } = await useAsyncData(() => client.listProductReviews?.(productId) ?? client.listReviews?.(productId));
35
+ const { data, error } = await useAsyncData(() => client.listProductReviews?.(slug) ?? client.listReviews?.(slug));
36
36
  useHandleError(error.value);
37
37
  state.value.data = data.value as unknown as Maybe<SfProductReview[]>;
38
38
  state.value.loading = false;
@@ -0,0 +1,3 @@
1
+ export default function useHead(_: any = {}) {
2
+ return {}
3
+ }
@@ -0,0 +1,4 @@
1
+ import type { Product } from '../../../../composables/_types';
2
+ export type ProductAccordionPropsType = {
3
+ product: Product;
4
+ };
@@ -0,0 +1,4 @@
1
+ import type { Product } from '../../../../composables/_types';
2
+ export type ProductPropertiesProps = {
3
+ product: Product;
4
+ };
@@ -0,0 +1,6 @@
1
+ import type { HTMLAttributes } from 'vue';
2
+ import type { Product } from '../../../../composables/_types';
3
+ export type ProductSliderProps = {
4
+ items?: Product[];
5
+ wrapperClass?: HTMLAttributes['class'];
6
+ };
@@ -0,0 +1,4 @@
1
+ import type { Product } from '../../../../composables/_types';
2
+ export type RecommendedProductsProps = {
3
+ products: Product[];
4
+ };
@@ -0,0 +1,14 @@
1
+ import type { Maybe } from '../../../composables/_types';
2
+ export interface Address {
3
+ streetNumber?: Maybe<string>;
4
+ phone?: Maybe<string>;
5
+ streetName?: Maybe<string>;
6
+ [key: string]: any;
7
+ }
8
+ export type CheckoutAddressProps = {
9
+ type: 'billingAddress' | 'shippingAddress';
10
+ heading: string;
11
+ description: string;
12
+ buttonText: string;
13
+ savedAddress?: Maybe<Address>;
14
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ export declare enum PaymentMethod {
2
+ CreditCard = "credit-card",
3
+ PayPal = "pay-pal",
4
+ ApplePay = "apple-pay",
5
+ GooglePay = "google-pay"
6
+ }
7
+ export type CheckoutPaymentProps = {
8
+ activePayment: string;
9
+ };
10
+ export type CheckoutPaymentEmits = (event: 'update:activePayment', parameter: PaymentMethod) => void;
@@ -0,0 +1,7 @@
1
+ export var PaymentMethod;
2
+ (function (PaymentMethod) {
3
+ PaymentMethod["CreditCard"] = "credit-card";
4
+ PaymentMethod["PayPal"] = "pay-pal";
5
+ PaymentMethod["ApplePay"] = "apple-pay";
6
+ PaymentMethod["GooglePay"] = "google-pay";
7
+ })(PaymentMethod || (PaymentMethod = {}));
@@ -0,0 +1,4 @@
1
+ import type { Cart } from '../../../composables/_types';
2
+ export type OrderSummaryPropsType = {
3
+ cart: Cart;
4
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ export type Maybe<T> = T | null | undefined;
2
+ export type SfProduct = any;
3
+ export type Product = any;
4
+ export type SfCart = any;
5
+ export type Cart = any;
6
+ export type SfCustomer = any;
7
+ export type SfAddress = any;
8
+ export type SfProductReview = any;
9
+ export type SfShippingMethods = any;
10
+ export type SfAttribute = any;
11
+ export type Category = any;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import { Product } from "../../domain/product";
2
+ export interface ProductAdapter {
3
+ list(): Promise<Product[]>;
4
+ get(id: string): Promise<Product | null>;
5
+ search(query: string): Promise<Product[]>;
6
+ }
@@ -0,0 +1,4 @@
1
+ import { CartProvider } from "./types";
2
+ export declare function registerCartProvider(name: string, provider: CartProvider): void;
3
+ export declare function getCartProvider(name: string): CartProvider;
4
+ export declare function registerCartProviderRuntime(name: string, provider: CartProvider): void;
@@ -0,0 +1,16 @@
1
+ const providers = {};
2
+ export function registerCartProvider(name, provider) {
3
+ providers[name] = provider;
4
+ }
5
+ export function getCartProvider(name) {
6
+ const provider = providers[name];
7
+ if (!provider)
8
+ throw new Error(`Cart provider "${name}" not found`);
9
+ return provider;
10
+ }
11
+ // Runtime helper for adapter packages to register themselves when the
12
+ // app boots. Adapter packages can import this and call it from their
13
+ // plugin entry to wire into the commerce cart provider registry.
14
+ export function registerCartProviderRuntime(name, provider) {
15
+ registerCartProvider(name, provider);
16
+ }
@@ -0,0 +1,16 @@
1
+ export interface CartItem {
2
+ id: string;
3
+ quantity: number;
4
+ product: any;
5
+ }
6
+ export interface Cart {
7
+ id: string;
8
+ items: CartItem[];
9
+ total: number;
10
+ }
11
+ export interface CartProvider {
12
+ getCart(): Promise<Cart>;
13
+ addItem(productId: string, quantity?: number): Promise<Cart>;
14
+ removeItem(productId: string): Promise<Cart>;
15
+ clearCart(): Promise<Cart>;
16
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare function useCart(): {
2
+ getCart: () => Promise<import("./types").Cart>;
3
+ addItem: (productId: string, quantity?: number) => Promise<import("./types").Cart>;
4
+ removeItem: (productId: string) => Promise<import("./types").Cart>;
5
+ clearCart: () => Promise<import("./types").Cart>;
6
+ };
@@ -0,0 +1,13 @@
1
+ import { getCartProvider } from './registry';
2
+ import { useRuntimeConfig } from '#imports';
3
+ export function useCart() {
4
+ const config = useRuntimeConfig();
5
+ const providerName = config.public.cartProvider || 'directus';
6
+ const provider = getCartProvider(providerName);
7
+ return {
8
+ getCart: provider.getCart,
9
+ addItem: provider.addItem,
10
+ removeItem: provider.removeItem,
11
+ clearCart: provider.clearCart
12
+ };
13
+ }
@@ -0,0 +1,7 @@
1
+ export interface CommerceConfig {
2
+ productProvider: string;
3
+ cartProvider: string;
4
+ categoryProvider: string;
5
+ }
6
+ export declare function setCommerceConfig(newConfig: Partial<CommerceConfig>): void;
7
+ export declare function getCommerceConfig(): CommerceConfig;
@@ -0,0 +1,11 @@
1
+ let config = {
2
+ productProvider: 'directus',
3
+ cartProvider: 'directus',
4
+ categoryProvider: 'directus'
5
+ };
6
+ export function setCommerceConfig(newConfig) {
7
+ config = { ...config, ...newConfig };
8
+ }
9
+ export function getCommerceConfig() {
10
+ return config;
11
+ }
@@ -0,0 +1,7 @@
1
+ import type { DefineAddCustomFields, NormalizersConstraint } from "./types";
2
+ import type { UnifiedMethods } from "../methods";
3
+ export type DefineApi<TContext = Record<string, unknown>> = {
4
+ [TKey in keyof UnifiedMethods]: (fn: (context: TContext, ...args: Parameters<UnifiedMethods[TKey]>) => ReturnType<UnifiedMethods[TKey]>) => (context: TContext, ...args: Parameters<UnifiedMethods[TKey]>) => ReturnType<UnifiedMethods[TKey]>;
5
+ };
6
+ export declare function getApiDefinitions<TContext = Record<string, unknown>>(): DefineApi<TContext>;
7
+ export declare function defineAddCustomFieldsFactory<TNormalizers extends NormalizersConstraint>(): <TInput extends DefineAddCustomFields<TNormalizers>>(input: TInput) => TInput;
@@ -0,0 +1,39 @@
1
+ export function getApiDefinitions() {
2
+ return {
3
+ getCategories: (fn) => fn,
4
+ getCategory: (fn) => fn,
5
+ getCart: (fn) => fn,
6
+ addCartLineItem: (fn) => fn,
7
+ updateCartLineItem: (fn) => fn,
8
+ removeCartLineItem: (fn) => fn,
9
+ applyCouponToCart: (fn) => fn,
10
+ removeCouponFromCart: (fn) => fn,
11
+ setCustomerEmail: (fn) => fn,
12
+ setCartAddress: (fn) => fn,
13
+ getAvailableShippingMethods: (fn) => fn,
14
+ setShippingMethod: (fn) => fn,
15
+ registerCustomer: (fn) => fn,
16
+ loginCustomer: (fn) => fn,
17
+ getCustomer: (fn) => fn,
18
+ logoutCustomer: (fn) => fn,
19
+ updateCustomer: (fn) => fn,
20
+ changeCustomerPassword: (fn) => fn,
21
+ searchProducts: (fn) => fn,
22
+ getProducts: (fn) => fn,
23
+ getProductDetails: (fn) => fn,
24
+ getProductReviews: (fn) => fn,
25
+ createCustomerAddress: (fn) => fn,
26
+ getCustomerAddresses: (fn) => fn,
27
+ updateCustomerAddress: (fn) => fn,
28
+ deleteCustomerAddress: (fn) => fn,
29
+ getCurrencies: (fn) => fn,
30
+ getOrders: (fn) => fn,
31
+ getOrderDetails: (fn) => fn,
32
+ placeOrder: (fn) => fn,
33
+ };
34
+ }
35
+ export function defineAddCustomFieldsFactory() {
36
+ return (input) => {
37
+ return input;
38
+ };
39
+ }
@@ -0,0 +1,91 @@
1
+ type ApiMethods = Record<string, (...args: any[]) => any>;
2
+ import type { CreateUnifiedExtensionParams, DefineAddCustomFields, NormalizersConstraint, UnifiedConfig, UnifiedExtensionContextConstraint, UnifiedExtensionFactoryParams } from "./types";
3
+ /**
4
+ * @description A factory function which builds the default normalizers and default API methods into unified extension.
5
+ * It expects the type of the API methods, normalizers, and config as generics.
6
+ *
7
+ * @returns A `createUnifiedExtension` function which can be used by the user to create a unified extension.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * export const createUnifiedExtension = unifiedExtensionFactory<
12
+ * typeof apiMethods,
13
+ * Normalizers,
14
+ * Config
15
+ * >({
16
+ * extendApiMethods: apiMethods,
17
+ * normalizers,
18
+ * });
19
+ * ```
20
+ */
21
+ export declare function unifiedExtensionFactory<TApiMethods extends ApiMethods, TNormalizers extends NormalizersConstraint, TConfig extends UnifiedConfig>(factoryParams: UnifiedExtensionFactoryParams<TApiMethods, TNormalizers>): <TAddCustomFieldsArray extends [DefineAddCustomFields<TNormalizers>, ...DefineAddCustomFields<TNormalizers>[]]>(params: CreateUnifiedExtensionParams<TConfig, TApiMethods, TNormalizers, TAddCustomFieldsArray>) => {
22
+ name: string;
23
+ extendApiMethods: TApiMethods;
24
+ hooks(req: any, res: any): {
25
+ beforeCall({ args, configuration }: {
26
+ args: any;
27
+ configuration: any;
28
+ }): any;
29
+ };
30
+ isNamespaced: boolean;
31
+ normalizers: TNormalizers;
32
+ /**
33
+ * @internal You shouldn't use this field. It's present only to infer the type of addCustomFields
34
+ */
35
+ _addCustomFields: TAddCustomFieldsArray;
36
+ };
37
+ /**
38
+ * @description A factory function which builds the default normalizers and default API methods into unified extension.
39
+ * It expects the type of the API methods, normalizers, and config as generics.
40
+ *
41
+ * @returns A Middleware extension which can be registered in the API client.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * export const createUnifiedExtension = createUnifiedCmsExtension({
46
+ * extendApiMethods: {
47
+ * getPage,
48
+ * },
49
+ * normalizers,
50
+ * getAdditionalNormalizerContext: () => ({
51
+ * documentToHtmlString,
52
+ * }),
53
+ * });
54
+ * ```
55
+ */
56
+ export declare function createUnifiedCmsExtension<TApiMethods extends ApiMethods, TNormalizers extends NormalizersConstraint>(params: UnifiedExtensionFactoryParams<TApiMethods, TNormalizers>): {
57
+ name: string;
58
+ extendApiMethods: TApiMethods;
59
+ isNamespaced: boolean;
60
+ hooks(req: any, res: any): {
61
+ beforeCall({ args, configuration }: {
62
+ args: any;
63
+ configuration: any;
64
+ }): any;
65
+ };
66
+ };
67
+ /**
68
+ * A helper function to get the normalizers from the context.
69
+ * @param context Context passed to the API method
70
+ * @returns normalizers
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * const { normalizeProduct } = getNormalizers(context);
75
+ * ```
76
+ */
77
+ export declare function getNormalizers<TContext extends UnifiedExtensionContextConstraint>(context: TContext): TContext["config"]["normalizerContext"]["normalizers"];
78
+ /**
79
+ * A helper function to assign values to the normalizer context.
80
+ * @param context Context passed to the API method
81
+ * @param overrides Object with the values to override in the normalizer context
82
+ * @returns void - it mutates the context
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * assignToNormalizerContext(context, { locale: "de" });
87
+ * ```
88
+ */
89
+ export declare function assignToNormalizerContext<TContext extends UnifiedExtensionContextConstraint>(context: TContext, overrides: Partial<TContext["config"]["normalizerContext"]>): void;
90
+ export declare function mergeNormalizers<TNormalizers extends NormalizersConstraint>(baseNormalizers: TNormalizers, addCustomFields: DefineAddCustomFields<TNormalizers>[]): TNormalizers;
91
+ export {};
@@ -0,0 +1,154 @@
1
+ import { mergeDeepRight } from "ramda";
2
+ import { toContextualizedNormalizers } from "../helpers";
3
+ const Logger = console;
4
+ const CURRENCY_COOKIE = "vsf-currency";
5
+ const LOCALE_COOKIE = "vsf-locale";
6
+ /**
7
+ * @description A factory function which builds the default normalizers and default API methods into unified extension.
8
+ * It expects the type of the API methods, normalizers, and config as generics.
9
+ *
10
+ * @returns A `createUnifiedExtension` function which can be used by the user to create a unified extension.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * export const createUnifiedExtension = unifiedExtensionFactory<
15
+ * typeof apiMethods,
16
+ * Normalizers,
17
+ * Config
18
+ * >({
19
+ * extendApiMethods: apiMethods,
20
+ * normalizers,
21
+ * });
22
+ * ```
23
+ */
24
+ export function unifiedExtensionFactory(factoryParams) {
25
+ return function createUnifiedExtension(params) {
26
+ const { extendApiMethods: defaultApiMethods, normalizers: defaultNormalizers, getAdditionalNormalizerContext, } = factoryParams;
27
+ const baseNormalizers = { ...defaultNormalizers, ...params.normalizers.override };
28
+ const normalizers = mergeNormalizers(baseNormalizers, params.normalizers.addCustomFields);
29
+ const { config: extensionConfig, methods, isNamespaced = factoryParams.isNamespaced } = params;
30
+ return {
31
+ name: "unified",
32
+ extendApiMethods: {
33
+ ...defaultApiMethods,
34
+ ...methods?.override,
35
+ },
36
+ hooks(req, res) {
37
+ return {
38
+ beforeCall({ args, configuration }) {
39
+ if (!req.cookies[CURRENCY_COOKIE] && extensionConfig) {
40
+ req.cookies[CURRENCY_COOKIE] = extensionConfig.defaultCurrency;
41
+ }
42
+ configuration.unified = extensionConfig;
43
+ if (!configuration.normalizerContext) {
44
+ configuration.normalizerContext = createNormalizerContext(normalizers, getAdditionalNormalizerContext, { req, res, config: configuration });
45
+ configuration.normalizerContext.currency =
46
+ req.cookies?.[CURRENCY_COOKIE] ?? extensionConfig.defaultCurrency ?? "USD";
47
+ }
48
+ return args;
49
+ },
50
+ };
51
+ },
52
+ isNamespaced,
53
+ normalizers,
54
+ /**
55
+ * @internal You shouldn't use this field. It's present only to infer the type of addCustomFields
56
+ */
57
+ _addCustomFields: {},
58
+ };
59
+ };
60
+ }
61
+ /**
62
+ * @description A factory function which builds the default normalizers and default API methods into unified extension.
63
+ * It expects the type of the API methods, normalizers, and config as generics.
64
+ *
65
+ * @returns A Middleware extension which can be registered in the API client.
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * export const createUnifiedExtension = createUnifiedCmsExtension({
70
+ * extendApiMethods: {
71
+ * getPage,
72
+ * },
73
+ * normalizers,
74
+ * getAdditionalNormalizerContext: () => ({
75
+ * documentToHtmlString,
76
+ * }),
77
+ * });
78
+ * ```
79
+ */
80
+ export function createUnifiedCmsExtension(params) {
81
+ const { extendApiMethods, normalizers: defaultNormalizers, getAdditionalNormalizerContext, isNamespaced = true, } = params;
82
+ return {
83
+ name: "unified",
84
+ extendApiMethods,
85
+ isNamespaced,
86
+ hooks(req, res) {
87
+ return {
88
+ beforeCall({ args, configuration }) {
89
+ if (!configuration.normalizerContext) {
90
+ const unifiedConfig = configuration?.unified ?? {};
91
+ const baseNormalizers = {
92
+ ...defaultNormalizers,
93
+ ...unifiedConfig.normalizers?.override,
94
+ };
95
+ const normalizers = mergeNormalizers(baseNormalizers, unifiedConfig.normalizers?.addCustomFields ?? []);
96
+ configuration.normalizerContext = createNormalizerContext(normalizers, getAdditionalNormalizerContext, { req, res, config: configuration });
97
+ }
98
+ return args;
99
+ },
100
+ };
101
+ },
102
+ };
103
+ }
104
+ /**
105
+ * A helper function to get the normalizers from the context.
106
+ * @param context Context passed to the API method
107
+ * @returns normalizers
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * const { normalizeProduct } = getNormalizers(context);
112
+ * ```
113
+ */
114
+ export function getNormalizers(context) {
115
+ return context.config.normalizerContext.normalizers;
116
+ }
117
+ /**
118
+ * A helper function to assign values to the normalizer context.
119
+ * @param context Context passed to the API method
120
+ * @param overrides Object with the values to override in the normalizer context
121
+ * @returns void - it mutates the context
122
+ *
123
+ * @example
124
+ * ```ts
125
+ * assignToNormalizerContext(context, { locale: "de" });
126
+ * ```
127
+ */
128
+ export function assignToNormalizerContext(context, overrides) {
129
+ Object.assign(context.config.normalizerContext, overrides);
130
+ }
131
+ function createNormalizerContext(normalizers, getAdditionalNormalizerContext, { req, res, config }) {
132
+ const logger = Logger;
133
+ const normalizerContext = {
134
+ locale: req.cookies?.[LOCALE_COOKIE] ?? "en",
135
+ ...getAdditionalNormalizerContext({ req, res, config }),
136
+ logger,
137
+ };
138
+ normalizerContext.normalizers = toContextualizedNormalizers(normalizers, () => normalizerContext);
139
+ return normalizerContext;
140
+ }
141
+ export function mergeNormalizers(baseNormalizers, addCustomFields) {
142
+ const normalizers = { ...baseNormalizers };
143
+ addCustomFields.forEach((customFieldsNormalizers) => {
144
+ Object.entries(customFieldsNormalizers).forEach(([name, customFields]) => {
145
+ const currentNormalizer = normalizers[name];
146
+ if (normalizers[name] && customFields) {
147
+ normalizers[name] = (input, context) => mergeDeepRight(currentNormalizer(input, context), {
148
+ $custom: customFields(input, context),
149
+ });
150
+ }
151
+ });
152
+ });
153
+ return normalizers;
154
+ }