@pushwoosh/smart-components-kit 1.23.0 → 1.24.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/index.d.ts CHANGED
@@ -16,6 +16,5 @@ export * from './RichMessageEditorSmart';
16
16
  export * from './Table';
17
17
  export * from './OpenActions';
18
18
  export * from './PickerSort';
19
- export * from './SystemParcel';
20
19
  export * from './ModalCloningJourney';
21
20
  export * from './types';
package/index.js CHANGED
@@ -16,6 +16,5 @@ export * from './RichMessageEditorSmart';
16
16
  export * from './Table';
17
17
  export * from './OpenActions';
18
18
  export * from './PickerSort';
19
- export * from './SystemParcel';
20
19
  export * from './ModalCloningJourney';
21
20
  export * from './types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/smart-components-kit",
3
- "version": "1.23.0",
3
+ "version": "1.24.0",
4
4
  "description": "Stateful, data-connected React components shared by Pushwoosh micro-frontends",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,9 +0,0 @@
1
- import { type ComponentType } from 'react';
2
- type SystemParcelProps = {
3
- importPath: string;
4
- methodName?: string;
5
- mountRootParcel: any;
6
- Parcel: ComponentType<any>;
7
- } & Record<string, unknown>;
8
- export declare function SystemParcel({ importPath, mountRootParcel, methodName, Parcel, ...restProps }: SystemParcelProps): import("react").JSX.Element;
9
- export {};
@@ -1,47 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useMemo } from 'react';
3
- import { useSPAContext } from '@pushwoosh/spa-context';
4
- export function SystemParcel({
5
- importPath,
6
- mountRootParcel,
7
- methodName = 'parcel',
8
- Parcel,
9
- ...restProps
10
- }) {
11
- const spaContext = useSPAContext();
12
- const parcelConfig = useMemo(() => createSystemParcelConfig(importPath, methodName), [importPath, methodName]);
13
- return _jsx(Parcel, {
14
- config: parcelConfig,
15
- spaContext: spaContext,
16
- mountParcel: mountRootParcel,
17
- ...restProps
18
- });
19
- }
20
- function createSystemParcelConfig(importPath, methodName) {
21
- let parcel;
22
- return {
23
- bootstrap({
24
- domElement
25
- }) {
26
- return System.import(importPath).then(module => {
27
- const factory = module[methodName];
28
- if (typeof factory !== 'function') {
29
- throw new Error(`Method "${methodName}" is not a function in module "${importPath}"`);
30
- }
31
- parcel = factory(domElement);
32
- });
33
- },
34
- mount(props) {
35
- parcel.render(props);
36
- return Promise.resolve();
37
- },
38
- unmount() {
39
- parcel.unmount();
40
- return Promise.resolve();
41
- },
42
- update(props) {
43
- parcel.render(props);
44
- return Promise.resolve();
45
- }
46
- };
47
- }
@@ -1,7 +0,0 @@
1
- import { type ReactElement } from 'react';
2
- type ParcelResult<T> = {
3
- render: (props: T) => void;
4
- unmount: () => void;
5
- };
6
- export declare function createParcelFunction<T>(render: (props: T) => ReactElement): (container: HTMLElement) => ParcelResult<T>;
7
- export {};
@@ -1,14 +0,0 @@
1
- import { createRoot } from 'react-dom/client';
2
- export function createParcelFunction(render) {
3
- return container => {
4
- const root = createRoot(container);
5
- return {
6
- render(props) {
7
- root.render(render(props));
8
- },
9
- unmount() {
10
- root.unmount();
11
- }
12
- };
13
- };
14
- }
@@ -1,2 +0,0 @@
1
- export { SystemParcel } from './SystemParcel';
2
- export { createParcelFunction } from './helpers';
@@ -1,2 +0,0 @@
1
- export { SystemParcel } from './SystemParcel';
2
- export { createParcelFunction } from './helpers';