@capillarytech/creatives-library 8.0.125-alpha.6 → 8.0.126
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 +6 -0
- package/containers/App/constants.js +0 -1
- package/containers/Email/index.js +5 -5
- package/containers/WeChat/RichmediaTemplates/Create/index.js +1 -1
- package/initialReducer.js +2 -0
- package/package.json +1 -1
- package/services/api.js +94 -1
- package/services/tests/api.test.js +191 -0
- package/tests/integration/TemplateCreation/TemplateCreation.integration.test.js +3 -8
- package/tests/integration/TemplateCreation/api-response.js +0 -5
- package/tests/integration/TemplateCreation/msw-handler.js +63 -42
- package/utils/common.js +0 -7
- package/utils/commonUtils.js +6 -2
- package/v2Components/CapImageUpload/index.js +45 -51
- package/v2Components/CapInAppCTA/index.js +0 -1
- package/v2Components/CapTagList/index.js +120 -177
- package/v2Components/CapVideoUpload/constants.js +0 -3
- package/v2Components/CapVideoUpload/index.js +110 -167
- package/v2Components/CapVideoUpload/messages.js +0 -16
- package/v2Components/Carousel/index.js +13 -15
- package/v2Components/CustomerSearchSection/_customerSearch.scss +309 -0
- package/v2Components/CustomerSearchSection/constants.js +5 -0
- package/v2Components/CustomerSearchSection/index.js +362 -0
- package/v2Components/CustomerSearchSection/messages.js +20 -0
- package/v2Components/CustomerSearchSection/tests/utils.test.js +334 -0
- package/v2Components/CustomerSearchSection/utils.js +49 -0
- package/v2Components/ErrorInfoNote/style.scss +0 -1
- package/v2Components/MobilePushPreviewV2/index.js +5 -37
- package/v2Components/TemplatePreview/_templatePreview.scss +72 -114
- package/v2Components/TemplatePreview/index.js +50 -178
- package/v2Components/TemplatePreview/messages.js +0 -4
- package/v2Components/TestAndPreviewSlidebox/_testAndPreviewSlidebox.scss +543 -0
- package/v2Components/TestAndPreviewSlidebox/actions.js +67 -0
- package/v2Components/TestAndPreviewSlidebox/constants.js +67 -0
- package/v2Components/TestAndPreviewSlidebox/index.js +771 -0
- package/v2Components/TestAndPreviewSlidebox/messages.js +147 -0
- package/v2Components/TestAndPreviewSlidebox/reducer.js +233 -0
- package/v2Components/TestAndPreviewSlidebox/sagas.js +258 -0
- package/v2Components/TestAndPreviewSlidebox/selectors.js +142 -0
- package/v2Components/TestAndPreviewSlidebox/tests/actions.test.js +80 -0
- package/v2Components/TestAndPreviewSlidebox/tests/reducer.test.js +367 -0
- package/v2Components/TestAndPreviewSlidebox/tests/saga.rtl.test.js +192 -0
- package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +652 -0
- package/v2Components/TestAndPreviewSlidebox/tests/selector.test.js +182 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +21 -9
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +23 -2
- package/v2Containers/CreativesContainer/index.js +160 -195
- package/v2Containers/CreativesContainer/messages.js +4 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +21 -0
- package/v2Containers/Email/index.js +18 -6
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +10 -0
- package/v2Containers/EmailWrapper/index.js +6 -0
- package/v2Containers/InApp/constants.js +0 -1
- package/v2Containers/InApp/index.js +13 -13
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +3 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -0
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +2 -0
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +9 -0
- package/v2Containers/MobilePush/Create/index.js +0 -1
- package/v2Containers/MobilePush/commonMethods.js +14 -7
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +23 -5
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4 -0
- package/v2Containers/TagList/index.js +10 -56
- package/v2Containers/Templates/_templates.scss +1 -101
- package/v2Containers/Templates/index.js +35 -147
- package/v2Containers/Templates/messages.js +0 -8
- package/v2Containers/Templates/sagas.js +0 -2
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +1 -1
- package/v2Containers/Whatsapp/constants.js +0 -1
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +35 -0
- package/utils/createPayload.js +0 -270
- package/utils/tests/createPayload.test.js +0 -761
- package/v2Components/CapMpushCTA/constants.js +0 -25
- package/v2Components/CapMpushCTA/index.js +0 -332
- package/v2Components/CapMpushCTA/index.scss +0 -95
- package/v2Components/CapMpushCTA/messages.js +0 -89
- package/v2Components/TemplatePreview/assets/images/Android _ With date and time.svg +0 -29
- package/v2Components/TemplatePreview/assets/images/android.svg +0 -9
- package/v2Components/TemplatePreview/assets/images/iOS _ With date and time.svg +0 -26
- package/v2Components/TemplatePreview/assets/images/ios.svg +0 -9
- package/v2Containers/Email/tests/index.test.js +0 -35
- package/v2Containers/MobilePushNew/actions.js +0 -116
- package/v2Containers/MobilePushNew/components/CtaButtons.js +0 -170
- package/v2Containers/MobilePushNew/components/MediaUploaders.js +0 -686
- package/v2Containers/MobilePushNew/components/PlatformContentFields.js +0 -279
- package/v2Containers/MobilePushNew/components/index.js +0 -5
- package/v2Containers/MobilePushNew/components/tests/CtaButtons.test.js +0 -779
- package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +0 -2114
- package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +0 -343
- package/v2Containers/MobilePushNew/constants.js +0 -115
- package/v2Containers/MobilePushNew/hooks/tests/usePlatformSync.test.js +0 -1299
- package/v2Containers/MobilePushNew/hooks/tests/useUpload.test.js +0 -1223
- package/v2Containers/MobilePushNew/hooks/usePlatformSync.js +0 -246
- package/v2Containers/MobilePushNew/hooks/useUpload.js +0 -709
- package/v2Containers/MobilePushNew/index.js +0 -2170
- package/v2Containers/MobilePushNew/index.scss +0 -308
- package/v2Containers/MobilePushNew/messages.js +0 -226
- package/v2Containers/MobilePushNew/reducer.js +0 -160
- package/v2Containers/MobilePushNew/sagas.js +0 -198
- package/v2Containers/MobilePushNew/selectors.js +0 -55
- package/v2Containers/MobilePushNew/tests/reducer.test.js +0 -741
- package/v2Containers/MobilePushNew/tests/sagas.test.js +0 -863
- package/v2Containers/MobilePushNew/tests/selectors.test.js +0 -425
- package/v2Containers/MobilePushNew/tests/utils.test.js +0 -322
- package/v2Containers/MobilePushNew/utils.js +0 -33
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
call, put, takeLatest, all,
|
|
3
|
-
} from "redux-saga/effects";
|
|
4
|
-
// import { schema, normalize } from 'normalizr';
|
|
5
|
-
import * as Api from "../../services/api";
|
|
6
|
-
import * as types from "./constants";
|
|
7
|
-
|
|
8
|
-
// Individual exports for testing
|
|
9
|
-
export function* createTemplate({template, callback}) {
|
|
10
|
-
let errorMsg;
|
|
11
|
-
try {
|
|
12
|
-
const result = yield call(Api.createMobilePushTemplate, template);
|
|
13
|
-
if (result.message) {
|
|
14
|
-
errorMsg = result.message;
|
|
15
|
-
if (result.status && result.status.code >= 400) {
|
|
16
|
-
throw errorMsg;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
if (callback) {
|
|
20
|
-
yield call(callback, result.response);
|
|
21
|
-
}
|
|
22
|
-
yield put({
|
|
23
|
-
type: types.CREATE_TEMPLATE_SUCCESS,
|
|
24
|
-
data: result.response,
|
|
25
|
-
statusCode: result.status ? result.status.code : "",
|
|
26
|
-
errorMsg,
|
|
27
|
-
});
|
|
28
|
-
} catch (error) {
|
|
29
|
-
yield put({ type: types.CREATE_TEMPLATE_FAILURE, error, errorMsg });
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export function* uploadAsset(action) {
|
|
33
|
-
try {
|
|
34
|
-
const {
|
|
35
|
-
file, assetType, fileParams, index, mobilePushParams = {},
|
|
36
|
-
} = action;
|
|
37
|
-
const uploadParams = {
|
|
38
|
-
file,
|
|
39
|
-
assetType,
|
|
40
|
-
fileParams,
|
|
41
|
-
...mobilePushParams,
|
|
42
|
-
};
|
|
43
|
-
const result = yield call(Api.uploadFile, uploadParams);
|
|
44
|
-
|
|
45
|
-
yield put({
|
|
46
|
-
type: types.UPLOAD_ASSET_SUCCESS,
|
|
47
|
-
data: result.response.asset,
|
|
48
|
-
statusCode: result.status ? result.status.code : "",
|
|
49
|
-
index,
|
|
50
|
-
});
|
|
51
|
-
} catch (error) {
|
|
52
|
-
yield put({ type: types.UPLOAD_ASSET_FAILURE, error });
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function* watchCreateTemplate() {
|
|
57
|
-
yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
|
|
58
|
-
}
|
|
59
|
-
export function* watchUploadAsset() {
|
|
60
|
-
yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
|
|
61
|
-
}
|
|
62
|
-
export function* watchGetIosCtas() {
|
|
63
|
-
yield takeLatest(types.GET_IOS_CTAS, getIosCtas);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Individual exports for testing
|
|
67
|
-
export function* editTemplate({ template, callback }) {
|
|
68
|
-
let errorMsg;
|
|
69
|
-
try {
|
|
70
|
-
// Use the same API endpoint as create - backend determines create vs edit based on _id presence
|
|
71
|
-
const result = yield call(Api.createMobilePushTemplate, template);
|
|
72
|
-
// Check for error status codes (400+)
|
|
73
|
-
if (result.status.code >= 400) {
|
|
74
|
-
errorMsg = result.message || `HTTP Error ${result.status.code}`;
|
|
75
|
-
throw errorMsg;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// For edit operations, we need to structure the response similar to create
|
|
79
|
-
// The Templates container expects a templateId field
|
|
80
|
-
const editResponseData = {
|
|
81
|
-
...result.response,
|
|
82
|
-
templateId: result?.response?.templateId?._id || result?.response?._id || template._id,
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
yield put({
|
|
86
|
-
type: types.EDIT_TEMPLATE_SUCCESS,
|
|
87
|
-
data: editResponseData,
|
|
88
|
-
statusCode: result.status ? result.status.code : "",
|
|
89
|
-
errorMsg,
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
// Call callback with proper response structure
|
|
93
|
-
if (callback) {
|
|
94
|
-
yield call(callback, editResponseData);
|
|
95
|
-
}
|
|
96
|
-
} catch (error) {
|
|
97
|
-
yield put({ type: types.EDIT_TEMPLATE_FAILURE, error, errorMsg });
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export function* getTemplateDetails(id) {
|
|
102
|
-
try {
|
|
103
|
-
const result = yield call(Api.getTemplateDetails, id);
|
|
104
|
-
// const sidebar = result.response.sidebar;
|
|
105
|
-
yield put({
|
|
106
|
-
type: types.GET_TEMPLATE_DETAILS_SUCCESS,
|
|
107
|
-
data: result.response,
|
|
108
|
-
});
|
|
109
|
-
} catch (error) {
|
|
110
|
-
yield put({ type: types.GET_TEMPLATE_DETAILS_FAILURE, error });
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export function* getIosCtas(licenseCode) {
|
|
115
|
-
try {
|
|
116
|
-
const result = yield call(Api.getIosCtas, licenseCode);
|
|
117
|
-
yield put({
|
|
118
|
-
type: types.GET_IOS_CTAS_SUCCESS,
|
|
119
|
-
data: result.response.metaEntities.data,
|
|
120
|
-
statusCode: result.status ? result.status.code : "",
|
|
121
|
-
});
|
|
122
|
-
} catch (error) {
|
|
123
|
-
yield put({ type: types.GET_IOS_CTAS_FAILURE, error });
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export function* getMobilepushTemplatesList(params) {
|
|
128
|
-
try {
|
|
129
|
-
const result = yield call(Api.getAllTemplates, {
|
|
130
|
-
channel: params.channel,
|
|
131
|
-
queryParams: params.queryParams,
|
|
132
|
-
});
|
|
133
|
-
yield put({
|
|
134
|
-
type: types.GET_MOBILEPUSH_TEMPLATES_LIST_SUCCESS,
|
|
135
|
-
data: result.response.templates,
|
|
136
|
-
templateData: result.response.mapped,
|
|
137
|
-
});
|
|
138
|
-
} catch (error) {
|
|
139
|
-
yield put({ type: types.GET_MOBILEPUSH_TEMPLATES_LIST_FAILURE, error });
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export function* fetchWeCrmAccounts(action) {
|
|
144
|
-
try {
|
|
145
|
-
const result = yield call(Api.fetchWeCrmAccounts, action.source);
|
|
146
|
-
yield put({
|
|
147
|
-
type: types.GET_WECRM_ACCOUNTS_SUCCESS,
|
|
148
|
-
data: result.response,
|
|
149
|
-
});
|
|
150
|
-
} catch (error) {
|
|
151
|
-
yield put({
|
|
152
|
-
type: types.GET_WECRM_ACCOUNTS_FAILURE,
|
|
153
|
-
data: error,
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export function* watchFetchWeCrmAccounts() {
|
|
159
|
-
yield takeLatest(types.GET_WECRM_ACCOUNTS_REQUEST, fetchWeCrmAccounts);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export function* watchEditTemplate() {
|
|
163
|
-
yield takeLatest(types.EDIT_TEMPLATE_REQUEST, editTemplate);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export function* watchGetTemplateDetails() {
|
|
167
|
-
yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export function* watchMobilepushTemplatesList() {
|
|
171
|
-
yield takeLatest(
|
|
172
|
-
types.GET_MOBILEPUSH_TEMPLATES_LIST_REQUEST,
|
|
173
|
-
getMobilepushTemplatesList
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// All sagas to be loaded
|
|
178
|
-
export default [
|
|
179
|
-
watchEditTemplate,
|
|
180
|
-
watchCreateTemplate,
|
|
181
|
-
watchGetTemplateDetails,
|
|
182
|
-
watchFetchWeCrmAccounts,
|
|
183
|
-
watchMobilepushTemplatesList,
|
|
184
|
-
watchUploadAsset,
|
|
185
|
-
watchGetIosCtas,
|
|
186
|
-
];
|
|
187
|
-
|
|
188
|
-
export function* v2MobilePushSagas() {
|
|
189
|
-
yield all([
|
|
190
|
-
watchCreateTemplate(),
|
|
191
|
-
watchEditTemplate(),
|
|
192
|
-
watchGetTemplateDetails(),
|
|
193
|
-
watchFetchWeCrmAccounts(),
|
|
194
|
-
watchMobilepushTemplatesList(),
|
|
195
|
-
watchUploadAsset(),
|
|
196
|
-
watchGetIosCtas(),
|
|
197
|
-
]);
|
|
198
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { createSelector } from 'reselect';
|
|
2
|
-
import { fromJS } from 'immutable';
|
|
3
|
-
|
|
4
|
-
// New selectors for MobilePushNew
|
|
5
|
-
const selectMobilePushNewDomain = () => (state) => state.get('mobilePushNew') || fromJS({});
|
|
6
|
-
|
|
7
|
-
const makeSelectMobilePushNew = () => createSelector(
|
|
8
|
-
selectMobilePushNewDomain(),
|
|
9
|
-
(substate) => substate.toJS()
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
const makeSelectUploadedAssetData = () => createSelector(
|
|
13
|
-
selectMobilePushNewDomain(),
|
|
14
|
-
(substate) => substate.get('uploadedAssetData') || {}
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
const makeSelectUploadedAssetData0 = () => createSelector(
|
|
18
|
-
selectMobilePushNewDomain(),
|
|
19
|
-
(substate) => substate.get('uploadedAssetData0') || {}
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
const makeSelectUploadedAssetData1 = () => createSelector(
|
|
23
|
-
selectMobilePushNewDomain(),
|
|
24
|
-
(substate) => substate.get('uploadedAssetData1') || {}
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
const makeSelectUploadAssetSuccess = () => createSelector(
|
|
28
|
-
selectMobilePushNewDomain(),
|
|
29
|
-
(substate) => substate.get('uploadAssetSuccess') || false
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
const makeSelectCreateError = () => createSelector(
|
|
33
|
-
selectMobilePushNewDomain(), (dimensionState) => dimensionState.get('createTemplateErrorMessage') || ""
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const makeSelectAssetUploading = () => createSelector(
|
|
37
|
-
selectMobilePushNewDomain(),
|
|
38
|
-
(substate) => substate.get('assetUploading') || false
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
const makeSelectGetTemplateDetailsInProgress = () => createSelector(
|
|
42
|
-
selectMobilePushNewDomain(),
|
|
43
|
-
(substate) => substate.get('getTemplateDetailsInProgress') || false
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
export {
|
|
47
|
-
makeSelectMobilePushNew,
|
|
48
|
-
makeSelectUploadedAssetData,
|
|
49
|
-
makeSelectUploadedAssetData0,
|
|
50
|
-
makeSelectUploadedAssetData1,
|
|
51
|
-
makeSelectUploadAssetSuccess,
|
|
52
|
-
makeSelectCreateError,
|
|
53
|
-
makeSelectAssetUploading,
|
|
54
|
-
makeSelectGetTemplateDetailsInProgress,
|
|
55
|
-
};
|