@plasmicapp/loader-react 1.0.229 → 1.0.230

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.
@@ -1823,15 +1823,36 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
1823
1823
  });
1824
1824
  };
1825
1825
  _proto.registerComponent = function registerComponent(component, meta) {
1826
- var _meta$importPath;
1826
+ var _meta$states, _meta$importPath;
1827
1827
  this.substituteComponent(component, {
1828
1828
  name: meta.name,
1829
1829
  isCode: true
1830
1830
  });
1831
- // Import path is not used as we will use component substitution
1831
+ // making the component meta consistent between codegen and loader
1832
+ var stateHelpers = Object.fromEntries(Object.entries((_meta$states = meta.states) != null ? _meta$states : {}).filter(function (_ref) {
1833
+ var stateSpec = _ref[1];
1834
+ return 'initFunc' in stateSpec || 'onChangeArgsToValue' in stateSpec;
1835
+ }).map(function (_ref2) {
1836
+ var stateName = _ref2[0],
1837
+ stateSpec = _ref2[1];
1838
+ return [stateName, _extends({}, 'initFunc' in stateSpec ? {
1839
+ initFunc: stateSpec.initFunc
1840
+ } : {}, 'onChangeArgsToValue' in stateSpec ? {
1841
+ onChangeArgsToValue: stateSpec.onChangeArgsToValue
1842
+ } : {})];
1843
+ }));
1832
1844
  PlasmicHost.registerComponent(component, _extends({}, meta, {
1845
+ // Import path is not used as we will use component substitution
1833
1846
  importPath: (_meta$importPath = meta.importPath) != null ? _meta$importPath : ''
1834
- }));
1847
+ }, Object.keys(stateHelpers).length > 0 ? {
1848
+ componentHelpers: {
1849
+ helpers: {
1850
+ states: stateHelpers
1851
+ },
1852
+ importPath: '',
1853
+ importName: ''
1854
+ }
1855
+ } : {}));
1835
1856
  };
1836
1857
  _proto.registerGlobalContext = function registerGlobalContext(context, meta) {
1837
1858
  var _meta$importPath2;