cloudcommerce 0.0.133 → 0.1.0
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/.vscode/settings.json +2 -1
- package/CHANGELOG.md +25 -0
- package/action.yml +13 -5
- package/ecomplus-stores/monocard/functions/core/package.json +1 -1
- package/ecomplus-stores/monocard/functions/events/package.json +1 -1
- package/ecomplus-stores/monocard/functions/modules/package.json +1 -1
- package/ecomplus-stores/monocard/functions/passport/package.json +1 -1
- package/ecomplus-stores/tia-sonia/functions/core/package.json +1 -1
- package/ecomplus-stores/tia-sonia/functions/events/package.json +1 -1
- package/ecomplus-stores/tia-sonia/functions/modules/package.json +1 -1
- package/ecomplus-stores/tia-sonia/functions/passport/package.json +1 -1
- package/package.json +8 -9
- package/packages/api/fetch-polyfill.js +1 -1
- package/packages/api/package.json +1 -1
- package/packages/api/tests/index.test.ts +0 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-payment/CHANGELOG.md +1 -0
- package/packages/apps/custom-payment/README.md +1 -0
- package/packages/apps/custom-payment/lib/custom-payment-create-transaction.d.ts +68 -0
- package/packages/apps/custom-payment/lib/custom-payment-create-transaction.js +55 -0
- package/packages/apps/custom-payment/lib/custom-payment-create-transaction.js.map +1 -0
- package/packages/apps/custom-payment/lib/custom-payment-list-payments.d.ts +3 -0
- package/packages/apps/custom-payment/lib/custom-payment-list-payments.js +79 -0
- package/packages/apps/custom-payment/lib/custom-payment-list-payments.js.map +1 -0
- package/packages/apps/custom-payment/lib/custom-payment.d.ts +68 -0
- package/packages/apps/custom-payment/lib/custom-payment.js +11 -0
- package/packages/apps/custom-payment/lib/custom-payment.js.map +1 -0
- package/packages/apps/custom-payment/lib/index.d.ts +1 -0
- package/packages/apps/custom-payment/lib/index.js +2 -0
- package/packages/apps/custom-payment/lib/index.js.map +1 -0
- package/packages/apps/custom-payment/package.json +27 -0
- package/packages/apps/custom-payment/src/custom-payment-create-transaction.ts +67 -0
- package/packages/apps/custom-payment/src/custom-payment-list-payments.ts +96 -0
- package/packages/apps/custom-payment/src/custom-payment.ts +11 -0
- package/packages/apps/custom-payment/src/index.ts +1 -0
- package/packages/apps/custom-payment/tsconfig.json +6 -0
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +2 -2
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/galaxpay/CHANGELOG.md +1 -0
- package/packages/apps/galaxpay/README.md +1 -0
- package/packages/apps/galaxpay/assets/onload-expression.js +23 -0
- package/packages/apps/galaxpay/events.js +1 -0
- package/packages/apps/galaxpay/lib/functions-lib/all-parses.d.ts +5 -0
- package/packages/apps/galaxpay/lib/functions-lib/all-parses.js +79 -0
- package/packages/apps/galaxpay/lib/functions-lib/all-parses.js.map +1 -0
- package/packages/apps/galaxpay/lib/functions-lib/ecom/events-to-galaxpay.d.ts +3 -0
- package/packages/apps/galaxpay/lib/functions-lib/ecom/events-to-galaxpay.js +75 -0
- package/packages/apps/galaxpay/lib/functions-lib/ecom/events-to-galaxpay.js.map +1 -0
- package/packages/apps/galaxpay/lib/functions-lib/galaxpay/auth/create-access.d.ts +11 -0
- package/packages/apps/galaxpay/lib/functions-lib/galaxpay/auth/create-access.js +60 -0
- package/packages/apps/galaxpay/lib/functions-lib/galaxpay/auth/create-access.js.map +1 -0
- package/packages/apps/galaxpay/lib/functions-lib/galaxpay/auth/create-axios.d.ts +2 -0
- package/packages/apps/galaxpay/lib/functions-lib/galaxpay/auth/create-axios.js +20 -0
- package/packages/apps/galaxpay/lib/functions-lib/galaxpay/auth/create-axios.js.map +1 -0
- package/packages/apps/galaxpay/lib/functions-lib/galaxpay/auth/gerate-token.d.ts +2 -0
- package/packages/apps/galaxpay/lib/functions-lib/galaxpay/auth/gerate-token.js +32 -0
- package/packages/apps/galaxpay/lib/functions-lib/galaxpay/auth/gerate-token.js.map +1 -0
- package/packages/apps/galaxpay/lib/functions-lib/galaxpay/handle-plans.d.ts +30 -0
- package/packages/apps/galaxpay/lib/functions-lib/galaxpay/handle-plans.js +73 -0
- package/packages/apps/galaxpay/lib/functions-lib/galaxpay/handle-plans.js.map +1 -0
- package/packages/apps/galaxpay/lib/functions-lib/galaxpay/update-subscription.d.ts +8 -0
- package/packages/apps/galaxpay/lib/functions-lib/galaxpay/update-subscription.js +56 -0
- package/packages/apps/galaxpay/lib/functions-lib/galaxpay/update-subscription.js.map +1 -0
- package/packages/apps/galaxpay/lib/functions-lib/galaxpay/webhook.d.ts +3 -0
- package/packages/apps/galaxpay/lib/functions-lib/galaxpay/webhook.js +291 -0
- package/packages/apps/galaxpay/lib/functions-lib/galaxpay/webhook.js.map +1 -0
- package/packages/apps/galaxpay/lib/functions-lib/utils.d.ts +8 -0
- package/packages/apps/galaxpay/lib/functions-lib/utils.js +17 -0
- package/packages/apps/galaxpay/lib/functions-lib/utils.js.map +1 -0
- package/packages/apps/galaxpay/lib/galaxpay-create-transaction.d.ts +71 -0
- package/packages/apps/galaxpay/lib/galaxpay-create-transaction.js +199 -0
- package/packages/apps/galaxpay/lib/galaxpay-create-transaction.js.map +1 -0
- package/packages/apps/galaxpay/lib/galaxpay-events.d.ts +6 -0
- package/packages/apps/galaxpay/lib/galaxpay-events.js +21 -0
- package/packages/apps/galaxpay/lib/galaxpay-events.js.map +1 -0
- package/packages/apps/galaxpay/lib/galaxpay-list-payments.d.ts +7 -0
- package/packages/apps/galaxpay/lib/galaxpay-list-payments.js +105 -0
- package/packages/apps/galaxpay/lib/galaxpay-list-payments.js.map +1 -0
- package/packages/apps/galaxpay/lib/galaxpay.d.ts +76 -0
- package/packages/apps/galaxpay/lib/galaxpay.js +12 -0
- package/packages/apps/galaxpay/lib/galaxpay.js.map +1 -0
- package/packages/apps/galaxpay/lib/index.d.ts +1 -0
- package/packages/apps/galaxpay/lib/index.js +3 -0
- package/packages/apps/galaxpay/lib/index.js.map +1 -0
- package/packages/apps/galaxpay/package.json +36 -0
- package/packages/apps/galaxpay/scripts/build.sh +5 -0
- package/packages/apps/galaxpay/src/functions-lib/all-parses.ts +91 -0
- package/packages/apps/galaxpay/src/functions-lib/ecom/events-to-galaxpay.ts +85 -0
- package/packages/apps/galaxpay/src/functions-lib/galaxpay/auth/create-access.ts +80 -0
- package/packages/apps/galaxpay/src/functions-lib/galaxpay/auth/create-axios.ts +21 -0
- package/packages/apps/galaxpay/src/functions-lib/galaxpay/auth/gerate-token.ts +36 -0
- package/packages/apps/galaxpay/src/functions-lib/galaxpay/handle-plans.ts +92 -0
- package/packages/apps/galaxpay/src/functions-lib/galaxpay/update-subscription.ts +73 -0
- package/packages/apps/galaxpay/src/functions-lib/galaxpay/webhook.ts +381 -0
- package/packages/apps/galaxpay/src/functions-lib/utils.ts +23 -0
- package/packages/apps/galaxpay/src/galaxpay-create-transaction.ts +240 -0
- package/packages/apps/galaxpay/src/galaxpay-events.ts +28 -0
- package/packages/apps/galaxpay/src/galaxpay-list-payments.ts +130 -0
- package/packages/apps/galaxpay/src/galaxpay.ts +12 -0
- package/packages/apps/galaxpay/src/index.ts +2 -0
- package/packages/apps/galaxpay/tsconfig.json +6 -0
- package/packages/apps/galaxpay/types/config-app.d.ts +99 -0
- package/packages/apps/infinitepay/lib/infinitepay.js +1 -2
- package/packages/apps/infinitepay/lib/infinitepay.js.map +1 -1
- package/packages/apps/infinitepay/lib/ip-create-transaction.d.ts +1 -2
- package/packages/apps/infinitepay/lib/ip-create-transaction.js +3 -2
- package/packages/apps/infinitepay/lib/ip-create-transaction.js.map +1 -1
- package/packages/apps/infinitepay/lib/ip-list-payments.d.ts +1 -2
- package/packages/apps/infinitepay/lib/ip-list-payments.js.map +1 -1
- package/packages/apps/infinitepay/package.json +3 -3
- package/packages/apps/infinitepay/src/infinitepay.ts +1 -2
- package/packages/apps/infinitepay/src/ip-create-transaction.ts +8 -6
- package/packages/apps/infinitepay/src/ip-list-payments.ts +5 -3
- package/packages/apps/jadlog/CHANGELOG.md +1 -0
- package/packages/apps/jadlog/README.md +1 -0
- package/packages/apps/jadlog/lib/index.d.ts +1 -0
- package/packages/apps/jadlog/lib/index.js +2 -0
- package/packages/apps/jadlog/lib/index.js.map +1 -0
- package/packages/apps/jadlog/lib/jadlog.d.ts +2 -0
- package/packages/apps/jadlog/lib/jadlog.js +6 -0
- package/packages/apps/jadlog/lib/jadlog.js.map +1 -0
- package/packages/apps/jadlog/lib-mjs/calculate-jadlog.mjs +408 -0
- package/packages/apps/jadlog/lib-mjs/deadlines/range-0.mjs +147 -0
- package/packages/apps/jadlog/lib-mjs/deadlines/range-1.mjs +1149 -0
- package/packages/apps/jadlog/lib-mjs/deadlines/range-2.mjs +1137 -0
- package/packages/apps/jadlog/lib-mjs/deadlines/range-3.mjs +1638 -0
- package/packages/apps/jadlog/lib-mjs/deadlines/range-4.mjs +1089 -0
- package/packages/apps/jadlog/lib-mjs/deadlines/range-5.mjs +1101 -0
- package/packages/apps/jadlog/lib-mjs/deadlines/range-6.mjs +1893 -0
- package/packages/apps/jadlog/lib-mjs/deadlines/range-7.mjs +1371 -0
- package/packages/apps/jadlog/lib-mjs/deadlines/range-8.mjs +1401 -0
- package/packages/apps/jadlog/lib-mjs/deadlines/range-9.mjs +963 -0
- package/packages/apps/jadlog/lib-mjs/jadlog-get-deadlines.mjs +32 -0
- package/packages/apps/jadlog/package.json +28 -0
- package/packages/apps/jadlog/src/index.ts +1 -0
- package/packages/apps/jadlog/src/jadlog.ts +7 -0
- package/packages/apps/jadlog/tsconfig.json +6 -0
- package/packages/apps/mercadopago/lib/mercadopago.js +1 -2
- package/packages/apps/mercadopago/lib/mercadopago.js.map +1 -1
- package/packages/apps/mercadopago/lib/mp-create-transaction.d.ts +1 -2
- package/packages/apps/mercadopago/lib/mp-create-transaction.js +3 -2
- package/packages/apps/mercadopago/lib/mp-create-transaction.js.map +1 -1
- package/packages/apps/mercadopago/lib/mp-list-payments.d.ts +1 -2
- package/packages/apps/mercadopago/lib/mp-list-payments.js +2 -1
- package/packages/apps/mercadopago/lib/mp-list-payments.js.map +1 -1
- package/packages/apps/mercadopago/package.json +3 -3
- package/packages/apps/mercadopago/src/mercadopago.ts +1 -2
- package/packages/apps/mercadopago/src/mp-create-transaction.ts +12 -10
- package/packages/apps/mercadopago/src/mp-list-payments.ts +9 -7
- package/packages/apps/pagarme/lib/pagarme-create-transaction.js.map +1 -1
- package/packages/apps/pagarme/lib/pagarme-list-payments.d.ts +1 -2
- package/packages/apps/pagarme/lib/pagarme-list-payments.js.map +1 -1
- package/packages/apps/pagarme/package.json +3 -3
- package/packages/apps/pagarme/src/pagarme-create-transaction.ts +5 -3
- package/packages/apps/pagarme/src/pagarme-list-payments.ts +5 -3
- package/packages/apps/pix/lib/functions-lib/pix-auth/construtor.js +1 -1
- package/packages/apps/pix/lib/functions-lib/pix-auth/construtor.js.map +1 -1
- package/packages/apps/pix/lib/pix-create-transaction.d.ts +1 -2
- package/packages/apps/pix/lib/pix-create-transaction.js +6 -5
- package/packages/apps/pix/lib/pix-create-transaction.js.map +1 -1
- package/packages/apps/pix/lib/pix-list-payments.d.ts +1 -2
- package/packages/apps/pix/lib/pix-list-payments.js.map +1 -1
- package/packages/apps/pix/lib/pix-webhook.js +1 -1
- package/packages/apps/pix/lib/pix-webhook.js.map +1 -1
- package/packages/apps/pix/lib/pix.js +1 -2
- package/packages/apps/pix/lib/pix.js.map +1 -1
- package/packages/apps/pix/package.json +3 -3
- package/packages/apps/pix/src/functions-lib/pix-auth/construtor.ts +1 -1
- package/packages/apps/pix/src/pix-create-transaction.ts +10 -9
- package/packages/apps/pix/src/pix-list-payments.ts +5 -3
- package/packages/apps/pix/src/pix-webhook.ts +1 -1
- package/packages/apps/pix/src/pix.ts +1 -2
- package/packages/apps/tiny-erp/package.json +3 -3
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +2 -2
- package/packages/events/lib/firebase.js +2 -0
- package/packages/events/lib/firebase.js.map +1 -1
- package/packages/events/package.json +4 -3
- package/packages/events/src/firebase.ts +2 -0
- package/packages/firebase/lib/config.d.ts +10 -0
- package/packages/firebase/lib/config.js +13 -0
- package/packages/firebase/lib/config.js.map +1 -1
- package/packages/firebase/lib/init.d.ts +0 -1
- package/packages/firebase/lib/init.js +0 -1
- package/packages/firebase/lib/init.js.map +1 -1
- package/packages/firebase/package.json +3 -4
- package/packages/firebase/src/config.ts +14 -0
- package/packages/firebase/src/init.ts +0 -1
- package/packages/i18n/lib/en_us/i19get$1back.txt +1 -0
- package/packages/i18n/lib/en_us.d.ts +1 -0
- package/packages/i18n/lib/en_us.js +1 -0
- package/packages/i18n/lib/en_us.js.map +1 -1
- package/packages/i18n/lib/pt_br/i19get$1back.txt +1 -0
- package/packages/i18n/lib/pt_br/i19get.txt +1 -1
- package/packages/i18n/lib/pt_br.d.ts +2 -1
- package/packages/i18n/lib/pt_br.js +2 -1
- package/packages/i18n/lib/pt_br.js.map +1 -1
- package/packages/i18n/package.json +1 -1
- package/packages/i18n/src/en_us.ts +1 -0
- package/packages/i18n/src/pt_br.ts +2 -1
- package/packages/modules/lib/firebase/call-app-module.js +71 -51
- package/packages/modules/lib/firebase/call-app-module.js.map +1 -1
- package/packages/modules/package.json +6 -3
- package/packages/modules/src/firebase/call-app-module.ts +37 -24
- package/packages/passport/package.json +3 -3
- package/packages/ssr/lib/firebase.js +1 -2
- package/packages/ssr/lib/firebase.js.map +1 -1
- package/packages/ssr/package.json +5 -5
- package/packages/ssr/src/firebase.ts +1 -2
- package/packages/storefront/.eslintrc.cjs +1 -1
- package/packages/storefront/.nvmrc +1 -0
- package/packages/storefront/dist/client/HeaderButtons.f1c92fd8.js +1 -0
- package/packages/storefront/dist/client/Prices.795d082c.js +1 -0
- package/packages/storefront/dist/client/ProductCard.f477b7a1.js +1 -0
- package/packages/storefront/dist/client/assets/_...slug_.15766f41.css +1 -0
- package/packages/storefront/dist/client/assets/index.e6a09532.css +1 -0
- package/packages/storefront/dist/client/assets/server.4d9646d8.css +1 -0
- package/packages/storefront/dist/client/chunks/HeaderButtons.27ab2180.js +1 -0
- package/packages/storefront/dist/client/chunks/{LoginForm.83fec3a1.js → LoginForm.36774236.js} +1 -1
- package/packages/storefront/dist/client/chunks/Prices.vue_vue_type_script_setup_true_lang.522e4ac4.js +1 -0
- package/packages/storefront/dist/client/chunks/_plugin-vue_export-helper.979dc9e3.js +1 -0
- package/packages/storefront/dist/client/chunks/{price.130e6005.js → price.ecf7fed4.js} +1 -1
- package/packages/storefront/dist/client/chunks/runtime-core.esm-bundler.6c012e5d.js +1 -0
- package/packages/storefront/dist/client/client.8b4e336b.js +1 -0
- package/packages/storefront/dist/client/hoisted.f6ee2883.js +1 -0
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/entry.mjs +704 -70
- package/packages/storefront/package.json +12 -9
- package/packages/storefront/src/lib/assets/base.css +4 -0
- package/packages/storefront/src/lib/components/Prices.vue +165 -0
- package/packages/storefront/src/lib/components/ProductCard.vue +36 -0
- package/packages/storefront/src/lib/components/globals/Fade.vue +171 -0
- package/packages/storefront/src/lib/composables/use-component-variant.ts +13 -0
- package/packages/storefront/src/lib/composables/use-prices.ts +172 -0
- package/packages/storefront/src/lib/layouts/BaseBody.astro +1 -0
- package/packages/storefront/src/lib/pages/_vue.ts +13 -1
- package/packages/storefront/src/lib/state/modules-info.ts +1 -1
- package/packages/storefront/src/vue-globals.d.ts +9 -2
- package/packages/storefront/tailwind.config.cjs +1 -0
- package/packages/storefront/uno.config.cjs +1 -0
- package/packages/types/package.json +1 -1
- package/store.renovate.json +2 -1
- package/packages/storefront/dist/client/HeaderButtons.1968a9ac.js +0 -1
- package/packages/storefront/dist/client/Price.c4aab3ea.js +0 -1
- package/packages/storefront/dist/client/assets/_...slug_.580c5aa4.css +0 -1
- package/packages/storefront/dist/client/chunks/HeaderButtons.5a0e371e.js +0 -1
- package/packages/storefront/dist/client/chunks/runtime-core.esm-bundler.4dae6bc1.js +0 -1
- package/packages/storefront/dist/client/chunks/runtime-dom.esm-bundler.7a999c6c.js +0 -1
- package/packages/storefront/dist/client/client.79a40b9d.js +0 -1
- package/packages/storefront/dist/client/hoisted.cce93d56.js +0 -1
- package/packages/storefront/src/lib/components/Price/PriceCashback.vue +0 -13
- package/packages/storefront/src/lib/components/Price/PriceCompare.vue +0 -13
- package/packages/storefront/src/lib/components/Price/PriceDiscountLabel.vue +0 -13
- package/packages/storefront/src/lib/components/Price/PriceInstallments.vue +0 -13
- package/packages/storefront/src/lib/components/Price/PriceSale.vue +0 -13
- package/packages/storefront/src/lib/components/Price/PriceWithDiscount.vue +0 -13
- package/packages/storefront/src/lib/components/Price.vue +0 -57
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/storefront",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront with Astro",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"repository": {
|
|
@@ -15,9 +15,11 @@
|
|
|
15
15
|
"url": "https://github.com/ecomplus/cloud-commerce/issues"
|
|
16
16
|
},
|
|
17
17
|
"homepage": "https://github.com/ecomplus/cloud-commerce/tree/main/packages/storefront#readme",
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=16"
|
|
20
|
+
},
|
|
18
21
|
"scripts": {
|
|
19
22
|
"dev": "astro dev",
|
|
20
|
-
"dev:cms": "tinacms dev -c \"astro dev\"",
|
|
21
23
|
"start": "astro dev --host",
|
|
22
24
|
"build": "astro build",
|
|
23
25
|
"build:static": "BUILD_OUTPUT=static astro build",
|
|
@@ -27,29 +29,30 @@
|
|
|
27
29
|
},
|
|
28
30
|
"dependencies": {
|
|
29
31
|
"@astrojs/image": "^0.12.1",
|
|
30
|
-
"@astrojs/node": "^
|
|
32
|
+
"@astrojs/node": "^4.0.0",
|
|
31
33
|
"@astrojs/partytown": "^1.0.2",
|
|
32
34
|
"@astrojs/prefetch": "^0.1.1",
|
|
33
|
-
"@astrojs/vue": "^1.2.
|
|
35
|
+
"@astrojs/vue": "^1.2.2",
|
|
34
36
|
"@cloudcommerce/api": "workspace:*",
|
|
35
37
|
"@cloudcommerce/config": "workspace:*",
|
|
36
38
|
"@cloudcommerce/i18n": "workspace:*",
|
|
37
39
|
"@ecomplus/utils": "1.5.0-rc.3",
|
|
38
40
|
"@fastify/deepmerge": "^1.3.0",
|
|
39
|
-
"@headlessui/vue": "^1.7.
|
|
41
|
+
"@headlessui/vue": "^1.7.7",
|
|
40
42
|
"@iconify-json/brands": "npm:@iconify-json/fa6-brands@^1.1.8",
|
|
41
43
|
"@iconify-json/general": "npm:@iconify-json/heroicons@^1.1.6",
|
|
42
44
|
"@iconify-json/logos": "^1.1.19",
|
|
43
|
-
"@vueuse/core": "^9.
|
|
44
|
-
"astro": "^1.
|
|
45
|
+
"@vueuse/core": "^9.7.0",
|
|
46
|
+
"astro": "^1.7.1",
|
|
45
47
|
"chroma-js": "^2.4.2",
|
|
46
48
|
"dotenv": "^16.0.3",
|
|
47
49
|
"firebase": "^9.15.0",
|
|
50
|
+
"floating-vue": "2.0.0-beta.20",
|
|
48
51
|
"image-size": "^1.0.2",
|
|
49
52
|
"tailwindcss": "^3.2.4",
|
|
50
|
-
"unocss": "^0.47.
|
|
53
|
+
"unocss": "^0.47.6",
|
|
51
54
|
"vite": "^3.2.5",
|
|
52
|
-
"vite-plugin-pwa": "^0.
|
|
55
|
+
"vite-plugin-pwa": "^0.14.0",
|
|
53
56
|
"vue": "^3.2.45",
|
|
54
57
|
"vue-bind-once": "^0.1.1"
|
|
55
58
|
},
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
10
10
|
--font-family: var(--font-sans);
|
|
11
11
|
--transition: .15s ease-in-out;
|
|
12
|
+
--transition-slow: .25s ease-in-out;
|
|
13
|
+
--transition-slower: .45s ease-in-out;
|
|
12
14
|
--c-on-dark: rgb(255, 255, 255);
|
|
13
15
|
--c-on-light: rgb(0, 0, 0);
|
|
14
16
|
--c-background: #fff;
|
|
@@ -27,6 +29,8 @@
|
|
|
27
29
|
@media (prefers-reduced-motion: reduce) {
|
|
28
30
|
:root {
|
|
29
31
|
--transition: 0s;
|
|
32
|
+
--transition-slow: 0s;
|
|
33
|
+
--transition-slower: .15s linear;
|
|
30
34
|
}
|
|
31
35
|
}
|
|
32
36
|
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Products, Carts, ListPaymentsResponse } from '@cloudcommerce/types';
|
|
3
|
+
import usePrices from '@@sf/composables/use-prices';
|
|
4
|
+
import useComponentVariant from '@@sf/composables/use-component-variant';
|
|
5
|
+
import { ref } from 'vue';
|
|
6
|
+
|
|
7
|
+
export interface Props {
|
|
8
|
+
product?: Partial<Carts['items'][0]> & Partial<Products> & { price: Products['price'] };
|
|
9
|
+
price?: number;
|
|
10
|
+
basePrice?: number;
|
|
11
|
+
isAmountTotal?: boolean,
|
|
12
|
+
installmentsOption?: ListPaymentsResponse['installments_option'];
|
|
13
|
+
discountOption?: ListPaymentsResponse['discount_option'];
|
|
14
|
+
isBig?: boolean;
|
|
15
|
+
isLiteral?: boolean;
|
|
16
|
+
hasCashback?: boolean;
|
|
17
|
+
hasPriceOptions?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
21
|
+
hasCashback: true,
|
|
22
|
+
hasPriceOptions: true,
|
|
23
|
+
});
|
|
24
|
+
const prices = usePrices(props);
|
|
25
|
+
const {
|
|
26
|
+
hasVariedPrices,
|
|
27
|
+
salePrice,
|
|
28
|
+
comparePrice,
|
|
29
|
+
earnPointsPercentage,
|
|
30
|
+
pointsCashback,
|
|
31
|
+
installmentsNumber,
|
|
32
|
+
monthlyInterest,
|
|
33
|
+
installmentValue,
|
|
34
|
+
priceWithDiscount,
|
|
35
|
+
discountLabel,
|
|
36
|
+
} = prices;
|
|
37
|
+
const componentVariant = useComponentVariant(props);
|
|
38
|
+
const isFade = ref(false);
|
|
39
|
+
setTimeout(() => {
|
|
40
|
+
isFade.value = true;
|
|
41
|
+
setTimeout(() => {
|
|
42
|
+
isFade.value = false;
|
|
43
|
+
}, 5000);
|
|
44
|
+
}, 5000);
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<template>
|
|
48
|
+
<slot v-bind="prices">
|
|
49
|
+
<div :data-sf-prices="componentVariant" class="text-base-600">
|
|
50
|
+
<slot v-if="comparePrice" name="compare" v-bind="prices">
|
|
51
|
+
<span :data-sf-prices-compare="comparePrice" class="text-base-500 mr-1">
|
|
52
|
+
<slot name="compare-pre">
|
|
53
|
+
<small v-if="isLiteral">
|
|
54
|
+
{{ `${$t.i19from} ` }}
|
|
55
|
+
</small>
|
|
56
|
+
</slot>
|
|
57
|
+
<slot name="compare-value" v-bind="prices">
|
|
58
|
+
<s>{{ $money(comparePrice) }}</s>
|
|
59
|
+
</slot>
|
|
60
|
+
<slot name="compare-post">
|
|
61
|
+
<small v-if="isLiteral">
|
|
62
|
+
{{ ` ${$t.i19to}` }}
|
|
63
|
+
</small>
|
|
64
|
+
</slot>
|
|
65
|
+
</span>
|
|
66
|
+
</slot>
|
|
67
|
+
<slot name="sale" v-bind="prices">
|
|
68
|
+
<strong :data-sf-prices-sale="salePrice" class="inline-block text-base-800">
|
|
69
|
+
<slot name="sale-pre">
|
|
70
|
+
<small v-if="hasVariedPrices">
|
|
71
|
+
{{ `${$t.i19asOf} ` }}
|
|
72
|
+
</small>
|
|
73
|
+
</slot>
|
|
74
|
+
<slot name="sale-value" v-bind="prices">
|
|
75
|
+
{{ $money(salePrice) }}
|
|
76
|
+
</slot>
|
|
77
|
+
<slot name="sale-post" />
|
|
78
|
+
</strong>
|
|
79
|
+
</slot>
|
|
80
|
+
<slot v-if="pointsCashback" name="cashback" v-bind="prices">
|
|
81
|
+
<Fade slide="down">
|
|
82
|
+
<div v-if="hasCashback" :data-sf-prices-cashback="pointsCashback">
|
|
83
|
+
<span v-tooltip.bottom="$t.i19get$1back
|
|
84
|
+
.replace('$1', $percentage(earnPointsPercentage))">
|
|
85
|
+
<slot name="cashback-pre">
|
|
86
|
+
<i class="i-arrow-uturn-left mr-1"></i>
|
|
87
|
+
</slot>
|
|
88
|
+
<slot name="cashback-value" v-bind="prices">
|
|
89
|
+
<span class="font-medium">
|
|
90
|
+
{{ $money(pointsCashback) }}
|
|
91
|
+
</span>
|
|
92
|
+
</slot>
|
|
93
|
+
<slot name="cashback-post">
|
|
94
|
+
<small> cashback</small>
|
|
95
|
+
</slot>
|
|
96
|
+
</span>
|
|
97
|
+
</div>
|
|
98
|
+
</Fade>
|
|
99
|
+
</slot>
|
|
100
|
+
<slot v-if="installmentValue" name="installment" v-bind="prices">
|
|
101
|
+
<Fade slide="down">
|
|
102
|
+
<div v-if="hasPriceOptions" :data-sf-prices-installment="installmentValue">
|
|
103
|
+
<slot name="installment-pre">
|
|
104
|
+
<small v-if="isLiteral">
|
|
105
|
+
{{ `${$t.i19upTo} ` }}
|
|
106
|
+
</small>
|
|
107
|
+
</slot>
|
|
108
|
+
<slot name="installment-value" v-bind="prices">
|
|
109
|
+
{{ installmentsNumber }}x
|
|
110
|
+
<small v-if="isLiteral">
|
|
111
|
+
{{ ` ${$t.i19of} ` }}
|
|
112
|
+
</small>
|
|
113
|
+
<span>{{ $money(installmentValue) }}</span>
|
|
114
|
+
</slot>
|
|
115
|
+
<slot name="installment-post">
|
|
116
|
+
<small v-if="!monthlyInterest && isLiteral">
|
|
117
|
+
{{ $t.i19interestFree }}
|
|
118
|
+
</small>
|
|
119
|
+
</slot>
|
|
120
|
+
</div>
|
|
121
|
+
</Fade>
|
|
122
|
+
</slot>
|
|
123
|
+
<slot v-if="priceWithDiscount < salePrice" name="discount" v-bind="prices">
|
|
124
|
+
<Fade slide="down">
|
|
125
|
+
<div v-if="hasPriceOptions" :data-sf-prices-discount="priceWithDiscount">
|
|
126
|
+
<slot name="discount-pre">
|
|
127
|
+
<small v-if="!discountLabel">
|
|
128
|
+
{{ `${$t.i19asOf} ` }}
|
|
129
|
+
</small>
|
|
130
|
+
</slot>
|
|
131
|
+
<slot name="discount-value" v-bind="prices">
|
|
132
|
+
<span>{{ $money(priceWithDiscount) }}</span>
|
|
133
|
+
</slot>
|
|
134
|
+
<slot name="discount-post">
|
|
135
|
+
<small v-if="discountLabel">
|
|
136
|
+
{{ ` ${discountLabel}` }}
|
|
137
|
+
</small>
|
|
138
|
+
</slot>
|
|
139
|
+
</div>
|
|
140
|
+
</Fade>
|
|
141
|
+
</slot>
|
|
142
|
+
</div>
|
|
143
|
+
</slot>
|
|
144
|
+
</template>
|
|
145
|
+
|
|
146
|
+
<style>
|
|
147
|
+
[data-sf-prices-compare] {
|
|
148
|
+
font-size: 87%;
|
|
149
|
+
}
|
|
150
|
+
[data-sf-prices-cashback],
|
|
151
|
+
[data-sf-prices-installment],
|
|
152
|
+
[data-sf-prices-discount] {
|
|
153
|
+
font-size: 90%;
|
|
154
|
+
}
|
|
155
|
+
[data-sf-prices] small {
|
|
156
|
+
@apply lowercase;
|
|
157
|
+
font-size: 92%;
|
|
158
|
+
}
|
|
159
|
+
[data-sf-prices~=Big] {
|
|
160
|
+
@apply text-lg;
|
|
161
|
+
}
|
|
162
|
+
[data-sf-prices~=Big] [data-sf-prices-sale] {
|
|
163
|
+
@apply text-5xl block;
|
|
164
|
+
}
|
|
165
|
+
</style>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue';
|
|
3
|
+
import Prices from '@@components/Prices.vue';
|
|
4
|
+
|
|
5
|
+
export interface Props {
|
|
6
|
+
as?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
withDefaults(defineProps<Props>(), {
|
|
10
|
+
as: 'div',
|
|
11
|
+
});
|
|
12
|
+
const price = ref(12);
|
|
13
|
+
const isBig = ref(false);
|
|
14
|
+
setTimeout(() => {
|
|
15
|
+
price.value = 8;
|
|
16
|
+
isBig.value = true;
|
|
17
|
+
}, 5000);
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<component :is="as">
|
|
22
|
+
<Prices v-slot="{ salePrice }">
|
|
23
|
+
ProductCard {{ salePrice }}
|
|
24
|
+
</Prices>
|
|
25
|
+
<Prices :product="{ price }" />
|
|
26
|
+
<Prices :price="12" :base-price="17" />
|
|
27
|
+
<Prices :price="12" :base-price="16" :is-literal="true" />
|
|
28
|
+
<Prices :price="12" :is-big="isBig" />
|
|
29
|
+
<Prices :price="14" :base-price="18" :is-big="isBig" :is-literal="true" />
|
|
30
|
+
<Prices :price="12" :base-price="16">
|
|
31
|
+
<template #compare-value="{ comparePrice }">
|
|
32
|
+
x{{ comparePrice }}
|
|
33
|
+
</template>
|
|
34
|
+
</Prices>
|
|
35
|
+
</component>
|
|
36
|
+
</template>
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
|
|
4
|
+
export interface Props {
|
|
5
|
+
speed?: 'default' | 'slow' | 'slower',
|
|
6
|
+
slide?: 'down' | 'left' | 'right' | 'up',
|
|
7
|
+
isLeaveTo?: boolean,
|
|
8
|
+
isEnterFrom?: boolean,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
12
|
+
speed: 'default',
|
|
13
|
+
isLeaveTo: true,
|
|
14
|
+
isEnterFrom: true,
|
|
15
|
+
});
|
|
16
|
+
const duration = computed(() => {
|
|
17
|
+
if (props.speed === 'default') return 'var(--transition, .2s linear)';
|
|
18
|
+
return `var(--transition-${props.speed}, .4s linear)`;
|
|
19
|
+
});
|
|
20
|
+
const transform = computed(() => {
|
|
21
|
+
switch (props.slide) {
|
|
22
|
+
case 'down':
|
|
23
|
+
return 'translate3d(0, -100%, 0)';
|
|
24
|
+
case 'left':
|
|
25
|
+
return 'translate3d(-100%, 0, 0)';
|
|
26
|
+
case 'right':
|
|
27
|
+
return 'translate3d(100%, 0, 0)';
|
|
28
|
+
case 'up':
|
|
29
|
+
return 'translate3d(0, 100%, 0)';
|
|
30
|
+
default:
|
|
31
|
+
return 'none';
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const opacity = computed(() => {
|
|
35
|
+
return transform.value !== 'none' ? 0.1 : 0;
|
|
36
|
+
});
|
|
37
|
+
const enterFromOpacity = computed(() => {
|
|
38
|
+
return props.isEnterFrom ? opacity.value : 1;
|
|
39
|
+
});
|
|
40
|
+
const leaveToOpacity = computed(() => {
|
|
41
|
+
return props.isLeaveTo ? opacity.value : 1;
|
|
42
|
+
});
|
|
43
|
+
const enterFromTransform = computed(() => {
|
|
44
|
+
return props.isEnterFrom ? transform.value : 'none';
|
|
45
|
+
});
|
|
46
|
+
const leaveToTransform = computed(() => {
|
|
47
|
+
return props.isLeaveTo ? transform.value : 'none';
|
|
48
|
+
});
|
|
49
|
+
const isSlideY = computed(() => {
|
|
50
|
+
return props.slide === 'down' || props.slide === 'up';
|
|
51
|
+
});
|
|
52
|
+
const height = computed(() => {
|
|
53
|
+
return isSlideY.value ? 0 : 'auto';
|
|
54
|
+
});
|
|
55
|
+
const width = computed(() => {
|
|
56
|
+
return props.slide && !isSlideY.value ? 0 : 'auto';
|
|
57
|
+
});
|
|
58
|
+
const enterFromHeight = computed(() => {
|
|
59
|
+
return props.isEnterFrom ? height.value : 'auto';
|
|
60
|
+
});
|
|
61
|
+
const leaveToHeight = computed(() => {
|
|
62
|
+
return props.isLeaveTo ? height.value : 'auto';
|
|
63
|
+
});
|
|
64
|
+
const enterFromWidth = computed(() => {
|
|
65
|
+
return props.isEnterFrom ? width.value : 'auto';
|
|
66
|
+
});
|
|
67
|
+
const leaveToWidth = computed(() => {
|
|
68
|
+
return props.isLeaveTo ? width.value : 'auto';
|
|
69
|
+
});
|
|
70
|
+
const willChange = computed(() => {
|
|
71
|
+
let properties = 'opacity';
|
|
72
|
+
if (transform.value !== 'none') properties += ', transform';
|
|
73
|
+
if (height.value !== 'auto') properties += ', height';
|
|
74
|
+
if (width.value !== 'auto') properties += ', width';
|
|
75
|
+
return properties;
|
|
76
|
+
});
|
|
77
|
+
const onEnter = (el: HTMLElement) => {
|
|
78
|
+
if (props.slide) {
|
|
79
|
+
if (isSlideY.value) {
|
|
80
|
+
el.style.width = getComputedStyle(el).width;
|
|
81
|
+
el.style.height = 'auto';
|
|
82
|
+
} else {
|
|
83
|
+
el.style.width = 'auto';
|
|
84
|
+
el.style.height = getComputedStyle(el).height;
|
|
85
|
+
}
|
|
86
|
+
el.style.position = 'absolute';
|
|
87
|
+
el.style.visibility = 'hidden';
|
|
88
|
+
// eslint-disable-next-line no-shadow
|
|
89
|
+
const { width, height } = getComputedStyle(el);
|
|
90
|
+
el.style.width = isSlideY.value ? null : '0';
|
|
91
|
+
el.style.height = isSlideY.value ? '0' : null;
|
|
92
|
+
el.style.position = null;
|
|
93
|
+
el.style.visibility = null;
|
|
94
|
+
// Force repaint to make sure the animation is triggered correctly
|
|
95
|
+
// eslint-disable-next-line no-unused-expressions
|
|
96
|
+
getComputedStyle(el)[isSlideY.value ? 'height' : 'width'];
|
|
97
|
+
requestAnimationFrame(() => {
|
|
98
|
+
if (isSlideY.value) {
|
|
99
|
+
el.style.height = height;
|
|
100
|
+
} else {
|
|
101
|
+
el.style.width = width;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const onAfterEnter = (el: HTMLElement) => {
|
|
107
|
+
if (props.slide) {
|
|
108
|
+
el.style[isSlideY.value ? 'height' : 'width'] = 'auto';
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
const onLeave = (el: HTMLElement) => {
|
|
112
|
+
if (props.slide) {
|
|
113
|
+
if (isSlideY.value) {
|
|
114
|
+
el.style.height = getComputedStyle(el).height;
|
|
115
|
+
} else {
|
|
116
|
+
el.style.width = getComputedStyle(el).width;
|
|
117
|
+
}
|
|
118
|
+
const sizeProp = isSlideY.value ? 'height' : 'width';
|
|
119
|
+
// eslint-disable-next-line no-unused-expressions
|
|
120
|
+
getComputedStyle(el)[sizeProp];
|
|
121
|
+
requestAnimationFrame(() => {
|
|
122
|
+
el.style[sizeProp] = '0';
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
</script>
|
|
127
|
+
|
|
128
|
+
<template>
|
|
129
|
+
<Transition
|
|
130
|
+
name="sf-fade"
|
|
131
|
+
@enter="onEnter"
|
|
132
|
+
@after-enter="onAfterEnter"
|
|
133
|
+
@leave="onLeave"
|
|
134
|
+
>
|
|
135
|
+
<slot />
|
|
136
|
+
</Transition>
|
|
137
|
+
</template>
|
|
138
|
+
|
|
139
|
+
<style>
|
|
140
|
+
.sf-fade-enter-active,
|
|
141
|
+
.sf-fade-leave-active {
|
|
142
|
+
transition: opacity var(--duration), transform var(--duration),
|
|
143
|
+
height var(--duration), width var(--duration);
|
|
144
|
+
overflow: hidden;
|
|
145
|
+
}
|
|
146
|
+
</style>
|
|
147
|
+
|
|
148
|
+
<style scoped>
|
|
149
|
+
* {
|
|
150
|
+
will-change: v-bind(willChange);
|
|
151
|
+
transform: translateZ(0);
|
|
152
|
+
backface-visibility: hidden;
|
|
153
|
+
perspective: 1000px;
|
|
154
|
+
}
|
|
155
|
+
.sf-fade-enter-active,
|
|
156
|
+
.sf-fade-leave-active {
|
|
157
|
+
--duration: v-bind(duration);
|
|
158
|
+
}
|
|
159
|
+
.sf-fade-enter-from {
|
|
160
|
+
opacity: v-bind(enterFromOpacity);
|
|
161
|
+
transform: v-bind(enterFromTransform);
|
|
162
|
+
height: v-bind(enterFromHeight);
|
|
163
|
+
width: v-bind(enterFromWidth);
|
|
164
|
+
}
|
|
165
|
+
.sf-fade-leave-to {
|
|
166
|
+
opacity: v-bind(leaveToOpacity);
|
|
167
|
+
transform: v-bind(leaveToTransform);
|
|
168
|
+
height: v-bind(leaveToHeight);
|
|
169
|
+
width: v-bind(leaveToWidth);
|
|
170
|
+
}
|
|
171
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { computed } from 'vue';
|
|
2
|
+
|
|
3
|
+
export default (props: Record<string, any>) => {
|
|
4
|
+
return computed(() => {
|
|
5
|
+
let variantName = '';
|
|
6
|
+
Object.keys(props).forEach((prop) => {
|
|
7
|
+
if (props[prop] === true) {
|
|
8
|
+
variantName += ` ${prop.replace(/^(is|has)/, '')}`;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
return variantName.slice(1);
|
|
12
|
+
});
|
|
13
|
+
};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import type { Products, Carts, ListPaymentsResponse } from '@cloudcommerce/types';
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import { price as getPrice, onPromotion as checkOnPromotion } from '@ecomplus/utils';
|
|
4
|
+
import modulesInfo from '@@sf/state/modules-info';
|
|
5
|
+
|
|
6
|
+
export interface Props {
|
|
7
|
+
product?: Partial<Carts['items'][0]> & Partial<Products> & { price: Products['price'] };
|
|
8
|
+
price?: number;
|
|
9
|
+
basePrice?: number;
|
|
10
|
+
isAmountTotal?: boolean,
|
|
11
|
+
installmentsOption?: ListPaymentsResponse['installments_option'];
|
|
12
|
+
discountOption?: ListPaymentsResponse['discount_option'];
|
|
13
|
+
loyaltyPointsProgram?: ListPaymentsResponse['loyalty_points_programs']['k'];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const getPriceWithDiscount = (price: number, discount: Props['discountOption']) => {
|
|
17
|
+
const { type, value } = discount;
|
|
18
|
+
let priceWithDiscount: number;
|
|
19
|
+
if (value) {
|
|
20
|
+
if (type === 'percentage') {
|
|
21
|
+
priceWithDiscount = price * ((100 - value) / 100);
|
|
22
|
+
} else {
|
|
23
|
+
priceWithDiscount = price - value;
|
|
24
|
+
}
|
|
25
|
+
return priceWithDiscount > 0 ? priceWithDiscount : 0;
|
|
26
|
+
}
|
|
27
|
+
return price;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default (props: Props) => {
|
|
31
|
+
const _product = computed(() => {
|
|
32
|
+
return props.product || {
|
|
33
|
+
price: props.price || 0,
|
|
34
|
+
base_price: props.basePrice,
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
const hasVariedPrices = computed(() => {
|
|
38
|
+
const { variations } = _product.value;
|
|
39
|
+
if (variations) {
|
|
40
|
+
const productPrice = getPrice(_product.value);
|
|
41
|
+
for (let i = 0; i < variations.length; i++) {
|
|
42
|
+
const price = getPrice({
|
|
43
|
+
..._product.value,
|
|
44
|
+
...variations[i],
|
|
45
|
+
});
|
|
46
|
+
if (price > productPrice) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
});
|
|
53
|
+
const extraDiscount = computed(() => {
|
|
54
|
+
return modulesInfo.apply_discount.available_extra_discount;
|
|
55
|
+
});
|
|
56
|
+
const salePrice = computed(() => {
|
|
57
|
+
const price = getPrice(_product.value);
|
|
58
|
+
const discount = extraDiscount.value;
|
|
59
|
+
if (discount && (!discount.min_amount || price > discount.min_amount)) {
|
|
60
|
+
return getPriceWithDiscount(price, discount);
|
|
61
|
+
}
|
|
62
|
+
return price;
|
|
63
|
+
});
|
|
64
|
+
const comparePrice = computed(() => {
|
|
65
|
+
if (checkOnPromotion(_product.value)) {
|
|
66
|
+
return _product.value.base_price as number;
|
|
67
|
+
}
|
|
68
|
+
const price = getPrice(_product.value);
|
|
69
|
+
if (price > salePrice.value) {
|
|
70
|
+
return price;
|
|
71
|
+
}
|
|
72
|
+
return 0;
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const installmentsObject = computed(() => {
|
|
76
|
+
return props.installmentsOption
|
|
77
|
+
|| modulesInfo.list_payments.installments_option
|
|
78
|
+
|| { max_number: 1 };
|
|
79
|
+
});
|
|
80
|
+
const installmentsNumber = computed(() => {
|
|
81
|
+
if (installmentsObject.value.max_number <= 1) {
|
|
82
|
+
return 1;
|
|
83
|
+
}
|
|
84
|
+
const minInstallment = installmentsObject.value.min_installment || 5;
|
|
85
|
+
const maxInstallmentsNumber = Math.round(salePrice.value / minInstallment);
|
|
86
|
+
return Math.min(maxInstallmentsNumber, installmentsObject.value.max_number);
|
|
87
|
+
});
|
|
88
|
+
const monthlyInterest = computed(() => {
|
|
89
|
+
return installmentsObject.value.monthly_interest || 0;
|
|
90
|
+
});
|
|
91
|
+
const installmentValue = computed(() => {
|
|
92
|
+
if (installmentsNumber.value >= 2) {
|
|
93
|
+
if (monthlyInterest.value) {
|
|
94
|
+
return salePrice.value / installmentsNumber.value;
|
|
95
|
+
}
|
|
96
|
+
const interest = monthlyInterest.value / 100;
|
|
97
|
+
return (salePrice.value * interest)
|
|
98
|
+
/ (1 - ((1 + interest) ** -installmentsNumber.value));
|
|
99
|
+
}
|
|
100
|
+
return 0;
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
const discountObject = computed(() => {
|
|
104
|
+
const discount = props.discountOption || modulesInfo.list_payments.discount_option;
|
|
105
|
+
if (
|
|
106
|
+
discount
|
|
107
|
+
&& (!discount.min_amount || discount.min_amount <= salePrice.value)
|
|
108
|
+
&& (!props.isAmountTotal || discount.apply_at === 'total')
|
|
109
|
+
) {
|
|
110
|
+
return discount;
|
|
111
|
+
}
|
|
112
|
+
return {};
|
|
113
|
+
});
|
|
114
|
+
const discountLabel = computed(() => {
|
|
115
|
+
return discountObject.value.label || '';
|
|
116
|
+
});
|
|
117
|
+
const priceWithDiscount = computed(() => {
|
|
118
|
+
return getPriceWithDiscount(salePrice.value, discountObject.value);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const pointsProgramObject = computed(() => {
|
|
122
|
+
if (props.loyaltyPointsProgram) {
|
|
123
|
+
return props.loyaltyPointsProgram;
|
|
124
|
+
}
|
|
125
|
+
const pointsPrograms = modulesInfo.list_payments.loyalty_points_programs;
|
|
126
|
+
if (pointsPrograms) {
|
|
127
|
+
const programIds = Object.keys(pointsPrograms);
|
|
128
|
+
for (let i = 0; i < programIds.length; i++) {
|
|
129
|
+
const program = pointsPrograms[i];
|
|
130
|
+
if (program && program.earn_percentage > 0) {
|
|
131
|
+
return program;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return { ratio: 0 };
|
|
136
|
+
});
|
|
137
|
+
const pointsMinPrice = computed(() => {
|
|
138
|
+
return pointsProgramObject.value.min_subtotal_to_earn || 0;
|
|
139
|
+
});
|
|
140
|
+
const pointsProgramName = computed(() => {
|
|
141
|
+
return pointsProgramObject.value.name || '';
|
|
142
|
+
});
|
|
143
|
+
const earnPointsPercentage = computed(() => {
|
|
144
|
+
return pointsProgramObject.value.earn_percentage || 0;
|
|
145
|
+
});
|
|
146
|
+
const earnPointsFactor = computed(() => {
|
|
147
|
+
return earnPointsPercentage.value / 100;
|
|
148
|
+
});
|
|
149
|
+
const pointsCashback = computed(() => {
|
|
150
|
+
return earnPointsFactor.value > 0
|
|
151
|
+
? salePrice.value * earnPointsFactor.value : 0;
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
return {
|
|
155
|
+
hasVariedPrices,
|
|
156
|
+
salePrice,
|
|
157
|
+
comparePrice,
|
|
158
|
+
installmentsObject,
|
|
159
|
+
installmentsNumber,
|
|
160
|
+
monthlyInterest,
|
|
161
|
+
installmentValue,
|
|
162
|
+
discountObject,
|
|
163
|
+
discountLabel,
|
|
164
|
+
priceWithDiscount,
|
|
165
|
+
pointsProgramObject,
|
|
166
|
+
pointsMinPrice,
|
|
167
|
+
pointsProgramName,
|
|
168
|
+
earnPointsPercentage,
|
|
169
|
+
earnPointsFactor,
|
|
170
|
+
pointsCashback,
|
|
171
|
+
};
|
|
172
|
+
};
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { App } from 'vue';
|
|
2
2
|
import { i18n, formatMoney } from '@ecomplus/utils';
|
|
3
|
+
import { VTooltip } from 'floating-vue';
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import Fade from '@@components/globals/Fade.vue';
|
|
6
|
+
|
|
7
|
+
const formatPercentage = (value: number, digits = 1) => {
|
|
8
|
+
return Number.isInteger(value) ? `${value}%` : `${value.toFixed(digits)}%`;
|
|
9
|
+
};
|
|
3
10
|
|
|
4
11
|
export default (app: App) => {
|
|
5
12
|
app.use({
|
|
@@ -10,7 +17,12 @@ export default (app: App) => {
|
|
|
10
17
|
// @ts-ignore
|
|
11
18
|
return i18n(dict, lang || options?.lang);
|
|
12
19
|
};
|
|
13
|
-
app.config.globalProperties.$
|
|
20
|
+
app.config.globalProperties.$money = formatMoney;
|
|
21
|
+
app.config.globalProperties.$percentage = formatPercentage;
|
|
14
22
|
},
|
|
15
23
|
});
|
|
24
|
+
app.directive('tooltip', VTooltip);
|
|
25
|
+
app.component('Fade', Fade);
|
|
16
26
|
};
|
|
27
|
+
|
|
28
|
+
export type FormatPercentage = typeof formatPercentage;
|
|
@@ -16,7 +16,7 @@ const modulesInfo = reactive<{
|
|
|
16
16
|
list_payments: {
|
|
17
17
|
installments_option?: ListPaymentsResponse['installments_option'],
|
|
18
18
|
discount_option?: ListPaymentsResponse['discount_option'],
|
|
19
|
-
loyalty_points_programs?: ListPaymentsResponse['
|
|
19
|
+
loyalty_points_programs?: ListPaymentsResponse['loyalty_points_programs'],
|
|
20
20
|
},
|
|
21
21
|
calculate_shipping: {
|
|
22
22
|
free_shipping_from_value?: CalculateShippingResponse['free_shipping_from_value'],
|