@designcrowd/library.brand-page 5.15.21 → 5.15.24-ast-previews-2

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 (196) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-DZ5Vucii.js → CreatedOnBrandCrowd-de-de-eUKSDWA0.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-DknGL3Zu.js → CreatedOnBrandCrowd-en-us-C_uqDCbw.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-NwtO4oKe.js → CreatedOnBrandCrowd-es-es-D00N7D1y.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-DfUf3ajR.js → CreatedOnBrandCrowd-fr-ca-C_Y11ve1.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-DfUf3ajR.js → CreatedOnBrandCrowd-fr-fr-C_Y11ve1.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-TjO5ceZp.js → CreatedOnBrandCrowd-pt-br-b-NirRyH.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-TjO5ceZp.js → CreatedOnBrandCrowd-pt-pt-b-NirRyH.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-CiEaeern.js → CreatedOnDcom-de-de-DGenvk6d.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-BsQTy39u.js → CreatedOnDcom-en-us-BNO9QrD0.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-BgUs8RD2.js → CreatedOnDcom-es-es-BG_gd286.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-5Rt16LTN.js → CreatedOnDcom-fr-ca-DLBcHowo.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-DRajgiLq.js → CreatedOnDcom-fr-fr-jInQfULX.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-CpGsGCmj.js → CreatedOnDcom-pt-br-Di1Kb5Xa.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-C1CjD8Ks.js → CreatedOnDcom-pt-pt-BWZ0TIJv.js} +1 -1
  15. package/lib/src/brand-page/components/media/Media.mixin.d.ts +12 -0
  16. package/lib/src/brand-page/components/media/Media.mixin.js +5 -0
  17. package/lib/src/brand-page/components/page/Page.stories.js +1 -1
  18. package/lib/src/brand-page/components/payment/__fixtures__/request-payment.d.ts +1 -0
  19. package/lib/src/brand-page/components/payment/__fixtures__/support-me.d.ts +1 -0
  20. package/lib/src/brand-page/models/brand-page-context.model.d.ts +1 -0
  21. package/lib/src/brand-page/models/index.d.ts +16 -0
  22. package/lib/src/brand-page/models/index.js +19 -0
  23. package/lib/src/brand-page/models/payment.model.d.ts +7 -0
  24. package/lib/src/brand-page/utils/migration/migration-07.js +1 -1
  25. package/lib/src/brand-page/utils/view-model.util.d.ts +16 -5
  26. package/lib/src/brand-page/utils/view-model.util.js +48 -8
  27. package/lib/src/brand-page/view-models.d.ts +19 -1
  28. package/lib/src/brand-page-maker/components/action-bar/ActionBar.mixin.d.ts +1 -0
  29. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +4 -0
  30. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.stories.js +1 -0
  31. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMakerTemplateSettings.mixin.d.ts +1 -0
  32. package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +4 -0
  33. package/lib/src/brand-page-maker/components/brandpage-settings/ReplaceImageSettingsForBrandPageSettings.mixin.d.ts +1 -0
  34. package/lib/src/brand-page-maker/components/preview/Preview.mixin.js +1 -0
  35. package/lib/src/brand-page-maker/components/preview/Preview.stories.js +1 -1
  36. package/lib/src/brand-page-maker/components/seo-settings/SeoPageSettings.mixin.d.ts +1 -0
  37. package/lib/src/brand-page-maker/components/seo-settings/UrlSettings.mixin.d.ts +1 -0
  38. package/lib/src/brand-page-maker/components/social-share/SocialShare.mixin.d.ts +1 -0
  39. package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.d.ts +228 -0
  40. package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.js +72 -6
  41. package/lib/src/brand-page-maker/constants/config-settings-constant.js +28 -11
  42. package/lib/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.d.ts +12 -0
  43. package/lib/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.js +20 -3
  44. package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.d.ts +1 -0
  45. package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +35 -4
  46. package/lib/src/brand-page-maker/stores/index.d.ts +1 -0
  47. package/lib/src/brand-page-maker/stores/index.js +1 -0
  48. package/lib/src/brand-page-maker/stores/video/index.d.ts +1 -0
  49. package/lib/src/brand-page-maker/stores/video/index.js +1 -0
  50. package/lib/src/brand-page-maker/stores/video/video-store.d.ts +27 -0
  51. package/lib/src/brand-page-maker/stores/video/video-store.js +27 -0
  52. package/lib/src/{bundled-translations-wzmaFfsm.js → bundled-translations-D9iHE5G9.js} +1 -1
  53. package/lib/src/bundled-translations-DfL3kp2E.js +27 -0
  54. package/lib/src/bundled-translations.de-DE-C-Q--DoV.js +27 -0
  55. package/lib/src/bundled-translations.de-DE-DW3iDx_G.js +161 -0
  56. package/lib/src/bundled-translations.es-ES-C2bDEZN2.js +27 -0
  57. package/lib/src/bundled-translations.es-ES-C9I8wDyq.js +161 -0
  58. package/lib/src/bundled-translations.fr-CA-BT6vKgDQ.js +27 -0
  59. package/lib/src/bundled-translations.fr-CA-C0NN8DsO.js +161 -0
  60. package/lib/src/bundled-translations.fr-FR-BekT99Kc.js +27 -0
  61. package/lib/src/bundled-translations.fr-FR-oKV5NyE1.js +161 -0
  62. package/lib/src/bundled-translations.pt-BR-CTvCfv1X.js +161 -0
  63. package/lib/src/bundled-translations.pt-BR-DjzgcAmv.js +27 -0
  64. package/lib/src/bundled-translations.pt-PT-CbwxwRY1.js +161 -0
  65. package/lib/src/bundled-translations.pt-PT-ZxaU_1Hw.js +27 -0
  66. package/lib/src/bundles/bundled-translations.de-DE.json +4 -0
  67. package/lib/src/bundles/bundled-translations.es-ES.json +4 -0
  68. package/lib/src/bundles/bundled-translations.fr-CA.json +4 -0
  69. package/lib/src/bundles/bundled-translations.fr-FR.json +4 -0
  70. package/lib/src/bundles/bundled-translations.json +4 -0
  71. package/lib/src/bundles/bundled-translations.pt-BR.json +4 -0
  72. package/lib/src/bundles/bundled-translations.pt-PT.json +4 -0
  73. package/lib/src/clients/brand-page-client.d.ts +1 -0
  74. package/lib/src/clients/brand-page-client.js +11 -1
  75. package/lib/src/clients/gettyimages-client.js +1 -1
  76. package/lib/src/css/library.brand-page-brandCrowd.min.css +59 -44
  77. package/lib/src/css/library.brand-page-brandPage.min.css +59 -44
  78. package/lib/src/css/library.brand-page-designCom.min.css +59 -44
  79. package/lib/src/css/library.brand-page-preview.min.css +59 -44
  80. package/lib/src/helpers/ts.helper.d.ts +1 -0
  81. package/lib/src/helpers/ts.helper.js +22 -0
  82. package/lib/src/index.d.ts +1 -1
  83. package/lib/src/index.mjs +183 -180
  84. package/lib/src/{lib-BpQH-xbj.js → lib-Crz0R1bS.js} +20226 -19710
  85. package/lib/src/lib.js +1 -1
  86. package/lib/src/shared/content-settings/components/GenericTextInput.mixin.d.ts +1 -1
  87. package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +4 -0
  88. package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +6 -1
  89. package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.js +4 -0
  90. package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.d.ts +2 -0
  91. package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.js +1 -0
  92. package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +4 -0
  93. package/lib/src/shared/content-settings/components/email-field/EmailField.mixin.d.ts +1 -1
  94. package/lib/src/shared/content-settings/components/focused-content-item-settings/FocusedContentItemSettings.mixin.d.ts +2 -0
  95. package/lib/src/shared/content-settings/components/focused-content-item-settings/FocusedContentItemSettings.mixin.js +1 -0
  96. package/lib/src/shared/content-settings/components/image-field/ImageField.mixin.d.ts +23 -1
  97. package/lib/src/shared/content-settings/components/image-field/ImageField.mixin.js +25 -1
  98. package/lib/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.mixin.d.ts +1 -0
  99. package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.d.ts +79 -1
  100. package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.js +16 -0
  101. package/lib/src/shared/content-settings/components/tel-field/TelField.mixin.d.ts +1 -1
  102. package/lib/src/shared/content-settings/components/text-field/TextField.mixin.d.ts +1 -1
  103. package/lib/src/shared/content-settings/components/textarea-field/TextareaField.mixin.d.ts +1 -1
  104. package/lib/src/shared/content-settings/components/url-field/UrlField.mixin.d.ts +1 -1
  105. package/lib/src/shared/content-settings/components/youtube-video-field/YoutubeVideoField.mixin.d.ts +1 -1
  106. package/lib/src/shared/content-settings/models.d.ts +2 -0
  107. package/lib/src/shared/content-settings/store/content-settings-store.d.ts +3 -0
  108. package/lib/src/shared/content-settings/store/content-settings-store.js +37 -1
  109. package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +2 -0
  110. package/lib/src/shared/my-uploads/models.d.ts +12 -0
  111. package/lib/src/shared/page-settings/components/new-page-modal/NewPageModal.mixin.d.ts +1 -0
  112. package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +4 -0
  113. package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +4 -0
  114. package/lib/src/shared/page-settings/store/page-settings-store.d.ts +2 -1
  115. package/lib/src/shared/page-settings/store/page-settings-store.js +35 -0
  116. package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts +1 -0
  117. package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +1 -0
  118. package/lib/src/shared/template-settings/store/template-settings-store.js +18 -5
  119. package/package.json +2 -2
  120. package/src/brand-page/components/banner-section/BannerSection.vue +6 -1
  121. package/src/brand-page/components/media/Media.mixin.ts +6 -0
  122. package/src/brand-page/components/media/Media.vue +18 -3
  123. package/src/brand-page/components/media/Video.vue +62 -0
  124. package/src/brand-page/components/page/Page.stories.ts +1 -0
  125. package/src/brand-page/components/page/Page.vue +2 -2
  126. package/src/brand-page/models/brand-page-context.model.ts +1 -0
  127. package/src/brand-page/models/index.ts +34 -0
  128. package/src/brand-page/models/payment.model.ts +8 -0
  129. package/src/brand-page/utils/migration/migration-07.ts +6 -4
  130. package/src/brand-page/utils/view-model.util.test.ts +10 -2
  131. package/src/brand-page/utils/view-model.util.ts +93 -7
  132. package/src/brand-page/view-models.ts +24 -0
  133. package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.stories.ts +1 -0
  134. package/src/brand-page-maker/components/preview/Preview.mixin.ts +1 -0
  135. package/src/brand-page-maker/components/preview/Preview.stories.ts +1 -0
  136. package/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.ts +93 -5
  137. package/src/brand-page-maker/components/template-preview/TemplatePreview.vue +40 -4
  138. package/src/brand-page-maker/components/template-preview-with-state/TemplatePreviewWithState.vue +4 -6
  139. package/src/brand-page-maker/constants/config-settings-constant.ts +30 -10
  140. package/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.ts +46 -1
  141. package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +41 -1
  142. package/src/brand-page-maker/stores/index.ts +1 -0
  143. package/src/brand-page-maker/stores/video/index.ts +1 -0
  144. package/src/brand-page-maker/stores/video/video-store.ts +47 -0
  145. package/src/bundles/bundled-translations.de-DE.json +4 -0
  146. package/src/bundles/bundled-translations.es-ES.json +4 -0
  147. package/src/bundles/bundled-translations.fr-CA.json +4 -0
  148. package/src/bundles/bundled-translations.fr-FR.json +4 -0
  149. package/src/bundles/bundled-translations.json +4 -0
  150. package/src/bundles/bundled-translations.pt-BR.json +4 -0
  151. package/src/bundles/bundled-translations.pt-PT.json +4 -0
  152. package/src/clients/brand-page-client.ts +20 -1
  153. package/src/clients/gettyimages-client.js +1 -1
  154. package/src/helpers/ts.helper.ts +30 -0
  155. package/src/lib.ts +1 -0
  156. package/src/shared/common/i18n/common.de-DE.json +1 -0
  157. package/src/shared/common/i18n/common.es-ES.json +1 -0
  158. package/src/shared/common/i18n/common.fr-CA.json +1 -0
  159. package/src/shared/common/i18n/common.fr-FR.json +1 -0
  160. package/src/shared/common/i18n/common.json +2 -0
  161. package/src/shared/common/i18n/common.pt-BR.json +1 -0
  162. package/src/shared/common/i18n/common.pt-PT.json +1 -0
  163. package/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.ts +12 -1
  164. package/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.vue +1 -0
  165. package/src/shared/content-settings/components/content-settings/i18n/content-settings.de-DE.json +3 -0
  166. package/src/shared/content-settings/components/content-settings/i18n/content-settings.es-ES.json +3 -0
  167. package/src/shared/content-settings/components/content-settings/i18n/content-settings.fr-CA.json +3 -0
  168. package/src/shared/content-settings/components/content-settings/i18n/content-settings.fr-FR.json +3 -0
  169. package/src/shared/content-settings/components/content-settings/i18n/content-settings.json +4 -0
  170. package/src/shared/content-settings/components/content-settings/i18n/content-settings.pt-BR.json +3 -0
  171. package/src/shared/content-settings/components/content-settings/i18n/content-settings.pt-PT.json +3 -0
  172. package/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.ts +1 -0
  173. package/src/shared/content-settings/components/focused-content-item-settings/FocusedContentItemSettings.mixin.ts +1 -0
  174. package/src/shared/content-settings/components/image-field/ImageField.mixin.ts +31 -1
  175. package/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.ts +34 -0
  176. package/src/shared/content-settings/components/payment-config-field/PaymentConfigField.vue +23 -8
  177. package/src/shared/content-settings/components/replace-image-base-settings/ReplaceImageBaseSettings.vue +10 -2
  178. package/src/shared/content-settings/models.ts +3 -0
  179. package/src/shared/content-settings/store/content-settings-store.ts +68 -0
  180. package/src/shared/my-uploads/models.ts +16 -0
  181. package/src/shared/page-settings/store/page-settings-store.ts +58 -0
  182. package/src/shared/template-settings/store/template-settings-store.ts +27 -14
  183. package/src/shared/video-library/VideoLibrary.vue +32 -11
  184. package/lib/src/bundled-translations-BMr0LtzI.js +0 -27
  185. package/lib/src/bundled-translations.de-DE-BDSwnN6z.js +0 -27
  186. package/lib/src/bundled-translations.de-DE-BNwDY0Gw.js +0 -161
  187. package/lib/src/bundled-translations.es-ES-B4FHib2V.js +0 -27
  188. package/lib/src/bundled-translations.es-ES-DTvCIjvS.js +0 -161
  189. package/lib/src/bundled-translations.fr-CA-5oL4PLEx.js +0 -161
  190. package/lib/src/bundled-translations.fr-CA-SQDJwXv_.js +0 -27
  191. package/lib/src/bundled-translations.fr-FR-B84T67W5.js +0 -27
  192. package/lib/src/bundled-translations.fr-FR-DWL7DJQp.js +0 -161
  193. package/lib/src/bundled-translations.pt-BR-C9ZYeoLd.js +0 -27
  194. package/lib/src/bundled-translations.pt-BR-CDj0L4EF.js +0 -161
  195. package/lib/src/bundled-translations.pt-PT-BB4hTIYd.js +0 -27
  196. package/lib/src/bundled-translations.pt-PT-M916KJYD.js +0 -161
@@ -38,6 +38,8 @@ import type {
38
38
  SensitiveContent,
39
39
  BookingSectionContent,
40
40
  TextShapeItem,
41
+ GettyVideoMedia,
42
+ AbstractMedia,
41
43
  } from '../models';
42
44
  import { ButtonStyles, SENSITIVE_CONTENT_TYPES, VIEWPORTS } from '../models';
43
45
  import {
@@ -75,6 +77,7 @@ import type {
75
77
  ShapesSectionViewModel,
76
78
  ShopViewModel,
77
79
  BookingSectionViewModel,
80
+ GettyVideoViewModel,
78
81
  } from '../view-models';
79
82
  import { isHexTransparent, setRgbAlpha } from './color.util';
80
83
  import type { ContentTextStylePropertyKey } from '../constants';
@@ -661,9 +664,69 @@ const mapToContactFormViewModel = (
661
664
  );
662
665
  };
663
666
 
667
+ const mapGettyVideoToGettyVideoViewModel = (
668
+ media: GettyVideoMedia,
669
+ options: ViewModelMappingOptions,
670
+ ): GettyVideoViewModel => {
671
+ if (!options.getVideoUrls?.(media.gettyToken)) {
672
+ const s3Urls = options.getS3VideoUrls?.(media.gettyToken);
673
+
674
+ if (s3Urls && s3Urls?.videoUrl) {
675
+ options.setVideoUrlsWithToken?.(
676
+ media.gettyToken,
677
+ s3Urls.videoUrl,
678
+ s3Urls.previewImageUrl,
679
+ media.gettyAssetId,
680
+ );
681
+ }
682
+ }
683
+
684
+ const videoUrls = options.getVideoUrls?.(media.gettyToken) || {
685
+ videoUrl: undefined,
686
+ previewImageUrl: undefined,
687
+ };
688
+
689
+ return {
690
+ type: 'getty-video',
691
+ gettyToken: media.gettyToken,
692
+ gettyAssetId: media.gettyAssetId,
693
+ mimeType: media.mimeType,
694
+ videoUrl: videoUrls.videoUrl,
695
+ previewImageUrl: videoUrls.previewImageUrl,
696
+ settings: {
697
+ autoPlay: media.settings?.autoPlay || false,
698
+ },
699
+ };
700
+ };
701
+
702
+ const mapMediaToContentViewModel = ({
703
+ media,
704
+ options,
705
+ }: {
706
+ media?: AbstractMedia;
707
+ options: ViewModelMappingOptions;
708
+ }) => {
709
+ if (!media) {
710
+ return undefined;
711
+ }
712
+
713
+ switch (media.type) {
714
+ case 'getty-video':
715
+ return mapGettyVideoToGettyVideoViewModel(
716
+ media as GettyVideoMedia,
717
+ options,
718
+ );
719
+ case 'image':
720
+ // TODO(jyao): Implement later
721
+ default:
722
+ throw new Error(`Unsupported media type: ${media.type}`);
723
+ }
724
+ };
725
+
664
726
  export const mapToBannerSectionViewModel = (
665
727
  content: BannerSectionContent,
666
728
  styles: PageStyles,
729
+ options: ViewModelMappingOptions,
667
730
  ): BannerSectionViewModel => {
668
731
  return applyViewModelTextStyles(
669
732
  {
@@ -688,6 +751,10 @@ export const mapToBannerSectionViewModel = (
688
751
  isFullWidth: true,
689
752
  imageUrl: mapToBannerSectionImageUrl(content),
690
753
  isBigImageType: isBigImageType(content.displayStyle),
754
+ mediaViewModel: mapMediaToContentViewModel({
755
+ media: content.media,
756
+ options,
757
+ }),
691
758
  },
692
759
  styles,
693
760
  );
@@ -1064,7 +1131,7 @@ export const mapToViewModel =
1064
1131
  (
1065
1132
  styles: PageStyles,
1066
1133
  brandPageType: BrandPageType,
1067
- options?: { useOldLogoRenderSize: boolean },
1134
+ options: ViewModelMappingOptions,
1068
1135
  ) =>
1069
1136
  (content: Content): ContentViewModel | undefined => {
1070
1137
  switch (content.type) {
@@ -1133,6 +1200,7 @@ export const mapToViewModel =
1133
1200
  return mapToBannerSectionViewModel(
1134
1201
  content as BannerSectionContent,
1135
1202
  styles,
1203
+ options,
1136
1204
  );
1137
1205
 
1138
1206
  case 'booking-section':
@@ -1198,11 +1266,29 @@ export const mapToViewModel =
1198
1266
  }
1199
1267
  };
1200
1268
 
1269
+ interface ViewModelMappingOptions {
1270
+ useOldLogoRenderSize?: boolean;
1271
+ getVideoUrls?: (token: string) => {
1272
+ videoUrl: string;
1273
+ previewImageUrl: string;
1274
+ };
1275
+ getS3VideoUrls?: (token: string) => {
1276
+ videoUrl: string;
1277
+ previewImageUrl: string;
1278
+ };
1279
+ setVideoUrlsWithToken?: (
1280
+ token: string,
1281
+ videoUrl: string,
1282
+ previewImageUrl: string,
1283
+ assetId: string,
1284
+ ) => void;
1285
+ }
1286
+
1201
1287
  export const getBrandPageViewModelFromBrandPageModel = (
1202
1288
  model: BrandPageModel,
1203
1289
  brandPageToken: string | undefined,
1204
1290
  showBrandCrowdLogo = true,
1205
- useOldLogoRenderSize = false,
1291
+ options: ViewModelMappingOptions,
1206
1292
  ): BrandPageViewModel => {
1207
1293
  const pages = model.pages.map((p) => {
1208
1294
  const contents = p.contents
@@ -1210,7 +1296,7 @@ export const getBrandPageViewModelFromBrandPageModel = (
1210
1296
  mapToViewModel(
1211
1297
  model.styles,
1212
1298
  model.brandPageType || BRAND_PAGE_TYPES.default,
1213
- { useOldLogoRenderSize },
1299
+ options,
1214
1300
  ),
1215
1301
  )
1216
1302
  .filter((c) => c !== undefined) as ContentViewModel[];
@@ -1232,23 +1318,23 @@ export const getBrandPageViewModelFromBrandPageModel = (
1232
1318
  model.pageHeaderDesktop,
1233
1319
  model.styles,
1234
1320
  pages,
1235
- useOldLogoRenderSize,
1321
+ options.useOldLogoRenderSize,
1236
1322
  ),
1237
1323
  headerViewModelMobile: mapToPageHeaderViewModel(
1238
1324
  model.pageHeaderMobile,
1239
1325
  model.styles,
1240
1326
  pages,
1241
- useOldLogoRenderSize,
1327
+ options.useOldLogoRenderSize,
1242
1328
  ),
1243
1329
  footerViewModelDesktop: mapToPageFooterViewModel(
1244
1330
  model.pageFooterDesktop,
1245
1331
  model.styles,
1246
- useOldLogoRenderSize,
1332
+ options.useOldLogoRenderSize,
1247
1333
  ),
1248
1334
  footerViewModelMobile: mapToPageFooterViewModel(
1249
1335
  model.pageFooterMobile,
1250
1336
  model.styles,
1251
- useOldLogoRenderSize,
1337
+ options.useOldLogoRenderSize,
1252
1338
  ),
1253
1339
  brandPageType: model.brandPageType || BRAND_PAGE_TYPES.default,
1254
1340
  faviconUrl: model.faviconUrl,
@@ -38,6 +38,7 @@ import type {
38
38
  CookieOptions,
39
39
  SensitiveContent,
40
40
  BookingSectionContent,
41
+ MediaTypes,
41
42
  } from './models';
42
43
  import type { ImagesSectionContentDisplayStyle } from './constants';
43
44
 
@@ -171,6 +172,29 @@ export interface BannerSectionViewModel
171
172
  buttonViewModel: ButtonViewModel;
172
173
  isFullWidth: boolean;
173
174
  isBigImageType: boolean;
175
+ mediaViewModel?: MediaViewModel;
176
+ }
177
+
178
+ export interface MediaViewModel {
179
+ type: MediaTypes;
180
+ }
181
+
182
+ // Note(jyao): We will construct the getty video url in the getty video vue component
183
+ export interface GettyVideoViewModel extends MediaViewModel {
184
+ type: 'getty-video';
185
+ gettyToken: string;
186
+ gettyAssetId: string;
187
+ mimeType: string;
188
+ videoUrl: string | undefined;
189
+ previewImageUrl: string | undefined;
190
+ settings: {
191
+ autoPlay: boolean;
192
+ };
193
+ }
194
+
195
+ export interface ImageMediaViewModel extends MediaViewModel {
196
+ type: 'image';
197
+ // TODO(jyao): Add image stuff later
174
198
  }
175
199
 
176
200
  export interface TextImageSectionViewModel {
@@ -265,6 +265,7 @@ const InitialiseMakerStores = (options: {
265
265
  triggerSaveSuccessMessage: false,
266
266
  abTests: {},
267
267
  isSubsequentPublish: false,
268
+ gettyVideos: [],
268
269
  });
269
270
 
270
271
  userStore.setIsAdmin({ isAdmin: options.isAdmin || false });
@@ -94,6 +94,7 @@ export default defineComponent({
94
94
  isServerRender: false,
95
95
  options: {
96
96
  mediaSizes: MEDIA_SIZES.size1x,
97
+ renderVideoAsImage: true,
97
98
  },
98
99
  stripePublishableKey: undefined,
99
100
  runtimeEnvironment: this.runtimeEnvironment,
@@ -37,6 +37,7 @@ const pages = [
37
37
  mapToViewModel(
38
38
  pageStyles,
39
39
  brandPageData.brandPageType || BRAND_PAGE_TYPES.default,
40
+ {},
40
41
  ),
41
42
  )
42
43
  .filter((x) => x !== undefined) as ContentViewModel[],
@@ -19,12 +19,16 @@ import type { TemplateSettingsTemplate } from '../../../shared/template-settings
19
19
  import type { DebounceHandle } from 'lodash.debounce';
20
20
  import debounce from 'lodash.debounce';
21
21
  import { MOBILE_HEIGHT, MOBILE_WIDTH } from '../../constants';
22
- import { useBrandPageMakerStore } from '../../stores';
22
+ import {
23
+ useBrandPageContainerStore,
24
+ useBrandPageMakerStore,
25
+ } from '../../stores';
23
26
  import {
24
27
  applyLogoImageBase64UrlToBrandPageTemplateModel,
25
28
  applyLogoImageToBrandPageTemplateModel,
26
29
  applyLogoTemplateImageToBrandPageTemplateModel,
27
30
  } from '../../../brand-page/utils/logo.util';
31
+ import { useVideoStore } from '../../../lib';
28
32
 
29
33
  const DEBOUNCE_IN_MS = 250;
30
34
 
@@ -40,18 +44,23 @@ interface TemplatePreviewData {
40
44
  renderHeight: number;
41
45
  renderWidth: number;
42
46
  rootStyles: BrandPageCssStyle;
47
+ imageLoadError: boolean;
48
+ imageLoading: boolean;
43
49
  }
44
50
 
45
51
  export default defineComponent({
46
52
  emits: ['template-selected'],
47
53
  setup() {
48
54
  const brandPageMakerStore = useBrandPageMakerStore();
55
+ const brandPageContainerStore = useBrandPageContainerStore();
49
56
 
50
57
  return {
51
58
  selectedTemplateId: computed(
52
59
  () => brandPageMakerStore.selectedTemplateId,
53
60
  ),
61
+ isPrePurchase: computed(() => brandPageContainerStore.isPrePurchase),
54
62
  brandPageMakerStore,
63
+ brandPageContainerStore,
55
64
  };
56
65
  },
57
66
  props: {
@@ -110,6 +119,8 @@ export default defineComponent({
110
119
  renderWidth: 400,
111
120
  rootStyles: {},
112
121
  viewModel: undefined,
122
+ imageLoadError: false,
123
+ imageLoading: true,
113
124
  };
114
125
 
115
126
  return data;
@@ -143,6 +154,7 @@ export default defineComponent({
143
154
  options: {
144
155
  disableNavigationSideMenu: true,
145
156
  mediaSizes: MEDIA_SIZES.sizeThumb,
157
+ renderVideoAsImage: true,
146
158
  },
147
159
  isCapturingPreview: false,
148
160
  };
@@ -200,16 +212,41 @@ export default defineComponent({
200
212
 
201
213
  return cssVariables;
202
214
  },
215
+
216
+ previewImageUrl(): string {
217
+ return this.generatePreviewImageUrl();
218
+ },
203
219
  },
204
220
  watch: {
205
- logoTheme: {
206
- handler() {
221
+ template() {
222
+ if (this.isPrePurchase) {
207
223
  this.updateViewModel();
224
+ }
225
+ },
226
+ logoImage: {
227
+ handler() {
228
+ if (this.isPrePurchase) {
229
+ this.regeneratePreview();
230
+ }
208
231
  },
209
232
  deep: true,
210
233
  },
211
- template() {
212
- this.updateViewModel();
234
+ logoTemplateImage: {
235
+ handler() {
236
+ // Only regenerate preview in pre-purchase mode
237
+ if (this.isPrePurchase) {
238
+ this.regeneratePreview();
239
+ }
240
+ },
241
+ deep: true,
242
+ },
243
+ logoTheme: {
244
+ handler() {
245
+ if (this.isPrePurchase) {
246
+ this.updateViewModel();
247
+ }
248
+ },
249
+ deep: true,
213
250
  },
214
251
  },
215
252
  created() {
@@ -258,7 +295,54 @@ export default defineComponent({
258
295
  this.rootStyles = styles;
259
296
  },
260
297
 
298
+ onImageError() {
299
+ console.warn(
300
+ `Failed to load preview image for template ${this.template.id}`,
301
+ );
302
+ this.imageLoadError = true;
303
+ this.imageLoading = false;
304
+ },
305
+
306
+ onImageLoad() {
307
+ this.imageLoadError = false;
308
+ this.imageLoading = false;
309
+ },
310
+
311
+ generatePreviewImageUrl(): string {
312
+ const baseUrl = this.getPreviewBaseUrl();
313
+ const logoDraftToken =
314
+ this.logoImage?.logoDraftToken ||
315
+ '0B660926-D94A-4E29-99D1-F07E67AA6E49';
316
+
317
+ const deviceType =
318
+ this.brandPageMakerStore.brandPageType === 'brandSite'
319
+ ? 'desktop'
320
+ : 'mobile';
321
+
322
+ return `${baseUrl}/preview/template/${this.template.id}/${logoDraftToken}?deviceType=${deviceType}`;
323
+ },
324
+
325
+ getPreviewBaseUrl(): string {
326
+ const domainSuffix = '.brand.page';
327
+
328
+ const envPrefix = window.location.hostname.split('.')[0];
329
+
330
+ return `https://preview-${envPrefix}${domainSuffix}`;
331
+ },
332
+
333
+ regeneratePreview() {
334
+ this.imageLoadError = false;
335
+ this.imageLoading = true;
336
+ this.$forceUpdate();
337
+ },
338
+
261
339
  async updateViewModel(forceUpdate = true) {
340
+ if (!this.isPrePurchase) {
341
+ return;
342
+ }
343
+
344
+ const videoStore = useVideoStore();
345
+
262
346
  let model = this.template.brandPageModel;
263
347
 
264
348
  if (this.logoImageBase64Url) {
@@ -290,6 +374,10 @@ export default defineComponent({
290
374
  model,
291
375
  undefined,
292
376
  false,
377
+ {
378
+ useOldLogoRenderSize: false,
379
+ getVideoUrls: videoStore.getS3VideoUrlsForToken,
380
+ },
293
381
  );
294
382
 
295
383
  if (forceUpdate) {
@@ -18,8 +18,11 @@
18
18
  <span class="tw-sr-only">Select Template</span>
19
19
  </button>
20
20
  <!-- End Overlay-->
21
- <!-- Start Page -->
22
- <div class="template-preview__page" :style="cssVariablesStyle">
21
+ <div
22
+ v-if="isPrePurchase"
23
+ class="template-preview__page"
24
+ :style="cssVariablesStyle"
25
+ >
23
26
  <Page
24
27
  v-if="viewModel"
25
28
  :context="context"
@@ -29,7 +32,26 @@
29
32
  @on-set-preview-styles="onSetPreviewStyles"
30
33
  />
31
34
  </div>
32
- <!-- End Page -->
35
+ <!-- Start Preview Image -->
36
+ <div v-else class="template-preview__image-container">
37
+ <!-- Loading spinner -->
38
+ <div
39
+ v-if="imageLoading"
40
+ class="tw-absolute tw-inset-0 tw-flex tw-items-center tw-justify-center tw-bg-gray-50 tw-z-10"
41
+ >
42
+ <Loader />
43
+ </div>
44
+
45
+ <img
46
+ :src="previewImageUrl"
47
+ :alt="`Template ${template.id} preview`"
48
+ class="template-preview__image"
49
+ :class="{ 'tw-opacity-0': imageLoading }"
50
+ @error="onImageError"
51
+ @load="onImageLoad"
52
+ />
53
+ </div>
54
+ <!-- End Preview Image -->
33
55
  <!-- Start personalisation tag -->
34
56
  <div
35
57
  v-if="isPersonalisable"
@@ -45,12 +67,14 @@
45
67
  </template>
46
68
  <script>
47
69
  import { defineComponent } from 'vue';
70
+ import { Loader } from '@designcrowd/fe-shared-lib';
48
71
  import TemplatePreviewMixin from './TemplatePreview.mixin.ts';
49
72
  import Page from '../../../brand-page/components/page/Page.vue';
50
73
 
51
74
  export default defineComponent({
52
75
  components: {
53
76
  Page,
77
+ Loader,
54
78
  },
55
79
  mixins: [TemplatePreviewMixin],
56
80
  setup(props, context) {
@@ -68,11 +92,23 @@ export default defineComponent({
68
92
  @apply tw-absolute tw-top-0 tw-left-0 tw-right-0 tw-bottom-0 tw-opacity-0 tw-cursor-pointer tw-w-full tw-h-full;
69
93
  }
70
94
 
71
- .template-preview__page {
95
+ .template-preview__image-container {
72
96
  @apply tw-pointer-events-none;
97
+ @apply tw-w-full tw-h-full;
73
98
  }
74
99
 
100
+ .template-preview__image {
101
+ @apply tw-w-full tw-h-full tw-object-fill;
102
+ transition: filter 0.2s ease;
103
+ }
104
+
105
+ .template-preview__page {
106
+ @apply tw-pointer-events-none;
107
+ }
75
108
  .template-preview :deep(.c-shape-background) {
76
109
  @apply tw-absolute;
77
110
  }
111
+ .template-preview__image :deep(.c-shape-background) {
112
+ @apply tw-absolute;
113
+ }
78
114
  </style>
@@ -41,12 +41,10 @@ const pageSettingsStore = useUiPageSettingsStore();
41
41
 
42
42
  const logoTheme = computed(() => uiStore.logoTheme);
43
43
 
44
- const personalisationData = computed(() =>
45
- uiStore.personalisationData?.length
46
- ? uiStore.personalisationData[props.template.personalisationContentIndex]
47
- .userPersonalisation
48
- : undefined,
49
- );
44
+ const personalisationData = computed(() => {
45
+ const index = props.template.personalisationContentIndex;
46
+ return uiStore.personalisationData?.[index]?.userPersonalisation;
47
+ });
50
48
 
51
49
  const templateLogoImage = computed(() => {
52
50
  const desktopPageHeader =
@@ -50,6 +50,7 @@ import {
50
50
  DEFAULT_SHAPE_SIZE,
51
51
  PAYMENT_OPTION_DISPLAY_TYPES,
52
52
  PAYMENT_OPTION_IMAGE_TYPES,
53
+ GettyVideoMedia,
53
54
  } from '../../brand-page';
54
55
  import type {
55
56
  ContentSettingsConfig,
@@ -168,6 +169,7 @@ import {
168
169
  brandSiteTypeVisibilityAssessor,
169
170
  } from '../assessors/brand-page-type-visibility.assessor';
170
171
  import { contentSettingsTr } from '../../composables/useTranslate';
172
+ import type { GettyVideoMediaSelectedPayload } from '../../shared/my-uploads/models';
171
173
 
172
174
  const MediaFieldNames = {
173
175
  aspectRatio: 'aspectRatio',
@@ -428,12 +430,13 @@ const shopReplaceImageSettings =
428
430
  desiredWidth: undefined,
429
431
  });
430
432
 
433
+ // TOOD(jyao): This should be reworked to bannerSectionReplaceMediaSettings
431
434
  const bannerSectionReplaceImageSettings =
432
435
  (): ContentReplaceImageSettings<BannerSectionContent> => ({
433
436
  tabs: ['MY_UPLOADS', 'IMAGE_LIBRARY', 'VIDEO_LIBRARY', 'SHAPE_LIBRARY'],
434
- buttonTitleAdd: contentSettingsTr(`addImageButtonTitle`),
435
- titleAdd: contentSettingsTr(`addImageHeaderTitle`),
436
- titleReplace: contentSettingsTr(`imageReplaceTitle`),
437
+ buttonTitleAdd: contentSettingsTr(`addMediaTitle`),
438
+ titleAdd: contentSettingsTr(`addMediaTitle`),
439
+ titleReplace: contentSettingsTr(`replaceMediaTitle`),
437
440
  contentMediaFieldName: MediaFieldNames.avatarImageUrl,
438
441
  openByDefault: false,
439
442
  mediaType: MEDIA_TYPES.image,
@@ -445,13 +448,30 @@ const bannerSectionReplaceImageSettings =
445
448
  content: BannerSectionContent,
446
449
  value: SetContentMediaPayload,
447
450
  ) => {
448
- content.imageUrl = value.imageUrl;
449
- content.mediaType = MEDIA_TYPES.image;
451
+ if (value.media && value.media.type === 'getty-video') {
452
+ const gettyMedia = value.media as GettyVideoMediaSelectedPayload;
453
+
454
+ content.media = new GettyVideoMedia({
455
+ gettyToken: gettyMedia.token,
456
+ gettyAssetId: gettyMedia.assetId,
457
+ mimeType: gettyMedia.mimeType,
458
+ settings: {
459
+ autoPlay: gettyMedia.autoPlay,
460
+ },
461
+ });
462
+ content.imageUrl = '';
463
+ } else {
464
+ content.imageUrl = value.imageUrl;
465
+ content.mediaType = MEDIA_TYPES.image;
450
466
 
451
- if (isValidSvgUrl(content.imageUrl)) {
452
- content.size = DEFAULT_SHAPE_SIZE;
453
- content.mediaType = MEDIA_TYPES.shape;
454
- content.colorReplacements = value.colorReplacements || [];
467
+ // Note(jyao): Temporarily here until we move all images/shapes to media
468
+ content.media = undefined;
469
+
470
+ if (isValidSvgUrl(content.imageUrl)) {
471
+ content.size = DEFAULT_SHAPE_SIZE;
472
+ content.mediaType = MEDIA_TYPES.shape;
473
+ content.colorReplacements = value.colorReplacements || [];
474
+ }
455
475
  }
456
476
  },
457
477
  });
@@ -2213,7 +2233,7 @@ export const BANNER_SECTION_SETTINGS_CONFIG =
2213
2233
  imageUrl: {
2214
2234
  type: 'image',
2215
2235
  replaceImageSettings: bannerSectionReplaceImageSettings(),
2216
- title: contentSettingsTr(`imageTitle`),
2236
+ title: contentSettingsTr(`media`),
2217
2237
  groupId: SETTINGS_STYLE_FIELD_GROUP_IDS.settings,
2218
2238
  },
2219
2239
  imageUrlOverride: {