@sitecore-jss/sitecore-jss-react 21.2.0-canary.8 → 21.3.0-canary.1

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.
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ComponentBuilder = void 0;
4
+ /**
5
+ * React implementation of component builder class for building components based on the configuration.
6
+ */
7
+ class ComponentBuilder {
8
+ constructor(config) {
9
+ this.config = config;
10
+ this.components = new Map([...config.components]);
11
+ }
12
+ /**
13
+ * Creates a new instance of component factory
14
+ * @returns {ComponentFactory} Component factory implementation
15
+ */
16
+ getComponentFactory() {
17
+ return (componentName) => {
18
+ const component = this.components.get(componentName);
19
+ if (!component)
20
+ return null;
21
+ return component;
22
+ };
23
+ }
24
+ }
25
+ exports.ComponentBuilder = ComponentBuilder;
package/dist/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EditFrame = exports.withDatasourceCheck = exports.withPlaceholder = exports.withEditorChromes = exports.useSitecoreContext = exports.withSitecoreContext = exports.SitecoreContextReactContext = exports.SitecoreContext = exports.VisitorIdentification = exports.File = exports.LinkPropTypes = exports.Link = exports.fetchFEaaSComponentServerProps = exports.FEaaSComponent = exports.DateField = exports.Text = exports.RichTextPropTypes = exports.RichText = exports.getEEMarkup = exports.Image = exports.Placeholder = exports.mediaApi = exports.RestDictionaryService = exports.GraphQLDictionaryService = exports.trackingApi = exports.getFieldValue = exports.getChildPlaceholder = exports.RestLayoutService = exports.GraphQLLayoutService = exports.LayoutServicePageState = exports.DefaultEditFrameButtons = exports.DefaultEditFrameButton = exports.resetEditorChromes = exports.isEditorActive = exports.enableDebug = exports.constants = void 0;
3
+ exports.ComponentBuilder = exports.EditFrame = exports.withDatasourceCheck = exports.withPlaceholder = exports.withEditorChromes = exports.useSitecoreContext = exports.withSitecoreContext = exports.SitecoreContextReactContext = exports.SitecoreContext = exports.VisitorIdentification = exports.File = exports.LinkPropTypes = exports.Link = exports.fetchFEaaSComponentServerProps = exports.FEaaSComponent = exports.DateField = exports.Text = exports.RichTextPropTypes = exports.RichText = exports.getEEMarkup = exports.Image = exports.Placeholder = exports.mediaApi = exports.RestDictionaryService = exports.GraphQLDictionaryService = exports.trackingApi = exports.getFieldValue = exports.getChildPlaceholder = exports.RestLayoutService = exports.GraphQLLayoutService = exports.LayoutServicePageState = exports.DefaultEditFrameButtons = exports.DefaultEditFrameButton = exports.resetEditorChromes = exports.isEditorActive = exports.enableDebug = exports.constants = void 0;
4
4
  var sitecore_jss_1 = require("@sitecore-jss/sitecore-jss");
5
5
  Object.defineProperty(exports, "constants", { enumerable: true, get: function () { return sitecore_jss_1.constants; } });
6
6
  Object.defineProperty(exports, "enableDebug", { enumerable: true, get: function () { return sitecore_jss_1.enableDebug; } });
@@ -58,3 +58,5 @@ var withDatasourceCheck_1 = require("./enhancers/withDatasourceCheck");
58
58
  Object.defineProperty(exports, "withDatasourceCheck", { enumerable: true, get: function () { return withDatasourceCheck_1.withDatasourceCheck; } });
59
59
  var EditFrame_1 = require("./components/EditFrame");
60
60
  Object.defineProperty(exports, "EditFrame", { enumerable: true, get: function () { return EditFrame_1.EditFrame; } });
61
+ var ComponentBuilder_1 = require("./ComponentBuilder");
62
+ Object.defineProperty(exports, "ComponentBuilder", { enumerable: true, get: function () { return ComponentBuilder_1.ComponentBuilder; } });
@@ -0,0 +1,21 @@
1
+ /**
2
+ * React implementation of component builder class for building components based on the configuration.
3
+ */
4
+ export class ComponentBuilder {
5
+ constructor(config) {
6
+ this.config = config;
7
+ this.components = new Map([...config.components]);
8
+ }
9
+ /**
10
+ * Creates a new instance of component factory
11
+ * @returns {ComponentFactory} Component factory implementation
12
+ */
13
+ getComponentFactory() {
14
+ return (componentName) => {
15
+ const component = this.components.get(componentName);
16
+ if (!component)
17
+ return null;
18
+ return component;
19
+ };
20
+ }
21
+ }
package/dist/esm/index.js CHANGED
@@ -19,3 +19,4 @@ export { withEditorChromes } from './enhancers/withEditorChromes';
19
19
  export { withPlaceholder } from './enhancers/withPlaceholder';
20
20
  export { withDatasourceCheck } from './enhancers/withDatasourceCheck';
21
21
  export { EditFrame } from './components/EditFrame';
22
+ export { ComponentBuilder } from './ComponentBuilder';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-jss/sitecore-jss-react",
3
- "version": "21.2.0-canary.8",
3
+ "version": "21.3.0-canary.1",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -61,15 +61,15 @@
61
61
  "react-dom": "^18.2.0"
62
62
  },
63
63
  "dependencies": {
64
- "@sitecore-feaas/clientside": "^0.1.48",
65
- "@sitecore-jss/sitecore-jss": "^21.2.0-canary.8",
64
+ "@sitecore-feaas/clientside": "^0.3.0",
65
+ "@sitecore-jss/sitecore-jss": "^21.3.0-canary.1",
66
66
  "deep-equal": "^2.1.0",
67
67
  "prop-types": "^15.8.1",
68
68
  "style-attr": "^1.3.0"
69
69
  },
70
70
  "description": "",
71
71
  "types": "types/index.d.ts",
72
- "gitHead": "632fb767b0e2295f18c68e07d994a8a495e03619",
72
+ "gitHead": "fcf3490aa19fd1aee6320a4865098d99523878ad",
73
73
  "files": [
74
74
  "dist",
75
75
  "types"
@@ -0,0 +1,27 @@
1
+ import { ComponentType } from 'react';
2
+ import { ComponentFactory } from './components/sharedTypes';
3
+ /**
4
+ * Configuration for ComponentBuilder
5
+ */
6
+ export type ComponentBuilderConfig<ComponentType> = {
7
+ /**
8
+ * List of components to be stored
9
+ */
10
+ components: Map<string, ComponentType>;
11
+ };
12
+ /**
13
+ * React implementation of component builder class for building components based on the configuration.
14
+ */
15
+ export declare class ComponentBuilder {
16
+ protected config: ComponentBuilderConfig<ComponentType>;
17
+ /**
18
+ * List of components to be stored
19
+ */
20
+ protected components: Map<string, ComponentType>;
21
+ constructor(config: ComponentBuilderConfig<ComponentType>);
22
+ /**
23
+ * Creates a new instance of component factory
24
+ * @returns {ComponentFactory} Component factory implementation
25
+ */
26
+ getComponentFactory(): ComponentFactory;
27
+ }
package/types/index.d.ts CHANGED
@@ -20,3 +20,4 @@ export { withEditorChromes } from './enhancers/withEditorChromes';
20
20
  export { withPlaceholder } from './enhancers/withPlaceholder';
21
21
  export { withDatasourceCheck } from './enhancers/withDatasourceCheck';
22
22
  export { EditFrameProps, EditFrame } from './components/EditFrame';
23
+ export { ComponentBuilder, ComponentBuilderConfig } from './ComponentBuilder';