@designcrowd/library.brand-page 5.16.18-save-11 → 5.16.18-save-12

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 (19) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-BnCBBUAU.js → CreatedOnBrandCrowd-de-de-Dry5w_lm.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-Cd84LFVB.js → CreatedOnBrandCrowd-en-us-B_2-Z9JM.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-Dtam7rai.js → CreatedOnBrandCrowd-es-es-DEC2zAb7.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-Dw9u0-G7.js → CreatedOnBrandCrowd-fr-ca-JXDU_Ivx.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-Dw9u0-G7.js → CreatedOnBrandCrowd-fr-fr-JXDU_Ivx.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-B-0KDswd.js → CreatedOnBrandCrowd-pt-br-CIdGNStL.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-B-0KDswd.js → CreatedOnBrandCrowd-pt-pt-CIdGNStL.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-yGgwRq4a.js → CreatedOnDcom-de-de-BrOqZZm9.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-ZWnWX3xW.js → CreatedOnDcom-en-us-BDvrthsu.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-B2oGPEkl.js → CreatedOnDcom-es-es-B8cZRukY.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-DnPcEIlS.js → CreatedOnDcom-fr-ca-DiapqRdA.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-BBdVcHWG.js → CreatedOnDcom-fr-fr-BgJzV4_P.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-LLYijvWl.js → CreatedOnDcom-pt-br-S4LmApIA.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-C1TCL-oO.js → CreatedOnDcom-pt-pt-DEUvSqZI.js} +1 -1
  15. package/lib/src/brand-page/utils/vcard.util.js +41 -24
  16. package/lib/src/index.mjs +1 -1
  17. package/lib/src/{lib-CAOZ-qJ5.js → lib-de5rdKi0.js} +2020 -2015
  18. package/package.json +1 -1
  19. package/src/brand-page/utils/vcard.util.ts +58 -20
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-CAOZ-qJ5.js";
2
+ import { _ as t } from "./lib-de5rdKi0.js";
3
3
  const i = {}, h = {
4
4
  width: "275",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-CAOZ-qJ5.js";
2
+ import { _ as t } from "./lib-de5rdKi0.js";
3
3
  const i = {}, h = {
4
4
  width: "251",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-CAOZ-qJ5.js";
2
+ import { _ as t } from "./lib-de5rdKi0.js";
3
3
  const i = {}, h = {
4
4
  width: "250",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-CAOZ-qJ5.js";
2
+ import { _ as t } from "./lib-de5rdKi0.js";
3
3
  const i = {}, h = {
4
4
  width: "237",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-CAOZ-qJ5.js";
2
+ import { _ as t } from "./lib-de5rdKi0.js";
3
3
  const i = {}, h = {
4
4
  width: "237",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-CAOZ-qJ5.js";
2
+ import { _ as t } from "./lib-de5rdKi0.js";
3
3
  const i = {}, h = {
4
4
  width: "263",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-CAOZ-qJ5.js";
2
+ import { _ as t } from "./lib-de5rdKi0.js";
3
3
  const i = {}, h = {
4
4
  width: "263",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-CAOZ-qJ5.js";
2
+ import { _ as e } from "./lib-de5rdKi0.js";
3
3
  const M = {}, Z = {
4
4
  width: "242",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-CAOZ-qJ5.js";
2
+ import { _ as e } from "./lib-de5rdKi0.js";
3
3
  const i = {}, M = {
4
4
  width: "231",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-CAOZ-qJ5.js";
2
+ import { _ as e } from "./lib-de5rdKi0.js";
3
3
  const M = {}, Z = {
4
4
  width: "230",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-CAOZ-qJ5.js";
2
+ import { _ as e } from "./lib-de5rdKi0.js";
3
3
  const i = {}, l = {
4
4
  width: "216",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-CAOZ-qJ5.js";
2
+ import { _ as e } from "./lib-de5rdKi0.js";
3
3
  const i = {}, l = {
4
4
  width: "216",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as M } from "./lib-CAOZ-qJ5.js";
2
+ import { _ as M } from "./lib-de5rdKi0.js";
3
3
  const Z = {}, e = {
4
4
  width: "232",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as M } from "./lib-CAOZ-qJ5.js";
2
+ import { _ as M } from "./lib-de5rdKi0.js";
3
3
  const Z = {}, e = {
4
4
  width: "232",
5
5
  height: "36",
@@ -1,4 +1,5 @@
1
1
  import { isValidUrl } from '../../helpers/url.helper';
2
+ import { getPlainTextFromRTE } from '../../brand-page-maker/utils/rich-text-editor.util';
2
3
  // Constants
3
4
  const HTML_ENTITIES = {
4
5
  ' ': ' ',
@@ -22,7 +23,8 @@ const SOCIAL_TYPE_MAP = {
22
23
  const sanitizeForVCard = (value) => {
23
24
  if (!value || typeof value !== 'string')
24
25
  return '';
25
- let text = value.replace(/<[^>]*>/g, ''); // Strip HTML tags
26
+ // Strip HTML tags (handles rich text editor content)
27
+ let text = getPlainTextFromRTE(value);
26
28
  // Decode HTML entities
27
29
  Object.entries(HTML_ENTITIES).forEach(([entity, char]) => {
28
30
  text = text.replace(new RegExp(entity, 'g'), char);
@@ -64,50 +66,62 @@ export const findProfileContent = (brandPageData) => {
64
66
  };
65
67
  export const hasProfileContent = (brandPageData) => findProfileContent(brandPageData) !== undefined;
66
68
  // vCard Entry Handlers
67
- const addPhoneEntry = (phoneNumber, vcardLines) => {
69
+ const addPhoneEntry = (phoneNumber, vcardLines, addedEntries) => {
68
70
  const cleaned = phoneNumber.replace(/[^\d+]/g, '');
69
- vcardLines.push(`TEL;TYPE=CELL:${cleaned}`);
71
+ const key = `phone:${cleaned}`;
72
+ if (!addedEntries.has(key)) {
73
+ vcardLines.push(`TEL;TYPE=CELL:${cleaned}`);
74
+ addedEntries.add(key);
75
+ }
70
76
  };
71
- const addEmailEntry = (email, vcardLines) => {
72
- vcardLines.push(`EMAIL:${email}`, `EMAIL;TYPE=WORK:${email}`);
77
+ const addEmailEntry = (email, vcardLines, addedEntries) => {
78
+ const key = `email:${email.toLowerCase()}`;
79
+ if (!addedEntries.has(key)) {
80
+ vcardLines.push(`EMAIL:${email}`);
81
+ addedEntries.add(key);
82
+ }
73
83
  };
74
- const addUrlEntry = (url, type, vcardLines) => {
84
+ const addUrlEntry = (url, type, vcardLines, addedEntries) => {
75
85
  const formatted = normalizeUrl(url);
76
86
  // Skip invalid URLs
77
87
  if (!formatted)
78
88
  return;
79
- if (type) {
80
- vcardLines.push(`URL;TYPE=${type}:${formatted}`);
81
- }
82
- else {
83
- vcardLines.push(`URL:${formatted}`);
89
+ const key = `url:${formatted.toLowerCase()}`;
90
+ if (!addedEntries.has(key)) {
91
+ if (type) {
92
+ vcardLines.push(`URL;TYPE=${type}:${formatted}`);
93
+ }
94
+ else {
95
+ vcardLines.push(`URL:${formatted}`);
96
+ }
97
+ addedEntries.add(key);
84
98
  }
85
99
  };
86
- const processContactUrl = (url, iconType, vcardLines) => {
100
+ const processContactUrl = (url, iconType, vcardLines, addedEntries) => {
87
101
  if (url.startsWith('tel:')) {
88
- addPhoneEntry(url.replace('tel:', ''), vcardLines);
102
+ addPhoneEntry(url.replace('tel:', ''), vcardLines, addedEntries);
89
103
  }
90
104
  else if (url.startsWith('mailto:')) {
91
- addEmailEntry(url.replace('mailto:', ''), vcardLines);
105
+ addEmailEntry(url.replace('mailto:', ''), vcardLines, addedEntries);
92
106
  }
93
107
  else if (iconType === 'email') {
94
- addEmailEntry(url, vcardLines);
108
+ addEmailEntry(url, vcardLines, addedEntries);
95
109
  }
96
110
  else if (iconType === 'phone') {
97
- addPhoneEntry(url, vcardLines);
111
+ addPhoneEntry(url, vcardLines, addedEntries);
98
112
  }
99
113
  else {
100
- addUrlEntry(url, SOCIAL_TYPE_MAP[iconType], vcardLines);
114
+ addUrlEntry(url, SOCIAL_TYPE_MAP[iconType], vcardLines, addedEntries);
101
115
  }
102
116
  };
103
- const processButton = (button, vcardLines) => {
117
+ const processButton = (button, vcardLines, addedEntries) => {
104
118
  if (!button.url)
105
119
  return;
106
120
  const url = button.url.trim();
107
121
  const iconType = button.iconUrl?.toLowerCase() || '';
108
- processContactUrl(url, iconType, vcardLines);
122
+ processContactUrl(url, iconType, vcardLines, addedEntries);
109
123
  };
110
- const processSocialLinks = (socialLinksContent, vcardLines) => {
124
+ const processSocialLinks = (socialLinksContent, vcardLines, addedEntries) => {
111
125
  if (!socialLinksContent.links?.length)
112
126
  return;
113
127
  socialLinksContent.links.forEach((link) => {
@@ -115,7 +129,7 @@ const processSocialLinks = (socialLinksContent, vcardLines) => {
115
129
  return;
116
130
  const url = link.url.trim();
117
131
  const platform = link.imageUrl?.toLowerCase() || '';
118
- processContactUrl(url, platform, vcardLines);
132
+ processContactUrl(url, platform, vcardLines, addedEntries);
119
133
  });
120
134
  };
121
135
  const addProfileInfo = (profile, vcardLines) => {
@@ -137,21 +151,24 @@ const addProfileInfo = (profile, vcardLines) => {
137
151
  // Main Functions
138
152
  export const generateVCard = (brandPageData) => {
139
153
  const vcardLines = ['BEGIN:VCARD', 'VERSION:3.0'];
154
+ const addedEntries = new Set();
140
155
  const profile = findProfileContent(brandPageData);
141
156
  if (profile) {
142
157
  addProfileInfo(profile, vcardLines);
143
158
  }
144
159
  const buttons = findContentsByType(brandPageData, 'button');
145
- buttons.forEach((button) => processButton(button, vcardLines));
160
+ buttons.forEach((button) => processButton(button, vcardLines, addedEntries));
146
161
  const socialLinks = findContentsByType(brandPageData, 'social-links');
147
- socialLinks.forEach((links) => processSocialLinks(links, vcardLines));
162
+ socialLinks.forEach((links) => processSocialLinks(links, vcardLines, addedEntries));
148
163
  vcardLines.push('END:VCARD');
149
164
  return vcardLines.join('\r\n');
150
165
  };
151
166
  const generateVCardFilename = (name) => {
152
167
  if (!name)
153
168
  return 'contact.vcf';
154
- const safeName = name
169
+ // Strip HTML tags first
170
+ const plainName = getPlainTextFromRTE(name);
171
+ const safeName = plainName
155
172
  .replace(/[^a-z0-9]/gi, '_')
156
173
  .toLowerCase()
157
174
  .slice(0, 50);
package/lib/src/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { bD as E, ar as T, aU as I, a5 as s, aj as N, ai as S, af as A, bt as e, bK as O, cb as G, ca as C, c9 as D, c3 as P, b2 as t, b1 as R, bP as L, bQ as M, bX as o, bM as b, bO as r, bN as F, bR as n, bS as B, c2 as i, c0 as l, aq as g, c1 as Y, a8 as U, aZ as c, a$ as d, a_ as u, e as H, f as y, B as p, $ as K, d as V, a0 as k, j as X, an as m, Z as v, bs as h, bL as W, ay as x, aW as f, aS as z, b_ as Z, bZ as w, C as Q, b5 as j, D as q, b as J, a as $, bV as aa, b4 as _a, aX as Ea, aT as Ta, c7 as Ia, c8 as sa, bY as Na, bH as Sa, ad as Aa, b$ as ea, c4 as Oa, ba as Ga, aK as Ca, bg as Da, F as Pa, a7 as ta, a6 as Ra, h as La, a1 as Ma, b7 as oa, aV as ba, aR as ra, a3 as Fa, ak as na, l as Ba, K as ia, H as la, a9 as ga, bE as Ya, bb as Ua, bc as ca, bC as da, bi as ua, bk as Ha, b6 as ya, L as pa, aJ as Ka, bp as Va, aP as ka, bo as Xa, as as ma, ab as va, bW as ha, c5 as Wa, c6 as xa, aY as fa, N as za, aB as Za, aA as wa, aC as Qa, aw as ja, ax as qa, az as Ja, be as $a, bl as a_, b8 as __, o as E_, al as T_, am as I_, ag as s_, ah as N_, ae as S_, a4 as A_, m as e_, bq as O_, ap as G_, bI as C_, bJ as D_, bU as P_, ac as t_, bG as R_, br as L_, n as M_, S as o_, P as b_, aI as r_, bF as F_, bf as n_, bx as B_, bw as i_, bz as l_, bu as g_, bA as Y_, bB as U_, bv as c_, by as d_, aD as u_, aE as H_, bn as y_, bm as p_, aG as K_, aH as V_, aM as k_, b0 as X_, aL as m_, aN as v_, U as h_, aa as W_, aQ as x_, k as f_, bd as z_, ao as Z_, b9 as w_, bh as Q_, bj as j_, b3 as q_, Q as J_, a2 as $_, g as aE, bT as _E, r as EE, u as TE, M as IE, Y as sE, aF as NE, aO as SE, au as AE, p as eE, W as OE, t as GE, w as CE, at as DE, i as PE, av as tE, c as RE, q as LE, v as ME, V as oE, O as bE, s as rE, X as FE, A as nE, x as BE, y as iE, T as lE, E as gE, R as YE, G as UE, J as cE, z as dE, I as uE } from "./lib-CAOZ-qJ5.js";
1
+ import { bD as E, ar as T, aU as I, a5 as s, aj as N, ai as S, af as A, bt as e, bK as O, cb as G, ca as C, c9 as D, c3 as P, b2 as t, b1 as R, bP as L, bQ as M, bX as o, bM as b, bO as r, bN as F, bR as n, bS as B, c2 as i, c0 as l, aq as g, c1 as Y, a8 as U, aZ as c, a$ as d, a_ as u, e as H, f as y, B as p, $ as K, d as V, a0 as k, j as X, an as m, Z as v, bs as h, bL as W, ay as x, aW as f, aS as z, b_ as Z, bZ as w, C as Q, b5 as j, D as q, b as J, a as $, bV as aa, b4 as _a, aX as Ea, aT as Ta, c7 as Ia, c8 as sa, bY as Na, bH as Sa, ad as Aa, b$ as ea, c4 as Oa, ba as Ga, aK as Ca, bg as Da, F as Pa, a7 as ta, a6 as Ra, h as La, a1 as Ma, b7 as oa, aV as ba, aR as ra, a3 as Fa, ak as na, l as Ba, K as ia, H as la, a9 as ga, bE as Ya, bb as Ua, bc as ca, bC as da, bi as ua, bk as Ha, b6 as ya, L as pa, aJ as Ka, bp as Va, aP as ka, bo as Xa, as as ma, ab as va, bW as ha, c5 as Wa, c6 as xa, aY as fa, N as za, aB as Za, aA as wa, aC as Qa, aw as ja, ax as qa, az as Ja, be as $a, bl as a_, b8 as __, o as E_, al as T_, am as I_, ag as s_, ah as N_, ae as S_, a4 as A_, m as e_, bq as O_, ap as G_, bI as C_, bJ as D_, bU as P_, ac as t_, bG as R_, br as L_, n as M_, S as o_, P as b_, aI as r_, bF as F_, bf as n_, bx as B_, bw as i_, bz as l_, bu as g_, bA as Y_, bB as U_, bv as c_, by as d_, aD as u_, aE as H_, bn as y_, bm as p_, aG as K_, aH as V_, aM as k_, b0 as X_, aL as m_, aN as v_, U as h_, aa as W_, aQ as x_, k as f_, bd as z_, ao as Z_, b9 as w_, bh as Q_, bj as j_, b3 as q_, Q as J_, a2 as $_, g as aE, bT as _E, r as EE, u as TE, M as IE, Y as sE, aF as NE, aO as SE, au as AE, p as eE, W as OE, t as GE, w as CE, at as DE, i as PE, av as tE, c as RE, q as LE, v as ME, V as oE, O as bE, s as rE, X as FE, A as nE, x as BE, y as iE, T as lE, E as gE, R as YE, G as UE, J as cE, z as dE, I as uE } from "./lib-de5rdKi0.js";
2
2
  import { createPinia as yE, setActivePinia as pE } from "pinia";
3
3
  export {
4
4
  E as ABOUT_SECTION_SETTINGS_CONFIG,