cloudcommerce 0.6.5 → 0.6.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/action.yml +17 -21
  3. package/package.json +1 -1
  4. package/packages/api/package.json +1 -1
  5. package/packages/apps/correios/package.json +1 -1
  6. package/packages/apps/custom-payment/package.json +1 -1
  7. package/packages/apps/custom-shipping/package.json +1 -1
  8. package/packages/apps/datafrete/package.json +1 -1
  9. package/packages/apps/discounts/package.json +1 -1
  10. package/packages/apps/emails/package.json +1 -1
  11. package/packages/apps/fb-conversions/package.json +1 -1
  12. package/packages/apps/frenet/package.json +1 -1
  13. package/packages/apps/galaxpay/assets/onload-expression.min.js +1 -0
  14. package/packages/apps/galaxpay/package.json +1 -1
  15. package/packages/apps/google-analytics/package.json +1 -1
  16. package/packages/apps/infinitepay/package.json +1 -1
  17. package/packages/apps/jadlog/package.json +1 -1
  18. package/packages/apps/loyalty-points/package.json +1 -1
  19. package/packages/apps/melhor-envio/package.json +1 -1
  20. package/packages/apps/mercadopago/assets/onload-expression.min.js +1 -0
  21. package/packages/apps/mercadopago/package.json +1 -1
  22. package/packages/apps/pagarme/assets/onload-expression.min.js +1 -0
  23. package/packages/apps/pagarme/package.json +1 -1
  24. package/packages/apps/paghiper/package.json +1 -1
  25. package/packages/apps/pix/package.json +1 -1
  26. package/packages/apps/tiny-erp/package.json +1 -1
  27. package/packages/apps/webhooks/package.json +1 -1
  28. package/packages/cli/lib/cli.js +9 -8
  29. package/packages/cli/package.json +1 -1
  30. package/packages/cli/src/cli.ts +9 -8
  31. package/packages/config/package.json +1 -1
  32. package/packages/emails/package.json +1 -1
  33. package/packages/events/package.json +1 -1
  34. package/packages/firebase/package.json +1 -1
  35. package/packages/i18n/package.json +1 -1
  36. package/packages/modules/package.json +1 -1
  37. package/packages/passport/package.json +1 -1
  38. package/packages/ssr/package.json +1 -1
  39. package/packages/storefront/dist/client/_astro/{PitchBar.96fed383.js → PitchBar.16431255.js} +1 -1
  40. package/packages/storefront/dist/client/_astro/{Prices.036ad2b4.js → Prices.7368883b.js} +1 -1
  41. package/packages/storefront/dist/client/_astro/{ProductCard.69751e12.js → ProductCard.b9f8f3e7.js} +1 -1
  42. package/packages/storefront/dist/client/_astro/ShopHeader.7967a383.js +4 -0
  43. package/packages/storefront/dist/client/_astro/{_...slug_.25a09a96.css → _...slug_.61014c4c.css} +1 -1
  44. package/packages/storefront/dist/client/_astro/{_plugin-vue_export-helper.be244611.js → _plugin-vue_export-helper.3dfd3410.js} +1 -1
  45. package/packages/storefront/dist/client/_astro/{client.bc16bf93.js → client.3ab4cffd.js} +1 -1
  46. package/packages/storefront/dist/client/_astro/{format-money.e57ae2ab.js → format-money.e75b6ce1.js} +1 -1
  47. package/packages/storefront/dist/client/_astro/{index.248ccd97.js → index.140ec818.js} +1 -1
  48. package/packages/storefront/dist/client/_astro/{modules-info.8540ba60.js → modules-info.6e650119.js} +1 -1
  49. package/packages/storefront/dist/client/_astro/{runtime-dom.esm-bundler.be3a98cd.js → runtime-dom.esm-bundler.b4764bdb.js} +1 -1
  50. package/packages/storefront/dist/client/sw.js +1 -1
  51. package/packages/storefront/dist/server/chunks/pages/{all.9ad006f8.mjs → all.571056bd.mjs} +817 -80
  52. package/packages/storefront/dist/server/entry.mjs +2 -2
  53. package/packages/storefront/package.json +1 -1
  54. package/packages/storefront/server.d.ts +5 -0
  55. package/packages/storefront/src/lib/components/AccountLink.vue +38 -0
  56. package/packages/storefront/src/lib/components/Drawer.vue +11 -3
  57. package/packages/storefront/src/lib/composables/use-shop-header.ts +1 -3
  58. package/packages/storefront/src/lib/layouts/PagesHeader.astro +1 -0
  59. package/packages/storefront/src/lib/ssr-context.ts +2 -5
  60. package/packages/storefront/tailwind.config.cjs +1 -0
  61. package/packages/types/index.ts +5 -0
  62. package/packages/types/package.json +1 -1
  63. package/packages/storefront/dist/client/_astro/ShopHeader.4a8ce417.js +0 -4
package/CHANGELOG.md CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.6.7](https://github.com/ecomplus/cloud-commerce/compare/v0.6.6...v0.6.7) (2023-02-26)
6
+
7
+
8
+ ### Features
9
+
10
+ * **storefront:** Add new `AccountLink` atomic component ([5f07602](https://github.com/ecomplus/cloud-commerce/commit/5f07602231664a2b116684da33c615c50f436585))
11
+ * **storefront:** Update pages header layout to pass `serviceLinks` prop from CMS ([8c6c8a6](https://github.com/ecomplus/cloud-commerce/commit/8c6c8a65309d6c148e176e62c8f26a0b61287667))
12
+ * **types:** Add optional app links to `CmsSettings` object typedef ([ad3cf2e](https://github.com/ecomplus/cloud-commerce/commit/ad3cf2e88125357bf0644ed7d84798aad394240d))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * **apps:** Remove wrong .gitignore to publish minified assets to npm ([1ac4df9](https://github.com/ecomplus/cloud-commerce/commit/1ac4df963bad38df7b41695b06f1cea7e32da088))
18
+
19
+ ### [0.6.6](https://github.com/ecomplus/cloud-commerce/compare/v0.6.5...v0.6.6) (2023-02-25)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * **cli:** Fix passing deploy options to command arguments with zx ([46e838f](https://github.com/ecomplus/cloud-commerce/commit/46e838ff9bf59116c05329e188a6661275f95493))
25
+ * **cli:** Prevent passing --only and --codebase args as true ([9266111](https://github.com/ecomplus/cloud-commerce/commit/92661117b1842d6e7dfa74d507426343d5c920b4))
26
+ * **storefront:** Fix `Drawer` vertical placement slide and handle scrollbar width ([7c6b916](https://github.com/ecomplus/cloud-commerce/commit/7c6b91602597274d962887951824590cef4ced28))
27
+
5
28
  ### [0.6.5](https://github.com/ecomplus/cloud-commerce/compare/v0.6.4...v0.6.5) (2023-02-24)
6
29
 
7
30
 
package/action.yml CHANGED
@@ -88,29 +88,23 @@ runs:
88
88
  ssr:
89
89
  - 'functions/ssr/**'
90
90
 
91
- - shell: bash
91
+ - if: steps.changes.outputs.core != 'true' && steps.changes.outputs.events != 'true'
92
+ shell: bash
92
93
  env:
93
94
  DEPLOY_CODEBASE: ${{ inputs.deploy-codebase }}
94
- CHS_CORE: ${{ steps.changes.outputs.core }}
95
- CHS_EVENTS: ${{ steps.changes.outputs.events }}
96
95
  CHS_MODULES: ${{ steps.changes.outputs.modules }}
97
96
  CHS_PASSPORT: ${{ steps.changes.outputs.passport }}
98
97
  CHS_SSR: ${{ steps.changes.outputs.ssr }}
99
98
  run: |
100
99
  if [ -z "$DEPLOY_CODEBASE" ]; then
101
- if [ -z "$CHS_CORE" ]; then
102
- deploy_codebase=$(node -p "\
103
- const changes = ['$CHS_SSR', '$CHS_MODULES', '$CHS_EVENTS', '$CHS_PASSPORT']; \
104
- let codebase = ''; \
105
- if (changes.filter(v => v === 'true').length === 1) { \
106
- switch (changes.findIndex(v => v === 'true')) {\
107
- case 0: codebase = 'ssr'; break; \
108
- case 1: codebase = 'modules'; break; \
109
- case 2: codebase = 'events'; break; \
110
- case 3: codebase = 'passport'; break; \
111
- } \
112
- } \
113
- codebase;")
100
+ if [ $CHS_SSR == 'true' ]; then
101
+ if [ $CHS_MODULES != 'true' ] && [ $CHS_PASSPORT != 'true' ]; then
102
+ deploy_codebase="ssr"
103
+ fi
104
+ elif [ $CHS_MODULES == 'true' ] && [ $CHS_PASSPORT != 'true' ]; then
105
+ deploy_codebase="modules"
106
+ elif [ $CHS_MODULES != 'true' ] && [ $CHS_PASSPORT == 'true' ]; then
107
+ deploy_codebase="passport"
114
108
  fi
115
109
  else
116
110
  deploy_codebase=$DEPLOY_CODEBASE
@@ -162,13 +156,15 @@ runs:
162
156
  DATAFRETE_OPERATOR_TOKEN=$DATAFRETE_OPERATOR_TOKEN
163
157
  " > functions/.env
164
158
  if [ -z "$DEPLOY_CODEBASE" ]; then
165
- GOOGLE_APPLICATION_CREDENTIALS=$GAC_FILENAME npm run deploy -- \
166
- --only functions --codebase $DEPLOY_CODEBASE
159
+ GOOGLE_APPLICATION_CREDENTIALS=$GAC_FILENAME npm run deploy
160
+ else
167
161
  if [ $DEPLOY_CODEBASE == "ssr" ]; then
168
- npx firebase deploy --only hosting
162
+ GOOGLE_APPLICATION_CREDENTIALS=$GAC_FILENAME npm run deploy -- \
163
+ --only functions:$DEPLOY_CODEBASE,hosting
164
+ else
165
+ GOOGLE_APPLICATION_CREDENTIALS=$GAC_FILENAME npm run deploy -- \
166
+ --only functions:$DEPLOY_CODEBASE
169
167
  fi
170
- else
171
- GOOGLE_APPLICATION_CREDENTIALS=$GAC_FILENAME npm run deploy
172
168
  fi
173
169
 
174
170
  - if: github.event_name == 'pull_request'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloudcommerce",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "Open fair-code headless commerce platform: API-first, microservices based, event driven and cloud native",
6
6
  "main": "packages/api/lib/index.js",
7
7
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/api",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce APIs client/adapter",
6
6
  "main": "lib/api.js",
7
7
  "types": "lib/api.d.ts",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-correios",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce app for Correios shipping calculation",
6
6
  "main": "lib/correios.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-custom-payment",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce app for simple custom payment methods",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-custom-shipping",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce app for custom shipping methods",
6
6
  "main": "lib/custom-shipping.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-datafrete",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Datafrete shipping gateway ",
6
6
  "main": "lib/datafrete.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-discounts",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce app for complex discount rules",
6
6
  "main": "lib/discounts.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-emails",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce default transactional email app",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-fb-conversions",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce app to send carts/orders to Facebook Conversions API",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-frenet",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce app for Frenet shipping calculation",
6
6
  "main": "lib/frenet.js",
7
7
  "exports": {
@@ -0,0 +1 @@
1
+ window._galaxyHashcard=function(o){return new Promise((n,r)=>{var a=window._galaxPayPublicToken,e=!window._galaxPaySandbox,a=new GalaxPay(a,e),e=a.newCard({number:o.number,holder:o.name,expiresAt:`20${o.year.toString()}-`+o.month.toString(),cvv:o.cvc});a.hashCreditCard(e,a=>{n(a)},a=>{r(a)})})};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-galaxpay",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Galax Pay for recurring payments",
6
6
  "main": "lib/galaxpay.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-google-analytics",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce app to send carts/orders events to GA Measurement Protocol",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-infinitepay",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate InfinitePay",
6
6
  "main": "lib/infinitepay.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-jadlog",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce app for Jadlog shipping calculation",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-loyalty-points",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce app to handle simple loyalty points programs",
6
6
  "main": "lib/loyalty-points.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-melhor-envio",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Melhor Envio",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -0,0 +1 @@
1
+ window.Mercadopago.getIdentificationTypes(),window._mpHash=function(t){return new Promise((o,e)=>{window._mpBrand(t.number).then(()=>{return c=t,new Promise((n,o)=>{var e,t,r=window.storefrontApp["customer"],a={},d=(a.cardNumber=c.number,a.cardholderName=c.name,a.cardExpirationMonth=c.month,a.cardExpirationYear=c.year,a.securityCode=c.cvc,c.doc?a.docNumber=c.doc:a.docNumber=r.doc_number,a.email=r.main_email,a.payment_method_id=window.mpPaymentMethodId,document.createElement("form"));for(const s in a)a[s]&&(e=a[s],(t=document.createElement("input")).setAttribute("type","text"),t.setAttribute("id",s),t.setAttribute("data-checkout",s),t.setAttribute("value",e),d.appendChild(t));var i=document.createElement("select"),m=(i.setAttribute("data-checkout","docType"),document.createElement("option"));m.text="j"===r.registry_type?"CNPJ":"CPF",m.value="j"===r.registry_type?"CNPJ":"CPF",m.setAttribute("selected",!0),i.add(m),d.appendChild(i),window.Mercadopago.createToken(d,(e,t)=>{(200===e?n:o)(t)})});var c}).then(n=>{window.Mercadopago.getIssuers(window.mpPaymentMethodId,(e,t)=>{console.log(t);t=n.id+" // "+JSON.stringify({payment_method_id:window.mpPaymentMethodId,issuer:t});return o(t)})}).catch(e)})},window._mpInstallments=function(t){return new Promise((r,a)=>{window._mpBrand(t.number).then(e=>{e={payment_method_id:e,amount:t.amount};return window.Mercadopago.getInstallments(e,(e,t)=>{if(200===e){var n=[];for(let e=0;e<t[0].payer_costs.length;e++){var o=t[0].payer_costs[e];n.push({number:o.installments,tax:0<o.installment_rate,value:o.installment_amount})}r(n)}else console.log("installments method info error:",response),a(response)})}).catch(a)})},window._mpBrand=function(t){return new Promise((n,o)=>{let e=String(t);if(6<=(e=e.substring(0,6)).length)return window.Mercadopago.getPaymentMethod({bin:e},(e,t)=>{200===e?(window.mpPaymentMethodId=t[0].id,n(t[0].id)):(console.log("payment method info error:",t),o(t))});o(new Error("Failed trying installments with card number yet imcomplete"))})};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-mercadopago",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Mercado Pago",
6
6
  "main": "lib/mercadopago.js",
7
7
  "exports": {
@@ -0,0 +1 @@
1
+ window._pagarmeHash=function(r){return new Promise((e,n)=>{window.pagarme.client.connect({encryption_key:window._pagarmeKey}).then(e=>e.security.encrypt({card_number:r.number,card_holder_name:r.name,card_expiration_date:r.month.toString()+r.year.toString(),card_cvv:r.cvc})).then(e).catch(n)})};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-pagarme",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Pagar.me",
6
6
  "main": "lib/pagarme.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-paghiper",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate PagHiper",
6
6
  "main": "lib/paghiper.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-pix",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Pix API (Bacen)",
6
6
  "main": "lib/pix.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-tiny-erp",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce app for Tiny ERP",
6
6
  "main": "lib/tiny-erp.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-webhooks",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce app for general order webhooks",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -37,18 +37,19 @@ if (projectId) {
37
37
 
38
38
  export default async () => {
39
39
  await fs.copy(path.join(__dirname, '..', 'config'), pwd);
40
- const options = Object.keys(argv).reduce((opts, key) => {
40
+ const options = [];
41
+ Object.keys(argv).forEach((key) => {
41
42
  if (key !== '_' && argv[key] !== false) {
42
- // eslint-disable-next-line no-param-reassign
43
- opts += ` --${key} ${argv[key]}`;
43
+ if (argv[key] !== true || (key !== 'codebase' && key !== 'only')) {
44
+ options.push(`--${key}`, argv[key]);
45
+ }
44
46
  }
45
- return opts;
46
- }, '');
47
+ });
47
48
  const $firebase = (cmd) => {
48
- if (cmd === 'deploy' && !options) {
49
- return $`firebase --project=${projectId} ${cmd}${options} --force`;
49
+ if (cmd === 'deploy' && !options.length) {
50
+ return $`firebase --project=${projectId} ${cmd} --force`;
50
51
  }
51
- return $`firebase --project=${projectId} ${cmd}${options}`;
52
+ return $`firebase --project=${projectId} ${cmd} ${options}`;
52
53
  };
53
54
  if (argv._.includes('serve')) {
54
55
  await build();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/cli",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce CLI tools",
6
6
  "bin": {
7
7
  "cloudcommerce": "./bin/run.mjs"
@@ -51,18 +51,19 @@ if (projectId) {
51
51
  export default async () => {
52
52
  await fs.copy(path.join(__dirname, '..', 'config'), pwd);
53
53
 
54
- const options = Object.keys(argv).reduce((opts, key) => {
54
+ const options: string[] = [];
55
+ Object.keys(argv).forEach((key) => {
55
56
  if (key !== '_' && argv[key] !== false) {
56
- // eslint-disable-next-line no-param-reassign
57
- opts += ` --${key} ${argv[key]}`;
57
+ if (argv[key] !== true || (key !== 'codebase' && key !== 'only')) {
58
+ options.push(`--${key}`, argv[key]);
59
+ }
58
60
  }
59
- return opts;
60
- }, '');
61
+ });
61
62
  const $firebase = (cmd: string) => {
62
- if (cmd === 'deploy' && !options) {
63
- return $`firebase --project=${projectId} ${cmd}${options} --force`;
63
+ if (cmd === 'deploy' && !options.length) {
64
+ return $`firebase --project=${projectId} ${cmd} --force`;
64
65
  }
65
- return $`firebase --project=${projectId} ${cmd}${options}`;
66
+ return $`firebase --project=${projectId} ${cmd} ${options}`;
66
67
  };
67
68
 
68
69
  if (argv._.includes('serve')) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/config",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce base config",
6
6
  "main": "lib/config.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/emails",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/events",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce app events",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/firebase",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce on Firebase",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/i18n",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce i18n",
6
6
  "main": "lib/all.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/modules",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce modules API",
6
6
  "main": "lib/index.cjs",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/passport",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce customers authentication (passport) API",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/ssr",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "E-Com Plus Cloud Commerce storefront SSR",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -1 +1 @@
1
- import{v as G}from"./runtime-dom.esm-bundler.be3a98cd.js";import{p as J}from"./modules-info.8540ba60.js";import{c as g,d as R,_ as j,m as Q,o as u,a as p,p as x,e as I,n as z,j as d,q as C,s as D,u as X,v as Y,x as Z,y as ee,k as $,w as v,l as q,g as b,z as te,A as ae,B as oe,F as re,C as se,b as ne}from"./_plugin-vue_export-helper.be244611.js";import{u as le,a as ie,b as ue}from"./index.248ccd97.js";/* empty css */import"./session-utm.72684b84.js";import"./idle-callback.889bf0ea.js";import"./format-money.e57ae2ab.js";const ce=r=>{const s=g(()=>r.slides.map(({html:e})=>J(e).value)),a=g(()=>s.value.filter(e=>e).length);return{parsedContents:s,countValidSlides:a}},K=Symbol("carousel"),de=R({__name:"CarouselControl",props:{direction:{default:1}},setup(r,{expose:s}){s();const{changeSlide:a}=Q(K),e={changeSlide:a};return Object.defineProperty(e,"__isScriptSetup",{enumerable:!1,value:!0}),e}}),fe=["aria-label","data-carousel-control"];function pe(r,s,a,e,n,o){return u(),p("button",{type:"button","aria-label":a.direction>0?"Próximo":"Anterior",onClick:s[0]||(s[0]=i=>e.changeSlide(a.direction)),class:z(["group absolute top-0",a.direction>0?"right-0":"left-0"]),"data-carousel-control":a.direction>0?"next":"previous"},[x(r.$slots,"default",{},()=>[I("i",{class:z(["m-0",a.direction>0?"i-chevron-right group-active:translate-x-1":"i-chevron-left group-active:-translate-x-1"])},null,2)])],10,fe)}const U=j(de,[["render",pe]]),ve=R({__name:"Carousel",props:{as:{default:"ul"},modelValue:{default:1},autoplay:null},emits:["update:modelValue"],setup(r,{expose:s,emit:a}){s();const e=r,n=d(e.modelValue-1);C(D(e,"modelValue"),t=>{n.value=t-1}),C(n,(t,l)=>{t!==l&&a("update:modelValue",t+1)});const o=d(null),{x:i,isScrolling:f,arrivedState:S}=le(o),y=g(()=>S.left),w=g(()=>S.right),h=d([]),B=d(0),L=d(0),P=d(0),A=()=>{B.value=o.value.scrollWidth,L.value=o.value.offsetWidth},E=()=>{const t=[...o.value.children];h.value=t.map(l=>({offsetLeft:l.offsetLeft,width:l.offsetWidth}))},N=t=>{const l=t>0?n.value:n.value+t,O=h.value[l]?.width||0;return O?O*t:0},V=()=>{const t=h.value.findIndex(l=>Math.abs(l.offsetLeft-i.value)<=5);t>-1&&(n.value=t||0)},k=()=>{const t=B.value-L.value;P.value=h.value.findIndex(({offsetLeft:l})=>l>=t-5)};let c=null;const m=()=>{e.autoplay&&(clearTimeout(c),c=setTimeout(()=>{_(1)},e.autoplay))},_=t=>{if(t<0){if(y.value){k(),n.value=P.value-1,_(1);return}}else if(w.value){n.value=1,_(-1);return}const l=N(t);l&&(o.value.scrollBy({left:l,behavior:"smooth"}),m())};C(f,t=>{t?clearTimeout(c):(V(),m())});const F=d(null),H=ie(F);C(H,t=>{t?clearTimeout(c):m()});const T=()=>{o.value&&(A(),E(),V(),k())},W=ue(()=>{o.value.scrollLeft=0,T()},400);X(()=>{T(),Y(()=>{[...o.value.children].forEach(t=>{t.setAttribute("tabindex","0")})}),m(),window.addEventListener("resize",W)}),Z(()=>{window.removeEventListener("resize",W),clearTimeout(c)}),ee(K,{autoplay:D(e,"autoplay"),changeSlide:_,isBoundLeft:y,isBoundRight:w});const M={props:e,emit:a,currentIndex:n,wrapper:o,currentPos:i,isScrolling:f,arrivedState:S,isBoundLeft:y,isBoundRight:w,slidesWidth:h,wrapperScrollWidth:B,wrapperVisibleWidth:L,indexCount:P,calcWrapperWidth:A,calcSlidesWidth:E,calcNextWidth:N,calcCurrentIndex:V,calcIndexCount:k,get autoplayTimer(){return c},set autoplayTimer(t){c=t},restartAutoplay:m,changeSlide:_,carousel:F,isHovered:H,calcOnInit:T,onResize:W,CarouselControl:U};return Object.defineProperty(M,"__isScriptSetup",{enumerable:!1,value:!0}),M}}),he={ref:"carousel",class:"relative","data-carousel":""};function me(r,s,a,e,n,o){return u(),p("div",he,[(u(),$(q(a.as),{ref:"wrapper",class:"flex overflow-x-scroll overflow-y-hidden list-none m-0 p-0","data-carousel-wrapper":""},{default:v(()=>[x(r.$slots,"default")]),_:3},512)),x(r.$slots,"controls",te(ae({changeSlide:e.changeSlide,isBoundLeft:e.isBoundLeft,isBoundRight:e.isBoundRight,currentPage:e.currentIndex+1,pageCount:e.indexCount+1})),()=>[b(e.CarouselControl,{direction:-1},{default:v(()=>[x(r.$slots,"previous")]),_:3}),b(e.CarouselControl,null,{default:v(()=>[x(r.$slots,"next")]),_:3})])],512)}const _e=j(ve,[["render",me]]),xe=R({__name:"PitchBar",props:{slides:null},setup(r,{expose:s}){s();const a=r,{parsedContents:e,countValidSlides:n}=ce(a),o={props:a,parsedContents:e,countValidSlides:n,Carousel:_e,CarouselControl:U};return Object.defineProperty(o,"__isScriptSetup",{enumerable:!1,value:!0}),o}}),be={class:"bg-base-100 relative z-1"},Ce={class:"container md:w-2/3 mx-auto px-3 py-1"},ge=["innerHTML"],Se={class:"text-xl leading-none text-base-400"};function ye(r,s,a,e,n,o){return u(),p("div",be,[I("div",Ce,[b(e.Carousel,{autoplay:e.countValidSlides>1?7e3:null},{controls:v(()=>[oe(I("div",Se,[b(e.CarouselControl,{direction:-1,class:"pr-2 bg-base-100 hover:text-base-700"}),b(e.CarouselControl,{class:"pl-2 bg-base-100 hover:text-base-700"})],512),[[G,e.countValidSlides>1]])]),default:v(()=>[(u(!0),p(re,null,se(a.slides,(i,f)=>(u(),p("li",{key:f,class:"shrink-0 basis-full h-full text-center"},[(u(),$(q(i.href?"ALink":"span"),{href:i.href,target:i.target,class:z(["inline-block px-8",i.href?"hover:underline":null])},{default:v(()=>[e.parsedContents[f]?(u(),p("span",{key:0,innerHTML:e.parsedContents[f],class:"prose text-sm text-base-800"},null,8,ge)):ne("",!0)]),_:2},1032,["href","target","class"]))]))),128))]),_:1},8,["autoplay"])])])}const Ie=j(xe,[["render",ye]]);export{Ie as default};
1
+ import{v as G}from"./runtime-dom.esm-bundler.b4764bdb.js";import{p as J}from"./modules-info.6e650119.js";import{c as g,d as R,_ as j,m as Q,o as u,a as p,p as x,e as I,n as z,j as d,q as C,s as D,u as X,v as Y,x as Z,y as ee,k as $,w as v,l as q,g as b,z as te,A as ae,B as oe,F as re,C as se,b as ne}from"./_plugin-vue_export-helper.3dfd3410.js";import{u as le,a as ie,b as ue}from"./index.140ec818.js";/* empty css */import"./session-utm.72684b84.js";import"./idle-callback.889bf0ea.js";import"./format-money.e75b6ce1.js";const ce=r=>{const s=g(()=>r.slides.map(({html:e})=>J(e).value)),a=g(()=>s.value.filter(e=>e).length);return{parsedContents:s,countValidSlides:a}},K=Symbol("carousel"),de=R({__name:"CarouselControl",props:{direction:{default:1}},setup(r,{expose:s}){s();const{changeSlide:a}=Q(K),e={changeSlide:a};return Object.defineProperty(e,"__isScriptSetup",{enumerable:!1,value:!0}),e}}),fe=["aria-label","data-carousel-control"];function pe(r,s,a,e,n,o){return u(),p("button",{type:"button","aria-label":a.direction>0?"Próximo":"Anterior",onClick:s[0]||(s[0]=i=>e.changeSlide(a.direction)),class:z(["group absolute top-0",a.direction>0?"right-0":"left-0"]),"data-carousel-control":a.direction>0?"next":"previous"},[x(r.$slots,"default",{},()=>[I("i",{class:z(["m-0",a.direction>0?"i-chevron-right group-active:translate-x-1":"i-chevron-left group-active:-translate-x-1"])},null,2)])],10,fe)}const U=j(de,[["render",pe]]),ve=R({__name:"Carousel",props:{as:{default:"ul"},modelValue:{default:1},autoplay:null},emits:["update:modelValue"],setup(r,{expose:s,emit:a}){s();const e=r,n=d(e.modelValue-1);C(D(e,"modelValue"),t=>{n.value=t-1}),C(n,(t,l)=>{t!==l&&a("update:modelValue",t+1)});const o=d(null),{x:i,isScrolling:f,arrivedState:S}=le(o),y=g(()=>S.left),w=g(()=>S.right),h=d([]),B=d(0),L=d(0),P=d(0),A=()=>{B.value=o.value.scrollWidth,L.value=o.value.offsetWidth},E=()=>{const t=[...o.value.children];h.value=t.map(l=>({offsetLeft:l.offsetLeft,width:l.offsetWidth}))},N=t=>{const l=t>0?n.value:n.value+t,O=h.value[l]?.width||0;return O?O*t:0},V=()=>{const t=h.value.findIndex(l=>Math.abs(l.offsetLeft-i.value)<=5);t>-1&&(n.value=t||0)},k=()=>{const t=B.value-L.value;P.value=h.value.findIndex(({offsetLeft:l})=>l>=t-5)};let c=null;const m=()=>{e.autoplay&&(clearTimeout(c),c=setTimeout(()=>{_(1)},e.autoplay))},_=t=>{if(t<0){if(y.value){k(),n.value=P.value-1,_(1);return}}else if(w.value){n.value=1,_(-1);return}const l=N(t);l&&(o.value.scrollBy({left:l,behavior:"smooth"}),m())};C(f,t=>{t?clearTimeout(c):(V(),m())});const F=d(null),H=ie(F);C(H,t=>{t?clearTimeout(c):m()});const T=()=>{o.value&&(A(),E(),V(),k())},W=ue(()=>{o.value.scrollLeft=0,T()},400);X(()=>{T(),Y(()=>{[...o.value.children].forEach(t=>{t.setAttribute("tabindex","0")})}),m(),window.addEventListener("resize",W)}),Z(()=>{window.removeEventListener("resize",W),clearTimeout(c)}),ee(K,{autoplay:D(e,"autoplay"),changeSlide:_,isBoundLeft:y,isBoundRight:w});const M={props:e,emit:a,currentIndex:n,wrapper:o,currentPos:i,isScrolling:f,arrivedState:S,isBoundLeft:y,isBoundRight:w,slidesWidth:h,wrapperScrollWidth:B,wrapperVisibleWidth:L,indexCount:P,calcWrapperWidth:A,calcSlidesWidth:E,calcNextWidth:N,calcCurrentIndex:V,calcIndexCount:k,get autoplayTimer(){return c},set autoplayTimer(t){c=t},restartAutoplay:m,changeSlide:_,carousel:F,isHovered:H,calcOnInit:T,onResize:W,CarouselControl:U};return Object.defineProperty(M,"__isScriptSetup",{enumerable:!1,value:!0}),M}}),he={ref:"carousel",class:"relative","data-carousel":""};function me(r,s,a,e,n,o){return u(),p("div",he,[(u(),$(q(a.as),{ref:"wrapper",class:"flex overflow-x-scroll overflow-y-hidden list-none m-0 p-0","data-carousel-wrapper":""},{default:v(()=>[x(r.$slots,"default")]),_:3},512)),x(r.$slots,"controls",te(ae({changeSlide:e.changeSlide,isBoundLeft:e.isBoundLeft,isBoundRight:e.isBoundRight,currentPage:e.currentIndex+1,pageCount:e.indexCount+1})),()=>[b(e.CarouselControl,{direction:-1},{default:v(()=>[x(r.$slots,"previous")]),_:3}),b(e.CarouselControl,null,{default:v(()=>[x(r.$slots,"next")]),_:3})])],512)}const _e=j(ve,[["render",me]]),xe=R({__name:"PitchBar",props:{slides:null},setup(r,{expose:s}){s();const a=r,{parsedContents:e,countValidSlides:n}=ce(a),o={props:a,parsedContents:e,countValidSlides:n,Carousel:_e,CarouselControl:U};return Object.defineProperty(o,"__isScriptSetup",{enumerable:!1,value:!0}),o}}),be={class:"bg-base-100 relative z-1"},Ce={class:"container md:w-2/3 mx-auto px-3 py-1"},ge=["innerHTML"],Se={class:"text-xl leading-none text-base-400"};function ye(r,s,a,e,n,o){return u(),p("div",be,[I("div",Ce,[b(e.Carousel,{autoplay:e.countValidSlides>1?7e3:null},{controls:v(()=>[oe(I("div",Se,[b(e.CarouselControl,{direction:-1,class:"pr-2 bg-base-100 hover:text-base-700"}),b(e.CarouselControl,{class:"pl-2 bg-base-100 hover:text-base-700"})],512),[[G,e.countValidSlides>1]])]),default:v(()=>[(u(!0),p(re,null,se(a.slides,(i,f)=>(u(),p("li",{key:f,class:"shrink-0 basis-full h-full text-center"},[(u(),$(q(i.href?"ALink":"span"),{href:i.href,target:i.target,class:z(["inline-block px-8",i.href?"hover:underline":null])},{default:v(()=>[e.parsedContents[f]?(u(),p("span",{key:0,innerHTML:e.parsedContents[f],class:"prose text-sm text-base-800"},null,8,ge)):ne("",!0)]),_:2},1032,["href","target","class"]))]))),128))]),_:1},8,["autoplay"])])])}const Ie=j(xe,[["render",ye]]);export{Ie as default};
@@ -1 +1 @@
1
- import{m as k}from"./modules-info.8540ba60.js";import{g,c as S}from"./format-money.e57ae2ab.js";import{c as a,d as M,_ as T,a as i,t as o,b as u,e as h,f as C,n as I,g as L,w as D,r as z,o as l}from"./_plugin-vue_export-helper.be244611.js";/* empty css */import"./session-utm.72684b84.js";import"./idle-callback.889bf0ea.js";const j=(n,c)=>{const{type:s,value:t}=c;let r;return t?(s==="percentage"?r=n*((100-t)/100):r=n-t,r>0?r:0):n},E=n=>{const c=a(()=>n.product||{price:n.price||0,base_price:n.basePrice}),s=a(()=>{const{variations:e}=c.value;if(e){const d=g(c.value);for(let v=0;v<e.length;v++)if(g({...c.value,...e[v]})>d)return!0}return!1}),t=a(()=>k.apply_discount.available_extra_discount),r=a(()=>{const e=g(c.value),d=t.value;return d&&(!d.min_amount||e>d.min_amount)?j(e,d):e}),f=a(()=>{if(S(c.value))return c.value.base_price;const e=g(c.value);return e>r.value?e:0}),m=a(()=>n.installmentsOption||k.list_payments.installments_option||{max_number:1}),b=a(()=>{if(m.value.max_number<=1)return 1;const e=m.value.min_installment||5,d=Math.round(r.value/e);return Math.min(d,m.value.max_number)}),y=a(()=>m.value.monthly_interest||0),V=a(()=>{if(b.value>=2){if(!y.value)return r.value/b.value;const e=y.value/100;return r.value*e/(1-(1+e)**-b.value)}return 0}),p=a(()=>{const e=n.discountOption||k.list_payments.discount_option;return e&&(!e.min_amount||e.min_amount<=r.value)&&(!n.isAmountTotal||e.apply_at==="total")?e:{}}),x=a(()=>{const{label:e}=p.value;return e?e.includes(" ")?e:`via ${e}`:""}),O=a(()=>j(r.value,p.value)),_=a(()=>{if(n.loyaltyPointsProgram)return n.loyaltyPointsProgram;const e=k.list_payments.loyalty_points_programs;if(e){const d=Object.keys(e);for(let v=0;v<d.length;v++){const P=e[d[v]];if(P&&P.earn_percentage>0)return P}}return{ratio:0}}),W=a(()=>_.value.min_subtotal_to_earn||0),w=a(()=>_.value.name||""),N=a(()=>_.value.earn_percentage||0),B=a(()=>N.value*_.value.ratio),A=a(()=>B.value>=1?r.value*(B.value/100):0);return{hasVariedPrices:s,salePrice:r,comparePrice:f,installmentsObject:m,installmentsNumber:b,monthlyInterest:y,installmentValue:V,discountObject:p,discountLabel:x,priceWithDiscount:O,pointsProgramObject:_,pointsMinPrice:W,pointsProgramName:w,earnPointsPercentage:N,cashbackPercentage:B,cashbackValue:A}},F=M({__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(n,{expose:c}){c();const s=n,{hasVariedPrices:t,salePrice:r,comparePrice:f,cashbackPercentage:m,cashbackValue:b,installmentsNumber:y,monthlyInterest:V,installmentValue:p,priceWithDiscount:x,discountLabel:O}=E(s),_={props:s,hasVariedPrices:t,salePrice:r,comparePrice:f,cashbackPercentage:m,cashbackValue:b,installmentsNumber:y,monthlyInterest:V,installmentValue:p,priceWithDiscount:x,discountLabel:O};return Object.defineProperty(_,"__isScriptSetup",{enumerable:!1,value:!0}),_}}),R={key:0,class:"text-base-500 mr-1"},q={key:0},G={key:1},H={key:0},J={key:0,class:"relative z-10"},K=["data-tooltip"],Q=h("i",{class:"i-cashback mr-1"},null,-1),U={class:"font-medium"},X=h("small",null," cashback",-1),Y={key:0},Z={key:0},$={key:1},ee={key:2},te={key:0},ne={key:0},ae={key:1};function se(n,c,s,t,r,f){const m=z("Fade");return l(),i("div",{class:I(["text-base-600",s.isBig?"text-lg":null]),"data-prices":""},[t.comparePrice?(l(),i("span",R,[s.isLiteral?(l(),i("small",q,o("De "))):u("",!0),h("s",null,o(n.$money(t.comparePrice)),1),s.isLiteral?(l(),i("small",G,o(" Por"))):u("",!0)])):u("",!0),h("strong",{class:I(["inline-block text-base-800",s.isBig?"text-5xl block":null])},[t.hasVariedPrices?(l(),i("small",H,o("A partir de "))):u("",!0),C(" "+o(n.$money(t.salePrice)),1)],2),L(m,{slide:"down"},{default:D(()=>[t.cashbackValue&&s.hasCashback?(l(),i("div",J,[h("span",{"data-tooltip":"Receba $1 de volta".replace("$1",n.$percentage(t.cashbackPercentage))},[Q,h("span",U,o(n.$money(t.cashbackValue)),1),X],8,K)])):u("",!0)]),_:1}),L(m,{slide:"down"},{default:D(()=>[t.installmentValue&&s.hasPriceOptions?(l(),i("div",Y,[s.isLiteral?(l(),i("small",Z,o("Até "))):u("",!0),C(" "+o(t.installmentsNumber)+"x ",1),s.isLiteral?(l(),i("small",$,o(" De "))):u("",!0),h("span",null,o(n.$money(t.installmentValue)),1),!t.monthlyInterest&&s.isLiteral?(l(),i("small",ee,o("Sem juros"))):u("",!0)])):u("",!0)]),_:1}),L(m,{slide:"down"},{default:D(()=>[t.priceWithDiscount<t.salePrice&&s.hasPriceOptions?(l(),i("div",te,[t.discountLabel?u("",!0):(l(),i("small",ne,o("A partir de "))),h("span",null,o(n.$money(t.priceWithDiscount)),1),t.discountLabel?(l(),i("small",ae,o(` ${t.discountLabel}`),1)):u("",!0)])):u("",!0)]),_:1})],2)}const me=T(F,[["render",se]]);export{me as default};
1
+ import{m as k}from"./modules-info.6e650119.js";import{g,c as S}from"./format-money.e75b6ce1.js";import{c as a,d as M,_ as T,a as i,t as o,b as u,e as h,f as C,n as I,g as L,w as D,r as z,o as l}from"./_plugin-vue_export-helper.3dfd3410.js";/* empty css */import"./session-utm.72684b84.js";import"./idle-callback.889bf0ea.js";const j=(n,c)=>{const{type:s,value:t}=c;let r;return t?(s==="percentage"?r=n*((100-t)/100):r=n-t,r>0?r:0):n},E=n=>{const c=a(()=>n.product||{price:n.price||0,base_price:n.basePrice}),s=a(()=>{const{variations:e}=c.value;if(e){const d=g(c.value);for(let v=0;v<e.length;v++)if(g({...c.value,...e[v]})>d)return!0}return!1}),t=a(()=>k.apply_discount.available_extra_discount),r=a(()=>{const e=g(c.value),d=t.value;return d&&(!d.min_amount||e>d.min_amount)?j(e,d):e}),f=a(()=>{if(S(c.value))return c.value.base_price;const e=g(c.value);return e>r.value?e:0}),m=a(()=>n.installmentsOption||k.list_payments.installments_option||{max_number:1}),b=a(()=>{if(m.value.max_number<=1)return 1;const e=m.value.min_installment||5,d=Math.round(r.value/e);return Math.min(d,m.value.max_number)}),y=a(()=>m.value.monthly_interest||0),V=a(()=>{if(b.value>=2){if(!y.value)return r.value/b.value;const e=y.value/100;return r.value*e/(1-(1+e)**-b.value)}return 0}),p=a(()=>{const e=n.discountOption||k.list_payments.discount_option;return e&&(!e.min_amount||e.min_amount<=r.value)&&(!n.isAmountTotal||e.apply_at==="total")?e:{}}),x=a(()=>{const{label:e}=p.value;return e?e.includes(" ")?e:`via ${e}`:""}),O=a(()=>j(r.value,p.value)),_=a(()=>{if(n.loyaltyPointsProgram)return n.loyaltyPointsProgram;const e=k.list_payments.loyalty_points_programs;if(e){const d=Object.keys(e);for(let v=0;v<d.length;v++){const P=e[d[v]];if(P&&P.earn_percentage>0)return P}}return{ratio:0}}),W=a(()=>_.value.min_subtotal_to_earn||0),w=a(()=>_.value.name||""),N=a(()=>_.value.earn_percentage||0),B=a(()=>N.value*_.value.ratio),A=a(()=>B.value>=1?r.value*(B.value/100):0);return{hasVariedPrices:s,salePrice:r,comparePrice:f,installmentsObject:m,installmentsNumber:b,monthlyInterest:y,installmentValue:V,discountObject:p,discountLabel:x,priceWithDiscount:O,pointsProgramObject:_,pointsMinPrice:W,pointsProgramName:w,earnPointsPercentage:N,cashbackPercentage:B,cashbackValue:A}},F=M({__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(n,{expose:c}){c();const s=n,{hasVariedPrices:t,salePrice:r,comparePrice:f,cashbackPercentage:m,cashbackValue:b,installmentsNumber:y,monthlyInterest:V,installmentValue:p,priceWithDiscount:x,discountLabel:O}=E(s),_={props:s,hasVariedPrices:t,salePrice:r,comparePrice:f,cashbackPercentage:m,cashbackValue:b,installmentsNumber:y,monthlyInterest:V,installmentValue:p,priceWithDiscount:x,discountLabel:O};return Object.defineProperty(_,"__isScriptSetup",{enumerable:!1,value:!0}),_}}),R={key:0,class:"text-base-500 mr-1"},q={key:0},G={key:1},H={key:0},J={key:0,class:"relative z-10"},K=["data-tooltip"],Q=h("i",{class:"i-cashback mr-1"},null,-1),U={class:"font-medium"},X=h("small",null," cashback",-1),Y={key:0},Z={key:0},$={key:1},ee={key:2},te={key:0},ne={key:0},ae={key:1};function se(n,c,s,t,r,f){const m=z("Fade");return l(),i("div",{class:I(["text-base-600",s.isBig?"text-lg":null]),"data-prices":""},[t.comparePrice?(l(),i("span",R,[s.isLiteral?(l(),i("small",q,o("De "))):u("",!0),h("s",null,o(n.$money(t.comparePrice)),1),s.isLiteral?(l(),i("small",G,o(" Por"))):u("",!0)])):u("",!0),h("strong",{class:I(["inline-block text-base-800",s.isBig?"text-5xl block":null])},[t.hasVariedPrices?(l(),i("small",H,o("A partir de "))):u("",!0),C(" "+o(n.$money(t.salePrice)),1)],2),L(m,{slide:"down"},{default:D(()=>[t.cashbackValue&&s.hasCashback?(l(),i("div",J,[h("span",{"data-tooltip":"Receba $1 de volta".replace("$1",n.$percentage(t.cashbackPercentage))},[Q,h("span",U,o(n.$money(t.cashbackValue)),1),X],8,K)])):u("",!0)]),_:1}),L(m,{slide:"down"},{default:D(()=>[t.installmentValue&&s.hasPriceOptions?(l(),i("div",Y,[s.isLiteral?(l(),i("small",Z,o("Até "))):u("",!0),C(" "+o(t.installmentsNumber)+"x ",1),s.isLiteral?(l(),i("small",$,o(" De "))):u("",!0),h("span",null,o(n.$money(t.installmentValue)),1),!t.monthlyInterest&&s.isLiteral?(l(),i("small",ee,o("Sem juros"))):u("",!0)])):u("",!0)]),_:1}),L(m,{slide:"down"},{default:D(()=>[t.priceWithDiscount<t.salePrice&&s.hasPriceOptions?(l(),i("div",te,[t.discountLabel?u("",!0):(l(),i("small",ne,o("A partir de "))),h("span",null,o(n.$money(t.priceWithDiscount)),1),t.discountLabel?(l(),i("small",ae,o(` ${t.discountLabel}`),1)):u("",!0)])):u("",!0)]),_:1})],2)}const me=T(F,[["render",se]]);export{me as default};
@@ -1 +1 @@
1
- import d from"./Prices.036ad2b4.js";import{d as _,_ as u,j as o,k as m,w as a,l as f,o as P,g as r,f as l,t as n}from"./_plugin-vue_export-helper.be244611.js";import"./modules-info.8540ba60.js";import"./session-utm.72684b84.js";import"./idle-callback.889bf0ea.js";import"./format-money.e57ae2ab.js";/* empty css */const b=_({__name:"ProductCard",props:{as:{default:"div"}},setup(p,{expose:s}){s();const i=o(12),e=o(!1);setTimeout(()=>{i.value=8,e.value=!0},5e3);const c={price:i,isBig:e,Prices:d};return Object.defineProperty(c,"__isScriptSetup",{enumerable:!1,value:!0}),c}});function g(p,s,i,e,c,v){return P(),m(f(i.as),null,{default:a(()=>[r(e.Prices,null,{default:a(({salePrice:t})=>[l(" ProductCard "+n(t),1)]),_:1}),r(e.Prices,{product:{price:e.price}},null,8,["product"]),r(e.Prices,{price:12,"base-price":17}),r(e.Prices,{price:12,"base-price":16,"is-literal":!0}),r(e.Prices,{price:12,"is-big":e.isBig},null,8,["is-big"]),r(e.Prices,{price:14,"base-price":18,"is-big":e.isBig,"is-literal":!0},null,8,["is-big"]),r(e.Prices,{price:12,"base-price":16},{"compare-value":a(({comparePrice:t})=>[l(" x"+n(t),1)]),_:1})]),_:1})}const j=u(b,[["render",g]]);export{j as default};
1
+ import d from"./Prices.7368883b.js";import{d as _,_ as u,j as o,k as m,w as a,l as f,o as P,g as r,f as l,t as n}from"./_plugin-vue_export-helper.3dfd3410.js";import"./modules-info.6e650119.js";import"./session-utm.72684b84.js";import"./idle-callback.889bf0ea.js";import"./format-money.e75b6ce1.js";/* empty css */const b=_({__name:"ProductCard",props:{as:{default:"div"}},setup(p,{expose:s}){s();const i=o(12),e=o(!1);setTimeout(()=>{i.value=8,e.value=!0},5e3);const c={price:i,isBig:e,Prices:d};return Object.defineProperty(c,"__isScriptSetup",{enumerable:!1,value:!0}),c}});function g(p,s,i,e,c,v){return P(),m(f(i.as),null,{default:a(()=>[r(e.Prices,null,{default:a(({salePrice:t})=>[l(" ProductCard "+n(t),1)]),_:1}),r(e.Prices,{product:{price:e.price}},null,8,["product"]),r(e.Prices,{price:12,"base-price":17}),r(e.Prices,{price:12,"base-price":16,"is-literal":!0}),r(e.Prices,{price:12,"is-big":e.isBig},null,8,["is-big"]),r(e.Prices,{price:14,"base-price":18,"is-big":e.isBig,"is-literal":!0},null,8,["is-big"]),r(e.Prices,{price:12,"base-price":16},{"compare-value":a(({comparePrice:t})=>[l(" x"+n(t),1)]),_:1})]),_:1})}const j=u(b,[["render",g]]);export{j as default};