@wix/auto-patterns 1.22.0 → 1.23.0

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.
Files changed (87) hide show
  1. package/dist/cjs/hooks/useActionCell.js.map +1 -1
  2. package/dist/cjs/providers/PatternsWizardOverridesContext.js +1 -1
  3. package/dist/cjs/providers/PatternsWizardOverridesContext.js.map +1 -1
  4. package/dist/cjs/types/actions/base.js.map +1 -1
  5. package/dist/docs/app_config_structure.md +0 -3
  6. package/dist/docs/auto-patterns-guide.md +87 -22
  7. package/dist/docs/bulk_actions.md +1 -4
  8. package/dist/docs/custom_overrides.md +86 -15
  9. package/dist/esm/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js +3 -4
  10. package/dist/esm/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js.map +1 -1
  11. package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js +1 -2
  12. package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
  13. package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js +8 -13
  14. package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js.map +1 -1
  15. package/dist/esm/components/AutoPatternsEntityPage/Fields/DateInput.js +6 -10
  16. package/dist/esm/components/AutoPatternsEntityPage/Fields/DateInput.js.map +1 -1
  17. package/dist/esm/components/AutoPatternsEntityPage/Fields/DateTime.js +16 -23
  18. package/dist/esm/components/AutoPatternsEntityPage/Fields/DateTime.js.map +1 -1
  19. package/dist/esm/components/AutoPatternsEntityPage/Fields/FormFieldInput.js +2 -3
  20. package/dist/esm/components/AutoPatternsEntityPage/Fields/FormFieldInput.js.map +1 -1
  21. package/dist/esm/components/AutoPatternsEntityPage/Fields/ImageInput.js +6 -9
  22. package/dist/esm/components/AutoPatternsEntityPage/Fields/ImageInput.js.map +1 -1
  23. package/dist/esm/components/AutoPatternsEntityPage/Fields/LongText.js +6 -8
  24. package/dist/esm/components/AutoPatternsEntityPage/Fields/LongText.js.map +1 -1
  25. package/dist/esm/components/AutoPatternsEntityPage/Fields/Number.js +8 -10
  26. package/dist/esm/components/AutoPatternsEntityPage/Fields/Number.js.map +1 -1
  27. package/dist/esm/components/AutoPatternsEntityPage/Fields/ShortText.js +10 -12
  28. package/dist/esm/components/AutoPatternsEntityPage/Fields/ShortText.js.map +1 -1
  29. package/dist/esm/components/AutoPatternsEntityPage/Fields/Url.js +6 -8
  30. package/dist/esm/components/AutoPatternsEntityPage/Fields/Url.js.map +1 -1
  31. package/dist/esm/components/AutoPatternsEntityPage/SkeletonEntity.js +4 -7
  32. package/dist/esm/components/AutoPatternsEntityPage/SkeletonEntity.js.map +1 -1
  33. package/dist/esm/components/ModalRenderer.js +1 -2
  34. package/dist/esm/components/ModalRenderer.js.map +1 -1
  35. package/dist/esm/components/modals/actions/BulkDeleteModal.js +7 -12
  36. package/dist/esm/components/modals/actions/BulkDeleteModal.js.map +1 -1
  37. package/dist/esm/components/modals/actions/CreateModal.js +6 -11
  38. package/dist/esm/components/modals/actions/CreateModal.js.map +1 -1
  39. package/dist/esm/components/modals/actions/EditModal.js +6 -11
  40. package/dist/esm/components/modals/actions/EditModal.js.map +1 -1
  41. package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js +3 -4
  42. package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
  43. package/dist/esm/dataSourceAdapters/cms/filterUtils.js +1 -2
  44. package/dist/esm/dataSourceAdapters/cms/filterUtils.js.map +1 -1
  45. package/dist/esm/dataSourceAdapters/cms/sortUtils.js +2 -2
  46. package/dist/esm/dataSourceAdapters/cms/sortUtils.js.map +1 -1
  47. package/dist/esm/hooks/useActionCell.js +8 -12
  48. package/dist/esm/hooks/useActionCell.js.map +1 -1
  49. package/dist/esm/hooks/useBaseTableFeatures.js +1 -2
  50. package/dist/esm/hooks/useBaseTableFeatures.js.map +1 -1
  51. package/dist/esm/hooks/useBulkActionToolbar.js +2 -2
  52. package/dist/esm/hooks/useBulkActionToolbar.js.map +1 -1
  53. package/dist/esm/hooks/useCollectionPageActions.js +3 -3
  54. package/dist/esm/hooks/useCollectionPageActions.js.map +1 -1
  55. package/dist/esm/hooks/useCollectionPageOnRowClickActions.js +1 -1
  56. package/dist/esm/hooks/useCollectionPageOnRowClickActions.js.map +1 -1
  57. package/dist/esm/hooks/useColumns.js +7 -12
  58. package/dist/esm/hooks/useColumns.js.map +1 -1
  59. package/dist/esm/hooks/useCommonCollectionFeatures.js +7 -8
  60. package/dist/esm/hooks/useCommonCollectionFeatures.js.map +1 -1
  61. package/dist/esm/hooks/useEmptyStates.js +5 -6
  62. package/dist/esm/hooks/useEmptyStates.js.map +1 -1
  63. package/dist/esm/hooks/useFilters.js +7 -7
  64. package/dist/esm/hooks/useFilters.js.map +1 -1
  65. package/dist/esm/hooks/useNavigationUtils.js +2 -3
  66. package/dist/esm/hooks/useNavigationUtils.js.map +1 -1
  67. package/dist/esm/hooks/usePagePath.js +3 -4
  68. package/dist/esm/hooks/usePagePath.js.map +1 -1
  69. package/dist/esm/hooks/useTableFeatures.js +1 -2
  70. package/dist/esm/hooks/useTableFeatures.js.map +1 -1
  71. package/dist/esm/providers/PatternsWizardOverridesContext.js.map +1 -1
  72. package/dist/esm/providers/SchemaContext.js +2 -3
  73. package/dist/esm/providers/SchemaContext.js.map +1 -1
  74. package/dist/esm/providers/SchemaRegistryContext.js +1 -1
  75. package/dist/esm/providers/SchemaRegistryContext.js.map +1 -1
  76. package/dist/esm/types/actions/base.js.map +1 -1
  77. package/dist/esm/utils/actions/customAction.js +1 -2
  78. package/dist/esm/utils/actions/customAction.js.map +1 -1
  79. package/dist/esm/utils/actions/deleteAction.js +5 -10
  80. package/dist/esm/utils/actions/deleteAction.js.map +1 -1
  81. package/dist/esm/utils/filterCreators.js +11 -11
  82. package/dist/esm/utils/filterCreators.js.map +1 -1
  83. package/dist/types/providers/PatternsWizardOverridesContext.d.ts +2 -5
  84. package/dist/types/providers/PatternsWizardOverridesContext.d.ts.map +1 -1
  85. package/dist/types/types/actions/base.d.ts +0 -4
  86. package/dist/types/types/actions/base.d.ts.map +1 -1
  87. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"names":["React","FormField","NumberInput","useEntityPageContext","useSelector","useWixPatternsContainer","useController","Number","props","_field$validation","_pageState$entity","_field$validation3","_controller$fieldStat","field","dataHook","translate","t","container","initTask","status","pageState","numberRange","validation","min","max","controller","name","id","control","form","defaultValue","entity","rules","validate","value","_field$validation2","required","undefined","minAmount","maxAmount","createElement","label","displayName","fieldState","error","statusMessage","message","onChange","e","onBlur","inputRef","ref"],"sources":["../../../../../src/components/AutoPatternsEntityPage/Fields/Number.tsx"],"sourcesContent":["import React from 'react';\nimport { FormField, NumberInput } from '@wix/design-system';\nimport { BaseInputProps } from './types';\nimport {\n useEntityPageContext,\n useSelector,\n useWixPatternsContainer,\n} from '@wix/patterns';\nimport { useController } from '@wix/patterns/form';\n\nexport interface NumberProps extends BaseInputProps<number | null> {}\n\nexport const Number = (props: NumberProps) => {\n const { field, dataHook } = props;\n\n const { translate: t, ...container } = useWixPatternsContainer();\n useSelector(() => container.initTask.status);\n\n const pageState = useEntityPageContext();\n\n const numberRange = field.validation?.numberRange;\n const min = numberRange?.min;\n const max = numberRange?.max;\n\n const controller = useController({\n name: field?.id ?? '',\n control: pageState.form.control,\n defaultValue: (pageState.entity as any)?.[field?.id ?? ''],\n rules: {\n validate: (value) => {\n if (\n field.validation?.required &&\n (value === null || value === undefined || value === '')\n ) {\n return t('cairo.fieldValidation.requiredField');\n }\n\n if (value !== null && value !== undefined) {\n if (min !== undefined && value < min) {\n return t('cairo.fieldValidation.minNumber', {\n minAmount: min,\n });\n }\n if (max !== undefined && value > max) {\n return t('cairo.fieldValidation.maxNumber', {\n maxAmount: max,\n });\n }\n }\n\n return true;\n },\n },\n });\n\n return (\n <FormField\n label={field.displayName}\n required={field.validation?.required}\n status={controller.fieldState.error ? 'error' : undefined}\n statusMessage={controller.fieldState.error?.message}\n dataHook={dataHook}\n >\n <NumberInput\n value={controller.field.value ?? undefined}\n onChange={(e) => controller.field.onChange(e)}\n onBlur={controller.field.onBlur}\n inputRef={controller.field.ref}\n dataHook={`number-${field.id}`}\n />\n </FormField>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,EAAEC,WAAW,QAAQ,oBAAoB;AAE3D,SACEC,oBAAoB,EACpBC,WAAW,EACXC,uBAAuB,QAClB,eAAe;AACtB,SAASC,aAAa,QAAQ,oBAAoB;AAIlD,OAAO,MAAMC,MAAM,GAAIC,KAAkB,IAAK;EAAA,IAAAC,iBAAA,EAAAC,iBAAA,EAAAC,kBAAA,EAAAC,qBAAA;EAC5C,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAC,GAAGN,KAAK;EAEjC,MAAM;IAAEO,SAAS,EAAEC,CAAC;IAAE,GAAGC;EAAU,CAAC,GAAGZ,uBAAuB,CAAC,CAAC;EAChED,WAAW,CAAC,MAAMa,SAAS,CAACC,QAAQ,CAACC,MAAM,CAAC;EAE5C,MAAMC,SAAS,GAAGjB,oBAAoB,CAAC,CAAC;EAExC,MAAMkB,WAAW,IAAAZ,iBAAA,GAAGI,KAAK,CAACS,UAAU,qBAAhBb,iBAAA,CAAkBY,WAAW;EACjD,MAAME,GAAG,GAAGF,WAAW,oBAAXA,WAAW,CAAEE,GAAG;EAC5B,MAAMC,GAAG,GAAGH,WAAW,oBAAXA,WAAW,CAAEG,GAAG;EAE5B,MAAMC,UAAU,GAAGnB,aAAa,CAAC;IAC/BoB,IAAI,EAAE,CAAAb,KAAK,oBAALA,KAAK,CAAEc,EAAE,KAAI,EAAE;IACrBC,OAAO,EAAER,SAAS,CAACS,IAAI,CAACD,OAAO;IAC/BE,YAAY,GAAApB,iBAAA,GAAGU,SAAS,CAACW,MAAM,qBAAjBrB,iBAAA,CAA4B,CAAAG,KAAK,oBAALA,KA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U;IAC3CU,QAAQ,EAAGC,CAAC,IAAKvB,UAAU,CAACZ,KAAK,CAACkC,QAAQ,CAACC,CAAC,CAAE;IAC9CC,MAAM,EAAExB,UAAU,CAACZ,KAAK,CAACoC,MAAO;IAChCC,QAAQ,EAAEzB,UAAU,CAACZ,KAAK,CAACsC,GAAI;IAC/BrC,QAAQ,EAAE,UAAUD,KAAK,CAACc,EAAE;EAAG,CAChC,CACQ,CAAC;AAEhB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","FormField","NumberInput","useEntityPageContext","useSelector","useWixPatternsContainer","useController","Number","props","field","dataHook","translate","t","container","initTask","status","pageState","numberRange","validation","min","max","controller","name","id","control","form","defaultValue","entity","rules","validate","value","required","undefined","minAmount","maxAmount","createElement","label","displayName","fieldState","error","statusMessage","message","onChange","e","onBlur","inputRef","ref"],"sources":["../../../../../src/components/AutoPatternsEntityPage/Fields/Number.tsx"],"sourcesContent":["import React from 'react';\nimport { FormField, NumberInput } from '@wix/design-system';\nimport { BaseInputProps } from './types';\nimport {\n useEntityPageContext,\n useSelector,\n useWixPatternsContainer,\n} from '@wix/patterns';\nimport { useController } from '@wix/patterns/form';\n\nexport interface NumberProps extends BaseInputProps<number | null> {}\n\nexport const Number = (props: NumberProps) => {\n const { field, dataHook } = props;\n\n const { translate: t, ...container } = useWixPatternsContainer();\n useSelector(() => container.initTask.status);\n\n const pageState = useEntityPageContext();\n\n const numberRange = field.validation?.numberRange;\n const min = numberRange?.min;\n const max = numberRange?.max;\n\n const controller = useController({\n name: field?.id ?? '',\n control: pageState.form.control,\n defaultValue: (pageState.entity as any)?.[field?.id ?? ''],\n rules: {\n validate: (value) => {\n if (\n field.validation?.required &&\n (value === null || value === undefined || value === '')\n ) {\n return t('cairo.fieldValidation.requiredField');\n }\n\n if (value !== null && value !== undefined) {\n if (min !== undefined && value < min) {\n return t('cairo.fieldValidation.minNumber', {\n minAmount: min,\n });\n }\n if (max !== undefined && value > max) {\n return t('cairo.fieldValidation.maxNumber', {\n maxAmount: max,\n });\n }\n }\n\n return true;\n },\n },\n });\n\n return (\n <FormField\n label={field.displayName}\n required={field.validation?.required}\n status={controller.fieldState.error ? 'error' : undefined}\n statusMessage={controller.fieldState.error?.message}\n dataHook={dataHook}\n >\n <NumberInput\n value={controller.field.value ?? undefined}\n onChange={(e) => controller.field.onChange(e)}\n onBlur={controller.field.onBlur}\n inputRef={controller.field.ref}\n dataHook={`number-${field.id}`}\n />\n </FormField>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,EAAEC,WAAW,QAAQ,oBAAoB;AAE3D,SACEC,oBAAoB,EACpBC,WAAW,EACXC,uBAAuB,QAClB,eAAe;AACtB,SAASC,aAAa,QAAQ,oBAAoB;AAIlD,OAAO,MAAMC,MAAM,GAAIC,KAAkB,IAAK;EAC5C,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAC,GAAGF,KAAK;EAEjC,MAAM;IAAEG,SAAS,EAAEC,CAAC;IAAE,GAAGC;EAAU,CAAC,GAAGR,uBAAuB,CAAC,CAAC;EAChED,WAAW,CAAC,MAAMS,SAAS,CAACC,QAAQ,CAACC,MAAM,CAAC;EAE5C,MAAMC,SAAS,GAAGb,oBAAoB,CAAC,CAAC;EAExC,MAAMc,WAAW,GAAGR,KAAK,CAACS,UAAU,EAAED,WAAW;EACjD,MAAME,GAAG,GAAGF,WAAW,EAAEE,GAAG;EAC5B,MAAMC,GAAG,GAAGH,WAAW,EAAEG,GAAG;EAE5B,MAAMC,UAAU,GAAGf,aAAa,CAAC;IAC/BgB,IAAI,EAAEb,KAAK,EAAEc,EAAE,IAAI,EAAE;IACrBC,OAAO,EAAER,SAAS,CAACS,IAAI,CAACD,OAAO;IAC/BE,YAAY,EAAGV,SAAS,CAACW,MAAM,GAAWlB,KAAK,EAAEc,EAAE,IAAI,EAAE,CAAC;IAC1DK,KAAK,EAAE;MACLC,QAAQ,EAAGC,KAAK,IAAK;QACnB,IACErB,KA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UD,KAAK,CAACc,EAAE;EAAG,CAChC,CACQ,CAAC;AAEhB,CAAC","ignoreList":[]}
@@ -3,7 +3,6 @@ import { FormField, Input } from '@wix/design-system';
3
3
  import { useEntityPageContext, useSelector, useWixPatternsContainer } from '@wix/patterns';
4
4
  import { useController } from '@wix/patterns/form';
5
5
  export const ShortText = props => {
6
- var _field$validation, _pageState$entity, _controller$field$val, _field$validation3, _controller$fieldStat;
7
6
  const {
8
7
  field,
9
8
  dataHook
@@ -14,17 +13,16 @@ export const ShortText = props => {
14
13
  } = useWixPatternsContainer();
15
14
  useSelector(() => container.initTask.status);
16
15
  const pageState = useEntityPageContext();
17
- const stringLengthRange = (_field$validation = field.validation) == null ? void 0 : _field$validation.stringLengthRange;
18
- const minLength = stringLengthRange == null ? void 0 : stringLengthRange.minLength;
19
- const maxLength = stringLengthRange == null ? void 0 : stringLengthRange.maxLength;
16
+ const stringLengthRange = field.validation?.stringLengthRange;
17
+ const minLength = stringLengthRange?.minLength;
18
+ const maxLength = stringLengthRange?.maxLength;
20
19
  const controller = useController({
21
- name: (field == null ? void 0 : field.id) ?? '',
20
+ name: field?.id ?? '',
22
21
  control: pageState.form.control,
23
- defaultValue: (_pageState$entity = pageState.entity) == null ? void 0 : _pageState$entity[(field == null ? void 0 : field.id) ?? ''],
22
+ defaultValue: pageState.entity?.[field?.id ?? ''],
24
23
  rules: {
25
24
  validate: value => {
26
- var _field$validation2;
27
- if ((_field$validation2 = field.validation) != null && _field$validation2.required && (value === null || value === undefined || value === '')) {
25
+ if (field.validation?.required && (value === null || value === undefined || value === '')) {
28
26
  return t('cairo.fieldValidation.requiredField');
29
27
  }
30
28
  if (minLength && value && value.length < minLength) {
@@ -40,17 +38,17 @@ export const ShortText = props => {
40
38
  }
41
39
  }
42
40
  });
43
- const charCount = maxLength ? maxLength - ((_controller$field$val = controller.field.value) == null ? void 0 : _controller$field$val.length) : undefined;
41
+ const charCount = maxLength ? maxLength - controller.field.value?.length : undefined;
44
42
  return /*#__PURE__*/React.createElement(FormField, {
45
43
  label: field.displayName,
46
- required: (_field$validation3 = field.validation) == null ? void 0 : _field$validation3.required,
44
+ required: field.validation?.required,
47
45
  charCount: charCount,
48
46
  status: controller.fieldState.error ? 'error' : undefined,
49
- statusMessage: (_controller$fieldStat = controller.fieldState.error) == null ? void 0 : _controller$fieldStat.message,
47
+ statusMessage: controller.fieldState.error?.message,
50
48
  dataHook: dataHook
51
49
  }, /*#__PURE__*/React.createElement(Input, {
52
50
  value: controller.field.value,
53
- onChange: e => controller.field.onChange == null ? void 0 : controller.field.onChange(e.target.value),
51
+ onChange: e => controller.field.onChange?.(e.target.value),
54
52
  onBlur: controller.field.onBlur,
55
53
  dataHook: `short-text-${field.id}`,
56
54
  ref: controller.field.ref
@@ -1 +1 @@
1
- {"version":3,"names":["React","FormField","Input","useEntityPageContext","useSelector","useWixPatternsContainer","useController","ShortText","props","_field$validation","_pageState$entity","_controller$field$val","_field$validation3","_controller$fieldStat","field","dataHook","translate","t","container","initTask","status","pageState","stringLengthRange","validation","minLength","maxLength","controller","name","id","control","form","defaultValue","entity","rules","validate","value","_field$validation2","required","undefined","length","charMin","charMax","charCount","createElement","label","displayName","fieldState","error","statusMessage","message","onChange","e","target","onBlur","ref"],"sources":["../../../../../src/components/AutoPatternsEntityPage/Fields/ShortText.tsx"],"sourcesContent":["import React from 'react';\nimport { FormField, Input } from '@wix/design-system';\nimport { BaseInputProps } from './types';\nimport {\n useEntityPageContext,\n useSelector,\n useWixPatternsContainer,\n} from '@wix/patterns';\nimport { useController } from '@wix/patterns/form';\n\nexport interface ShortTextProps extends BaseInputProps<string> {}\n\nexport const ShortText = (props: ShortTextProps) => {\n const { field, dataHook } = props;\n\n const { translate: t, ...container } = useWixPatternsContainer();\n useSelector(() => container.initTask.status);\n\n const pageState = useEntityPageContext();\n\n const stringLengthRange = field.validation?.stringLengthRange;\n const minLength = stringLengthRange?.minLength;\n const maxLength = stringLengthRange?.maxLength;\n\n const controller = useController({\n name: field?.id ?? '',\n control: pageState.form.control,\n defaultValue: (pageState.entity as any)?.[field?.id ?? ''],\n rules: {\n validate: (value) => {\n if (\n field.validation?.required &&\n (value === null || value === undefined || value === '')\n ) {\n return t('cairo.fieldValidation.requiredField');\n }\n\n if (minLength && value && value.length < minLength) {\n return t('cairo.fieldValidation.minCharacter', {\n charMin: minLength,\n });\n } else if (maxLength && value && value.length > maxLength) {\n return t('cairo.fieldValidation.maxCharacter', {\n charMax: maxLength,\n });\n }\n\n return true;\n },\n },\n });\n\n const charCount = maxLength\n ? maxLength - controller.field.value?.length\n : undefined;\n\n return (\n <FormField\n label={field.displayName}\n required={field.validation?.required}\n charCount={charCount}\n status={controller.fieldState.error ? 'error' : undefined}\n statusMessage={controller.fieldState.error?.message}\n dataHook={dataHook}\n >\n <Input\n value={controller.field.value}\n onChange={(e) => controller.field.onChange?.(e.target.value)}\n onBlur={controller.field.onBlur}\n dataHook={`short-text-${field.id}`}\n ref={controller.field.ref}\n />\n </FormField>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,EAAEC,KAAK,QAAQ,oBAAoB;AAErD,SACEC,oBAAoB,EACpBC,WAAW,EACXC,uBAAuB,QAClB,eAAe;AACtB,SAASC,aAAa,QAAQ,oBAAoB;AAIlD,OAAO,MAAMC,SAAS,GAAIC,KAAqB,IAAK;EAAA,IAAAC,iBAAA,EAAAC,iBAAA,EAAAC,qBAAA,EAAAC,kBAAA,EAAAC,qBAAA;EAClD,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAC,GAAGP,KAAK;EAEjC,MAAM;IAAEQ,SAAS,EAAEC,CAAC;IAAE,GAAGC;EAAU,CAAC,GAAGb,uBAAuB,CAAC,CAAC;EAChED,WAAW,CAAC,MAAMc,SAAS,CAACC,QAAQ,CAACC,MAAM,CAAC;EAE5C,MAAMC,SAAS,GAAGlB,oBAAoB,CAAC,CAAC;EAExC,MAAMmB,iBAAiB,IAAAb,iBAAA,GAAGK,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AACZ,KAAK,CAACqB,KAAK,qBAAtBxB,qBAAA,CAAwB4B,MAAM,IAC1CD,SAAS;EAEb,oBACEtC,KAAA,CAAA2C,aAAA,CAAC1C,SAAS;IACR2C,KAAK,EAAE9B,KAAK,CAAC+B,WAAY;IACzBR,QAAQ,GAAAzB,kBAAA,GAAEE,KAAK,CAACS,UAAU,qBAAhBX,kBAAA,CAAkByB,QAAS;IACrCK,SAAS,EAAEA,SAAU;IACrBtB,MAAM,EAAEM,UAAU,CAACoB,UAAU,CAACC,KAAK,GAAG,OAAO,GAAGT,SAAU;IAC1DU,aAAa,GAAAnC,qBAAA,GAAEa,UAAU,CAACoB,UAAU,CAACC,KAAK,qBAA3BlC,qBAAA,CAA6BoC,OAAQ;IACpDlC,QAAQ,EAAEA;EAAS,gBAEnBf,KAAA,CAAA2C,aAAA,CAACzC,KAAK;IACJiC,KAAK,EAAET,UAAU,CAACZ,KAAK,CAACqB,KAAM;IAC9Be,QAAQ,EAAGC,CAAC,IAAKzB,UAAU,CAACZ,KAAK,CAACoC,QAAQ,oBAAzBxB,UAAU,CAACZ,KAAK,CAACoC,QAAQ,CAAGC,CAAC,CAACC,MAAM,CAACjB,KAAK,CAAE;IAC7DkB,MAAM,EAAE3B,UAAU,CAACZ,KAAK,CAACuC,MAAO;IAChCtC,QAAQ,EAAE,cAAcD,KAAK,CAACc,EAAE,EAAG;IACnC0B,GAAG,EAAE5B,UAAU,CAACZ,KAAK,CAACwC;EAAI,CAC3B,CACQ,CAAC;AAEhB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","FormField","Input","useEntityPageContext","useSelector","useWixPatternsContainer","useController","ShortText","props","field","dataHook","translate","t","container","initTask","status","pageState","stringLengthRange","validation","minLength","maxLength","controller","name","id","control","form","defaultValue","entity","rules","validate","value","required","undefined","length","charMin","charMax","charCount","createElement","label","displayName","fieldState","error","statusMessage","message","onChange","e","target","onBlur","ref"],"sources":["../../../../../src/components/AutoPatternsEntityPage/Fields/ShortText.tsx"],"sourcesContent":["import React from 'react';\nimport { FormField, Input } from '@wix/design-system';\nimport { BaseInputProps } from './types';\nimport {\n useEntityPageContext,\n useSelector,\n useWixPatternsContainer,\n} from '@wix/patterns';\nimport { useController } from '@wix/patterns/form';\n\nexport interface ShortTextProps extends BaseInputProps<string> {}\n\nexport const ShortText = (props: ShortTextProps) => {\n const { field, dataHook } = props;\n\n const { translate: t, ...container } = useWixPatternsContainer();\n useSelector(() => container.initTask.status);\n\n const pageState = useEntityPageContext();\n\n const stringLengthRange = field.validation?.stringLengthRange;\n const minLength = stringLengthRange?.minLength;\n const maxLength = stringLengthRange?.maxLength;\n\n const controller = useController({\n name: field?.id ?? '',\n control: pageState.form.control,\n defaultValue: (pageState.entity as any)?.[field?.id ?? ''],\n rules: {\n validate: (value) => {\n if (\n field.validation?.required &&\n (value === null || value === undefined || value === '')\n ) {\n return t('cairo.fieldValidation.requiredField');\n }\n\n if (minLength && value && value.length < minLength) {\n return t('cairo.fieldValidation.minCharacter', {\n charMin: minLength,\n });\n } else if (maxLength && value && value.length > maxLength) {\n return t('cairo.fieldValidation.maxCharacter', {\n charMax: maxLength,\n });\n }\n\n return true;\n },\n },\n });\n\n const charCount = maxLength\n ? maxLength - controller.field.value?.length\n : undefined;\n\n return (\n <FormField\n label={field.displayName}\n required={field.validation?.required}\n charCount={charCount}\n status={controller.fieldState.error ? 'error' : undefined}\n statusMessage={controller.fieldState.error?.message}\n dataHook={dataHook}\n >\n <Input\n value={controller.field.value}\n onChange={(e) => controller.field.onChange?.(e.target.value)}\n onBlur={controller.field.onBlur}\n dataHook={`short-text-${field.id}`}\n ref={controller.field.ref}\n />\n </FormField>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,EAAEC,KAAK,QAAQ,oBAAoB;AAErD,SACEC,oBAAoB,EACpBC,WAAW,EACXC,uBAAuB,QAClB,eAAe;AACtB,SAASC,aAAa,QAAQ,oBAAoB;AAIlD,OAAO,MAAM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C;QACJ;QAEA,OAAO,IAAI;MACb;IACF;EACF,CAAC,CAAC;EAEF,MAAMgB,SAAS,GAAGhB,SAAS,GACvBA,SAAS,GAAGC,UAAU,CAACZ,KAAK,CAACqB,KAAK,EAAEG,MAAM,GAC1CD,SAAS;EAEb,oBACEhC,KAAA,CAAAqC,aAAA,CAACpC,SAAS;IACRqC,KAAK,EAAE7B,KAAK,CAAC8B,WAAY;IACzBR,QAAQ,EAAEtB,KAAK,CAACS,UAAU,EAAEa,QAAS;IACrCK,SAAS,EAAEA,SAAU;IACrBrB,MAAM,EAAEM,UAAU,CAACmB,UAAU,CAACC,KAAK,GAAG,OAAO,GAAGT,SAAU;IAC1DU,aAAa,EAAErB,UAAU,CAACmB,UAAU,CAACC,KAAK,EAAEE,OAAQ;IACpDjC,QAAQ,EAAEA;EAAS,gBAEnBV,KAAA,CAAAqC,aAAA,CAACnC,KAAK;IACJ4B,KAAK,EAAET,UAAU,CAACZ,KAAK,CAACqB,KAAM;IAC9Bc,QAAQ,EAAGC,CAAC,IAAKxB,UAAU,CAACZ,KAAK,CAACmC,QAAQ,GAAGC,CAAC,CAACC,MAAM,CAAChB,KAAK,CAAE;IAC7DiB,MAAM,EAAE1B,UAAU,CAACZ,KAAK,CAACsC,MAAO;IAChCrC,QAAQ,EAAE,cAAcD,KAAK,CAACc,EAAE,EAAG;IACnCyB,GAAG,EAAE3B,UAAU,CAACZ,KAAK,CAACuC;EAAI,CAC3B,CACQ,CAAC;AAEhB,CAAC","ignoreList":[]}
@@ -4,7 +4,6 @@ import { Link } from '@wix/wix-ui-icons-common';
4
4
  import { useEntityPageContext, useSelector, useWixPatternsContainer } from '@wix/patterns';
5
5
  import { useController } from '@wix/patterns/form';
6
6
  export const Url = props => {
7
- var _pageState$entity, _field$validation2, _controller$fieldStat;
8
7
  const {
9
8
  field,
10
9
  dataHook
@@ -21,13 +20,12 @@ export const Url = props => {
21
20
  // eslint-disable-next-line no-useless-escape
22
21
  /^[A-Za-z][A-Za-z0-9+.-]*:(\/\/([A-Za-z0-9._~\-%!$&'()*+,;=:]*@)?[A-Za-z0-9._~\-!$&'()*+,;=%:\[\]]*(:[0-9]*)?)?[A-Za-z0-9._~\-%!$&'()*+,;=:@\/]*([?][A-Za-z0-9._~\-%!$&'()*+,;=:@\/?]*)?([#][A-Za-z0-9._~\-%!$&'()*+,;=:@\/?]*)?$/;
23
22
  const controller = useController({
24
- name: (field == null ? void 0 : field.id) ?? '',
23
+ name: field?.id ?? '',
25
24
  control: pageState.form.control,
26
- defaultValue: (_pageState$entity = pageState.entity) == null ? void 0 : _pageState$entity[(field == null ? void 0 : field.id) ?? ''],
25
+ defaultValue: pageState.entity?.[field?.id ?? ''],
27
26
  rules: {
28
27
  validate: value => {
29
- var _field$validation;
30
- if ((_field$validation = field.validation) != null && _field$validation.required && (value === null || value === undefined || value === '')) {
28
+ if (field.validation?.required && (value === null || value === undefined || value === '')) {
31
29
  return t('cairo.fieldValidation.requiredField');
32
30
  } else if (value) {
33
31
  return uriPattern.test(value) || t('cairo.customFields.url-input.error');
@@ -38,16 +36,16 @@ export const Url = props => {
38
36
  });
39
37
  return /*#__PURE__*/React.createElement(FormField, {
40
38
  label: field.displayName,
41
- required: (_field$validation2 = field.validation) == null ? void 0 : _field$validation2.required,
39
+ required: field.validation?.required,
42
40
  dataHook: dataHook,
43
41
  status: controller.fieldState.error ? 'error' : undefined,
44
- statusMessage: (_controller$fieldStat = controller.fieldState.error) == null ? void 0 : _controller$fieldStat.message
42
+ statusMessage: controller.fieldState.error?.message
45
43
  }, /*#__PURE__*/React.createElement(Input, {
46
44
  prefix: /*#__PURE__*/React.createElement(Input.IconAffix, null, /*#__PURE__*/React.createElement(Link, null)),
47
45
  placeholder: t('cairo.customFields.url-input.placeholder'),
48
46
  dataHook: `url-${field.id}`,
49
47
  value: controller.field.value,
50
- onChange: e => controller.field.onChange == null ? void 0 : controller.field.onChange(e.target.value),
48
+ onChange: e => controller.field.onChange?.(e.target.value),
51
49
  onBlur: controller.field.onBlur,
52
50
  ref: controller.field.ref
53
51
  }));
@@ -1 +1 @@
1
- {"version":3,"names":["React","FormField","Input","Link","useEntityPageContext","useSelector","useWixPatternsContainer","useController","Url","props","_pageState$entity","_field$validation2","_controller$fieldStat","field","dataHook","translate","t","container","initTask","status","pageState","uriPattern","controller","name","id","control","form","defaultValue","entity","rules","validate","value","_field$validation","validation","required","undefined","test","createElement","label","displayName","fieldState","error","statusMessage","message","prefix","IconAffix","placeholder","onChange","e","target","onBlur","ref"],"sources":["../../../../../src/components/AutoPatternsEntityPage/Fields/Url.tsx"],"sourcesContent":["import React from 'react';\nimport { FormField, Input } from '@wix/design-system';\nimport { BaseInputProps } from './types';\nimport { Link } from '@wix/wix-ui-icons-common';\nimport {\n useEntityPageContext,\n useSelector,\n useWixPatternsContainer,\n} from '@wix/patterns';\nimport { useController } from '@wix/patterns/form';\n\nexport interface UrlProps extends BaseInputProps<string> {}\n\nexport const Url = (props: UrlProps) => {\n const { field, dataHook } = props;\n const { translate: t, ...container } = useWixPatternsContainer();\n useSelector(() => container.initTask.status);\n const pageState = useEntityPageContext();\n\n // Same regex as data-extensions https://github.com/wix-private/server-infra/blob/a6c3009d39bbb0312c929f68ee81c559e1eb5b4e/iptf/dataextensions/src/main/scala/com/wixpress/infra/dataextensions/runtime/validator/Formats.scala#L31\n const uriPattern =\n // eslint-disable-next-line no-useless-escape\n /^[A-Za-z][A-Za-z0-9+.-]*:(\\/\\/([A-Za-z0-9._~\\-%!$&'()*+,;=:]*@)?[A-Za-z0-9._~\\-!$&'()*+,;=%:\\[\\]]*(:[0-9]*)?)?[A-Za-z0-9._~\\-%!$&'()*+,;=:@\\/]*([?][A-Za-z0-9._~\\-%!$&'()*+,;=:@\\/?]*)?([#][A-Za-z0-9._~\\-%!$&'()*+,;=:@\\/?]*)?$/;\n\n const controller = useController({\n name: field?.id ?? '',\n control: pageState.form.control,\n defaultValue: (pageState.entity as any)?.[field?.id ?? ''],\n rules: {\n validate: (value: string | null | undefined) => {\n if (\n field.validation?.required &&\n (value === null || value === undefined || value === '')\n ) {\n return t('cairo.fieldValidation.requiredField');\n } else if (value) {\n return (\n uriPattern.test(value) || t('cairo.customFields.url-input.error')\n );\n }\n return true;\n },\n },\n });\n\n return (\n <FormField\n label={field.displayName}\n required={field.validation?.required}\n dataHook={dataHook}\n status={controller.fieldState.error ? 'error' : undefined}\n statusMessage={controller.fieldState.error?.message}\n >\n <Input\n prefix={\n <Input.IconAffix>\n <Link />\n </Input.IconAffix>\n }\n placeholder={t('cairo.customFields.url-input.placeholder')}\n dataHook={`url-${field.id}`}\n value={controller.field.value}\n onChange={(e) => controller.field.onChange?.(e.target.value)}\n onBlur={controller.field.onBlur}\n ref={controller.field.ref}\n />\n </FormField>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,EAAEC,KAAK,QAAQ,oBAAoB;AAErD,SAASC,IAAI,QAAQ,0BAA0B;AAC/C,SACEC,oBAAoB,EACpBC,WAAW,EACXC,uBAAuB,QAClB,eAAe;AACtB,SAASC,aAAa,QAAQ,oBAAoB;AAIlD,OAAO,MAAMC,GAAG,GAAIC,KAAe,IAAK;EAAA,IAAAC,iBAAA,EAAAC,kBAAA,EAAAC,qBAAA;EACtC,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAC,GAAGL,KAAK;EACjC,MAAM;IAAEM,SAAS,EAAEC,CAAC;IAAE,GAAGC;EAAU,CAAC,GAAGX,uBAAuB,CAAC,CAAC;EAChED,WAAW,CAAC,MAAMY,SAAS,CAACC,QAAQ,CAACC,MAAM,CAAC;EAC5C,MAAMC,SAAS,GAAGhB,oBAAoB,CAAC,CAAC;;EAExC;EACA,MAAMiB,UAAU;EACd;EACA,kOAAkO;EAEpO,MAAMC,UAAU,GAAGf,aAAa,CAAC;IAC/BgB,IAAI,EAAE,CAAAV,KAAK,oBAALA,KAAK,CAAEW,EAAE,KAAI,EAAE;IACrBC,OAAO,EAAEL,SAAS,CAACM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C3DF,QAAQ,EAAE,OAAOD,KAAK,CAACW,EAAE,EAAG;IAC5BO,KAAK,EAAET,UAAU,CAACT,KAAK,CAACkB,KAAM;IAC9BgB,QAAQ,EAAGC,CAAC,IAAK1B,UAAU,CAACT,KAAK,CAACkC,QAAQ,oBAAzBzB,UAAU,CAACT,KAAK,CAACkC,QAAQ,CAAGC,CAAC,CAACC,MAAM,CAAClB,KAAK,CAAE;IAC7DmB,MAAM,EAAE5B,UAAU,CAACT,KAAK,CAACqC,MAAO;IAChCC,GAAG,EAAE7B,UAAU,CAACT,KAAK,CAACsC;EAAI,CAC3B,CACQ,CAAC;AAEhB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","FormField","Input","Link","useEntityPageContext","useSelector","useWixPatternsContainer","useController","Url","props","field","dataHook","translate","t","container","initTask","status","pageState","uriPattern","controller","name","id","control","form","defaultValue","entity","rules","validate","value","validation","required","undefined","test","createElement","label","displayName","fieldState","error","statusMessage","message","prefix","IconAffix","placeholder","onChange","e","target","onBlur","ref"],"sources":["../../../../../src/components/AutoPatternsEntityPage/Fields/Url.tsx"],"sourcesContent":["import React from 'react';\nimport { FormField, Input } from '@wix/design-system';\nimport { BaseInputProps } from './types';\nimport { Link } from '@wix/wix-ui-icons-common';\nimport {\n useEntityPageContext,\n useSelector,\n useWixPatternsContainer,\n} from '@wix/patterns';\nimport { useController } from '@wix/patterns/form';\n\nexport interface UrlProps extends BaseInputProps<string> {}\n\nexport const Url = (props: UrlProps) => {\n const { field, dataHook } = props;\n const { translate: t, ...container } = useWixPatternsContainer();\n useSelector(() => container.initTask.status);\n const pageState = useEntityPageContext();\n\n // Same regex as data-extensions https://github.com/wix-private/server-infra/blob/a6c3009d39bbb0312c929f68ee81c559e1eb5b4e/iptf/dataextensions/src/main/scala/com/wixpress/infra/dataextensions/runtime/validator/Formats.scala#L31\n const uriPattern =\n // eslint-disable-next-line no-useless-escape\n /^[A-Za-z][A-Za-z0-9+.-]*:(\\/\\/([A-Za-z0-9._~\\-%!$&'()*+,;=:]*@)?[A-Za-z0-9._~\\-!$&'()*+,;=%:\\[\\]]*(:[0-9]*)?)?[A-Za-z0-9._~\\-%!$&'()*+,;=:@\\/]*([?][A-Za-z0-9._~\\-%!$&'()*+,;=:@\\/?]*)?([#][A-Za-z0-9._~\\-%!$&'()*+,;=:@\\/?]*)?$/;\n\n const controller = useController({\n name: field?.id ?? '',\n control: pageState.form.control,\n defaultValue: (pageState.entity as any)?.[field?.id ?? ''],\n rules: {\n validate: (value: string | null | undefined) => {\n if (\n field.validation?.required &&\n (value === null || value === undefined || value === '')\n ) {\n return t('cairo.fieldValidation.requiredField');\n } else if (value) {\n return (\n uriPattern.test(value) || t('cairo.customFields.url-input.error')\n );\n }\n return true;\n },\n },\n });\n\n return (\n <FormField\n label={field.displayName}\n required={field.validation?.required}\n dataHook={dataHook}\n status={controller.fieldState.error ? 'error' : undefined}\n statusMessage={controller.fieldState.error?.message}\n >\n <Input\n prefix={\n <Input.IconAffix>\n <Link />\n </Input.IconAffix>\n }\n placeholder={t('cairo.customFields.url-input.placeholder')}\n dataHook={`url-${field.id}`}\n value={controller.field.value}\n onChange={(e) => controller.field.onChange?.(e.target.value)}\n onBlur={controller.field.onBlur}\n ref={controller.field.ref}\n />\n </FormField>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,EAAEC,KAAK,QAAQ,oBAAoB;AAErD,SAASC,IAAI,QAAQ,0BAA0B;AAC/C,SACEC,oBAAoB,EACpBC,WAAW,EACXC,uBAAuB,QAClB,eAAe;AACtB,SAASC,aAAa,QAAQ,oBAAoB;AAIlD,OAAO,MAAMC,GAAG,GAAIC,KAAe,IAAK;EACtC,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAC,GAAGF,KAAK;EACjC,MAAM;IAAEG,SAAS,EAAEC,CAAC;IAAE,GAAGC;EAAU,CAAC,GAAGR,uBAAuB,CAAC,CAAC;EAChED,WAAW,CAAC,MAAMS,S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AAE,CACQ,CAClB;IACDuC,WAAW,EAAE7B,CAAC,CAAC,0CAA0C,CAAE;IAC3DF,QAAQ,EAAE,OAAOD,KAAK,CAACW,EAAE,EAAG;IAC5BO,KAAK,EAAET,UAAU,CAACT,KAAK,CAACkB,KAAM;IAC9Be,QAAQ,EAAGC,CAAC,IAAKzB,UAAU,CAACT,KAAK,CAACiC,QAAQ,GAAGC,CAAC,CAACC,MAAM,CAACjB,KAAK,CAAE;IAC7DkB,MAAM,EAAE3B,UAAU,CAACT,KAAK,CAACoC,MAAO;IAChCC,GAAG,EAAE5B,UAAU,CAACT,KAAK,CAACqC;EAAI,CAC3B,CACQ,CAAC;AAEhB,CAAC","ignoreList":[]}
@@ -3,7 +3,6 @@ import { useForm } from '../../exports/form';
3
3
  import React from 'react';
4
4
  import { Card, Cell, Layout } from '@wix/design-system';
5
5
  const RenderLayoutContent = _ref => {
6
- var _content$container$ch;
7
6
  let {
8
7
  content,
9
8
  level,
@@ -13,7 +12,7 @@ const RenderLayoutContent = _ref => {
13
12
  } = _ref;
14
13
  switch (content.type) {
15
14
  case 'container':
16
- if (!((_content$container$ch = content.container.children) != null && _content$container$ch.length)) {
15
+ if (!content.container.children?.length) {
17
16
  return null;
18
17
  }
19
18
  return /*#__PURE__*/React.createElement(Cell, {
@@ -31,7 +30,6 @@ const RenderLayoutContent = _ref => {
31
30
  }
32
31
  };
33
32
  const RenderLayoutCard = _ref2 => {
34
- var _layout$card$subtitle;
35
33
  let {
36
34
  layout,
37
35
  sectionId,
@@ -43,7 +41,7 @@ const RenderLayoutCard = _ref2 => {
43
41
  minHeight: "50px"
44
42
  }, /*#__PURE__*/React.createElement(Card.Header, {
45
43
  title: layout.card.title.text,
46
- subtitle: (_layout$card$subtitle = layout.card.subtitle) == null ? void 0 : _layout$card$subtitle.text
44
+ subtitle: layout.card.subtitle?.text
47
45
  }), /*#__PURE__*/React.createElement(Card.Divider, null), /*#__PURE__*/React.createElement(Card.Content, null, /*#__PURE__*/React.createElement(Layout, null, layout.card.children.map((child, index) => /*#__PURE__*/React.createElement(RenderLayoutContent, {
48
46
  key: `${sectionId}-card-${cardIndex}-content-${index}`,
49
47
  content: child,
@@ -57,7 +55,6 @@ const RenderLayoutCard = _ref2 => {
57
55
  }
58
56
  };
59
57
  export const SkeletonEntity = _ref3 => {
60
- var _entityPage$layout, _entityPage$layout2, _entityPage$layout$si;
61
58
  let {
62
59
  entityPage
63
60
  } = _ref3;
@@ -76,12 +73,12 @@ export const SkeletonEntity = _ref3 => {
76
73
  title: {
77
74
  text: ''
78
75
  }
79
- }), /*#__PURE__*/React.createElement(EntityPage.Content, null, /*#__PURE__*/React.createElement(EntityPage.MainContent, null, (_entityPage$layout = entityPage.layout) == null || (_entityPage$layout = _entityPage$layout.main) == null ? void 0 : _entityPage$layout.map((layout, layoutIndex) => /*#__PURE__*/React.createElement(RenderLayoutCard, {
76
+ }), /*#__PURE__*/React.createElement(EntityPage.Content, null, /*#__PURE__*/React.createElement(EntityPage.MainContent, null, entityPage.layout?.main?.map((layout, layoutIndex) => /*#__PURE__*/React.createElement(RenderLayoutCard, {
80
77
  key: `main-section-card-${layoutIndex}`,
81
78
  layout: layout,
82
79
  sectionId: "main",
83
80
  cardIndex: layoutIndex
84
- }))), (_entityPage$layout2 = entityPage.layout) != null && _entityPage$layout2.sidebar ? /*#__PURE__*/React.createElement(EntityPage.AdditionalContent, null, (_entityPage$layout$si = entityPage.layout.sidebar) == null ? void 0 : _entityPage$layout$si.map((layout, layoutIndex) => /*#__PURE__*/React.createElement(RenderLayoutCard, {
81
+ }))), entityPage.layout?.sidebar ? /*#__PURE__*/React.createElement(EntityPage.AdditionalContent, null, entityPage.layout.sidebar?.map((layout, layoutIndex) => /*#__PURE__*/React.createElement(RenderLayoutCard, {
85
82
  key: `sidebar-section-card-${layoutIndex}`,
86
83
  layout: layout,
87
84
  sectionId: "sidebar",
@@ -1 +1 @@
1
- {"version":3,"names":["EntityPage","useEntityPage","useForm","React","Card","Cell","Layout","RenderLayoutContent","_ref","_content$container$ch","content","level","sectionId","cardIndex","contentIndex","type","container","children","length","createElement","span","map","child","index","key","RenderLayoutCard","_ref2","_layout$card$subtitle","layout","minHeight","Header","title","card","text","subtitle","Divider","Content","SkeletonEntity","_ref3","_entityPage$layout","_entityPage$layout2","_entityPage$layout$si","entityPage","form","state","parentPath","onSave","updatedEntity","fetch","Promise","Fragment","MainContent","main","layoutIndex","sidebar","AdditionalContent"],"sources":["../../../../src/components/AutoPatternsEntityPage/SkeletonEntity.tsx"],"sourcesContent":["import { EntityPage, EntityPageState, useEntityPage } from '@wix/patterns';\nimport { useForm } from '../../exports/form';\nimport React from 'react';\nimport { EntityPageConfig, CardLayout, LayoutContent } from '../../types';\n\nexport interface SkeletonEntityProps {\n entityPage: EntityPageConfig;\n}\nimport { Card, Cell, Layout } from '@wix/design-system';\n\nconst RenderLayoutContent: React.FC<{\n content: LayoutContent;\n level: number;\n sectionId: string;\n cardIndex: number;\n contentIndex: number;\n}> = ({ content, level, sectionId, cardIndex, contentIndex }) => {\n switch (content.type) {\n case 'container':\n if (!content.container.children?.length) {\n return null;\n }\n\n return (\n <Cell span={content.container.span}>\n <Layout>\n {content.container.children.map((child, index) => (\n <RenderLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${contentIndex}-level-${level}-child-${index}`}\n content={child}\n level={level + 1}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n />\n ))}\n </Layout>\n </Cell>\n );\n\n default:\n return null;\n }\n};\n\nconst RenderLayoutCard: React.FC<{\n layout: CardLayout;\n sectionId: string;\n cardIndex: number;\n}> = ({ layout, sectionId, cardIndex }) => {\n switch (layout.type) {\n case 'card':\n return (\n <EntityPage.Card minHeight=\"50px\">\n <Card.Header\n title={layout.card.title.text}\n subtitle={layout.card.subtitle?.text}\n />\n <Card.Divider />\n <Card.Content>\n <Layout>\n {layout.card.children.map((child, index: number) => (\n <RenderLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${index}`}\n content={child}\n level={0}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n />\n ))}\n </Layout>\n </Card.Content>\n </EntityPage.Card>\n );\n default:\n return null;\n }\n};\n\nexport const SkeletonEntity = ({ entityPage }: SkeletonEntityProps) => {\n const form = useForm();\n\n const state: EntityPageState<any> = useEntityPage<any, any>({\n parentPath: '',\n form,\n onSave: async () => ({ updatedEntity: {} }),\n fetch: async () => new Promise(() => {}),\n });\n\n return (\n <>\n <EntityPage state={state}>\n <EntityPage.Header title={{ text: '' }} />\n <EntityPage.Content>\n <EntityPage.MainContent>\n {entityPage.layout?.main?.map((layout, layoutIndex) => (\n <RenderLayoutCard\n key={`main-section-card-${layoutIndex}`}\n layout={layout}\n sectionId=\"main\"\n cardIndex={layoutIndex}\n />\n ))}\n </EntityPage.MainContent>\n {entityPage.layout?.sidebar ? (\n <EntityPage.AdditionalContent>\n {entityPage.layout.sidebar?.map((layout, layoutIndex) => (\n <RenderLayoutCard\n key={`sidebar-section-card-${layoutIndex}`}\n layout={layout}\n sectionId=\"sidebar\"\n cardIndex={layoutIndex}\n />\n ))}\n </EntityPage.AdditionalContent>\n ) : null}\n </EntityPage.Content>\n </EntityPage>\n </>\n );\n};\n"],"mappings":"AAAA,SAASA,UAAU,EAAmBC,aAAa,QAAQ,eAAe;AAC1E,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,OAAOC,KAAK,MAAM,OAAO;AAMzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,MAAM,QAAQ,oBAAoB;AAEvD,MAAMC,mBAMJ,GAAGC,IAAA,IAA4D;EAAA,IAAAC,qBAAA;EAAA,IAA3D;IAAEC,OAAO;IAAEC,KAAK;IAAEC,SAAS;IAAEC,SAAS;IAAEC;EAAa,CAAC,GAAAN,IAAA;EAC1D,QAAQE,OAAO,CAACK,IAAI;IAClB,KAAK,WAAW;MACd,IAAI,GAAAN,qBAAA,GAACC,OAAO,CAACM,SAAS,CAACC,QAAQ,aAA1BR,qBAAA,C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D,WAAW,SAAAZ,kBAAA,GACpBG,UAAU,CAACd,MAAM,cAAAW,kBAAA,GAAjBA,kBAAA,CAAmBa,IAAI,qBAAvBb,kBAAA,CAAyBlB,GAAG,CAAC,CAACO,MAAM,EAAEyB,WAAW,kBAChDlD,KAAA,CAAAgB,aAAA,CAACM,gBAAgB;IACfD,GAAG,EAAE,qBAAqB6B,WAAW,EAAG;IACxCzB,MAAM,EAAEA,MAAO;IACfhB,SAAS,EAAC,MAAM;IAChBC,SAAS,EAAEwC;EAAY,CACxB,CACF,CACqB,CAAC,EACxB,CAAAb,mBAAA,GAAAE,UAAU,CAACd,MAAM,aAAjBY,mBAAA,CAAmBc,OAAO,gBACzBnD,KAAA,CAAAgB,aAAA,CAACnB,UAAU,CAACuD,iBAAiB,SAAAd,qBAAA,GAC1BC,UAAU,CAACd,MAAM,CAAC0B,OAAO,qBAAzBb,qBAAA,CAA2BpB,GAAG,CAAC,CAACO,MAAM,EAAEyB,WAAW,kBAClDlD,KAAA,CAAAgB,aAAA,CAACM,gBAAgB;IACfD,GAAG,EAAE,wBAAwB6B,WAAW,EAAG;IAC3CzB,MAAM,EAAEA,MAAO;IACfhB,SAAS,EAAC,SAAS;IACnBC,SAAS,EAAEwC;EAAY,CACxB,CACF,CAC2B,CAAC,GAC7B,IACc,CACV,CACZ,CAAC;AAEP,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["EntityPage","useEntityPage","useForm","React","Card","Cell","Layout","RenderLayoutContent","_ref","content","level","sectionId","cardIndex","contentIndex","type","container","children","length","createElement","span","map","child","index","key","RenderLayoutCard","_ref2","layout","minHeight","Header","title","card","text","subtitle","Divider","Content","SkeletonEntity","_ref3","entityPage","form","state","parentPath","onSave","updatedEntity","fetch","Promise","Fragment","MainContent","main","layoutIndex","sidebar","AdditionalContent"],"sources":["../../../../src/components/AutoPatternsEntityPage/SkeletonEntity.tsx"],"sourcesContent":["import { EntityPage, EntityPageState, useEntityPage } from '@wix/patterns';\nimport { useForm } from '../../exports/form';\nimport React from 'react';\nimport { EntityPageConfig, CardLayout, LayoutContent } from '../../types';\n\nexport interface SkeletonEntityProps {\n entityPage: EntityPageConfig;\n}\nimport { Card, Cell, Layout } from '@wix/design-system';\n\nconst RenderLayoutContent: React.FC<{\n content: LayoutContent;\n level: number;\n sectionId: string;\n cardIndex: number;\n contentIndex: number;\n}> = ({ content, level, sectionId, cardIndex, contentIndex }) => {\n switch (content.type) {\n case 'container':\n if (!content.container.children?.length) {\n return null;\n }\n\n return (\n <Cell span={content.container.span}>\n <Layout>\n {content.container.children.map((child, index) => (\n <RenderLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${contentIndex}-level-${level}-child-${index}`}\n content={child}\n level={level + 1}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n />\n ))}\n </Layout>\n </Cell>\n );\n\n default:\n return null;\n }\n};\n\nconst RenderLayoutCard: React.FC<{\n layout: CardLayout;\n sectionId: string;\n cardIndex: number;\n}> = ({ layout, sectionId, cardIndex }) => {\n switch (layout.type) {\n case 'card':\n return (\n <EntityPage.Card minHeight=\"50px\">\n <Card.Header\n title={layout.card.title.text}\n subtitle={layout.card.subtitle?.text}\n />\n <Card.Divider />\n <Card.Content>\n <Layout>\n {layout.card.children.map((child, index: number) => (\n <RenderLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${index}`}\n content={child}\n level={0}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n />\n ))}\n </Layout>\n </Card.Content>\n </EntityPage.Card>\n );\n default:\n return null;\n }\n};\n\nexport const SkeletonEntity = ({ entityPage }: SkeletonEntityProps) => {\n const form = useForm();\n\n const state: EntityPageState<any> = useEntityPage<any, any>({\n parentPath: '',\n form,\n onSave: async () => ({ updatedEntity: {} }),\n fetch: async () => new Promise(() => {}),\n });\n\n return (\n <>\n <EntityPage state={state}>\n <EntityPage.Header title={{ text: '' }} />\n <EntityPage.Content>\n <EntityPage.MainContent>\n {entityPage.layout?.main?.map((layout, layoutIndex) => (\n <RenderLayoutCard\n key={`main-section-card-${layoutIndex}`}\n layout={layout}\n sectionId=\"main\"\n cardIndex={layoutIndex}\n />\n ))}\n </EntityPage.MainContent>\n {entityPage.layout?.sidebar ? (\n <EntityPage.AdditionalContent>\n {entityPage.layout.sidebar?.map((layout, layoutIndex) => (\n <RenderLayoutCard\n key={`sidebar-section-card-${layoutIndex}`}\n layout={layout}\n sectionId=\"sidebar\"\n cardIndex={layoutIndex}\n />\n ))}\n </EntityPage.AdditionalContent>\n ) : null}\n </EntityPage.Content>\n </EntityPage>\n </>\n );\n};\n"],"mappings":"AAAA,SAASA,UAAU,EAAmBC,aAAa,QAAQ,eAAe;AAC1E,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,OAAOC,KAAK,MAAM,OAAO;AAMzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,MAAM,QAAQ,oBAAoB;AAEvD,MAAMC,mBAMJ,GAAGC,IAAA,IAA4D;EAAA,IAA3D;IAAEC,OAAO;IAAEC,KAAK;IAAEC,SAAS;IAAEC,SAAS;IAAEC;EAAa,CAAC,GAAAL,IAAA;EAC1D,QAAQC,OAAO,CAACK,IAAI;IAClB,KAAK,WAAW;MACd,IAAI,CAACL,OAAO,CAACM,SAAS,CAACC,QAAQ,EAAEC,MAAM,EAAE;QACvC,OAAO,IAAI;MACb;MAEA,oBACEd,KAAA,CAAAe,aAAA,CAACb,IAAI;QAACc,IAAI,EAAEV,OAAO,CAACM,SAAS,CAACI;MAAK,gBACjChB,KAAA,CAAAe,aAAA,CAACZ,MAAM,QACJG,OAAO,CAACM,SAAS,CAACC,QAAQ,CAACI,GAAG,CAAC,CAACC,KAAK,EAAEC,KAAK,kBAC3CnB,KAAA,CAAAe,aAAA,CAACX,mBAAmB;QAClBgB,GAAG,EAAE,GAAGZ,SAAS,SAASC,SAAS,YAAYC,YAAY,UAAUH,KAAK,UAAUY,KAAK,EAAG;QAC5Fb,OAAO,EAAEY,KAAM;QACfX,KAAK,EAA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AAEA,MAAO;IACff,SAAS,EAAC,SAAS;IACnBC,SAAS,EAAEoC;EAAY,CACxB,CACF,CAC2B,CAAC,GAC7B,IACc,CACV,CACZ,CAAC;AAEP,CAAC","ignoreList":[]}
@@ -4,7 +4,6 @@ import * as modals from './modals';
4
4
  import { useModalContext } from '../providers/ModalContext';
5
5
  import { usePatternsWizardOverridesContext } from '../providers';
6
6
  export const ModalRenderer = () => {
7
- var _overrides$modals;
8
7
  const {
9
8
  modal,
10
9
  closeModal
@@ -13,7 +12,7 @@ export const ModalRenderer = () => {
13
12
  if (!modal.id) {
14
13
  return null;
15
14
  }
16
- const ModalComponent = (overrides == null || (_overrides$modals = overrides.modals) == null ? void 0 : _overrides$modals[modal.id]) || modals[modal.id];
15
+ const ModalComponent = overrides?.modals?.[modal.id] || modals[modal.id];
17
16
  if (!ModalComponent) {
18
17
  console.warn(`No modal registered for id: ${modal.id}`);
19
18
  return null;
@@ -1 +1 @@
1
- {"version":3,"names":["React","modals","useModalContext","usePatternsWizardOverridesContext","ModalRenderer","_overrides$modals","modal","closeModal","overrides","id","ModalComponent","console","warn","createElement","_extends","props","onClose"],"sources":["../../../src/components/ModalRenderer.tsx"],"sourcesContent":["import React from 'react';\nimport * as modals from './modals';\nimport { useModalContext } from '../providers/ModalContext';\nimport { usePatternsWizardOverridesContext } from '../providers';\n\nexport const ModalRenderer = () => {\n const { modal, closeModal } = useModalContext();\n const overrides = usePatternsWizardOverridesContext();\n\n if (!modal.id) {\n return null;\n }\n\n const ModalComponent =\n overrides?.modals?.[modal.id] ||\n (modals as Record<string, React.ComponentType<any>>)[modal.id];\n\n if (!ModalComponent) {\n console.warn(`No modal registered for id: ${modal.id}`);\n return null;\n }\n\n return <ModalComponent {...modal.props} onClose={closeModal} />;\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAO,KAAKC,MAAM,MAAM,UAAU;AAClC,SAASC,eAAe,QAAQ,2BAA2B;AAC3D,SAASC,iCAAiC,QAAQ,cAAc;AAEhE,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EAAA,IAAAC,iBAAA;EACjC,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGL,eAAe,CAAC,CAAC;EAC/C,MAAMM,SAAS,GAAGL,iCAAiC,CAAC,CAAC;EAErD,IAAI,CAACG,KAAK,CAACG,EAAE,EAAE;IACb,OAAO,IAAI;EACb;EAEA,MAAMC,cAAc,GAClB,CAAAF,SAAS,aAAAH,iBAAA,GAATG,SAAS,CAAEP,MAAM,qBAAjBI,iBAAA,CAAoBC,KAAK,CAACG,EAAE,CAAC,KAC5BR,MAAM,CAA8CK,KAAK,CAACG,EAAE,CAAC;EAEhE,IAAI,CAACC,cAAc,EAAE;IACnBC,OAAO,CAACC,IAAI,CAAC,+BAA+BN,KAAK,CAACG,EAAE,EAAE,CAAC;IACvD,OAAO,IAAI;EACb;EAEA,oBAAOT,KAAA,CAAAa,aAAA,CAACH,cAAc,EAAAI,QAAA,KAAKR,KAAK,CAACS,KAAK;IAAEC,OAAO,EAAET;EAAW,EAAE,CAAC;AACjE,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","modals","useModalContext","usePatternsWizardOverridesContext","ModalRenderer","modal","closeModal","overrides","id","ModalComponent","console","warn","createElement","_extends","props","onClose"],"sources":["../../../src/components/ModalRenderer.tsx"],"sourcesContent":["import React from 'react';\nimport * as modals from './modals';\nimport { useModalContext } from '../providers/ModalContext';\nimport { usePatternsWizardOverridesContext } from '../providers';\n\nexport const ModalRenderer = () => {\n const { modal, closeModal } = useModalContext();\n const overrides = usePatternsWizardOverridesContext();\n\n if (!modal.id) {\n return null;\n }\n\n const ModalComponent =\n overrides?.modals?.[modal.id] ||\n (modals as Record<string, React.ComponentType<any>>)[modal.id];\n\n if (!ModalComponent) {\n console.warn(`No modal registered for id: ${modal.id}`);\n return null;\n }\n\n return <ModalComponent {...modal.props} onClose={closeModal} />;\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAO,KAAKC,MAAM,MAAM,UAAU;AAClC,SAASC,eAAe,QAAQ,2BAA2B;AAC3D,SAASC,iCAAiC,QAAQ,cAAc;AAEhE,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EACjC,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGJ,eAAe,CAAC,CAAC;EAC/C,MAAMK,SAAS,GAAGJ,iCAAiC,CAAC,CAAC;EAErD,IAAI,CAACE,KAAK,CAACG,EAAE,EAAE;IACb,OAAO,IAAI;EACb;EAEA,MAAMC,cAAc,GAClBF,SAAS,EAAEN,MAAM,GAAGI,KAAK,CAACG,EAAE,CAAC,IAC5BP,MAAM,CAA8CI,KAAK,CAACG,EAAE,CAAC;EAEhE,IAAI,CAACC,cAAc,EAAE;IACnBC,OAAO,CAACC,IAAI,CAAC,+BAA+BN,KAAK,CAACG,EAAE,EAAE,CAAC;IACvD,OAAO,IAAI;EACb;EAEA,oBAAOR,KAAA,CAAAY,aAAA,CAACH,cAAc,EAAAI,QAAA,KAAKR,KAAK,CAACS,KAAK;IAAEC,OAAO,EAAET;EAAW,EAAE,CAAC;AACjE,CAAC","ignoreList":[]}
@@ -1,7 +1,6 @@
1
1
  import { Box, CustomModalLayout, Modal, Text } from '@wix/design-system';
2
2
  import React from 'react';
3
3
  export const BulkDeleteModal = _ref => {
4
- var _modalParams$title, _modalParams$actions, _modalParams$actions2, _modalParams$descript;
5
4
  let {
6
5
  sdk,
7
6
  modalParams,
@@ -17,24 +16,20 @@ export const BulkDeleteModal = _ref => {
17
16
  isOpen: true,
18
17
  onRequestClose: closeModal
19
18
  }, /*#__PURE__*/React.createElement(CustomModalLayout, {
20
- title: ((_modalParams$title = modalParams.title) == null ? void 0 : _modalParams$title.text) || 'Delete item?',
19
+ title: modalParams.title?.text || 'Delete item?',
21
20
  theme: "destructive",
22
21
  onCloseButtonClick: () => {
23
22
  closeModal();
24
23
  },
25
24
  primaryButtonOnClick: () => {
26
- var _modalParams$feedback;
27
25
  const schema = sdk.getSchema(sdk.collectionId);
28
26
  if (!schema) {
29
27
  throw new Error('Schema not found');
30
28
  }
31
29
  const selectedIds = actionParams.selectedValues.map(value => value[schema.idField]);
32
- optimisticActions == null || optimisticActions.deleteMany(actionParams.selectedValues, {
33
- successToast: ((_modalParams$feedback = modalParams.feedback) == null || (_modalParams$feedback = _modalParams$feedback.successToast) == null ? void 0 : _modalParams$feedback.text) || 'Items deleted successfully',
34
- errorToast: () => {
35
- var _modalParams$feedback2;
36
- return ((_modalParams$feedback2 = modalParams.feedback) == null || (_modalParams$feedback2 = _modalParams$feedback2.errorToast) == null ? void 0 : _modalParams$feedback2.text) || 'Failed to delete items';
37
- },
30
+ optimisticActions?.deleteMany(actionParams.selectedValues, {
31
+ successToast: modalParams.feedback?.successToast?.text || 'Items deleted successfully',
32
+ errorToast: () => modalParams.feedback?.errorToast?.text || 'Failed to delete items',
38
33
  submit: async () => {
39
34
  const result = await schema.actions.bulkDelete(selectedIds);
40
35
  return [result];
@@ -45,15 +40,15 @@ export const BulkDeleteModal = _ref => {
45
40
  secondaryButtonOnClick: () => {
46
41
  closeModal();
47
42
  },
48
- primaryButtonText: ((_modalParams$actions = modalParams.actions) == null || (_modalParams$actions = _modalParams$actions.submit) == null ? void 0 : _modalParams$actions.text) || 'Save',
49
- secondaryButtonText: ((_modalParams$actions2 = modalParams.actions) == null || (_modalParams$actions2 = _modalParams$actions2.cancel) == null ? void 0 : _modalParams$actions2.text) || 'Cancel',
43
+ primaryButtonText: modalParams.actions?.submit?.text || 'Save',
44
+ secondaryButtonText: modalParams.actions?.cancel?.text || 'Cancel',
50
45
  content: /*#__PURE__*/React.createElement(Box, {
51
46
  direction: "vertical",
52
47
  width: "552px",
53
48
  gap: "SP2",
54
49
  paddingTop: "SP1",
55
50
  paddingBottom: "SP1"
56
- }, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Text, null, ((_modalParams$descript = modalParams.description) == null ? void 0 : _modalParams$descript.text) || 'This items will be deleted')))
51
+ }, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Text, null, modalParams.description?.text || 'This items will be deleted')))
57
52
  }));
58
53
  };
59
54
  //# sourceMappingURL=BulkDeleteModal.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Box","CustomModalLayout","Modal","Text","React","BulkDeleteModal","_ref","_modalParams$title","_modalParams$actions","_modalParams$actions2","_modalParams$descript","sdk","modalParams","actionParams","getOptimisticActions","collectionId","closeModal","optimisticActions","createElement","isOpen","onRequestClose","title","text","theme","onCloseButtonClick","primaryButtonOnClick","_modalParams$feedback","schema","getSchema","Error","selectedIds","selectedValues","map","value","idField","deleteMany","successToast","feedback","errorToast","_modalParams$feedback2","submit","result","actions","bulkDelete","secondaryButtonOnClick","primaryButtonText","secondaryButtonText","cancel","content","direction","width","gap","paddingTop","paddingBottom","description"],"sources":["../../../../../src/components/modals/actions/BulkDeleteModal.tsx"],"sourcesContent":["import { Box, CustomModalLayout, Modal, Text } from '@wix/design-system';\nimport React from 'react';\nimport { BulkActionsActionParams, BulkDeleteActionModal } from '../../../types';\nimport { ActionModalProps } from './types';\n\nexport interface BulkDeleteModalProps extends ActionModalProps {\n modalParams: BulkDeleteActionModal;\n actionParams: BulkActionsActionParams;\n}\n\nexport const BulkDeleteModal = ({\n sdk,\n modalParams,\n actionParams,\n}: BulkDeleteModalProps) => {\n const { getOptimisticActions, collectionId, closeModal } = sdk;\n const optimisticActions = getOptimisticActions(collectionId);\n\n return (\n <Modal isOpen onRequestClose={closeModal}>\n <CustomModalLayout\n title={modalParams.title?.text || 'Delete item?'}\n theme=\"destructive\"\n onCloseButtonClick={() => {\n closeModal();\n }}\n primaryButtonOnClick={() => {\n const schema = sdk.getSchema(sdk.collectionId);\n if (!schema) {\n throw new Error('Schema not found');\n }\n const selectedIds = actionParams.selectedValues.map(\n (value) => value[schema.idField],\n );\n optimisticActions?.deleteMany(actionParams.selectedValues, {\n successToast:\n modalParams.feedback?.successToast?.text ||\n 'Items deleted successfully',\n errorToast: () =>\n modalParams.feedback?.errorToast?.text ||\n 'Failed to delete items',\n submit: async () => {\n const result = await schema.actions.bulkDelete(selectedIds);\n return [result];\n },\n });\n closeModal();\n }}\n secondaryButtonOnClick={() => {\n closeModal();\n }}\n primaryButtonText={modalParams.actions?.submit?.text || 'Save'}\n secondaryButtonText={modalParams.actions?.cancel?.text || 'Cancel'}\n content={\n <Box\n direction=\"vertical\"\n width=\"552px\"\n gap=\"SP2\"\n paddingTop=\"SP1\"\n paddingBottom=\"SP1\"\n >\n <Box>\n <Text>\n {modalParams.description?.text || 'This items will be deleted'}\n </Text>\n </Box>\n </Box>\n }\n />\n </Modal>\n );\n};\n"],"mappings":"AAAA,SAASA,GAAG,EAAEC,iBAAiB,EAAEC,KAAK,EAAEC,IAAI,QAAQ,oBAAoB;AACxE,OAAOC,KAAK,MAAM,OAAO;AASzB,OAAO,MAAMC,eAAe,GAAGC,IAAA,IAIH;EAAA,IAAAC,kBAAA,EAAAC,oBAAA,EAAAC,qBAAA,EAAAC,qBAAA;EAAA,IAJI;IAC9BC,GAAG;IACHC,WAAW;IACXC;EACoB,CAAC,GAAAP,IAAA;EACrB,MAAM;IAAEQ,oBAAoB;IAAEC,YAAY;IAAEC;EAAW,CAAC,GAAGL,GAAG;EAC9D,MAAMM,iBAAiB,GAAGH,oBAAoB,CAACC,YAAY,CAAC;EAE5D,oBACEX,KAAA,CAAAc,aAAA,CAAChB,KAAK;IAACiB,MAAM;IAACC,cAAc,EAAEJ;EAAW,gBACvCZ,KAAA,CAAAc,aAAA,CAACjB,iBAAiB;IAChBoB,KAAK,EAAE,EAAAd,kBAAA,GAAAK,WAAW,CAACS,KAAK,qBAAjBd,kBAAA,CAAmBe,IAAI,KAAI,cAAe;IACjDC,KAAK,EAAC,aAAa;IACnBC,kBAAkB,EAAEA,CAAA,KAAM;MACxBR,UAAU,CAAC,CAAC;IACd,CAAE;IACFS,oBAAoB,EAAEA,CAAA,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AAC8B,OAAO,cAAAjC,qBAAA,GAAnBA,qBAAA,CAAqBsC,MAAM,qBAA3BtC,qBAAA,CAA6Ba,IAAI,KAAI,QAAS;IACnE0B,OAAO,eACL5C,KAAA,CAAAc,aAAA,CAAClB,GAAG;MACFiD,SAAS,EAAC,UAAU;MACpBC,KAAK,EAAC,OAAO;MACbC,GAAG,EAAC,KAAK;MACTC,UAAU,EAAC,KAAK;MAChBC,aAAa,EAAC;IAAK,gBAEnBjD,KAAA,CAAAc,aAAA,CAAClB,GAAG,qBACFI,KAAA,CAAAc,aAAA,CAACf,IAAI,QACF,EAAAO,qBAAA,GAAAE,WAAW,CAAC0C,WAAW,qBAAvB5C,qBAAA,CAAyBY,IAAI,KAAI,4BAC9B,CACH,CACF;EACN,CACF,CACI,CAAC;AAEZ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Box","CustomModalLayout","Modal","Text","React","BulkDeleteModal","_ref","sdk","modalParams","actionParams","getOptimisticActions","collectionId","closeModal","optimisticActions","createElement","isOpen","onRequestClose","title","text","theme","onCloseButtonClick","primaryButtonOnClick","schema","getSchema","Error","selectedIds","selectedValues","map","value","idField","deleteMany","successToast","feedback","errorToast","submit","result","actions","bulkDelete","secondaryButtonOnClick","primaryButtonText","secondaryButtonText","cancel","content","direction","width","gap","paddingTop","paddingBottom","description"],"sources":["../../../../../src/components/modals/actions/BulkDeleteModal.tsx"],"sourcesContent":["import { Box, CustomModalLayout, Modal, Text } from '@wix/design-system';\nimport React from 'react';\nimport { BulkActionsActionParams, BulkDeleteActionModal } from '../../../types';\nimport { ActionModalProps } from './types';\n\nexport interface BulkDeleteModalProps extends ActionModalProps {\n modalParams: BulkDeleteActionModal;\n actionParams: BulkActionsActionParams;\n}\n\nexport const BulkDeleteModal = ({\n sdk,\n modalParams,\n actionParams,\n}: BulkDeleteModalProps) => {\n const { getOptimisticActions, collectionId, closeModal } = sdk;\n const optimisticActions = getOptimisticActions(collectionId);\n\n return (\n <Modal isOpen onRequestClose={closeModal}>\n <CustomModalLayout\n title={modalParams.title?.text || 'Delete item?'}\n theme=\"destructive\"\n onCloseButtonClick={() => {\n closeModal();\n }}\n primaryButtonOnClick={() => {\n const schema = sdk.getSchema(sdk.collectionId);\n if (!schema) {\n throw new Error('Schema not found');\n }\n const selectedIds = actionParams.selectedValues.map(\n (value) => value[schema.idField],\n );\n optimisticActions?.deleteMany(actionParams.selectedValues, {\n successToast:\n modalParams.feedback?.successToast?.text ||\n 'Items deleted successfully',\n errorToast: () =>\n modalParams.feedback?.errorToast?.text ||\n 'Failed to delete items',\n submit: async () => {\n const result = await schema.actions.bulkDelete(selectedIds);\n return [result];\n },\n });\n closeModal();\n }}\n secondaryButtonOnClick={() => {\n closeModal();\n }}\n primaryButtonText={modalParams.actions?.submit?.text || 'Save'}\n secondaryButtonText={modalParams.actions?.cancel?.text || 'Cancel'}\n content={\n <Box\n direction=\"vertical\"\n width=\"552px\"\n gap=\"SP2\"\n paddingTop=\"SP1\"\n paddingBottom=\"SP1\"\n >\n <Box>\n <Text>\n {modalParams.description?.text || 'This items will be deleted'}\n </Text>\n </Box>\n </Box>\n }\n />\n </Modal>\n );\n};\n"],"mappings":"AAAA,SAASA,GAAG,EAAEC,iBAAiB,EAAEC,KAAK,EAAEC,IAAI,QAAQ,oBAAoB;AACxE,OAAOC,KAAK,MAAM,OAAO;AASzB,OAAO,MAAMC,eAAe,GAAGC,IAAA,IAIH;EAAA,IAJI;IAC9BC,GAAG;IACHC,WAAW;IACXC;EACoB,CAAC,GAAAH,IAAA;EACrB,MAAM;IAAEI,oBAAoB;IAAEC,YAAY;IAAEC;EAAW,CAAC,GAAGL,GAAG;EAC9D,MAAMM,iBAAiB,GAAGH,oBAAoB,CAACC,YAAY,CAAC;EAE5D,oBACEP,KAAA,CAAAU,aAAA,CAACZ,KAAK;IAACa,MAAM;IAACC,cAAc,EAAEJ;EAAW,gBACvCR,KAAA,CAAAU,aAAA,CAACb,iBAAiB;IAChBgB,KAAK,EAAET,WAAW,CA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,EAAC,OAAO;MACbC,GAAG,EAAC,KAAK;MACTC,UAAU,EAAC,KAAK;MAChBC,aAAa,EAAC;IAAK,gBAEnB3C,KAAA,CAAAU,aAAA,CAACd,GAAG,qBACFI,KAAA,CAAAU,aAAA,CAACX,IAAI,QACFK,WAAW,CAACwC,WAAW,EAAE9B,IAAI,IAAI,4BAC9B,CACH,CACF;EACN,CACF,CACI,CAAC;AAEZ,CAAC","ignoreList":[]}
@@ -1,7 +1,6 @@
1
1
  import { Box, CustomModalLayout, Input, Modal, Text } from '@wix/design-system';
2
2
  import React, { useState } from 'react';
3
3
  export const CreateModal = _ref => {
4
- var _modalParams$title, _modalParams$actions, _modalParams$actions2;
5
4
  let {
6
5
  sdk,
7
6
  modalParams
@@ -22,22 +21,18 @@ export const CreateModal = _ref => {
22
21
  isOpen: true,
23
22
  onRequestClose: closeModal
24
23
  }, /*#__PURE__*/React.createElement(CustomModalLayout, {
25
- title: ((_modalParams$title = modalParams.title) == null ? void 0 : _modalParams$title.text) || 'Create',
24
+ title: modalParams.title?.text || 'Create',
26
25
  onCloseButtonClick: () => {
27
26
  closeModal();
28
27
  },
29
28
  primaryButtonOnClick: () => {
30
- var _modalParams$feedback;
31
29
  const schema = sdk.getSchema(sdk.collectionId);
32
30
  const createdItem = {
33
31
  ...values
34
32
  };
35
- optimisticActions == null || optimisticActions.createOne(createdItem, {
36
- successToast: ((_modalParams$feedback = modalParams.feedback) == null || (_modalParams$feedback = _modalParams$feedback.successToast) == null ? void 0 : _modalParams$feedback.text) || 'Item created successfully',
37
- errorToast: () => {
38
- var _modalParams$feedback2;
39
- return ((_modalParams$feedback2 = modalParams.feedback) == null || (_modalParams$feedback2 = _modalParams$feedback2.errorToast) == null ? void 0 : _modalParams$feedback2.text) || 'Failed to create item';
40
- },
33
+ optimisticActions?.createOne(createdItem, {
34
+ successToast: modalParams.feedback?.successToast?.text || 'Item created successfully',
35
+ errorToast: () => modalParams.feedback?.errorToast?.text || 'Failed to create item',
41
36
  submit: async () => {
42
37
  if (!schema) {
43
38
  throw new Error('Schema not found');
@@ -51,8 +46,8 @@ export const CreateModal = _ref => {
51
46
  secondaryButtonOnClick: () => {
52
47
  closeModal();
53
48
  },
54
- primaryButtonText: ((_modalParams$actions = modalParams.actions) == null || (_modalParams$actions = _modalParams$actions.submit) == null ? void 0 : _modalParams$actions.text) || 'Save',
55
- secondaryButtonText: ((_modalParams$actions2 = modalParams.actions) == null || (_modalParams$actions2 = _modalParams$actions2.cancel) == null ? void 0 : _modalParams$actions2.text) || 'Cancel',
49
+ primaryButtonText: modalParams.actions?.submit?.text || 'Save',
50
+ secondaryButtonText: modalParams.actions?.cancel?.text || 'Cancel',
56
51
  content: /*#__PURE__*/React.createElement(Box, {
57
52
  direction: "vertical",
58
53
  width: "552px",
@@ -1 +1 @@
1
- {"version":3,"names":["Box","CustomModalLayout","Input","Modal","Text","React","useState","CreateModal","_ref","_modalParams$title","_modalParams$actions","_modalParams$actions2","sdk","modalParams","values","setValues","fields","reduce","acc","field","id","closeModal","getOptimisticActions","collectionId","optimisticActions","createElement","isOpen","onRequestClose","title","text","onCloseButtonClick","primaryButtonOnClick","_modalParams$feedback","schema","getSchema","createdItem","createOne","successToast","feedback","errorToast","_modalParams$feedback2","submit","Error","result","actions","create","secondaryButtonOnClick","primaryButtonText","secondaryButtonText","cancel","content","direction","width","gap","paddingTop","paddingBottom","map","key","label","value","onChange","e","prev","target"],"sources":["../../../../../src/components/modals/actions/CreateModal.tsx"],"sourcesContent":["import { Box, CustomModalLayout, Input, Modal, Text } from '@wix/design-system';\nimport React, { useState } from 'react';\nimport { CreateActionModal } from '../../../types';\nimport { ActionModalProps } from './types';\n\nexport interface CreateModalProps extends ActionModalProps {\n modalParams: CreateActionModal;\n}\n\nexport const CreateModal = ({ sdk, modalParams }: CreateModalProps) => {\n const [values, setValues] = useState(\n modalParams.fields.reduce((acc, field) => {\n acc[field.id] = '';\n return acc;\n }, {} as Record<string, any>),\n );\n const { closeModal } = sdk;\n const { getOptimisticActions, collectionId } = sdk;\n const optimisticActions = getOptimisticActions(collectionId);\n\n return (\n <Modal isOpen onRequestClose={closeModal}>\n <CustomModalLayout\n title={modalParams.title?.text || 'Create'}\n onCloseButtonClick={() => {\n closeModal();\n }}\n primaryButtonOnClick={() => {\n const schema = sdk.getSchema(sdk.collectionId);\n const createdItem = { ...values };\n optimisticActions?.createOne(createdItem, {\n successToast:\n modalParams.feedback?.successToast?.text ||\n 'Item created successfully',\n errorToast: () =>\n modalParams.feedback?.errorToast?.text || 'Failed to create item',\n submit: async () => {\n if (!schema) {\n throw new Error('Schema not found');\n }\n\n const result = await schema.actions.create(createdItem);\n return [result];\n },\n });\n closeModal();\n }}\n secondaryButtonOnClick={() => {\n closeModal();\n }}\n primaryButtonText={modalParams.actions?.submit?.text || 'Save'}\n secondaryButtonText={modalParams.actions?.cancel?.text || 'Cancel'}\n content={\n <Box\n direction=\"vertical\"\n width=\"552px\"\n gap=\"SP2\"\n paddingTop=\"SP1\"\n paddingBottom=\"SP1\"\n >\n {modalParams.fields.map((field) => {\n return (\n <Box key={field.id} direction=\"vertical\" width=\"100%\" gap=\"SP2\">\n <Box>\n <Text>{field.label}</Text>\n </Box>\n <Box>\n <Input\n value={values[field.id]}\n onChange={(e) => {\n setValues((prev) => ({\n ...prev,\n [field.id]: e.target.value,\n }));\n }}\n />\n </Box>\n </Box>\n );\n })}\n </Box>\n }\n />\n </Modal>\n );\n};\n"],"mappings":"AAAA,SAASA,GAAG,EAAEC,iBAAiB,EAAEC,KAAK,EAAEC,KAAK,EAAEC,IAAI,QAAQ,oBAAoB;AAC/E,OAAOC,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AAQvC,OAAO,MAAMC,WAAW,GAAGC,IAAA,IAA4C;EAAA,IAAAC,kBAAA,EAAAC,oBAAA,EAAAC,qBAAA;EAAA,IAA3C;IAAEC,GAAG;IAAEC;EAA8B,CAAC,GAAAL,IAAA;EAChE,MAAM,CAACM,MAAM,EAAEC,SAAS,CAAC,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Y,CACtB,CAAC,eACNrD,KAAA,CAAAoB,aAAA,CAACzB,GAAG,qBACFK,KAAA,CAAAoB,aAAA,CAACvB,KAAK;QACJyD,KAAK,EAAE7C,MAAM,CAACK,KAAK,CAACC,EAAE,CAAE;QACxBwC,QAAQ,EAAGC,CAAC,IAAK;UACf9C,SAAS,CAAE+C,IAAI,KAAM;YACnB,GAAGA,IAAI;YACP,CAAC3C,KAAK,CAACC,EAAE,GAAGyC,CAAC,CAACE,MAAM,CAACJ;UACvB,CAAC,CAAC,CAAC;QACL;MAAE,CACH,CACE,CACF,CAAC;IAEV,CAAC,CACE;EACN,CACF,CACI,CAAC;AAEZ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Box","CustomModalLayout","Input","Modal","Text","React","useState","CreateModal","_ref","sdk","modalParams","values","setValues","fields","reduce","acc","field","id","closeModal","getOptimisticActions","collectionId","optimisticActions","createElement","isOpen","onRequestClose","title","text","onCloseButtonClick","primaryButtonOnClick","schema","getSchema","createdItem","createOne","successToast","feedback","errorToast","submit","Error","result","actions","create","secondaryButtonOnClick","primaryButtonText","secondaryButtonText","cancel","content","direction","width","gap","paddingTop","paddingBottom","map","key","label","value","onChange","e","prev","target"],"sources":["../../../../../src/components/modals/actions/CreateModal.tsx"],"sourcesContent":["import { Box, CustomModalLayout, Input, Modal, Text } from '@wix/design-system';\nimport React, { useState } from 'react';\nimport { CreateActionModal } from '../../../types';\nimport { ActionModalProps } from './types';\n\nexport interface CreateModalProps extends ActionModalProps {\n modalParams: CreateActionModal;\n}\n\nexport const CreateModal = ({ sdk, modalParams }: CreateModalProps) => {\n const [values, setValues] = useState(\n modalParams.fields.reduce((acc, field) => {\n acc[field.id] = '';\n return acc;\n }, {} as Record<string, any>),\n );\n const { closeModal } = sdk;\n const { getOptimisticActions, collectionId } = sdk;\n const optimisticActions = getOptimisticActions(collectionId);\n\n return (\n <Modal isOpen onRequestClose={closeModal}>\n <CustomModalLayout\n title={modalParams.title?.text || 'Create'}\n onCloseButtonClick={() => {\n closeModal();\n }}\n primaryButtonOnClick={() => {\n const schema = sdk.getSchema(sdk.collectionId);\n const createdItem = { ...values };\n optimisticActions?.createOne(createdItem, {\n successToast:\n modalParams.feedback?.successToast?.text ||\n 'Item created successfully',\n errorToast: () =>\n modalParams.feedback?.errorToast?.text || 'Failed to create item',\n submit: async () => {\n if (!schema) {\n throw new Error('Schema not found');\n }\n\n const result = await schema.actions.create(createdItem);\n return [result];\n },\n });\n closeModal();\n }}\n secondaryButtonOnClick={() => {\n closeModal();\n }}\n primaryButtonText={modalParams.actions?.submit?.text || 'Save'}\n secondaryButtonText={modalParams.actions?.cancel?.text || 'Cancel'}\n content={\n <Box\n direction=\"vertical\"\n width=\"552px\"\n gap=\"SP2\"\n paddingTop=\"SP1\"\n paddingBottom=\"SP1\"\n >\n {modalParams.fields.map((field) => {\n return (\n <Box key={field.id} direction=\"vertical\" width=\"100%\" gap=\"SP2\">\n <Box>\n <Text>{field.label}</Text>\n </Box>\n <Box>\n <Input\n value={values[field.id]}\n onChange={(e) => {\n setValues((prev) => ({\n ...prev,\n [field.id]: e.target.value,\n }));\n }}\n />\n </Box>\n </Box>\n );\n })}\n </Box>\n }\n />\n </Modal>\n );\n};\n"],"mappings":"AAAA,SAASA,GAAG,EAAEC,iBAAiB,EAAEC,KAAK,EAAEC,KAAK,EAAEC,IAAI,QAAQ,oBAAoB;AAC/E,OAAOC,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AAQvC,OAAO,MAAMC,WAAW,GAAGC,IAAA,IAA4C;EAAA,IAA3C;IAAEC,GAAG;IAAEC;EAA8B,CAAC,GAAAF,IAAA;EAChE,MAAM,CAACG,MAAM,EAAEC,SAAS,CAAC,GAAGN,QAAQ,CAClCI,WAAW,CAACG,MAAM,CAACC,MAAM,CAAC,CAACC,GAAG,EAAEC,KAAK,KAAK;IACxCD,GAAG,CAACC,KAAK,CAACC,EAAE,CAAC,GAAG,EAAE;IAClB,OAAOF,GAAG;EACZ,CAAC,EAAE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WAAW,CAAC6B,OAAO,EAAEH,MAAM,EAAEV,IAAI,IAAI,MAAO;IAC/DiB,mBAAmB,EAAEjC,WAAW,CAAC6B,OAAO,EAAEK,MAAM,EAAElB,IAAI,IAAI,QAAS;IACnEmB,OAAO,eACLxC,KAAA,CAAAiB,aAAA,CAACtB,GAAG;MACF8C,SAAS,EAAC,UAAU;MACpBC,KAAK,EAAC,OAAO;MACbC,GAAG,EAAC,KAAK;MACTC,UAAU,EAAC,KAAK;MAChBC,aAAa,EAAC;IAAK,GAElBxC,WAAW,CAACG,MAAM,CAACsC,GAAG,CAAEnC,KAAK,IAAK;MACjC,oBACEX,KAAA,CAAAiB,aAAA,CAACtB,GAAG;QAACoD,GAAG,EAAEpC,KAAK,CAACC,EAAG;QAAC6B,SAAS,EAAC,UAAU;QAACC,KAAK,EAAC,MAAM;QAACC,GAAG,EAAC;MAAK,gBAC7D3C,KAAA,CAAAiB,aAAA,CAACtB,GAAG,qBACFK,KAAA,CAAAiB,aAAA,CAAClB,IAAI,QAAEY,KAAK,CAACqC,KAAY,CACtB,CAAC,eACNhD,KAAA,CAAAiB,aAAA,CAACtB,GAAG,qBACFK,KAAA,CAAAiB,aAAA,CAACpB,KAAK;QACJoD,KAAK,EAAE3C,MAAM,CAACK,KAAK,CAACC,EAAE,CAAE;QACxBsC,QAAQ,EAAGC,CAAC,IAAK;UACf5C,SAAS,CAAE6C,IAAI,KAAM;YACnB,GAAGA,IAAI;YACP,CAACzC,KAAK,CAACC,EAAE,GAAGuC,CAAC,CAACE,MAAM,CAACJ;UACvB,CAAC,CAAC,CAAC;QACL;MAAE,CACH,CACE,CACF,CAAC;IAEV,CAAC,CACE;EACN,CACF,CACI,CAAC;AAEZ,CAAC","ignoreList":[]}
@@ -1,7 +1,6 @@
1
1
  import { Box, CustomModalLayout, Input, Modal, Text } from '@wix/design-system';
2
2
  import React, { useState } from 'react';
3
3
  export const EditModal = _ref => {
4
- var _modalParams$title, _modalParams$actions, _modalParams$actions2;
5
4
  let {
6
5
  sdk,
7
6
  modalParams,
@@ -23,23 +22,19 @@ export const EditModal = _ref => {
23
22
  isOpen: true,
24
23
  onRequestClose: closeModal
25
24
  }, /*#__PURE__*/React.createElement(CustomModalLayout, {
26
- title: ((_modalParams$title = modalParams.title) == null ? void 0 : _modalParams$title.text) || 'Edit',
25
+ title: modalParams.title?.text || 'Edit',
27
26
  onCloseButtonClick: () => {
28
27
  closeModal();
29
28
  },
30
29
  primaryButtonOnClick: () => {
31
- var _modalParams$feedback;
32
30
  const schema = sdk.getSchema(sdk.collectionId);
33
31
  const updatedItem = {
34
32
  ...actionParams.item,
35
33
  ...values
36
34
  };
37
- optimisticActions == null || optimisticActions.updateOne(updatedItem, {
38
- successToast: ((_modalParams$feedback = modalParams.feedback) == null || (_modalParams$feedback = _modalParams$feedback.successToast) == null ? void 0 : _modalParams$feedback.text) || 'Item updated successfully',
39
- errorToast: () => {
40
- var _modalParams$feedback2;
41
- return ((_modalParams$feedback2 = modalParams.feedback) == null || (_modalParams$feedback2 = _modalParams$feedback2.errorToast) == null ? void 0 : _modalParams$feedback2.text) || 'Failed to update item';
42
- },
35
+ optimisticActions?.updateOne(updatedItem, {
36
+ successToast: modalParams.feedback?.successToast?.text || 'Item updated successfully',
37
+ errorToast: () => modalParams.feedback?.errorToast?.text || 'Failed to update item',
43
38
  submit: async () => {
44
39
  if (!schema) {
45
40
  throw new Error('Schema not found');
@@ -53,8 +48,8 @@ export const EditModal = _ref => {
53
48
  secondaryButtonOnClick: () => {
54
49
  closeModal();
55
50
  },
56
- primaryButtonText: ((_modalParams$actions = modalParams.actions) == null || (_modalParams$actions = _modalParams$actions.submit) == null ? void 0 : _modalParams$actions.text) || 'Save',
57
- secondaryButtonText: ((_modalParams$actions2 = modalParams.actions) == null || (_modalParams$actions2 = _modalParams$actions2.cancel) == null ? void 0 : _modalParams$actions2.text) || 'Cancel',
51
+ primaryButtonText: modalParams.actions?.submit?.text || 'Save',
52
+ secondaryButtonText: modalParams.actions?.cancel?.text || 'Cancel',
58
53
  content: /*#__PURE__*/React.createElement(Box, {
59
54
  direction: "vertical",
60
55
  width: "552px",
@@ -1 +1 @@
1
- {"version":3,"names":["Box","CustomModalLayout","Input","Modal","Text","React","useState","EditModal","_ref","_modalParams$title","_modalParams$actions","_modalParams$actions2","sdk","modalParams","actionParams","values","setValues","fields","reduce","acc","field","id","item","closeModal","getOptimisticActions","collectionId","optimisticActions","createElement","isOpen","onRequestClose","title","text","onCloseButtonClick","primaryButtonOnClick","_modalParams$feedback","schema","getSchema","updatedItem","updateOne","successToast","feedback","errorToast","_modalParams$feedback2","submit","Error","result","actions","update","secondaryButtonOnClick","primaryButtonText","secondaryButtonText","cancel","content","direction","width","gap","paddingTop","paddingBottom","map","key","label","value","onChange","e","prev","target"],"sources":["../../../../../src/components/modals/actions/EditModal.tsx"],"sourcesContent":["import { Box, CustomModalLayout, Input, Modal, Text } from '@wix/design-system';\nimport React, { useState } from 'react';\nimport { UpdateActionModal } from '../../../types';\nimport { ActionModalProps } from './types';\n\nexport interface EditModalProps extends ActionModalProps {\n modalParams: UpdateActionModal;\n actionParams: { item: any };\n}\n\nexport const EditModal = ({\n sdk,\n modalParams,\n actionParams,\n}: EditModalProps) => {\n const [values, setValues] = useState(\n modalParams.fields.reduce((acc, field) => {\n acc[field.id] = actionParams.item[field.id];\n return acc;\n }, {} as Record<string, any>),\n );\n const { closeModal } = sdk;\n const { getOptimisticActions, collectionId } = sdk;\n const optimisticActions = getOptimisticActions(collectionId);\n\n return (\n <Modal isOpen onRequestClose={closeModal}>\n <CustomModalLayout\n title={modalParams.title?.text || 'Edit'}\n onCloseButtonClick={() => {\n closeModal();\n }}\n primaryButtonOnClick={() => {\n const schema = sdk.getSchema(sdk.collectionId);\n const updatedItem = { ...actionParams.item, ...values };\n optimisticActions?.updateOne(updatedItem, {\n successToast:\n modalParams.feedback?.successToast?.text ||\n 'Item updated successfully',\n errorToast: () =>\n modalParams.feedback?.errorToast?.text || 'Failed to update item',\n submit: async () => {\n if (!schema) {\n throw new Error('Schema not found');\n }\n\n const result = await schema.actions.update(updatedItem);\n return [result];\n },\n });\n closeModal();\n }}\n secondaryButtonOnClick={() => {\n closeModal();\n }}\n primaryButtonText={modalParams.actions?.submit?.text || 'Save'}\n secondaryButtonText={modalParams.actions?.cancel?.text || 'Cancel'}\n content={\n <Box\n direction=\"vertical\"\n width=\"552px\"\n gap=\"SP2\"\n paddingTop=\"SP1\"\n paddingBottom=\"SP1\"\n >\n {modalParams.fields.map((field) => {\n return (\n <Box key={field.id} direction=\"vertical\" width=\"100%\" gap=\"SP2\">\n <Box>\n <Text>{field.label}</Text>\n </Box>\n <Box>\n <Input\n value={values[field.id]}\n onChange={(e) => {\n setValues((prev) => ({\n ...prev,\n [field.id]: e.target.value,\n }));\n }}\n />\n </Box>\n </Box>\n );\n })}\n </Box>\n }\n />\n </Modal>\n );\n};\n"],"mappings":"AAAA,SAASA,GAAG,EAAEC,iBAAiB,EAAEC,KAAK,EAAEC,KAAK,EAAEC,IAAI,QAAQ,oBAAoB;AAC/E,OAAOC,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AASvC,OAAO,MAAMC,SAAS,GAAGC,IAAA,IAIH;EAAA,IAAAC,kBAAA,EAAAC,oBAAA,EAAAC,qBAAA;EAAA,IAJI;IACxBC,GAAG;IACHC,WAAW;IACXC;EACc,CAAC,GAAAN,IAAA;EACf,MAAM,CAACO,MAAM,EAAEC,SAAS,CAAC,GAAGV,QAAQ,CAClCO,WAAW,CAACI,MAAM,CAACC,MAAM,CAAC,CAACC,GAAG,EAAEC,KAAK,KAAK;IACxCD,GAAG,CAACC,KAAK,CAACC,EAAE,CAAC,GAAGP,YAAY,CAACQ,IAAI,CAACF,KAAK,CAACC,EAAE,CAAC;IAC3C,OAAOF,GAAG;EACZ,CAAC,EAAE,CAAC,CAAwB,CAC9B,CAAC;EACD,MAAM;IAAEI;EAAW,CAAC,GAAGX,GAAG;EAC1B,MAAM;IAAEY,oBAAoB;IAAEC;E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AAC5C,KAAK,CAACC,EAAE,GAAG0C,CAAC,CAACE,MAAM,CAACJ;UACvB,CAAC,CAAC,CAAC;QACL;MAAE,CACH,CACE,CACF,CAAC;IAEV,CAAC,CACE;EACN,CACF,CACI,CAAC;AAEZ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Box","CustomModalLayout","Input","Modal","Text","React","useState","EditModal","_ref","sdk","modalParams","actionParams","values","setValues","fields","reduce","acc","field","id","item","closeModal","getOptimisticActions","collectionId","optimisticActions","createElement","isOpen","onRequestClose","title","text","onCloseButtonClick","primaryButtonOnClick","schema","getSchema","updatedItem","updateOne","successToast","feedback","errorToast","submit","Error","result","actions","update","secondaryButtonOnClick","primaryButtonText","secondaryButtonText","cancel","content","direction","width","gap","paddingTop","paddingBottom","map","key","label","value","onChange","e","prev","target"],"sources":["../../../../../src/components/modals/actions/EditModal.tsx"],"sourcesContent":["import { Box, CustomModalLayout, Input, Modal, Text } from '@wix/design-system';\nimport React, { useState } from 'react';\nimport { UpdateActionModal } from '../../../types';\nimport { ActionModalProps } from './types';\n\nexport interface EditModalProps extends ActionModalProps {\n modalParams: UpdateActionModal;\n actionParams: { item: any };\n}\n\nexport const EditModal = ({\n sdk,\n modalParams,\n actionParams,\n}: EditModalProps) => {\n const [values, setValues] = useState(\n modalParams.fields.reduce((acc, field) => {\n acc[field.id] = actionParams.item[field.id];\n return acc;\n }, {} as Record<string, any>),\n );\n const { closeModal } = sdk;\n const { getOptimisticActions, collectionId } = sdk;\n const optimisticActions = getOptimisticActions(collectionId);\n\n return (\n <Modal isOpen onRequestClose={closeModal}>\n <CustomModalLayout\n title={modalParams.title?.text || 'Edit'}\n onCloseButtonClick={() => {\n closeModal();\n }}\n primaryButtonOnClick={() => {\n const schema = sdk.getSchema(sdk.collectionId);\n const updatedItem = { ...actionParams.item, ...values };\n optimisticActions?.updateOne(updatedItem, {\n successToast:\n modalParams.feedback?.successToast?.text ||\n 'Item updated successfully',\n errorToast: () =>\n modalParams.feedback?.errorToast?.text || 'Failed to update item',\n submit: async () => {\n if (!schema) {\n throw new Error('Schema not found');\n }\n\n const result = await schema.actions.update(updatedItem);\n return [result];\n },\n });\n closeModal();\n }}\n secondaryButtonOnClick={() => {\n closeModal();\n }}\n primaryButtonText={modalParams.actions?.submit?.text || 'Save'}\n secondaryButtonText={modalParams.actions?.cancel?.text || 'Cancel'}\n content={\n <Box\n direction=\"vertical\"\n width=\"552px\"\n gap=\"SP2\"\n paddingTop=\"SP1\"\n paddingBottom=\"SP1\"\n >\n {modalParams.fields.map((field) => {\n return (\n <Box key={field.id} direction=\"vertical\" width=\"100%\" gap=\"SP2\">\n <Box>\n <Text>{field.label}</Text>\n </Box>\n <Box>\n <Input\n value={values[field.id]}\n onChange={(e) => {\n setValues((prev) => ({\n ...prev,\n [field.id]: e.target.value,\n }));\n }}\n />\n </Box>\n </Box>\n );\n })}\n </Box>\n }\n />\n </Modal>\n );\n};\n"],"mappings":"AAAA,SAASA,GAAG,EAAEC,iBAAiB,EAAEC,KAAK,EAAEC,KAAK,EAAEC,IAAI,QAAQ,oBAAoB;AAC/E,OAAOC,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AASvC,OAAO,MAAMC,SAAS,GAAGC,IAAA,IAIH;EAAA,IAJI;IACxBC,GAAG;IACHC,WAAW;IACXC;EACc,CAAC,GAAAH,IAAA;EACf,MAAM,CAACI,MAAM,EAAEC,SAAS,CAAC,GAAGP,QAAQ,CAClCI,WAAW,CAACI,MAAM,CAACC,MAAM,CAAC,CAACC,GAAG,EAAEC,KAAK,KAAK;IACxCD,GAAG,CAACC,KAAK,CAACC,EAAE,CAAC,GAAGP,YAAY,CAACQ,IAAI,CAACF,KAAK,CAACC,EAAE,CAAC;IAC3C,OAAOF,GAAG;EACZ,CAAC,EAAE,CAAC,CAAwB,CAC9B,CAAC;EACD,MAAM;IAAEI;EAAW,CAAC,GAAGX,GAAG;EAC1B,MAAM;IAAEY,oBAAoB;IAAEC;EAAa,CAAC,GAAGb,GAAG;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