@capillarytech/creatives-library 8.0.116 → 8.0.118
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/package.json +1 -1
- package/v2Components/ErrorInfoNote/ErrorTypeRenderer.js +2 -2
- package/v2Components/ErrorInfoNote/ErrorTypeRenderer.test.js +9 -9
- package/v2Components/ErrorInfoNote/index.js +7 -6
- package/v2Components/ErrorInfoNote/utils.js +7 -7
- package/v2Components/ErrorInfoNote/utils.test.js +22 -22
- package/v2Components/FormBuilder/index.js +0 -4
- package/v2Containers/Cap/index.js +1 -1
package/package.json
CHANGED
|
@@ -54,8 +54,8 @@ const ErrorTypeRenderer = ({
|
|
|
54
54
|
|
|
55
55
|
if (!hasAndroid && !hasIos) return null;
|
|
56
56
|
|
|
57
|
-
const showPlatformLabels = !!androidErrors?.
|
|
58
|
-
const showTitle = hasAndroid && hasIos
|
|
57
|
+
const showPlatformLabels = !!androidErrors?.LIQUID?.platformLabel || !!iosErrors?.LIQUID?.platformLabel;
|
|
58
|
+
const showTitle = hasAndroid && hasIos;
|
|
59
59
|
const liquidAndroidProps = getLiquidProps(androidErrors, true, showTitle, showPlatformLabels);
|
|
60
60
|
const liquidIosProps = getLiquidProps(iosErrors, false, showTitle, showPlatformLabels);
|
|
61
61
|
|
|
@@ -99,19 +99,19 @@ describe('ErrorTypeRenderer', () => { const ErrorSectionComponent = jest.fn(({
|
|
|
99
99
|
render(
|
|
100
100
|
<ErrorTypeRenderer
|
|
101
101
|
androidErrors={{
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
STANDARD: { errorsToShow: ['a1'], title: 'Android Standard', platformLabel: ANDROID },
|
|
103
|
+
LIQUID: { errorsToShow: ['al1'], title: 'Android Liquid', platformLabel: ANDROID },
|
|
104
104
|
}}
|
|
105
105
|
iosErrors={{
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
STANDARD: { errorsToShow: [], title: 'iOS Standard', platformLabel: IOS },
|
|
107
|
+
LIQUID: { errorsToShow: [], title: 'iOS Liquid', platformLabel: IOS },
|
|
108
108
|
}}
|
|
109
109
|
ErrorSectionComponent={ErrorSectionComponent}
|
|
110
110
|
/>
|
|
111
111
|
);
|
|
112
112
|
expect(ErrorSectionComponent).toHaveBeenCalledWith(
|
|
113
113
|
expect.objectContaining({
|
|
114
|
-
title:
|
|
114
|
+
title: 'Android Liquid',
|
|
115
115
|
errors: ['a1', 'al1'],
|
|
116
116
|
liquidError: true,
|
|
117
117
|
platformLabel: ANDROID,
|
|
@@ -124,12 +124,12 @@ describe('ErrorTypeRenderer', () => { const ErrorSectionComponent = jest.fn(({
|
|
|
124
124
|
render(
|
|
125
125
|
<ErrorTypeRenderer
|
|
126
126
|
androidErrors={{
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
STANDARD: { errorsToShow: [], title: 'Android Standard', platformLabel: ANDROID },
|
|
128
|
+
LIQUID: { errorsToShow: [], title: 'Android Liquid', platformLabel: ANDROID },
|
|
129
129
|
}}
|
|
130
130
|
iosErrors={{
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
STANDARD: { errorsToShow: ['i1'], title: 'iOS Standard', platformLabel: IOS },
|
|
132
|
+
LIQUID: { errorsToShow: ['il1'], title: 'iOS Liquid', platformLabel: IOS },
|
|
133
133
|
}}
|
|
134
134
|
ErrorSectionComponent={ErrorSectionComponent}
|
|
135
135
|
/>
|
|
@@ -94,21 +94,22 @@ export const ErrorInfoNote = (props) => {
|
|
|
94
94
|
|
|
95
95
|
// Detect if platform-specific (ANDROID/IOS) or GENERIC
|
|
96
96
|
const isObject = typeof rawStandardErrors === 'object' && rawStandardErrors !== null;
|
|
97
|
-
const isNotArray = !Array.isArray(
|
|
98
|
-
const hasPlatformKeys = isObject && isNotArray && [ANDROID, IOS, GENERIC].some((key) => key in
|
|
97
|
+
const isNotArray = !Array.isArray(rawLiquidErrors);
|
|
98
|
+
const hasPlatformKeys = isObject && isNotArray && [ANDROID, IOS, GENERIC].some((key) => key in rawLiquidErrors);
|
|
99
99
|
|
|
100
100
|
if (hasPlatformKeys) {
|
|
101
101
|
// Platform-specific
|
|
102
102
|
const androidErrors = {
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
STANDARD: processErrors(rawStandardErrors, 'standard', ANDROID, messages),
|
|
104
|
+
LIQUID: processErrors(rawLiquidErrors, 'liquid', ANDROID, messages),
|
|
105
105
|
};
|
|
106
106
|
const iosErrors = {
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
STANDARD: processErrors(rawStandardErrors, 'standard', IOS, messages),
|
|
108
|
+
LIQUID: processErrors(rawLiquidErrors, 'liquid', IOS, messages),
|
|
109
109
|
};
|
|
110
110
|
return (
|
|
111
111
|
<ErrorTypeRenderer
|
|
112
|
+
genericErrors={null}
|
|
112
113
|
androidErrors={androidErrors}
|
|
113
114
|
iosErrors={iosErrors}
|
|
114
115
|
ErrorSectionComponent={ErrorSection}
|
|
@@ -27,13 +27,13 @@ export const processErrors = (rawErrorData, errorType, platform, messages) => {
|
|
|
27
27
|
return { errorsToShow, title, platformLabel };
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
export const getLiquidProps = (errors, isAndroid,showTitle,showPlatformLabels) => ({
|
|
31
|
-
title: (isAndroid
|
|
30
|
+
export const getLiquidProps = (errors, isAndroid, showTitle, showPlatformLabels) => ({
|
|
31
|
+
title: (isAndroid || !showTitle) && errors?.LIQUID?.title,
|
|
32
32
|
errors: [
|
|
33
|
-
...(errors?.
|
|
34
|
-
...(errors?.
|
|
33
|
+
...(errors?.STANDARD?.errorsToShow || []),
|
|
34
|
+
...(errors?.LIQUID?.errorsToShow || []),
|
|
35
35
|
],
|
|
36
|
-
liquidError: !!errors?.
|
|
36
|
+
liquidError: !!errors?.LIQUID?.errorsToShow?.length,
|
|
37
37
|
platformLabel: showPlatformLabels ? (isAndroid ? ANDROID : IOS) : null,
|
|
38
38
|
});
|
|
39
39
|
|
|
@@ -44,7 +44,7 @@ export const getLiquidProps = (errors, isAndroid,showTitle,showPlatformLabels) =
|
|
|
44
44
|
*/
|
|
45
45
|
export const hasPlatformErrors = (errors) => {
|
|
46
46
|
if (!errors) return false;
|
|
47
|
-
const standardLength = errors?.
|
|
48
|
-
const liquidLength = errors?.
|
|
47
|
+
const standardLength = errors?.STANDARD?.errorsToShow?.length || 0;
|
|
48
|
+
const liquidLength = errors?.LIQUID?.errorsToShow?.length || 0;
|
|
49
49
|
return standardLength > 0 || liquidLength > 0;
|
|
50
50
|
};
|
|
@@ -98,8 +98,8 @@ describe('processErrors', () => {
|
|
|
98
98
|
|
|
99
99
|
describe('getLiquidProps', () => {
|
|
100
100
|
const baseErrors = {
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
STANDARD: { errorsToShow: ['s1'] },
|
|
102
|
+
LIQUID: { errorsToShow: ['l1'], title: 'Liquid Title' },
|
|
103
103
|
};
|
|
104
104
|
|
|
105
105
|
it('returns correct props for Android with showTitle true and showPlatformLabels true', () => {
|
|
@@ -122,14 +122,14 @@ describe('getLiquidProps', () => {
|
|
|
122
122
|
});
|
|
123
123
|
});
|
|
124
124
|
|
|
125
|
-
it('returns
|
|
125
|
+
it('returns title even when showTitle is false for Android', () => {
|
|
126
126
|
const result = getLiquidProps(baseErrors, true, false, true);
|
|
127
|
-
expect(result.title).
|
|
127
|
+
expect(result.title).toBe('Liquid Title');
|
|
128
128
|
});
|
|
129
129
|
|
|
130
|
-
it('returns
|
|
131
|
-
const result = getLiquidProps(baseErrors, false,
|
|
132
|
-
expect(result.title).
|
|
130
|
+
it('returns title even when showTitle is false for iOS', () => {
|
|
131
|
+
const result = getLiquidProps(baseErrors, false, false, true);
|
|
132
|
+
expect(result.title).toBe('Liquid Title');
|
|
133
133
|
});
|
|
134
134
|
|
|
135
135
|
it('returns platformLabel null if showPlatformLabels is false', () => {
|
|
@@ -143,7 +143,7 @@ describe('getLiquidProps', () => {
|
|
|
143
143
|
});
|
|
144
144
|
|
|
145
145
|
it('liquidError is false if no liquid errors', () => {
|
|
146
|
-
const result = getLiquidProps({
|
|
146
|
+
const result = getLiquidProps({ STANDARD: { errorsToShow: ['s1'] } }, true, true, true);
|
|
147
147
|
expect(result.liquidError).toBe(false);
|
|
148
148
|
});
|
|
149
149
|
|
|
@@ -162,28 +162,28 @@ describe('hasPlatformErrors', () => {
|
|
|
162
162
|
expect(hasPlatformErrors({})).toBe(false);
|
|
163
163
|
});
|
|
164
164
|
|
|
165
|
-
it('returns false if both
|
|
166
|
-
expect(hasPlatformErrors({
|
|
167
|
-
expect(hasPlatformErrors({
|
|
165
|
+
it('returns false if both STANDARD.errorsToShow and LIQUID.errorsToShow are missing or empty', () => {
|
|
166
|
+
expect(hasPlatformErrors({ STANDARD: { errorsToShow: [] }, LIQUID: { errorsToShow: [] } })).toBe(false);
|
|
167
|
+
expect(hasPlatformErrors({ STANDARD: {}, LIQUID: {} })).toBe(false);
|
|
168
168
|
expect(hasPlatformErrors({})).toBe(false);
|
|
169
169
|
});
|
|
170
170
|
|
|
171
|
-
it('returns true if
|
|
172
|
-
expect(hasPlatformErrors({
|
|
171
|
+
it('returns true if STANDARD.errorsToShow has items', () => {
|
|
172
|
+
expect(hasPlatformErrors({ STANDARD: { errorsToShow: [1, 2] }, LIQUID: { errorsToShow: [] } })).toBe(true);
|
|
173
173
|
});
|
|
174
174
|
|
|
175
|
-
it('returns true if
|
|
176
|
-
expect(hasPlatformErrors({
|
|
175
|
+
it('returns true if LIQUID.errorsToShow has items', () => {
|
|
176
|
+
expect(hasPlatformErrors({ STANDARD: { errorsToShow: [] }, LIQUID: { errorsToShow: [1] } })).toBe(true);
|
|
177
177
|
});
|
|
178
178
|
|
|
179
|
-
it('returns true if both
|
|
180
|
-
expect(hasPlatformErrors({
|
|
179
|
+
it('returns true if both STANDARD and LIQUID errorsToShow have items', () => {
|
|
180
|
+
expect(hasPlatformErrors({ STANDARD: { errorsToShow: [1] }, LIQUID: { errorsToShow: [2] } })).toBe(true);
|
|
181
181
|
});
|
|
182
182
|
|
|
183
|
-
it('handles missing
|
|
184
|
-
expect(hasPlatformErrors({
|
|
185
|
-
expect(hasPlatformErrors({
|
|
186
|
-
expect(hasPlatformErrors({
|
|
187
|
-
expect(hasPlatformErrors({
|
|
183
|
+
it('handles missing STANDARD or LIQUID keys gracefully', () => {
|
|
184
|
+
expect(hasPlatformErrors({ STANDARD: { errorsToShow: [1] } })).toBe(true);
|
|
185
|
+
expect(hasPlatformErrors({ LIQUID: { errorsToShow: [2] } })).toBe(true);
|
|
186
|
+
expect(hasPlatformErrors({ STANDARD: {}, LIQUID: undefined })).toBe(false);
|
|
187
|
+
expect(hasPlatformErrors({ STANDARD: undefined, LIQUID: {} })).toBe(false);
|
|
188
188
|
});
|
|
189
189
|
});
|
|
@@ -708,15 +708,12 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
708
708
|
errorData[parseInt(index)]['invalid-tags'] = tagValidationResponse.unsupportedTags;
|
|
709
709
|
errorData[parseInt(index)][`bracket-error`] = isBraceError && TAG_BRACKET_COUNT_MISMATCH_ERROR;
|
|
710
710
|
isValid = false;
|
|
711
|
-
isCurrentTabValid = false;
|
|
712
711
|
}
|
|
713
712
|
}
|
|
714
713
|
|
|
715
714
|
} else {
|
|
716
|
-
|
|
717
715
|
errorData[parseInt(index)][`message-editor${selector}`] = true;
|
|
718
716
|
isValid = false;
|
|
719
|
-
isCurrentTabValid = false;
|
|
720
717
|
}
|
|
721
718
|
|
|
722
719
|
|
|
@@ -739,7 +736,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
739
736
|
errorData[parseInt(index)][`message-title${selector}`] = isBraceError ? TAG_BRACKET_COUNT_MISMATCH_ERROR : true;
|
|
740
737
|
errorData[parseInt(index)][`bracket-error`] = isBraceError && TAG_BRACKET_COUNT_MISMATCH_ERROR;
|
|
741
738
|
isValid = false;
|
|
742
|
-
isCurrentTabValid = false;
|
|
743
739
|
}
|
|
744
740
|
}
|
|
745
741
|
} else {
|
|
@@ -618,7 +618,7 @@ const withLineContainerSaga = injectSaga({ key: 'lineCreate', saga: v2LineContai
|
|
|
618
618
|
const withMobilePushCreateSaga = injectSaga({ key: 'mobileCreate', saga: v2MobilePushCreateSagas });
|
|
619
619
|
const withWechatMapTemplatesSaga = injectSaga({ key: 'weChatMapTemplate', saga: v2WechatMapTemplatesSagas });
|
|
620
620
|
const withRcsSaga = injectSaga({ key: 'rcs', saga: v2RcsSagas });
|
|
621
|
-
const withInAppSaga = injectSaga({ key: 'inapp', saga: v2InAppSagas });
|
|
621
|
+
const withInAppSaga = injectSaga({ key: 'inapp', saga: v2InAppSagas, mode: DAEMON });
|
|
622
622
|
const withViberSaga = injectSaga({ key: 'viber', saga: v2ViberSagas });
|
|
623
623
|
const withFacebookSaga = injectSaga({ key: 'facebook', saga: v2FacebookSagas });
|
|
624
624
|
const withLineReducer = injectReducer({ key: 'lineCreate', reducer: createReducer });
|