@capillarytech/creatives-library 9.0.36 → 9.0.37-alpha.1

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.
Files changed (48) hide show
  1. package/AppRoot.js +124 -0
  2. package/app-config.js +61 -0
  3. package/app.js +10 -175
  4. package/bootstrap.js +185 -0
  5. package/entry.js +67 -1
  6. package/mfe-exposed-components.js +2 -4
  7. package/package.json +2 -2
  8. package/services/api.js +9 -1
  9. package/styles/containers/layout/_layoutPage.scss +8 -6
  10. package/utils/getDataLayer.js +15 -0
  11. package/utils/gtmTrackers/gtmEvents/creativeDetails.js +2 -1
  12. package/utils/mfeDetect.js +1 -0
  13. package/utils/mfeFirstPaintReady.js +29 -0
  14. package/utils/mfeHistory.js +62 -0
  15. package/utils/rcsPayloadUtils.js +5 -2
  16. package/utils/tests/rcsPayloadUtils.test.js +54 -2
  17. package/v2Components/CapActionButton/constants.js +1 -0
  18. package/v2Components/CapActionButton/index.js +77 -9
  19. package/v2Components/CapActionButton/index.scss +13 -0
  20. package/v2Components/CapActionButton/messages.js +13 -0
  21. package/v2Components/CapActionButton/tests/index.test.js +32 -1
  22. package/v2Components/CommonTestAndPreview/index.js +44 -15
  23. package/v2Components/CommonTestAndPreview/tests/index.test.js +78 -0
  24. package/v2Components/CommonTestAndPreview/utils.js +34 -0
  25. package/v2Components/NavigationBar/index.js +9 -7
  26. package/v2Components/NavigationBar/mfeModuleHeader.config.js +16 -0
  27. package/v2Components/NavigationBar/tests/index.test.js +39 -19
  28. package/v2Components/SmsFallback/index.js +6 -0
  29. package/v2Containers/Cap/constants.js +1 -0
  30. package/v2Containers/Cap/index.js +57 -27
  31. package/v2Containers/CreativesContainer/index.js +11 -8
  32. package/v2Containers/CreativesContainer/tests/index.test.js +53 -0
  33. package/v2Containers/Rcs/components/CarouselCard.js +5 -0
  34. package/v2Containers/Rcs/components/CarouselCardButtons.js +20 -0
  35. package/v2Containers/Rcs/index.js +154 -79
  36. package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +55 -4
  37. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +286 -0
  38. package/v2Containers/Rcs/tests/carouselUtils.test.js +13 -17
  39. package/v2Containers/Rcs/tests/index.test.js +141 -6
  40. package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +110 -0
  41. package/v2Containers/Rcs/tests/utils.test.js +36 -0
  42. package/v2Containers/Rcs/utils.js +16 -4
  43. package/v2Containers/SmsTrai/Edit/index.js +35 -24
  44. package/v2Containers/Templates/_templates.scss +1 -1
  45. package/v2Containers/Templates/index.js +1 -0
  46. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +5 -0
  47. package/v2Containers/TemplatesV2/TemplatesV2.style.js +8 -3
  48. package/v2Containers/TemplatesV2/index.js +22 -9
@@ -10,7 +10,7 @@ import { connect } from 'react-redux';
10
10
  import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
11
11
  import { createStructuredSelector } from 'reselect';
12
12
  import { bindActionCreators, compose } from 'redux';
13
- import { CapTab, CapCustomCard, CapButton, CapHeader, CapIcon, CapSpin, CapTooltip } from '@capillarytech/cap-ui-library';
13
+ import { CapTab, CapCustomCard, CapButton, CapIcon, CapSpin, CapTooltip } from '@capillarytech/cap-ui-library';
14
14
  import { find, get, pick } from 'lodash';
15
15
  import Helmet from 'react-helmet';
16
16
 
@@ -47,6 +47,9 @@ import {
47
47
  NORMALIZED_CHANNEL_ALIASES,
48
48
  SMS,
49
49
  } from "../CreativesContainer/constants";
50
+ import { MFEEventBus } from '@capillarytech/cap-ui-utils';
51
+ import { isMFEMode } from '../../utils/mfeDetect';
52
+ import appConfig from '../../app-config';
50
53
 
51
54
  const { CapCustomCardList } = CapCustomCard;
52
55
 
@@ -54,6 +57,7 @@ const StyledCapTab = withStyles(CapTab, CapTabStyle);
54
57
  export class TemplatesV2 extends React.Component { // eslint-disable-line react/prefer-stateless-function
55
58
  constructor(props) {
56
59
  super(props);
60
+ this.lcpReported = false;
57
61
  let defaultChannel = get(this, 'props.channel') || get(this, 'props.params.channel') || 'sms';
58
62
  if (defaultChannel === LOYALTY) {
59
63
  defaultChannel = 'sms';
@@ -222,6 +226,23 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
222
226
  }
223
227
  }
224
228
 
229
+ componentDidUpdate(prevProps) {
230
+ if (
231
+ isMFEMode() &&
232
+ !this.lcpReported &&
233
+ !this.props.Templates.getAllTemplatesInProgress &&
234
+ prevProps.Templates.getAllTemplatesInProgress
235
+ ) {
236
+ this.lcpReported = true;
237
+ MFEEventBus.emit('mfe:segment', {
238
+ action: 'stop',
239
+ appId: appConfig.appName,
240
+ type: 'lcp',
241
+ timestamp: performance.now(),
242
+ });
243
+ }
244
+ }
245
+
225
246
  componentWillReceiveProps(nextProps) {
226
247
  if (this.props.channel !== nextProps.channel) {
227
248
  const panes = this.setChannelContent(nextProps.channel, this.state.panes);
@@ -422,14 +443,6 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
422
443
  />
423
444
  )}
424
445
  <section className="component-wrapper">
425
- {isFullMode && (
426
- <CapHeader
427
- title={<FormattedMessage {...messages.creatives} />}
428
- {...(!useLocalTemplates && {
429
- description: <FormattedMessage {...messages.creativesDesc} />,
430
- })}
431
- />
432
- )}
433
446
  {hideChannelTabsForLocalSms ? (
434
447
  <section className="templates-v2-local-sms-pane">{activeLocalPane?.content}</section>
435
448
  ) : (