@capillarytech/creatives-library 8.0.310-alpha.0 → 8.0.311
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 +1 -1
- package/services/api.js +0 -17
- package/services/tests/api.test.js +0 -85
- package/utils/commonUtils.js +0 -10
- package/utils/tests/commonUtil.test.js +0 -169
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +49 -78
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +34 -134
- package/v2Components/CommonTestAndPreview/actions.js +0 -10
- package/v2Components/CommonTestAndPreview/constants.js +1 -15
- package/v2Components/CommonTestAndPreview/index.js +19 -80
- package/v2Components/CommonTestAndPreview/messages.js +0 -94
- package/v2Components/CommonTestAndPreview/reducer.js +0 -10
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +0 -53
- package/v2Components/CommonTestAndPreview/tests/constants.test.js +1 -31
- package/v2Components/CommonTestAndPreview/tests/index.test.js +0 -36
- package/v2Components/CommonTestAndPreview/tests/reducer.test.js +0 -71
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +0 -377
- package/v2Components/CommonTestAndPreview/tests/selectors.test.js +0 -17
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +1276 -1408
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +288 -321
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +4872 -5246
- package/v2Components/CommonTestAndPreview/AddTestCustomer.js +0 -42
- package/v2Components/CommonTestAndPreview/CustomerCreationModal.js +0 -284
- package/v2Components/CommonTestAndPreview/ExistingCustomerModal.js +0 -72
- package/v2Components/CommonTestAndPreview/tests/AddTestCustomer.test.js +0 -66
- package/v2Components/CommonTestAndPreview/tests/CommonTestAndPreview.addTestCustomer.test.js +0 -657
- package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +0 -172
- package/v2Components/CommonTestAndPreview/tests/CustomerCreationModal.test.js +0 -466
- package/v2Components/CommonTestAndPreview/tests/ExistingCustomerModal.test.js +0 -114
|
@@ -5,12 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
@import '~@capillarytech/cap-ui-library/styles/_variables.scss';
|
|
7
7
|
|
|
8
|
-
/* All ant overrides scoped under wrapper to avoid affecting other modals. */
|
|
8
|
+
/* All ant overrides scoped under wrapper to avoid affecting other modals. */
|
|
9
9
|
.common-test-preview-modal-wrap {
|
|
10
|
-
z-index: 10000;
|
|
11
|
-
display: flex;
|
|
12
|
-
justify-content: center;
|
|
13
|
-
align-items: center;
|
|
10
|
+
z-index: 10000 !important;
|
|
14
11
|
}
|
|
15
12
|
|
|
16
13
|
/* Lookup spinner overlay above test-customers dropdown. */
|
|
@@ -25,23 +22,19 @@
|
|
|
25
22
|
|
|
26
23
|
/* When customer lookup is loading, dropdown renders inside .send-test-section; lower it so spinner is on top. */
|
|
27
24
|
.common-test-preview-customer-loading .test-customers-tree-select-dropdown {
|
|
28
|
-
z-index: 0;
|
|
25
|
+
z-index: 0 !important;
|
|
29
26
|
}
|
|
30
27
|
|
|
31
28
|
/* Customer creation modal content – avoid inline styles */
|
|
32
|
-
.common-test-preview-modal
|
|
33
|
-
color: $CAP_G01;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
max-width: 32.571em;
|
|
38
|
-
|
|
29
|
+
.common-test-preview-modal {
|
|
30
|
+
color: $CAP_G01 !important;
|
|
31
|
+
.ant-modal-content {
|
|
32
|
+
width: 28.5rem; /* 456px at 16px root */
|
|
33
|
+
}
|
|
39
34
|
.ant-modal-footer {
|
|
40
35
|
text-align: left;
|
|
41
|
-
margin-left: 0.625rem;
|
|
42
|
-
/*
|
|
43
|
-
margin-top: 0.9375rem;
|
|
44
|
-
/* 15px at 16px root */
|
|
36
|
+
margin-left: 0.625rem; /* 10px at 16px root */
|
|
37
|
+
margin-top: 0.9375rem; /* 15px at 16px root */
|
|
45
38
|
}
|
|
46
39
|
|
|
47
40
|
.customer-creation-modal-row {
|
|
@@ -70,72 +63,22 @@
|
|
|
70
63
|
font-weight: normal;
|
|
71
64
|
}
|
|
72
65
|
|
|
73
|
-
/* Input text color and font to match standalone (lib mode can lose host styles) */
|
|
74
66
|
.customer-creation-modal-input {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
color: $CAP_G01;
|
|
78
|
-
font-size: $FONT_SIZE_M;
|
|
79
|
-
font-weight: normal;
|
|
80
|
-
padding: 0.571em;
|
|
81
|
-
/* 8px */
|
|
82
|
-
height: 2.857em;
|
|
83
|
-
/* 40px */
|
|
84
|
-
line-height: 1.714em;
|
|
85
|
-
/* 24px */
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.ant-input:hover,
|
|
89
|
-
.ant-input:focus {
|
|
90
|
-
border: 1px solid $CAP_G01;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.ant-input::placeholder {
|
|
94
|
-
color: $CAP_G06;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/* Error state: single clean red border, no double line or focus ring */
|
|
98
|
-
&.has-input-error {
|
|
99
|
-
.ant-input-affix-wrapper {
|
|
100
|
-
border: 1px solid $CAP_COLOR_03;
|
|
101
|
-
border-radius: $CAP_SPACE_04;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.ant-input-affix-wrapper:hover,
|
|
105
|
-
.ant-input-affix-wrapper:focus,
|
|
106
|
-
.ant-input-affix-wrapper-focused {
|
|
107
|
-
border: 1px solid $CAP_COLOR_03;
|
|
108
|
-
}
|
|
67
|
+
width: 100%;
|
|
68
|
+
color: $CAP_G01;
|
|
109
69
|
|
|
110
|
-
|
|
111
|
-
|
|
70
|
+
&.has-error {
|
|
71
|
+
color: $CAP_COLOR_03 !important;
|
|
72
|
+
.ant-input {
|
|
73
|
+
border-color: $CAP_COLOR_03 !important;
|
|
112
74
|
}
|
|
113
75
|
}
|
|
114
76
|
}
|
|
115
77
|
|
|
116
|
-
/* Error message only – no extra border/line below the input */
|
|
117
78
|
.customer-creation-modal-validation-error {
|
|
118
79
|
color: $CAP_COLOR_03;
|
|
119
80
|
font-size: $FONT_SIZE_S;
|
|
120
81
|
margin-top: $CAP_SPACE_04;
|
|
121
|
-
border: none;
|
|
122
|
-
border-top: none;
|
|
123
|
-
box-shadow: none;
|
|
124
|
-
|
|
125
|
-
&::before,
|
|
126
|
-
&::after {
|
|
127
|
-
display: none;
|
|
128
|
-
content: none;
|
|
129
|
-
border: none;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/* Lookup loading: make Email and Mobile fields look disabled (wrapper-only) */
|
|
134
|
-
.customer-creation-modal--lookup-loading .customer-creation-modal-row--email .customer-creation-modal-input,
|
|
135
|
-
.customer-creation-modal--lookup-loading .customer-creation-modal-row--last .customer-creation-modal-input {
|
|
136
|
-
opacity: 0.65;
|
|
137
|
-
cursor: not-allowed;
|
|
138
|
-
background-color: $CAP_G09;
|
|
139
82
|
}
|
|
140
83
|
|
|
141
84
|
/* Existing customer modal content */
|
|
@@ -144,17 +87,13 @@
|
|
|
144
87
|
margin-bottom: $CAP_SPACE_16;
|
|
145
88
|
}
|
|
146
89
|
|
|
147
|
-
.ant-card.cap-card-v2 {
|
|
148
|
-
border: none
|
|
149
|
-
}
|
|
150
|
-
|
|
151
90
|
.ant-card-body {
|
|
152
91
|
padding: 1rem;
|
|
153
|
-
border-radius: $CAP_SPACE_08;
|
|
154
|
-
border: $CAP_SPACE_01 solid $CAP_G06;
|
|
155
92
|
}
|
|
156
93
|
|
|
157
94
|
&-card {
|
|
95
|
+
border-radius: $CAP_SPACE_08;
|
|
96
|
+
border: $CAP_SPACE_01 solid $CAP_G06;
|
|
158
97
|
padding: 0;
|
|
159
98
|
}
|
|
160
99
|
|
|
@@ -165,11 +104,9 @@
|
|
|
165
104
|
}
|
|
166
105
|
|
|
167
106
|
&-avatar {
|
|
168
|
-
width: 3rem;
|
|
169
|
-
/* 48px at 16px root */
|
|
107
|
+
width: 3rem; /* 48px at 16px root */
|
|
170
108
|
height: 3rem;
|
|
171
|
-
border-radius: 1.25rem;
|
|
172
|
-
/* 20px at 16px root */
|
|
109
|
+
border-radius: 1.25rem; /* 20px at 16px root */
|
|
173
110
|
background-color: $CAP_G07;
|
|
174
111
|
display: flex;
|
|
175
112
|
align-items: center;
|
|
@@ -214,6 +151,9 @@
|
|
|
214
151
|
}
|
|
215
152
|
|
|
216
153
|
.common-test-and-preview-slidebox {
|
|
154
|
+
.common-test-preview-modal-wrap {
|
|
155
|
+
z-index: 10003;
|
|
156
|
+
}
|
|
217
157
|
|
|
218
158
|
.ant-modal-mask,
|
|
219
159
|
.ant-modal-wrap {
|
|
@@ -256,7 +196,6 @@
|
|
|
256
196
|
|
|
257
197
|
.tag-input-field {
|
|
258
198
|
width: 14.714rem;
|
|
259
|
-
|
|
260
199
|
.input {
|
|
261
200
|
height: $CAP_SPACE_40;
|
|
262
201
|
}
|
|
@@ -269,16 +208,12 @@
|
|
|
269
208
|
|
|
270
209
|
.left-panel {
|
|
271
210
|
width: 40%;
|
|
272
|
-
min-width: 20rem;
|
|
273
|
-
/* Consistent width in campaigns/library mode so test customer dropdown matches creatives */
|
|
274
211
|
padding-right: 1rem;
|
|
275
212
|
border-right: $CAP_SPACE_01 solid $CAP_G12;
|
|
276
213
|
overflow-y: auto;
|
|
277
|
-
|
|
278
214
|
.panel-divider {
|
|
279
215
|
margin: 0;
|
|
280
216
|
}
|
|
281
|
-
|
|
282
217
|
.no-tags-extracted-info-note {
|
|
283
218
|
.note-text {
|
|
284
219
|
white-space: unset;
|
|
@@ -327,7 +262,6 @@
|
|
|
327
262
|
.values-missing-message {
|
|
328
263
|
margin: $CAP_SPACE_16 0;
|
|
329
264
|
}
|
|
330
|
-
|
|
331
265
|
.editor-header {
|
|
332
266
|
display: flex;
|
|
333
267
|
justify-content: flex-end;
|
|
@@ -411,7 +345,7 @@
|
|
|
411
345
|
align-items: center;
|
|
412
346
|
min-height: $CAP_SPACE_20;
|
|
413
347
|
padding-left: $CAP_SPACE_08;
|
|
414
|
-
|
|
348
|
+
|
|
415
349
|
&:hover {
|
|
416
350
|
background-color: #f5f5f5;
|
|
417
351
|
}
|
|
@@ -477,7 +411,6 @@
|
|
|
477
411
|
color: #bfbfbf;
|
|
478
412
|
font-style: italic;
|
|
479
413
|
}
|
|
480
|
-
|
|
481
414
|
.ant-input {
|
|
482
415
|
margin: $CAP_SPACE_06 0;
|
|
483
416
|
height: $CAP_SPACE_36;
|
|
@@ -538,11 +471,10 @@
|
|
|
538
471
|
justify-content: space-between;
|
|
539
472
|
margin-bottom: $CAP_SPACE_16;
|
|
540
473
|
}
|
|
541
|
-
|
|
542
474
|
.editor-actions::before,
|
|
543
475
|
.editor-actions::after {
|
|
544
|
-
|
|
545
|
-
|
|
476
|
+
content: none;
|
|
477
|
+
display: none;
|
|
546
478
|
}
|
|
547
479
|
|
|
548
480
|
.optional-tags-section {
|
|
@@ -551,10 +483,9 @@
|
|
|
551
483
|
color: #666;
|
|
552
484
|
}
|
|
553
485
|
|
|
554
|
-
|
|
555
|
-
|
|
486
|
+
z-index: -1;
|
|
556
487
|
.optional-tags-content {
|
|
557
|
-
padding: $CAP_SPACE_16;
|
|
488
|
+
padding: $CAP_SPACE_16;
|
|
558
489
|
background: #f5f5f5;
|
|
559
490
|
border-radius: $CAP_SPACE_04;
|
|
560
491
|
}
|
|
@@ -580,40 +511,31 @@
|
|
|
580
511
|
margin-bottom: $CAP_SPACE_16;
|
|
581
512
|
color: #666;
|
|
582
513
|
}
|
|
583
|
-
|
|
584
514
|
.ant-collapse-header {
|
|
585
515
|
padding-left: 0;
|
|
586
516
|
}
|
|
587
|
-
|
|
588
517
|
.ant-collapse-content-box {
|
|
589
518
|
padding-left: 0 !important;
|
|
590
519
|
}
|
|
591
|
-
|
|
592
520
|
.send-test-content {
|
|
593
521
|
flex-direction: column;
|
|
594
522
|
align-items: stretch;
|
|
595
523
|
gap: 0;
|
|
596
524
|
}
|
|
597
|
-
|
|
598
525
|
.test-customers-tree-select {
|
|
599
526
|
width: 100%;
|
|
600
|
-
min-width: 18rem;
|
|
601
|
-
/* Consistent dropdown width in campaigns and creatives */
|
|
602
527
|
min-height: $CAP_SPACE_40;
|
|
603
528
|
margin: $CAP_SPACE_12 0 $CAP_SPACE_08;
|
|
604
|
-
|
|
605
529
|
.ant-select-selection,
|
|
606
530
|
.ant-select-selector {
|
|
607
531
|
min-height: $CAP_SPACE_40;
|
|
608
532
|
height: auto !important;
|
|
609
533
|
}
|
|
610
534
|
}
|
|
611
|
-
|
|
612
535
|
.send-test-content .ant-btn {
|
|
613
536
|
margin-top: $CAP_SPACE_04;
|
|
614
537
|
flex-shrink: 0;
|
|
615
538
|
}
|
|
616
|
-
|
|
617
539
|
.ant-select-selection__choice {
|
|
618
540
|
background-color: $CAP_G08;
|
|
619
541
|
border-radius: $CAP_SPACE_04;
|
|
@@ -623,11 +545,8 @@
|
|
|
623
545
|
|
|
624
546
|
// Test customers TreeSelect dropdown: limit height and make scrollable (dropdown renders in portal)
|
|
625
547
|
.test-customers-tree-select-dropdown {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
/* 320px */
|
|
629
|
-
overflow-y: auto;
|
|
630
|
-
|
|
548
|
+
max-height: 20rem !important; /* 320px */
|
|
549
|
+
overflow-y: auto !important;
|
|
631
550
|
.ant-select-tree-list-holder-inner {
|
|
632
551
|
overflow: visible;
|
|
633
552
|
}
|
|
@@ -635,10 +554,8 @@
|
|
|
635
554
|
|
|
636
555
|
.test-customer-add-btn {
|
|
637
556
|
width: 100%;
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
color: $FONT_COLOR_05;
|
|
641
|
-
}
|
|
557
|
+
background-color: transparent !important;
|
|
558
|
+
color: $FONT_COLOR_05 !important;
|
|
642
559
|
white-space: normal;
|
|
643
560
|
word-break: normal;
|
|
644
561
|
overflow-wrap: break-word;
|
|
@@ -666,7 +583,7 @@
|
|
|
666
583
|
padding-bottom: $CAP_SPACE_16;
|
|
667
584
|
margin-bottom: $CAP_SPACE_16;
|
|
668
585
|
}
|
|
669
|
-
|
|
586
|
+
|
|
670
587
|
.right-panel {
|
|
671
588
|
padding-left: 0;
|
|
672
589
|
padding-top: $CAP_SPACE_16;
|
|
@@ -682,7 +599,6 @@
|
|
|
682
599
|
.preview-divider {
|
|
683
600
|
margin: 0;
|
|
684
601
|
}
|
|
685
|
-
|
|
686
602
|
.preview-header {
|
|
687
603
|
display: flex;
|
|
688
604
|
justify-content: space-between;
|
|
@@ -694,7 +610,6 @@
|
|
|
694
610
|
font-size: $FONT_SIZE_M;
|
|
695
611
|
color: #595959;
|
|
696
612
|
gap: $CAP_SPACE_04;
|
|
697
|
-
|
|
698
613
|
b {
|
|
699
614
|
color: #262626;
|
|
700
615
|
margin-left: $CAP_SPACE_04;
|
|
@@ -725,12 +640,10 @@
|
|
|
725
640
|
|
|
726
641
|
.preview-body {
|
|
727
642
|
border-radius: $CAP_SPACE_08;
|
|
728
|
-
box-shadow: 0 $CAP_SPACE_04 $CAP_SPACE_12 rgba(0,
|
|
729
|
-
|
|
643
|
+
box-shadow: 0 $CAP_SPACE_04 $CAP_SPACE_12 rgba(0,0,0,0.1);
|
|
730
644
|
&.mobile {
|
|
731
645
|
width: 26.786rem;
|
|
732
646
|
margin: 0 auto;
|
|
733
|
-
|
|
734
647
|
.browser-bar {
|
|
735
648
|
background: $CAP_G08;
|
|
736
649
|
}
|
|
@@ -746,16 +659,13 @@
|
|
|
746
659
|
display: flex;
|
|
747
660
|
gap: $CAP_SPACE_08;
|
|
748
661
|
color: $CAP_G06;
|
|
749
|
-
|
|
750
662
|
.refresh-icon {
|
|
751
663
|
margin-top: $CAP_SPACE_04;
|
|
752
|
-
|
|
753
664
|
svg path {
|
|
754
665
|
fill: $CAP_G06;
|
|
755
666
|
}
|
|
756
667
|
}
|
|
757
668
|
}
|
|
758
|
-
|
|
759
669
|
.address-bar {
|
|
760
670
|
flex-grow: 1;
|
|
761
671
|
background: $CAP_WHITE;
|
|
@@ -765,16 +675,13 @@
|
|
|
765
675
|
color: #595959;
|
|
766
676
|
text-align: center;
|
|
767
677
|
border: $CAP_SPACE_01 solid $CAP_G07;
|
|
768
|
-
|
|
769
678
|
.address-bar-label {
|
|
770
679
|
float: left;
|
|
771
680
|
}
|
|
772
|
-
|
|
773
681
|
.browser-address-bar-icon {
|
|
774
682
|
float: right;
|
|
775
683
|
}
|
|
776
684
|
}
|
|
777
|
-
|
|
778
685
|
.browser-actions {
|
|
779
686
|
color: #8c8c8c;
|
|
780
687
|
}
|
|
@@ -785,11 +692,9 @@
|
|
|
785
692
|
align-items: center;
|
|
786
693
|
padding: $CAP_SPACE_16;
|
|
787
694
|
gap: $CAP_SPACE_16;
|
|
788
|
-
|
|
789
695
|
.back-arrow {
|
|
790
696
|
font-size: $CAP_SPACE_16;
|
|
791
697
|
}
|
|
792
|
-
|
|
793
698
|
.email-meta {
|
|
794
699
|
margin-left: auto;
|
|
795
700
|
display: flex;
|
|
@@ -797,7 +702,6 @@
|
|
|
797
702
|
gap: $CAP_SPACE_08;
|
|
798
703
|
font-size: $FONT_SIZE_S;
|
|
799
704
|
color: #8c8c8c;
|
|
800
|
-
|
|
801
705
|
.dots {
|
|
802
706
|
width: $CAP_SPACE_06;
|
|
803
707
|
height: $CAP_SPACE_06;
|
|
@@ -812,19 +716,16 @@
|
|
|
812
716
|
align-items: center;
|
|
813
717
|
padding: 0 $CAP_SPACE_16 $CAP_SPACE_16;
|
|
814
718
|
gap: $CAP_SPACE_12;
|
|
815
|
-
|
|
816
719
|
.sender-avatar {
|
|
817
720
|
width: $CAP_SPACE_40;
|
|
818
721
|
height: $CAP_SPACE_40;
|
|
819
722
|
border-radius: 50%;
|
|
820
723
|
background: $CAP_G12;
|
|
821
724
|
}
|
|
822
|
-
|
|
823
725
|
.sender-info {
|
|
824
726
|
.sender-name {
|
|
825
727
|
font-weight: 500;
|
|
826
728
|
}
|
|
827
|
-
|
|
828
729
|
.recipient-info {
|
|
829
730
|
font-size: $FONT_SIZE_S;
|
|
830
731
|
color: #8c8c8c;
|
|
@@ -835,7 +736,6 @@
|
|
|
835
736
|
.email-content {
|
|
836
737
|
border-top: $CAP_SPACE_01 solid $CAP_G12;
|
|
837
738
|
padding: 0 $CAP_SPACE_16;
|
|
838
|
-
|
|
839
739
|
iframe {
|
|
840
740
|
border: none;
|
|
841
741
|
}
|
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
CLEAR_PREVIEW_ERRORS,
|
|
21
21
|
GET_SENDER_DETAILS_REQUESTED,
|
|
22
22
|
GET_WECRM_ACCOUNTS_REQUESTED,
|
|
23
|
-
ADD_TEST_CUSTOMER,
|
|
24
23
|
} from './constants';
|
|
25
24
|
|
|
26
25
|
// ============================================
|
|
@@ -93,15 +92,6 @@ export const getTestGroupsRequested = () => ({
|
|
|
93
92
|
type: GET_TEST_GROUPS_REQUESTED,
|
|
94
93
|
});
|
|
95
94
|
|
|
96
|
-
/**
|
|
97
|
-
* Add a test customer to the list (e.g. after adding existing customer so tree shows name)
|
|
98
|
-
* @param {Object} customer - { userId, customerId, name, email, mobile }
|
|
99
|
-
*/
|
|
100
|
-
export const addTestCustomer = (customer) => ({
|
|
101
|
-
type: ADD_TEST_CUSTOMER,
|
|
102
|
-
payload: { customer },
|
|
103
|
-
});
|
|
104
|
-
|
|
105
95
|
/**
|
|
106
96
|
* Create or update message meta configuration
|
|
107
97
|
* @param {Object} payload - Message meta payload
|
|
@@ -33,7 +33,6 @@ export const SEND_TEST_MESSAGE_FAILURE = 'app/CommonTestAndPreview/SEND_TEST_MES
|
|
|
33
33
|
export const GET_TEST_CUSTOMERS_REQUESTED = 'app/CommonTestAndPreview/GET_TEST_CUSTOMERS_REQUESTED';
|
|
34
34
|
export const GET_TEST_CUSTOMERS_SUCCESS = 'app/CommonTestAndPreview/GET_TEST_CUSTOMERS_SUCCESS';
|
|
35
35
|
export const GET_TEST_CUSTOMERS_FAILURE = 'app/CommonTestAndPreview/GET_TEST_CUSTOMERS_FAILURE';
|
|
36
|
-
export const ADD_TEST_CUSTOMER = 'app/CommonTestAndPreview/ADD_TEST_CUSTOMER';
|
|
37
36
|
|
|
38
37
|
// Test Groups
|
|
39
38
|
export const GET_TEST_GROUPS_REQUESTED = 'app/CommonTestAndPreview/GET_TEST_GROUPS_REQUESTED';
|
|
@@ -66,12 +65,6 @@ export const GET_WECRM_ACCOUNTS_REQUESTED = 'app/CommonTestAndPreview/GET_WECRM_
|
|
|
66
65
|
export const GET_WECRM_ACCOUNTS_SUCCESS = 'app/CommonTestAndPreview/GET_WECRM_ACCOUNTS_SUCCESS';
|
|
67
66
|
export const GET_WECRM_ACCOUNTS_FAILURE = 'app/CommonTestAndPreview/GET_WECRM_ACCOUNTS_FAILURE';
|
|
68
67
|
|
|
69
|
-
// ============================================
|
|
70
|
-
// CUSTOMER MODAL TYPE (test customer addition)
|
|
71
|
-
// ============================================
|
|
72
|
-
export const CUSTOMER_MODAL_NEW = 'new';
|
|
73
|
-
export const CUSTOMER_MODAL_EXISTING = 'existing';
|
|
74
|
-
|
|
75
68
|
// ============================================
|
|
76
69
|
// CHANNEL CONSTANTS
|
|
77
70
|
// ============================================
|
|
@@ -107,21 +100,14 @@ export const CLIENT_NAME_CREATIVES = 'CREATIVES';
|
|
|
107
100
|
// Note: API uses "PUSH" instead of "MOBILEPUSH" for MobilePush channel
|
|
108
101
|
export const API_CHANNEL_PUSH = 'PUSH';
|
|
109
102
|
|
|
110
|
-
// ============================================
|
|
111
|
-
// VALIDATION REGEX (shared with commonUtils for email/mobile validation)
|
|
112
|
-
// ============================================
|
|
113
|
-
export const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
114
|
-
export const PHONE_REGEX = /^[1-9]\d{7,14}$/;
|
|
115
|
-
|
|
116
103
|
// ============================================
|
|
117
104
|
// IDENTIFIER TYPE CONSTANTS
|
|
118
105
|
// ============================================
|
|
119
|
-
export const IDENTIFIER_TYPE_EMAIL = 'email';
|
|
120
106
|
export const IDENTIFIER_TYPE_MOBILE = 'mobile';
|
|
121
107
|
export const IDENTIFIER_TYPE_PHONE = 'phone';
|
|
122
108
|
|
|
123
109
|
// Customer creation modal – input error state class suffix (used with customer-creation-modal-input)
|
|
124
|
-
export const INPUT_HAS_ERROR_CLASS = ' has-
|
|
110
|
+
export const INPUT_HAS_ERROR_CLASS = ' has-error';
|
|
125
111
|
|
|
126
112
|
// ============================================
|
|
127
113
|
// CHANNEL NAME CONSTANTS (for CDN and other utilities)
|
|
@@ -17,9 +17,6 @@ import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
|
|
|
17
17
|
import CapHeader from '@capillarytech/cap-ui-library/CapHeader';
|
|
18
18
|
import CapDivider from '@capillarytech/cap-ui-library/CapDivider';
|
|
19
19
|
import CapNotification from '@capillarytech/cap-ui-library/CapNotification';
|
|
20
|
-
import CapSpin from '@capillarytech/cap-ui-library/CapSpin';
|
|
21
|
-
import CustomerCreationModal from './CustomerCreationModal';
|
|
22
|
-
import { createTestCustomer } from '../../services/api';
|
|
23
20
|
|
|
24
21
|
// Import messages and styles
|
|
25
22
|
import messages from './messages';
|
|
@@ -30,16 +27,10 @@ import LeftPanelContent from './LeftPanelContent';
|
|
|
30
27
|
import CustomValuesEditor from './CustomValuesEditor';
|
|
31
28
|
import SendTestMessage from './SendTestMessage';
|
|
32
29
|
import PreviewSection from './PreviewSection';
|
|
33
|
-
|
|
34
|
-
import ExistingCustomerModal from './ExistingCustomerModal';
|
|
30
|
+
|
|
35
31
|
// Import constants
|
|
36
32
|
import {
|
|
37
33
|
CHANNELS,
|
|
38
|
-
CUSTOMER_MODAL_NEW,
|
|
39
|
-
CUSTOMER_MODAL_EXISTING,
|
|
40
|
-
IDENTIFIER_TYPE_EMAIL,
|
|
41
|
-
IDENTIFIER_TYPE_MOBILE,
|
|
42
|
-
IDENTIFIER_TYPE_PHONE,
|
|
43
34
|
TEST,
|
|
44
35
|
DESKTOP,
|
|
45
36
|
ANDROID,
|
|
@@ -83,8 +74,6 @@ import {
|
|
|
83
74
|
|
|
84
75
|
// Import utilities
|
|
85
76
|
import { getCdnUrl } from '../../utils/cdnTransformation';
|
|
86
|
-
import { isValidEmail, isValidMobile } from '../../utils/commonUtils';
|
|
87
|
-
import { getMembersLookup } from '../../services/api';
|
|
88
77
|
|
|
89
78
|
/**
|
|
90
79
|
* Preview Component Factory - REMOVED IN PHASE 5
|
|
@@ -141,11 +130,6 @@ const CommonTestAndPreview = (props) => {
|
|
|
141
130
|
const [customValues, setCustomValues] = useState({});
|
|
142
131
|
const [showJSON, setShowJSON] = useState(false);
|
|
143
132
|
const [tagsExtracted, setTagsExtracted] = useState(false);
|
|
144
|
-
const [searchValue, setSearchValue] = useState("");
|
|
145
|
-
const [customerModal, setCustomerModal] = useState([false, ""]);
|
|
146
|
-
const [isCustomerDataLoading, setIsCustomerDataLoading] = useState(false);
|
|
147
|
-
const [customerData, setCustomerData] = useState({ name: '', email: '', mobile: '', customerId: '' });
|
|
148
|
-
|
|
149
133
|
// Initialize device based on channel: SMS uses Android/iOS, others use Desktop/Mobile
|
|
150
134
|
// Initialize device based on channel: SMS, WhatsApp, RCS, InApp, MobilePush, and Viber use Android/iOS, others use Desktop/Mobile
|
|
151
135
|
const initialDevice = (channel === CHANNELS.SMS || channel === CHANNELS.WHATSAPP || channel === CHANNELS.RCS || channel === CHANNELS.INAPP || channel === CHANNELS.MOBILEPUSH || channel === CHANNELS.VIBER) ? ANDROID : DESKTOP;
|
|
@@ -364,7 +348,7 @@ const CommonTestAndPreview = (props) => {
|
|
|
364
348
|
return content || '';
|
|
365
349
|
}, [channel, formData, currentTab, beeContent, content, beeInstance]);
|
|
366
350
|
|
|
367
|
-
// Build test entities tree data
|
|
351
|
+
// Build test entities tree data
|
|
368
352
|
const testEntitiesTreeData = useMemo(() => {
|
|
369
353
|
const groupsNode = {
|
|
370
354
|
title: 'Groups',
|
|
@@ -377,10 +361,7 @@ const CommonTestAndPreview = (props) => {
|
|
|
377
361
|
title: 'Individuals',
|
|
378
362
|
value: 'customers-node',
|
|
379
363
|
selectable: false,
|
|
380
|
-
children: testCustomers?.map((customer) => ({
|
|
381
|
-
title: customer?.name?.trim() || customer?.email?.trim() || customer?.mobile?.trim() || customer?.userId || customer?.customerId,
|
|
382
|
-
value: customer?.userId ?? customer?.customerId,
|
|
383
|
-
})) || [],
|
|
364
|
+
children: testCustomers?.map((customer) => ({ title: customer.name, value: customer?.userId })),
|
|
384
365
|
};
|
|
385
366
|
|
|
386
367
|
return [groupsNode, customersNode];
|
|
@@ -410,13 +391,15 @@ const CommonTestAndPreview = (props) => {
|
|
|
410
391
|
/**
|
|
411
392
|
* Common handler for saving test customers (both new and existing)
|
|
412
393
|
*/
|
|
413
|
-
const handleSaveTestCustomer = async (validationErrors = {},setIsLoading
|
|
394
|
+
const handleSaveTestCustomer = async (validationErrors = {},setIsLoading) => {
|
|
414
395
|
// Check for validation errors before saving (for new customers)
|
|
415
396
|
if (customerModal[1] === CUSTOMER_MODAL_NEW && (validationErrors.email || validationErrors.mobile)) {
|
|
416
397
|
return;
|
|
417
398
|
}
|
|
418
399
|
|
|
419
|
-
setIsLoading
|
|
400
|
+
if (typeof setIsLoading === 'function') {
|
|
401
|
+
setIsLoading(true);
|
|
402
|
+
}
|
|
420
403
|
|
|
421
404
|
try {
|
|
422
405
|
let payload;
|
|
@@ -2576,6 +2559,7 @@ const CommonTestAndPreview = (props) => {
|
|
|
2576
2559
|
* Handle extract tags
|
|
2577
2560
|
*/
|
|
2578
2561
|
const handleExtractTags = () => {
|
|
2562
|
+
// Get content based on channel
|
|
2579
2563
|
let contentToExtract = getCurrentContent;
|
|
2580
2564
|
|
|
2581
2565
|
if (channel === CHANNELS.EMAIL && formData) {
|
|
@@ -2676,10 +2660,7 @@ const CommonTestAndPreview = (props) => {
|
|
|
2676
2660
|
|
|
2677
2661
|
if (!success) {
|
|
2678
2662
|
const errorMessage = response?.message || response?.status?.message || formatMessage(messages.memberLookupError);
|
|
2679
|
-
CapNotification.error({
|
|
2680
|
-
message: formatMessage(messages.memberLookupError),
|
|
2681
|
-
description: errorMessage,
|
|
2682
|
-
});
|
|
2663
|
+
CapNotification.error({ title: formatMessage(messages.errorTitle), message: errorMessage });
|
|
2683
2664
|
return;
|
|
2684
2665
|
}
|
|
2685
2666
|
|
|
@@ -2713,7 +2694,6 @@ const CommonTestAndPreview = (props) => {
|
|
|
2713
2694
|
} catch {
|
|
2714
2695
|
CapNotification.error({
|
|
2715
2696
|
message: formatMessage(messages.memberLookupError),
|
|
2716
|
-
description: formatMessage(messages.memberLookupError),
|
|
2717
2697
|
});
|
|
2718
2698
|
} finally {
|
|
2719
2699
|
setIsCustomerDataLoading(false);
|
|
@@ -2838,7 +2818,6 @@ const CommonTestAndPreview = (props) => {
|
|
|
2838
2818
|
content={getCurrentContent}
|
|
2839
2819
|
channel={channel}
|
|
2840
2820
|
isSendingTestMessage={isSendingTestMessage}
|
|
2841
|
-
renderAddTestCustomerButton={renderAddTestCustomerButton}
|
|
2842
2821
|
formatMessage={formatMessage}
|
|
2843
2822
|
deliverySettings={testPreviewDeliverySettings[channel]}
|
|
2844
2823
|
senderDetailsOptions={senderDetailsByChannel[channel]}
|
|
@@ -2847,8 +2826,6 @@ const CommonTestAndPreview = (props) => {
|
|
|
2847
2826
|
isLoadingSenderDetails={isLoadingSenderDetails}
|
|
2848
2827
|
smsTraiDltEnabled={smsTraiDltEnabled}
|
|
2849
2828
|
registeredSenderIds={registeredSenderIds}
|
|
2850
|
-
searchValue={searchValue}
|
|
2851
|
-
setSearchValue={setSearchValue}
|
|
2852
2829
|
/>
|
|
2853
2830
|
);
|
|
2854
2831
|
|
|
@@ -2858,20 +2835,6 @@ const CommonTestAndPreview = (props) => {
|
|
|
2858
2835
|
/>
|
|
2859
2836
|
);
|
|
2860
2837
|
|
|
2861
|
-
const renderAddTestCustomerButton = () => {
|
|
2862
|
-
const value = searchValue || "";
|
|
2863
|
-
const showAddButton =
|
|
2864
|
-
[CHANNELS.EMAIL, CHANNELS.SMS].includes(channel) &&
|
|
2865
|
-
(channel === CHANNELS.EMAIL ? isValidEmail(value) : isValidMobile(value));
|
|
2866
|
-
if (!showAddButton) return null;
|
|
2867
|
-
return (
|
|
2868
|
-
<AddTestCustomerButton
|
|
2869
|
-
searchValue={value}
|
|
2870
|
-
handleAddTestCustomer={handleAddTestCustomer}
|
|
2871
|
-
/>
|
|
2872
|
-
);
|
|
2873
|
-
};
|
|
2874
|
-
|
|
2875
2838
|
// Header content for the slidebox
|
|
2876
2839
|
const slideboxHeader = (
|
|
2877
2840
|
<CapRow className="test-preview-header">
|
|
@@ -2891,18 +2854,14 @@ const CommonTestAndPreview = (props) => {
|
|
|
2891
2854
|
show={show}
|
|
2892
2855
|
size="size-xl"
|
|
2893
2856
|
content={(
|
|
2894
|
-
<
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
{channel === CHANNELS.ZALO ? null : renderLeftPanelContent()}
|
|
2903
|
-
<CapDivider className="panel-divider" />
|
|
2904
|
-
|
|
2905
|
-
{/* Send Test Message Section */}
|
|
2857
|
+
<CapRow className="test-preview-container">
|
|
2858
|
+
<CapRow className="test-and-preview-panels">
|
|
2859
|
+
{/* Left Panel */}
|
|
2860
|
+
<CapRow className="left-panel">
|
|
2861
|
+
{channel === CHANNELS.ZALO ? null : renderLeftPanelContent()}
|
|
2862
|
+
<CapDivider className="panel-divider" />
|
|
2863
|
+
|
|
2864
|
+
{/* Send Test Message Section */}
|
|
2906
2865
|
{config.enableTestMessage !== false && (
|
|
2907
2866
|
<CapRow className="panel-section send-test-section">
|
|
2908
2867
|
{renderSendTestMessage()}
|
|
@@ -2916,27 +2875,7 @@ const CommonTestAndPreview = (props) => {
|
|
|
2916
2875
|
{renderPreview()}
|
|
2917
2876
|
</CapRow>
|
|
2918
2877
|
</CapRow>
|
|
2919
|
-
|
|
2920
|
-
<ExistingCustomerModal
|
|
2921
|
-
customerData={customerData}
|
|
2922
|
-
setCustomerModal={setCustomerModal}
|
|
2923
|
-
customerModal={customerModal}
|
|
2924
|
-
channel={channel}
|
|
2925
|
-
onSave={handleSaveTestCustomer}
|
|
2926
|
-
/>
|
|
2927
|
-
)}
|
|
2928
|
-
{customerModal[0] && customerModal[1] === CUSTOMER_MODAL_NEW && (
|
|
2929
|
-
<CustomerCreationModal
|
|
2930
|
-
customerData={customerData}
|
|
2931
|
-
setCustomerData={setCustomerData}
|
|
2932
|
-
setCustomerModal={setCustomerModal}
|
|
2933
|
-
customerModal={customerModal}
|
|
2934
|
-
onSave={handleSaveTestCustomer}
|
|
2935
|
-
channel={channel}
|
|
2936
|
-
/>
|
|
2937
|
-
)}
|
|
2938
|
-
</CapRow>
|
|
2939
|
-
</CapSpin>
|
|
2878
|
+
</CapRow>
|
|
2940
2879
|
)}
|
|
2941
2880
|
/>
|
|
2942
2881
|
);
|
|
@@ -3038,4 +2977,4 @@ CommonTestAndPreview.defaultProps = {
|
|
|
3038
2977
|
// Note: Redux connection is handled by the wrapper components (e.g., TestAndPreviewSlidebox)
|
|
3039
2978
|
// This component receives all Redux props (including intl) from its parent
|
|
3040
2979
|
|
|
3041
|
-
export default CommonTestAndPreview;
|
|
2980
|
+
export default CommonTestAndPreview;
|