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