@measured/puck 0.16.2-canary.bf5c5a3 → 0.16.2-canary.cb90f5d

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -840,12 +840,12 @@ var useResolvedPermissions = (config, appState, globalPermissions, setComponentL
840
840
  ({ item, type, root } = {}) => {
841
841
  if (item) {
842
842
  const componentConfig = config.components[item.type];
843
- const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
843
+ const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig == null ? void 0 : componentConfig.permissions);
844
844
  const resolvedForItem = resolvedPermissions[item.props.id];
845
845
  return resolvedForItem ? __spreadValues(__spreadValues({}, globalPermissions), resolvedForItem) : initialPermissions;
846
846
  } else if (type) {
847
847
  const componentConfig = config.components[type];
848
- return __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
848
+ return __spreadValues(__spreadValues({}, globalPermissions), componentConfig == null ? void 0 : componentConfig.permissions);
849
849
  } else if (root) {
850
850
  const rootConfig = config.root;
851
851
  const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), rootConfig == null ? void 0 : rootConfig.permissions);
@@ -3699,10 +3699,10 @@ var useResolvedFields = () => {
3699
3699
  const { data } = state;
3700
3700
  const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
3701
3701
  const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
3702
- const defaultFields = selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields;
3702
+ const defaultFields = (selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields) || {};
3703
3703
  const rootProps = data.root.props || data.root;
3704
3704
  const [lastSelectedData, setLastSelectedData] = (0, import_react21.useState)({});
3705
- const [resolvedFields, setResolvedFields] = (0, import_react21.useState)(defaultFields || {});
3705
+ const [resolvedFields, setResolvedFields] = (0, import_react21.useState)(defaultFields);
3706
3706
  const [fieldsLoading, setFieldsLoading] = (0, import_react21.useState)(false);
3707
3707
  const defaultResolveFields = (_componentData, _params) => defaultFields;
3708
3708
  const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
package/dist/index.mjs CHANGED
@@ -722,12 +722,12 @@ var useResolvedPermissions = (config, appState, globalPermissions, setComponentL
722
722
  ({ item, type, root } = {}) => {
723
723
  if (item) {
724
724
  const componentConfig = config.components[item.type];
725
- const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
725
+ const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig == null ? void 0 : componentConfig.permissions);
726
726
  const resolvedForItem = resolvedPermissions[item.props.id];
727
727
  return resolvedForItem ? __spreadValues(__spreadValues({}, globalPermissions), resolvedForItem) : initialPermissions;
728
728
  } else if (type) {
729
729
  const componentConfig = config.components[type];
730
- return __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
730
+ return __spreadValues(__spreadValues({}, globalPermissions), componentConfig == null ? void 0 : componentConfig.permissions);
731
731
  } else if (root) {
732
732
  const rootConfig = config.root;
733
733
  const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), rootConfig == null ? void 0 : rootConfig.permissions);
@@ -3528,10 +3528,10 @@ var useResolvedFields = () => {
3528
3528
  const { data } = state;
3529
3529
  const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
3530
3530
  const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
3531
- const defaultFields = selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields;
3531
+ const defaultFields = (selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields) || {};
3532
3532
  const rootProps = data.root.props || data.root;
3533
3533
  const [lastSelectedData, setLastSelectedData] = useState15({});
3534
- const [resolvedFields, setResolvedFields] = useState15(defaultFields || {});
3534
+ const [resolvedFields, setResolvedFields] = useState15(defaultFields);
3535
3535
  const [fieldsLoading, setFieldsLoading] = useState15(false);
3536
3536
  const defaultResolveFields = (_componentData, _params) => defaultFields;
3537
3537
  const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck",
3
- "version": "0.16.2-canary.bf5c5a3",
3
+ "version": "0.16.2-canary.cb90f5d",
4
4
  "author": "Measured Corporation Ltd <hello@measured.co>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",