@wix/editor-react-components 1.2225.0 → 1.2226.0
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/dist/site/components/AnimatedIcon/component.js +2 -2
- package/dist/site/components/AudioPlayer/component.js +2 -2
- package/dist/site/components/BoxContainer/component.js +2 -2
- package/dist/site/components/Breadcrumbs/component.js +7 -19
- package/dist/site/components/CollapsibleText/component.js +2 -2
- package/dist/site/components/GoogleMap/component.js +2 -2
- package/dist/site/components/HTMLComponent/component.js +8 -18
- package/dist/site/components/HipaaIcon/component.js +4 -5
- package/dist/site/components/Line/component.js +2 -2
- package/dist/site/components/LinkBar/component.js +2 -2
- package/dist/site/components/Lottie/component.js +2 -2
- package/dist/site/components/Menu/component.js +11 -33
- package/dist/site/components/Menu/sdk.js +2 -756
- package/dist/site/components/ShareButtons/component.js +4 -4
- package/dist/site/components/Slideshow/component.js +2 -2
- package/dist/site/components/SlotsPlaceholder/component.js +2 -2
- package/dist/site/components/Tabs/component.js +2 -2
- package/dist/site/components/TextInput/component.js +12 -25
- package/dist/site/components/TextInput/sdk.js +3 -4
- package/dist/site/components/VideoUpload/component.js +2 -2
- package/dist/site/components/WRichText/sdk.js +2 -3
- package/dist/site/components/chunks/index.js +3 -52
- package/dist/site/components/chunks/index10.js +3 -52
- package/dist/site/components/chunks/index2.js +3 -3
- package/dist/site/components/chunks/index5.js +3 -14
- package/dist/site/components/chunks/index6.js +3 -13
- package/dist/site/components/chunks/index7.js +3 -21
- package/dist/site/components/chunks/staticService.js +5 -0
- package/dist/site/components/chunks/useConsentPolicyProps.js +7 -58
- package/package.json +13 -13
- package/dist/site/components/chunks/index11.js +0 -16
- package/dist/site/components/chunks/index12.js +0 -6
|
@@ -2,9 +2,8 @@ import { c as createA11ySdk } from "../chunks/a11ySdk.js";
|
|
|
2
2
|
import { i as isNil, h as isDate, l as isObject, k as isArray } from "../chunks/assert.js";
|
|
3
3
|
import { b as registerCorvidMouseEvent } from "../chunks/corvidEvents.js";
|
|
4
4
|
import { c as composeSDKFactories } from "../chunks/composeSDKFactories.js";
|
|
5
|
-
import { r as requireDefinition$1 } from "../chunks/index.js";
|
|
6
|
-
import { r as requireDefinition } from "../chunks/index10.js";
|
|
7
5
|
import { v as validateMenuItems, c as createMenuDataItem } from "../chunks/utils2.js";
|
|
6
|
+
import { L as LinkUtilsDefinition } from "../chunks/index.js";
|
|
8
7
|
const sanitizeItem = (item) => Object.entries(item).reduce((acc, [key, value]) => {
|
|
9
8
|
if (isNil(value)) {
|
|
10
9
|
return acc;
|
|
@@ -49,762 +48,9 @@ const transformSdkDataToPropData = (sdkMenuItem) => {
|
|
|
49
48
|
items: (_a = sdkMenuItem.menuItems) == null ? void 0 : _a.map(transformSdkDataToPropData)
|
|
50
49
|
});
|
|
51
50
|
};
|
|
52
|
-
var dist = {};
|
|
53
|
-
var externalLinkUtils = {};
|
|
54
|
-
var sharedLinkUtils = {};
|
|
55
|
-
var links = {};
|
|
56
|
-
var linkPatternUtils = {};
|
|
57
|
-
var hasRequiredLinkPatternUtils;
|
|
58
|
-
function requireLinkPatternUtils() {
|
|
59
|
-
if (hasRequiredLinkPatternUtils) return linkPatternUtils;
|
|
60
|
-
hasRequiredLinkPatternUtils = 1;
|
|
61
|
-
(function(exports$1) {
|
|
62
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
63
|
-
exports$1.isScrollTopOrBottomAnchor = exports$1.isSamePageAnchorUrl = exports$1.isPageUrl = exports$1.isAbsoluteUrl = exports$1.isDocumentUrl = exports$1.isMailtoUrl = exports$1.isWhatsappLink = exports$1.isPhoneUrl = exports$1.LEGACY_DOCUMENT_URL_REGEXP = exports$1.DOCUMENT_URL_REGEXP = exports$1.ABSOLUTE_URL_REGEXP = exports$1.SAME_PAGE_WITH_ANCHOR_REGEXP = exports$1.PAGE_URL_REGEXP = exports$1.WHATSAPP_LINK_PREFIX = exports$1.PHONE_URL_REGEXP = exports$1.MAILTO_URL_REGEXP = void 0;
|
|
64
|
-
exports$1.MAILTO_URL_REGEXP = /mailto:([^?]+)(\?(.*))?/;
|
|
65
|
-
exports$1.PHONE_URL_REGEXP = /^tel:(.*)/;
|
|
66
|
-
exports$1.WHATSAPP_LINK_PREFIX = `https://api.whatsapp.com/send?phone=`;
|
|
67
|
-
exports$1.PAGE_URL_REGEXP = /^\/([^?#]*)?[#]?([^?#]*)[?]?(.*)/;
|
|
68
|
-
exports$1.SAME_PAGE_WITH_ANCHOR_REGEXP = /^#([^?]*)[?]?(.*)/;
|
|
69
|
-
exports$1.ABSOLUTE_URL_REGEXP = /^(http|https):\/\/(.*)/;
|
|
70
|
-
exports$1.DOCUMENT_URL_REGEXP = /^wix:document:\/\/v1\/(.+)\/(.+)/;
|
|
71
|
-
exports$1.LEGACY_DOCUMENT_URL_REGEXP = /^document:\/\/(.*)/;
|
|
72
|
-
const isPhoneUrl = (url) => exports$1.PHONE_URL_REGEXP.test(url);
|
|
73
|
-
exports$1.isPhoneUrl = isPhoneUrl;
|
|
74
|
-
const isWhatsappLink = (url) => url.startsWith(exports$1.WHATSAPP_LINK_PREFIX);
|
|
75
|
-
exports$1.isWhatsappLink = isWhatsappLink;
|
|
76
|
-
const isMailtoUrl = (url) => exports$1.MAILTO_URL_REGEXP.test(url);
|
|
77
|
-
exports$1.isMailtoUrl = isMailtoUrl;
|
|
78
|
-
const isDocumentUrl = (url) => exports$1.DOCUMENT_URL_REGEXP.test(url) || exports$1.LEGACY_DOCUMENT_URL_REGEXP.test(url);
|
|
79
|
-
exports$1.isDocumentUrl = isDocumentUrl;
|
|
80
|
-
const isAbsoluteUrl = (url) => exports$1.ABSOLUTE_URL_REGEXP.test(url);
|
|
81
|
-
exports$1.isAbsoluteUrl = isAbsoluteUrl;
|
|
82
|
-
const isPageUrl = (href) => exports$1.PAGE_URL_REGEXP.test(href);
|
|
83
|
-
exports$1.isPageUrl = isPageUrl;
|
|
84
|
-
const isSamePageAnchorUrl = (href) => exports$1.SAME_PAGE_WITH_ANCHOR_REGEXP.test(href);
|
|
85
|
-
exports$1.isSamePageAnchorUrl = isSamePageAnchorUrl;
|
|
86
|
-
const isScrollTopOrBottomAnchor = (anchorDataId) => ["SCROLL_TO_TOP", "SCROLL_TO_BOTTOM"].includes(anchorDataId);
|
|
87
|
-
exports$1.isScrollTopOrBottomAnchor = isScrollTopOrBottomAnchor;
|
|
88
|
-
})(linkPatternUtils);
|
|
89
|
-
return linkPatternUtils;
|
|
90
|
-
}
|
|
91
|
-
var hasRequiredLinks;
|
|
92
|
-
function requireLinks() {
|
|
93
|
-
if (hasRequiredLinks) return links;
|
|
94
|
-
hasRequiredLinks = 1;
|
|
95
|
-
(function(exports$1) {
|
|
96
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
97
|
-
exports$1.hasLinkDataWithCurrentRouteAnchors = exports$1.getDocumentLink = exports$1.resolveDocumentLink = exports$1.getBaseUrlFilesPath = exports$1.resolveDynamicPageLink = exports$1.resolveAddressLink = exports$1.resolveWhatsAppLink = exports$1.resolvePhoneLink = exports$1.resolveEmailLink = exports$1.getPostSignupUrl = exports$1.getImpliedLink = exports$1.convertDataQueryLinksToHtmlAnchors = exports$1.toQueryString = exports$1.ALLOWED_FILE_EXTENSIONS_FROM_USER_DOMAIN = exports$1.getDocumentLinkProps = exports$1.replaceUrls = exports$1.replacePhoneNumbers = exports$1.replaceEmails = exports$1.getUrlWithProtocol = exports$1.PatternType = void 0;
|
|
98
|
-
exports$1.findFirstMatch = findFirstMatch;
|
|
99
|
-
exports$1.getImpliedLinks = getImpliedLinks;
|
|
100
|
-
const linkPatternUtils_1 = /* @__PURE__ */ requireLinkPatternUtils();
|
|
101
|
-
const PHONE_NUMBER_PATTERN = /(?:\+|\()?\d(?:[-.() \t\u00a0\u1680\u180e\u2000\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]{0,5}\d){6,16}\)?(?![<@)\w])|\*\d{4}(?![<@)\w])/;
|
|
102
|
-
const PHONE_NUMBER_AS_WORD_PATTERN = /(?:^|[\s:;,<>])(?:\+|\()?\d(?:[-.() \t\u00a0\u1680\u180e\u2000\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]{0,5}\d){6,16}\)?(?![<@)\w])|\*\d{4}(?![<@)\w])/;
|
|
103
|
-
const EMAIL_PATTERN = /(^|[\s:;,<>])([A-Z0-9][A-Z0-9._%+-]+@[A-Z0-9][A-Z0-9.-]+\.[A-Z]{2,})(?=$|[\s:;,<>])/i;
|
|
104
|
-
const URL_PATTERN = /(^|[\s:;,<>])((?:https?:\/\/|www\.)[a-z0-9](?:\.?[a-z0-9\-%_])*(?:(?:\\|\/)[a-z0-9\-._~:/\\?#[\]@!$&'()*+,;=%]*)?)(?=$|[^a-z0-9\-._~:/\\?#[\]@!$&'()*+,;=%])/i;
|
|
105
|
-
const GLOBAL_PHONE_NUMBER_AS_WORD_PATTERN = new RegExp(PHONE_NUMBER_AS_WORD_PATTERN, "g");
|
|
106
|
-
const GLOBAL_EMAIL_PATTERN = /([A-Z0-9][A-Z0-9._%+-]+@[A-Z0-9][A-Z0-9.-]+\.[A-Z]{2,})/gi;
|
|
107
|
-
const GLOBAL_URL_PATTERN = /((?:https?:\/\/|www\.)[a-z0-9](?:\.?[a-z0-9\-%_])*(?:(?:\\|\/)[a-z0-9\-._~:/\\?#[\]@!$&'()*+,;=%]*)?)/gi;
|
|
108
|
-
exports$1.PatternType = {
|
|
109
|
-
PHONE: "PHONE",
|
|
110
|
-
MAIL: "MAIL",
|
|
111
|
-
URL: "URL"
|
|
112
|
-
};
|
|
113
|
-
const findPhoneNumber = (text) => {
|
|
114
|
-
const matching = text.match(PHONE_NUMBER_PATTERN);
|
|
115
|
-
return matching && {
|
|
116
|
-
key: matching[0],
|
|
117
|
-
value: matching[0].match(/[*\d]/g).join(""),
|
|
118
|
-
index: matching.index,
|
|
119
|
-
pattern: exports$1.PatternType.PHONE
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
const findEmail = (text) => {
|
|
123
|
-
const matching = text.match(EMAIL_PATTERN);
|
|
124
|
-
if (matching) {
|
|
125
|
-
const prefixSize = matching[1].length;
|
|
126
|
-
const mainCapture = matching[2];
|
|
127
|
-
return {
|
|
128
|
-
key: mainCapture,
|
|
129
|
-
value: mainCapture,
|
|
130
|
-
index: matching.index + prefixSize,
|
|
131
|
-
pattern: exports$1.PatternType.MAIL
|
|
132
|
-
};
|
|
133
|
-
} else {
|
|
134
|
-
return null;
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
const getUrlWithProtocol = (url) => {
|
|
138
|
-
const beginsWithHttp = url.toLowerCase().indexOf("http") === 0;
|
|
139
|
-
return beginsWithHttp ? url : `http://${url}`;
|
|
140
|
-
};
|
|
141
|
-
exports$1.getUrlWithProtocol = getUrlWithProtocol;
|
|
142
|
-
const findUrl = (text) => {
|
|
143
|
-
const matching = text.match(URL_PATTERN);
|
|
144
|
-
if (matching) {
|
|
145
|
-
const mainCapture = matching[2];
|
|
146
|
-
const prefixSize = matching[1].length;
|
|
147
|
-
const value = (0, exports$1.getUrlWithProtocol)(mainCapture);
|
|
148
|
-
return {
|
|
149
|
-
key: mainCapture,
|
|
150
|
-
value,
|
|
151
|
-
index: matching.index + prefixSize,
|
|
152
|
-
pattern: exports$1.PatternType.URL
|
|
153
|
-
};
|
|
154
|
-
} else {
|
|
155
|
-
return null;
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
const replaceEmails = (str, replacer) => str.replace(GLOBAL_EMAIL_PATTERN, replacer);
|
|
159
|
-
exports$1.replaceEmails = replaceEmails;
|
|
160
|
-
const possiblePrefixes = [" ", ":", ";", ",", "<", ">"];
|
|
161
|
-
const replacePhoneNumbers = (str, replacer) => {
|
|
162
|
-
return str.replace(GLOBAL_PHONE_NUMBER_AS_WORD_PATTERN, (match) => {
|
|
163
|
-
const prefix = possiblePrefixes.find((i) => i === match[0]);
|
|
164
|
-
return prefix ? prefix + replacer(match.substring(1, match.length)) : replacer(match);
|
|
165
|
-
});
|
|
166
|
-
};
|
|
167
|
-
exports$1.replacePhoneNumbers = replacePhoneNumbers;
|
|
168
|
-
const replaceUrls = (str, replacer) => str.replace(GLOBAL_URL_PATTERN, replacer);
|
|
169
|
-
exports$1.replaceUrls = replaceUrls;
|
|
170
|
-
const patternToMatchingFunc = {
|
|
171
|
-
[exports$1.PatternType.PHONE]: findPhoneNumber,
|
|
172
|
-
[exports$1.PatternType.MAIL]: findEmail,
|
|
173
|
-
[exports$1.PatternType.URL]: findUrl
|
|
174
|
-
};
|
|
175
|
-
function findFirstMatch(text, patterns = {}) {
|
|
176
|
-
if (!text) {
|
|
177
|
-
return null;
|
|
178
|
-
}
|
|
179
|
-
const matches = Object.keys(patterns).filter((key) => patterns[key]).map((key) => patternToMatchingFunc[key](text)).filter((value) => value !== null);
|
|
180
|
-
const firstMatch = matches[0] ? matches.reduce((prev, curr) => {
|
|
181
|
-
return curr.index < prev.index ? curr : prev;
|
|
182
|
-
}, matches[0]) : null;
|
|
183
|
-
return firstMatch;
|
|
184
|
-
}
|
|
185
|
-
const getDocumentLinkProps = (documentUrl, metaSiteId, userFileDomainUrl = "filesusr.com/", externalBaseUrl = "", isPremiumDomain = false, isResolveDocumentLinkEnabled = false) => {
|
|
186
|
-
const [, docId, name] = linkPatternUtils_1.DOCUMENT_URL_REGEXP.exec(documentUrl) || linkPatternUtils_1.LEGACY_DOCUMENT_URL_REGEXP.exec(documentUrl);
|
|
187
|
-
return {
|
|
188
|
-
type: "DocumentLink",
|
|
189
|
-
href: (0, exports$1.resolveDocumentLink)({ docId, name: name || "", indexable: false }, metaSiteId, userFileDomainUrl, externalBaseUrl, isPremiumDomain, isResolveDocumentLinkEnabled),
|
|
190
|
-
target: "_blank",
|
|
191
|
-
docInfo: {
|
|
192
|
-
docId,
|
|
193
|
-
name
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
};
|
|
197
|
-
exports$1.getDocumentLinkProps = getDocumentLinkProps;
|
|
198
|
-
exports$1.ALLOWED_FILE_EXTENSIONS_FROM_USER_DOMAIN = [
|
|
199
|
-
"pdf",
|
|
200
|
-
"docx",
|
|
201
|
-
"zip",
|
|
202
|
-
"pptx",
|
|
203
|
-
"xlsx",
|
|
204
|
-
"doc",
|
|
205
|
-
"txt",
|
|
206
|
-
"rar",
|
|
207
|
-
"xls",
|
|
208
|
-
"ppt",
|
|
209
|
-
"ppsx",
|
|
210
|
-
"epub",
|
|
211
|
-
"rtf",
|
|
212
|
-
"pub",
|
|
213
|
-
"vcf",
|
|
214
|
-
"csv"
|
|
215
|
-
];
|
|
216
|
-
const PatternToPrefix = {
|
|
217
|
-
[exports$1.PatternType.PHONE]: "tel:",
|
|
218
|
-
[exports$1.PatternType.MAIL]: "mailto:",
|
|
219
|
-
[exports$1.PatternType.URL]: ""
|
|
220
|
-
};
|
|
221
|
-
const parseLinkValue = ({ pattern, value }) => {
|
|
222
|
-
const baseLinkProps = pattern === exports$1.PatternType.URL ? { target: "_blank" } : {};
|
|
223
|
-
return { ...baseLinkProps, href: `${PatternToPrefix[pattern]}${value}` };
|
|
224
|
-
};
|
|
225
|
-
const getPropertyName = (key) => {
|
|
226
|
-
switch (key) {
|
|
227
|
-
case "linkPopupId":
|
|
228
|
-
return "data-popupid";
|
|
229
|
-
case "anchorDataId":
|
|
230
|
-
return "data-anchor";
|
|
231
|
-
case "anchorCompId":
|
|
232
|
-
return "data-anchor-comp-id";
|
|
233
|
-
default:
|
|
234
|
-
return key;
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
const toQueryString = (queryObject) => Object.keys(queryObject).map((key) => `${key}=${encodeURIComponent(queryObject[key])}`).join("&");
|
|
238
|
-
exports$1.toQueryString = toQueryString;
|
|
239
|
-
const getLinkAttributes = (linkProps) => {
|
|
240
|
-
if (linkProps) {
|
|
241
|
-
if (linkProps.linkPopupId) {
|
|
242
|
-
linkProps.role = "button";
|
|
243
|
-
linkProps["aria-haspopup"] = "dialog";
|
|
244
|
-
linkProps.tabindex = "0";
|
|
245
|
-
delete linkProps.href;
|
|
246
|
-
}
|
|
247
|
-
return Object.keys(linkProps).map((key) => `${getPropertyName(key)}="${linkProps[key]}"`).join(" ");
|
|
248
|
-
}
|
|
249
|
-
return "";
|
|
250
|
-
};
|
|
251
|
-
const joinAttributesParts = (attributesParts) => attributesParts.filter((attributesPart) => attributesPart !== "").map((attributesPart) => attributesPart.trim()).join(" ");
|
|
252
|
-
const convertDataQueryLinksToHtmlAnchors = (text, linkList) => text.replace(/<a ([^>]*)dataquery="#([^"]+)"([^>]*)>/g, (_full, preAttributes, dataQuery, postAttributes) => {
|
|
253
|
-
const linkProps = linkList[dataQuery];
|
|
254
|
-
const fixedAttributes = joinAttributesParts([preAttributes, getLinkAttributes(linkProps), postAttributes]);
|
|
255
|
-
return `<a${fixedAttributes ? ` ${fixedAttributes}` : ""}>`;
|
|
256
|
-
});
|
|
257
|
-
exports$1.convertDataQueryLinksToHtmlAnchors = convertDataQueryLinksToHtmlAnchors;
|
|
258
|
-
const getImpliedLink = (text, isMobileView) => {
|
|
259
|
-
const firstMatch = findFirstMatch(text, { MAIL: true, URL: true, PHONE: isMobileView });
|
|
260
|
-
return firstMatch && parseLinkValue(firstMatch);
|
|
261
|
-
};
|
|
262
|
-
exports$1.getImpliedLink = getImpliedLink;
|
|
263
|
-
const getLinkWrapperFunction = (type) => (content) => {
|
|
264
|
-
let aTagContent = "";
|
|
265
|
-
const href = content.trim();
|
|
266
|
-
switch (type) {
|
|
267
|
-
case "email":
|
|
268
|
-
aTagContent = `href="mailto:${href}"`;
|
|
269
|
-
break;
|
|
270
|
-
case "phone":
|
|
271
|
-
aTagContent = `href="tel:${href}"`;
|
|
272
|
-
break;
|
|
273
|
-
case "url":
|
|
274
|
-
aTagContent = `href="${(0, exports$1.getUrlWithProtocol)(href)}" target="_blank"`;
|
|
275
|
-
break;
|
|
276
|
-
}
|
|
277
|
-
return `<a data-auto-recognition="true" ${aTagContent}>${content}</a>`;
|
|
278
|
-
};
|
|
279
|
-
const wrapEmailImpliedLink = getLinkWrapperFunction("email");
|
|
280
|
-
const wrapUrlImpliedLink = getLinkWrapperFunction("url");
|
|
281
|
-
const wrapPhoneImpliedLink = getLinkWrapperFunction("phone");
|
|
282
|
-
const getTextLinkMatcher = (isMobileView, parseEscaped) => (fullMatch, text) => {
|
|
283
|
-
if (!text || !parseEscaped && text.startsWith("<")) {
|
|
284
|
-
return fullMatch;
|
|
285
|
-
}
|
|
286
|
-
let textWithLinks = (0, exports$1.replaceEmails)(text, wrapEmailImpliedLink);
|
|
287
|
-
textWithLinks = (0, exports$1.replaceUrls)(textWithLinks, wrapUrlImpliedLink);
|
|
288
|
-
if (isMobileView) {
|
|
289
|
-
textWithLinks = (0, exports$1.replacePhoneNumbers)(textWithLinks, wrapPhoneImpliedLink);
|
|
290
|
-
}
|
|
291
|
-
return fullMatch.split(text).join(textWithLinks);
|
|
292
|
-
};
|
|
293
|
-
function getImpliedLinks(text, isMobileView, { parseEscaped } = { parseEscaped: false }) {
|
|
294
|
-
return text.replace(/>((?![<>]).+?)<|(?:<a.*>.*<\/a>)/g, getTextLinkMatcher(isMobileView, parseEscaped));
|
|
295
|
-
}
|
|
296
|
-
const getPostSignupUrl = (postSignupUrl) => {
|
|
297
|
-
const placeholder = "{ifcontext}";
|
|
298
|
-
if (!postSignupUrl.includes(placeholder)) {
|
|
299
|
-
return postSignupUrl;
|
|
300
|
-
}
|
|
301
|
-
const [, queryString] = postSignupUrl.split("?");
|
|
302
|
-
const urlSearchParams = new URLSearchParams(queryString);
|
|
303
|
-
let target;
|
|
304
|
-
let postSignupUrlWithContext = "";
|
|
305
|
-
urlSearchParams.forEach((value, key) => {
|
|
306
|
-
if (key.toLowerCase() !== "ifcontext") {
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
target = value.replace("#", "");
|
|
310
|
-
if (/^[a-zA-Z0-9]+$/.test(target)) {
|
|
311
|
-
postSignupUrlWithContext = postSignupUrl.replace(placeholder, target);
|
|
312
|
-
} else {
|
|
313
|
-
postSignupUrlWithContext = postSignupUrl.replace(placeholder, "illegalContextValue");
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
return postSignupUrlWithContext || postSignupUrl;
|
|
317
|
-
};
|
|
318
|
-
exports$1.getPostSignupUrl = getPostSignupUrl;
|
|
319
|
-
const resolveEmailLink = ({ recipient, subject, body, bcc = void 0, cc = void 0 }) => {
|
|
320
|
-
const queryString = Object.entries({ subject, body, bcc, cc }).filter(([, value]) => value).map(([key, value]) => `${key}=${value}`).join("&");
|
|
321
|
-
const query = queryString.length > 0 ? `?${queryString}` : "";
|
|
322
|
-
return `mailto:${recipient}${query}`;
|
|
323
|
-
};
|
|
324
|
-
exports$1.resolveEmailLink = resolveEmailLink;
|
|
325
|
-
const resolvePhoneLink = ({ phoneNumber }) => `tel:${phoneNumber}`;
|
|
326
|
-
exports$1.resolvePhoneLink = resolvePhoneLink;
|
|
327
|
-
const resolveWhatsAppLink = ({ phoneNumber }) => {
|
|
328
|
-
const sanitizedPhoneNumber = phoneNumber.replace(new RegExp("[+|-]", "g"), "");
|
|
329
|
-
return `${linkPatternUtils_1.WHATSAPP_LINK_PREFIX}${sanitizedPhoneNumber}`;
|
|
330
|
-
};
|
|
331
|
-
exports$1.resolveWhatsAppLink = resolveWhatsAppLink;
|
|
332
|
-
const resolveAddressLink = ({ address }) => `http://maps.google.com/maps?daddr=${encodeURI(address)}`;
|
|
333
|
-
exports$1.resolveAddressLink = resolveAddressLink;
|
|
334
|
-
const getInnerRouteSuffix = (innerRoute) => innerRoute && innerRoute.replace(/^\//, "");
|
|
335
|
-
const resolveDynamicPageLink = (externalBaseUrl, { innerRoute }, routerInfo) => {
|
|
336
|
-
const { prefix } = routerInfo;
|
|
337
|
-
const innerRouteSuffix = getInnerRouteSuffix(innerRoute);
|
|
338
|
-
return innerRouteSuffix ? `${externalBaseUrl}/${prefix}/${innerRouteSuffix}` : `${externalBaseUrl}/${prefix}`;
|
|
339
|
-
};
|
|
340
|
-
exports$1.resolveDynamicPageLink = resolveDynamicPageLink;
|
|
341
|
-
const isFreeSite = (url) => {
|
|
342
|
-
const hostname = new URL(url).hostname;
|
|
343
|
-
return hostname.endsWith(".wixsite.com") || hostname.endsWith(".editorx.io") || hostname.endsWith(".wixstudio.io") || hostname.endsWith(".wixstudio.com");
|
|
344
|
-
};
|
|
345
|
-
const shouldServeFileFromUserDomain = (isPremiumDomain, externalBaseUrl, docId) => {
|
|
346
|
-
const isPreview = new URL(externalBaseUrl).hostname.startsWith("editor.wix");
|
|
347
|
-
if (!isPremiumDomain || isPreview || isFreeSite(externalBaseUrl)) {
|
|
348
|
-
return false;
|
|
349
|
-
}
|
|
350
|
-
return exports$1.ALLOWED_FILE_EXTENSIONS_FROM_USER_DOMAIN.some((fileExtension) => docId.endsWith(fileExtension));
|
|
351
|
-
};
|
|
352
|
-
const getDocumentLinkSuffix = (docId, name, indexable) => {
|
|
353
|
-
const isPDF = docId.endsWith(".pdf");
|
|
354
|
-
if (isPDF) {
|
|
355
|
-
return indexable ? "?index=true" : "";
|
|
356
|
-
}
|
|
357
|
-
return `?${(0, exports$1.toQueryString)({ dn: name })}`;
|
|
358
|
-
};
|
|
359
|
-
const getBaseUrlFilesPath = (externalBaseUrl) => {
|
|
360
|
-
const externalBaseUrlWithTrailingSlash = externalBaseUrl.endsWith("/") ? externalBaseUrl : `${externalBaseUrl}/`;
|
|
361
|
-
return new URL("_files", externalBaseUrlWithTrailingSlash);
|
|
362
|
-
};
|
|
363
|
-
exports$1.getBaseUrlFilesPath = getBaseUrlFilesPath;
|
|
364
|
-
const resolveDocumentLink = ({ docId, name, indexable }, metaSiteId, userFileDomainUrl, externalBaseUrl, isPremiumDomain, isResolveDocumentLinkEnabled = false) => {
|
|
365
|
-
if (!isResolveDocumentLinkEnabled) {
|
|
366
|
-
return "";
|
|
367
|
-
}
|
|
368
|
-
const serveFileFromUserDomain = shouldServeFileFromUserDomain(isPremiumDomain, externalBaseUrl, docId);
|
|
369
|
-
const baseUrl = serveFileFromUserDomain ? (0, exports$1.getBaseUrlFilesPath)(externalBaseUrl) : `https://${metaSiteId}.${userFileDomainUrl}`;
|
|
370
|
-
const prefixedDocId = docId.includes("/") ? docId : `ugd/${docId}`;
|
|
371
|
-
const prefixedDocIdWithSlash = prefixedDocId.startsWith("/") ? prefixedDocId : `/${prefixedDocId}`;
|
|
372
|
-
const suffix = getDocumentLinkSuffix(docId, name, indexable);
|
|
373
|
-
return `${baseUrl}${prefixedDocIdWithSlash}${suffix}`;
|
|
374
|
-
};
|
|
375
|
-
exports$1.resolveDocumentLink = resolveDocumentLink;
|
|
376
|
-
const getDocumentLink = (docId, name = "") => `wix:document://v1/${docId}/${name}`;
|
|
377
|
-
exports$1.getDocumentLink = getDocumentLink;
|
|
378
|
-
const hasLinkDataWithCurrentRouteAnchors = (dataItem) => {
|
|
379
|
-
var _a, _b;
|
|
380
|
-
const subDataItems = (dataItem == null ? void 0 : dataItem.items) || (dataItem == null ? void 0 : dataItem.linkList) || (dataItem == null ? void 0 : dataItem.menuRef) || [];
|
|
381
|
-
const anchorDataId = (dataItem == null ? void 0 : dataItem.anchorDataId) || ((_a = dataItem == null ? void 0 : dataItem.link) == null ? void 0 : _a.anchorDataId) || "";
|
|
382
|
-
const innerRoute = (dataItem == null ? void 0 : dataItem.innerRoute) || ((_b = dataItem == null ? void 0 : dataItem.link) == null ? void 0 : _b.innerRoute);
|
|
383
|
-
const isLinkWithTopBottomAnchor = ["SCROLL_TO_TOP", "SCROLL_TO_BOTTOM"].includes(anchorDataId);
|
|
384
|
-
const isCurrentInnerRouteDynamicPageLink = innerRoute === "CURRENT_INNER_ROUTE";
|
|
385
|
-
return isLinkWithTopBottomAnchor || isCurrentInnerRouteDynamicPageLink || subDataItems.some((item) => (0, exports$1.hasLinkDataWithCurrentRouteAnchors)(item));
|
|
386
|
-
};
|
|
387
|
-
exports$1.hasLinkDataWithCurrentRouteAnchors = hasLinkDataWithCurrentRouteAnchors;
|
|
388
|
-
})(links);
|
|
389
|
-
return links;
|
|
390
|
-
}
|
|
391
|
-
var hasRequiredSharedLinkUtils;
|
|
392
|
-
function requireSharedLinkUtils() {
|
|
393
|
-
if (hasRequiredSharedLinkUtils) return sharedLinkUtils;
|
|
394
|
-
hasRequiredSharedLinkUtils = 1;
|
|
395
|
-
Object.defineProperty(sharedLinkUtils, "__esModule", { value: true });
|
|
396
|
-
sharedLinkUtils.createSharedLinkUtils = sharedLinkUtils.UnsupportedLinkTypeError = void 0;
|
|
397
|
-
const links_1 = /* @__PURE__ */ requireLinks();
|
|
398
|
-
const linkPatternUtils_1 = /* @__PURE__ */ requireLinkPatternUtils();
|
|
399
|
-
const TYPE_TO_ANCHOR_NAME = {
|
|
400
|
-
SCROLL_TO_TOP: "top",
|
|
401
|
-
SCROLL_TO_BOTTOM: "bottom"
|
|
402
|
-
};
|
|
403
|
-
const getEscapedQueries = (queryParams) => ({
|
|
404
|
-
subject: encodeURIComponent(queryParams.get("subject") || ""),
|
|
405
|
-
body: encodeURIComponent(queryParams.get("body") || ""),
|
|
406
|
-
bcc: encodeURIComponent(queryParams.get("bcc") || ""),
|
|
407
|
-
cc: encodeURIComponent(queryParams.get("cc") || "")
|
|
408
|
-
});
|
|
409
|
-
const getMailtoLinkProps = (mailtoUrl) => {
|
|
410
|
-
const [, recipient, queries] = linkPatternUtils_1.MAILTO_URL_REGEXP.exec(mailtoUrl);
|
|
411
|
-
const escapedQuery = getEscapedQueries(new URLSearchParams(queries));
|
|
412
|
-
return {
|
|
413
|
-
type: "EmailLink",
|
|
414
|
-
href: (0, links_1.resolveEmailLink)({ recipient, ...escapedQuery }),
|
|
415
|
-
target: "_self"
|
|
416
|
-
};
|
|
417
|
-
};
|
|
418
|
-
const getPhoneLinkProps = (telUrl) => {
|
|
419
|
-
const [, phoneNumber] = linkPatternUtils_1.PHONE_URL_REGEXP.exec(telUrl);
|
|
420
|
-
return {
|
|
421
|
-
type: "PhoneLink",
|
|
422
|
-
href: (0, links_1.resolvePhoneLink)({ phoneNumber }),
|
|
423
|
-
target: "_self"
|
|
424
|
-
};
|
|
425
|
-
};
|
|
426
|
-
const getExternalLinkProps = (url, target = "_blank", rel = "noopener") => {
|
|
427
|
-
return {
|
|
428
|
-
type: "ExternalLink",
|
|
429
|
-
href: url,
|
|
430
|
-
target,
|
|
431
|
-
rel
|
|
432
|
-
};
|
|
433
|
-
};
|
|
434
|
-
class UnsupportedLinkTypeError extends Error {
|
|
435
|
-
constructor() {
|
|
436
|
-
super("Unsupported link type");
|
|
437
|
-
this.name = "UnsupportedLinkTypeError";
|
|
438
|
-
if (Error.captureStackTrace) {
|
|
439
|
-
Error.captureStackTrace(this, UnsupportedLinkTypeError);
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
sharedLinkUtils.UnsupportedLinkTypeError = UnsupportedLinkTypeError;
|
|
444
|
-
const createSharedLinkUtils = (config) => {
|
|
445
|
-
const { metaSiteId, isMobileView, userFileDomainUrl, externalBaseUrl, isPremiumDomain, isResolveDocumentLinkEnabled = false } = config;
|
|
446
|
-
const BASE_DOCUMENTS_URL = `https://${metaSiteId}.filesusr.com/`;
|
|
447
|
-
const isDocumentHref = (href) => href.startsWith(BASE_DOCUMENTS_URL);
|
|
448
|
-
return {
|
|
449
|
-
getImpliedLink: (text) => (0, links_1.getImpliedLink)(text, isMobileView),
|
|
450
|
-
getImpliedLinks: (text, getImpliedLinksConfig) => (0, links_1.getImpliedLinks)(text, isMobileView, getImpliedLinksConfig),
|
|
451
|
-
getLink: ({ href = "", anchorDataId: _anchorDataId = "", docInfo, type } = {}) => {
|
|
452
|
-
if ((0, linkPatternUtils_1.isMailtoUrl)(href)) {
|
|
453
|
-
return href;
|
|
454
|
-
}
|
|
455
|
-
if (isDocumentHref(href)) {
|
|
456
|
-
return (0, links_1.getDocumentLink)(docInfo.docId, docInfo.name);
|
|
457
|
-
}
|
|
458
|
-
const anchorDataId = typeof _anchorDataId === "string" ? _anchorDataId : _anchorDataId == null ? void 0 : _anchorDataId.id;
|
|
459
|
-
if ((0, linkPatternUtils_1.isScrollTopOrBottomAnchor)(anchorDataId)) {
|
|
460
|
-
return `#${TYPE_TO_ANCHOR_NAME[anchorDataId]}`;
|
|
461
|
-
}
|
|
462
|
-
const isExternalLink = type === "ExternalLink";
|
|
463
|
-
if (isExternalLink) {
|
|
464
|
-
return href;
|
|
465
|
-
}
|
|
466
|
-
return href;
|
|
467
|
-
},
|
|
468
|
-
getLinkProps: (url, target, rel) => {
|
|
469
|
-
if ((0, linkPatternUtils_1.isMailtoUrl)(url)) {
|
|
470
|
-
return getMailtoLinkProps(url);
|
|
471
|
-
}
|
|
472
|
-
if ((0, linkPatternUtils_1.isPhoneUrl)(url)) {
|
|
473
|
-
return getPhoneLinkProps(url);
|
|
474
|
-
}
|
|
475
|
-
if ((0, linkPatternUtils_1.isAbsoluteUrl)(url)) {
|
|
476
|
-
return getExternalLinkProps(url, target, rel);
|
|
477
|
-
}
|
|
478
|
-
if ((0, linkPatternUtils_1.isDocumentUrl)(url)) {
|
|
479
|
-
return (0, links_1.getDocumentLinkProps)(url, metaSiteId, userFileDomainUrl, externalBaseUrl, isPremiumDomain, isResolveDocumentLinkEnabled);
|
|
480
|
-
}
|
|
481
|
-
throw new UnsupportedLinkTypeError();
|
|
482
|
-
},
|
|
483
|
-
isDocumentHref
|
|
484
|
-
};
|
|
485
|
-
};
|
|
486
|
-
sharedLinkUtils.createSharedLinkUtils = createSharedLinkUtils;
|
|
487
|
-
return sharedLinkUtils;
|
|
488
|
-
}
|
|
489
|
-
var hasRequiredExternalLinkUtils;
|
|
490
|
-
function requireExternalLinkUtils() {
|
|
491
|
-
if (hasRequiredExternalLinkUtils) return externalLinkUtils;
|
|
492
|
-
hasRequiredExternalLinkUtils = 1;
|
|
493
|
-
Object.defineProperty(externalLinkUtils, "__esModule", { value: true });
|
|
494
|
-
externalLinkUtils.createExternalLinkUtils = void 0;
|
|
495
|
-
const definition_1 = /* @__PURE__ */ requireDefinition();
|
|
496
|
-
const sharedLinkUtils_1 = /* @__PURE__ */ requireSharedLinkUtils();
|
|
497
|
-
const linkPatternUtils_1 = /* @__PURE__ */ requireLinkPatternUtils();
|
|
498
|
-
const createExternalLinkUtils = (config, getService) => {
|
|
499
|
-
const env = getService(definition_1.EnvironmentDefinition);
|
|
500
|
-
const { isMobileView } = env;
|
|
501
|
-
const metaSiteId = env.getMetaSiteId() ?? "unknown";
|
|
502
|
-
const sharedUtils = (0, sharedLinkUtils_1.createSharedLinkUtils)({
|
|
503
|
-
metaSiteId,
|
|
504
|
-
isMobileView
|
|
505
|
-
});
|
|
506
|
-
return {
|
|
507
|
-
isDynamicPage: () => {
|
|
508
|
-
return false;
|
|
509
|
-
},
|
|
510
|
-
isAbsoluteUrl: linkPatternUtils_1.isAbsoluteUrl,
|
|
511
|
-
getImpliedLink: sharedUtils.getImpliedLink,
|
|
512
|
-
getImpliedLinks: sharedUtils.getImpliedLinks,
|
|
513
|
-
getLink: sharedUtils.getLink,
|
|
514
|
-
getLinkProps: sharedUtils.getLinkProps,
|
|
515
|
-
getLinkUrlFromDataItem: () => {
|
|
516
|
-
throw new Error(`getLinkUrlFromDataItem is not implemented`);
|
|
517
|
-
}
|
|
518
|
-
};
|
|
519
|
-
};
|
|
520
|
-
externalLinkUtils.createExternalLinkUtils = createExternalLinkUtils;
|
|
521
|
-
return externalLinkUtils;
|
|
522
|
-
}
|
|
523
|
-
var internalLinkUtils = {};
|
|
524
|
-
var hasRequiredInternalLinkUtils;
|
|
525
|
-
function requireInternalLinkUtils() {
|
|
526
|
-
if (hasRequiredInternalLinkUtils) return internalLinkUtils;
|
|
527
|
-
hasRequiredInternalLinkUtils = 1;
|
|
528
|
-
(function(exports$1) {
|
|
529
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
530
|
-
exports$1.isAbsoluteLink = exports$1.createInternalLinkUtils = void 0;
|
|
531
|
-
const definition_1 = /* @__PURE__ */ requireDefinition();
|
|
532
|
-
const links_1 = /* @__PURE__ */ requireLinks();
|
|
533
|
-
const linkPatternUtils_1 = /* @__PURE__ */ requireLinkPatternUtils();
|
|
534
|
-
const sharedLinkUtils_1 = /* @__PURE__ */ requireSharedLinkUtils();
|
|
535
|
-
const ANCHOR_NAME_TO_TYPE = {
|
|
536
|
-
top: "SCROLL_TO_TOP",
|
|
537
|
-
bottom: "SCROLL_TO_BOTTOM"
|
|
538
|
-
};
|
|
539
|
-
const isDynamicPage = (routersConfig, pageUriSeo) => {
|
|
540
|
-
if (routersConfig) {
|
|
541
|
-
const [prefix] = pageUriSeo.replace("#", "/#").split(/[/]+/);
|
|
542
|
-
const routersWithPrefixFromUrl = Object.values(routersConfig).filter((router) => router.prefix === prefix);
|
|
543
|
-
return routersWithPrefixFromUrl.length === 1;
|
|
544
|
-
}
|
|
545
|
-
return false;
|
|
546
|
-
};
|
|
547
|
-
const getRouteWithPossibleTpaInnerRoute = (routes, relativePath) => {
|
|
548
|
-
const decodedFullPathPageUriSeo = decodeURIComponent(relativePath);
|
|
549
|
-
const fullPathPageRoute = `./${decodedFullPathPageUriSeo}`;
|
|
550
|
-
if (routes[fullPathPageRoute]) {
|
|
551
|
-
return [decodedFullPathPageUriSeo, ""];
|
|
552
|
-
} else {
|
|
553
|
-
const [pageUriSeo, ...tpaInnerRoute] = relativePath.split("/");
|
|
554
|
-
const tpaInnerRoutePath = tpaInnerRoute.length > 0 ? `/${tpaInnerRoute.join("/")}` : "";
|
|
555
|
-
return [pageUriSeo, tpaInnerRoutePath];
|
|
556
|
-
}
|
|
557
|
-
};
|
|
558
|
-
const getPageRoute = (routingInfo, pageId) => {
|
|
559
|
-
const pageRoute = Object.keys(routingInfo.routes).find((key) => {
|
|
560
|
-
const route = routingInfo.routes[key];
|
|
561
|
-
if (route.type === "Dynamic") {
|
|
562
|
-
const pageIds = route.pageIds || [];
|
|
563
|
-
return pageIds.includes(pageId);
|
|
564
|
-
}
|
|
565
|
-
return route.pageId === pageId;
|
|
566
|
-
});
|
|
567
|
-
if (pageRoute) {
|
|
568
|
-
return removeLeadingDotFromRoute(pageRoute);
|
|
569
|
-
}
|
|
570
|
-
throw new Error(`No url route for pageId: ${pageId}`);
|
|
571
|
-
};
|
|
572
|
-
const removeLeadingDotFromRoute = (url) => url.replace(/^\.\//, "/");
|
|
573
|
-
const removeTrailingSlashFromRoute = (url) => url.replace(/\/+$/, "");
|
|
574
|
-
const concatPaths = (path1, path2) => {
|
|
575
|
-
const path1WithoutTrailingSlash = path1.replace(/\/+$/, "");
|
|
576
|
-
const path2WithoutLeadingSlash = path2.replace(/^\/+/, "");
|
|
577
|
-
const joinedPath = `${path1WithoutTrailingSlash}/${path2WithoutLeadingSlash}`;
|
|
578
|
-
return removeTrailingSlashFromRoute(joinedPath);
|
|
579
|
-
};
|
|
580
|
-
const createInternalLinkUtils = (config, getService) => {
|
|
581
|
-
const { routingInfo, userFileDomainUrl, popupPages, getCompIdByWixCodeNickname, getRoleForCompId, routersConfig, multilingualInfo, isPremiumDomain } = config;
|
|
582
|
-
const envService = getService(definition_1.EnvironmentDefinition);
|
|
583
|
-
const metaSiteId = envService.getMetaSiteId() ?? "unknown";
|
|
584
|
-
const isResolveDocumentLinkEnabled = envService.isExperimentOpen("specs.thunderbolt.resolveDocumentLink");
|
|
585
|
-
const sharedLinkUtils2 = (0, sharedLinkUtils_1.createSharedLinkUtils)({
|
|
586
|
-
metaSiteId,
|
|
587
|
-
isMobileView: envService.isMobileView,
|
|
588
|
-
userFileDomainUrl,
|
|
589
|
-
externalBaseUrl: routingInfo.externalBaseUrl,
|
|
590
|
-
isPremiumDomain,
|
|
591
|
-
isResolveDocumentLinkEnabled
|
|
592
|
-
});
|
|
593
|
-
const isPopupId = (pageId) => popupPages ? popupPages[pageId] : false;
|
|
594
|
-
const isDocumentHref = (href) => sharedLinkUtils2.isDocumentHref(href) || isPremiumDomain && href.startsWith((0, links_1.getBaseUrlFilesPath)(routingInfo.externalBaseUrl).href);
|
|
595
|
-
const removeBaseUrlFromHref = (href) => href.replace(routingInfo.externalBaseUrl, "");
|
|
596
|
-
const parsePageUrl = (url) => {
|
|
597
|
-
var _a;
|
|
598
|
-
const [, relativePath = "", anchor = "", queryString = ""] = linkPatternUtils_1.PAGE_URL_REGEXP.exec(url);
|
|
599
|
-
const relativePageUrlPrefix = relativePath.replace(/\/+$/, "");
|
|
600
|
-
const queryParams = new URLSearchParams(queryString);
|
|
601
|
-
if (!(multilingualInfo == null ? void 0 : multilingualInfo.isOriginalLanguage) && ((_a = multilingualInfo == null ? void 0 : multilingualInfo.currentLanguage) == null ? void 0 : _a.resolutionMethod) === "QueryParam") {
|
|
602
|
-
queryParams.set("lang", multilingualInfo.currentLanguage.languageCode);
|
|
603
|
-
}
|
|
604
|
-
return { relativePageUrlPrefix, anchor, queryString: queryParams.toString() };
|
|
605
|
-
};
|
|
606
|
-
const isDynamicPageUrl = (url) => {
|
|
607
|
-
const { relativePageUrlPrefix } = parsePageUrl(url);
|
|
608
|
-
return isDynamicPage(routersConfig, relativePageUrlPrefix);
|
|
609
|
-
};
|
|
610
|
-
const getHomePageRouteWithPageUriSEO = () => {
|
|
611
|
-
const mainPageRoute = Object.keys(routingInfo.routes).find((key) => routingInfo.routes[key].pageId === routingInfo.mainPageId);
|
|
612
|
-
return removeLeadingDotFromRoute(mainPageRoute);
|
|
613
|
-
};
|
|
614
|
-
const getPageLinkProps = (pageUrl, target = "_self", rel) => {
|
|
615
|
-
const { relativePageUrlPrefix = "", anchor = "", queryString } = parsePageUrl(pageUrl);
|
|
616
|
-
const anchorNickname = ANCHOR_NAME_TO_TYPE[anchor] || anchor;
|
|
617
|
-
if (isPopupId(relativePageUrlPrefix)) {
|
|
618
|
-
return {
|
|
619
|
-
type: "PageLink",
|
|
620
|
-
href: "",
|
|
621
|
-
target: "_self",
|
|
622
|
-
linkPopupId: relativePageUrlPrefix
|
|
623
|
-
};
|
|
624
|
-
}
|
|
625
|
-
const externalBaseUrl = routingInfo.externalBaseUrl;
|
|
626
|
-
let type;
|
|
627
|
-
let href;
|
|
628
|
-
let isSamePageNavigation;
|
|
629
|
-
if (isDynamicPage(routersConfig, relativePageUrlPrefix)) {
|
|
630
|
-
const relativeHref = `./${relativePageUrlPrefix}`;
|
|
631
|
-
isSamePageNavigation = relativeHref === routingInfo.relativeUrl;
|
|
632
|
-
type = "DynamicPageLink";
|
|
633
|
-
href = `${externalBaseUrl}/${relativePageUrlPrefix}`;
|
|
634
|
-
} else {
|
|
635
|
-
const [pageUriSeoPath, maybeTpaInnerPath] = getRouteWithPossibleTpaInnerRoute(routingInfo.routes, relativePageUrlPrefix);
|
|
636
|
-
const pageUriSeoInCurrentLang = routingInfo.pagesUriSEOs[pageUriSeoPath] || pageUriSeoPath;
|
|
637
|
-
const pageRoute = `./${pageUriSeoInCurrentLang}`;
|
|
638
|
-
const nextRouteConfig = pageRoute === "./" ? { pageId: routingInfo.mainPageId } : routingInfo.routes[pageRoute];
|
|
639
|
-
const isHomePageNavigation = (nextRouteConfig == null ? void 0 : nextRouteConfig.pageId) === routingInfo.mainPageId;
|
|
640
|
-
type = "PageLink";
|
|
641
|
-
href = isHomePageNavigation && !maybeTpaInnerPath ? externalBaseUrl : `${externalBaseUrl}/${pageUriSeoInCurrentLang}${maybeTpaInnerPath}`;
|
|
642
|
-
isSamePageNavigation = nextRouteConfig && nextRouteConfig.pageId === routingInfo.pageId;
|
|
643
|
-
}
|
|
644
|
-
const anchorCompId = anchorNickname && getCompIdByWixCodeNickname && getCompIdByWixCodeNickname(anchorNickname);
|
|
645
|
-
const hasAnchorOnSamePage = isSamePageNavigation && anchorCompId;
|
|
646
|
-
const hasAnchorOnOtherPage = anchorNickname && !hasAnchorOnSamePage;
|
|
647
|
-
return {
|
|
648
|
-
href: `${href}${queryString ? `?${new URLSearchParams(queryString).toString()}` : ""}`,
|
|
649
|
-
target,
|
|
650
|
-
rel,
|
|
651
|
-
type,
|
|
652
|
-
// if we have an anchor on the current page, we set the anchor compId
|
|
653
|
-
...hasAnchorOnSamePage && { anchorCompId },
|
|
654
|
-
// if we have an anchor on another page, we set the anchor data item Id
|
|
655
|
-
...hasAnchorOnOtherPage && { anchorDataId: anchorNickname }
|
|
656
|
-
};
|
|
657
|
-
};
|
|
658
|
-
const encodeInnerRoute = (innerRoute) => {
|
|
659
|
-
const [innerRoutePath, stateQueryParams] = innerRoute.split("?");
|
|
660
|
-
if (stateQueryParams) {
|
|
661
|
-
const encodedQueryParams = encodeURIComponent(`?${stateQueryParams}`);
|
|
662
|
-
return innerRoutePath ? `${innerRoutePath}${encodedQueryParams}` : encodedQueryParams;
|
|
663
|
-
}
|
|
664
|
-
return innerRoutePath;
|
|
665
|
-
};
|
|
666
|
-
const linkTypeToUrlResolverFn = {
|
|
667
|
-
AnchorLink: (linkData) => {
|
|
668
|
-
const { anchorDataId, pageId } = linkData;
|
|
669
|
-
const isScrollTopOrBottom = (0, linkPatternUtils_1.isScrollTopOrBottomAnchor)(anchorDataId);
|
|
670
|
-
const nextPageId = isScrollTopOrBottom ? routingInfo.pageId : pageId.replace(/^#/, "");
|
|
671
|
-
const nextAnchorDataId = anchorDataId.startsWith("#") ? anchorDataId : `#${anchorDataId}`;
|
|
672
|
-
const pageRoute = getPageRoute(routingInfo, nextPageId);
|
|
673
|
-
return `${pageRoute}${nextAnchorDataId}`;
|
|
674
|
-
},
|
|
675
|
-
DocumentLink: (linkData) => {
|
|
676
|
-
const { docId, name } = linkData;
|
|
677
|
-
return (0, links_1.getDocumentLink)(docId, name);
|
|
678
|
-
},
|
|
679
|
-
ExternalLink: (linkData) => {
|
|
680
|
-
const { url } = linkData;
|
|
681
|
-
return url;
|
|
682
|
-
},
|
|
683
|
-
DynamicPageLink: (linkData) => {
|
|
684
|
-
const { routerId, innerRoute, anchorDataId: _anchorDataId = "" } = linkData;
|
|
685
|
-
const anchorDataId = _anchorDataId ?? "";
|
|
686
|
-
const prefix = `/${routersConfig[routerId].prefix}`;
|
|
687
|
-
const encodedInnerRoute = innerRoute ? encodeInnerRoute(innerRoute) : innerRoute;
|
|
688
|
-
const suffix = encodedInnerRoute ? `/${encodedInnerRoute}${anchorDataId}` : anchorDataId;
|
|
689
|
-
return `${prefix}${suffix}`;
|
|
690
|
-
},
|
|
691
|
-
TpaPageLink: (linkData) => {
|
|
692
|
-
const { pageId, path = "" } = linkData;
|
|
693
|
-
const _pageId = pageId.replace(/^#/, "");
|
|
694
|
-
const prefix = routingInfo.pageIdToPrefix[_pageId];
|
|
695
|
-
const pageUriSeo = routingInfo.pages[_pageId].pageUriSEO;
|
|
696
|
-
const relativeUrl = prefix ? `/${prefix}/${pageUriSeo}` : `/${pageUriSeo}`;
|
|
697
|
-
const encodedPath = encodeInnerRoute(path);
|
|
698
|
-
if (encodedPath && routingInfo.isCustomizedUrl) {
|
|
699
|
-
return prefix ? concatPaths(prefix, encodedPath) : encodedPath;
|
|
700
|
-
}
|
|
701
|
-
const isPathWithPageUriSEO = path.startsWith(relativeUrl);
|
|
702
|
-
if (isPathWithPageUriSEO) {
|
|
703
|
-
return encodedPath;
|
|
704
|
-
}
|
|
705
|
-
return concatPaths(relativeUrl, encodedPath);
|
|
706
|
-
},
|
|
707
|
-
PageLink: (linkData) => {
|
|
708
|
-
const { pageId: pageIdOrData } = linkData;
|
|
709
|
-
const pageId = ((typeof pageIdOrData === "string" ? pageIdOrData : pageIdOrData.id) || "").replace(/^#/, "");
|
|
710
|
-
if (isPopupId(pageId)) {
|
|
711
|
-
return `/${pageId}`;
|
|
712
|
-
}
|
|
713
|
-
if (pageId === routingInfo.mainPageId) {
|
|
714
|
-
return "/";
|
|
715
|
-
}
|
|
716
|
-
return getPageRoute(routingInfo, pageId);
|
|
717
|
-
},
|
|
718
|
-
PhoneLink: (linkData) => (0, links_1.resolvePhoneLink)(linkData),
|
|
719
|
-
EmailLink: (linkData) => (0, links_1.resolveEmailLink)(linkData)
|
|
720
|
-
};
|
|
721
|
-
return {
|
|
722
|
-
isDynamicPage: isDynamicPageUrl,
|
|
723
|
-
isAbsoluteUrl: linkPatternUtils_1.isAbsoluteUrl,
|
|
724
|
-
getImpliedLink: sharedLinkUtils2.getImpliedLink,
|
|
725
|
-
getImpliedLinks: sharedLinkUtils2.getImpliedLinks,
|
|
726
|
-
getLink: ({ href: linkHref = "", linkPopupId, anchorCompId = "", anchorDataId = "", docInfo, type } = {}) => {
|
|
727
|
-
if (linkPopupId) {
|
|
728
|
-
return `/${linkPopupId}`;
|
|
729
|
-
}
|
|
730
|
-
if (isDocumentHref(linkHref)) {
|
|
731
|
-
return (0, links_1.getDocumentLink)(docInfo.docId, docInfo.name);
|
|
732
|
-
}
|
|
733
|
-
const linkProps = { href: linkHref, linkPopupId, anchorDataId, docInfo, type };
|
|
734
|
-
if ((0, exports$1.isAbsoluteLink)(metaSiteId, linkProps)) {
|
|
735
|
-
return sharedLinkUtils2.getLink(linkProps);
|
|
736
|
-
}
|
|
737
|
-
const [href] = linkHref.split("?");
|
|
738
|
-
const anchor = (getRoleForCompId == null ? void 0 : getRoleForCompId(anchorCompId, "wixCode")) || anchorDataId;
|
|
739
|
-
const anchorId = anchor ? `#${anchor}` : "";
|
|
740
|
-
const isHomePageUrl = href === routingInfo.externalBaseUrl;
|
|
741
|
-
const link = isHomePageUrl ? getHomePageRouteWithPageUriSEO() : removeBaseUrlFromHref(href);
|
|
742
|
-
return `${link}${anchorId}`;
|
|
743
|
-
},
|
|
744
|
-
getLinkProps: (url, target, rel) => {
|
|
745
|
-
if ((0, linkPatternUtils_1.isSamePageAnchorUrl)(url)) {
|
|
746
|
-
const relativeUrl = removeLeadingDotFromRoute(routingInfo.relativeUrl);
|
|
747
|
-
const currentPageUriSEOWithAnchorUrl = `${relativeUrl}${url}`;
|
|
748
|
-
return getPageLinkProps(currentPageUriSEOWithAnchorUrl, target);
|
|
749
|
-
}
|
|
750
|
-
if ((0, linkPatternUtils_1.isPageUrl)(url)) {
|
|
751
|
-
return getPageLinkProps(url, target, rel);
|
|
752
|
-
}
|
|
753
|
-
if ((0, linkPatternUtils_1.isDocumentUrl)(url)) {
|
|
754
|
-
return (0, links_1.getDocumentLinkProps)(url, metaSiteId, userFileDomainUrl, routingInfo.externalBaseUrl, isPremiumDomain, isResolveDocumentLinkEnabled);
|
|
755
|
-
}
|
|
756
|
-
return sharedLinkUtils2.getLinkProps(url, target, rel);
|
|
757
|
-
},
|
|
758
|
-
getLinkUrlFromDataItem: (linkData) => {
|
|
759
|
-
const linkUrlResolverFn = linkTypeToUrlResolverFn[linkData.type];
|
|
760
|
-
if (linkUrlResolverFn) {
|
|
761
|
-
return linkUrlResolverFn(linkData);
|
|
762
|
-
}
|
|
763
|
-
throw new Error("Provided link type is not supported");
|
|
764
|
-
}
|
|
765
|
-
};
|
|
766
|
-
};
|
|
767
|
-
exports$1.createInternalLinkUtils = createInternalLinkUtils;
|
|
768
|
-
const isAbsoluteLink = (metaSiteId, { href = "", anchorDataId: _anchorDataId = "", type }) => {
|
|
769
|
-
const anchorDataId = typeof _anchorDataId === "string" ? _anchorDataId : _anchorDataId == null ? void 0 : _anchorDataId.id;
|
|
770
|
-
return (0, linkPatternUtils_1.isMailtoUrl)(href) || type === "ExternalLink" || href.startsWith(`https://${metaSiteId}.filesusr.com/`) || (0, linkPatternUtils_1.isScrollTopOrBottomAnchor)(anchorDataId);
|
|
771
|
-
};
|
|
772
|
-
exports$1.isAbsoluteLink = isAbsoluteLink;
|
|
773
|
-
})(internalLinkUtils);
|
|
774
|
-
return internalLinkUtils;
|
|
775
|
-
}
|
|
776
|
-
var hasRequiredDist;
|
|
777
|
-
function requireDist() {
|
|
778
|
-
if (hasRequiredDist) return dist;
|
|
779
|
-
hasRequiredDist = 1;
|
|
780
|
-
(function(exports$1) {
|
|
781
|
-
var __createBinding = dist && dist.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
782
|
-
if (k2 === void 0) k2 = k;
|
|
783
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
784
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
785
|
-
desc = { enumerable: true, get: function() {
|
|
786
|
-
return m[k];
|
|
787
|
-
} };
|
|
788
|
-
}
|
|
789
|
-
Object.defineProperty(o, k2, desc);
|
|
790
|
-
}) : (function(o, m, k, k2) {
|
|
791
|
-
if (k2 === void 0) k2 = k;
|
|
792
|
-
o[k2] = m[k];
|
|
793
|
-
}));
|
|
794
|
-
var __exportStar = dist && dist.__exportStar || function(m, exports$12) {
|
|
795
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$12, p)) __createBinding(exports$12, m, p);
|
|
796
|
-
};
|
|
797
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
798
|
-
__exportStar(/* @__PURE__ */ requireDefinition$1(), exports$1);
|
|
799
|
-
__exportStar(/* @__PURE__ */ requireExternalLinkUtils(), exports$1);
|
|
800
|
-
__exportStar(/* @__PURE__ */ requireInternalLinkUtils(), exports$1);
|
|
801
|
-
})(dist);
|
|
802
|
-
return dist;
|
|
803
|
-
}
|
|
804
|
-
var distExports = /* @__PURE__ */ requireDist();
|
|
805
51
|
const createMenuSdk = (api) => {
|
|
806
52
|
const { props, setProps, getService } = api;
|
|
807
|
-
const linkUtils = getService(
|
|
53
|
+
const linkUtils = getService(LinkUtilsDefinition);
|
|
808
54
|
return {
|
|
809
55
|
get type() {
|
|
810
56
|
return "$w.Menu";
|