diff --git a/CHANGELOG.md b/CHANGELOG.md index a221b1cb..ffbd341f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +2.2.8 +---------- +`2024-10-31ยท 1 ๐Ÿ› ยท 1 ๐ŸŽ‰ ` + +### ๐Ÿ› Bug fixes +- Fix: VTEX Config - check vtex ADS prop. +### ๐ŸŽ‰ New Features +- Feat: Added `Content-Security-Policy (CSP)` settings header. + 2.2.7 ---------- `2024-10-24ยท 1 ๐Ÿ› ยท 1 ๐ŸŽ‰ ` diff --git a/nginx.conf b/nginx.conf index 6738f7c6..68478aeb 100644 --- a/nginx.conf +++ b/nginx.conf @@ -25,6 +25,18 @@ http { access_log /dev/stdout main; server { + set $CSP_DEFAULT "default-src 'self' blob:"; + set $CSP_SCRIPT "script-src 'self' 'unsafe-eval' 'unsafe-inline' www.googletagmanager.com accounts.google.com *.hotjar.com www.google-analytics.com cdn.logr-ingest.com"; + set $CSP_STYLE "style-src 'self' 'unsafe-hashes' 'unsafe-inline' ilhasoft.com.br accounts.google.com fonts.googleapis.com"; + set $CSP_FONT "font-src 'self' data: fonts.gstatic.com"; + set $CSP_IMAGE "img-src 'self' data: blob: www.google-analytics.com www.google.com.br www.googletagmanager.com *.amazonaws.com https://tile.openstreetmap.org"; + set $CSP_CONNECT "connect-src 'self' blob: *.weni.ai *.bothub.it accounts.google.com www.google-analytics.com analytics.google.com *.hotjar.io wss://ws.hotjar.com https://cdn.plyr.io"; + set $CSP_FRAME_SRC "frame-src 'self' *.weni.ai https://td.doubleclick.net"; + set $CSP_WORKER_SRC "worker-src data: blob:"; + set $CSP_FRAME_ANCESTORS "frame-ancestors 'self' *.weni.ai"; + + add_header Content-Security-Policy "${CSP_DEFAULT}; ${CSP_SCRIPT}; ${CSP_STYLE}; ${CSP_FONT}; ${CSP_IMAGE}; ${CSP_CONNECT}; ${CSP_FRAME_SRC}; ${CSP_WORKER_SRC}; ${CSP_FRAME_ANCESTORS};"; + listen 8080; server_name localhost; client_max_body_size 32m; diff --git a/package.json b/package.json index 8987b41d..f8bc45f0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "weni-integrations", - "version": "2.2.7", + "version": "2.2.8", "private": true, "type": "module", "scripts": { diff --git a/src/components/config/ecommerce/vtex/Config.vue b/src/components/config/ecommerce/vtex/Config.vue index c8075633..fec089ad 100644 --- a/src/components/config/ecommerce/vtex/Config.vue +++ b/src/components/config/ecommerce/vtex/Config.vue @@ -317,6 +317,12 @@ this.selectedSellers = value; }, async handleSave() { + if (this.appConfig?.vtex_ads !== undefined) { + await this.syncADS({ + uuid: this.appUuid, + payload: { project_uuid: this.project, vtex_ads: this.vtexADS }, + }); + } const sellers = this.selectedSellers.map((item) => item.value); if (sellers.length) { const payloadSync = { @@ -326,10 +332,6 @@ await this.syncSellers({ uuid: this.appUuid, payload: payloadSync }); this.disableSellers = true; } - await this.syncADS({ - uuid: this.appUuid, - payload: { project_uuid: this.project, vtex_ads: this.vtexADS }, - }); if (this.errorSyncSellers) { this.callModal({ @@ -339,7 +341,6 @@ return; } this.callModal({ text: i18n.global.t('vtex.success.sync_sellers'), type: 'success' }); - this.disableSellers = true; }, updateVtexADS(value) { this.vtexADS = value; diff --git a/src/tests/components/config/ecommerce/vtex/Config.spec.js b/src/tests/components/config/ecommerce/vtex/Config.spec.js index c9ff077b..44042686 100644 --- a/src/tests/components/config/ecommerce/vtex/Config.spec.js +++ b/src/tests/components/config/ecommerce/vtex/Config.spec.js @@ -100,22 +100,6 @@ describe('vtex-config Component', () => { }); }); - it('should show an alert when there are no selected sellers during save', async () => { - const unnnicCallAlertSpy = vi.spyOn(unnnic, 'unnnicCallAlert'); - - await wrapper.vm.handleSave(); - - expect(unnnicCallAlertSpy).toHaveBeenCalledWith( - expect.objectContaining({ - props: { - text: 'Failed to redirect to catalog, please refresh the page and try again', - type: 'error', - }, - seconds: 6, - }), - ); - }); - it('should render sellers list correctly when hasConnectedCatalog is true', async () => { wrapper.vm.sellersList = ['Seller 1', 'Seller 2']; await wrapper.vm.$nextTick();