@designcrowd/library.brand-page 5.15.3 → 5.15.4

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 (104) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-P6321XBu.js → CreatedOnBrandCrowd-de-de-D-JqIBXF.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-CB2Vbc_1.js → CreatedOnBrandCrowd-en-us-rj1RdP3D.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-BUzOkzZ1.js → CreatedOnBrandCrowd-es-es-CQjoXEVn.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-BGhklGg-.js → CreatedOnBrandCrowd-fr-ca-BLfDC22k.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-BGhklGg-.js → CreatedOnBrandCrowd-fr-fr-BLfDC22k.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-DjkF8yHg.js → CreatedOnBrandCrowd-pt-br-DA4HMlpw.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-DjkF8yHg.js → CreatedOnBrandCrowd-pt-pt-DA4HMlpw.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-Blsa8CUj.js → CreatedOnDcom-de-de-DcSzC02I.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-CBk25ntF.js → CreatedOnDcom-en-us-Cj099v1g.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-D1ghG1-O.js → CreatedOnDcom-es-es-BLMAaoWm.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-C0igjVq3.js → CreatedOnDcom-fr-ca-DT5jxd5X.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-BAO9DjJx.js → CreatedOnDcom-fr-fr-BVT8h3pj.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-DIq8gG3f.js → CreatedOnDcom-pt-br-DP4jKxkV.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-De83jTtG.js → CreatedOnDcom-pt-pt-B6K9BtIo.js} +1 -1
  15. package/lib/src/brand-page/utils/migration/migration-07.js +2 -1
  16. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +3 -1
  17. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.stories.js +0 -1
  18. package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.js +0 -2
  19. package/lib/src/brand-page-maker/constants/config-settings-constant.js +2 -2
  20. package/lib/src/brand-page-maker/constants/index.js +0 -2
  21. package/lib/src/brand-page-maker/stores/user/user-store.js +0 -1
  22. package/lib/src/{bundled-translations-Gwpp-xB6.js → bundled-translations-C35ICQCS.js} +16 -18
  23. package/lib/src/{bundled-translations.de-DE-CB4KkNf3.js → bundled-translations.de-DE-B3sIK6Yw.js} +11 -13
  24. package/lib/src/{bundled-translations.es-ES-27tfJoU5.js → bundled-translations.es-ES-CJCflztK.js} +13 -15
  25. package/lib/src/{bundled-translations.fr-CA-SDhUJ5C0.js → bundled-translations.fr-CA-CtlwKcDs.js} +16 -18
  26. package/lib/src/{bundled-translations.fr-FR-_THRUXSu.js → bundled-translations.fr-FR-CjDBsRhl.js} +20 -22
  27. package/lib/src/{bundled-translations.pt-BR-Cet1bnj3.js → bundled-translations.pt-BR-CNuFzR0R.js} +17 -19
  28. package/lib/src/{bundled-translations.pt-PT-BWuPalqF.js → bundled-translations.pt-PT-D2Ak5M-w.js} +4 -6
  29. package/lib/src/bundles/bundled-translations.de-DE.json +0 -7
  30. package/lib/src/bundles/bundled-translations.es-ES.json +0 -7
  31. package/lib/src/bundles/bundled-translations.fr-CA.json +0 -7
  32. package/lib/src/bundles/bundled-translations.fr-FR.json +0 -7
  33. package/lib/src/bundles/bundled-translations.json +0 -7
  34. package/lib/src/bundles/bundled-translations.pt-BR.json +0 -7
  35. package/lib/src/bundles/bundled-translations.pt-PT.json +0 -7
  36. package/lib/src/composables/useTranslate.d.ts +1 -2
  37. package/lib/src/composables/useTranslate.js +1 -2
  38. package/lib/src/constants/ui.d.ts +0 -1
  39. package/lib/src/css/library.brand-page-brandCrowd.min.css +22 -68
  40. package/lib/src/css/library.brand-page-brandPage.min.css +22 -68
  41. package/lib/src/css/library.brand-page-designCom.min.css +22 -68
  42. package/lib/src/css/library.brand-page-preview.min.css +22 -68
  43. package/lib/src/index.mjs +1 -1
  44. package/lib/src/{lib-B3T2jOqU.js → lib-DV-z72zv.js} +9928 -10096
  45. package/lib/src/shared/content-settings/components/content-settings/ContentSettings.stories.js +0 -1
  46. package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.d.ts +3 -1
  47. package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.js +3 -1
  48. package/lib/src/shared/content-settings/components/replace-image-base-settings/ReplaceImageBaseSettings.mixin.d.ts +112 -0
  49. package/lib/src/shared/content-settings/components/replace-image-base-settings/ReplaceImageBaseSettings.mixin.js +135 -0
  50. package/lib/src/shared/content-settings/models.d.ts +0 -1
  51. package/lib/src/shared/content-settings/models.js +0 -1
  52. package/lib/src/shared/ecommerce-settings/store/shop-settings-store.d.ts +3 -1
  53. package/lib/src/shared/ecommerce-settings/store/shop-settings-store.js +2 -2
  54. package/lib/src/shared/models.d.ts +0 -1
  55. package/lib/src/shared/my-uploads/MyMedia.stories.js +0 -1
  56. package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +0 -1
  57. package/package.json +1 -1
  58. package/src/brand-page/components/logo/LogoRender.vue +1 -0
  59. package/src/brand-page/components/shop/FeaturedDisplay.vue +6 -7
  60. package/src/brand-page/components/shop/PaymentModal.vue +2 -0
  61. package/src/brand-page/components/shop/ProductDetailModal.vue +1 -2
  62. package/src/brand-page/components/shop/Shop.vue +31 -12
  63. package/src/brand-page/components/shop/TextDisplay.vue +6 -7
  64. package/src/brand-page/components/shop/ThumbnailDisplay.vue +6 -7
  65. package/src/brand-page/utils/migration/migration-07.ts +2 -1
  66. package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.stories.ts +0 -1
  67. package/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.ts +0 -2
  68. package/src/brand-page-maker/components/shop/AddOrEditProductContainer.vue +8 -3
  69. package/src/brand-page-maker/constants/config-settings-constant.ts +2 -2
  70. package/src/brand-page-maker/constants/index.ts +0 -2
  71. package/src/brand-page-maker/stores/user/user-store.ts +0 -1
  72. package/src/bundles/bundled-translations.de-DE.json +0 -7
  73. package/src/bundles/bundled-translations.es-ES.json +0 -7
  74. package/src/bundles/bundled-translations.fr-CA.json +0 -7
  75. package/src/bundles/bundled-translations.fr-FR.json +0 -7
  76. package/src/bundles/bundled-translations.json +0 -7
  77. package/src/bundles/bundled-translations.pt-BR.json +0 -7
  78. package/src/bundles/bundled-translations.pt-PT.json +0 -7
  79. package/src/composables/useTranslate.ts +0 -2
  80. package/src/constants/ui.ts +0 -1
  81. package/src/shared/content-settings/components/content-settings/ContentSettings.stories.ts +0 -1
  82. package/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.ts +3 -1
  83. package/src/shared/content-settings/components/replace-image-base-settings/ReplaceImageBaseSettings.mixin.ts +168 -0
  84. package/src/shared/content-settings/components/replace-image-base-settings/ReplaceImageBaseSettings.vue +19 -215
  85. package/src/shared/content-settings/components/replace-image-base-settings/i18n/replace-image-setting.de-DE.json +0 -1
  86. package/src/shared/content-settings/components/replace-image-base-settings/i18n/replace-image-setting.es-ES.json +0 -1
  87. package/src/shared/content-settings/components/replace-image-base-settings/i18n/replace-image-setting.fr-CA.json +0 -1
  88. package/src/shared/content-settings/components/replace-image-base-settings/i18n/replace-image-setting.fr-FR.json +0 -1
  89. package/src/shared/content-settings/components/replace-image-base-settings/i18n/replace-image-setting.json +0 -1
  90. package/src/shared/content-settings/components/replace-image-base-settings/i18n/replace-image-setting.pt-BR.json +0 -1
  91. package/src/shared/content-settings/components/replace-image-base-settings/i18n/replace-image-setting.pt-PT.json +0 -1
  92. package/src/shared/content-settings/models.ts +0 -1
  93. package/src/shared/ecommerce-settings/components/product-config-field/ProductConfigOption.vue +2 -4
  94. package/src/shared/ecommerce-settings/store/shop-settings-store.ts +4 -2
  95. package/src/shared/models.ts +0 -1
  96. package/src/shared/my-uploads/MyMedia.stories.ts +0 -1
  97. package/src/shared/video-library/VideoLibrary.vue +0 -374
  98. package/src/shared/video-library/i18n/video-library.de-DE.json +0 -8
  99. package/src/shared/video-library/i18n/video-library.es-ES.json +0 -8
  100. package/src/shared/video-library/i18n/video-library.fr-CA.json +0 -8
  101. package/src/shared/video-library/i18n/video-library.fr-FR.json +0 -8
  102. package/src/shared/video-library/i18n/video-library.json +0 -8
  103. package/src/shared/video-library/i18n/video-library.pt-BR.json +0 -8
  104. package/src/shared/video-library/i18n/video-library.pt-PT.json +0 -8
@@ -153,23 +153,28 @@ import {
153
153
  import { computed } from 'vue';
154
154
  import ProductItemField from './ProductItemField.vue';
155
155
  import { useProductConfigStore } from '../../../brand-page-maker/stores/product-config/product-config-store';
156
- import { useShopConfigStore } from '../../../shared/ecommerce-settings/store/shop-settings-store';
157
156
  import NumberInput from '../../../shared/common/NumberInput.vue';
158
157
  import { errorTr } from '../../../composables/useTranslate';
159
158
  import { productTr } from '../../../composables/useTranslate';
160
159
 
161
160
  const productSettingStore = useProductConfigStore();
162
- const shopConfigStore = useShopConfigStore();
163
161
  const imageUrl = computed(() => productSettingStore.productImageUrl);
164
162
  const MAX_PAYMENT_DESCRIPTION_LENGTH = 255;
165
163
  const MAX_PAYMENT_TITLE_LENGTH = 100;
166
164
  const MAX_PAYMENT_DESCRIPTION_REACHED_MSG = () =>
167
165
  errorTr('maxCharactersDescription');
168
166
  const MAX_PAYMENT_TITLE_REACHED_MSG = () => errorTr('maxCharactersTitle');
167
+ interface Props {
168
+ currencySymbol: string;
169
+ }
170
+
171
+ // TODO: currency need to be from productConfigStore
172
+ const props = withDefaults(defineProps<Props>(), {
173
+ currencySymbol: '$',
174
+ });
169
175
 
170
176
  const enableNotes = computed(() => productSettingStore.productEnableNotes);
171
177
  const hasVariants = computed(() => productSettingStore.productHasVariants);
172
- const currencySymbol = computed(() => shopConfigStore.currencySymbol);
173
178
 
174
179
  const emit = defineEmits(['update:modelValue']);
175
180
 
@@ -430,7 +430,7 @@ const shopReplaceImageSettings =
430
430
 
431
431
  const bannerSectionReplaceImageSettings =
432
432
  (): ContentReplaceImageSettings<BannerSectionContent> => ({
433
- tabs: ['MY_UPLOADS', 'IMAGE_LIBRARY', 'VIDEO_LIBRARY', 'SHAPE_LIBRARY'],
433
+ tabs: ['MY_UPLOADS', 'IMAGE_LIBRARY', 'SHAPE_LIBRARY'],
434
434
  buttonTitleAdd: contentSettingsTr(`addImageButtonTitle`),
435
435
  titleAdd: contentSettingsTr(`addImageHeaderTitle`),
436
436
  titleReplace: contentSettingsTr(`imageReplaceTitle`),
@@ -2993,7 +2993,7 @@ export const SHOP_SECTION_SETTINGS_CONFIG = (): ContentSettingsConfig<
2993
2993
  shouldRender: false,
2994
2994
  },
2995
2995
  paymentConfig: {
2996
- type: 'shop-payment-config',
2996
+ type: 'payment-config',
2997
2997
  groupId: REQUEST_PAYMENT_GROUPS.settings,
2998
2998
  overrideValueFieldName: 'shopPaymentConfig',
2999
2999
  },
@@ -43,7 +43,6 @@ export const DEFAULT_USER_ENDPOINTS: Readonly<Endpoints> = {
43
43
  getAllUserMediaEndpoint: GET_ALL_USER_MEDIA_ENDPOINT,
44
44
  userPolicyDataEndpoint: USER_POLICY_DATA_ENDPOINT,
45
45
  getUnsplashMediaRootEndpoint: '',
46
- getGettyEndpoint: '',
47
46
  } as const;
48
47
 
49
48
  export const DEFAULT_ADMIN_ENDPOINTS: Readonly<Endpoints> = {
@@ -52,5 +51,4 @@ export const DEFAULT_ADMIN_ENDPOINTS: Readonly<Endpoints> = {
52
51
  getAllUserMediaEndpoint: GET_ALL_ADMIN_MEDIA_ENDPOINT,
53
52
  userPolicyDataEndpoint: ADMIN_POLICY_DATA_ENDPOINT,
54
53
  getUnsplashMediaRootEndpoint: '',
55
- getGettyEndpoint: '',
56
54
  } as const;
@@ -29,7 +29,6 @@ export const useBrandPageMakerUserStore = defineStore('brandPageMakerUser', {
29
29
  canUseRichTextEditor: false,
30
30
  canUsePremiumFontFamily: false,
31
31
  maxNumOfPages: DEFAULT_MAX_NUM_OF_PAGES,
32
- canUseGettyVideos: false,
33
32
  },
34
33
  emailAddress: '',
35
34
  hasBrandPagePremiumSubscription: false,
@@ -625,7 +625,6 @@
625
625
  "myUploads": "Meine Uploads",
626
626
  "myDesigns": "Meine Designs",
627
627
  "imageLibrary": "Bilderbibliothek",
628
- "videoLibrary": "Videobibliothek",
629
628
  "shapeLibrary": "Formbibliothek"
630
629
  },
631
630
  "shapeField": {
@@ -840,11 +839,5 @@
840
839
  "applyMessage": "Das gilt für alle Logos auf Ihrer Website.",
841
840
  "cancelLabel": "Abbrechen",
842
841
  "continueLabel": "Weiter"
843
- },
844
- "videoLibrary": {
845
- "poweredBy": "Powered by",
846
- "emptyState": "Ihr Browser unterstützt keine eingebetteten Videos.",
847
- "loadMoreVideos": "Weitere Videos laden",
848
- "supported": "Ihr Browser unterstützt keine eingebetteten Videos."
849
842
  }
850
843
  }
@@ -625,7 +625,6 @@
625
625
  "myUploads": "Mis subidas",
626
626
  "myDesigns": "Mis diseños",
627
627
  "imageLibrary": "Biblioteca de imágenes",
628
- "videoLibrary": "Videoteca",
629
628
  "shapeLibrary": "Biblioteca de Formas"
630
629
  },
631
630
  "shapeField": {
@@ -840,11 +839,5 @@
840
839
  "applyMessage": "Esto se aplicará a todos los logos de tu sitio web.",
841
840
  "cancelLabel": "Cancelar",
842
841
  "continueLabel": "Continuar"
843
- },
844
- "videoLibrary": {
845
- "poweredBy": "Desarrollado por",
846
- "emptyState": "Lo sentimos, tu navegador no admite vídeos incrustados.",
847
- "loadMoreVideos": "Carga más vídeos",
848
- "supported": "Lo sentimos, tu navegador no admite vídeos incrustados."
849
842
  }
850
843
  }
@@ -625,7 +625,6 @@
625
625
  "myUploads": "Mes importations",
626
626
  "myDesigns": "Mes créations",
627
627
  "imageLibrary": "Bibliothèque d’images",
628
- "videoLibrary": "Vidéothèque",
629
628
  "shapeLibrary": "Bibliothèque de formes"
630
629
  },
631
630
  "shapeField": {
@@ -840,11 +839,5 @@
840
839
  "applyMessage": "Cela s’appliquera à tous les logos de votre site Web.",
841
840
  "cancelLabel": "Annuler",
842
841
  "continueLabel": "Continuer"
843
- },
844
- "videoLibrary": {
845
- "poweredBy": "Alimenté par",
846
- "emptyState": "Désolé, votre navigateur ne prend pas en charge les vidéos intégrées.",
847
- "loadMoreVideos": "Charger plus de vidéos",
848
- "supported": "Désolé, votre navigateur ne prend pas en charge les vidéos intégrées."
849
842
  }
850
843
  }
@@ -625,7 +625,6 @@
625
625
  "myUploads": "Mes importations",
626
626
  "myDesigns": "Mes créations",
627
627
  "imageLibrary": "Bibliothèque d’images",
628
- "videoLibrary": "Vidéothèque",
629
628
  "shapeLibrary": "Bibliothèque de formes"
630
629
  },
631
630
  "shapeField": {
@@ -840,11 +839,5 @@
840
839
  "applyMessage": "Cela s’appliquera à tous les logos de votre site Web.",
841
840
  "cancelLabel": "Annuler",
842
841
  "continueLabel": "Continuer"
843
- },
844
- "videoLibrary": {
845
- "poweredBy": "Alimenté par",
846
- "emptyState": "Désolé, votre navigateur ne prend pas en charge les vidéos intégrées.",
847
- "loadMoreVideos": "Charger plus de vidéos",
848
- "supported": "Désolé, votre navigateur ne prend pas en charge les vidéos intégrées."
849
842
  }
850
843
  }
@@ -625,7 +625,6 @@
625
625
  "myUploads": "My Uploads",
626
626
  "myDesigns": "My Designs",
627
627
  "imageLibrary": "Image Library",
628
- "videoLibrary": "Video Library",
629
628
  "shapeLibrary": "Shape Library"
630
629
  },
631
630
  "shapeField": {
@@ -840,11 +839,5 @@
840
839
  "applyMessage": "This will apply to all the logos in your website.",
841
840
  "cancelLabel": "Cancel",
842
841
  "continueLabel": "Continue"
843
- },
844
- "videoLibrary": {
845
- "poweredBy": "Powered by",
846
- "emptyState": "Sorry, your browser doesn't support embedded videos.",
847
- "loadMoreVideos": "Load more videos",
848
- "supported": "Sorry, your browser doesn't support embedded videos."
849
842
  }
850
843
  }
@@ -625,7 +625,6 @@
625
625
  "myUploads": "Meus uploads",
626
626
  "myDesigns": "Meus designs",
627
627
  "imageLibrary": "Biblioteca de imagens",
628
- "videoLibrary": "Biblioteca de vídeos",
629
628
  "shapeLibrary": "Biblioteca de formas"
630
629
  },
631
630
  "shapeField": {
@@ -840,11 +839,5 @@
840
839
  "applyMessage": "Isso se aplicará a todos os logotipos do seu site.",
841
840
  "cancelLabel": "Cancelar",
842
841
  "continueLabel": "Continuar"
843
- },
844
- "videoLibrary": {
845
- "poweredBy": "Assegurado por",
846
- "emptyState": "Seu navegador não aceita vídeos incorporados.",
847
- "loadMoreVideos": "Carregar mais vídeos",
848
- "supported": "Seu navegador não aceita vídeos incorporados."
849
842
  }
850
843
  }
@@ -625,7 +625,6 @@
625
625
  "myUploads": "Os meus carregamentos",
626
626
  "myDesigns": "Os meus designs",
627
627
  "imageLibrary": "Biblioteca de imagens",
628
- "videoLibrary": "Videoteca",
629
628
  "shapeLibrary": "Biblioteca de Formas"
630
629
  },
631
630
  "shapeField": {
@@ -840,11 +839,5 @@
840
839
  "applyMessage": "Isto vai aplicar-se a todos os logótipos no seu website.",
841
840
  "cancelLabel": "Cancelar",
842
841
  "continueLabel": "Continuar"
843
- },
844
- "videoLibrary": {
845
- "poweredBy": "Assegurado por",
846
- "emptyState": "Lamentamos, mas o seu navegador não suporta vídeos incorporados.",
847
- "loadMoreVideos": "Carregar mais vídeos",
848
- "supported": "Lamentamos, mas o seu navegador não suporta vídeos incorporados."
849
842
  }
850
843
  }
@@ -201,7 +201,6 @@ const videoTr = (key, valuesToInterpolate = {}) =>
201
201
  tr(`video.${key}`, valuesToInterpolate);
202
202
  const confirmModalTr = (key, valuesToInterpolate = {}) =>
203
203
  tr(`confirmModal.${key}`, valuesToInterpolate);
204
- const videoLibraryTr = (key) => tr(`videoLibrary.${key}`);
205
204
  const logoSwitchConfirmationModalTr = (key, valuesToInterpolate = {}) =>
206
205
  tr(`logoSwitchConfirmationModal.${key}`, valuesToInterpolate);
207
206
  const logoTemplateSearchModalTr = (key, valuesToInterpolate = {}) =>
@@ -300,7 +299,6 @@ export {
300
299
  videoTr,
301
300
  bookingUrlFieldTr,
302
301
  confirmModalTr,
303
- videoLibraryTr,
304
302
  logoSwitchConfirmationModalTr,
305
303
  logoTemplateSearchModalTr,
306
304
  };
@@ -11,7 +11,6 @@ export interface UIUserFeatures {
11
11
  canUsePremiumFontFamily: boolean;
12
12
  maxNumOfPages: number;
13
13
  canUseRichTextEditor: boolean;
14
- canUseGettyVideos: boolean;
15
14
  }
16
15
 
17
16
  export const TEMPLATE_FIRST_PAGE_NO = 1;
@@ -29,7 +29,6 @@ export const Sample = (): any => {
29
29
  canUsePremiumFontFamily: true,
30
30
  canUseRichTextEditor: false,
31
31
  maxNumOfPages: DEFAULT_MAX_NUM_OF_PAGES,
32
- canUseGettyVideos: true,
33
32
  };
34
33
 
35
34
  const pinia = setupStoryPinia();
@@ -135,7 +135,9 @@ export default defineComponent({
135
135
  }
136
136
 
137
137
  if (this.isShop) {
138
- this.shopConfigStore.setPaymentConfig(paymentConfig);
138
+ this.shopConfigStore.setPaymentConfig({
139
+ paymentConfig: paymentConfig,
140
+ });
139
141
  }
140
142
 
141
143
  this.selectedPaymentConfig = paymentConfig;
@@ -0,0 +1,168 @@
1
+ import type { PropType } from 'vue';
2
+ import { computed, defineComponent } from 'vue';
3
+ import type {
4
+ Tab,
5
+ ReplaceImageSettingsTabId,
6
+ ReplaceImageSettingsBase,
7
+ } from '../../models';
8
+ import type { UserMediaItemWithDimensions } from '../../../my-uploads/models';
9
+ import {
10
+ useBrandPageContainerStore,
11
+ type BrandPageSettingsMode,
12
+ } from '../../../../brand-page-maker/stores';
13
+ import axios from 'axios';
14
+ import { getColorReplacementsFromSvgString } from '../../../../brand-page/utils/svg-color.util';
15
+ import { tr } from '../../../../composables/useTranslate';
16
+
17
+ const imageSettingTr = (key) => tr(`replaceImageSetting.${key}`);
18
+
19
+ export default defineComponent({
20
+ props: {
21
+ mediaSettings: {
22
+ type: Object as PropType<ReplaceImageSettingsBase>,
23
+ required: false,
24
+ default: undefined,
25
+ },
26
+ imageExtension: {
27
+ type: Array as PropType<string[]>,
28
+ required: false,
29
+ default: () => ['.jpg', '.jpeg', '.png'],
30
+ },
31
+ mode: {
32
+ type: Object as PropType<BrandPageSettingsMode>,
33
+ required: true,
34
+ },
35
+ isAdmin: {
36
+ type: Boolean,
37
+ required: true,
38
+ default: false,
39
+ },
40
+ activeTabs: {
41
+ type: Array as PropType<ReplaceImageSettingsTabId[]>,
42
+ required: true,
43
+ },
44
+ mediaType: {
45
+ type: String,
46
+ required: false,
47
+ default: '',
48
+ },
49
+ sectionTitle: {
50
+ type: String,
51
+ required: false,
52
+ default: '',
53
+ },
54
+ transparentBg: {
55
+ type: Boolean,
56
+ required: true,
57
+ default: false,
58
+ },
59
+ stickyBackBtn: {
60
+ type: Boolean,
61
+ required: true,
62
+ default: true,
63
+ },
64
+ },
65
+ setup() {
66
+ const containerStore = useBrandPageContainerStore();
67
+
68
+ return {
69
+ isPrePurchase: computed(() => containerStore.isPrePurchase),
70
+ };
71
+ },
72
+ data() {
73
+ return {
74
+ tabs: [
75
+ {
76
+ id: 'ICON',
77
+ label: imageSettingTr('icon'),
78
+ active: false,
79
+ } as Tab,
80
+ {
81
+ id: 'MY_UPLOADS',
82
+ label: imageSettingTr('myUploads'),
83
+ active: false,
84
+ } as Tab,
85
+ {
86
+ id: 'MY_DESIGNS',
87
+ label: imageSettingTr('myDesigns'),
88
+ active: false,
89
+ } as Tab,
90
+ {
91
+ id: 'IMAGE_LIBRARY',
92
+ label: imageSettingTr('imageLibrary'),
93
+ active: false,
94
+ } as Tab,
95
+ {
96
+ id: 'SHAPE_LIBRARY',
97
+ label: imageSettingTr('shapeLibrary'),
98
+ active: false,
99
+ } as Tab,
100
+ ],
101
+ };
102
+ },
103
+ computed: {
104
+ enabledTabs(): Tab[] {
105
+ const value = this.tabs
106
+ .filter((x) => x.id !== 'MY_DESIGNS' || !this.isAdmin)
107
+ .filter(
108
+ (x) =>
109
+ this.activeTabs.some((y) => y === x.id) &&
110
+ (!this.isPrePurchase || x.id !== 'MY_DESIGNS'),
111
+ );
112
+
113
+ return value;
114
+ },
115
+ isDeleteEnabled(): boolean {
116
+ return true;
117
+ },
118
+ },
119
+ created() {
120
+ if (this.enabledTabs.length > 0) {
121
+ this.enabledTabs[0].active = true;
122
+ }
123
+ },
124
+ methods: {
125
+ onBack() {
126
+ this.$emit('on-back');
127
+ },
128
+ onImageSelected(
129
+ image: Pick<
130
+ UserMediaItemWithDimensions,
131
+ 'url' | 'minimisedUrl' | 'width' | 'height'
132
+ >,
133
+ ) {
134
+ this.$emit('on-image-picked', image, this.mediaType);
135
+ },
136
+ onDeleteImage(
137
+ image: Pick<
138
+ UserMediaItemWithDimensions,
139
+ 'url' | 'minimisedUrl' | 'width' | 'height'
140
+ >,
141
+ ) {
142
+ this.$emit('on-image-removed', image);
143
+ },
144
+ onDesignSelected(image: UserMediaItemWithDimensions) {
145
+ this.$emit('on-design-selected', image);
146
+ },
147
+ switchActiveTab(id: string) {
148
+ this.tabs.forEach((tab: Tab) =>
149
+ tab.id === id ? (tab.active = true) : (tab.active = false),
150
+ );
151
+ },
152
+ async onShapeSelected(image: UserMediaItemWithDimensions) {
153
+ const svgResponse = await axios.get<string>(image.url);
154
+
155
+ const colorReplacements = getColorReplacementsFromSvgString(
156
+ svgResponse.data,
157
+ );
158
+
159
+ this.$emit('on-shape-selected', {
160
+ imageUrl: image.url,
161
+ width: image.width,
162
+ height: image.height,
163
+ colorReplacements,
164
+ aspectRatio: image.aspectRatio,
165
+ });
166
+ },
167
+ },
168
+ });