@nectary/assets 3.1.1 → 3.2.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/bundle.d.ts +1 -1
- package/bundle.js +3 -3
- package/bundle.ts +1 -2
- package/icons-branded/{chatlayert → chatlayer}/global/index.d.ts +4 -4
- package/icons-branded/{chatlayert → chatlayer}/global/index.js +1 -1
- package/icons-branded/{chatlayert → chatlayer}/index.d.ts +5 -5
- package/icons-branded/{chatlayert → chatlayer}/index.js +3 -3
- package/package.json +1 -1
- package/utils/asset-names.d.ts +2 -2
- package/utils/asset-names.js +1 -1
- package/utils/element.d.ts +1 -1
- package/utils/global-assets-constants.d.ts +0 -1
- package/utils/global-assets-constants.js +0 -2
- package/utils/global-assets-manager.d.ts +12 -32
- package/utils/global-assets-manager.js +1 -2
- package/utils/shared/global-elements-manager.d.ts +12 -32
- package/utils/shared/global-elements-manager.js +50 -43
- package/utils/shared/global-elements-store.d.ts +2 -2
- package/utils/shared/global-elements-store.js +2 -2
package/bundle.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export { IconBrandedChannels } from './icons-branded/channels';
|
|
|
21
21
|
export { IconBrandedChat } from './icons-branded/chat';
|
|
22
22
|
export { IconBrandedChatMessage } from './icons-branded/chat-message';
|
|
23
23
|
export { IconBrandedChatbot } from './icons-branded/chatbot';
|
|
24
|
-
export {
|
|
24
|
+
export { IconBrandedChatlayer } from './icons-branded/chatlayer';
|
|
25
25
|
export { IconBrandedCloud } from './icons-branded/cloud';
|
|
26
26
|
export { IconBrandedConnection } from './icons-branded/connection';
|
|
27
27
|
export { IconBrandedContact } from './icons-branded/contact';
|
package/bundle.js
CHANGED
|
@@ -244,8 +244,8 @@ const templateHTML$4A = '<svg viewBox="0 0 48 48" aria-hidden="true"><path fill-
|
|
|
244
244
|
const IconBrandedChatbot = createIconClass$1(templateHTML$4A);
|
|
245
245
|
defineCustomElement("sinch-icon-branded-chatbot", IconBrandedChatbot);
|
|
246
246
|
const templateHTML$4z = '<svg viewBox="0 0 48 48" aria-hidden="true"><path d="m24 37 8 5v-7h1a4 4 0 0 0 4-4V18a4 4 0 0 0-4-4h-5v2h5a2 2 0 0 1 2 2v13a2 2 0 0 1-2 2h-3v5.392L27.774 37H24Z" class="accent"/><path fill-rule="evenodd" clip-rule="evenodd" d="m22.97 8.271-11 6.142c-.623.349-.97.966-.97 1.593v15.136c0 .959.827 1.858 2 1.858h11c1.173 0 2-.9 2-1.858V9.864c0-1.324-1.588-2.398-3.03-1.593Zm-11.974 4.396C9.76 13.357 9 14.63 9 16.006v15.136C9 33.272 10.79 35 13 35h11c2.21 0 4-1.727 4-3.858V9.864c0-2.972-3.337-4.828-6.004-3.34l-11 6.143Z"/></svg>';
|
|
247
|
-
const
|
|
248
|
-
defineCustomElement("sinch-icon-branded-
|
|
247
|
+
const IconBrandedChatlayer = createIconClass$1(templateHTML$4z);
|
|
248
|
+
defineCustomElement("sinch-icon-branded-chatlayer", IconBrandedChatlayer);
|
|
249
249
|
const templateHTML$4y = '<svg viewBox="0 0 48 48" aria-hidden="true"><path d="M41.656 24.267a7.404 7.404 0 0 0-7.17-5.58h-.87c-.45-1.36-1.17-2.63-2.1-3.72-1.1-1.3-2.48-2.33-4.04-3.01-1.55-.68-3.24-1.01-4.93-.95-2.22.02-4.32 1.14-5.41 2 1.15-.04 2.31.04 3.45.23.1.02.2.03.3.05.55-.17 1.13-.28 1.7-.28h.03c.95-.04 1.9.08 2.82.33.43.12.84.27 1.25.45a9.12 9.12 0 0 1 3.32 2.48c.45.53.84 1.11 1.16 1.73l.01.01c.32.62.57 1.27.75 1.95.11.44.51.75.97.75h1.61c1.2 0 2.37.4 3.32 1.14a5.43 5.43 0 0 1 1.92 2.93c.29 1.14.2 2.35-.26 3.44-.19.32-.34.55-.47.73v.28c0 .76-.06 1.51-.18 2.24 1.23-.33 1.79-1.25 2.4-2.28.02-.04.04-.07.06-.11.63-1.53.77-3.22.36-4.81Z" class="accent"/><path d="M18.246 37c-2.1 0-4.16-.383-5.94-1.493-1.79-1.11-3.23-2.7-4.15-4.59-.93-1.89-1.31-4-1.1-6.09.21-2.1 1.01-3.787 2.3-5.447a11.08 11.08 0 0 1 4.99-3.68c1.98-.73 4.11-.9 6.18-.47 2.06.43 3.96 1.117 5.49 2.567 1.34 1.27 2.34 2.85 2.92 4.59h.87c1.98 0 3.84.77 5.24 2.17a7.36 7.36 0 0 1 2.17 5.24c0 1.98-.77 3.84-2.17 5.24-1.4 1.4-3.26 2-5.24 2L18.5 37h-.254Zm0-20c-1.09 0-2.18.19-3.21.58-1.62.6-3.04 1.64-4.1 3.01-1.06 1.37-1.71 2.707-1.89 4.427-.17 1.72.14 3.46.9 5.01a9.234 9.234 0 0 0 3.42 3.78c1.47.91 3.15 1.193 4.88 1.193h.254l11.296.037c1.45 0 2.8-.39 3.83-1.41a5.33 5.33 0 0 0 1.58-3.82c0-1.44-.56-2.8-1.58-3.82a5.377 5.377 0 0 0-3.83-1.58h-1.61c-.46 0-.85-.31-.97-.75a9.227 9.227 0 0 0-2.58-4.39c-1.25-1.19-2.81-1.707-4.51-2.057a8.03 8.03 0 0 0-1.88-.21Z"/></svg>';
|
|
250
250
|
const IconBrandedCloud = createIconClass$1(templateHTML$4y);
|
|
251
251
|
defineCustomElement("sinch-icon-branded-cloud", IconBrandedCloud);
|
|
@@ -17742,7 +17742,7 @@ export {
|
|
|
17742
17742
|
IconBrandedChat,
|
|
17743
17743
|
IconBrandedChatMessage,
|
|
17744
17744
|
IconBrandedChatbot,
|
|
17745
|
-
|
|
17745
|
+
IconBrandedChatlayer,
|
|
17746
17746
|
IconBrandedCloud,
|
|
17747
17747
|
IconBrandedConnection,
|
|
17748
17748
|
IconBrandedContact,
|
package/bundle.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// Reminder: Keep this list updated as we add new assets
|
|
2
|
-
|
|
3
2
|
// Icons Branded
|
|
4
3
|
export { IconBranded5gReadiness } from './icons-branded/5g-readiness'
|
|
5
4
|
export { IconBrandedAbcd } from './icons-branded/abcd'
|
|
@@ -24,7 +23,7 @@ export { IconBrandedChannels } from './icons-branded/channels'
|
|
|
24
23
|
export { IconBrandedChat } from './icons-branded/chat'
|
|
25
24
|
export { IconBrandedChatMessage } from './icons-branded/chat-message'
|
|
26
25
|
export { IconBrandedChatbot } from './icons-branded/chatbot'
|
|
27
|
-
export {
|
|
26
|
+
export { IconBrandedChatlayer } from './icons-branded/chatlayer'
|
|
28
27
|
export { IconBrandedCloud } from './icons-branded/cloud'
|
|
29
28
|
export { IconBrandedConnection } from './icons-branded/connection'
|
|
30
29
|
export { IconBrandedContact } from './icons-branded/contact'
|
|
@@ -2,23 +2,23 @@ import type { TSinchIconBrandedElement, TSinchIconBrandedReact, TSinchIconBrande
|
|
|
2
2
|
export * from '../../types';
|
|
3
3
|
declare global {
|
|
4
4
|
interface NectaryComponentMap {
|
|
5
|
-
'sinch-icon-branded-
|
|
5
|
+
'sinch-icon-branded-chatlayer': {
|
|
6
6
|
props: TSinchIconBrandedProps;
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
9
|
interface HTMLElementTagNameMap {
|
|
10
|
-
'sinch-icon-branded-
|
|
10
|
+
'sinch-icon-branded-chatlayer': TSinchIconBrandedElement;
|
|
11
11
|
}
|
|
12
12
|
namespace JSX {
|
|
13
13
|
interface IntrinsicElements {
|
|
14
|
-
'sinch-icon-branded-
|
|
14
|
+
'sinch-icon-branded-chatlayer': TSinchIconBrandedReact;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
declare module 'react' {
|
|
19
19
|
namespace JSX {
|
|
20
20
|
interface IntrinsicElements extends globalThis.JSX.IntrinsicElements {
|
|
21
|
-
'sinch-icon-branded-
|
|
21
|
+
'sinch-icon-branded-chatlayer': TSinchIconBrandedReact;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { defineCustomElement } from "../../../utils/element.js";
|
|
2
|
-
defineCustomElement("sinch-icon-branded-
|
|
2
|
+
defineCustomElement("sinch-icon-branded-chatlayer");
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import type { TSinchIconBrandedElement, TSinchIconBrandedReact, TSinchIconBrandedProps } from '../types';
|
|
2
2
|
export * from '../types';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const IconBrandedChatlayer: CustomElementConstructor;
|
|
4
4
|
declare global {
|
|
5
5
|
interface NectaryComponentMap {
|
|
6
|
-
'sinch-icon-branded-
|
|
6
|
+
'sinch-icon-branded-chatlayer': {
|
|
7
7
|
props: TSinchIconBrandedProps;
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
10
|
interface HTMLElementTagNameMap {
|
|
11
|
-
'sinch-icon-branded-
|
|
11
|
+
'sinch-icon-branded-chatlayer': TSinchIconBrandedElement;
|
|
12
12
|
}
|
|
13
13
|
namespace JSX {
|
|
14
14
|
interface IntrinsicElements {
|
|
15
|
-
'sinch-icon-branded-
|
|
15
|
+
'sinch-icon-branded-chatlayer': TSinchIconBrandedReact;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
declare module 'react' {
|
|
20
20
|
namespace JSX {
|
|
21
21
|
interface IntrinsicElements extends globalThis.JSX.IntrinsicElements {
|
|
22
|
-
'sinch-icon-branded-
|
|
22
|
+
'sinch-icon-branded-chatlayer': TSinchIconBrandedReact;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineCustomElement } from "../../utils/element.js";
|
|
2
2
|
import { createIconClass } from "../create-icon-class.js";
|
|
3
3
|
const templateHTML = '<svg viewBox="0 0 48 48" aria-hidden="true"><path d="m24 37 8 5v-7h1a4 4 0 0 0 4-4V18a4 4 0 0 0-4-4h-5v2h5a2 2 0 0 1 2 2v13a2 2 0 0 1-2 2h-3v5.392L27.774 37H24Z" class="accent"/><path fill-rule="evenodd" clip-rule="evenodd" d="m22.97 8.271-11 6.142c-.623.349-.97.966-.97 1.593v15.136c0 .959.827 1.858 2 1.858h11c1.173 0 2-.9 2-1.858V9.864c0-1.324-1.588-2.398-3.03-1.593Zm-11.974 4.396C9.76 13.357 9 14.63 9 16.006v15.136C9 33.272 10.79 35 13 35h11c2.21 0 4-1.727 4-3.858V9.864c0-2.972-3.337-4.828-6.004-3.34l-11 6.143Z"/></svg>';
|
|
4
|
-
const
|
|
5
|
-
defineCustomElement("sinch-icon-branded-
|
|
4
|
+
const IconBrandedChatlayer = createIconClass(templateHTML);
|
|
5
|
+
defineCustomElement("sinch-icon-branded-chatlayer", IconBrandedChatlayer);
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
IconBrandedChatlayer
|
|
8
8
|
};
|
package/package.json
CHANGED
package/utils/asset-names.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const BASE_ASSET_NAMES_LIST: readonly ["icon-branded-5g-readiness", "icon-branded-abcd", "icon-branded-ai", "icon-branded-airplane", "icon-branded-announcement", "icon-branded-barchart-down", "icon-branded-barchart-up", "icon-branded-bell", "icon-branded-bell-notification", "icon-branded-bell-off", "icon-branded-billing", "icon-branded-boat", "icon-branded-book", "icon-branded-calendar", "icon-branded-call", "icon-branded-call-and-verified", "icon-branded-calling-api", "icon-branded-campaigns", "icon-branded-car", "icon-branded-channels", "icon-branded-chat", "icon-branded-chat-message", "icon-branded-chatbot", "icon-branded-
|
|
2
|
-
export declare const BASE_ASSET_NAMES: Set<"icon-branded-5g-readiness" | "icon-branded-abcd" | "icon-branded-ai" | "icon-branded-airplane" | "icon-branded-announcement" | "icon-branded-barchart-down" | "icon-branded-barchart-up" | "icon-branded-bell" | "icon-branded-bell-notification" | "icon-branded-bell-off" | "icon-branded-billing" | "icon-branded-boat" | "icon-branded-book" | "icon-branded-calendar" | "icon-branded-call" | "icon-branded-call-and-verified" | "icon-branded-calling-api" | "icon-branded-campaigns" | "icon-branded-car" | "icon-branded-channels" | "icon-branded-chat" | "icon-branded-chat-message" | "icon-branded-chatbot" | "icon-branded-
|
|
1
|
+
export declare const BASE_ASSET_NAMES_LIST: readonly ["icon-branded-5g-readiness", "icon-branded-abcd", "icon-branded-ai", "icon-branded-airplane", "icon-branded-announcement", "icon-branded-barchart-down", "icon-branded-barchart-up", "icon-branded-bell", "icon-branded-bell-notification", "icon-branded-bell-off", "icon-branded-billing", "icon-branded-boat", "icon-branded-book", "icon-branded-calendar", "icon-branded-call", "icon-branded-call-and-verified", "icon-branded-calling-api", "icon-branded-campaigns", "icon-branded-car", "icon-branded-channels", "icon-branded-chat", "icon-branded-chat-message", "icon-branded-chatbot", "icon-branded-chatlayer", "icon-branded-cloud", "icon-branded-connection", "icon-branded-contact", "icon-branded-contact-center", "icon-branded-contact-pro", "icon-branded-cookies", "icon-branded-credit-card", "icon-branded-custom", "icon-branded-custom-message", "icon-branded-customer-satisfaction-smiley", "icon-branded-database", "icon-branded-decision", "icon-branded-developer", "icon-branded-direction", "icon-branded-easytouse", "icon-branded-edit", "icon-branded-finance", "icon-branded-flow", "icon-branded-flow-chart", "icon-branded-global", "icon-branded-global-settings", "icon-branded-gym", "icon-branded-handshaking", "icon-branded-health-insurance", "icon-branded-healthcare", "icon-branded-help", "icon-branded-home", "icon-branded-idea", "icon-branded-integration", "icon-branded-intelligent-revenue-maximisation", "icon-branded-laptop", "icon-branded-layout", "icon-branded-line-chart-down", "icon-branded-line-chart-up", "icon-branded-lock", "icon-branded-logistic", "icon-branded-long-message", "icon-branded-loop", "icon-branded-low-cost", "icon-branded-make-it-happen", "icon-branded-make-money", "icon-branded-massage", "icon-branded-media", "icon-branded-message", "icon-branded-message-questions", "icon-branded-messaging", "icon-branded-mic", "icon-branded-mms", "icon-branded-mobile", "icon-branded-mobile-intergration", "icon-branded-mobile-numbers", "icon-branded-money", "icon-branded-multiple-channels", "icon-branded-music", "icon-branded-mute", "icon-branded-news", "icon-branded-numbers", "icon-branded-office", "icon-branded-office-activities", "icon-branded-opened-message", "icon-branded-operators", "icon-branded-package", "icon-branded-path", "icon-branded-perso-message", "icon-branded-pie-chart", "icon-branded-piggybank", "icon-branded-pin", "icon-branded-price-tag", "icon-branded-protection", "icon-branded-purpose", "icon-branded-push", "icon-branded-puzzle", "icon-branded-queue", "icon-branded-rcs", "icon-branded-retail", "icon-branded-rich-content", "icon-branded-rocket", "icon-branded-roi", "icon-branded-search", "icon-branded-send", "icon-branded-settings", "icon-branded-shopping-cart", "icon-branded-sms", "icon-branded-support", "icon-branded-system-settings", "icon-branded-telemast", "icon-branded-thumbs-down", "icon-branded-thumbs-up", "icon-branded-time", "icon-branded-tutorial", "icon-branded-user", "icon-branded-users", "icon-branded-verification-api", "icon-branded-verified-phone", "icon-branded-video-calling", "icon-branded-video-off", "icon-branded-video-on", "icon-branded-voice-calling", "icon-branded-voice-video-and-data", "icon-branded-webhook", "icon-branded-wheels", "icon-branded-wi-fi", "icon-channel-apple-business-chat", "icon-channel-apple-business-chat-square", "icon-channel-facebook", "icon-channel-facebook-messenger", "icon-channel-facebook-messenger-square", "icon-channel-facebook-square", "icon-channel-google-business", "icon-channel-google-business-square", "icon-channel-instagram", "icon-channel-instagram-square", "icon-channel-line", "icon-channel-line-square", "icon-channel-mms-round", "icon-channel-mms-square", "icon-channel-notify", "icon-channel-notify-square", "icon-channel-push-round", "icon-channel-push-square", "icon-channel-rcs-round", "icon-channel-rcs-square", "icon-channel-sms-round", "icon-channel-sms-square", "icon-channel-talk", "icon-channel-talk-square", "icon-channel-telegram", "icon-channel-telegram-square", "icon-channel-twitter", "icon-channel-twitter-square", "icon-channel-viber", "icon-channel-viber-square", "icon-channel-webchat-round", "icon-channel-webchat-square", "icon-channel-wechat", "icon-channel-wechat-square", "icon-channel-whatsapp", "icon-channel-whatsapp-square", "illustration-5g", "illustration-about-page", "illustration-bank", "illustration-boost", "illustration-buildvoicebot", "illustration-call-center", "illustration-cat", "illustration-cat-texting", "illustration-chat-bot", "illustration-check", "illustration-code", "illustration-contact-us", "illustration-contactus", "illustration-conversation-api", "illustration-cooking", "illustration-costumer-support", "illustration-credit-card", "illustration-credit-card-30-degrees", "illustration-cute-bee", "illustration-decorative-flamingo", "illustration-decorative-rainbow", "illustration-delivery-service-package", "illustration-desktop", "illustration-document", "illustration-dream-big", "illustration-flower-hand", "illustration-football", "illustration-geometric-shapes-passing", "illustration-girl-on-phone", "illustration-global-reach", "illustration-hand-ok", "illustration-hands-laptop", "illustration-handset-omnichannel-messages", "illustration-happy-text", "illustration-headphones", "illustration-heart", "illustration-hero-messages", "illustration-hero-page", "illustration-jump", "illustration-laptop-holding", "illustration-laptop-sitting-verified", "illustration-lightbulb", "illustration-lightning", "illustration-lock", "illustration-lying-and-looking-at-the-phone", "illustration-magnifying-glass", "illustration-man-on-right", "illustration-meeting-scrum", "illustration-meeting-scrum-2", "illustration-megaphone", "illustration-menu", "illustration-message-passing", "illustration-message-recieved", "illustration-messages", "illustration-messages-on-yellow-bg", "illustration-messages-shopping", "illustration-monitor", "illustration-numbers-passing", "illustration-office-worker", "illustration-old-person-on-phone", "illustration-omnichannel-messaging", "illustration-on-a-cloud", "illustration-on-the-phone", "illustration-parcel-delivery", "illustration-passing-heart", "illustration-passing-heart-cool", "illustration-person-lightbulb-backpack", "illustration-person-on-phone", "illustration-person-on-walk", "illustration-person-with-dog", "illustration-person-with-phone", "illustration-phone-and-cat", "illustration-pineapple", "illustration-pizza", "illustration-plane", "illustration-presenting-charts", "illustration-product-page", "illustration-product-page-2", "illustration-scooter", "illustration-security", "illustration-security-camera", "illustration-sherlockholmes", "illustration-shoe", "illustration-shopping", "illustration-shopping-cart", "illustration-sick-kid", "illustration-sitting-messaging", "illustration-sitting-person", "illustration-sitting-person-2", "illustration-sofa", "illustration-stats", "illustration-support-center", "illustration-supporting-device", "illustration-supporting-device-2", "illustration-supporting-device-3", "illustration-supporting-device-4", "illustration-surf", "illustration-taxi", "illustration-taxi-2", "illustration-teamwork-from-phone", "illustration-telemast", "illustration-texting-sitting", "illustration-texting-sofa", "illustration-train", "illustration-video-voice-call", "illustration-voicebot", "illustration-walking-on-phone", "illustration-what-tools", "illustration-win-together", "illustration-win-together-two-people", "illustration-wizard", "illustration-woman-hand-lifted", "illustration-woman-on-left", "illustration-woman-on-right", "logo-campaigns-icon", "logo-campaigns-icon-wordmark", "logo-chatlayer-icon", "logo-chatlayer-icon-wordmark", "logo-contact-pro-icon", "logo-contact-pro-icon-wordmark", "logo-email-on-acid-icon", "logo-email-on-acid-icon-wordmark", "logo-engage-icon", "logo-engage-icon-wordmark", "logo-mailgun-icon", "logo-mailgun-icon-wordmark", "logo-mailjet-icon", "logo-mailjet-icon-wordmark", "logo-message-media-icon", "logo-message-media-icon-wordmark", "logo-message-studio-icon", "logo-message-studio-icon-wordmark", "logo-nectary-icon", "logo-nectary-icon-wordmark", "logo-portal-build-icon", "logo-portal-build-icon-wordmark", "logo-portal-connect-icon", "logo-portal-connect-icon-wordmark", "logo-portal-engage-icon", "logo-portal-engage-icon-wordmark", "logo-portal-mailgun-icon", "logo-portal-mailgun-icon-wordmark", "logo-portal-mailjet-icon", "logo-portal-mailjet-icon-wordmark", "logo-portal-message-media-icon", "logo-portal-message-media-icon-wordmark", "logo-portal-sinch-account-icon-wordmark", "logo-portal-sinch-id-icon-wordmark", "logo-simple-texting-icon", "logo-simple-texting-icon-wordmark", "logo-sinch-icon", "logo-sinch-icon-wordmark", "animation-engage-logo", "animation-sinch-logo"];
|
|
2
|
+
export declare const BASE_ASSET_NAMES: Set<"icon-branded-5g-readiness" | "icon-branded-abcd" | "icon-branded-ai" | "icon-branded-airplane" | "icon-branded-announcement" | "icon-branded-barchart-down" | "icon-branded-barchart-up" | "icon-branded-bell" | "icon-branded-bell-notification" | "icon-branded-bell-off" | "icon-branded-billing" | "icon-branded-boat" | "icon-branded-book" | "icon-branded-calendar" | "icon-branded-call" | "icon-branded-call-and-verified" | "icon-branded-calling-api" | "icon-branded-campaigns" | "icon-branded-car" | "icon-branded-channels" | "icon-branded-chat" | "icon-branded-chat-message" | "icon-branded-chatbot" | "icon-branded-chatlayer" | "icon-branded-cloud" | "icon-branded-connection" | "icon-branded-contact" | "icon-branded-contact-center" | "icon-branded-contact-pro" | "icon-branded-cookies" | "icon-branded-credit-card" | "icon-branded-custom" | "icon-branded-custom-message" | "icon-branded-customer-satisfaction-smiley" | "icon-branded-database" | "icon-branded-decision" | "icon-branded-developer" | "icon-branded-direction" | "icon-branded-easytouse" | "icon-branded-edit" | "icon-branded-finance" | "icon-branded-flow" | "icon-branded-flow-chart" | "icon-branded-global" | "icon-branded-global-settings" | "icon-branded-gym" | "icon-branded-handshaking" | "icon-branded-health-insurance" | "icon-branded-healthcare" | "icon-branded-help" | "icon-branded-home" | "icon-branded-idea" | "icon-branded-integration" | "icon-branded-intelligent-revenue-maximisation" | "icon-branded-laptop" | "icon-branded-layout" | "icon-branded-line-chart-down" | "icon-branded-line-chart-up" | "icon-branded-lock" | "icon-branded-logistic" | "icon-branded-long-message" | "icon-branded-loop" | "icon-branded-low-cost" | "icon-branded-make-it-happen" | "icon-branded-make-money" | "icon-branded-massage" | "icon-branded-media" | "icon-branded-message" | "icon-branded-message-questions" | "icon-branded-messaging" | "icon-branded-mic" | "icon-branded-mms" | "icon-branded-mobile" | "icon-branded-mobile-intergration" | "icon-branded-mobile-numbers" | "icon-branded-money" | "icon-branded-multiple-channels" | "icon-branded-music" | "icon-branded-mute" | "icon-branded-news" | "icon-branded-numbers" | "icon-branded-office" | "icon-branded-office-activities" | "icon-branded-opened-message" | "icon-branded-operators" | "icon-branded-package" | "icon-branded-path" | "icon-branded-perso-message" | "icon-branded-pie-chart" | "icon-branded-piggybank" | "icon-branded-pin" | "icon-branded-price-tag" | "icon-branded-protection" | "icon-branded-purpose" | "icon-branded-push" | "icon-branded-puzzle" | "icon-branded-queue" | "icon-branded-rcs" | "icon-branded-retail" | "icon-branded-rich-content" | "icon-branded-rocket" | "icon-branded-roi" | "icon-branded-search" | "icon-branded-send" | "icon-branded-settings" | "icon-branded-shopping-cart" | "icon-branded-sms" | "icon-branded-support" | "icon-branded-system-settings" | "icon-branded-telemast" | "icon-branded-thumbs-down" | "icon-branded-thumbs-up" | "icon-branded-time" | "icon-branded-tutorial" | "icon-branded-user" | "icon-branded-users" | "icon-branded-verification-api" | "icon-branded-verified-phone" | "icon-branded-video-calling" | "icon-branded-video-off" | "icon-branded-video-on" | "icon-branded-voice-calling" | "icon-branded-voice-video-and-data" | "icon-branded-webhook" | "icon-branded-wheels" | "icon-branded-wi-fi" | "icon-channel-apple-business-chat" | "icon-channel-apple-business-chat-square" | "icon-channel-facebook" | "icon-channel-facebook-messenger" | "icon-channel-facebook-messenger-square" | "icon-channel-facebook-square" | "icon-channel-google-business" | "icon-channel-google-business-square" | "icon-channel-instagram" | "icon-channel-instagram-square" | "icon-channel-line" | "icon-channel-line-square" | "icon-channel-mms-round" | "icon-channel-mms-square" | "icon-channel-notify" | "icon-channel-notify-square" | "icon-channel-push-round" | "icon-channel-push-square" | "icon-channel-rcs-round" | "icon-channel-rcs-square" | "icon-channel-sms-round" | "icon-channel-sms-square" | "icon-channel-talk" | "icon-channel-talk-square" | "icon-channel-telegram" | "icon-channel-telegram-square" | "icon-channel-twitter" | "icon-channel-twitter-square" | "icon-channel-viber" | "icon-channel-viber-square" | "icon-channel-webchat-round" | "icon-channel-webchat-square" | "icon-channel-wechat" | "icon-channel-wechat-square" | "icon-channel-whatsapp" | "icon-channel-whatsapp-square" | "illustration-5g" | "illustration-about-page" | "illustration-bank" | "illustration-boost" | "illustration-buildvoicebot" | "illustration-call-center" | "illustration-cat" | "illustration-cat-texting" | "illustration-chat-bot" | "illustration-check" | "illustration-code" | "illustration-contact-us" | "illustration-contactus" | "illustration-conversation-api" | "illustration-cooking" | "illustration-costumer-support" | "illustration-credit-card" | "illustration-credit-card-30-degrees" | "illustration-cute-bee" | "illustration-decorative-flamingo" | "illustration-decorative-rainbow" | "illustration-delivery-service-package" | "illustration-desktop" | "illustration-document" | "illustration-dream-big" | "illustration-flower-hand" | "illustration-football" | "illustration-geometric-shapes-passing" | "illustration-girl-on-phone" | "illustration-global-reach" | "illustration-hand-ok" | "illustration-hands-laptop" | "illustration-handset-omnichannel-messages" | "illustration-happy-text" | "illustration-headphones" | "illustration-heart" | "illustration-hero-messages" | "illustration-hero-page" | "illustration-jump" | "illustration-laptop-holding" | "illustration-laptop-sitting-verified" | "illustration-lightbulb" | "illustration-lightning" | "illustration-lock" | "illustration-lying-and-looking-at-the-phone" | "illustration-magnifying-glass" | "illustration-man-on-right" | "illustration-meeting-scrum" | "illustration-meeting-scrum-2" | "illustration-megaphone" | "illustration-menu" | "illustration-message-passing" | "illustration-message-recieved" | "illustration-messages" | "illustration-messages-on-yellow-bg" | "illustration-messages-shopping" | "illustration-monitor" | "illustration-numbers-passing" | "illustration-office-worker" | "illustration-old-person-on-phone" | "illustration-omnichannel-messaging" | "illustration-on-a-cloud" | "illustration-on-the-phone" | "illustration-parcel-delivery" | "illustration-passing-heart" | "illustration-passing-heart-cool" | "illustration-person-lightbulb-backpack" | "illustration-person-on-phone" | "illustration-person-on-walk" | "illustration-person-with-dog" | "illustration-person-with-phone" | "illustration-phone-and-cat" | "illustration-pineapple" | "illustration-pizza" | "illustration-plane" | "illustration-presenting-charts" | "illustration-product-page" | "illustration-product-page-2" | "illustration-scooter" | "illustration-security" | "illustration-security-camera" | "illustration-sherlockholmes" | "illustration-shoe" | "illustration-shopping" | "illustration-shopping-cart" | "illustration-sick-kid" | "illustration-sitting-messaging" | "illustration-sitting-person" | "illustration-sitting-person-2" | "illustration-sofa" | "illustration-stats" | "illustration-support-center" | "illustration-supporting-device" | "illustration-supporting-device-2" | "illustration-supporting-device-3" | "illustration-supporting-device-4" | "illustration-surf" | "illustration-taxi" | "illustration-taxi-2" | "illustration-teamwork-from-phone" | "illustration-telemast" | "illustration-texting-sitting" | "illustration-texting-sofa" | "illustration-train" | "illustration-video-voice-call" | "illustration-voicebot" | "illustration-walking-on-phone" | "illustration-what-tools" | "illustration-win-together" | "illustration-win-together-two-people" | "illustration-wizard" | "illustration-woman-hand-lifted" | "illustration-woman-on-left" | "illustration-woman-on-right" | "logo-campaigns-icon" | "logo-campaigns-icon-wordmark" | "logo-chatlayer-icon" | "logo-chatlayer-icon-wordmark" | "logo-contact-pro-icon" | "logo-contact-pro-icon-wordmark" | "logo-email-on-acid-icon" | "logo-email-on-acid-icon-wordmark" | "logo-engage-icon" | "logo-engage-icon-wordmark" | "logo-mailgun-icon" | "logo-mailgun-icon-wordmark" | "logo-mailjet-icon" | "logo-mailjet-icon-wordmark" | "logo-message-media-icon" | "logo-message-media-icon-wordmark" | "logo-message-studio-icon" | "logo-message-studio-icon-wordmark" | "logo-nectary-icon" | "logo-nectary-icon-wordmark" | "logo-portal-build-icon" | "logo-portal-build-icon-wordmark" | "logo-portal-connect-icon" | "logo-portal-connect-icon-wordmark" | "logo-portal-engage-icon" | "logo-portal-engage-icon-wordmark" | "logo-portal-mailgun-icon" | "logo-portal-mailgun-icon-wordmark" | "logo-portal-mailjet-icon" | "logo-portal-mailjet-icon-wordmark" | "logo-portal-message-media-icon" | "logo-portal-message-media-icon-wordmark" | "logo-portal-sinch-account-icon-wordmark" | "logo-portal-sinch-id-icon-wordmark" | "logo-simple-texting-icon" | "logo-simple-texting-icon-wordmark" | "logo-sinch-icon" | "logo-sinch-icon-wordmark" | "animation-engage-logo" | "animation-sinch-logo">;
|
|
3
3
|
export type AssetName = `sinch-${typeof BASE_ASSET_NAMES_LIST[number]}`;
|
|
4
4
|
export declare const NAME_TO_PATH_MAP: Map<string, string>;
|
package/utils/asset-names.js
CHANGED
package/utils/element.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ declare const BASE_ASSET_NAMES_LIST: readonly [
|
|
|
31
31
|
"icon-branded-chat",
|
|
32
32
|
"icon-branded-chat-message",
|
|
33
33
|
"icon-branded-chatbot",
|
|
34
|
-
"icon-branded-
|
|
34
|
+
"icon-branded-chatlayer",
|
|
35
35
|
"icon-branded-cloud",
|
|
36
36
|
"icon-branded-connection",
|
|
37
37
|
"icon-branded-contact",
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
const ASSETS_STORE_KEY = Symbol.for("NectaryAssetsStore");
|
|
2
2
|
const ASSETS_REGISTRY_URL = "https://registry.npmjs.org/@nectary/assets";
|
|
3
|
-
const ASSETS_CDN_URL = "https://esm.sh/@nectary/assets";
|
|
4
3
|
export {
|
|
5
|
-
ASSETS_CDN_URL,
|
|
6
4
|
ASSETS_REGISTRY_URL,
|
|
7
5
|
ASSETS_STORE_KEY
|
|
8
6
|
};
|
|
@@ -4,49 +4,28 @@ export type SinchElementName = `sinch-${string}`;
|
|
|
4
4
|
export interface GlobalManagerConfig {
|
|
5
5
|
storeKey: symbol;
|
|
6
6
|
registryUrl: string;
|
|
7
|
-
cdnUrl: string;
|
|
8
7
|
baseElementNames: Set<string>;
|
|
9
8
|
nameToPathMap?: Map<string, string>;
|
|
10
9
|
}
|
|
11
10
|
export interface GlobalManagerInitOptions {
|
|
12
11
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* When preload is true:
|
|
16
|
-
*
|
|
17
|
-
* targetlibVersion will only work since v5 of nectary/components and v3 of nectary/assets.
|
|
18
|
-
*
|
|
19
|
-
* parchPreviousVersions will have no effect since its not needed.
|
|
20
|
-
*
|
|
21
|
-
* fallbackLoaderBundle will be used instead of fallbackLoader
|
|
22
|
-
*/
|
|
23
|
-
preload?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Target version of the library to resolve the constructor from the CDN.
|
|
26
|
-
*
|
|
27
|
-
* If left unspecified, it will resolve to the latest version.
|
|
12
|
+
* URL to resolve the modules from
|
|
28
13
|
*/
|
|
29
|
-
|
|
14
|
+
cdnUrl: string;
|
|
30
15
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* @default true
|
|
16
|
+
* Fallback URL to resolve the modules from if `cdnUrl` fails
|
|
34
17
|
*/
|
|
35
|
-
|
|
18
|
+
fallbackCdnUrl?: string;
|
|
36
19
|
/**
|
|
37
|
-
*
|
|
20
|
+
* Preloads all components from the bundle.js module
|
|
38
21
|
*/
|
|
39
|
-
|
|
22
|
+
preload?: boolean;
|
|
40
23
|
/**
|
|
41
|
-
*
|
|
24
|
+
* Target version of the library to resolve
|
|
42
25
|
*
|
|
43
|
-
*
|
|
44
|
-
*/
|
|
45
|
-
fallbackLoaderBundle?: () => Promise<any>;
|
|
46
|
-
/**
|
|
47
|
-
* Constructors will be resolved from fallback directly and CDN will not be used.
|
|
26
|
+
* If left unspecified, it will resolve to the latest version
|
|
48
27
|
*/
|
|
49
|
-
|
|
28
|
+
targetlibVersion?: string;
|
|
50
29
|
}
|
|
51
30
|
declare abstract class GlobalElementsManager {
|
|
52
31
|
private config;
|
|
@@ -57,9 +36,10 @@ declare abstract class GlobalElementsManager {
|
|
|
57
36
|
private loadModuleWithFallback;
|
|
58
37
|
private createLoader;
|
|
59
38
|
private preloadBundle;
|
|
60
|
-
init(options
|
|
39
|
+
init(options: GlobalManagerInitOptions): Promise<void>;
|
|
61
40
|
whenLoaded(): Promise<void>;
|
|
62
|
-
private
|
|
41
|
+
private getImportPath;
|
|
42
|
+
private getModulePath;
|
|
63
43
|
preload(name: SinchElementName | SinchElementName[] | "all"): Promise<void>;
|
|
64
44
|
}
|
|
65
45
|
declare class GlobalAssetsManagerImpl extends GlobalElementsManager {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { GlobalElementsManager } from "./shared/global-elements-manager.js";
|
|
2
2
|
import { NAME_TO_PATH_MAP, BASE_ASSET_NAMES } from "./asset-names.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ASSETS_REGISTRY_URL, ASSETS_STORE_KEY } from "./global-assets-constants.js";
|
|
4
4
|
class GlobalAssetsManagerImpl extends GlobalElementsManager {
|
|
5
5
|
static instance = null;
|
|
6
6
|
constructor() {
|
|
7
7
|
super({
|
|
8
8
|
storeKey: ASSETS_STORE_KEY,
|
|
9
9
|
registryUrl: ASSETS_REGISTRY_URL,
|
|
10
|
-
cdnUrl: ASSETS_CDN_URL,
|
|
11
10
|
baseElementNames: BASE_ASSET_NAMES,
|
|
12
11
|
nameToPathMap: NAME_TO_PATH_MAP
|
|
13
12
|
});
|
|
@@ -2,49 +2,28 @@ import type { SinchElementName } from './nectary-element-base';
|
|
|
2
2
|
interface GlobalManagerConfig {
|
|
3
3
|
storeKey: symbol;
|
|
4
4
|
registryUrl: string;
|
|
5
|
-
cdnUrl: string;
|
|
6
5
|
baseElementNames: Set<string>;
|
|
7
6
|
nameToPathMap?: Map<string, string>;
|
|
8
7
|
}
|
|
9
8
|
interface GlobalManagerInitOptions {
|
|
10
9
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* When preload is true:
|
|
14
|
-
*
|
|
15
|
-
* targetlibVersion will only work since v5 of nectary/components and v3 of nectary/assets.
|
|
16
|
-
*
|
|
17
|
-
* parchPreviousVersions will have no effect since its not needed.
|
|
18
|
-
*
|
|
19
|
-
* fallbackLoaderBundle will be used instead of fallbackLoader
|
|
20
|
-
*/
|
|
21
|
-
preload?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Target version of the library to resolve the constructor from the CDN.
|
|
24
|
-
*
|
|
25
|
-
* If left unspecified, it will resolve to the latest version.
|
|
10
|
+
* URL to resolve the modules from
|
|
26
11
|
*/
|
|
27
|
-
|
|
12
|
+
cdnUrl: string;
|
|
28
13
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* @default true
|
|
14
|
+
* Fallback URL to resolve the modules from if `cdnUrl` fails
|
|
32
15
|
*/
|
|
33
|
-
|
|
16
|
+
fallbackCdnUrl?: string;
|
|
34
17
|
/**
|
|
35
|
-
*
|
|
18
|
+
* Preloads all components from the bundle.js module
|
|
36
19
|
*/
|
|
37
|
-
|
|
20
|
+
preload?: boolean;
|
|
38
21
|
/**
|
|
39
|
-
*
|
|
22
|
+
* Target version of the library to resolve
|
|
40
23
|
*
|
|
41
|
-
*
|
|
42
|
-
*/
|
|
43
|
-
fallbackLoaderBundle?: () => Promise<any>;
|
|
44
|
-
/**
|
|
45
|
-
* Constructors will be resolved from fallback directly and CDN will not be used.
|
|
24
|
+
* If left unspecified, it will resolve to the latest version
|
|
46
25
|
*/
|
|
47
|
-
|
|
26
|
+
targetlibVersion?: string;
|
|
48
27
|
}
|
|
49
28
|
export declare abstract class GlobalElementsManager {
|
|
50
29
|
private config;
|
|
@@ -55,9 +34,10 @@ export declare abstract class GlobalElementsManager {
|
|
|
55
34
|
private loadModuleWithFallback;
|
|
56
35
|
private createLoader;
|
|
57
36
|
private preloadBundle;
|
|
58
|
-
init(options
|
|
37
|
+
init(options: GlobalManagerInitOptions): Promise<void>;
|
|
59
38
|
whenLoaded(): Promise<void>;
|
|
60
|
-
private
|
|
39
|
+
private getImportPath;
|
|
40
|
+
private getModulePath;
|
|
61
41
|
preload(name: SinchElementName | SinchElementName[] | 'all'): Promise<void>;
|
|
62
42
|
}
|
|
63
43
|
export {};
|
|
@@ -39,10 +39,10 @@ class GlobalElementsManager {
|
|
|
39
39
|
toClassName(itemName) {
|
|
40
40
|
return itemName.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
41
41
|
}
|
|
42
|
-
async loadModuleWithFallback(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
async loadModuleWithFallback(modulePath) {
|
|
43
|
+
const store = getStore(this.config.storeKey);
|
|
44
|
+
const importPath = this.getImportPath(store.cdnUrl, modulePath);
|
|
45
|
+
const fallbackImportPath = this.getImportPath(store.fallbackCdnUrl, modulePath);
|
|
46
46
|
try {
|
|
47
47
|
const module = await import(
|
|
48
48
|
/* webpackIgnore: true */
|
|
@@ -50,12 +50,16 @@ class GlobalElementsManager {
|
|
|
50
50
|
);
|
|
51
51
|
return module;
|
|
52
52
|
} catch (error) {
|
|
53
|
-
if (
|
|
53
|
+
if (fallbackImportPath !== null) {
|
|
54
54
|
try {
|
|
55
|
-
|
|
55
|
+
const fallbackModule = await import(
|
|
56
|
+
/* webpackIgnore: true */
|
|
57
|
+
fallbackImportPath
|
|
58
|
+
);
|
|
59
|
+
return fallbackModule;
|
|
56
60
|
} catch (fallbackError) {
|
|
57
61
|
console.error(`Nectary Primary load failed: ${importPath}`, error);
|
|
58
|
-
console.error(`Nectary fallback load failed
|
|
62
|
+
console.error(`Nectary fallback load failed: ${fallbackImportPath}`, fallbackError);
|
|
59
63
|
throw fallbackError;
|
|
60
64
|
}
|
|
61
65
|
}
|
|
@@ -63,34 +67,26 @@ class GlobalElementsManager {
|
|
|
63
67
|
throw error;
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
|
-
createLoader(
|
|
70
|
+
createLoader(modulePath, itemName) {
|
|
67
71
|
return async () => {
|
|
68
|
-
const module = await this.loadModuleWithFallback(
|
|
69
|
-
importPath,
|
|
70
|
-
fallbackLoader != null ? () => fallbackLoader(itemName) : null,
|
|
71
|
-
useFallbackExclusively
|
|
72
|
-
);
|
|
72
|
+
const module = await this.loadModuleWithFallback(modulePath);
|
|
73
73
|
const className = this.toClassName(itemName);
|
|
74
74
|
const globalConstructor = module[className];
|
|
75
75
|
if (globalConstructor == null) {
|
|
76
|
-
throw new Error(`Nectary element ${className} not found in module
|
|
76
|
+
throw new Error(`Nectary element ${className} not found in module`);
|
|
77
77
|
}
|
|
78
78
|
globalConstructor.isGlobal = true;
|
|
79
79
|
return globalConstructor;
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
|
-
async preloadBundle(
|
|
82
|
+
async preloadBundle() {
|
|
83
83
|
const store = getStore(this.config.storeKey);
|
|
84
|
-
const module = await this.loadModuleWithFallback(
|
|
85
|
-
importPath,
|
|
86
|
-
fallbackLoaderBundle,
|
|
87
|
-
useFallbackExclusively
|
|
88
|
-
);
|
|
84
|
+
const module = await this.loadModuleWithFallback("bundle");
|
|
89
85
|
for (const itemName of this.config.baseElementNames) {
|
|
90
86
|
const className = this.toClassName(itemName);
|
|
91
87
|
const globalConstructor = module[className];
|
|
92
88
|
if (globalConstructor == null) {
|
|
93
|
-
console.error(`Nectary element ${className} not found in module
|
|
89
|
+
console.error(`Nectary element ${className} not found in module`);
|
|
94
90
|
continue;
|
|
95
91
|
}
|
|
96
92
|
globalConstructor.isGlobal = true;
|
|
@@ -99,41 +95,35 @@ class GlobalElementsManager {
|
|
|
99
95
|
window.customElements.define(sinchName, globalConstructor);
|
|
100
96
|
}
|
|
101
97
|
}
|
|
102
|
-
async init(options
|
|
98
|
+
async init(options) {
|
|
103
99
|
const store = getStore(this.config.storeKey);
|
|
104
100
|
if (store.hasInitialized) {
|
|
105
101
|
console.warn(`${this.constructor.name} has already been initialized`);
|
|
106
102
|
return;
|
|
107
103
|
}
|
|
108
104
|
store.hasInitialized = true;
|
|
105
|
+
store.cdnUrl = options.cdnUrl;
|
|
106
|
+
store.fallbackCdnUrl = options.fallbackCdnUrl ?? "";
|
|
107
|
+
store.targetlibVersion = options.targetlibVersion ?? "";
|
|
109
108
|
store.preload = options.preload ?? false;
|
|
110
|
-
store.patchPerviousVersions = options.patchPerviousVersions ?? true;
|
|
111
|
-
store.useFallbackExclusively = options.useFallbackExclusively ?? false;
|
|
112
109
|
try {
|
|
113
110
|
if (store.preload) {
|
|
114
|
-
|
|
115
|
-
store.targetlibVersion = version ?? store.targetlibVersion;
|
|
116
|
-
const importPath = version != null ? `${this.config.cdnUrl}@${version}/es2022/bundle.mjs` : `${this.config.cdnUrl}/bundle`;
|
|
117
|
-
await this.preloadBundle(importPath, options.fallbackLoaderBundle, store.useFallbackExclusively);
|
|
111
|
+
await this.preloadBundle();
|
|
118
112
|
} else {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
} else {
|
|
113
|
+
this.patchCustomElements();
|
|
114
|
+
const setDefinitions = () => {
|
|
115
|
+
this.config.baseElementNames.forEach((name) => {
|
|
116
|
+
const modulePath = this.getModulePath(name);
|
|
117
|
+
store.definitions.set(`sinch-${name}`, this.createLoader(modulePath, name));
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
setDefinitions();
|
|
121
|
+
if (store.targetlibVersion.length === 0) {
|
|
129
122
|
const registry = await fetch(`${this.config.registryUrl}/latest`);
|
|
130
123
|
const registryData = await registry.json();
|
|
131
124
|
store.targetlibVersion = registryData.version;
|
|
132
125
|
}
|
|
133
|
-
|
|
134
|
-
const importPath = `${this.config.cdnUrl}@${store.targetlibVersion}/es2022/${this.getImportPathFromName(name)}.mjs`;
|
|
135
|
-
store.definitions.set(`sinch-${name}`, this.createLoader(importPath, name, options.fallbackLoader, store.useFallbackExclusively));
|
|
136
|
-
});
|
|
126
|
+
setDefinitions();
|
|
137
127
|
}
|
|
138
128
|
} finally {
|
|
139
129
|
store.loadPromise.resolve();
|
|
@@ -143,7 +133,24 @@ class GlobalElementsManager {
|
|
|
143
133
|
const store = getStore(this.config.storeKey);
|
|
144
134
|
return store.loadPromise.promise;
|
|
145
135
|
}
|
|
146
|
-
|
|
136
|
+
getImportPath(cdnUrl, modulePath) {
|
|
137
|
+
if (cdnUrl.length === 0) {
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
const store = getStore(this.config.storeKey);
|
|
141
|
+
const host = new URL(cdnUrl).host;
|
|
142
|
+
if (host === "esm.sh") {
|
|
143
|
+
if (store.targetlibVersion.length !== 0) {
|
|
144
|
+
return `${cdnUrl}@${store.targetlibVersion}/es2022/${modulePath}.mjs`;
|
|
145
|
+
}
|
|
146
|
+
return `${cdnUrl}/${modulePath}`;
|
|
147
|
+
}
|
|
148
|
+
if (store.targetlibVersion.length !== 0) {
|
|
149
|
+
return `${cdnUrl}/${store.targetlibVersion}/${modulePath}.js`;
|
|
150
|
+
}
|
|
151
|
+
return `${cdnUrl}/latest/${modulePath}.js`;
|
|
152
|
+
}
|
|
153
|
+
getModulePath(name) {
|
|
147
154
|
for (const [key, value] of this.config.nameToPathMap ?? []) {
|
|
148
155
|
const splittedName = name.startsWith(key) ? name.split(key) : [name];
|
|
149
156
|
if (splittedName.length > 1) {
|
|
@@ -3,9 +3,9 @@ interface GlobalStore {
|
|
|
3
3
|
definitions: Map<SinchElementName, () => Promise<any>>;
|
|
4
4
|
hasInitialized: boolean;
|
|
5
5
|
targetlibVersion: string;
|
|
6
|
-
patchPerviousVersions: boolean;
|
|
7
|
-
useFallbackExclusively: boolean;
|
|
8
6
|
preload: boolean;
|
|
7
|
+
cdnUrl: string;
|
|
8
|
+
fallbackCdnUrl: string;
|
|
9
9
|
loadPromise: {
|
|
10
10
|
promise: Promise<void>;
|
|
11
11
|
resolve: (value: void) => void;
|
|
@@ -13,8 +13,8 @@ const getStore = (storeKey) => {
|
|
|
13
13
|
definitions: /* @__PURE__ */ new Map(),
|
|
14
14
|
hasInitialized: false,
|
|
15
15
|
targetlibVersion: "",
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
cdnUrl: "",
|
|
17
|
+
fallbackCdnUrl: "",
|
|
18
18
|
preload: false,
|
|
19
19
|
loadPromise: createDeferredPromise()
|
|
20
20
|
};
|