@wix/auto-patterns 1.27.0 → 1.29.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.
- package/dist/cjs/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js +19 -58
- package/dist/cjs/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js.map +1 -1
- package/dist/cjs/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js +1 -1
- package/dist/cjs/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
- package/dist/cjs/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.js +48 -0
- package/dist/cjs/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.js.map +1 -0
- package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js +1 -1
- package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js.map +1 -1
- package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js +1 -1
- package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js.map +1 -1
- package/dist/cjs/components/AutoPatternsRoute/AutoPatternsRoutes.js +11 -7
- package/dist/cjs/components/AutoPatternsRoute/AutoPatternsRoutes.js.map +1 -1
- package/dist/cjs/components/ModalRenderer.js +1 -1
- package/dist/cjs/components/ModalRenderer.js.map +1 -1
- package/dist/cjs/dataSourceAdapters/cms/cmsAdapter.js +5 -0
- package/dist/cjs/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
- package/dist/cjs/dataSourceAdapters/cms/fetchCmsData.js +1 -1
- package/dist/cjs/dataSourceAdapters/cms/fetchCmsData.js.map +1 -1
- package/dist/cjs/hooks/useAutoPatternsOptimisticActions.js +13 -6
- package/dist/cjs/hooks/useAutoPatternsOptimisticActions.js.map +1 -1
- package/dist/cjs/hooks/useBaseCollectionParams.js +38 -0
- package/dist/cjs/hooks/useBaseCollectionParams.js.map +1 -0
- package/dist/cjs/hooks/useBaseSDK.js +1 -1
- package/dist/cjs/hooks/useBaseSDK.js.map +1 -1
- package/dist/cjs/hooks/useColumns.js +1 -1
- package/dist/cjs/hooks/useColumns.js.map +1 -1
- package/dist/cjs/hooks/useCommonCollectionFeatures.js +13 -6
- package/dist/cjs/hooks/useCommonCollectionFeatures.js.map +1 -1
- package/dist/cjs/hooks/useEmptyStates.js +1 -1
- package/dist/cjs/hooks/useEmptyStates.js.map +1 -1
- package/dist/cjs/hooks/useEntityPageHeaderTexts.js +2 -2
- package/dist/cjs/hooks/useEntityPageHeaderTexts.js.map +1 -1
- package/dist/cjs/hooks/useFetchData.js +4 -5
- package/dist/cjs/hooks/useFetchData.js.map +1 -1
- package/dist/cjs/hooks/useFilters.js +2 -2
- package/dist/cjs/hooks/useFilters.js.map +1 -1
- package/dist/cjs/hooks/useGridFeatures.js +6 -26
- package/dist/cjs/hooks/useGridFeatures.js.map +1 -1
- package/dist/cjs/hooks/useTableFeatures.js +8 -28
- package/dist/cjs/hooks/useTableFeatures.js.map +1 -1
- package/dist/cjs/hooks/useTableGridSwitchFeatures.js +8 -28
- package/dist/cjs/hooks/useTableGridSwitchFeatures.js.map +1 -1
- package/dist/cjs/providers/{PatternsWizardOverridesContext.js → AutoPatternsOverridesContext.js} +14 -11
- package/dist/cjs/providers/AutoPatternsOverridesContext.js.map +1 -0
- package/dist/cjs/providers/SchemaContext.js +24 -7
- package/dist/cjs/providers/SchemaContext.js.map +1 -1
- package/dist/cjs/providers/index.js +4 -4
- package/dist/cjs/providers/index.js.map +1 -1
- package/dist/cjs/types/BaseSDK.js.map +1 -1
- package/dist/cjs/types/CollectionPageConfig.js.map +1 -1
- package/dist/cjs/types/actions/base.js.map +1 -1
- package/dist/cjs/types/fetchData.js +4 -0
- package/dist/cjs/types/fetchData.js.map +1 -0
- package/dist/cjs/types/index.js +6 -0
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/types/types.js.map +1 -1
- package/dist/cjs/utils/actions/resolveAction.js +2 -1
- package/dist/cjs/utils/actions/resolveAction.js.map +1 -1
- package/dist/cjs/utils/actions/types.js.map +1 -1
- package/dist/cjs/utils/vibe.js +11 -0
- package/dist/cjs/utils/vibe.js.map +1 -0
- package/dist/docs/action_cell.md +18 -8
- package/dist/docs/app_config_structure.md +37 -1
- package/dist/docs/app_context.md +45 -0
- package/dist/docs/auto-patterns-guide.md +331 -82
- package/dist/docs/bulk_actions.md +10 -5
- package/dist/docs/collection_page.md +1 -1
- package/dist/docs/collection_page_actions.md +16 -9
- package/dist/docs/custom_overrides.md +22 -36
- package/dist/docs/entity_page.md +10 -10
- package/dist/docs/entity_page_actions.md +11 -4
- package/dist/docs/error_handling.md +135 -0
- package/dist/docs/index.md +8 -0
- package/dist/docs/installation.md +3 -3
- package/dist/docs/resolved_action.md +6 -2
- package/dist/docs/schema_config.md +11 -3
- package/dist/docs/wix_fqdn_custom_data_source.md +51 -9
- package/dist/esm/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js +2 -25
- package/dist/esm/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js.map +1 -1
- package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js +2 -2
- package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
- package/dist/esm/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.js +29 -0
- package/dist/esm/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.js.map +1 -0
- package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js +2 -2
- package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js +2 -2
- package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js.map +1 -1
- package/dist/esm/components/AutoPatternsRoute/AutoPatternsRoutes.js +5 -1
- package/dist/esm/components/AutoPatternsRoute/AutoPatternsRoutes.js.map +1 -1
- package/dist/esm/components/ModalRenderer.js +2 -2
- package/dist/esm/components/ModalRenderer.js.map +1 -1
- package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js +4 -0
- package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
- package/dist/esm/dataSourceAdapters/cms/fetchCmsData.js +1 -1
- package/dist/esm/dataSourceAdapters/cms/fetchCmsData.js.map +1 -1
- package/dist/esm/hooks/useAutoPatternsOptimisticActions.js +14 -9
- package/dist/esm/hooks/useAutoPatternsOptimisticActions.js.map +1 -1
- package/dist/esm/hooks/useBaseCollectionParams.js +37 -0
- package/dist/esm/hooks/useBaseCollectionParams.js.map +1 -0
- package/dist/esm/hooks/useBaseSDK.js +2 -2
- package/dist/esm/hooks/useBaseSDK.js.map +1 -1
- package/dist/esm/hooks/useColumns.js +2 -2
- package/dist/esm/hooks/useColumns.js.map +1 -1
- package/dist/esm/hooks/useCommonCollectionFeatures.js +9 -2
- package/dist/esm/hooks/useCommonCollectionFeatures.js.map +1 -1
- package/dist/esm/hooks/useEmptyStates.js +2 -2
- package/dist/esm/hooks/useEmptyStates.js.map +1 -1
- package/dist/esm/hooks/useEntityPageHeaderTexts.js +2 -2
- package/dist/esm/hooks/useEntityPageHeaderTexts.js.map +1 -1
- package/dist/esm/hooks/useFetchData.js +2 -2
- package/dist/esm/hooks/useFetchData.js.map +1 -1
- package/dist/esm/hooks/useFilters.js +2 -2
- package/dist/esm/hooks/useFilters.js.map +1 -1
- package/dist/esm/hooks/useGridFeatures.js +6 -29
- package/dist/esm/hooks/useGridFeatures.js.map +1 -1
- package/dist/esm/hooks/useTableFeatures.js +8 -31
- package/dist/esm/hooks/useTableFeatures.js.map +1 -1
- package/dist/esm/hooks/useTableGridSwitchFeatures.js +8 -31
- package/dist/esm/hooks/useTableGridSwitchFeatures.js.map +1 -1
- package/dist/esm/providers/AutoPatternsOverridesContext.js +19 -0
- package/dist/esm/providers/AutoPatternsOverridesContext.js.map +1 -0
- package/dist/esm/providers/SchemaContext.js +23 -6
- package/dist/esm/providers/SchemaContext.js.map +1 -1
- package/dist/esm/providers/index.js +1 -1
- package/dist/esm/providers/index.js.map +1 -1
- package/dist/esm/types/BaseSDK.js.map +1 -1
- package/dist/esm/types/CollectionPageConfig.js.map +1 -1
- package/dist/esm/types/actions/base.js.map +1 -1
- package/dist/esm/types/fetchData.js +2 -0
- package/dist/esm/types/fetchData.js.map +1 -0
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm/types/types.js.map +1 -1
- package/dist/esm/utils/actions/resolveAction.js +2 -1
- package/dist/esm/utils/actions/resolveAction.js.map +1 -1
- package/dist/esm/utils/actions/types.js.map +1 -1
- package/dist/esm/utils/vibe.js +6 -0
- package/dist/esm/utils/vibe.js.map +1 -0
- package/dist/types/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.d.ts +3 -0
- package/dist/types/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsRoute/AutoPatternsRoutes.d.ts.map +1 -1
- package/dist/types/dataSourceAdapters/cms/cmsAdapter.d.ts +2 -1
- package/dist/types/dataSourceAdapters/cms/cmsAdapter.d.ts.map +1 -1
- package/dist/types/hooks/useAutoPatternsOptimisticActions.d.ts +7 -1
- package/dist/types/hooks/useAutoPatternsOptimisticActions.d.ts.map +1 -1
- package/dist/types/hooks/useBaseCollectionParams.d.ts +27 -0
- package/dist/types/hooks/useBaseCollectionParams.d.ts.map +1 -0
- package/dist/types/hooks/useCommonCollectionFeatures.d.ts +4 -3
- package/dist/types/hooks/useCommonCollectionFeatures.d.ts.map +1 -1
- package/dist/types/hooks/useEntityPageHeaderTexts.d.ts.map +1 -1
- package/dist/types/hooks/useFetchData.d.ts +3 -13
- package/dist/types/hooks/useFetchData.d.ts.map +1 -1
- package/dist/types/hooks/useGridFeatures.d.ts +1 -1
- package/dist/types/hooks/useGridFeatures.d.ts.map +1 -1
- package/dist/types/hooks/useTableFeatures.d.ts +1 -1
- package/dist/types/hooks/useTableFeatures.d.ts.map +1 -1
- package/dist/types/hooks/useTableGridSwitchFeatures.d.ts +1 -1
- package/dist/types/hooks/useTableGridSwitchFeatures.d.ts.map +1 -1
- package/dist/types/providers/{PatternsWizardOverridesContext.d.ts → AutoPatternsOverridesContext.d.ts} +14 -5
- package/dist/types/providers/AutoPatternsOverridesContext.d.ts.map +1 -0
- package/dist/types/providers/SchemaContext.d.ts.map +1 -1
- package/dist/types/providers/index.d.ts +1 -1
- package/dist/types/providers/index.d.ts.map +1 -1
- package/dist/types/types/BaseSDK.d.ts +2 -2
- package/dist/types/types/BaseSDK.d.ts.map +1 -1
- package/dist/types/types/CollectionPageConfig.d.ts +4 -0
- package/dist/types/types/CollectionPageConfig.d.ts.map +1 -1
- package/dist/types/types/actions/base.d.ts +1 -0
- package/dist/types/types/actions/base.d.ts.map +1 -1
- package/dist/types/types/fetchData.d.ts +21 -0
- package/dist/types/types/fetchData.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/types/types.d.ts +12 -7
- package/dist/types/types/types.d.ts.map +1 -1
- package/dist/types/utils/actions/resolveAction.d.ts +1 -0
- package/dist/types/utils/actions/resolveAction.d.ts.map +1 -1
- package/dist/types/utils/actions/types.d.ts +1 -0
- package/dist/types/utils/actions/types.d.ts.map +1 -1
- package/dist/types/utils/vibe.d.ts +2 -0
- package/dist/types/utils/vibe.d.ts.map +1 -0
- package/package.json +10 -10
- package/dist/cjs/dataSourceAdapters/factory.js +0 -14
- package/dist/cjs/dataSourceAdapters/factory.js.map +0 -1
- package/dist/cjs/providers/PatternsWizardOverridesContext.js.map +0 -1
- package/dist/esm/dataSourceAdapters/factory.js +0 -10
- package/dist/esm/dataSourceAdapters/factory.js.map +0 -1
- package/dist/esm/providers/PatternsWizardOverridesContext.js +0 -15
- package/dist/esm/providers/PatternsWizardOverridesContext.js.map +0 -1
- package/dist/types/dataSourceAdapters/factory.d.ts +0 -3
- package/dist/types/dataSourceAdapters/factory.d.ts.map +0 -1
- package/dist/types/providers/PatternsWizardOverridesContext.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_useFetchData","require","_patterns","_useCommonCollectionFeatures","_useFilters","
|
|
1
|
+
{"version":3,"names":["_useFetchData","require","_patterns","_useCommonCollectionFeatures","_useFilters","_useBaseTableFeatures","_AutoPatternsOverridesContext","_useBaseCollectionParams","_useUpdateAppContextItems","useTableFeatures","configuration","_configuration$sectio","_overrides$sections","filterComponent","filtersObject","filterFieldMapping","useFilters","filters","customColumns","visibleFieldIds","columns","onRowClick","stickyColumns","stickySelectionColumn","showTitleBar","useBaseTableFeatures","fetchData","useFetchData","searchableFieldIds","overrides","useAutoPatternsOverridesContext","params","useBaseCollectionParams","config","collection","state","useTableCollection","items","useSelector","result","useUpdateAppContextItems","commonFeatures","useCommonCollectionFeatures","collectionState","sections","id","renderSection","TableSections","undefined","exports"],"sources":["../../../src/hooks/useTableFeatures.tsx"],"sourcesContent":["import { TableConfig } from '../types';\nimport { useFetchData } from './useFetchData';\nimport { TableSections, useSelector, useTableCollection } from '@wix/patterns';\nimport { useCommonCollectionFeatures } from './useCommonCollectionFeatures';\nimport { useFilters } from './useFilters';\nimport { useBaseTableFeatures } from './useBaseTableFeatures';\nimport { useAutoPatternsOverridesContext } from '../providers/AutoPatternsOverridesContext';\nimport { useBaseCollectionParams } from './useBaseCollectionParams';\nimport { useUpdateAppContextItems } from './useUpdateAppContextItems';\n\nexport const useTableFeatures = (configuration: TableConfig) => {\n const { filterComponent, filtersObject, filterFieldMapping } = useFilters(\n configuration.filters,\n );\n const {\n customColumns,\n visibleFieldIds,\n columns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n showTitleBar,\n } = useBaseTableFeatures(configuration);\n\n const { fetchData } = useFetchData({\n searchableFieldIds: visibleFieldIds,\n filterFieldMapping,\n });\n\n const overrides = useAutoPatternsOverridesContext();\n\n const params = useBaseCollectionParams({\n config: configuration.collection,\n fetchData,\n filters: filtersObject,\n });\n\n const state = useTableCollection<any>(params);\n const items = useSelector(() => state.collection.result.items);\n useUpdateAppContextItems(items);\n\n const commonFeatures = useCommonCollectionFeatures({\n ...configuration,\n collectionState: state.collection,\n });\n\n const sections =\n configuration.sections?.id &&\n overrides?.sections?.[configuration.sections.id]\n ? {\n renderSection: overrides.sections[configuration.sections.id],\n TableSections,\n }\n : undefined;\n\n return {\n ...commonFeatures,\n state,\n columns,\n filters: filterComponent,\n customColumns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n showTitleBar,\n sections,\n };\n};\n"],"mappings":";;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,4BAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,qBAAA,GAAAJ,OAAA;AACA,IAAAK,6BAAA,GAAAL,OAAA;AACA,IAAAM,wBAAA,GAAAN,OAAA;AACA,IAAAO,yBAAA,GAAAP,OAAA;AAEO,MAAMQ,gBAAgB,GAAIC,aAA0B,IAAK;EAAA,IAAAC,qBAAA,EAAAC,mBAAA;EAC9D,MAAM;IAAEC,eAAe;IAAEC,aAAa;IAAEC;EAAmB,CAAC,GAAG,IAAAC,sBAAU,EACvEN,aAAa,CAACO,OAChB,CAAC;EACD,MAAM;IACJC,aAAa;IACbC,eAAe;IACfC,OAAO;IACPC,UAAU;IACVC,aAAa;IACbC,qBAAqB;IACrBC;EACF,CAAC,GAAG,IAAAC,0CAAoB,EAACf,aAAa,CAAC;EAEvC,MAAM;IAAEgB;EAAU,CAAC,GAAG,IAAAC,0BAAY,EAA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wix/patterns");
|
|
7
7
|
var _useCommonCollectionFeatures = require("./useCommonCollectionFeatures");
|
|
8
8
|
var _useFilters = require("./useFilters");
|
|
9
|
-
var _SchemaContext = require("../providers/SchemaContext");
|
|
10
|
-
var _useAutoPatternsOptimisticActions = require("./useAutoPatternsOptimisticActions");
|
|
11
9
|
var _useBaseGridFeatures = require("./useBaseGridFeatures");
|
|
12
10
|
var _useBaseTableFeatures = require("./useBaseTableFeatures");
|
|
11
|
+
var _useBaseCollectionParams = require("./useBaseCollectionParams");
|
|
13
12
|
var _useUpdateAppContextItems = require("./useUpdateAppContextItems");
|
|
14
13
|
const useTableGridSwitchFeatures = config => {
|
|
15
|
-
const schema = (0, _SchemaContext.useSchema)();
|
|
16
|
-
const {
|
|
17
|
-
collectionId,
|
|
18
|
-
limit,
|
|
19
|
-
reflectQueryInUrl,
|
|
20
|
-
selectAllScope,
|
|
21
|
-
selectionUpdateMode
|
|
22
|
-
} = config.collection;
|
|
23
14
|
const {
|
|
24
15
|
filterComponent,
|
|
25
16
|
filtersObject,
|
|
@@ -41,39 +32,28 @@ const useTableGridSwitchFeatures = config => {
|
|
|
41
32
|
showTitleBar
|
|
42
33
|
} = (0, _useBaseTableFeatures.useBaseTableFeatures)(config);
|
|
43
34
|
const {
|
|
44
|
-
fetchData
|
|
35
|
+
fetchData
|
|
45
36
|
} = (0, _useFetchData.useFetchData)({
|
|
46
37
|
searchableFieldIds: Array.from(new Set([...tableVisibleFieldIds, ...gridVisibleFieldIds])),
|
|
47
38
|
filterFieldMapping
|
|
48
39
|
});
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
filters: filtersObject,
|
|
54
|
-
toExtendedFields: item => item.extendedFields,
|
|
55
|
-
fetchErrorMessage: ({
|
|
56
|
-
err
|
|
57
|
-
}) => String(err),
|
|
58
|
-
fetchData: tableFetchData,
|
|
59
|
-
limit,
|
|
60
|
-
persistQueryToUrl: reflectQueryInUrl,
|
|
61
|
-
disableAutoSelectAllCount: selectAllScope === 'page',
|
|
62
|
-
selectionConsistencyMode: selectionUpdateMode
|
|
40
|
+
const params = (0, _useBaseCollectionParams.useBaseCollectionParams)({
|
|
41
|
+
config: config.collection,
|
|
42
|
+
fetchData,
|
|
43
|
+
filters: filtersObject
|
|
63
44
|
});
|
|
45
|
+
const state = (0, _patterns.useTableGridSwitchCollection)(params);
|
|
64
46
|
const items = (0, _patterns.useSelector)(() => state.collection.result.items);
|
|
65
47
|
(0, _useUpdateAppContextItems.useUpdateAppContextItems)(items);
|
|
66
|
-
const optimisticActions = (0, _useAutoPatternsOptimisticActions.useAutoPatternsOptimisticActions)(collectionId, state.collection);
|
|
67
48
|
const commonFeatures = (0, _useCommonCollectionFeatures.useCommonCollectionFeatures)({
|
|
68
49
|
...config,
|
|
69
|
-
|
|
50
|
+
collectionState: state.collection
|
|
70
51
|
});
|
|
71
52
|
return {
|
|
72
53
|
...commonFeatures,
|
|
73
54
|
state,
|
|
74
55
|
columns: tableColumns,
|
|
75
56
|
filters: filterComponent,
|
|
76
|
-
optimisticActions,
|
|
77
57
|
customColumns,
|
|
78
58
|
onRowClick,
|
|
79
59
|
stickyColumns,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_useFetchData","require","_patterns","_useCommonCollectionFeatures","_useFilters","
|
|
1
|
+
{"version":3,"names":["_useFetchData","require","_patterns","_useCommonCollectionFeatures","_useFilters","_useBaseGridFeatures","_useBaseTableFeatures","_useBaseCollectionParams","_useUpdateAppContextItems","useTableGridSwitchFeatures","config","filterComponent","filtersObject","filterFieldMapping","useFilters","filters","preset","imagePlacement","visibleFieldIds","gridVisibleFieldIds","renderItem","useBaseGridFeatures","customColumns","tableVisibleFieldIds","columns","tableColumns","onRowClick","stickyColumns","stickySelectionColumn","showTitleBar","useBaseTableFeatures","fetchData","useFetchData","searchableFieldIds","Array","from","Set","params","useBaseCollectionParams","collection","state","useTableGridSwitchCollection","items","useSelector","result","useUpdateAppContextItems","commonFeatures","useCommonCollectionFeatures","collectionState","horizontalScroll","exports"],"sources":["../../../src/hooks/useTableGridSwitchFeatures.tsx"],"sourcesContent":["import { TableGridSwitchConfig } from '../types';\nimport { useFetchData } from './useFetchData';\nimport { useSelector, useTableGridSwitchCollection } from '@wix/patterns';\nimport { useCommonCollectionFeatures } from './useCommonCollectionFeatures';\nimport { useFilters } from './useFilters';\nimport { useBaseGridFeatures } from './useBaseGridFeatures';\nimport { useBaseTableFeatures } from './useBaseTableFeatures';\nimport { useBaseCollectionParams } from './useBaseCollectionParams';\nimport { useUpdateAppContextItems } from './useUpdateAppContextItems';\n\nexport const useTableGridSwitchFeatures = (config: TableGridSwitchConfig) => {\n const { filterComponent, filtersObject, filterFieldMapping } = useFilters(\n config.filters,\n );\n\n const {\n preset,\n imagePlacement,\n visibleFieldIds: gridVisibleFieldIds,\n renderItem,\n } = useBaseGridFeatures(config);\n\n const {\n customColumns,\n visibleFieldIds: tableVisibleFieldIds,\n columns: tableColumns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n showTitleBar,\n } = useBaseTableFeatures(config);\n\n const { fetchData } = useFetchData({\n searchableFieldIds: Array.from(\n new Set([...tableVisibleFieldIds, ...gridVisibleFieldIds]),\n ),\n filterFieldMapping,\n });\n\n const params = useBaseCollectionParams({\n config: config.collection,\n fetchData,\n filters: filtersObject,\n });\n\n const state = useTableGridSwitchCollection<any>(params);\n const items = useSelector(() => state.collection.result.items);\n useUpdateAppContextItems(items);\n\n const commonFeatures = useCommonCollectionFeatures({\n ...config,\n collectionState: state.collection,\n });\n\n return {\n ...commonFeatures,\n state,\n columns: tableColumns,\n filters: filterComponent,\n customColumns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n horizontalScroll: true,\n // Grid specific features\n imagePlacement,\n preset,\n renderItem,\n showTitleBar,\n };\n};\n"],"mappings":";;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,4BAAA,G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AC;IACjD,GAAGrC,MAAM;IACTsC,eAAe,EAAER,KAAK,CAACD;EACzB,CAAC,CAAC;EAEF,OAAO;IACL,GAAGO,cAAc;IACjBN,KAAK;IACLhB,OAAO,EAAEC,YAAY;IACrBV,OAAO,EAAEJ,eAAe;IACxBW,aAAa;IACbI,UAAU;IACVC,aAAa;IACbC,qBAAqB;IACrBqB,gBAAgB,EAAE,IAAI;IACtB;IACAhC,cAAc;IACdD,MAAM;IACNI,UAAU;IACVS;EACF,CAAC;AACH,CAAC;AAACqB,OAAA,CAAAzC,0BAAA,GAAAA,0BAAA","ignoreList":[]}
|
package/dist/cjs/providers/{PatternsWizardOverridesContext.js → AutoPatternsOverridesContext.js}
RENAMED
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.
|
|
4
|
+
exports.useAutoPatternsOverridesContext = exports.PatternsWizardOverridesProvider = exports.AutoPatternsOverridesProvider = void 0;
|
|
5
5
|
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
-
var _jsxFileName = "/home/builduser/work/73d19ce3378ce4dd/packages/auto-patterns/dist/cjs/providers/
|
|
6
|
+
var _jsxFileName = "/home/builduser/work/73d19ce3378ce4dd/packages/auto-patterns/dist/cjs/providers/AutoPatternsOverridesContext.tsx";
|
|
7
7
|
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); }
|
|
8
8
|
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; }
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const AutoPatternsOverridesContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
10
|
+
const AutoPatternsOverridesProvider = ({
|
|
11
11
|
children,
|
|
12
12
|
value
|
|
13
13
|
}) => {
|
|
14
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
14
|
+
return /*#__PURE__*/_react.default.createElement(AutoPatternsOverridesContext.Provider, {
|
|
15
15
|
value: value,
|
|
16
16
|
__self: void 0,
|
|
17
17
|
__source: {
|
|
18
18
|
fileName: _jsxFileName,
|
|
19
|
-
lineNumber:
|
|
19
|
+
lineNumber: 67,
|
|
20
20
|
columnNumber: 5
|
|
21
21
|
}
|
|
22
22
|
}, children);
|
|
23
23
|
};
|
|
24
|
-
exports.
|
|
25
|
-
const
|
|
26
|
-
return (0, _react.useContext)(
|
|
24
|
+
exports.AutoPatternsOverridesProvider = AutoPatternsOverridesProvider;
|
|
25
|
+
const useAutoPatternsOverridesContext = () => {
|
|
26
|
+
return (0, _react.useContext)(AutoPatternsOverridesContext);
|
|
27
27
|
};
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
|
|
29
|
+
// For backwards compatibility
|
|
30
|
+
exports.useAutoPatternsOverridesContext = useAutoPatternsOverridesContext;
|
|
31
|
+
const PatternsWizardOverridesProvider = exports.PatternsWizardOverridesProvider = AutoPatternsOverridesProvider;
|
|
32
|
+
//# sourceMappingURL=AutoPatternsOverridesContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_jsxFileName","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","AutoPatternsOverridesContext","createContext","undefined","AutoPatternsOverridesProvider","children","value","createElement","Provider","__self","__source","fileName","lineNumber","columnNumber","exports","useAutoPatternsOverridesContext","useContext","PatternsWizardOverridesProvider"],"sources":["../../../src/providers/AutoPatternsOverridesContext.tsx"],"sourcesContent":["import React, { createContext, useContext, ReactNode } from 'react';\nimport {\n CustomComponentProps,\n CustomActionCellPrimaryActionResolver,\n CustomActionCellSecondaryActionResolver,\n CustomEntityPageActionResolver,\n CustomBulkActionsActionResolver,\n CustomActionCollectionPageActionResolver,\n CustomActionCollectionPageActionOnRowClickResolver,\n IColumnValue,\n SchemaConfig,\n} from '../types';\n\nimport { Section, useOptimisticActions } from '@wix/patterns';\nimport { BadgeSkin, IconElement } from '@wix/design-system';\nimport { collections } from '@wix/data';\n\nexport interface AutoPatternsOverridesContextProps {\n actions?: Record<\n string,\n | CustomActionCellPrimaryActionResolver\n | CustomActionCellSecondaryActionResolver\n | CustomBulkActionsActionResolver\n | CustomEntityPageActionResolver\n | CustomActionCollectionPageActionResolver\n | CustomActionCollectionPageActionOnRowClickResolver\n >;\n columns?: Record<string, (props: IColumnValue<any>) => void>;\n modals?: Record<string, React.FC<any>>;\n emptyState?: Record<string, () => void>;\n components?: Record<string, React.FC<CustomComponentProps>>;\n slots?: Record<string, React.FC>;\n entityPageHeaderSubtitle?: Record<\n string,\n (entity: Record<string, any>) => { text: string }\n >;\n entityPageHeaderBadges?: Record<\n string,\n (entity: Record<string, any>) => {\n text: string;\n skin?: BadgeSkin;\n prefixIcon?: IconElement;\n suffixIcon?: IconElement;\n }[]\n >;\n customDataSources?: Record<\n string,\n (collectionId: string, context: any) => Promise<SchemaConfig>\n >;\n cmsSchema?: Record<string, collections.DataCollection>;\n sections?: Record<string, (item: any) => Section>;\n optimisticActions?: Record<\n string,\n Parameters<typeof useOptimisticActions>[1]\n >;\n}\n\nconst AutoPatternsOverridesContext = createContext<\n AutoPatternsOverridesContextProps | undefined\n>(undefined);\n\nexport const AutoPatternsOverridesProvider: React.FC<{\n children: ReactNode;\n value: AutoPatternsOverridesContextProps;\n}> = ({ children, value }) => {\n return (\n <AutoPatternsOverridesContext.Provider value={value}>\n {children}\n </AutoPatternsOverridesContext.Provider>\n );\n};\n\nexport const useAutoPatternsOverridesContext = ():\n | AutoPatternsOverridesContextProps\n | undefined => {\n return useContext(AutoPatternsOverridesContext);\n};\n\n// For backwards compatibility\nexport interface PatternsWizardOverridesContextProps\n extends AutoPatternsOverridesContextProps {}\nexport const PatternsWizardOverridesProvider = AutoPatternsOverridesProvider;\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAoE,IAAAC,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,SAAAJ,wBAAAI,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,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAyDpE,MAAMW,4BAA4B,gBAAG,IAAAC,oBAAa,EAEhDC,SAAS,CAAC;AAEL,MAAMC,6BAGX,GAAGA,CAAC;EAAEC,QAAQ;EAAEC;AAAM,CAAC,KAAK;EAC5B,oBACE7B,MAAA,CAAAU,OAAA,CAAAoB,aAAA,CAACN,4BAA4B,CAACO,QAAQ;IAACF,KAAK,EAAEA,KAAM;IAAAG,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAA/B,YAAA;MAAAgC,UAAA;MAAAC,YAAA;IAAA;EAAA,GACjDR,QACoC,CAAC;AAE5C,CAAC;AAACS,OAAA,CAAAV,6BAAA,GAAAA,6BAAA;AAEK,MAAMW,+BAA+B,GAAGA,CAAA,KAE9B;EACf,OAAO,IAAAC,iBAAU,EAACf,4BAA4B,CAAC;AACjD,CAAC;;AAED;AAAAa,OAAA,CAAAC,+BAAA,GAAAA,+BAAA;AAGO,MAAME,+BAA+B,GAAAH,OAAA,CAAAG,+BAAA,GAAGb,6BAA6B","ignoreList":[]}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.useSchema = exports.SchemaProvider = void 0;
|
|
5
5
|
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
-
var _factory = require("../dataSourceAdapters/factory");
|
|
7
6
|
var _SchemaRegistryContext = require("./SchemaRegistryContext");
|
|
8
|
-
var
|
|
7
|
+
var _AutoPatternsOverridesContext = require("./AutoPatternsOverridesContext");
|
|
9
8
|
var _patterns = require("@wix/patterns");
|
|
10
9
|
var _ErrorContext = require("./ErrorContext");
|
|
10
|
+
var _cmsAdapter = require("../dataSourceAdapters/cms/cmsAdapter");
|
|
11
11
|
var _jsxFileName = "/home/builduser/work/73d19ce3378ce4dd/packages/auto-patterns/dist/cjs/providers/SchemaContext.tsx";
|
|
12
12
|
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); }
|
|
13
13
|
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; }
|
|
@@ -32,14 +32,28 @@ const SchemaProvider = ({
|
|
|
32
32
|
} = (0, _ErrorContext.useError)();
|
|
33
33
|
const [schema, setSchema] = (0, _react.useState)(null);
|
|
34
34
|
const [isLoading, setIsLoading] = (0, _react.useState)(false);
|
|
35
|
-
const overrides = (0,
|
|
35
|
+
const overrides = (0, _AutoPatternsOverridesContext.useAutoPatternsOverridesContext)();
|
|
36
36
|
const {
|
|
37
37
|
httpClient
|
|
38
38
|
} = (0, _patterns.useWixPatternsContainer)();
|
|
39
39
|
(0, _react.useEffect)(() => {
|
|
40
|
+
const getSchema = async collectionConfig => {
|
|
41
|
+
var _collectionConfig$cms, _overrides$cmsSchema;
|
|
42
|
+
switch (collectionConfig.entityTypeSource) {
|
|
43
|
+
case 'cms':
|
|
44
|
+
const schemaInput = (_collectionConfig$cms = collectionConfig.cms) != null && (_collectionConfig$cms = _collectionConfig$cms.schema) != null && _collectionConfig$cms.id ? overrides == null || (_overrides$cmsSchema = overrides.cmsSchema) == null ? void 0 : _overrides$cmsSchema[collectionConfig.cms.schema.id] : null;
|
|
45
|
+
const currentSchema = schemaInput || (await (0, _cmsAdapter.fetchCmsSchema)(collectionConfig.collectionId));
|
|
46
|
+
return (0, _cmsAdapter.transformCmsSchema)(currentSchema);
|
|
47
|
+
default:
|
|
48
|
+
throw new Error(`Unsupported entityTypeSource: ${collectionConfig.entityTypeSource}`);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
40
51
|
const fetchSchemaForCollection = async (targetCollectionId, targetCustomDataSourceId) => {
|
|
41
|
-
if (entityTypeSource === 'custom'
|
|
42
|
-
|
|
52
|
+
if (entityTypeSource === 'custom') {
|
|
53
|
+
if (!targetCustomDataSourceId || !(overrides != null && overrides.customDataSources)) {
|
|
54
|
+
throw new Error('Custom data source not found');
|
|
55
|
+
}
|
|
56
|
+
const customSchemaProvider = overrides == null ? void 0 : overrides.customDataSources[targetCustomDataSourceId];
|
|
43
57
|
if (customSchemaProvider) {
|
|
44
58
|
return customSchemaProvider(targetCollectionId, {
|
|
45
59
|
httpClient
|
|
@@ -47,7 +61,10 @@ const SchemaProvider = ({
|
|
|
47
61
|
}
|
|
48
62
|
throw new Error(`Custom schema provider '${targetCustomDataSourceId}' not found`);
|
|
49
63
|
}
|
|
50
|
-
return
|
|
64
|
+
return getSchema({
|
|
65
|
+
collectionId: targetCollectionId,
|
|
66
|
+
entityTypeSource
|
|
67
|
+
});
|
|
51
68
|
};
|
|
52
69
|
const fetchReferencedSchemas = async referencedSchema => {
|
|
53
70
|
const referencedCollectionIds = new Set();
|
|
@@ -100,7 +117,7 @@ const SchemaProvider = ({
|
|
|
100
117
|
__self: void 0,
|
|
101
118
|
__source: {
|
|
102
119
|
fileName: _jsxFileName,
|
|
103
|
-
lineNumber:
|
|
120
|
+
lineNumber: 165,
|
|
104
121
|
columnNumber: 5
|
|
105
122
|
}
|
|
106
123
|
}, children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_factory","_SchemaRegistryContext","_PatternsWizardOverridesContext","_patterns","_ErrorContext","_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","skeleton","_collection$custom","collectionId","entityTypeSource","customDataSourceId","custom","id","undefined","getSchema","getSchemaFromRegistry","addSchema","addSchemaToRegistry","useSchemaRegistry","showError","useError","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';\nimport { useError } from './ErrorContext';\n\nconst SchemaContext = createContext<SchemaConfig | null>(null);\n\ninterface SchemaProviderProps {\n collection: BaseCollectionConfig;\n children: ReactNode;\n skeleton: JSX.Element;\n}\n\nexport const SchemaProvider = ({\n collection,\n children,\n skeleton,\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 { showError } = useError();\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 showError(error);\n })\n .finally(() => {\n setIsLoading(false);\n });\n }, [\n collectionId,\n entityTypeSource,\n customDataSourceId,\n addSchemaToRegistry,\n getSchemaFromRegistry,\n overrides,\n httpClient,\n showError,\n ]);\n if (!schema || isLoading) {\n return skeleton;\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;AACA,IAAAK,aAAA,GAAAL,OAAA;AAA0C,IAAAM,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,SAAAT,wBAAAS,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,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,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A;IAAAC,QAAA;MAAAC,QAAA,EAAA1F,YAAA;MAAA2F,UAAA;MAAAC,YAAA;IAAA;EAAA,GAAEnE,QAAiC,CAAC;AAE9E,CAAC;AAACoE,OAAA,CAAAtE,cAAA,GAAAA,cAAA;AAEK,MAAMuE,SAAS,GAAGA,CAAA,KAAoB;EAC3C,MAAMC,OAAO,GAAG,IAAAC,iBAAU,EAAC3E,aAAa,CAAC;EACzC,IAAI,CAAC0E,OAAO,EAAE;IACZ,MAAM,IAAIvC,KAAK,CAAC,gDAAgD,CAAC;EACnE;EACA,OAAOuC,OAAO;AAChB,CAAC;AAACF,OAAA,CAAAC,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_SchemaRegistryContext","_AutoPatternsOverridesContext","_patterns","_ErrorContext","_cmsAdapter","_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","skeleton","_collection$custom","collectionId","entityTypeSource","customDataSourceId","custom","id","undefined","getSchema","getSchemaFromRegistry","addSchema","addSchemaToRegistry","useSchemaRegistry","showError","useError","schema","setSchema","useState","isLoading","setIsLoading","overrides","useAutoPatternsOverridesContext","httpClient","useWixPatternsContainer","useEffect","collectionConfig","_collectionConfig$cms","_overrides$cmsSchema","schemaInput","cms","cmsSchema","currentSchema","fetchCmsSchema","transformCmsSchema","Error","fetchSchemaForCollection","targetCollectionId","targetCustomDataSourceId","customDataSources","customSchemaProvider","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 { useSchemaRegistry } from './SchemaRegistryContext';\nimport { useAutoPatternsOverridesContext } from './AutoPatternsOverridesContext';\nimport { useWixPatternsContainer } from '@wix/patterns';\nimport { useError } from './ErrorContext';\nimport {\n fetchCmsSchema,\n transformCmsSchema,\n} from '../dataSourceAdapters/cms/cmsAdapter';\n\nconst SchemaContext = createContext<SchemaConfig | null>(null);\n\ninterface SchemaProviderProps {\n collection: BaseCollectionConfig;\n children: ReactNode;\n skeleton: JSX.Element;\n}\n\nexport const SchemaProvider = ({\n collection,\n children,\n skeleton,\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 { showError } = useError();\n const [schema, setSchema] = useState<SchemaConfig | null>(null);\n const [isLoading, setIsLoading] = useState<boolean>(false);\n const overrides = useAutoPatternsOverridesContext();\n const { httpClient } = useWixPatternsContainer();\n\n useEffect(() => {\n const getSchema = async (\n collectionConfig: BaseCollectionConfig,\n ): Promise<SchemaConfig> => {\n switch (collectionConfig.entityTypeSource) {\n case 'cms':\n const schemaInput = collectionConfig.cms?.schema?.id\n ? overrides?.cmsSchema?.[collectionConfig.cms.schema.id]\n : null;\n\n const currentSchema =\n schemaInput ||\n (await fetchCmsSchema(collectionConfig.collectionId));\n\n return transformCmsSchema(currentSchema);\n default:\n throw new Error(\n `Unsupported entityTypeSource: ${collectionConfig.entityTypeSource}`,\n );\n }\n };\n\n const fetchSchemaForCollection = async (\n targetCollectionId: string,\n targetCustomDataSourceId?: string,\n ): Promise<SchemaConfig> => {\n if (entityTypeSource === 'custom') {\n if (!targetCustomDataSourceId || !overrides?.customDataSources) {\n throw new Error('Custom data source not found');\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({\n collectionId: targetCollectionId,\n entityTypeSource,\n });\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 showError(error);\n })\n .finally(() => {\n setIsLoading(false);\n });\n }, [\n collectionId,\n entityTypeSource,\n customDataSourceId,\n addSchemaToRegistry,\n getSchemaFromRegistry,\n overrides,\n httpClient,\n showError,\n ]);\n if (!schema || isLoading) {\n return skeleton;\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,sBAAA,GAAAD,OAAA;AACA,IAAAE,6BAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAG8C,IAAAM,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,SAAAT,wBAAAS,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,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,C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,CAACyB,aAAa,CAAC;IAC7C,CAAC,CAAC,CACDC,KAAK,CAAEP,KAAK,IAAK;MAChBC,OAAO,CAACD,KAAK,CAAC,+BAA+B,EAAEA,KAAK,CAAC;MACrD9C,SAAS,CAAC8C,KAAK,CAAC;IAClB,CAAC,CAAC,CACDQ,OAAO,CAAC,MAAM;MACbhD,YAAY,CAAC,KAAK,CAAC;IACrB,CAAC,CAAC;EACN,CAAC,EAAE,CACDjB,YAAY,EACZC,gBAAgB,EAChBC,kBAAkB,EAClBO,mBAAmB,EACnBF,qBAAqB,EACrBW,SAAS,EACTE,UAAU,EACVT,SAAS,CACV,CAAC;EACF,IAAI,CAACE,MAAM,IAAIG,SAAS,EAAE;IACxB,OAAOlB,QAAQ;EACjB;EAEA,oBACElC,MAAA,CAAAe,OAAA,CAAAuF,aAAA,CAACzE,aAAa,CAAC0E,QAAQ;IAACC,KAAK,EAAEvD,MAAO;IAAAwD,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAAnG,YAAA;MAAAoG,UAAA;MAAAC,YAAA;IAAA;EAAA,GAAE5E,QAAiC,CAAC;AAE9E,CAAC;AAAC6E,OAAA,CAAA/E,cAAA,GAAAA,cAAA;AAEK,MAAMgF,SAAS,GAAGA,CAAA,KAAoB;EAC3C,MAAMC,OAAO,GAAG,IAAAC,iBAAU,EAACpF,aAAa,CAAC;EACzC,IAAI,CAACmF,OAAO,EAAE;IACZ,MAAM,IAAI5C,KAAK,CAAC,gDAAgD,CAAC;EACnE;EACA,OAAO4C,OAAO;AAChB,CAAC;AAACF,OAAA,CAAAC,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -12,12 +12,12 @@ Object.keys(_SchemaContext).forEach(function (key) {
|
|
|
12
12
|
if (key in exports && exports[key] === _SchemaContext[key]) return;
|
|
13
13
|
exports[key] = _SchemaContext[key];
|
|
14
14
|
});
|
|
15
|
-
var
|
|
16
|
-
Object.keys(
|
|
15
|
+
var _AutoPatternsOverridesContext = require("./AutoPatternsOverridesContext");
|
|
16
|
+
Object.keys(_AutoPatternsOverridesContext).forEach(function (key) {
|
|
17
17
|
if (key === "default" || key === "__esModule") return;
|
|
18
18
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
19
|
-
if (key in exports && exports[key] ===
|
|
20
|
-
exports[key] =
|
|
19
|
+
if (key in exports && exports[key] === _AutoPatternsOverridesContext[key]) return;
|
|
20
|
+
exports[key] = _AutoPatternsOverridesContext[key];
|
|
21
21
|
});
|
|
22
22
|
var _ModalContext = require("./ModalContext");
|
|
23
23
|
Object.keys(_ModalContext).forEach(function (key) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_SchemaContext","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","
|
|
1
|
+
{"version":3,"names":["_SchemaContext","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","_AutoPatternsOverridesContext","_ModalContext","_SchemaRegistryContext","_AppConfigContext","_ErrorContext","_AppContext","useAppContext"],"sources":["../../../src/providers/index.ts"],"sourcesContent":["export * from './SchemaContext';\nexport * from './AutoPatternsOverridesContext';\nexport * from './ModalContext';\nexport * from './SchemaRegistryContext';\nexport * from './AppConfigContext';\nexport * from './ErrorContext';\nexport { useAppContext } from './AppContext';\n"],"mappings":";;;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,cAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,cAAA,CAAAK,GAAA;EAAAK,OAAA,CAAAL,GAAA,IAAAL,cAAA,CAAAK,GAAA;AAAA;AACA,IAAAM,6BAAA,GAAAV,OAAA;AAAAC,MAAA,C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A,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,iBAAA,CAAAT,GAAA;EAAAK,OAAA,CAAAL,GAAA,IAAAS,iBAAA,CAAAT,GAAA;AAAA;AACA,IAAAU,aAAA,GAAAd,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAY,aAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAU,aAAA,CAAAV,GAAA;EAAAK,OAAA,CAAAL,GAAA,IAAAU,aAAA,CAAAV,GAAA;AAAA;AACA,IAAAW,WAAA,GAAAf,OAAA;AAA6CS,OAAA,CAAAO,aAAA,GAAAD,WAAA,CAAAC,aAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/types/BaseSDK.ts"],"sourcesContent":["import { ModalId } from '../providers/ModalContext';\nimport {
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/types/BaseSDK.ts"],"sourcesContent":["import { ModalId } from '../providers/ModalContext';\nimport { AutoPatternsOverridesContextProps } from '../providers';\nimport { AppConfig } from './types';\nimport { NavigateToEntityPageFunc } from '../hooks';\n\nexport interface BaseSDK {\n appConfig: AppConfig;\n openModal: (id: ModalId, props?: Record<string, any>) => void;\n closeModal: () => void;\n overrides?: AutoPatternsOverridesContextProps;\n navigateToEntityPage?: NavigateToEntityPageFunc;\n}\n"],"mappings":"","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 CollectionPageOnRowClickActionConfig,\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 CollectionComponentConfig\n extends BaseCollectionComponentConfig {\n type: 'collection';\n layout: LayoutItemConfig[];\n}\n\nexport interface CustomComponentConfig {\n type: 'custom';\n id: string;\n}\n\nexport type ComponentConfig = CollectionComponentConfig | CustomComponentConfig;\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 onRowClick?: CollectionPageOnRowClickActionConfig;\n showTitleBar?: boolean;\n sections?: {\n id: string;\n };\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":";;;;
|
|
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 CollectionPageOnRowClickActionConfig,\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 CollectionComponentConfig\n extends BaseCollectionComponentConfig {\n type: 'collection';\n layout: LayoutItemConfig[];\n}\n\nexport interface CustomComponentConfig {\n type: 'custom';\n id: string;\n}\n\nexport type ComponentConfig = CollectionComponentConfig | CustomComponentConfig;\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 onRowClick?: CollectionPageOnRowClickActionConfig;\n showTitleBar?: boolean;\n sections?: {\n id: string;\n };\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 optimisticActions?: {\n id: string;\n };\n paginationMode?: 'cursor' | 'offset';\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":";;;;IAkLYA,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/actions/base.ts"],"sourcesContent":["export type DividerActionConfig = { type: 'divider' };\n\nexport type BaseActionItemConfig = {\n id: string;\n label?: string;\n skin?: 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 }\n | {\n mode: 'custom';\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 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};\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 skin?: string;\n biName?: 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 }\n | {\n mode: 'custom';\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 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};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/types/fetchData.ts"],"sourcesContent":["import { CursorQuery, OffsetQuery } from '@wix/patterns';\n\nexport type Mode = 'cursor' | 'offset';\n\nexport type UseFetchDataProps<M extends Mode> = {\n searchableFieldIds?: string[];\n filterFieldMapping?: Record<string, { fieldId: string }>;\n paginationMode?: M;\n};\n\nexport interface CursorQueryResult {\n items: any[];\n cursor?: string | undefined | null;\n total?: number | null;\n}\n\nexport interface OffsetQueryResult {\n items: any[];\n total?: number | null;\n hasNext?: boolean;\n}\n\nexport type FetchDataFn<M extends Mode> = M extends 'cursor'\n ? (q: CursorQuery<any>) => Promise<CursorQueryResult>\n : (q: OffsetQuery<any>) => Promise<OffsetQueryResult>;\n"],"mappings":"","ignoreList":[]}
|
package/dist/cjs/types/index.js
CHANGED
|
@@ -43,4 +43,10 @@ Object.keys(_BaseSDK).forEach(function (key) {
|
|
|
43
43
|
if (key in exports && exports[key] === _BaseSDK[key]) return;
|
|
44
44
|
exports[key] = _BaseSDK[key];
|
|
45
45
|
});
|
|
46
|
+
var _fetchData = require("./fetchData");
|
|
47
|
+
Object.keys(_fetchData).forEach(function (key) {
|
|
48
|
+
if (key === "default" || key === "__esModule") return;
|
|
49
|
+
if (key in exports && exports[key] === _fetchData[key]) return;
|
|
50
|
+
exports[key] = _fetchData[key];
|
|
51
|
+
});
|
|
46
52
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
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;AAA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AAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,QAAA,CAAAL,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAK,QAAA,CAAAL,GAAA;AAAA;AACA,IAAAM,OAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,OAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,OAAA,CAAAN,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAM,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":[]}
|
|
1
|
+
{"version":3,"names":["_types","require","Object","keys","forEach","key","exports","_CollectionPageConfig","_EntityPageConfig","_providers","_actions","_types2","_BaseSDK","_fetchData"],"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';\nexport * from './fetchData';\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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A,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,OAAA,CAAAN,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAM,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;AACA,IAAAQ,UAAA,GAAAZ,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAU,UAAA,EAAAT,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,UAAA,CAAAR,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAQ,UAAA,CAAAR,GAAA;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/types/types.ts"],"sourcesContent":["import { EntityPageConfig } from './EntityPageConfig';\nimport { CollectionPageConfig } from './CollectionPageConfig';\n\ninterface BaseCollectionConfigCommon {\n collectionId: string;\n}\n\
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/types/types.ts"],"sourcesContent":["import { EntityPageConfig } from './EntityPageConfig';\nimport { CollectionPageConfig } from './CollectionPageConfig';\nimport { useOptimisticActions } from '@wix/patterns';\nimport { CursorQueryResult, OffsetQueryResult } from './fetchData';\n\ninterface BaseCollectionConfigCommon {\n collectionId: string;\n}\n\nexport interface CMSCollectionConfig extends BaseCollectionConfigCommon {\n entityTypeSource: 'cms';\n cms?: {\n schema?: { id: string };\n };\n custom?: never;\n}\n\ninterface CustomCollectionConfig extends BaseCollectionConfigCommon {\n entityTypeSource: 'custom';\n cms?: never;\n custom: {\n id: string;\n };\n}\n\nexport type BaseCollectionConfig = CMSCollectionConfig | 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 Query {\n limit: number;\n offset?: number;\n page: number;\n search?: string;\n cursor?: string | null;\n filters: Record<string, any>;\n sort?: {\n fieldName: string;\n order: 'asc' | 'desc';\n }[];\n}\nexport interface SchemaConfig {\n id: string;\n fields: Record<string, Field | undefined>;\n displayField: string;\n idField: 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: Query,\n options?: {\n searchableFieldIds?: string[];\n filterFieldMapping?: Record<string, { fieldId: string }>;\n },\n ) => Promise<CursorQueryResult | OffsetQueryResult>;\n };\n}\n\nexport type OptimisticActionsParams = Parameters<\n typeof useOptimisticActions\n>[1];\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["resolveAction","actionConfig","action","label","skin","exports"],"sources":["../../../../src/utils/actions/resolveAction.ts"],"sourcesContent":["import { BaseActionItemConfig, ResolvedAction } from '../../types';\n\nexport const resolveAction = (\n actionConfig: BaseActionItemConfig,\n action: Partial<ResolvedAction>,\n) => {\n return {\n ...action,\n label: actionConfig.label ?? action.label,\n skin: actionConfig.skin,\n };\n};\n"],"mappings":";;;;AAEO,MAAMA,aAAa,GAAGA,CAC3BC,YAAkC,EAClCC,MAA+B,KAC5B;EACH,OAAO;IACL,GAAGA,MAAM;IACTC,KAAK,EAAEF,YAAY,CAACE,KAAK,IAAID,MAAM,CAACC,KAAK;IACzCC,IAAI,EAAEH,YAAY,CAACG;
|
|
1
|
+
{"version":3,"names":["resolveAction","actionConfig","action","label","skin","biName","exports"],"sources":["../../../../src/utils/actions/resolveAction.ts"],"sourcesContent":["import { BaseActionItemConfig, ResolvedAction } from '../../types';\n\nexport const resolveAction = (\n actionConfig: BaseActionItemConfig,\n action: Partial<ResolvedAction>,\n) => {\n return {\n ...action,\n label: actionConfig.label ?? action.label,\n skin: actionConfig.skin,\n biName: actionConfig.biName,\n };\n};\n"],"mappings":";;;;AAEO,MAAMA,aAAa,GAAGA,CAC3BC,YAAkC,EAClCC,MAA+B,KAC5B;EACH,OAAO;IACL,GAAGA,MAAM;IACTC,KAAK,EAAEF,YAAY,CAACE,KAAK,IAAID,MAAM,CAACC,KAAK;IACzCC,IAAI,EAAEH,YAAY,CAACG,IAAI;IACvBC,MAAM,EAAEJ,YAAY,CAACI;EACvB,CAAC;AACH,CAAC;AAACC,OAAA,CAAAN,aAAA,GAAAA,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 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 hidden?: boolean;\n tooltip?: string;\n skin?: 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 BaseActionParams {\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":[]}
|
|
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 hidden?: boolean;\n tooltip?: string;\n skin?: string;\n biName?: 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 BaseActionParams {\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":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.getMetasiteId = void 0;
|
|
5
|
+
// Copied https://github.com/wix-private/picasso-giza-host/blob/7750022685df79e499194fc7f5225f5f49d62ee0/packages/picasso-common/src/services/metaSiteIdService.ts#L2
|
|
6
|
+
const getMetasiteId = () => {
|
|
7
|
+
const match = window.location.href.match(/[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i);
|
|
8
|
+
return match == null ? void 0 : match[0];
|
|
9
|
+
};
|
|
10
|
+
exports.getMetasiteId = getMetasiteId;
|
|
11
|
+
//# sourceMappingURL=vibe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getMetasiteId","match","window","location","href","exports"],"sources":["../../../src/utils/vibe.ts"],"sourcesContent":["// Copied https://github.com/wix-private/picasso-giza-host/blob/7750022685df79e499194fc7f5225f5f49d62ee0/packages/picasso-common/src/services/metaSiteIdService.ts#L2\nexport const getMetasiteId = () => {\n const match = window.location.href.match(\n /[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i,\n );\n return match?.[0];\n};\n"],"mappings":";;;;AAAA;AACO,MAAMA,aAAa,GAAGA,CAAA,KAAM;EACjC,MAAMC,KAAK,GAAGC,MAAM,CAACC,QAAQ,CAACC,IAAI,CAACH,KAAK,CACtC,0EACF,CAAC;EACD,OAAOA,KAAK,oBAALA,KAAK,CAAG,CAAC,CAAC;AACnB,CAAC;AAACI,OAAA,CAAAL,aAAA,GAAAA,aAAA","ignoreList":[]}
|
package/dist/docs/action_cell.md
CHANGED
|
@@ -144,6 +144,7 @@ Custom actions execute JavaScript code that you define. These actions receive pa
|
|
|
144
144
|
})
|
|
145
145
|
});
|
|
146
146
|
},
|
|
147
|
+
biName: 'download-pet-details-action' // MANDATORY: For analytics tracking
|
|
147
148
|
};
|
|
148
149
|
};
|
|
149
150
|
```
|
|
@@ -168,10 +169,11 @@ Custom actions execute JavaScript code that you define. These actions receive pa
|
|
|
168
169
|
"id": "downloadPetDetails", // MUST match the function name exactly
|
|
169
170
|
"type": "custom", // REQUIRED: Must be exactly "custom"
|
|
170
171
|
"label": "Download Details", // Optional: Displayed text
|
|
172
|
+
"biName": "download-pet-details-action" // MANDATORY: Analytics tracking identifier
|
|
171
173
|
}
|
|
172
174
|
```
|
|
173
175
|
|
|
174
|
-
5. Register your action in the `
|
|
176
|
+
5. Register your action in the `AutoPatternsOverridesProvider`:
|
|
175
177
|
```typescript
|
|
176
178
|
import { useActions } from '../components/actions';
|
|
177
179
|
|
|
@@ -179,9 +181,9 @@ Custom actions execute JavaScript code that you define. These actions receive pa
|
|
|
179
181
|
const actions = useActions();
|
|
180
182
|
|
|
181
183
|
return (
|
|
182
|
-
<
|
|
184
|
+
<AutoPatternsOverridesProvider value={{ actions }}>
|
|
183
185
|
<AutoPatternsApp configuration={config} />
|
|
184
|
-
</
|
|
186
|
+
</AutoPatternsOverridesProvider>
|
|
185
187
|
);
|
|
186
188
|
}
|
|
187
189
|
```
|
|
@@ -196,13 +198,21 @@ Custom actions execute JavaScript code that you define. These actions receive pa
|
|
|
196
198
|
|
|
197
199
|
1. `id` must:
|
|
198
200
|
- Match exactly the function name of the custom action implementation
|
|
199
|
-
- Be registered in the `actions` property of your `
|
|
201
|
+
- Be registered in the `actions` property of your `AutoPatternsOverridesProvider`
|
|
200
202
|
- Follow JavaScript identifier naming rules (camelCase recommended)
|
|
201
203
|
|
|
202
|
-
2.
|
|
203
|
-
-
|
|
204
|
+
2. `biName` must:
|
|
205
|
+
- Be included in every action configuration (MANDATORY)
|
|
206
|
+
- Use descriptive, kebab-case naming (e.g., "download-pet-details-action")
|
|
207
|
+
- Be unique across the application
|
|
208
|
+
- Follow the pattern: `{action-purpose}-action`
|
|
209
|
+
- Enable analytics tracking for user interactions
|
|
210
|
+
|
|
211
|
+
2. The implementation must return a `ResolvedAction` object with:
|
|
212
|
+
- `label`: Text displayed for the action
|
|
204
213
|
- `icon`: An Icon component from "@wix/wix-ui-icons-common"
|
|
205
214
|
- `onClick`: Handler function for the action
|
|
215
|
+
- `biName`: Business intelligence name for analytics tracking. Must match the `biName` in your action configuration (required)
|
|
206
216
|
- `hidden` (optional): Boolean to hide the action when true
|
|
207
217
|
|
|
208
218
|
3. The implementation must:
|
|
@@ -238,13 +248,13 @@ Follow this decision process when implementing ActionCell:
|
|
|
238
248
|
- Complex, full-entity edits → Use `mode: "page"` to navigate to entity page
|
|
239
249
|
|
|
240
250
|
6. **Custom Implementation**:
|
|
241
|
-
- For `custom` actions, you must provide implementations in your code and register them with `
|
|
251
|
+
- For `custom` actions, you must provide implementations in your code and register them with `AutoPatternsOverridesProvider`
|
|
242
252
|
|
|
243
253
|
### ActionCell Validation Checklist
|
|
244
254
|
|
|
245
255
|
AI agents should verify these requirements before generating ActionCell configurations:
|
|
246
256
|
|
|
247
|
-
✓ ActionCell is placed
|
|
257
|
+
✓ ActionCell is placed at the collection component level (`collectionPage.components[*].actionCell`) as a sibling to `collection`, `layout`, etc. — NOT inside `table` or `grid`
|
|
248
258
|
✓ Each action has a unique `id` and correct `type` value
|
|
249
259
|
✓ Each action type only includes its required field(s)
|
|
250
260
|
✓ Update page action refers to a valid entity page ID
|