cloudcommerce 0.6.2 → 0.6.4

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 (74) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/package.json +10 -10
  3. package/packages/api/lib/types/carts.d.ts +72 -20
  4. package/packages/api/lib/types/orders.d.ts +72 -20
  5. package/packages/api/lib/types/products.d.ts +82 -11
  6. package/packages/api/package.json +1 -1
  7. package/packages/api/src/types/carts.d.ts +72 -20
  8. package/packages/api/src/types/orders.d.ts +72 -20
  9. package/packages/api/src/types/products.d.ts +82 -11
  10. package/packages/apps/correios/package.json +2 -2
  11. package/packages/apps/custom-payment/package.json +1 -1
  12. package/packages/apps/custom-shipping/package.json +1 -1
  13. package/packages/apps/datafrete/package.json +2 -2
  14. package/packages/apps/discounts/package.json +1 -1
  15. package/packages/apps/emails/package.json +1 -1
  16. package/packages/apps/fb-conversions/package.json +1 -1
  17. package/packages/apps/frenet/package.json +2 -2
  18. package/packages/apps/galaxpay/package.json +2 -2
  19. package/packages/apps/google-analytics/package.json +2 -2
  20. package/packages/apps/infinitepay/package.json +2 -2
  21. package/packages/apps/jadlog/package.json +2 -2
  22. package/packages/apps/loyalty-points/package.json +1 -1
  23. package/packages/apps/melhor-envio/package.json +2 -2
  24. package/packages/apps/mercadopago/package.json +2 -2
  25. package/packages/apps/pagarme/package.json +2 -2
  26. package/packages/apps/paghiper/package.json +2 -2
  27. package/packages/apps/pix/package.json +2 -2
  28. package/packages/apps/tiny-erp/package.json +2 -2
  29. package/packages/apps/webhooks/package.json +2 -2
  30. package/packages/cli/package.json +2 -2
  31. package/packages/config/package.json +1 -1
  32. package/packages/emails/package.json +3 -3
  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 +3 -3
  37. package/packages/passport/package.json +1 -1
  38. package/packages/ssr/lib/firebase/serve-storefront.js +3 -2
  39. package/packages/ssr/lib/firebase/serve-storefront.js.map +1 -1
  40. package/packages/ssr/package.json +5 -5
  41. package/packages/ssr/src/firebase/serve-storefront.ts +3 -2
  42. package/packages/storefront/dist/client/_astro/PitchBar.b3636d56.js +1 -0
  43. package/packages/storefront/dist/client/_astro/{Prices.a1302bf9.js → Prices.2bd87845.js} +1 -1
  44. package/packages/storefront/dist/client/_astro/{ProductCard.1a45764a.js → ProductCard.48f0f5ba.js} +1 -1
  45. package/packages/storefront/dist/client/_astro/ShopHeader.44e0873d.js +4 -0
  46. package/packages/storefront/dist/client/_astro/_...slug_.cd49465e.css +1 -0
  47. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.43eaff51.js +1 -0
  48. package/packages/storefront/dist/client/_astro/client.14d15518.js +1 -0
  49. package/packages/storefront/dist/client/_astro/{format-money.6f464cee.js → format-money.060d67ef.js} +1 -1
  50. package/packages/storefront/dist/client/_astro/{index.a500792d.js → index.3243538d.js} +1 -1
  51. package/packages/storefront/dist/client/_astro/{modules-info.80ae4e30.js → modules-info.01f8d523.js} +1 -1
  52. package/packages/storefront/dist/client/_astro/{runtime-dom.esm-bundler.acde10ec.js → runtime-dom.esm-bundler.cb4db78a.js} +1 -1
  53. package/packages/storefront/dist/client/sw.js +1 -1
  54. package/packages/storefront/dist/server/chunks/{astro.7d9d5f6e.mjs → astro.a9f695c0.mjs} +16 -3
  55. package/packages/storefront/dist/server/chunks/pages/{all.42c985c2.mjs → all.7f368e08.mjs} +638 -101
  56. package/packages/storefront/dist/server/entry.mjs +59 -16
  57. package/packages/storefront/package.json +10 -10
  58. package/packages/storefront/src/lib/components/CarouselControl.vue +4 -1
  59. package/packages/storefront/src/lib/components/globals/AImg.vue +53 -0
  60. package/packages/storefront/src/lib/composables/use-shop-header-submenu.ts +53 -0
  61. package/packages/storefront/src/lib/composables/use-shop-header.ts +55 -7
  62. package/packages/storefront/src/lib/layouts/BaseHead.astro +3 -1
  63. package/packages/storefront/src/lib/layouts/PagesHeader.astro +3 -0
  64. package/packages/storefront/src/lib/pages/_vue.ts +2 -0
  65. package/packages/storefront/src/lib/ssr-context.ts +4 -2
  66. package/packages/storefront/src/vue-globals.d.ts +1 -0
  67. package/packages/types/package.json +1 -1
  68. package/packages/storefront/dist/client/_astro/PitchBar.457658a3.js +0 -1
  69. package/packages/storefront/dist/client/_astro/ShopHeader.d36e6752.js +0 -1
  70. package/packages/storefront/dist/client/_astro/_...slug_.6721f699.css +0 -1
  71. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.6da04e63.js +0 -1
  72. package/packages/storefront/dist/client/_astro/client.b854166f.js +0 -1
  73. package/packages/storefront/dist/client/fallback/index.html +0 -79
  74. package/packages/storefront/dist/server/chunks/prerender.6899569d.mjs +0 -2
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-correios",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.4",
5
5
  "description": "E-Com Plus Cloud Commerce app for Correios shipping calculation",
6
6
  "main": "lib/correios.js",
7
7
  "repository": {
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@cloudcommerce/api": "workspace:*",
23
- "axios": "^1.3.2",
23
+ "axios": "^1.3.3",
24
24
  "xml2js": "^0.4.23"
25
25
  },
26
26
  "devDependencies": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-custom-payment",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.4",
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.2",
4
+ "version": "0.6.4",
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.2",
4
+ "version": "0.6.4",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Datafrete shipping gateway ",
6
6
  "main": "lib/datafrete.js",
7
7
  "exports": {
@@ -26,7 +26,7 @@
26
26
  "@cloudcommerce/api": "workspace:*",
27
27
  "@cloudcommerce/firebase": "workspace:*",
28
28
  "@ecomplus/utils": "1.5.0-rc.3",
29
- "axios": "^1.3.2",
29
+ "axios": "^1.3.3",
30
30
  "firebase-admin": "^11.5.0",
31
31
  "firebase-functions": "^4.2.1"
32
32
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-discounts",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.4",
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.2",
4
+ "version": "0.6.4",
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.2",
4
+ "version": "0.6.4",
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.2",
4
+ "version": "0.6.4",
5
5
  "description": "E-Com Plus Cloud Commerce app for Frenet shipping calculation",
6
6
  "main": "lib/frenet.js",
7
7
  "exports": {
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@cloudcommerce/api": "workspace:*",
27
27
  "@cloudcommerce/firebase": "workspace:*",
28
- "axios": "^1.3.2",
28
+ "axios": "^1.3.3",
29
29
  "firebase-admin": "^11.5.0",
30
30
  "firebase-functions": "^4.2.1"
31
31
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-galaxpay",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.4",
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": {
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@cloudcommerce/api": "workspace:*",
27
27
  "@cloudcommerce/firebase": "workspace:*",
28
- "axios": "^1.3.2",
28
+ "axios": "^1.3.3",
29
29
  "firebase-admin": "^11.5.0",
30
30
  "firebase-functions": "^4.2.1"
31
31
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-google-analytics",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.4",
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": {
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@cloudcommerce/api": "workspace:*",
23
23
  "@cloudcommerce/firebase": "workspace:*",
24
- "axios": "^1.3.2",
24
+ "axios": "^1.3.3",
25
25
  "firebase-admin": "^11.5.0",
26
26
  "firebase-functions": "^4.2.1"
27
27
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-infinitepay",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.4",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate InfinitePay",
6
6
  "main": "lib/infinitepay.js",
7
7
  "exports": {
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@cloudcommerce/api": "workspace:*",
27
27
  "@cloudcommerce/firebase": "workspace:*",
28
- "axios": "^1.3.2",
28
+ "axios": "^1.3.3",
29
29
  "crypto-js": "^4.1.1",
30
30
  "firebase-admin": "^11.5.0",
31
31
  "firebase-functions": "^4.2.1"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-jadlog",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.4",
5
5
  "description": "E-Com Plus Cloud Commerce app for Jadlog shipping calculation",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@cloudcommerce/api": "workspace:*",
23
- "axios": "^1.3.2"
23
+ "axios": "^1.3.3"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@cloudcommerce/types": "workspace:*"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-loyalty-points",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.4",
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.2",
4
+ "version": "0.6.4",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Melhor Envio",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@cloudcommerce/api": "workspace:*",
27
27
  "@cloudcommerce/firebase": "workspace:*",
28
- "axios": "^1.3.2",
28
+ "axios": "^1.3.3",
29
29
  "firebase-admin": "^11.5.0",
30
30
  "firebase-functions": "^4.2.1"
31
31
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-mercadopago",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.4",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Mercado Pago",
6
6
  "main": "lib/mercadopago.js",
7
7
  "exports": {
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@cloudcommerce/api": "workspace:*",
27
27
  "@cloudcommerce/firebase": "workspace:*",
28
- "axios": "^1.3.2",
28
+ "axios": "^1.3.3",
29
29
  "firebase-admin": "^11.5.0",
30
30
  "firebase-functions": "^4.2.1"
31
31
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-pagarme",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.4",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Pagar.me",
6
6
  "main": "lib/pagarme.js",
7
7
  "exports": {
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@cloudcommerce/api": "workspace:*",
27
27
  "@cloudcommerce/firebase": "workspace:*",
28
- "axios": "^1.3.2",
28
+ "axios": "^1.3.3",
29
29
  "firebase-admin": "^11.5.0",
30
30
  "firebase-functions": "^4.2.1",
31
31
  "pagarme": "^4.30.0",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-paghiper",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.4",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate PagHiper",
6
6
  "main": "lib/paghiper.js",
7
7
  "exports": {
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@cloudcommerce/api": "workspace:*",
27
27
  "@cloudcommerce/firebase": "workspace:*",
28
- "axios": "^1.3.2",
28
+ "axios": "^1.3.3",
29
29
  "firebase-admin": "^11.5.0",
30
30
  "firebase-functions": "^4.2.1"
31
31
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-pix",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.4",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Pix API (Bacen)",
6
6
  "main": "lib/pix.js",
7
7
  "exports": {
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@cloudcommerce/api": "workspace:*",
27
27
  "@cloudcommerce/firebase": "workspace:*",
28
- "axios": "^1.3.2",
28
+ "axios": "^1.3.3",
29
29
  "firebase-admin": "^11.5.0",
30
30
  "firebase-functions": "^4.2.1"
31
31
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-tiny-erp",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.4",
5
5
  "description": "E-Com Plus Cloud Commerce app for Tiny ERP",
6
6
  "main": "lib/tiny-erp.js",
7
7
  "repository": {
@@ -22,7 +22,7 @@
22
22
  "@cloudcommerce/api": "workspace:*",
23
23
  "@cloudcommerce/firebase": "workspace:*",
24
24
  "@ecomplus/utils": "1.5.0-rc.3",
25
- "axios": "^1.3.2",
25
+ "axios": "^1.3.3",
26
26
  "firebase-admin": "^11.5.0",
27
27
  "firebase-functions": "^4.2.1",
28
28
  "form-data": "^4.0.0"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-webhooks",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.4",
5
5
  "description": "E-Com Plus Cloud Commerce app for general order webhooks",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@cloudcommerce/api": "workspace:*",
23
23
  "@cloudcommerce/firebase": "workspace:*",
24
- "axios": "^1.3.2",
24
+ "axios": "^1.3.3",
25
25
  "firebase-admin": "^11.5.0",
26
26
  "firebase-functions": "^4.2.1"
27
27
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/cli",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.4",
5
5
  "description": "E-Com Plus Cloud Commerce CLI tools",
6
6
  "bin": {
7
7
  "cloudcommerce": "./bin/run.mjs"
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@cloudcommerce/api": "workspace:*",
30
- "libsodium-wrappers": "^0.7.10",
30
+ "libsodium-wrappers": "^0.7.11",
31
31
  "md5": "^2.3.0",
32
32
  "zx": "^7.1.1"
33
33
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/config",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.4",
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.2",
4
+ "version": "0.6.4",
5
5
  "description": "E-Com Plus Cloud Commerce",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -23,13 +23,13 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@cloudcommerce/firebase": "workspace:*",
26
- "axios": "^1.3.2",
26
+ "axios": "^1.3.3",
27
27
  "ejs": "^3.1.8",
28
28
  "nodemailer": "^6.9.1"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@cloudcommerce/types": "workspace:*",
32
- "@types/ejs": "^3.1.1",
32
+ "@types/ejs": "^3.1.2",
33
33
  "@types/nodemailer": "^6.4.7"
34
34
  }
35
35
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/events",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.4",
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.2",
4
+ "version": "0.6.4",
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.2",
4
+ "version": "0.6.4",
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.2",
4
+ "version": "0.6.4",
5
5
  "description": "E-Com Plus Cloud Commerce modules API",
6
6
  "main": "lib/index.cjs",
7
7
  "exports": {
@@ -44,7 +44,7 @@
44
44
  "@ecomplus/utils": "1.5.0-rc.3",
45
45
  "ajv": "^8.12.0",
46
46
  "ajv-formats": "^2.1.1",
47
- "axios": "^1.3.2",
47
+ "axios": "^1.3.3",
48
48
  "firebase-admin": "^11.5.0",
49
49
  "firebase-functions": "^4.2.1",
50
50
  "source-map-support": "^0.5.21"
@@ -52,6 +52,6 @@
52
52
  "devDependencies": {
53
53
  "@cloudcommerce/types": "workspace:*",
54
54
  "@firebase/app-types": "^0.9.0",
55
- "json-schema-to-typescript": "^11.0.3"
55
+ "json-schema-to-typescript": "^11.0.4"
56
56
  }
57
57
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/passport",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.4",
5
5
  "description": "E-Com Plus Cloud Commerce customers authentication (passport) API",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -34,6 +34,7 @@ export default (req, res) => {
34
34
  global.ssr_handler(req, res, async (err) => {
35
35
  if (err) {
36
36
  res.set('X-SSR-Error', err.message);
37
+ res.set('X-SSR-Error-Stack', err.stack);
37
38
  fallback(err);
38
39
  return;
39
40
  }
@@ -42,8 +43,8 @@ export default (req, res) => {
42
43
  const data = await readFile(local);
43
44
  setStatusAndCache(200, 'public, max-age=60, s-maxage=600')
44
45
  .send(data);
45
- } catch {
46
- fallback(err, 404);
46
+ } catch (e) {
47
+ fallback(e, 404);
47
48
  }
48
49
  });
49
50
  };
@@ -1 +1 @@
1
- {"version":3,"file":"serve-storefront.js","sourceRoot":"","sources":["../../src/firebase/serve-storefront.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,IAA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;IAEF;;;;MAIE;IACF,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAQ,EAAE,EAAE;QAC9C,IAAI,GAAG,EAAE;YACP,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;YACpC,GAAG,CAAC,GAAG,CAAC,mBAAmB,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;YACxC,QAAQ,CAAC,GAAG,CAAC,CAAC;YACd,OAAO;SACR;QACD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,IAAI,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;QAC7C,IAAI;YACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC;YACnC,iBAAiB,CAAC,GAAG,EAAE,kCAAkC,CAAC;iBACvD,IAAI,CAAC,IAAI,CAAC,CAAC;SACf;QAAC,OAAO,CAAC,EAAE;YACV,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;SAClB;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/ssr",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.4",
5
5
  "description": "E-Com Plus Cloud Commerce storefront SSR",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -23,15 +23,15 @@
23
23
  "build": "sh ../../scripts/build-lib.sh"
24
24
  },
25
25
  "dependencies": {
26
- "@astrojs/image": "^0.14.1",
26
+ "@astrojs/image": "^0.15.0",
27
27
  "@astrojs/node": "^5.0.3",
28
28
  "@cloudcommerce/api": "workspace:*",
29
29
  "@cloudcommerce/firebase": "workspace:*",
30
30
  "@cloudcommerce/i18n": "workspace:*",
31
31
  "@ecomplus/utils": "1.5.0-rc.3",
32
- "@headlessui/vue": "^1.7.9",
33
- "@vueuse/core": "^9.12.0",
34
- "astro": "^2.0.10",
32
+ "@headlessui/vue": "^1.7.10",
33
+ "@vueuse/core": "9.12.0 || ^9.13.1",
34
+ "astro": "^2.0.14",
35
35
  "firebase-admin": "^11.5.0",
36
36
  "firebase-functions": "^4.2.1",
37
37
  "image-size": "^1.0.2",
@@ -41,6 +41,7 @@ export default (req: Request, res: Response) => {
41
41
  global.ssr_handler(req, res, async (err: any) => {
42
42
  if (err) {
43
43
  res.set('X-SSR-Error', err.message);
44
+ res.set('X-SSR-Error-Stack', err.stack);
44
45
  fallback(err);
45
46
  return;
46
47
  }
@@ -49,8 +50,8 @@ export default (req: Request, res: Response) => {
49
50
  const data = await readFile(local);
50
51
  setStatusAndCache(200, 'public, max-age=60, s-maxage=600')
51
52
  .send(data);
52
- } catch {
53
- fallback(err, 404);
53
+ } catch (e) {
54
+ fallback(e, 404);
54
55
  }
55
56
  });
56
57
  };
@@ -0,0 +1 @@
1
+ import{v as G}from"./runtime-dom.esm-bundler.cb4db78a.js";import{p as J}from"./modules-info.01f8d523.js";import{c as g,d as z,_ as R,m as Q,o as u,a as f,p as x,e as I,n as D,j as d,q as b,s as O,u as X,v as Y,x as Z,y as ee,k as $,w as v,l as q,g as C,z as te,A as ae,B as oe,F as re,C as ne,b as se}from"./_plugin-vue_export-helper.43eaff51.js";import{u as le,a as ie,b as ue}from"./index.3243538d.js";/* empty css */import"./session-utm.72684b84.js";import"./idle-callback.889bf0ea.js";import"./format-money.060d67ef.js";const ce=o=>{const n=g(()=>o.slides.map(({html:e})=>J(e).value)),a=g(()=>n.value.filter(e=>e).length);return{parsedContents:n,countValidSlides:a}},K=Symbol("carousel"),de=z({__name:"CarouselControl",props:{direction:{default:1}},setup(o,{expose:n}){n();const{changeSlide:a}=Q(K),e={changeSlide:a};return Object.defineProperty(e,"__isScriptSetup",{enumerable:!1,value:!0}),e}}),pe=["aria-label","data-carousel-control"];function fe(o,n,a,e,s,r){return u(),f("button",{type:"button","aria-label":a.direction>0?"Próximo":"Anterior",onClick:n[0]||(n[0]=i=>e.changeSlide(a.direction)),"data-carousel-control":a.direction>0?"next":"previous",class:"group"},[x(o.$slots,"default",{},()=>[I("i",{class:D(["m-0",a.direction>0?"i-chevron-right group-active:translate-x-1":"i-chevron-left group-active:-translate-x-1"])},null,2)])],8,pe)}const U=R(de,[["render",fe]]),ve=z({__name:"Carousel",props:{as:{default:"ul"},modelValue:{default:1},autoplay:null},emits:["update:modelValue"],setup(o,{expose:n,emit:a}){n();const e=o,s=d(e.modelValue-1);b(O(e,"modelValue"),t=>{s.value=t-1}),b(s,(t,l)=>{t!==l&&a("update:modelValue",t+1)});const r=d(null),{x:i,isScrolling:p,arrivedState:S}=le(r),y=g(()=>S.left),w=g(()=>S.right),m=d([]),B=d(0),P=d(0),V=d(0),j=()=>{B.value=r.value.scrollWidth,P.value=r.value.offsetWidth},A=()=>{const t=[...r.value.children];m.value=t.map(l=>({offsetLeft:l.offsetLeft,width:l.offsetWidth}))},E=t=>{const l=t>0?s.value:s.value+t,M=m.value[l]?.width||0;return M?M*t:0},L=()=>{const t=m.value.findIndex(l=>Math.abs(l.offsetLeft-i.value)<=5);t>-1&&(s.value=t||0)},T=()=>{const t=B.value-P.value;V.value=m.value.findIndex(({offsetLeft:l})=>l>=t-5)};let c=null;const h=()=>{e.autoplay&&(clearTimeout(c),c=setTimeout(()=>{_(1)},e.autoplay))},_=t=>{if(t<0){if(y.value){T(),s.value=V.value-1,_(1);return}}else if(w.value){s.value=1,_(-1);return}const l=E(t);l&&(r.value.scrollBy({left:l,behavior:"smooth"}),h())};b(p,t=>{t?clearTimeout(c):(L(),h())});const N=d(null),F=ie(N);b(F,t=>{t?clearTimeout(c):h()});const W=()=>{r.value&&(j(),A(),L(),T())},k=ue(W,400);X(()=>{W(),Y(()=>{[...r.value.children].forEach(t=>{t.setAttribute("tabindex","0")})}),h(),window.addEventListener("resize",k)}),Z(()=>{window.removeEventListener("resize",k),clearTimeout(c)}),ee(K,{autoplay:O(e,"autoplay"),changeSlide:_,isBoundLeft:y,isBoundRight:w});const H={props:e,emit:a,currentIndex:s,wrapper:r,currentPos:i,isScrolling:p,arrivedState:S,isBoundLeft:y,isBoundRight:w,slidesWidth:m,wrapperScrollWidth:B,wrapperVisibleWidth:P,indexCount:V,calcWrapperWidth:j,calcSlidesWidth:A,calcNextWidth:E,calcCurrentIndex:L,calcIndexCount:T,get autoplayTimer(){return c},set autoplayTimer(t){c=t},restartAutoplay:h,changeSlide:_,carousel:N,isHovered:F,calcOnInit:W,onResize:k,CarouselControl:U};return Object.defineProperty(H,"__isScriptSetup",{enumerable:!1,value:!0}),H}}),me={ref:"carousel","data-carousel":""};function he(o,n,a,e,s,r){return u(),f("div",me,[(u(),$(q(a.as),{ref:"wrapper","data-carousel-wrapper":""},{default:v(()=>[x(o.$slots,"default")]),_:3},512)),x(o.$slots,"controls",te(ae({changeSlide:e.changeSlide,isBoundLeft:e.isBoundLeft,isBoundRight:e.isBoundRight,currentPage:e.currentIndex+1,pageCount:e.indexCount+1})),()=>[C(e.CarouselControl,{direction:-1},{default:v(()=>[x(o.$slots,"previous")]),_:3}),C(e.CarouselControl,null,{default:v(()=>[x(o.$slots,"next")]),_:3})])],512)}const _e=R(ve,[["render",he]]),xe=z({__name:"PitchBar",props:{slides:null},setup(o,{expose:n}){n();const a=o,{parsedContents:e,countValidSlides:s}=ce(a),r={props:a,parsedContents:e,countValidSlides:s,Carousel:_e,CarouselControl:U};return Object.defineProperty(r,"__isScriptSetup",{enumerable:!1,value:!0}),r}}),Ce={class:"bg-base-100 relative z-1"},be={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(o,n,a,e,s,r){return u(),f("div",Ce,[I("div",be,[C(e.Carousel,{autoplay:e.countValidSlides>1?7e3:null},{controls:v(()=>[oe(I("div",Se,[C(e.CarouselControl,{direction:-1,class:"pr-2 bg-base-100 hover:text-base-700"}),C(e.CarouselControl,{class:"pl-2 bg-base-100 hover:text-base-700"})],512),[[G,e.countValidSlides>1]])]),default:v(()=>[(u(!0),f(re,null,ne(a.slides,(i,p)=>(u(),f("li",{key:p},[(u(),$(q(i.href?"ALink":"span"),{href:i.href,target:i.target,class:D(["inline-block px-8",i.href?"hover:underline":null])},{default:v(()=>[e.parsedContents[p]?(u(),f("span",{key:0,innerHTML:e.parsedContents[p],class:"prose text-sm text-base-800"},null,8,ge)):se("",!0)]),_:2},1032,["href","target","class"]))]))),128))]),_:1},8,["autoplay"])])])}const Ie=R(xe,[["render",ye]]);export{Ie as default};
@@ -1 +1 @@
1
- import{m as k}from"./modules-info.80ae4e30.js";import{g,c as S}from"./format-money.6f464cee.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.6da04e63.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.01f8d523.js";import{g,c as S}from"./format-money.060d67ef.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.43eaff51.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.a1302bf9.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.6da04e63.js";import"./modules-info.80ae4e30.js";import"./session-utm.72684b84.js";import"./idle-callback.889bf0ea.js";import"./format-money.6f464cee.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.2bd87845.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.43eaff51.js";import"./modules-info.01f8d523.js";import"./session-utm.72684b84.js";import"./idle-callback.889bf0ea.js";import"./format-money.060d67ef.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};