Skip to content

Commit

Permalink
Merge branch 'feat/email' of https://github.com/weni-ai/weni-integrat…
Browse files Browse the repository at this point in the history
…ions-webapp into feat/email
  • Loading branch information
acnormun committed Nov 1, 2024
2 parents c2de8ee + f23e80a commit 38bb746
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 22 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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 🎉 `
Expand Down
12 changes: 12 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "weni-integrations",
"version": "2.2.7",
"version": "2.2.8",
"private": true,
"type": "module",
"scripts": {
Expand Down
11 changes: 6 additions & 5 deletions src/components/config/ecommerce/vtex/Config.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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({
Expand All @@ -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;
Expand Down
16 changes: 0 additions & 16 deletions src/tests/components/config/ecommerce/vtex/Config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 38bb746

Please sign in to comment.