@wikala/spmkt 3.0.0-beta.1 → 4.0.0-alpha.1
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/README.md +88 -0
- package/dist/analytics/ga4.d.ts +44 -0
- package/dist/analytics/ga4.js +47 -0
- package/dist/analytics/ga4.js.map +1 -0
- package/dist/core/api/account.d.ts +25 -0
- package/dist/core/api/account.js +27 -0
- package/dist/core/api/account.js.map +1 -0
- package/dist/core/api/address.d.ts +10 -0
- package/dist/core/api/address.js +18 -0
- package/dist/core/api/address.js.map +1 -0
- package/dist/core/api/cart.d.ts +43 -0
- package/dist/core/api/cart.js +46 -0
- package/dist/core/api/cart.js.map +1 -0
- package/dist/core/api/checkout.d.ts +90 -0
- package/dist/core/api/checkout.js +75 -0
- package/dist/core/api/checkout.js.map +1 -0
- package/dist/core/api/index.d.ts +12 -0
- package/dist/core/api/location.d.ts +8 -0
- package/dist/core/api/location.js +16 -0
- package/dist/core/api/location.js.map +1 -0
- package/dist/core/api/product.d.ts +13 -0
- package/dist/core/api/product.js +19 -0
- package/dist/core/api/product.js.map +1 -0
- package/dist/core/api/questions.d.ts +3 -0
- package/dist/core/api/questions.js +9 -0
- package/dist/core/api/questions.js.map +1 -0
- package/dist/core/api/reviews.d.ts +17 -0
- package/dist/core/api/reviews.js +30 -0
- package/dist/core/api/reviews.js.map +1 -0
- package/dist/core/api/search.d.ts +3 -0
- package/dist/core/api/search.js +8 -0
- package/dist/core/api/search.js.map +1 -0
- package/dist/core/config.d.ts +16 -0
- package/dist/core/config.js +33 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/cookies.d.ts +5 -0
- package/dist/core/cookies.js +29 -0
- package/dist/core/cookies.js.map +1 -0
- package/dist/core/errors.d.ts +27 -0
- package/dist/core/errors.js +42 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/events.d.ts +137 -0
- package/dist/core/events.js +13 -0
- package/dist/core/events.js.map +1 -0
- package/dist/core/forms.d.ts +17 -0
- package/dist/core/forms.js +70 -0
- package/dist/core/forms.js.map +1 -0
- package/dist/core/i18n.d.ts +26 -0
- package/dist/core/i18n.js +82 -0
- package/dist/core/i18n.js.map +1 -0
- package/dist/core/index.d.ts +22 -0
- package/dist/core/index.js +156 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/money.d.ts +10 -0
- package/dist/core/money.js +30 -0
- package/dist/core/money.js.map +1 -0
- package/dist/core/page-events.d.ts +13 -0
- package/dist/core/page-events.js +76 -0
- package/dist/core/page-events.js.map +1 -0
- package/dist/core/recaptcha.d.ts +17 -0
- package/dist/core/recaptcha.js +44 -0
- package/dist/core/recaptcha.js.map +1 -0
- package/dist/core/request.d.ts +38 -0
- package/dist/core/request.js +170 -0
- package/dist/core/request.js.map +1 -0
- package/dist/core/session.d.ts +7 -0
- package/dist/core/session.js +16 -0
- package/dist/core/session.js.map +1 -0
- package/dist/core/state.d.ts +22 -0
- package/dist/core/state.js +120 -0
- package/dist/core/state.js.map +1 -0
- package/dist/core/stores/cart.d.ts +45 -0
- package/dist/core/stores/cart.js +102 -0
- package/dist/core/stores/cart.js.map +1 -0
- package/dist/core/stores/checkout-draft.d.ts +58 -0
- package/dist/core/stores/checkout-draft.js +67 -0
- package/dist/core/stores/checkout-draft.js.map +1 -0
- package/dist/core/stores/checkout.d.ts +85 -0
- package/dist/core/stores/checkout.js +299 -0
- package/dist/core/stores/checkout.js.map +1 -0
- package/dist/core/stores/compare.d.ts +17 -0
- package/dist/core/stores/compare.js +78 -0
- package/dist/core/stores/compare.js.map +1 -0
- package/dist/core/stores/customer.d.ts +2 -0
- package/dist/core/stores/customer.js +13 -0
- package/dist/core/stores/customer.js.map +1 -0
- package/dist/core/stores/index.d.ts +9 -0
- package/dist/core/stores/location.d.ts +13 -0
- package/dist/core/stores/location.js +32 -0
- package/dist/core/stores/location.js.map +1 -0
- package/dist/core/types.d.ts +251 -0
- package/dist/elements/account-form/account-form.d.ts +33 -0
- package/dist/elements/account-form/account-form.js +42 -0
- package/dist/elements/account-form/account-form.js.map +1 -0
- package/dist/elements/account-form/index.d.ts +3 -0
- package/dist/elements/account-form/index.js +6 -0
- package/dist/elements/account-form/index.js.map +1 -0
- package/dist/elements/add-to-cart/add-to-cart.d.ts +43 -0
- package/dist/elements/add-to-cart/add-to-cart.js +99 -0
- package/dist/elements/add-to-cart/add-to-cart.js.map +1 -0
- package/dist/elements/add-to-cart/index.d.ts +3 -0
- package/dist/elements/add-to-cart/index.js +6 -0
- package/dist/elements/add-to-cart/index.js.map +1 -0
- package/dist/elements/address-autocomplete/address-autocomplete.d.ts +65 -0
- package/dist/elements/address-autocomplete/address-autocomplete.js +124 -0
- package/dist/elements/address-autocomplete/address-autocomplete.js.map +1 -0
- package/dist/elements/address-autocomplete/index.d.ts +3 -0
- package/dist/elements/address-autocomplete/index.js +7 -0
- package/dist/elements/address-autocomplete/index.js.map +1 -0
- package/dist/elements/address-book/address-book.d.ts +61 -0
- package/dist/elements/address-book/address-book.js +184 -0
- package/dist/elements/address-book/address-book.js.map +1 -0
- package/dist/elements/address-book/index.d.ts +3 -0
- package/dist/elements/address-book/index.js +6 -0
- package/dist/elements/address-book/index.js.map +1 -0
- package/dist/elements/age-check/age-check.d.ts +89 -0
- package/dist/elements/age-check/age-check.js +195 -0
- package/dist/elements/age-check/age-check.js.map +1 -0
- package/dist/elements/age-check/index.d.ts +3 -0
- package/dist/elements/age-check/index.js +8 -0
- package/dist/elements/age-check/index.js.map +1 -0
- package/dist/elements/age-gate/age-gate.d.ts +21 -0
- package/dist/elements/age-gate/age-gate.js +24 -0
- package/dist/elements/age-gate/age-gate.js.map +1 -0
- package/dist/elements/age-gate/index.d.ts +3 -0
- package/dist/elements/age-gate/index.js +7 -0
- package/dist/elements/age-gate/index.js.map +1 -0
- package/dist/elements/back-in-stock/back-in-stock.d.ts +61 -0
- package/dist/elements/back-in-stock/back-in-stock.js +101 -0
- package/dist/elements/back-in-stock/back-in-stock.js.map +1 -0
- package/dist/elements/back-in-stock/index.d.ts +3 -0
- package/dist/elements/back-in-stock/index.js +6 -0
- package/dist/elements/back-in-stock/index.js.map +1 -0
- package/dist/elements/carousel/carousel.d.ts +51 -0
- package/dist/elements/carousel/carousel.js +133 -0
- package/dist/elements/carousel/carousel.js.map +1 -0
- package/dist/elements/carousel/index.d.ts +3 -0
- package/dist/elements/carousel/index.js +6 -0
- package/dist/elements/carousel/index.js.map +1 -0
- package/dist/elements/cart/cart.d.ts +50 -0
- package/dist/elements/cart/cart.js +153 -0
- package/dist/elements/cart/cart.js.map +1 -0
- package/dist/elements/cart/index.d.ts +3 -0
- package/dist/elements/cart/index.js +6 -0
- package/dist/elements/cart/index.js.map +1 -0
- package/dist/elements/cart-count/cart-count.d.ts +16 -0
- package/dist/elements/cart-count/cart-count.js +32 -0
- package/dist/elements/cart-count/cart-count.js.map +1 -0
- package/dist/elements/cart-count/index.d.ts +3 -0
- package/dist/elements/cart-count/index.js +6 -0
- package/dist/elements/cart-count/index.js.map +1 -0
- package/dist/elements/checkout/checkout.d.ts +65 -0
- package/dist/elements/checkout/checkout.js +144 -0
- package/dist/elements/checkout/checkout.js.map +1 -0
- package/dist/elements/checkout/index.d.ts +3 -0
- package/dist/elements/checkout/index.js +6 -0
- package/dist/elements/checkout/index.js.map +1 -0
- package/dist/elements/checkout-address/checkout-address.d.ts +41 -0
- package/dist/elements/checkout-address/checkout-address.js +105 -0
- package/dist/elements/checkout-address/checkout-address.js.map +1 -0
- package/dist/elements/checkout-address/index.d.ts +3 -0
- package/dist/elements/checkout-address/index.js +6 -0
- package/dist/elements/checkout-address/index.js.map +1 -0
- package/dist/elements/checkout-delivery/checkout-delivery.d.ts +75 -0
- package/dist/elements/checkout-delivery/checkout-delivery.js +293 -0
- package/dist/elements/checkout-delivery/checkout-delivery.js.map +1 -0
- package/dist/elements/checkout-delivery/index.d.ts +3 -0
- package/dist/elements/checkout-delivery/index.js +6 -0
- package/dist/elements/checkout-delivery/index.js.map +1 -0
- package/dist/elements/checkout-identity/checkout-identity.d.ts +34 -0
- package/dist/elements/checkout-identity/checkout-identity.js +49 -0
- package/dist/elements/checkout-identity/checkout-identity.js.map +1 -0
- package/dist/elements/checkout-identity/index.d.ts +3 -0
- package/dist/elements/checkout-identity/index.js +6 -0
- package/dist/elements/checkout-identity/index.js.map +1 -0
- package/dist/elements/checkout-payment/checkout-payment.d.ts +74 -0
- package/dist/elements/checkout-payment/checkout-payment.js +286 -0
- package/dist/elements/checkout-payment/checkout-payment.js.map +1 -0
- package/dist/elements/checkout-payment/index.d.ts +3 -0
- package/dist/elements/checkout-payment/index.js +6 -0
- package/dist/elements/checkout-payment/index.js.map +1 -0
- package/dist/elements/collection/collection.d.ts +66 -0
- package/dist/elements/collection/collection.js +179 -0
- package/dist/elements/collection/collection.js.map +1 -0
- package/dist/elements/collection/index.d.ts +3 -0
- package/dist/elements/collection/index.js +6 -0
- package/dist/elements/collection/index.js.map +1 -0
- package/dist/elements/combobox/combobox.d.ts +54 -0
- package/dist/elements/combobox/combobox.js +178 -0
- package/dist/elements/combobox/combobox.js.map +1 -0
- package/dist/elements/combobox/index.d.ts +2 -0
- package/dist/elements/combobox/index.js +5 -0
- package/dist/elements/combobox/index.js.map +1 -0
- package/dist/elements/compare-bar/compare-bar.d.ts +21 -0
- package/dist/elements/compare-bar/compare-bar.js +34 -0
- package/dist/elements/compare-bar/compare-bar.js.map +1 -0
- package/dist/elements/compare-bar/index.d.ts +3 -0
- package/dist/elements/compare-bar/index.js +6 -0
- package/dist/elements/compare-bar/index.js.map +1 -0
- package/dist/elements/compare-remove/compare-remove.d.ts +20 -0
- package/dist/elements/compare-remove/compare-remove.js +19 -0
- package/dist/elements/compare-remove/compare-remove.js.map +1 -0
- package/dist/elements/compare-remove/index.d.ts +3 -0
- package/dist/elements/compare-remove/index.js +6 -0
- package/dist/elements/compare-remove/index.js.map +1 -0
- package/dist/elements/compare-toggle/compare-toggle.d.ts +39 -0
- package/dist/elements/compare-toggle/compare-toggle.js +53 -0
- package/dist/elements/compare-toggle/compare-toggle.js.map +1 -0
- package/dist/elements/compare-toggle/index.d.ts +3 -0
- package/dist/elements/compare-toggle/index.js +6 -0
- package/dist/elements/compare-toggle/index.js.map +1 -0
- package/dist/elements/dialog/dialog.d.ts +23 -0
- package/dist/elements/dialog/dialog.js +61 -0
- package/dist/elements/dialog/dialog.js.map +1 -0
- package/dist/elements/dialog/index.d.ts +3 -0
- package/dist/elements/dialog/index.js +6 -0
- package/dist/elements/dialog/index.js.map +1 -0
- package/dist/elements/location-picker/index.d.ts +3 -0
- package/dist/elements/location-picker/index.js +6 -0
- package/dist/elements/location-picker/index.js.map +1 -0
- package/dist/elements/location-picker/location-picker.d.ts +28 -0
- package/dist/elements/location-picker/location-picker.js +88 -0
- package/dist/elements/location-picker/location-picker.js.map +1 -0
- package/dist/elements/mini-cart/index.d.ts +3 -0
- package/dist/elements/mini-cart/index.js +6 -0
- package/dist/elements/mini-cart/index.js.map +1 -0
- package/dist/elements/mini-cart/mini-cart.d.ts +29 -0
- package/dist/elements/mini-cart/mini-cart.js +102 -0
- package/dist/elements/mini-cart/mini-cart.js.map +1 -0
- package/dist/elements/mobile-nav/index.d.ts +3 -0
- package/dist/elements/mobile-nav/index.js +6 -0
- package/dist/elements/mobile-nav/index.js.map +1 -0
- package/dist/elements/mobile-nav/mobile-nav.d.ts +20 -0
- package/dist/elements/mobile-nav/mobile-nav.js +29 -0
- package/dist/elements/mobile-nav/mobile-nav.js.map +1 -0
- package/dist/elements/product-gallery/index.d.ts +3 -0
- package/dist/elements/product-gallery/index.js +6 -0
- package/dist/elements/product-gallery/index.js.map +1 -0
- package/dist/elements/product-gallery/product-gallery.d.ts +49 -0
- package/dist/elements/product-gallery/product-gallery.js +143 -0
- package/dist/elements/product-gallery/product-gallery.js.map +1 -0
- package/dist/elements/quantity/index.d.ts +3 -0
- package/dist/elements/quantity/index.js +6 -0
- package/dist/elements/quantity/index.js.map +1 -0
- package/dist/elements/quantity/quantity.d.ts +21 -0
- package/dist/elements/quantity/quantity.js +57 -0
- package/dist/elements/quantity/quantity.js.map +1 -0
- package/dist/elements/questions/index.d.ts +3 -0
- package/dist/elements/questions/index.js +6 -0
- package/dist/elements/questions/index.js.map +1 -0
- package/dist/elements/questions/questions.d.ts +28 -0
- package/dist/elements/questions/questions.js +65 -0
- package/dist/elements/questions/questions.js.map +1 -0
- package/dist/elements/quick-view/index.d.ts +2 -0
- package/dist/elements/quick-view/index.js +6 -0
- package/dist/elements/quick-view/index.js.map +1 -0
- package/dist/elements/quick-view/quick-view.d.ts +26 -0
- package/dist/elements/quick-view/quick-view.js +70 -0
- package/dist/elements/quick-view/quick-view.js.map +1 -0
- package/dist/elements/range/index.d.ts +3 -0
- package/dist/elements/range/index.js +6 -0
- package/dist/elements/range/index.js.map +1 -0
- package/dist/elements/range/range.d.ts +24 -0
- package/dist/elements/range/range.js +37 -0
- package/dist/elements/range/range.js.map +1 -0
- package/dist/elements/related/index.d.ts +3 -0
- package/dist/elements/related/index.js +6 -0
- package/dist/elements/related/index.js.map +1 -0
- package/dist/elements/related/related.d.ts +33 -0
- package/dist/elements/related/related.js +66 -0
- package/dist/elements/related/related.js.map +1 -0
- package/dist/elements/review-form/index.d.ts +3 -0
- package/dist/elements/review-form/index.js +6 -0
- package/dist/elements/review-form/index.js.map +1 -0
- package/dist/elements/review-form/review-form.d.ts +60 -0
- package/dist/elements/review-form/review-form.js +158 -0
- package/dist/elements/review-form/review-form.js.map +1 -0
- package/dist/elements/reviews/index.d.ts +3 -0
- package/dist/elements/reviews/index.js +6 -0
- package/dist/elements/reviews/index.js.map +1 -0
- package/dist/elements/reviews/reviews.d.ts +19 -0
- package/dist/elements/reviews/reviews.js +30 -0
- package/dist/elements/reviews/reviews.js.map +1 -0
- package/dist/elements/search/index.d.ts +3 -0
- package/dist/elements/search/index.js +6 -0
- package/dist/elements/search/index.js.map +1 -0
- package/dist/elements/search/search.d.ts +20 -0
- package/dist/elements/search/search.js +53 -0
- package/dist/elements/search/search.js.map +1 -0
- package/dist/elements/shared/folding-form.d.ts +15 -0
- package/dist/elements/shared/folding-form.js +35 -0
- package/dist/elements/shared/folding-form.js.map +1 -0
- package/dist/elements/shared/google-maps.d.ts +100 -0
- package/dist/elements/shared/google-maps.js +34 -0
- package/dist/elements/shared/google-maps.js.map +1 -0
- package/dist/elements/shared/json-form.d.ts +28 -0
- package/dist/elements/shared/json-form.js +85 -0
- package/dist/elements/shared/json-form.js.map +1 -0
- package/dist/elements/shared/paged-section.d.ts +28 -0
- package/dist/elements/shared/paged-section.js +93 -0
- package/dist/elements/shared/paged-section.js.map +1 -0
- package/dist/elements/shared/phone-mask.d.ts +9 -0
- package/dist/elements/shared/phone-mask.js +38 -0
- package/dist/elements/shared/phone-mask.js.map +1 -0
- package/dist/elements/shared/select-item.d.ts +7 -0
- package/dist/elements/shared/select-item.js +19 -0
- package/dist/elements/shared/select-item.js.map +1 -0
- package/dist/elements/store-availability/index.d.ts +3 -0
- package/dist/elements/store-availability/index.js +6 -0
- package/dist/elements/store-availability/index.js.map +1 -0
- package/dist/elements/store-availability/store-availability.d.ts +26 -0
- package/dist/elements/store-availability/store-availability.js +66 -0
- package/dist/elements/store-availability/store-availability.js.map +1 -0
- package/dist/elements/store-map/index.d.ts +4 -0
- package/dist/elements/store-map/index.js +8 -0
- package/dist/elements/store-map/index.js.map +1 -0
- package/dist/elements/store-map/store-map.d.ts +59 -0
- package/dist/elements/store-map/store-map.js +118 -0
- package/dist/elements/store-map/store-map.js.map +1 -0
- package/dist/elements/tabs/index.d.ts +3 -0
- package/dist/elements/tabs/index.js +6 -0
- package/dist/elements/tabs/index.js.map +1 -0
- package/dist/elements/tabs/tabs.d.ts +21 -0
- package/dist/elements/tabs/tabs.js +69 -0
- package/dist/elements/tabs/tabs.js.map +1 -0
- package/dist/elements/toaster/index.d.ts +3 -0
- package/dist/elements/toaster/index.js +7 -0
- package/dist/elements/toaster/index.js.map +1 -0
- package/dist/elements/toaster/toaster.d.ts +47 -0
- package/dist/elements/toaster/toaster.js +109 -0
- package/dist/elements/toaster/toaster.js.map +1 -0
- package/dist/elements/variant-picker/index.d.ts +3 -0
- package/dist/elements/variant-picker/index.js +6 -0
- package/dist/elements/variant-picker/index.js.map +1 -0
- package/dist/elements/variant-picker/variant-picker.d.ts +28 -0
- package/dist/elements/variant-picker/variant-picker.js +83 -0
- package/dist/elements/variant-picker/variant-picker.js.map +1 -0
- package/dist/elements/vote/index.d.ts +3 -0
- package/dist/elements/vote/index.js +6 -0
- package/dist/elements/vote/index.js.map +1 -0
- package/dist/elements/vote/vote.d.ts +33 -0
- package/dist/elements/vote/vote.js +72 -0
- package/dist/elements/vote/vote.js.map +1 -0
- package/dist/lit/forms.d.ts +8 -0
- package/dist/lit/forms.js +42 -0
- package/dist/lit/forms.js.map +1 -0
- package/dist/lit/fragments.d.ts +28 -0
- package/dist/lit/fragments.js +74 -0
- package/dist/lit/fragments.js.map +1 -0
- package/dist/lit/index.d.ts +7 -0
- package/dist/lit/index.js +21 -0
- package/dist/lit/index.js.map +1 -0
- package/dist/lit/lazy-define.d.ts +35 -0
- package/dist/lit/lazy-define.js +103 -0
- package/dist/lit/lazy-define.js.map +1 -0
- package/dist/lit/signal-controller.d.ts +19 -0
- package/dist/lit/signal-controller.js +30 -0
- package/dist/lit/signal-controller.js.map +1 -0
- package/dist/lit/spmkt-element.d.ts +40 -0
- package/dist/lit/spmkt-element.js +76 -0
- package/dist/lit/spmkt-element.js.map +1 -0
- package/dist/locales/en.json +125 -0
- package/dist/locales/sr.json +130 -0
- package/package.json +45 -55
- package/MIGRATION_GUIDE.md +0 -310
- package/api/address.js +0 -115
- package/api/affiliate.js +0 -12
- package/api/cart.js +0 -81
- package/api/compare.js +0 -47
- package/api/countries.js +0 -13
- package/api/order.js +0 -27
- package/api/product-questions.js +0 -36
- package/api/product-reviews.js +0 -35
- package/api/product.js +0 -59
- package/api/request.js +0 -118
- package/api/user.js +0 -71
- package/api.js +0 -26
- package/components/Account/AccountDashboard.vue +0 -136
- package/components/Account/AccountStore.js +0 -97
- package/components/Account/AffiliateReport.vue +0 -98
- package/components/Account/Orders/OrderDetail.vue +0 -169
- package/components/Account/Orders/Orders.vue +0 -124
- package/components/Account/Settings/AccountSettings.vue +0 -45
- package/components/Account/Settings/ChangeEmail.vue +0 -136
- package/components/Account/Settings/ChangeName.vue +0 -82
- package/components/Account/Settings/ChangePassword.vue +0 -91
- package/components/Address/Address.vue +0 -141
- package/components/Address/AddressBook.vue +0 -171
- package/components/Address/AddressSelect.vue +0 -203
- package/components/Address/Edit.vue +0 -527
- package/components/Address/PostalCode.vue +0 -67
- package/components/Address/address.schema.js +0 -84
- package/components/AgeGate.vue +0 -109
- package/components/Auth/Login.vue +0 -191
- package/components/Auth/Register.vue +0 -240
- package/components/Auth/ResetPassword.vue +0 -108
- package/components/Cart/AgeVerification/AgeChecker.vue +0 -141
- package/components/Cart/CartBadge.vue +0 -68
- package/components/Cart/CartBox.vue +0 -139
- package/components/Cart/CartItem.vue +0 -126
- package/components/Cart/CartMode.vue +0 -200
- package/components/Cart/CartPreview.vue +0 -166
- package/components/Cart/CartSummary.vue +0 -107
- package/components/Cart/Coupon.vue +0 -107
- package/components/Cart/CreditCard/Everyware.vue +0 -262
- package/components/Cart/CreditCard/ExtendedCreditCard.vue +0 -240
- package/components/Cart/CreditCard/SquarePay.vue +0 -296
- package/components/Cart/CreditCard/StandardCreditCard.vue +0 -241
- package/components/Cart/Delivery/Delivery.vue +0 -364
- package/components/Cart/Delivery/DeliveryAddress.vue +0 -195
- package/components/Cart/Delivery/DeliveryAddressGuest.vue +0 -204
- package/components/Cart/Delivery/DeliveryMethods.vue +0 -109
- package/components/Cart/Delivery/DeliveryOptions.vue +0 -171
- package/components/Cart/Delivery/DeliveryTypes.vue +0 -61
- package/components/Cart/Delivery/DeliveryWarning.vue +0 -14
- package/components/Cart/Delivery/ReservationSlots.vue +0 -88
- package/components/Cart/Delivery/reservation.schema.js +0 -35
- package/components/Cart/Disclaimer.vue +0 -56
- package/components/Cart/OrderConfirmation.vue +0 -187
- package/components/Cart/Payment/Payment.vue +0 -436
- package/components/Cart/Payment/PaymentMethods.vue +0 -59
- package/components/Cart/ReviewAndSubmit.vue +0 -159
- package/components/Cart/ShoppingCart.vue +0 -219
- package/components/Cart/Store/actions.js +0 -129
- package/components/Cart/Store/getters.js +0 -80
- package/components/Cart/Store/index.js +0 -14
- package/components/Cart/Store/mutations.js +0 -172
- package/components/Cart/Store/state.js +0 -80
- package/components/Cart/UserIdentity.vue +0 -178
- package/components/Category/CategoryFilter.vue +0 -330
- package/components/Category/CategorySort.vue +0 -77
- package/components/Category/FilterMixin.js +0 -70
- package/components/Category/LoadMore.vue +0 -98
- package/components/DeliverTo.vue +0 -51
- package/components/DeliveryNotice.vue +0 -123
- package/components/DobInput.vue +0 -294
- package/components/Gmaps/GmapsAutocomplete.vue +0 -166
- package/components/Gmaps/GmapsLocations.vue +0 -233
- package/components/Gmaps/GmapsSingleLocation.vue +0 -134
- package/components/MobileMenu/MobileMenu.vue +0 -224
- package/components/MobileMenu/components/MenuBurger.vue +0 -23
- package/components/MobileMenu/components/MenuPanel.vue +0 -80
- package/components/MobileMenu/components/MenuShadow.vue +0 -21
- package/components/MobileMenu/demo-data.js +0 -97
- package/components/MobileMenu/icons/LeftArrowIcon.vue +0 -25
- package/components/MobileMenu/icons/MenuIcon.vue +0 -27
- package/components/MobileMenu/icons/RightArrowIcon.vue +0 -25
- package/components/MobileMenu/index.js +0 -8
- package/components/MobileMenu/mixins/contentControl.mixin.js +0 -46
- package/components/MobileMenu/mixins/functionalityStyle.mixin.js +0 -59
- package/components/MobileMenu/mixins/panelControl.mixin.js +0 -51
- package/components/ModalContainer/ModalContainer.vue +0 -212
- package/components/ModalContainer/index.js +0 -103
- package/components/Oembed.vue +0 -46
- package/components/Product/AddToCart.vue +0 -284
- package/components/Product/BoxAddToCart.vue +0 -177
- package/components/Product/Compare.vue +0 -150
- package/components/Product/CompareBox.vue +0 -162
- package/components/Product/Lookup.vue +0 -132
- package/components/Product/Photo.vue +0 -115
- package/components/Product/Price.vue +0 -106
- package/components/Product/ProductAutocomplete.vue +0 -103
- package/components/Product/ProductBox.vue +0 -88
- package/components/Product/ProductImages.vue +0 -137
- package/components/Product/Quantity.vue +0 -126
- package/components/Product/QuickView.vue +0 -145
- package/components/Product/RelatedProducts.vue +0 -104
- package/components/Product/SKU.vue +0 -46
- package/components/Product/Variants.vue +0 -399
- package/components/Product/reviews-questions/ProductQuestions.vue +0 -319
- package/components/Product/reviews-questions/ProductReviews.vue +0 -182
- package/components/Product/reviews-questions/Review.vue +0 -126
- package/components/Product/reviews-questions/ReviewForm.vue +0 -313
- package/components/Product/reviews-questions/ReviewImages.vue +0 -229
- package/components/Product/reviews-questions/Vote.vue +0 -104
- package/components/QuantityInput.vue +0 -111
- package/components/RangeInput.vue +0 -141
- package/components/Recaptcha.vue +0 -104
- package/components/SelectShippingCountry.vue +0 -115
- package/components/TimedOffer.vue +0 -84
- package/composables/globals.js +0 -53
- package/config.js +0 -21
- package/index.js +0 -182
- package/install.js +0 -88
- package/locales/en.json +0 -288
- package/locales/sr.json +0 -288
- package/translations.js +0 -4
- package/utils/animate.css +0 -50
- package/utils/animate.js +0 -23
- package/utils/buefy.js +0 -62
- package/utils/custom-event-bus.js +0 -13
- package/utils/directives.js +0 -79
- package/utils/event-bus.js +0 -56
- package/utils/filters.js +0 -110
- package/utils/format-date.js +0 -17
- package/utils/google/gmaps.js +0 -269
- package/utils/google/google-analytics-eec.js +0 -108
- package/utils/native-dom.js +0 -27
- package/utils/objects.js +0 -19
- package/utils/random-id.js +0 -10
- package/utils/rc-token.js +0 -24
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="gmaps-place-input">
|
|
3
|
-
<div v-if="loading" :class="{ 'is-error': loaderFailed }">
|
|
4
|
-
{{ msg }}
|
|
5
|
-
</div>
|
|
6
|
-
<template v-else>
|
|
7
|
-
<b-field
|
|
8
|
-
:label="label"
|
|
9
|
-
label-position="inside"
|
|
10
|
-
:type="fetchFailed ? 'is-danger' : ''"
|
|
11
|
-
:message="fetchFailed ? $t('address.autocompleteUnavailable') : ''"
|
|
12
|
-
>
|
|
13
|
-
<!-- append-to-body: the address modal's body scrolls and would clip the dropdown -->
|
|
14
|
-
<b-autocomplete
|
|
15
|
-
v-model="pacInput"
|
|
16
|
-
append-to-body
|
|
17
|
-
:data="suggestions"
|
|
18
|
-
:loading="isFetching"
|
|
19
|
-
:placeholder="placeholderText"
|
|
20
|
-
:custom-formatter="formatSuggestion"
|
|
21
|
-
@typing="fetchSuggestions"
|
|
22
|
-
@select="selectSuggestion"
|
|
23
|
-
>
|
|
24
|
-
<template #default="{ option }">
|
|
25
|
-
<strong>{{ option.mainText?.toString() }}</strong>
|
|
26
|
-
<small v-if="option.secondaryText" class="ml-1">{{ option.secondaryText.toString() }}</small>
|
|
27
|
-
</template>
|
|
28
|
-
</b-autocomplete>
|
|
29
|
-
</b-field>
|
|
30
|
-
</template>
|
|
31
|
-
</div>
|
|
32
|
-
</template>
|
|
33
|
-
|
|
34
|
-
<script setup>
|
|
35
|
-
import { ref } from 'vue'
|
|
36
|
-
import _ from 'underscore'
|
|
37
|
-
// Defines window.customEventBus, which hosts call to announce that Maps has loaded
|
|
38
|
-
import '../../utils/custom-event-bus'
|
|
39
|
-
import gmaps from '../../utils/google/gmaps'
|
|
40
|
-
import { addressSchema } from '../Address/address.schema'
|
|
41
|
-
|
|
42
|
-
const props = defineProps({
|
|
43
|
-
label: {
|
|
44
|
-
type: String,
|
|
45
|
-
default: 'Enter a street address'
|
|
46
|
-
},
|
|
47
|
-
placeholderText: {
|
|
48
|
-
type: String,
|
|
49
|
-
default: ''
|
|
50
|
-
},
|
|
51
|
-
restrictToCountries: {
|
|
52
|
-
type: Array,
|
|
53
|
-
default: () => []
|
|
54
|
-
},
|
|
55
|
-
inputId: {
|
|
56
|
-
type: String,
|
|
57
|
-
default: 'pac-input'
|
|
58
|
-
}
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
const emit = defineEmits(['update:modelValue', 'input'])
|
|
62
|
-
|
|
63
|
-
const loading = ref(false)
|
|
64
|
-
const loaderFailed = ref(false)
|
|
65
|
-
const msg = ref('')
|
|
66
|
-
const pacInput = ref('')
|
|
67
|
-
const suggestions = ref([])
|
|
68
|
-
const isFetching = ref(false)
|
|
69
|
-
const fetchFailed = ref(false)
|
|
70
|
-
// Only the latest request may clear the spinner
|
|
71
|
-
let latestFetch = 0
|
|
72
|
-
|
|
73
|
-
// One token per typing-and-select session, so Google bills it as one session
|
|
74
|
-
let sessionToken = null
|
|
75
|
-
|
|
76
|
-
// The Maps script loads after the page module, so look the library up when it is needed
|
|
77
|
-
const placesApi = () => window.google?.maps?.places
|
|
78
|
-
|
|
79
|
-
const formatSuggestion = (prediction) => prediction.text.toString()
|
|
80
|
-
|
|
81
|
-
const countryCodes = () => props.restrictToCountries.filter(c => typeof c === 'string' && c.length > 0)
|
|
82
|
-
|
|
83
|
-
const fetchSuggestions = _.debounce(async (query) => {
|
|
84
|
-
const places = placesApi()
|
|
85
|
-
if (!query || !places?.AutocompleteSuggestion) {
|
|
86
|
-
suggestions.value = []
|
|
87
|
-
return
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
sessionToken ??= new places.AutocompleteSessionToken()
|
|
91
|
-
const request = { input: query, sessionToken }
|
|
92
|
-
const countries = countryCodes()
|
|
93
|
-
if (countries.length > 0) {
|
|
94
|
-
request.includedRegionCodes = countries
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const fetchId = ++latestFetch
|
|
98
|
-
isFetching.value = true
|
|
99
|
-
try {
|
|
100
|
-
const response = await places.AutocompleteSuggestion.fetchAutocompleteSuggestions(request)
|
|
101
|
-
// Drop responses for text the user has already moved past
|
|
102
|
-
if (pacInput.value === query) {
|
|
103
|
-
suggestions.value = response.suggestions
|
|
104
|
-
.map(suggestion => suggestion.placePrediction)
|
|
105
|
-
.filter(Boolean)
|
|
106
|
-
}
|
|
107
|
-
fetchFailed.value = false
|
|
108
|
-
} catch (error) {
|
|
109
|
-
// Most often the key lacks the Places API (New), which AutocompleteSuggestion needs
|
|
110
|
-
console.error('Google Places autocomplete failed. Is the Places API (New) enabled for this key?', error)
|
|
111
|
-
suggestions.value = []
|
|
112
|
-
fetchFailed.value = true
|
|
113
|
-
} finally {
|
|
114
|
-
if (fetchId === latestFetch) {
|
|
115
|
-
isFetching.value = false
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}, 250)
|
|
119
|
-
|
|
120
|
-
// Place (New) uses longText/shortText; the shared parser expects the legacy names
|
|
121
|
-
const toLegacyComponents = (components) => components.map(component => ({
|
|
122
|
-
long_name: component.longText,
|
|
123
|
-
short_name: component.shortText,
|
|
124
|
-
types: component.types
|
|
125
|
-
}))
|
|
126
|
-
|
|
127
|
-
const selectSuggestion = async (prediction) => {
|
|
128
|
-
if (!prediction) {
|
|
129
|
-
return
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const place = prediction.toPlace()
|
|
133
|
-
// A keystroke still waiting on the debounce would open a new, separately billed session
|
|
134
|
-
fetchSuggestions.cancel()
|
|
135
|
-
// fetchFields ends the session; the next keystroke starts a new one
|
|
136
|
-
sessionToken = null
|
|
137
|
-
suggestions.value = []
|
|
138
|
-
|
|
139
|
-
try {
|
|
140
|
-
await place.fetchFields({ fields: ['addressComponents', 'location', 'displayName'] })
|
|
141
|
-
} catch (error) {
|
|
142
|
-
console.error('Google Places details request failed', error)
|
|
143
|
-
return
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if (!place.location) {
|
|
147
|
-
window.alert("No details available for input: '" + place.displayName + "'")
|
|
148
|
-
return
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (place.addressComponents) {
|
|
152
|
-
const parsedAddress = gmaps.getAddressFromComponents({ ...addressSchema }, toLegacyComponents(place.addressComponents))
|
|
153
|
-
const result = {
|
|
154
|
-
address: parsedAddress,
|
|
155
|
-
coordinates: {
|
|
156
|
-
lat: place.location.lat(),
|
|
157
|
-
lng: place.location.lng()
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// Emit both for backwards compatibility and Vue 3 v-model
|
|
162
|
-
emit('input', result)
|
|
163
|
-
emit('update:modelValue', result)
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
</script>
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="gmaps-locations">
|
|
3
|
-
<div class="search-locations">
|
|
4
|
-
<div v-if="acSearchLabel" class="search-label">{{ acSearchLabel }}</div>
|
|
5
|
-
<slot></slot>
|
|
6
|
-
<GmapsAutocomplete
|
|
7
|
-
label=""
|
|
8
|
-
:placeholder-text="acPlaceholderText"
|
|
9
|
-
:restrict-to-countries="acRestrictToCountries"
|
|
10
|
-
@input="autocompleteInput"
|
|
11
|
-
/>
|
|
12
|
-
<div v-if="acShowResults && nearestLocations.length > 0" class="nearest-locations">
|
|
13
|
-
<div v-for="(nloc, index) in nearestLocations" class="search-locations-result" :tabindex="index" @click="centerMap(nloc)">
|
|
14
|
-
<strong>{{ nloc.name }}</strong>
|
|
15
|
-
<div v-if="nloc.status===2" class="opening-soon-xs">Opening soon</div>
|
|
16
|
-
<div v-if="nloc.distance">Distance: {{ formatNumber(nloc.distance) }}km</div>
|
|
17
|
-
<p>{{ nloc.address.address1 }}</p>
|
|
18
|
-
<p>
|
|
19
|
-
<span>{{ nloc.address.city }}</span>,
|
|
20
|
-
<span v-if="nloc.address.state && nloc.address.state.name">{{ nloc.address.state ? nloc.address.state.name : '' }}</span>
|
|
21
|
-
</p>
|
|
22
|
-
<p>
|
|
23
|
-
<span v-if="nloc.address.postcode">{{ nloc.address.postcode }}</span>
|
|
24
|
-
</p>
|
|
25
|
-
<p v-if="nloc.address.phone">Phone number: {{ nloc.address.phone }}</p>
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
</div>
|
|
29
|
-
<div class="map-locations" id="map-locations"></div>
|
|
30
|
-
</div>
|
|
31
|
-
</template>
|
|
32
|
-
|
|
33
|
-
<script>
|
|
34
|
-
import _ from 'underscore'
|
|
35
|
-
|
|
36
|
-
import { formatNumber } from '../../utils/filters'
|
|
37
|
-
import '../../utils/custom-event-bus'
|
|
38
|
-
import gmaps from '../../utils/google/gmaps'
|
|
39
|
-
import { Address } from '../../api'
|
|
40
|
-
|
|
41
|
-
import GmapsAutocomplete from './GmapsAutocomplete'
|
|
42
|
-
|
|
43
|
-
export default {
|
|
44
|
-
name: 'GmapsLocations',
|
|
45
|
-
components: { GmapsAutocomplete },
|
|
46
|
-
props: {
|
|
47
|
-
acPlaceholderText: {
|
|
48
|
-
type: String,
|
|
49
|
-
default: 'Enter address'
|
|
50
|
-
},
|
|
51
|
-
acSearchLabel: {
|
|
52
|
-
type: String,
|
|
53
|
-
default: ''
|
|
54
|
-
},
|
|
55
|
-
acShowResults: {
|
|
56
|
-
type: Boolean,
|
|
57
|
-
default: true
|
|
58
|
-
},
|
|
59
|
-
acRestrictToCountries: {
|
|
60
|
-
type: Array,
|
|
61
|
-
default: function () {
|
|
62
|
-
return []
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
mapId: {
|
|
66
|
-
type: String,
|
|
67
|
-
default: ''
|
|
68
|
-
},
|
|
69
|
-
mapStyles: {
|
|
70
|
-
type: Array,
|
|
71
|
-
default: function () {
|
|
72
|
-
return []
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
data() {
|
|
77
|
-
return {
|
|
78
|
-
loading: true,
|
|
79
|
-
loaderFailed: false,
|
|
80
|
-
msg: 'Loading Google Maps...',
|
|
81
|
-
retailLocations: [],
|
|
82
|
-
nearestLocations: [],
|
|
83
|
-
map: null,
|
|
84
|
-
markers: [],
|
|
85
|
-
userLocationMarker: null,
|
|
86
|
-
infowindow: null
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
methods: {
|
|
91
|
-
formatNumber,
|
|
92
|
-
init() {
|
|
93
|
-
let vm = this
|
|
94
|
-
|
|
95
|
-
if (this.$mq === 'mobile') {
|
|
96
|
-
gmaps.MAP_OPTIONS.disableDefaultUI = true
|
|
97
|
-
gmaps.MAP_OPTIONS.scrollwheel = true
|
|
98
|
-
gmaps.MAP_OPTIONS.gestureHandling = 'greedy'
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (this.mapId) {
|
|
102
|
-
gmaps.MAP_OPTIONS.mapId = this.mapId
|
|
103
|
-
} else {
|
|
104
|
-
if (this.mapStyles.length > 0) {
|
|
105
|
-
gmaps.MAP_OPTIONS.styles = this.mapStyles
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
console.log('gmaps init', gmaps.MAP_OPTIONS)
|
|
109
|
-
let map = new google.maps.Map(document.getElementById('map-locations'), gmaps.MAP_OPTIONS)
|
|
110
|
-
|
|
111
|
-
this.map = map
|
|
112
|
-
this.infowindow = new google.maps.InfoWindow()
|
|
113
|
-
|
|
114
|
-
for (let i = 0; i < vm.retailLocations.length; i++) {
|
|
115
|
-
if (!vm.retailLocations[i].coordinates) {
|
|
116
|
-
continue
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
let markerColor = 'red'
|
|
120
|
-
if(vm.retailLocations[i].status === 2) {
|
|
121
|
-
markerColor = 'yellow'
|
|
122
|
-
}
|
|
123
|
-
let marker = gmaps.createMarker(map, vm.retailLocations[i].coordinates.lat, vm.retailLocations[i].coordinates.lng, markerColor)
|
|
124
|
-
|
|
125
|
-
this.markers.push(marker)
|
|
126
|
-
|
|
127
|
-
google.maps.event.addListener(
|
|
128
|
-
marker,
|
|
129
|
-
'click',
|
|
130
|
-
(function (marker, i) {
|
|
131
|
-
return function () {
|
|
132
|
-
vm.infowindow.setContent(`
|
|
133
|
-
<div class="gmaps-locations-infowindow">
|
|
134
|
-
<div><strong>${vm.retailLocations[i].name}</strong></div>
|
|
135
|
-
<div>${Address.getFormatted(vm.retailLocations[i].address)}</div>
|
|
136
|
-
<div><button onclick='customEventBus.dispatchEvent("viewLocation", ${vm.retailLocations[i].id})'>See Store</button></div>
|
|
137
|
-
</div>
|
|
138
|
-
`)
|
|
139
|
-
vm.infowindow.open(map, marker)
|
|
140
|
-
}
|
|
141
|
-
})(marker, i)
|
|
142
|
-
)
|
|
143
|
-
this.retailLocations[i].marker = marker
|
|
144
|
-
}
|
|
145
|
-
this.updateMapBounds()
|
|
146
|
-
|
|
147
|
-
/*google.maps.event.addListener(this.map, 'bounds_changed', function(event) {
|
|
148
|
-
console.log(vm.map.getCenter().lat(), vm.map.getCenter().lng(), vm.map.getZoom())
|
|
149
|
-
})*/
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
updateMapBounds(markers) {
|
|
153
|
-
let bounds = new google.maps.LatLngBounds()
|
|
154
|
-
if (!markers) {
|
|
155
|
-
markers = this.markers
|
|
156
|
-
}
|
|
157
|
-
for (let i = 0; i < markers.length; i++) {
|
|
158
|
-
bounds.extend(markers[i].position)
|
|
159
|
-
}
|
|
160
|
-
this.map.fitBounds(bounds)
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
async getList() {
|
|
164
|
-
this.retailLocations = this.initialState.retail_locations
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
viewLocation(id) {
|
|
168
|
-
window.location.href = '/locations/' + id
|
|
169
|
-
},
|
|
170
|
-
|
|
171
|
-
autocompleteInput(address) {
|
|
172
|
-
console.log('autocompleteinput ', address)
|
|
173
|
-
this.infowindow.close()
|
|
174
|
-
if (!this.userLocationMarker) {
|
|
175
|
-
this.userLocationMarker = new google.maps.Marker({
|
|
176
|
-
position: new google.maps.LatLng(address.coordinates.lat, address.coordinates.lng),
|
|
177
|
-
map: this.map,
|
|
178
|
-
icon: {
|
|
179
|
-
url: 'http://maps.google.com/mapfiles/ms/icons/blue-dot.png'
|
|
180
|
-
}
|
|
181
|
-
})
|
|
182
|
-
this.markers.push(this.userLocationMarker)
|
|
183
|
-
} else {
|
|
184
|
-
this.userLocationMarker.setPosition(address.coordinates)
|
|
185
|
-
}
|
|
186
|
-
//this.updateMapBounds()
|
|
187
|
-
//this.map.setCenter(address.coordinates)
|
|
188
|
-
//this.map.setZoom(14)
|
|
189
|
-
|
|
190
|
-
this.nearestLocations = gmaps.findNearest(address.coordinates, this.retailLocations)
|
|
191
|
-
let boundsSlice = 1
|
|
192
|
-
if (this.nearestLocations[0].distance < 0.1) {
|
|
193
|
-
boundsSlice = 1
|
|
194
|
-
}
|
|
195
|
-
this.updateMapBounds([this.userLocationMarker, ..._.pluck(this.nearestLocations.slice(0, boundsSlice), 'marker')])
|
|
196
|
-
|
|
197
|
-
if (!address.address.postcode && !address.address.city) {
|
|
198
|
-
this.map.setCenter(address.coordinates)
|
|
199
|
-
this.map.setZoom(5)
|
|
200
|
-
}
|
|
201
|
-
/*if (boundsSlice === 1) {
|
|
202
|
-
this.map.setZoom(15)
|
|
203
|
-
}*/
|
|
204
|
-
},
|
|
205
|
-
|
|
206
|
-
centerMap(location) {
|
|
207
|
-
this.infowindow.setContent(`
|
|
208
|
-
<div class="gmaps-locations-infowindow">
|
|
209
|
-
<div><strong>${location.name}</strong></div>
|
|
210
|
-
<div>${Address.getFormatted(location.address)}</div>
|
|
211
|
-
<div><button onclick='customEventBus.dispatchEvent("viewLocation", ${location.id})'>See Store</button></div>
|
|
212
|
-
</div>
|
|
213
|
-
`)
|
|
214
|
-
this.infowindow.open(this.map, location.marker)
|
|
215
|
-
this.map.setZoom(14)
|
|
216
|
-
this.map.setCenter(location.coordinates)
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
|
|
220
|
-
async mounted() {
|
|
221
|
-
await this.getList()
|
|
222
|
-
this.nearestLocations = this.retailLocations
|
|
223
|
-
customEventBus.addEventListener('viewLocation', (event) => {
|
|
224
|
-
this.viewLocation(event.detail)
|
|
225
|
-
})
|
|
226
|
-
customEventBus.addEventListener('gmapsLoaded', () => {
|
|
227
|
-
this.init()
|
|
228
|
-
})
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
</script>
|
|
232
|
-
|
|
233
|
-
<style scoped></style>
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="gm-single-location" id="gm-single-location" ref="mapElement"></div>
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script setup>
|
|
6
|
-
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
|
7
|
-
import { useMq } from '../../composables/globals'
|
|
8
|
-
import '../../utils/custom-event-bus'
|
|
9
|
-
import gmaps from '../../utils/google/gmaps'
|
|
10
|
-
import { Address } from '../../api'
|
|
11
|
-
|
|
12
|
-
const props = defineProps({
|
|
13
|
-
location: {
|
|
14
|
-
type: Object,
|
|
15
|
-
default: () => ({
|
|
16
|
-
coordinates: { lat: 0, lng: 0 },
|
|
17
|
-
name: '',
|
|
18
|
-
address: {},
|
|
19
|
-
status: 0
|
|
20
|
-
})
|
|
21
|
-
},
|
|
22
|
-
zoomLevel: {
|
|
23
|
-
type: Number,
|
|
24
|
-
default: 14
|
|
25
|
-
},
|
|
26
|
-
mapId: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: ''
|
|
29
|
-
},
|
|
30
|
-
mapStyles: {
|
|
31
|
-
type: Array,
|
|
32
|
-
default: () => []
|
|
33
|
-
}
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
const mapElement = ref(null)
|
|
37
|
-
const mapInstance = ref(null)
|
|
38
|
-
const infoWindow = ref(null)
|
|
39
|
-
|
|
40
|
-
const mq = useMq()
|
|
41
|
-
const isMobile = computed(() => mq.value === 'mobile')
|
|
42
|
-
|
|
43
|
-
const buildMapOptions = () => {
|
|
44
|
-
const options = { ...gmaps.MAP_OPTIONS }
|
|
45
|
-
|
|
46
|
-
if (isMobile.value) {
|
|
47
|
-
options.disableDefaultUI = true
|
|
48
|
-
options.scrollwheel = true
|
|
49
|
-
options.gestureHandling = 'greedy'
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (props.mapId) {
|
|
53
|
-
options.mapId = props.mapId
|
|
54
|
-
delete options.styles
|
|
55
|
-
} else if (props.mapStyles.length > 0) {
|
|
56
|
-
options.styles = props.mapStyles
|
|
57
|
-
delete options.mapId
|
|
58
|
-
} else {
|
|
59
|
-
delete options.mapId
|
|
60
|
-
delete options.styles
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return options
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const openInfoWindow = (marker) => {
|
|
67
|
-
if (!infoWindow.value || !mapInstance.value) {
|
|
68
|
-
return
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const name = props.location?.name || ''
|
|
72
|
-
const addressHtml = Address.getFormatted(props.location?.address || {})
|
|
73
|
-
|
|
74
|
-
infoWindow.value.setContent(`
|
|
75
|
-
<div class="gmaps-locations-infowindow">
|
|
76
|
-
<div><strong>${name}</strong></div>
|
|
77
|
-
<div>${addressHtml}</div>
|
|
78
|
-
</div>
|
|
79
|
-
`)
|
|
80
|
-
infoWindow.value.open(mapInstance.value, marker)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const initMap = () => {
|
|
84
|
-
const hasGoogle = window?.google && window.google.maps && typeof window.google.maps.Map === 'function'
|
|
85
|
-
if (!mapElement.value || !hasGoogle || !props.location?.coordinates) {
|
|
86
|
-
return
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const options = buildMapOptions()
|
|
90
|
-
const map = new window.google.maps.Map(mapElement.value, options)
|
|
91
|
-
|
|
92
|
-
mapInstance.value = map
|
|
93
|
-
infoWindow.value = new window.google.maps.InfoWindow()
|
|
94
|
-
|
|
95
|
-
const { lat, lng } = props.location.coordinates
|
|
96
|
-
const markerColor = props.location.status === 2 ? 'yellow' : 'red'
|
|
97
|
-
const marker = gmaps.createMarker(map, lat, lng, markerColor)
|
|
98
|
-
|
|
99
|
-
map.setCenter(props.location.coordinates)
|
|
100
|
-
map.setZoom(props.zoomLevel)
|
|
101
|
-
|
|
102
|
-
window.google.maps.event.addListener(marker, 'click', () => {
|
|
103
|
-
openInfoWindow(marker)
|
|
104
|
-
})
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const handleGmapsLoaded = () => {
|
|
108
|
-
initMap()
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
onMounted(() => {
|
|
112
|
-
if (window.google?.maps?.Map) {
|
|
113
|
-
initMap()
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (window.customEventBus) {
|
|
117
|
-
window.customEventBus.addEventListener('gmapsLoaded', handleGmapsLoaded)
|
|
118
|
-
}
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
onBeforeUnmount(() => {
|
|
122
|
-
if (window.customEventBus?.bus) {
|
|
123
|
-
window.customEventBus.bus.removeEventListener('gmapsLoaded', handleGmapsLoaded)
|
|
124
|
-
}
|
|
125
|
-
})
|
|
126
|
-
</script>
|
|
127
|
-
|
|
128
|
-
<style scoped>
|
|
129
|
-
.gm-single-location {
|
|
130
|
-
width: 100%;
|
|
131
|
-
height: 100%;
|
|
132
|
-
min-height: 320px;
|
|
133
|
-
}
|
|
134
|
-
</style>
|