@capillarytech/creatives-library 8.0.330-alpha.0 → 8.0.330
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 -18
- package/package.json +1 -1
- package/services/api.js +0 -17
- package/services/tests/api.test.js +0 -85
- package/utils/commonUtils.js +0 -28
- package/utils/tests/commonUtil.test.js +0 -169
- package/v2Components/CapTagList/index.js +0 -10
- package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +49 -70
- package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +2 -8
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +21 -207
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +0 -16
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +10 -85
- package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +0 -30
- package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +11 -79
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +53 -87
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +1 -20
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +4 -133
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +34 -145
- package/v2Components/CommonTestAndPreview/actions.js +0 -10
- package/v2Components/CommonTestAndPreview/constants.js +1 -53
- package/v2Components/CommonTestAndPreview/index.js +168 -998
- package/v2Components/CommonTestAndPreview/messages.js +3 -147
- package/v2Components/CommonTestAndPreview/reducer.js +0 -10
- package/v2Components/CommonTestAndPreview/sagas.js +6 -15
- package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +286 -328
- 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/SendTestMessage.test.js +24 -65
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +1 -199
- package/v2Components/CommonTestAndPreview/tests/constants.test.js +1 -31
- package/v2Components/CommonTestAndPreview/tests/index.test.js +4 -168
- package/v2Components/CommonTestAndPreview/tests/reducer.test.js +0 -71
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +2 -2
- package/v2Components/CommonTestAndPreview/tests/selectors.test.js +0 -17
- package/v2Components/FormBuilder/index.js +1 -7
- 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/CreativesContainer/SlideBoxContent.js +4 -36
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +1 -10
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +4 -29
- package/v2Containers/CreativesContainer/constants.js +0 -9
- package/v2Containers/CreativesContainer/index.js +93 -292
- package/v2Containers/CreativesContainer/index.scss +1 -51
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +34 -78
- 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 +98 -357
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +10 -20
- package/v2Containers/CreativesContainer/tests/index.test.js +9 -71
- package/v2Containers/Rcs/constants.js +3 -40
- package/v2Containers/Rcs/index.js +895 -1145
- package/v2Containers/Rcs/index.scss +6 -85
- package/v2Containers/Rcs/messages.js +2 -12
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +2236 -41719
- package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +5 -0
- package/v2Containers/Rcs/tests/index.test.js +38 -41
- package/v2Containers/Rcs/tests/mockData.js +0 -38
- package/v2Containers/Rcs/tests/utils.test.js +1 -435
- package/v2Containers/Rcs/utils.js +10 -405
- package/v2Containers/Sms/Create/index.js +38 -100
- package/v2Containers/SmsTrai/Create/index.js +4 -9
- package/v2Containers/SmsTrai/Edit/constants.js +0 -2
- package/v2Containers/SmsTrai/Edit/index.js +128 -636
- package/v2Containers/SmsTrai/Edit/messages.js +4 -14
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +2604 -4590
- package/v2Containers/SmsWrapper/index.js +8 -37
- package/v2Containers/TagList/index.js +0 -6
- package/v2Containers/Templates/_templates.scss +2 -63
- package/v2Containers/Templates/actions.js +0 -11
- package/v2Containers/Templates/constants.js +0 -2
- package/v2Containers/Templates/index.js +40 -90
- package/v2Containers/Templates/sagas.js +12 -57
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1079 -1043
- package/v2Containers/Templates/tests/sagas.test.js +123 -193
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +1 -72
- package/v2Containers/TemplatesV2/index.js +23 -86
- package/v2Containers/Whatsapp/index.js +20 -3
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +4872 -5790
- package/utils/templateVarUtils.js +0 -201
- package/utils/tests/templateVarUtils.test.js +0 -204
- package/v2Components/CommonTestAndPreview/AddTestCustomer.js +0 -42
- package/v2Components/CommonTestAndPreview/CustomerCreationModal.js +0 -155
- package/v2Components/CommonTestAndPreview/ExistingCustomerModal.js +0 -93
- package/v2Components/CommonTestAndPreview/previewApiUtils.js +0 -59
- package/v2Components/CommonTestAndPreview/tests/AddTestCustomer.test.js +0 -66
- package/v2Components/CommonTestAndPreview/tests/CommonTestAndPreview.addTestCustomer.test.js +0 -648
- package/v2Components/CommonTestAndPreview/tests/CustomerCreationModal.test.js +0 -174
- package/v2Components/CommonTestAndPreview/tests/ExistingCustomerModal.test.js +0 -114
- package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +0 -67
- package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +0 -87
- package/v2Components/SmsFallback/constants.js +0 -73
- package/v2Components/SmsFallback/index.js +0 -955
- package/v2Components/SmsFallback/index.scss +0 -265
- package/v2Components/SmsFallback/messages.js +0 -78
- package/v2Components/SmsFallback/smsFallbackUtils.js +0 -118
- 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 -197
- package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +0 -277
- package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +0 -422
- package/v2Components/SmsFallback/useLocalTemplateList.js +0 -92
- 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 -43
- package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +0 -67
- 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 -225
- 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 -121
- 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
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
@import '~@capillarytech/cap-ui-library/styles/_variables';
|
|
2
|
-
|
|
3
|
-
/* Edit SMS Fallback slidebox: back control before title (CapHeader `prefix`) */
|
|
4
|
-
.sms-fallback-slidebox-header--edit {
|
|
5
|
-
.sms-fallback-slidebox-header__prefix {
|
|
6
|
-
display: inline-flex;
|
|
7
|
-
align-items: center;
|
|
8
|
-
margin-right: $CAP_SPACE_12;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.sms-fallback-slidebox-header__back {
|
|
12
|
-
display: inline-flex;
|
|
13
|
-
align-items: center;
|
|
14
|
-
justify-content: center;
|
|
15
|
-
padding: $CAP_SPACE_04;
|
|
16
|
-
margin: 0;
|
|
17
|
-
border: none;
|
|
18
|
-
background: transparent;
|
|
19
|
-
cursor: pointer;
|
|
20
|
-
color: inherit;
|
|
21
|
-
border-radius: $CAP_SPACE_04;
|
|
22
|
-
line-height: 1;
|
|
23
|
-
|
|
24
|
-
&:focus-visible {
|
|
25
|
-
outline: $CAP_SPACE_01 solid map-get($CAP_SECONDARY, base);
|
|
26
|
-
outline-offset: $CAP_SPACE_02;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.anticon {
|
|
30
|
-
font-size: 1rem;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.sms-fallback-header-row {
|
|
36
|
-
margin-bottom: $CAP_SPACE_12;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/* Selected fallback template card: thin line under SMS title row (matches preview card layout) */
|
|
40
|
-
.sms-fallback-card-wrap {
|
|
41
|
-
.ant-card.cap-custom-card.SMS .ant-card-head {
|
|
42
|
-
border-bottom: $CAP_SPACE_01 solid $CAP_COLOR_16;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/* Breathing room between header rule and body copy */
|
|
46
|
-
.ant-card.cap-custom-card.SMS .ant-card-body {
|
|
47
|
-
padding-top: $CAP_SPACE_16;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/* "Select template" — scoped via wrapper; no `ant-*` selectors */
|
|
52
|
-
.sms-fallback-select-wrap {
|
|
53
|
-
/* `button` bumps specificity vs library defaults without targeting ant classes */
|
|
54
|
-
button.sms-fallback-select-btn {
|
|
55
|
-
$sms-fallback-secondary: map-get($CAP_SECONDARY, base);
|
|
56
|
-
|
|
57
|
-
/* Same padding + radius default vs hover so the control doesn’t grow on hover */
|
|
58
|
-
min-width: auto;
|
|
59
|
-
min-height: auto;
|
|
60
|
-
height: auto;
|
|
61
|
-
padding: $CAP_SPACE_08 $CAP_SPACE_12;
|
|
62
|
-
border: none;
|
|
63
|
-
border-radius: $CAP_SPACE_04;
|
|
64
|
-
color: $sms-fallback-secondary;
|
|
65
|
-
font-weight: $FONT_WEIGHT_MEDIUM;
|
|
66
|
-
line-height: 1.25;
|
|
67
|
-
background-color: transparent;
|
|
68
|
-
box-shadow: none;
|
|
69
|
-
|
|
70
|
-
&:hover:not(:disabled) {
|
|
71
|
-
color: $sms-fallback-secondary;
|
|
72
|
-
background-color: #ebf8ff;
|
|
73
|
-
font-weight: $FONT_WEIGHT_MEDIUM;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
&:hover:not(:disabled) span {
|
|
77
|
-
font-weight: $FONT_WEIGHT_MEDIUM;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
&:focus:not(:disabled) {
|
|
81
|
-
color: $sms-fallback-secondary;
|
|
82
|
-
font-weight: $FONT_WEIGHT_MEDIUM;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
&:focus-visible:not(:disabled) {
|
|
86
|
-
outline: $CAP_SPACE_01 solid $sms-fallback-secondary;
|
|
87
|
-
outline-offset: $CAP_SPACE_02;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
&:disabled {
|
|
91
|
-
color: $FONT_COLOR_03;
|
|
92
|
-
background-color: transparent;
|
|
93
|
-
border: none;
|
|
94
|
-
opacity: 1;
|
|
95
|
-
cursor: not-allowed;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.sms-fallback-inline-editor {
|
|
101
|
-
margin-top: $CAP_SPACE_08;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/* Toolbar search uses shared `.action-container__toolbar-row .search-text` (13.125rem) from `_templates.scss` — same as other channels. */
|
|
105
|
-
|
|
106
|
-
.sms-fallback-selector {
|
|
107
|
-
position: relative;
|
|
108
|
-
min-height: 12.5rem;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/* Portal’d template picker: give the slidebox a real height so the grid flex fills the space (no dead band below the cards). */
|
|
112
|
-
.sms-fallback-selector:not(.sms-fallback-selector--visually-hidden) {
|
|
113
|
-
height: 100vh;
|
|
114
|
-
max-height: 100vh;
|
|
115
|
-
display: flex;
|
|
116
|
-
flex-direction: column;
|
|
117
|
-
min-height: 0;
|
|
118
|
-
box-sizing: border-box;
|
|
119
|
-
|
|
120
|
-
.add-creatives-section.creatives-slidebox--local-sms-templates {
|
|
121
|
-
flex: 1 1 0%;
|
|
122
|
-
min-height: 0;
|
|
123
|
-
height: 100%;
|
|
124
|
-
max-height: 100%;
|
|
125
|
-
display: flex;
|
|
126
|
-
flex-direction: column;
|
|
127
|
-
|
|
128
|
-
.cap-slide-box-v2-container {
|
|
129
|
-
flex: 1 1 0%;
|
|
130
|
-
min-height: 0;
|
|
131
|
-
height: 100%;
|
|
132
|
-
max-height: 100%;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/* Off-screen but in DOM: avoid huge pixel offsets; clip + fixed corner. */
|
|
138
|
-
.sms-fallback-selector--visually-hidden {
|
|
139
|
-
position: fixed;
|
|
140
|
-
top: 0;
|
|
141
|
-
left: 0;
|
|
142
|
-
width: 0.0625rem;
|
|
143
|
-
height: 0.0625rem;
|
|
144
|
-
margin: -0.0625rem;
|
|
145
|
-
padding: 0;
|
|
146
|
-
overflow: hidden;
|
|
147
|
-
clip: rect(0, 0, 0, 0);
|
|
148
|
-
white-space: nowrap;
|
|
149
|
-
border: 0;
|
|
150
|
-
opacity: 0;
|
|
151
|
-
pointer-events: none;
|
|
152
|
-
z-index: -1;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.sms-fallback-selector__loading {
|
|
156
|
-
position: absolute;
|
|
157
|
-
inset: 0;
|
|
158
|
-
z-index: 10;
|
|
159
|
-
display: flex;
|
|
160
|
-
align-items: center;
|
|
161
|
-
justify-content: center;
|
|
162
|
-
background-color: rgba($CAP_WHITE, 0.7);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/* Creatives SMS create: same title alignment as `SlideBoxHeader` + `.support-video-elements` */
|
|
166
|
-
.sms-fallback-create-slidebox-header.support-video-elements {
|
|
167
|
-
.cap-header-v2-title {
|
|
168
|
-
display: inline-flex;
|
|
169
|
-
align-items: center;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.sms-fallback-create-slidebox-header__prefix {
|
|
174
|
-
margin-right: $CAP_SPACE_16;
|
|
175
|
-
display: inline-flex;
|
|
176
|
-
align-items: center;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.sms-fallback-slidebox,
|
|
180
|
-
.rcs-sms-fallback-slidebox {
|
|
181
|
-
z-index: 10010;
|
|
182
|
-
|
|
183
|
-
> .cap-slide-box-v2-container {
|
|
184
|
-
z-index: 10011;
|
|
185
|
-
background: $CAP_WHITE;
|
|
186
|
-
/*
|
|
187
|
-
* cap-ui sets overflow-y:auto on the panel; combined with our old min-height/height:auto overrides
|
|
188
|
-
* the whole panel scrolled and the footer looked like a separate band with a second scrollbar.
|
|
189
|
-
* Normal SMS edit: only `.slidebox-content-container` scrolls; footer stays in the fixed slot.
|
|
190
|
-
*/
|
|
191
|
-
overflow: hidden;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
.slidebox-header,
|
|
195
|
-
.slidebox-content-container,
|
|
196
|
-
.slidebox-footer {
|
|
197
|
-
background: $CAP_WHITE;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/*
|
|
202
|
-
* Embedded SMS create in RCS fallback: same flex layout as Creatives `creatives-slidebox--local-sms-templates`
|
|
203
|
-
* so only the middle scrolls and `SlideBoxFooter` stays in cap-ui’s fixed footer slot (no huge empty gap).
|
|
204
|
-
*/
|
|
205
|
-
.sms-fallback-slidebox--embedded-sms-create {
|
|
206
|
-
.cap-slide-box-v2-container {
|
|
207
|
-
display: flex;
|
|
208
|
-
flex-direction: column;
|
|
209
|
-
min-height: 0;
|
|
210
|
-
max-height: 100vh;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
.slidebox-content-container {
|
|
214
|
-
flex: 1;
|
|
215
|
-
min-height: 0;
|
|
216
|
-
display: flex;
|
|
217
|
-
flex-direction: column;
|
|
218
|
-
overflow: hidden;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
.slidebox-content-container > div {
|
|
222
|
-
flex: 1;
|
|
223
|
-
min-height: 0;
|
|
224
|
-
display: flex;
|
|
225
|
-
flex-direction: column;
|
|
226
|
-
overflow: hidden;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
.sms-create-container {
|
|
230
|
-
flex: 1;
|
|
231
|
-
min-height: 0;
|
|
232
|
-
display: flex;
|
|
233
|
-
flex-direction: column;
|
|
234
|
-
overflow: hidden;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
.sms-create-container .ant-spin-nested-loading {
|
|
238
|
-
flex: 1;
|
|
239
|
-
min-height: 0;
|
|
240
|
-
display: flex;
|
|
241
|
-
flex-direction: column;
|
|
242
|
-
overflow: hidden;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
.sms-create-container .ant-spin-container {
|
|
246
|
-
flex: 1;
|
|
247
|
-
min-height: 0;
|
|
248
|
-
overflow-y: auto;
|
|
249
|
-
overflow-x: hidden;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/* Same as CreativesContainer `creatives-library-mode` for embedded SMS (no tab bar chrome). */
|
|
254
|
-
.add-creatives-section.creatives-library-mode {
|
|
255
|
-
.sms-create-container {
|
|
256
|
-
.ant-tabs-top-bar {
|
|
257
|
-
display: none;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
.sms-fallback-taglist-popover,
|
|
263
|
-
.rcs-sms-fallback-taglist-popover {
|
|
264
|
-
z-index: 10020;
|
|
265
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { defineMessages } from 'react-intl';
|
|
2
|
-
|
|
3
|
-
const scope = 'creatives.componentsV2.SmsFallback';
|
|
4
|
-
|
|
5
|
-
export default defineMessages({
|
|
6
|
-
sectionTitle: {
|
|
7
|
-
id: `${scope}.sectionTitle`,
|
|
8
|
-
defaultMessage: 'Fallback SMS message (Optional)',
|
|
9
|
-
},
|
|
10
|
-
sectionTitleWithoutOptional: {
|
|
11
|
-
id: `${scope}.sectionTitleWithoutOptional`,
|
|
12
|
-
defaultMessage: 'Fallback SMS message',
|
|
13
|
-
},
|
|
14
|
-
selectTemplate: {
|
|
15
|
-
id: `${scope}.selectTemplate`,
|
|
16
|
-
defaultMessage: 'Select template',
|
|
17
|
-
},
|
|
18
|
-
templateListTitle: {
|
|
19
|
-
id: `${scope}.templateListTitle`,
|
|
20
|
-
defaultMessage: 'Creative templates',
|
|
21
|
-
},
|
|
22
|
-
templateListDescription: {
|
|
23
|
-
id: `${scope}.templateListDescription`,
|
|
24
|
-
defaultMessage: 'Select only one creative',
|
|
25
|
-
},
|
|
26
|
-
searchByCreativeName: {
|
|
27
|
-
id: `${scope}.searchByCreativeName`,
|
|
28
|
-
defaultMessage: 'Search by creative name',
|
|
29
|
-
},
|
|
30
|
-
createNew: {
|
|
31
|
-
id: `${scope}.createNew`,
|
|
32
|
-
defaultMessage: 'Create new',
|
|
33
|
-
},
|
|
34
|
-
uploadNew: {
|
|
35
|
-
id: `${scope}.uploadNew`,
|
|
36
|
-
defaultMessage: 'Upload template',
|
|
37
|
-
},
|
|
38
|
-
createTitle: {
|
|
39
|
-
id: `${scope}.createTitle`,
|
|
40
|
-
defaultMessage: 'Create SMS template',
|
|
41
|
-
},
|
|
42
|
-
backToTemplates: {
|
|
43
|
-
id: `${scope}.backToTemplates`,
|
|
44
|
-
defaultMessage: 'Back to templates',
|
|
45
|
-
},
|
|
46
|
-
editTitle: {
|
|
47
|
-
id: `${scope}.editTitle`,
|
|
48
|
-
defaultMessage: 'Edit SMS Fallback',
|
|
49
|
-
},
|
|
50
|
-
messagePreview: {
|
|
51
|
-
id: `${scope}.messagePreview`,
|
|
52
|
-
defaultMessage: 'Message: {message}',
|
|
53
|
-
},
|
|
54
|
-
editTemplate: {
|
|
55
|
-
id: `${scope}.editTemplate`,
|
|
56
|
-
defaultMessage: 'Edit',
|
|
57
|
-
},
|
|
58
|
-
removeTemplate: {
|
|
59
|
-
id: `${scope}.removeTemplate`,
|
|
60
|
-
defaultMessage: 'Remove',
|
|
61
|
-
},
|
|
62
|
-
messageLabel: {
|
|
63
|
-
id: `${scope}.messageLabel`,
|
|
64
|
-
defaultMessage: 'Message',
|
|
65
|
-
},
|
|
66
|
-
totalCharacters: {
|
|
67
|
-
id: `${scope}.totalCharacters`,
|
|
68
|
-
defaultMessage: '{smsCount} SMS ({number} characters)',
|
|
69
|
-
},
|
|
70
|
-
unicodeLabel: {
|
|
71
|
-
id: `${scope}.unicodeLabel`,
|
|
72
|
-
defaultMessage: 'Allow unicode characters',
|
|
73
|
-
},
|
|
74
|
-
fallbackCardUntitled: {
|
|
75
|
-
id: `${scope}.fallbackCardUntitled`,
|
|
76
|
-
defaultMessage: 'Untitled creative',
|
|
77
|
-
},
|
|
78
|
-
});
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import get from 'lodash/get';
|
|
2
|
-
import { getFallbackResolvedContentForCardDisplay } from '../../utils/templateVarUtils';
|
|
3
|
-
import { extractRegisteredSenderIdsFromSmsFallbackRecord } from '../../utils/commonUtils';
|
|
4
|
-
import { SMS_CATEGORY_FILTERS } from './constants';
|
|
5
|
-
|
|
6
|
-
export function buildFallbackDataFromTemplate(template) {
|
|
7
|
-
const base = get(template, 'versions.base', {});
|
|
8
|
-
const smsEditor = base['sms-editor'] || '';
|
|
9
|
-
/**
|
|
10
|
-
* `templateContent` is the raw template string (may contain {{vars}} / {#slots#}).
|
|
11
|
-
* `content` is the display/send body — identical here since no resolution happens at pick time.
|
|
12
|
-
* They diverge in `buildFallbackDataFromCreativesPayload` where `messageBody` (resolved) differs
|
|
13
|
-
* from `tc.template` (raw). Consumers should prefer `templateContent`; read `content` as fallback
|
|
14
|
-
* (see `mapFallbackValueToEditTemplateData`).
|
|
15
|
-
*/
|
|
16
|
-
const templateContent = smsEditor;
|
|
17
|
-
const content = smsEditor;
|
|
18
|
-
const headerList = Array.isArray(base.header) ? base.header : [];
|
|
19
|
-
const senderId = (headerList[0]) || base.senderId || '';
|
|
20
|
-
const templateName =
|
|
21
|
-
template.name
|
|
22
|
-
|| base.template_name
|
|
23
|
-
|| base['template-name']
|
|
24
|
-
|| '';
|
|
25
|
-
return {
|
|
26
|
-
smsTemplateId: template._id || '',
|
|
27
|
-
templateName,
|
|
28
|
-
content,
|
|
29
|
-
templateContent,
|
|
30
|
-
senderId,
|
|
31
|
-
/** TRAI DLT registered sender IDs — used by Test & Preview delivery settings filtering. */
|
|
32
|
-
registeredSenderIds: headerList,
|
|
33
|
-
unicodeValidity: typeof base['unicode-validity'] === 'boolean' ? base['unicode-validity'] : true,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function mapFallbackValueToEditTemplateData(source) {
|
|
38
|
-
if (!source) return null;
|
|
39
|
-
const rcsSmsFallbackVarMappedFromSource = source?.rcsSmsFallbackVarMapped;
|
|
40
|
-
const hasPersistedFallbackVarMap =
|
|
41
|
-
rcsSmsFallbackVarMappedFromSource != null
|
|
42
|
-
&& typeof rcsSmsFallbackVarMappedFromSource === 'object'
|
|
43
|
-
&& Object.keys(rcsSmsFallbackVarMappedFromSource).length > 0;
|
|
44
|
-
const registeredSenderIdsForHeader =
|
|
45
|
-
extractRegisteredSenderIdsFromSmsFallbackRecord(source);
|
|
46
|
-
return {
|
|
47
|
-
_id: source?.smsTemplateId,
|
|
48
|
-
name: source?.templateName,
|
|
49
|
-
versions: {
|
|
50
|
-
base: {
|
|
51
|
-
'sms-editor': source?.templateContent || source?.content,
|
|
52
|
-
...(source?.templateName != null && String(source.templateName).trim() !== ''
|
|
53
|
-
? { template_name: String(source.templateName).trim() }
|
|
54
|
-
: {}),
|
|
55
|
-
...(Array.isArray(registeredSenderIdsForHeader) && registeredSenderIdsForHeader.length
|
|
56
|
-
? { header: registeredSenderIdsForHeader }
|
|
57
|
-
: {}),
|
|
58
|
-
...(typeof source?.unicodeValidity === 'boolean'
|
|
59
|
-
? { 'unicode-validity': source.unicodeValidity }
|
|
60
|
-
: {}),
|
|
61
|
-
...(hasPersistedFallbackVarMap
|
|
62
|
-
? { 'rcs-sms-fallback-var-mapped': rcsSmsFallbackVarMappedFromSource }
|
|
63
|
-
: {}),
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export function getBaseFromSmsTraiFormData(formData) {
|
|
70
|
-
const base = get(formData, 'versions.base', get(formData, 'value.base', {})) || {};
|
|
71
|
-
return { base };
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function resolveContentFromTraiBase(base) {
|
|
75
|
-
const smsEditor = base['sms-editor'] || '';
|
|
76
|
-
return smsEditor;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Card body: show TagList / VarSegment values where filled; otherwise show raw `{{…}}` / `{#…#}` tokens
|
|
81
|
-
* (so saving without slot labels still shows `{#var#}` on the card).
|
|
82
|
-
*/
|
|
83
|
-
export function getSmsFallbackCardDisplayContent(value) {
|
|
84
|
-
if (!value || typeof value !== 'object') return '';
|
|
85
|
-
const templateStr = String(value.templateContent ?? value.content ?? '');
|
|
86
|
-
const map = value.rcsSmsFallbackVarMapped;
|
|
87
|
-
return getFallbackResolvedContentForCardDisplay(templateStr, map && typeof map === 'object' ? map : {});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export function filterSmsTemplatesByCategory(templates, smsFilter) {
|
|
91
|
-
if (!Array.isArray(templates)) return [];
|
|
92
|
-
if (!smsFilter || smsFilter === SMS_CATEGORY_FILTERS.ALL) return templates;
|
|
93
|
-
return templates.filter((template) =>
|
|
94
|
-
(get(template, 'versions.base.type') || '').toLowerCase().includes(smsFilter),
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Maps `CreativesContainer` `getCreativesData` payload (after save / create) to SmsFallback `value` shape.
|
|
100
|
-
* See `CreativesContainer.getCreativesData` SMS branch for `messageBody` / `templateConfigs`.
|
|
101
|
-
*/
|
|
102
|
-
export function buildFallbackDataFromCreativesPayload(creativesData) {
|
|
103
|
-
if (!creativesData || creativesData.channel !== 'SMS') return null;
|
|
104
|
-
const tc = creativesData.templateConfigs || {};
|
|
105
|
-
const templateStr = typeof tc.template === 'string' ? tc.template : '';
|
|
106
|
-
const bodyRaw = creativesData.messageBody;
|
|
107
|
-
const body = typeof bodyRaw === 'string' ? bodyRaw : templateStr;
|
|
108
|
-
const headerList = Array.isArray(tc.registeredSenderIds) ? tc.registeredSenderIds : [];
|
|
109
|
-
return {
|
|
110
|
-
smsTemplateId: tc.templateId != null ? String(tc.templateId) : '',
|
|
111
|
-
templateName: tc.templateName != null ? String(tc.templateName) : '',
|
|
112
|
-
content: body,
|
|
113
|
-
templateContent: templateStr || body,
|
|
114
|
-
senderId: headerList[0] || '',
|
|
115
|
-
registeredSenderIds: headerList,
|
|
116
|
-
unicodeValidity: true,
|
|
117
|
-
};
|
|
118
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import '@testing-library/jest-dom';
|
|
4
|
-
import { SmsFallbackLocalSelector } from '../SmsFallbackLocalSelector';
|
|
5
|
-
|
|
6
|
-
jest.mock('v2Containers/CreativesContainer', () => ({
|
|
7
|
-
__esModule: true,
|
|
8
|
-
default: () => <div data-testid="creatives-mock">CreativesContainer</div>,
|
|
9
|
-
}));
|
|
10
|
-
|
|
11
|
-
jest.mock('v2Components/CapPageSpinner', () => ({
|
|
12
|
-
__esModule: true,
|
|
13
|
-
default: () => <span data-testid="spinner">spinner</span>,
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
describe('SmsFallbackLocalSelector', () => {
|
|
17
|
-
const baseProps = {
|
|
18
|
-
hidden: false,
|
|
19
|
-
fetchDetailsLoading: false,
|
|
20
|
-
templateList: {
|
|
21
|
-
templates: [],
|
|
22
|
-
loading: false,
|
|
23
|
-
loadMore: jest.fn(),
|
|
24
|
-
search: '',
|
|
25
|
-
setSearch: jest.fn(),
|
|
26
|
-
reset: jest.fn(),
|
|
27
|
-
},
|
|
28
|
-
channelsToHide: ['email'],
|
|
29
|
-
smsRegister: {},
|
|
30
|
-
onCloseCreatives: jest.fn(),
|
|
31
|
-
onSelectTemplate: jest.fn(),
|
|
32
|
-
filterContent: <div>filters</div>,
|
|
33
|
-
getCreativesData: jest.fn(),
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
it('renders CreativesContainer with local template config', () => {
|
|
37
|
-
render(<SmsFallbackLocalSelector {...baseProps} />);
|
|
38
|
-
expect(screen.getByTestId('creatives-mock')).toBeInTheDocument();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('shows loading overlay when fetchDetailsLoading is true', () => {
|
|
42
|
-
render(<SmsFallbackLocalSelector {...baseProps} fetchDetailsLoading />);
|
|
43
|
-
expect(screen.getByTestId('spinner')).toBeInTheDocument();
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('applies visually hidden class when hidden', () => {
|
|
47
|
-
const { container } = render(<SmsFallbackLocalSelector {...baseProps} hidden />);
|
|
48
|
-
expect(container.querySelector('.sms-fallback-selector--visually-hidden')).toBeTruthy();
|
|
49
|
-
});
|
|
50
|
-
});
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RCS SMS fallback — acceptance / regression tests.
|
|
3
|
-
*
|
|
4
|
-
* Covers documented product behavior for the SMS fallback picker (SmsFallback) and
|
|
5
|
-
* related payload expectations. Full end-to-end flows (CreativesContainer + SlideBox + SmsTraiEdit)
|
|
6
|
-
* are better suited to manual or browser automation; those are marked with it.todo below.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
|
|
11
|
-
import '@testing-library/jest-dom';
|
|
12
|
-
import { Provider } from 'react-redux';
|
|
13
|
-
import { createStore } from 'redux';
|
|
14
|
-
import { IntlProvider } from 'react-intl';
|
|
15
|
-
import SmsFallback from '../index';
|
|
16
|
-
import smsFallbackMessages from '../messages';
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
jest.mock('react-redux', () => ({
|
|
20
|
-
...jest.requireActual('react-redux'),
|
|
21
|
-
useDispatch: () => jest.fn(),
|
|
22
|
-
}));
|
|
23
|
-
|
|
24
|
-
jest.mock('../../../services/api', () => ({
|
|
25
|
-
getTemplateDetails: jest.fn().mockResolvedValue({ response: {} }),
|
|
26
|
-
}));
|
|
27
|
-
|
|
28
|
-
jest.mock('../../../v2Containers/Templates/utils/smsTemplatesListApi', () => ({
|
|
29
|
-
fetchSmsTemplatesListPage: jest.fn().mockResolvedValue({ templates: [], totalCount: 0 }),
|
|
30
|
-
}));
|
|
31
|
-
|
|
32
|
-
jest.mock('react-dom', () => ({
|
|
33
|
-
...jest.requireActual('react-dom'),
|
|
34
|
-
createPortal: (node) => node,
|
|
35
|
-
}));
|
|
36
|
-
|
|
37
|
-
jest.mock('../../../v2Containers/CreativesContainer', () => ({
|
|
38
|
-
__esModule: true,
|
|
39
|
-
default: () => <div data-testid="sms-fallback-creatives-container">CreativesContainer</div>,
|
|
40
|
-
}));
|
|
41
|
-
|
|
42
|
-
jest.mock('../../../v2Containers/SmsTrai/Edit', () => ({
|
|
43
|
-
__esModule: true,
|
|
44
|
-
default: () => <div data-testid="sms-trai-edit-mock">SmsTraiEdit</div>,
|
|
45
|
-
}));
|
|
46
|
-
|
|
47
|
-
jest.mock('../../../v2Containers/SmsWrapper', () => ({
|
|
48
|
-
__esModule: true,
|
|
49
|
-
default: () => <div data-testid="sms-wrapper-mock">SmsWrapper</div>,
|
|
50
|
-
}));
|
|
51
|
-
|
|
52
|
-
const intlMessages = Object.keys(smsFallbackMessages).reduce((acc, key) => {
|
|
53
|
-
const m = smsFallbackMessages[key];
|
|
54
|
-
acc[m.id] = m.defaultMessage;
|
|
55
|
-
return acc;
|
|
56
|
-
}, {});
|
|
57
|
-
|
|
58
|
-
const renderSmsFallback = (props = {}) => {
|
|
59
|
-
const store = createStore((state = {}) => state);
|
|
60
|
-
return render(
|
|
61
|
-
<Provider store={store}>
|
|
62
|
-
<IntlProvider locale="en" messages={intlMessages}>
|
|
63
|
-
<SmsFallback
|
|
64
|
-
onChange={jest.fn()}
|
|
65
|
-
smsRegister={props.smsRegister ?? 'DLT'}
|
|
66
|
-
isFullMode={props.isFullMode ?? true}
|
|
67
|
-
{...props}
|
|
68
|
-
/>
|
|
69
|
-
</IntlProvider>
|
|
70
|
-
</Provider>
|
|
71
|
-
);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
describe('RCS SMS fallback — Create/Edit UI (SmsFallback)', () => {
|
|
75
|
-
it('shows “Fallback SMS message (Optional)” section title when no template is selected', () => {
|
|
76
|
-
renderSmsFallback({ value: null });
|
|
77
|
-
expect(
|
|
78
|
-
screen.getByText(smsFallbackMessages.sectionTitle.defaultMessage)
|
|
79
|
-
).toBeInTheDocument();
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('renders Select template control when no fallback value is set', () => {
|
|
83
|
-
renderSmsFallback({ value: null });
|
|
84
|
-
expect(
|
|
85
|
-
screen.getByRole('button', { name: smsFallbackMessages.selectTemplate.defaultMessage })
|
|
86
|
-
).toBeInTheDocument();
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('opens embedded SMS template list (CreativesContainer) when Select template is clicked', async () => {
|
|
90
|
-
renderSmsFallback({ value: null });
|
|
91
|
-
fireEvent.click(
|
|
92
|
-
screen.getByRole('button', { name: smsFallbackMessages.selectTemplate.defaultMessage })
|
|
93
|
-
);
|
|
94
|
-
await waitFor(() => {
|
|
95
|
-
expect(screen.getByTestId('sms-fallback-creatives-container')).toBeInTheDocument();
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('shows template name and content on the card when a fallback value is set', () => {
|
|
100
|
-
renderSmsFallback({
|
|
101
|
-
value: {
|
|
102
|
-
templateName: 'Promo SMS',
|
|
103
|
-
content: 'Hello {{name}}',
|
|
104
|
-
},
|
|
105
|
-
showAsCard: true,
|
|
106
|
-
});
|
|
107
|
-
expect(screen.getByText('Promo SMS')).toBeInTheDocument();
|
|
108
|
-
expect(screen.getByText(/Hello/)).toBeInTheDocument();
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it('wraps the SMS fallback card in sms-fallback-card-wrap for header border styling', () => {
|
|
112
|
-
const { container } = renderSmsFallback({
|
|
113
|
-
value: {
|
|
114
|
-
templateName: 'Promo SMS',
|
|
115
|
-
content: 'Hello',
|
|
116
|
-
},
|
|
117
|
-
showAsCard: true,
|
|
118
|
-
});
|
|
119
|
-
expect(container.querySelector('.sms-fallback-card-wrap')).toBeTruthy();
|
|
120
|
-
expect(container.querySelector('.sms-fallback-card-wrap .sms-fallback-card')).toBeTruthy();
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it.todo('Edit icon / more menu → Edit should open SlideBox in edit mode with header “Edit SMS Fallback” and SmsTraiEdit (Ant Dropdown + portal — use E2E or user-event + getPopupContainer)');
|
|
124
|
-
it.todo('More menu → Remove should clear selection and show Select template CTA again');
|
|
125
|
-
|
|
126
|
-
it.todo('SlideBox list header should match product copy for template selection (see CreativesContainer / TemplatesV2)');
|
|
127
|
-
it.todo('Template grid should list only SMS creatives approved per channel filters (API + DLT category filters)');
|
|
128
|
-
it.todo('Selecting a template should load details and transition to SmsTraiEdit with correct templateData');
|
|
129
|
-
it.todo('Done/Save in SmsTraiEdit should persist card and close slidebox (integration)');
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
describe('RCS SMS fallback — SlideBox interactions', () => {
|
|
133
|
-
it.todo('Closing SlideBox without confirming should not set fallback when none was selected');
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Payload: `app/v2Containers/Rcs/tests/index.test.js` asserts `smsFallBackContent` is omitted when no SmsFallback data.
|
|
138
|
-
*/
|
|
139
|
-
describe('RCS SMS fallback — Create/Edit payload', () => {
|
|
140
|
-
it.todo('Create/Update RCS without selecting fallback should not send smsFallBackContent (covered in Rcs index.test.js — keep in sync)');
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
describe('RCS SMS fallback — Edit flow (hydration & save)', () => {
|
|
144
|
-
it.todo('Opening an existing RCS template with smsFallBackContent should pre-populate the fallback card');
|
|
145
|
-
it.todo('Editing fallback on an existing RCS should update the card after Done/Save');
|
|
146
|
-
it.todo('Removing fallback on an existing RCS should clear card and omit smsFallBackContent on next save');
|
|
147
|
-
});
|