cloudcommerce 0.1.6 → 0.2.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.
Files changed (190) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/action.yml +4 -0
  3. package/ecomplus-stores/monocard/functions/core/package.json +1 -1
  4. package/ecomplus-stores/monocard/functions/events/package.json +2 -2
  5. package/ecomplus-stores/monocard/functions/modules/package.json +2 -2
  6. package/ecomplus-stores/monocard/functions/passport/package.json +2 -2
  7. package/ecomplus-stores/monocard/functions/ssr/package.json +9 -6
  8. package/ecomplus-stores/monocard/package.json +1 -1
  9. package/ecomplus-stores/tia-sonia/functions/core/package.json +1 -1
  10. package/ecomplus-stores/tia-sonia/functions/events/package.json +2 -2
  11. package/ecomplus-stores/tia-sonia/functions/modules/package.json +2 -2
  12. package/ecomplus-stores/tia-sonia/functions/passport/package.json +2 -2
  13. package/ecomplus-stores/tia-sonia/functions/ssr/package.json +11 -7
  14. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/categoria-acucares.webp +0 -0
  15. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/categoria-barras.webp +0 -0
  16. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/categoria-bebidas-em-po.webp +0 -0
  17. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/categoria-cookies.webp +0 -0
  18. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/categoria-granola-tia-sonia.webp +0 -0
  19. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/categoria-integrais.webp +0 -0
  20. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/categoria-naturais.webp +0 -0
  21. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/categoria-pastas-tia-sonia.webp +0 -0
  22. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/categoria-snacks.webp +0 -0
  23. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/categoria-ultrabar.webp +0 -0
  24. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/daniel-cady.webp +0 -0
  25. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/granola-tradicional-lata-verso.webp +0 -0
  26. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/granola-tradicional-lata.webp +0 -0
  27. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/{acai-com-granola.jpg → hero-acai-granola.jpg} +0 -0
  28. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/{cafe-com-tapioca-e-aveia.jpg → hero-cafe-tapioca-aveia.jpg} +0 -0
  29. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/hero-piquenique-snack-cookies.jpg +0 -0
  30. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/machu-picchu-1500.jpg +0 -0
  31. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/selo-ibd-120-80.webp +0 -0
  32. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/selo-organico-120-80.webp +0 -0
  33. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/selo-usda-120-80.webp +0 -0
  34. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/selo-vegano-120-80.webp +0 -0
  35. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/tia-sonia-real.png +0 -0
  36. package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/trustvox.png +0 -0
  37. package/ecomplus-stores/tia-sonia/functions/ssr/src/assets/prices.css +3 -0
  38. package/ecomplus-stores/tia-sonia/functions/ssr/src/components/AboutUs.astro +77 -0
  39. package/ecomplus-stores/tia-sonia/functions/ssr/src/components/BrandTestimonials.vue +134 -0
  40. package/ecomplus-stores/tia-sonia/functions/ssr/src/components/CategoriesGrid.vue +32 -0
  41. package/ecomplus-stores/tia-sonia/functions/ssr/src/components/CategoriesSlider.vue +117 -0
  42. package/ecomplus-stores/tia-sonia/functions/ssr/src/components/HeroBanner.vue +112 -0
  43. package/ecomplus-stores/tia-sonia/functions/ssr/src/components/PitchBar.vue +48 -16
  44. package/ecomplus-stores/tia-sonia/functions/ssr/src/components/TheHeader.vue +39 -19
  45. package/ecomplus-stores/tia-sonia/functions/ssr/src/components/header/HeaderNav.vue +4 -0
  46. package/ecomplus-stores/tia-sonia/functions/ssr/src/layouts/Base.astro +10 -4
  47. package/ecomplus-stores/tia-sonia/functions/ssr/src/layouts/Pages.astro +1 -1
  48. package/ecomplus-stores/tia-sonia/functions/ssr/src/main/Home.astro +158 -31
  49. package/ecomplus-stores/tia-sonia/functions/ssr/src/scripts/head-scripts.ts +15 -0
  50. package/ecomplus-stores/tia-sonia/functions/ssr/src/scripts/modules-info-preset.ts +27 -0
  51. package/ecomplus-stores/tia-sonia/package.json +1 -1
  52. package/package.json +13 -13
  53. package/packages/api/package.json +1 -1
  54. package/packages/apps/correios/package.json +2 -2
  55. package/packages/apps/custom-payment/package.json +1 -1
  56. package/packages/apps/custom-shipping/package.json +1 -1
  57. package/packages/apps/datafrete/CHANGELOG.md +1 -0
  58. package/packages/apps/datafrete/README.md +1 -0
  59. package/packages/apps/datafrete/lib/datafrete-webhook.d.ts +4 -0
  60. package/packages/apps/datafrete/lib/datafrete-webhook.js +108 -0
  61. package/packages/apps/datafrete/lib/datafrete-webhook.js.map +1 -0
  62. package/packages/apps/datafrete/lib/datafrete.d.ts +2 -0
  63. package/packages/apps/datafrete/lib/datafrete.js +6 -0
  64. package/packages/apps/datafrete/lib/datafrete.js.map +1 -0
  65. package/packages/apps/datafrete/lib/index.d.ts +1 -0
  66. package/packages/apps/datafrete/lib/index.js +2 -0
  67. package/packages/apps/datafrete/lib/index.js.map +1 -0
  68. package/packages/apps/datafrete/lib-mjs/calculate-datafrete.mjs +277 -0
  69. package/packages/apps/datafrete/package.json +37 -0
  70. package/packages/apps/datafrete/src/datafrete-webhook.ts +131 -0
  71. package/packages/apps/datafrete/src/datafrete.ts +7 -0
  72. package/packages/apps/datafrete/src/index.ts +1 -0
  73. package/packages/apps/datafrete/tsconfig.json +6 -0
  74. package/packages/apps/datafrete/webhook.js +1 -0
  75. package/packages/apps/discounts/package.json +1 -1
  76. package/packages/apps/emails/package.json +1 -1
  77. package/packages/apps/fb-conversions/package.json +2 -2
  78. package/packages/apps/frenet/package.json +3 -3
  79. package/packages/apps/galaxpay/lib/functions-lib/galaxpay/webhook.js +3 -2
  80. package/packages/apps/galaxpay/lib/functions-lib/galaxpay/webhook.js.map +1 -1
  81. package/packages/apps/galaxpay/package.json +2 -2
  82. package/packages/apps/galaxpay/src/functions-lib/galaxpay/webhook.ts +3 -2
  83. package/packages/apps/google-analytics/CHANGELOG.md +1 -0
  84. package/packages/apps/google-analytics/README.md +1 -0
  85. package/packages/apps/google-analytics/lib/google-analytics-events.js +113 -0
  86. package/packages/apps/google-analytics/lib/google-analytics-events.js.map +1 -0
  87. package/packages/apps/google-analytics/lib/index.js +2 -0
  88. package/packages/apps/google-analytics/lib/index.js.map +1 -0
  89. package/packages/apps/google-analytics/package.json +32 -0
  90. package/packages/apps/google-analytics/src/google-analytics-events.ts +151 -0
  91. package/packages/apps/google-analytics/src/index.ts +1 -0
  92. package/packages/apps/google-analytics/tsconfig.json +3 -0
  93. package/packages/apps/google-analytics/types.d.ts +43 -0
  94. package/packages/apps/infinitepay/package.json +2 -2
  95. package/packages/apps/jadlog/package.json +2 -2
  96. package/packages/apps/loyalty-points/package.json +1 -1
  97. package/packages/apps/mercadopago/lib/mp-create-transaction.js +1 -1
  98. package/packages/apps/mercadopago/lib/mp-create-transaction.js.map +1 -1
  99. package/packages/apps/mercadopago/lib/mp-webhook.js +2 -7
  100. package/packages/apps/mercadopago/lib/mp-webhook.js.map +1 -1
  101. package/packages/apps/mercadopago/package.json +2 -2
  102. package/packages/apps/mercadopago/src/mp-create-transaction.ts +1 -1
  103. package/packages/apps/mercadopago/src/mp-webhook.ts +3 -8
  104. package/packages/apps/pagarme/lib/pagarme-webhook.js +1 -1
  105. package/packages/apps/pagarme/lib/pagarme-webhook.js.map +1 -1
  106. package/packages/apps/pagarme/package.json +2 -2
  107. package/packages/apps/pagarme/src/pagarme-webhook.ts +1 -1
  108. package/packages/apps/pix/package.json +2 -2
  109. package/packages/apps/tiny-erp/package.json +2 -2
  110. package/packages/cli/package.json +1 -1
  111. package/packages/config/package.json +1 -1
  112. package/packages/emails/package.json +3 -3
  113. package/packages/events/lib/firebase.js +4 -0
  114. package/packages/events/lib/firebase.js.map +1 -1
  115. package/packages/events/package.json +3 -1
  116. package/packages/events/src/firebase.ts +4 -0
  117. package/packages/firebase/lib/config.d.ts +7 -0
  118. package/packages/firebase/lib/config.js +10 -0
  119. package/packages/firebase/lib/config.js.map +1 -1
  120. package/packages/firebase/package.json +1 -1
  121. package/packages/firebase/src/config.ts +11 -0
  122. package/packages/i18n/package.json +1 -1
  123. package/packages/modules/lib/firebase/call-app-module.js +5 -0
  124. package/packages/modules/lib/firebase/call-app-module.js.map +1 -1
  125. package/packages/modules/package.json +4 -3
  126. package/packages/modules/src/firebase/call-app-module.ts +5 -0
  127. package/packages/passport/package.json +1 -1
  128. package/packages/ssr/package.json +4 -3
  129. package/packages/storefront/.eslintrc.cjs +5 -1
  130. package/packages/storefront/astro.config.mjs +9 -24
  131. package/packages/storefront/client.d.ts +7 -8
  132. package/packages/storefront/dist/client/PitchBar.afe7ff5c.js +1 -0
  133. package/packages/storefront/dist/client/Prices.eaf8a32c.js +1 -0
  134. package/packages/storefront/dist/client/ProductCard.1106b153.js +1 -0
  135. package/packages/storefront/dist/client/assets/_...slug_.fea84512.css +1 -0
  136. package/packages/storefront/dist/client/assets/index.90df622b.css +1 -0
  137. package/packages/storefront/dist/client/chunks/Prices.vue_vue_type_script_setup_true_lang.781b6501.js +1 -0
  138. package/packages/storefront/dist/client/chunks/ecom-utils.63984324.js +1 -0
  139. package/packages/storefront/dist/client/chunks/runtime-core.esm-bundler.fa6cdb60.js +1 -0
  140. package/packages/storefront/dist/client/client.367a6497.js +1 -0
  141. package/packages/storefront/dist/client/hoisted.4671ed15.js +1 -0
  142. package/packages/storefront/dist/client/sw.js +1 -1
  143. package/packages/storefront/dist/client/workbox-e2ee76b5.js +1 -0
  144. package/packages/storefront/dist/server/entry.mjs +571 -737
  145. package/packages/storefront/package.json +11 -10
  146. package/packages/storefront/src/env.d.ts +9 -0
  147. package/packages/storefront/src/lib/assets/tooltip.css +6 -5
  148. package/packages/storefront/src/lib/components/Carousel.vue +259 -0
  149. package/packages/storefront/src/lib/components/CarouselControl.vue +29 -0
  150. package/packages/storefront/src/lib/components/LoginDrawer.vue +1 -1
  151. package/packages/storefront/src/lib/components/PitchBar.vue +44 -0
  152. package/packages/storefront/src/lib/components/Prices.vue +116 -105
  153. package/packages/storefront/src/lib/components/ProductCard.vue +1 -1
  154. package/packages/storefront/src/lib/components/_injection-keys.ts +9 -0
  155. package/packages/storefront/src/lib/components/globals/ALink.vue +26 -0
  156. package/packages/storefront/src/lib/composables/use-prices.ts +19 -12
  157. package/packages/storefront/src/lib/layouts/BaseBody.astro +1 -5
  158. package/packages/storefront/src/lib/layouts/BaseHead.astro +7 -2
  159. package/packages/storefront/src/lib/layouts/PagesHeader.astro +38 -0
  160. package/packages/storefront/src/lib/pages/_vue.ts +3 -2
  161. package/packages/storefront/src/lib/ssr/image.ts +3 -2
  162. package/packages/storefront/src/lib/ssr-context.ts +6 -0
  163. package/packages/storefront/src/lib/state/modules-info.ts +10 -4
  164. package/packages/storefront/src/vue-globals.d.ts +5 -5
  165. package/packages/storefront/tailwind.config.cjs +12 -6
  166. package/packages/storefront/tsconfig.json +2 -2
  167. package/packages/storefront/uno.config.cjs +4 -4
  168. package/packages/types/package.json +1 -1
  169. package/ecomplus-stores/tia-sonia/functions/ssr/src/scripts/InlineScripts.astro +0 -10
  170. package/packages/storefront/dist/client/HeaderButtons.300c19e5.js +0 -1
  171. package/packages/storefront/dist/client/Prices.6c44a513.js +0 -1
  172. package/packages/storefront/dist/client/ProductCard.69bba7fc.js +0 -1
  173. package/packages/storefront/dist/client/assets/_...slug_.15bda576.css +0 -1
  174. package/packages/storefront/dist/client/assets/index.e6a09532.css +0 -1
  175. package/packages/storefront/dist/client/chunks/HeaderButtons.1abd5bf4.js +0 -1
  176. package/packages/storefront/dist/client/chunks/LoginForm.7e7d6137.js +0 -1441
  177. package/packages/storefront/dist/client/chunks/Prices.vue_vue_type_script_setup_true_lang.e4525076.js +0 -1
  178. package/packages/storefront/dist/client/chunks/_plugin-vue_export-helper.fc452b02.js +0 -1
  179. package/packages/storefront/dist/client/chunks/ecom-utils.b0a26608.js +0 -1
  180. package/packages/storefront/dist/client/chunks/preload-helper.1de719f8.js +0 -1
  181. package/packages/storefront/dist/client/chunks/price.ecf7fed4.js +0 -1
  182. package/packages/storefront/dist/client/chunks/runtime-core.esm-bundler.b4556b35.js +0 -1
  183. package/packages/storefront/dist/client/client.2a3e5a58.js +0 -1
  184. package/packages/storefront/dist/client/hoisted.f6ee2883.js +0 -1
  185. package/packages/storefront/dist/client/page.5a6f3db5.js +0 -1
  186. package/packages/storefront/dist/client/workbox-abdc68aa.js +0 -1
  187. package/packages/storefront/dist/client/~partytown/partytown-atomics.js +0 -2
  188. package/packages/storefront/dist/client/~partytown/partytown-media.js +0 -2
  189. package/packages/storefront/dist/client/~partytown/partytown-sw.js +0 -2
  190. package/packages/storefront/dist/client/~partytown/partytown.js +0 -2
@@ -1,11 +1,10 @@
1
1
  <script setup lang="ts">
2
- import type { Products, Carts, ListPaymentsResponse } from '@cloudcommerce/types';
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<Carts['items'][0]> & Partial<Products> & { price: Products['price'] };
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
- earnPointsPercentage,
30
- pointsCashback,
28
+ cashbackPercentage,
29
+ cashbackValue,
31
30
  installmentsNumber,
32
31
  monthlyInterest,
33
32
  installmentValue,
@@ -35,131 +34,143 @@ 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
- <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">
40
+ <div :data-prices="componentVariant" class="text-base-600">
41
+ <slot v-if="comparePrice" name="compare" v-bind="{ salePrice, comparePrice }">
42
+ <span data-prices-compare 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-prices-sale 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 v-if="hasCashback" data-prices-cashback class="relative z-10">
78
+ <span :data-tooltip="$t.i19get$1back
79
+ .replace('$1', $percentage(cashbackPercentage))">
80
+ <slot name="cashback-pre">
81
+ <i class="i-cashback mr-1"></i>
82
+ </slot>
83
+ <slot
84
+ name="cashback-value"
85
+ v-bind="{ salePrice, cashbackValue, cashbackPercentage }"
86
+ >
87
+ <span class="font-medium">
88
+ {{ $money(cashbackValue) }}
89
+ </span>
90
+ </slot>
91
+ <slot name="cashback-post">
92
+ <small> cashback</small>
93
+ </slot>
94
+ </span>
95
+ </div>
96
+ </Fade>
97
+ </slot>
98
+ <slot
99
+ v-if="installmentValue"
100
+ name="installment"
101
+ v-bind="{ salePrice, installmentValue, installmentsNumber, monthlyInterest }"
102
+ >
103
+ <Fade slide="down">
104
+ <div v-if="hasPriceOptions" data-prices-installment>
105
+ <slot name="installment-pre">
53
106
  <small v-if="isLiteral">
54
- {{ `${$t.i19from} ` }}
107
+ {{ `${$t.i19upTo} ` }}
55
108
  </small>
56
109
  </slot>
57
- <slot name="compare-value" v-bind="prices">
58
- <s>{{ $money(comparePrice) }}</s>
59
- </slot>
60
- <slot name="compare-post">
110
+ <slot
111
+ name="installment-value"
112
+ v-bind="{ salePrice, installmentValue, installmentsNumber, monthlyInterest }"
113
+ >
114
+ {{ installmentsNumber }}x
61
115
  <small v-if="isLiteral">
62
- {{ ` ${$t.i19to}` }}
116
+ {{ ` ${$t.i19of} ` }}
63
117
  </small>
118
+ <span>{{ $money(installmentValue) }}</span>
64
119
  </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">
120
+ <slot name="installment-post">
121
+ <small v-if="!monthlyInterest && isLiteral">
122
+ {{ $t.i19interestFree }}
123
+ </small>
124
+ </slot>
125
+ </div>
126
+ </Fade>
127
+ </slot>
128
+ <slot
129
+ v-if="priceWithDiscount < salePrice"
130
+ name="discount"
131
+ v-bind="{ salePrice, priceWithDiscount, discountLabel }"
132
+ >
133
+ <Fade slide="down">
134
+ <div v-if="hasPriceOptions" data-prices-discount>
135
+ <slot name="discount-pre">
136
+ <small v-if="!discountLabel">
71
137
  {{ `${$t.i19asOf} ` }}
72
138
  </small>
73
139
  </slot>
74
- <slot name="sale-value" v-bind="prices">
75
- {{ $money(salePrice) }}
140
+ <slot
141
+ name="discount-value"
142
+ v-bind="{ salePrice, priceWithDiscount, discountLabel }"
143
+ >
144
+ <span>{{ $money(priceWithDiscount) }}</span>
76
145
  </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 :data-tooltip="$t.i19get$1back
84
- .replace('$1', $percentage(earnPointsPercentage))">
85
- <slot name="cashback-pre">
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>
146
+ <slot name="discount-post">
147
+ <small v-if="discountLabel">
148
+ {{ ` ${discountLabel}` }}
149
+ </small>
150
+ </slot>
151
+ </div>
152
+ </Fade>
153
+ </slot>
154
+ </div>
144
155
  </template>
145
156
 
146
157
  <style>
147
- [data-sf-prices-compare] {
158
+ [data-prices-compare] {
148
159
  font-size: 87%;
149
160
  }
150
- [data-sf-prices-cashback],
151
- [data-sf-prices-installment],
152
- [data-sf-prices-discount] {
161
+ [data-prices-cashback],
162
+ [data-prices-installment],
163
+ [data-prices-discount] {
153
164
  font-size: 90%;
154
165
  }
155
- [data-sf-prices] small {
166
+ [data-prices] small {
156
167
  @apply lowercase;
157
168
  font-size: 92%;
158
169
  }
159
- [data-sf-prices~=Big] {
170
+ [data-prices~=Big] {
160
171
  @apply text-lg;
161
172
  }
162
- [data-sf-prices~=Big] [data-sf-prices-sale] {
173
+ [data-prices~=Big] [data-prices-sale] {
163
174
  @apply text-5xl block;
164
175
  }
165
176
  </style>
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { ref } from 'vue';
3
- import Prices from '@@components/Prices.vue';
3
+ import Prices from '@@sf/components/Prices.vue';
4
4
 
5
5
  export interface Props {
6
6
  as?: string;
@@ -0,0 +1,9 @@
1
+ /* eslint-disable import/prefer-default-export */
2
+ import type { Ref, InjectionKey } from 'vue';
3
+
4
+ export const carouselKey = Symbol('carousel') as InjectionKey<{
5
+ autoplay: Ref<number>,
6
+ changeSlide: (direction: number) => void,
7
+ isBoundLeft: Ref<boolean>,
8
+ isBoundRight: Ref<boolean>,
9
+ }>;
@@ -0,0 +1,26 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue';
3
+
4
+ export interface Props {
5
+ href: string;
6
+ target?: string;
7
+ }
8
+
9
+ const props = defineProps<Props>();
10
+ const linkTarget = computed(() => {
11
+ if (props.target) return props.target;
12
+ if (props.href.startsWith('http') && globalThis.storefront.settings) {
13
+ const domain = globalThis.storefront.settings.domain || window.location.host;
14
+ if (props.href.startsWith(`https://${domain}`)) return null;
15
+ }
16
+ return null;
17
+ });
18
+ </script>
19
+
20
+ <template>
21
+ <a
22
+ :href="href"
23
+ :target="linkTarget"
24
+ :rel="linkTarget === '_blank' ? 'noopener' : null"
25
+ ><slot /></a>
26
+ </template>
@@ -1,10 +1,10 @@
1
- import type { Products, Carts, ListPaymentsResponse } from '@cloudcommerce/types';
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<Carts['items'][0]> & Partial<Products> & { price: Products['price'] };
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
- return discountObject.value.label || '';
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 earnPointsFactor = computed(() => {
147
- return earnPointsPercentage.value / 100;
153
+ const cashbackPercentage = computed(() => {
154
+ return earnPointsPercentage.value * pointsProgramObject.value.ratio;
148
155
  });
149
- const pointsCashback = computed(() => {
150
- return earnPointsFactor.value > 0
151
- ? salePrice.value * earnPointsFactor.value : 0;
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
- earnPointsFactor,
170
- pointsCashback,
176
+ cashbackPercentage,
177
+ cashbackValue,
171
178
  };
172
179
  };
@@ -13,10 +13,6 @@ export interface Props {
13
13
 
14
14
  <body>
15
15
  <slot />
16
- <script>
17
- import { registerSW } from 'virtual:pwa-register';
18
- import '../scripts/session-utm';
19
- registerSW();
20
- </script>
16
+ <script src="../scripts/session-utm"></script>
21
17
  <slot name="before-body-end" />
22
18
  </body>
@@ -1,7 +1,8 @@
1
1
  ---
2
2
  import type CmsSocial from '@@sf/types/cms-social';
3
- import { img as getImg } from '@ecomplus/utils';
4
3
  import type { PageContext } from '@@sf/ssr-context';
4
+ import { pwaInfo } from 'virtual:pwa-info';
5
+ import { img as getImg } from '@ecomplus/utils';
5
6
  import { getImage as transformImage } from '@@sf/ssr/image';
6
7
 
7
8
  export interface Props {
@@ -53,7 +54,6 @@ if (!ogImage) {
53
54
  <meta name="viewport" content="width=device-width">
54
55
  <meta name="theme-color" content={primaryColor}>
55
56
  <link rel="icon" href={favicon} />
56
- {import.meta.env.PROD && <link rel="manifest" href="/manifest.webmanifest" />}
57
57
  <title>{title}</title>
58
58
  <meta name="description" content={description}>
59
59
  <meta name="author" content={settings.name}>
@@ -73,3 +73,8 @@ if (!ogImage) {
73
73
  <meta name="twitter:card" content="summary">
74
74
  {cmsSocial.twitter_username && <meta name="twitter:site" content={cmsSocial.twitter_username} />}
75
75
  <meta name="ecom-store-id" content={String(storeId)}>
76
+ {pwaInfo && <Fragment set:html={pwaInfo.webManifest.linkTag} />}
77
+ <script>
78
+ import { registerSW } from 'virtual:pwa-register';
79
+ registerSW({ immediate: true });
80
+ </script>
@@ -0,0 +1,38 @@
1
+ ---
2
+ import type { Categories } from '@cloudcommerce/api/types';
3
+ import type CmsHeader from '@@sf/types/cms-header';
4
+ import type CmsContacts from '@@sf/types/cms-contacts';
5
+ import type { PageContext } from '@@sf/ssr-context';
6
+ import { i19buyOnWhatsApp } from '@@i18n';
7
+ import { getImage } from '@@sf/ssr/image';
8
+ import PitchBar, { Props as PitchBarProps } from '@@sf/components/PitchBar.vue';
9
+
10
+ export interface Props {
11
+ pageContext: PageContext;
12
+ }
13
+
14
+ const {
15
+ pageContext: {
16
+ apiState,
17
+ settings,
18
+ cms,
19
+ },
20
+ } = Astro.props as Props;
21
+ const header = cms('header') as CmsHeader &
22
+ { marketing_stripe?: { text: string, link: string } };
23
+ const pitchBar: PitchBarProps = { slides: [] };
24
+ if (header.pitch_bar) {
25
+ pitchBar.slides = header.pitch_bar;
26
+ } else if (header.marketing_stripe) {
27
+ pitchBar.slides = [{
28
+ href: header.marketing_stripe.link,
29
+ html: header.marketing_stripe.text,
30
+ }];
31
+ }
32
+ ---
33
+
34
+ <Fragment>
35
+ <slot name="pitch-bar">
36
+ {pitchBar.slides.length && <PitchBar {...pitchBar} client:idle />}
37
+ </slot>
38
+ </Fragment>
@@ -1,7 +1,7 @@
1
1
  import type { App } from 'vue';
2
2
  import { i18n, formatMoney } from '@ecomplus/utils';
3
- // @ts-ignore
4
- import Fade from '@@components/globals/Fade.vue';
3
+ import Fade from '@@sf/components/globals/Fade.vue';
4
+ import ALink from '@@sf/components/globals/ALink.vue';
5
5
 
6
6
  const formatPercentage = (value: number, digits = 1) => {
7
7
  return Number.isInteger(value) ? `${value}%` : `${value.toFixed(digits)}%`;
@@ -21,6 +21,7 @@ export default (app: App) => {
21
21
  },
22
22
  });
23
23
  app.component('Fade', Fade);
24
+ app.component('ALink', ALink);
24
25
  };
25
26
 
26
27
  export type FormatPercentage = typeof formatPercentage;
@@ -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') {
@@ -26,10 +26,15 @@ const getConfig: () => StorefrontConfig = _getConfig;
26
26
  declare global {
27
27
  // eslint-disable-next-line
28
28
  var api_prefetch_endpoints: ApiEndpoint[];
29
+ // eslint-disable-next-line
30
+ var storefront: { settings: Partial<CmsSettings> };
29
31
  }
30
32
  if (!globalThis.api_prefetch_endpoints) {
31
33
  globalThis.api_prefetch_endpoints = ['categories'];
32
34
  }
35
+ if (!globalThis.storefront) {
36
+ globalThis.storefront = { settings: {} };
37
+ }
33
38
 
34
39
  type ApiPrefetchEndpoints = Array<ApiEndpoint>;
35
40
 
@@ -53,6 +58,7 @@ const loadPageContext = async (Astro: AstroGlobal, {
53
58
  const urlPath = Astro.url.pathname;
54
59
  const { slug } = Astro.params;
55
60
  const config = getConfig();
61
+ globalThis.storefront.settings = config.settings;
56
62
  let cmsContent: Record<string, any> | undefined;
57
63
  let apiResource: string | undefined;
58
64
  let apiDoc: Record<string, any> | undefined;
@@ -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 modulesToFetch: { modName: string, reqOptions?: Record<string, any> }[] = [
50
- { modName: 'list_payments' },
51
- { modName: 'calculate_shipping' },
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,6 +1,6 @@
1
- /* eslint-disable */
2
1
  // Read more: https://github.com/vuejs/core/pull/3399
3
- import '@vue/runtime-core'
2
+ // eslint-disable-next-line import/no-extraneous-dependencies
3
+ import '@vue/runtime-core';
4
4
  import type { FormatPercentage } from '@@sf/pages/_vue';
5
5
 
6
6
  type Dictionary = Omit<typeof import('@@i18n'),
@@ -21,9 +21,9 @@ declare module '@vue/runtime-core' {
21
21
  }
22
22
 
23
23
  export interface GlobalComponents {
24
- // @ts-ignore
25
- Fade: typeof import('@@components/globals/Fade.vue')['default']
24
+ Fade: typeof import('@@sf/components/globals/Fade.vue')['default'];
25
+ ALink: typeof import('@@sf/components/globals/ALink.vue')['default'];
26
26
  }
27
27
  }
28
28
 
29
- export {}
29
+ export {};
@@ -37,8 +37,14 @@ let defaultThemeOptions = {
37
37
  'dinersclub',
38
38
  ],
39
39
  generalIcons: 'heroicons',
40
- shoppingCartIcon: 'shopping-bag',
41
- cashbackIcon: 'arrow-uturn-left',
40
+ iconAliases: {
41
+ 'shopping-cart': 'shopping-bag',
42
+ cashback: 'arrow-uturn-left',
43
+ 'chevron-right': 'chevron-right',
44
+ 'chevron-left': 'chevron-left',
45
+ 'chevron-up': 'chevron-up',
46
+ 'chevron-down': 'chevron-down',
47
+ },
42
48
  };
43
49
  if (globalThis.storefront_theme_options) {
44
50
  defaultThemeOptions = deepmerge(defaultThemeOptions, globalThis.storefront_theme_options);
@@ -115,8 +121,7 @@ const genTailwindConfig = (themeOptions = {}) => {
115
121
  successColor,
116
122
  warningColor,
117
123
  dangerColor,
118
- shoppingCartIcon,
119
- cashbackIcon,
124
+ iconAliases,
120
125
  } = deepmerge(defaultThemeOptions, themeOptions);
121
126
  const config = {
122
127
  theme: {
@@ -162,8 +167,9 @@ const genTailwindConfig = (themeOptions = {}) => {
162
167
  if (!shortcuts) {
163
168
  const { icons } = require(`@iconify-json/${iconset}`);
164
169
  shortcuts = Object.keys(icons.icons);
165
- shortcuts.push(['shopping-cart', shoppingCartIcon]);
166
- shortcuts.push(['cashback', cashbackIcon]);
170
+ Object.keys(iconAliases).forEach((alias) => {
171
+ shortcuts.push([alias, iconAliases[alias]]);
172
+ });
167
173
  }
168
174
  shortcuts.forEach((shortcut) => {
169
175
  if (typeof shortcut === 'string') {
@@ -6,9 +6,9 @@
6
6
  "paths": {
7
7
  "@@i18n": ["./node_modules/@cloudcommerce/i18n/src/pt_br.ts"],
8
8
  "@@sf/*": ["./src/lib/*"],
9
- "@@components/*": ["./src/components/*", "./src/lib/components/*"],
10
9
  "~/*": ["./src/*"],
11
10
  "content/*": ["./content/*"],
12
- }
11
+ },
12
+ "types": ["vite-plugin-pwa/info"]
13
13
  }
14
14
  }
@@ -46,8 +46,7 @@ const genUnoCSSConfig = (themeOptions = {}) => {
46
46
  brandLogos,
47
47
  brandLogosShortcuts,
48
48
  generalIcons,
49
- shoppingCartIcon,
50
- cashbackIcon,
49
+ iconAliases,
51
50
  preflights = [{
52
51
  getCSS: () => {
53
52
  const strCSSVars = Object.entries(colorCSSVars)
@@ -86,8 +85,9 @@ const genUnoCSSConfig = (themeOptions = {}) => {
86
85
  ? { [`i-${brand}`]: `i-${brandLogos}:${brand}` }
87
86
  : { [`i-${brand[0]}`]: `i-${brandLogos}:${brand[1]}` };
88
87
  }),
89
- { 'i-shopping-cart': `i-${generalIcons}:${shoppingCartIcon}` },
90
- { 'i-cashback': `i-${generalIcons}:${cashbackIcon}` },
88
+ ...Object.keys(iconAliases).map((alias) => {
89
+ return { [`i-${alias}`]: `i-${generalIcons}:${iconAliases[alias]}` };
90
+ }),
91
91
  [/^i-([^:]+)$/, ([, icon]) => `i-${generalIcons}:${icon}`],
92
92
  ],
93
93
  theme: {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/types",
3
3
  "type": "module",
4
- "version": "0.1.6",
4
+ "version": "0.2.0",
5
5
  "description": "E-Com Plus Cloud Commerce reusable type definitions",
6
6
  "main": "index.ts",
7
7
  "repository": {