cloudcommerce 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- 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 -7
- package/ecomplus-stores/monocard/package.json +1 -1
- package/ecomplus-stores/tia-sonia/functions/core/package.json +1 -1
- package/ecomplus-stores/tia-sonia/functions/events/package.json +2 -2
- package/ecomplus-stores/tia-sonia/functions/modules/package.json +2 -2
- package/ecomplus-stores/tia-sonia/functions/passport/package.json +2 -2
- package/ecomplus-stores/tia-sonia/functions/ssr/package.json +7 -7
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/{acai-com-granola.jpg → hero-acai-granola.jpg} +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/{cafe-com-tapioca-e-aveia.jpg → hero-cafe-tapioca-aveia.jpg} +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/hero-piquenique-snack-cookies.jpg +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/assets/prices.css +3 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/CategoriesSlider.vue +19 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/HeroBanner.vue +112 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/PitchBar.vue +48 -16
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/TheHeader.vue +39 -19
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/header/HeaderNav.vue +4 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/layouts/Base.astro +5 -3
- package/ecomplus-stores/tia-sonia/functions/ssr/src/layouts/Pages.astro +2 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/main/Home.astro +55 -17
- package/ecomplus-stores/tia-sonia/functions/ssr/src/scripts/head-scripts.ts +15 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/scripts/modules-info-preset.ts +27 -0
- package/ecomplus-stores/tia-sonia/package.json +1 -1
- package/package.json +7 -7
- package/packages/api/package.json +1 -1
- package/packages/apps/correios/package.json +2 -2
- package/packages/apps/custom-payment/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +1 -1
- package/packages/apps/fb-conversions/CHANGELOG.md +1 -0
- package/packages/apps/fb-conversions/README.md +1 -0
- package/packages/apps/fb-conversions/lib/fb-conversions-events.js +145 -0
- package/packages/apps/fb-conversions/lib/fb-conversions-events.js.map +1 -0
- package/packages/apps/fb-conversions/lib/index.js +2 -0
- package/packages/apps/fb-conversions/lib/index.js.map +1 -0
- package/packages/apps/fb-conversions/package.json +33 -0
- package/packages/apps/fb-conversions/src/fb-conversions-events.ts +178 -0
- package/packages/apps/fb-conversions/src/index.ts +1 -0
- package/packages/apps/fb-conversions/tsconfig.json +3 -0
- package/packages/apps/frenet/package.json +3 -3
- package/packages/apps/galaxpay/package.json +2 -2
- package/packages/apps/infinitepay/package.json +2 -2
- package/packages/apps/jadlog/package.json +2 -2
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/mercadopago/package.json +2 -2
- package/packages/apps/pagarme/package.json +2 -2
- package/packages/apps/pix/package.json +2 -2
- package/packages/apps/tiny-erp/package.json +2 -2
- 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 +2 -1
- package/packages/events/src/firebase.ts +2 -0
- package/packages/firebase/lib/config.d.ts +4 -0
- package/packages/firebase/lib/config.js +7 -0
- package/packages/firebase/lib/config.js.map +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/firebase/src/config.ts +7 -0
- package/packages/i18n/package.json +1 -1
- package/packages/modules/package.json +2 -2
- package/packages/passport/package.json +1 -1
- package/packages/ssr/package.json +4 -2
- package/packages/storefront/astro.config.mjs +3 -1
- package/packages/storefront/client.d.ts +1 -0
- package/packages/storefront/dist/client/HeaderButtons.6f668467.js +1 -0
- package/packages/storefront/dist/client/Prices.2ada125b.js +1 -0
- package/packages/storefront/dist/client/ProductCard.e5bdea60.js +1 -0
- package/packages/storefront/dist/client/assets/{_...slug_.15bda576.css → _...slug_.81b9a00c.css} +1 -1
- package/packages/storefront/dist/client/chunks/{HeaderButtons.1abd5bf4.js → HeaderButtons.cfa275db.js} +1 -1
- package/packages/storefront/dist/client/chunks/{LoginForm.7e7d6137.js → LoginForm.1ba3ad0d.js} +1 -1
- package/packages/storefront/dist/client/chunks/Prices.vue_vue_type_script_setup_true_lang.9a6ab0d6.js +1 -0
- package/packages/storefront/dist/client/chunks/{_plugin-vue_export-helper.fc452b02.js → _plugin-vue_export-helper.0d33cd48.js} +1 -1
- package/packages/storefront/dist/client/chunks/{runtime-core.esm-bundler.b4556b35.js → runtime-core.esm-bundler.45ba83fa.js} +1 -1
- package/packages/storefront/dist/client/{client.2a3e5a58.js → client.4d2b3a73.js} +1 -1
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/entry.mjs +274 -376
- package/packages/storefront/package.json +6 -7
- package/packages/storefront/src/lib/components/Prices.vue +113 -98
- package/packages/storefront/src/lib/composables/use-prices.ts +19 -12
- package/packages/storefront/src/lib/ssr/image.ts +3 -2
- package/packages/storefront/src/lib/state/modules-info.ts +10 -4
- package/packages/types/package.json +1 -1
- package/ecomplus-stores/monocard/functions/ssr/.nvmrc +0 -1
- package/ecomplus-stores/tia-sonia/functions/ssr/.nvmrc +0 -1
- package/ecomplus-stores/tia-sonia/functions/ssr/src/scripts/InlineScripts.astro +0 -10
- package/packages/storefront/.nvmrc +0 -1
- package/packages/storefront/dist/client/HeaderButtons.300c19e5.js +0 -1
- package/packages/storefront/dist/client/Prices.6c44a513.js +0 -1
- package/packages/storefront/dist/client/ProductCard.69bba7fc.js +0 -1
- package/packages/storefront/dist/client/chunks/Prices.vue_vue_type_script_setup_true_lang.e4525076.js +0 -1
- package/packages/storefront/dist/server/chunks/avif/avif_node_dec.wasm +0 -0
- package/packages/storefront/dist/server/chunks/avif/avif_node_enc.wasm +0 -0
- package/packages/storefront/dist/server/chunks/image-pool.abfa6f7b.mjs +0 -10794
- package/packages/storefront/dist/server/chunks/mozjpeg/mozjpeg_node_dec.wasm +0 -0
- package/packages/storefront/dist/server/chunks/mozjpeg/mozjpeg_node_enc.wasm +0 -0
- package/packages/storefront/dist/server/chunks/png/squoosh_oxipng_bg.wasm +0 -0
- package/packages/storefront/dist/server/chunks/png/squoosh_png_bg.wasm +0 -0
- package/packages/storefront/dist/server/chunks/resize/squoosh_resize_bg.wasm +0 -0
- package/packages/storefront/dist/server/chunks/rotate/rotate.wasm +0 -0
- package/packages/storefront/dist/server/chunks/webp/webp_node_dec.wasm +0 -0
- package/packages/storefront/dist/server/chunks/webp/webp_node_enc.wasm +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/storefront",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.7",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront with Astro",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"repository": {
|
|
@@ -15,9 +15,6 @@
|
|
|
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
|
-
},
|
|
21
18
|
"scripts": {
|
|
22
19
|
"dev": "astro dev",
|
|
23
20
|
"start": "astro dev --host",
|
|
@@ -40,14 +37,16 @@
|
|
|
40
37
|
"@fastify/deepmerge": "^1.3.0",
|
|
41
38
|
"@headlessui/vue": "^1.7.7",
|
|
42
39
|
"@iconify-json/fa6-brands": "^1.1.8",
|
|
43
|
-
"@iconify-json/heroicons": "^1.1.
|
|
44
|
-
"@iconify-json/logos": "^1.1.
|
|
40
|
+
"@iconify-json/heroicons": "^1.1.8",
|
|
41
|
+
"@iconify-json/logos": "^1.1.21",
|
|
45
42
|
"@vueuse/core": "^9.9.0",
|
|
46
|
-
"astro": "^1.
|
|
43
|
+
"astro": "^1.8.0",
|
|
47
44
|
"chroma-js": "^2.4.2",
|
|
48
45
|
"dotenv": "^16.0.3",
|
|
49
46
|
"firebase": "^9.15.0",
|
|
50
47
|
"image-size": "^1.0.2",
|
|
48
|
+
"semver": "^7.3.8",
|
|
49
|
+
"sharp": "^0.31.3",
|
|
51
50
|
"tailwindcss": "^3.2.4",
|
|
52
51
|
"unocss": "^0.48.0",
|
|
53
52
|
"vite": "^3.2.5",
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { Products,
|
|
2
|
+
import type { Products, ListPaymentsResponse } from '@cloudcommerce/types';
|
|
3
3
|
import usePrices from '@@sf/composables/use-prices';
|
|
4
4
|
import useComponentVariant from '@@sf/composables/use-component-variant';
|
|
5
|
-
import { ref } from 'vue';
|
|
6
5
|
|
|
7
6
|
export interface Props {
|
|
8
|
-
product?: Partial<
|
|
7
|
+
product?: Partial<Products> & { price: number, final_price?: number };
|
|
9
8
|
price?: number;
|
|
10
9
|
basePrice?: number;
|
|
11
10
|
isAmountTotal?: boolean,
|
|
@@ -26,8 +25,8 @@ const {
|
|
|
26
25
|
hasVariedPrices,
|
|
27
26
|
salePrice,
|
|
28
27
|
comparePrice,
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
cashbackPercentage,
|
|
29
|
+
cashbackValue,
|
|
31
30
|
installmentsNumber,
|
|
32
31
|
monthlyInterest,
|
|
33
32
|
installmentValue,
|
|
@@ -35,112 +34,128 @@ const {
|
|
|
35
34
|
discountLabel,
|
|
36
35
|
} = prices;
|
|
37
36
|
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
37
|
</script>
|
|
46
38
|
|
|
47
39
|
<template>
|
|
48
|
-
<
|
|
49
|
-
<
|
|
50
|
-
<
|
|
51
|
-
<
|
|
52
|
-
<
|
|
40
|
+
<div :data-sf-prices="componentVariant" class="text-base-600">
|
|
41
|
+
<slot v-if="comparePrice" name="compare" v-bind="{ salePrice, comparePrice }">
|
|
42
|
+
<span :data-sf-prices-compare="comparePrice" class="text-base-500 mr-1">
|
|
43
|
+
<slot name="compare-pre">
|
|
44
|
+
<small v-if="isLiteral">
|
|
45
|
+
{{ `${$t.i19from} ` }}
|
|
46
|
+
</small>
|
|
47
|
+
</slot>
|
|
48
|
+
<slot name="compare-value" v-bind="{ salePrice, comparePrice }">
|
|
49
|
+
<s>{{ $money(comparePrice) }}</s>
|
|
50
|
+
</slot>
|
|
51
|
+
<slot name="compare-post">
|
|
52
|
+
<small v-if="isLiteral">
|
|
53
|
+
{{ ` ${$t.i19to}` }}
|
|
54
|
+
</small>
|
|
55
|
+
</slot>
|
|
56
|
+
</span>
|
|
57
|
+
</slot>
|
|
58
|
+
<slot name="sale" v-bind="{ salePrice }">
|
|
59
|
+
<strong :data-sf-prices-sale="salePrice" class="inline-block text-base-800">
|
|
60
|
+
<slot name="sale-pre">
|
|
61
|
+
<small v-if="hasVariedPrices">
|
|
62
|
+
{{ `${$t.i19asOf} ` }}
|
|
63
|
+
</small>
|
|
64
|
+
</slot>
|
|
65
|
+
<slot name="sale-value" v-bind="{ salePrice }">
|
|
66
|
+
{{ $money(salePrice) }}
|
|
67
|
+
</slot>
|
|
68
|
+
<slot name="sale-post" />
|
|
69
|
+
</strong>
|
|
70
|
+
</slot>
|
|
71
|
+
<slot
|
|
72
|
+
v-if="cashbackValue"
|
|
73
|
+
name="cashback"
|
|
74
|
+
v-bind="{ salePrice, cashbackValue, cashbackPercentage }"
|
|
75
|
+
>
|
|
76
|
+
<Fade slide="down">
|
|
77
|
+
<div
|
|
78
|
+
v-if="hasCashback"
|
|
79
|
+
:data-sf-prices-cashback="cashbackValue"
|
|
80
|
+
class="relative z-10"
|
|
81
|
+
>
|
|
82
|
+
<span :data-tooltip="$t.i19get$1back
|
|
83
|
+
.replace('$1', $percentage(cashbackPercentage))">
|
|
84
|
+
<slot name="cashback-pre">
|
|
85
|
+
<i class="i-cashback mr-1"></i>
|
|
86
|
+
</slot>
|
|
87
|
+
<slot
|
|
88
|
+
name="cashback-value"
|
|
89
|
+
v-bind="{ salePrice, cashbackValue, cashbackPercentage }"
|
|
90
|
+
>
|
|
91
|
+
<span class="font-medium">
|
|
92
|
+
{{ $money(cashbackValue) }}
|
|
93
|
+
</span>
|
|
94
|
+
</slot>
|
|
95
|
+
<slot name="cashback-post">
|
|
96
|
+
<small> cashback</small>
|
|
97
|
+
</slot>
|
|
98
|
+
</span>
|
|
99
|
+
</div>
|
|
100
|
+
</Fade>
|
|
101
|
+
</slot>
|
|
102
|
+
<slot
|
|
103
|
+
v-if="installmentValue"
|
|
104
|
+
name="installment"
|
|
105
|
+
v-bind="{ salePrice, installmentValue, installmentsNumber, monthlyInterest }"
|
|
106
|
+
>
|
|
107
|
+
<Fade slide="down">
|
|
108
|
+
<div v-if="hasPriceOptions" :data-sf-prices-installment="installmentValue">
|
|
109
|
+
<slot name="installment-pre">
|
|
53
110
|
<small v-if="isLiteral">
|
|
54
|
-
{{ `${$t.
|
|
111
|
+
{{ `${$t.i19upTo} ` }}
|
|
55
112
|
</small>
|
|
56
113
|
</slot>
|
|
57
|
-
<slot
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
114
|
+
<slot
|
|
115
|
+
name="installment-value"
|
|
116
|
+
v-bind="{ salePrice, installmentValue, installmentsNumber, monthlyInterest }"
|
|
117
|
+
>
|
|
118
|
+
{{ installmentsNumber }}x
|
|
61
119
|
<small v-if="isLiteral">
|
|
62
|
-
{{ ` ${$t.
|
|
120
|
+
{{ ` ${$t.i19of} ` }}
|
|
63
121
|
</small>
|
|
122
|
+
<span>{{ $money(installmentValue) }}</span>
|
|
64
123
|
</slot>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
124
|
+
<slot name="installment-post">
|
|
125
|
+
<small v-if="!monthlyInterest && isLiteral">
|
|
126
|
+
{{ $t.i19interestFree }}
|
|
127
|
+
</small>
|
|
128
|
+
</slot>
|
|
129
|
+
</div>
|
|
130
|
+
</Fade>
|
|
131
|
+
</slot>
|
|
132
|
+
<slot
|
|
133
|
+
v-if="priceWithDiscount < salePrice"
|
|
134
|
+
name="discount"
|
|
135
|
+
v-bind="{ salePrice, priceWithDiscount, discountLabel }"
|
|
136
|
+
>
|
|
137
|
+
<Fade slide="down">
|
|
138
|
+
<div v-if="hasPriceOptions" :data-sf-prices-discount="priceWithDiscount">
|
|
139
|
+
<slot name="discount-pre">
|
|
140
|
+
<small v-if="!discountLabel">
|
|
71
141
|
{{ `${$t.i19asOf} ` }}
|
|
72
142
|
</small>
|
|
73
143
|
</slot>
|
|
74
|
-
<slot
|
|
75
|
-
|
|
144
|
+
<slot
|
|
145
|
+
name="discount-value"
|
|
146
|
+
v-bind="{ salePrice, priceWithDiscount, discountLabel }"
|
|
147
|
+
>
|
|
148
|
+
<span>{{ $money(priceWithDiscount) }}</span>
|
|
76
149
|
</slot>
|
|
77
|
-
<slot name="
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
<i class="i-cashback 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>
|
|
150
|
+
<slot name="discount-post">
|
|
151
|
+
<small v-if="discountLabel">
|
|
152
|
+
{{ ` ${discountLabel}` }}
|
|
153
|
+
</small>
|
|
154
|
+
</slot>
|
|
155
|
+
</div>
|
|
156
|
+
</Fade>
|
|
157
|
+
</slot>
|
|
158
|
+
</div>
|
|
144
159
|
</template>
|
|
145
160
|
|
|
146
161
|
<style>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { Products,
|
|
1
|
+
import type { Products, ListPaymentsResponse } from '@cloudcommerce/types';
|
|
2
2
|
import { computed } from 'vue';
|
|
3
3
|
import { price as getPrice, onPromotion as checkOnPromotion } from '@ecomplus/utils';
|
|
4
4
|
import modulesInfo from '@@sf/state/modules-info';
|
|
5
5
|
|
|
6
6
|
export interface Props {
|
|
7
|
-
product?: Partial<
|
|
7
|
+
product?: Partial<Products> & { price: number, final_price?: number };
|
|
8
8
|
price?: number;
|
|
9
9
|
basePrice?: number;
|
|
10
10
|
isAmountTotal?: boolean,
|
|
@@ -90,7 +90,7 @@ export default (props: Props) => {
|
|
|
90
90
|
});
|
|
91
91
|
const installmentValue = computed(() => {
|
|
92
92
|
if (installmentsNumber.value >= 2) {
|
|
93
|
-
if (monthlyInterest.value) {
|
|
93
|
+
if (!monthlyInterest.value) {
|
|
94
94
|
return salePrice.value / installmentsNumber.value;
|
|
95
95
|
}
|
|
96
96
|
const interest = monthlyInterest.value / 100;
|
|
@@ -112,7 +112,14 @@ export default (props: Props) => {
|
|
|
112
112
|
return {};
|
|
113
113
|
});
|
|
114
114
|
const discountLabel = computed(() => {
|
|
115
|
-
|
|
115
|
+
const { label } = discountObject.value;
|
|
116
|
+
if (label) {
|
|
117
|
+
if (label.includes(' ')) {
|
|
118
|
+
return label;
|
|
119
|
+
}
|
|
120
|
+
return `via ${label}`;
|
|
121
|
+
}
|
|
122
|
+
return '';
|
|
116
123
|
});
|
|
117
124
|
const priceWithDiscount = computed(() => {
|
|
118
125
|
return getPriceWithDiscount(salePrice.value, discountObject.value);
|
|
@@ -126,7 +133,7 @@ export default (props: Props) => {
|
|
|
126
133
|
if (pointsPrograms) {
|
|
127
134
|
const programIds = Object.keys(pointsPrograms);
|
|
128
135
|
for (let i = 0; i < programIds.length; i++) {
|
|
129
|
-
const program = pointsPrograms[i];
|
|
136
|
+
const program = pointsPrograms[programIds[i]];
|
|
130
137
|
if (program && program.earn_percentage > 0) {
|
|
131
138
|
return program;
|
|
132
139
|
}
|
|
@@ -143,12 +150,12 @@ export default (props: Props) => {
|
|
|
143
150
|
const earnPointsPercentage = computed(() => {
|
|
144
151
|
return pointsProgramObject.value.earn_percentage || 0;
|
|
145
152
|
});
|
|
146
|
-
const
|
|
147
|
-
return earnPointsPercentage.value
|
|
153
|
+
const cashbackPercentage = computed(() => {
|
|
154
|
+
return earnPointsPercentage.value * pointsProgramObject.value.ratio;
|
|
148
155
|
});
|
|
149
|
-
const
|
|
150
|
-
return
|
|
151
|
-
? salePrice.value *
|
|
156
|
+
const cashbackValue = computed(() => {
|
|
157
|
+
return cashbackPercentage.value >= 1
|
|
158
|
+
? salePrice.value * (cashbackPercentage.value / 100) : 0;
|
|
152
159
|
});
|
|
153
160
|
|
|
154
161
|
return {
|
|
@@ -166,7 +173,7 @@ export default (props: Props) => {
|
|
|
166
173
|
pointsMinPrice,
|
|
167
174
|
pointsProgramName,
|
|
168
175
|
earnPointsPercentage,
|
|
169
|
-
|
|
170
|
-
|
|
176
|
+
cashbackPercentage,
|
|
177
|
+
cashbackValue,
|
|
171
178
|
};
|
|
172
179
|
};
|
|
@@ -15,8 +15,9 @@ const tryImageSize = (src: string) => {
|
|
|
15
15
|
return dimensions;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
type TransformOptions = Parameters<typeof _getImage>[0] & {
|
|
18
|
+
type TransformOptions = Omit<Parameters<typeof _getImage>[0], 'alt'> & {
|
|
19
19
|
isLowResolution?: boolean,
|
|
20
|
+
alt?: string,
|
|
20
21
|
};
|
|
21
22
|
const getImage = async (options: TransformOptions) => {
|
|
22
23
|
if (!options.isLowResolution) {
|
|
@@ -40,7 +41,7 @@ const getImage = async (options: TransformOptions) => {
|
|
|
40
41
|
options.aspectRatio = height ? width / height : 1;
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
|
-
const imgAttrs = await _getImage(options);
|
|
44
|
+
const imgAttrs = await _getImage({ alt: '', ...options });
|
|
44
45
|
imgAttrs.src += imgAttrs.src.includes('?') ? '&' : '?';
|
|
45
46
|
imgAttrs.src += `V=${import.meta.env.DEPLOY_RAND || '_'}`;
|
|
46
47
|
if (typeof imgAttrs.width === 'number') {
|
|
@@ -46,10 +46,16 @@ if (!import.meta.env.SSR) {
|
|
|
46
46
|
if (persistedValue?.list_payments) {
|
|
47
47
|
Object.assign(modulesInfo, persistedValue);
|
|
48
48
|
} else {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
const modulesInfoPreset = window.storefront?.modulesInfoPreset;
|
|
50
|
+
if (modulesInfoPreset) {
|
|
51
|
+
Object.assign(modulesInfo, modulesInfoPreset);
|
|
52
|
+
}
|
|
53
|
+
const modulesToFetch: { modName: string, reqOptions?: Record<string, any> }[] = [];
|
|
54
|
+
['list_payments', 'calculate_shipping'].forEach((modName) => {
|
|
55
|
+
if (!Object.keys(modulesInfo[modName]).length) {
|
|
56
|
+
modulesToFetch.push({ modName });
|
|
57
|
+
}
|
|
58
|
+
});
|
|
53
59
|
if (Object.keys(utm).length) {
|
|
54
60
|
modulesToFetch.push({
|
|
55
61
|
modName: 'apply_discount',
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
16
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
16
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<script is:inline>
|
|
2
|
-
window.firebaseConfig = {
|
|
3
|
-
apiKey: "AIzaSyDZ5QPJaLZM1bxEJyGbyK1weoBZ1TiLgFc",
|
|
4
|
-
authDomain: "ecom2-tiasonia.firebaseapp.com",
|
|
5
|
-
projectId: "ecom2-tiasonia",
|
|
6
|
-
storageBucket: "ecom2-tiasonia.appspot.com",
|
|
7
|
-
messagingSenderId: "895718193792",
|
|
8
|
-
appId: "1:895718193792:web:1d4fd74466248202994465"
|
|
9
|
-
};
|
|
10
|
-
</script>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
16
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as a}from"./chunks/HeaderButtons.1abd5bf4.js";import"./chunks/preload-helper.1de719f8.js";import"./chunks/_plugin-vue_export-helper.fc452b02.js";import"./chunks/runtime-core.esm-bundler.b4556b35.js";/* empty css */export{a as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./chunks/Prices.vue_vue_type_script_setup_true_lang.e4525076.js";import{_ as s}from"./chunks/Prices.vue_vue_type_script_setup_true_lang.e4525076.js";/* empty css */import"./chunks/session-utm.2de8b604.js";import"./chunks/runtime-core.esm-bundler.b4556b35.js";import"./chunks/price.ecf7fed4.js";import"./chunks/ecom-utils.b0a26608.js";export{s as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e}from"./chunks/Prices.vue_vue_type_script_setup_true_lang.e4525076.js";/* empty css */import{d as u,a as o,l as n,w as t,p as m,o as d,j as a,i as c,t as l}from"./chunks/runtime-core.esm-bundler.b4556b35.js";import"./chunks/session-utm.2de8b604.js";import"./chunks/price.ecf7fed4.js";import"./chunks/ecom-utils.b0a26608.js";const h=u({__name:"ProductCard",props:{as:{default:"div"}},setup(p){const s=o(12),r=o(!1);return setTimeout(()=>{s.value=8,r.value=!0},5e3),(_,f)=>(d(),n(m(p.as),null,{default:t(()=>[a(e,null,{default:t(({salePrice:i})=>[c(" ProductCard "+l(i),1)]),_:1}),a(e,{product:{price:s.value}},null,8,["product"]),a(e,{price:12,"base-price":17}),a(e,{price:12,"base-price":16,"is-literal":!0}),a(e,{price:12,"is-big":r.value},null,8,["is-big"]),a(e,{price:14,"base-price":18,"is-big":r.value,"is-literal":!0},null,8,["is-big"]),a(e,{price:12,"base-price":16},{"compare-value":t(({comparePrice:i})=>[c(" x"+l(i),1)]),_:1})]),_:1}))}});export{h as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as E}from"./session-utm.2de8b604.js";import{r as W,c as m,d as R,a as q,b as u,n as _,g as I,u as e,e as P,m as V,o as v,f as b,t as h,h as d,i as F,j as T,w as A,k as z}from"./runtime-core.esm-bundler.b4556b35.js";import{g as L,c as K}from"./price.ecf7fed4.js";import"./ecom-utils.b0a26608.js";const U=(t,o,a=1e4)=>{let p,l;a&&(p=new AbortController,l=setTimeout(()=>{p.abort()},a)),o?.body&&typeof o.body=="object"&&(o.body=JSON.stringify(o.body),o.headers={...o.headers,"Content-Type":"application/json","Content-Length":o.body.length.toString()});const g=fetch(t,{...o,signal:p?.signal});return g.finally(()=>{l&&clearTimeout(l)}),g},G={list_payments:{},calculate_shipping:{},apply_discount:{}},j=W(G);{const t="MODULES_INFO",o=sessionStorage.getItem(t);let a;if(o)try{a=JSON.parse(o),a.__timestamp<Date.now()-1e3*60*5&&(a=null,sessionStorage.removeItem(t)),delete a.__timestamp}catch{sessionStorage.removeItem(t)}if(a?.list_payments)Object.assign(j,a);else{const p=[{modName:"list_payments"},{modName:"calculate_shipping"}];Object.keys(E).length&&p.push({modName:"apply_discount",reqOptions:{method:"post",body:{utm:E}}}),p.forEach(({modName:l,reqOptions:g})=>{U(`/api/modules/${l}`,g).then(async k=>{if(k.ok){const i={};j[l]=i;const{result:O}=await k.json();Array.isArray(O)&&O.forEach(({error:S,response:f})=>{if(!S){let s,r;switch(l){case"calculate_shipping":s="free_shipping_from_value",r=f[s],typeof r=="number"&&(i[s]===void 0||r<i[s])&&(i[s]=r);break;case"list_payments":s="installments_option",r=f[s],r&&(!i[s]||r.monthly_interest<i[s].monthly_interest||r.max_number>i[s].max_number)&&(i[s]=r),s="discount_option",r=f[s],r&&(!i[s]||r.value>i[s].value)&&f.payment_gateways.forEach(({discount:y})=>{y&&y.apply_at!=="freight"&&y.value===r.value&&(i[s]={apply_at:y.apply_at,...r})}),s="loyalty_points_programs",r=f[s],r&&(i[s]={...i[s],...r});break;default:s="available_extra_discount",r=f[s],r&&(!i[s]||r.value>i[s].value)&&(i[s]=r)}}}),sessionStorage.setItem(t,JSON.stringify({...j,__timestamp:Date.now()}))}}).catch(console.error)})}}const J=(t,o)=>{const{type:a,value:p}=o;let l;return p?(a==="percentage"?l=t*((100-p)/100):l=t-p,l>0?l:0):t},H=t=>{const o=m(()=>t.product||{price:t.price||0,base_price:t.basePrice}),a=m(()=>{const{variations:c}=o.value;if(c){const $=L(o.value);for(let C=0;C<c.length;C++)if(L({...o.value,...c[C]})>$)return!0}return!1}),p=m(()=>j.apply_discount.available_extra_discount),l=m(()=>{const c=L(o.value),$=p.value;return $&&(!$.min_amount||c>$.min_amount)?J(c,$):c}),g=m(()=>{if(K(o.value))return o.value.base_price;const c=L(o.value);return c>l.value?c:0}),k=m(()=>t.installmentsOption||j.list_payments.installments_option||{max_number:1}),i=m(()=>{if(k.value.max_number<=1)return 1;const c=k.value.min_installment||5,$=Math.round(l.value/c);return Math.min($,k.value.max_number)}),O=m(()=>k.value.monthly_interest||0),S=m(()=>{if(i.value>=2){if(O.value)return l.value/i.value;const c=O.value/100;return l.value*c/(1-(1+c)**-i.value)}return 0}),f=m(()=>{const c=t.discountOption||j.list_payments.discount_option;return c&&(!c.min_amount||c.min_amount<=l.value)&&(!t.isAmountTotal||c.apply_at==="total")?c:{}}),s=m(()=>f.value.label||""),r=m(()=>J(l.value,f.value)),y=m(()=>{if(t.loyaltyPointsProgram)return t.loyaltyPointsProgram;const c=j.list_payments.loyalty_points_programs;if(c){const $=Object.keys(c);for(let C=0;C<$.length;C++){const D=c[C];if(D&&D.earn_percentage>0)return D}}return{ratio:0}}),w=m(()=>y.value.min_subtotal_to_earn||0),n=m(()=>y.value.name||""),B=m(()=>y.value.earn_percentage||0),N=m(()=>B.value/100),M=m(()=>N.value>0?l.value*N.value:0);return{hasVariedPrices:a,salePrice:l,comparePrice:g,installmentsObject:k,installmentsNumber:i,monthlyInterest:O,installmentValue:S,discountObject:f,discountLabel:s,priceWithDiscount:r,pointsProgramObject:y,pointsMinPrice:w,pointsProgramName:n,earnPointsPercentage:B,earnPointsFactor:N,pointsCashback:M}},Q=t=>m(()=>{let o="";return Object.keys(t).forEach(a=>{t[a]===!0&&(o+=` ${a.replace(/^(is|has)/,"")}`)}),o.slice(1)}),X=["data-sf-prices"],Y=["data-sf-prices-compare"],Z={key:0},x={key:0},ee=["data-sf-prices-sale"],te={key:0},se=["data-sf-prices-cashback"],ae=["data-tooltip"],ne=P("i",{class:"i-cashback mr-1"},null,-1),oe={class:"font-medium"},re=P("small",null," cashback",-1),le=["data-sf-prices-installment"],ie={key:0},ce={key:0},ue={key:0},me=["data-sf-prices-discount"],pe={key:0},de={key:0},ve=R({__name:"Prices",props:{product:null,price:null,basePrice:null,isAmountTotal:{type:Boolean},installmentsOption:null,discountOption:null,isBig:{type:Boolean},isLiteral:{type:Boolean},hasCashback:{type:Boolean,default:!0},hasPriceOptions:{type:Boolean,default:!0}},setup(t){const o=t,a=H(o),{hasVariedPrices:p,salePrice:l,comparePrice:g,earnPointsPercentage:k,pointsCashback:i,installmentsNumber:O,monthlyInterest:S,installmentValue:f,priceWithDiscount:s,discountLabel:r}=a,y=Q(o),w=q(!1);return setTimeout(()=>{w.value=!0,setTimeout(()=>{w.value=!1},5e3)},5e3),(n,B)=>{const N=z("Fade");return u(n.$slots,"default",_(I(e(a))),()=>[P("div",{"data-sf-prices":e(y),class:"text-base-600"},[e(g)?u(n.$slots,"compare",_(V({key:0},e(a))),()=>[P("span",{"data-sf-prices-compare":e(g),class:"text-base-500 mr-1"},[u(n.$slots,"compare-pre",{},()=>[t.isLiteral?(v(),b("small",Z,h("De "))):d("",!0)]),u(n.$slots,"compare-value",_(I(e(a))),()=>[P("s",null,h(n.$money(e(g))),1)]),u(n.$slots,"compare-post",{},()=>[t.isLiteral?(v(),b("small",x,h(" Por"))):d("",!0)])],8,Y)]):d("",!0),u(n.$slots,"sale",_(I(e(a))),()=>[P("strong",{"data-sf-prices-sale":e(l),class:"inline-block text-base-800"},[u(n.$slots,"sale-pre",{},()=>[e(p)?(v(),b("small",te,h("A partir de "))):d("",!0)]),u(n.$slots,"sale-value",_(I(e(a))),()=>[F(h(n.$money(e(l))),1)]),u(n.$slots,"sale-post")],8,ee)]),e(i)?u(n.$slots,"cashback",_(V({key:1},e(a))),()=>[T(N,{slide:"down"},{default:A(()=>[t.hasCashback?(v(),b("div",{key:0,"data-sf-prices-cashback":e(i)},[P("span",{"data-tooltip":"Receba $1 de volta".replace("$1",n.$percentage(e(k)))},[u(n.$slots,"cashback-pre",{},()=>[ne]),u(n.$slots,"cashback-value",_(I(e(a))),()=>[P("span",oe,h(n.$money(e(i))),1)]),u(n.$slots,"cashback-post",{},()=>[re])],8,ae)],8,se)):d("",!0)]),_:3})]):d("",!0),e(f)?u(n.$slots,"installment",_(V({key:2},e(a))),()=>[T(N,{slide:"down"},{default:A(()=>[t.hasPriceOptions?(v(),b("div",{key:0,"data-sf-prices-installment":e(f)},[u(n.$slots,"installment-pre",{},()=>[t.isLiteral?(v(),b("small",ie,h("At\xE9 "))):d("",!0)]),u(n.$slots,"installment-value",_(I(e(a))),()=>[F(h(e(O))+"x ",1),t.isLiteral?(v(),b("small",ce,h(" De "))):d("",!0),P("span",null,h(n.$money(e(f))),1)]),u(n.$slots,"installment-post",{},()=>[!e(S)&&t.isLiteral?(v(),b("small",ue,h("Sem juros"))):d("",!0)])],8,le)):d("",!0)]),_:3})]):d("",!0),e(s)<e(l)?u(n.$slots,"discount",_(V({key:3},e(a))),()=>[T(N,{slide:"down"},{default:A(()=>[t.hasPriceOptions?(v(),b("div",{key:0,"data-sf-prices-discount":e(s)},[u(n.$slots,"discount-pre",{},()=>[e(r)?d("",!0):(v(),b("small",pe,h("A partir de ")))]),u(n.$slots,"discount-value",_(I(e(a))),()=>[P("span",null,h(n.$money(e(s))),1)]),u(n.$slots,"discount-post",{},()=>[e(r)?(v(),b("small",de,h(` ${e(r)}`),1)):d("",!0)])],8,me)):d("",!0)]),_:3})]):d("",!0)],8,X)])}}});export{ve as _};
|
|
Binary file
|
|
Binary file
|