@capillarytech/creatives-library 8.0.345-alpha.13 → 8.0.345-alpha.15
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/constants/unified.js +29 -0
- package/package.json +1 -1
- package/services/api.js +0 -20
- package/services/tests/api.test.js +13 -59
- package/utils/commonUtils.js +19 -1
- package/utils/rcsPayloadUtils.js +92 -0
- package/utils/templateVarUtils.js +201 -0
- package/utils/tests/templateVarUtils.test.js +204 -0
- package/v2Components/CapActionButton/constants.js +7 -0
- package/v2Components/CapActionButton/index.js +167 -109
- package/v2Components/CapActionButton/index.scss +157 -6
- package/v2Components/CapActionButton/messages.js +19 -3
- package/v2Components/CapActionButton/tests/index.test.js +41 -17
- package/v2Components/CapCustomSkeleton/index.js +1 -1
- package/v2Components/CapCustomSkeleton/tests/__snapshots__/index.test.js.snap +12 -12
- package/v2Components/CapTagList/index.js +10 -0
- package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +70 -49
- package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +8 -2
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +207 -21
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +16 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +85 -10
- package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +30 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +79 -11
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +10 -5
- package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +160 -15
- package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js.rej +18 -0
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +341 -76
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +133 -4
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +11 -0
- package/v2Components/CommonTestAndPreview/constants.js +38 -2
- package/v2Components/CommonTestAndPreview/index.js +676 -186
- package/v2Components/CommonTestAndPreview/messages.js +49 -3
- package/v2Components/CommonTestAndPreview/previewApiUtils.js +59 -0
- package/v2Components/CommonTestAndPreview/sagas.js +15 -6
- package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +308 -284
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +231 -65
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +118 -5
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +341 -0
- package/v2Components/CommonTestAndPreview/tests/PreviewSection.test.js +8 -1
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +34 -13
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/RcsPreviewContent.test.js +281 -283
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +199 -1
- package/v2Components/CommonTestAndPreview/tests/index.test.js +132 -4
- package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +67 -0
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +2 -2
- package/v2Components/FormBuilder/index.js +8 -10
- package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +87 -0
- package/v2Components/SmsFallback/constants.js +73 -0
- package/v2Components/SmsFallback/index.js +955 -0
- package/v2Components/SmsFallback/index.scss +265 -0
- package/v2Components/SmsFallback/messages.js +78 -0
- package/v2Components/SmsFallback/smsFallbackUtils.js +118 -0
- package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +50 -0
- package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +147 -0
- package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +304 -0
- package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +197 -0
- package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +277 -0
- package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +422 -0
- package/v2Components/SmsFallback/useLocalTemplateList.js +92 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +33 -23
- package/v2Components/TemplatePreview/constants.js +2 -0
- package/v2Components/TemplatePreview/index.js +143 -28
- package/v2Components/TemplatePreview/tests/index.test.js +142 -0
- package/v2Components/TestAndPreviewSlidebox/index.js +13 -1
- package/v2Components/TestAndPreviewSlidebox/sagas.js +11 -4
- package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +3 -1
- package/v2Components/VarSegmentMessageEditor/constants.js +2 -0
- package/v2Components/VarSegmentMessageEditor/index.js +125 -0
- package/v2Components/VarSegmentMessageEditor/index.scss +46 -0
- package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +43 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +36 -4
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +11 -4
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +29 -4
- package/v2Containers/CreativesContainer/constants.js +9 -0
- package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +67 -0
- package/v2Containers/CreativesContainer/index.js +300 -108
- package/v2Containers/CreativesContainer/index.scss +51 -1
- package/v2Containers/CreativesContainer/messages.js +0 -4
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +90 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +78 -34
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +79 -16
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +8 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +357 -98
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +20 -18
- package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +258 -0
- package/v2Containers/CreativesContainer/tests/index.test.js +71 -9
- package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +125 -0
- package/v2Containers/Rcs/constants.js +119 -8
- package/v2Containers/Rcs/index.js +2379 -807
- package/v2Containers/Rcs/index.js.rej +1336 -0
- package/v2Containers/Rcs/index.scss +276 -6
- package/v2Containers/Rcs/index.scss.rej +74 -0
- package/v2Containers/Rcs/messages.js +38 -3
- package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +225 -0
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +98018 -70073
- package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +0 -5
- package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap.rej +128 -0
- package/v2Containers/Rcs/tests/index.test.js +152 -121
- package/v2Containers/Rcs/tests/mockData.js +38 -0
- package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +318 -0
- package/v2Containers/Rcs/tests/utils.test.js +646 -30
- package/v2Containers/Rcs/utils.js +478 -11
- package/v2Containers/Sms/Create/index.js +100 -40
- package/v2Containers/Sms/smsFormDataHelpers.js +67 -0
- package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +253 -0
- package/v2Containers/SmsTrai/Create/index.js +9 -4
- package/v2Containers/SmsTrai/Edit/constants.js +2 -0
- package/v2Containers/SmsTrai/Edit/index.js +636 -130
- package/v2Containers/SmsTrai/Edit/index.scss +121 -0
- package/v2Containers/SmsTrai/Edit/messages.js +14 -4
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4328 -2375
- package/v2Containers/SmsWrapper/index.js +37 -8
- package/v2Containers/TagList/index.js +6 -0
- package/v2Containers/Templates/ChannelTypeIllustration.js +6 -23
- package/v2Containers/Templates/TemplatesActionBar.js +101 -0
- package/v2Containers/Templates/_templates.scss +181 -126
- package/v2Containers/Templates/actions.js +11 -36
- package/v2Containers/Templates/constants.js +2 -23
- package/v2Containers/Templates/index.js +142 -333
- package/v2Containers/Templates/messages.js +0 -68
- package/v2Containers/Templates/reducer.js +0 -68
- package/v2Containers/Templates/sagas.js +55 -98
- package/v2Containers/Templates/selectors.js +0 -12
- package/v2Containers/Templates/tests/ChannelTypeIllustration.test.js +0 -12
- package/v2Containers/Templates/tests/TemplatesActionBar.test.js +120 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1042 -1256
- package/v2Containers/Templates/tests/index.test.js +0 -6
- package/v2Containers/Templates/tests/reducer.test.js +0 -178
- package/v2Containers/Templates/tests/sagas.test.js +200 -436
- package/v2Containers/Templates/tests/selector.test.js +0 -32
- package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +180 -0
- package/v2Containers/Templates/utils/smsTemplatesListApi.js +79 -0
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +72 -1
- package/v2Containers/TemplatesV2/index.js +86 -23
- package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +131 -0
- package/v2Containers/Whatsapp/index.js +3 -20
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +578 -34
- package/v2Containers/Assets/images/archive_Empty_Illustration.svg +0 -9
|
@@ -98,6 +98,20 @@ export default defineMessages({
|
|
|
98
98
|
id: `${scope}.personalizationTags`,
|
|
99
99
|
defaultMessage: 'Personalization Tags',
|
|
100
100
|
},
|
|
101
|
+
rcsTagsSectionTitle: {
|
|
102
|
+
id: `${scope}.rcsTagsSectionTitle`,
|
|
103
|
+
defaultMessage: 'RCS Tags',
|
|
104
|
+
},
|
|
105
|
+
/** Primary SMS section when channel is SMS — `messages[`${channel}TagsSectionTitle`]` resolves to this. */
|
|
106
|
+
SMSTagsSectionTitle: {
|
|
107
|
+
id: `${scope}.SMSTagsSectionTitle`,
|
|
108
|
+
defaultMessage: 'SMS tags',
|
|
109
|
+
},
|
|
110
|
+
/** Fallback SMS under RCS — same label as SMS Test & Preview for consistent personalization UX. */
|
|
111
|
+
smsFallbackTagsSectionTitle: {
|
|
112
|
+
id: `${scope}.smsFallbackTagsSectionTitle`,
|
|
113
|
+
defaultMessage: 'SMS tags',
|
|
114
|
+
},
|
|
101
115
|
customValues: {
|
|
102
116
|
id: `${scope}.customValues`,
|
|
103
117
|
defaultMessage: 'Custom Values',
|
|
@@ -138,6 +152,14 @@ export default defineMessages({
|
|
|
138
152
|
id: `${scope}.discardCustomValues`,
|
|
139
153
|
defaultMessage: 'Discard custom values',
|
|
140
154
|
},
|
|
155
|
+
rcsSenderIdLabel: {
|
|
156
|
+
id: `${scope}.rcsSenderIdLabel`,
|
|
157
|
+
defaultMessage: 'RCS Sender ID',
|
|
158
|
+
},
|
|
159
|
+
fallbackSmsSenderIdLabel: {
|
|
160
|
+
id: `${scope}.fallbackSmsSenderIdLabel`,
|
|
161
|
+
defaultMessage: 'Fallback SMS Sender ID',
|
|
162
|
+
},
|
|
141
163
|
updatePreview: {
|
|
142
164
|
id: `${scope}.updatePreview`,
|
|
143
165
|
defaultMessage: 'Update Preview',
|
|
@@ -194,6 +216,14 @@ export default defineMessages({
|
|
|
194
216
|
id: `${scope}.previewTitle`,
|
|
195
217
|
defaultMessage: 'Preview',
|
|
196
218
|
},
|
|
219
|
+
rcsTab: {
|
|
220
|
+
id: `${scope}.rcsTab`,
|
|
221
|
+
defaultMessage: 'RCS',
|
|
222
|
+
},
|
|
223
|
+
smsFallbackTab: {
|
|
224
|
+
id: `${scope}.smsFallbackTab`,
|
|
225
|
+
defaultMessage: 'Fallback SMS',
|
|
226
|
+
},
|
|
197
227
|
previewPlaceholder: {
|
|
198
228
|
id: `${scope}.previewPlaceholder`,
|
|
199
229
|
defaultMessage: 'Click "Update Preview" to see the rendered email.',
|
|
@@ -286,14 +316,22 @@ export default defineMessages({
|
|
|
286
316
|
id: `${scope}.lastModified`,
|
|
287
317
|
defaultMessage: 'Last modified',
|
|
288
318
|
},
|
|
289
|
-
|
|
290
|
-
id: `${scope}.
|
|
291
|
-
defaultMessage: 'by',
|
|
319
|
+
byAuthor: {
|
|
320
|
+
id: `${scope}.byAuthor`,
|
|
321
|
+
defaultMessage: 'by {name}',
|
|
292
322
|
},
|
|
293
323
|
senderId: {
|
|
294
324
|
id: `${scope}.senderId`,
|
|
295
325
|
defaultMessage: 'Sender ID',
|
|
296
326
|
},
|
|
327
|
+
rcsSenderIdLabel: {
|
|
328
|
+
id: `${scope}.rcsSenderIdLabel`,
|
|
329
|
+
defaultMessage: 'RCS sender ID',
|
|
330
|
+
},
|
|
331
|
+
domainLabel: {
|
|
332
|
+
id: `${scope}.domainLabel`,
|
|
333
|
+
defaultMessage: 'Domain',
|
|
334
|
+
},
|
|
297
335
|
urlPreviewImage: {
|
|
298
336
|
id: `${scope}.urlPreviewImage`,
|
|
299
337
|
defaultMessage: 'URL Preview Image',
|
|
@@ -302,6 +340,14 @@ export default defineMessages({
|
|
|
302
340
|
id: `${scope}.videoPreviewTooltip`,
|
|
303
341
|
defaultMessage: 'Video Preview',
|
|
304
342
|
},
|
|
343
|
+
rcsCarouselPreviewTitlePlaceholder: {
|
|
344
|
+
id: `${scope}.rcsCarouselPreviewTitlePlaceholder`,
|
|
345
|
+
defaultMessage: 'Card title',
|
|
346
|
+
},
|
|
347
|
+
rcsCarouselPreviewBodyPlaceholder: {
|
|
348
|
+
id: `${scope}.rcsCarouselPreviewBodyPlaceholder`,
|
|
349
|
+
defaultMessage: 'Card description',
|
|
350
|
+
},
|
|
305
351
|
toMe: {
|
|
306
352
|
id: `${scope}.toMe`,
|
|
307
353
|
defaultMessage: 'to me',
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers for Liquid `/preview` (updateEmailPreview) responses.
|
|
3
|
+
* The API may nest the payload under `data` or return fields at the top level.
|
|
4
|
+
* SMS responses often use `messageBody` instead of `resolvedBody`.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { getFallbackResolvedContent } from '../../utils/templateVarUtils';
|
|
8
|
+
import { RCS_SMS_FALLBACK_VAR_MAPPED_PROP } from './constants';
|
|
9
|
+
|
|
10
|
+
export function normalizePreviewApiPayload(raw) {
|
|
11
|
+
if (!raw || typeof raw !== 'object') return raw;
|
|
12
|
+
const next = { ...raw };
|
|
13
|
+
if (next.resolvedBody == null) {
|
|
14
|
+
const alt = next.messageBody ?? next.previewMessage ?? next.previewText;
|
|
15
|
+
if (alt != null) next.resolvedBody = alt;
|
|
16
|
+
}
|
|
17
|
+
return next;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Returns a normalized preview object suitable for Redux `previewData`, or null on error / empty.
|
|
22
|
+
*/
|
|
23
|
+
export function extractPreviewFromLiquidResponse(response) {
|
|
24
|
+
if (!response || response.error) return null;
|
|
25
|
+
if (response.errors && Array.isArray(response.errors) && response.errors.length > 0) return null;
|
|
26
|
+
|
|
27
|
+
let body;
|
|
28
|
+
if (response.data !== undefined && response.data !== null && typeof response.data === 'object') {
|
|
29
|
+
body = normalizePreviewApiPayload(response.data);
|
|
30
|
+
} else if (typeof response === 'object' && !Array.isArray(response)) {
|
|
31
|
+
body = normalizePreviewApiPayload(response);
|
|
32
|
+
} else {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!body) return null;
|
|
37
|
+
if (body.resolvedBody === undefined && body.messageBody === undefined) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return body;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* RCS SMS fallback: merge template (`templateContent` / `content`) with VarSegment
|
|
45
|
+
* `rcsSmsFallbackVarMapped` before Liquid /preview, tag extraction, or createMessageMeta.
|
|
46
|
+
* Raw template alone is stale when the user edits slot values.
|
|
47
|
+
*/
|
|
48
|
+
export function getSmsFallbackTextForTagExtraction(smsFallbackContext) {
|
|
49
|
+
const rawTemplateBody =
|
|
50
|
+
smsFallbackContext?.templateContent ?? smsFallbackContext?.content ?? '';
|
|
51
|
+
if (!rawTemplateBody) return '';
|
|
52
|
+
const rcsSmsFallbackVarMapped = smsFallbackContext?.[RCS_SMS_FALLBACK_VAR_MAPPED_PROP];
|
|
53
|
+
const hasRcsSmsFallbackVarMappedEntries =
|
|
54
|
+
Object.keys(rcsSmsFallbackVarMapped ?? {}).length > 0;
|
|
55
|
+
if (hasRcsSmsFallbackVarMappedEntries) {
|
|
56
|
+
return getFallbackResolvedContent(rawTemplateBody, rcsSmsFallbackVarMapped ?? {});
|
|
57
|
+
}
|
|
58
|
+
return rawTemplateBody;
|
|
59
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
call, put, takeLatest, all,
|
|
6
|
+
call, put, takeLatest, takeEvery, all,
|
|
7
7
|
} from 'redux-saga/effects';
|
|
8
8
|
import get from 'lodash/get';
|
|
9
9
|
import isEmpty from 'lodash/isEmpty';
|
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
CHANNELS,
|
|
46
46
|
} from './constants';
|
|
47
47
|
import { parseSenderDetailsResponse } from './DeliverySettings/utils/parseSenderDetailsResponse';
|
|
48
|
+
import { extractPreviewFromLiquidResponse } from './previewApiUtils';
|
|
48
49
|
|
|
49
50
|
// Search Customers Saga
|
|
50
51
|
export function* searchCustomersSaga(action) {
|
|
@@ -91,11 +92,12 @@ export function* updatePreviewSaga(action) {
|
|
|
91
92
|
const customValues = action.payload.resolvedTags;
|
|
92
93
|
|
|
93
94
|
const response = yield call(Api.updateEmailPreview, action.payload);
|
|
94
|
-
|
|
95
|
+
const previewPayload = extractPreviewFromLiquidResponse(response);
|
|
96
|
+
if (previewPayload) {
|
|
95
97
|
yield put({
|
|
96
98
|
type: UPDATE_PREVIEW_SUCCESS,
|
|
97
99
|
payload: {
|
|
98
|
-
previewData:
|
|
100
|
+
previewData: previewPayload,
|
|
99
101
|
customValues, // Pass custom values to be preserved
|
|
100
102
|
},
|
|
101
103
|
});
|
|
@@ -237,8 +239,13 @@ export function* createMessageMetaSaga(action) {
|
|
|
237
239
|
export function* getPrefilledValuesSaga(action) {
|
|
238
240
|
try {
|
|
239
241
|
const response = yield call(Api.updateEmailPreview, action.payload);
|
|
240
|
-
|
|
241
|
-
|
|
242
|
+
const body =
|
|
243
|
+
response?.data !== undefined && response?.data !== null
|
|
244
|
+
? response.data
|
|
245
|
+
: response;
|
|
246
|
+
const resolvedTagValues = body?.resolvedTagValues;
|
|
247
|
+
if (resolvedTagValues != null) {
|
|
248
|
+
yield put({ type: GET_PREFILLED_VALUES_SUCCESS, payload: { values: resolvedTagValues } });
|
|
242
249
|
} else {
|
|
243
250
|
// Pass all errors from API response to state
|
|
244
251
|
yield put({
|
|
@@ -338,7 +345,9 @@ export function* getWeCrmAccountsSaga(action) {
|
|
|
338
345
|
}
|
|
339
346
|
|
|
340
347
|
export function* watchGetSenderDetails() {
|
|
341
|
-
|
|
348
|
+
// takeEvery: RCS test & preview dispatches RCS then SMS back-to-back; takeLatest would
|
|
349
|
+
// cancel the RCS fetch so senderDetailsByChannel.RCS stayed empty while SMS loaded.
|
|
350
|
+
yield takeEvery(GET_SENDER_DETAILS_REQUESTED, getSenderDetailsSaga);
|
|
342
351
|
}
|
|
343
352
|
|
|
344
353
|
export function* watchGetWeCrmAccounts() {
|