@capillarytech/creatives-library 7.12.50 → 7.12.53
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/config/app.js +0 -1
- package/package.json +1 -1
- package/services/api.js +15 -2
- package/v2Components/CapImageUpload/index.js +33 -17
- package/v2Components/CapImageUpload/messages.js +11 -3
- package/v2Components/CapWhatsappCTA/constants.js +12 -1
- package/v2Components/CapWhatsappCTA/index.js +88 -29
- package/v2Components/CapWhatsappCTA/index.scss +4 -6
- package/v2Components/CapWhatsappCTA/messages.js +24 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +9 -8
- package/v2Components/TemplatePreview/index.js +8 -6
- package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +3 -19
- package/v2Components/TemplatePreview/tests/index.test.js +0 -2
- package/v2Components/WhatsappStatusContainer/index.js +42 -52
- package/v2Containers/Cap/tests/index.test.js +2 -2
- package/v2Containers/CreativesContainer/SlideBoxContent.js +8 -8
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +28 -36
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +165 -344
- package/v2Containers/CreativesContainer/tests/index.test.js +0 -3
- package/v2Containers/Line/Container/ImageCarousel/Content.js +15 -29
- package/v2Containers/Line/Container/ImageCarousel/constants.js +3 -0
- package/v2Containers/Line/Container/ImageCarousel/index.js +28 -40
- package/v2Containers/Line/Container/ImageCarousel/messages.js +2 -2
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +9851 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +21113 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/content.test.js +71 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/index.test.js +58 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/mockData.js +1322 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/utils.test.js +13 -0
- package/v2Containers/Line/Container/ImageCarousel/utils.js +12 -0
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +84451 -0
- package/v2Containers/Line/Container/Wrapper/tests/index.test.js +58 -0
- package/v2Containers/Line/Container/Wrapper/tests/mockData.js +171 -0
- package/v2Containers/Line/Container/index.js +5 -1
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +63597 -0
- package/v2Containers/Line/Container/tests/index.test.js +105 -0
- package/v2Containers/Line/Container/tests/mockData.js +1334 -0
- package/v2Containers/Templates/_templates.scss +5 -0
- package/v2Containers/Templates/actions.js +7 -0
- package/v2Containers/Templates/constants.js +9 -1
- package/v2Containers/Templates/index.js +45 -30
- package/v2Containers/Templates/messages.js +1 -1
- package/v2Containers/Templates/reducer.js +15 -0
- package/v2Containers/Templates/sagas.js +32 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1774 -1881
- package/v2Containers/Templates/tests/index.test.js +14 -3
- package/v2Containers/Whatsapp/actions.js +22 -0
- package/v2Containers/Whatsapp/constants.js +56 -23
- package/v2Containers/Whatsapp/index.js +204 -66
- package/v2Containers/Whatsapp/index.scss +18 -2
- package/v2Containers/Whatsapp/messages.js +35 -7
- package/v2Containers/Whatsapp/reducer.js +35 -1
- package/v2Containers/Whatsapp/sagas.js +30 -1
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +44349 -32926
- package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +15 -21
- package/v2Containers/Whatsapp/utils.js +16 -9
- package/v2Containers/mockdata.js +210 -555
|
@@ -17,6 +17,7 @@ describe('Test Templates container', () => {
|
|
|
17
17
|
const setChannelAccount = jest.fn();
|
|
18
18
|
const getAllTemplates = jest.fn();
|
|
19
19
|
const getUserList = jest.fn();
|
|
20
|
+
const getSenderDetails = jest.fn();
|
|
20
21
|
let renderedComponent;
|
|
21
22
|
|
|
22
23
|
beforeEach(() => {
|
|
@@ -35,6 +36,7 @@ describe('Test Templates container', () => {
|
|
|
35
36
|
setChannelAccount,
|
|
36
37
|
getAllTemplates,
|
|
37
38
|
getUserList,
|
|
39
|
+
getSenderDetails,
|
|
38
40
|
}}
|
|
39
41
|
location={{
|
|
40
42
|
pathname: "/whatsapp",
|
|
@@ -56,8 +58,11 @@ describe('Test Templates container', () => {
|
|
|
56
58
|
renderFunction();
|
|
57
59
|
expect(renderedComponent).toMatchSnapshot();
|
|
58
60
|
|
|
59
|
-
expect(
|
|
60
|
-
expect(
|
|
61
|
+
expect(getSenderDetails).toHaveBeenCalledTimes(1);
|
|
62
|
+
expect(getSenderDetails).toHaveBeenCalledWith({
|
|
63
|
+
channel: 'WHATSAPP',
|
|
64
|
+
orgUnitId: -1,
|
|
65
|
+
});
|
|
61
66
|
});
|
|
62
67
|
|
|
63
68
|
|
|
@@ -115,12 +120,18 @@ describe('Test Templates container', () => {
|
|
|
115
120
|
expect(renderedComponent).toMatchSnapshot();
|
|
116
121
|
});
|
|
117
122
|
|
|
118
|
-
it('Test max templates exceeded', () => {
|
|
123
|
+
it('Test max templates not exceeded', () => {
|
|
119
124
|
renderFunction(true);
|
|
120
125
|
renderedComponent.setProps({TemplatesList: [{ ...TemplatesProp.templates[0], totalCount: 260 }]});
|
|
121
126
|
expect(renderedComponent).toMatchSnapshot();
|
|
122
127
|
});
|
|
123
128
|
|
|
129
|
+
it('Test max templates exceeded', () => {
|
|
130
|
+
renderFunction(true);
|
|
131
|
+
renderedComponent.setProps({TemplatesList: [{ ...TemplatesProp.templates[0], totalCount: 1510 }]});
|
|
132
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
133
|
+
});
|
|
134
|
+
|
|
124
135
|
it('Test max templates warning', () => {
|
|
125
136
|
renderFunction(true);
|
|
126
137
|
renderedComponent.setProps({TemplatesList: [{ ...TemplatesProp.templates[0], totalCount: 248 }]});
|
|
@@ -4,6 +4,8 @@ import {
|
|
|
4
4
|
GET_TEMPLATE_DETAILS_REQUEST,
|
|
5
5
|
RESET_EDIT_TEMPLATE,
|
|
6
6
|
WHATSAPP,
|
|
7
|
+
UPLOAD_WHATSAPP_ASSET_REQUEST,
|
|
8
|
+
CLEAR_WHATSAPP_ASSET,
|
|
7
9
|
} from './constants';
|
|
8
10
|
|
|
9
11
|
export function createWhatsappTemplate(payload, callback) {
|
|
@@ -32,3 +34,23 @@ export function resetEditTemplate() {
|
|
|
32
34
|
type: RESET_EDIT_TEMPLATE,
|
|
33
35
|
};
|
|
34
36
|
}
|
|
37
|
+
|
|
38
|
+
export const uploadWhatsappAsset = (
|
|
39
|
+
file,
|
|
40
|
+
assetType,
|
|
41
|
+
fileParams,
|
|
42
|
+
templateType,
|
|
43
|
+
whatsappParams,
|
|
44
|
+
) => ({
|
|
45
|
+
type: UPLOAD_WHATSAPP_ASSET_REQUEST,
|
|
46
|
+
file,
|
|
47
|
+
assetType,
|
|
48
|
+
fileParams,
|
|
49
|
+
templateType,
|
|
50
|
+
whatsappParams,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export const clearWhatsappAsset = (templateType) => ({
|
|
54
|
+
type: CLEAR_WHATSAPP_ASSET,
|
|
55
|
+
templateType,
|
|
56
|
+
});
|
|
@@ -13,27 +13,24 @@ export const UNSUBSCRIBE_TEXT_LENGTH = 36;
|
|
|
13
13
|
export const TEMPLATE_MESSAGE_MAX_LENGTH = 1024;
|
|
14
14
|
export const WHATSAPP = 'WHATSAPP';
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export const TEMPLATE_CREATE_SUCCESS =
|
|
19
|
-
|
|
20
|
-
export const
|
|
21
|
-
'app/v2Containers/Whatsapp/TEMPLATE_CREATE_FAILURE';
|
|
22
|
-
export const CLEAR_CREATE_RESPONSE_REQUEST =
|
|
23
|
-
'app/v2Containers/Whatsapp/CLEAR_CREATE_RESPONSE_REQUEST';
|
|
16
|
+
const prefix = 'app/v2Containers/Whatsapp';
|
|
17
|
+
export const TEMPLATE_CREATE_REQUEST = `${prefix}/TEMPLATE_CREATE_REQUEST`;
|
|
18
|
+
export const TEMPLATE_CREATE_SUCCESS = `${prefix}/TEMPLATE_CREATE_SUCCESS`;
|
|
19
|
+
export const TEMPLATE_CREATE_FAILURE = `${prefix}/TEMPLATE_CREATE_FAILURE`;
|
|
20
|
+
export const CLEAR_CREATE_RESPONSE_REQUEST = `${prefix}/CLEAR_CREATE_RESPONSE_REQUEST`;
|
|
24
21
|
// FOR EDIT
|
|
25
|
-
export const GET_TEMPLATE_DETAILS_REQUEST =
|
|
26
|
-
|
|
27
|
-
export const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export const
|
|
32
|
-
|
|
22
|
+
export const GET_TEMPLATE_DETAILS_REQUEST = `${prefix}/Edit/GET_TEMPLATE_DETAILS_REQUEST`;
|
|
23
|
+
export const GET_TEMPLATE_DETAILS_SUCCESS = `${prefix}/Edit/GET_TEMPLATE_DETAILS_SUCCESS`;
|
|
24
|
+
export const GET_TEMPLATE_DETAILS_FAILURE = `${prefix}/Edit/GET_TEMPLATE_DETAILS_FAILURE`;
|
|
25
|
+
export const RESET_EDIT_TEMPLATE = `${prefix}/Edit/RESET_EDIT_TEMPLATE`;
|
|
26
|
+
|
|
27
|
+
export const UPLOAD_WHATSAPP_ASSET_REQUEST = `${prefix}/UPLOAD_WHATSAPP_ASSET_REQUEST`;
|
|
28
|
+
export const UPLOAD_WHATSAPP_ASSET_SUCCESS = `${prefix}/UPLOAD_WHATSAPP_ASSET_SUCCESS`;
|
|
29
|
+
export const UPLOAD_WHATSAPP_ASSET_FAILURE = `${prefix}/UPLOAD_WHATSAPP_ASSET_FAILURE`;
|
|
30
|
+
export const CLEAR_WHATSAPP_ASSET = `${prefix}/CLEAR_WHATSAPP_ASSET`;
|
|
33
31
|
|
|
34
32
|
export const STATUS = 'status';
|
|
35
33
|
export const CATEGORY = 'category';
|
|
36
|
-
const tooltip = 'Tooltip';
|
|
37
34
|
|
|
38
35
|
export const WHATSAPP_CATEGORIES = {
|
|
39
36
|
alertUpdate: 'ALERT_UPDATE',
|
|
@@ -41,21 +38,51 @@ export const WHATSAPP_CATEGORIES = {
|
|
|
41
38
|
appointmentUpdate: 'APPOINTMENT_UPDATE',
|
|
42
39
|
paymentUpdate: 'PAYMENT_UPDATE',
|
|
43
40
|
reservationUpdate: 'RESERVATION_UPDATE',
|
|
41
|
+
transactional: 'TRANSACTIONAL',
|
|
42
|
+
marketing: 'MARKETING',
|
|
43
|
+
otp: 'OTP',
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
export const
|
|
46
|
+
export const KARIX_CATEGORY_OPTIONS = [
|
|
47
|
+
{
|
|
48
|
+
key: 'transactional',
|
|
49
|
+
value: WHATSAPP_CATEGORIES.transactional,
|
|
50
|
+
label: <FormattedMessage {...messages.transactional} />,
|
|
51
|
+
tooltipLabel: <FormattedMessage {...messages.transactionalTooltip} />,
|
|
52
|
+
tagColor: CAP_PURPLE03,
|
|
53
|
+
tagTextColor: CAP_PURPLE02,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: 'marketing',
|
|
57
|
+
value: WHATSAPP_CATEGORIES.marketing,
|
|
58
|
+
label: <FormattedMessage {...messages.marketing} />,
|
|
59
|
+
tooltipLabel: <FormattedMessage {...messages.marketingTooltip} />,
|
|
60
|
+
tagColor: CAP_ORANGE01,
|
|
61
|
+
tagTextColor: CAP_ORANGE,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
key: 'otp',
|
|
65
|
+
value: WHATSAPP_CATEGORIES.otp,
|
|
66
|
+
label: <FormattedMessage {...messages.otp} />,
|
|
67
|
+
tooltipLabel: <FormattedMessage {...messages.otpTooltip} />,
|
|
68
|
+
tagColor: CAP_GREEN02,
|
|
69
|
+
tagTextColor: CAP_GREEN01,
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
export const TWILIO_CATEGORY_OPTIONS = [
|
|
47
74
|
{
|
|
48
75
|
key: 'alertUpdate',
|
|
49
76
|
value: WHATSAPP_CATEGORIES.alertUpdate,
|
|
50
77
|
label: <FormattedMessage {...messages.alertUpdate} />,
|
|
51
|
-
tooltipLabel: <FormattedMessage {...messages
|
|
78
|
+
tooltipLabel: <FormattedMessage {...messages.alertUpdateTooltip} />,
|
|
52
79
|
tagColor: CAP_PURPLE03,
|
|
53
80
|
tagTextColor: CAP_PURPLE02,
|
|
54
81
|
},
|
|
55
82
|
{
|
|
56
83
|
key: 'accountUpdate',
|
|
57
84
|
label: <FormattedMessage {...messages.accountUpdate} />,
|
|
58
|
-
tooltipLabel: <FormattedMessage {...messages
|
|
85
|
+
tooltipLabel: <FormattedMessage {...messages.accountUpdateTooltip} />,
|
|
59
86
|
value: WHATSAPP_CATEGORIES.accountUpdate,
|
|
60
87
|
tagColor: CAP_ORANGE01,
|
|
61
88
|
tagTextColor: CAP_ORANGE,
|
|
@@ -65,7 +92,7 @@ export const CATEGORY_OPTIONS = [
|
|
|
65
92
|
value: WHATSAPP_CATEGORIES.appointmentUpdate,
|
|
66
93
|
label: <FormattedMessage {...messages.appointmentUpdate} />,
|
|
67
94
|
tooltipLabel: (
|
|
68
|
-
<FormattedMessage {...messages
|
|
95
|
+
<FormattedMessage {...messages.appointmentUpdateTooltip} />
|
|
69
96
|
),
|
|
70
97
|
tagColor: CAP_GREEN02,
|
|
71
98
|
tagTextColor: CAP_GREEN01,
|
|
@@ -74,7 +101,7 @@ export const CATEGORY_OPTIONS = [
|
|
|
74
101
|
key: 'paymentUpdate',
|
|
75
102
|
value: WHATSAPP_CATEGORIES.paymentUpdate,
|
|
76
103
|
label: <FormattedMessage {...messages.paymentUpdate} />,
|
|
77
|
-
tooltipLabel: <FormattedMessage {...messages
|
|
104
|
+
tooltipLabel: <FormattedMessage {...messages.paymentUpdateTooltip} />,
|
|
78
105
|
tagColor: CAP_ORANGE01,
|
|
79
106
|
tagTextColor: CAP_ORANGE,
|
|
80
107
|
},
|
|
@@ -83,7 +110,7 @@ export const CATEGORY_OPTIONS = [
|
|
|
83
110
|
value: WHATSAPP_CATEGORIES.reservationUpdate,
|
|
84
111
|
label: <FormattedMessage {...messages.reservationUpdate} />,
|
|
85
112
|
tooltipLabel: (
|
|
86
|
-
<FormattedMessage {...messages
|
|
113
|
+
<FormattedMessage {...messages.reservationUpdateTooltip} />
|
|
87
114
|
),
|
|
88
115
|
tagColor: CAP_ORANGE01,
|
|
89
116
|
tagTextColor: CAP_ORANGE,
|
|
@@ -127,6 +154,7 @@ export const WHATSAPP_MEDIA_TYPES = {
|
|
|
127
154
|
TEXT: 'TEXT',
|
|
128
155
|
IMAGE: 'IMAGE',
|
|
129
156
|
VIDEO: 'VIDEO',
|
|
157
|
+
DOCUMENT: 'DOCUMENT',
|
|
130
158
|
};
|
|
131
159
|
export const NONE = 'NONE';
|
|
132
160
|
export const CTA = 'CTA';
|
|
@@ -150,6 +178,11 @@ export const INITIAL_CTA_DATA = [
|
|
|
150
178
|
},
|
|
151
179
|
];
|
|
152
180
|
|
|
181
|
+
export const ALLOWED_IMAGE_EXTENSIONS_REGEX = /\.(jpe?g|png)$/i;
|
|
182
|
+
export const WHATSAPP_IMG_SIZE = 5000000; // 5MB
|
|
183
|
+
export const HOST_TWILIO = 'twiliowhatsapptrans';
|
|
184
|
+
export const HOST_KARIX = 'karixwhatsappbulk';
|
|
185
|
+
|
|
153
186
|
export const LANGUAGE_OPTIONS = [
|
|
154
187
|
{
|
|
155
188
|
value: 'af',
|