@servicetitan/web-components 23.0.0 → 23.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.
Files changed (94) hide show
  1. package/dist/__mocks__/index.d.ts +3 -0
  2. package/dist/__mocks__/index.d.ts.map +1 -0
  3. package/dist/__mocks__/index.js +3 -0
  4. package/dist/__mocks__/index.js.map +1 -0
  5. package/dist/__mocks__/register-component.d.ts +4 -0
  6. package/dist/__mocks__/register-component.d.ts.map +1 -0
  7. package/dist/__mocks__/register-component.js +14 -0
  8. package/dist/__mocks__/register-component.js.map +1 -0
  9. package/dist/__mocks__/test-component.d.ts +3 -0
  10. package/dist/__mocks__/test-component.d.ts.map +1 -0
  11. package/dist/__mocks__/test-component.js +14 -0
  12. package/dist/__mocks__/test-component.js.map +1 -0
  13. package/dist/contexts/tests/mfe-data-context.test.js +1 -1
  14. package/dist/contexts/tests/mfe-data-context.test.js.map +1 -1
  15. package/dist/contexts/tests/mfe-metadata-context.test.js +1 -1
  16. package/dist/contexts/tests/mfe-metadata-context.test.js.map +1 -1
  17. package/dist/loader.d.ts +7 -17
  18. package/dist/loader.d.ts.map +1 -1
  19. package/dist/loader.js +74 -224
  20. package/dist/loader.js.map +1 -1
  21. package/dist/register.d.ts +4 -1
  22. package/dist/register.d.ts.map +1 -1
  23. package/dist/register.js +26 -13
  24. package/dist/register.js.map +1 -1
  25. package/dist/render.d.ts +11 -0
  26. package/dist/render.d.ts.map +1 -0
  27. package/dist/render.js +39 -0
  28. package/dist/render.js.map +1 -0
  29. package/dist/utils/get-bundle-info.d.ts +24 -0
  30. package/dist/utils/get-bundle-info.d.ts.map +1 -0
  31. package/dist/utils/get-bundle-info.js +98 -0
  32. package/dist/utils/get-bundle-info.js.map +1 -0
  33. package/dist/utils/get-entry-points.d.ts +6 -0
  34. package/dist/utils/get-entry-points.d.ts.map +1 -0
  35. package/dist/utils/get-entry-points.js +24 -0
  36. package/dist/utils/get-entry-points.js.map +1 -0
  37. package/dist/{get-mfe-supports-rerendering.d.ts → utils/get-mfe-supports-rerendering.d.ts} +1 -1
  38. package/dist/utils/get-mfe-supports-rerendering.d.ts.map +1 -0
  39. package/dist/utils/get-mfe-supports-rerendering.js.map +1 -0
  40. package/dist/{utils.d.ts → utils/get-version-mismatches.d.ts} +2 -3
  41. package/dist/utils/get-version-mismatches.d.ts.map +1 -0
  42. package/dist/{utils.js → utils/get-version-mismatches.js} +2 -10
  43. package/dist/utils/get-version-mismatches.js.map +1 -0
  44. package/dist/utils/index.d.ts +9 -0
  45. package/dist/utils/index.d.ts.map +1 -0
  46. package/dist/utils/index.js +9 -0
  47. package/dist/utils/index.js.map +1 -0
  48. package/dist/utils/is-versioned-url.d.ts +2 -0
  49. package/dist/utils/is-versioned-url.d.ts.map +1 -0
  50. package/dist/utils/is-versioned-url.js +9 -0
  51. package/dist/utils/is-versioned-url.js.map +1 -0
  52. package/dist/utils/load-scripts.d.ts +3 -0
  53. package/dist/utils/load-scripts.d.ts.map +1 -0
  54. package/dist/utils/load-scripts.js +31 -0
  55. package/dist/utils/load-scripts.js.map +1 -0
  56. package/dist/utils/validate-bundle-info.d.ts +7 -0
  57. package/dist/utils/validate-bundle-info.d.ts.map +1 -0
  58. package/dist/utils/validate-bundle-info.js +10 -0
  59. package/dist/utils/validate-bundle-info.js.map +1 -0
  60. package/dist/utils/web-component.d.ts +17 -0
  61. package/dist/utils/web-component.d.ts.map +1 -0
  62. package/dist/utils/web-component.js +54 -0
  63. package/dist/utils/web-component.js.map +1 -0
  64. package/package.json +17 -18
  65. package/src/__mocks__/index.ts +2 -0
  66. package/src/__mocks__/register-component.tsx +20 -0
  67. package/src/__mocks__/test-component.tsx +30 -0
  68. package/src/__tests__/event-bus.test.ts +3 -2
  69. package/src/__tests__/loader.test.tsx +17 -11
  70. package/src/__tests__/register-legacy-root.test.tsx +36 -0
  71. package/src/__tests__/register.test.tsx +16 -81
  72. package/src/contexts/tests/mfe-data-context.test.tsx +4 -4
  73. package/src/contexts/tests/mfe-metadata-context.test.tsx +4 -4
  74. package/src/loader.tsx +129 -374
  75. package/src/register.tsx +25 -14
  76. package/src/render.ts +62 -0
  77. package/src/{__tests__ → utils/__tests__}/get-mfe-supports-rerendering.test.ts +1 -1
  78. package/src/utils/__tests__/get-version-mismatches.test.ts +76 -0
  79. package/src/utils/__tests__/is-versioned-url.test.ts +18 -0
  80. package/src/utils/get-bundle-info.ts +121 -0
  81. package/src/utils/get-entry-points.ts +23 -0
  82. package/src/{get-mfe-supports-rerendering.ts → utils/get-mfe-supports-rerendering.ts} +1 -1
  83. package/src/{utils.ts → utils/get-version-mismatches.ts} +1 -12
  84. package/src/utils/index.ts +8 -0
  85. package/src/utils/is-versioned-url.ts +11 -0
  86. package/src/utils/load-scripts.ts +38 -0
  87. package/src/utils/validate-bundle-info.ts +15 -0
  88. package/src/utils/web-component.tsx +96 -0
  89. package/dist/get-mfe-supports-rerendering.d.ts.map +0 -1
  90. package/dist/get-mfe-supports-rerendering.js.map +0 -1
  91. package/dist/utils.d.ts.map +0 -1
  92. package/dist/utils.js.map +0 -1
  93. package/src/__tests__/utils.test.ts +0 -95
  94. /package/dist/{get-mfe-supports-rerendering.js → utils/get-mfe-supports-rerendering.js} +0 -0
package/dist/register.js CHANGED
@@ -1,14 +1,15 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { render, unmountComponentAtNode } from 'react-dom';
3
- import { Log } from '@servicetitan/log-service';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect } from 'react';
4
3
  import { DefaultPortalContext, TablePopupPropsContext } from '@servicetitan/design-system';
4
+ import { Log } from '@servicetitan/log-service';
5
5
  import { Provider } from '@servicetitan/react-ioc';
6
6
  import { EXPOSED_DEPENDENCIES_TOKEN, BASENAME_TOKEN, IS_WEB_COMPONENT_TOKEN, RENDER_ROOT_TOKEN, } from './common';
7
- import { EVENT_BUS_TOKEN } from './event-bus';
8
- import { HistoryManager } from './history-manager';
9
- import { WEB_COMPONENT_NAME } from './globals';
10
7
  import { MFEDataContext } from './contexts/mfe-data-context';
11
8
  import { MFEMetadataContext } from './contexts/mfe-metadata-context';
9
+ import { EVENT_BUS_TOKEN } from './event-bus';
10
+ import { WEB_COMPONENT_NAME } from './globals';
11
+ import { HistoryManager } from './history-manager';
12
+ import { render } from './render';
12
13
  function createLink(url, onLoad) {
13
14
  const element = document.createElement('link');
14
15
  element.href = url;
@@ -19,7 +20,7 @@ function createLink(url, onLoad) {
19
20
  return element;
20
21
  }
21
22
  const Placeholder = () => _jsx("div", { style: { display: 'none' } });
22
- export function register(Component, light) {
23
+ export function register(Component, light, options) {
23
24
  class WebComponent extends HTMLElement {
24
25
  constructor() {
25
26
  super(...arguments);
@@ -83,6 +84,12 @@ export function register(Component, light) {
83
84
  writable: true,
84
85
  value: void 0
85
86
  });
87
+ Object.defineProperty(this, "view", {
88
+ enumerable: true,
89
+ configurable: true,
90
+ writable: true,
91
+ value: void 0
92
+ });
86
93
  Object.defineProperty(this, "provide", {
87
94
  enumerable: true,
88
95
  configurable: true,
@@ -128,6 +135,7 @@ export function register(Component, light) {
128
135
  configurable: true,
129
136
  writable: true,
130
137
  value: () => {
138
+ var _a;
131
139
  /*
132
140
  * Check for this.root first, otherwise we get error when
133
141
  * attributeChangedCallback happens on load
@@ -148,7 +156,7 @@ export function register(Component, light) {
148
156
  shadowRoot: this.root,
149
157
  portalShadowRoot: this.portal,
150
158
  };
151
- render(_jsx(Provider, Object.assign({ singletons: [
159
+ (_a = this.view) === null || _a === void 0 ? void 0 : _a.rerender(_jsx(Provider, Object.assign({ singletons: [
152
160
  { provide: IS_WEB_COMPONENT_TOKEN, useValue: true },
153
161
  { provide: RENDER_ROOT_TOKEN, useValue: this.root },
154
162
  ] }, { children: _jsx(DefaultPortalContext.Provider, Object.assign({ value: this.portal }, { children: _jsx(TablePopupPropsContext.Provider, Object.assign({ value: props => (Object.assign(Object.assign({}, props), { appendTo: this.root })) }, { children: _jsx(Provider, Object.assign({ singletons: [
@@ -160,7 +168,7 @@ export function register(Component, light) {
160
168
  },
161
169
  { provide: EVENT_BUS_TOKEN, useValue: this.eventBus },
162
170
  { provide: BASENAME_TOKEN, useValue: this.basename },
163
- ].filter(({ useValue }) => useValue !== undefined) }, { children: _jsx(MFEDataContext.Provider, Object.assign({ value: Object.assign({}, mfeData) }, { children: _jsx(MFEMetadataContext.Provider, Object.assign({ value: metadata }, { children: _jsx(Component, Object.assign({}, mfeData)) })) })) })) })) })) })), this.root, this.onReady);
171
+ ].filter(({ useValue }) => useValue !== undefined) }, { children: _jsx(MFEDataContext.Provider, Object.assign({ value: Object.assign({}, mfeData) }, { children: _jsxs(MFEMetadataContext.Provider, Object.assign({ value: metadata }, { children: [_jsx(Component, Object.assign({}, mfeData)), this.onReady && (_jsx(RenderCallback, { callback: this.onReady }))] })) })) })) })) })) })));
164
172
  }
165
173
  }
166
174
  });
@@ -199,23 +207,23 @@ export function register(Component, light) {
199
207
  this.portal = document.body
200
208
  .appendChild(document.createElement('div'))
201
209
  .attachShadow({ mode: 'open' });
202
- render(_jsx(Placeholder, {}), this.root);
210
+ this.view = render(_jsx(Placeholder, {}), this.root, options);
203
211
  this.styles.elements.push(...this.attachStyles(this.root, styleUrls));
204
212
  this.styles.elements.push(...this.attachStyles(this.portal, styleUrls));
205
213
  }
206
214
  disconnectedCallback() {
207
- var _a, _b;
215
+ var _a, _b, _c;
208
216
  if (!this.root || ((_a = this.root) === null || _a === void 0 ? void 0 : _a.isConnected)) {
209
217
  return;
210
218
  }
211
219
  for (const element of this.styles.elements) {
212
220
  element.remove();
213
221
  }
214
- unmountComponentAtNode(this.root);
222
+ (_b = this.view) === null || _b === void 0 ? void 0 : _b.unmount();
215
223
  document.body.removeChild(this.portal.host);
216
224
  this.root = undefined;
217
225
  this.portal = undefined;
218
- (_b = this.onDispose) === null || _b === void 0 ? void 0 : _b.call(this);
226
+ (_c = this.onDispose) === null || _c === void 0 ? void 0 : _c.call(this);
219
227
  }
220
228
  // Observe changes to the data-mfe-data attribute so that we can re-render when it changes
221
229
  static get observedAttributes() {
@@ -232,4 +240,9 @@ export function register(Component, light) {
232
240
  }
233
241
  window.customElements.define(WEB_COMPONENT_NAME, WebComponent);
234
242
  }
243
+ function RenderCallback({ callback }) {
244
+ // eslint-disable-next-line react-hooks/exhaustive-deps
245
+ useEffect(() => callback(), []);
246
+ return null;
247
+ }
235
248
  //# sourceMappingURL=register.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAE3D,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC3F,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,OAAO,EAEH,0BAA0B,EAG1B,cAAc,EACd,sBAAsB,EACtB,iBAAiB,GACpB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAY,eAAe,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,SAAS,UAAU,CAAC,GAAW,EAAE,MAAkB;IAC/C,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAE/C,OAAO,CAAC,IAAI,GAAG,GAAG,CAAC;IACnB,OAAO,CAAC,GAAG,GAAG,YAAY,CAAC;IAC3B,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC;IAClC,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;IACxB,OAAO,C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AAM,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,cAAc,CAAC,EAAE,QAAQ,EAA4B;IAC1D,uDAAuD;IACvD,SAAS,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;IAChC,OAAO,IAAI,CAAC;AAChB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { ReactElement } from 'react';
2
+ interface RenderOptions {
3
+ legacyRoot?: boolean;
4
+ }
5
+ interface RenderResult {
6
+ rerender(element: ReactElement): void;
7
+ unmount(): void;
8
+ }
9
+ export declare function render(element: ReactElement, container: Element | DocumentFragment, options?: RenderOptions): RenderResult;
10
+ export {};
11
+ //# sourceMappingURL=render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAerC,UAAU,aAAa;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,UAAU,YAAY;IAClB,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC;IACtC,OAAO,IAAI,IAAI,CAAC;CACnB;AAED,wBAAgB,MAAM,CAClB,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,OAAO,GAAG,gBAAgB,EACrC,OAAO,CAAC,EAAE,aAAa,GACxB,YAAY,CAgBd"}
package/dist/render.js ADDED
@@ -0,0 +1,39 @@
1
+ import ReactDOM from 'react-dom';
2
+ let createRoot;
3
+ try {
4
+ /**
5
+ * Note, the webpack.IgnorePlugin must be configured to ignore this dependency.
6
+ * @see {@link file://./../../startup/src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts}
7
+ */
8
+ createRoot = require('react-dom/client').createRoot;
9
+ }
10
+ catch (e) {
11
+ // ignore
12
+ }
13
+ export function render(element, container, options) {
14
+ if (typeof createRoot !== 'function' || (options === null || options === void 0 ? void 0 : options.legacyRoot)) {
15
+ return renderLegacyRoot(element, container);
16
+ }
17
+ const root = createRoot(container);
18
+ root.render(element);
19
+ return {
20
+ rerender(element) {
21
+ root.render(element);
22
+ },
23
+ unmount() {
24
+ root.unmount();
25
+ },
26
+ };
27
+ }
28
+ function renderLegacyRoot(element, container) {
29
+ ReactDOM.render(element, container);
30
+ return {
31
+ rerender(element) {
32
+ ReactDOM.render(element, container);
33
+ },
34
+ unmount() {
35
+ ReactDOM.unmountComponentAtNode(container);
36
+ },
37
+ };
38
+ }
39
+ //# sourceMappingURL=render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,MAAM,WAAW,CAAC;AAGjC,IAAI,UAA4C,CAAC;AACjD,IAAI;IACA;;;OAGG;IACH,UAAU,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,UAAU,CAAC;CACvD;AAAC,OAAO,CAAC,EAAE;IACR,SAAS;CACZ;AAWD,MAAM,UAAU,MAAM,CAClB,OAAqB,EACrB,SAAqC,EACrC,OAAuB;IAEvB,IAAI,OAAO,UAAU,KAAK,UAAU,KAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,CAAA,EAAE;QACzD,OAAO,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;KAC/C;IAED,MAAM,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;IACnC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAErB,OAAO;QACH,QAAQ,CAAC,OAAqB;YAC1B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACzB,CAAC;QACD,OAAO;YACH,IAAI,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC;KACJ,CAAC;AACN,CAAC;AAED,SAAS,gBAAgB,CACrB,OAAqB,EACrB,SAAqC;IAErC,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAEpC,OAAO;QACH,QAAQ,CAAC,OAAqB;YAC1B,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QACxC,CAAC;QACD,OAAO;YACH,QAAQ,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;QAC/C,CAAC;KACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { ExposedDependencies, GetJsonError } from '../common';
2
+ import { EntryPoints } from './get-entry-points';
3
+ export interface Metadata {
4
+ name: string;
5
+ bundledWith?: Record<string, string | undefined>;
6
+ sharedDependencies: Record<string, string>;
7
+ dependencies?: Record<string, string>;
8
+ entrypoints?: Record<string, {
9
+ css: string[];
10
+ js: string[];
11
+ }>;
12
+ }
13
+ export declare type BundleInfo = Awaited<ReturnType<typeof getBundleInfo>>;
14
+ export declare function getBundleInfo(mainPackageUrl: string, fallbackPackageUrl: string | undefined, exposedDependencies?: ExposedDependencies, signal?: AbortSignal, retries?: number, onRequestError?: (error: GetJsonError) => void): Promise<{
15
+ disposer: () => void;
16
+ mfeSupportsRerendering: boolean;
17
+ mismatch: Record<string, {
18
+ host: string;
19
+ package: string;
20
+ }> | undefined;
21
+ urls: EntryPoints;
22
+ WebComponent: any;
23
+ }>;
24
+ //# sourceMappingURL=get-bundle-info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-bundle-info.d.ts","sourceRoot":"","sources":["../../src/utils/get-bundle-info.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAW,YAAY,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAAE,WAAW,EAAkB,MAAM,oBAAoB,CAAC;AAKjE,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACjD,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,EAAE,CAAC;QAAC,EAAE,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;CACjE;AAED,oBAAY,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC;AAEnE,wBAAsB,aAAa,CAC/B,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,MAAM,GAAG,SAAS,EACtC,mBAAmB,GAAE,mBAAwB,EAC7C,MAAM,CAAC,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,MAAM,EAChB,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI;;;;;;;;;GA+DjD"}
@@ -0,0 +1,98 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import semver from 'semver';
11
+ import get from 'lodash.get';
12
+ import { getJson } from '../common';
13
+ import { getEntrypoints } from './get-entry-points';
14
+ import { getMFESupportsRerendering } from './get-mfe-supports-rerendering';
15
+ import { getVersionMismatches } from './get-version-mismatches';
16
+ import { isVersionedUrl } from './is-versioned-url';
17
+ export function getBundleInfo(mainPackageUrl, fallbackPackageUrl, exposedDependencies = {}, signal, retries, onRequestError) {
18
+ var _a;
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ const { data: metadata, url: packageUrl } = yield getMetadata({
21
+ fallbackPackageUrl,
22
+ mainPackageUrl,
23
+ onRequestError,
24
+ retries,
25
+ signal,
26
+ });
27
+ const { bundledWith, name, sharedDependencies } = metadata;
28
+ const exactPackageUrl = packageUrl.replace('/dist/metadata.json', '');
29
+ const cache = getCacheSetting(exactPackageUrl);
30
+ let dependencies;
31
+ if (metadata.dependencies) {
32
+ dependencies = metadata.dependencies;
33
+ }
34
+ else {
35
+ const { data: packageJson } = yield getJson(`${exactPackageUrl}/package.json`, {
36
+ cache,
37
+ retries,
38
+ signal,
39
+ });
40
+ dependencies = packageJson.dependencies;
41
+ }
42
+ const mismatch = getVersionMismatches(exposedDependencies, dependencies, sharedDependencies);
43
+ const hasMismatch = !!Object.keys(mismatch).length;
44
+ const startupVersion = bundledWith === null || bundledWith === void 0 ? void 0 : bundledWith['@servicetitan/startup'];
45
+ const supportLightBundles = startupVersion && semver.gte(startupVersion, '17.0.0');
46
+ const embed = !hasMismatch && supportLightBundles;
47
+ const bundleType = embed ? 'light' : 'full';
48
+ const withBaseUrl = (path) => `${exactPackageUrl}/dist/bundle/${bundleType}/${path}`;
49
+ let entrypoints;
50
+ if ((_a = metadata.entrypoints) === null || _a === void 0 ? void 0 : _a[bundleType]) {
51
+ entrypoints = metadata.entrypoints[bundleType];
52
+ }
53
+ else {
54
+ entrypoints = yield getEntrypoints(withBaseUrl('entrypoints.json'), cache);
55
+ }
56
+ const disposer = () => {
57
+ if (embed) {
58
+ const path = Object.values(sharedDependencies).shift();
59
+ if (path) {
60
+ get(window, path).getStorage().clear(name);
61
+ }
62
+ }
63
+ };
64
+ const urls = Object.entries(entrypoints).reduce((result, [key, value]) => (Object.assign(Object.assign({}, result), { [key]: value.map(withBaseUrl) })), {});
65
+ return {
66
+ disposer,
67
+ mfeSupportsRerendering: getMFESupportsRerendering(bundledWith, dependencies),
68
+ mismatch: hasMismatch ? mismatch : undefined,
69
+ urls,
70
+ WebComponent: name,
71
+ };
72
+ });
73
+ }
74
+ function getMetadata(props) {
75
+ return __awaiter(this, void 0, void 0, function* () {
76
+ const { fallbackPackageUrl, mainPackageUrl, onRequestError, retries, signal } = props;
77
+ return getJson(`${mainPackageUrl}/dist/metadata.json`, {
78
+ cache: getCacheSetting(mainPackageUrl),
79
+ retries: fallbackPackageUrl ? 0 : retries,
80
+ onRequestError,
81
+ signal,
82
+ }).catch(e => {
83
+ if (!fallbackPackageUrl) {
84
+ throw e;
85
+ }
86
+ return getJson(`${fallbackPackageUrl}/dist/metadata.json`, {
87
+ retries,
88
+ onRequestError,
89
+ cache: getCacheSetting(fallbackPackageUrl),
90
+ signal,
91
+ });
92
+ });
93
+ });
94
+ }
95
+ function getCacheSetting(url) {
96
+ return isVersionedUrl(url) ? undefined : 'no-store';
97
+ }
98
+ //# sourceMappingURL=get-bundle-info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-bundle-info.js","sourceRoot":"","sources":["../../src/utils/get-bundle-info.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,GAAG,MAAM,YAAY,CAAC;AAE7B,OAAO,EAAuB,OAAO,EAAgB,MAAM,WAAW,CAAC;AACvE,OAAO,EAAe,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAYpD,MAAM,UAAgB,aAAa,CAC/B,cAAsB,EACtB,kBAAsC,EACtC,sBAA2C,EAAE,EAC7C,MAAoB,EACpB,OAAgB,EAChB,cAA8C;;;QAE9C,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,MAAM,WAAW,CAAC;YAC1D,kBAAkB;YAClB,cAAc;YACd,cAAc;YACd,OAAO;YACP,MAAM;SACT,CAAC,CA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c;YACd,MAAM;SACT,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;YACT,IAAI,CAAC,kBAAkB,EAAE;gBACrB,MAAM,CAAC,CAAC;aACX;YAED,OAAO,OAAO,CAAC,GAAG,kBAAkB,qBAAqB,EAAE;gBACvD,OAAO;gBACP,cAAc;gBACd,KAAK,EAAE,eAAe,CAAC,kBAAkB,CAAC;gBAC1C,MAAM;aACT,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;CAAA;AAED,SAAS,eAAe,CAAC,GAAW;IAChC,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC;AACxD,CAAC"}
@@ -0,0 +1,6 @@
1
+ export interface EntryPoints {
2
+ css: string[];
3
+ js: string[];
4
+ }
5
+ export declare function getEntrypoints(url: string, cache: 'no-store' | undefined, signal?: AbortSignal): Promise<EntryPoints>;
6
+ //# sourceMappingURL=get-entry-points.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-entry-points.d.ts","sourceRoot":"","sources":["../../src/utils/get-entry-points.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IACxB,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,EAAE,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,wBAAsB,cAAc,CAChC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,UAAU,GAAG,SAAS,EAC7B,MAAM,CAAC,EAAE,WAAW,GACrB,OAAO,CAAC,WAAW,CAAC,CAWtB"}
@@ -0,0 +1,24 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { getJson } from '../common';
11
+ export function getEntrypoints(url, cache, signal) {
12
+ return __awaiter(this, void 0, void 0, function* () {
13
+ try {
14
+ return (yield getJson(url, {
15
+ cache,
16
+ signal,
17
+ })).data;
18
+ }
19
+ catch (_a) {
20
+ return { css: ['index.css'], js: ['index.js'] };
21
+ }
22
+ });
23
+ }
24
+ //# sourceMappingURL=get-entry-points.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-entry-points.js","sourceRoot":"","sources":["../../src/utils/get-entry-points.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,MAAM,UAAgB,cAAc,CAChC,GAAW,EACX,KAA6B,EAC7B,MAAoB;;QAEpB,IAAI;YACA,OAAO,CACH,MAAM,OAAO,CAAC,GAAG,EAAE;gBACf,KAAK;gBACL,MAAM;aACT,CAAC,CACL,CAAC,IAAI,CAAC;SACV;QAAC,WAAM;YACJ,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;SACnD;IACL,CAAC;CAAA"}
@@ -1,3 +1,3 @@
1
- import { Metadata } from './loader';
1
+ import { Metadata } from './get-bundle-info';
2
2
  export declare function getMFESupportsRerendering(bundledWith: Metadata['bundledWith'], dependencies: Metadata['dependencies']): boolean;
3
3
  //# sourceMappingURL=get-mfe-supports-rerendering.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-mfe-supports-rerendering.d.ts","sourceRoot":"","sources":["../../src/utils/get-mfe-supports-rerendering.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAY7C,wBAAgB,yBAAyB,CACrC,WAAW,EAAE,QAAQ,CAAC,aAAa,CAAC,EACpC,YAAY,EAAE,QAAQ,CAAC,cAAc,CAAC,WAOzC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-mfe-supports-rerendering.js","sourceRoot":"","sources":["../../src/utils/get-mfe-supports-rerendering.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B;;;;;;;;;GASG;AACH,MAAM,UAAU,yBAAyB,CACrC,WAAoC,EACpC,YAAsC;;IAEtC,OAAO,CAAC,CAAC,CACL,MAAA,MAAA,kBAAkB,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAG,8BAA8B,CAAC,CAAC,mCACjE,kBAAkB,CAAC,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,8BAA8B,CAAC,CAAC,mCAClE,kBAAkB,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAG,uBAAuB,CAAC,CAAC,CAC7D,CAAC;AACN,CAAC;AAED,SAAS,kBAAkB,CAAC,OAAgB;IACxC,MAAM,UAAU,GAAG,OAAO,IAAI,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACzD,IAAI,UAAU,EAAE;QACZ,OAAO,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;KAC5C;AACL,CAAC"}
@@ -1,7 +1,6 @@
1
- import { ExposedDependencies } from './common';
1
+ import { ExposedDependencies } from '../common';
2
2
  export declare const getVersionMismatches: (exposedDependencies: ExposedDependencies, dependencies: Record<string, string>, sharedDependencies: Record<string, string>) => Record<string, {
3
3
  host: string;
4
4
  package: string;
5
5
  }>;
6
- export declare const isVersionedUrl: (url: string) => boolean;
7
- //# sourceMappingURL=utils.d.ts.map
6
+ //# sourceMappingURL=get-version-mismatches.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-version-mismatches.d.ts","sourceRoot":"","sources":["../../src/utils/get-version-mismatches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAgB,MAAM,WAAW,CAAC;AAE9D,eAAO,MAAM,oBAAoB,wBACR,mBAAmB,gBAC1B,OAAO,MAAM,EAAE,MAAM,CAAC,sBAChB,OAAO,MAAM,EAAE,MAAM,CAAC;UAYT,MAAM;aAAW,MAAM;EAc3D,CAAC"}
@@ -1,5 +1,4 @@
1
- import semver from 'semver';
2
- import { isCompatible } from './common';
1
+ import { isCompatible } from '../common';
3
2
  export const getVersionMismatches = (exposedDependencies, dependencies, sharedDependencies) => {
4
3
  const mismatch = Object.entries(exposedDependencies).reduce((result, [dependency, { version: hostVersion }]) => {
5
4
  const packageVersion = dependencies[dependency];
@@ -19,11 +18,4 @@ export const getVersionMismatches = (exposedDependencies, dependencies, sharedDe
19
18
  }
20
19
  return mismatch;
21
20
  };
22
- export const isVersionedUrl = (url) => {
23
- if (!url.includes('unpkg.')) {
24
- return false;
25
- }
26
- const parts = url.split('@');
27
- return !!semver.clean(parts[parts.length - 1]);
28
- };
29
- //# sourceMappingURL=utils.js.map
21
+ //# sourceMappingURL=get-version-mismatches.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-version-mismatches.js","sourceRoot":"","sources":["../../src/utils/get-version-mismatches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAChC,mBAAwC,EACxC,YAAoC,EACpC,kBAA0C,EAC5C,EAAE;IACA,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,MAAM,CACvD,CAAC,MAAM,EAAE,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,EAAE,EAAE;QAC/C,MAAM,cAAc,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;QAEhD,IAAI,cAAc,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,cAAc,CAAC,EAAE;YAC9D,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;SACvE;QAED,OAAO,MAAM,CAAC;IAClB,CAAC,EACD,EAAuD,CAC1D,CAAC;IAEF,KAAK,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE;QACrE,MAAM,cAAc,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;QAEhD,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,EAAE;YAClC,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;SACvE;aAAM,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC,QAAQ,KAAK,QAAQ,EAAE;YAC9D,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;SACrF;KACJ;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ export * from './get-bundle-info';
2
+ export * from './get-entry-points';
3
+ export * from './get-mfe-supports-rerendering';
4
+ export * from './get-version-mismatches';
5
+ export * from './is-versioned-url';
6
+ export * from './load-scripts';
7
+ export * from './validate-bundle-info';
8
+ export * from './web-component';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,9 @@
1
+ export * from './get-bundle-info';
2
+ export * from './get-entry-points';
3
+ export * from './get-mfe-supports-rerendering';
4
+ export * from './get-version-mismatches';
5
+ export * from './is-versioned-url';
6
+ export * from './load-scripts';
7
+ export * from './validate-bundle-info';
8
+ export * from './web-component';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const isVersionedUrl: (url: string) => boolean;
2
+ //# sourceMappingURL=is-versioned-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-versioned-url.d.ts","sourceRoot":"","sources":["../../src/utils/is-versioned-url.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,QAAS,MAAM,KAAG,OAQ5C,CAAC"}
@@ -0,0 +1,9 @@
1
+ import semver from 'semver';
2
+ export const isVersionedUrl = (url) => {
3
+ if (!url.includes('unpkg.')) {
4
+ return false;
5
+ }
6
+ const parts = url.split('@');
7
+ return !!semver.clean(parts[parts.length - 1]);
8
+ };
9
+ //# sourceMappingURL=is-versioned-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-versioned-url.js","sourceRoot":"","sources":["../../src/utils/is-versioned-url.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAW,EAAW,EAAE;IACnD,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;QACzB,OAAO,KAAK,CAAC;KAChB;IAED,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE7B,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { BundleInfo } from './get-bundle-info';
2
+ export declare function loadScripts({ urls, WebComponent }: BundleInfo): Promise<void[]>;
3
+ //# sourceMappingURL=load-scripts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-scripts.d.ts","sourceRoot":"","sources":["../../src/utils/load-scripts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,UAAU,mBAmC7D"}
@@ -0,0 +1,31 @@
1
+ export function loadScripts({ urls, WebComponent }) {
2
+ return Promise.all(urls.js.map(url => {
3
+ const script = Array.from(document.scripts).find(({ src }) => src === url);
4
+ if (!script) {
5
+ return new Promise(resolve => {
6
+ const script = document.createElement('script');
7
+ script.crossOrigin = 'anonymous';
8
+ script.onload = () => {
9
+ script.dataset.webComponent = WebComponent;
10
+ script.onload = null;
11
+ resolve();
12
+ };
13
+ script.async = true;
14
+ script.src = url;
15
+ document.body.append(script);
16
+ });
17
+ }
18
+ if (!script.dataset.webComponent) {
19
+ return new Promise(resolve => {
20
+ const originalOnload = script.onload;
21
+ script.onload = (...args) => {
22
+ originalOnload === null || originalOnload === void 0 ? void 0 : originalOnload.call(script, ...args);
23
+ script.onload = null;
24
+ resolve();
25
+ };
26
+ });
27
+ }
28
+ return Promise.resolve();
29
+ }));
30
+ }
31
+ //# sourceMappingURL=load-scripts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-scripts.js","sourceRoot":"","sources":["../../src/utils/load-scripts.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,WAAW,CAAC,EAAE,IAAI,EAAE,YAAY,EAAc;IAC1D,OAAO,OAAO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AAC,OAAO,EAAE,CAAC;IAC7B,CAAC,CAAC,CACL,CAAC;AACN,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Log } from '@servicetitan/log-service';
2
+ import { BundleInfo } from './get-bundle-info';
3
+ export declare function validateBundleInfo({ mismatch }: BundleInfo, { logService, packageName }: {
4
+ logService?: Log;
5
+ packageName: string;
6
+ }): void;
7
+ //# sourceMappingURL=validate-bundle-info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-bundle-info.d.ts","sourceRoot":"","sources":["../../src/utils/validate-bundle-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,wBAAgB,kBAAkB,CAC9B,EAAE,QAAQ,EAAE,EAAE,UAAU,EACxB,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE;IAAE,UAAU,CAAC,EAAE,GAAG,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,QASzE"}
@@ -0,0 +1,10 @@
1
+ export function validateBundleInfo({ mismatch }, { logService, packageName }) {
2
+ if (mismatch) {
3
+ logService === null || logService === void 0 ? void 0 : logService.warning({
4
+ category: 'MicroFrontends.DependenciesMismatch',
5
+ message: 'Some of the package dependencies have incompatible versions.',
6
+ data: { package: packageName, dependencies: JSON.stringify(mismatch) },
7
+ });
8
+ }
9
+ }
10
+ //# sourceMappingURL=validate-bundle-info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-bundle-info.js","sourceRoot":"","sources":["../../src/utils/validate-bundle-info.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,kBAAkB,CAC9B,EAAE,QAAQ,EAAc,EACxB,EAAE,UAAU,EAAE,WAAW,EAA6C;IAEtE,IAAI,QAAQ,EAAE;QACV,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,OAAO,CAAC;YAChB,QAAQ,EAAE,qCAAqC;YAC/C,OAAO,EAAE,8DAA8D;YACvE,IAAI,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE;SACzE,CAAC,CAAC;KACN;AACL,CAAC"}
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import { Log } from '@servicetitan/log-service';
3
+ import { ExposedDependencies } from '../common';
4
+ import { EventBus } from '../event-bus';
5
+ import { BundleInfo } from './get-bundle-info';
6
+ import { LoaderDataProps } from '../loader';
7
+ interface WebComponentProps {
8
+ basename?: string;
9
+ bundleInfo: BundleInfo;
10
+ eventBus: EventBus;
11
+ exposedDependencies?: ExposedDependencies;
12
+ logService?: Log;
13
+ LoadingFallback: () => JSX.Element;
14
+ }
15
+ export declare function webComponent(props: WebComponentProps): (props: LoaderDataProps) => import("react/jsx-runtime").JSX.Element;
16
+ export {};
17
+ //# sourceMappingURL=web-component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-component.d.ts","sourceRoot":"","sources":["../../src/utils/web-component.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAGhD,OAAO,EAAE,mBAAmB,EAAiB,MAAM,WAAW,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,UAAU,iBAAiB;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,eAAe,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC;CACtC;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,WAKlC,eAAe,6CAmDjC"}