@capillarytech/creatives-library 9.0.15-alpha.1 → 9.0.16
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 +0 -29
- package/global-styles.js +1 -1
- package/package.json +1 -1
- package/services/tests/api.test.js +20 -35
- package/utils/commonUtils.js +1 -19
- package/v2Components/CapActionButton/constants.js +0 -7
- package/v2Components/CapActionButton/index.js +109 -168
- package/v2Components/CapActionButton/index.scss +5 -156
- package/v2Components/CapActionButton/messages.js +3 -19
- package/v2Components/CapActionButton/tests/index.test.js +18 -42
- package/v2Components/CapImageUpload/index.js +2 -2
- package/v2Components/CapTagList/index.js +0 -10
- package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +48 -70
- package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +2 -8
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +21 -214
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +0 -16
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +9 -83
- package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +0 -30
- package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +11 -60
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +5 -10
- package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +23 -201
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +76 -355
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +8 -155
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +0 -11
- package/v2Components/CommonTestAndPreview/constants.js +2 -38
- package/v2Components/CommonTestAndPreview/index.js +222 -761
- package/v2Components/CommonTestAndPreview/messages.js +3 -45
- package/v2Components/CommonTestAndPreview/sagas.js +6 -25
- package/v2Components/CommonTestAndPreview/tests/CommonTestAndPreview.addTestCustomer.test.js +0 -1
- package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +267 -284
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +65 -231
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +5 -118
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +0 -341
- package/v2Components/CommonTestAndPreview/tests/PreviewSection.test.js +1 -8
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +13 -34
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/RcsPreviewContent.test.js +283 -281
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +1 -199
- package/v2Components/CommonTestAndPreview/tests/index.test.js +4 -133
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +24 -31
- package/v2Components/TemplatePreview/_templatePreview.scss +22 -41
- package/v2Components/TemplatePreview/index.js +31 -143
- package/v2Components/TemplatePreview/tests/index.test.js +0 -142
- package/v2Components/TestAndPreviewSlidebox/CustomValuesEditor.js +6 -6
- package/v2Components/TestAndPreviewSlidebox/index.js +1 -13
- package/v2Components/TestAndPreviewSlidebox/sagas.js +4 -11
- package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +1 -3
- package/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +1 -4
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/DeliverySettingsSection.test.js +0 -4
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +20 -20
- package/v2Containers/CreativesContainer/SlideBoxContent.js +7 -36
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +5 -14
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +5 -36
- package/v2Containers/CreativesContainer/constants.js +0 -11
- package/v2Containers/CreativesContainer/index.js +104 -323
- package/v2Containers/CreativesContainer/index.scss +1 -83
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +34 -79
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +16 -79
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +0 -8
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +90 -333
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +15 -20
- package/v2Containers/CreativesContainer/tests/index.test.js +9 -71
- package/v2Containers/Email/index.js +5 -2
- package/v2Containers/MobilePush/Create/test/saga.test.js +2 -2
- package/v2Containers/Rcs/constants.js +11 -131
- package/v2Containers/Rcs/index.js +810 -2605
- package/v2Containers/Rcs/index.scss +8 -289
- package/v2Containers/Rcs/messages.js +3 -34
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +38537 -73535
- package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +8 -0
- package/v2Containers/Rcs/tests/index.test.js +36 -147
- package/v2Containers/Rcs/tests/mockData.js +0 -38
- package/v2Containers/Rcs/tests/utils.test.js +30 -646
- package/v2Containers/Rcs/utils.js +11 -478
- package/v2Containers/Sms/Create/index.js +48 -115
- package/v2Containers/SmsTrai/Create/index.js +4 -9
- package/v2Containers/SmsTrai/Edit/constants.js +0 -2
- package/v2Containers/SmsTrai/Edit/index.js +169 -678
- package/v2Containers/SmsTrai/Edit/messages.js +4 -14
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +2854 -5455
- package/v2Containers/SmsWrapper/index.js +8 -37
- package/v2Containers/TagList/index.js +0 -6
- package/v2Containers/Templates/_templates.scss +12 -171
- package/v2Containers/Templates/actions.js +0 -11
- package/v2Containers/Templates/constants.js +0 -2
- package/v2Containers/Templates/index.js +55 -125
- package/v2Containers/Templates/sagas.js +13 -57
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1015 -1060
- package/v2Containers/Templates/tests/sagas.test.js +16 -199
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +1 -72
- package/v2Containers/TemplatesV2/index.js +23 -86
- package/v2Containers/WeChat/MapTemplates/test/saga.test.js +9 -9
- package/v2Containers/Whatsapp/index.js +20 -3
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +34 -578
- package/utils/rcsPayloadUtils.js +0 -92
- package/utils/templateVarUtils.js +0 -201
- package/utils/tests/rcsPayloadUtils.test.js +0 -226
- package/utils/tests/templateVarUtils.test.js +0 -204
- package/v2Components/CommonTestAndPreview/previewApiUtils.js +0 -59
- package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +0 -67
- package/v2Components/CommonTestAndPreview/utils.js +0 -84
- package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +0 -91
- package/v2Components/SmsFallback/constants.js +0 -94
- package/v2Components/SmsFallback/index.js +0 -958
- package/v2Components/SmsFallback/index.scss +0 -266
- package/v2Components/SmsFallback/messages.js +0 -78
- package/v2Components/SmsFallback/smsFallbackUtils.js +0 -120
- package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +0 -50
- package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +0 -147
- package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +0 -304
- package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +0 -208
- package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +0 -309
- package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +0 -422
- package/v2Components/SmsFallback/useLocalTemplateList.js +0 -92
- package/v2Components/TemplatePreview/constants.js +0 -2
- package/v2Components/VarSegmentMessageEditor/constants.js +0 -2
- package/v2Components/VarSegmentMessageEditor/index.js +0 -125
- package/v2Components/VarSegmentMessageEditor/index.scss +0 -46
- package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +0 -17
- package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +0 -79
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +0 -90
- package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +0 -258
- package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +0 -125
- package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +0 -227
- package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +0 -318
- package/v2Containers/Sms/smsFormDataHelpers.js +0 -67
- package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +0 -253
- package/v2Containers/SmsTrai/Edit/index.scss +0 -126
- package/v2Containers/Templates/TemplatesActionBar.js +0 -101
- package/v2Containers/Templates/tests/TemplatesActionBar.test.js +0 -120
- package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +0 -180
- package/v2Containers/Templates/utils/smsTemplatesListApi.js +0 -79
- package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +0 -131
package/constants/unified.js
CHANGED
|
@@ -162,24 +162,6 @@ export const TAG_CONTENT_REGEX = /{{([^}]+)}}/g;
|
|
|
162
162
|
export const ENTRY_TRIGGER_TAG_REGEX = /\bentryTrigger\.\w+(?:\.\w+)?(?:\(\w+\))?/g;
|
|
163
163
|
export const SKIP_TAGS_REGEX_GROUPS = ["dynamic_expiry_date_after_\\d+_days.FORMAT_\\d", "unsubscribe\\(#[a-zA-Z\\d]{6}\\)", "Link_to_[a-zA-Z]", "SURVEY.*.TOKEN", "^[A-Za-z].*\\([a-zA-Z\\d]*\\)", "referral_unique_(code|url).*userid"];
|
|
164
164
|
|
|
165
|
-
// --- Template variable tokens (`{{var}}`, DLT `{#var#}`) ---
|
|
166
|
-
/** Global: all `{{…}}` placeholders in a string. */
|
|
167
|
-
export const DEFAULT_MUSTACHE_VAR_REGEX = /\{\{[^}]+\}\}/g;
|
|
168
|
-
/** Global: `{{…}}` or DLT `{#…#}` tokens (SMS combined mode). */
|
|
169
|
-
export const COMBINED_SMS_TEMPLATE_VAR_REGEX = /\{\{[^}]+\}\}|\{\#[^#]*\#\}/g;
|
|
170
|
-
/** Full-string check: one mustache token. */
|
|
171
|
-
export const MUSTACHE_VAR_TOKEN_FULL_STRING_REGEX = /^\{\{[^}]+\}\}$/;
|
|
172
|
-
/** Full-string check: one DLT hash token. */
|
|
173
|
-
export const DLT_HASH_VAR_TOKEN_FULL_STRING_REGEX = /^\{\#[^#]*\#\}$/;
|
|
174
|
-
/** Full-string with capture group: inner name for `{{ name }}`-style tokens (whitespace-tolerant). */
|
|
175
|
-
export const MUSTACHE_TOKEN_INNER_NAME_REGEX = /^\{\{\s*([^}]+?)\s*\}\}$/;
|
|
176
|
-
/** Full-string with capture group: inner name/body for `{# name #}` DLT tokens (whitespace-tolerant). */
|
|
177
|
-
export const DLT_HASH_TOKEN_INNER_NAME_REGEX = /^\{#\s*(.*?)\s*#\}$/;
|
|
178
|
-
/** Global with capture group: inner name inside `{{name}}`. */
|
|
179
|
-
export const MUSTACHE_VAR_NAME_CAPTURE_REGEX = /\{\{([^}]+)\}\}/g;
|
|
180
|
-
/** Global with capture group: inner body inside `{#body#}`. */
|
|
181
|
-
export const DLT_VAR_BODY_CAPTURE_REGEX = /\{\#([^#]*)\#\}/g;
|
|
182
|
-
|
|
183
165
|
export const GET_TRANSLATION_MAPPED = {
|
|
184
166
|
'en': 'en-US',
|
|
185
167
|
'zh-cn': 'zh',
|
|
@@ -217,14 +199,3 @@ export const LOGOUT_FAILURE = 'cap/LOGOUT_FAILURE';
|
|
|
217
199
|
export const JAPANESE_HELP_TEXT = 'ヘルプ :トークンの定義';
|
|
218
200
|
|
|
219
201
|
export const TAG_TRANSLATION_DOC = 'https://docs.capillarytech.com/docs/tags-translation';
|
|
220
|
-
|
|
221
|
-
// --- RCS SMS fallback API contract (shared across modules: campaigns, journey, etc.) ---
|
|
222
|
-
|
|
223
|
-
/** Keys on `messageContent.*.smsFallBackContent` sent to the API: only `message` + `templateConfigs`.
|
|
224
|
-
* `rcsSmsFallbackVarMapped` is editor-only — merged into `message` at normalize, not sent on the wire. */
|
|
225
|
-
export const RCS_API_SMS_FALLBACK_KEYS = Object.freeze({
|
|
226
|
-
MESSAGE: 'message',
|
|
227
|
-
TEMPLATE_CONFIGS: 'templateConfigs',
|
|
228
|
-
RCS_SMS_FALLBACK_VAR_MAPPED: 'rcsSmsFallbackVarMapped',
|
|
229
|
-
});
|
|
230
|
-
|
package/global-styles.js
CHANGED
|
@@ -51,7 +51,7 @@ export default createGlobalStyle`
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
.slidebox-header-icon-right {
|
|
54
|
-
.title-desc-container:not(:has(.whatsapp-rcs-slidebox-template-name))
|
|
54
|
+
.title-desc-container:not(:has(.whatsapp-rcs-slidebox-template-name)) {
|
|
55
55
|
display: flex;
|
|
56
56
|
align-items: center;
|
|
57
57
|
}
|
package/package.json
CHANGED
|
@@ -89,26 +89,21 @@ describe('uploadFile -- whatsapp image upload', () => {
|
|
|
89
89
|
|
|
90
90
|
it('Uploads the file with the original filename when encodeURIComponent fails', async () => {
|
|
91
91
|
// Mocking the encodeURIComponent function to throw an error
|
|
92
|
-
const originalEncodeURIComponent = global.encodeURIComponent;
|
|
93
92
|
global.encodeURIComponent = jest.fn(() => { throw new Error('encodeURIComponent error'); });
|
|
94
93
|
const blob = new Blob([''], { type: 'image/jpeg' });
|
|
95
94
|
const file = new File([blob], '@%test.jpeg', { type: 'image/jpeg' });
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
).toEqual(Promise.resolve());
|
|
109
|
-
} finally {
|
|
110
|
-
global.encodeURIComponent = originalEncodeURIComponent;
|
|
111
|
-
}
|
|
95
|
+
expect(
|
|
96
|
+
uploadFile({
|
|
97
|
+
file,
|
|
98
|
+
assetType: 'image',
|
|
99
|
+
fileParams: {
|
|
100
|
+
width: 275,
|
|
101
|
+
height: 183,
|
|
102
|
+
error: false,
|
|
103
|
+
},
|
|
104
|
+
whatsappParams: {},
|
|
105
|
+
}),
|
|
106
|
+
).toEqual(Promise.resolve());
|
|
112
107
|
});
|
|
113
108
|
});
|
|
114
109
|
|
|
@@ -1042,26 +1037,16 @@ describe('getMembersLookup', () => {
|
|
|
1042
1037
|
expect(result).toBeInstanceOf(Promise);
|
|
1043
1038
|
});
|
|
1044
1039
|
|
|
1045
|
-
it('should call fetch with correct URL encoding and GET method',
|
|
1040
|
+
it('should call fetch with correct URL encoding and GET method', () => {
|
|
1046
1041
|
global.fetch.mockClear();
|
|
1047
|
-
|
|
1042
|
+
getMembersLookup('email', 'user+test@example.com');
|
|
1048
1043
|
expect(global.fetch).toHaveBeenCalled();
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
url.includes('identifierType=email') &&
|
|
1056
|
-
url.includes('identifierValue=user%2Btest%40example.com')
|
|
1057
|
-
);
|
|
1058
|
-
expect(call).toBeDefined();
|
|
1059
|
-
|
|
1060
|
-
// Check URL structure
|
|
1061
|
-
const [url, options] = call;
|
|
1062
|
-
expect(url).toContain('identifierType=email');
|
|
1063
|
-
expect(url).toContain('identifierValue=user%2Btest%40example.com');
|
|
1064
|
-
expect((options && options.method) || 'GET').toBe('GET');
|
|
1044
|
+
const calls = global.fetch.mock.calls;
|
|
1045
|
+
const anyMembersCall = calls.find((c) => c[0] && String(c[0]).includes('members'));
|
|
1046
|
+
expect(anyMembersCall).toBeDefined();
|
|
1047
|
+
expect(anyMembersCall[0]).toContain('identifierType=');
|
|
1048
|
+
expect(anyMembersCall[0]).toContain('identifierValue=');
|
|
1049
|
+
expect(anyMembersCall[1]?.method || 'GET').toBe('GET');
|
|
1065
1050
|
});
|
|
1066
1051
|
});
|
|
1067
1052
|
|
package/utils/commonUtils.js
CHANGED
|
@@ -539,22 +539,4 @@ export const isValidMobile = (mobile) => PHONE_REGEX.test(mobile);
|
|
|
539
539
|
export const formatPhoneNumber = (phone) => {
|
|
540
540
|
if (!phone) return '';
|
|
541
541
|
return String(phone).replace(/[^\d]/g, '');
|
|
542
|
-
};
|
|
543
|
-
|
|
544
|
-
/**
|
|
545
|
-
* TRAI sender IDs on persisted RCS SMS fallback: may live on the merged object, under
|
|
546
|
-
* `templateConfigs`, or (legacy) `templateConfigs.header`. Same resolution order as
|
|
547
|
-
* `createPayload` in `Rcs/index.js`.
|
|
548
|
-
*/
|
|
549
|
-
export function extractRegisteredSenderIdsFromSmsFallbackRecord(record) {
|
|
550
|
-
if (!record || typeof record !== 'object') return null;
|
|
551
|
-
const tc = record.templateConfigs && typeof record.templateConfigs === 'object'
|
|
552
|
-
? record.templateConfigs
|
|
553
|
-
: {};
|
|
554
|
-
const candidates = [record.registeredSenderIds, tc.registeredSenderIds, tc.header];
|
|
555
|
-
for (let i = 0; i < candidates.length; i += 1) {
|
|
556
|
-
const a = candidates[i];
|
|
557
|
-
if (Array.isArray(a) && a.length > 0) return a;
|
|
558
|
-
}
|
|
559
|
-
return null;
|
|
560
|
-
}
|
|
542
|
+
};
|
|
@@ -32,13 +32,6 @@ export const CTA_OPTIONS = [
|
|
|
32
32
|
];
|
|
33
33
|
|
|
34
34
|
export const invalidVarRegex = /{{(.*?)}}/g;
|
|
35
|
-
|
|
36
|
-
/** URL CTA subtype (Figma: URL type dropdown). */
|
|
37
|
-
export const RCS_CTA_URL_TYPE = {
|
|
38
|
-
STATIC: 'STATIC',
|
|
39
|
-
DYNAMIC: 'DYNAMIC',
|
|
40
|
-
};
|
|
41
|
-
|
|
42
35
|
export const BTN_MAX_LENGTH = 25;
|
|
43
36
|
export const PHONE_NUMBER_MAX_LENGTH = 15;
|
|
44
37
|
export const URL_MAX_LENGTH = 2000;
|