cloudcommerce 0.0.124 → 0.0.126
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/.eslintrc.cjs +26 -7
- package/.gitmodules +3 -0
- package/CHANGELOG.md +15 -0
- package/action.yml +5 -1
- package/ecomplus-stores/monocard/functions/core/package.json +1 -1
- package/ecomplus-stores/monocard/functions/events/package.json +2 -2
- package/ecomplus-stores/monocard/functions/modules/package.json +2 -2
- package/ecomplus-stores/monocard/functions/passport/package.json +2 -2
- package/ecomplus-stores/monocard/functions/ssr/package.json +7 -4
- package/ecomplus-stores/monocard/functions/ssr/src/main/Home.astro +1 -1
- package/ecomplus-stores/monocard/package.json +1 -1
- package/ecomplus-stores/tia-sonia/.github/renovate.json +5 -0
- package/ecomplus-stores/tia-sonia/.github/workflows/build-and-deploy.yml +41 -0
- package/ecomplus-stores/tia-sonia/.github/workflows/calibreapp-image-actions.yml +23 -0
- package/ecomplus-stores/tia-sonia/.vscode/extensions.json +8 -0
- package/ecomplus-stores/tia-sonia/.vscode/settings.json +5 -0
- package/ecomplus-stores/tia-sonia/LICENSE.md +230 -0
- package/ecomplus-stores/tia-sonia/README.md +117 -0
- package/ecomplus-stores/tia-sonia/README.pt-BR.md +117 -0
- package/ecomplus-stores/tia-sonia/functions/config.json +3 -0
- package/ecomplus-stores/tia-sonia/functions/core/index.js +9 -0
- package/ecomplus-stores/tia-sonia/functions/core/package.json +20 -0
- package/ecomplus-stores/tia-sonia/functions/events/index.js +9 -0
- package/ecomplus-stores/tia-sonia/functions/events/package.json +21 -0
- package/ecomplus-stores/tia-sonia/functions/example.env +10 -0
- package/ecomplus-stores/tia-sonia/functions/modules/index.js +9 -0
- package/ecomplus-stores/tia-sonia/functions/modules/package.json +21 -0
- package/ecomplus-stores/tia-sonia/functions/passport/index.js +9 -0
- package/ecomplus-stores/tia-sonia/functions/passport/package.json +21 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/.eslintrc.cjs +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/astro.config.mjs +4 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/blog.json +18 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/brands.json +24 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/categories.json +24 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/code.json +5 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/collections.json +24 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/contacts.json +13 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/footer.json +46 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/header.json +35 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/home.json +45 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/info.json +18 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/maintenance.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/menu.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/pages/contato.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/pages/entrega.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/pages/faq.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/pages/pagamentos.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/pages/privacidade.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/pages/sobre-nos.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/pages/termos.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/pages/trocas.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/posts/esta-loja-e-um-pwa.json +9 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/products.json +32 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/search.json +8 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/settings.json +14 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/social.json +5 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/analytics.json +11 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/compre-confie.json +11 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/ebit.json +11 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/fb-pixel.json +12 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/gmc-ratings.json +12 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/minicart.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/offers-notification.json +11 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/opinioes-verificadas.json +18 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/product-card.json +10 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/product.json +13 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/search-engine.json +8 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/search.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/tag-manager.json +12 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/tawkto.json +12 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/trustvox.json +15 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/user.json +5 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/index.js +18 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/package.json +30 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/admin/config.json +1 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/cms-preview.css +274 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/cms.css +114 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/cvv.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/icons/bootstrap-icons/font/storefront-icons.woff2 +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/icons/feather-icons/font/storefront-icons.woff2 +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/icons/font-awesome/font/storefront-icons.woff2 +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/icons/line-awesome/font/storefront-icons.woff2 +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/icons/tabler-icons/font/storefront-icons.woff2 +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/img-placeholder.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/payments.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/ssl-safe.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/icon.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/large-icon.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/banner1.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/banner2.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/banner2.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/favicon.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/headless.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/headphone.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/headphone.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/icon.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/large-icon.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/logo.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/logo.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/og-image.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/passion.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/passion.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/pwa-reliable.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/rect8589.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/rect859.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/rect89.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/rect89.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/ssl-safe.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/robots.txt +8 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/assets/.gitkeep +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/TheHeader.vue +42 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/TopBar.vue +133 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/header/HeaderButtonLink.vue +5 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/header/HeaderButtons.vue +46 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/header/HeaderNav.vue +9 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/header/HeaderNavLink.vue +5 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/env.d.ts +3 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/layouts/Base.astro +34 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/layouts/Checkout.astro +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/layouts/Pages.astro +19 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/layouts/PagesHeader.astro +117 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/main/Fallback.astro +15 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/main/Home.astro +19 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/main/Wildcard.astro +21 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/pages/[...slug].astro +36 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/pages/app/account.astro +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/pages/app/index.astro +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/pages/fallback.astro +19 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/pages/index.astro +31 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/scripts/InlineScripts.astro +11 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/tailwind.config.cjs +4 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/tsconfig.json +16 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/uno.config.ts +4 -0
- package/ecomplus-stores/tia-sonia/package.json +28 -0
- package/ecomplus-stores/tia-sonia/scripts/install.sh +9 -0
- package/package.json +14 -14
- package/packages/api/package.json +1 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/mercadopago/lib/mercadopago.js +0 -2
- package/packages/apps/mercadopago/lib/mercadopago.js.map +1 -1
- package/packages/apps/mercadopago/lib/mp-webhook.js +0 -2
- package/packages/apps/mercadopago/lib/mp-webhook.js.map +1 -1
- package/packages/apps/mercadopago/package.json +4 -4
- package/packages/apps/mercadopago/src/mercadopago.ts +0 -3
- package/packages/apps/mercadopago/src/mp-webhook.ts +0 -2
- package/packages/apps/tiny-erp/lib/event-to-tiny.js +1 -1
- package/packages/apps/tiny-erp/lib/event-to-tiny.js.map +1 -1
- package/packages/apps/tiny-erp/lib/integration/after-tiny-queue.js +1 -1
- package/packages/apps/tiny-erp/lib/integration/after-tiny-queue.js.map +1 -1
- package/packages/apps/tiny-erp/lib/integration/export-order-to-tiny.js +1 -1
- package/packages/apps/tiny-erp/lib/integration/export-order-to-tiny.js.map +1 -1
- package/packages/apps/tiny-erp/lib/integration/import-order-from-tiny.js +1 -2
- package/packages/apps/tiny-erp/lib/integration/import-order-from-tiny.js.map +1 -1
- package/packages/apps/tiny-erp/lib/integration/import-product-from-tiny.js +1 -1
- package/packages/apps/tiny-erp/lib/integration/import-product-from-tiny.js.map +1 -1
- package/packages/apps/tiny-erp/lib/integration/parsers/product-from-tiny.js +1 -1
- package/packages/apps/tiny-erp/lib/integration/parsers/product-from-tiny.js.map +1 -1
- package/packages/apps/tiny-erp/lib/tiny-erp.js +0 -1
- package/packages/apps/tiny-erp/lib/tiny-erp.js.map +1 -1
- package/packages/apps/tiny-erp/lib/tiny-webhook.js +1 -1
- package/packages/apps/tiny-erp/lib/tiny-webhook.js.map +1 -1
- package/packages/apps/tiny-erp/package.json +4 -4
- package/packages/apps/tiny-erp/src/event-to-tiny.ts +1 -1
- package/packages/apps/tiny-erp/src/integration/after-tiny-queue.ts +1 -1
- package/packages/apps/tiny-erp/src/integration/export-order-to-tiny.ts +1 -1
- package/packages/apps/tiny-erp/src/integration/import-order-from-tiny.ts +1 -2
- package/packages/apps/tiny-erp/src/integration/import-product-from-tiny.ts +1 -1
- package/packages/apps/tiny-erp/src/integration/parsers/product-from-tiny.ts +1 -1
- package/packages/apps/tiny-erp/src/tiny-erp.ts +0 -1
- package/packages/apps/tiny-erp/src/tiny-webhook.ts +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/events/package.json +4 -4
- package/packages/firebase/lib/config.js +3 -3
- package/packages/firebase/lib/handlers/check-store-events.js +1 -2
- package/packages/firebase/lib/handlers/check-store-events.js.map +1 -1
- package/packages/firebase/lib/helpers/update-app-data.js +1 -1
- package/packages/firebase/lib/helpers/update-app-data.js.map +1 -1
- package/packages/firebase/lib/init.js +0 -2
- package/packages/firebase/lib/init.js.map +1 -1
- package/packages/firebase/package.json +4 -4
- package/packages/firebase/src/config.ts +3 -3
- package/packages/firebase/src/handlers/check-store-events.ts +1 -2
- package/packages/firebase/src/helpers/update-app-data.ts +1 -1
- package/packages/firebase/src/init.ts +0 -2
- package/packages/i18n/package.json +1 -1
- package/packages/modules/lib/firebase/call-app-module.js +1 -1
- package/packages/modules/lib/firebase/call-app-module.js.map +1 -1
- package/packages/modules/lib/firebase/checkout.js +9 -7
- package/packages/modules/lib/firebase/checkout.js.map +1 -1
- package/packages/modules/lib/firebase/functions-checkout/fix-items.js +80 -18
- package/packages/modules/lib/firebase/functions-checkout/fix-items.js.map +1 -1
- package/packages/modules/lib/firebase/functions-checkout/get-custumerId.js +1 -1
- package/packages/modules/lib/firebase/functions-checkout/get-custumerId.js.map +1 -1
- package/packages/modules/lib/firebase/functions-checkout/handle-order-transaction.js +16 -16
- package/packages/modules/lib/firebase/functions-checkout/handle-order-transaction.js.map +1 -1
- package/packages/modules/lib/firebase/functions-checkout/new-order.js +8 -8
- package/packages/modules/lib/firebase/functions-checkout/new-order.js.map +1 -1
- package/packages/modules/lib/firebase/functions-checkout/request-to-module.js +23 -6
- package/packages/modules/lib/firebase/functions-checkout/request-to-module.js.map +1 -1
- package/packages/modules/lib/firebase/functions-checkout/utils.js +1 -2
- package/packages/modules/lib/firebase/functions-checkout/utils.js.map +1 -1
- package/packages/modules/lib/firebase/handle-module.js +1 -1
- package/packages/modules/lib/firebase/handle-module.js.map +1 -1
- package/packages/modules/lib/firebase.js +0 -1
- package/packages/modules/lib/firebase.js.map +1 -1
- package/packages/modules/package.json +4 -4
- package/packages/modules/src/firebase/call-app-module.ts +1 -1
- package/packages/modules/src/firebase/checkout.ts +13 -10
- package/packages/modules/src/firebase/functions-checkout/fix-items.ts +88 -20
- package/packages/modules/src/firebase/functions-checkout/get-custumerId.ts +1 -1
- package/packages/modules/src/firebase/functions-checkout/handle-order-transaction.ts +24 -23
- package/packages/modules/src/firebase/functions-checkout/new-order.ts +15 -14
- package/packages/modules/src/firebase/functions-checkout/request-to-module.ts +30 -8
- package/packages/modules/src/firebase/functions-checkout/utils.ts +3 -5
- package/packages/modules/src/firebase/handle-module.ts +1 -1
- package/packages/modules/src/firebase.ts +0 -1
- package/packages/modules/src/types/index.d.ts +7 -6
- package/packages/passport/lib/firebase/serve-passport-api.js +1 -1
- package/packages/passport/lib/firebase/serve-passport-api.js.map +1 -1
- package/packages/passport/lib/firebase.js +0 -1
- package/packages/passport/lib/firebase.js.map +1 -1
- package/packages/passport/package.json +4 -4
- package/packages/passport/src/firebase/serve-passport-api.ts +1 -1
- package/packages/passport/src/firebase.ts +0 -1
- package/packages/ssr/package.json +7 -7
- package/packages/storefront/.eslintrc.cjs +0 -1
- package/packages/storefront/astro.config.mjs +3 -2
- package/packages/storefront/dist/client/HeaderButtons.b5b4a939.js +1 -0
- package/packages/storefront/dist/client/assets/_...slug_.8d138f36.css +4 -0
- package/packages/storefront/dist/client/chunks/{HeaderButtons.d1f8a21f.js → HeaderButtons.308edb4d.js} +1 -1
- package/packages/storefront/dist/client/chunks/{LoginForm.e02dee3d.js → LoginForm.0c5ba697.js} +95 -95
- package/packages/storefront/dist/client/chunks/preload-helper.1de719f8.js +1 -0
- package/packages/storefront/dist/client/chunks/runtime-dom.esm-bundler.f00ab3bd.js +1 -0
- package/packages/storefront/dist/client/client.69fdbd1b.js +1 -0
- package/packages/storefront/dist/client/{hoisted.3f1cf839.js → hoisted.4f689abe.js} +1 -1
- package/packages/storefront/dist/client/page.33c44e88.js +1 -0
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/entry.mjs +2826 -3530
- package/packages/storefront/package.json +13 -16
- package/packages/storefront/src/lib/assets/pico.css +19 -24
- package/packages/storefront/src/lib/components/LoginForm.vue +4 -13
- package/packages/storefront/src/lib/ssr/image.ts +0 -1
- package/packages/storefront/src/lib/state/customer-session.ts +29 -37
- package/packages/storefront/src/lib/state/shopping-cart/add-cart-item.ts +89 -0
- package/packages/storefront/src/lib/state/shopping-cart.ts +52 -0
- package/packages/storefront/src/lib/state/use-storage.ts +19 -0
- package/packages/storefront/tailwind.config.cjs +6 -1
- package/packages/types/package.json +1 -1
- package/packages/storefront/dist/client/HeaderButtons.75084c8f.js +0 -1
- package/packages/storefront/dist/client/assets/_...slug_.5d8e6131.css +0 -4
- package/packages/storefront/dist/client/chunks/preload-helper.f15ab524.js +0 -1
- package/packages/storefront/dist/client/chunks/runtime-dom.esm-bundler.9119f0ff.js +0 -1
- package/packages/storefront/dist/client/client.671d7334.js +0 -1
- package/packages/storefront/dist/client/page.b906f867.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/storefront",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.126",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront with Astro",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"repository": {
|
|
@@ -25,33 +25,30 @@
|
|
|
25
25
|
"prepare-monorepo": "sh scripts/prepare-monorepo.sh"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@astrojs/image": "^0.
|
|
29
|
-
"@astrojs/node": "^
|
|
28
|
+
"@astrojs/image": "^0.11.0",
|
|
29
|
+
"@astrojs/node": "^2.0.2",
|
|
30
30
|
"@astrojs/partytown": "^1.0.1",
|
|
31
|
-
"@astrojs/prefetch": "^0.0
|
|
32
|
-
"@astrojs/vue": "^1.1
|
|
31
|
+
"@astrojs/prefetch": "^0.1.0",
|
|
32
|
+
"@astrojs/vue": "^1.2.1",
|
|
33
33
|
"@cloudcommerce/api": "workspace:*",
|
|
34
34
|
"@cloudcommerce/config": "workspace:*",
|
|
35
35
|
"@cloudcommerce/i18n": "workspace:*",
|
|
36
36
|
"@ecomplus/utils": "^1.4.1",
|
|
37
|
-
"@iconify-json/
|
|
37
|
+
"@iconify-json/fa6-brands": "^1.1.6",
|
|
38
38
|
"@iconify-json/heroicons": "^1.1.5",
|
|
39
|
-
"@iconify-json/logos": "^1.1.
|
|
40
|
-
"@
|
|
41
|
-
"
|
|
42
|
-
"astro": "^1.5.0",
|
|
39
|
+
"@iconify-json/logos": "^1.1.18",
|
|
40
|
+
"@unocss/preset-icons": "^0.46.2",
|
|
41
|
+
"astro": "^1.6.2",
|
|
43
42
|
"color": "^4.2.3",
|
|
44
43
|
"dotenv": "^16.0.3",
|
|
45
|
-
"firebase": "^9.
|
|
44
|
+
"firebase": "^9.13.0",
|
|
46
45
|
"image-size": "^1.0.2",
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"unocss": "^0.45.29",
|
|
50
|
-
"vite": "^3.1.8",
|
|
46
|
+
"unocss": "^0.46.2",
|
|
47
|
+
"vite": "^3.2.2",
|
|
51
48
|
"vite-plugin-pwa": "^0.13.1",
|
|
52
49
|
"vue": "^3.2.41"
|
|
53
50
|
},
|
|
54
51
|
"devDependencies": {
|
|
55
|
-
"@babel/core": "^7.19.
|
|
52
|
+
"@babel/core": "^7.19.6"
|
|
56
53
|
}
|
|
57
54
|
}
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
--icon-invalid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(198, 40, 40)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='8' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'%3E%3C/line%3E%3C/svg%3E");
|
|
39
39
|
--icon-valid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(56, 142, 60)' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
|
|
40
40
|
}
|
|
41
|
-
@media (min-width:
|
|
41
|
+
@media (min-width: 640px) {
|
|
42
42
|
:root {
|
|
43
43
|
--font-size: 16.5px;
|
|
44
44
|
}
|
|
@@ -48,18 +48,18 @@
|
|
|
48
48
|
--font-size: 17px;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
@media (min-width:
|
|
51
|
+
@media (min-width: 1024px) {
|
|
52
52
|
:root {
|
|
53
53
|
--font-size: 17.65px;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
@media (min-width:
|
|
56
|
+
@media (min-width: 1280px) {
|
|
57
57
|
:root {
|
|
58
58
|
--font-size: 18.5px;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
@media (min-width:
|
|
62
|
+
@media (min-width: 640px) {
|
|
63
63
|
body > header,
|
|
64
64
|
body > main,
|
|
65
65
|
body > footer,
|
|
@@ -75,7 +75,7 @@ section {
|
|
|
75
75
|
--block-spacing-vertical: calc(var(--spacing) * 3);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
@media (min-width:
|
|
78
|
+
@media (min-width: 1024px) {
|
|
79
79
|
body > header,
|
|
80
80
|
body > main,
|
|
81
81
|
body > footer,
|
|
@@ -83,7 +83,7 @@ section {
|
|
|
83
83
|
--block-spacing-vertical: calc(var(--spacing) * 3.5);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
@media (min-width:
|
|
86
|
+
@media (min-width: 1280px) {
|
|
87
87
|
body > header,
|
|
88
88
|
body > main,
|
|
89
89
|
body > footer,
|
|
@@ -92,7 +92,7 @@ section {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
@media (min-width:
|
|
95
|
+
@media (min-width: 640px) {
|
|
96
96
|
article {
|
|
97
97
|
--block-spacing-horizontal: calc(var(--spacing) * 1.25);
|
|
98
98
|
}
|
|
@@ -102,12 +102,12 @@ section {
|
|
|
102
102
|
--block-spacing-horizontal: calc(var(--spacing) * 1.5);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
@media (min-width:
|
|
105
|
+
@media (min-width: 1024px) {
|
|
106
106
|
article {
|
|
107
107
|
--block-spacing-horizontal: calc(var(--spacing) * 1.75);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
@media (min-width:
|
|
110
|
+
@media (min-width: 1280px) {
|
|
111
111
|
article {
|
|
112
112
|
--block-spacing-horizontal: calc(var(--spacing) * 2);
|
|
113
113
|
}
|
|
@@ -117,7 +117,7 @@ dialog > article {
|
|
|
117
117
|
--block-spacing-vertical: calc(var(--spacing) * 2);
|
|
118
118
|
--block-spacing-horizontal: var(--spacing);
|
|
119
119
|
}
|
|
120
|
-
@media (min-width:
|
|
120
|
+
@media (min-width: 640px) {
|
|
121
121
|
dialog > article {
|
|
122
122
|
--block-spacing-vertical: calc(var(--spacing) * 2.5);
|
|
123
123
|
--block-spacing-horizontal: calc(var(--spacing) * 1.25);
|
|
@@ -737,6 +737,7 @@ button,
|
|
|
737
737
|
[type=button],
|
|
738
738
|
[type=reset],
|
|
739
739
|
[type=submit] {
|
|
740
|
+
appearance: button;
|
|
740
741
|
-webkit-appearance: button;
|
|
741
742
|
}
|
|
742
743
|
|
|
@@ -879,15 +880,17 @@ textarea {
|
|
|
879
880
|
}
|
|
880
881
|
|
|
881
882
|
[type=search] {
|
|
883
|
+
appearance: textfield;
|
|
882
884
|
-webkit-appearance: textfield;
|
|
883
885
|
outline-offset: -2px;
|
|
884
886
|
}
|
|
885
887
|
|
|
886
888
|
[type=search]::-webkit-search-decoration {
|
|
887
|
-
|
|
889
|
+
appearance: none;
|
|
888
890
|
}
|
|
889
891
|
|
|
890
892
|
::-webkit-file-upload-button {
|
|
893
|
+
appearance: button;
|
|
891
894
|
-webkit-appearance: button;
|
|
892
895
|
font: inherit;
|
|
893
896
|
}
|
|
@@ -942,8 +945,6 @@ textarea {
|
|
|
942
945
|
:where(input):not([type=checkbox], [type=radio], [type=range], [type=file]),
|
|
943
946
|
select,
|
|
944
947
|
textarea {
|
|
945
|
-
-webkit-appearance: none;
|
|
946
|
-
-moz-appearance: none;
|
|
947
948
|
appearance: none;
|
|
948
949
|
padding: var(--form-element-spacing-vertical) var(--form-element-spacing-horizontal);
|
|
949
950
|
}
|
|
@@ -1081,8 +1082,6 @@ label > :where(input, select, textarea) {
|
|
|
1081
1082
|
*/
|
|
1082
1083
|
[type=checkbox],
|
|
1083
1084
|
[type=radio] {
|
|
1084
|
-
-webkit-appearance: none;
|
|
1085
|
-
-moz-appearance: none;
|
|
1086
1085
|
appearance: none;
|
|
1087
1086
|
width: 1.25em;
|
|
1088
1087
|
height: 1.25em;
|
|
@@ -1333,8 +1332,6 @@ label > :where(input, select, textarea) {
|
|
|
1333
1332
|
}
|
|
1334
1333
|
|
|
1335
1334
|
[type=range] {
|
|
1336
|
-
-webkit-appearance: none;
|
|
1337
|
-
-moz-appearance: none;
|
|
1338
1335
|
appearance: none;
|
|
1339
1336
|
width: 100%;
|
|
1340
1337
|
height: 1.25rem;
|
|
@@ -1365,7 +1362,7 @@ label > :where(input, select, textarea) {
|
|
|
1365
1362
|
transition: background-color var(--transition), box-shadow var(--transition);
|
|
1366
1363
|
}
|
|
1367
1364
|
[type=range]::-webkit-slider-thumb {
|
|
1368
|
-
|
|
1365
|
+
appearance: none;
|
|
1369
1366
|
width: 1.25rem;
|
|
1370
1367
|
height: 1.25rem;
|
|
1371
1368
|
margin-top: -0.5rem;
|
|
@@ -1377,7 +1374,7 @@ label > :where(input, select, textarea) {
|
|
|
1377
1374
|
transition: background-color var(--transition), transform var(--transition);
|
|
1378
1375
|
}
|
|
1379
1376
|
[type=range]::-moz-range-thumb {
|
|
1380
|
-
|
|
1377
|
+
appearance: none;
|
|
1381
1378
|
width: 1.25rem;
|
|
1382
1379
|
height: 1.25rem;
|
|
1383
1380
|
margin-top: -0.5rem;
|
|
@@ -1389,7 +1386,7 @@ label > :where(input, select, textarea) {
|
|
|
1389
1386
|
transition: background-color var(--transition), transform var(--transition);
|
|
1390
1387
|
}
|
|
1391
1388
|
[type=range]::-ms-thumb {
|
|
1392
|
-
|
|
1389
|
+
appearance: none;
|
|
1393
1390
|
width: 1.25rem;
|
|
1394
1391
|
height: 1.25rem;
|
|
1395
1392
|
margin-top: -0.5rem;
|
|
@@ -1430,7 +1427,7 @@ input:not([type=checkbox], [type=radio], [type=range], [type=file])[type=search]
|
|
|
1430
1427
|
}
|
|
1431
1428
|
|
|
1432
1429
|
[type=search]::-webkit-search-cancel-button {
|
|
1433
|
-
|
|
1430
|
+
appearance: none;
|
|
1434
1431
|
display: none;
|
|
1435
1432
|
}
|
|
1436
1433
|
|
|
@@ -1698,7 +1695,7 @@ dialog article {
|
|
|
1698
1695
|
max-height: calc(100vh - var(--spacing) * 2);
|
|
1699
1696
|
overflow: auto;
|
|
1700
1697
|
}
|
|
1701
|
-
@media (min-width:
|
|
1698
|
+
@media (min-width: 640px) {
|
|
1702
1699
|
dialog article {
|
|
1703
1700
|
max-width: 510px;
|
|
1704
1701
|
}
|
|
@@ -1857,8 +1854,6 @@ progress {
|
|
|
1857
1854
|
}
|
|
1858
1855
|
|
|
1859
1856
|
progress {
|
|
1860
|
-
-webkit-appearance: none;
|
|
1861
|
-
-moz-appearance: none;
|
|
1862
1857
|
display: inline-block;
|
|
1863
1858
|
appearance: none;
|
|
1864
1859
|
width: 100%;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { ref,
|
|
3
|
-
import { useStore } from '@nanostores/vue';
|
|
2
|
+
import { ref, watch } from 'vue';
|
|
4
3
|
import {
|
|
5
4
|
i19accessMyAccount,
|
|
6
5
|
i19createAnAccount,
|
|
@@ -18,14 +17,13 @@ import {
|
|
|
18
17
|
signInWithEmailAndPassword,
|
|
19
18
|
} from 'firebase/auth';
|
|
20
19
|
import {
|
|
21
|
-
customerName
|
|
22
|
-
customerEmail,
|
|
23
|
-
setCustomerEmail,
|
|
20
|
+
customerName,
|
|
21
|
+
customerEmail as email,
|
|
24
22
|
isLogged,
|
|
25
23
|
} from '@@storefront/state/customer-session';
|
|
26
24
|
|
|
27
25
|
const emit = defineEmits(['login', 'logout']);
|
|
28
|
-
watch(
|
|
26
|
+
watch(isLogged, (_isLogged) => {
|
|
29
27
|
emit(_isLogged ? 'login' : 'logout');
|
|
30
28
|
}, {
|
|
31
29
|
immediate: true,
|
|
@@ -37,12 +35,6 @@ watch(isSignUp, (_isSignUp) => {
|
|
|
37
35
|
isLinkSignIn.value = true;
|
|
38
36
|
}
|
|
39
37
|
});
|
|
40
|
-
const email = computed({
|
|
41
|
-
get() {
|
|
42
|
-
return useStore(customerEmail).value;
|
|
43
|
-
},
|
|
44
|
-
set: setCustomerEmail,
|
|
45
|
-
});
|
|
46
38
|
const password = ref('');
|
|
47
39
|
const submitLogin = async () => {
|
|
48
40
|
const firebaseAuth = getAuth();
|
|
@@ -63,7 +55,6 @@ const submitLogin = async () => {
|
|
|
63
55
|
console.error(error);
|
|
64
56
|
}
|
|
65
57
|
};
|
|
66
|
-
const customerName = useStore($customerName);
|
|
67
58
|
</script>
|
|
68
59
|
|
|
69
60
|
<template>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Customers } from '@cloudcommerce/api/types';
|
|
2
2
|
import api from '@cloudcommerce/api';
|
|
3
3
|
import { nickname as getNickname } from '@ecomplus/utils';
|
|
4
|
-
import {
|
|
4
|
+
import { computed } from 'vue';
|
|
5
5
|
import {
|
|
6
6
|
getAuth,
|
|
7
7
|
onAuthStateChanged,
|
|
@@ -9,8 +9,10 @@ import {
|
|
|
9
9
|
signInWithEmailLink,
|
|
10
10
|
// updateProfile,
|
|
11
11
|
} from 'firebase/auth';
|
|
12
|
-
import '
|
|
12
|
+
import useStorage from './use-storage';
|
|
13
|
+
import '../scripts/firebase-app';
|
|
13
14
|
|
|
15
|
+
const storageKey = 'SESSION';
|
|
14
16
|
const emptySession = {
|
|
15
17
|
customer: {
|
|
16
18
|
display_name: '',
|
|
@@ -18,37 +20,28 @@ const emptySession = {
|
|
|
18
20
|
},
|
|
19
21
|
auth: null,
|
|
20
22
|
};
|
|
21
|
-
const session =
|
|
23
|
+
const session = useStorage<{
|
|
22
24
|
customer: Partial<Customers>,
|
|
23
25
|
auth: null | {
|
|
24
26
|
access_token: string,
|
|
25
27
|
expires: string,
|
|
26
28
|
customer_id: string,
|
|
27
29
|
},
|
|
28
|
-
}>(emptySession);
|
|
29
|
-
const storageKey = 'SESSION';
|
|
30
|
-
const sessionJson = localStorage.getItem(storageKey);
|
|
31
|
-
if (sessionJson) {
|
|
32
|
-
try {
|
|
33
|
-
session.set(JSON.parse(sessionJson));
|
|
34
|
-
} catch (e) {
|
|
35
|
-
localStorage.removeItem(storageKey);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
onSet(session, () => {
|
|
39
|
-
localStorage.setItem(storageKey, JSON.stringify(session.get()));
|
|
40
|
-
});
|
|
30
|
+
}>(storageKey, emptySession);
|
|
41
31
|
|
|
42
|
-
const isAuthenticated = computed(
|
|
32
|
+
const isAuthenticated = computed(() => {
|
|
33
|
+
const { auth } = session;
|
|
43
34
|
return auth && new Date(auth.expires).getTime() - Date.now() > 1000 * 10;
|
|
44
35
|
});
|
|
45
|
-
const customer = computed(
|
|
46
|
-
const customerName = computed(
|
|
47
|
-
const customerEmail = computed(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
36
|
+
const customer = computed(() => session.customer);
|
|
37
|
+
const customerName = computed(() => getNickname(customer.value) as string);
|
|
38
|
+
const customerEmail = computed({
|
|
39
|
+
get() {
|
|
40
|
+
return customer.value.main_email;
|
|
41
|
+
},
|
|
42
|
+
set(email) {
|
|
43
|
+
session.customer.main_email = email;
|
|
44
|
+
},
|
|
52
45
|
});
|
|
53
46
|
|
|
54
47
|
const firebaseAuth = getAuth();
|
|
@@ -61,11 +54,12 @@ if (isSignInWithEmailLink(firebaseAuth, window.location.href)) {
|
|
|
61
54
|
}
|
|
62
55
|
}
|
|
63
56
|
|
|
64
|
-
const isLogged = computed(
|
|
65
|
-
return
|
|
57
|
+
const isLogged = computed(() => {
|
|
58
|
+
return isAuthenticated.value || !!firebaseAuth.currentUser;
|
|
66
59
|
});
|
|
67
60
|
const logout = () => {
|
|
68
|
-
session.
|
|
61
|
+
session.auth = emptySession.auth;
|
|
62
|
+
session.customer = emptySession.customer;
|
|
69
63
|
localStorage.removeItem(storageKey);
|
|
70
64
|
firebaseAuth.signOut();
|
|
71
65
|
};
|
|
@@ -81,36 +75,35 @@ const authenticate = async () => {
|
|
|
81
75
|
Authorization: `Bearer ${authToken}`,
|
|
82
76
|
},
|
|
83
77
|
});
|
|
84
|
-
session.
|
|
78
|
+
session.auth = await resAuth.json();
|
|
85
79
|
} catch (err) {
|
|
86
80
|
console.error(err);
|
|
87
81
|
}
|
|
88
82
|
};
|
|
89
83
|
|
|
90
84
|
const getAccessToken = async () => {
|
|
91
|
-
if (!isAuthenticated.
|
|
85
|
+
if (!isAuthenticated.value) {
|
|
92
86
|
await authenticate();
|
|
93
87
|
}
|
|
94
|
-
return session.
|
|
88
|
+
return session.auth.access_token;
|
|
95
89
|
};
|
|
96
90
|
|
|
97
91
|
const fetchCustomer = async () => {
|
|
98
92
|
const accessToken = await getAccessToken();
|
|
99
|
-
const {
|
|
100
|
-
const { data } = await api.get(`customers/${auth.customer_id}`, {
|
|
93
|
+
const { data } = await api.get(`customers/${session.auth.customer_id}`, {
|
|
101
94
|
accessToken,
|
|
102
95
|
});
|
|
103
|
-
session.
|
|
96
|
+
session.customer = data;
|
|
104
97
|
return data;
|
|
105
98
|
};
|
|
106
99
|
|
|
107
100
|
onAuthStateChanged(firebaseAuth, async (user) => {
|
|
108
101
|
if (user) {
|
|
109
102
|
if (user.emailVerified) {
|
|
110
|
-
const isEmailChanged = user.email !== customerEmail.
|
|
111
|
-
if (isEmailChanged || !isAuthenticated.
|
|
103
|
+
const isEmailChanged = user.email !== customerEmail.value;
|
|
104
|
+
if (isEmailChanged || !isAuthenticated.value) {
|
|
112
105
|
await authenticate();
|
|
113
|
-
if (isEmailChanged || !customerName.
|
|
106
|
+
if (isEmailChanged || !customerName.value) {
|
|
114
107
|
await fetchCustomer();
|
|
115
108
|
}
|
|
116
109
|
}
|
|
@@ -128,7 +121,6 @@ export {
|
|
|
128
121
|
customer,
|
|
129
122
|
customerName,
|
|
130
123
|
customerEmail,
|
|
131
|
-
setCustomerEmail,
|
|
132
124
|
isLogged,
|
|
133
125
|
logout,
|
|
134
126
|
authenticate,
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { Carts } from '@cloudcommerce/api/types';
|
|
2
|
+
import { randomObjectId } from '@ecomplus/utils';
|
|
3
|
+
import fixItemQuantity from './../lib/fix-item-quantity'
|
|
4
|
+
import fixItemFinalPrice from './../lib/fix-item-final-price'
|
|
5
|
+
import fixSubtotal from './../lib/fix-subtotal'
|
|
6
|
+
|
|
7
|
+
type CartItem = Carts['items'][0];
|
|
8
|
+
|
|
9
|
+
const checkItems = (item: CartItem, newItem: CartItem) => {
|
|
10
|
+
if (!item.flags && !newItem.flags) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
if (
|
|
14
|
+
!item.flags
|
|
15
|
+
|| !newItem.flags
|
|
16
|
+
|| item.flags.length !== newItem.flags.length
|
|
17
|
+
) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return item.flags.every((flag) => newItem.flags.includes(flag));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default ({ data, save }, emitter, [newItem, canSave = true]) => {
|
|
24
|
+
if (
|
|
25
|
+
typeof newItem.product_id !== 'string' ||
|
|
26
|
+
typeof newItem.quantity !== 'number' || !(newItem.quantity >= 0) ||
|
|
27
|
+
typeof newItem.price !== 'number' || !(newItem.price >= 0)
|
|
28
|
+
) {
|
|
29
|
+
return null
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let fixedItem
|
|
33
|
+
if (!newItem.kit_product) {
|
|
34
|
+
for (let i = 0; i < data.items.length; i++) {
|
|
35
|
+
const item = data.items[i]
|
|
36
|
+
if (
|
|
37
|
+
!item.kit_product &&
|
|
38
|
+
!item.keep_item_quantity &&
|
|
39
|
+
item.product_id === newItem.product_id &&
|
|
40
|
+
item.variation_id === newItem.variation_id &&
|
|
41
|
+
(!item.customizations || !item.customizations.length) &&
|
|
42
|
+
checkFlags(item, newItem)
|
|
43
|
+
) {
|
|
44
|
+
item.quantity += newItem.quantity
|
|
45
|
+
if (newItem.price) {
|
|
46
|
+
item.price = newItem.price
|
|
47
|
+
}
|
|
48
|
+
if (newItem.final_price) {
|
|
49
|
+
item.final_price = newItem.final_price
|
|
50
|
+
}
|
|
51
|
+
fixedItem = fixItemQuantity(item)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!fixedItem) {
|
|
57
|
+
const itemCopy = Object.assign({}, newItem)
|
|
58
|
+
if (
|
|
59
|
+
!newItem._id ||
|
|
60
|
+
newItem._id === newItem.variation_id ||
|
|
61
|
+
data.items.find(({ _id }) => _id === newItem._id)
|
|
62
|
+
) {
|
|
63
|
+
itemCopy._id = randomObjectId()
|
|
64
|
+
}
|
|
65
|
+
if (newItem.customizations) {
|
|
66
|
+
newItem.customizations.forEach((customization, i) => {
|
|
67
|
+
itemCopy.customizations[i] = Object.assign({}, customization)
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
data.items.push(itemCopy)
|
|
71
|
+
fixedItem = fixItemQuantity(itemCopy)
|
|
72
|
+
fixItemFinalPrice(fixedItem)
|
|
73
|
+
}
|
|
74
|
+
fixSubtotal(data)
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @event EcomCart#addItem
|
|
78
|
+
* @type {object}
|
|
79
|
+
* @property {object} data - Shopping cart data
|
|
80
|
+
* @property {object} item - Item added to cart
|
|
81
|
+
* @example ecomCart.on('addItem', ({ data, item }) => { console.log(data, item) })
|
|
82
|
+
*/
|
|
83
|
+
emitter.emit('addItem', { data, item: fixedItem })
|
|
84
|
+
|
|
85
|
+
if (canSave) {
|
|
86
|
+
save(false)
|
|
87
|
+
}
|
|
88
|
+
return fixedItem
|
|
89
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { CartSet } from '@cloudcommerce/api/types';
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import useStorage from './use-storage';
|
|
4
|
+
|
|
5
|
+
const storageKey = 'SHOPPING_CART';
|
|
6
|
+
const emptyCart = {
|
|
7
|
+
items: [],
|
|
8
|
+
};
|
|
9
|
+
const cart = useStorage<CartSet>(storageKey, emptyCart);
|
|
10
|
+
|
|
11
|
+
const cartItems = computed(() => {
|
|
12
|
+
return cart.items.map((item) => {
|
|
13
|
+
item.final_price = item.kit_product?.price && item.kit_product.pack_quantity
|
|
14
|
+
? item.kit_product.price / item.kit_product.pack_quantity
|
|
15
|
+
: item.price;
|
|
16
|
+
if (Array.isArray(item.customizations)) {
|
|
17
|
+
item.customizations.forEach((customization) => {
|
|
18
|
+
if (customization.add_to_price) {
|
|
19
|
+
const { type, addition } = customization.add_to_price;
|
|
20
|
+
item.final_price += type === 'fixed'
|
|
21
|
+
? addition
|
|
22
|
+
: item.price * (addition / 100);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return item;
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
const subtotal = computed(() => {
|
|
30
|
+
return cartItems.value.reduce((acc, item) => {
|
|
31
|
+
return acc + (item.quantity * item.final_price);
|
|
32
|
+
}, 0);
|
|
33
|
+
});
|
|
34
|
+
const shoppingCart = computed({
|
|
35
|
+
get() {
|
|
36
|
+
return {
|
|
37
|
+
...cart,
|
|
38
|
+
subtotal: subtotal.value,
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
set(newCart) {
|
|
42
|
+
Object.assign(cart, newCart, {
|
|
43
|
+
subtotal: subtotal.value,
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export default shoppingCart;
|
|
49
|
+
|
|
50
|
+
export {
|
|
51
|
+
shoppingCart,
|
|
52
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { reactive, watch } from 'vue';
|
|
2
|
+
|
|
3
|
+
export default <T extends {}>(key: string, initialValue: T, storage = localStorage) => {
|
|
4
|
+
let persistedValue: T | undefined | null;
|
|
5
|
+
const sessionJson = storage.getItem(key);
|
|
6
|
+
if (sessionJson) {
|
|
7
|
+
try {
|
|
8
|
+
persistedValue = JSON.parse(sessionJson);
|
|
9
|
+
} catch (e) {
|
|
10
|
+
persistedValue = null;
|
|
11
|
+
storage.removeItem(key);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const state = reactive<T>(persistedValue || initialValue);
|
|
15
|
+
watch(state, () => {
|
|
16
|
+
storage.setItem(key, JSON.stringify(state));
|
|
17
|
+
});
|
|
18
|
+
return state;
|
|
19
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// IntelliSense for UnoCSS icons
|
|
2
2
|
const defaultIcons = {
|
|
3
|
-
brandIcons: '
|
|
3
|
+
brandIcons: 'fa6-brands',
|
|
4
4
|
brandIconsShortcuts: [
|
|
5
5
|
'facebook',
|
|
6
6
|
'twitter',
|
|
@@ -13,6 +13,7 @@ const defaultIcons = {
|
|
|
13
13
|
'telegram',
|
|
14
14
|
'whatsapp',
|
|
15
15
|
'messenger',
|
|
16
|
+
'pix',
|
|
16
17
|
],
|
|
17
18
|
brandLogos: 'logos',
|
|
18
19
|
brandLogosShortcuts: [
|
|
@@ -74,6 +75,10 @@ const genTailwindConfig = ({
|
|
|
74
75
|
plugins: [
|
|
75
76
|
({ addUtilities }) => {
|
|
76
77
|
addUtilities({
|
|
78
|
+
// To clear HTML element (0, 0, x) specificity styles from PicoCSS
|
|
79
|
+
'.unset': {
|
|
80
|
+
all: 'unset',
|
|
81
|
+
},
|
|
77
82
|
// https://picocss.com/docs/containers.html
|
|
78
83
|
'.container-fluid': {
|
|
79
84
|
'max-width': 'var(--content-max-width)',
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as i}from"./chunks/HeaderButtons.d1f8a21f.js";import"./chunks/preload-helper.f15ab524.js";import"./chunks/runtime-dom.esm-bundler.9119f0ff.js";/* empty css */export{i as default};
|