@capillarytech/creatives-library 9.0.56-alpha.8 → 9.0.56
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
CHANGED
|
@@ -228,3 +228,10 @@ export const RCS_API_SMS_FALLBACK_KEYS = Object.freeze({
|
|
|
228
228
|
RCS_SMS_FALLBACK_VAR_MAPPED: 'rcsSmsFallbackVarMapped',
|
|
229
229
|
});
|
|
230
230
|
|
|
231
|
+
export const HTTP_METHODS = Object.freeze({
|
|
232
|
+
GET: 'GET',
|
|
233
|
+
POST: 'POST',
|
|
234
|
+
PUT: 'PUT',
|
|
235
|
+
PATCH: 'PATCH',
|
|
236
|
+
DELETE: 'DELETE',
|
|
237
|
+
});
|
package/package.json
CHANGED
package/services/api.js
CHANGED
|
@@ -12,6 +12,7 @@ import getSchema from './getSchema';
|
|
|
12
12
|
import * as API from '../utils/ApiCaller';
|
|
13
13
|
import { addBaseToTemplate, transformCustomFieldsData } from '../utils/commonUtils';
|
|
14
14
|
import { EMAIL, SMS, TRANSACTION } from '../v2Containers/CreativesContainer/constants';
|
|
15
|
+
import { HTTP_METHODS } from '../constants/unified';
|
|
15
16
|
let API_ENDPOINT = config.development.api_endpoint;
|
|
16
17
|
let EXPORT_API_ENDPOINT = config.development.exports_api_endpoint;
|
|
17
18
|
let CAMPAIGNS_API_ENDPOINT = config.development.campaigns_api_endpoint;
|
|
@@ -698,7 +699,7 @@ export const getLiquidTags = (content) => {
|
|
|
698
699
|
|
|
699
700
|
export const createCentralCommsMetaId = (payload, metaType = TRANSACTION) => {
|
|
700
701
|
const url = `${API_ENDPOINT}/common/central-comms/meta-id/${metaType}`;
|
|
701
|
-
return request(url, getAPICallObject(
|
|
702
|
+
return request(url, getAPICallObject(HTTP_METHODS.POST, payload, false, false, false, true));
|
|
702
703
|
};
|
|
703
704
|
|
|
704
705
|
// Use the CCS CommDefinition API for CommunicationFlow Save; keep legacy messageMeta APIs for CreativesContainer.
|
|
@@ -706,34 +707,34 @@ const COMM_DEFINITIONS_PATH = `${API_ENDPOINT}/comm-definitions`;
|
|
|
706
707
|
|
|
707
708
|
export const createCommDefinition = (payload) => {
|
|
708
709
|
const url = COMM_DEFINITIONS_PATH;
|
|
709
|
-
return request(url, getAPICallObject(
|
|
710
|
+
return request(url, getAPICallObject(HTTP_METHODS.POST, payload, false, false, false, true));
|
|
710
711
|
};
|
|
711
712
|
|
|
712
713
|
// Opens a new DRAFT version on an existing CommDefinition, preserving its id/referenceId.
|
|
713
714
|
export const editCommDefinition = (commDefinitionId, payload) => {
|
|
714
715
|
const url = `${COMM_DEFINITIONS_PATH}/${commDefinitionId}/edit`;
|
|
715
|
-
return request(url, getAPICallObject(
|
|
716
|
+
return request(url, getAPICallObject(HTTP_METHODS.POST, payload, false, false, false, true));
|
|
716
717
|
};
|
|
717
718
|
|
|
718
719
|
// notify/ui's "Send test" uses this instead of the legacy createMessageMeta/sendTestMessage flow.
|
|
719
720
|
export const sendTransactionalComm = (payload) => {
|
|
720
721
|
const url = `${COMM_DEFINITIONS_PATH}/send/transaction`;
|
|
721
|
-
return request(url, getAPICallObject(
|
|
722
|
+
return request(url, getAPICallObject(HTTP_METHODS.POST, payload, false, false, false, true));
|
|
722
723
|
};
|
|
723
724
|
|
|
724
725
|
export const getCentralCommsMetaIds = (metaIds, metaType = TRANSACTION) => {
|
|
725
726
|
const url = `${API_ENDPOINT}/common/central-comms/meta-id/${metaType}?metaIds=${metaIds}`;
|
|
726
|
-
return request(url, getAPICallObject(
|
|
727
|
+
return request(url, getAPICallObject(HTTP_METHODS.GET, null, false, false, false, true));
|
|
727
728
|
};
|
|
728
729
|
|
|
729
730
|
export const bulkClaimAndApprove = (payload, metaType = TRANSACTION) => {
|
|
730
731
|
const url = `${API_ENDPOINT}/common/central-comms/bulk-claim-approve/${metaType}`;
|
|
731
|
-
return request(url, getAPICallObject(
|
|
732
|
+
return request(url, getAPICallObject(HTTP_METHODS.POST, payload, false, false, false, true));
|
|
732
733
|
};
|
|
733
734
|
|
|
734
735
|
export const updateMetaConfig = (payload, metaType = TRANSACTION, metaId) => {
|
|
735
736
|
const url = `${API_ENDPOINT}/common/central-comms/meta-id/${metaType}/${metaId}`;
|
|
736
|
-
return request(url, getAPICallObject(
|
|
737
|
+
return request(url, getAPICallObject(HTTP_METHODS.PATCH, payload, false, false, false, true));
|
|
737
738
|
};
|
|
738
739
|
|
|
739
740
|
// Customer Search APIs for Email Test & Preview Feature
|
|
@@ -571,12 +571,7 @@ const WebPushCreate = ({
|
|
|
571
571
|
});
|
|
572
572
|
}, [isFullMode, templateName]);
|
|
573
573
|
|
|
574
|
-
//
|
|
575
|
-
// Done/Preview-and-test buttons as soon as the notification title or message is cleared.
|
|
576
|
-
// Both title and message are required fields for WebPush (see isSaveDisabled below), so the
|
|
577
|
-
// content is considered empty if either is blank/whitespace-only. Mirrors the Sms Create/Edit
|
|
578
|
-
// componentDidUpdate pattern — the ref-based dedup guard prevents an infinite render loop
|
|
579
|
-
// (parent setState -> re-render -> effect re-fires -> parent setState -> ...).
|
|
574
|
+
// Dedup guard (lastReportedContentEmptyRef) avoids re-triggering the parent's setState loop.
|
|
580
575
|
useEffect(() => {
|
|
581
576
|
if (typeof onContentValidityChange !== 'function') {
|
|
582
577
|
return;
|