@wix/auto-patterns 1.14.0 → 1.15.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 (155) hide show
  1. package/dist/cjs/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js +1 -2
  2. package/dist/cjs/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
  3. package/dist/cjs/components/AutoPatternsRoute/AutoPatternsPage.js +2 -3
  4. package/dist/cjs/components/AutoPatternsRoute/AutoPatternsPage.js.map +1 -1
  5. package/dist/cjs/components/filters/DynamicCollectionFilter.js +5 -11
  6. package/dist/cjs/components/filters/DynamicCollectionFilter.js.map +1 -1
  7. package/dist/cjs/dataSourceAdapters/cms/cmsAdapter.js +51 -88
  8. package/dist/cjs/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
  9. package/dist/cjs/dataSourceAdapters/cms/fetchCmsData.js +43 -0
  10. package/dist/cjs/dataSourceAdapters/cms/fetchCmsData.js.map +1 -0
  11. package/dist/cjs/dataSourceAdapters/cms/filterUtils.js +15 -15
  12. package/dist/cjs/dataSourceAdapters/cms/filterUtils.js.map +1 -1
  13. package/dist/cjs/dataSourceAdapters/cms/sortUtils.js +2 -2
  14. package/dist/cjs/dataSourceAdapters/cms/sortUtils.js.map +1 -1
  15. package/dist/cjs/dataSourceAdapters/factory.js +0 -20
  16. package/dist/cjs/dataSourceAdapters/factory.js.map +1 -1
  17. package/dist/cjs/hooks/useActionCell.js +0 -6
  18. package/dist/cjs/hooks/useActionCell.js.map +1 -1
  19. package/dist/cjs/hooks/useBulkActionToolbar.js +1 -7
  20. package/dist/cjs/hooks/useBulkActionToolbar.js.map +1 -1
  21. package/dist/cjs/hooks/useCollectionPageActions.js +2 -8
  22. package/dist/cjs/hooks/useCollectionPageActions.js.map +1 -1
  23. package/dist/cjs/hooks/useFetchData.js +9 -29
  24. package/dist/cjs/hooks/useFetchData.js.map +1 -1
  25. package/dist/cjs/hooks/useFilters.js +2 -2
  26. package/dist/cjs/hooks/useFilters.js.map +1 -1
  27. package/dist/cjs/hooks/useGridFeatures.js +3 -4
  28. package/dist/cjs/hooks/useGridFeatures.js.map +1 -1
  29. package/dist/cjs/hooks/useTableFeatures.js +3 -4
  30. package/dist/cjs/hooks/useTableFeatures.js.map +1 -1
  31. package/dist/cjs/hooks/useTableGridSwitchFeatures.js +3 -4
  32. package/dist/cjs/hooks/useTableGridSwitchFeatures.js.map +1 -1
  33. package/dist/cjs/providers/PatternsWizardOverridesContext.js +1 -1
  34. package/dist/cjs/providers/PatternsWizardOverridesContext.js.map +1 -1
  35. package/dist/cjs/providers/SchemaContext.js +29 -6
  36. package/dist/cjs/providers/SchemaContext.js.map +1 -1
  37. package/dist/cjs/types/CollectionPageConfig.js.map +1 -1
  38. package/dist/cjs/types/EntityPageConfig.js.map +1 -1
  39. package/dist/cjs/types/actions/actionCell.js.map +1 -1
  40. package/dist/cjs/types/actions/base.js.map +1 -1
  41. package/dist/cjs/types/actions/bulkActions.js.map +1 -1
  42. package/dist/cjs/types/actions/collectionPageActions.js.map +1 -1
  43. package/dist/cjs/types/index.js +6 -0
  44. package/dist/cjs/types/index.js.map +1 -1
  45. package/dist/cjs/types/providers.js +4 -0
  46. package/dist/cjs/types/providers.js.map +1 -0
  47. package/dist/cjs/types/types.js.map +1 -1
  48. package/dist/cjs/utils/actions/index.js +0 -6
  49. package/dist/cjs/utils/actions/index.js.map +1 -1
  50. package/dist/cjs/utils/actions/types.js.map +1 -1
  51. package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js +1 -2
  52. package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
  53. package/dist/esm/components/AutoPatternsRoute/AutoPatternsPage.js +1 -2
  54. package/dist/esm/components/AutoPatternsRoute/AutoPatternsPage.js.map +1 -1
  55. package/dist/esm/components/filters/DynamicCollectionFilter.js +4 -10
  56. package/dist/esm/components/filters/DynamicCollectionFilter.js.map +1 -1
  57. package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js +54 -88
  58. package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
  59. package/dist/esm/dataSourceAdapters/cms/fetchCmsData.js +42 -0
  60. package/dist/esm/dataSourceAdapters/cms/fetchCmsData.js.map +1 -0
  61. package/dist/esm/dataSourceAdapters/cms/filterUtils.js +15 -15
  62. package/dist/esm/dataSourceAdapters/cms/filterUtils.js.map +1 -1
  63. package/dist/esm/dataSourceAdapters/cms/sortUtils.js +2 -2
  64. package/dist/esm/dataSourceAdapters/cms/sortUtils.js.map +1 -1
  65. package/dist/esm/dataSourceAdapters/factory.js +1 -21
  66. package/dist/esm/dataSourceAdapters/factory.js.map +1 -1
  67. package/dist/esm/hooks/useActionCell.js +1 -7
  68. package/dist/esm/hooks/useActionCell.js.map +1 -1
  69. package/dist/esm/hooks/useBulkActionToolbar.js +1 -7
  70. package/dist/esm/hooks/useBulkActionToolbar.js.map +1 -1
  71. package/dist/esm/hooks/useCollectionPageActions.js +1 -7
  72. package/dist/esm/hooks/useCollectionPageActions.js.map +1 -1
  73. package/dist/esm/hooks/useFetchData.js +9 -29
  74. package/dist/esm/hooks/useFetchData.js.map +1 -1
  75. package/dist/esm/hooks/useFilters.js +2 -2
  76. package/dist/esm/hooks/useFilters.js.map +1 -1
  77. package/dist/esm/hooks/useGridFeatures.js +3 -4
  78. package/dist/esm/hooks/useGridFeatures.js.map +1 -1
  79. package/dist/esm/hooks/useTableFeatures.js +3 -4
  80. package/dist/esm/hooks/useTableFeatures.js.map +1 -1
  81. package/dist/esm/hooks/useTableGridSwitchFeatures.js +3 -4
  82. package/dist/esm/hooks/useTableGridSwitchFeatures.js.map +1 -1
  83. package/dist/esm/providers/PatternsWizardOverridesContext.js.map +1 -1
  84. package/dist/esm/providers/SchemaContext.js +28 -5
  85. package/dist/esm/providers/SchemaContext.js.map +1 -1
  86. package/dist/esm/types/CollectionPageConfig.js.map +1 -1
  87. package/dist/esm/types/EntityPageConfig.js.map +1 -1
  88. package/dist/esm/types/actions/actionCell.js.map +1 -1
  89. package/dist/esm/types/actions/base.js.map +1 -1
  90. package/dist/esm/types/actions/bulkActions.js.map +1 -1
  91. package/dist/esm/types/actions/collectionPageActions.js.map +1 -1
  92. package/dist/esm/types/index.js +1 -0
  93. package/dist/esm/types/index.js.map +1 -1
  94. package/dist/esm/types/providers.js +2 -0
  95. package/dist/esm/types/providers.js.map +1 -0
  96. package/dist/esm/types/types.js.map +1 -1
  97. package/dist/esm/utils/actions/index.js +0 -2
  98. package/dist/esm/utils/actions/index.js.map +1 -1
  99. package/dist/esm/utils/actions/types.js.map +1 -1
  100. package/dist/types/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.d.ts.map +1 -1
  101. package/dist/types/components/AutoPatternsRoute/AutoPatternsPage.d.ts.map +1 -1
  102. package/dist/types/components/filters/DynamicCollectionFilter.d.ts.map +1 -1
  103. package/dist/types/dataSourceAdapters/cms/cmsAdapter.d.ts +1 -10
  104. package/dist/types/dataSourceAdapters/cms/cmsAdapter.d.ts.map +1 -1
  105. package/dist/types/dataSourceAdapters/cms/fetchCmsData.d.ts +13 -0
  106. package/dist/types/dataSourceAdapters/cms/fetchCmsData.d.ts.map +1 -0
  107. package/dist/types/dataSourceAdapters/cms/filterUtils.d.ts +9 -7
  108. package/dist/types/dataSourceAdapters/cms/filterUtils.d.ts.map +1 -1
  109. package/dist/types/dataSourceAdapters/cms/sortUtils.d.ts +2 -2
  110. package/dist/types/dataSourceAdapters/cms/sortUtils.d.ts.map +1 -1
  111. package/dist/types/dataSourceAdapters/factory.d.ts +1 -11
  112. package/dist/types/dataSourceAdapters/factory.d.ts.map +1 -1
  113. package/dist/types/hooks/useActionCell.d.ts.map +1 -1
  114. package/dist/types/hooks/useBulkActionToolbar.d.ts.map +1 -1
  115. package/dist/types/hooks/useCollectionPageActions.d.ts.map +1 -1
  116. package/dist/types/hooks/useEntityPageHeaderTexts.d.ts.map +1 -1
  117. package/dist/types/hooks/useFetchData.d.ts +13 -7
  118. package/dist/types/hooks/useFetchData.d.ts.map +1 -1
  119. package/dist/types/hooks/useFilters.d.ts +1 -1
  120. package/dist/types/hooks/useGridFeatures.d.ts.map +1 -1
  121. package/dist/types/hooks/useTableFeatures.d.ts.map +1 -1
  122. package/dist/types/hooks/useTableGridSwitchFeatures.d.ts.map +1 -1
  123. package/dist/types/providers/PatternsWizardOverridesContext.d.ts +2 -3
  124. package/dist/types/providers/PatternsWizardOverridesContext.d.ts.map +1 -1
  125. package/dist/types/providers/SchemaContext.d.ts +3 -4
  126. package/dist/types/providers/SchemaContext.d.ts.map +1 -1
  127. package/dist/types/types/CollectionPageConfig.d.ts +2 -7
  128. package/dist/types/types/CollectionPageConfig.d.ts.map +1 -1
  129. package/dist/types/types/EntityPageConfig.d.ts +3 -4
  130. package/dist/types/types/EntityPageConfig.d.ts.map +1 -1
  131. package/dist/types/types/actions/actionCell.d.ts +2 -2
  132. package/dist/types/types/actions/actionCell.d.ts.map +1 -1
  133. package/dist/types/types/actions/base.d.ts +0 -7
  134. package/dist/types/types/actions/base.d.ts.map +1 -1
  135. package/dist/types/types/actions/bulkActions.d.ts +2 -2
  136. package/dist/types/types/actions/bulkActions.d.ts.map +1 -1
  137. package/dist/types/types/actions/collectionPageActions.d.ts +2 -2
  138. package/dist/types/types/actions/collectionPageActions.d.ts.map +1 -1
  139. package/dist/types/types/index.d.ts +1 -0
  140. package/dist/types/types/index.d.ts.map +1 -1
  141. package/dist/types/types/providers.d.ts +11 -0
  142. package/dist/types/types/providers.d.ts.map +1 -0
  143. package/dist/types/types/types.d.ts +25 -1
  144. package/dist/types/types/types.d.ts.map +1 -1
  145. package/dist/types/utils/actions/index.d.ts +0 -2
  146. package/dist/types/utils/actions/index.d.ts.map +1 -1
  147. package/dist/types/utils/actions/types.d.ts +1 -4
  148. package/dist/types/utils/actions/types.d.ts.map +1 -1
  149. package/package.json +2 -2
  150. package/dist/cjs/utils/actions/customModalAction.js +0 -22
  151. package/dist/cjs/utils/actions/customModalAction.js.map +0 -1
  152. package/dist/esm/utils/actions/customModalAction.js +0 -17
  153. package/dist/esm/utils/actions/customModalAction.js.map +0 -1
  154. package/dist/types/utils/actions/customModalAction.d.ts +0 -5
  155. package/dist/types/utils/actions/customModalAction.d.ts.map +0 -1
@@ -5,22 +5,45 @@ exports.useSchema = exports.SchemaProvider = void 0;
5
5
  var _react = _interopRequireWildcard(require("react"));
6
6
  var _factory = require("../dataSourceAdapters/factory");
7
7
  var _SchemaRegistryContext = require("./SchemaRegistryContext");
8
+ var _PatternsWizardOverridesContext = require("./PatternsWizardOverridesContext");
9
+ var _patterns = require("@wix/patterns");
8
10
  var _jsxFileName = "/home/builduser/work/73d19ce3378ce4dd/packages/auto-patterns/dist/cjs/providers/SchemaContext.tsx";
9
11
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
12
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
13
  const SchemaContext = /*#__PURE__*/(0, _react.createContext)(null);
12
14
  const SchemaProvider = ({
13
- collectionId,
14
- entityTypeSource,
15
+ collection,
15
16
  children
16
17
  }) => {
18
+ var _collection$custom;
19
+ const {
20
+ collectionId,
21
+ entityTypeSource
22
+ } = collection;
23
+ const customDataSourceId = collection.entityTypeSource === 'custom' && 'custom' in collection ? (_collection$custom = collection.custom) == null ? void 0 : _collection$custom.id : undefined;
17
24
  const {
18
25
  getSchema: getSchemaFromRegistry,
19
26
  addSchema: addSchemaToRegistry
20
27
  } = (0, _SchemaRegistryContext.useSchemaRegistry)();
21
28
  const [schema, setSchema] = (0, _react.useState)(null);
22
29
  const [isLoading, setIsLoading] = (0, _react.useState)(false);
30
+ const overrides = (0, _PatternsWizardOverridesContext.usePatternsWizardOverridesContext)();
31
+ const {
32
+ httpClient
33
+ } = (0, _patterns.useWixPatternsContainer)();
23
34
  (0, _react.useEffect)(() => {
35
+ const fetchSchemaForCollection = async (targetCollectionId, targetCustomDataSourceId) => {
36
+ if (entityTypeSource === 'custom' && targetCustomDataSourceId && overrides != null && overrides.customDataSources) {
37
+ const customSchemaProvider = overrides.customDataSources[targetCustomDataSourceId];
38
+ if (customSchemaProvider) {
39
+ return customSchemaProvider(targetCollectionId, {
40
+ httpClient
41
+ });
42
+ }
43
+ throw new Error(`Custom schema provider '${targetCustomDataSourceId}' not found`);
44
+ }
45
+ return (0, _factory.getSchema)(targetCollectionId, entityTypeSource);
46
+ };
24
47
  const fetchReferencedSchemas = async referencedSchema => {
25
48
  const referencedCollectionIds = new Set();
26
49
  Object.values(referencedSchema.fields).forEach(field => {
@@ -38,7 +61,7 @@ const SchemaProvider = ({
38
61
  }
39
62
  const fetchPromises = Array.from(referencedCollectionIds).map(async refCollectionId => {
40
63
  try {
41
- const refSchema = await (0, _factory.getSchema)(refCollectionId, entityTypeSource);
64
+ const refSchema = await fetchSchemaForCollection(refCollectionId);
42
65
  addSchemaToRegistry(refCollectionId, refSchema);
43
66
  await fetchReferencedSchemas(refSchema);
44
67
  } catch (error) {
@@ -53,7 +76,7 @@ const SchemaProvider = ({
53
76
  return;
54
77
  }
55
78
  setIsLoading(true);
56
- (0, _factory.getSchema)(collectionId, entityTypeSource).then(async fetchedSchema => {
79
+ fetchSchemaForCollection(collectionId, customDataSourceId).then(async fetchedSchema => {
57
80
  setSchema(fetchedSchema);
58
81
  addSchemaToRegistry(collectionId, fetchedSchema);
59
82
  await fetchReferencedSchemas(fetchedSchema);
@@ -62,7 +85,7 @@ const SchemaProvider = ({
62
85
  }).finally(() => {
63
86
  setIsLoading(false);
64
87
  });
65
- }, [collectionId, entityTypeSource, addSchemaToRegistry, getSchemaFromRegistry]);
88
+ }, [collectionId, entityTypeSource, customDataSourceId, addSchemaToRegistry, getSchemaFromRegistry, overrides, httpClient]);
66
89
  if (!schema || isLoading) {
67
90
  return null;
68
91
  }
@@ -71,7 +94,7 @@ const SchemaProvider = ({
71
94
  __self: void 0,
72
95
  __source: {
73
96
  fileName: _jsxFileName,
74
- lineNumber: 106,
97
+ lineNumber: 133,
75
98
  columnNumber: 5
76
99
  }
77
100
  }, children);
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_factory","_SchemaRegistryContext","_jsxFileName","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","SchemaContext","createContext","SchemaProvider","collectionId","entityTypeSource","children","getSchema","getSchemaFromRegistry","addSchema","addSchemaToRegistry","useSchemaRegistry","schema","setSchema","useState","isLoading","setIsLoading","useEffect","fetchReferencedSchemas","referencedSchema","referencedCollectionIds","Set","values","fields","forEach","field","type","referenceMetadata","referencedCollectionId","add","size","fetchPromises","Array","from","map","refCollectionId","refSchema","error","console","Promise","all","cachedSchema","then","fetchedSchema","catch","finally","createElement","Provider","value","__self","__source","fileName","lineNumber","columnNumber","exports","useSchema","context","useContext","Error"],"sources":["../../../src/providers/SchemaContext.tsx"],"sourcesContent":["import React, {\n createContext,\n useContext,\n useEffect,\n useState,\n ReactNode,\n} from 'react';\n\nimport { SchemaConfig } from '../types';\nimport { getSchema } from '../dataSourceAdapters/factory';\nimport { useSchemaRegistry } from './SchemaRegistryContext';\n\nconst SchemaContext = createContext<SchemaConfig | null>(null);\n\ninterface SchemaProviderProps {\n collectionId: string;\n entityTypeSource: string;\n children: ReactNode;\n}\n\nexport const SchemaProvider = ({\n collectionId,\n entityTypeSource,\n children,\n}: SchemaProviderProps) => {\n const { getSchema: getSchemaFromRegistry, addSchema: addSchemaToRegistry } =\n useSchemaRegistry();\n const [schema, setSchema] = useState<SchemaConfig | null>(null);\n const [isLoading, setIsLoading] = useState<boolean>(false);\n\n useEffect(() => {\n const fetchReferencedSchemas = async (referencedSchema: SchemaConfig) => {\n const referencedCollectionIds = new Set<string>();\n\n Object.values(referencedSchema.fields).forEach((field) => {\n if (field && field.type === 'REFERENCE' && field.referenceMetadata) {\n const { referencedCollectionId } = field.referenceMetadata;\n if (\n referencedCollectionId &&\n !getSchemaFromRegistry(referencedCollectionId)\n ) {\n referencedCollectionIds.add(referencedCollectionId);\n }\n }\n });\n\n if (referencedCollectionIds.size === 0) {\n return;\n }\n\n const fetchPromises = Array.from(referencedCollectionIds).map(\n async (refCollectionId) => {\n try {\n const refSchema = await getSchema(\n refCollectionId,\n entityTypeSource,\n );\n\n addSchemaToRegistry(refCollectionId, refSchema);\n\n await fetchReferencedSchemas(refSchema);\n } catch (error) {\n console.error(\n `Error fetching referenced schema ${refCollectionId}:`,\n error,\n );\n }\n },\n );\n\n await Promise.all(fetchPromises);\n };\n\n const cachedSchema = getSchemaFromRegistry(collectionId);\n if (cachedSchema) {\n setSchema(cachedSchema);\n return;\n }\n\n setIsLoading(true);\n getSchema(collectionId, entityTypeSource)\n .then(async (fetchedSchema) => {\n setSchema(fetchedSchema);\n addSchemaToRegistry(collectionId, fetchedSchema);\n\n await fetchReferencedSchemas(fetchedSchema);\n })\n .catch((error) => {\n console.error('Error fetching schema config:', error);\n })\n .finally(() => {\n setIsLoading(false);\n });\n }, [\n collectionId,\n entityTypeSource,\n addSchemaToRegistry,\n getSchemaFromRegistry,\n ]);\n\n if (!schema || isLoading) {\n return null;\n }\n\n return (\n <SchemaContext.Provider value={schema}>{children}</SchemaContext.Provider>\n );\n};\n\nexport const useSchema = (): SchemaConfig => {\n const context = useContext(SchemaContext);\n if (!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QAAiC,CAAC;AAE9E,CAAC;AAACgD,OAAA,CAAAnD,cAAA,GAAAA,cAAA;AAEK,MAAMoD,SAAS,GAAGA,CAAA,KAAoB;EAC3C,MAAMC,OAAO,GAAG,IAAAC,iBAAU,EAACxD,aAAa,CAAC;EACzC,IAAI,CAACuD,OAAO,EAAE;IACZ,MAAM,IAAIE,KAAK,CAAC,gDAAgD,CAAC;EACnE;EACA,OAAOF,OAAO;AAChB,CAAC;AAACF,OAAA,CAAAC,SAAA,GAAAA,SAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_factory","_SchemaRegistryContext","_PatternsWizardOverridesContext","_patterns","_jsxFileName","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","SchemaContext","createContext","SchemaProvider","collection","children","_collection$custom","collectionId","entityTypeSource","customDataSourceId","custom","id","undefined","getSchema","getSchemaFromRegistry","addSchema","addSchemaToRegistry","useSchemaRegistry","schema","setSchema","useState","isLoading","setIsLoading","overrides","usePatternsWizardOverridesContext","httpClient","useWixPatternsContainer","useEffect","fetchSchemaForCollection","targetCollectionId","targetCustomDataSourceId","customDataSources","customSchemaProvider","Error","fetchReferencedSchemas","referencedSchema","referencedCollectionIds","Set","values","fields","forEach","field","type","referenceMetadata","referencedCollectionId","add","size","fetchPromises","Array","from","map","refCollectionId","refSchema","error","console","Promise","all","cachedSchema","then","fetchedSchema","catch","finally","createElement","Provider","value","__self","__source","fileName","lineNumber","columnNumber","exports","useSchema","context","useContext"],"sources":["../../../src/providers/SchemaContext.tsx"],"sourcesContent":["import React, {\n createContext,\n useContext,\n useEffect,\n useState,\n ReactNode,\n} from 'react';\n\nimport { SchemaConfig, BaseCollectionConfig } from '../types';\nimport { getSchema } from '../dataSourceAdapters/factory';\nimport { useSchemaRegistry } from './SchemaRegistryContext';\nimport { usePatternsWizardOverridesContext } from './PatternsWizardOverridesContext';\nimport { useWixPatternsContainer } from '@wix/patterns';\n\nconst SchemaContext = createContext<SchemaConfig | null>(null);\n\ninterface SchemaProviderProps {\n collection: BaseCollectionConfig;\n children: ReactNode;\n}\n\nexport const SchemaProvider = ({\n collection,\n children,\n}: SchemaProviderProps) => {\n const { collectionId, entityTypeSource } = collection;\n const customDataSourceId =\n collection.entityTypeSource === 'custom' && 'custom' in collection\n ? collection.custom?.id\n : undefined;\n const { getSchema: getSchemaFromRegistry, addSchema: addSchemaToRegistry } =\n useSchemaRegistry();\n const [schema, setSchema] = useState<SchemaConfig | null>(null);\n const [isLoading, setIsLoading] = useState<boolean>(false);\n const overrides = usePatternsWizardOverridesContext();\n const { httpClient } = useWixPatternsContainer();\n\n useEffect(() => {\n const fetchSchemaForCollection = async (\n targetCollectionId: string,\n targetCustomDataSourceId?: string,\n ): Promise<SchemaConfig> => {\n if (\n entityTypeSource === 'custom' &&\n targetCustomDataSourceId &&\n overrides?.customDataSources\n ) {\n const customSchemaProvider =\n overrides.customDataSources[targetCustomDataSourceId];\n if (customSchemaProvider) {\n return customSchemaProvider(targetCollectionId, { httpClient });\n }\n throw new Error(\n `Custom schema provider '${targetCustomDataSourceId}' not found`,\n );\n }\n\n return getSchema(targetCollectionId, entityTypeSource);\n };\n\n const fetchReferencedSchemas = async (referencedSchema: SchemaConfig) => {\n const referencedCollectionIds = new Set<string>();\n\n Object.values(referencedSchema.fields).forEach((field) => {\n if (field && field.type === 'REFERENCE' && field.referenceMetadata) {\n const { referencedCollectionId } = field.referenceMetadata;\n if (\n referencedCollectionId &&\n !getSchemaFromRegistry(referencedCollectionId)\n ) {\n referencedCollectionIds.add(referencedCollectionId);\n }\n }\n });\n\n if (referencedCollectionIds.size === 0) {\n return;\n }\n\n const fetchPromises = Array.from(referencedCollectionIds).map(\n async (refCollectionId) => {\n try {\n const refSchema = await fetchSchemaForCollection(refCollectionId);\n\n addSchemaToRegistry(refCollectionId, refSchema);\n\n await fetchReferencedSchemas(refSchema);\n } catch (error) {\n console.error(\n `Error fetching referenced schema ${refCollectionId}:`,\n error,\n );\n }\n },\n );\n\n await Promise.all(fetchPromises);\n };\n\n const cachedSchema = getSchemaFromRegistry(collectionId);\n if (cachedSchema) {\n setSchema(cachedSchema);\n return;\n }\n setIsLoading(true);\n fetchSchemaForCollection(collectionId, customDataSourceId)\n .then(async (fetchedSchema) => {\n setSchema(fetchedSchema);\n addSchemaToRegistry(collectionId, fetchedSchema);\n\n await fetchReferencedSchemas(fetchedSchema);\n })\n .catch((error) => {\n console.error('Error fetching schema config:', error);\n })\n .finally(() => {\n setIsLoading(false);\n });\n }, [\n collectionId,\n entityTypeSource,\n customDataSourceId,\n addSchemaToRegistry,\n getSchemaFromRegistry,\n overrides,\n httpClient,\n ]);\n if (!schema || isLoading) {\n return null;\n }\n\n return (\n <SchemaContext.Provider value={schema}>{children}</SchemaContext.Provider>\n );\n};\n\nexport const useSchema = (): SchemaConfig => {\n const context = useContext(SchemaContext);\n if (!context) {\n throw new Error('useSchema must be used within a SchemaProvider');\n }\n return context;\n};\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AASA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AACA,IAAAG,+BAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAAwD,IAAAK,YAAA;AAAA,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA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,EACTE,UAAU,CACX,CAAC;EACF,IAAI,CAACP,MAAM,IAAIG,SAAS,EAAE;IACxB,OAAO,IAAI;EACb;EAEA,oBACEhD,MAAA,CAAAc,OAAA,CAAA2E,aAAA,CAAC7D,aAAa,CAAC8D,QAAQ;IAACC,KAAK,EAAE9C,MAAO;IAAA+C,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAAvF,YAAA;MAAAwF,UAAA;MAAAC,YAAA;IAAA;EAAA,GAAEhE,QAAiC,CAAC;AAE9E,CAAC;AAACiE,OAAA,CAAAnE,cAAA,GAAAA,cAAA;AAEK,MAAMoE,SAAS,GAAGA,CAAA,KAAoB;EAC3C,MAAMC,OAAO,GAAG,IAAAC,iBAAU,EAACxE,aAAa,CAAC;EACzC,IAAI,CAACuE,OAAO,EAAE;IACZ,MAAM,IAAIvC,KAAK,CAAC,gDAAgD,CAAC;EACnE;EACA,OAAOuC,OAAO;AAChB,CAAC;AAACF,OAAA,CAAAC,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["ComponentTypeEnum","exports"],"sources":["../../../src/types/CollectionPageConfig.ts"],"sourcesContent":["import { CollectionToolbarFiltersProps } from '@wix/patterns';\nimport { DateRangeFilterMode, DateRangeOptions } from '@wix/patterns/core';\nimport { BaseCollectionConfig } from './types';\nimport {\n ActionCellConfig,\n BulkActionsConfig,\n CollectionPagePrimaryActions,\n CollectionPageSecondaryActions,\n} from './actions';\n\nexport interface CollectionPageTitle {\n text: string;\n hideTotal?: boolean;\n}\n\nexport interface CollectionPageSubtitle {\n text: string;\n learnMore?: {\n url: string;\n label?: string;\n };\n}\n\nexport interface CollectionPageConfig {\n route: {\n path: string;\n };\n title: CollectionPageTitle;\n subtitle?: CollectionPageSubtitle;\n actions?: {\n primaryActions?: CollectionPagePrimaryActions;\n secondaryActions?: CollectionPageSecondaryActions;\n };\n components: ComponentConfig[];\n}\n\nexport interface ComponentConfig extends BaseCollectionComponentConfig {\n layout: LayoutItemConfig[];\n}\n\nexport interface LayoutItemConfig {\n type: 'Table' | 'Grid';\n table?: TableSpecificConfig;\n grid?: GridSpecificConfig;\n}\n\nexport type ColumnsConfig = Column[];\n\nexport interface TableSpecificConfig {\n columns: ColumnsConfig;\n customColumns?: {\n enabled: boolean;\n };\n stickyColumns?: number;\n}\n\nexport interface GridSpecificConfig {\n item: GridItem;\n}\n\nexport interface TableConfig\n extends BaseCollectionComponentConfig,\n TableSpecificConfig {}\nexport interface GridConfig\n extends BaseCollectionComponentConfig,\n GridSpecificConfig {}\nexport interface TableGridSwitchConfig\n extends BaseCollectionComponentConfig,\n TableSpecificConfig,\n GridSpecificConfig {}\n\nexport interface CollectionConfig extends BaseCollectionConfig {\n fetchData?: FetchData;\n limit?: number;\n reflectQueryInUrl?: boolean;\n selectAllScope?: 'page' | 'all';\n selectionUpdateMode?: 'preserve' | 'clear';\n}\n\nexport interface BaseCollectionComponentConfig {\n collection: CollectionConfig;\n entityPageId?: string;\n search?: { shown?: boolean };\n toolbarTitle?: ToolbarTitle;\n actionCell?: ActionCellConfig;\n emptyState?: EmptyState;\n filters?: FiltersConfig;\n bulkActionToolbar?: BulkActionsConfig;\n}\n\nexport interface ToolbarTitle {\n title: string;\n subtitle?: {\n text: string;\n info?: {\n content: {\n text: string;\n link?: {\n url: string;\n label: string;\n };\n };\n };\n learnMore?: {\n url: string;\n label?: string;\n };\n };\n showTotal?: boolean;\n itemsLimit?: number;\n}\n\nexport interface Column {\n id: string;\n name: string;\n width: string;\n sortable?: boolean;\n defaultSortOrder?: 'asc' | 'desc';\n sortMode?: 'asc' | 'desc';\n defaultHidden?: boolean;\n hiddenFromCustomColumnsSelection?: boolean;\n hideable?: boolean;\n reorderDisabled?: boolean;\n}\n\nexport interface GridItem {\n titleFieldId: string;\n subtitleFieldId?: string;\n imageFieldId?: string;\n cardContentMode?: 'full' | 'title' | 'empty'; // Footer is not supported in auto-patterns\n imagePlacement?: 'top' | 'side';\n}\n\nexport interface EmptyState {\n title?: string;\n subtitle?: string;\n image?: {\n id: string;\n };\n addNewCta?: {\n id?: string;\n text?: string;\n };\n customCta?: {\n id?: string;\n };\n}\n\ninterface FetchData {\n id: string;\n}\n\nexport interface FilterOption {\n value: string;\n label: string;\n}\n\nexport type FilterSelectionMode = 'single' | 'multiple';\nexport type FilterOptionType =\n | 'checkbox'\n | 'inlineCheckbox'\n | 'radio'\n | 'select';\n\nexport enum ComponentTypeEnum {\n SINGLE = 'single',\n MULTI_SELECT = 'multi-select',\n RADIO_GROUP = 'radio-group',\n NUMBER = 'number',\n DATE_RANGE = 'date-range',\n}\n\nexport type FilterItems = Filter[];\nexport interface FiltersConfig {\n items: FilterItems;\n maxInlineFilters?: CollectionToolbarFiltersProps['inline'];\n panelTitle?: string;\n}\n\nexport interface BaseOptionsFilterConfig {\n selectionMode: FilterSelectionMode;\n}\n\nexport interface DateFilterConfig {\n mode?: DateRangeFilterMode;\n presets?: DateRangeOptions;\n includeTime?: boolean;\n}\n\nexport interface NumberFilterConfig {\n min?: number;\n max?: number;\n allowedDecimals?: boolean;\n}\n\nexport interface BooleanFilterConfig {\n trueLabel?: string;\n falseLabel?: string;\n}\n\nexport interface EnumFilterConfig extends BaseOptionsFilterConfig {\n options: FilterOption[];\n optionType?: FilterOptionType;\n}\n\nexport interface DynamicOptionsFilterConfig extends BaseOptionsFilterConfig {}\n\nexport interface Filter {\n id: string;\n fieldId: string;\n displayName?: string;\n sectionTitle?: string;\n openByDefault?: boolean;\n tagLabel?: string;\n numberConfig?: NumberFilterConfig;\n dateConfig?: DateFilterConfig;\n booleanConfig?: BooleanFilterConfig;\n enumConfig?: EnumFilterConfig;\n dynamicOptionsConfig?: DynamicOptionsFilterConfig;\n}\n"],"mappings":";;;;IAoKYA,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["ComponentTypeEnum","exports"],"sources":["../../../src/types/CollectionPageConfig.ts"],"sourcesContent":["import { CollectionToolbarFiltersProps } from '@wix/patterns';\nimport { DateRangeFilterMode, DateRangeOptions } from '@wix/patterns/core';\nimport { BaseCollectionConfig } from './types';\nimport {\n ActionCellConfig,\n BulkActionsConfig,\n CollectionPagePrimaryActions,\n CollectionPageSecondaryActions,\n} from './actions';\n\nexport interface CollectionPageTitle {\n text: string;\n hideTotal?: boolean;\n}\n\nexport interface CollectionPageSubtitle {\n text: string;\n learnMore?: {\n url: string;\n label?: string;\n };\n}\n\nexport interface CollectionPageConfig {\n route: {\n path: string;\n };\n title: CollectionPageTitle;\n subtitle?: CollectionPageSubtitle;\n actions?: {\n primaryActions?: CollectionPagePrimaryActions;\n secondaryActions?: CollectionPageSecondaryActions;\n };\n components: ComponentConfig[];\n}\n\nexport interface ComponentConfig extends BaseCollectionComponentConfig {\n layout: LayoutItemConfig[];\n}\n\nexport interface LayoutItemConfig {\n type: 'Table' | 'Grid';\n table?: TableSpecificConfig;\n grid?: GridSpecificConfig;\n}\n\nexport type ColumnsConfig = Column[];\n\nexport interface TableSpecificConfig {\n columns: ColumnsConfig;\n customColumns?: {\n enabled: boolean;\n };\n stickyColumns?: number;\n}\n\nexport interface GridSpecificConfig {\n item: GridItem;\n}\n\nexport interface TableConfig\n extends BaseCollectionComponentConfig,\n TableSpecificConfig {}\nexport interface GridConfig\n extends BaseCollectionComponentConfig,\n GridSpecificConfig {}\nexport interface TableGridSwitchConfig\n extends BaseCollectionComponentConfig,\n TableSpecificConfig,\n GridSpecificConfig {}\n\nexport type CollectionConfig = BaseCollectionConfig & {\n limit?: number;\n reflectQueryInUrl?: boolean;\n selectAllScope?: 'page' | 'all';\n selectionUpdateMode?: 'preserve' | 'clear';\n};\n\nexport interface BaseCollectionComponentConfig {\n collection: CollectionConfig;\n entityPageId?: string;\n search?: { shown?: boolean };\n toolbarTitle?: ToolbarTitle;\n actionCell?: ActionCellConfig;\n emptyState?: EmptyState;\n filters?: FiltersConfig;\n bulkActionToolbar?: BulkActionsConfig;\n}\n\nexport interface ToolbarTitle {\n title: string;\n subtitle?: {\n text: string;\n info?: {\n content: {\n text: string;\n link?: {\n url: string;\n label: string;\n };\n };\n };\n learnMore?: {\n url: string;\n label?: string;\n };\n };\n showTotal?: boolean;\n itemsLimit?: number;\n}\n\nexport interface Column {\n id: string;\n name: string;\n width: string;\n sortable?: boolean;\n defaultSortOrder?: 'asc' | 'desc';\n sortMode?: 'asc' | 'desc';\n defaultHidden?: boolean;\n hiddenFromCustomColumnsSelection?: boolean;\n hideable?: boolean;\n reorderDisabled?: boolean;\n}\n\nexport interface GridItem {\n titleFieldId: string;\n subtitleFieldId?: string;\n imageFieldId?: string;\n cardContentMode?: 'full' | 'title' | 'empty'; // Footer is not supported in auto-patterns\n imagePlacement?: 'top' | 'side';\n}\n\nexport interface EmptyState {\n title?: string;\n subtitle?: string;\n image?: {\n id: string;\n };\n addNewCta?: {\n id?: string;\n text?: string;\n };\n customCta?: {\n id?: string;\n };\n}\n\nexport interface FilterOption {\n value: string;\n label: string;\n}\n\nexport type FilterSelectionMode = 'single' | 'multiple';\nexport type FilterOptionType =\n | 'checkbox'\n | 'inlineCheckbox'\n | 'radio'\n | 'select';\n\nexport enum ComponentTypeEnum {\n SINGLE = 'single',\n MULTI_SELECT = 'multi-select',\n RADIO_GROUP = 'radio-group',\n NUMBER = 'number',\n DATE_RANGE = 'date-range',\n}\n\nexport type FilterItems = Filter[];\nexport interface FiltersConfig {\n items: FilterItems;\n maxInlineFilters?: CollectionToolbarFiltersProps['inline'];\n panelTitle?: string;\n}\n\nexport interface BaseOptionsFilterConfig {\n selectionMode: FilterSelectionMode;\n}\n\nexport interface DateFilterConfig {\n mode?: DateRangeFilterMode;\n presets?: DateRangeOptions;\n includeTime?: boolean;\n}\n\nexport interface NumberFilterConfig {\n min?: number;\n max?: number;\n allowedDecimals?: boolean;\n}\n\nexport interface BooleanFilterConfig {\n trueLabel?: string;\n falseLabel?: string;\n}\n\nexport interface EnumFilterConfig extends BaseOptionsFilterConfig {\n options: FilterOption[];\n optionType?: FilterOptionType;\n}\n\nexport interface DynamicOptionsFilterConfig extends BaseOptionsFilterConfig {}\n\nexport interface Filter {\n id: string;\n fieldId: string;\n displayName?: string;\n sectionTitle?: string;\n openByDefault?: boolean;\n tagLabel?: string;\n numberConfig?: NumberFilterConfig;\n dateConfig?: DateFilterConfig;\n booleanConfig?: BooleanFilterConfig;\n enumConfig?: EnumFilterConfig;\n dynamicOptionsConfig?: DynamicOptionsFilterConfig;\n}\n"],"mappings":";;;;IA+JYA,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../src/types/EntityPageConfig.ts"],"sourcesContent":["import { FieldValues, UseFormReturn } from '@wix/patterns/form';\nimport { EntityPageMoreActions } from './actions/entityPageActions';\n\nexport interface EntityPageConfig {\n route: {\n path: string;\n params: {\n id: string;\n };\n };\n title?: {\n text: string;\n };\n subtitle?: {\n text: string;\n learnMore?: {\n url: string;\n label?: string;\n };\n };\n collectionId: string;\n entityTypeSource: string;\n parentPageId?: string;\n layout?: {\n main: CardLayout[];\n sidebar?: CardLayout[];\n };\n moreActions?: EntityPageMoreActions;\n}\n\nexport interface CardLayout {\n type: 'card';\n card: {\n title: {\n text: string;\n };\n subtitle?: {\n text: string;\n };\n children: LayoutContent[];\n };\n}\n\nexport type LayoutContent =\n | FieldContent\n | ContainerContent\n | ComponentItemContent;\n\ninterface FieldContent {\n type: 'field';\n field: {\n span?: number;\n fieldId: string;\n };\n}\n\ninterface ContainerContent {\n type: 'container';\n container: {\n span?: number;\n children: LayoutContent[];\n };\n}\n\ninterface ComponentItemContent {\n type: 'component';\n component: {\n span?: number;\n componentId: string;\n };\n}\n\nexport interface CustomComponentProps {\n entity?: Record<string, any>;\n form: UseFormReturn<FieldValues, any, undefined>;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["../../../src/types/EntityPageConfig.ts"],"sourcesContent":["import { FieldValues, UseFormReturn } from '@wix/patterns/form';\nimport { EntityPageMoreActions } from './actions/entityPageActions';\nimport { BaseCollectionConfig } from './types';\n\nexport type EntityPageConfig = {\n route: {\n path: string;\n params: {\n id: string;\n };\n };\n title?: {\n text: string;\n };\n subtitle?: {\n text: string;\n learnMore?: {\n url: string;\n label?: string;\n };\n };\n parentPageId?: string;\n layout?: {\n main: CardLayout[];\n sidebar?: CardLayout[];\n };\n moreActions?: EntityPageMoreActions;\n} & BaseCollectionConfig;\n\nexport interface CardLayout {\n type: 'card';\n card: {\n title: {\n text: string;\n };\n subtitle?: {\n text: string;\n };\n children: LayoutContent[];\n };\n}\n\nexport type LayoutContent =\n | FieldContent\n | ContainerContent\n | ComponentItemContent;\n\ninterface FieldContent {\n type: 'field';\n field: {\n span?: number;\n fieldId: string;\n };\n}\n\ninterface ContainerContent {\n type: 'container';\n container: {\n span?: number;\n children: LayoutContent[];\n };\n}\n\ninterface ComponentItemContent {\n type: 'component';\n component: {\n span?: number;\n componentId: string;\n };\n}\n\nexport interface CustomComponentProps {\n entity?: Record<string, any>;\n form: UseFormReturn<FieldValues, any, undefined>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../../src/types/actions/actionCell.ts"],"sourcesContent":["import {\n CustomActionModalProps,\n CustomActionParams,\n ResolvedAction,\n} from '../../exports/types';\nimport {\n CustomActionConfig,\n CustomModalActionConfig,\n DeleteActionConfig,\n UpdateActionConfig,\n DividerActionConfig,\n} from './base';\n\nexport type ActionCellItemConfig =\n | UpdateActionConfig\n | CustomModalActionConfig\n | CustomActionConfig\n | DeleteActionConfig;\n\nexport interface ActionCellPrimaryAction {\n item: ActionCellItemConfig;\n}\n\nexport interface ActionCellSecondaryActions {\n items: (ActionCellItemConfig | DividerActionConfig)[];\n inlineCount?: number;\n inlineAlwaysVisible?: boolean;\n}\n\nexport interface ActionCellConfig {\n primaryAction?: ActionCellPrimaryAction;\n secondaryActions?: ActionCellSecondaryActions;\n}\n\nexport interface ActionCellActionParams {\n item: any;\n}\n\nexport type CustomActionCellActionParams =\n CustomActionParams<ActionCellActionParams>;\n\nexport type CustomActionCellActionResolver = (\n params: CustomActionCellActionParams,\n) => ResolvedAction;\n\nexport interface CustomActionCellActionModalProps\n extends CustomActionModalProps {\n actionParams: ActionCellActionParams;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["../../../../src/types/actions/actionCell.ts"],"sourcesContent":["import {\n CustomActionModalProps,\n CustomActionParams,\n ResolvedAction,\n} from '../../exports/types';\nimport {\n CustomActionConfig,\n DeleteActionConfig,\n UpdateActionConfig,\n DividerActionConfig,\n} from './base';\n\nexport type ActionCellItemConfig =\n | UpdateActionConfig\n | CustomActionConfig\n | DeleteActionConfig;\n\nexport interface ActionCellPrimaryAction {\n item: ActionCellItemConfig;\n}\n\nexport interface ActionCellSecondaryActions {\n items: (ActionCellItemConfig | DividerActionConfig)[];\n inlineCount?: number;\n inlineAlwaysVisible?: boolean;\n}\n\nexport interface ActionCellConfig {\n primaryAction?: ActionCellPrimaryAction;\n secondaryActions?: ActionCellSecondaryActions;\n}\n\nexport interface ActionCellActionParams {\n item: any;\n}\n\nexport type CustomActionCellActionParams =\n CustomActionParams<ActionCellActionParams>;\n\nexport type CustomActionCellActionResolver = (\n params: CustomActionCellActionParams,\n) => ResolvedAction;\n\nexport interface CustomActionCellActionModalProps\n extends CustomActionModalProps {\n actionParams: ActionCellActionParams;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../../src/types/actions/base.ts"],"sourcesContent":["export type DividerActionConfig = { type: 'divider' };\n\nexport type BaseActionItemConfig = {\n id: string;\n label?: string;\n};\n\nexport interface Feedback {\n successToast?: { text: string };\n errorToast?: { text: string };\n}\n\nexport interface BaseActionModal {\n title?: { text: string };\n actions?: {\n submit?: { text: string };\n cancel?: { text: string };\n };\n feedback?: Feedback;\n}\n\nexport interface ActionModalField {\n id: string;\n label?: string;\n}\n\nexport interface DeleteActionModal extends BaseActionModal {\n description?: { text: string };\n}\n\nexport interface BulkDeleteActionModal extends DeleteActionModal {}\n\nexport type BulkDeleteAction =\n | {\n mode: 'modal';\n modal: BulkDeleteActionModal;\n custom?: never;\n }\n | {\n mode: 'custom';\n custom: CustomAction;\n modal?: never;\n };\n\nexport type DeleteAction = {\n mode: 'modal';\n modal: DeleteActionModal;\n};\n\nexport interface BaseActionPage {\n id: string;\n}\n\nexport type CustomAction = {};\n\nexport type CustomModalAction = {\n id: string;\n};\n\nexport interface ActionModalWithFields extends BaseActionModal {\n fields: ActionModalField[];\n}\n\nexport interface UpdateActionModal extends ActionModalWithFields {}\n\nexport interface CreateActionModal extends ActionModalWithFields {}\n\nexport interface UpdateActionPage extends BaseActionPage {}\n\nexport interface CreateActionPage extends BaseActionPage {}\n\nexport type UpdateAction = {\n mode: 'page';\n page: UpdateActionPage;\n};\n\nexport type CreateAction = {\n mode: 'page';\n page: CreateActionPage;\n};\n\nexport type CreateActionConfig = BaseActionItemConfig & {\n type: 'create';\n create: CreateAction;\n};\n\nexport type UpdateActionConfig = BaseActionItemConfig & {\n type: 'update';\n update: UpdateAction;\n};\n\nexport type DeleteActionConfig = BaseActionItemConfig & {\n type: 'delete';\n delete: DeleteAction;\n};\n\nexport type BulkDeleteActionConfig = BaseActionItemConfig & {\n type: 'bulkDelete';\n bulkDelete: BulkDeleteAction;\n};\n\nexport type CustomModalActionConfig = BaseActionItemConfig & {\n type: 'customModal';\n customModal: CustomModalAction;\n};\n\nexport type CustomActionConfig = BaseActionItemConfig & {\n type: 'custom';\n custom: CustomAction;\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["../../../../src/types/actions/base.ts"],"sourcesContent":["export type DividerActionConfig = { type: 'divider' };\n\nexport type BaseActionItemConfig = {\n id: string;\n label?: string;\n};\n\nexport interface Feedback {\n successToast?: { text: string };\n errorToast?: { text: string };\n}\n\nexport interface BaseActionModal {\n title?: { text: string };\n actions?: {\n submit?: { text: string };\n cancel?: { text: string };\n };\n feedback?: Feedback;\n}\n\nexport interface ActionModalField {\n id: string;\n label?: string;\n}\n\nexport interface DeleteActionModal extends BaseActionModal {\n description?: { text: string };\n}\n\nexport interface BulkDeleteActionModal extends DeleteActionModal {}\n\nexport type BulkDeleteAction =\n | {\n mode: 'modal';\n modal: BulkDeleteActionModal;\n custom?: never;\n }\n | {\n mode: 'custom';\n custom: CustomAction;\n modal?: never;\n };\n\nexport type DeleteAction = {\n mode: 'modal';\n modal: DeleteActionModal;\n};\n\nexport interface BaseActionPage {\n id: string;\n}\n\nexport type CustomAction = {};\n\nexport interface ActionModalWithFields extends BaseActionModal {\n fields: ActionModalField[];\n}\n\nexport interface UpdateActionModal extends ActionModalWithFields {}\n\nexport interface CreateActionModal extends ActionModalWithFields {}\n\nexport interface UpdateActionPage extends BaseActionPage {}\n\nexport interface CreateActionPage extends BaseActionPage {}\n\nexport type UpdateAction = {\n mode: 'page';\n page: UpdateActionPage;\n};\n\nexport type CreateAction = {\n mode: 'page';\n page: CreateActionPage;\n};\n\nexport type CreateActionConfig = BaseActionItemConfig & {\n type: 'create';\n create: CreateAction;\n};\n\nexport type UpdateActionConfig = BaseActionItemConfig & {\n type: 'update';\n update: UpdateAction;\n};\n\nexport type DeleteActionConfig = BaseActionItemConfig & {\n type: 'delete';\n delete: DeleteAction;\n};\n\nexport type BulkDeleteActionConfig = BaseActionItemConfig & {\n type: 'bulkDelete';\n bulkDelete: BulkDeleteAction;\n};\n\nexport type CustomActionConfig = BaseActionItemConfig & {\n type: 'custom';\n custom: CustomAction;\n};\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../../src/types/actions/bulkActions.ts"],"sourcesContent":["import {\n BaseActionParams,\n CustomActionModalProps,\n ResolvedAction,\n} from '../../exports/types';\nimport {\n BulkDeleteActionConfig,\n CustomActionConfig,\n CustomModalActionConfig,\n DividerActionConfig,\n} from './base';\n\nexport type BulkActionItemConfig =\n | BulkDeleteActionConfig\n | CustomModalActionConfig\n | CustomActionConfig;\n\ntype BulkActionItem = {\n type: 'action';\n action: {\n item: BulkActionItemConfig;\n };\n menu?: never;\n};\n\ntype BulkActionMenu = {\n type: 'menu';\n menu: {\n label: string;\n items: (BulkActionItemConfig | DividerActionConfig)[];\n };\n action?: never;\n};\n\nexport interface BulkActionsConfig {\n primaryActions?: (BulkActionItem | BulkActionMenu)[];\n secondaryActions?: (BulkActionItemConfig | DividerActionConfig)[];\n}\n\nexport interface BulkActionsActionParams {\n selectedValues: any[];\n total: number;\n}\n\nexport interface CustomBulkActionsActionParams extends BaseActionParams {\n actionParams: BulkActionsActionParams;\n}\nexport type CustomBulkActionsActionResolver = (\n params: CustomBulkActionsActionParams,\n) => ResolvedAction;\n\nexport interface CustomBulkActionsActionModalProps\n extends CustomActionModalProps {\n actionParams: BulkActionsActionParams;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["../../../../src/types/actions/bulkActions.ts"],"sourcesContent":["import {\n BaseActionParams,\n CustomActionModalProps,\n ResolvedAction,\n} from '../../exports/types';\nimport {\n BulkDeleteActionConfig,\n CustomActionConfig,\n DividerActionConfig,\n} from './base';\n\nexport type BulkActionItemConfig = BulkDeleteActionConfig | CustomActionConfig;\n\ntype BulkActionItem = {\n type: 'action';\n action: {\n item: BulkActionItemConfig;\n };\n menu?: never;\n};\n\ntype BulkActionMenu = {\n type: 'menu';\n menu: {\n label: string;\n items: (BulkActionItemConfig | DividerActionConfig)[];\n };\n action?: never;\n};\n\nexport interface BulkActionsConfig {\n primaryActions?: (BulkActionItem | BulkActionMenu)[];\n secondaryActions?: (BulkActionItemConfig | DividerActionConfig)[];\n}\n\nexport interface BulkActionsActionParams {\n selectedValues: any[];\n total: number;\n}\n\nexport interface CustomBulkActionsActionParams extends BaseActionParams {\n actionParams: BulkActionsActionParams;\n}\nexport type CustomBulkActionsActionResolver = (\n params: CustomBulkActionsActionParams,\n) => ResolvedAction;\n\nexport interface CustomBulkActionsActionModalProps\n extends CustomActionModalProps {\n actionParams: BulkActionsActionParams;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../../src/types/actions/collectionPageActions.ts"],"sourcesContent":["import {\n CustomActionModalProps,\n CustomActionParams,\n ResolvedAction,\n} from '../../exports/types';\nimport {\n CreateActionConfig,\n CustomActionConfig,\n CustomModalActionConfig,\n DividerActionConfig,\n} from './base';\n\nexport type CollectionPageActionConfig = (\n | CreateActionConfig\n | CustomModalActionConfig\n | CustomActionConfig\n) & {\n collection: {\n collectionId: string;\n entityTypeSource: 'cms';\n };\n};\n\ntype CollectionPageAction = {\n type: 'action';\n action: {\n item: CollectionPageActionConfig;\n };\n menu?: never;\n};\n\ntype CollectionPageMenu = {\n type: 'menu';\n menu: {\n label: string;\n items: (CollectionPageActionConfig | DividerActionConfig)[];\n };\n action?: never;\n};\n\nexport type CollectionPagePrimaryActions =\n | CollectionPageAction\n | CollectionPageMenu;\n\nexport type CollectionPageSecondaryActions =\n | CollectionPageAction\n | CollectionPageMenu;\n\nexport interface CollectionPageActionParams {\n collectionId: string;\n}\n\nexport type CustomActionCollectionPageActionParams =\n CustomActionParams<CollectionPageActionParams>;\n\nexport type CustomActionCollectionPageActionResolver = (\n params: CustomActionCollectionPageActionParams,\n) => ResolvedAction;\n\nexport interface CustomActionCollectionPageActionModalProps\n extends CustomActionModalProps {\n actionParams: CollectionPageActionParams;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["../../../../src/types/actions/collectionPageActions.ts"],"sourcesContent":["import {\n CustomActionModalProps,\n CustomActionParams,\n ResolvedAction,\n} from '../../exports/types';\nimport {\n CreateActionConfig,\n CustomActionConfig,\n DividerActionConfig,\n} from './base';\n\nexport type CollectionPageActionConfig = (\n | CreateActionConfig\n | CustomActionConfig\n) & {\n collection: {\n collectionId: string;\n entityTypeSource: 'cms';\n };\n};\n\ntype CollectionPageAction = {\n type: 'action';\n action: {\n item: CollectionPageActionConfig;\n };\n menu?: never;\n};\n\ntype CollectionPageMenu = {\n type: 'menu';\n menu: {\n label: string;\n items: (CollectionPageActionConfig | DividerActionConfig)[];\n };\n action?: never;\n};\n\nexport type CollectionPagePrimaryActions =\n | CollectionPageAction\n | CollectionPageMenu;\n\nexport type CollectionPageSecondaryActions =\n | CollectionPageAction\n | CollectionPageMenu;\n\nexport interface CollectionPageActionParams {\n collectionId: string;\n}\n\nexport type CustomActionCollectionPageActionParams =\n CustomActionParams<CollectionPageActionParams>;\n\nexport type CustomActionCollectionPageActionResolver = (\n params: CustomActionCollectionPageActionParams,\n) => ResolvedAction;\n\nexport interface CustomActionCollectionPageActionModalProps\n extends CustomActionModalProps {\n actionParams: CollectionPageActionParams;\n}\n"],"mappings":"","ignoreList":[]}
@@ -19,6 +19,12 @@ Object.keys(_EntityPageConfig).forEach(function (key) {
19
19
  if (key in exports && exports[key] === _EntityPageConfig[key]) return;
20
20
  exports[key] = _EntityPageConfig[key];
21
21
  });
22
+ var _providers = require("./providers");
23
+ Object.keys(_providers).forEach(function (key) {
24
+ if (key === "default" || key === "__esModule") return;
25
+ if (key in exports && exports[key] === _providers[key]) return;
26
+ exports[key] = _providers[key];
27
+ });
22
28
  var _actions = require("./actions");
23
29
  Object.keys(_actions).forEach(function (key) {
24
30
  if (key === "default" || key === "__esModule") return;
@@ -1 +1 @@
1
- {"version":3,"names":["_types","require","Object","keys","forEach","key","exports","_CollectionPageConfig","_EntityPageConfig","_actions","_types2","_BaseSDK"],"sources":["../../../src/types/index.ts"],"sourcesContent":["export * from './types';\nexport * from './CollectionPageConfig';\nexport * from './EntityPageConfig';\nexport * from './actions';\nexport * from '../utils/actions/types';\nexport * from './BaseSDK';\n"],"mappings":";;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAL,MAAA,CAAAK,GAAA;AAAA;AACA,IAAAE,qBAAA,GAAAN,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAI,qBAAA,EAAAH,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAE,qBAAA,CAAAF,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAE,qBAAA,CAAAF,GAAA;AAAA;AACA,IAAAG,iBAAA,GAAAP,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAK,iBAAA,EAAAJ,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAG,iBAAA,CAAAH,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAG,iBAAA,CAAAH,GAAA;AAAA;AACA,IAAAI,QAAA,GAAAR,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAM,QAAA,EAAAL,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAI,QAAA,CAAAJ,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAI,QAAA,CAAAJ,GAAA;AAAA;AACA,IAAAK,OAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,OAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,OAAA,CAAAL,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAK,OAAA,CAAAL,GAAA;AAAA;AACA,IAAAM,QAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,QAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,QAAA,CAAAN,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAM,QAAA,CAAAN,GAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["_types","require","Object","keys","forEach","key","exports","_CollectionPageConfig","_EntityPageConfig","_providers","_actions","_types2","_BaseSDK"],"sources":["../../../src/types/index.ts"],"sourcesContent":["export * from './types';\nexport * from './CollectionPageConfig';\nexport * from './EntityPageConfig';\nexport * from './providers';\nexport * from './actions';\nexport * from '../utils/actions/types';\nexport * from './BaseSDK';\n"],"mappings":";;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAL,MAAA,CAAAK,GAAA;AAAA;AACA,IAAAE,qBAAA,GAAAN,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAI,qBAAA,EAAAH,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GA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AAM,OAAA,CAAAN,GAAA;AAAA;AACA,IAAAO,QAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,QAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,QAAA,CAAAP,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAO,QAAA,CAAAP,GAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ //# sourceMappingURL=providers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../../src/types/providers.ts"],"sourcesContent":["import { SchemaConfig } from './types';\nimport { CollectionConfig } from '@wix/patterns';\n\nexport interface SchemaProviderConfig {\n id: string;\n}\n\nexport interface DataProviderConfig {\n id: string;\n}\n\nexport type ExternalSchemaProvider = (\n collectionId: string,\n context: any,\n) => Promise<SchemaConfig>;\n\nexport type ExternalDataProvider = (\n collectionId: string,\n context: any,\n) => CollectionConfig<any, any>['fetchData'];\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../src/types/types.ts"],"sourcesContent":["import { EntityPageConfig } from './EntityPageConfig';\nimport { CollectionPageConfig } from './CollectionPageConfig';\n\nexport interface BaseCollectionConfig {\n collectionId: string;\n entityTypeSource: 'cms';\n}\n\nexport type PatternsFieldType =\n | 'SHORT_TEXT'\n | 'LONG_TEXT'\n | 'NUMBER'\n | 'BOOLEAN'\n | 'DATE'\n | 'DATETIME'\n | 'URL'\n | 'ARRAY'\n | 'REFERENCE'\n | 'IMAGE';\n\nexport interface AppConfig {\n pages: PageConfig[];\n}\n\nexport interface BasePageConfig {\n id: string;\n appMainPage?: boolean;\n}\n\nexport interface CollectionPageConfigType extends BasePageConfig {\n type: 'collectionPage';\n collectionPage: CollectionPageConfig;\n entityPage?: never;\n}\n\nexport interface EntityPageConfigType extends BasePageConfig {\n type: 'entityPage';\n entityPage: EntityPageConfig;\n collectionPage?: never;\n}\n\nexport type PageConfig = CollectionPageConfigType | EntityPageConfigType;\n\nexport type EntityProps = { [key: string]: any };\n\nexport interface IMenuItem<T extends EntityProps = any> {\n item: T;\n}\nexport interface IColumnValue<T> {\n value: T;\n row: Record<string, any>;\n}\n\nexport type QueryOperator =\n | 'CONTAINS'\n | 'ENDS_WITH'\n | 'EQ'\n | 'EXISTS'\n | 'GT'\n | 'GTE'\n | 'HAS_ALL'\n | 'HAS_SOME'\n | 'LT'\n | 'LTE'\n | 'NE'\n | 'STARTS_WITH'\n | 'URLIZED';\n\ninterface BaseField {\n id: string;\n displayName: string;\n validation?: {\n numberRange?: NumberRange;\n stringLengthRange?: StringLengthRange;\n required: boolean;\n };\n capabilities: {\n supportedQueryOperators: QueryOperator[];\n sortable: boolean;\n };\n}\n\nexport interface ReferenceField extends BaseField {\n type: 'REFERENCE';\n referenceMetadata: {\n referencedCollectionId: string;\n };\n}\n\nexport interface NonReferenceField extends BaseField {\n type: Exclude<PatternsFieldType, 'REFERENCE'>;\n}\n\nexport type Field = ReferenceField | NonReferenceField;\n\nexport interface NumberRange {\n min?: number;\n max?: number;\n}\nexport interface StringLengthRange {\n minLength?: number;\n maxLength?: number;\n}\n\nexport interface SchemaConfig {\n id: string;\n fields: Record<string, Field | undefined>;\n displayField: string;\n idField: string;\n imageField?: string;\n actions: {\n get: (entityId: string) => Promise<any>;\n create: (newEntity: Partial<any>) => Promise<any>;\n update: (updatedEntity: any) => Promise<any>;\n delete: (entityId: string) => Promise<any>;\n bulkDelete: (entityIds: string[]) => Promise<any>;\n };\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["../../../src/types/types.ts"],"sourcesContent":["import { EntityPageConfig } from './EntityPageConfig';\nimport { CollectionPageConfig } from './CollectionPageConfig';\nimport { ComputedQuery } from '@wix/patterns';\n\ninterface BaseCollectionConfigCommon {\n collectionId: string;\n}\n\ninterface CMSCollectionConfig extends BaseCollectionConfigCommon {\n entityTypeSource: 'cms';\n custom?: never;\n}\n\ninterface WixCollectionConfig extends BaseCollectionConfigCommon {\n entityTypeSource: 'wix';\n custom?: never;\n}\n\ninterface CustomCollectionConfig extends BaseCollectionConfigCommon {\n entityTypeSource: 'custom';\n custom: {\n id: string;\n };\n}\n\nexport type BaseCollectionConfig =\n | CMSCollectionConfig\n | WixCollectionConfig\n | CustomCollectionConfig;\n\nexport type PatternsFieldType =\n | 'SHORT_TEXT'\n | 'LONG_TEXT'\n | 'NUMBER'\n | 'BOOLEAN'\n | 'DATE'\n | 'DATETIME'\n | 'URL'\n | 'ARRAY'\n | 'REFERENCE'\n | 'IMAGE';\n\nexport interface AppConfig {\n pages: PageConfig[];\n}\n\nexport interface BasePageConfig {\n id: string;\n appMainPage?: boolean;\n}\n\nexport interface CollectionPageConfigType extends BasePageConfig {\n type: 'collectionPage';\n collectionPage: CollectionPageConfig;\n entityPage?: never;\n}\n\nexport interface EntityPageConfigType extends BasePageConfig {\n type: 'entityPage';\n entityPage: EntityPageConfig;\n collectionPage?: never;\n}\n\nexport type PageConfig = CollectionPageConfigType | EntityPageConfigType;\n\nexport type EntityProps = { [key: string]: any };\n\nexport interface IMenuItem<T extends EntityProps = any> {\n item: T;\n}\nexport interface IColumnValue<T> {\n value: T;\n row: Record<string, any>;\n}\n\nexport type QueryOperator =\n | 'CONTAINS'\n | 'ENDS_WITH'\n | 'EQ'\n | 'EXISTS'\n | 'GT'\n | 'GTE'\n | 'HAS_ALL'\n | 'HAS_SOME'\n | 'LT'\n | 'LTE'\n | 'NE'\n | 'STARTS_WITH'\n | 'URLIZED';\n\ninterface BaseField {\n id: string;\n displayName: string;\n validation?: {\n numberRange?: NumberRange;\n stringLengthRange?: StringLengthRange;\n required: boolean;\n };\n capabilities: {\n supportedQueryOperators: QueryOperator[];\n sortable: boolean;\n };\n}\n\nexport interface ReferenceField extends BaseField {\n type: 'REFERENCE';\n referenceMetadata: {\n referencedCollectionId: string;\n };\n}\n\nexport interface NonReferenceField extends BaseField {\n type: Exclude<PatternsFieldType, 'REFERENCE'>;\n}\n\nexport type Field = ReferenceField | NonReferenceField;\n\nexport interface NumberRange {\n min?: number;\n max?: number;\n}\nexport interface StringLengthRange {\n minLength?: number;\n maxLength?: number;\n}\n\nexport interface SchemaConfig {\n id: string;\n fields: Record<string, Field | undefined>;\n displayField: string;\n idField: string;\n imageField?: string;\n actions: {\n get: (entityId: string) => Promise<any>;\n create: (newEntity: Partial<any>) => Promise<any>;\n update: (updatedEntity: any) => Promise<any>;\n delete: (entityId: string) => Promise<any>;\n bulkDelete: (entityIds: string[]) => Promise<any>;\n find: (\n query: ComputedQuery<any>,\n options?: {\n searchableFieldIds?: string[];\n filterFieldMapping?: Record<string, { fieldId: string }>;\n },\n ) => Promise<{ items: any[]; total: number }>;\n };\n}\n"],"mappings":"","ignoreList":[]}
@@ -31,12 +31,6 @@ Object.keys(_customAction).forEach(function (key) {
31
31
  if (key in exports && exports[key] === _customAction[key]) return;
32
32
  exports[key] = _customAction[key];
33
33
  });
34
- var _customModalAction = require("./customModalAction");
35
- Object.keys(_customModalAction).forEach(function (key) {
36
- if (key === "default" || key === "__esModule") return;
37
- if (key in exports && exports[key] === _customModalAction[key]) return;
38
- exports[key] = _customModalAction[key];
39
- });
40
34
  var _createAction = require("./createAction");
41
35
  Object.keys(_createAction).forEach(function (key) {
42
36
  if (key === "default" || key === "__esModule") return;
@@ -1 +1 @@
1
- {"version":3,"names":["_resolveAction","require","Object","keys","forEach","key","exports","_bulkDeleteAction","_updateAction","_deleteAction","_customAction","_customModalAction","_createAction","_groupActions"],"sources":["../../../../src/utils/actions/index.ts"],"sourcesContent":["export * from './resolveAction';\nexport * from './bulkDeleteAction';\nexport * from './updateAction';\nexport * from './deleteAction';\nexport * from './customAction';\nexport * from './customModalAction';\nexport * from './customAction';\nexport * from './createAction';\nexport * from './groupActions';\n"],"mappings":";;;AAAA,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AAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,aAAA,CAAAL,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAK,aAAA,CAAAL,GAAA;AAAA;AADA,IAAAM,kBAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,kBAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,kBAAA,CAAAN,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAM,kBAAA,CAAAN,GAAA;AAAA;AAEA,IAAAO,aAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,aAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,aAAA,CAAAP,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAO,aAAA,CAAAP,GAAA;AAAA;AACA,IAAAQ,aAAA,GAAAZ,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAU,aAAA,EAAAT,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,aAAA,CAAAR,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAQ,aAAA,CAAAR,GAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["_resolveAction","require","Object","keys","forEach","key","exports","_bulkDeleteAction","_updateAction","_deleteAction","_customAction","_createAction","_groupActions"],"sources":["../../../../src/utils/actions/index.ts"],"sourcesContent":["export * from './resolveAction';\nexport * from './bulkDeleteAction';\nexport * from './updateAction';\nexport * from './deleteAction';\nexport * from './customAction';\nexport * from './createAction';\nexport * from './gro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A,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,aAAA,CAAAL,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAK,aAAA,CAAAL,GAAA;AAAA;AACA,IAAAM,aAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,aAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,aAAA,CAAAN,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAM,aAAA,CAAAN,GAAA;AAAA;AACA,IAAAO,aAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,aAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,aAAA,CAAAP,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAO,aAAA,CAAAP,GAAA;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../../src/utils/actions/types.ts"],"sourcesContent":["import { ActionCellAPI, CollectionOptimisticActions } from '@wix/patterns';\nimport {\n UpdateActionConfig,\n CustomActionConfig,\n CustomModalActionConfig,\n SchemaConfig,\n BulkDeleteActionConfig,\n DeleteActionConfig,\n CreateActionConfig,\n BaseSDK,\n} from '../../types';\nimport { IconElement } from '@wix/design-system';\n\nexport interface ResolvedAction {\n label: string;\n icon: IconElement;\n onClick: () => void;\n disabled?: boolean;\n tooltip?: string;\n}\n\nexport interface BaseContextParams {\n schema: SchemaConfig;\n}\n\nexport interface ActionsSDK extends BaseSDK {\n getSchema: (collectionId: string) => SchemaConfig | undefined;\n collectionId: string; // TODO: Why collectionId is needed here? getSchema with internal collectionId is enough\n getOptimisticActions: (\n collectionId: string,\n ) => CollectionOptimisticActions<any, any>;\n}\n\nexport interface BaseActionParams<T = Record<string, any>> {\n sdk: ActionsSDK;\n actionParams: T;\n}\n\nexport interface ActionCellBaseParams extends BaseActionParams {\n actionParams: {\n item: any;\n index: number;\n api: ActionCellAPI<any, any>;\n };\n}\n\nexport interface BulkDeleteActionParams extends BaseActionParams {\n action: BulkDeleteActionConfig;\n actionParams: {\n selectedValues: any[];\n total: number;\n };\n}\n\nexport interface DeleteActionParams extends ActionCellBaseParams {\n action: DeleteActionConfig;\n}\n\nexport interface UpdateActionParams extends ActionCellBaseParams {\n action: UpdateActionConfig;\n}\n\nexport interface CreateActionParams extends BaseActionParams {\n action: CreateActionConfig;\n}\n\nexport interface CustomModalActionParams extends BaseActionParams {\n action: CustomModalActionConfig;\n}\nexport interface CustomActionParams<T> extends BaseActionParams<T> {\n action: CustomActionConfig;\n}\n\nexport interface ActionModalProps {\n modalParams: Record<string, any>;\n actionParams: Record<string, any>;\n sdk: ActionsSDK;\n}\n\nexport interface CustomActionModalProps extends ActionModalProps {\n modalParams: { id: string };\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["../../../../src/utils/actions/types.ts"],"sourcesContent":["import { ActionCellAPI, CollectionOptimisticActions } from '@wix/patterns';\nimport {\n UpdateActionConfig,\n CustomActionConfig,\n SchemaConfig,\n BulkDeleteActionConfig,\n DeleteActionConfig,\n CreateActionConfig,\n BaseSDK,\n} from '../../types';\nimport { IconElement } from '@wix/design-system';\n\nexport interface ResolvedAction {\n label: string;\n icon: IconElement;\n onClick: () => void;\n disabled?: boolean;\n tooltip?: string;\n}\n\nexport interface BaseContextParams {\n schema: SchemaConfig;\n}\n\nexport interface ActionsSDK extends BaseSDK {\n getSchema: (collectionId: string) => SchemaConfig | undefined;\n collectionId: string; // TODO: Why collectionId is needed here? getSchema with internal collectionId is enough\n getOptimisticActions: (\n collectionId: string,\n ) => CollectionOptimisticActions<any, any>;\n}\n\nexport interface BaseActionParams<T = Record<string, any>> {\n sdk: ActionsSDK;\n actionParams: T;\n}\n\nexport interface ActionCellBaseParams extends BaseActionParams {\n actionParams: {\n item: any;\n index: number;\n api: ActionCellAPI<any, any>;\n };\n}\n\nexport interface BulkDeleteActionParams extends BaseActionParams {\n action: BulkDeleteActionConfig;\n actionParams: {\n selectedValues: any[];\n total: number;\n };\n}\n\nexport interface DeleteActionParams extends ActionCellBaseParams {\n action: DeleteActionConfig;\n}\n\nexport interface UpdateActionParams extends ActionCellBaseParams {\n action: UpdateActionConfig;\n}\n\nexport interface CreateActionParams extends BaseActionParams {\n action: CreateActionConfig;\n}\n\nexport interface CustomActionParams<T> extends BaseActionParams<T> {\n action: CustomActionConfig;\n}\n\nexport interface ActionModalProps {\n modalParams: Record<string, any>;\n actionParams: Record<string, any>;\n sdk: ActionsSDK;\n}\n\nexport interface CustomActionModalProps extends ActionModalProps {\n modalParams: { id: string };\n}\n"],"mappings":"","ignoreList":[]}
@@ -50,8 +50,7 @@ export const AutoPatternsCollectionPageContent = _ref => {
50
50
  }
51
51
  return componentToRender ? /*#__PURE__*/React.createElement(SchemaProvider, {
52
52
  key: `${sharedConfig.collection.collectionId}-${index}`,
53
- collectionId: sharedConfig.collection.collectionId,
54
- entityTypeSource: sharedConfig.collection.entityTypeSource
53
+ collection: sharedConfig.collection
55
54
  }, componentToRender) : null;
56
55
  }).filter(Boolean));
57
56
  };
@@ -1 +1 @@
1
- {"version":3,"names":["React","AutoPatternsTable","AutoPatternsGrid","AutoPatternsTableGridSwitch","SchemaProvider","AutoPatternsCollectionPageContent","_ref","configuration","components","createElement","Fragment","map","component","index","_layout$find","_layout$find2","layout","sharedConfig","length","tableConfig","find","item","type","table","gridConfig","grid","componentToRender","config","key","collection","collectionId","entityTypeSource","filter","Boolean"],"sources":["../../../../src/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.tsx"],"sourcesContent":["import React from 'react';\nimport { AutoPatternsTable } from '../AutoPatternsTable';\nimport { CollectionPageConfig } from '../../types';\nimport { AutoPatternsGrid } from '../AutoPatternsGrid';\nimport { AutoPatternsTableGridSwitch } from '../AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch';\nimport { SchemaProvider } from '../../providers';\n\nexport interface AutoPatternsCollectionPageContentProps {\n configuration: CollectionPageConfig;\n}\n\nexport const AutoPatternsCollectionPageContent = ({\n configuration,\n}: AutoPatternsCollectionPageContentProps) => {\n const { components } = configuration;\n return (\n <>\n {components\n .map((component, index) => {\n const { layout, ...sharedConfig } = component;\n\n if (!layout?.length) {\n return null;\n }\n\n const tableConfig = layout.find(\n (item) => item.type === 'Table',\n )?.table;\n const gridConfig = layout.find((item) => item.type === 'Grid')?.grid;\n\n let componentToRender = null;\n\n if (tableConfig && gridConfig) {\n const config = {\n ...sharedConfig,\n ...tableConfig,\n ...gridConfig,\n };\n componentToRender = (\n <AutoPatternsTableGridSwitch configuration={config} />\n );\n } else if (tableConfig) {\n const config = { ...sharedConfig, ...tableConfig };\n componentToRender = <AutoPatternsTable configuration={config} />;\n } else if (gridConfig) {\n const config = { ...sharedConfig, ...gridConfig };\n componentToRender = <AutoPatternsGrid configuration={config} />;\n }\n\n return componentToRender ? (\n <SchemaProvider\n key={`${sharedConfig.collection.collectionId}-${index}`}\n collectionId={sharedConfig.collection.collectionId}\n entityTypeSource={sharedConfig.collection.entityTypeSource}\n >\n {componentToRender}\n </SchemaProvider>\n ) : null;\n })\n .filter(Boolean)}\n </>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,iBAAiB,QAAQ,sBAAsB;AAExD,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SAASC,2BAA2B,QAAQ,4DAA4D;AACxG,SAASC,cAAc,QAAQ,iBAAiB;AAMhD,OAAO,MAAMC,iCAAiC,GAAGC,IAAA,IAEH;EAAA,IAFI;IAChDC;EACsC,CAAC,GAAAD,IAAA;EACvC,MAAM;IAAEE;EAAW,CAAC,GAA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,EAAEoB;MAAO,CAAE,CAAC;IACjE;IAEA,OAAOD,iBAAiB,gBACtB1B,KAAA,CAAAS,aAAA,CAACL,cAAc;MACbwB,GAAG,EAAE,GAAGX,YAAY,CAACY,UAAU,CAACC,YAAY,IAAIjB,KAAK,EAAG;MACxDiB,YAAY,EAAEb,YAAY,CAACY,UAAU,CAACC,YAAa;MACnDC,gBAAgB,EAAEd,YAAY,CAACY,UAAU,CAACE;IAAiB,GAE1DL,iBACa,CAAC,GACf,IAAI;EACV,CAAC,CAAC,CACDM,MAAM,CAACC,OAAO,CACjB,CAAC;AAEP,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","AutoPatternsTable","AutoPatternsGrid","AutoPatternsTableGridSwitch","SchemaProvider","AutoPatternsCollectionPageContent","_ref","configuration","components","createElement","Fragment","map","component","index","_layout$find","_layout$find2","layout","sharedConfig","length","tableConfig","find","item","type","table","gridConfig","grid","componentToRender","config","key","collection","collectionId","filter","Boolean"],"sources":["../../../../src/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.tsx"],"sourcesContent":["import React from 'react';\nimport { AutoPatternsTable } from '../AutoPatternsTable';\nimport { CollectionPageConfig } from '../../types';\nimport { AutoPatternsGrid } from '../AutoPatternsGrid';\nimport { AutoPatternsTableGridSwitch } from '../AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch';\nimport { SchemaProvider } from '../../providers';\n\nexport interface AutoPatternsCollectionPageContentProps {\n configuration: CollectionPageConfig;\n}\n\nexport const AutoPatternsCollectionPageContent = ({\n configuration,\n}: AutoPatternsCollectionPageContentProps) => {\n const { components } = configuration;\n return (\n <>\n {components\n .map((component, index) => {\n const { layout, ...sharedConfig } = component;\n\n if (!layout?.length) {\n return null;\n }\n\n const tableConfig = layout.find(\n (item) => item.type === 'Table',\n )?.table;\n const gridConfig = layout.find((item) => item.type === 'Grid')?.grid;\n\n let componentToRender = null;\n\n if (tableConfig && gridConfig) {\n const config = {\n ...sharedConfig,\n ...tableConfig,\n ...gridConfig,\n };\n componentToRender = (\n <AutoPatternsTableGridSwitch configuration={config} />\n );\n } else if (tableConfig) {\n const config = { ...sharedConfig, ...tableConfig };\n componentToRender = <AutoPatternsTable configuration={config} />;\n } else if (gridConfig) {\n const config = { ...sharedConfig, ...gridConfig };\n componentToRender = <AutoPatternsGrid configuration={config} />;\n }\n\n return componentToRender ? (\n <SchemaProvider\n key={`${sharedConfig.collection.collectionId}-${index}`}\n collection={sharedConfig.collection}\n >\n {componentToRender}\n </SchemaProvider>\n ) : null;\n })\n .filter(Boolean)}\n </>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,iBAAiB,QAAQ,sBAAsB;AAExD,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SAASC,2BAA2B,QAAQ,4DAA4D;AACxG,SAASC,cAAc,QAAQ,iBAAiB;AAMhD,OAAO,MAAMC,iCAAiC,GAAGC,IAAA,IAEH;EAAA,IAFI;IAChDC;EACsC,CAAC,GAAAD,IAAA;EACvC,MAAM;IAAEE;EAAW,CAAC,GAAGD,aAAa;EACpC,oBACEP,KAAA,CAAAS,aAAA,CAAAT,KAAA,CAAAU,QAAA,QACGF,UAAU,CACRG,GAAG,CAAC,CAACC,SAAS,EAAEC,KAAK,KAAK;IAAA,IAAAC,YAAA,EAAAC,aAAA;IACzB,MAAM;MAAEC,MAAM;MAAE,GAAGC;IAAa,CAAC,GAAGL,SAAS;IAE7C,IAAI,EAACI,MAAM,YAANA,MAAM,CAAEE,MAAM,GAAE;MACnB,OAAO,IAAI;IACb;IAEA,MAAMC,WAAW,IAAAL,YAAA,GAAGE,MAAM,CAACI,IAAI,CAC5BC,IAAI,IAAKA,IAAI,CAACC,IAAI,KAAK,OAC1B,CAAC,qBAFmBR,YAAA,CAEjBS,KAAK;IACR,MAAMC,UAAU,IAAAT,aAAA,GAAGC,MAAM,CAACI,IAAI,CAAEC,IAAI,IAAKA,IAAI,CAACC,IAAI,KAAK,MAAM,CAAC,qBAA3CP,aAAA,CAA6CU,IAAI;IAEpE,IAAIC,iBAAiB,GAAG,IAAI;IAE5B,IAAIP,WAAW,IAAIK,UAAU,EAAE;MAC7B,MAAMG,MAAM,GAAG;QACb,GAAGV,YAAY;QACf,GAAGE,WAAW;QACd,GAAGK;MACL,CAAC;MACDE,iBAAiB,gBACf1B,KAAA,CAAAS,aAAA,CAACN,2BAA2B;QAACI,aAAa,EAAEoB;MAAO,CAAE,CACtD;IACH,CAAC,MAAM,IAAIR,WAAW,EAAE;MACtB,MAAMQ,MAAM,GAAG;QAAE,GAAGV,YAAY;QAAE,GAAGE;MAAY,CAAC;MAClDO,iBAAiB,gBAAG1B,KAAA,CAAAS,aAAA,CAACR,iBAAiB;QAACM,aAAa,EAAEoB;MAAO,CAAE,CAAC;IAClE,CAAC,MAAM,IAAIH,UAAU,EAAE;MACrB,MAAMG,MAAM,GAAG;QAAE,GAAGV,YAAY;QAAE,GAAGO;MAAW,CAAC;MACjDE,iBAAiB,gBAAG1B,KAAA,CAAAS,aAAA,CAACP,gBAAgB;QAACK,aAAa,EAAEoB;MAAO,CAAE,CAAC;IACjE;IAEA,OAAOD,iBAAiB,gBACtB1B,KAAA,CAAAS,aAAA,CAACL,cAAc;MACbwB,GAAG,EAAE,GAAGX,YAAY,CAACY,UAAU,CAACC,YAAY,IAAIjB,KAAK,EAAG;MACxDgB,UAAU,EAAEZ,YAAY,CAACY;IAAW,GAEnCH,iBACa,CAAC,GACf,IAAI;EACV,CAAC,CAAC,CACDK,MAAM,CAACC,OAAO,CACjB,CAAC;AAEP,CAAC","ignoreList":[]}
@@ -22,8 +22,7 @@ export const AutoPatternsPage = _ref => {
22
22
  case 'entityPage':
23
23
  if (entityPage) {
24
24
  return /*#__PURE__*/React.createElement(SchemaProvider, {
25
- collectionId: entityPage.collectionId,
26
- entityTypeSource: entityPage.entityTypeSource
25
+ collection: entityPage
27
26
  }, /*#__PURE__*/React.createElement(AutoPatternsEntityPage, {
28
27
  configuration: entityPage
29
28
  }));
@@ -1 +1 @@
1
- {"version":3,"names":["React","AutoPatternsCollectionPage","AutoPatternsEntityPage","SchemaProvider","AutoPatternsPage","_ref","pageConfig","type","collectionPage","entityPage","createElement","configuration","collectionId","entityTypeSource"],"sources":["../../../../src/components/AutoPatternsRoute/AutoPatternsPage.tsx"],"sourcesContent":["import React from 'react';\nimport { PageConfig } from '../../types';\nimport { AutoPatternsCollectionPage } from '../AutoPatternsCollectionPage';\nimport { AutoPatternsEntityPage } from '../AutoPatternsEntityPage';\nimport { SchemaProvider } from '../../providers/SchemaContext';\n\nexport interface AutoPatternsPageProps {\n pageConfig: PageConfig;\n}\n\nexport const AutoPatternsPage = ({ pageConfig }: AutoPatternsPageProps) => {\n const { type, collectionPage, entityPage } = pageConfig;\n\n switch (type) {\n case 'collectionPage':\n if (collectionPage) {\n return <AutoPatternsCollectionPage configuration={collectionPage} />;\n }\n break;\n case 'entityPage':\n if (entityPage) {\n return (\n <SchemaProvider\n collectionId={entityPage.collectionId}\n entityTypeSource={entityPage.entityTypeSource}\n >\n <AutoPatternsEntityPage configuration={entityPage} />\n </SchemaProvider>\n );\n }\n break;\n default:\n break;\n }\n\n return null;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,0BAA0B,QAAQ,+BAA+B;AAC1E,SAASC,sBAAsB,QAAQ,2BAA2B;AAClE,SAASC,cAAc,QAAQ,+BAA+B;AAM9D,OAAO,MAAMC,gBAAgB,GAAGC,IAAA,IAA2C;EAAA,IAA1C;IAAEC;EAAkC,CAAC,GAAAD,IAAA;EACpE,MAAM;IAAEE,IAAI;IAAEC,cAAc;IAAEC;EAAW,CAAC,GAAGH,UAAU;EAEvD,QAAQC,IAAI;IACV,KAAK,gBAAgB;MACnB,IAAIC,cAAc,EAAE;QAClB,oBAAOR,KAAA,CAAAU,aAAA,CAACT,0BAA0B;UAACU,aAAa,EAAEH;QAAe,CAAE,CAAC;MACtE;MACA;IACF,KAAK,YAAY;MACf,IAAIC,UAAU,EAAE;QACd,oBACET,KAAA,CAAAU,aAAA,CAACP,cAAc;UACbS,YAAY,EAAEH,UAAU,CAACG,YAAa;UACtCC,gBAAgB,EAAEJ,UAAU,CAACI;QAAiB,gBAE9Cb,KAAA,CAAAU,aAAA,CAACR,sBAAsB;UAACS,aAAa,EAAEF;QAAW,CAAE,CACtC,CAAC;MAErB;MACA;IACF;MACE;EACJ;EAEA,OAAO,IAAI;AACb,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","AutoPatternsCollectionPage","AutoPatternsEntityPage","SchemaProvider","AutoPatternsPage","_ref","pageConfig","type","collectionPage","entityPage","createElement","configuration","collection"],"sources":["../../../../src/components/AutoPatternsRoute/AutoPatternsPage.tsx"],"sourcesContent":["import React from 'react';\nimport { PageConfig } from '../../types';\nimport { AutoPatternsCollectionPage } from '../AutoPatternsCollectionPage';\nimport { AutoPatternsEntityPage } from '../AutoPatternsEntityPage';\nimport { SchemaProvider } from '../../providers/SchemaContext';\n\nexport interface AutoPatternsPageProps {\n pageConfig: PageConfig;\n}\n\nexport const AutoPatternsPage = ({ pageConfig }: AutoPatternsPageProps) => {\n const { type, collectionPage, entityPage } = pageConfig;\n\n switch (type) {\n case 'collectionPage':\n if (collectionPage) {\n return <AutoPatternsCollectionPage configuration={collectionPage} />;\n }\n break;\n case 'entityPage':\n if (entityPage) {\n return (\n <SchemaProvider collection={entityPage}>\n <AutoPatternsEntityPage configuration={entityPage} />\n </SchemaProvider>\n );\n }\n break;\n default:\n break;\n }\n\n return null;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,0BAA0B,QAAQ,+BAA+B;AAC1E,SAASC,sBAAsB,QAAQ,2BAA2B;AAClE,SAASC,cAAc,QAAQ,+BAA+B;AAM9D,OAAO,MAAMC,gBAAgB,GAAGC,IAAA,IAA2C;EAAA,IAA1C;IAAEC;EAAkC,CAAC,GAAAD,IAAA;EACpE,MAAM;IAAEE,IAAI;IAAEC,cAAc;IAAEC;EAAW,CAAC,GAAGH,UAAU;EAEvD,QAAQC,IAAI;IACV,KAAK,gBAAgB;MACnB,IAAIC,cAAc,EAAE;QAClB,oBAAOR,KAAA,CAAAU,aAAA,CAACT,0BAA0B;UAACU,aAAa,EAAEH;QAAe,CAAE,CAAC;MACtE;MACA;IACF,KAAK,YAAY;MACf,IAAIC,UAAU,EAAE;QACd,oBACET,KAAA,CAAAU,aAAA,CAACP,cAAc;UAACS,UAAU,EAAEH;QAAW,gBACrCT,KAAA,CAAAU,aAAA,CAACR,sBAAsB;UAACS,aAAa,EAAEF;QAAW,CAAE,CACtC,CAAC;MAErB;MACA;IACF;MACE;EACJ;EAEA,OAAO,IAAI;AACb,CAAC","ignoreList":[]}
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import { useFilterCollection } from '@wix/patterns';
4
4
  import { useSchemaRegistry } from '../../providers';
5
- import { createDataProvider } from '../../dataSourceAdapters/factory';
5
+ import { fetchCmsData } from '../../dataSourceAdapters/cms/fetchCmsData';
6
6
  export const DynamicCollectionFilter = _ref => {
7
7
  let {
8
8
  filter,
@@ -21,16 +21,10 @@ export const DynamicCollectionFilter = _ref => {
21
21
  total: 0
22
22
  };
23
23
  }
24
- const {
25
- fetchData: fetchFilterData
26
- } = createDataProvider({
27
- collectionId,
28
- entityTypeSource: 'cms',
29
- schema: referencedSchema,
30
- visibleFieldIds: [referencedSchema.displayField],
31
- filtersMapping: {}
24
+ const result = await fetchCmsData(collectionId, query, referencedSchema.fields, {
25
+ searchableFieldIds: [referencedSchema.displayField],
26
+ filterFieldMapping: {}
32
27
  });
33
- const result = await fetchFilterData(query);
34
28
  return {
35
29
  items: result.items.map(item => ({
36
30
  id: item[referencedSchema.idField],
@@ -1 +1 @@
1
- {"version":3,"names":["React","useFilterCollection","useSchemaRegistry","createDataProvider","DynamicCollectionFilter","_ref","filter","collectionId","component","FilterComponent","filterProps","getSchema","referencedSchema","fetchData","useCallback","query","items","total","fetchFilterData","entityTypeSource","schema","visibleFieldIds","displayField","filtersMapping","result","map","item","id","idField","name","collection","queryName","createElement","_extends"],"sources":["../../../../src/components/filters/DynamicCollectionFilter.tsx"],"sourcesContent":["import React from 'react';\nimport { Filter, useFilterCollection } from '@wix/patterns';\nimport { useSchemaRegistry } from '../../providers';\nimport { createDataProvider } from '../../dataSourceAdapters/factory';\n\ninterface DynamicCollectionFilterProps {\n filter: Filter<any>;\n collectionId: string;\n component: React.ElementType;\n componentName?: string;\n [key: string]: any;\n}\n\nexport const DynamicCollectionFilter: React.FC<\n DynamicCollectionFilterProps\n> = ({ filter, collectionId, component: FilterComponent, ...filterProps }) => {\n const { getSchema } = useSchemaRegistry();\n const referencedSchema = getSchema(collectionId);\n\n const fetchData = React.useCallback(\n async (query) => {\n if (!referencedSchema) {\n return { items: [], total: 0 };\n }\n\n const { fetchData: fetchFilterData } = createDataProvider({\n collectionId,\n entityTypeSource: 'cms',\n schema: referencedSchema,\n visibleFieldIds: [referencedSchema.displayField],\n filtersMapping: {},\n });\n\n const result = await fetchFilterData(query);\n return {\n items: result.items.map((item: any) => ({\n id: item[referencedSchema.idField],\n name: item[referencedSchema.displayField],\n })),\n };\n },\n [collectionId, referencedSchema],\n );\n\n const collection = useFilterCollection(filter, {\n queryName: `filter-collection-${collectionId}`,\n fetchData,\n });\n\n return (\n <FilterComponent filter={filter} collection={collection} {...filterProps} />\n );\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAiBC,mBAAmB,QAAQ,eAAe;AAC3D,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SAASC,kBAAkB,QAAQ,kCAAkC;AAUrE,OAAO,MAAMC,uBAEZ,GAAGC,IAAA,IAA0E;EAAA,IAAzE;IAAEC,MAAM;IAAEC,YAAY;IAAEC,SAAS,EAAEC,eAAe;IAAE,GAAGC;EAAY,CAAC,GAAAL,IAAA;EACvE,MAAM;IAAEM;EAAU,CAAC,GAAGT,iBAAiB,CAAC,CAAC;EACzC,MAAMU,gBAAgB,GAAGD,SAAS,CAACJ,YAAY,CAAC;EAEhD,MAAMM,SAAS,GAAGb,KAAK,CAACc,WAAW,CACjC,MAAOC,KAAK,IAAK;IACf,IAAI,CAACH,gBAAgB,EAAE;MACrB,OAAO;QAAEI,KAAK,EAAE,EAAE;QAAEC,KAAK,EAAE;MAAE,CAAC;IAChC;IAEA,MAAM;MAAEJ,SAAS,EAAEK;IAAgB,CAAC,GAAGf,kBAAkB,CAAC;MACxDI,YAAY;MACZY,gBAAgB,EAAE,KAAK;MACvBC,MAAM,EAAER,gBAAgB;MACxBS,eAAe,EAAE,CAACT,gBAAgB,CAACU,YAAY,CAAC;MAChDC,cAAc,EAAE,CAAC;IACnB,CAAC,CAAC;IAEF,MAAMC,MAAM,GAAG,MAAMN,eAAe,CAACH,KAAK,CAAC;IAC3C,OAAO;MACLC,KAAK,EAAEQ,MAAM,CAACR,KAAK,CAACS,GAAG,CAAEC,IAAS,KAAM;QACtCC,EAAE,EAAED,IAAI,CAACd,gBAAgB,CAACgB,OAAO,CAAC;QAClCC,IAAI,EAAEH,IAAI,CAACd,gBAAgB,CAACU,YAAY;MAC1C,CAAC,CAAC;IACJ,CAAC;EACH,CAAC,EACD,CAACf,YAAY,EAAEK,gBAAgB,CACjC,CAAC;EAED,MAAMkB,UAAU,GAAG7B,mBAAmB,CAACK,MAAM,EAAE;IAC7CyB,SAAS,EAAE,qBAAqBxB,YAAY,EAAE;IAC9CM;EACF,CAAC,CAAC;EAEF,oBACEb,KAAA,CAAAgC,aAAA,CAACvB,eAAe,EAAAwB,QAAA;IAAC3B,MAAM,EAAEA,MAAO;IAACwB,UAAU,EAAEA;EAAW,GAAKpB,WAAW,CAAG,CAAC;AAEhF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useFilterCollection","useSchemaRegistry","fetchCmsData","DynamicCollectionFilter","_ref","filter","collectionId","component","FilterComponent","filterProps","getSchema","referencedSchema","fetchData","useCallback","query","items","total","result","fields","searchableFieldIds","displayField","filterFieldMapping","map","item","id","idField","name","collection","queryName","createElement","_extends"],"sources":["../../../../src/components/filters/DynamicCollectionFilter.tsx"],"sourcesContent":["import React from 'react';\nimport { Filter, useFilterCollection } from '@wix/patterns';\nimport { useSchemaRegistry } from '../../providers';\nimport { fetchCmsData } from '../../dataSourceAdapters/cms/fetchCmsData';\n\ninterface DynamicCollectionFilterProps {\n filter: Filter<any>;\n collectionId: string;\n component: React.ElementType;\n componentName?: string;\n [key: string]: any;\n}\n\nexport const DynamicCollectionFilter: React.FC<\n DynamicCollectionFilterProps\n> = ({ filter, collectionId, component: FilterComponent, ...filterProps }) => {\n const { getSchema } = useSchemaRegistry();\n const referencedSchema = getSchema(collectionId);\n\n const fetchData = React.useCallback(\n async (query) => {\n if (!referencedSchema) {\n return { items: [], total: 0 };\n }\n\n const result = await fetchCmsData(\n collectionId,\n query,\n referencedSchema.fields,\n {\n searchableFieldIds: [referencedSchema.displayField],\n filterFieldMapping: {},\n },\n );\n\n return {\n items: result.items.map((item: any) => ({\n id: item[referencedSchema.idField],\n name: item[referencedSchema.displayField],\n })),\n };\n },\n [collectionId, referencedSchema],\n );\n\n const collection = useFilterCollection(filter, {\n queryName: `filter-collection-${collectionId}`,\n fetchData,\n });\n\n return (\n <FilterComponent filter={filter} collection={collection} {...filterProps} />\n );\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAiBC,mBAAmB,QAAQ,eAAe;AAC3D,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SAASC,YAAY,QAAQ,2CAA2C;AAUxE,OAAO,MAAMC,uBAEZ,GAAGC,IAAA,IAA0E;EAAA,IAAzE;IAAEC,MAAM;IAAEC,YAAY;IAAEC,SAAS,EAAEC,eAAe;IAAE,GAAGC;EAAY,CAAC,GAAAL,IAAA;EACvE,MAAM;IAAEM;EAAU,CAAC,GAAGT,iBAAiB,CAAC,CAAC;EACzC,MAAMU,gBAAgB,GAAGD,SAAS,CAACJ,YAAY,CAAC;EAEhD,MAAMM,SAAS,GAAGb,KAAK,CAACc,WAAW,CACjC,MAAOC,KAAK,IAAK;IACf,IAAI,CAACH,gBAAgB,EAAE;MACrB,OAAO;QAAEI,KAAK,EAAE,EAAE;QAAEC,KAAK,EAAE;MAAE,CAAC;IAChC;IAEA,MAAMC,MAAM,GAAG,MAAMf,YAAY,CAC/BI,YAAY,EACZQ,KAAK,EACLH,gBAAgB,CAACO,MAAM,EACvB;MACEC,kBAAkB,EAAE,CAACR,gBAAgB,CAACS,YAAY,CAAC;MACnDC,kBAAkB,EAAE,CAAC;IACvB,CACF,CAAC;IAED,OAAO;MACLN,KAAK,EAAEE,MAAM,CAACF,KAAK,CAACO,GAAG,CAAEC,IAAS,KAAM;QACtCC,EAAE,EAAED,IAAI,CAACZ,gBAAgB,CAACc,OAAO,CAAC;QAClCC,IAAI,EAAEH,IAAI,CAACZ,gBAAgB,CAACS,YAAY;MAC1C,CAAC,CAAC;IACJ,CAAC;EACH,CAAC,EACD,CAACd,YAAY,EAAEK,gBAAgB,CACjC,CAAC;EAED,MAAMgB,UAAU,GAAG3B,mBAAmB,CAACK,MAAM,EAAE;IAC7CuB,SAAS,EAAE,qBAAqBtB,YAAY,EAAE;IAC9CM;EACF,CAAC,CAAC;EAEF,oBACEb,KAAA,CAAA8B,aAAA,CAACrB,eAAe,EAAAsB,QAAA;IAACzB,MAAM,EAAEA,MAAO;IAACsB,UAAU,EAAEA;EAAW,GAAKlB,WAAW,CAAG,CAAC;AAEhF,CAAC","ignoreList":[]}
@@ -1,6 +1,5 @@
1
1
  import { collections, items } from '@wix/data';
2
- import { addFiltersToDataQuery, addSearchToDataQuery } from './filterUtils';
3
- import { addSortToDataQuery } from './sortUtils';
2
+ import { fetchCmsData } from './fetchCmsData';
4
3
  export const CmsFieldTypeToPatternsFieldType = {
5
4
  [collections.Type.TEXT]: 'SHORT_TEXT',
6
5
  [collections.Type.DATE]: 'DATE',
@@ -20,55 +19,56 @@ export const CmsFieldTypeToPatternsFieldType = {
20
19
  export async function fetchCmsSchema(collectionId) {
21
20
  var _schema$fields$find;
22
21
  const schema = await collections.getDataCollection(collectionId);
23
- return {
22
+ const transformedFields = schema.fields.reduce((acc, field) => {
23
+ var _field$capabilities, _field$capabilities2, _field$typeMetadata;
24
+ if (!field.key) {
25
+ return acc;
26
+ }
27
+ const fieldType = field.type ? CmsFieldTypeToPatternsFieldType[field.type] || 'SHORT_TEXT' : 'SHORT_TEXT';
28
+ const baseField = {
29
+ id: field.key,
30
+ displayName: field.displayName || '',
31
+ validation: {
32
+ numberRange: field.numberRange ? {
33
+ min: field.numberRange.min ?? undefined,
34
+ max: field.numberRange.max ?? undefined
35
+ } : undefined,
36
+ stringLengthRange: field.stringLengthRange ? {
37
+ minLength: field.stringLengthRange.minLength ?? undefined,
38
+ maxLength: field.stringLengthRange.maxLength ?? undefined
39
+ } : undefined,
40
+ required: field.required ?? false
41
+ },
42
+ capabilities: {
43
+ supportedQueryOperators: ((_field$capabilities = field.capabilities) == null ? void 0 : _field$capabilities.queryOperators) || [],
44
+ sortable: ((_field$capabilities2 = field.capabilities) == null ? void 0 : _field$capabilities2.sortable) || false
45
+ }
46
+ };
47
+ if (fieldType === 'REFERENCE' && (_field$typeMetadata = field.typeMetadata) != null && (_field$typeMetadata = _field$typeMetadata.reference) != null && _field$typeMetadata.referencedCollectionId) {
48
+ const referenceField = {
49
+ ...baseField,
50
+ type: 'REFERENCE',
51
+ referenceMetadata: {
52
+ referencedCollectionId: field.typeMetadata.reference.referencedCollectionId
53
+ }
54
+ };
55
+ acc[field.key] = referenceField;
56
+ } else {
57
+ const nonReferenceType = fieldType === 'REFERENCE' ? 'SHORT_TEXT' : fieldType;
58
+ const nonReferenceField = {
59
+ ...baseField,
60
+ type: nonReferenceType
61
+ };
62
+ acc[field.key] = nonReferenceField;
63
+ }
64
+ return acc;
65
+ }, {});
66
+ const schemaConfig = {
24
67
  id: collectionId,
25
68
  displayField: schema.displayField ?? '_id',
26
69
  idField: '_id',
27
70
  imageField: (_schema$fields$find = schema.fields.find(field => field.type === 'IMAGE')) == null ? void 0 : _schema$fields$find.key,
28
- fields: schema.fields.reduce((acc, field) => {
29
- var _field$capabilities, _field$capabilities2, _field$typeMetadata;
30
- if (!field.key) {
31
- return acc;
32
- }
33
- const fieldType = field.type ? CmsFieldTypeToPatternsFieldType[field.type] || 'SHORT_TEXT' : 'SHORT_TEXT';
34
- const baseField = {
35
- id: field.key,
36
- displayName: field.displayName || '',
37
- validation: {
38
- numberRange: field.numberRange ? {
39
- min: field.numberRange.min ?? undefined,
40
- max: field.numberRange.max ?? undefined
41
- } : undefined,
42
- stringLengthRange: field.stringLengthRange ? {
43
- minLength: field.stringLengthRange.minLength ?? undefined,
44
- maxLength: field.stringLengthRange.maxLength ?? undefined
45
- } : undefined,
46
- required: field.required ?? false
47
- },
48
- capabilities: {
49
- supportedQueryOperators: ((_field$capabilities = field.capabilities) == null ? void 0 : _field$capabilities.queryOperators) || [],
50
- sortable: ((_field$capabilities2 = field.capabilities) == null ? void 0 : _field$capabilities2.sortable) || false
51
- }
52
- };
53
- if (fieldType === 'REFERENCE' && (_field$typeMetadata = field.typeMetadata) != null && (_field$typeMetadata = _field$typeMetadata.reference) != null && _field$typeMetadata.referencedCollectionId) {
54
- const referenceField = {
55
- ...baseField,
56
- type: 'REFERENCE',
57
- referenceMetadata: {
58
- referencedCollectionId: field.typeMetadata.reference.referencedCollectionId
59
- }
60
- };
61
- acc[field.key] = referenceField;
62
- } else {
63
- const nonReferenceType = fieldType === 'REFERENCE' ? 'SHORT_TEXT' : fieldType;
64
- const nonReferenceField = {
65
- ...baseField,
66
- type: nonReferenceType
67
- };
68
- acc[field.key] = nonReferenceField;
69
- }
70
- return acc;
71
- }, {}),
71
+ fields: transformedFields,
72
72
  actions: {
73
73
  get: entityId => {
74
74
  return items.get(collectionId, entityId);
@@ -84,49 +84,15 @@ export async function fetchCmsSchema(collectionId) {
84
84
  },
85
85
  bulkDelete: entityIds => {
86
86
  return items.bulkRemove(collectionId, entityIds);
87
+ },
88
+ find: async function (query, options) {
89
+ if (options === void 0) {
90
+ options = {};
91
+ }
92
+ return fetchCmsData(collectionId, query, transformedFields, options);
87
93
  }
88
94
  }
89
95
  };
90
- }
91
- export function createCmsDataProvider(_ref) {
92
- let {
93
- collectionId,
94
- schema,
95
- visibleFieldIds,
96
- filtersMapping
97
- } = _ref;
98
- return {
99
- fetchData: async query => {
100
- let dataQuery = items.query(collectionId);
101
- dataQuery = addSearchToDataQuery({
102
- dataQuery,
103
- query,
104
- schema,
105
- visibleFieldIds
106
- });
107
- dataQuery = addFiltersToDataQuery({
108
- dataQuery,
109
- query,
110
- schema,
111
- filtersMapping
112
- });
113
- dataQuery = addSortToDataQuery({
114
- dataQuery,
115
- query,
116
- schema
117
- });
118
- const referenceFieldIds = Object.values(schema.fields).filter(field => !!field && field.type === 'REFERENCE' && visibleFieldIds.includes(field.id)).map(field => field.id);
119
- if (referenceFieldIds.length > 0) {
120
- dataQuery = dataQuery.include(...referenceFieldIds);
121
- }
122
- const res = await dataQuery.skip(query.offset).limit(query.limit).find({
123
- returnTotalCount: true
124
- });
125
- return {
126
- items: res.items,
127
- total: res.totalCount ?? 0
128
- };
129
- }
130
- };
96
+ return schemaConfig;
131
97
  }
132
98
  //# sourceMappingURL=cmsAdapter.js.map