@capillarytech/creatives-library 8.0.330-alpha.0 → 8.0.330
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 +0 -18
- package/package.json +1 -1
- package/services/api.js +0 -17
- package/services/tests/api.test.js +0 -85
- package/utils/commonUtils.js +0 -28
- package/utils/tests/commonUtil.test.js +0 -169
- package/v2Components/CapTagList/index.js +0 -10
- package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +49 -70
- package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +2 -8
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +21 -207
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +0 -16
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +10 -85
- package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +0 -30
- package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +11 -79
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +53 -87
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +1 -20
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +4 -133
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +34 -145
- package/v2Components/CommonTestAndPreview/actions.js +0 -10
- package/v2Components/CommonTestAndPreview/constants.js +1 -53
- package/v2Components/CommonTestAndPreview/index.js +168 -998
- package/v2Components/CommonTestAndPreview/messages.js +3 -147
- package/v2Components/CommonTestAndPreview/reducer.js +0 -10
- package/v2Components/CommonTestAndPreview/sagas.js +6 -15
- package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +286 -328
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +65 -231
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +5 -118
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +0 -341
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +24 -65
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +1 -199
- package/v2Components/CommonTestAndPreview/tests/constants.test.js +1 -31
- package/v2Components/CommonTestAndPreview/tests/index.test.js +4 -168
- package/v2Components/CommonTestAndPreview/tests/reducer.test.js +0 -71
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +2 -2
- package/v2Components/CommonTestAndPreview/tests/selectors.test.js +0 -17
- package/v2Components/FormBuilder/index.js +1 -7
- package/v2Components/TestAndPreviewSlidebox/index.js +1 -13
- package/v2Components/TestAndPreviewSlidebox/sagas.js +4 -11
- package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +1 -3
- package/v2Containers/CreativesContainer/SlideBoxContent.js +4 -36
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +1 -10
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +4 -29
- package/v2Containers/CreativesContainer/constants.js +0 -9
- package/v2Containers/CreativesContainer/index.js +93 -292
- package/v2Containers/CreativesContainer/index.scss +1 -51
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +34 -78
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +16 -79
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +0 -8
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +98 -357
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +10 -20
- package/v2Containers/CreativesContainer/tests/index.test.js +9 -71
- package/v2Containers/Rcs/constants.js +3 -40
- package/v2Containers/Rcs/index.js +895 -1145
- package/v2Containers/Rcs/index.scss +6 -85
- package/v2Containers/Rcs/messages.js +2 -12
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +2236 -41719
- package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +5 -0
- package/v2Containers/Rcs/tests/index.test.js +38 -41
- package/v2Containers/Rcs/tests/mockData.js +0 -38
- package/v2Containers/Rcs/tests/utils.test.js +1 -435
- package/v2Containers/Rcs/utils.js +10 -405
- package/v2Containers/Sms/Create/index.js +38 -100
- package/v2Containers/SmsTrai/Create/index.js +4 -9
- package/v2Containers/SmsTrai/Edit/constants.js +0 -2
- package/v2Containers/SmsTrai/Edit/index.js +128 -636
- package/v2Containers/SmsTrai/Edit/messages.js +4 -14
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +2604 -4590
- package/v2Containers/SmsWrapper/index.js +8 -37
- package/v2Containers/TagList/index.js +0 -6
- package/v2Containers/Templates/_templates.scss +2 -63
- package/v2Containers/Templates/actions.js +0 -11
- package/v2Containers/Templates/constants.js +0 -2
- package/v2Containers/Templates/index.js +40 -90
- package/v2Containers/Templates/sagas.js +12 -57
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1079 -1043
- package/v2Containers/Templates/tests/sagas.test.js +123 -193
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +1 -72
- package/v2Containers/TemplatesV2/index.js +23 -86
- package/v2Containers/Whatsapp/index.js +20 -3
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +4872 -5790
- package/utils/templateVarUtils.js +0 -201
- package/utils/tests/templateVarUtils.test.js +0 -204
- package/v2Components/CommonTestAndPreview/AddTestCustomer.js +0 -42
- package/v2Components/CommonTestAndPreview/CustomerCreationModal.js +0 -155
- package/v2Components/CommonTestAndPreview/ExistingCustomerModal.js +0 -93
- package/v2Components/CommonTestAndPreview/previewApiUtils.js +0 -59
- package/v2Components/CommonTestAndPreview/tests/AddTestCustomer.test.js +0 -66
- package/v2Components/CommonTestAndPreview/tests/CommonTestAndPreview.addTestCustomer.test.js +0 -648
- package/v2Components/CommonTestAndPreview/tests/CustomerCreationModal.test.js +0 -174
- package/v2Components/CommonTestAndPreview/tests/ExistingCustomerModal.test.js +0 -114
- package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +0 -67
- package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +0 -87
- package/v2Components/SmsFallback/constants.js +0 -73
- package/v2Components/SmsFallback/index.js +0 -955
- package/v2Components/SmsFallback/index.scss +0 -265
- package/v2Components/SmsFallback/messages.js +0 -78
- package/v2Components/SmsFallback/smsFallbackUtils.js +0 -118
- package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +0 -50
- package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +0 -147
- package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +0 -304
- package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +0 -197
- package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +0 -277
- package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +0 -422
- package/v2Components/SmsFallback/useLocalTemplateList.js +0 -92
- package/v2Components/VarSegmentMessageEditor/constants.js +0 -2
- package/v2Components/VarSegmentMessageEditor/index.js +0 -125
- package/v2Components/VarSegmentMessageEditor/index.scss +0 -46
- package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +0 -43
- package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +0 -67
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +0 -90
- package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +0 -258
- package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +0 -125
- package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +0 -225
- package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +0 -318
- package/v2Containers/Sms/smsFormDataHelpers.js +0 -67
- package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +0 -253
- package/v2Containers/SmsTrai/Edit/index.scss +0 -121
- package/v2Containers/Templates/TemplatesActionBar.js +0 -101
- package/v2Containers/Templates/tests/TemplatesActionBar.test.js +0 -120
- package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +0 -180
- package/v2Containers/Templates/utils/smsTemplatesListApi.js +0 -79
- package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +0 -131
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Embedded SMS template list: localTemplatesConfig + SMS-only channel visibility (RCS SMS fallback).
|
|
3
|
-
*/
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { injectIntl } from 'react-intl';
|
|
6
|
-
import '@testing-library/jest-dom';
|
|
7
|
-
import cloneDeep from 'lodash/cloneDeep';
|
|
8
|
-
import { Provider } from 'react-redux';
|
|
9
|
-
import { configureStore } from '@capillarytech/vulcan-react-sdk/utils';
|
|
10
|
-
import history from '../../../utils/history';
|
|
11
|
-
import { initialReducer } from '../../../initialReducer';
|
|
12
|
-
import { render, screen } from '../../../utils/test-utils';
|
|
13
|
-
import { TemplatesV2 } from '../index';
|
|
14
|
-
import { Templates, authData, currentOrgDetails as currentOrgDetailsMock } from './mockData';
|
|
15
|
-
import { CHANNELS_TO_HIDE_FOR_SMS_ONLY } from '../../../v2Components/SmsFallback/constants';
|
|
16
|
-
|
|
17
|
-
const mockTemplates = jest.fn(() => <div data-testid="templates-mock">Templates</div>);
|
|
18
|
-
jest.mock('v2Containers/Templates', () => ({
|
|
19
|
-
__esModule: true,
|
|
20
|
-
default: (props) => mockTemplates(props),
|
|
21
|
-
}));
|
|
22
|
-
|
|
23
|
-
jest.mock('../../../utils/authWrapper', () => ({
|
|
24
|
-
UserIsAuthenticated: jest.fn((config) => config),
|
|
25
|
-
}));
|
|
26
|
-
|
|
27
|
-
const ComponentToRender = injectIntl(TemplatesV2);
|
|
28
|
-
const renderComponent = (p) => {
|
|
29
|
-
const store = configureStore({}, initialReducer, history);
|
|
30
|
-
return render(
|
|
31
|
-
<Provider store={store}>
|
|
32
|
-
<ComponentToRender {...p} />
|
|
33
|
-
</Provider>,
|
|
34
|
-
);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
describe('TemplatesV2 local SMS templates (embedded)', () => {
|
|
38
|
-
const templateActions = {
|
|
39
|
-
templateActions: jest.fn(),
|
|
40
|
-
deleteTemplate: jest.fn(),
|
|
41
|
-
getAccountsSettings: jest.fn(),
|
|
42
|
-
getAllTemplates: jest.fn(),
|
|
43
|
-
getCdnTransformationConfig: jest.fn(),
|
|
44
|
-
getDefaultBeeTemplates: jest.fn(),
|
|
45
|
-
getSenderDetails: jest.fn(),
|
|
46
|
-
getTemplateDetails: jest.fn(),
|
|
47
|
-
getUserList: jest.fn(),
|
|
48
|
-
getWeCrmAccounts: jest.fn(),
|
|
49
|
-
handleHtmlUpload: jest.fn(),
|
|
50
|
-
handleZipUpload: jest.fn(),
|
|
51
|
-
resetAccount: jest.fn(),
|
|
52
|
-
resetTemplate: jest.fn(),
|
|
53
|
-
resetTemplateData: jest.fn(),
|
|
54
|
-
resetTemplateStoreData: jest.fn(),
|
|
55
|
-
resetUploadData: jest.fn(),
|
|
56
|
-
setBEETemplate: jest.fn(),
|
|
57
|
-
setChannelAccount: jest.fn(),
|
|
58
|
-
setEdmTemplate: jest.fn(),
|
|
59
|
-
setFacebookAccount: jest.fn(),
|
|
60
|
-
setViberAccount: jest.fn(),
|
|
61
|
-
setWeChatAccount: jest.fn(),
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const baseProps = {
|
|
65
|
-
cap: {
|
|
66
|
-
user: { accessiblePermissions: ['CREATIVES_UI_VIEW'] },
|
|
67
|
-
},
|
|
68
|
-
actions: { defaultAction: jest.fn(), getTemplates: jest.fn() },
|
|
69
|
-
Templates,
|
|
70
|
-
TemplatesList: Templates?.templates,
|
|
71
|
-
authData,
|
|
72
|
-
templateActions,
|
|
73
|
-
isFullMode: false,
|
|
74
|
-
className: 'embed-test',
|
|
75
|
-
channel: 'sms',
|
|
76
|
-
channelsToHide: CHANNELS_TO_HIDE_FOR_SMS_ONLY,
|
|
77
|
-
channelsToDisable: [],
|
|
78
|
-
onChannelChange: jest.fn(),
|
|
79
|
-
enableNewChannels: [],
|
|
80
|
-
/** Without JP_LOCALE_HIDE_FEATURE so SMS panes are not stripped to Email/Line/Gallery only */
|
|
81
|
-
currentOrgDetails: {
|
|
82
|
-
...currentOrgDetailsMock,
|
|
83
|
-
accessibleFeatures: (currentOrgDetailsMock.accessibleFeatures || []).filter(
|
|
84
|
-
(f) => f !== 'JP_LOCALE_HIDE_FEATURE',
|
|
85
|
-
),
|
|
86
|
-
},
|
|
87
|
-
location: {
|
|
88
|
-
pathname: 'v2',
|
|
89
|
-
basename: '/creatives/ui/',
|
|
90
|
-
query: {},
|
|
91
|
-
},
|
|
92
|
-
router: { push: jest.fn() },
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
beforeEach(() => {
|
|
96
|
-
mockTemplates.mockClear();
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('adds local-sms container class and single-pane layout when only SMS is visible', () => {
|
|
100
|
-
const p = cloneDeep(baseProps);
|
|
101
|
-
p.localTemplatesConfig = {
|
|
102
|
-
useLocalTemplates: true,
|
|
103
|
-
localTemplates: [],
|
|
104
|
-
localTemplatesLoading: false,
|
|
105
|
-
};
|
|
106
|
-
renderComponent(p);
|
|
107
|
-
|
|
108
|
-
const wrapper = screen.getByTestId('cap-wrapper');
|
|
109
|
-
expect(wrapper).toHaveClass('creatives-templates-container--local-sms');
|
|
110
|
-
expect(document.querySelector('.templates-v2-local-sms-pane')).toBeTruthy();
|
|
111
|
-
expect(mockTemplates).toHaveBeenCalled();
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
it('passes localTemplatesConfig into Templates for the SMS pane', () => {
|
|
115
|
-
const localConfig = {
|
|
116
|
-
useLocalTemplates: true,
|
|
117
|
-
localTemplates: [{ _id: '1', name: 'A' }],
|
|
118
|
-
localTemplatesLoading: false,
|
|
119
|
-
};
|
|
120
|
-
const p = cloneDeep(baseProps);
|
|
121
|
-
p.localTemplatesConfig = localConfig;
|
|
122
|
-
renderComponent(p);
|
|
123
|
-
|
|
124
|
-
expect(mockTemplates).toHaveBeenCalled();
|
|
125
|
-
const passed = mockTemplates.mock.calls.find(
|
|
126
|
-
(call) => call[0] && call[0].localTemplatesConfig && call[0].localTemplatesConfig.useLocalTemplates,
|
|
127
|
-
);
|
|
128
|
-
expect(passed).toBeTruthy();
|
|
129
|
-
expect(passed[0].localTemplatesConfig).toMatchObject(localConfig);
|
|
130
|
-
});
|
|
131
|
-
});
|