@meeovi/layer-commerce 1.0.10 → 1.0.13
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/app/components/catalog/product/ProductAccordion/ProductAccordion.vue +39 -0
- package/app/components/catalog/product/ProductAccordion/__tests__/ProductAccordion.spec.ts +15 -0
- package/app/components/catalog/product/ProductAccordion/types.ts +5 -0
- package/app/components/catalog/product/ProductProperties/ProductProperties.vue +50 -0
- package/app/components/catalog/product/ProductProperties/__tests__/ProductProperties.spec.ts +15 -0
- package/app/components/catalog/product/ProductProperties/types.ts +5 -0
- package/app/components/catalog/product/ProductSlider/ProductSlider.vue +28 -0
- package/app/components/catalog/product/ProductSlider/__tests__/ProductSlider.spec.ts +14 -0
- package/app/components/catalog/product/ProductSlider/types.ts +7 -0
- package/app/components/catalog/product/RecommendedProducts/RecommendedProducts.vue +12 -0
- package/app/components/catalog/product/RecommendedProducts/types.ts +5 -0
- package/app/components/catalog/product/RenderContentProductSlider/RenderContentProductSlider.vue +11 -0
- package/app/components/catalog/product/add-attribute.vue +54 -0
- package/app/components/catalog/product/add-product-type.vue +54 -0
- package/app/components/catalog/product/add-product.vue +53 -0
- package/app/components/catalog/product/add-showcase.vue +52 -0
- package/app/components/catalog/product/add-station.vue +54 -0
- package/app/components/catalog/product/bestsellers.vue +57 -0
- package/app/components/catalog/product/bidding.vue +93 -0
- package/app/components/catalog/product/colorOptions.vue +58 -0
- package/app/components/catalog/product/deals.vue +46 -0
- package/app/components/catalog/product/exclusives.vue +56 -0
- package/app/components/catalog/product/featuredproducts.vue +57 -0
- package/app/components/catalog/product/giftCard.vue +63 -0
- package/app/components/catalog/product/latestproducts.vue +46 -0
- package/app/components/catalog/product/productCard.vue +105 -0
- package/app/components/catalog/product/productCompare.vue +60 -0
- package/app/components/catalog/product/productCompareTable.vue +441 -0
- package/app/components/catalog/product/productDetails.vue +126 -0
- package/app/components/catalog/product/productFaqs.vue +17 -0
- package/app/components/catalog/product/productGallery.vue +16 -0
- package/app/components/catalog/product/productQty.vue +54 -0
- package/app/components/catalog/product/productReviews.vue +56 -0
- package/app/components/catalog/product/productSpecs.vue +116 -0
- package/app/components/catalog/product/radiostation.vue +36 -0
- package/app/components/catalog/product/recentlyviewed.vue +43 -0
- package/app/components/catalog/product/relatedbrands.vue +54 -0
- package/app/components/catalog/product/relatedproducts.vue +43 -0
- package/app/components/catalog/product/relatedstations.vue +40 -0
- package/app/components/catalog/product/shippingOptions.vue +41 -0
- package/app/components/catalog/product/sizeOptions.vue +42 -0
- package/app/components/catalog/product/update-attribute-set.vue +209 -0
- package/app/components/catalog/product/update-attribute.vue +118 -0
- package/app/components/catalog/product/update-product.vue +372 -0
- package/app/components/catalog/product/update-showcase.vue +153 -0
- package/app/components/catalog/shops/relatedstores.vue +37 -0
- package/app/components/catalog/shops/restaurant.vue +66 -0
- package/app/components/catalog/shops/stores.vue +44 -0
- package/app/components/catalog/vendor/README.md +3 -0
- package/app/components/catalog/vendor/blocks/biggestcustomers.vue +33 -0
- package/app/components/catalog/vendor/blocks/lowestselling.vue +33 -0
- package/app/components/catalog/vendor/blocks/topcategories.vue +33 -0
- package/app/components/catalog/vendor/blocks/topproducts.vue +27 -0
- package/app/components/catalog/vendor/pages/attributes.vue +43 -0
- package/app/components/catalog/vendor/pages/commissions.vue +43 -0
- package/app/components/catalog/vendor/pages/crm.vue +67 -0
- package/app/components/catalog/vendor/pages/dashboard.vue +46 -0
- package/app/components/catalog/vendor/pages/emails.vue +43 -0
- package/app/components/catalog/vendor/pages/enquiries.vue +43 -0
- package/app/components/catalog/vendor/pages/invoices.vue +43 -0
- package/app/components/catalog/vendor/pages/orders.vue +68 -0
- package/app/components/catalog/vendor/pages/products.vue +55 -0
- package/app/components/catalog/vendor/pages/reviews.vue +48 -0
- package/app/components/catalog/vendor/pages/shipments.vue +43 -0
- package/app/components/catalog/vendor/pages/stores.vue +43 -0
- package/app/components/categories/chart/[id].vue +200 -0
- package/app/components/categories/chart/add-chart.vue +142 -0
- package/app/components/categories/chart/chart.vue +82 -0
- package/app/components/categories/chart/monthlyChart.vue +46 -0
- package/app/components/categories/chart/weeklyChart.vue +46 -0
- package/app/components/categories/chart/yearlyChart.vue +46 -0
- package/app/components/categories/charts.vue +118 -0
- package/app/components/categories/deals.vue +101 -0
- package/app/components/categories/eats.vue +49 -0
- package/app/components/categories/restaurants.vue +26 -0
- package/app/components/categories/station/[id].vue +72 -0
- package/app/components/categories/stations.vue +124 -0
- package/app/components/categories/time/time.vue +63 -0
- package/app/components/categories/travel.vue +75 -0
- package/app/components/categories/weather/weather.vue +44 -0
- package/app/components/content/blocks/breadcrumbs.vue +0 -0
- package/app/components/content/blocks/currencySwitcher.vue +0 -0
- package/app/components/content/blocks/languageSwitcher.vue +0 -0
- package/app/components/content/blocks/videoproduct.vue +9 -0
- package/app/components/content/pages/checkout.vue +118 -0
- package/app/components/content/pages/meeoviGlobal.vue +68 -0
- package/app/components/content/pages/pickup-locations.vue +238 -0
- package/app/components/content/pages/showcases.vue +90 -0
- package/app/components/content/pages/success.vue +60 -0
- package/app/components/marketing/add-brand.vue +54 -0
- package/app/components/marketing/add-incentive.vue +54 -0
- package/app/components/marketing/promotions/giftcards.vue +102 -0
- package/app/components/marketing/promotions/subscriptions.vue +121 -0
- package/app/components/marketing/update-incentive.vue +326 -0
- package/app/components/menus/lowernav.vue +78 -0
- package/app/components/partials/LocaleSelector.vue +24 -0
- package/app/components/partials/ShoppingCart.vue +128 -0
- package/app/components/partials/StripePayment.vue +149 -0
- package/app/components/partials/addToCartBtn.vue +40 -0
- package/app/components/partials/cartItem.vue +124 -0
- package/app/components/partials/checkoutButton.vue +44 -0
- package/app/components/partials/compareBtn.vue +68 -0
- package/app/components/partials/ratings.vue +13 -0
- package/app/components/partials/store/CurrencySelector.vue +133 -0
- package/app/components/partials/store/StoreSwitcher.vue +13 -0
- package/app/components/placeholders/Comments.vue +15 -0
- package/app/components/placeholders/CreateListBtn.vue +7 -0
- package/app/components/placeholders/Event.vue +9 -0
- package/app/components/placeholders/ListShowcases.vue +9 -0
- package/app/components/placeholders/Short.vue +9 -0
- package/app/components/placeholders/Space.vue +9 -0
- package/app/components/placeholders/Tag.vue +7 -0
- package/app/components/related/brandCard.vue +41 -0
- package/app/components/related/incentiveCard.vue +44 -0
- package/app/components/related/invoiceCard.vue +43 -0
- package/app/components/related/orderCard.vue +43 -0
- package/app/components/related/relatedproducts.vue +17 -0
- package/app/components/sales/CartPageContent/CartPageContent.vue +37 -0
- package/app/components/sales/CheckoutAddress/CheckoutAddress.vue +50 -0
- package/app/components/sales/CheckoutAddress/__tests__/CheckoutAddress.spec.ts +16 -0
- package/app/components/sales/CheckoutAddress/types.ts +16 -0
- package/app/components/sales/CheckoutPayment/CheckoutPayment.vue +68 -0
- package/app/components/sales/CheckoutPayment/__tests__/CheckoutPayment.spec.ts +14 -0
- package/app/components/sales/CheckoutPayment/types.ts +12 -0
- package/app/components/sales/OrderSummary/OrderSummary.vue +57 -0
- package/app/components/sales/OrderSummary/__tests__/ContactInformation.spec.ts +52 -0
- package/app/components/sales/OrderSummary/types.ts +5 -0
- package/app/components/sales/incentives.vue +223 -0
- package/app/components/sales/invoices.vue +107 -0
- package/app/components/sales/orders.vue +378 -0
- package/app/components/sales/shipments.vue +65 -0
- package/app/components/sales/transactions.vue +109 -0
- package/app/components/shop/add-shop.vue +54 -0
- package/app/components/shop/cart/cartItem.vue +182 -0
- package/app/components/shop/cart/checkout.vue +415 -0
- package/app/components/shop/checkout/StripeCardElement.vue +206 -0
- package/app/components/shop/checkout/StripeCheckout.vue +49 -0
- package/app/components/shop/checkout/addressBilling.vue +263 -0
- package/app/components/shop/checkout/addressShipping.vue +175 -0
- package/app/components/shop/checkout/cart/ProductItem.vue +56 -0
- package/app/components/shop/checkout/cart/PromotionItem.vue +53 -0
- package/app/composables/_types.ts +18 -0
- package/app/composables/adapters/abstract/cartAdapter.ts +0 -0
- package/app/composables/adapters/abstract/categoryAdapter.ts +0 -0
- package/app/composables/adapters/abstract/customerAdapter.ts +0 -0
- package/app/composables/adapters/abstract/inventoryAdapter.ts +0 -0
- package/app/composables/adapters/abstract/orderAdapter.ts +0 -0
- package/app/composables/adapters/abstract/productAdapter.ts +7 -0
- package/app/composables/cart/registry.ts +20 -0
- package/app/composables/cart/types.ts +18 -0
- package/app/composables/cart/useCart.ts +15 -0
- package/app/composables/config.ts +19 -0
- package/app/composables/defs/apiDefinitions.ts +55 -0
- package/app/composables/defs/extension.feature +40 -0
- package/app/composables/defs/extension.mocks.ts +39 -0
- package/app/composables/defs/extension.test.ts +280 -0
- package/app/composables/defs/extension.ts +236 -0
- package/app/composables/defs/index.ts +3 -0
- package/app/composables/defs/types.ts +136 -0
- package/app/composables/domain/cart.ts +0 -0
- package/app/composables/domain/category.ts +0 -0
- package/app/composables/domain/order.ts +0 -0
- package/app/composables/domain/price.ts +0 -0
- package/app/composables/domain/product.ts +8 -0
- package/app/composables/domain/reward.ts +0 -0
- package/app/composables/domain/transactions.ts +0 -0
- package/app/composables/helpers/contextualizedNormalizers.feature +14 -0
- package/app/composables/helpers/contextualizedNormalizers.test.ts +85 -0
- package/app/composables/helpers/contextualizedNormalizers.ts +20 -0
- package/app/composables/helpers/index.ts +1 -0
- package/app/composables/index.ts +6 -0
- package/app/composables/methods/auth.ts +83 -0
- package/app/composables/methods/cart.ts +119 -0
- package/app/composables/methods/category.ts +27 -0
- package/app/composables/methods/checkout.ts +54 -0
- package/app/composables/methods/customer.ts +52 -0
- package/app/composables/methods/helpers.ts +5 -0
- package/app/composables/methods/index.ts +75 -0
- package/app/composables/methods/order.ts +39 -0
- package/app/composables/methods/product.ts +95 -0
- package/app/composables/methods/settings.ts +16 -0
- package/app/composables/models/cart.ts +95 -0
- package/app/composables/models/category.ts +13 -0
- package/app/composables/models/checkout.ts +17 -0
- package/app/composables/models/customer.ts +16 -0
- package/app/composables/models/facets.ts +25 -0
- package/app/composables/models/index.ts +94 -0
- package/app/composables/models/order.ts +43 -0
- package/app/composables/models/product.ts +73 -0
- package/app/composables/models/shared.ts +75 -0
- package/app/composables/products/registry.ts +20 -0
- package/app/composables/products/types.ts +13 -0
- package/app/composables/products/useEvents.ts +0 -0
- package/app/composables/products/useGiftCards.ts +0 -0
- package/app/composables/products/useProducts.ts +12 -0
- package/app/composables/products/useSubscriptions.ts +0 -0
- package/app/composables/registry.ts +21 -0
- package/app/composables/stores/cart.ts +218 -0
- package/app/composables/stores/cartStore.ts +300 -0
- package/app/composables/stores/checkout.ts +19 -0
- package/app/composables/stores/compare.ts +65 -0
- package/app/composables/stores/currency.js +29 -0
- package/app/composables/stores/digital-products.js +11 -0
- package/app/composables/stores/index.js +0 -0
- package/app/composables/stores/orders.ts +161 -0
- package/app/composables/stores/product.ts +26 -0
- package/app/composables/stores/productList.ts +0 -0
- package/app/composables/stores/productListInfo.ts +0 -0
- package/app/composables/stores/products.ts +112 -0
- package/app/composables/stores/recentlyViewedProducts.ts +0 -0
- package/app/composables/stores/review.ts +25 -0
- package/app/composables/stores/storeInPickUp.ts +22 -0
- package/app/composables/stores/user.ts +20 -0
- package/app/composables/stores/wishlist.ts +19 -0
- package/app/composables/types/Order.type.ts +181 -0
- package/app/composables/types/index.ts +285 -0
- package/app/composables/types/product.ts +14 -0
- package/app/composables/useBreakpoints/index.ts +1 -0
- package/app/composables/useBreakpoints/useBreakpoints.ts +28 -0
- package/app/composables/useCart/__tests__/useCart.spec.ts +11 -0
- package/app/composables/useCart/index.ts +1 -0
- package/app/composables/useCart/types.ts +17 -0
- package/app/composables/useCart/useCart.ts +46 -0
- package/app/composables/useCartShippingMethods/__tests__/useCartShippingMethods.spec.ts +11 -0
- package/app/composables/useCartShippingMethods/index.ts +1 -0
- package/app/composables/useCartShippingMethods/types.ts +17 -0
- package/app/composables/useCartShippingMethods/useCartShippingMethods.ts +47 -0
- package/app/composables/useCatalog.ts +64 -0
- package/app/composables/useContent/index.ts +1 -0
- package/app/composables/useContent/types.ts +44 -0
- package/app/composables/useContent/useContent.ts +45 -0
- package/app/composables/useContent.ts +57 -0
- package/app/composables/useCustomer/__tests__/useCustomer.spec.ts +25 -0
- package/app/composables/useCustomer/index.ts +2 -0
- package/app/composables/useCustomer/types.ts +17 -0
- package/app/composables/useCustomer/useCustomer.ts +40 -0
- package/app/composables/useCustomerAddress/__tests__/useCustomerAddress.spec.ts +11 -0
- package/app/composables/useCustomerAddress/index.ts +2 -0
- package/app/composables/useCustomerAddress/types.ts +17 -0
- package/app/composables/useCustomerAddress/useCustomerAddress.ts +55 -0
- package/app/composables/useCustomerOrder/__tests__/useCustomerOrder.spec.ts +11 -0
- package/app/composables/useCustomerOrder/adress.ts +10 -0
- package/app/composables/useCustomerOrder/index.ts +2 -0
- package/app/composables/useCustomerOrder/product.ts +37 -0
- package/app/composables/useCustomerOrder/types.ts +40 -0
- package/app/composables/useCustomerOrder/useCustomerOrder.ts +63 -0
- package/app/composables/useCustomerOrders/__tests__/useCustomerOrders.spec.ts +11 -0
- package/app/composables/useCustomerOrders/index.ts +2 -0
- package/app/composables/useCustomerOrders/types.ts +20 -0
- package/app/composables/useCustomerOrders/useCustomerOrders.ts +56 -0
- package/app/composables/useCustomerReturns/__tests__/useCustomerReturns.spec.ts +11 -0
- package/app/composables/useCustomerReturns/index.ts +2 -0
- package/app/composables/useCustomerReturns/types.ts +17 -0
- package/app/composables/useCustomerReturns/useCustomerReturns.ts +41 -0
- package/app/composables/useHandleError/index.ts +1 -0
- package/app/composables/useHandleError/types.ts +11 -0
- package/app/composables/useHandleError/useHandleError.ts +27 -0
- package/app/composables/usePageTitle.ts +16 -0
- package/app/composables/useProduct/index.ts +2 -0
- package/app/composables/useProduct/types.ts +17 -0
- package/app/composables/useProduct/useProduct.ts +42 -0
- package/app/composables/useProductAttribute/__tests__/useProduct.mock.ts +31 -0
- package/app/composables/useProductAttribute/__tests__/useProductAttribute.spec.ts +14 -0
- package/app/composables/useProductAttribute/index.ts +1 -0
- package/app/composables/useProductAttribute/useProductAttribute.ts +37 -0
- package/app/composables/useProductRecommended/__tests__/useProductRecommended.spec.ts +12 -0
- package/app/composables/useProductRecommended/index.ts +1 -0
- package/app/composables/useProductRecommended/types.ts +17 -0
- package/app/composables/useProductRecommended/useProductRecommended.ts +43 -0
- package/app/composables/useProductReviews/__tests__/productReviews.mock.ts +20 -0
- package/app/composables/useProductReviews/__tests__/useProductReviews.spec.ts +22 -0
- package/app/composables/useProductReviews/index.ts +2 -0
- package/app/composables/useProductReviews/types.ts +17 -0
- package/app/composables/useProductReviews/useProductReviews.ts +46 -0
- package/app/composables/useProducts/__tests__/useProducts.spec.ts +11 -0
- package/app/composables/useProducts/types.ts +22 -0
- package/app/composables/useProducts/useProducts.ts +41 -0
- package/app/composables/utils/countryList.ts +14 -0
- package/app/composables/utils/currency.js +56 -0
- package/app/composables/utils/glossary.ts +0 -0
- package/app/composables/utils/importExport.ts +0 -0
- package/app/composables/utils/index.js +0 -0
- package/app/composables/utils/print.ts +0 -0
- package/app/composables/utils/shopThemes.ts +0 -0
- package/app/composables/utils/statistics.ts +0 -0
- package/app/composables/utils/stock.ts +0 -0
- package/app/composables/utils/stripe.ts +16 -0
- package/app/composables/utils/taxation.ts +0 -0
- package/app/composables/utils/tellFriends.ts +0 -0
- package/app/composables/validationRules/index.ts +1 -0
- package/app/composables/validationRules/password.feature +67 -0
- package/app/composables/validationRules/password.test.ts +89 -0
- package/app/composables/validationRules/password.ts +25 -0
- package/app/composables/vendors/index.ts +0 -0
- package/app/composables/vendors/registry.ts +0 -0
- package/app/composables/vendors/useAffiliates.ts +0 -0
- package/app/composables/vendors/useCommission.ts +0 -0
- package/app/modules/vue-head/composables/useHead.ts +3 -0
- package/app/pages/brand/[...slug].vue +92 -0
- package/app/pages/brands.vue +90 -0
- package/app/pages/cart.vue +142 -0
- package/app/pages/compare.vue +166 -0
- package/app/pages/departments/[...slug].vue +385 -0
- package/app/pages/departments/category/[...slug].vue +135 -0
- package/app/pages/incentive/[...id].vue +66 -0
- package/app/pages/invoice/[id].vue +309 -0
- package/app/pages/order/[id].vue +327 -0
- package/app/pages/product/[...id].vue +309 -0
- package/app/pages/product/showcases/index.vue +86 -0
- package/app/pages/shipment/[...id].vue +176 -0
- package/app/pages/shop/[...slug].vue +158 -0
- package/app/pages/shops.vue +76 -0
- package/app/pages/subscription/[...id].vue +147 -0
- package/app/pages/transaction/[...id].vue +74 -0
- package/app/types/shims-imports.d.ts +13 -0
- package/app/utils/client.ts +26 -0
- package/app/utils/index.ts +53 -0
- package/app/utils/normalizer.ts +23 -0
- package/app/utils/normalizers/magento.ts +29 -0
- package/app/utils/normalizers/shopify.ts +29 -0
- package/global.d.ts +149 -0
- package/index.js +3 -0
- package/package.json +3 -9
- package/tsconfig.json +31 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { SfCart, SfCartCoupon, SfCartCouponCustom, SfCartLineItemCustom } from "./cart";
|
|
2
|
+
import type { SfCategory, SfCategoryCustom } from "./category";
|
|
3
|
+
import type { SfShippingMethod, SfShippingMethodCustom, SfShippingMethods } from "./checkout";
|
|
4
|
+
import type { SfCustomer, SfCustomerAddress, SfCustomerCustom } from "./customer";
|
|
5
|
+
import type { SfFacet, SfFacetCustom, SfFacetItem, SfFacetType, SfFacetTypes } from "./facets";
|
|
6
|
+
import type {
|
|
7
|
+
SfOrder,
|
|
8
|
+
SfOrderCustom,
|
|
9
|
+
SfOrderLineItem,
|
|
10
|
+
SfOrderLineItemCustom,
|
|
11
|
+
SfOrderListItem,
|
|
12
|
+
SfOrderListItemCustom,
|
|
13
|
+
} from "./order";
|
|
14
|
+
import type {
|
|
15
|
+
SfPagination,
|
|
16
|
+
SfPaginationCustom,
|
|
17
|
+
SfProduct,
|
|
18
|
+
SfProductCatalogItem,
|
|
19
|
+
SfProductCatalogItemCustom,
|
|
20
|
+
SfProductCustom,
|
|
21
|
+
SfProductReview,
|
|
22
|
+
SfProductReviewCustom,
|
|
23
|
+
SfProductVariant,
|
|
24
|
+
} from "./product";
|
|
25
|
+
import type {
|
|
26
|
+
SfAddress,
|
|
27
|
+
SfAddressCustom,
|
|
28
|
+
SfAttribute,
|
|
29
|
+
SfAttributeCustom,
|
|
30
|
+
SfCreateAddressBody,
|
|
31
|
+
SfCurrency,
|
|
32
|
+
SfDiscountablePrice,
|
|
33
|
+
SfDiscountablePriceCustom,
|
|
34
|
+
SfImage,
|
|
35
|
+
SfImageCustom,
|
|
36
|
+
SfMoney,
|
|
37
|
+
SfMoneyCustom,
|
|
38
|
+
} from "./shared";
|
|
39
|
+
|
|
40
|
+
export * from "./cart";
|
|
41
|
+
export * from "./category";
|
|
42
|
+
export * from "./checkout";
|
|
43
|
+
export * from "./customer";
|
|
44
|
+
export * from "./facets";
|
|
45
|
+
export * from "./product";
|
|
46
|
+
export * from "./shared";
|
|
47
|
+
export * from "./order";
|
|
48
|
+
|
|
49
|
+
export interface SfContract {
|
|
50
|
+
SfCartLineItemCustom: SfCartLineItemCustom;
|
|
51
|
+
SfCartCouponCustom: SfCartCouponCustom;
|
|
52
|
+
SfCartCoupon: SfCartCoupon;
|
|
53
|
+
SfCart: SfCart;
|
|
54
|
+
SfCategoryCustom: SfCategoryCustom;
|
|
55
|
+
SfCategory: SfCategory;
|
|
56
|
+
SfShippingMethodCustom: SfShippingMethodCustom;
|
|
57
|
+
SfShippingMethod: SfShippingMethod;
|
|
58
|
+
SfShippingMethods: SfShippingMethods;
|
|
59
|
+
SfCustomerCustom: SfCustomerCustom;
|
|
60
|
+
SfCustomer: SfCustomer;
|
|
61
|
+
SfCustomerAddress: SfCustomerAddress;
|
|
62
|
+
SfFacetTypes: SfFacetTypes;
|
|
63
|
+
SfFacetType: SfFacetType;
|
|
64
|
+
SfFacetItem: SfFacetItem;
|
|
65
|
+
SfFacetCustom: SfFacetCustom;
|
|
66
|
+
SfFacet: SfFacet;
|
|
67
|
+
SfOrderLineItemCustom: SfOrderLineItemCustom;
|
|
68
|
+
SfOrderLineItem: SfOrderLineItem;
|
|
69
|
+
SfOrderCustom: SfOrderCustom;
|
|
70
|
+
SfOrder: SfOrder;
|
|
71
|
+
SfOrderListItemCustom: SfOrderListItemCustom;
|
|
72
|
+
SfOrderListItem: SfOrderListItem;
|
|
73
|
+
SfProductVariant: SfProductVariant;
|
|
74
|
+
SfProductReviewCustom: SfProductReviewCustom;
|
|
75
|
+
SfProductReview: SfProductReview;
|
|
76
|
+
SfProductCustom: SfProductCustom;
|
|
77
|
+
SfProduct: SfProduct;
|
|
78
|
+
SfProductCatalogItemCustom: SfProductCatalogItemCustom;
|
|
79
|
+
SfProductCatalogItem: SfProductCatalogItem;
|
|
80
|
+
SfPaginationCustom: SfPaginationCustom;
|
|
81
|
+
SfPagination: SfPagination;
|
|
82
|
+
SfMoneyCustom: SfMoneyCustom;
|
|
83
|
+
SfMoney: SfMoney;
|
|
84
|
+
SfDiscountablePriceCustom: SfDiscountablePriceCustom;
|
|
85
|
+
SfDiscountablePrice: SfDiscountablePrice;
|
|
86
|
+
SfImageCustom: SfImageCustom;
|
|
87
|
+
SfImage: SfImage;
|
|
88
|
+
SfAttributeCustom: SfAttributeCustom;
|
|
89
|
+
SfAttribute: SfAttribute;
|
|
90
|
+
SfCreateAddressBody: SfCreateAddressBody;
|
|
91
|
+
SfAddressCustom: SfAddressCustom;
|
|
92
|
+
SfAddress: SfAddress;
|
|
93
|
+
SfCurrency: SfCurrency;
|
|
94
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { InferCustom } from "../defs";
|
|
2
|
+
import type { SfShippingMethod } from "./checkout";
|
|
3
|
+
import type { Maybe, SfAddress, SfAttribute, SfId, SfImage, SfMoney } from "./shared";
|
|
4
|
+
|
|
5
|
+
export interface SfOrderLineItemCustom extends InferCustom<"normalizeOrderLineItem"> {}
|
|
6
|
+
|
|
7
|
+
export interface SfOrderLineItem {
|
|
8
|
+
id: SfId;
|
|
9
|
+
attributes: SfAttribute[];
|
|
10
|
+
unitPrice: SfMoney;
|
|
11
|
+
totalPrice: SfMoney;
|
|
12
|
+
quantity: number;
|
|
13
|
+
image: Maybe<SfImage>;
|
|
14
|
+
productId: SfId;
|
|
15
|
+
productName: string;
|
|
16
|
+
sku: Maybe<string>;
|
|
17
|
+
$custom?: SfOrderLineItemCustom;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface SfOrderCustom extends InferCustom<"normalizeOrder"> {}
|
|
21
|
+
|
|
22
|
+
export interface SfOrder {
|
|
23
|
+
id: SfId;
|
|
24
|
+
orderDate: string;
|
|
25
|
+
status: string;
|
|
26
|
+
lineItems: SfOrderLineItem[];
|
|
27
|
+
subtotalPrice: SfMoney;
|
|
28
|
+
totalShippingPrice: SfMoney;
|
|
29
|
+
totalTax: SfMoney;
|
|
30
|
+
totalPrice: SfMoney;
|
|
31
|
+
shippingAddress: SfAddress;
|
|
32
|
+
billingAddress: Maybe<SfAddress>;
|
|
33
|
+
shippingMethod: SfShippingMethod;
|
|
34
|
+
paymentMethod: string;
|
|
35
|
+
$custom?: SfOrderCustom;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface SfOrderListItemCustom extends InferCustom<"normalizeOrder"> {}
|
|
39
|
+
|
|
40
|
+
export interface SfOrderListItem
|
|
41
|
+
extends Pick<SfOrder, "id" | "orderDate" | "totalPrice" | "status"> {
|
|
42
|
+
$custom?: SfOrderListItemCustom;
|
|
43
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { InferCustom } from "../defs";
|
|
2
|
+
import type { Maybe, SfAttribute, SfDiscountablePrice, SfId, SfImage } from "./shared";
|
|
3
|
+
|
|
4
|
+
export interface SfProductVariant {
|
|
5
|
+
id: SfId;
|
|
6
|
+
slug: string;
|
|
7
|
+
sku: Maybe<string>;
|
|
8
|
+
name: Maybe<string>;
|
|
9
|
+
/*
|
|
10
|
+
* Maximum available quantity for variant, null if unlimited
|
|
11
|
+
*/
|
|
12
|
+
quantityLimit: Maybe<number>;
|
|
13
|
+
attributes: SfAttribute[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface SfProductReviewCustom extends InferCustom<"normalizeProductReview"> {}
|
|
17
|
+
|
|
18
|
+
export interface SfProductReview {
|
|
19
|
+
id: SfId;
|
|
20
|
+
title: Maybe<string>;
|
|
21
|
+
text: Maybe<string>;
|
|
22
|
+
rating: Maybe<number>;
|
|
23
|
+
/*
|
|
24
|
+
* Name of the reviewer (Full name or nickname)
|
|
25
|
+
*/
|
|
26
|
+
reviewer: Maybe<string>;
|
|
27
|
+
/*
|
|
28
|
+
* Creation date in ISO 8601 format
|
|
29
|
+
*/
|
|
30
|
+
createdAt: string;
|
|
31
|
+
$custom?: SfProductReviewCustom;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface SfProductCustom extends InferCustom<"normalizeProduct"> {}
|
|
35
|
+
|
|
36
|
+
export interface SfProduct {
|
|
37
|
+
id: SfId;
|
|
38
|
+
sku: Maybe<string>;
|
|
39
|
+
name: Maybe<string>;
|
|
40
|
+
slug: string;
|
|
41
|
+
description: Maybe<string>;
|
|
42
|
+
price: Maybe<SfDiscountablePrice>;
|
|
43
|
+
primaryImage: Maybe<SfImage>;
|
|
44
|
+
gallery: SfImage[];
|
|
45
|
+
rating: Maybe<{
|
|
46
|
+
average: number;
|
|
47
|
+
count: number;
|
|
48
|
+
}>;
|
|
49
|
+
variants: SfProductVariant[];
|
|
50
|
+
attributes: SfAttribute[];
|
|
51
|
+
/*
|
|
52
|
+
* Maximum available quantity for product, null if unlimited
|
|
53
|
+
*/
|
|
54
|
+
quantityLimit: Maybe<number>;
|
|
55
|
+
$custom?: SfProductCustom;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface SfProductCatalogItemCustom extends InferCustom<"normalizeProductCatalogItem"> {}
|
|
59
|
+
|
|
60
|
+
export interface SfProductCatalogItem
|
|
61
|
+
extends Omit<SfProduct, "variants" | "gallery" | "description" | "attributes"> {
|
|
62
|
+
$custom?: SfProductCatalogItemCustom;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface SfPaginationCustom extends InferCustom<"normalizePagination"> {}
|
|
66
|
+
|
|
67
|
+
export interface SfPagination {
|
|
68
|
+
currentPage: number;
|
|
69
|
+
pageSize: Maybe<number>;
|
|
70
|
+
totalResults: number;
|
|
71
|
+
totalPages: number;
|
|
72
|
+
$custom?: SfPaginationCustom;
|
|
73
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { InferCustom } from "../defs";
|
|
2
|
+
|
|
3
|
+
export type Maybe<TType> = TType | null;
|
|
4
|
+
|
|
5
|
+
export type SfId = string;
|
|
6
|
+
|
|
7
|
+
export interface SfMoneyCustom extends InferCustom<"normalizeMoney"> {}
|
|
8
|
+
|
|
9
|
+
export interface SfMoney {
|
|
10
|
+
currency: string;
|
|
11
|
+
amount: number;
|
|
12
|
+
precisionAmount: string;
|
|
13
|
+
$custom?: SfMoneyCustom;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface SfDiscountablePriceCustom extends InferCustom<"normalizeDiscountablePrice"> {}
|
|
17
|
+
|
|
18
|
+
export interface SfDiscountablePrice {
|
|
19
|
+
isDiscounted: boolean;
|
|
20
|
+
regularPrice: SfMoney;
|
|
21
|
+
/**
|
|
22
|
+
* Price with discounts. If there is no discount, it will be the same as regularPrice
|
|
23
|
+
*/
|
|
24
|
+
value: SfMoney;
|
|
25
|
+
$custom?: SfDiscountablePriceCustom;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface SfImageCustom extends InferCustom<"normalizeImage"> {}
|
|
29
|
+
|
|
30
|
+
export interface SfImage {
|
|
31
|
+
alt: Maybe<string>;
|
|
32
|
+
url: string;
|
|
33
|
+
$custom?: SfImageCustom;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface SfAttributeCustom extends InferCustom<"normalizeAttribute"> {}
|
|
37
|
+
|
|
38
|
+
export interface SfAttribute {
|
|
39
|
+
label: string;
|
|
40
|
+
name: string;
|
|
41
|
+
value: string;
|
|
42
|
+
valueLabel: string;
|
|
43
|
+
$custom?: SfAttributeCustom;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface SfCreateAddressBody {
|
|
47
|
+
address1: string;
|
|
48
|
+
address2?: Maybe<string>;
|
|
49
|
+
city: string;
|
|
50
|
+
country: string;
|
|
51
|
+
firstName: string;
|
|
52
|
+
lastName: string;
|
|
53
|
+
phoneNumber: string;
|
|
54
|
+
postalCode: string;
|
|
55
|
+
state: string;
|
|
56
|
+
titleCode: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface SfAddressCustom extends InferCustom<"normalizeAddress"> {}
|
|
60
|
+
|
|
61
|
+
export interface SfAddress {
|
|
62
|
+
address1: Maybe<string>;
|
|
63
|
+
address2?: Maybe<string>;
|
|
64
|
+
city: Maybe<string>;
|
|
65
|
+
country: Maybe<string>;
|
|
66
|
+
firstName: Maybe<string>;
|
|
67
|
+
lastName: Maybe<string>;
|
|
68
|
+
phoneNumber: Maybe<string>;
|
|
69
|
+
postalCode: Maybe<string>;
|
|
70
|
+
state: Maybe<string>;
|
|
71
|
+
titleCode: Maybe<string>;
|
|
72
|
+
$custom?: SfAddressCustom;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export type SfCurrency = string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ProductProvider } from "./types"
|
|
2
|
+
|
|
3
|
+
const providers: Record<string, ProductProvider> = {}
|
|
4
|
+
|
|
5
|
+
export function registerProductProvider(name: string, provider: ProductProvider) {
|
|
6
|
+
providers[name] = provider
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function getProductProvider(name: string) {
|
|
10
|
+
const provider = providers[name]
|
|
11
|
+
if (!provider) throw new Error(`Product provider "${name}" not found`)
|
|
12
|
+
return provider
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Runtime helper for adapter packages to register themselves when the
|
|
16
|
+
// app boots. Adapter packages can import this and call it from their
|
|
17
|
+
// plugin entry to wire into the commerce product provider registry.
|
|
18
|
+
export function registerProductProviderRuntime(name: string, provider: ProductProvider) {
|
|
19
|
+
registerProductProvider(name, provider)
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface Product {
|
|
2
|
+
id: string
|
|
3
|
+
title: string
|
|
4
|
+
description?: string
|
|
5
|
+
price: number
|
|
6
|
+
images: string[]
|
|
7
|
+
[key: string]: any
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ProductProvider {
|
|
11
|
+
getProduct(id: string): Promise<Product>
|
|
12
|
+
listProducts(params?: Record<string, any>): Promise<Product[]>
|
|
13
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getCommerceConfig } from '../config'
|
|
2
|
+
import { getProductProvider } from './registry'
|
|
3
|
+
|
|
4
|
+
export function useProducts() {
|
|
5
|
+
const { productProvider } = getCommerceConfig()
|
|
6
|
+
const provider = getProductProvider(productProvider)
|
|
7
|
+
|
|
8
|
+
return {
|
|
9
|
+
getProduct: provider.getProduct,
|
|
10
|
+
listProducts: provider.listProducts
|
|
11
|
+
}
|
|
12
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ProductProvider } from './products/types'
|
|
2
|
+
import type { CartProvider } from './cart/types'
|
|
3
|
+
import { registerProductProvider } from './products/registry'
|
|
4
|
+
import { registerCartProvider } from './cart/registry'
|
|
5
|
+
|
|
6
|
+
export interface CommerceProviderBundle {
|
|
7
|
+
product?: ProductProvider
|
|
8
|
+
cart?: CartProvider
|
|
9
|
+
// future: category?: CategoryProvider
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Register multiple domain providers at once from an adapter package.
|
|
13
|
+
// Example adapter entrypoint can call this during app boot.
|
|
14
|
+
export function registerCommerceProviderRuntime(name: string, bundle: CommerceProviderBundle) {
|
|
15
|
+
if (bundle.product) registerProductProvider(name, bundle.product)
|
|
16
|
+
if (bundle.cart) registerCartProvider(name, bundle.cart)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Also re-export individual runtime helpers for convenience
|
|
20
|
+
export { registerProductProviderRuntime } from './products/registry'
|
|
21
|
+
export { registerCartProviderRuntime } from './cart/registry'
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { ref, computed, readonly } from 'vue'
|
|
2
|
+
import type { Cart, CartItem, Product } from '../types'
|
|
3
|
+
import { useCart } from '../cart/useCart'
|
|
4
|
+
import { defineStore } from 'pinia'
|
|
5
|
+
|
|
6
|
+
export const useCartStore = defineStore('cart', () => {
|
|
7
|
+
const cart = ref<Cart | null>(null)
|
|
8
|
+
const loading = ref(false)
|
|
9
|
+
const error = ref<string | null>(null)
|
|
10
|
+
|
|
11
|
+
// Import cart composable
|
|
12
|
+
const {
|
|
13
|
+
fetchCart,
|
|
14
|
+
addToCart,
|
|
15
|
+
removeFromCart,
|
|
16
|
+
updateCartItem,
|
|
17
|
+
applyCoupon,
|
|
18
|
+
removeCoupon,
|
|
19
|
+
clearCart,
|
|
20
|
+
setShippingOption: setShippingOptionFn
|
|
21
|
+
,createCheckoutSession: createCheckoutSessionFn
|
|
22
|
+
} = useCart() as any
|
|
23
|
+
|
|
24
|
+
const initializeCart = async () => {
|
|
25
|
+
loading.value = true
|
|
26
|
+
error.value = null
|
|
27
|
+
try {
|
|
28
|
+
await fetchCart()
|
|
29
|
+
} catch (err: any) {
|
|
30
|
+
error.value = err.message
|
|
31
|
+
console.error('Error initializing cart:', err)
|
|
32
|
+
} finally {
|
|
33
|
+
loading.value = false
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const addProductToCart = async (productId: string, quantity: number = 1, variantId?: string) => {
|
|
38
|
+
loading.value = true
|
|
39
|
+
error.value = null
|
|
40
|
+
try {
|
|
41
|
+
await addToCart(productId, quantity, variantId)
|
|
42
|
+
} catch (err: any) {
|
|
43
|
+
error.value = err.message
|
|
44
|
+
console.error('Error adding product to cart:', err)
|
|
45
|
+
throw err
|
|
46
|
+
} finally {
|
|
47
|
+
loading.value = false
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const removeProductFromCart = async (itemId: string) => {
|
|
52
|
+
loading.value = true
|
|
53
|
+
error.value = null
|
|
54
|
+
try {
|
|
55
|
+
await removeFromCart(itemId)
|
|
56
|
+
} catch (err: any) {
|
|
57
|
+
error.value = err.message
|
|
58
|
+
console.error('Error removing product from cart:', err)
|
|
59
|
+
throw err
|
|
60
|
+
} finally {
|
|
61
|
+
loading.value = false
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const updateProductQuantity = async (itemId: string, quantity: number) => {
|
|
66
|
+
loading.value = true
|
|
67
|
+
error.value = null
|
|
68
|
+
try {
|
|
69
|
+
await updateCartItem(itemId, quantity)
|
|
70
|
+
} catch (err: any) {
|
|
71
|
+
error.value = err.message
|
|
72
|
+
console.error('Error updating cart item:', err)
|
|
73
|
+
throw err
|
|
74
|
+
} finally {
|
|
75
|
+
loading.value = false
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const applyCartCoupon = async (couponCode: string) => {
|
|
80
|
+
loading.value = true
|
|
81
|
+
error.value = null
|
|
82
|
+
try {
|
|
83
|
+
const success = await applyCoupon(couponCode)
|
|
84
|
+
if (!success) {
|
|
85
|
+
throw new Error('Failed to apply coupon')
|
|
86
|
+
}
|
|
87
|
+
} catch (err: any) {
|
|
88
|
+
error.value = err.message
|
|
89
|
+
console.error('Error applying coupon:', err)
|
|
90
|
+
throw err
|
|
91
|
+
} finally {
|
|
92
|
+
loading.value = false
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const removeCartCoupon = async () => {
|
|
97
|
+
loading.value = true
|
|
98
|
+
error.value = null
|
|
99
|
+
try {
|
|
100
|
+
await removeCoupon()
|
|
101
|
+
} catch (err: any) {
|
|
102
|
+
error.value = err.message
|
|
103
|
+
console.error('Error removing coupon:', err)
|
|
104
|
+
throw err
|
|
105
|
+
} finally {
|
|
106
|
+
loading.value = false
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const emptyCart = async () => {
|
|
111
|
+
loading.value = true
|
|
112
|
+
error.value = null
|
|
113
|
+
try {
|
|
114
|
+
await clearCart()
|
|
115
|
+
} catch (err: any) {
|
|
116
|
+
error.value = err.message
|
|
117
|
+
console.error('Error clearing cart:', err)
|
|
118
|
+
throw err
|
|
119
|
+
} finally {
|
|
120
|
+
loading.value = false
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const setShippingOption = async (option: any) => {
|
|
125
|
+
loading.value = true
|
|
126
|
+
error.value = null
|
|
127
|
+
try {
|
|
128
|
+
if (!setShippingOptionFn) throw new Error('Shipping setter unavailable')
|
|
129
|
+
await setShippingOptionFn(option)
|
|
130
|
+
} catch (err: any) {
|
|
131
|
+
error.value = err.message
|
|
132
|
+
console.error('Error setting shipping option:', err)
|
|
133
|
+
throw err
|
|
134
|
+
} finally {
|
|
135
|
+
loading.value = false
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const createCheckoutSession = async (cartId?: string) => {
|
|
140
|
+
loading.value = true
|
|
141
|
+
error.value = null
|
|
142
|
+
try {
|
|
143
|
+
const data = await createCheckoutSessionFn(cartId)
|
|
144
|
+
return data
|
|
145
|
+
} catch (err: any) {
|
|
146
|
+
error.value = err.message
|
|
147
|
+
throw err
|
|
148
|
+
} finally {
|
|
149
|
+
loading.value = false
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Computed properties
|
|
154
|
+
const itemCount = computed(() => {
|
|
155
|
+
return cart.value?.items?.reduce((count: any, item: { quantity: any }) => count + item.quantity, 0) || 0
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
const isEmpty = computed(() => {
|
|
159
|
+
return !cart.value?.items?.length
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
const hasItems = computed(() => {
|
|
163
|
+
return !isEmpty.value
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
const subtotal = computed(() => {
|
|
167
|
+
return cart.value?.subtotal || 0
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
const total = computed(() => {
|
|
171
|
+
return cart.value?.total || 0
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
const taxAmount = computed(() => {
|
|
175
|
+
return cart.value?.tax_amount || 0
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
const shippingAmount = computed(() => {
|
|
179
|
+
return cart.value?.shipping_amount || 0
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
const discountAmount = computed(() => {
|
|
183
|
+
return cart.value?.discount_amount || 0
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
const hasCoupon = computed(() => {
|
|
187
|
+
return !!cart.value?.coupon_code
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
return {
|
|
191
|
+
// State
|
|
192
|
+
cart: readonly(cart),
|
|
193
|
+
loading: readonly(loading),
|
|
194
|
+
error: readonly(error),
|
|
195
|
+
|
|
196
|
+
// Computed
|
|
197
|
+
itemCount,
|
|
198
|
+
isEmpty,
|
|
199
|
+
hasItems,
|
|
200
|
+
subtotal,
|
|
201
|
+
total,
|
|
202
|
+
taxAmount,
|
|
203
|
+
shippingAmount,
|
|
204
|
+
discountAmount,
|
|
205
|
+
hasCoupon,
|
|
206
|
+
|
|
207
|
+
// Actions
|
|
208
|
+
initializeCart,
|
|
209
|
+
addProductToCart,
|
|
210
|
+
removeProductFromCart,
|
|
211
|
+
updateProductQuantity,
|
|
212
|
+
applyCartCoupon,
|
|
213
|
+
removeCartCoupon,
|
|
214
|
+
emptyCart
|
|
215
|
+
,setShippingOption
|
|
216
|
+
,createCheckoutSession
|
|
217
|
+
}
|
|
218
|
+
})
|