@designcrowd/library.brand-page 5.10.20-kp-1 → 5.10.30
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/brand-page/models/index.d.ts +5 -0
- package/lib/src/brand-page/models/index.js +4 -0
- package/lib/src/brand-page/utils/style.util.d.ts +8 -1
- package/lib/src/brand-page/utils/style.util.js +58 -5
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +0 -5
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.stories.js +0 -1
- package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.js +1 -1
- package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/content-settings-items.fixture.js +1 -0
- package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/page-content-items.d.ts +1 -1
- package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/page-content-items.js +2 -1
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +33 -2
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.js +35 -1
- package/lib/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.d.ts +0 -2
- package/lib/src/brand-page-maker/components/seo-settings/SeoPageSettings.mixin.d.ts +0 -2
- package/lib/src/brand-page-maker/components/seo-settings/UrlSettings.mixin.d.ts +0 -2
- package/lib/src/brand-page-maker/components/seo-settings/UseExistingDomainModal.mixin.d.ts +0 -2
- package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.d.ts +1 -0
- package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.js +17 -0
- package/lib/src/brand-page-maker/components/upgrade-to-premium-button/UpgradeToPremiumButton.mixin.d.ts +0 -2
- package/lib/src/brand-page-maker/composables/rich-text-editor/bubbleMenu.d.ts +19 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/bubbleMenu.js +31 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/AutoLink.d.ts +2 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/AutoLink.js +161 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/MaxLength.js +3 -3
- package/lib/src/brand-page-maker/composables/rich-text-editor/font.d.ts +1 -1
- package/lib/src/brand-page-maker/composables/rich-text-editor/font.js +0 -1
- package/lib/src/brand-page-maker/composables/rich-text-editor/formatting.d.ts +1 -1
- package/lib/src/brand-page-maker/composables/rich-text-editor/formatting.js +0 -1
- package/lib/src/brand-page-maker/composables/rich-text-editor/hyperlink.d.ts +19 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/hyperlink.js +87 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/spacing.d.ts +1 -1
- package/lib/src/brand-page-maker/composables/rich-text-editor/spacing.js +0 -1
- package/lib/src/brand-page-maker/composables/rich-text-editor/textAlign.d.ts +1 -1
- package/lib/src/brand-page-maker/composables/rich-text-editor/textAlign.js +0 -1
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.d.ts +24 -3
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +214 -33
- package/lib/src/brand-page-maker/models/button-group.model.d.ts +2 -0
- package/lib/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.d.ts +0 -3
- package/lib/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.js +0 -6
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.d.ts +19 -2
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.js +340 -8
- package/lib/src/{bundled-translations.de-DE-O4sKkzBX.js → bundled-translations.de-DE-DjQFwukR.js} +1 -1
- package/lib/src/{bundled-translations.es-ES-C4lGaf08.js → bundled-translations.es-ES--EbGRI7e.js} +1 -1
- package/lib/src/{bundled-translations.fr-FR-CIy8KjAV.js → bundled-translations.fr-FR-VtC2JYUC.js} +1 -1
- package/lib/src/{bundled-translations.pt-PT-C8EcSdyX.js → bundled-translations.pt-PT-l9cEldEo.js} +1 -1
- package/lib/src/css/library.brand-page-brandCrowd.min.css +96 -70
- package/lib/src/css/library.brand-page-brandPage.min.css +96 -70
- package/lib/src/css/library.brand-page-designCom.min.css +96 -70
- package/lib/src/css/library.brand-page-preview.min.css +96 -70
- package/lib/src/index.d.ts +1 -0
- package/lib/src/index.mjs +29031 -26630
- package/lib/src/lib.js +1 -0
- package/lib/src/shared/content-settings/components/color-field/ColorField.mixin.d.ts +11 -0
- package/lib/src/shared/content-settings/components/color-field/ColorField.mixin.js +5 -0
- package/lib/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.mixin.d.ts +11 -1
- package/lib/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.mixin.js +4 -0
- package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.d.ts +0 -2
- package/lib/src/shared/content-settings/components/url-field/UrlField.mixin.d.ts +2 -0
- package/lib/src/shared/content-settings/components/url-field/UrlField.mixin.js +12 -7
- package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +0 -2
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +0 -2
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +2 -2
- package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts +0 -2
- package/lib/src/shared/side-bar/components/SideBar.mixin.d.ts +0 -2
- package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +0 -2
- package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.d.ts +0 -4
- package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.js +0 -8
- package/lib/src/shared/template-settings/store/template-settings-store.d.ts +0 -4
- package/lib/src/shared/template-settings/store/template-settings-store.js +0 -4
- package/package.json +6 -3
- package/src/brand-page/components/banner-section/BannerSection.vue +6 -0
- package/src/brand-page/components/text/Text.vue +2 -0
- package/src/brand-page/components/text-wrapper/TextWrapper.vue +31 -11
- package/src/brand-page/models/index.ts +6 -0
- package/src/brand-page/utils/style.util.ts +105 -5
- package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.stories.ts +0 -1
- package/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.ts +1 -1
- package/src/brand-page-maker/components/brand-page-maker/__fixtures__/content-settings-items.fixture.ts +1 -0
- package/src/brand-page-maker/components/brand-page-maker/__fixtures__/page-content-items.ts +2 -0
- package/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.ts +44 -1
- package/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.vue +1 -0
- package/src/brand-page-maker/components/rich-text-editor/RichTextEditor.vue +539 -50
- package/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.ts +22 -0
- package/src/brand-page-maker/components/template-preview/TemplatePreview.vue +1 -1
- package/src/brand-page-maker/composables/rich-text-editor/bubbleMenu.ts +42 -0
- package/src/brand-page-maker/composables/rich-text-editor/extensions/AutoLink.ts +227 -0
- package/src/brand-page-maker/composables/rich-text-editor/extensions/MaxLength.test.ts +1 -1
- package/src/brand-page-maker/composables/rich-text-editor/extensions/MaxLength.ts +4 -15
- package/src/brand-page-maker/composables/rich-text-editor/font.ts +1 -1
- package/src/brand-page-maker/composables/rich-text-editor/formatting.ts +1 -1
- package/src/brand-page-maker/composables/rich-text-editor/hyperlink.ts +114 -0
- package/src/brand-page-maker/composables/rich-text-editor/spacing.ts +1 -1
- package/src/brand-page-maker/composables/rich-text-editor/textAlign.ts +1 -1
- package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +299 -41
- package/src/brand-page-maker/models/button-group.model.ts +2 -0
- package/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.ts +0 -8
- package/src/brand-page-maker/stores/brandpage-maker/__snapshots__/brandpage-maker-store.test.ts.snap +1 -0
- package/src/brand-page-maker/utils/rich-text-editor.util.test.ts +418 -0
- package/src/brand-page-maker/utils/rich-text-editor.util.ts +470 -25
- package/src/lib.ts +1 -0
- package/src/shared/content-settings/components/color-field/ColorField.mixin.ts +5 -0
- package/src/shared/content-settings/components/color-field/ColorField.vue +1 -1
- package/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.mixin.ts +4 -0
- package/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.vue +2 -2
- package/src/shared/content-settings/components/text-field/TextField.vue +1 -1
- package/src/shared/content-settings/components/text-items-field/TextItemsField.vue +2 -2
- package/src/shared/content-settings/components/textarea-field/TextareaField.vue +3 -3
- package/src/shared/content-settings/components/url-field/UrlField.mixin.ts +15 -10
- package/src/shared/content-settings/components/url-field/UrlField.vue +1 -0
- package/src/shared/template-settings/components/TemplatesSettings.mixin.ts +0 -12
- package/src/shared/template-settings/store/template-settings-store.ts +0 -5
|
@@ -207,6 +207,11 @@ export declare const BUTTON_LINK_TYPE: {
|
|
|
207
207
|
readonly tel: "tel";
|
|
208
208
|
};
|
|
209
209
|
export type ButtonLinkType = keyof typeof BUTTON_LINK_TYPE;
|
|
210
|
+
export declare const HYPERLINK_TYPE: {
|
|
211
|
+
readonly url: "url";
|
|
212
|
+
readonly page: "page";
|
|
213
|
+
};
|
|
214
|
+
export type HyperlinkType = keyof typeof HYPERLINK_TYPE;
|
|
210
215
|
export declare const URL_TYPE: {
|
|
211
216
|
readonly url: "url";
|
|
212
217
|
readonly email: "email";
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import type { BrandPageModel, LogoTheme, FabricLogoTheme, ButtonStyles, PageModel } from '../models';
|
|
1
|
+
import type { BrandPageModel, LogoTheme, ThemeColor, FabricLogoTheme, ButtonStyles, PageModel } from '../models';
|
|
2
2
|
import { NavigationDesktop, NavigationMobile } from '../models';
|
|
3
3
|
import { PageStyles, PageHeaderMobile, PageHeaderDesktop, PageFooterMobile, PageFooterDesktop } from '../models';
|
|
4
|
+
/**
|
|
5
|
+
* @function getColorValueForCorrectCssProperty
|
|
6
|
+
* @param k: string
|
|
7
|
+
* @param colorData { rgb: 'rgb(0,255,0)', gradient: 'linear-gradient(180deg, rgb(0,0,0), rgb(255,0,0), 100%)'}
|
|
8
|
+
* @returns string - rgb() or linear-gradient()
|
|
9
|
+
*/
|
|
10
|
+
export declare const getColorValueForCorrectCssProperty: (k: string, colorData: ThemeColor) => string;
|
|
4
11
|
export declare const colorMatchCssKeyValue: (cssKey: string, cssValue: string, logoTheme: LogoTheme, applyColorWithMatchingLuminance?: {
|
|
5
12
|
originalColor: string;
|
|
6
13
|
}) => {
|
|
@@ -4,6 +4,7 @@ import { STYLE_THEME_KEYS } from '../constants';
|
|
|
4
4
|
import { arrayToLinearGradient, linearGradientToArray, isColorLinearGradient, RGBAtoHex, } from '../../utils/helpers';
|
|
5
5
|
import { addTransparentAlphaChannelToHex, calculateLuminanceRatio, getNewColorBasedOnTargetColorTheme, } from './color.util';
|
|
6
6
|
import chroma from 'chroma-js';
|
|
7
|
+
import { hasRTEContent } from '../../brand-page-maker/utils';
|
|
7
8
|
const MIN_LUM_RATIO = 0.3;
|
|
8
9
|
const parseFabricColorToCssStyle = (fabricColor) => {
|
|
9
10
|
if (fabricColor && typeof fabricColor === 'object') {
|
|
@@ -25,7 +26,7 @@ const parseFabricColorToCssStyle = (fabricColor) => {
|
|
|
25
26
|
* @param colorData { rgb: 'rgb(0,255,0)', gradient: 'linear-gradient(180deg, rgb(0,0,0), rgb(255,0,0), 100%)'}
|
|
26
27
|
* @returns string - rgb() or linear-gradient()
|
|
27
28
|
*/
|
|
28
|
-
const getColorValueForCorrectCssProperty = (k, colorData) => {
|
|
29
|
+
export const getColorValueForCorrectCssProperty = (k, colorData) => {
|
|
29
30
|
const gradientSupportedCssProperties = ['background', 'backgroundImage'];
|
|
30
31
|
return colorData.gradient && gradientSupportedCssProperties.indexOf(k) > -1
|
|
31
32
|
? colorData.gradient
|
|
@@ -49,13 +50,15 @@ export const colorMatchCssKeyValue = (cssKey, cssValue, logoTheme, applyColorWit
|
|
|
49
50
|
return { cssValue: newColor, isModified: true };
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
|
-
if (cssValue.match(new RegExp(STYLE_THEME_KEYS.LogoTextColor, 'g')) ||
|
|
53
|
-
cssValue.match(new RegExp(STYLE_THEME_KEYS.LogoTextMultiColor, 'g')))
|
|
53
|
+
if ((cssValue.match(new RegExp(STYLE_THEME_KEYS.LogoTextColor, 'g')) ||
|
|
54
|
+
cssValue.match(new RegExp(STYLE_THEME_KEYS.LogoTextMultiColor, 'g'))) &&
|
|
55
|
+
!hasRTEContent(cssValue)) {
|
|
54
56
|
cssValue = getColorValueForCorrectCssProperty(cssKey, logoTheme.logoTextColor);
|
|
55
57
|
return { cssValue, isModified: true };
|
|
56
58
|
}
|
|
57
|
-
else if (cssValue.match(new RegExp(STYLE_THEME_KEYS.LogoBackgroundColor, 'g')) ||
|
|
58
|
-
cssValue.match(new RegExp(STYLE_THEME_KEYS.LogoBackgroundMultiColor, 'g')))
|
|
59
|
+
else if ((cssValue.match(new RegExp(STYLE_THEME_KEYS.LogoBackgroundColor, 'g')) ||
|
|
60
|
+
cssValue.match(new RegExp(STYLE_THEME_KEYS.LogoBackgroundMultiColor, 'g'))) &&
|
|
61
|
+
!hasRTEContent(cssValue)) {
|
|
59
62
|
cssValue = getColorValueForCorrectCssProperty(cssKey, logoTheme.logoBackgroundColor);
|
|
60
63
|
return { cssValue, isModified: true };
|
|
61
64
|
}
|
|
@@ -196,6 +199,8 @@ const CONTENT_STYLE_PROP_NAME_SUFFIX = [
|
|
|
196
199
|
'Color',
|
|
197
200
|
'Replacements',
|
|
198
201
|
];
|
|
202
|
+
const RTE_ALLOWED_SECTION_TYPES = ['text', 'banner-section'];
|
|
203
|
+
const RTE_ALLOWED_FIELDS = ['title', 'description', 'text', 'textItems'];
|
|
199
204
|
export const applyLogoThemeToContents = (logoTheme, pages) => {
|
|
200
205
|
let isModified = false;
|
|
201
206
|
const newPages = pages.map((page) => {
|
|
@@ -211,12 +216,60 @@ export const applyLogoThemeToContents = (logoTheme, pages) => {
|
|
|
211
216
|
newContent[styleKey] = newStyle;
|
|
212
217
|
isModified = isModified || isApplied;
|
|
213
218
|
}
|
|
219
|
+
const rteContentKeys = RTE_ALLOWED_SECTION_TYPES.includes(content.type)
|
|
220
|
+
? Object.keys(content).filter((k) => RTE_ALLOWED_FIELDS.includes(k))
|
|
221
|
+
: [];
|
|
222
|
+
for (const key of rteContentKeys) {
|
|
223
|
+
const { newRTEContent, isApplied } = applyLogoThemeToBrandPageRTEContentColorsRecursive(newContent[key], logoTheme, isModified);
|
|
224
|
+
newContent[key] = newRTEContent;
|
|
225
|
+
isModified = isModified || isApplied;
|
|
226
|
+
}
|
|
214
227
|
return newContent;
|
|
215
228
|
});
|
|
216
229
|
return { ...page, contents: newContents };
|
|
217
230
|
});
|
|
218
231
|
return { pages: newPages, isModified };
|
|
219
232
|
};
|
|
233
|
+
const applyLogoThemeToBrandPageRTEContentColorsRecursive = (content, logoTheme, isModified) => {
|
|
234
|
+
let isApplied = false;
|
|
235
|
+
let newRTEContent = {};
|
|
236
|
+
if (typeof content === 'string' && hasRTEContent(content)) {
|
|
237
|
+
newRTEContent = replaceRTEContentColors(content, logoTheme);
|
|
238
|
+
isApplied = true;
|
|
239
|
+
}
|
|
240
|
+
else if (Array.isArray(content)) {
|
|
241
|
+
newRTEContent = content.map((item) => {
|
|
242
|
+
const { newRTEContent: recursiveContent, isApplied: recursiveIsApplied } = applyLogoThemeToBrandPageRTEContentColorsRecursive(item, logoTheme, isModified);
|
|
243
|
+
isApplied = recursiveIsApplied;
|
|
244
|
+
return recursiveContent;
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
else if (typeof content === 'object') {
|
|
248
|
+
for (const [key, value] of Object.entries(content)) {
|
|
249
|
+
if (RTE_ALLOWED_FIELDS.includes(key) &&
|
|
250
|
+
typeof value === 'string' &&
|
|
251
|
+
hasRTEContent(value)) {
|
|
252
|
+
newRTEContent[key] = replaceRTEContentColors(value, logoTheme);
|
|
253
|
+
isApplied = true;
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
newRTEContent[key] = value;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
newRTEContent = content;
|
|
262
|
+
isApplied = false;
|
|
263
|
+
}
|
|
264
|
+
return { isApplied, newRTEContent };
|
|
265
|
+
};
|
|
266
|
+
const replaceRTEContentColors = (content, logoTheme) => {
|
|
267
|
+
return content
|
|
268
|
+
.replace(new RegExp(`var\\(--${STYLE_THEME_KEYS.LogoTextColor}\\)`, 'g'), logoTheme.logoTextColor.rgb)
|
|
269
|
+
.replace(new RegExp(`var\\(--${STYLE_THEME_KEYS.LogoBackgroundColor}\\)`, 'g'), logoTheme.logoBackgroundColor.rgb)
|
|
270
|
+
.replace(new RegExp(`var\\(--${STYLE_THEME_KEYS.LogoTextMultiColor}\\)`, 'g'), logoTheme.logoTextColor.rgb)
|
|
271
|
+
.replace(new RegExp(`var\\(--${STYLE_THEME_KEYS.LogoBackgroundMultiColor}\\)`, 'g'), logoTheme.logoBackgroundColor.rgb);
|
|
272
|
+
};
|
|
220
273
|
export const applyLogoThemeToBrandPageStyles = (logoTheme, pageStyles) => {
|
|
221
274
|
let isModified = false;
|
|
222
275
|
const newStyle = new PageStyles();
|
|
@@ -248,7 +248,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
248
248
|
eventButtonLocation?: string | undefined;
|
|
249
249
|
showPublishOptionModal?: boolean | undefined;
|
|
250
250
|
abTests: Record<string, string>;
|
|
251
|
-
logoBrandIndustry: string | undefined;
|
|
252
251
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
253
252
|
isUserDraft: (state: {
|
|
254
253
|
availableTaxes: any[];
|
|
@@ -309,7 +308,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
309
308
|
eventButtonLocation?: string | undefined;
|
|
310
309
|
showPublishOptionModal?: boolean | undefined;
|
|
311
310
|
abTests: Record<string, string>;
|
|
312
|
-
logoBrandIndustry: string | undefined;
|
|
313
311
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
314
312
|
}, {
|
|
315
313
|
clearTriggerSaveEventApiOnPublishModalClose(): void;
|
|
@@ -998,9 +996,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
998
996
|
selectInitialTemplateCategory(payload: {
|
|
999
997
|
selectedCategory: string;
|
|
1000
998
|
}): void;
|
|
1001
|
-
setInitialSearchTerm(payload: {
|
|
1002
|
-
initialSearchTerm: string;
|
|
1003
|
-
}): void;
|
|
1004
999
|
clearTemplates(): void;
|
|
1005
1000
|
getTemplateByTemplateId(id: string): import("../../../shared/template-settings/models").TemplateSettingsTemplate | undefined;
|
|
1006
1001
|
}>;
|
|
@@ -176,7 +176,6 @@ const InitialiseMakerStores = (options) => {
|
|
|
176
176
|
triggerSaveSuccessMessage: false,
|
|
177
177
|
triggerSaveEventApiOnPublishModalClose: false,
|
|
178
178
|
abTests: {},
|
|
179
|
-
logoBrandIndustry: 'Fashion',
|
|
180
179
|
});
|
|
181
180
|
userStore.setIsAdmin({ isAdmin: options.isAdmin || false });
|
|
182
181
|
userStore.setHasBrandPagePremiumSubscription(false);
|
package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/page-content-items.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const brandPageContentsSampleData: (import("../../../../brand-page").ButtonContent | import("../../../../brand-page").ProfileContent | import("../../../../brand-page").LogoContent)[];
|
|
1
|
+
export declare const brandPageContentsSampleData: (import("../../../../brand-page").ButtonContent | import("../../../../brand-page").ProfileContent | import("../../../../brand-page").TextContent | import("../../../../brand-page").LogoContent)[];
|
|
2
2
|
export declare const brandPageContentsSampleDataStarterKit: (import("../../../../brand-page").ButtonContent | import("../../../../brand-page").ProfileContent | import("../../../../brand-page").LogoContent)[];
|
package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/page-content-items.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { logoContent, profileContent, generalLink, facebookLink, websiteLink, emailLink, phoneLink, twitterLink, instagramLink, youtubeLink, linkedinLink, pinterestLink, twitchLink, tiktokLink, } from './content-settings-items.fixture';
|
|
1
|
+
import { logoContent, profileContent, generalLink, facebookLink, websiteLink, emailLink, phoneLink, twitterLink, instagramLink, youtubeLink, linkedinLink, pinterestLink, twitchLink, tiktokLink, textContent, } from './content-settings-items.fixture';
|
|
2
2
|
export const brandPageContentsSampleData = [
|
|
3
3
|
logoContent,
|
|
4
4
|
profileContent,
|
|
5
|
+
textContent,
|
|
5
6
|
generalLink,
|
|
6
7
|
websiteLink,
|
|
7
8
|
emailLink,
|
package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts
CHANGED
|
@@ -37,6 +37,38 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
37
37
|
selectedTemplateId: import("vue").ComputedRef<string | false>;
|
|
38
38
|
canUseRichTextEditor: import("vue").ComputedRef<boolean>;
|
|
39
39
|
isAdmin: import("vue").ComputedRef<boolean>;
|
|
40
|
+
logoTheme: import("vue").ComputedRef<{
|
|
41
|
+
logoTextColor: {
|
|
42
|
+
rgb: string;
|
|
43
|
+
gradient?: string | undefined;
|
|
44
|
+
50?: string | undefined;
|
|
45
|
+
100?: string | undefined;
|
|
46
|
+
200?: string | undefined;
|
|
47
|
+
300?: string | undefined;
|
|
48
|
+
400?: string | undefined;
|
|
49
|
+
500?: string | undefined;
|
|
50
|
+
600?: string | undefined;
|
|
51
|
+
700?: string | undefined;
|
|
52
|
+
800?: string | undefined;
|
|
53
|
+
900?: string | undefined;
|
|
54
|
+
950?: string | undefined;
|
|
55
|
+
};
|
|
56
|
+
logoBackgroundColor: {
|
|
57
|
+
rgb: string;
|
|
58
|
+
gradient?: string | undefined;
|
|
59
|
+
50?: string | undefined;
|
|
60
|
+
100?: string | undefined;
|
|
61
|
+
200?: string | undefined;
|
|
62
|
+
300?: string | undefined;
|
|
63
|
+
400?: string | undefined;
|
|
64
|
+
500?: string | undefined;
|
|
65
|
+
600?: string | undefined;
|
|
66
|
+
700?: string | undefined;
|
|
67
|
+
800?: string | undefined;
|
|
68
|
+
900?: string | undefined;
|
|
69
|
+
950?: string | undefined;
|
|
70
|
+
};
|
|
71
|
+
}>;
|
|
40
72
|
contentSettingsStore: import("pinia").Store<"uiContentSettings", import("../../../shared/content-settings/store").ContentSettingsState, {
|
|
41
73
|
contentErrorCount(): number;
|
|
42
74
|
getContent(state: {
|
|
@@ -655,7 +687,6 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
655
687
|
eventButtonLocation?: string | undefined;
|
|
656
688
|
showPublishOptionModal?: boolean | undefined;
|
|
657
689
|
abTests: Record<string, string>;
|
|
658
|
-
logoBrandIndustry: string | undefined;
|
|
659
690
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
660
691
|
isUserDraft: (state: {
|
|
661
692
|
availableTaxes: any[];
|
|
@@ -716,7 +747,6 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
716
747
|
eventButtonLocation?: string | undefined;
|
|
717
748
|
showPublishOptionModal?: boolean | undefined;
|
|
718
749
|
abTests: Record<string, string>;
|
|
719
|
-
logoBrandIndustry: string | undefined;
|
|
720
750
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
721
751
|
}, {
|
|
722
752
|
clearTriggerSaveEventApiOnPublishModalClose(): void;
|
|
@@ -1032,6 +1062,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
1032
1062
|
};
|
|
1033
1063
|
isDraggableEnabled(): boolean;
|
|
1034
1064
|
isItemSelected(): (itemIdx: any) => boolean;
|
|
1065
|
+
styleHtml(): string;
|
|
1035
1066
|
}, {
|
|
1036
1067
|
dispatchViewPortChangeEvent(): void;
|
|
1037
1068
|
onDraggingStart(): void;
|
package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.js
CHANGED
|
@@ -14,6 +14,7 @@ import debounce from 'lodash.debounce';
|
|
|
14
14
|
import { transformToRTE } from '../../../brand-page-maker/utils';
|
|
15
15
|
import { useExternalRichTextEditor } from '../../../brand-page-maker/composables/rich-text-editor/useRichTextEditor';
|
|
16
16
|
import { useUiStyleSettingsStore } from '../../../shared/style-settings/store';
|
|
17
|
+
import { STYLE_THEME_KEYS } from '../../../brand-page/constants';
|
|
17
18
|
export default defineComponent({
|
|
18
19
|
mixins: [PageMixin],
|
|
19
20
|
setup() {
|
|
@@ -40,6 +41,7 @@ export default defineComponent({
|
|
|
40
41
|
selectedTemplateId: computed(() => brandPageMakerStore.selectedTemplateId),
|
|
41
42
|
canUseRichTextEditor: computed(() => brandPageMakerUserStore.features.canUseRichTextEditor),
|
|
42
43
|
isAdmin: computed(() => brandPageMakerUserStore.isAdmin),
|
|
44
|
+
logoTheme: computed(() => uiStore.logoTheme),
|
|
43
45
|
contentSettingsStore,
|
|
44
46
|
brandPageMakerStore,
|
|
45
47
|
brandPageContainerStore,
|
|
@@ -97,6 +99,31 @@ export default defineComponent({
|
|
|
97
99
|
return this.isContentSelected ? item.id === this.selectedItemId : false;
|
|
98
100
|
};
|
|
99
101
|
},
|
|
102
|
+
styleHtml() {
|
|
103
|
+
if (!this.logoTheme) {
|
|
104
|
+
return '';
|
|
105
|
+
}
|
|
106
|
+
// Generate CSS variables for logo theme colors
|
|
107
|
+
const cssVariables = Object.entries(STYLE_THEME_KEYS)
|
|
108
|
+
.map(([key, value]) => {
|
|
109
|
+
const themeColor = key.includes('Background')
|
|
110
|
+
? this.logoTheme.logoBackgroundColor
|
|
111
|
+
: this.logoTheme.logoTextColor;
|
|
112
|
+
if (themeColor?.rgb) {
|
|
113
|
+
return `--${value}: ${themeColor.rgb};`;
|
|
114
|
+
}
|
|
115
|
+
return '';
|
|
116
|
+
})
|
|
117
|
+
.filter(Boolean)
|
|
118
|
+
.join('\n ');
|
|
119
|
+
return cssVariables
|
|
120
|
+
? `<style>
|
|
121
|
+
:root {
|
|
122
|
+
${cssVariables}
|
|
123
|
+
}
|
|
124
|
+
</style>`
|
|
125
|
+
: '';
|
|
126
|
+
},
|
|
100
127
|
},
|
|
101
128
|
mounted() {
|
|
102
129
|
this.dispatchViewPortChangeEvent();
|
|
@@ -180,7 +207,14 @@ export default defineComponent({
|
|
|
180
207
|
this.isContentSelected = true;
|
|
181
208
|
if ((item.type === 'banner-section' || item.type === 'text') &&
|
|
182
209
|
this.canUseRichTextEditor) {
|
|
183
|
-
|
|
210
|
+
let selectedItem = item;
|
|
211
|
+
if (this.isAdmin) {
|
|
212
|
+
const currentItem = this.items.find((i) => i.id === item.id);
|
|
213
|
+
if (currentItem) {
|
|
214
|
+
selectedItem = currentItem.settings.content;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
transformToRTE(this.pageSettingsStore, this.externalEditor, this.styleSettingsStore, selectedItem);
|
|
184
218
|
}
|
|
185
219
|
if (this.selectEventDebounceHandler) {
|
|
186
220
|
this.selectEventDebounceHandler();
|
|
@@ -70,7 +70,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
70
70
|
eventButtonLocation?: string | undefined;
|
|
71
71
|
showPublishOptionModal?: boolean | undefined;
|
|
72
72
|
abTests: Record<string, string>;
|
|
73
|
-
logoBrandIndustry: string | undefined;
|
|
74
73
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
75
74
|
isUserDraft: (state: {
|
|
76
75
|
availableTaxes: any[];
|
|
@@ -131,7 +130,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
131
130
|
eventButtonLocation?: string | undefined;
|
|
132
131
|
showPublishOptionModal?: boolean | undefined;
|
|
133
132
|
abTests: Record<string, string>;
|
|
134
|
-
logoBrandIndustry: string | undefined;
|
|
135
133
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
136
134
|
}, {
|
|
137
135
|
clearTriggerSaveEventApiOnPublishModalClose(): void;
|
|
@@ -86,7 +86,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
86
86
|
eventButtonLocation?: string | undefined;
|
|
87
87
|
showPublishOptionModal?: boolean | undefined;
|
|
88
88
|
abTests: Record<string, string>;
|
|
89
|
-
logoBrandIndustry: string | undefined;
|
|
90
89
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
91
90
|
isUserDraft: (state: {
|
|
92
91
|
availableTaxes: any[];
|
|
@@ -147,7 +146,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
147
146
|
eventButtonLocation?: string | undefined;
|
|
148
147
|
showPublishOptionModal?: boolean | undefined;
|
|
149
148
|
abTests: Record<string, string>;
|
|
150
|
-
logoBrandIndustry: string | undefined;
|
|
151
149
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
152
150
|
}, {
|
|
153
151
|
clearTriggerSaveEventApiOnPublishModalClose(): void;
|
|
@@ -88,7 +88,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
88
88
|
eventButtonLocation?: string | undefined;
|
|
89
89
|
showPublishOptionModal?: boolean | undefined;
|
|
90
90
|
abTests: Record<string, string>;
|
|
91
|
-
logoBrandIndustry: string | undefined;
|
|
92
91
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
93
92
|
isUserDraft: (state: {
|
|
94
93
|
availableTaxes: any[];
|
|
@@ -149,7 +148,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
149
148
|
eventButtonLocation?: string | undefined;
|
|
150
149
|
showPublishOptionModal?: boolean | undefined;
|
|
151
150
|
abTests: Record<string, string>;
|
|
152
|
-
logoBrandIndustry: string | undefined;
|
|
153
151
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
154
152
|
}, {
|
|
155
153
|
clearTriggerSaveEventApiOnPublishModalClose(): void;
|
|
@@ -67,7 +67,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
67
67
|
eventButtonLocation?: string | undefined;
|
|
68
68
|
showPublishOptionModal?: boolean | undefined;
|
|
69
69
|
abTests: Record<string, string>;
|
|
70
|
-
logoBrandIndustry: string | undefined;
|
|
71
70
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
72
71
|
isUserDraft: (state: {
|
|
73
72
|
availableTaxes: any[];
|
|
@@ -128,7 +127,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
128
127
|
eventButtonLocation?: string | undefined;
|
|
129
128
|
showPublishOptionModal?: boolean | undefined;
|
|
130
129
|
abTests: Record<string, string>;
|
|
131
|
-
logoBrandIndustry: string | undefined;
|
|
132
130
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
133
131
|
}, {
|
|
134
132
|
clearTriggerSaveEventApiOnPublishModalClose(): void;
|
|
@@ -185,6 +185,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
185
185
|
scaledContainerStyle(): BrandPageCssStyle;
|
|
186
186
|
innerContainerStyle(): BrandPageCssStyle;
|
|
187
187
|
isPersonalisable(): boolean;
|
|
188
|
+
cssVariablesStyle(): Record<string, string>;
|
|
188
189
|
}, {
|
|
189
190
|
onOverlayClicked(): void;
|
|
190
191
|
onResize(): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { computed, defineComponent } from 'vue';
|
|
2
2
|
import { BRAND_PAGE_TYPES, MEDIA_SIZES, VIEWPORTS } from '../../../brand-page';
|
|
3
3
|
import { applyLogoThemeToBrandPageModel, applyUserPersonalisationToBrandPageModelAsync, getBrandPageViewModelFromBrandPageModel, } from '../../../brand-page/utils';
|
|
4
|
+
import { STYLE_THEME_KEYS } from '../../../brand-page/constants';
|
|
4
5
|
import debounce from 'lodash.debounce';
|
|
5
6
|
import { MOBILE_HEIGHT, MOBILE_WIDTH } from '../../constants';
|
|
6
7
|
import { useBrandPageMakerStore } from '../../stores';
|
|
@@ -128,6 +129,22 @@ export default defineComponent({
|
|
|
128
129
|
isPersonalisable() {
|
|
129
130
|
return this.template.isPersonalisable || false;
|
|
130
131
|
},
|
|
132
|
+
cssVariablesStyle() {
|
|
133
|
+
if (!this.logoTheme) {
|
|
134
|
+
return {};
|
|
135
|
+
}
|
|
136
|
+
const cssVariables = {};
|
|
137
|
+
// Generate CSS variables for logo theme colors
|
|
138
|
+
Object.entries(STYLE_THEME_KEYS).forEach(([key, value]) => {
|
|
139
|
+
const themeColor = key.includes('Background')
|
|
140
|
+
? this.logoTheme.logoBackgroundColor
|
|
141
|
+
: this.logoTheme.logoTextColor;
|
|
142
|
+
if (themeColor?.rgb) {
|
|
143
|
+
cssVariables[`--${value}`] = themeColor.rgb;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
return cssVariables;
|
|
147
|
+
},
|
|
131
148
|
},
|
|
132
149
|
watch: {
|
|
133
150
|
logoTheme: {
|
|
@@ -67,7 +67,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
67
67
|
eventButtonLocation?: string | undefined;
|
|
68
68
|
showPublishOptionModal?: boolean | undefined;
|
|
69
69
|
abTests: Record<string, string>;
|
|
70
|
-
logoBrandIndustry: string | undefined;
|
|
71
70
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
72
71
|
isUserDraft: (state: {
|
|
73
72
|
availableTaxes: any[];
|
|
@@ -128,7 +127,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
128
127
|
eventButtonLocation?: string | undefined;
|
|
129
128
|
showPublishOptionModal?: boolean | undefined;
|
|
130
129
|
abTests: Record<string, string>;
|
|
131
|
-
logoBrandIndustry: string | undefined;
|
|
132
130
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
133
131
|
}, {
|
|
134
132
|
clearTriggerSaveEventApiOnPublishModalClose(): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/vue-3';
|
|
2
|
+
import type { Ref } from 'vue';
|
|
3
|
+
export declare const useBubbleMenu: (editor: Editor, isHyperlinkPopupOpen?: Ref<boolean>) => {
|
|
4
|
+
shouldShow: ({ editor, state }: {
|
|
5
|
+
editor: any;
|
|
6
|
+
state: any;
|
|
7
|
+
}) => any;
|
|
8
|
+
tippyOptions: {
|
|
9
|
+
duration: number;
|
|
10
|
+
placement: "bottom";
|
|
11
|
+
interactive: boolean;
|
|
12
|
+
appendTo: "parent";
|
|
13
|
+
hideOnClick: boolean;
|
|
14
|
+
arrow: boolean;
|
|
15
|
+
offset: [number, number];
|
|
16
|
+
trigger: "manual";
|
|
17
|
+
zIndex: number;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const useBubbleMenu = (editor, isHyperlinkPopupOpen) => {
|
|
2
|
+
const shouldShow = ({ editor, state }) => {
|
|
3
|
+
if (!editor || !state)
|
|
4
|
+
return false;
|
|
5
|
+
// Hide preview popup if the hyperlink popup is open
|
|
6
|
+
if (isHyperlinkPopupOpen?.value)
|
|
7
|
+
return false;
|
|
8
|
+
const { selection } = state;
|
|
9
|
+
// Only show bubble menu if there's a selection and it contains a link
|
|
10
|
+
if (!selection.empty) {
|
|
11
|
+
const linkAttrs = editor.getAttributes('link');
|
|
12
|
+
return linkAttrs.href && linkAttrs.href.trim() !== '';
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
15
|
+
};
|
|
16
|
+
const tippyOptions = {
|
|
17
|
+
duration: 100,
|
|
18
|
+
placement: 'bottom',
|
|
19
|
+
interactive: true,
|
|
20
|
+
appendTo: 'parent',
|
|
21
|
+
hideOnClick: false,
|
|
22
|
+
arrow: false,
|
|
23
|
+
offset: [0, 10],
|
|
24
|
+
trigger: 'manual',
|
|
25
|
+
zIndex: 10,
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
shouldShow,
|
|
29
|
+
tippyOptions,
|
|
30
|
+
};
|
|
31
|
+
};
|