@contentful/experiences-sdk-react 0.0.1-alpha.11 → 0.0.1-alpha.13

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/index.d.ts CHANGED
@@ -47,5 +47,13 @@ declare const useFetchBySlug: ({ slug, localeCode, client, experienceTypeId, }:
47
47
  * @returns void
48
48
  */
49
49
  declare const defineComponents: (componentRegistrations: ComponentRegistration[], options?: ComponentRegistrationOptions) => void;
50
+ /**
51
+ * @deprecated This method is used to maintain the basic component ids (without the prefix 'contentful-') in order to be compatible
52
+ * with experiences created with an older alpha version of the SDK. Components in these experiences should be migrated to use
53
+ * the components with the 'contentful-' prefix. To do so, load the experience in the editor, and replace any older basic components
54
+ * (marked with [OLD] in the UI) with the new components (without the [OLD]). This method (and functionality for the older components)
55
+ * will be removed in the next major release.
56
+ */
57
+ declare const maintainBasicComponentIdsWithoutPrefix: () => void;
50
58
 
51
- export { ExperienceRoot, defineComponents, useFetchById, useFetchBySlug };
59
+ export { ExperienceRoot, defineComponents, maintainBasicComponentIdsWithoutPrefix, useFetchById, useFetchBySlug };
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import * as Components from '@contentful/experiences-components-react';
9
9
  import { ContentfulContainer, Columns, SingleColumn } from '@contentful/experiences-components-react';
10
10
  import styleInject from 'style-inject';
11
11
 
12
- const SDK_VERSION = '0.0.1-alpha.10';
12
+ const SDK_VERSION = '0.0.1-alpha.12';
13
13
 
14
14
  var util;
15
15
  (function (util) {
@@ -4487,7 +4487,7 @@ const optionalBuiltInComponents = [
4487
4487
  ];
4488
4488
  const sendRegisteredComponentsMessage = () => {
4489
4489
  // Send the definitions (without components) via the connection message to the experience builder
4490
- const registeredDefinitions = Array.from(componentRegistry.values());
4490
+ const registeredDefinitions = Array.from(componentRegistry.values()).map(({ definition }) => definition);
4491
4491
  sendMessage(OUTGOING_EVENTS.RegisteredComponents, {
4492
4492
  definitions: registeredDefinitions,
4493
4493
  });
@@ -4552,6 +4552,27 @@ const createAssemblyRegistration = ({ definitionId, definitionName, component, }
4552
4552
  addComponentRegistration({ component, definition });
4553
4553
  return componentRegistry.get(definitionId);
4554
4554
  };
4555
+ /**
4556
+ * @deprecated This method is used to maintain the basic component ids (without the prefix 'contentful-') in order to be compatible
4557
+ * with experiences created with an older alpha version of the SDK. Components in these experiences should be migrated to use
4558
+ * the components with the 'contentful-' prefix. To do so, load the experience in the editor, and replace any older basic components
4559
+ * (marked with [OLD] in the UI) with the new components (without the [OLD]). This method (and functionality for the older components)
4560
+ * will be removed in the next major release.
4561
+ */
4562
+ const maintainBasicComponentIdsWithoutPrefix = () => {
4563
+ optionalBuiltInComponents.forEach((id) => {
4564
+ if (componentRegistry.has(id) && id.startsWith('contentful-')) {
4565
+ const registeredComponent = componentRegistry.get(id);
4566
+ const definition = registeredComponent.definition;
4567
+ const newDefinition = cloneObject(definition);
4568
+ newDefinition.name = newDefinition.name + '[OLD]';
4569
+ const newId = id.replace('contentful-', '');
4570
+ newDefinition.id = newId;
4571
+ const newRegisteredComponent = { ...registeredComponent, definition: newDefinition };
4572
+ componentRegistry.set(newId, newRegisteredComponent);
4573
+ }
4574
+ });
4575
+ };
4555
4576
 
4556
4577
  /**
4557
4578
  *
@@ -5014,5 +5035,5 @@ if (typeof window !== 'undefined') {
5014
5035
  };
5015
5036
  }
5016
5037
 
5017
- export { ExperienceRoot, defineComponents, useFetchById, useFetchBySlug };
5038
+ export { ExperienceRoot, defineComponents, maintainBasicComponentIdsWithoutPrefix, useFetchById, useFetchBySlug };
5018
5039
  //# sourceMappingURL=index.js.map