@capillarytech/creatives-library 8.0.210 → 8.0.211
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 +1 -2
- package/package.json +1 -1
- package/services/api.js +0 -2
- package/v2Containers/CreativesContainer/SlideBoxContent.js +0 -2
- package/v2Containers/Rcs/index.js +34 -7
- package/v2Containers/Rcs/index.scss +4 -0
- package/v2Containers/Rcs/messages.js +12 -0
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +0 -151
- package/v2Containers/Rcs/tests/index.test.js +12 -0
- package/v2Containers/Rcs/tests/utils.test.js +5 -2
- package/v2Containers/Rcs/utils.js +5 -3
- package/v2Containers/Templates/index.js +3 -2
- package/v2Containers/Whatsapp/index.js +0 -1
package/config/app.js
CHANGED
|
@@ -20,8 +20,7 @@ const config = {
|
|
|
20
20
|
accountConfig: (strs, accountId) => `${window.location.origin}/org/config/AccountAdd?q=a&channelId=2&accountId=${accountId}&edit=1`,
|
|
21
21
|
},
|
|
22
22
|
development: {
|
|
23
|
-
|
|
24
|
-
api_endpoint: 'http://localhost:2022/arya/api/v1/creatives',
|
|
23
|
+
api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/creatives',
|
|
25
24
|
campaigns_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/campaigns',
|
|
26
25
|
campaigns_api_org_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/org/campaign',
|
|
27
26
|
auth_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/auth',
|
package/package.json
CHANGED
package/services/api.js
CHANGED
|
@@ -264,7 +264,6 @@ export const getUserData = () => {
|
|
|
264
264
|
|
|
265
265
|
export const createTemplate = ({template}) => {
|
|
266
266
|
const url = `${API_ENDPOINT}/templates/SMS`;
|
|
267
|
-
console.log("creating template",template);
|
|
268
267
|
return request(url, getAPICallObject('POST', template));
|
|
269
268
|
};
|
|
270
269
|
|
|
@@ -347,7 +346,6 @@ export const getAllTemplates = async ({channel, queryParams = {}}) => {
|
|
|
347
346
|
|
|
348
347
|
export const deleteTemplate = ({channel, id}) => {
|
|
349
348
|
const url = `${API_ENDPOINT}/templates/${id}/${channel}`;
|
|
350
|
-
console.log("deleting template", url);
|
|
351
349
|
return request(url, getAPICallObject('DELETE'));
|
|
352
350
|
//return API.deleteResource(url);
|
|
353
351
|
};
|
|
@@ -513,17 +513,21 @@ export const Rcs = (props) => {
|
|
|
513
513
|
case RCS_STATUSES.approved:
|
|
514
514
|
setTemplateStatus(RCS_STATUSES.approved);
|
|
515
515
|
break;
|
|
516
|
-
case RCS_STATUSES.rejected:
|
|
517
|
-
setTemplateStatus(RCS_STATUSES.rejected);
|
|
518
|
-
break;
|
|
519
516
|
case RCS_STATUSES.pending:
|
|
520
517
|
setTemplateStatus(RCS_STATUSES.pending);
|
|
521
518
|
break;
|
|
522
519
|
case RCS_STATUSES.awaitingApproval:
|
|
523
520
|
setTemplateStatus(RCS_STATUSES.awaitingApproval);
|
|
524
521
|
break;
|
|
525
|
-
|
|
522
|
+
case RCS_STATUSES.unavailable:
|
|
526
523
|
setTemplateStatus(RCS_STATUSES.unavailable);
|
|
524
|
+
break;
|
|
525
|
+
case RCS_STATUSES.rejected:
|
|
526
|
+
setTemplateStatus(RCS_STATUSES.rejected);
|
|
527
|
+
break;
|
|
528
|
+
default:
|
|
529
|
+
setTemplateStatus(status);
|
|
530
|
+
break;
|
|
527
531
|
}
|
|
528
532
|
};
|
|
529
533
|
|
|
@@ -2314,13 +2318,20 @@ const splitTemplateVarString = (str) => {
|
|
|
2314
2318
|
case RCS_STATUSES.rejected:
|
|
2315
2319
|
return (
|
|
2316
2320
|
<>
|
|
2317
|
-
<CapLabel type="label2"
|
|
2321
|
+
<CapLabel type="label2" className="rcs-status-label">
|
|
2318
2322
|
{formatMessage(messages.rejectedStatusMsg)}
|
|
2319
2323
|
</CapLabel>
|
|
2320
2324
|
</>
|
|
2321
2325
|
);
|
|
2322
|
-
|
|
2323
|
-
|
|
2326
|
+
case RCS_STATUSES.unavailable:
|
|
2327
|
+
return (
|
|
2328
|
+
<>
|
|
2329
|
+
<CapLabel type="label2" className="rcs-status-label">
|
|
2330
|
+
{formatMessage(messages.unavailableStatusMsg)}
|
|
2331
|
+
</CapLabel>
|
|
2332
|
+
</>
|
|
2333
|
+
);
|
|
2334
|
+
case RCS_STATUSES.pending:
|
|
2324
2335
|
return (
|
|
2325
2336
|
<>
|
|
2326
2337
|
<CapLabel type="label2" style={{ fontWeight: 500 }}>
|
|
@@ -2328,6 +2339,22 @@ const splitTemplateVarString = (str) => {
|
|
|
2328
2339
|
</CapLabel>
|
|
2329
2340
|
</>
|
|
2330
2341
|
);
|
|
2342
|
+
case RCS_STATUSES.rejected:
|
|
2343
|
+
return (
|
|
2344
|
+
<>
|
|
2345
|
+
<CapLabel type="label2" style={{ fontWeight: 500 }}>
|
|
2346
|
+
{formatMessage(messages.rejectedStatusMsg)}
|
|
2347
|
+
</CapLabel>
|
|
2348
|
+
</>
|
|
2349
|
+
);
|
|
2350
|
+
default:
|
|
2351
|
+
return (
|
|
2352
|
+
<>
|
|
2353
|
+
<CapLabel type="label2" className="rcs-status-label">
|
|
2354
|
+
{formatMessage(messages.templateStatusGeneric, { templateStatus })}
|
|
2355
|
+
</CapLabel>
|
|
2356
|
+
</>
|
|
2357
|
+
);
|
|
2331
2358
|
}
|
|
2332
2359
|
};
|
|
2333
2360
|
|
|
@@ -18,6 +18,14 @@ export default defineMessages({
|
|
|
18
18
|
id: `${prefix}.awaitingStatusMsg`,
|
|
19
19
|
defaultMessage: 'This template is awaiting approval',
|
|
20
20
|
},
|
|
21
|
+
unavailableStatusMsg: {
|
|
22
|
+
id: `${prefix}.unavailableStatusMsg`,
|
|
23
|
+
defaultMessage: 'This template is unavailable',
|
|
24
|
+
},
|
|
25
|
+
templateStatusGeneric: {
|
|
26
|
+
id: `${prefix}.templateStatusGeneric`,
|
|
27
|
+
defaultMessage: 'This template has been - {templateStatus}',
|
|
28
|
+
},
|
|
21
29
|
awaitingStatusDesc: {
|
|
22
30
|
id: `${prefix}.awaitingStatusDesc`,
|
|
23
31
|
defaultMessage:
|
|
@@ -391,6 +399,10 @@ export default defineMessages({
|
|
|
391
399
|
id: `${prefix}.unavailable_STATUS`,
|
|
392
400
|
defaultMessage: 'unavailable',
|
|
393
401
|
},
|
|
402
|
+
unknown_STATUS: {
|
|
403
|
+
id: `${prefix}.unknown_STATUS`,
|
|
404
|
+
defaultMessage: 'unknown',
|
|
405
|
+
},
|
|
394
406
|
templateTypeLabel: {
|
|
395
407
|
id: `${prefix}.templateTypeLabel`,
|
|
396
408
|
defaultMessage: 'Template Type',
|
|
@@ -137711,18 +137711,6 @@ new message content.",
|
|
|
137711
137711
|
"id": "creatives.containersV2.Rcs.carousel",
|
|
137712
137712
|
},
|
|
137713
137713
|
],
|
|
137714
|
-
Array [
|
|
137715
|
-
Object {
|
|
137716
|
-
"defaultMessage": "Template Status",
|
|
137717
|
-
"id": "creatives.containersV2.Rcs.templateStatusLabel",
|
|
137718
|
-
},
|
|
137719
|
-
],
|
|
137720
|
-
Array [
|
|
137721
|
-
Object {
|
|
137722
|
-
"defaultMessage": "This template is awaiting approval",
|
|
137723
|
-
"id": "creatives.containersV2.Rcs.awaitingStatusMsg",
|
|
137724
|
-
},
|
|
137725
|
-
],
|
|
137726
137714
|
Array [
|
|
137727
137715
|
Object {
|
|
137728
137716
|
"defaultMessage": "Enter template name",
|
|
@@ -137855,18 +137843,6 @@ new message content.",
|
|
|
137855
137843
|
"id": "creatives.containersV2.Rcs.carousel",
|
|
137856
137844
|
},
|
|
137857
137845
|
],
|
|
137858
|
-
Array [
|
|
137859
|
-
Object {
|
|
137860
|
-
"defaultMessage": "Template Status",
|
|
137861
|
-
"id": "creatives.containersV2.Rcs.templateStatusLabel",
|
|
137862
|
-
},
|
|
137863
|
-
],
|
|
137864
|
-
Array [
|
|
137865
|
-
Object {
|
|
137866
|
-
"defaultMessage": "This template is awaiting approval",
|
|
137867
|
-
"id": "creatives.containersV2.Rcs.awaitingStatusMsg",
|
|
137868
|
-
},
|
|
137869
|
-
],
|
|
137870
137846
|
Array [
|
|
137871
137847
|
Object {
|
|
137872
137848
|
"defaultMessage": "Enter template name",
|
|
@@ -138321,22 +138297,6 @@ new message content.",
|
|
|
138321
138297
|
"type": "return",
|
|
138322
138298
|
"value": undefined,
|
|
138323
138299
|
},
|
|
138324
|
-
Object {
|
|
138325
|
-
"type": "return",
|
|
138326
|
-
"value": undefined,
|
|
138327
|
-
},
|
|
138328
|
-
Object {
|
|
138329
|
-
"type": "return",
|
|
138330
|
-
"value": undefined,
|
|
138331
|
-
},
|
|
138332
|
-
Object {
|
|
138333
|
-
"type": "return",
|
|
138334
|
-
"value": undefined,
|
|
138335
|
-
},
|
|
138336
|
-
Object {
|
|
138337
|
-
"type": "return",
|
|
138338
|
-
"value": undefined,
|
|
138339
|
-
},
|
|
138340
138300
|
],
|
|
138341
138301
|
},
|
|
138342
138302
|
}
|
|
@@ -138455,117 +138415,6 @@ new message content.",
|
|
|
138455
138415
|
className="ant-spin-container ant-spin-blur"
|
|
138456
138416
|
key="container"
|
|
138457
138417
|
>
|
|
138458
|
-
<CapRow
|
|
138459
|
-
className="template-status-container"
|
|
138460
|
-
>
|
|
138461
|
-
<Row
|
|
138462
|
-
className="cap-row-v2 template-status-container"
|
|
138463
|
-
gutter={0}
|
|
138464
|
-
>
|
|
138465
|
-
<div
|
|
138466
|
-
className="ant-row cap-row-v2 template-status-container"
|
|
138467
|
-
>
|
|
138468
|
-
<CapLabel
|
|
138469
|
-
key=".0"
|
|
138470
|
-
type="label2"
|
|
138471
|
-
>
|
|
138472
|
-
<div
|
|
138473
|
-
className="CapLabel-n7zsf5-0 jzfptu"
|
|
138474
|
-
type="label2"
|
|
138475
|
-
/>
|
|
138476
|
-
</CapLabel>
|
|
138477
|
-
<CapAlert
|
|
138478
|
-
key=".1"
|
|
138479
|
-
message={
|
|
138480
|
-
<React.Fragment>
|
|
138481
|
-
<CapLabel
|
|
138482
|
-
style={
|
|
138483
|
-
Object {
|
|
138484
|
-
"fontWeight": 500,
|
|
138485
|
-
}
|
|
138486
|
-
}
|
|
138487
|
-
type="label2"
|
|
138488
|
-
/>
|
|
138489
|
-
</React.Fragment>
|
|
138490
|
-
}
|
|
138491
|
-
type="warning"
|
|
138492
|
-
>
|
|
138493
|
-
<Alert
|
|
138494
|
-
className="cap-alert-v2"
|
|
138495
|
-
message={
|
|
138496
|
-
<React.Fragment>
|
|
138497
|
-
<CapLabel
|
|
138498
|
-
style={
|
|
138499
|
-
Object {
|
|
138500
|
-
"fontWeight": 500,
|
|
138501
|
-
}
|
|
138502
|
-
}
|
|
138503
|
-
type="label2"
|
|
138504
|
-
/>
|
|
138505
|
-
</React.Fragment>
|
|
138506
|
-
}
|
|
138507
|
-
type="warning"
|
|
138508
|
-
>
|
|
138509
|
-
<Animate
|
|
138510
|
-
animation={Object {}}
|
|
138511
|
-
component=""
|
|
138512
|
-
componentProps={Object {}}
|
|
138513
|
-
onAppear={[Function]}
|
|
138514
|
-
onEnd={[Function]}
|
|
138515
|
-
onEnter={[Function]}
|
|
138516
|
-
onLeave={[Function]}
|
|
138517
|
-
showProp="data-show"
|
|
138518
|
-
transitionAppear={false}
|
|
138519
|
-
transitionEnter={true}
|
|
138520
|
-
transitionLeave={true}
|
|
138521
|
-
transitionName="ant-alert-slide-up"
|
|
138522
|
-
>
|
|
138523
|
-
<AnimateChild
|
|
138524
|
-
animation={Object {}}
|
|
138525
|
-
key="rc_animate_1612267539410"
|
|
138526
|
-
transitionAppear={false}
|
|
138527
|
-
transitionEnter={true}
|
|
138528
|
-
transitionLeave={true}
|
|
138529
|
-
transitionName="ant-alert-slide-up"
|
|
138530
|
-
>
|
|
138531
|
-
<div
|
|
138532
|
-
className="ant-alert ant-alert-warning ant-alert-no-icon cap-alert-v2"
|
|
138533
|
-
data-show={true}
|
|
138534
|
-
key="rc_animate_1612267539410"
|
|
138535
|
-
>
|
|
138536
|
-
<span
|
|
138537
|
-
className="ant-alert-message"
|
|
138538
|
-
>
|
|
138539
|
-
<CapLabel
|
|
138540
|
-
style={
|
|
138541
|
-
Object {
|
|
138542
|
-
"fontWeight": 500,
|
|
138543
|
-
}
|
|
138544
|
-
}
|
|
138545
|
-
type="label2"
|
|
138546
|
-
>
|
|
138547
|
-
<div
|
|
138548
|
-
className="CapLabel-n7zsf5-0 jzfptu"
|
|
138549
|
-
style={
|
|
138550
|
-
Object {
|
|
138551
|
-
"fontWeight": 500,
|
|
138552
|
-
}
|
|
138553
|
-
}
|
|
138554
|
-
type="label2"
|
|
138555
|
-
/>
|
|
138556
|
-
</CapLabel>
|
|
138557
|
-
</span>
|
|
138558
|
-
<span
|
|
138559
|
-
className="ant-alert-description"
|
|
138560
|
-
/>
|
|
138561
|
-
</div>
|
|
138562
|
-
</AnimateChild>
|
|
138563
|
-
</Animate>
|
|
138564
|
-
</Alert>
|
|
138565
|
-
</CapAlert>
|
|
138566
|
-
</div>
|
|
138567
|
-
</Row>
|
|
138568
|
-
</CapRow>
|
|
138569
138418
|
<CapRow
|
|
138570
138419
|
className="cap-rcs-creatives"
|
|
138571
138420
|
>
|
|
@@ -179,6 +179,18 @@ describe('Creatives rcs test/>', () => {
|
|
|
179
179
|
expect(renderedComponent).toMatchSnapshot();
|
|
180
180
|
});
|
|
181
181
|
|
|
182
|
+
it('shows generic template status message for custom status', () => {
|
|
183
|
+
const details = JSON.parse(JSON.stringify(mockData.editData1.templateDetails));
|
|
184
|
+
details.versions.base.content.RCS.rcsContent.cardContent[0].Status = 'created';
|
|
185
|
+
renderHelper({ rcsData: { templateDetails: details } });
|
|
186
|
+
|
|
187
|
+
const calledWithGeneric = formatMessage.mock.calls.some(([msg, values]) => {
|
|
188
|
+
return msg && msg.id && msg.id.indexOf('.templateStatusGeneric') !== -1 && values && values.templateStatus === 'created';
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
expect(calledWithGeneric).toBe(true);
|
|
192
|
+
});
|
|
193
|
+
|
|
182
194
|
it('template title change', () => {
|
|
183
195
|
renderHelper({});
|
|
184
196
|
// Test that title field is NOT present for text_message template type (default)
|
|
@@ -102,6 +102,9 @@ describe('RCS utils', () => {
|
|
|
102
102
|
it('returns pending for awaitingApproval', () => {
|
|
103
103
|
expect(getRcsStatusType(RCS_STATUSES.awaitingApproval)).toBe(RCS_STATUSES.pending);
|
|
104
104
|
});
|
|
105
|
+
it('returns pending for pending', () => {
|
|
106
|
+
expect(getRcsStatusType(RCS_STATUSES.pending)).toBe(RCS_STATUSES.pending);
|
|
107
|
+
});
|
|
105
108
|
it('returns rejected for rejected', () => {
|
|
106
109
|
expect(getRcsStatusType(RCS_STATUSES.rejected)).toBe(RCS_STATUSES.rejected);
|
|
107
110
|
});
|
|
@@ -111,8 +114,8 @@ describe('RCS utils', () => {
|
|
|
111
114
|
it('returns approved for approved', () => {
|
|
112
115
|
expect(getRcsStatusType(RCS_STATUSES.approved)).toBe(RCS_STATUSES.approved);
|
|
113
116
|
});
|
|
114
|
-
it('returns
|
|
115
|
-
expect(getRcsStatusType('some_unknown_status')).toBe(RCS_STATUSES.
|
|
117
|
+
it('returns rejected for unknown status', () => {
|
|
118
|
+
expect(getRcsStatusType('some_unknown_status')).toBe(RCS_STATUSES.rejected);
|
|
116
119
|
});
|
|
117
120
|
});
|
|
118
121
|
|
|
@@ -11,12 +11,14 @@ export const getRcsStatusType = (status) => {
|
|
|
11
11
|
switch (status) {
|
|
12
12
|
case RCS_STATUSES.awaitingApproval:
|
|
13
13
|
return RCS_STATUSES.pending;
|
|
14
|
-
case RCS_STATUSES.rejected:
|
|
15
|
-
return RCS_STATUSES.rejected;
|
|
16
14
|
case RCS_STATUSES.unavailable:
|
|
17
15
|
return RCS_STATUSES.unavailable;
|
|
18
|
-
|
|
16
|
+
case RCS_STATUSES.approved:
|
|
19
17
|
return RCS_STATUSES.approved;
|
|
18
|
+
case RCS_STATUSES.pending:
|
|
19
|
+
return RCS_STATUSES.pending;
|
|
20
|
+
default:
|
|
21
|
+
return RCS_STATUSES.rejected;
|
|
20
22
|
}
|
|
21
23
|
};
|
|
22
24
|
|
|
@@ -1660,13 +1660,14 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1660
1660
|
case RCS: {
|
|
1661
1661
|
const status = get(template, "versions.base.content.RCS.rcsContent.cardContent[0].Status", "unavailable");
|
|
1662
1662
|
const name = get(template, "name", "");
|
|
1663
|
+
const statusDisplay=getRcsStatusType(status);
|
|
1663
1664
|
templateData.title = (
|
|
1664
1665
|
<CapRow>
|
|
1665
1666
|
<CapLabel className="whatsapp-rcs-template-name">{name}</CapLabel>
|
|
1666
1667
|
<CapRow type="flex" align="middle" className="rcs-status-container zalo-status-color">
|
|
1667
1668
|
<CapStatus
|
|
1668
|
-
type={
|
|
1669
|
-
text={
|
|
1669
|
+
type={statusDisplay}
|
|
1670
|
+
text={statusDisplay && this.props.intl.formatMessage(rcsMessages?.[`${statusDisplay}_STATUS`])}
|
|
1670
1671
|
labelType="label3"
|
|
1671
1672
|
/>
|
|
1672
1673
|
</CapRow>
|
|
@@ -1711,7 +1711,6 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1711
1711
|
};
|
|
1712
1712
|
|
|
1713
1713
|
const saveToMessage = () => {
|
|
1714
|
-
console.log("saveToMessage----> createPayload", createPayload());
|
|
1715
1714
|
getFormData({
|
|
1716
1715
|
value: createPayload(),
|
|
1717
1716
|
_id: params?.id,
|