Skip to content

Commit e486f31

Browse files
Merge pull request #1267 from FromDoppler/DOP-1901-add-idThirdPartyApp-param
DOP-1901 - add id third party app param at getsettings request
2 parents c166e1a + 7fbbf4b commit e486f31

8 files changed

Lines changed: 80 additions & 50 deletions

File tree

cspell-project-words.txt

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# code
2-
CONV
3-
GETUTCDATE
4-
MSYS
5-
NZEC
6-
PATHCONV
72
appsettings
3+
CONV
84
duplicatable
95
endregion
106
executesql
117
getTTFB
8+
GETUTCDATE
129
hideable
1310
iframe
11+
MSYS
1412
nvarchar
13+
NZEC
1514
onclick
1615
ondragstart
16+
PATHCONV
1717
preheader
1818
testid
1919
valign
@@ -23,33 +23,33 @@ accountname
2323
ContentXFIeld
2424
doppler
2525
dopplerdock
26+
dp-btnsearch
27+
dp-rowflex
28+
dpicon
2629
dplr
30+
emailtransaccional
31+
firstname
2732
fromdoppler
33+
iconapp
34+
lastname
2835
mseditor
2936
mydplr
30-
socialshare
31-
spanish
32-
undoredo
33-
firstname
34-
lastname
3537
omnicanalidad
36-
emailtransaccional
37-
dp-btnsearch
38-
dp-rowflex
39-
dpicon
40-
iconapp
4138
prefixe
4239
PROMOCODE
40+
socialshare
41+
spanish
42+
undoredo
4343

4444
# Technical terms
4545
automerge
4646
entitize
47+
entrypoints
48+
forbbiden
49+
gdpr
4750
Liskov
4851
nofile
4952
webfonts
50-
entrypoints
51-
gdpr
52-
forbbiden
5353

5454
# our services and providers
5555
aspnet
@@ -61,29 +61,30 @@ dotnet
6161
eclint
6262
esnext
6363
firefox
64+
FormatjsIntl
6465
gitlint
6566
hadolint
6667
hellang
6768
jenkins
6869
jenkinsfile
6970
jorisroovers
71+
Jumpseller
7072
koalaman
7173
linkedin
7274
loggly
7375
openssh
7476
pinterest
7577
react-cool-onclickoutside
78+
react-infinite-scroller
7679
serilog
7780
shellcheck
7881
swashbuckle
7982
tanstack
83+
Thirdparty
84+
Tiendanube
8085
ttionya
8186
unlayer
82-
whatsapp
83-
xunit
84-
react-infinite-scroller
85-
FormatjsIntl
86-
Tiendanube
87-
Jumpseller
8887
VTEX
88+
whatsapp
8989
Woocomerce
90+
xunit

src/abstractions/doppler-legacy-client/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export interface DopplerLegacyClient {
6060
getEditorSettings: (
6161
idCampaign?: string,
6262
idTemplate?: string,
63+
idThirdpartyApp?: string,
6364
) => Promise<Result<DopplerEditorSettings>>;
6465
getPromoCodes: ({
6566
store,

src/components/UnlayerEditorWrapper.test.tsx

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { UnlayerEditorWrapper } from "./UnlayerEditorWrapper";
99
import { TestDopplerIntlProvider } from "./i18n/TestDopplerIntlProvider";
1010
import { AssetManifestClient } from "../abstractions/asset-manifest-client";
1111
import { MfeLoaderAssetManifestClientImpl } from "../implementations/MfeLoaderAssetManifestClientImpl";
12+
import { MemoryRouter } from "react-router-dom";
1213

1314
const emailEditorPropsTestId = "EmailEditor_props";
1415

@@ -92,18 +93,22 @@ describe(UnlayerEditorWrapper.name, () => {
9293

9394
// Act
9495
render(
95-
<QueryClientProvider client={queryClient}>
96-
<AppServicesProvider appServices={appServices}>
97-
<TestDopplerIntlProvider>
98-
<AppSessionStateContext.Provider value={authenticatedSession}>
99-
<UnlayerEditorWrapper
100-
setUnlayerEditorObject={jest.fn()}
101-
hidden={true}
102-
/>
103-
</AppSessionStateContext.Provider>
104-
</TestDopplerIntlProvider>
105-
</AppServicesProvider>
106-
</QueryClientProvider>,
96+
<MemoryRouter
97+
initialEntries={["/editors/campaigns/36371440?idThirdPartyApp=1"]}
98+
>
99+
<QueryClientProvider client={queryClient}>
100+
<AppServicesProvider appServices={appServices}>
101+
<TestDopplerIntlProvider>
102+
<AppSessionStateContext.Provider value={authenticatedSession}>
103+
<UnlayerEditorWrapper
104+
setUnlayerEditorObject={jest.fn()}
105+
hidden={true}
106+
/>
107+
</AppSessionStateContext.Provider>
108+
</TestDopplerIntlProvider>
109+
</AppServicesProvider>
110+
</QueryClientProvider>
111+
</MemoryRouter>,
107112
);
108113

109114
// Assert
@@ -161,16 +166,22 @@ describe(UnlayerEditorWrapper.name, () => {
161166

162167
// Act
163168
render(
164-
<QueryClientProvider client={queryClient}>
165-
<AppServicesProvider appServices={appServices}>
166-
<TestDopplerIntlProvider>
167-
<UnlayerEditorWrapper
168-
setUnlayerEditorObject={jest.fn()}
169-
hidden={true}
170-
/>
171-
</TestDopplerIntlProvider>
172-
</AppServicesProvider>
173-
</QueryClientProvider>,
169+
<MemoryRouter
170+
initialEntries={["/editors/campaigns/36371440?idThirdPartyApp=1"]}
171+
>
172+
<QueryClientProvider client={queryClient}>
173+
<AppServicesProvider appServices={appServices}>
174+
<TestDopplerIntlProvider>
175+
<AppSessionStateContext.Provider value={authenticatedSession}>
176+
<UnlayerEditorWrapper
177+
setUnlayerEditorObject={jest.fn()}
178+
hidden={true}
179+
/>
180+
</AppSessionStateContext.Provider>
181+
</TestDopplerIntlProvider>
182+
</AppServicesProvider>
183+
</QueryClientProvider>
184+
</MemoryRouter>,
174185
);
175186

176187
// Assert

src/components/UnlayerEditorWrapper.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { promisifyProps } from "../utils";
1616
import { useCustomFields } from "./useCustomFields";
1717
import { useGetEditorSettings } from "../queries/editor-settings-queries";
1818
import { keyBy } from "lodash";
19-
import { useParams } from "react-router-dom";
19+
import { useParams, useLocation } from "react-router-dom";
2020

2121
const prepareUnlayerEditorObject = (
2222
editorObject: Editor,
@@ -48,7 +48,15 @@ export const UnlayerEditorWrapper = ({
4848
idCampaign: string;
4949
idTemplate: string;
5050
}>;
51-
const editorSettings = useGetEditorSettings(idCampaign, idTemplate);
51+
52+
const location = useLocation();
53+
const searchParams = new URLSearchParams(location.search);
54+
const idThirdPartyApp = searchParams.get("idThirdPartyApp") ?? "";
55+
const editorSettings = useGetEditorSettings(
56+
idCampaign,
57+
idTemplate,
58+
idThirdPartyApp,
59+
);
5260
const userFieldsQuery = useGetUserFields();
5361
const mergeTags = keyBy(
5462
useCustomFields(userFieldsQuery.data) || [],

src/implementations/DopplerLegacyClientImpl.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ describe(DopplerLegacyClientImpl.name, () => {
422422
withCredentials: true,
423423
});
424424
expect(axiosGet).toBeCalledWith(
425-
"/MSEditor/Editor/GetSettings?idCampaign=0&idTemplate=0",
425+
"/MSEditor/Editor/GetSettings?idCampaign=0&idTemplate=0&idThirdpartyApp=0",
426426
);
427427
});
428428

src/implementations/DopplerLegacyClientImpl.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,17 @@ export class DopplerLegacyClientImpl implements DopplerLegacyClient {
248248
}
249249
}
250250

251-
async getEditorSettings(idCampaign?: string, idTemplate?: string) {
251+
async getEditorSettings(
252+
idCampaign?: string,
253+
idTemplate?: string,
254+
idThirdpartyApp?: string,
255+
) {
252256
// fix to resolve call GetSettings with both parameter
253257
const _idTemplate = idCampaign && idCampaign !== "0" ? "0" : idTemplate;
254258
const queryString = new URLSearchParams({
255259
idCampaign: idCampaign || "0",
256260
idTemplate: _idTemplate || "0",
261+
idThirdpartyApp: idThirdpartyApp || "0",
257262
});
258263

259264
const response = await this.axios.get(

src/implementations/dummies/doppler-legacy-client.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ export class DummyDopplerLegacyClient implements DopplerLegacyClient {
264264
crossSellingEnabled: false,
265265
rssCampaign: false,
266266
rssShowPreview: false,
267+
productDynamic: false,
267268
isUnlayerExportHTMLEnabled: true,
268269
stores: [
269270
{
@@ -423,6 +424,7 @@ export class DummyDopplerLegacyClient implements DopplerLegacyClient {
423424
value: {
424425
items,
425426
continuation: newContinuation,
427+
source: "",
426428
},
427429
};
428430

src/queries/editor-settings-queries.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { DopplerEditorSettings } from "../abstractions/domain/DopplerEditorSetti
55
export const useGetEditorSettings = (
66
idCampaign?: string,
77
idTemplate?: string,
8+
idThirdPartyApp?: string,
89
) => {
910
const { dopplerLegacyClient } = useAppServices();
1011

@@ -18,6 +19,7 @@ export const useGetEditorSettings = (
1819
const result = await dopplerLegacyClient.getEditorSettings(
1920
idCampaign,
2021
idTemplate,
22+
idThirdPartyApp,
2123
);
2224
return result.value;
2325
};

0 commit comments

Comments
 (0)