@designcrowd/library.brand-page 6.0.6-json-prereq-2 → 6.0.6-json-prereq-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 (26) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-F1Ldbx6c.js → CreatedOnBrandCrowd-de-de-B75jYGAG.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-D8z2m0Et.js → CreatedOnBrandCrowd-en-us-CoDbU42G.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-CLSkbkYu.js → CreatedOnBrandCrowd-es-es-CkQBC_E2.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-Cyc4YWYR.js → CreatedOnBrandCrowd-fr-ca-BueYGoqR.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-Cyc4YWYR.js → CreatedOnBrandCrowd-fr-fr-BueYGoqR.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-DSSUcSmV.js → CreatedOnBrandCrowd-pt-br-iVkkV5mY.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-DSSUcSmV.js → CreatedOnBrandCrowd-pt-pt-iVkkV5mY.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-DF1JaJPE.js → CreatedOnDcom-de-de-DTcMQ9rQ.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-Dek2GCu0.js → CreatedOnDcom-en-us-C6KX2pNG.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-C3JD7_bP.js → CreatedOnDcom-es-es-Bx2DoOtp.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-Bllxm84y.js → CreatedOnDcom-fr-ca-CMnpCJqe.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-B3cFZgRB.js → CreatedOnDcom-fr-fr-CIDsOdaw.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-DHCnZdZk.js → CreatedOnDcom-pt-br-CbrdeuQe.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-BLooAZOd.js → CreatedOnDcom-pt-pt-nOvChX6_.js} +1 -1
  15. package/lib/src/brand-page/utils/view-model.util.d.ts +1 -0
  16. package/lib/src/brand-page/utils/view-model.util.js +68 -20
  17. package/lib/src/brand-page-maker/validators/field.validator.js +7 -2
  18. package/lib/src/index.mjs +1 -1
  19. package/lib/src/{lib-BWEaceMZ.js → lib-BXP4Pl2X.js} +10353 -10333
  20. package/lib/src/shared/content-settings/components/GenericTextInput.mixin.js +14 -1
  21. package/package.json +1 -1
  22. package/src/brand-page/utils/view-model.pageid-rte.test.ts +104 -0
  23. package/src/brand-page/utils/view-model.util.ts +94 -26
  24. package/src/brand-page-maker/validators/field.validator.test.ts +50 -0
  25. package/src/brand-page-maker/validators/field.validator.ts +7 -2
  26. package/src/shared/content-settings/components/GenericTextInput.mixin.ts +17 -1
@@ -1,5 +1,5 @@
1
1
  import { openBlock as e, createElementBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-BWEaceMZ.js";
2
+ import { _ as t } from "./lib-BXP4Pl2X.js";
3
3
  const i = {}, h = {
4
4
  width: "275",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as e, createElementBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-BWEaceMZ.js";
2
+ import { _ as t } from "./lib-BXP4Pl2X.js";
3
3
  const i = {}, h = {
4
4
  width: "251",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as e, createElementBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-BWEaceMZ.js";
2
+ import { _ as t } from "./lib-BXP4Pl2X.js";
3
3
  const i = {}, h = {
4
4
  width: "250",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as e, createElementBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-BWEaceMZ.js";
2
+ import { _ as t } from "./lib-BXP4Pl2X.js";
3
3
  const i = {}, h = {
4
4
  width: "237",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as e, createElementBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-BWEaceMZ.js";
2
+ import { _ as t } from "./lib-BXP4Pl2X.js";
3
3
  const i = {}, h = {
4
4
  width: "237",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as e, createElementBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-BWEaceMZ.js";
2
+ import { _ as t } from "./lib-BXP4Pl2X.js";
3
3
  const i = {}, h = {
4
4
  width: "263",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as e, createElementBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-BWEaceMZ.js";
2
+ import { _ as t } from "./lib-BXP4Pl2X.js";
3
3
  const i = {}, h = {
4
4
  width: "263",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as H, createElementBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-BWEaceMZ.js";
2
+ import { _ as e } from "./lib-BXP4Pl2X.js";
3
3
  const M = {}, Z = {
4
4
  width: "242",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as H, createElementBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-BWEaceMZ.js";
2
+ import { _ as e } from "./lib-BXP4Pl2X.js";
3
3
  const i = {}, M = {
4
4
  width: "231",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as H, createElementBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-BWEaceMZ.js";
2
+ import { _ as e } from "./lib-BXP4Pl2X.js";
3
3
  const M = {}, Z = {
4
4
  width: "230",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as H, createElementBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-BWEaceMZ.js";
2
+ import { _ as e } from "./lib-BXP4Pl2X.js";
3
3
  const i = {}, l = {
4
4
  width: "216",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as H, createElementBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-BWEaceMZ.js";
2
+ import { _ as e } from "./lib-BXP4Pl2X.js";
3
3
  const i = {}, l = {
4
4
  width: "216",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as H, createElementBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as M } from "./lib-BWEaceMZ.js";
2
+ import { _ as M } from "./lib-BXP4Pl2X.js";
3
3
  const Z = {}, e = {
4
4
  width: "232",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as H, createElementBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as M } from "./lib-BWEaceMZ.js";
2
+ import { _ as M } from "./lib-BXP4Pl2X.js";
3
3
  const Z = {}, e = {
4
4
  width: "232",
5
5
  height: "36",
@@ -28,6 +28,7 @@ interface ViewModelMappingOptions {
28
28
  setVideoUrlsWithToken?: (token: string, videoUrl: string, previewImageUrl: string, assetId: string) => void;
29
29
  }
30
30
  export declare const getBrandPageViewModelFromBrandPageModel: (model: BrandPageModel, brandPageToken: string | undefined, showBrandCrowdLogo: boolean | undefined, options: ViewModelMappingOptions) => BrandPageViewModel;
31
+ export declare const resolvePageIdsInRteJson: (doc: unknown, nav: NavViewModel, options: ViewModelMappingOptions) => unknown;
31
32
  export declare const isLogoViewModel: (viewModel: ContentViewModel) => viewModel is LogoViewModel;
32
33
  /** for service.brand-page website preview by logo draft token */
33
34
  export declare const applyLogoImageToBrandPageViewModel: (viewModel: BrandPageViewModel, logoImage: LogoImageModel) => BrandPageViewModel;
@@ -10,7 +10,7 @@ import { isValidSvgUrl } from './image.util';
10
10
  import { isLogoContent } from './model.util';
11
11
  import { getBoxShadowValue } from './button.util';
12
12
  import { findNavItemByPageId, getRouteNameByPageIndex, getRouteParamsByPage, } from './route.util';
13
- import { hasRTEContent } from '../../brand-page-maker/utils';
13
+ import { hasRTEContent, isTiptapDocument } from '../../brand-page-maker/utils';
14
14
  import { getPageIdFromHref, isHrefPageId, } from '../../brand-page-maker/composables/rich-text-editor/hyperlink';
15
15
  const BUTTON_BORDER_RADIUS = '9999px';
16
16
  const CONTENT_BORDER_RADIUS = '48px';
@@ -863,13 +863,75 @@ const mapPageIdReferencesToRelativePaths = (pages, nav, options) => {
863
863
  });
864
864
  });
865
865
  };
866
+ // Resolve a `pageid:<id>` internal-link href to the published relative path.
867
+ // Returns the resolved href, or null when `href` is not an internal pageid link
868
+ // (external/absolute links are left untouched). Falls back to the site root when
869
+ // the pageid can't be matched to a nav route.
870
+ const resolvePageIdHref = (href, nav, options) => {
871
+ // Only process internal links (no protocol, doesn't start with /)
872
+ if (!href || href.match(/^(https?:\/\/|\/)/) || !isHrefPageId(href)) {
873
+ return null;
874
+ }
875
+ const pageId = getPageIdFromHref(href);
876
+ const route = findNavItemByPageId(nav.navItems, pageId);
877
+ const brandPageSlugRoute = options.brandPageSlug
878
+ ? `/${options.brandPageSlug}`
879
+ : '/';
880
+ if (route) {
881
+ if (route.isRoot) {
882
+ return brandPageSlugRoute;
883
+ }
884
+ return `${brandPageSlugRoute}${brandPageSlugRoute === '/' ? '' : '/'}${route.relativePath}`;
885
+ }
886
+ // fallback to root if pageid cannot be resolved.
887
+ return brandPageSlugRoute;
888
+ };
889
+ // BP-5847: walk a Tiptap JSON doc and rewrite every link mark whose href is a
890
+ // `pageid:` reference into its published relative path. Returns a NEW doc when
891
+ // something changed (so the shared model doc is never mutated), else the same
892
+ // reference.
893
+ export const resolvePageIdsInRteJson = (doc, nav, options) => {
894
+ let changed = false;
895
+ const walk = (node) => {
896
+ if (!node || typeof node !== 'object') {
897
+ return node;
898
+ }
899
+ let next = node;
900
+ if (Array.isArray(node.marks)) {
901
+ const marks = node.marks.map((mark) => {
902
+ if (mark?.type === 'link' && typeof mark.attrs?.href === 'string') {
903
+ const resolved = resolvePageIdHref(mark.attrs.href, nav, options);
904
+ if (resolved !== null) {
905
+ changed = true;
906
+ return { ...mark, attrs: { ...mark.attrs, href: resolved } };
907
+ }
908
+ }
909
+ return mark;
910
+ });
911
+ next = { ...next, marks };
912
+ }
913
+ if (Array.isArray(node.content)) {
914
+ next = { ...next, content: node.content.map(walk) };
915
+ }
916
+ return next;
917
+ };
918
+ const result = walk(doc);
919
+ return changed ? result : doc;
920
+ };
866
921
  const dynamicallyMapPageIdInHyperlinksToRelativePaths = (content, nav, options) => {
867
922
  Object.keys(content).forEach((key) => {
868
923
  const value = content[key];
869
924
  if (value === undefined || value === null) {
870
925
  return;
871
926
  }
872
- if (typeof value === 'object' && (key === 'items' || key === 'textItems')) {
927
+ if (isTiptapDocument(value)) {
928
+ // BP-5847: RTE fields may now be Tiptap JSON. Resolve pageid link marks
929
+ // here too, or internal links render as raw `pageid:` and don't navigate.
930
+ content[key] =
931
+ resolvePageIdsInRteJson(value, nav, options);
932
+ }
933
+ else if (typeof value === 'object' &&
934
+ (key === 'items' || key === 'textItems')) {
873
935
  if (Array.isArray(value)) {
874
936
  value.forEach((item) => {
875
937
  dynamicallyMapPageIdInHyperlinksToRelativePaths(item, nav, options);
@@ -881,24 +943,10 @@ const dynamicallyMapPageIdInHyperlinksToRelativePaths = (content, nav, options)
881
943
  }
882
944
  else if (typeof value === 'string' && hasRTEContent(value)) {
883
945
  content[key] = value.replace(/<a\s+([^>]*?)href="([^"]*?)"([^>]*?)>/gi, (match, existingAttrsStart, href, existingAttrsEnd) => {
884
- // Only process internal links (no protocol, doesn't start with /)
885
- if (href && !href.match(/^(https?:\/\/|\/)/) && isHrefPageId(href)) {
886
- const pageId = getPageIdFromHref(href);
887
- const route = findNavItemByPageId(nav.navItems, pageId);
888
- const brandPageSlugRoute = options.brandPageSlug
889
- ? `/${options.brandPageSlug}`
890
- : '/';
891
- if (route) {
892
- let href = `${brandPageSlugRoute}`;
893
- if (!route.isRoot) {
894
- href = `${brandPageSlugRoute}${brandPageSlugRoute === '/' ? '' : '/'}${route.relativePath}`;
895
- }
896
- return `<a ${existingAttrsStart}href="${href}"${existingAttrsEnd}>`;
897
- }
898
- // fallback to root if pageid cannot be resolved.
899
- return `<a ${existingAttrsStart}href="${brandPageSlugRoute}"${existingAttrsEnd}>`;
900
- }
901
- return match;
946
+ const resolved = resolvePageIdHref(href, nav, options);
947
+ return resolved === null
948
+ ? match
949
+ : `<a ${existingAttrsStart}href="${resolved}"${existingAttrsEnd}>`;
902
950
  });
903
951
  }
904
952
  });
@@ -1,5 +1,5 @@
1
1
  import { isURL, isEmail, isTel } from '@utils/validator.util';
2
- import { YOUTUBE_URL_RE } from '@brand-page-maker/utils';
2
+ import { YOUTUBE_URL_RE, getPlainTextFromRTE } from '@brand-page-maker/utils';
3
3
  import { validatorTr } from '@src/composables/useTranslate';
4
4
  const addressValueValidator = {
5
5
  validate: (name, value) => {
@@ -62,7 +62,12 @@ export const dummyValidator = {
62
62
  };
63
63
  const nonEmptyStringValidator = {
64
64
  validate: (name, value) => {
65
- const isValid = typeof value === 'string' && value.length > 0;
65
+ // BP-5787/BP-5857: `title` fields may now hold Tiptap JSON (an RTE doc)
66
+ // rather than a plain string once switchAllContentToRTE converts them.
67
+ // Validate the visible text either way — a doc with text is "entered",
68
+ // even though `typeof value` is 'object'. getPlainTextFromRTE dual-reads
69
+ // both forms (string → stripped text, JSON → concatenated text).
70
+ const isValid = getPlainTextFromRTE(value).trim().length > 0;
66
71
  return {
67
72
  isValid,
68
73
  message: isValid ? '' : validatorTr(`emptyStringMessage`),
package/lib/src/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as _, a as E, b as s, c as I, d as S, e as N, f as e, B as A, g as O, h as t, i as C, j as G, k as D, l as P, m as R, n as o, o as L, p as M, q as r, r as n, s as b, t as l, u as i, v as c, w as F, x as g, y as B, z as Y, C as U, D as d, E as u, F as H, G as p, H as y, I as m, J as K, K as k, L as V, M as X, N as v, O as h, P as x, Q as f, R as W, S as z, T as w, U as J, V as Z, W as j, X as q, Y as Q, Z as $, $ as aa, a0 as Ta, a1 as _a, a2 as Ea, a3 as sa, a4 as Ia, a5 as Sa, a6 as Na, a7 as ea, a8 as Aa, a9 as Oa, aa as ta, ab as Ca, ac as Ga, ad as Da, ae as Pa, af as Ra, ag as oa, ah as La, ai as Ma, aj as ra, ak as na, al as ba, am as la, an as ia, ao as ca, ap as Fa, aq as ga, ar as Ba, as as Ya, at as Ua, au as da, av as ua, aw as Ha, ax as pa, ay as ya, az as ma, aA as Ka, aB as ka, aC as Va, aD as Xa, aE as va, aF as ha, aG as xa, aH as fa, aI as Wa, aJ as za, aK as wa, aL as Ja, aM as Za, aN as ja, aO as qa, aP as Qa, aQ as $a, aR as aT, aS as TT, aT as _T, aU as ET, aV as sT, aW as IT, aX as ST, aY as NT, aZ as eT, a_ as AT, a$ as OT, b0 as tT, b1 as CT, b2 as GT, b3 as DT, b4 as PT, b5 as RT, b6 as oT, b7 as LT, b8 as MT, b9 as rT, ba as nT, bb as bT, bc as lT, bd as iT, be as cT, bf as FT, bg as gT, bh as BT, bi as YT, bj as UT, bk as dT, bl as uT, bm as HT, bn as pT, bo as yT, bp as mT, bq as KT, br as kT, bs as VT, bt as XT, bu as vT, bv as hT, bw as xT, bx as fT, by as WT, bz as zT, bA as wT, bB as JT, bC as ZT, bD as jT, bE as qT, bF as QT, bG as $T, bH as a_, bI as T_, bJ as __, bK as E_, bL as s_, bM as I_, bN as S_, bO as N_, bP as e_, bQ as A_, bR as O_, bS as t_, bT as C_, bU as G_, bV as D_, bW as P_, bX as R_, bY as o_, bZ as L_, b_ as M_, b$ as r_, c0 as n_, c1 as b_, c2 as l_, c3 as i_, c4 as c_, c5 as F_, c6 as g_, c7 as B_, c8 as Y_, c9 as U_, ca as d_, cb as u_, cc as H_, cd as p_, ce as y_, cf as m_, cg as K_, ch as k_, ci as V_, cj as X_, ck as v_, cl as h_, cm as x_, cn as f_, co as W_, cp as z_, cq as w_, cr as J_, cs as Z_, ct as j_, cu as q_, cv as Q_, cw as $_, cx as aE, cy as TE, cz as _E } from "./lib-BWEaceMZ.js";
1
+ import { A as _, a as E, b as s, c as I, d as S, e as N, f as e, B as A, g as O, h as t, i as C, j as G, k as D, l as P, m as R, n as o, o as L, p as M, q as r, r as n, s as b, t as l, u as i, v as c, w as F, x as g, y as B, z as Y, C as U, D as d, E as u, F as H, G as p, H as y, I as m, J as K, K as k, L as V, M as X, N as v, O as h, P as x, Q as f, R as W, S as z, T as w, U as J, V as Z, W as j, X as q, Y as Q, Z as $, $ as aa, a0 as Ta, a1 as _a, a2 as Ea, a3 as sa, a4 as Ia, a5 as Sa, a6 as Na, a7 as ea, a8 as Aa, a9 as Oa, aa as ta, ab as Ca, ac as Ga, ad as Da, ae as Pa, af as Ra, ag as oa, ah as La, ai as Ma, aj as ra, ak as na, al as ba, am as la, an as ia, ao as ca, ap as Fa, aq as ga, ar as Ba, as as Ya, at as Ua, au as da, av as ua, aw as Ha, ax as pa, ay as ya, az as ma, aA as Ka, aB as ka, aC as Va, aD as Xa, aE as va, aF as ha, aG as xa, aH as fa, aI as Wa, aJ as za, aK as wa, aL as Ja, aM as Za, aN as ja, aO as qa, aP as Qa, aQ as $a, aR as aT, aS as TT, aT as _T, aU as ET, aV as sT, aW as IT, aX as ST, aY as NT, aZ as eT, a_ as AT, a$ as OT, b0 as tT, b1 as CT, b2 as GT, b3 as DT, b4 as PT, b5 as RT, b6 as oT, b7 as LT, b8 as MT, b9 as rT, ba as nT, bb as bT, bc as lT, bd as iT, be as cT, bf as FT, bg as gT, bh as BT, bi as YT, bj as UT, bk as dT, bl as uT, bm as HT, bn as pT, bo as yT, bp as mT, bq as KT, br as kT, bs as VT, bt as XT, bu as vT, bv as hT, bw as xT, bx as fT, by as WT, bz as zT, bA as wT, bB as JT, bC as ZT, bD as jT, bE as qT, bF as QT, bG as $T, bH as a_, bI as T_, bJ as __, bK as E_, bL as s_, bM as I_, bN as S_, bO as N_, bP as e_, bQ as A_, bR as O_, bS as t_, bT as C_, bU as G_, bV as D_, bW as P_, bX as R_, bY as o_, bZ as L_, b_ as M_, b$ as r_, c0 as n_, c1 as b_, c2 as l_, c3 as i_, c4 as c_, c5 as F_, c6 as g_, c7 as B_, c8 as Y_, c9 as U_, ca as d_, cb as u_, cc as H_, cd as p_, ce as y_, cf as m_, cg as K_, ch as k_, ci as V_, cj as X_, ck as v_, cl as h_, cm as x_, cn as f_, co as W_, cp as z_, cq as w_, cr as J_, cs as Z_, ct as j_, cu as q_, cv as Q_, cw as $_, cx as aE, cy as TE, cz as _E } from "./lib-BXP4Pl2X.js";
2
2
  import { createPinia as sE, setActivePinia as IE } from "pinia";
3
3
  export {
4
4
  _ as ABOUT_SECTION_SETTINGS_CONFIG,