@designcrowd/library.brand-page 5.15.4 → 5.15.5
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/lib/src/{CreatedOnBrandCrowd-de-de-D-JqIBXF.js → CreatedOnBrandCrowd-de-de-BxSRz5rV.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-rj1RdP3D.js → CreatedOnBrandCrowd-en-us-bvRHsK4P.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-CQjoXEVn.js → CreatedOnBrandCrowd-es-es-B7UhGZ_i.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-BLfDC22k.js → CreatedOnBrandCrowd-fr-ca-DbrCnQfL.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-BLfDC22k.js → CreatedOnBrandCrowd-fr-fr-DbrCnQfL.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-DA4HMlpw.js → CreatedOnBrandCrowd-pt-br-DHBSkoHf.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-DA4HMlpw.js → CreatedOnBrandCrowd-pt-pt-DHBSkoHf.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-DcSzC02I.js → CreatedOnDcom-de-de-CJ5PfRgk.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-Cj099v1g.js → CreatedOnDcom-en-us-CFgQcJsC.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-BLMAaoWm.js → CreatedOnDcom-es-es-2qGiWLwl.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-DT5jxd5X.js → CreatedOnDcom-fr-ca-BrBIvOOs.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-BVT8h3pj.js → CreatedOnDcom-fr-fr-CrvtNu83.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-DP4jKxkV.js → CreatedOnDcom-pt-br-BwnlmEkz.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-B6K9BtIo.js → CreatedOnDcom-pt-pt-DMqOsUps.js} +1 -1
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +1 -3
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.stories.js +1 -0
- package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.js +2 -0
- package/lib/src/brand-page-maker/constants/config-settings-constant.js +2 -2
- package/lib/src/brand-page-maker/constants/index.js +2 -0
- package/lib/src/brand-page-maker/stores/user/user-store.js +1 -0
- package/lib/src/{bundled-translations-C35ICQCS.js → bundled-translations-Gwpp-xB6.js} +18 -16
- package/lib/src/{bundled-translations.de-DE-B3sIK6Yw.js → bundled-translations.de-DE-CB4KkNf3.js} +13 -11
- package/lib/src/{bundled-translations.es-ES-CJCflztK.js → bundled-translations.es-ES-27tfJoU5.js} +15 -13
- package/lib/src/{bundled-translations.fr-CA-CtlwKcDs.js → bundled-translations.fr-CA-SDhUJ5C0.js} +18 -16
- package/lib/src/{bundled-translations.fr-FR-CjDBsRhl.js → bundled-translations.fr-FR-_THRUXSu.js} +22 -20
- package/lib/src/{bundled-translations.pt-BR-CNuFzR0R.js → bundled-translations.pt-BR-Cet1bnj3.js} +19 -17
- package/lib/src/{bundled-translations.pt-PT-D2Ak5M-w.js → bundled-translations.pt-PT-BWuPalqF.js} +6 -4
- package/lib/src/bundles/bundled-translations.de-DE.json +7 -0
- package/lib/src/bundles/bundled-translations.es-ES.json +7 -0
- package/lib/src/bundles/bundled-translations.fr-CA.json +7 -0
- package/lib/src/bundles/bundled-translations.fr-FR.json +7 -0
- package/lib/src/bundles/bundled-translations.json +7 -0
- package/lib/src/bundles/bundled-translations.pt-BR.json +7 -0
- package/lib/src/bundles/bundled-translations.pt-PT.json +7 -0
- package/lib/src/composables/useTranslate.d.ts +2 -1
- package/lib/src/composables/useTranslate.js +2 -1
- package/lib/src/constants/ui.d.ts +1 -0
- package/lib/src/css/library.brand-page-brandCrowd.min.css +66 -20
- package/lib/src/css/library.brand-page-brandPage.min.css +66 -20
- package/lib/src/css/library.brand-page-designCom.min.css +66 -20
- package/lib/src/css/library.brand-page-preview.min.css +66 -20
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-DV-z72zv.js → lib-NaxZd0H-.js} +10094 -9925
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.stories.js +1 -0
- package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.d.ts +1 -3
- package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.js +1 -3
- package/lib/src/shared/content-settings/models.d.ts +1 -0
- package/lib/src/shared/content-settings/models.js +1 -0
- package/lib/src/shared/ecommerce-settings/store/shop-settings-store.d.ts +1 -3
- package/lib/src/shared/ecommerce-settings/store/shop-settings-store.js +2 -2
- package/lib/src/shared/models.d.ts +1 -0
- package/lib/src/shared/my-uploads/MyMedia.stories.js +1 -0
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +1 -0
- package/package.json +1 -1
- package/src/brand-page/components/shop/FeaturedDisplay.vue +7 -6
- package/src/brand-page/components/shop/PaymentModal.vue +0 -2
- package/src/brand-page/components/shop/ProductDetailModal.vue +2 -1
- package/src/brand-page/components/shop/Shop.vue +12 -31
- package/src/brand-page/components/shop/TextDisplay.vue +7 -6
- package/src/brand-page/components/shop/ThumbnailDisplay.vue +7 -6
- package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.stories.ts +1 -0
- package/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.ts +2 -0
- package/src/brand-page-maker/components/shop/AddOrEditProductContainer.vue +3 -8
- package/src/brand-page-maker/constants/config-settings-constant.ts +2 -2
- package/src/brand-page-maker/constants/index.ts +2 -0
- package/src/brand-page-maker/stores/user/user-store.ts +1 -0
- package/src/bundles/bundled-translations.de-DE.json +7 -0
- package/src/bundles/bundled-translations.es-ES.json +7 -0
- package/src/bundles/bundled-translations.fr-CA.json +7 -0
- package/src/bundles/bundled-translations.fr-FR.json +7 -0
- package/src/bundles/bundled-translations.json +7 -0
- package/src/bundles/bundled-translations.pt-BR.json +7 -0
- package/src/bundles/bundled-translations.pt-PT.json +7 -0
- package/src/composables/useTranslate.ts +2 -0
- package/src/constants/ui.ts +1 -0
- package/src/shared/content-settings/components/content-settings/ContentSettings.stories.ts +1 -0
- package/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.ts +1 -3
- package/src/shared/content-settings/components/replace-image-base-settings/ReplaceImageBaseSettings.vue +215 -19
- package/src/shared/content-settings/components/replace-image-base-settings/i18n/replace-image-setting.de-DE.json +1 -0
- package/src/shared/content-settings/components/replace-image-base-settings/i18n/replace-image-setting.es-ES.json +1 -0
- package/src/shared/content-settings/components/replace-image-base-settings/i18n/replace-image-setting.fr-CA.json +1 -0
- package/src/shared/content-settings/components/replace-image-base-settings/i18n/replace-image-setting.fr-FR.json +1 -0
- package/src/shared/content-settings/components/replace-image-base-settings/i18n/replace-image-setting.json +1 -0
- package/src/shared/content-settings/components/replace-image-base-settings/i18n/replace-image-setting.pt-BR.json +1 -0
- package/src/shared/content-settings/components/replace-image-base-settings/i18n/replace-image-setting.pt-PT.json +1 -0
- package/src/shared/content-settings/models.ts +1 -0
- package/src/shared/ecommerce-settings/components/product-config-field/ProductConfigOption.vue +4 -2
- package/src/shared/ecommerce-settings/store/shop-settings-store.ts +2 -4
- package/src/shared/models.ts +1 -0
- package/src/shared/my-uploads/MyMedia.stories.ts +1 -0
- package/src/shared/video-library/VideoLibrary.vue +374 -0
- package/src/shared/video-library/i18n/video-library.de-DE.json +8 -0
- package/src/shared/video-library/i18n/video-library.es-ES.json +8 -0
- package/src/shared/video-library/i18n/video-library.fr-CA.json +8 -0
- package/src/shared/video-library/i18n/video-library.fr-FR.json +8 -0
- package/src/shared/video-library/i18n/video-library.json +8 -0
- package/src/shared/video-library/i18n/video-library.pt-BR.json +8 -0
- package/src/shared/video-library/i18n/video-library.pt-PT.json +8 -0
- package/lib/src/shared/content-settings/components/replace-image-base-settings/ReplaceImageBaseSettings.mixin.d.ts +0 -112
- package/lib/src/shared/content-settings/components/replace-image-base-settings/ReplaceImageBaseSettings.mixin.js +0 -135
- package/src/shared/content-settings/components/replace-image-base-settings/ReplaceImageBaseSettings.mixin.ts +0 -168
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<TextInput
|
|
4
|
+
v-model="searchString"
|
|
5
|
+
size="md"
|
|
6
|
+
icon="search"
|
|
7
|
+
class="tw-py-2 tw-mb-2"
|
|
8
|
+
:placeholder="commonTr('search')"
|
|
9
|
+
:enable-clear="true"
|
|
10
|
+
@input="onSearchText"
|
|
11
|
+
@on-clear="onClearSearch"
|
|
12
|
+
/>
|
|
13
|
+
<div
|
|
14
|
+
v-if="!isLoading && hasVideoLibraryCategories"
|
|
15
|
+
class="tw-grid tw-gap-4 tw-grid-cols-2"
|
|
16
|
+
>
|
|
17
|
+
<figure
|
|
18
|
+
v-for="(videoCategory, idx) in videoLibraryCategories"
|
|
19
|
+
:key="videoCategory.categoryName"
|
|
20
|
+
class="tw-rounded-md"
|
|
21
|
+
>
|
|
22
|
+
<button
|
|
23
|
+
class="c-media-btn tw-p-0 tw-border-none tw-cursor-pointer tw-relative"
|
|
24
|
+
:data-test-video-library-category="videoCategory.categoryName"
|
|
25
|
+
@click="onCategoryClicked(videoCategory.categoryName)"
|
|
26
|
+
>
|
|
27
|
+
<div
|
|
28
|
+
class="c-media-btn__overlay c-media-btn__overlay--category tw-h-100 tw-flex tw-items-center tw-justify-center tw-mb-0.5 tw-capitalize"
|
|
29
|
+
>
|
|
30
|
+
{{ videoCategory.categoryName }}
|
|
31
|
+
</div>
|
|
32
|
+
<video
|
|
33
|
+
:data-test-tag="`video-category-${idx}`"
|
|
34
|
+
:src="getVideoPreview(videoCategory.videos.videos[0].displaySizes)"
|
|
35
|
+
loop
|
|
36
|
+
muted
|
|
37
|
+
playsinline
|
|
38
|
+
class="c-media-btn__img hover:!tw-shadow-[0_0_0_3px] hover:!tw-shadow-info-500"
|
|
39
|
+
@mouseenter="mouseOverPreview"
|
|
40
|
+
@mouseleave="mouseLeavePreview"
|
|
41
|
+
>
|
|
42
|
+
{{ videoLibraryTr('supported') }}
|
|
43
|
+
</video>
|
|
44
|
+
</button>
|
|
45
|
+
</figure>
|
|
46
|
+
</div>
|
|
47
|
+
<div v-if="videoLibrary" class="tw-grid tw-gap-4 tw-grid-cols-2">
|
|
48
|
+
<figure
|
|
49
|
+
v-for="(video, idx) in videoLibrary.videos"
|
|
50
|
+
:key="`${idx}-${video.id}`"
|
|
51
|
+
class="c-media-btn tw-p-0 tw-border-none tw-cursor-pointer tw-relative tw-group"
|
|
52
|
+
>
|
|
53
|
+
<div
|
|
54
|
+
class="c-media-btn__overlay c-media-btn__overlay--video"
|
|
55
|
+
:data-test-video-library-item="`${idx}-${video.id}`"
|
|
56
|
+
@click="onVideoLibraryItemClicked(video)"
|
|
57
|
+
/>
|
|
58
|
+
<div
|
|
59
|
+
v-if="video.isLoading"
|
|
60
|
+
class="tw-absolute tw-inset-0 tw-flex tw-items-center tw-justify-center tw-bg-black tw-bg-opacity-50 tw-rounded-md"
|
|
61
|
+
>
|
|
62
|
+
<Loader />
|
|
63
|
+
</div>
|
|
64
|
+
<img
|
|
65
|
+
v-if="isMobile"
|
|
66
|
+
:src="getImagePreview(video.displaySizes)"
|
|
67
|
+
alt=""
|
|
68
|
+
class="c-media-btn__img hover:!tw-shadow-[0_0_0_3px] hover:!tw-shadow-info-500"
|
|
69
|
+
/>
|
|
70
|
+
<video
|
|
71
|
+
v-else
|
|
72
|
+
:src="getVideoPreview(video.displaySizes)"
|
|
73
|
+
loop
|
|
74
|
+
muted
|
|
75
|
+
playsinline
|
|
76
|
+
class="c-media-btn__img hover:!tw-shadow-[0_0_0_3px] hover:!tw-shadow-info-500"
|
|
77
|
+
@mouseenter="mouseOverPreview"
|
|
78
|
+
@mouseleave="mouseLeavePreview"
|
|
79
|
+
>
|
|
80
|
+
{{ videoLibraryTr('emptyState') }}
|
|
81
|
+
</video>
|
|
82
|
+
</figure>
|
|
83
|
+
</div>
|
|
84
|
+
<p v-if="!isLoading && !hasVideos" class="tw-text-xs">
|
|
85
|
+
{{ commonTr('emptySearchLabel') }}
|
|
86
|
+
</p>
|
|
87
|
+
<div
|
|
88
|
+
v-if="!isLoading && canLoadMoreResults"
|
|
89
|
+
class="tw-mt-4 tw-w-100 tw-text-center"
|
|
90
|
+
>
|
|
91
|
+
<Button
|
|
92
|
+
:label="videoLibraryTr('loadMoreVideos')"
|
|
93
|
+
variant="outline"
|
|
94
|
+
size="small-medium"
|
|
95
|
+
@on-click.stop="getNextPageOfResults"
|
|
96
|
+
/>
|
|
97
|
+
</div>
|
|
98
|
+
<div v-if="isLoading" class="tw-flex tw-justify-center tw-my-8">
|
|
99
|
+
<Loader />
|
|
100
|
+
</div>
|
|
101
|
+
<p class="tw-mt-4 tw-text-xs tw-text-grayscale-600">
|
|
102
|
+
{{ videoLibraryTr('poweredBy') }}
|
|
103
|
+
<a
|
|
104
|
+
href="https://www.gettyimages.com"
|
|
105
|
+
class="maker-anchor tw-no-underline"
|
|
106
|
+
target="_blank"
|
|
107
|
+
>Getty Images</a
|
|
108
|
+
>
|
|
109
|
+
</p>
|
|
110
|
+
</div>
|
|
111
|
+
</template>
|
|
112
|
+
|
|
113
|
+
<script setup lang="ts">
|
|
114
|
+
import { ref, computed, onMounted } from 'vue';
|
|
115
|
+
import GettyImagesClient from '../../clients/gettyimages-client';
|
|
116
|
+
import { commonTr, videoLibraryTr } from '../../composables/useTranslate';
|
|
117
|
+
import { Button, Loader, TextInput } from '@designcrowd/fe-shared-lib';
|
|
118
|
+
import { useUiStore } from '../../brand-page-maker/stores';
|
|
119
|
+
|
|
120
|
+
interface VideoItem {
|
|
121
|
+
id: string;
|
|
122
|
+
isLoading?: boolean;
|
|
123
|
+
displaySizes: Array<{ name: string; uri: string }>;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
interface VideoLibraryData {
|
|
127
|
+
videos: VideoItem[];
|
|
128
|
+
resultCount: number;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
interface Props {
|
|
132
|
+
isMobile?: boolean;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
136
|
+
isMobile: false,
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// Store access
|
|
140
|
+
const uiStore = useUiStore();
|
|
141
|
+
const endpoints = computed(() => uiStore.endpoints);
|
|
142
|
+
|
|
143
|
+
// Reactive data
|
|
144
|
+
const searchString = ref('');
|
|
145
|
+
const gettyImagesClient = ref<GettyImagesClient | null>(null);
|
|
146
|
+
const videoLibrary = ref<VideoLibraryData | null>(null);
|
|
147
|
+
const currentVideoLibraryPage = ref(1);
|
|
148
|
+
const videoLibraryCategories = ref<any[] | null>(null);
|
|
149
|
+
const isLoading = ref(true);
|
|
150
|
+
const isSearchReady = ref(false);
|
|
151
|
+
const defaultLibrary = ref<VideoLibraryData | null>(null);
|
|
152
|
+
const isCategorySearch = ref(false);
|
|
153
|
+
const addVideosConcurrentlyLimit = ref(2);
|
|
154
|
+
const numberOfVideosBeingAdded = ref(0);
|
|
155
|
+
|
|
156
|
+
const SEARCH_DEBOUNCE_DELAY = 1500; // 1.5 seconds
|
|
157
|
+
const MIN_SEARCH_LENGTH = 2;
|
|
158
|
+
const VIDEOS_PER_PAGE = 10;
|
|
159
|
+
|
|
160
|
+
const hasVideoLibraryCategories = computed(() => {
|
|
161
|
+
return (
|
|
162
|
+
!isLoading.value &&
|
|
163
|
+
!videoLibrary.value &&
|
|
164
|
+
videoLibraryCategories.value &&
|
|
165
|
+
videoLibraryCategories.value.length > 0
|
|
166
|
+
);
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
const hasVideos = computed(() => {
|
|
170
|
+
return (
|
|
171
|
+
videoLibrary.value &&
|
|
172
|
+
videoLibrary.value.videos &&
|
|
173
|
+
videoLibrary.value.videos.length > 0
|
|
174
|
+
);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
const canLoadMoreResults = computed(() => {
|
|
178
|
+
return (
|
|
179
|
+
!isLoading.value &&
|
|
180
|
+
videoLibrary.value &&
|
|
181
|
+
currentVideoLibraryPage.value <=
|
|
182
|
+
videoLibrary.value.resultCount / VIDEOS_PER_PAGE
|
|
183
|
+
);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
// Methods
|
|
187
|
+
const onSearchText = () => {
|
|
188
|
+
if (searchString.value.length >= MIN_SEARCH_LENGTH) {
|
|
189
|
+
setTimeout(() => {
|
|
190
|
+
if (searchString.value.length >= MIN_SEARCH_LENGTH) {
|
|
191
|
+
searchVideos();
|
|
192
|
+
}
|
|
193
|
+
}, SEARCH_DEBOUNCE_DELAY);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const onClearSearch = () => {
|
|
198
|
+
resetSearch();
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const onCategoryClicked = (categoryName: string) => {
|
|
202
|
+
searchVideos(categoryName, true);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const getNextPageOfResults = async (): Promise<void> => {
|
|
206
|
+
currentVideoLibraryPage.value += 1;
|
|
207
|
+
|
|
208
|
+
try {
|
|
209
|
+
isLoading.value = true;
|
|
210
|
+
const res = await gettyImagesClient.value!.searchVideosAsync(
|
|
211
|
+
searchString.value,
|
|
212
|
+
currentVideoLibraryPage.value,
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
if (res && res.videos && res.videos.length > 0) {
|
|
216
|
+
videoLibrary.value!.videos = [
|
|
217
|
+
...videoLibrary.value!.videos,
|
|
218
|
+
...res.videos,
|
|
219
|
+
];
|
|
220
|
+
}
|
|
221
|
+
} catch (e) {
|
|
222
|
+
console.error(e);
|
|
223
|
+
} finally {
|
|
224
|
+
isLoading.value = false;
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
const getCategories = async (): Promise<void> => {
|
|
229
|
+
try {
|
|
230
|
+
isLoading.value = true;
|
|
231
|
+
videoLibraryCategories.value =
|
|
232
|
+
await gettyImagesClient.value!.getDefaultCategoriesAsync();
|
|
233
|
+
console.log('videoLibraryCategories', videoLibraryCategories.value);
|
|
234
|
+
} catch (e) {
|
|
235
|
+
console.error(e);
|
|
236
|
+
} finally {
|
|
237
|
+
isLoading.value = false;
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
const resetSearch = (): void => {
|
|
242
|
+
searchString.value = '';
|
|
243
|
+
videoLibrary.value = null;
|
|
244
|
+
getCategories();
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
const searchVideos = async (
|
|
248
|
+
str?: string,
|
|
249
|
+
isCategorySearchParam = false,
|
|
250
|
+
): Promise<void> => {
|
|
251
|
+
try {
|
|
252
|
+
searchString.value = str || searchString.value;
|
|
253
|
+
currentVideoLibraryPage.value = 1;
|
|
254
|
+
isLoading.value = true;
|
|
255
|
+
isCategorySearch.value = isCategorySearchParam;
|
|
256
|
+
|
|
257
|
+
if (searchString.value) {
|
|
258
|
+
videoLibrary.value = null;
|
|
259
|
+
videoLibrary.value = await gettyImagesClient.value!.searchVideosAsync(
|
|
260
|
+
searchString.value,
|
|
261
|
+
1,
|
|
262
|
+
);
|
|
263
|
+
} else {
|
|
264
|
+
videoLibrary.value = defaultLibrary.value;
|
|
265
|
+
}
|
|
266
|
+
} catch (e) {
|
|
267
|
+
console.error(e);
|
|
268
|
+
} finally {
|
|
269
|
+
isLoading.value = false;
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
const mouseOverPreview = (event: Event): void => {
|
|
274
|
+
const target = event.target as HTMLVideoElement;
|
|
275
|
+
target.play();
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
const mouseLeavePreview = (event: Event): void => {
|
|
279
|
+
const target = event.target as HTMLVideoElement;
|
|
280
|
+
target.pause();
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
const onVideoLibraryItemClicked = async (item: VideoItem): Promise<void> => {
|
|
284
|
+
if (item.isLoading) {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (numberOfVideosBeingAdded.value >= addVideosConcurrentlyLimit.value) {
|
|
289
|
+
window.alert(
|
|
290
|
+
`Maximum number of videos you can add is ${addVideosConcurrentlyLimit.value}`,
|
|
291
|
+
);
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
setIsLoading(item, true);
|
|
296
|
+
const video = await gettyImagesClient.value!.getVideoByVideoIdAsync(item.id);
|
|
297
|
+
if (!video) {
|
|
298
|
+
window.alert('Error loading getty video, please try again');
|
|
299
|
+
setIsLoading(item, false);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
const gettyMediaObject = {
|
|
304
|
+
mediaData: {
|
|
305
|
+
provider: 'getty',
|
|
306
|
+
assetId: item.id,
|
|
307
|
+
},
|
|
308
|
+
imageSrc: video.imagePreviewAsset.uri,
|
|
309
|
+
videoSrc: video.videoPreviewAsset.uri,
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
// Emit the video selection event
|
|
313
|
+
emit('on-select-video', gettyMediaObject);
|
|
314
|
+
|
|
315
|
+
setIsLoading(item, false);
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
const setIsLoading = (item: VideoItem, loading: boolean): void => {
|
|
319
|
+
item.isLoading = loading;
|
|
320
|
+
numberOfVideosBeingAdded.value += loading ? 1 : -1;
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
const getVideoPreview = (
|
|
324
|
+
displaySizes: Array<{ name: string; uri: string }>,
|
|
325
|
+
): string => {
|
|
326
|
+
return displaySizes.find((size) => size.name === 'preview')?.uri || '';
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
const getImagePreview = (
|
|
330
|
+
displaySizes: Array<{ name: string; uri: string }>,
|
|
331
|
+
): string => {
|
|
332
|
+
return displaySizes.find((size) => size.name === 'comp_poster')?.uri || '';
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
const emit = defineEmits<{
|
|
336
|
+
'on-select-video': [video: any];
|
|
337
|
+
}>();
|
|
338
|
+
|
|
339
|
+
onMounted(async () => {
|
|
340
|
+
const gettySettings = {
|
|
341
|
+
mediaBaseUrl: endpoints.value.getGettyEndpoint,
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
gettyImagesClient.value = new GettyImagesClient(gettySettings);
|
|
345
|
+
await getCategories();
|
|
346
|
+
|
|
347
|
+
isSearchReady.value = true;
|
|
348
|
+
});
|
|
349
|
+
</script>
|
|
350
|
+
<style scoped>
|
|
351
|
+
.c-media-btn__img {
|
|
352
|
+
@apply tw-transition-shadow tw-duration-200 tw-ease-out tw-w-full tw-rounded-md;
|
|
353
|
+
aspect-ratio: 1;
|
|
354
|
+
object-fit: cover;
|
|
355
|
+
max-height: 150px;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.c-media-btn__overlay {
|
|
359
|
+
@apply tw-absolute tw-left-0 tw-bottom-0 tw-top-0 tw-right-0 tw-text-white tw-rounded-md tw-text-white tw-transition-all tw-duration-200;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.c-media-btn__overlay--category {
|
|
363
|
+
background-color: rgba(17, 21, 23, 0.66);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.c-media-btn__overlay--video:hover {
|
|
367
|
+
background-color: rgba(17, 21, 23, 0.33);
|
|
368
|
+
}
|
|
369
|
+
.c-media-btn {
|
|
370
|
+
@apply tw-w-full;
|
|
371
|
+
aspect-ratio: 1;
|
|
372
|
+
max-height: 150px;
|
|
373
|
+
}
|
|
374
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"videoLibrary" : {
|
|
3
|
+
"poweredBy" : "Alimenté par",
|
|
4
|
+
"emptyState" : "Désolé, votre navigateur ne prend pas en charge les vidéos intégrées.",
|
|
5
|
+
"loadMoreVideos" : "Charger plus de vidéos",
|
|
6
|
+
"supported" : "Désolé, votre navigateur ne prend pas en charge les vidéos intégrées."
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"videoLibrary" : {
|
|
3
|
+
"poweredBy" : "Alimenté par",
|
|
4
|
+
"emptyState" : "Désolé, votre navigateur ne prend pas en charge les vidéos intégrées.",
|
|
5
|
+
"loadMoreVideos" : "Charger plus de vidéos",
|
|
6
|
+
"supported" : "Désolé, votre navigateur ne prend pas en charge les vidéos intégrées."
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"videoLibrary" : {
|
|
3
|
+
"poweredBy" : "Assegurado por",
|
|
4
|
+
"emptyState" : "Lamentamos, mas o seu navegador não suporta vídeos incorporados.",
|
|
5
|
+
"loadMoreVideos" : "Carregar mais vídeos",
|
|
6
|
+
"supported" : "Lamentamos, mas o seu navegador não suporta vídeos incorporados."
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import type { PropType } from 'vue';
|
|
2
|
-
import type { Tab, ReplaceImageSettingsBase } from '../../models';
|
|
3
|
-
import type { UserMediaItemWithDimensions } from '../../../my-uploads/models';
|
|
4
|
-
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
-
mediaSettings: {
|
|
6
|
-
type: PropType<ReplaceImageSettingsBase>;
|
|
7
|
-
required: false;
|
|
8
|
-
default: undefined;
|
|
9
|
-
};
|
|
10
|
-
imageExtension: {
|
|
11
|
-
type: PropType<string[]>;
|
|
12
|
-
required: false;
|
|
13
|
-
default: () => string[];
|
|
14
|
-
};
|
|
15
|
-
mode: {
|
|
16
|
-
type: PropType<"images" | "edit">;
|
|
17
|
-
required: true;
|
|
18
|
-
};
|
|
19
|
-
isAdmin: {
|
|
20
|
-
type: BooleanConstructor;
|
|
21
|
-
required: true;
|
|
22
|
-
default: boolean;
|
|
23
|
-
};
|
|
24
|
-
activeTabs: {
|
|
25
|
-
type: PropType<("ICON" | "IMAGE_LIBRARY" | "MY_UPLOADS" | "MY_DESIGNS" | "SHAPE_LIBRARY")[]>;
|
|
26
|
-
required: true;
|
|
27
|
-
};
|
|
28
|
-
mediaType: {
|
|
29
|
-
type: StringConstructor;
|
|
30
|
-
required: false;
|
|
31
|
-
default: string;
|
|
32
|
-
};
|
|
33
|
-
sectionTitle: {
|
|
34
|
-
type: StringConstructor;
|
|
35
|
-
required: false;
|
|
36
|
-
default: string;
|
|
37
|
-
};
|
|
38
|
-
transparentBg: {
|
|
39
|
-
type: BooleanConstructor;
|
|
40
|
-
required: true;
|
|
41
|
-
default: boolean;
|
|
42
|
-
};
|
|
43
|
-
stickyBackBtn: {
|
|
44
|
-
type: BooleanConstructor;
|
|
45
|
-
required: true;
|
|
46
|
-
default: boolean;
|
|
47
|
-
};
|
|
48
|
-
}>, {
|
|
49
|
-
isPrePurchase: import("vue").ComputedRef<boolean>;
|
|
50
|
-
}, {
|
|
51
|
-
tabs: Tab[];
|
|
52
|
-
}, {
|
|
53
|
-
enabledTabs(): Tab[];
|
|
54
|
-
isDeleteEnabled(): boolean;
|
|
55
|
-
}, {
|
|
56
|
-
onBack(): void;
|
|
57
|
-
onImageSelected(image: Pick<UserMediaItemWithDimensions, 'url' | 'minimisedUrl' | 'width' | 'height'>): void;
|
|
58
|
-
onDeleteImage(image: Pick<UserMediaItemWithDimensions, 'url' | 'minimisedUrl' | 'width' | 'height'>): void;
|
|
59
|
-
onDesignSelected(image: UserMediaItemWithDimensions): void;
|
|
60
|
-
switchActiveTab(id: string): void;
|
|
61
|
-
onShapeSelected(image: UserMediaItemWithDimensions): Promise<void>;
|
|
62
|
-
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
63
|
-
mediaSettings: {
|
|
64
|
-
type: PropType<ReplaceImageSettingsBase>;
|
|
65
|
-
required: false;
|
|
66
|
-
default: undefined;
|
|
67
|
-
};
|
|
68
|
-
imageExtension: {
|
|
69
|
-
type: PropType<string[]>;
|
|
70
|
-
required: false;
|
|
71
|
-
default: () => string[];
|
|
72
|
-
};
|
|
73
|
-
mode: {
|
|
74
|
-
type: PropType<"images" | "edit">;
|
|
75
|
-
required: true;
|
|
76
|
-
};
|
|
77
|
-
isAdmin: {
|
|
78
|
-
type: BooleanConstructor;
|
|
79
|
-
required: true;
|
|
80
|
-
default: boolean;
|
|
81
|
-
};
|
|
82
|
-
activeTabs: {
|
|
83
|
-
type: PropType<("ICON" | "IMAGE_LIBRARY" | "MY_UPLOADS" | "MY_DESIGNS" | "SHAPE_LIBRARY")[]>;
|
|
84
|
-
required: true;
|
|
85
|
-
};
|
|
86
|
-
mediaType: {
|
|
87
|
-
type: StringConstructor;
|
|
88
|
-
required: false;
|
|
89
|
-
default: string;
|
|
90
|
-
};
|
|
91
|
-
sectionTitle: {
|
|
92
|
-
type: StringConstructor;
|
|
93
|
-
required: false;
|
|
94
|
-
default: string;
|
|
95
|
-
};
|
|
96
|
-
transparentBg: {
|
|
97
|
-
type: BooleanConstructor;
|
|
98
|
-
required: true;
|
|
99
|
-
default: boolean;
|
|
100
|
-
};
|
|
101
|
-
stickyBackBtn: {
|
|
102
|
-
type: BooleanConstructor;
|
|
103
|
-
required: true;
|
|
104
|
-
default: boolean;
|
|
105
|
-
};
|
|
106
|
-
}>> & Readonly<{}>, {
|
|
107
|
-
mediaType: string;
|
|
108
|
-
mediaSettings: ReplaceImageSettingsBase;
|
|
109
|
-
sectionTitle: string;
|
|
110
|
-
imageExtension: string[];
|
|
111
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
112
|
-
export default _default;
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { computed, defineComponent } from 'vue';
|
|
2
|
-
import { useBrandPageContainerStore, } from '../../../../brand-page-maker/stores';
|
|
3
|
-
import axios from 'axios';
|
|
4
|
-
import { getColorReplacementsFromSvgString } from '../../../../brand-page/utils/svg-color.util';
|
|
5
|
-
import { tr } from '../../../../composables/useTranslate';
|
|
6
|
-
const imageSettingTr = (key) => tr(`replaceImageSetting.${key}`);
|
|
7
|
-
export default defineComponent({
|
|
8
|
-
props: {
|
|
9
|
-
mediaSettings: {
|
|
10
|
-
type: Object,
|
|
11
|
-
required: false,
|
|
12
|
-
default: undefined,
|
|
13
|
-
},
|
|
14
|
-
imageExtension: {
|
|
15
|
-
type: Array,
|
|
16
|
-
required: false,
|
|
17
|
-
default: () => ['.jpg', '.jpeg', '.png'],
|
|
18
|
-
},
|
|
19
|
-
mode: {
|
|
20
|
-
type: Object,
|
|
21
|
-
required: true,
|
|
22
|
-
},
|
|
23
|
-
isAdmin: {
|
|
24
|
-
type: Boolean,
|
|
25
|
-
required: true,
|
|
26
|
-
default: false,
|
|
27
|
-
},
|
|
28
|
-
activeTabs: {
|
|
29
|
-
type: Array,
|
|
30
|
-
required: true,
|
|
31
|
-
},
|
|
32
|
-
mediaType: {
|
|
33
|
-
type: String,
|
|
34
|
-
required: false,
|
|
35
|
-
default: '',
|
|
36
|
-
},
|
|
37
|
-
sectionTitle: {
|
|
38
|
-
type: String,
|
|
39
|
-
required: false,
|
|
40
|
-
default: '',
|
|
41
|
-
},
|
|
42
|
-
transparentBg: {
|
|
43
|
-
type: Boolean,
|
|
44
|
-
required: true,
|
|
45
|
-
default: false,
|
|
46
|
-
},
|
|
47
|
-
stickyBackBtn: {
|
|
48
|
-
type: Boolean,
|
|
49
|
-
required: true,
|
|
50
|
-
default: true,
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
setup() {
|
|
54
|
-
const containerStore = useBrandPageContainerStore();
|
|
55
|
-
return {
|
|
56
|
-
isPrePurchase: computed(() => containerStore.isPrePurchase),
|
|
57
|
-
};
|
|
58
|
-
},
|
|
59
|
-
data() {
|
|
60
|
-
return {
|
|
61
|
-
tabs: [
|
|
62
|
-
{
|
|
63
|
-
id: 'ICON',
|
|
64
|
-
label: imageSettingTr('icon'),
|
|
65
|
-
active: false,
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
id: 'MY_UPLOADS',
|
|
69
|
-
label: imageSettingTr('myUploads'),
|
|
70
|
-
active: false,
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
id: 'MY_DESIGNS',
|
|
74
|
-
label: imageSettingTr('myDesigns'),
|
|
75
|
-
active: false,
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
id: 'IMAGE_LIBRARY',
|
|
79
|
-
label: imageSettingTr('imageLibrary'),
|
|
80
|
-
active: false,
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
id: 'SHAPE_LIBRARY',
|
|
84
|
-
label: imageSettingTr('shapeLibrary'),
|
|
85
|
-
active: false,
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
};
|
|
89
|
-
},
|
|
90
|
-
computed: {
|
|
91
|
-
enabledTabs() {
|
|
92
|
-
const value = this.tabs
|
|
93
|
-
.filter((x) => x.id !== 'MY_DESIGNS' || !this.isAdmin)
|
|
94
|
-
.filter((x) => this.activeTabs.some((y) => y === x.id) &&
|
|
95
|
-
(!this.isPrePurchase || x.id !== 'MY_DESIGNS'));
|
|
96
|
-
return value;
|
|
97
|
-
},
|
|
98
|
-
isDeleteEnabled() {
|
|
99
|
-
return true;
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
created() {
|
|
103
|
-
if (this.enabledTabs.length > 0) {
|
|
104
|
-
this.enabledTabs[0].active = true;
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
methods: {
|
|
108
|
-
onBack() {
|
|
109
|
-
this.$emit('on-back');
|
|
110
|
-
},
|
|
111
|
-
onImageSelected(image) {
|
|
112
|
-
this.$emit('on-image-picked', image, this.mediaType);
|
|
113
|
-
},
|
|
114
|
-
onDeleteImage(image) {
|
|
115
|
-
this.$emit('on-image-removed', image);
|
|
116
|
-
},
|
|
117
|
-
onDesignSelected(image) {
|
|
118
|
-
this.$emit('on-design-selected', image);
|
|
119
|
-
},
|
|
120
|
-
switchActiveTab(id) {
|
|
121
|
-
this.tabs.forEach((tab) => tab.id === id ? (tab.active = true) : (tab.active = false));
|
|
122
|
-
},
|
|
123
|
-
async onShapeSelected(image) {
|
|
124
|
-
const svgResponse = await axios.get(image.url);
|
|
125
|
-
const colorReplacements = getColorReplacementsFromSvgString(svgResponse.data);
|
|
126
|
-
this.$emit('on-shape-selected', {
|
|
127
|
-
imageUrl: image.url,
|
|
128
|
-
width: image.width,
|
|
129
|
-
height: image.height,
|
|
130
|
-
colorReplacements,
|
|
131
|
-
aspectRatio: image.aspectRatio,
|
|
132
|
-
});
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
});
|