@capillarytech/creatives-library 9.0.36-alpha.0 → 9.0.37-alpha.0
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/translations/en.json +2 -2
- package/utils/permissions.js +59 -0
- package/utils/tests/permissions.test.js +116 -0
- package/v2Components/AccessForbidden/_accessForbidden.scss +14 -0
- package/v2Components/AccessForbidden/index.js +5 -3
- package/v2Components/AccessForbidden/messages.js +3 -2
- package/v2Components/CommonTestAndPreview/UnifiedPreview/ViberPreviewContent.js +15 -108
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +1 -139
- package/v2Components/CommonTestAndPreview/index.js +26 -240
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/ViberPreviewContent.test.js +0 -364
- package/v2Components/NoPermissionWrapper/_noPermissionWrapper.scss +12 -0
- package/v2Components/NoPermissionWrapper/index.js +26 -0
- package/v2Containers/App/constants.js +5 -0
- package/v2Containers/Assets/Gallery/_gallery.scss +6 -0
- package/v2Containers/Assets/Gallery/index.js +34 -10
- package/v2Containers/Cap/index.js +5 -2
- package/v2Containers/Cap/messages.js +4 -0
- package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +2 -2
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +6 -6
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +4 -4
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +32 -32
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +36 -36
- package/v2Containers/Rcs/carouselUtils.js +73 -46
- package/v2Containers/Rcs/components/CarouselCard.js +9 -6
- package/v2Containers/Rcs/constants.js +7 -2
- package/v2Containers/Rcs/index.js +126 -72
- package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +43 -5
- package/v2Containers/Rcs/tests/CarouselCard.test.js +2 -1
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +118 -118
- package/v2Containers/Rcs/tests/carouselUtils.test.js +15 -15
- package/v2Containers/Rcs/tests/index.test.js +232 -10
- package/v2Containers/Rcs/tests/utils.test.js +17 -0
- package/v2Containers/Rcs/utils.js +51 -12
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +8 -8
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +18 -18
- package/v2Containers/Templates/ChannelTypeIllustration.js +10 -1
- package/v2Containers/Templates/_templates.scss +6 -114
- package/v2Containers/Templates/index.js +151 -190
- package/v2Containers/Templates/tests/ChannelTypeIllustration.test.js +7 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +173 -120
- package/v2Containers/TemplatesV2/index.js +16 -5
- package/v2Containers/Viber/constants.js +0 -21
- package/v2Containers/Viber/index.js +49 -719
- package/v2Containers/Viber/index.scss +0 -175
- package/v2Containers/Viber/messages.js +0 -121
- package/v2Containers/Viber/tests/index.test.js +0 -80
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +268 -268
- package/v2Components/CommonTestAndPreview/UnifiedPreview/ViberCarouselPreviewCards.js +0 -132
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_viberCarouselPreviewCards.scss +0 -131
|
@@ -2,8 +2,9 @@ import React, { useMemo } from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import zaloillustration from '@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg';
|
|
4
4
|
import inAppIllustration from '@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg';
|
|
5
|
-
import { FormattedMessage } from 'react-intl';
|
|
5
|
+
import { FormattedMessage, useIntl } from 'react-intl';
|
|
6
6
|
import { CapIllustration } from "@capillarytech/cap-ui-library";
|
|
7
|
+
import globalMessages from '../Cap/messages';
|
|
7
8
|
import emailIllustration from '../Assets/images/emailIllustration.svg';
|
|
8
9
|
import smsIllustration from '../Assets/images/smsIllustration.svg';
|
|
9
10
|
import pushIllustration from '../Assets/images/pushIllustration.svg';
|
|
@@ -79,12 +80,14 @@ const CHANNEL_CONFIG = {
|
|
|
79
80
|
};
|
|
80
81
|
|
|
81
82
|
function ChannelTypeIllustration(props) {
|
|
83
|
+
const intl = useIntl();
|
|
82
84
|
const {
|
|
83
85
|
isFullMode,
|
|
84
86
|
createTemplate,
|
|
85
87
|
currentChannel,
|
|
86
88
|
hostName,
|
|
87
89
|
isArchivedMode,
|
|
90
|
+
canCreate = true,
|
|
88
91
|
} = props;
|
|
89
92
|
|
|
90
93
|
const templateText = useMemo(() => {
|
|
@@ -183,6 +186,11 @@ function ChannelTypeIllustration(props) {
|
|
|
183
186
|
if (config.hasButton) {
|
|
184
187
|
result.buttonLabel = <FormattedMessage {...config.buttonMessage} values={{ template: templateText }} />;
|
|
185
188
|
result.onClick = createTemplate;
|
|
189
|
+
// RBAC: gray out + disable the create button for users without create permission.
|
|
190
|
+
if (!canCreate) {
|
|
191
|
+
result.disabled = true;
|
|
192
|
+
result.buttonTooltip = intl.formatMessage(globalMessages.noPermissionAction);
|
|
193
|
+
}
|
|
186
194
|
}
|
|
187
195
|
|
|
188
196
|
if (config.descriptionMessage) {
|
|
@@ -213,5 +221,6 @@ ChannelTypeIllustration.propTypes = {
|
|
|
213
221
|
currentChannel: PropTypes.string,
|
|
214
222
|
hostName: PropTypes.string,
|
|
215
223
|
isArchivedMode: PropTypes.bool,
|
|
224
|
+
canCreate: PropTypes.bool,
|
|
216
225
|
};
|
|
217
226
|
export default ChannelTypeIllustration;
|
|
@@ -160,96 +160,6 @@
|
|
|
160
160
|
line-clamp: 3;
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
.viber-carousel-static-content {
|
|
164
|
-
width: 100%;
|
|
165
|
-
overflow: hidden;
|
|
166
|
-
.viber-carousel-static-message-box {
|
|
167
|
-
width: 100%;
|
|
168
|
-
height: auto;
|
|
169
|
-
border-radius: $CAP_SPACE_04;
|
|
170
|
-
background: $CAP_WHITE;
|
|
171
|
-
margin-bottom: $CAP_SPACE_08;
|
|
172
|
-
display: flex;
|
|
173
|
-
align-items: flex-start;
|
|
174
|
-
}
|
|
175
|
-
.viber-carousel-static-message {
|
|
176
|
-
display: -webkit-box;
|
|
177
|
-
width: 100%;
|
|
178
|
-
color: $CAP_G01;
|
|
179
|
-
line-height: 1.3;
|
|
180
|
-
overflow: hidden;
|
|
181
|
-
text-overflow: ellipsis;
|
|
182
|
-
-webkit-line-clamp: 2;
|
|
183
|
-
line-clamp: 2;
|
|
184
|
-
-webkit-box-orient: vertical;
|
|
185
|
-
white-space: normal;
|
|
186
|
-
word-break: break-word;
|
|
187
|
-
}
|
|
188
|
-
.viber-carousel-static-cards {
|
|
189
|
-
display: flex;
|
|
190
|
-
gap: $CAP_SPACE_08;
|
|
191
|
-
overflow: hidden;
|
|
192
|
-
}
|
|
193
|
-
.viber-carousel-static-card {
|
|
194
|
-
flex: 1;
|
|
195
|
-
min-width: 0;
|
|
196
|
-
background: $CAP_WHITE;
|
|
197
|
-
border-radius: $CAP_SPACE_04;
|
|
198
|
-
overflow: hidden;
|
|
199
|
-
display: flex;
|
|
200
|
-
flex-direction: column;
|
|
201
|
-
}
|
|
202
|
-
.viber-carousel-static-image {
|
|
203
|
-
width: 100%;
|
|
204
|
-
max-height: 11rem;
|
|
205
|
-
margin-bottom: $CAP_SPACE_04;
|
|
206
|
-
border-radius: $CAP_SPACE_04;
|
|
207
|
-
display: block;
|
|
208
|
-
}
|
|
209
|
-
.viber-carousel-static-image-placeholder {
|
|
210
|
-
width: 100%;
|
|
211
|
-
height: 7.143rem;
|
|
212
|
-
border-radius: $CAP_SPACE_04;
|
|
213
|
-
}
|
|
214
|
-
.viber-carousel-static-image-placeholder {
|
|
215
|
-
background: $CAP_G07;
|
|
216
|
-
}
|
|
217
|
-
.viber-carousel-static-text {
|
|
218
|
-
display: block;
|
|
219
|
-
color: $CAP_G01;
|
|
220
|
-
margin: $CAP_SPACE_04 0;
|
|
221
|
-
line-height: 1.3;
|
|
222
|
-
overflow: hidden;
|
|
223
|
-
text-overflow: ellipsis;
|
|
224
|
-
white-space: normal;
|
|
225
|
-
-webkit-line-clamp: 2;
|
|
226
|
-
line-clamp: 2;
|
|
227
|
-
-webkit-box-orient: vertical;
|
|
228
|
-
display: -webkit-box;
|
|
229
|
-
}
|
|
230
|
-
.viber-carousel-static-buttons {
|
|
231
|
-
display: flex;
|
|
232
|
-
flex-direction: column;
|
|
233
|
-
gap: $CAP_SPACE_04;
|
|
234
|
-
margin-top: auto;
|
|
235
|
-
}
|
|
236
|
-
.viber-carousel-static-button {
|
|
237
|
-
display: block;
|
|
238
|
-
min-height: 1.5rem;
|
|
239
|
-
border-radius: $CAP_SPACE_12;
|
|
240
|
-
background: $CAP_PURPLE01;
|
|
241
|
-
color: $CAP_WHITE;
|
|
242
|
-
text-align: center;
|
|
243
|
-
padding: 0.179rem $CAP_SPACE_08;
|
|
244
|
-
white-space: normal;
|
|
245
|
-
}
|
|
246
|
-
.viber-carousel-static-button-secondary {
|
|
247
|
-
color: $CAP_PURPLE01;
|
|
248
|
-
background: transparent;
|
|
249
|
-
border: none;
|
|
250
|
-
box-shadow: none;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
163
|
|
|
254
164
|
}
|
|
255
165
|
|
|
@@ -258,30 +168,6 @@
|
|
|
258
168
|
word-wrap: break-word;
|
|
259
169
|
}
|
|
260
170
|
}
|
|
261
|
-
|
|
262
|
-
&.viber-carousel-static {
|
|
263
|
-
height: auto;
|
|
264
|
-
min-height: 21.125rem;
|
|
265
|
-
|
|
266
|
-
.ant-card-body {
|
|
267
|
-
padding-bottom: $CAP_SPACE_12;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
.truncate-text-viber {
|
|
271
|
-
.ant-card-meta-description {
|
|
272
|
-
display: block;
|
|
273
|
-
overflow: visible;
|
|
274
|
-
-webkit-line-clamp: unset;
|
|
275
|
-
line-clamp: unset;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
.viber-carousel-static-content,
|
|
280
|
-
.viber-carousel-static-cards,
|
|
281
|
-
.viber-carousel-static-card {
|
|
282
|
-
overflow: visible;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
171
|
|
|
286
172
|
|
|
287
173
|
&.carousel-img-section {
|
|
@@ -1587,3 +1473,9 @@
|
|
|
1587
1473
|
min-width: 0;
|
|
1588
1474
|
}
|
|
1589
1475
|
}
|
|
1476
|
+
|
|
1477
|
+
// RBAC: dim + block a control the user lacks permission for (used with CapTooltip).
|
|
1478
|
+
.rbac-disabled {
|
|
1479
|
+
opacity: 0.4;
|
|
1480
|
+
cursor: not-allowed;
|
|
1481
|
+
}
|