cloudcommerce 2.14.0 → 2.14.2

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 (60) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/ecomplus-stores/barradoce/functions/many/package.json +3 -3
  3. package/ecomplus-stores/barradoce/functions/ssr/package.json +6 -6
  4. package/ecomplus-stores/barradoce/functions/ssr/src/components/ShopHeader.vue +0 -2
  5. package/ecomplus-stores/barradoce/functions/with-apps/package.json +3 -3
  6. package/ecomplus-stores/barradoce/package.json +2 -2
  7. package/package.json +2 -2
  8. package/packages/api/package.json +1 -1
  9. package/packages/apps/affiliate-program/package.json +1 -1
  10. package/packages/apps/correios/package.json +1 -1
  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 +1 -1
  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/flash-courier/package.json +1 -1
  18. package/packages/apps/frenet/package.json +1 -1
  19. package/packages/apps/galaxpay/package.json +1 -1
  20. package/packages/apps/google-analytics/package.json +1 -1
  21. package/packages/apps/jadlog/package.json +1 -1
  22. package/packages/apps/loyalty-points/package.json +1 -1
  23. package/packages/apps/mandae/package.json +1 -1
  24. package/packages/apps/melhor-envio/package.json +1 -1
  25. package/packages/apps/mercadopago/package.json +1 -1
  26. package/packages/apps/pagaleve/package.json +1 -1
  27. package/packages/apps/pagarme/package.json +1 -1
  28. package/packages/apps/pagarme-v5/package.json +1 -1
  29. package/packages/apps/paghiper/package.json +1 -1
  30. package/packages/apps/pix/package.json +1 -1
  31. package/packages/apps/tiny-erp/package.json +1 -1
  32. package/packages/apps/webhooks/package.json +1 -1
  33. package/packages/cli/ci/bunny-config-base.sh +1 -2
  34. package/packages/cli/config/firebase.json +0 -5
  35. package/packages/cli/package.json +1 -1
  36. package/packages/config/package.json +1 -1
  37. package/packages/emails/lib/index.js +11 -10
  38. package/packages/emails/lib/index.js.map +1 -1
  39. package/packages/emails/lib/providers/smtp/index.js +5 -17
  40. package/packages/emails/lib/providers/smtp/index.js.map +1 -1
  41. package/packages/emails/package.json +1 -1
  42. package/packages/emails/src/index.ts +11 -18
  43. package/packages/emails/src/providers/smtp/index.ts +6 -29
  44. package/packages/eslint/package.json +1 -1
  45. package/packages/events/package.json +1 -1
  46. package/packages/feeds/package.json +1 -1
  47. package/packages/firebase/package.json +1 -1
  48. package/packages/i18n/package.json +1 -1
  49. package/packages/modules/package.json +1 -1
  50. package/packages/passport/package.json +1 -1
  51. package/packages/ssr/package.json +2 -2
  52. package/packages/storefront/package.json +2 -2
  53. package/packages/storefront/scripts/build-prod.sh +2 -0
  54. package/packages/storefront/src/lib/components/AccountLink.vue +14 -3
  55. package/packages/storefront/src/lib/scripts/decap-cms.ts +1 -1
  56. package/packages/storefront/src/lib/scripts/vbeta-app.ts +4 -2
  57. package/packages/storefront/src/lib/state/customer-session.ts +16 -11
  58. package/packages/test-base/package.json +1 -1
  59. package/packages/types/package.json +1 -1
  60. package/ecomplus-stores/barradoce/functions/ssr/public/admin/.gitkeep +0 -2
package/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
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
+ ### [2.14.2](https://github.com/ecomplus/cloud-commerce/compare/v2.14.1...v2.14.2) (2024-04-17)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **cli:** Fix bunny.net CI to bypass perma-cache for /app/ (SPA) routes ([739caec](https://github.com/ecomplus/cloud-commerce/commit/739caec3dc0c0e8659f98317d89d6e2faaea05b1))
11
+ * **emails:** Properly settings default email sender (from) and mask sender ([e199706](https://github.com/ecomplus/cloud-commerce/commit/e19970613b66ec258a98024ba5f7f3ac7bd69322))
12
+ * **storefront:** Bump Vue to latest v3.4.23 ([553572d](https://github.com/ecomplus/cloud-commerce/commit/553572d10b30828df207db45024cb123b515ae4f))
13
+ * **storefront:** Minor fix Decap CMS `backend.api_root` with no trailing slash ([81abc3c](https://github.com/ecomplus/cloud-commerce/commit/81abc3c7976d4e596dbc2306b791234bb52ee7d4))
14
+
15
+ ### [2.14.1](https://github.com/ecomplus/cloud-commerce/compare/v2.14.0...v2.14.1) (2024-04-16)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **storefront:** Prevent hydration mismatch with `<AccountLink>` on logged state ([a4d1be9](https://github.com/ecomplus/cloud-commerce/commit/a4d1be9a171fe292794da2b0013f34d9b690a567))
21
+ * **storefront:** Properly set `ecomPassport` session auth for vbeta-app ([a6d8e4e](https://github.com/ecomplus/cloud-commerce/commit/a6d8e4ebf27f134fc29da0ab5025c8bc73431426))
22
+
5
23
  ## [2.14.0](https://github.com/ecomplus/cloud-commerce/compare/v2.13.1...v2.14.0) (2024-04-16)
6
24
 
7
25
 
@@ -15,8 +15,8 @@
15
15
  },
16
16
  "main": "index.js",
17
17
  "dependencies": {
18
- "@cloudcommerce/feeds": "^2.13.1",
19
- "@cloudcommerce/firebase": "^2.13.1",
20
- "@cloudcommerce/passport": "^2.13.1"
18
+ "@cloudcommerce/feeds": "^2.14.1",
19
+ "@cloudcommerce/firebase": "^2.14.1",
20
+ "@cloudcommerce/passport": "^2.14.1"
21
21
  }
22
22
  }
@@ -19,16 +19,16 @@
19
19
  },
20
20
  "main": "index.js",
21
21
  "dependencies": {
22
- "@cloudcommerce/api": "^2.13.1",
23
- "@cloudcommerce/firebase": "^2.13.1",
24
- "@cloudcommerce/ssr": "^2.13.1",
22
+ "@cloudcommerce/api": "^2.14.1",
23
+ "@cloudcommerce/firebase": "^2.14.1",
24
+ "@cloudcommerce/ssr": "^2.14.1",
25
25
  "@headlessui/vue": "^1.7.18",
26
26
  "micromark": "^4.0.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@cloudcommerce/i18n": "^2.13.1",
30
- "@cloudcommerce/storefront": "^2.13.1",
31
- "@cloudcommerce/types": "^2.13.1",
29
+ "@cloudcommerce/i18n": "^2.14.1",
30
+ "@cloudcommerce/storefront": "^2.14.1",
31
+ "@cloudcommerce/types": "^2.14.1",
32
32
  "@iconify-json/mingcute": "^1.1.16",
33
33
  "photoswipe": "^5.4.3"
34
34
  }
@@ -39,8 +39,6 @@
39
39
  opacity-0 transition-opacity lg:z-auto lg:flex lg:opacity-100"
40
40
  :class="isSearchOpen ? 'flex opacity-100' : '-z-10'"
41
41
  >
42
- <div class="hidden w-12 bg-gradient-to-r from-transparent
43
- to-white sm:block"></div>
44
42
  <input
45
43
  ref="searchInput"
46
44
  type="search"
@@ -15,8 +15,8 @@
15
15
  },
16
16
  "main": "index.js",
17
17
  "dependencies": {
18
- "@cloudcommerce/events": "^2.13.1",
19
- "@cloudcommerce/firebase": "^2.13.1",
20
- "@cloudcommerce/modules": "^2.13.1"
18
+ "@cloudcommerce/events": "^2.14.1",
19
+ "@cloudcommerce/firebase": "^2.14.1",
20
+ "@cloudcommerce/modules": "^2.14.1"
21
21
  }
22
22
  }
@@ -26,10 +26,10 @@
26
26
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
27
27
  },
28
28
  "dependencies": {
29
- "@cloudcommerce/cli": "^2.13.1"
29
+ "@cloudcommerce/cli": "^2.14.1"
30
30
  },
31
31
  "devDependencies": {
32
- "@cloudcommerce/eslint": "^2.13.1",
32
+ "@cloudcommerce/eslint": "^2.14.1",
33
33
  "husky": "^9.0.10",
34
34
  "lint-staged": "^15.2.2"
35
35
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloudcommerce",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
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>",
@@ -36,7 +36,7 @@
36
36
  "vite": "^5.2.8",
37
37
  "vitest": "^1.5.0",
38
38
  "zx": "^7.2.3",
39
- "@cloudcommerce/eslint": "2.14.0"
39
+ "@cloudcommerce/eslint": "2.14.2"
40
40
  },
41
41
  "scripts": {
42
42
  "fix-install": "bash scripts/pre-install.sh && pnpm i",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/api",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
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-affiliate-program",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce app for simple affiliate program",
6
6
  "main": "lib/index.js",
7
7
  "files": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-correios",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce app for Correios shipping calculation",
6
6
  "main": "lib/index.js",
7
7
  "files": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-custom-payment",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce app for simple custom payment methods",
6
6
  "main": "lib/index.js",
7
7
  "files": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-custom-shipping",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce app for custom shipping methods",
6
6
  "main": "lib/custom-shipping.js",
7
7
  "files": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-datafrete",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
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": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce app for complex discount rules",
6
6
  "main": "lib/discounts.js",
7
7
  "files": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-emails",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce default transactional email app",
6
6
  "main": "lib/index.js",
7
7
  "files": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-fb-conversions",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
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
  "files": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-flash-courier",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce app to integrate Flash Courier",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-frenet",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce app for Frenet shipping calculation",
6
6
  "main": "lib/frenet.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-galaxpay",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
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": "2.14.0",
4
+ "version": "2.14.2",
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
  "files": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-jadlog",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce app for Jadlog shipping calculation",
6
6
  "main": "lib/index.js",
7
7
  "files": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-loyalty-points",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce app to handle simple loyalty points programs",
6
6
  "main": "lib/loyalty-points.js",
7
7
  "files": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-mandae",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce app to integrate Mandaê shipping intermediator",
6
6
  "main": "lib/index.js",
7
7
  "files": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-melhor-envio",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce app to integrate Melhor Envio",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-mercadopago",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce app to integrate Mercado Pago",
6
6
  "main": "lib/mercadopago.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-pagaleve",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce app to integrate Pagaleve",
6
6
  "main": "lib/pagaleve.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-pagarme",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
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-pagarme-v5",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce app to integrate Pagar.me API v5 with recurring payments",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-paghiper",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
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": "2.14.0",
4
+ "version": "2.14.2",
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": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce app for Tiny ERP",
6
6
  "main": "lib/tiny-erp.js",
7
7
  "files": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-webhooks",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce app for general order webhooks",
6
6
  "main": "lib/index.js",
7
7
  "files": [
@@ -154,7 +154,6 @@ configure_edge_rule "APIs bypass CDN cache" '
154
154
  "PatternMatches": [
155
155
  "*/_api/*",
156
156
  "*.xml",
157
- "*/.*/git/*",
158
157
  "*/admin/*",
159
158
  "*/~*"
160
159
  ],
@@ -179,7 +178,7 @@ configure_edge_rule "APIs bypass perma-cache" '
179
178
  "PatternMatches": [
180
179
  "*/_api/*",
181
180
  "*.xml",
182
- "*/.*/git/*",
181
+ "*/app/*",
183
182
  "*/admin/*",
184
183
  "*/~*"
185
184
  ],
@@ -76,11 +76,6 @@
76
76
  "function": "feeds",
77
77
  "region": "us-east4"
78
78
  },
79
- {
80
- "source": "/.*/git/**",
81
- "function": "feeds",
82
- "region": "us-east4"
83
- },
84
79
  {
85
80
  "source": "**/!(*(*.)ico|*(*.)png|*(*.)map)",
86
81
  "function": "ssr",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/cli",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce CLI tools",
6
6
  "bin": {
7
7
  "cloudcommerce": "./bin/run.mjs"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/config",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce base config",
6
6
  "main": "lib/config.js",
7
7
  "exports": {
@@ -11,18 +11,13 @@ const sendEmail = (emailData) => {
11
11
  const {
12
12
  MAIL_SENDER, MAIL_SENDER_NAME, MAIL_REPLY_TO, SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS, SMTP_TLS, SENDGRID_API_KEY,
13
13
  } = process.env;
14
+ const { settingsContent } = config.get();
14
15
  const {
15
16
  templateData, templateId, template, to, subject, cc, sender, bcc, text, html,
16
17
  } = emailData;
17
- const { settingsContent } = config.get();
18
- const senderEmail = MAIL_SENDER || settingsContent.email;
19
- const senderName = MAIL_SENDER_NAME || settingsContent.name;
20
18
  if (!templateId && !template && !html) {
21
19
  throw new Error('TemplateId, template or html not found');
22
20
  }
23
- if (!senderEmail) {
24
- throw new Error('Sender email not configured');
25
- }
26
21
  const emailHeaders = {
27
22
  to,
28
23
  subject,
@@ -30,13 +25,19 @@ const sendEmail = (emailData) => {
30
25
  sender,
31
26
  bcc,
32
27
  from: {
33
- name: senderName,
34
- email: senderEmail,
28
+ name: MAIL_SENDER_NAME || settingsContent.name,
29
+ email: MAIL_SENDER || 'lojas@e-com.plus',
35
30
  },
36
31
  };
32
+ if (!MAIL_SENDER && !emailHeaders.sender) {
33
+ emailHeaders.sender = {
34
+ email: settingsContent.email,
35
+ name: settingsContent.name,
36
+ };
37
+ }
37
38
  if (MAIL_REPLY_TO) {
38
39
  emailHeaders.replyTo = {
39
- name: senderName,
40
+ name: settingsContent.name,
40
41
  email: MAIL_REPLY_TO,
41
42
  };
42
43
  }
@@ -68,7 +69,7 @@ const sendEmail = (emailData) => {
68
69
  template,
69
70
  });
70
71
  }
71
- throw new Error('Provider settings or smtp not found');
72
+ throw new Error('Provider settings or SMTP not found');
72
73
  };
73
74
  const sendGrid = {
74
75
  send: sendEmailSendGrid,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,MAAM,MAAM,oCAAoC,CAAC;AACxD,OAAO,aAAa,EAAE,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,iBAAiB,MAAM,4BAA4B,CAAC;AAE3D,0CAA0C;AAC1C,IAAI,UAAkC,CAAC;AAEvC,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAE,EAAE;IAC3C,OAAO,CAAC,GAAG,CAAC,gBAAgB,GAAG,MAAM,CAAC;AACxC,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAChB,SAWC,EACD,EAAE;IACF,MAAM,EACJ,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAA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;QACzD,OAAO,iBAAiB,CACtB,YAAY,EACZ;YACE,YAAY;YACZ,UAAU;YACV,QAAQ;YACR,IAAI;SACL,CACF,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,UAAU,IAAI,SAAS,IAAI,SAAS,IAAI,SAAS,IAAI,SAAS,EAAE,CAAC;QACpE,MAAM,IAAI,GAAG,QAAQ,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QACrC,MAAM,MAAM,GAAG,QAAQ,IAAI,QAAQ,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC;QACnF,+CAA+C;QAC/C,UAAU,GAAG;YACX,IAAI,EAAE,SAAS;YACf,IAAI;YACJ,MAAM;YACN,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;SAC3C,CAAC;QACF,aAAa,CAAC,UAAU,CAAC,CAAC;IAC5B,CAAC;IACD,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,UAAU,EAAE,CAAC;QACrC,OAAO,aAAa,CAClB,YAAY,EACZ;YACE,IAAI;YACJ,IAAI;YACJ,YAAY;YACZ,QAAQ;SACT,CACF,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;AACzD,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG;IACf,IAAI,EAAE,iBAAiB;IACvB,SAAS,EAAE,iBAAiB;CAE7B,CAAC;AAEF,MAAM,IAAI,GAAG;IACX,IAAI,EAAE,aAAa;IACnB,SAAS,EAAE,aAAa;CACzB,CAAC;AAEF,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAEnC,OAAO,EACL,SAAS,EACT,QAAQ,EACR,IAAI,GACL,CAAC"}
@@ -32,36 +32,24 @@ const sendEmail = async (emailHeaders, dataOptions) => {
32
32
  if (!html) {
33
33
  throw new Error(`Email body for template: #${template}, not found`);
34
34
  }
35
- // send mail with defined transport object
36
35
  const mailOptions = {
37
36
  from: `"${from.name}" <${from.email}>`,
38
37
  to: parseEmailsToString(to),
39
38
  subject: emailHeaders.subject,
40
39
  html,
40
+ text,
41
41
  };
42
- if (text) {
43
- Object.assign(mailOptions, text);
44
- }
45
42
  if (emailHeaders.sender) {
46
- Object.assign(mailOptions, {
47
- sender: `"${emailHeaders.sender.name}" <${emailHeaders.sender.email}>`,
48
- });
43
+ mailOptions.sender = `"${emailHeaders.sender.name}" <${emailHeaders.sender.email}>`;
49
44
  }
50
45
  if (emailHeaders.cc) {
51
- Object.assign(mailOptions, {
52
- cc: parseEmailsToString(emailHeaders.cc),
53
- });
46
+ mailOptions.cc = parseEmailsToString(emailHeaders.cc);
54
47
  }
55
48
  if (emailHeaders.bcc) {
56
- Object.assign(mailOptions, {
57
- bcc: parseEmailsToString(emailHeaders.bcc),
58
- });
49
+ mailOptions.bcc = parseEmailsToString(emailHeaders.bcc);
59
50
  }
60
51
  if (emailHeaders.replyTo) {
61
- const replyTo = parseEmailsToString(emailHeaders.replyTo);
62
- Object.assign(mailOptions, {
63
- replyTo,
64
- });
52
+ mailOptions.replyTo = parseEmailsToString(emailHeaders.replyTo);
65
53
  }
66
54
  if (!transporter && smtpConfig) {
67
55
  setConfigSmtp(smtpConfig);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/providers/smtp/index.ts"],"names":[],"mappings":"AAQA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,mBAAmB,MAAM,8BAA8B,CAAC;AAE/D,MAAM,mBAAmB,GAAG,CAAC,MAAqC,EAAE,EAAE;IACpE,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,KAAa,EAAE,YAA0B,EAAE,EAAE;YACjE,OAAO,GAAG,KAAK,KAAK,YAAY,CAAC,KAAK,EAAE,CAAC;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,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACrD,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;IACnE,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;AACrD,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC;AAEzB,OAAO,EACL,aAAa,GACd,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/emails",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce email sender",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -41,7 +41,7 @@ const sendEmail = (
41
41
  SMTP_TLS,
42
42
  SENDGRID_API_KEY,
43
43
  } = process.env;
44
-
44
+ const { settingsContent } = config.get();
45
45
  const {
46
46
  templateData,
47
47
  templateId,
@@ -54,18 +54,9 @@ const sendEmail = (
54
54
  text,
55
55
  html,
56
56
  } = emailData;
57
-
58
- const { settingsContent } = config.get();
59
- const senderEmail = MAIL_SENDER || settingsContent.email;
60
- const senderName = MAIL_SENDER_NAME || settingsContent.name;
61
-
62
57
  if (!templateId && !template && !html) {
63
58
  throw new Error('TemplateId, template or html not found');
64
59
  }
65
- if (!senderEmail) {
66
- throw new Error('Sender email not configured');
67
- }
68
-
69
60
  const emailHeaders: EmailHeaders = {
70
61
  to,
71
62
  subject,
@@ -73,17 +64,22 @@ const sendEmail = (
73
64
  sender,
74
65
  bcc,
75
66
  from: {
76
- name: senderName,
77
- email: senderEmail,
67
+ name: MAIL_SENDER_NAME || settingsContent.name,
68
+ email: MAIL_SENDER || 'lojas@e-com.plus',
78
69
  },
79
70
  };
71
+ if (!MAIL_SENDER && !emailHeaders.sender) {
72
+ emailHeaders.sender = {
73
+ email: settingsContent.email,
74
+ name: settingsContent.name,
75
+ };
76
+ }
80
77
  if (MAIL_REPLY_TO) {
81
78
  emailHeaders.replyTo = {
82
- name: senderName,
79
+ name: settingsContent.name,
83
80
  email: MAIL_REPLY_TO,
84
81
  };
85
82
  }
86
-
87
83
  if ((templateId || template || html) && SENDGRID_API_KEY) {
88
84
  return sendEmailSendGrid(
89
85
  emailHeaders,
@@ -95,7 +91,6 @@ const sendEmail = (
95
91
  },
96
92
  );
97
93
  }
98
-
99
94
  if (!smtpConfig && SMTP_HOST && SMTP_PORT && SMTP_USER && SMTP_PASS) {
100
95
  const port = parseInt(SMTP_PORT, 10);
101
96
  const secure = SMTP_TLS && SMTP_TLS.toUpperCase() === 'TRUE' ? true : port === 465;
@@ -108,7 +103,6 @@ const sendEmail = (
108
103
  };
109
104
  setConfigSmtp(smtpConfig);
110
105
  }
111
-
112
106
  if ((template || html) && smtpConfig) {
113
107
  return sendEmailSmpt(
114
108
  emailHeaders,
@@ -120,8 +114,7 @@ const sendEmail = (
120
114
  },
121
115
  );
122
116
  }
123
-
124
- throw new Error('Provider settings or smtp not found');
117
+ throw new Error('Provider settings or SMTP not found');
125
118
  };
126
119
 
127
120
  const sendGrid = {
@@ -44,63 +44,40 @@ const sendEmail = async (
44
44
  } = dataOptions;
45
45
  let { html } = dataOptions;
46
46
  const { from, to } = emailHeaders;
47
-
48
47
  if (!template && !html) {
49
48
  throw new Error('Template or html not found');
50
49
  }
51
-
52
50
  if (template && !templateData) {
53
51
  throw new Error('Data for template not found');
54
52
  }
55
-
56
53
  if (template && templateData) {
57
54
  html = parseTemplateToHtml(templateData, template);
58
55
  }
59
-
60
56
  if (!html) {
61
57
  throw new Error(`Email body for template: #${template}, not found`);
62
58
  }
63
-
64
- // send mail with defined transport object
65
- const mailOptions = {
59
+ const mailOptions: SMTPTransport.MailOptions = {
66
60
  from: `"${from.name}" <${from.email}>`,
67
61
  to: parseEmailsToString(to),
68
62
  subject: emailHeaders.subject,
69
63
  html,
64
+ text,
70
65
  };
71
- if (text) {
72
- Object.assign(mailOptions, text);
73
- }
74
-
75
66
  if (emailHeaders.sender) {
76
- Object.assign(mailOptions, {
77
- sender: `"${emailHeaders.sender.name}" <${emailHeaders.sender.email}>`,
78
- });
67
+ mailOptions.sender = `"${emailHeaders.sender.name}" <${emailHeaders.sender.email}>`;
79
68
  }
80
-
81
69
  if (emailHeaders.cc) {
82
- Object.assign(mailOptions, {
83
- cc: parseEmailsToString(emailHeaders.cc),
84
- });
70
+ mailOptions.cc = parseEmailsToString(emailHeaders.cc);
85
71
  }
86
-
87
72
  if (emailHeaders.bcc) {
88
- Object.assign(mailOptions, {
89
- bcc: parseEmailsToString(emailHeaders.bcc),
90
- });
73
+ mailOptions.bcc = parseEmailsToString(emailHeaders.bcc);
91
74
  }
92
-
93
75
  if (emailHeaders.replyTo) {
94
- const replyTo = parseEmailsToString(emailHeaders.replyTo);
95
- Object.assign(mailOptions, {
96
- replyTo,
97
- });
76
+ mailOptions.replyTo = parseEmailsToString(emailHeaders.replyTo);
98
77
  }
99
-
100
78
  if (!transporter && smtpConfig) {
101
79
  setConfigSmtp(smtpConfig);
102
80
  }
103
-
104
81
  if (transporter) {
105
82
  const info = await transporter.sendMail(mailOptions);
106
83
  return { status: 202, message: `messageId: #${info.messageId}` };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/eslint",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce ESLint config",
6
6
  "main": "lib/index.js",
7
7
  "files": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/events",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
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/feeds",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce catalog feeds",
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": "2.14.0",
4
+ "version": "2.14.2",
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": "2.14.0",
4
+ "version": "2.14.2",
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": "2.14.0",
4
+ "version": "2.14.2",
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": "2.14.0",
4
+ "version": "2.14.2",
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": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce storefront SSR",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -44,7 +44,7 @@
44
44
  "firebase-admin": "^12.0.0",
45
45
  "firebase-functions": "^4.9.0",
46
46
  "mitt": "^3.0.1",
47
- "vue": "^3.4.21",
47
+ "vue": "^3.4.23",
48
48
  "yaml": "^2.4.1"
49
49
  },
50
50
  "devDependencies": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/storefront",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce storefront with Astro",
6
6
  "bin": {
7
7
  "storefront": "./scripts/build-prod.sh"
@@ -65,7 +65,7 @@
65
65
  "tailwindcss": "^3.4.3",
66
66
  "unocss": "^0.58.9",
67
67
  "unplugin-auto-import": "^0.17.5",
68
- "vue": "^3.4.21",
68
+ "vue": "^3.4.23",
69
69
  "wade": "0.3.3",
70
70
  "yaml": "^2.4.1"
71
71
  },
@@ -11,6 +11,8 @@ mv ./.cloudcommerce/sf-tmp-dist/_astro/*.{png,jpg,jpeg,webp,avif,svg} \
11
11
  2>/dev/null
12
12
  mv ./.cloudcommerce/sf-tmp-dist/~fallback/index.html ./dist/client/~fallback.html
13
13
  mv ./.cloudcommerce/sf-tmp-dist/index.html ./dist/client/~index.html
14
+ mv ./.cloudcommerce/sf-tmp-dist/app/ ./dist/client/
15
+ mv ./.cloudcommerce/sf-tmp-dist/admin/ ./dist/client/
14
16
  rm -rf ./.cloudcommerce/sf-tmp-dist
15
17
 
16
18
  identify -format "%f,%w,%h\n" \
@@ -1,5 +1,10 @@
1
1
  <script setup lang="ts">
2
- import { ref, computed, nextTick } from 'vue';
2
+ import {
3
+ ref,
4
+ computed,
5
+ nextTick,
6
+ onMounted,
7
+ } from 'vue';
3
8
  import { isLogged } from '@@sf/state/customer-session';
4
9
 
5
10
  export interface Props {
@@ -18,9 +23,13 @@ if (globalThis.location?.href) {
18
23
  locationUrl.value = globalThis.location.href;
19
24
  });
20
25
  }
26
+ const isMounted = ref(false);
27
+ onMounted(() => { isMounted.value = true; });
21
28
  const href = computed(() => {
22
29
  const returnUrl = props.returnUrl || locationUrl.value;
23
- const loggedTo = !isLogged.value ? null : (props.to || 'account');
30
+ const loggedTo = isMounted.value && isLogged.value
31
+ ? (props.to || 'account')
32
+ : null;
24
33
  if (!loggedTo) {
25
34
  let { loginUrl } = props;
26
35
  if (props.isSignUp) {
@@ -28,7 +37,9 @@ const href = computed(() => {
28
37
  } else {
29
38
  loginUrl += '?';
30
39
  }
31
- return returnUrl ? `${loginUrl}return_url=${returnUrl}` : loginUrl;
40
+ return returnUrl
41
+ ? `${loginUrl}return_url=${returnUrl}`
42
+ : `${loginUrl}#/account/${props.to || ''}`;
32
43
  }
33
44
  const { settings } = globalThis.$storefront;
34
45
  if (loggedTo === 'orders' && settings.ordersUrl) {
@@ -64,7 +64,7 @@ const authAndInitCms = async () => {
64
64
  }
65
65
  cmsConfig.backend = {
66
66
  repo: GIT_REPO || '_owner/_name',
67
- api_root: `https://ecomplus.app/api/${ECOM_STORE_ID}/git/github/`,
67
+ api_root: `https://ecomplus.app/api/${ECOM_STORE_ID}/git/github`,
68
68
  name: 'github',
69
69
  base_url: `https://${location.hostname}`,
70
70
  auth_endpoint: location.pathname, // self
@@ -218,7 +218,7 @@ if (!import.meta.env.SSR) {
218
218
  if (isAuthenticated.value) {
219
219
  ecomPassport.setSession({
220
220
  auth: {
221
- ...session.auth,
221
+ token: session.auth,
222
222
  id: session.auth?.customer_id,
223
223
  level: 3,
224
224
  },
@@ -242,7 +242,9 @@ if (!import.meta.env.SSR) {
242
242
  ecomPassport.on('logout', () => {
243
243
  if (isAuthenticated.value) {
244
244
  logout();
245
- window.location.href = '/';
245
+ watch(isAuthenticated, () => {
246
+ window.location.href = '/';
247
+ }, { once: true });
246
248
  }
247
249
  });
248
250
  }, 400);
@@ -2,7 +2,7 @@ import type { Customers } from '@cloudcommerce/api/types';
2
2
  import type { Auth } from 'firebase/auth';
3
3
  import api from '@cloudcommerce/api';
4
4
  import { nickname as getNickname } from '@ecomplus/utils';
5
- import { ref, computed } from 'vue';
5
+ import { ref, computed, watch } from 'vue';
6
6
  import { requestIdleCallback } from '@@sf/sf-lib';
7
7
  import useStorage from '@@sf/state/use-storage';
8
8
 
@@ -40,18 +40,10 @@ const customerEmail = computed({
40
40
  },
41
41
  });
42
42
 
43
- let firebaseAuth: Auth;
43
+ let firebaseAuth: Auth | undefined;
44
44
  const isLogged = computed(() => {
45
45
  return isAuthenticated.value || !!firebaseAuth?.currentUser?.emailVerified;
46
46
  });
47
- const logout = () => {
48
- firebaseAuth.signOut().then(() => {
49
- session.auth = emptySession.auth;
50
- session.customer = emptySession.customer;
51
- localStorage.removeItem(storageKey);
52
- });
53
- };
54
-
55
47
  const throwNoAuth = (msg = 'Not authenticated') => {
56
48
  const err: any = new Error(msg);
57
49
  err.isNoAuth = true;
@@ -59,7 +51,7 @@ const throwNoAuth = (msg = 'Not authenticated') => {
59
51
  };
60
52
 
61
53
  const authenticate = async () => {
62
- const authToken = await firebaseAuth.currentUser?.getIdToken();
54
+ const authToken = await firebaseAuth?.currentUser?.getIdToken();
63
55
  if (!authToken) {
64
56
  throwNoAuth('Can\'t get Firebase user ID token');
65
57
  return;
@@ -155,6 +147,19 @@ const initializeFirebaseAuth = (canWaitIdle?: boolean) => {
155
147
  }
156
148
  };
157
149
 
150
+ const logout = () => {
151
+ if (!firebaseAuth) {
152
+ initializeFirebaseAuth();
153
+ watch(isAuthReady, () => logout(), { once: true });
154
+ return;
155
+ }
156
+ firebaseAuth.signOut().then(() => {
157
+ session.auth = emptySession.auth;
158
+ session.customer = emptySession.customer;
159
+ localStorage.removeItem(storageKey);
160
+ });
161
+ };
162
+
158
163
  export default session;
159
164
 
160
165
  export {
@@ -2,7 +2,7 @@
2
2
  "name": "@cloudcommerce/test-base",
3
3
  "private": true,
4
4
  "type": "module",
5
- "version": "2.14.0",
5
+ "version": "2.14.2",
6
6
  "description": "e-com.plus Cloud Commerce basic setup for testing",
7
7
  "main": "lib/index.js",
8
8
  "files": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/types",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.2",
5
5
  "description": "e-com.plus Cloud Commerce reusable type definitions",
6
6
  "main": "index.ts",
7
7
  "files": [
@@ -1,2 +0,0 @@
1
- #index.html
2
- #assets/