@capillarytech/creatives-library 7.17.39-alpha.4 → 7.17.39
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/components/CapTagList/index.js +1 -1
- package/components/CapTagList/messages.js +4 -0
- package/components/FormBuilder/index.js +2 -2
- package/components/FormBuilder/messages.js +8 -0
- package/containers/Assets/Gallery/index.js +1 -1
- package/containers/Assets/Gallery/messages.js +4 -0
- package/containers/Email/index.js +1 -1
- package/containers/Templates/index.js +1 -1
- package/containers/Templates/messages.js +4 -0
- package/index.js +2 -2
- package/package.json +1 -1
- package/services/api.js +6 -6
- package/utils/common.js +3 -2
- package/utils/tests/common.test.js +5 -5
- package/v2Components/CapTagList/index.js +1 -2
- package/v2Components/FormBuilder/index.js +1 -1
- package/v2Components/FormBuilder/messages.js +4 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +6 -12
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +3 -2
- package/v2Containers/CreativesContainer/index.js +7 -53
- package/v2Containers/CreativesContainer/messages.js +9 -1
- package/v2Containers/TagList/index.js +0 -2
- package/v2Containers/Templates/index.js +3 -17
- package/v2Containers/Templates/messages.js +0 -4
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +129 -28
- package/v2Containers/TemplatesV2/tests/index.test.js +0 -1
- package/v2Containers/Zalo/constants.js +1 -0
- package/v2Containers/Zalo/index.js +185 -301
- package/v2Containers/Zalo/index.scss +4 -3
- package/v2Containers/Zalo/messages.js +5 -17
- package/v2Containers/Zalo/saga.js +4 -10
- package/v2Containers/Zalo/selectors.js +10 -8
- package/v2Containers/Zalo/tests/index.test.js +48 -67
- package/v2Containers/Zalo/tests/mockData.js +5045 -5056
- package/v2Containers/Zalo/tests/reducer.test.js +3 -3
- package/v2Containers/Zalo/tests/saga.test.js +2 -5
- package/v2Containers/Zalo/tests/selectors.test.js +52 -0
- package/v2Containers/Zalo/tests/selector.test.js +0 -28
|
@@ -16,19 +16,19 @@ export default defineMessages({
|
|
|
16
16
|
},
|
|
17
17
|
variableType: {
|
|
18
18
|
id: `${prefix}.variableType`,
|
|
19
|
-
defaultMessage: "Variable type: <{
|
|
19
|
+
defaultMessage: "Variable type: <{fieldName}>",
|
|
20
20
|
},
|
|
21
21
|
charactersCount: {
|
|
22
22
|
id: `${prefix}.charactersCount`,
|
|
23
|
-
defaultMessage: "Characters count {variableLength}/{
|
|
23
|
+
defaultMessage: "Characters count {variableLength}/{fixedLength}",
|
|
24
24
|
},
|
|
25
25
|
maxMinLengthMessage: {
|
|
26
|
-
id: `${prefix}.
|
|
26
|
+
id: `${prefix}.maxLengthMessage`,
|
|
27
27
|
defaultMessage:
|
|
28
28
|
"Character count for this variable should be in between {minLength} to {maxLength}",
|
|
29
29
|
},
|
|
30
30
|
previewHead: {
|
|
31
|
-
id: `${prefix}.
|
|
31
|
+
id: `${prefix}.previewText`,
|
|
32
32
|
defaultMessage: "Preview",
|
|
33
33
|
},
|
|
34
34
|
previewText: {
|
|
@@ -70,17 +70,5 @@ export default defineMessages({
|
|
|
70
70
|
PENDING_REVIEW: {
|
|
71
71
|
id: `${prefix}.PENDING_REVIEW`,
|
|
72
72
|
defaultMessage: 'pending review',
|
|
73
|
-
}
|
|
74
|
-
zaloFailureNotificationTemplate: {
|
|
75
|
-
id: `${prefix}.zaloFailureNotificationTemplate`,
|
|
76
|
-
defaultMessage: 'Unable to load zalo template',
|
|
77
|
-
},
|
|
78
|
-
zaloFailureNotificationPreview: {
|
|
79
|
-
id: `${prefix}.zaloFailureNotificationPreview`,
|
|
80
|
-
defaultMessage: 'Unable to load zalo preview',
|
|
81
|
-
},
|
|
82
|
-
btnDisabledTooltip: {
|
|
83
|
-
id: `${prefix}.btnDisabledTooltip`,
|
|
84
|
-
defaultMessage: 'Please add all mandatory fields to proceed further',
|
|
85
|
-
},
|
|
73
|
+
}
|
|
86
74
|
});
|
|
@@ -8,29 +8,23 @@ import {
|
|
|
8
8
|
} from "./constants";
|
|
9
9
|
|
|
10
10
|
export function* getTemplateInfoById({ payload }) {
|
|
11
|
-
const { preview = "", actionCallback } = payload;
|
|
12
11
|
try {
|
|
13
12
|
const res = yield call(Api.getTemplateInfoById, payload);
|
|
14
13
|
if (res?.success) {
|
|
15
14
|
yield put({
|
|
16
|
-
type: preview
|
|
15
|
+
type: payload?.preview
|
|
16
|
+
? ZALO_TEMPLATE_PREVIEW_INFO
|
|
17
|
+
: ZALO_TEMPLATE_INFO_SUCCESS,
|
|
17
18
|
result: res?.response || {},
|
|
18
19
|
});
|
|
19
20
|
} else {
|
|
20
|
-
const errorMsg = res?.message || res?.status?.message;
|
|
21
21
|
yield put({
|
|
22
22
|
type: ZALO_TEMPLATE_INFO_ERROR,
|
|
23
|
-
error:
|
|
23
|
+
error: res?.error || res?.message,
|
|
24
24
|
});
|
|
25
|
-
if (actionCallback) {
|
|
26
|
-
actionCallback(errorMsg);
|
|
27
|
-
}
|
|
28
25
|
}
|
|
29
26
|
} catch (error) {
|
|
30
27
|
yield put({ type: ZALO_TEMPLATE_INFO_ERROR, error });
|
|
31
|
-
if (actionCallback) {
|
|
32
|
-
actionCallback(error);
|
|
33
|
-
}
|
|
34
28
|
}
|
|
35
29
|
}
|
|
36
30
|
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { createSelector } from "reselect";
|
|
2
|
+
import { fromJS } from "immutable";
|
|
2
3
|
|
|
3
|
-
const selectZaloDomain = (
|
|
4
|
-
const selectAccountDomain = () => (state) => state.get('templates');
|
|
4
|
+
const selectZaloDomain = (state = fromJS({})) => state.get("zalo");
|
|
5
5
|
|
|
6
6
|
const makeSelectZalo = () =>
|
|
7
|
-
createSelector(selectZaloDomain
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
createSelector(selectZaloDomain, (substate = fromJS({})) => ({
|
|
8
|
+
zaloTemplateInfoStatus: substate.get("zaloTemplateInfoStatus"),
|
|
9
|
+
zaloTemplateInfoValue: substate.get("zaloTemplateInfoValue"),
|
|
10
|
+
zaloTemplateInfoError: substate.get("zaloTemplateInfoError"),
|
|
11
|
+
zaloTemplatePreviewData: substate.get("zaloTemplatePreviewData"),
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
export { makeSelectZalo, selectZaloDomain };
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { injectIntl } from
|
|
3
|
-
import { browserHistory } from
|
|
4
|
-
import
|
|
5
|
-
import { Provider } from
|
|
6
|
-
import configureStore from
|
|
7
|
-
import { Zalo } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { injectIntl } from "react-intl";
|
|
3
|
+
import { browserHistory } from "react-router";
|
|
4
|
+
import "@testing-library/jest-dom";
|
|
5
|
+
import { Provider } from "react-redux";
|
|
6
|
+
import configureStore from "../../../store";
|
|
7
|
+
import { Zalo } from "..";
|
|
8
8
|
import {
|
|
9
9
|
metaEntities,
|
|
10
|
-
|
|
10
|
+
zaloTemplateInfoData,
|
|
11
11
|
location,
|
|
12
12
|
getDefaultTags,
|
|
13
13
|
injectedTags,
|
|
14
|
-
|
|
14
|
+
template,
|
|
15
15
|
templateData,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
} from "./mockData";
|
|
17
|
+
import {
|
|
18
|
+
render,
|
|
19
|
+
screen,
|
|
20
|
+
fireEvent,
|
|
21
|
+
} from "../../../utils/test-utils";
|
|
19
22
|
|
|
20
23
|
const mockActions = {
|
|
21
24
|
getTemplateInfoById: jest.fn(),
|
|
22
|
-
};
|
|
23
|
-
const mockGlobalActions = {
|
|
24
25
|
fetchSchemaForEntity: jest.fn(),
|
|
25
26
|
};
|
|
26
27
|
|
|
@@ -30,117 +31,97 @@ beforeAll(() => {
|
|
|
30
31
|
});
|
|
31
32
|
|
|
32
33
|
const ComponentToRender = injectIntl(Zalo);
|
|
33
|
-
const renderComponent = (props) =>
|
|
34
|
-
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
</Provider>,
|
|
34
|
+
const renderComponent = (props) => render(
|
|
35
|
+
<Provider store={store}>
|
|
36
|
+
<ComponentToRender {...props} />
|
|
37
|
+
</Provider>
|
|
38
38
|
);
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
|
|
41
|
+
describe("Test activity zalo container", () => {
|
|
42
|
+
it("test case for zalo template", async () => {
|
|
42
43
|
renderComponent({
|
|
43
44
|
actions: mockActions,
|
|
44
|
-
|
|
45
|
-
editData,
|
|
45
|
+
zaloTemplateInfoData,
|
|
46
46
|
metaEntities,
|
|
47
47
|
location,
|
|
48
48
|
getDefaultTags,
|
|
49
49
|
injectedTags,
|
|
50
|
-
|
|
50
|
+
template,
|
|
51
51
|
templateData,
|
|
52
|
-
isFullMode: true,
|
|
53
52
|
});
|
|
54
|
-
const inputBox = await screen.findAllByPlaceholderText(
|
|
55
|
-
|
|
56
|
-
);
|
|
57
|
-
fireEvent.change(inputBox[0], { target: { value: 'Hello, welcome' } });
|
|
53
|
+
const inputBox = await screen.findAllByPlaceholderText('Add labels or text or combination of both');
|
|
54
|
+
fireEvent.change(inputBox[0], { target: { value: "Hello, welcome" } });
|
|
58
55
|
inputBox[0].focus();
|
|
59
|
-
const previewButton = screen.getByTestId(
|
|
56
|
+
const previewButton = screen.getByTestId("preview-link-button");
|
|
60
57
|
previewButton.click();
|
|
61
58
|
expect(
|
|
62
|
-
screen.getByText(
|
|
59
|
+
screen.getByText("This template has been enabled")
|
|
63
60
|
).toBeInTheDocument();
|
|
64
61
|
});
|
|
65
62
|
|
|
66
|
-
it(
|
|
63
|
+
it("test case for text field curly braces error", async () => {
|
|
67
64
|
renderComponent({
|
|
68
65
|
actions: mockActions,
|
|
69
|
-
|
|
70
|
-
editData,
|
|
66
|
+
zaloTemplateInfoData,
|
|
71
67
|
metaEntities,
|
|
72
68
|
location,
|
|
73
69
|
getDefaultTags,
|
|
74
70
|
injectedTags,
|
|
75
|
-
|
|
71
|
+
template,
|
|
76
72
|
templateData,
|
|
77
|
-
isFullMode: true,
|
|
78
73
|
});
|
|
79
|
-
const inputBox = await screen.findAllByPlaceholderText(
|
|
80
|
-
|
|
81
|
-
);
|
|
82
|
-
fireEvent.change(inputBox[0], { target: { value: 'Hello, welcome {{' } });
|
|
74
|
+
const inputBox = await screen.findAllByPlaceholderText('Add labels or text or combination of both');
|
|
75
|
+
fireEvent.change(inputBox[0], { target: { value: "Hello, welcome {{" } });
|
|
83
76
|
inputBox[0].focus();
|
|
84
77
|
expect(
|
|
85
|
-
screen.getByText(
|
|
78
|
+
screen.getByText("Invalid label, please close all curly braces")
|
|
86
79
|
).toBeInTheDocument();
|
|
87
80
|
});
|
|
88
81
|
|
|
89
|
-
it(
|
|
82
|
+
it("test case for unsupported tag", async () => {
|
|
90
83
|
renderComponent({
|
|
91
84
|
actions: mockActions,
|
|
92
|
-
|
|
93
|
-
editData,
|
|
85
|
+
zaloTemplateInfoData,
|
|
94
86
|
metaEntities,
|
|
95
87
|
location,
|
|
96
88
|
getDefaultTags,
|
|
97
89
|
injectedTags,
|
|
98
|
-
|
|
90
|
+
template,
|
|
99
91
|
templateData,
|
|
100
|
-
isFullMode: true,
|
|
101
92
|
});
|
|
102
|
-
const inputBox = await screen.findAllByPlaceholderText(
|
|
103
|
-
'Add labels or text or combination of both',
|
|
104
|
-
);
|
|
93
|
+
const inputBox = await screen.findAllByPlaceholderText('Add labels or text or combination of both');
|
|
105
94
|
fireEvent.change(inputBox[0], {
|
|
106
|
-
target: { value:
|
|
95
|
+
target: { value: "Hello, welcome {{fsdaf}}" },
|
|
107
96
|
});
|
|
108
97
|
inputBox[0].focus();
|
|
109
98
|
expect(
|
|
110
99
|
screen.getByText(
|
|
111
|
-
|
|
112
|
-
)
|
|
100
|
+
"Unsupported tags: fsdaf. Please remove them from this message."
|
|
101
|
+
)
|
|
113
102
|
).toBeInTheDocument();
|
|
114
103
|
});
|
|
115
104
|
|
|
116
|
-
it(
|
|
117
|
-
templateData.templateConfigs = templateConfigs;
|
|
105
|
+
it("test case for length check", async () => {
|
|
118
106
|
renderComponent({
|
|
119
107
|
actions: mockActions,
|
|
120
|
-
|
|
121
|
-
editData,
|
|
108
|
+
zaloTemplateInfoData,
|
|
122
109
|
metaEntities,
|
|
123
110
|
location,
|
|
124
111
|
getDefaultTags,
|
|
125
112
|
injectedTags,
|
|
126
|
-
|
|
113
|
+
template,
|
|
127
114
|
templateData,
|
|
128
|
-
isFullMode: false,
|
|
129
115
|
});
|
|
130
|
-
const inputBox = await screen.findAllByPlaceholderText(
|
|
131
|
-
'Add labels or text or combination of both',
|
|
132
|
-
);
|
|
116
|
+
const inputBox = await screen.findAllByPlaceholderText('Add labels or text or combination of both');
|
|
133
117
|
fireEvent.change(inputBox[0], {
|
|
134
118
|
target: {
|
|
135
|
-
value:
|
|
136
|
-
'Hello, welcome user. Habata itara modoranai to ittta Mezashita no wa aoi aoi ano sora',
|
|
119
|
+
value: "Hello, welcome user. Habata itara modoranai to ittta Mezashita no wa aoi aoi ano sora",
|
|
137
120
|
},
|
|
138
121
|
});
|
|
139
122
|
inputBox[0].focus();
|
|
140
123
|
expect(
|
|
141
|
-
screen.getByText(
|
|
142
|
-
'Character count for this variable should be in between 0 to 30',
|
|
143
|
-
),
|
|
124
|
+
screen.getByText("Character count for this variable should be in between 0 to 30")
|
|
144
125
|
).toBeInTheDocument();
|
|
145
126
|
});
|
|
146
|
-
});
|
|
127
|
+
});
|