@capillarytech/creatives-library 9.0.69 → 9.0.70-alpha.sprint-cap-213712.13
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.
package/package.json
CHANGED
|
@@ -1203,8 +1203,8 @@ export class Creatives extends React.Component {
|
|
|
1203
1203
|
const { Templates, templateData: templateDataProps } = this.props;
|
|
1204
1204
|
const { accountDetails: selectedAccountDetails, accountId: selectedAccountId } = templateDataProps || {};
|
|
1205
1205
|
const selectedLineAccount = Templates && Templates.selectedLineAccount;
|
|
1206
|
-
const accountDetails =
|
|
1207
|
-
const accountId =
|
|
1206
|
+
const accountDetails = (selectedLineAccount ? JSON.stringify(selectedLineAccount) : selectedAccountDetails);
|
|
1207
|
+
const accountId = (selectedLineAccount ? selectedLineAccount.id : '') || selectedAccountId || '';
|
|
1208
1208
|
templateData = {
|
|
1209
1209
|
channel,
|
|
1210
1210
|
accountId,
|
|
@@ -1219,7 +1219,7 @@ export class Creatives extends React.Component {
|
|
|
1219
1219
|
const { accountDetails: selectedAccountDetails, accountId: selectedAccountId } = templateDataProps || {};
|
|
1220
1220
|
const selectedViberAccount = Templates && Templates.selectedViberAccount;
|
|
1221
1221
|
const accountDetails = (selectedViberAccount ? JSON.stringify(selectedViberAccount) : selectedAccountDetails);
|
|
1222
|
-
const accountId =
|
|
1222
|
+
const accountId = (selectedViberAccount ? selectedViberAccount.id : '') || selectedAccountId || '';
|
|
1223
1223
|
const { versions } = template.value;
|
|
1224
1224
|
const content = cloneDeep(versions.base.content);
|
|
1225
1225
|
content.scenarioKey = accountDetails ? get(JSON.parse(accountDetails), 'configs.scenario_key') : "";
|
|
@@ -1237,7 +1237,7 @@ export class Creatives extends React.Component {
|
|
|
1237
1237
|
const selectedWhatsappAccount = Templates?.selectedWhatsappAccount;
|
|
1238
1238
|
const { accountDetails: selectedAccountDetails, accountId: selectedAccountId } = templateDataProps || {};
|
|
1239
1239
|
const accountDetails = (selectedWhatsappAccount || selectedAccountDetails);
|
|
1240
|
-
const accountId =
|
|
1240
|
+
const accountId = selectedWhatsappAccount?.id || selectedAccountId || '';
|
|
1241
1241
|
const { versions } = template.value;
|
|
1242
1242
|
const {
|
|
1243
1243
|
languages = [{}],
|
|
@@ -139,6 +139,26 @@ describe('Test SlideBoxContent container', () => {
|
|
|
139
139
|
expect(getCreativesData).toHaveBeenCalledTimes(2);
|
|
140
140
|
});
|
|
141
141
|
|
|
142
|
+
it('WhatsApp getCreativesData prefers the live-selected account id over a stale carried-over accountId', async () => {
|
|
143
|
+
renderFunction('WHATSAPP', 'editTemplate', whatsappTemplates, {
|
|
144
|
+
accountId: 853,
|
|
145
|
+
accountName: 'Mochishoes_rcs',
|
|
146
|
+
});
|
|
147
|
+
const data = await renderedComponent
|
|
148
|
+
.instance()
|
|
149
|
+
.getCreativesData('WHATSAPP', whatsappGetCreativeData1, whatsappGetCreativeData1);
|
|
150
|
+
expect(data.accountId).toBe(12721);
|
|
151
|
+
expect(data.accountName).toBe('WhatsappAccount');
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it('WhatsApp getCreativesData resolves the live account id when there is no carryover (fresh content)', async () => {
|
|
155
|
+
renderFunction('WHATSAPP', 'editTemplate', whatsappTemplates, {});
|
|
156
|
+
const data = await renderedComponent
|
|
157
|
+
.instance()
|
|
158
|
+
.getCreativesData('WHATSAPP', whatsappGetCreativeData1, whatsappGetCreativeData1);
|
|
159
|
+
expect(data.accountId).toBe(12721);
|
|
160
|
+
});
|
|
161
|
+
|
|
142
162
|
it('It should clear templateData, on channel change.', async () => {
|
|
143
163
|
renderFunction(
|
|
144
164
|
'WHATSAPP',
|