Skip to content

Commit

Permalink
#0: make ccEmail / bccEmail checks more reliable
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed Nov 11, 2024
1 parent c4ff844 commit 79b4d97
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 45 deletions.
2 changes: 1 addition & 1 deletion @types/lib/metadataTypes/Journey.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

100 changes: 56 additions & 44 deletions lib/metadataTypes/Journey.js
Original file line number Diff line number Diff line change
Expand Up @@ -868,12 +868,16 @@ class Journey extends MetadataType {
delete triggeredSend.key;
}

triggeredSend.ccEmail = triggeredSend.ccEmail
.split(';')
.filter((el) => el !== '');
triggeredSend.bccEmail = triggeredSend.bccEmail
.split(';')
.filter((el) => el !== '');
if (triggeredSend.ccEmail) {
triggeredSend.ccEmail = triggeredSend.ccEmail
.split(';')
.filter((el) => el !== '');
}
if (triggeredSend.bccEmail) {
triggeredSend.bccEmail = triggeredSend.bccEmail
.split(';')
.filter((el) => el !== '');
}

// List (optional)
triggeredSend.r__list_PathName ||= {};
Expand Down Expand Up @@ -1384,14 +1388,18 @@ class Journey extends MetadataType {
delete triggeredSend.r__triggeredSend_key;
}

triggeredSend.ccEmail =
typeof triggeredSend.ccEmail === 'string'
? triggeredSend.ccEmail
: triggeredSend.ccEmail.join(';');
triggeredSend.bccEmail =
typeof triggeredSend.bccEmail === 'string'
? triggeredSend.bccEmail
: triggeredSend.bccEmail.join(';');
if (triggeredSend.ccEmail) {
triggeredSend.ccEmail =
typeof triggeredSend.ccEmail === 'string'
? triggeredSend.ccEmail
: triggeredSend.ccEmail?.join(';');
}
if (triggeredSend.bccEmail) {
triggeredSend.bccEmail =
typeof triggeredSend.bccEmail === 'string'
? triggeredSend.bccEmail
: triggeredSend.bccEmail?.join(';');
}

// List (optional)
if (triggeredSend.r__list_PathName) {
Expand Down Expand Up @@ -1667,38 +1675,42 @@ class Journey extends MetadataType {
const triggeredSend = activity.configurationArguments?.triggeredSend;
if (triggeredSend) {
// the following is very similar but not equal to the variables in TriggeredSend.js
try {
let bccEmail =
typeof triggeredSend.bccEmail === 'string'
? triggeredSend.bccEmail
: triggeredSend.bccEmail.join(';');
bccEmail = ReplaceCbReference.replaceReference(
bccEmail,
parentName,
findAssetKeys
);
triggeredSend.bccEmail = bccEmail.split(';').filter((el) => el !== '');
changes = true;
} catch (ex) {
if (ex.code !== 200) {
error = ex;
if (triggeredSend.bccEmail) {
try {
let bccEmail =
typeof triggeredSend.bccEmail === 'string'
? triggeredSend.bccEmail
: triggeredSend.bccEmail.join(';');
bccEmail = ReplaceCbReference.replaceReference(
bccEmail,
parentName,
findAssetKeys
);
triggeredSend.bccEmail = bccEmail.split(';').filter((el) => el !== '');
changes = true;
} catch (ex) {
if (ex.code !== 200) {
error = ex;
}
}
}
try {
let ccEmail =
typeof triggeredSend.ccEmail === 'string'
? triggeredSend.ccEmail
: triggeredSend.ccEmail.join(';');
ccEmail = ReplaceCbReference.replaceReference(
ccEmail,
parentName,
findAssetKeys
);
triggeredSend.ccEmail = ccEmail.split(';').filter((el) => el !== '');
changes = true;
} catch (ex) {
if (ex.code !== 200) {
error = ex;
if (triggeredSend.ccEmail) {
try {
let ccEmail =
typeof triggeredSend.ccEmail === 'string'
? triggeredSend.ccEmail
: triggeredSend.ccEmail?.join(';');
ccEmail = ReplaceCbReference.replaceReference(
ccEmail,
parentName,
findAssetKeys
);
triggeredSend.ccEmail = ccEmail.split(';').filter((el) => el !== '');
changes = true;
} catch (ex) {
if (ex.code !== 200) {
error = ex;
}
}
}
try {
Expand Down

0 comments on commit 79b4d97

Please sign in to comment.