@meeovi/layer-commerce 1.0.5 → 1.0.7
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/package.json +11 -12
- package/app/components/catalog/product/ProductAccordion/ProductAccordion.vue +0 -39
- package/app/components/catalog/product/ProductAccordion/__tests__/ProductAccordion.spec.ts +0 -15
- package/app/components/catalog/product/ProductAccordion/types.ts +0 -5
- package/app/components/catalog/product/ProductProperties/ProductProperties.vue +0 -50
- package/app/components/catalog/product/ProductProperties/__tests__/ProductProperties.spec.ts +0 -15
- package/app/components/catalog/product/ProductProperties/types.ts +0 -5
- package/app/components/catalog/product/ProductSlider/ProductSlider.vue +0 -28
- package/app/components/catalog/product/ProductSlider/__tests__/ProductSlider.spec.ts +0 -14
- package/app/components/catalog/product/ProductSlider/types.ts +0 -7
- package/app/components/catalog/product/RecommendedProducts/RecommendedProducts.vue +0 -12
- package/app/components/catalog/product/RecommendedProducts/types.ts +0 -5
- package/app/components/catalog/product/RenderContentProductSlider/RenderContentProductSlider.vue +0 -11
- package/app/components/catalog/product/add-attribute.vue +0 -54
- package/app/components/catalog/product/add-product-type.vue +0 -54
- package/app/components/catalog/product/add-product.vue +0 -53
- package/app/components/catalog/product/add-showcase.vue +0 -52
- package/app/components/catalog/product/add-station.vue +0 -54
- package/app/components/catalog/product/bestsellers.vue +0 -57
- package/app/components/catalog/product/bidding.vue +0 -93
- package/app/components/catalog/product/colorOptions.vue +0 -58
- package/app/components/catalog/product/deals.vue +0 -46
- package/app/components/catalog/product/exclusives.vue +0 -56
- package/app/components/catalog/product/featuredproducts.vue +0 -57
- package/app/components/catalog/product/giftCard.vue +0 -63
- package/app/components/catalog/product/latestproducts.vue +0 -46
- package/app/components/catalog/product/productCard.vue +0 -105
- package/app/components/catalog/product/productCompare.vue +0 -60
- package/app/components/catalog/product/productCompareTable.vue +0 -441
- package/app/components/catalog/product/productDetails.vue +0 -126
- package/app/components/catalog/product/productFaqs.vue +0 -17
- package/app/components/catalog/product/productGallery.vue +0 -16
- package/app/components/catalog/product/productQty.vue +0 -54
- package/app/components/catalog/product/productReviews.vue +0 -56
- package/app/components/catalog/product/productSpecs.vue +0 -116
- package/app/components/catalog/product/radiostation.vue +0 -36
- package/app/components/catalog/product/recentlyviewed.vue +0 -43
- package/app/components/catalog/product/relatedbrands.vue +0 -54
- package/app/components/catalog/product/relatedproducts.vue +0 -43
- package/app/components/catalog/product/relatedstations.vue +0 -40
- package/app/components/catalog/product/shippingOptions.vue +0 -41
- package/app/components/catalog/product/sizeOptions.vue +0 -42
- package/app/components/catalog/product/update-attribute-set.vue +0 -209
- package/app/components/catalog/product/update-attribute.vue +0 -118
- package/app/components/catalog/product/update-product.vue +0 -372
- package/app/components/catalog/product/update-showcase.vue +0 -153
- package/app/components/catalog/shops/relatedstores.vue +0 -37
- package/app/components/catalog/shops/restaurant.vue +0 -66
- package/app/components/catalog/shops/stores.vue +0 -44
- package/app/components/catalog/vendor/README.md +0 -3
- package/app/components/catalog/vendor/blocks/biggestcustomers.vue +0 -33
- package/app/components/catalog/vendor/blocks/lowestselling.vue +0 -33
- package/app/components/catalog/vendor/blocks/topcategories.vue +0 -33
- package/app/components/catalog/vendor/blocks/topproducts.vue +0 -27
- package/app/components/catalog/vendor/pages/attributes.vue +0 -43
- package/app/components/catalog/vendor/pages/commissions.vue +0 -43
- package/app/components/catalog/vendor/pages/crm.vue +0 -67
- package/app/components/catalog/vendor/pages/dashboard.vue +0 -46
- package/app/components/catalog/vendor/pages/emails.vue +0 -43
- package/app/components/catalog/vendor/pages/enquiries.vue +0 -43
- package/app/components/catalog/vendor/pages/invoices.vue +0 -43
- package/app/components/catalog/vendor/pages/orders.vue +0 -68
- package/app/components/catalog/vendor/pages/products.vue +0 -55
- package/app/components/catalog/vendor/pages/reviews.vue +0 -48
- package/app/components/catalog/vendor/pages/shipments.vue +0 -43
- package/app/components/catalog/vendor/pages/stores.vue +0 -43
- package/app/components/categories/chart/[id].vue +0 -200
- package/app/components/categories/chart/add-chart.vue +0 -142
- package/app/components/categories/chart/chart.vue +0 -82
- package/app/components/categories/chart/monthlyChart.vue +0 -46
- package/app/components/categories/chart/weeklyChart.vue +0 -46
- package/app/components/categories/chart/yearlyChart.vue +0 -46
- package/app/components/categories/charts.vue +0 -118
- package/app/components/categories/deals.vue +0 -101
- package/app/components/categories/eats.vue +0 -49
- package/app/components/categories/restaurants.vue +0 -26
- package/app/components/categories/station/[id].vue +0 -72
- package/app/components/categories/stations.vue +0 -124
- package/app/components/categories/time/time.vue +0 -63
- package/app/components/categories/travel.vue +0 -75
- package/app/components/categories/weather/weather.vue +0 -44
- 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 +0 -9
- package/app/components/content/pages/checkout.vue +0 -118
- package/app/components/content/pages/meeoviGlobal.vue +0 -68
- package/app/components/content/pages/pickup-locations.vue +0 -238
- package/app/components/content/pages/showcases.vue +0 -90
- package/app/components/content/pages/success.vue +0 -60
- package/app/components/marketing/add-brand.vue +0 -54
- package/app/components/marketing/add-incentive.vue +0 -54
- package/app/components/marketing/promotions/giftcards.vue +0 -102
- package/app/components/marketing/promotions/subscriptions.vue +0 -121
- package/app/components/marketing/update-incentive.vue +0 -326
- package/app/components/menus/lowernav.vue +0 -78
- package/app/components/partials/LocaleSelector.vue +0 -24
- package/app/components/partials/ShoppingCart.vue +0 -128
- package/app/components/partials/StripePayment.vue +0 -149
- package/app/components/partials/addToCartBtn.vue +0 -40
- package/app/components/partials/cartItem.vue +0 -124
- package/app/components/partials/checkoutButton.vue +0 -44
- package/app/components/partials/compareBtn.vue +0 -68
- package/app/components/partials/ratings.vue +0 -13
- package/app/components/partials/store/CurrencySelector.vue +0 -133
- package/app/components/partials/store/StoreSwitcher.vue +0 -13
- package/app/components/placeholders/Comments.vue +0 -15
- package/app/components/placeholders/CreateListBtn.vue +0 -7
- package/app/components/placeholders/Event.vue +0 -9
- package/app/components/placeholders/ListShowcases.vue +0 -9
- package/app/components/placeholders/Short.vue +0 -9
- package/app/components/placeholders/Space.vue +0 -9
- package/app/components/placeholders/Tag.vue +0 -7
- package/app/components/related/brandCard.vue +0 -41
- package/app/components/related/incentiveCard.vue +0 -44
- package/app/components/related/invoiceCard.vue +0 -43
- package/app/components/related/orderCard.vue +0 -43
- package/app/components/related/relatedproducts.vue +0 -17
- package/app/components/sales/CartPageContent/CartPageContent.vue +0 -37
- package/app/components/sales/CheckoutAddress/CheckoutAddress.vue +0 -50
- package/app/components/sales/CheckoutAddress/__tests__/CheckoutAddress.spec.ts +0 -16
- package/app/components/sales/CheckoutAddress/types.ts +0 -16
- package/app/components/sales/CheckoutPayment/CheckoutPayment.vue +0 -68
- package/app/components/sales/CheckoutPayment/__tests__/CheckoutPayment.spec.ts +0 -14
- package/app/components/sales/CheckoutPayment/types.ts +0 -12
- package/app/components/sales/OrderSummary/OrderSummary.vue +0 -57
- package/app/components/sales/OrderSummary/__tests__/ContactInformation.spec.ts +0 -52
- package/app/components/sales/OrderSummary/types.ts +0 -5
- package/app/components/sales/incentives.vue +0 -223
- package/app/components/sales/invoices.vue +0 -107
- package/app/components/sales/orders.vue +0 -378
- package/app/components/sales/shipments.vue +0 -65
- package/app/components/sales/transactions.vue +0 -109
- package/app/components/shop/add-shop.vue +0 -54
- package/app/components/shop/cart/cartItem.vue +0 -182
- package/app/components/shop/cart/checkout.vue +0 -415
- package/app/components/shop/checkout/StripeCardElement.vue +0 -206
- package/app/components/shop/checkout/StripeCheckout.vue +0 -49
- package/app/components/shop/checkout/addressBilling.vue +0 -263
- package/app/components/shop/checkout/addressShipping.vue +0 -175
- package/app/components/shop/checkout/cart/ProductItem.vue +0 -56
- package/app/components/shop/checkout/cart/PromotionItem.vue +0 -53
- package/app/composables/_types.ts +0 -18
- 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 +0 -7
- package/app/composables/cart/registry.ts +0 -20
- package/app/composables/cart/types.ts +0 -18
- package/app/composables/cart/useCart.ts +0 -15
- package/app/composables/config.ts +0 -19
- package/app/composables/defs/apiDefinitions.ts +0 -55
- package/app/composables/defs/extension.feature +0 -40
- package/app/composables/defs/extension.mocks.ts +0 -39
- package/app/composables/defs/extension.test.ts +0 -280
- package/app/composables/defs/extension.ts +0 -236
- package/app/composables/defs/index.ts +0 -3
- package/app/composables/defs/types.ts +0 -136
- 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 +0 -8
- package/app/composables/domain/reward.ts +0 -0
- package/app/composables/domain/transactions.ts +0 -0
- package/app/composables/helpers/contextualizedNormalizers.feature +0 -14
- package/app/composables/helpers/contextualizedNormalizers.test.ts +0 -85
- package/app/composables/helpers/contextualizedNormalizers.ts +0 -20
- package/app/composables/helpers/index.ts +0 -1
- package/app/composables/index.ts +0 -6
- package/app/composables/methods/auth.ts +0 -83
- package/app/composables/methods/cart.ts +0 -119
- package/app/composables/methods/category.ts +0 -27
- package/app/composables/methods/checkout.ts +0 -54
- package/app/composables/methods/customer.ts +0 -52
- package/app/composables/methods/helpers.ts +0 -5
- package/app/composables/methods/index.ts +0 -75
- package/app/composables/methods/order.ts +0 -39
- package/app/composables/methods/product.ts +0 -95
- package/app/composables/methods/settings.ts +0 -16
- package/app/composables/models/cart.ts +0 -95
- package/app/composables/models/category.ts +0 -13
- package/app/composables/models/checkout.ts +0 -17
- package/app/composables/models/customer.ts +0 -16
- package/app/composables/models/facets.ts +0 -25
- package/app/composables/models/index.ts +0 -94
- package/app/composables/models/order.ts +0 -43
- package/app/composables/models/product.ts +0 -73
- package/app/composables/models/shared.ts +0 -75
- package/app/composables/products/registry.ts +0 -20
- package/app/composables/products/types.ts +0 -13
- package/app/composables/products/useEvents.ts +0 -0
- package/app/composables/products/useGiftCards.ts +0 -0
- package/app/composables/products/useProducts.ts +0 -12
- package/app/composables/products/useSubscriptions.ts +0 -0
- package/app/composables/registry.ts +0 -21
- package/app/composables/stores/cart.ts +0 -218
- package/app/composables/stores/cartStore.ts +0 -300
- package/app/composables/stores/checkout.ts +0 -19
- package/app/composables/stores/compare.ts +0 -65
- package/app/composables/stores/currency.js +0 -29
- package/app/composables/stores/digital-products.js +0 -11
- package/app/composables/stores/index.js +0 -0
- package/app/composables/stores/orders.ts +0 -161
- package/app/composables/stores/product.ts +0 -26
- package/app/composables/stores/productList.ts +0 -0
- package/app/composables/stores/productListInfo.ts +0 -0
- package/app/composables/stores/products.ts +0 -112
- package/app/composables/stores/recentlyViewedProducts.ts +0 -0
- package/app/composables/stores/review.ts +0 -25
- package/app/composables/stores/storeInPickUp.ts +0 -22
- package/app/composables/stores/user.ts +0 -20
- package/app/composables/stores/wishlist.ts +0 -19
- package/app/composables/types/Order.type.ts +0 -181
- package/app/composables/types/index.ts +0 -285
- package/app/composables/types/product.ts +0 -14
- package/app/composables/useBreakpoints/index.ts +0 -1
- package/app/composables/useBreakpoints/useBreakpoints.ts +0 -28
- package/app/composables/useCart/__tests__/useCart.spec.ts +0 -11
- package/app/composables/useCart/index.ts +0 -1
- package/app/composables/useCart/types.ts +0 -17
- package/app/composables/useCart/useCart.ts +0 -46
- package/app/composables/useCartShippingMethods/__tests__/useCartShippingMethods.spec.ts +0 -11
- package/app/composables/useCartShippingMethods/index.ts +0 -1
- package/app/composables/useCartShippingMethods/types.ts +0 -17
- package/app/composables/useCartShippingMethods/useCartShippingMethods.ts +0 -47
- package/app/composables/useCatalog.ts +0 -64
- package/app/composables/useContent/index.ts +0 -1
- package/app/composables/useContent/types.ts +0 -44
- package/app/composables/useContent/useContent.ts +0 -45
- package/app/composables/useContent.ts +0 -57
- package/app/composables/useCustomer/__tests__/useCustomer.spec.ts +0 -25
- package/app/composables/useCustomer/index.ts +0 -2
- package/app/composables/useCustomer/types.ts +0 -17
- package/app/composables/useCustomer/useCustomer.ts +0 -40
- package/app/composables/useCustomerAddress/__tests__/useCustomerAddress.spec.ts +0 -11
- package/app/composables/useCustomerAddress/index.ts +0 -2
- package/app/composables/useCustomerAddress/types.ts +0 -17
- package/app/composables/useCustomerAddress/useCustomerAddress.ts +0 -55
- package/app/composables/useCustomerOrder/__tests__/useCustomerOrder.spec.ts +0 -11
- package/app/composables/useCustomerOrder/adress.ts +0 -10
- package/app/composables/useCustomerOrder/index.ts +0 -2
- package/app/composables/useCustomerOrder/product.ts +0 -37
- package/app/composables/useCustomerOrder/types.ts +0 -40
- package/app/composables/useCustomerOrder/useCustomerOrder.ts +0 -63
- package/app/composables/useCustomerOrders/__tests__/useCustomerOrders.spec.ts +0 -11
- package/app/composables/useCustomerOrders/index.ts +0 -2
- package/app/composables/useCustomerOrders/types.ts +0 -20
- package/app/composables/useCustomerOrders/useCustomerOrders.ts +0 -56
- package/app/composables/useCustomerReturns/__tests__/useCustomerReturns.spec.ts +0 -11
- package/app/composables/useCustomerReturns/index.ts +0 -2
- package/app/composables/useCustomerReturns/types.ts +0 -17
- package/app/composables/useCustomerReturns/useCustomerReturns.ts +0 -41
- package/app/composables/useHandleError/index.ts +0 -1
- package/app/composables/useHandleError/types.ts +0 -11
- package/app/composables/useHandleError/useHandleError.ts +0 -27
- package/app/composables/usePageTitle.ts +0 -16
- package/app/composables/useProduct/index.ts +0 -2
- package/app/composables/useProduct/types.ts +0 -17
- package/app/composables/useProduct/useProduct.ts +0 -42
- package/app/composables/useProductAttribute/__tests__/useProduct.mock.ts +0 -31
- package/app/composables/useProductAttribute/__tests__/useProductAttribute.spec.ts +0 -14
- package/app/composables/useProductAttribute/index.ts +0 -1
- package/app/composables/useProductAttribute/useProductAttribute.ts +0 -37
- package/app/composables/useProductRecommended/__tests__/useProductRecommended.spec.ts +0 -12
- package/app/composables/useProductRecommended/index.ts +0 -1
- package/app/composables/useProductRecommended/types.ts +0 -17
- package/app/composables/useProductRecommended/useProductRecommended.ts +0 -43
- package/app/composables/useProductReviews/__tests__/productReviews.mock.ts +0 -20
- package/app/composables/useProductReviews/__tests__/useProductReviews.spec.ts +0 -22
- package/app/composables/useProductReviews/index.ts +0 -2
- package/app/composables/useProductReviews/types.ts +0 -17
- package/app/composables/useProductReviews/useProductReviews.ts +0 -46
- package/app/composables/useProducts/__tests__/useProducts.spec.ts +0 -11
- package/app/composables/useProducts/types.ts +0 -22
- package/app/composables/useProducts/useProducts.ts +0 -41
- package/app/composables/utils/countryList.ts +0 -14
- package/app/composables/utils/currency.js +0 -56
- 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 +0 -16
- package/app/composables/utils/taxation.ts +0 -0
- package/app/composables/utils/tellFriends.ts +0 -0
- package/app/composables/validationRules/index.ts +0 -1
- package/app/composables/validationRules/password.feature +0 -67
- package/app/composables/validationRules/password.test.ts +0 -89
- package/app/composables/validationRules/password.ts +0 -25
- 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 +0 -3
- package/app/pages/brand/[...slug].vue +0 -92
- package/app/pages/brands.vue +0 -90
- package/app/pages/cart.vue +0 -142
- package/app/pages/compare.vue +0 -166
- package/app/pages/departments/[...slug].vue +0 -385
- package/app/pages/departments/category/[...slug].vue +0 -135
- package/app/pages/incentive/[...id].vue +0 -66
- package/app/pages/invoice/[id].vue +0 -309
- package/app/pages/order/[id].vue +0 -327
- package/app/pages/product/[...id].vue +0 -309
- package/app/pages/product/showcases/index.vue +0 -86
- package/app/pages/shipment/[...id].vue +0 -176
- package/app/pages/shop/[...slug].vue +0 -158
- package/app/pages/shops.vue +0 -76
- package/app/pages/subscription/[...id].vue +0 -147
- package/app/pages/transaction/[...id].vue +0 -74
- package/app/types/shims-imports.d.ts +0 -13
- package/app/utils/client.ts +0 -26
- package/app/utils/index.ts +0 -53
- package/app/utils/normalizer.ts +0 -23
- package/app/utils/normalizers/magento.ts +0 -29
- package/app/utils/normalizers/shopify.ts +0 -29
- package/dist/app/composables/cart/registry.d.ts +0 -3
- package/dist/app/composables/cart/registry.js +0 -10
- package/dist/app/composables/cart/types.d.ts +0 -16
- package/dist/app/composables/cart/types.js +0 -1
- package/dist/app/composables/cart/useCart.d.ts +0 -6
- package/dist/app/composables/cart/useCart.js +0 -13
- package/dist/app/composables/config.d.ts +0 -7
- package/dist/app/composables/config.js +0 -11
- package/dist/app/composables/products/registry.d.ts +0 -3
- package/dist/app/composables/products/registry.js +0 -10
- package/dist/app/composables/products/types.d.ts +0 -12
- package/dist/app/composables/products/types.js +0 -1
- package/dist/app/composables/products/useProducts.d.ts +0 -4
- package/dist/app/composables/products/useProducts.js +0 -10
- package/dist/app/utils/client.d.ts +0 -6
- package/dist/app/utils/client.js +0 -23
- package/dist/app/utils/normalizer.d.ts +0 -12
- package/dist/app/utils/normalizer.js +0 -13
- package/dist/app/utils/normalizers/magento.d.ts +0 -3
- package/dist/app/utils/normalizers/magento.js +0 -23
- package/dist/app/utils/normalizers/shopify.d.ts +0 -3
- package/dist/app/utils/normalizers/shopify.js +0 -24
- package/dist/client.d.ts +0 -6
- package/dist/client.js +0 -23
- package/dist/components/catalog/product/ProductAccordion/types.d.ts +0 -4
- package/dist/components/catalog/product/ProductAccordion/types.js +0 -1
- package/dist/components/catalog/product/ProductProperties/types.d.ts +0 -4
- package/dist/components/catalog/product/ProductProperties/types.js +0 -1
- package/dist/components/catalog/product/ProductSlider/types.d.ts +0 -6
- package/dist/components/catalog/product/ProductSlider/types.js +0 -1
- package/dist/components/catalog/product/RecommendedProducts/types.d.ts +0 -4
- package/dist/components/catalog/product/RecommendedProducts/types.js +0 -1
- package/dist/components/sales/CheckoutAddress/types.d.ts +0 -14
- package/dist/components/sales/CheckoutAddress/types.js +0 -1
- package/dist/components/sales/CheckoutPayment/types.d.ts +0 -10
- package/dist/components/sales/CheckoutPayment/types.js +0 -7
- package/dist/components/sales/OrderSummary/types.d.ts +0 -4
- package/dist/components/sales/OrderSummary/types.js +0 -1
- package/dist/composables/_types.d.ts +0 -11
- package/dist/composables/_types.js +0 -1
- package/dist/composables/adapters/abstract/cartAdapter.d.ts +0 -0
- package/dist/composables/adapters/abstract/cartAdapter.js +0 -0
- package/dist/composables/adapters/abstract/categoryAdapter.d.ts +0 -0
- package/dist/composables/adapters/abstract/categoryAdapter.js +0 -0
- package/dist/composables/adapters/abstract/customerAdapter.d.ts +0 -0
- package/dist/composables/adapters/abstract/customerAdapter.js +0 -0
- package/dist/composables/adapters/abstract/inventoryAdapter.d.ts +0 -0
- package/dist/composables/adapters/abstract/inventoryAdapter.js +0 -0
- package/dist/composables/adapters/abstract/orderAdapter.d.ts +0 -0
- package/dist/composables/adapters/abstract/orderAdapter.js +0 -0
- package/dist/composables/adapters/abstract/productAdapter.d.ts +0 -6
- package/dist/composables/adapters/abstract/productAdapter.js +0 -1
- package/dist/composables/cart/registry.d.ts +0 -4
- package/dist/composables/cart/registry.js +0 -16
- package/dist/composables/cart/types.d.ts +0 -16
- package/dist/composables/cart/types.js +0 -1
- package/dist/composables/cart/useCart.d.ts +0 -6
- package/dist/composables/cart/useCart.js +0 -13
- package/dist/composables/config.d.ts +0 -7
- package/dist/composables/config.js +0 -11
- package/dist/composables/defs/apiDefinitions.d.ts +0 -7
- package/dist/composables/defs/apiDefinitions.js +0 -39
- package/dist/composables/defs/extension.d.ts +0 -91
- package/dist/composables/defs/extension.js +0 -154
- package/dist/composables/defs/extension.mocks.d.ts +0 -30
- package/dist/composables/defs/extension.mocks.js +0 -23
- package/dist/composables/defs/extension.test.d.ts +0 -1
- package/dist/composables/defs/extension.test.js +0 -233
- package/dist/composables/defs/index.d.ts +0 -3
- package/dist/composables/defs/index.js +0 -3
- package/dist/composables/defs/types.d.ts +0 -81
- package/dist/composables/defs/types.js +0 -1
- package/dist/composables/domain/cart.d.ts +0 -0
- package/dist/composables/domain/cart.js +0 -0
- package/dist/composables/domain/category.d.ts +0 -0
- package/dist/composables/domain/category.js +0 -0
- package/dist/composables/domain/order.d.ts +0 -0
- package/dist/composables/domain/order.js +0 -0
- package/dist/composables/domain/price.d.ts +0 -0
- package/dist/composables/domain/price.js +0 -0
- package/dist/composables/domain/product.d.ts +0 -8
- package/dist/composables/domain/product.js +0 -1
- package/dist/composables/domain/reward.d.ts +0 -0
- package/dist/composables/domain/reward.js +0 -0
- package/dist/composables/domain/transactions.d.ts +0 -0
- package/dist/composables/domain/transactions.js +0 -0
- package/dist/composables/helpers/contextualizedNormalizers.d.ts +0 -5
- package/dist/composables/helpers/contextualizedNormalizers.js +0 -6
- package/dist/composables/helpers/contextualizedNormalizers.test.d.ts +0 -1
- package/dist/composables/helpers/contextualizedNormalizers.test.js +0 -62
- package/dist/composables/helpers/index.d.ts +0 -1
- package/dist/composables/helpers/index.js +0 -1
- package/dist/composables/index.d.ts +0 -6
- package/dist/composables/index.js +0 -6
- package/dist/composables/methods/auth.d.ts +0 -62
- package/dist/composables/methods/auth.js +0 -1
- package/dist/composables/methods/cart.d.ts +0 -101
- package/dist/composables/methods/cart.js +0 -1
- package/dist/composables/methods/category.d.ts +0 -22
- package/dist/composables/methods/category.js +0 -1
- package/dist/composables/methods/checkout.d.ts +0 -42
- package/dist/composables/methods/checkout.js +0 -1
- package/dist/composables/methods/customer.d.ts +0 -39
- package/dist/composables/methods/customer.js +0 -1
- package/dist/composables/methods/helpers.d.ts +0 -2
- package/dist/composables/methods/helpers.js +0 -3
- package/dist/composables/methods/index.d.ts +0 -49
- package/dist/composables/methods/index.js +0 -9
- package/dist/composables/methods/order.d.ts +0 -29
- package/dist/composables/methods/order.js +0 -1
- package/dist/composables/methods/product.d.ts +0 -71
- package/dist/composables/methods/product.js +0 -1
- package/dist/composables/methods/settings.d.ts +0 -12
- package/dist/composables/methods/settings.js +0 -1
- package/dist/composables/models/cart.d.ts +0 -84
- package/dist/composables/models/cart.js +0 -1
- package/dist/composables/models/category.d.ts +0 -12
- package/dist/composables/models/category.js +0 -1
- package/dist/composables/models/checkout.d.ts +0 -15
- package/dist/composables/models/checkout.js +0 -1
- package/dist/composables/models/customer.d.ts +0 -14
- package/dist/composables/models/customer.js +0 -1
- package/dist/composables/models/facets.d.ts +0 -21
- package/dist/composables/models/facets.js +0 -5
- package/dist/composables/models/index.d.ts +0 -62
- package/dist/composables/models/index.js +0 -8
- package/dist/composables/models/order.d.ts +0 -39
- package/dist/composables/models/order.js +0 -1
- package/dist/composables/models/product.d.ts +0 -55
- package/dist/composables/models/product.js +0 -1
- package/dist/composables/models/shared.d.ts +0 -66
- package/dist/composables/models/shared.js +0 -1
- package/dist/composables/products/registry.d.ts +0 -4
- package/dist/composables/products/registry.js +0 -16
- package/dist/composables/products/types.d.ts +0 -12
- package/dist/composables/products/types.js +0 -1
- package/dist/composables/products/useEvents.d.ts +0 -0
- package/dist/composables/products/useEvents.js +0 -0
- package/dist/composables/products/useGiftCards.d.ts +0 -0
- package/dist/composables/products/useGiftCards.js +0 -0
- package/dist/composables/products/useProducts.d.ts +0 -4
- package/dist/composables/products/useProducts.js +0 -10
- package/dist/composables/products/useSubscriptions.d.ts +0 -0
- package/dist/composables/products/useSubscriptions.js +0 -0
- package/dist/composables/registry.d.ts +0 -9
- package/dist/composables/registry.js +0 -13
- package/dist/composables/stores/cart.d.ts +0 -1
- package/dist/composables/stores/cart.js +0 -203
- package/dist/composables/stores/cartStore.d.ts +0 -1
- package/dist/composables/stores/cartStore.js +0 -246
- package/dist/composables/stores/checkout.d.ts +0 -1
- package/dist/composables/stores/checkout.js +0 -17
- package/dist/composables/stores/compare.d.ts +0 -1
- package/dist/composables/stores/compare.js +0 -50
- package/dist/composables/stores/orders.d.ts +0 -1
- package/dist/composables/stores/orders.js +0 -156
- package/dist/composables/stores/product.d.ts +0 -1
- package/dist/composables/stores/product.js +0 -26
- package/dist/composables/stores/productList.d.ts +0 -0
- package/dist/composables/stores/productList.js +0 -0
- package/dist/composables/stores/productListInfo.d.ts +0 -0
- package/dist/composables/stores/productListInfo.js +0 -0
- package/dist/composables/stores/products.d.ts +0 -1
- package/dist/composables/stores/products.js +0 -106
- package/dist/composables/stores/recentlyViewedProducts.d.ts +0 -0
- package/dist/composables/stores/recentlyViewedProducts.js +0 -0
- package/dist/composables/stores/review.d.ts +0 -1
- package/dist/composables/stores/review.js +0 -25
- package/dist/composables/stores/storeInPickUp.d.ts +0 -1
- package/dist/composables/stores/storeInPickUp.js +0 -21
- package/dist/composables/stores/user.d.ts +0 -1
- package/dist/composables/stores/user.js +0 -16
- package/dist/composables/stores/wishlist.d.ts +0 -1
- package/dist/composables/stores/wishlist.js +0 -17
- package/dist/composables/types/Order.type.d.ts +0 -141
- package/dist/composables/types/Order.type.js +0 -1
- package/dist/composables/types/index.d.ts +0 -265
- package/dist/composables/types/index.js +0 -3
- package/dist/composables/types/product.d.ts +0 -13
- package/dist/composables/types/product.js +0 -1
- package/dist/composables/useBreakpoints/index.d.ts +0 -1
- package/dist/composables/useBreakpoints/index.js +0 -1
- package/dist/composables/useBreakpoints/useBreakpoints.d.ts +0 -10
- package/dist/composables/useBreakpoints/useBreakpoints.js +0 -24
- package/dist/composables/useCart/index.d.ts +0 -1
- package/dist/composables/useCart/index.js +0 -1
- package/dist/composables/useCart/types.d.ts +0 -13
- package/dist/composables/useCart/types.js +0 -1
- package/dist/composables/useCart/useCart.d.ts +0 -8
- package/dist/composables/useCart/useCart.js +0 -43
- package/dist/composables/useCartShippingMethods/index.d.ts +0 -1
- package/dist/composables/useCartShippingMethods/index.js +0 -1
- package/dist/composables/useCartShippingMethods/types.d.ts +0 -13
- package/dist/composables/useCartShippingMethods/types.js +0 -1
- package/dist/composables/useCartShippingMethods/useCartShippingMethods.d.ts +0 -7
- package/dist/composables/useCartShippingMethods/useCartShippingMethods.js +0 -35
- package/dist/composables/useCatalog.d.ts +0 -13
- package/dist/composables/useCatalog.js +0 -61
- package/dist/composables/useContent/index.d.ts +0 -1
- package/dist/composables/useContent/index.js +0 -1
- package/dist/composables/useContent/types.d.ts +0 -32
- package/dist/composables/useContent/types.js +0 -1
- package/dist/composables/useContent/useContent.d.ts +0 -9
- package/dist/composables/useContent/useContent.js +0 -43
- package/dist/composables/useContent.d.ts +0 -14
- package/dist/composables/useContent.js +0 -55
- package/dist/composables/useCustomer/index.d.ts +0 -2
- package/dist/composables/useCustomer/index.js +0 -2
- package/dist/composables/useCustomer/types.d.ts +0 -13
- package/dist/composables/useCustomer/types.js +0 -1
- package/dist/composables/useCustomer/useCustomer.d.ts +0 -8
- package/dist/composables/useCustomer/useCustomer.js +0 -34
- package/dist/composables/useCustomerAddress/index.d.ts +0 -2
- package/dist/composables/useCustomerAddress/index.js +0 -2
- package/dist/composables/useCustomerAddress/types.d.ts +0 -13
- package/dist/composables/useCustomerAddress/types.js +0 -1
- package/dist/composables/useCustomerAddress/useCustomerAddress.d.ts +0 -8
- package/dist/composables/useCustomerAddress/useCustomerAddress.js +0 -43
- package/dist/composables/useCustomerOrder/adress.d.ts +0 -11
- package/dist/composables/useCustomerOrder/adress.js +0 -10
- package/dist/composables/useCustomerOrder/index.d.ts +0 -2
- package/dist/composables/useCustomerOrder/index.js +0 -2
- package/dist/composables/useCustomerOrder/product.d.ts +0 -28
- package/dist/composables/useCustomerOrder/product.js +0 -37
- package/dist/composables/useCustomerOrder/types.d.ts +0 -32
- package/dist/composables/useCustomerOrder/types.js +0 -1
- package/dist/composables/useCustomerOrder/useCustomerOrder.d.ts +0 -8
- package/dist/composables/useCustomerOrder/useCustomerOrder.js +0 -52
- package/dist/composables/useCustomerOrders/index.d.ts +0 -2
- package/dist/composables/useCustomerOrders/index.js +0 -2
- package/dist/composables/useCustomerOrders/types.d.ts +0 -15
- package/dist/composables/useCustomerOrders/types.js +0 -1
- package/dist/composables/useCustomerOrders/useCustomerOrders.d.ts +0 -8
- package/dist/composables/useCustomerOrders/useCustomerOrders.js +0 -42
- package/dist/composables/useCustomerReturns/index.d.ts +0 -2
- package/dist/composables/useCustomerReturns/index.js +0 -2
- package/dist/composables/useCustomerReturns/types.d.ts +0 -13
- package/dist/composables/useCustomerReturns/types.js +0 -1
- package/dist/composables/useCustomerReturns/useCustomerReturns.d.ts +0 -8
- package/dist/composables/useCustomerReturns/useCustomerReturns.js +0 -32
- package/dist/composables/useHandleError/index.d.ts +0 -1
- package/dist/composables/useHandleError/index.js +0 -1
- package/dist/composables/useHandleError/types.d.ts +0 -7
- package/dist/composables/useHandleError/types.js +0 -1
- package/dist/composables/useHandleError/useHandleError.d.ts +0 -10
- package/dist/composables/useHandleError/useHandleError.js +0 -24
- package/dist/composables/usePageTitle.d.ts +0 -5
- package/dist/composables/usePageTitle.js +0 -14
- package/dist/composables/useProduct/index.d.ts +0 -2
- package/dist/composables/useProduct/index.js +0 -2
- package/dist/composables/useProduct/types.d.ts +0 -13
- package/dist/composables/useProduct/types.js +0 -1
- package/dist/composables/useProduct/useProduct.d.ts +0 -9
- package/dist/composables/useProduct/useProduct.js +0 -36
- package/dist/composables/useProductAttribute/index.d.ts +0 -1
- package/dist/composables/useProductAttribute/index.js +0 -1
- package/dist/composables/useProductAttribute/useProductAttribute.d.ts +0 -11
- package/dist/composables/useProductAttribute/useProductAttribute.js +0 -25
- package/dist/composables/useProductRecommended/index.d.ts +0 -1
- package/dist/composables/useProductRecommended/index.js +0 -1
- package/dist/composables/useProductRecommended/types.d.ts +0 -13
- package/dist/composables/useProductRecommended/types.js +0 -1
- package/dist/composables/useProductRecommended/useProductRecommended.d.ts +0 -6
- package/dist/composables/useProductRecommended/useProductRecommended.js +0 -33
- package/dist/composables/useProductReviews/index.d.ts +0 -2
- package/dist/composables/useProductReviews/index.js +0 -2
- package/dist/composables/useProductReviews/types.d.ts +0 -13
- package/dist/composables/useProductReviews/types.js +0 -1
- package/dist/composables/useProductReviews/useProductReviews.d.ts +0 -9
- package/dist/composables/useProductReviews/useProductReviews.js +0 -36
- package/dist/composables/useProducts/types.d.ts +0 -18
- package/dist/composables/useProducts/types.js +0 -1
- package/dist/composables/useProducts/useProducts.d.ts +0 -8
- package/dist/composables/useProducts/useProducts.js +0 -35
- package/dist/composables/utils/countryList.d.ts +0 -5
- package/dist/composables/utils/countryList.js +0 -14
- package/dist/composables/utils/glossary.d.ts +0 -0
- package/dist/composables/utils/glossary.js +0 -0
- package/dist/composables/utils/importExport.d.ts +0 -0
- package/dist/composables/utils/importExport.js +0 -0
- package/dist/composables/utils/print.d.ts +0 -0
- package/dist/composables/utils/print.js +0 -0
- package/dist/composables/utils/shopThemes.d.ts +0 -0
- package/dist/composables/utils/shopThemes.js +0 -0
- package/dist/composables/utils/statistics.d.ts +0 -0
- package/dist/composables/utils/statistics.js +0 -0
- package/dist/composables/utils/stock.d.ts +0 -0
- package/dist/composables/utils/stock.js +0 -0
- package/dist/composables/utils/stripe.d.ts +0 -7
- package/dist/composables/utils/stripe.js +0 -14
- package/dist/composables/utils/taxation.d.ts +0 -0
- package/dist/composables/utils/taxation.js +0 -0
- package/dist/composables/utils/tellFriends.d.ts +0 -0
- package/dist/composables/utils/tellFriends.js +0 -0
- package/dist/composables/validationRules/index.d.ts +0 -1
- package/dist/composables/validationRules/index.js +0 -1
- package/dist/composables/validationRules/password.d.ts +0 -1
- package/dist/composables/validationRules/password.js +0 -20
- package/dist/composables/validationRules/password.test.d.ts +0 -1
- package/dist/composables/validationRules/password.test.js +0 -68
- package/dist/composables/vendors/index.d.ts +0 -0
- package/dist/composables/vendors/index.js +0 -0
- package/dist/composables/vendors/registry.d.ts +0 -0
- package/dist/composables/vendors/registry.js +0 -0
- package/dist/composables/vendors/useAffiliates.d.ts +0 -0
- package/dist/composables/vendors/useAffiliates.js +0 -0
- package/dist/composables/vendors/useCommission.d.ts +0 -0
- package/dist/composables/vendors/useCommission.js +0 -0
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -6
- package/dist/modules/vue-head/composables/useHead.d.ts +0 -1
- package/dist/modules/vue-head/composables/useHead.js +0 -3
- package/dist/normalizer.d.ts +0 -12
- package/dist/normalizer.js +0 -13
- package/dist/normalizers/magento.d.ts +0 -3
- package/dist/normalizers/magento.js +0 -23
- package/dist/normalizers/shopify.d.ts +0 -3
- package/dist/normalizers/shopify.js +0 -24
- package/dist/utils/client.d.ts +0 -6
- package/dist/utils/client.js +0 -23
- package/dist/utils/index.d.ts +0 -15
- package/dist/utils/index.js +0 -38
- package/dist/utils/normalizer.d.ts +0 -12
- package/dist/utils/normalizer.js +0 -13
- package/dist/utils/normalizers/magento.d.ts +0 -3
- package/dist/utils/normalizers/magento.js +0 -23
- package/dist/utils/normalizers/shopify.d.ts +0 -3
- package/dist/utils/normalizers/shopify.js +0 -24
- package/global.d.ts +0 -149
- package/tsconfig.json +0 -31
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-form @submit.prevent="handlePayment" aria-label="Stripe payment form" ref="formRef">
|
|
3
|
-
<div ref="cardElement" class="StripeElement" aria-label="Card input"></div>
|
|
4
|
-
<div v-if="cardError" class="stripe-error" role="alert">{{ cardError }}</div>
|
|
5
|
-
<v-row class="stripe-details">
|
|
6
|
-
<v-col cols="12" md="6">
|
|
7
|
-
<v-text-field v-model="billingDetails.name" label="Name on Card" required autocomplete="cc-name" outlined />
|
|
8
|
-
</v-col>
|
|
9
|
-
<v-col cols="12" md="6">
|
|
10
|
-
<v-text-field v-model="billingDetails.email" label="Email" type="email" required autocomplete="email" outlined />
|
|
11
|
-
</v-col>
|
|
12
|
-
<v-col cols="12" md="6">
|
|
13
|
-
<v-text-field v-model="billingDetails.phone" label="Phone" type="tel" autocomplete="tel" outlined />
|
|
14
|
-
</v-col>
|
|
15
|
-
<v-col cols="12" md="6">
|
|
16
|
-
<v-select v-model="billingDetails.address.country" :items="countryOptions" label="Country" required outlined />
|
|
17
|
-
</v-col>
|
|
18
|
-
<v-col cols="12" md="6">
|
|
19
|
-
<v-text-field v-model="billingDetails.address.line1" label="Address" required outlined />
|
|
20
|
-
</v-col>
|
|
21
|
-
<v-col cols="12" md="6">
|
|
22
|
-
<v-text-field v-model="billingDetails.address.city" label="City" required outlined />
|
|
23
|
-
</v-col>
|
|
24
|
-
<v-col cols="12" md="6">
|
|
25
|
-
<v-text-field v-model="billingDetails.address.state" label="State" required outlined />
|
|
26
|
-
</v-col>
|
|
27
|
-
<v-col cols="12" md="6">
|
|
28
|
-
<v-text-field v-model="billingDetails.address.postal_code" label="Postal Code" required outlined />
|
|
29
|
-
</v-col>
|
|
30
|
-
</v-row>
|
|
31
|
-
<v-row class="stripe-details">
|
|
32
|
-
<v-col cols="12" md="6">
|
|
33
|
-
<v-text-field v-model="shippingDetails.name" label="Shipping Name" required outlined />
|
|
34
|
-
</v-col>
|
|
35
|
-
<v-col cols="12" md="6">
|
|
36
|
-
<v-select v-model="shippingDetails.address.country" :items="countryOptions" label="Shipping Country" required outlined />
|
|
37
|
-
</v-col>
|
|
38
|
-
<v-col cols="12" md="6">
|
|
39
|
-
<v-text-field v-model="shippingDetails.address.line1" label="Shipping Address" required outlined />
|
|
40
|
-
</v-col>
|
|
41
|
-
<v-col cols="12" md="6">
|
|
42
|
-
<v-text-field v-model="shippingDetails.address.city" label="Shipping City" required outlined />
|
|
43
|
-
</v-col>
|
|
44
|
-
<v-col cols="12" md="6">
|
|
45
|
-
<v-text-field v-model="shippingDetails.address.state" label="Shipping State" required outlined />
|
|
46
|
-
</v-col>
|
|
47
|
-
<v-col cols="12" md="6">
|
|
48
|
-
<v-text-field v-model="shippingDetails.address.postal_code" label="Shipping Postal Code" required outlined />
|
|
49
|
-
</v-col>
|
|
50
|
-
</v-row>
|
|
51
|
-
<v-checkbox v-model="saveCard" label="Save card for future payments (secure)" class="mb-4" />
|
|
52
|
-
<v-btn type="submit" :disabled="loading || !cardReady" aria-busy="loading">
|
|
53
|
-
<span v-if="loading">Processing...</span>
|
|
54
|
-
<span v-else>Pay</span>
|
|
55
|
-
</v-btn>
|
|
56
|
-
</v-form>
|
|
57
|
-
</template>
|
|
58
|
-
|
|
59
|
-
<script setup lang="ts">
|
|
60
|
-
import { ref, onMounted, onUnmounted, watch, computed } from 'vue';
|
|
61
|
-
import { v-btn } from '@storefront-ui/vue';
|
|
62
|
-
import { useUserStore } from '../../stores/user';
|
|
63
|
-
import { useDirectusAuth } from '../../../../../composables/useDirectusAuth';
|
|
64
|
-
import countryList from '../../utils/countryList'; // Assume this is an array of country codes/names
|
|
65
|
-
|
|
66
|
-
const props = defineProps<{ clientSecret: string }>();
|
|
67
|
-
const emit = defineEmits(['payment-success', 'payment-error']);
|
|
68
|
-
|
|
69
|
-
const cardElement = ref<HTMLElement | null>(null);
|
|
70
|
-
let card: any = null;
|
|
71
|
-
let elements: any = null;
|
|
72
|
-
const loading = ref(false);
|
|
73
|
-
const cardError = ref('');
|
|
74
|
-
const cardReady = ref(false);
|
|
75
|
-
const saveCard = ref(false);
|
|
76
|
-
const formRef = ref();
|
|
77
|
-
|
|
78
|
-
const userStore = useUserStore();
|
|
79
|
-
const directusAuth = useDirectusAuth();
|
|
80
|
-
const directusUser = computed(() => directusAuth.user || {});
|
|
81
|
-
|
|
82
|
-
// Prefer Directus user data if available, fallback to store
|
|
83
|
-
const user = computed(() => Object.keys(directusUser.value).length ? directusUser.value : userStore.user || {});
|
|
84
|
-
|
|
85
|
-
const countryOptions = countryList.map((c: any) => ({ text: c.name, value: c.code }));
|
|
86
|
-
|
|
87
|
-
const billingDetails = ref({
|
|
88
|
-
name: user.value.name || '',
|
|
89
|
-
email: user.value.email || '',
|
|
90
|
-
phone: user.value.phone || '',
|
|
91
|
-
address: {
|
|
92
|
-
line1: user.value.address?.line1 || '',
|
|
93
|
-
city: user.value.address?.city || '',
|
|
94
|
-
state: user.value.address?.state || '',
|
|
95
|
-
postal_code: user.value.address?.postal_code || '',
|
|
96
|
-
country: user.value.address?.country || '',
|
|
97
|
-
},
|
|
98
|
-
});
|
|
99
|
-
const shippingDetails = ref({
|
|
100
|
-
name: user.value.shippingName || user.value.name || '',
|
|
101
|
-
address: {
|
|
102
|
-
line1: user.value.shippingAddress?.line1 || '',
|
|
103
|
-
city: user.value.shippingAddress?.city || '',
|
|
104
|
-
state: user.value.shippingAddress?.state || '',
|
|
105
|
-
postal_code: user.value.shippingAddress?.postal_code || '',
|
|
106
|
-
country: user.value.shippingAddress?.country || '',
|
|
107
|
-
},
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
function useNuxtApp() {
|
|
111
|
-
// Return a simple wrapper exposing a client-side Stripe instance if available
|
|
112
|
-
return {
|
|
113
|
-
$stripe: (typeof window !== 'undefined' && window.Stripe) ? window.Stripe : null
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
const { $stripe } = useNuxtApp();
|
|
117
|
-
|
|
118
|
-
onMounted(() => {
|
|
119
|
-
if (!$stripe || !props.clientSecret) return;
|
|
120
|
-
elements = $stripe.elements({ clientSecret: props.clientSecret });
|
|
121
|
-
card = elements.create('card');
|
|
122
|
-
card.mount(cardElement.value);
|
|
123
|
-
card.on('change', (event: any) => {
|
|
124
|
-
cardError.value = event.error ? event.error.message : '';
|
|
125
|
-
cardReady.value = event.complete;
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
onUnmounted(() => {
|
|
130
|
-
if (card) card.destroy();
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
watch(() => props.clientSecret, (newSecret) => {
|
|
134
|
-
if (elements && newSecret) {
|
|
135
|
-
// Re-create card element if clientSecret changes
|
|
136
|
-
if (card) card.destroy();
|
|
137
|
-
card = elements.create('card');
|
|
138
|
-
card.mount(cardElement.value);
|
|
139
|
-
card.on('change', (event: any) => {
|
|
140
|
-
cardError.value = event.error ? event.error.message : '';
|
|
141
|
-
cardReady.value = event.complete;
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
const handlePayment = async () => {
|
|
147
|
-
cardError.value = '';
|
|
148
|
-
loading.value = true;
|
|
149
|
-
try {
|
|
150
|
-
if (!$stripe || !props.clientSecret) {
|
|
151
|
-
cardError.value = 'Stripe is not initialized.';
|
|
152
|
-
emit('payment-error', cardError.value);
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
// Validate form before submitting
|
|
156
|
-
if (formRef.value && !(await formRef.value.validate?.())) {
|
|
157
|
-
loading.value = false;
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
const { error, paymentIntent, setupIntent } = await $stripe.confirmCardPayment(props.clientSecret, {
|
|
161
|
-
payment_method: {
|
|
162
|
-
card: card,
|
|
163
|
-
billing_details: billingDetails.value,
|
|
164
|
-
},
|
|
165
|
-
shipping: shippingDetails.value,
|
|
166
|
-
setup_future_usage: saveCard.value ? 'off_session' : undefined, // Save card if checked
|
|
167
|
-
// 3D Secure is handled automatically by Stripe if required
|
|
168
|
-
});
|
|
169
|
-
if (error) {
|
|
170
|
-
cardError.value = error.message || 'Payment failed.';
|
|
171
|
-
emit('payment-error', cardError.value);
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
if (paymentIntent && paymentIntent.status === 'succeeded') {
|
|
175
|
-
emit('payment-success', paymentIntent);
|
|
176
|
-
} else if (setupIntent && setupIntent.status === 'succeeded') {
|
|
177
|
-
emit('payment-success', setupIntent);
|
|
178
|
-
} else {
|
|
179
|
-
cardError.value = 'Payment was not successful.';
|
|
180
|
-
emit('payment-error', cardError.value);
|
|
181
|
-
}
|
|
182
|
-
} catch (e: any) {
|
|
183
|
-
cardError.value = e?.message || 'An unexpected error occurred.';
|
|
184
|
-
emit('payment-error', cardError.value);
|
|
185
|
-
} finally {
|
|
186
|
-
loading.value = false;
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
</script>
|
|
190
|
-
|
|
191
|
-
<style scoped>
|
|
192
|
-
.StripeElement {
|
|
193
|
-
border: 1px solid #ccc;
|
|
194
|
-
padding: 10px;
|
|
195
|
-
border-radius: 4px;
|
|
196
|
-
margin-bottom: 1rem;
|
|
197
|
-
}
|
|
198
|
-
.stripe-error {
|
|
199
|
-
color: #d32f2f;
|
|
200
|
-
margin-bottom: 1rem;
|
|
201
|
-
font-size: 0.95em;
|
|
202
|
-
}
|
|
203
|
-
.stripe-details {
|
|
204
|
-
margin-bottom: 1rem;
|
|
205
|
-
}
|
|
206
|
-
</style>
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<h1>Checkout</h1>
|
|
4
|
-
<v-btn @click="startCheckout" :disabled="loading || !clientSecret">
|
|
5
|
-
Pay with Stripe
|
|
6
|
-
</v-btn>
|
|
7
|
-
<StripeCardElement v-if="clientSecret" :clientSecret="clientSecret" @payment-success="onPaymentSuccess" />
|
|
8
|
-
</div>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
|
-
<script setup lang="ts">
|
|
12
|
-
import { ref } from 'vue';
|
|
13
|
-
import { v-btn } from '@storefront-ui/vue';
|
|
14
|
-
import { useVendureQuery } from '@/app/composables/useVendureQuery';
|
|
15
|
-
import { useVendureMutation } from '@/app/composables/useVendureMutation';
|
|
16
|
-
import createStripePaymentIntentMutation from '#graphql/app/commerce/mutations/createStripePaymentIntent.gql';
|
|
17
|
-
import getActiveOrderQuery from '#graphql/app/commerce/queries/getActiveOrder.gql';
|
|
18
|
-
import StripeCardElement from './StripeCardElement.vue';
|
|
19
|
-
|
|
20
|
-
const loading = ref(false);
|
|
21
|
-
const clientSecret = ref<string | null>(null);
|
|
22
|
-
|
|
23
|
-
// Get the active order (cart)
|
|
24
|
-
const { data: orderData, refetch } = useVendureQuery(getActiveOrderQuery);
|
|
25
|
-
|
|
26
|
-
const { mutate: createStripePaymentIntent } = useVendureMutation(createStripePaymentIntentMutation);
|
|
27
|
-
|
|
28
|
-
const startCheckout = async () => {
|
|
29
|
-
if (!orderData.value?.activeOrder) return;
|
|
30
|
-
loading.value = true;
|
|
31
|
-
try {
|
|
32
|
-
// Create payment intent on the server via Vendure mutation
|
|
33
|
-
const response = await createStripePaymentIntent({
|
|
34
|
-
orderId: orderData.value.activeOrder.id,
|
|
35
|
-
});
|
|
36
|
-
clientSecret.value = response?.createStripePaymentIntent?.clientSecret;
|
|
37
|
-
} catch (err) {
|
|
38
|
-
// Handle error (show notification, etc.)
|
|
39
|
-
console.error(err);
|
|
40
|
-
} finally {
|
|
41
|
-
loading.value = false;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const onPaymentSuccess = () => {
|
|
46
|
-
// Optionally refetch order/cart, show success notification, etc.
|
|
47
|
-
refetch();
|
|
48
|
-
};
|
|
49
|
-
</script>
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-form class="pa-4" @submit.prevent="setBillingAddressHandler">
|
|
3
|
-
<!-- Loading Overlay -->
|
|
4
|
-
<v-overlay
|
|
5
|
-
:model-value="loading"
|
|
6
|
-
class="align-center justify-center"
|
|
7
|
-
>
|
|
8
|
-
<v-progress-circular
|
|
9
|
-
indeterminate
|
|
10
|
-
size="64"
|
|
11
|
-
></v-progress-circular>
|
|
12
|
-
</v-overlay>
|
|
13
|
-
|
|
14
|
-
<!-- Error Alert -->
|
|
15
|
-
<v-alert
|
|
16
|
-
v-if="error"
|
|
17
|
-
type="error"
|
|
18
|
-
closable
|
|
19
|
-
class="mb-4"
|
|
20
|
-
@click:close="error = null"
|
|
21
|
-
>
|
|
22
|
-
{{ error }}
|
|
23
|
-
</v-alert>
|
|
24
|
-
|
|
25
|
-
<h2 class="text-h4 font-weight-bold mb-4">Billing Address</h2>
|
|
26
|
-
<v-row>
|
|
27
|
-
<v-col cols="12" md="6">
|
|
28
|
-
<v-text-field
|
|
29
|
-
v-model="billingAddress.fullName"
|
|
30
|
-
:error-messages="errors.fullName"
|
|
31
|
-
label="Full Name"
|
|
32
|
-
name="fullName"
|
|
33
|
-
autocomplete="name"
|
|
34
|
-
required
|
|
35
|
-
variant="outlined"
|
|
36
|
-
></v-text-field>
|
|
37
|
-
</v-col>
|
|
38
|
-
<v-col cols="12" md="6">
|
|
39
|
-
<v-text-field
|
|
40
|
-
v-model="billingAddress.phoneNumber"
|
|
41
|
-
:error-messages="errors.phoneNumber"
|
|
42
|
-
label="Phone"
|
|
43
|
-
name="phone"
|
|
44
|
-
type="tel"
|
|
45
|
-
autocomplete="tel"
|
|
46
|
-
required
|
|
47
|
-
variant="outlined"
|
|
48
|
-
></v-text-field>
|
|
49
|
-
</v-col>
|
|
50
|
-
<v-col cols="12">
|
|
51
|
-
<v-select
|
|
52
|
-
v-model="billingAddress.countryCode"
|
|
53
|
-
:error-messages="errors.countryCode"
|
|
54
|
-
label="Country"
|
|
55
|
-
name="country"
|
|
56
|
-
:items="countries"
|
|
57
|
-
item-title="name"
|
|
58
|
-
item-value="code"
|
|
59
|
-
autocomplete="country-name"
|
|
60
|
-
required
|
|
61
|
-
variant="outlined"
|
|
62
|
-
@update:model-value="updateRegions"
|
|
63
|
-
></v-select>
|
|
64
|
-
</v-col>
|
|
65
|
-
<v-col cols="12" md="8">
|
|
66
|
-
<v-text-field
|
|
67
|
-
v-model="billingAddress.streetLine1"
|
|
68
|
-
:error-messages="errors.streetLine1"
|
|
69
|
-
label="Street Address 1"
|
|
70
|
-
name="streetLine1"
|
|
71
|
-
autocomplete="address-line1"
|
|
72
|
-
required
|
|
73
|
-
variant="outlined"
|
|
74
|
-
hint="Street address or P.O. Box"
|
|
75
|
-
></v-text-field>
|
|
76
|
-
</v-col>
|
|
77
|
-
<v-col cols="12" md="4">
|
|
78
|
-
<v-text-field
|
|
79
|
-
v-model="billingAddress.streetLine2"
|
|
80
|
-
label="Street Address 2"
|
|
81
|
-
name="streetLine2"
|
|
82
|
-
variant="outlined"
|
|
83
|
-
hint="Optional"
|
|
84
|
-
></v-text-field>
|
|
85
|
-
</v-col>
|
|
86
|
-
<v-col cols="12" md="4">
|
|
87
|
-
<v-text-field
|
|
88
|
-
v-model="billingAddress.city"
|
|
89
|
-
:error-messages="errors.city"
|
|
90
|
-
label="City"
|
|
91
|
-
name="city"
|
|
92
|
-
autocomplete="address-level2"
|
|
93
|
-
required
|
|
94
|
-
variant="outlined"
|
|
95
|
-
></v-text-field>
|
|
96
|
-
</v-col>
|
|
97
|
-
<v-col cols="12" md="4">
|
|
98
|
-
<v-select
|
|
99
|
-
v-model="billingAddress.province"
|
|
100
|
-
:error-messages="errors.province"
|
|
101
|
-
label="State/Province"
|
|
102
|
-
name="province"
|
|
103
|
-
:items="regions"
|
|
104
|
-
item-title="name"
|
|
105
|
-
item-value="code"
|
|
106
|
-
autocomplete="address-level1"
|
|
107
|
-
required
|
|
108
|
-
variant="outlined"
|
|
109
|
-
></v-select>
|
|
110
|
-
</v-col>
|
|
111
|
-
<v-col cols="12" md="4">
|
|
112
|
-
<v-text-field
|
|
113
|
-
v-model="billingAddress.postalCode"
|
|
114
|
-
:error-messages="errors.postalCode"
|
|
115
|
-
label="ZIP/Postal Code"
|
|
116
|
-
name="postalCode"
|
|
117
|
-
placeholder="eg. 12345"
|
|
118
|
-
autocomplete="postal-code"
|
|
119
|
-
required
|
|
120
|
-
variant="outlined"
|
|
121
|
-
></v-text-field>
|
|
122
|
-
</v-col>
|
|
123
|
-
<v-col cols="12">
|
|
124
|
-
<v-checkbox
|
|
125
|
-
v-model="useAsShippingAddress"
|
|
126
|
-
label="Use as shipping address"
|
|
127
|
-
name="useAsShippingAddress"
|
|
128
|
-
></v-checkbox>
|
|
129
|
-
</v-col>
|
|
130
|
-
<v-col cols="12" class="d-flex justify-end gap-4">
|
|
131
|
-
<v-btn
|
|
132
|
-
variant="outlined"
|
|
133
|
-
type="reset"
|
|
134
|
-
color="primary"
|
|
135
|
-
@click="handleReset"
|
|
136
|
-
>
|
|
137
|
-
Clear all
|
|
138
|
-
</v-btn>
|
|
139
|
-
<v-btn
|
|
140
|
-
color="primary"
|
|
141
|
-
type="submit"
|
|
142
|
-
:loading="loading"
|
|
143
|
-
:disabled="loading"
|
|
144
|
-
>
|
|
145
|
-
Save
|
|
146
|
-
</v-btn>
|
|
147
|
-
</v-col>
|
|
148
|
-
</v-row>
|
|
149
|
-
</v-form>
|
|
150
|
-
</template>
|
|
151
|
-
|
|
152
|
-
<script setup lang="ts">
|
|
153
|
-
import { ref, reactive, onMounted, onErrorCaptured } from 'vue';
|
|
154
|
-
import { useVendureMutation } from '../../composables/useVendureMutation';
|
|
155
|
-
import setOrderBillingAddressMutation from '#graphql/app/commerce/mutations/setOrderBillingAddress.gql';
|
|
156
|
-
import getCountryListQuery from '#graphql/app/commerce/queries/getCountryList.gql';
|
|
157
|
-
import { useVendureQuery } from '../../composables/useVendureQuery';
|
|
158
|
-
import { useNotification } from '~//composables/useNotifications';
|
|
159
|
-
|
|
160
|
-
const emit = defineEmits(['address-saved', 'address-error', 'form-reset']);
|
|
161
|
-
const { showNotification } = useNotification();
|
|
162
|
-
const loading = ref(false);
|
|
163
|
-
const error = ref<string | null>(null);
|
|
164
|
-
const useAsShippingAddress = ref(false);
|
|
165
|
-
|
|
166
|
-
// Add a reactive errors object for field-level error messages
|
|
167
|
-
const errors = reactive({
|
|
168
|
-
fullName: '',
|
|
169
|
-
streetLine1: '',
|
|
170
|
-
streetLine2: '',
|
|
171
|
-
city: '',
|
|
172
|
-
province: '',
|
|
173
|
-
postalCode: '',
|
|
174
|
-
phoneNumber: '',
|
|
175
|
-
countryCode: '',
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
const { data: countriesResult } = useVendureQuery(getCountryListQuery);
|
|
179
|
-
type Country = {
|
|
180
|
-
code: string;
|
|
181
|
-
name: string;
|
|
182
|
-
regions?: Array<{ code: string; name: string }>;
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
const countries = ref<Country[]>([]);
|
|
186
|
-
const regions = ref<Array<{ code: string; name: string }>>([]);
|
|
187
|
-
|
|
188
|
-
const billingAddress = reactive({
|
|
189
|
-
fullName: '',
|
|
190
|
-
streetLine1: '',
|
|
191
|
-
streetLine2: '',
|
|
192
|
-
city: '',
|
|
193
|
-
province: '',
|
|
194
|
-
postalCode: '',
|
|
195
|
-
phoneNumber: '',
|
|
196
|
-
countryCode: '',
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
const { mutate: setBillingAddress } = useVendureMutation(setOrderBillingAddressMutation);
|
|
200
|
-
|
|
201
|
-
const updateRegions = (countryCode: string) => {
|
|
202
|
-
const country = countries.value.find((c) => c.code === countryCode);
|
|
203
|
-
regions.value = country?.regions || [];
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
const handleReset = () => {
|
|
207
|
-
Object.assign(billingAddress, {
|
|
208
|
-
fullName: '',
|
|
209
|
-
streetLine1: '',
|
|
210
|
-
streetLine2: '',
|
|
211
|
-
city: '',
|
|
212
|
-
province: '',
|
|
213
|
-
postalCode: '',
|
|
214
|
-
phoneNumber: '',
|
|
215
|
-
countryCode: '',
|
|
216
|
-
});
|
|
217
|
-
useAsShippingAddress.value = false;
|
|
218
|
-
emit('form-reset');
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
const setBillingAddressHandler = async () => {
|
|
222
|
-
loading.value = true;
|
|
223
|
-
error.value = null;
|
|
224
|
-
try {
|
|
225
|
-
const result = await setBillingAddress({
|
|
226
|
-
input: {
|
|
227
|
-
fullName: billingAddress.fullName,
|
|
228
|
-
streetLine1: billingAddress.streetLine1,
|
|
229
|
-
streetLine2: billingAddress.streetLine2,
|
|
230
|
-
city: billingAddress.city,
|
|
231
|
-
province: billingAddress.province,
|
|
232
|
-
postalCode: billingAddress.postalCode,
|
|
233
|
-
phoneNumber: billingAddress.phoneNumber,
|
|
234
|
-
countryCode: billingAddress.countryCode,
|
|
235
|
-
},
|
|
236
|
-
});
|
|
237
|
-
showNotification({ type: 'success', message: 'Billing address updated' });
|
|
238
|
-
emit('address-saved', result?.setOrderBillingAddress?.billingAddress);
|
|
239
|
-
} catch (err) {
|
|
240
|
-
error.value = err instanceof Error ? err.message : 'Failed to update billing address';
|
|
241
|
-
showNotification({ type: 'error', message: error.value });
|
|
242
|
-
emit('address-error', err instanceof Error ? err : new Error(error.value));
|
|
243
|
-
} finally {
|
|
244
|
-
loading.value = false;
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
onMounted(() => {
|
|
249
|
-
if (countriesResult.value) {
|
|
250
|
-
countries.value = countriesResult.value.countries;
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
onErrorCaptured((err) => {
|
|
254
|
-
error.value = err instanceof Error ? err.message : 'An unexpected error occurred';
|
|
255
|
-
return false;
|
|
256
|
-
});
|
|
257
|
-
</script>
|
|
258
|
-
|
|
259
|
-
<style scoped>
|
|
260
|
-
.gap-4 {
|
|
261
|
-
gap: 1rem;
|
|
262
|
-
}
|
|
263
|
-
</style>
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-form class="pa-4" @submit.prevent="setShippingAddressHandler">
|
|
3
|
-
<!-- Loading Overlay -->
|
|
4
|
-
<v-overlay :model-value="loading" class="align-center justify-center">
|
|
5
|
-
<v-progress-circular indeterminate size="64"></v-progress-circular>
|
|
6
|
-
</v-overlay>
|
|
7
|
-
|
|
8
|
-
<!-- Error Alert -->
|
|
9
|
-
<v-alert v-if="error" type="error" closable class="mb-4" @click:close="error = null">
|
|
10
|
-
{{ error }}
|
|
11
|
-
</v-alert>
|
|
12
|
-
|
|
13
|
-
<h2 class="text-h4 font-weight-bold mb-4">Shipping Address</h2>
|
|
14
|
-
<v-row>
|
|
15
|
-
<v-col cols="12" md="6">
|
|
16
|
-
<v-text-field v-model="shippingAddress.fullName" :error-messages="errors.fullName" label="Full Name"
|
|
17
|
-
name="fullName" autocomplete="name" required variant="outlined"></v-text-field>
|
|
18
|
-
</v-col>
|
|
19
|
-
<v-col cols="12" md="6">
|
|
20
|
-
<v-text-field v-model="shippingAddress.phoneNumber" :error-messages="errors.phoneNumber" label="Phone"
|
|
21
|
-
name="phone" type="tel" autocomplete="tel" required variant="outlined"></v-text-field>
|
|
22
|
-
</v-col>
|
|
23
|
-
<v-col cols="12">
|
|
24
|
-
<v-select v-model="shippingAddress.countryCode" :error-messages="errors.countryCode" label="Country"
|
|
25
|
-
name="country" :items="countries" item-title="name" item-value="code"
|
|
26
|
-
autocomplete="country-name" required variant="outlined"
|
|
27
|
-
@update:model-value="updateRegions"></v-select>
|
|
28
|
-
</v-col>
|
|
29
|
-
<v-col cols="12" md="8">
|
|
30
|
-
<v-text-field v-model="shippingAddress.streetLine1" :error-messages="errors.streetLine1" label="Street Line 1"
|
|
31
|
-
name="streetLine1" autocomplete="address-line1" required variant="outlined"
|
|
32
|
-
hint="Street address or P.O. Box"></v-text-field>
|
|
33
|
-
</v-col>
|
|
34
|
-
<v-col cols="12" md="4">
|
|
35
|
-
<v-text-field v-model="shippingAddress.streetLine2" label="Street Line 2" name="streetLine2"
|
|
36
|
-
variant="outlined" hint="Optional"></v-text-field>
|
|
37
|
-
</v-col>
|
|
38
|
-
<v-col cols="12" md="4">
|
|
39
|
-
<v-text-field v-model="shippingAddress.city" :error-messages="errors.city" label="City" name="city"
|
|
40
|
-
autocomplete="address-level2" required variant="outlined"></v-text-field>
|
|
41
|
-
</v-col>
|
|
42
|
-
<v-col cols="12" md="4">
|
|
43
|
-
<v-select v-model="shippingAddress.province" :error-messages="errors.province" label="State" name="state"
|
|
44
|
-
:items="regions" item-title="name" item-value="code" autocomplete="address-level1" required
|
|
45
|
-
variant="outlined"></v-select>
|
|
46
|
-
</v-col>
|
|
47
|
-
<v-col cols="12" md="4">
|
|
48
|
-
<v-text-field v-model="shippingAddress.postalCode" :error-messages="errors.postalCode" label="ZIP Code"
|
|
49
|
-
name="zipCode" placeholder="eg. 12345" autocomplete="postal-code" required
|
|
50
|
-
variant="outlined"></v-text-field>
|
|
51
|
-
</v-col>
|
|
52
|
-
<v-col cols="12">
|
|
53
|
-
<v-checkbox v-model="useAsShippingAddress" label="Use as shipping address"
|
|
54
|
-
name="useAsShippingAddress"></v-checkbox>
|
|
55
|
-
</v-col>
|
|
56
|
-
<v-col cols="12" class="d-flex justify-end gap-4">
|
|
57
|
-
<v-btn variant="outlined" type="reset" color="primary" @click="handleReset">
|
|
58
|
-
Clear all
|
|
59
|
-
</v-btn>
|
|
60
|
-
<v-btn color="primary" type="submit" :loading="loading" :disabled="loading">
|
|
61
|
-
Save
|
|
62
|
-
</v-btn>
|
|
63
|
-
</v-col>
|
|
64
|
-
</v-row>
|
|
65
|
-
</v-form>
|
|
66
|
-
</template>
|
|
67
|
-
|
|
68
|
-
<script setup lang="ts">
|
|
69
|
-
import { ref, reactive, onMounted, onErrorCaptured } from 'vue';
|
|
70
|
-
import { useVendureMutation } from '../../composables/useVendureMutation';
|
|
71
|
-
import setOrderShippingAddressMutation from '#graphql/app/commerce/mutations/setOrderShippingAddress.gql';
|
|
72
|
-
import getCountryListQuery from '#graphql/app/commerce/queries/getCountryList.gql';
|
|
73
|
-
import { useVendureQuery } from '../../composables/useVendureQuery';
|
|
74
|
-
import { useNotification } from '~//composables/useNotifications';
|
|
75
|
-
|
|
76
|
-
const emit = defineEmits(['address-saved', 'address-error', 'form-reset']);
|
|
77
|
-
const { showNotification } = useNotification();
|
|
78
|
-
const loading = ref(false);
|
|
79
|
-
const error = ref<string | null>(null);
|
|
80
|
-
const useAsShippingAddress = ref(false);
|
|
81
|
-
|
|
82
|
-
const errors = reactive({
|
|
83
|
-
fullName: '',
|
|
84
|
-
streetLine1: '',
|
|
85
|
-
streetLine2: '',
|
|
86
|
-
city: '',
|
|
87
|
-
province: '',
|
|
88
|
-
postalCode: '',
|
|
89
|
-
phoneNumber: '',
|
|
90
|
-
countryCode: '',
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
const { data: countriesResult } = useVendureQuery(getCountryListQuery);
|
|
94
|
-
type Province = { code: string; name: string };
|
|
95
|
-
type Country = { code: string; name: string; provinces?: Province[] };
|
|
96
|
-
|
|
97
|
-
const countries = ref<Country[]>([]);
|
|
98
|
-
const regions = ref<Province[]>([]);
|
|
99
|
-
|
|
100
|
-
const shippingAddress = reactive({
|
|
101
|
-
fullName: '',
|
|
102
|
-
streetLine1: '',
|
|
103
|
-
streetLine2: '',
|
|
104
|
-
city: '',
|
|
105
|
-
province: null,
|
|
106
|
-
postalCode: '',
|
|
107
|
-
phoneNumber: '',
|
|
108
|
-
countryCode: null,
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
const { mutate: setShippingAddress } = useVendureMutation(setOrderShippingAddressMutation);
|
|
112
|
-
|
|
113
|
-
const updateRegions = (countryCode: string | null) => {
|
|
114
|
-
const country = countries.value.find((c: any) => c.code === countryCode);
|
|
115
|
-
regions.value = country?.provinces || [];
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const handleReset = () => {
|
|
119
|
-
Object.assign(shippingAddress, {
|
|
120
|
-
fullName: '',
|
|
121
|
-
streetLine1: '',
|
|
122
|
-
streetLine2: '',
|
|
123
|
-
city: '',
|
|
124
|
-
province: '',
|
|
125
|
-
postalCode: '',
|
|
126
|
-
phoneNumber: '',
|
|
127
|
-
countryCode: '',
|
|
128
|
-
});
|
|
129
|
-
useAsShippingAddress.value = false;
|
|
130
|
-
emit('form-reset');
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
const setShippingAddressHandler = async () => {
|
|
134
|
-
loading.value = true;
|
|
135
|
-
error.value = null;
|
|
136
|
-
try {
|
|
137
|
-
const result = await setShippingAddress({
|
|
138
|
-
input: {
|
|
139
|
-
fullName: shippingAddress.fullName,
|
|
140
|
-
streetLine1: shippingAddress.streetLine1,
|
|
141
|
-
streetLine2: shippingAddress.streetLine2,
|
|
142
|
-
city: shippingAddress.city,
|
|
143
|
-
province: shippingAddress.province,
|
|
144
|
-
postalCode: shippingAddress.postalCode,
|
|
145
|
-
phoneNumber: shippingAddress.phoneNumber,
|
|
146
|
-
countryCode: shippingAddress.countryCode,
|
|
147
|
-
},
|
|
148
|
-
});
|
|
149
|
-
showNotification({ type: 'success', message: 'Shipping address updated' });
|
|
150
|
-
emit('address-saved', result?.setOrderShippingAddress?.shippingAddress);
|
|
151
|
-
} catch (err) {
|
|
152
|
-
error.value = err instanceof Error ? err.message : 'Failed to update shipping address';
|
|
153
|
-
showNotification({ type: 'error', message: error.value });
|
|
154
|
-
emit('address-error', err instanceof Error ? err : new Error(error.value));
|
|
155
|
-
} finally {
|
|
156
|
-
loading.value = false;
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
onMounted(() => {
|
|
161
|
-
if (countriesResult.value) {
|
|
162
|
-
countries.value = countriesResult.value.countries;
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
onErrorCaptured((err) => {
|
|
166
|
-
error.value = err instanceof Error ? err.message : 'An unexpected error occurred';
|
|
167
|
-
return false;
|
|
168
|
-
});
|
|
169
|
-
</script>
|
|
170
|
-
|
|
171
|
-
<style scoped>
|
|
172
|
-
.gap-4 {
|
|
173
|
-
gap: 1rem;
|
|
174
|
-
}
|
|
175
|
-
</style>
|