@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.
Files changed (193) hide show
  1. package/dist/cjs/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js +19 -58
  2. package/dist/cjs/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js.map +1 -1
  3. package/dist/cjs/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js +1 -1
  4. package/dist/cjs/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
  5. package/dist/cjs/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.js +48 -0
  6. package/dist/cjs/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.js.map +1 -0
  7. package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js +1 -1
  8. package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js.map +1 -1
  9. package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js +1 -1
  10. package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js.map +1 -1
  11. package/dist/cjs/components/AutoPatternsRoute/AutoPatternsRoutes.js +11 -7
  12. package/dist/cjs/components/AutoPatternsRoute/AutoPatternsRoutes.js.map +1 -1
  13. package/dist/cjs/components/ModalRenderer.js +1 -1
  14. package/dist/cjs/components/ModalRenderer.js.map +1 -1
  15. package/dist/cjs/dataSourceAdapters/cms/cmsAdapter.js +5 -0
  16. package/dist/cjs/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
  17. package/dist/cjs/dataSourceAdapters/cms/fetchCmsData.js +1 -1
  18. package/dist/cjs/dataSourceAdapters/cms/fetchCmsData.js.map +1 -1
  19. package/dist/cjs/hooks/useAutoPatternsOptimisticActions.js +13 -6
  20. package/dist/cjs/hooks/useAutoPatternsOptimisticActions.js.map +1 -1
  21. package/dist/cjs/hooks/useBaseCollectionParams.js +38 -0
  22. package/dist/cjs/hooks/useBaseCollectionParams.js.map +1 -0
  23. package/dist/cjs/hooks/useBaseSDK.js +1 -1
  24. package/dist/cjs/hooks/useBaseSDK.js.map +1 -1
  25. package/dist/cjs/hooks/useColumns.js +1 -1
  26. package/dist/cjs/hooks/useColumns.js.map +1 -1
  27. package/dist/cjs/hooks/useCommonCollectionFeatures.js +13 -6
  28. package/dist/cjs/hooks/useCommonCollectionFeatures.js.map +1 -1
  29. package/dist/cjs/hooks/useEmptyStates.js +1 -1
  30. package/dist/cjs/hooks/useEmptyStates.js.map +1 -1
  31. package/dist/cjs/hooks/useEntityPageHeaderTexts.js +2 -2
  32. package/dist/cjs/hooks/useEntityPageHeaderTexts.js.map +1 -1
  33. package/dist/cjs/hooks/useFetchData.js +4 -5
  34. package/dist/cjs/hooks/useFetchData.js.map +1 -1
  35. package/dist/cjs/hooks/useFilters.js +2 -2
  36. package/dist/cjs/hooks/useFilters.js.map +1 -1
  37. package/dist/cjs/hooks/useGridFeatures.js +6 -26
  38. package/dist/cjs/hooks/useGridFeatures.js.map +1 -1
  39. package/dist/cjs/hooks/useTableFeatures.js +8 -28
  40. package/dist/cjs/hooks/useTableFeatures.js.map +1 -1
  41. package/dist/cjs/hooks/useTableGridSwitchFeatures.js +8 -28
  42. package/dist/cjs/hooks/useTableGridSwitchFeatures.js.map +1 -1
  43. package/dist/cjs/providers/{PatternsWizardOverridesContext.js → AutoPatternsOverridesContext.js} +14 -11
  44. package/dist/cjs/providers/AutoPatternsOverridesContext.js.map +1 -0
  45. package/dist/cjs/providers/SchemaContext.js +24 -7
  46. package/dist/cjs/providers/SchemaContext.js.map +1 -1
  47. package/dist/cjs/providers/index.js +4 -4
  48. package/dist/cjs/providers/index.js.map +1 -1
  49. package/dist/cjs/types/BaseSDK.js.map +1 -1
  50. package/dist/cjs/types/CollectionPageConfig.js.map +1 -1
  51. package/dist/cjs/types/actions/base.js.map +1 -1
  52. package/dist/cjs/types/fetchData.js +4 -0
  53. package/dist/cjs/types/fetchData.js.map +1 -0
  54. package/dist/cjs/types/index.js +6 -0
  55. package/dist/cjs/types/index.js.map +1 -1
  56. package/dist/cjs/types/types.js.map +1 -1
  57. package/dist/cjs/utils/actions/resolveAction.js +2 -1
  58. package/dist/cjs/utils/actions/resolveAction.js.map +1 -1
  59. package/dist/cjs/utils/actions/types.js.map +1 -1
  60. package/dist/cjs/utils/vibe.js +11 -0
  61. package/dist/cjs/utils/vibe.js.map +1 -0
  62. package/dist/docs/action_cell.md +18 -8
  63. package/dist/docs/app_config_structure.md +37 -1
  64. package/dist/docs/app_context.md +45 -0
  65. package/dist/docs/auto-patterns-guide.md +331 -82
  66. package/dist/docs/bulk_actions.md +10 -5
  67. package/dist/docs/collection_page.md +1 -1
  68. package/dist/docs/collection_page_actions.md +16 -9
  69. package/dist/docs/custom_overrides.md +22 -36
  70. package/dist/docs/entity_page.md +10 -10
  71. package/dist/docs/entity_page_actions.md +11 -4
  72. package/dist/docs/error_handling.md +135 -0
  73. package/dist/docs/index.md +8 -0
  74. package/dist/docs/installation.md +3 -3
  75. package/dist/docs/resolved_action.md +6 -2
  76. package/dist/docs/schema_config.md +11 -3
  77. package/dist/docs/wix_fqdn_custom_data_source.md +51 -9
  78. package/dist/esm/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js +2 -25
  79. package/dist/esm/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js.map +1 -1
  80. package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js +2 -2
  81. package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
  82. package/dist/esm/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.js +29 -0
  83. package/dist/esm/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.js.map +1 -0
  84. package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js +2 -2
  85. package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js.map +1 -1
  86. package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js +2 -2
  87. package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js.map +1 -1
  88. package/dist/esm/components/AutoPatternsRoute/AutoPatternsRoutes.js +5 -1
  89. package/dist/esm/components/AutoPatternsRoute/AutoPatternsRoutes.js.map +1 -1
  90. package/dist/esm/components/ModalRenderer.js +2 -2
  91. package/dist/esm/components/ModalRenderer.js.map +1 -1
  92. package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js +4 -0
  93. package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
  94. package/dist/esm/dataSourceAdapters/cms/fetchCmsData.js +1 -1
  95. package/dist/esm/dataSourceAdapters/cms/fetchCmsData.js.map +1 -1
  96. package/dist/esm/hooks/useAutoPatternsOptimisticActions.js +14 -9
  97. package/dist/esm/hooks/useAutoPatternsOptimisticActions.js.map +1 -1
  98. package/dist/esm/hooks/useBaseCollectionParams.js +37 -0
  99. package/dist/esm/hooks/useBaseCollectionParams.js.map +1 -0
  100. package/dist/esm/hooks/useBaseSDK.js +2 -2
  101. package/dist/esm/hooks/useBaseSDK.js.map +1 -1
  102. package/dist/esm/hooks/useColumns.js +2 -2
  103. package/dist/esm/hooks/useColumns.js.map +1 -1
  104. package/dist/esm/hooks/useCommonCollectionFeatures.js +9 -2
  105. package/dist/esm/hooks/useCommonCollectionFeatures.js.map +1 -1
  106. package/dist/esm/hooks/useEmptyStates.js +2 -2
  107. package/dist/esm/hooks/useEmptyStates.js.map +1 -1
  108. package/dist/esm/hooks/useEntityPageHeaderTexts.js +2 -2
  109. package/dist/esm/hooks/useEntityPageHeaderTexts.js.map +1 -1
  110. package/dist/esm/hooks/useFetchData.js +2 -2
  111. package/dist/esm/hooks/useFetchData.js.map +1 -1
  112. package/dist/esm/hooks/useFilters.js +2 -2
  113. package/dist/esm/hooks/useFilters.js.map +1 -1
  114. package/dist/esm/hooks/useGridFeatures.js +6 -29
  115. package/dist/esm/hooks/useGridFeatures.js.map +1 -1
  116. package/dist/esm/hooks/useTableFeatures.js +8 -31
  117. package/dist/esm/hooks/useTableFeatures.js.map +1 -1
  118. package/dist/esm/hooks/useTableGridSwitchFeatures.js +8 -31
  119. package/dist/esm/hooks/useTableGridSwitchFeatures.js.map +1 -1
  120. package/dist/esm/providers/AutoPatternsOverridesContext.js +19 -0
  121. package/dist/esm/providers/AutoPatternsOverridesContext.js.map +1 -0
  122. package/dist/esm/providers/SchemaContext.js +23 -6
  123. package/dist/esm/providers/SchemaContext.js.map +1 -1
  124. package/dist/esm/providers/index.js +1 -1
  125. package/dist/esm/providers/index.js.map +1 -1
  126. package/dist/esm/types/BaseSDK.js.map +1 -1
  127. package/dist/esm/types/CollectionPageConfig.js.map +1 -1
  128. package/dist/esm/types/actions/base.js.map +1 -1
  129. package/dist/esm/types/fetchData.js +2 -0
  130. package/dist/esm/types/fetchData.js.map +1 -0
  131. package/dist/esm/types/index.js +1 -0
  132. package/dist/esm/types/index.js.map +1 -1
  133. package/dist/esm/types/types.js.map +1 -1
  134. package/dist/esm/utils/actions/resolveAction.js +2 -1
  135. package/dist/esm/utils/actions/resolveAction.js.map +1 -1
  136. package/dist/esm/utils/actions/types.js.map +1 -1
  137. package/dist/esm/utils/vibe.js +6 -0
  138. package/dist/esm/utils/vibe.js.map +1 -0
  139. package/dist/types/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.d.ts.map +1 -1
  140. package/dist/types/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.d.ts +3 -0
  141. package/dist/types/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.d.ts.map +1 -0
  142. package/dist/types/components/AutoPatternsRoute/AutoPatternsRoutes.d.ts.map +1 -1
  143. package/dist/types/dataSourceAdapters/cms/cmsAdapter.d.ts +2 -1
  144. package/dist/types/dataSourceAdapters/cms/cmsAdapter.d.ts.map +1 -1
  145. package/dist/types/hooks/useAutoPatternsOptimisticActions.d.ts +7 -1
  146. package/dist/types/hooks/useAutoPatternsOptimisticActions.d.ts.map +1 -1
  147. package/dist/types/hooks/useBaseCollectionParams.d.ts +27 -0
  148. package/dist/types/hooks/useBaseCollectionParams.d.ts.map +1 -0
  149. package/dist/types/hooks/useCommonCollectionFeatures.d.ts +4 -3
  150. package/dist/types/hooks/useCommonCollectionFeatures.d.ts.map +1 -1
  151. package/dist/types/hooks/useEntityPageHeaderTexts.d.ts.map +1 -1
  152. package/dist/types/hooks/useFetchData.d.ts +3 -13
  153. package/dist/types/hooks/useFetchData.d.ts.map +1 -1
  154. package/dist/types/hooks/useGridFeatures.d.ts +1 -1
  155. package/dist/types/hooks/useGridFeatures.d.ts.map +1 -1
  156. package/dist/types/hooks/useTableFeatures.d.ts +1 -1
  157. package/dist/types/hooks/useTableFeatures.d.ts.map +1 -1
  158. package/dist/types/hooks/useTableGridSwitchFeatures.d.ts +1 -1
  159. package/dist/types/hooks/useTableGridSwitchFeatures.d.ts.map +1 -1
  160. package/dist/types/providers/{PatternsWizardOverridesContext.d.ts → AutoPatternsOverridesContext.d.ts} +14 -5
  161. package/dist/types/providers/AutoPatternsOverridesContext.d.ts.map +1 -0
  162. package/dist/types/providers/SchemaContext.d.ts.map +1 -1
  163. package/dist/types/providers/index.d.ts +1 -1
  164. package/dist/types/providers/index.d.ts.map +1 -1
  165. package/dist/types/types/BaseSDK.d.ts +2 -2
  166. package/dist/types/types/BaseSDK.d.ts.map +1 -1
  167. package/dist/types/types/CollectionPageConfig.d.ts +4 -0
  168. package/dist/types/types/CollectionPageConfig.d.ts.map +1 -1
  169. package/dist/types/types/actions/base.d.ts +1 -0
  170. package/dist/types/types/actions/base.d.ts.map +1 -1
  171. package/dist/types/types/fetchData.d.ts +21 -0
  172. package/dist/types/types/fetchData.d.ts.map +1 -0
  173. package/dist/types/types/index.d.ts +1 -0
  174. package/dist/types/types/index.d.ts.map +1 -1
  175. package/dist/types/types/types.d.ts +12 -7
  176. package/dist/types/types/types.d.ts.map +1 -1
  177. package/dist/types/utils/actions/resolveAction.d.ts +1 -0
  178. package/dist/types/utils/actions/resolveAction.d.ts.map +1 -1
  179. package/dist/types/utils/actions/types.d.ts +1 -0
  180. package/dist/types/utils/actions/types.d.ts.map +1 -1
  181. package/dist/types/utils/vibe.d.ts +2 -0
  182. package/dist/types/utils/vibe.d.ts.map +1 -0
  183. package/package.json +10 -10
  184. package/dist/cjs/dataSourceAdapters/factory.js +0 -14
  185. package/dist/cjs/dataSourceAdapters/factory.js.map +0 -1
  186. package/dist/cjs/providers/PatternsWizardOverridesContext.js.map +0 -1
  187. package/dist/esm/dataSourceAdapters/factory.js +0 -10
  188. package/dist/esm/dataSourceAdapters/factory.js.map +0 -1
  189. package/dist/esm/providers/PatternsWizardOverridesContext.js +0 -15
  190. package/dist/esm/providers/PatternsWizardOverridesContext.js.map +0 -1
  191. package/dist/types/dataSourceAdapters/factory.d.ts +0 -3
  192. package/dist/types/dataSourceAdapters/factory.d.ts.map +0 -1
  193. package/dist/types/providers/PatternsWizardOverridesContext.d.ts.map +0 -1
@@ -19,6 +19,7 @@ export interface ResolvedAction {
19
19
  hidden?: boolean;
20
20
  tooltip?: string;
21
21
  skin?: string;
22
+ biName?: string;
22
23
  }
23
24
  ```
24
25
 
@@ -29,6 +30,7 @@ export interface ResolvedAction {
29
30
  - **`label`** (string): Text displayed in the button or menu item.
30
31
  - **`icon`** (IconElement): An icon component, typically from `@wix/wix-ui-icons-common`. Example: `icon: <Delete />`.
31
32
  - **`onClick`** (function): Handler function invoked when the user triggers the action. Can be async.
33
+ - **`biName`** (string): Business intelligence name for analytics tracking. Used to identify the action in analytics and reporting systems. The value should match the `biName` specified in your action configuration.
32
34
 
33
35
  ### Optional Fields
34
36
 
@@ -52,7 +54,8 @@ return {
52
54
  icon: <Add />,
53
55
  onClick: () => {
54
56
  // Your action logic here
55
- }
57
+ },
58
+ biName: 'create-action' // MANDATORY: For analytics tracking
56
59
  };
57
60
  ```
58
61
 
@@ -75,7 +78,8 @@ return {
75
78
  disabled: total === 0,
76
79
  tooltip: total === 0 ? 'Select at least one item to export' : undefined,
77
80
  hidden: !userHasExportPermission,
78
- skin: 'premium'
81
+ skin: 'premium',
82
+ biName: 'export_selected_items' // MANDATORY: For analytics tracking
79
83
  };
80
84
  ```
81
85
 
@@ -16,19 +16,25 @@ export interface SchemaConfig {
16
16
  update: (updatedEntity: any) => Promise<any>;
17
17
  delete: (entityId: string) => Promise<any>;
18
18
  bulkDelete: (entityIds: string[]) => Promise<any>;
19
+ // The return shape depends on pagination mode (see AppConfig.collection.paginationMode)
20
+ // - Cursor mode: { items, cursor, total? }
21
+ // - Offset mode (default): { items, hasNext, total? }
19
22
  find: (
20
23
  query: Query,
21
24
  options?: {
22
25
  searchableFieldIds?: string[];
23
26
  filterFieldMapping?: Record<string, { fieldId: string }>;
24
27
  },
25
- ) => Promise<{ items: any[]; total: number }>;
28
+ ) => Promise<
29
+ | { items: any[]; cursor?: string | null; total?: number | null }
30
+ | { items: any[]; hasNext?: boolean; total?: number | null }
31
+ >;
26
32
  };
27
33
  }
28
34
 
29
35
  export interface Query {
30
36
  limit: number; // Maximum number of items to return per request (controls page size)
31
- offset: number; // Number of items to skip from the beginning (for pagination)
37
+ offset?: number; // Number of items to skip from the beginning (for pagination)
32
38
  page: number; // Current page number (1-based, works with limit for pagination)
33
39
  search?: string; // Text search query applied to searchable fields
34
40
  cursor?: string | null; // Cursor-based pagination token (alternative to offset-based pagination)
@@ -127,7 +133,9 @@ export type Field = ReferenceField | NonReferenceField;
127
133
  - `query`: Query object with pagination, filtering, sorting, and search criteria (see Query Interface section)
128
134
  - `options.searchableFieldIds`: Array of field IDs that support text search
129
135
  - `options.filterFieldMapping`: Maps filter IDs to actual field IDs for complex filtering
130
- - Returns: `{ items: any[], total: number }`
136
+ - Returns (depends on pagination mode):
137
+ - Cursor mode: `{ items: any[]; cursor?: string | null; total?: number | null }`
138
+ - Offset mode (default): `{ items: any[]; hasNext?: boolean; total?: number | null }`
131
139
 
132
140
  ### Field Type Information
133
141
 
@@ -114,6 +114,7 @@ Follow the complete custom data source implementation guide in the "Custom Overr
114
114
  1. **Import the client library** identified in Step 2
115
115
  2. **Use the field mappings** from Step 3 in your SchemaConfig
116
116
  3. **⚠️ CRITICAL: DO NOT IMPLEMENT THE ACTIONS** - Instead, add guidance comments explaining how to use the imported client library for each CRUD operation, then throw an "unimplemented exception" error
117
+ 4. **⚠️ CRITICAL: Add Error Handling** - When implementing the actions, you MUST wrap all HTTP requests with proper error handling using `errorHandler` from `@wix/essentials` (see "Error Handling for HTTP Requests" section)
117
118
 
118
119
  **Important**: The schema actions should contain helpful comments but NOT actual implementations. Each action should throw an error indicating it's unimplemented and needs to be implemented by the user.
119
120
 
@@ -123,6 +124,8 @@ Create your custom data source with the hook pattern:
123
124
 
124
125
  In `components/customDataSources/myCustomDataSource.ts`:
125
126
  ```typescript
127
+ import { errorHandler } from '@wix/essentials';
128
+
126
129
  export const myCustomDataSource = async (collectionId: string, context: any) => {
127
130
  return {
128
131
  id: 'myCustomCollection',
@@ -134,37 +137,76 @@ export const myCustomDataSource = async (collectionId: string, context: any) =>
134
137
  actions: {
135
138
  get: async (entityId: string) => {
136
139
  // TODO: Implement using your FQDN client library
137
- // Example: const result = await yourFQDNClient.getEntity(entityId);
140
+ // Example:
141
+ // return errorHandler.withErrorHandler(
142
+ // async () => {
143
+ // return yourFQDNClient.getEntity(entityId);
144
+ // },
145
+ // {}
146
+ // );
138
147
  // Remember to map the response fields from snake_case to camelCase
139
148
  throw new Error('get action not implemented - user must implement this method');
140
149
  },
141
150
  create: async (newEntity: any) => {
142
151
  // TODO: Implement using your FQDN client library
143
- // Example: const result = await yourFQDNClient.createEntity(newEntity);
152
+ // Example:
153
+ // return errorHandler.withErrorHandler(
154
+ // async () => {
155
+ // return yourFQDNClient.createEntity(newEntity);
156
+ // },
157
+ // {}
158
+ // );
144
159
  // Remember to map the request fields from camelCase to snake_case
145
160
  throw new Error('create action not implemented - user must implement this method');
146
161
  },
147
162
  update: async (updatedEntity: any) => {
148
163
  // TODO: Implement using your FQDN client library
149
- // Example: const result = await yourFQDNClient.updateEntity(updatedEntity);
164
+ // Example:
165
+ // return errorHandler.withErrorHandler(
166
+ // async () => {
167
+ // return yourFQDNClient.updateEntity(updatedEntity);
168
+ // },
169
+ // {}
170
+ // );
150
171
  // Remember to map the request fields from camelCase to snake_case
151
172
  throw new Error('update action not implemented - user must implement this method');
152
173
  },
153
174
  delete: async (entityId: string) => {
154
175
  // TODO: Implement using your FQDN client library
155
- // Example: await yourFQDNClient.deleteEntity(entityId);
176
+ // Example:
177
+ // return errorHandler.withErrorHandler(
178
+ // async () => {
179
+ // return yourFQDNClient.deleteEntity(entityId);
180
+ // },
181
+ // {}
182
+ // );
156
183
  throw new Error('delete action not implemented - user must implement this method');
157
184
  },
158
185
  bulkDelete: async (entityIds: string[]) => {
159
186
  // TODO: Implement using your FQDN client library
160
- // Example: await yourFQDNClient.bulkDeleteEntities(entityIds);
187
+ // Example:
188
+ // return errorHandler.withErrorHandler(
189
+ // async () => {
190
+ // return yourFQDNClient.bulkDeleteEntities(entityIds);
191
+ // },
192
+ // {}
193
+ // );
161
194
  throw new Error('bulkDelete action not implemented - user must implement this method');
162
195
  },
163
196
  find: async (query: Query, options?: any) => {
164
197
  // TODO: Implement using your FQDN client library
165
- // Example: const result = await yourFQDNClient.queryEntities(query, options);
198
+ // Example:
199
+ // return errorHandler.withErrorHandler(
200
+ // async () => {
201
+ // return yourFQDNClient.queryEntities(query, options);
202
+ // },
203
+ // {}
204
+ // );
166
205
  // Remember to map the response fields from snake_case to camelCase
167
- // Must return: { items: any[], total: number }
206
+ // IMPORTANT: Return shape depends on pagination mode.
207
+ // Detect by presence of query.cursor (cursor mode) vs. query.offset/page (offset mode):
208
+ // - Cursor mode: return { items, cursor, total? }
209
+ // - Offset mode (default): return { items, hasNext, total? }
168
210
  throw new Error('find action not implemented - user must implement this method');
169
211
  }
170
212
  }
@@ -217,9 +259,9 @@ export default function YourPage() {
217
259
  const customDataSources = useCustomDataSources();
218
260
 
219
261
  return (
220
- <PatternsWizardOverridesProvider value={{ customDataSources }}>
262
+ <AutoPatternsOverridesProvider value={{ customDataSources }}>
221
263
  <AutoPatternsApp configuration={config} />
222
- </PatternsWizardOverridesProvider>
264
+ </AutoPatternsOverridesProvider>
223
265
  );
224
266
  }
225
267
  ```
@@ -2,8 +2,7 @@ import React from 'react';
2
2
  import { CollectionPage } from '@wix/patterns/page';
3
3
  import { AutoPatternsCollectionPageContent } from '../AutoPatternsCollectionPageContent';
4
4
  import { useCollectionPageActions } from '../../hooks/useCollectionPageActions';
5
- import { SidePanel, Box } from '@wix/design-system';
6
- import { useAppConfigContext } from '../../providers';
5
+ import { AutoPatternsCollectionPageFooter } from '../AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter';
7
6
  export const AutoPatternsCollectionPage = _ref => {
8
7
  let {
9
8
  configuration
@@ -12,31 +11,9 @@ export const AutoPatternsCollectionPage = _ref => {
12
11
  title,
13
12
  subtitle
14
13
  } = configuration;
15
- const {
16
- layout
17
- } = useAppConfigContext();
18
14
  const actions = useCollectionPageActions({
19
15
  collectionPageActions: configuration.actions
20
16
  });
21
-
22
- // This is temporary until we have support on it on CollectionPage component of WixPatterns
23
- if (layout === 'panel') {
24
- return /*#__PURE__*/React.createElement(SidePanel, {
25
- skin: "floating",
26
- width: "360px"
27
- }, /*#__PURE__*/React.createElement(SidePanel.Header, {
28
- title: "Manage Content"
29
- }), /*#__PURE__*/React.createElement(SidePanel.Content, {
30
- noPadding: true,
31
- stretchVertically: true
32
- }, /*#__PURE__*/React.createElement(Box, {
33
- direction: "vertical",
34
- width: "100%",
35
- height: "490px"
36
- }, /*#__PURE__*/React.createElement(AutoPatternsCollectionPageContent, {
37
- configuration: configuration
38
- }))));
39
- }
40
17
  return /*#__PURE__*/React.createElement(CollectionPage, {
41
18
  height: "100vh",
42
19
  dataHook: "auto-patterns-page"
@@ -47,6 +24,6 @@ export const AutoPatternsCollectionPage = _ref => {
47
24
  secondaryActions: actions.secondaryActions
48
25
  }), /*#__PURE__*/React.createElement(CollectionPage.Content, null, /*#__PURE__*/React.createElement(AutoPatternsCollectionPageContent, {
49
26
  configuration: configuration
50
- })));
27
+ })), /*#__PURE__*/React.createElement(CollectionPage.Footer, null, /*#__PURE__*/React.createElement(AutoPatternsCollectionPageFooter, null)));
51
28
  };
52
29
  //# sourceMappingURL=AutoPatternsCollectionPage.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","CollectionPage","AutoPatternsCollectionPageContent","useCollectionPageActions","SidePanel","Box","useAppConfigContext","AutoPatternsCollectionPage","_ref","configuration","title","subtitle","layout","actions","collectionPageActions","createElement","skin","width","Header","Content","noPadding","stretchVertically","direction","height","dataHook","primaryAction","primaryActions","secondaryActions"],"sources":["../../../../src/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.tsx"],"sourcesContent":["import React from 'react';\nimport { CollectionPage } from '@wix/patterns/page';\nimport { AutoPatternsCollectionPageContent } from '../AutoPatternsCollectionPageContent';\nimport { CollectionPageConfig } from '../../types/CollectionPageConfig';\nimport { useCollectionPageActions } from '../../hooks/useCollectionPageActions';\nimport { SidePanel, Box } from '@wix/design-system';\nimport { useAppConfigContext } from '../../providers';\n\nexport interface AutoPatternsCollectionPageProps {\n configuration: CollectionPageConfig;\n}\n\nexport const AutoPatternsCollectionPage: React.FC<\n AutoPatternsCollectionPageProps\n> = ({ configuration }) => {\n const { title, subtitle } = configuration;\n const { layout } = useAppConfigContext();\n\n const actions = useCollectionPageActions({\n collectionPageActions: configuration.actions,\n });\n\n // This is temporary until we have support on it on CollectionPage component of WixPatterns\n if (layout === 'panel') {\n return (\n <SidePanel skin=\"floating\" width=\"360px\">\n <SidePanel.Header title=\"Manage Content\" />\n <SidePanel.Content noPadding stretchVertically>\n <Box direction=\"vertical\" width=\"100%\" height=\"490px\">\n <AutoPatternsCollectionPageContent configuration={configuration} />\n </Box>\n </SidePanel.Content>\n </SidePanel>\n );\n }\n\n return (\n <CollectionPage height=\"100vh\" dataHook=\"auto-patterns-page\">\n <CollectionPage.Header\n title={title}\n subtitle={subtitle}\n primaryAction={actions.primaryActions}\n secondaryActions={actions.secondaryActions}\n />\n <CollectionPage.Content>\n <AutoPatternsCollectionPageContent configuration={configuration} />\n </CollectionPage.Content>\n </CollectionPage>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,iCAAiC,QAAQ,sCAAsC;AAExF,SAASC,wBAAwB,QAAQ,sCAAsC;AAC/E,SAASC,SAAS,EAAEC,GAAG,QAAQ,oBAAoB;AACnD,SAASC,mBAAmB,QAAQ,iBAAiB;AAMrD,OAAO,MAAMC,0BAEZ,GAAGC,IAAA,IAAuB;EAAA,IAAtB;IAAEC;EAAc,CAAC,GAAAD,IAAA;EACpB,MAAM;IAAEE,KAAK;IAAEC;EAAS,CAAC,GAAGF,aAAa;EACzC,MAAM;IAAEG;EAAO,CAAC,GAAGN,mBAAmB,CAAC,CAAC;EAExC,MAAMO,OAAO,GAAGV,wBAAwB,CAAC;IACvCW,qBAAqB,EAAEL,aAAa,CAACI;EACvC,CAAC,CAAC;;EAEF;EACA,IAAID,MAAM,KAAK,OAAO,EAAE;IACtB,oBACEZ,KAAA,CAAAe,aAAA,CAACX,SAAS;MAACY,IAAI,EAAC,UAAU;MAACC,KAAK,EAAC;IAAO,gBACtCjB,KAAA,CAAAe,aAAA,CAACX,SAAS,CAACc,MAAM;MAACR,KAAK,EAAC;IAAgB,CAAE,CAAC,eAC3CV,KAAA,CAAAe,aAAA,CAACX,SAAS,CAACe,OAAO;MAACC,SAAS;MAACC,iBAAiB;IAAA,gBAC5CrB,KAAA,CAAAe,aAAA,CAACV,GAAG;MAACiB,SAAS,EAAC,UAAU;MAACL,KAAK,EAAC,MAAM;MAACM,MAAM,EAAC;IAAO,gBACnDvB,KAAA,CAAAe,aAAA,CAACb,iCAAiC;MAACO,aAAa,EAAEA;IAAc,CAAE,CAC/D,CACY,CACV,CAAC;EAEhB;EAEA,oBACET,KAAA,CAAAe,aAAA,CAACd,cAAc;IAACsB,MAAM,EAAC,OAAO;IAACC,QAAQ,EAAC;EAAoB,gBAC1DxB,KAAA,CAAAe,aAAA,CAACd,cAAc,CAACiB,MAAM;IACpBR,KAAK,EAAEA,KAAM;IACbC,QAAQ,EAAEA,QAAS;IACnBc,aAAa,EAAEZ,OAAO,CAACa,cAAe;IACtCC,gBAAgB,EAAEd,OAAO,CAACc;EAAiB,CAC5C,CAAC,eACF3B,KAAA,CAAAe,aAAA,CAACd,cAAc,CAACkB,OAAO,qBACrBnB,KAAA,CAAAe,aAAA,CAACb,iCAAiC;IAACO,aAAa,EAAEA;EAAc,CAAE,CAC5C,CACV,CAAC;AAErB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","CollectionPage","AutoPatternsCollectionPageContent","useCollectionPageActions","AutoPatternsCollectionPageFooter","AutoPatternsCollectionPage","_ref","configuration","title","subtitle","actions","collectionPageActions","createElement","height","dataHook","Header","primaryAction","primaryActions","secondaryActions","Content","Footer"],"sources":["../../../../src/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.tsx"],"sourcesContent":["import React from 'react';\nimport { CollectionPage } from '@wix/patterns/page';\nimport { AutoPatternsCollectionPageContent } from '../AutoPatternsCollectionPageContent';\nimport { CollectionPageConfig } from '../../types/CollectionPageConfig';\nimport { useCollectionPageActions } from '../../hooks/useCollectionPageActions';\nimport { AutoPatternsCollectionPageFooter } from '../AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter';\n\nexport interface AutoPatternsCollectionPageProps {\n configuration: CollectionPageConfig;\n}\n\nexport const AutoPatternsCollectionPage: React.FC<\n AutoPatternsCollectionPageProps\n> = ({ configuration }) => {\n const { title, subtitle } = configuration;\n\n const actions = useCollectionPageActions({\n collectionPageActions: configuration.actions,\n });\n\n return (\n <CollectionPage height=\"100vh\" dataHook=\"auto-patterns-page\">\n <CollectionPage.Header\n title={title}\n subtitle={subtitle}\n primaryAction={actions.primaryActions}\n secondaryActions={actions.secondaryActions}\n />\n <CollectionPage.Content>\n <AutoPatternsCollectionPageContent configuration={configuration} />\n </CollectionPage.Content>\n <CollectionPage.Footer>\n <AutoPatternsCollectionPageFooter />\n </CollectionPage.Footer>\n </CollectionPage>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,iCAAiC,QAAQ,sCAAsC;AAExF,SAASC,wBAAwB,QAAQ,sCAAsC;AAC/E,SAASC,gCAAgC,QAAQ,sEAAsE;AAMvH,OAAO,MAAMC,0BAEZ,GAAGC,IAAA,IAAuB;EAAA,IAAtB;IAAEC;EAAc,CAAC,GAAAD,IAAA;EACpB,MAAM;IAAEE,KAAK;IAAEC;EAAS,CAAC,GAAGF,aAAa;EAEzC,MAAMG,OAAO,GAAGP,wBAAwB,CAAC;IACvCQ,qBAAqB,EAAEJ,aAAa,CAACG;EACvC,CAAC,CAAC;EAEF,oBACEV,KAAA,CAAAY,aAAA,CAACX,cAAc;IAACY,MAAM,EAAC,OAAO;IAACC,QAAQ,EAAC;EAAoB,gBAC1Dd,KAAA,CAAAY,aAAA,CAACX,cAAc,CAACc,MAAM;IACpBP,KAAK,EAAEA,KAAM;IACbC,QAAQ,EAAEA,QAAS;IACnBO,aAAa,EAAEN,OAAO,CAACO,cAAe;IACtCC,gBAAgB,EAAER,OAAO,CAACQ;EAAiB,CAC5C,CAAC,eACFlB,KAAA,CAAAY,aAAA,CAACX,cAAc,CAACkB,OAAO,qBACrBnB,KAAA,CAAAY,aAAA,CAACV,iCAAiC;IAACK,aAAa,EAAEA;EAAc,CAAE,CAC5C,CAAC,eACzBP,KAAA,CAAAY,aAAA,CAACX,cAAc,CAACmB,MAAM,qBACpBpB,KAAA,CAAAY,aAAA,CAACR,gCAAgC,MAAE,CACd,CACT,CAAC;AAErB,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { usePatternsWizardOverridesContext } from '../../providers';
2
+ import { useAutoPatternsOverridesContext } from '../../providers';
3
3
  import { AutoPatternsCollectionComponent } from '../AutoPatternsCollectionComponent/AutoPatternsCollectionComponent';
4
4
  export const AutoPatternsCollectionPageContent = _ref => {
5
5
  let {
@@ -8,7 +8,7 @@ export const AutoPatternsCollectionPageContent = _ref => {
8
8
  const {
9
9
  components
10
10
  } = configuration;
11
- const overrides = usePatternsWizardOverridesContext();
11
+ const overrides = useAutoPatternsOverridesContext();
12
12
  return /*#__PURE__*/React.createElement(React.Fragment, null, components.map((component, index) => {
13
13
  if (component.type === 'collection') {
14
14
  return /*#__PURE__*/React.createElement(AutoPatternsCollectionComponent, {
@@ -1 +1 @@
1
- {"version":3,"names":["React","usePatternsWizardOverridesContext","AutoPatternsCollectionComponent","AutoPatternsCollectionPageContent","_ref","configuration","components","overrides","createElement","Fragment","map","component","index","type","key","collection","collectionId","_overrides$slots","CustomComponent","slots","id","filter","Boolean"],"sources":["../../../../src/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.tsx"],"sourcesContent":["import React from 'react';\nimport { CollectionPageConfig } from '../../types';\nimport { usePatternsWizardOverridesContext } from '../../providers';\nimport { AutoPatternsCollectionComponent } from '../AutoPatternsCollectionComponent/AutoPatternsCollectionComponent';\n\nexport interface AutoPatternsCollectionPageContentProps {\n configuration: CollectionPageConfig;\n}\n\nexport const AutoPatternsCollectionPageContent = ({\n configuration,\n}: AutoPatternsCollectionPageContentProps) => {\n const { components } = configuration;\n const overrides = usePatternsWizardOverridesContext();\n\n return (\n <>\n {components\n .map((component, index) => {\n if (component.type === 'collection') {\n return (\n <AutoPatternsCollectionComponent\n key={`collection-${component.collection.collectionId}-${index}`}\n component={component}\n index={index}\n />\n );\n } else if (component.type === 'custom') {\n const CustomComponent = overrides?.slots?.[component.id];\n\n if (!CustomComponent) {\n return null;\n }\n\n return <CustomComponent key={`custom-${component.id}-${index}`} />;\n }\n\n return null;\n })\n .filter(Boolean)}\n </>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,iCAAiC,QAAQ,iBAAiB;AACnE,SAASC,+BAA+B,QAAQ,oEAAoE;AAMpH,OAAO,MAAMC,iCAAiC,GAAGC,IAAA,IAEH;EAAA,IAFI;IAChDC;EACsC,CAAC,GAAAD,IAAA;EACvC,MAAM;IAAEE;EAAW,CAAC,GAAGD,aAAa;EACpC,MAAME,SAAS,GAAGN,iCAAiC,CAAC,CAAC;EAErD,oBACED,KAAA,CAAAQ,aAAA,CAAAR,KAAA,CAAAS,QAAA,QACGH,UAAU,CACRI,GAAG,CAAC,CAACC,SAAS,EAAEC,KAAK,KAAK;IACzB,IAAID,SAAS,CAACE,IAAI,KAAK,YAAY,EAAE;MACnC,oBACEb,KAAA,CAAAQ,aAAA,CAACN,+BAA+B;QAC9BY,GAAG,EAAE,cAAcH,SAAS,CAACI,UAAU,CAACC,YAAY,IAAIJ,KAAK,EAAG;QAChED,SAAS,EAAEA,SAAU;QACrBC,KAAK,EAAEA;MAAM,CACd,CAAC;IAEN,CAAC,MAAM,IAAID,SAAS,CAACE,IAAI,KAAK,QAAQ,EAAE;MAAA,IAAAI,gBAAA;MACtC,MAAMC,eAAe,GAAGX,SAAS,aAAAU,gBAAA,GAATV,SAAS,CAAEY,KAAK,qBAAhBF,gBAAA,CAAmBN,SAAS,CAACS,EAAE,CAAC;MAExD,IAAI,CAACF,eAAe,EAAE;QACpB,OAAO,IAAI;MACb;MAEA,oBAAOlB,KAAA,CAAAQ,aAAA,CAACU,eAAe;QAACJ,GAAG,EAAE,UAAUH,SAAS,CAACS,EAAE,IAAIR,KAAK;MAAG,CAAE,CAAC;IACpE;IAEA,OAAO,IAAI;EACb,CAAC,CAAC,CACDS,MAAM,CAACC,OAAO,CACjB,CAAC;AAEP,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useAutoPatternsOverridesContext","AutoPatternsCollectionComponent","AutoPatternsCollectionPageContent","_ref","configuration","components","overrides","createElement","Fragment","map","component","index","type","key","collection","collectionId","_overrides$slots","CustomComponent","slots","id","filter","Boolean"],"sources":["../../../../src/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.tsx"],"sourcesContent":["import React from 'react';\nimport { CollectionPageConfig } from '../../types';\nimport { useAutoPatternsOverridesContext } from '../../providers';\nimport { AutoPatternsCollectionComponent } from '../AutoPatternsCollectionComponent/AutoPatternsCollectionComponent';\n\nexport interface AutoPatternsCollectionPageContentProps {\n configuration: CollectionPageConfig;\n}\n\nexport const AutoPatternsCollectionPageContent = ({\n configuration,\n}: AutoPatternsCollectionPageContentProps) => {\n const { components } = configuration;\n const overrides = useAutoPatternsOverridesContext();\n\n return (\n <>\n {components\n .map((component, index) => {\n if (component.type === 'collection') {\n return (\n <AutoPatternsCollectionComponent\n key={`collection-${component.collection.collectionId}-${index}`}\n component={component}\n index={index}\n />\n );\n } else if (component.type === 'custom') {\n const CustomComponent = overrides?.slots?.[component.id];\n\n if (!CustomComponent) {\n return null;\n }\n\n return <CustomComponent key={`custom-${component.id}-${index}`} />;\n }\n\n return null;\n })\n .filter(Boolean)}\n </>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,+BAA+B,QAAQ,iBAAiB;AACjE,SAASC,+BAA+B,QAAQ,oEAAoE;AAMpH,OAAO,MAAMC,iCAAiC,GAAGC,IAAA,IAEH;EAAA,IAFI;IAChDC;EACsC,CAAC,GAAAD,IAAA;EACvC,MAAM;IAAEE;EAAW,CAAC,GAAGD,aAAa;EACpC,MAAME,SAAS,GAAGN,+BAA+B,CAAC,CAAC;EAEnD,oBACED,KAAA,CAAAQ,aAAA,CAAAR,KAAA,CAAAS,QAAA,QACGH,UAAU,CACRI,GAAG,CAAC,CAACC,SAAS,EAAEC,KAAK,KAAK;IACzB,IAAID,SAAS,CAACE,IAAI,KAAK,YAAY,EAAE;MACnC,oBACEb,KAAA,CAAAQ,aAAA,CAACN,+BAA+B;QAC9BY,GAAG,EAAE,cAAcH,SAAS,CAACI,UAAU,CAACC,YAAY,IAAIJ,KAAK,EAAG;QAChED,SAAS,EAAEA,SAAU;QACrBC,KAAK,EAAEA;MAAM,CACd,CAAC;IAEN,CAAC,MAAM,IAAID,SAAS,CAACE,IAAI,KAAK,QAAQ,EAAE;MAAA,IAAAI,gBAAA;MACtC,MAAMC,eAAe,GAAGX,SAAS,aAAAU,gBAAA,GAATV,SAAS,CAAEY,KAAK,qBAAhBF,gBAAA,CAAmBN,SAAS,CAACS,EAAE,CAAC;MAExD,IAAI,CAACF,eAAe,EAAE;QACpB,OAAO,IAAI;MACb;MAEA,oBAAOlB,KAAA,CAAAQ,aAAA,CAACU,eAAe;QAACJ,GAAG,EAAE,UAAUH,SAAS,CAACS,EAAE,IAAIR,KAAK;MAAG,CAAE,CAAC;IACpE;IAEA,OAAO,IAAI;EACb,CAAC,CAAC,CACDS,MAAM,CAACC,OAAO,CACjB,CAAC;AAEP,CAAC","ignoreList":[]}
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { useWixPatternsContainer } from '@wix/patterns';
3
+ import { getMetasiteId } from '../../utils/vibe';
4
+ import { Box, TextButton } from '@wix/design-system';
5
+ const WIX_DASHBOARD_BASE_URL = 'https://manage.wix.com/dashboard/';
6
+ export const AutoPatternsCollectionPageFooter = () => {
7
+ const {
8
+ layoutType
9
+ } = useWixPatternsContainer();
10
+ const isPanel = layoutType === 'panel';
11
+ const metasiteId = getMetasiteId();
12
+
13
+ // Temporary solution - need to improve:
14
+ // 1. Not only CMS
15
+ // 2. Not only Panel
16
+ // 3. Translations
17
+
18
+ if (!isPanel) {
19
+ return null;
20
+ }
21
+ return /*#__PURE__*/React.createElement(Box, {
22
+ align: "center"
23
+ }, /*#__PURE__*/React.createElement(TextButton, {
24
+ onClick: () => {
25
+ window.open(`${WIX_DASHBOARD_BASE_URL}${metasiteId}/database`, '_blank');
26
+ }
27
+ }, "Manage Items"));
28
+ };
29
+ //# sourceMappingURL=AutoPatternsCollectionPageFooter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useWixPatternsContainer","getMetasiteId","Box","TextButton","WIX_DASHBOARD_BASE_URL","AutoPatternsCollectionPageFooter","layoutType","isPanel","metasiteId","createElement","align","onClick","window","open"],"sources":["../../../../src/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.tsx"],"sourcesContent":["import React from 'react';\nimport { useWixPatternsContainer } from '@wix/patterns';\nimport { getMetasiteId } from '../../utils/vibe';\nimport { Box, TextButton } from '@wix/design-system';\n\nconst WIX_DASHBOARD_BASE_URL = 'https://manage.wix.com/dashboard/';\n\nexport const AutoPatternsCollectionPageFooter = () => {\n const { layoutType } = useWixPatternsContainer();\n const isPanel = layoutType === 'panel';\n const metasiteId = getMetasiteId();\n\n // Temporary solution - need to improve:\n // 1. Not only CMS\n // 2. Not only Panel\n // 3. Translations\n\n if (!isPanel) {\n return null;\n }\n\n return (\n <Box align=\"center\">\n <TextButton\n onClick={() => {\n window.open(\n `${WIX_DASHBOARD_BASE_URL}${metasiteId}/database`,\n '_blank',\n );\n }}\n >\n Manage Items\n </TextButton>\n </Box>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,uBAAuB,QAAQ,eAAe;AACvD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,GAAG,EAAEC,UAAU,QAAQ,oBAAoB;AAEpD,MAAMC,sBAAsB,GAAG,mCAAmC;AAElE,OAAO,MAAMC,gCAAgC,GAAGA,CAAA,KAAM;EACpD,MAAM;IAAEC;EAAW,CAAC,GAAGN,uBAAuB,CAAC,CAAC;EAChD,MAAMO,OAAO,GAAGD,UAAU,KAAK,OAAO;EACtC,MAAME,UAAU,GAAGP,aAAa,CAAC,CAAC;;EAElC;EACA;EACA;EACA;;EAEA,IAAI,CAACM,OAAO,EAAE;IACZ,OAAO,IAAI;EACb;EAEA,oBACER,KAAA,CAAAU,aAAA,CAACP,GAAG;IAACQ,KAAK,EAAC;EAAQ,gBACjBX,KAAA,CAAAU,aAAA,CAACN,UAAU;IACTQ,OAAO,EAAEA,CAAA,KAAM;MACbC,MAAM,CAACC,IAAI,CACT,GAAGT,sBAAsB,GAAGI,UAAU,WAAW,EACjD,QACF,CAAC;IACH;EAAE,GACH,cAEW,CACT,CAAC;AAEV,CAAC","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Cell, Layout } from '@wix/design-system';
3
3
  import { useSchema } from '../../../providers/SchemaContext';
4
- import { usePatternsWizardOverridesContext } from '../../../providers';
4
+ import { useAutoPatternsOverridesContext } from '../../../providers';
5
5
  import { useEntityPageContext } from '@wix/patterns';
6
6
  import { FormFieldInput } from '../Fields/FormFieldInput';
7
7
  export const RenderLayoutContent = _ref => {
@@ -15,7 +15,7 @@ export const RenderLayoutContent = _ref => {
15
15
  setInputRef
16
16
  } = _ref;
17
17
  const schema = useSchema();
18
- const overrides = usePatternsWizardOverridesContext();
18
+ const overrides = useAutoPatternsOverridesContext();
19
19
  const pageState = useEntityPageContext();
20
20
  const entity = pageState.entity;
21
21
  switch (content.type) {
@@ -1 +1 @@
1
- {"version":3,"names":["React","Cell","Layout","useSchema","usePatternsWizardOverridesContext","useEntityPageContext","FormFieldInput","RenderLayoutContent","_ref","_content$container$ch","_overrides$components","content","level","sectionId","cardIndex","contentIndex","setInputRef","schema","overrides","pageState","entity","type","field","fieldId","fields","createElement","span","key","inputRef","ref","container","children","length","map","child","index","component","componentId","Component","components","form"],"sources":["../../../../../src/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.tsx"],"sourcesContent":["import React from 'react';\nimport { Cell, Layout } from '@wix/design-system';\nimport { useSchema } from '../../../providers/SchemaContext';\nimport { usePatternsWizardOverridesContext } from '../../../providers';\nimport { useEntityPageContext } from '@wix/patterns';\nimport { FormFieldInput } from '../Fields/FormFieldInput';\nimport { LayoutContent } from '../../../types';\nimport { BaseInputRef } from '../Fields/types';\n\nexport interface RenderLayoutContentProps {\n content: LayoutContent;\n level: number;\n sectionId: string;\n cardIndex: number;\n contentIndex: number;\n setInputRef: (id: string, input: BaseInputRef) => void;\n}\n\nexport const RenderLayoutContent: React.FC<RenderLayoutContentProps> = ({\n content,\n level,\n sectionId,\n cardIndex,\n contentIndex,\n setInputRef,\n}) => {\n const schema = useSchema();\n const overrides = usePatternsWizardOverridesContext();\n const pageState = useEntityPageContext();\n\n const entity = pageState.entity;\n\n switch (content.type) {\n case 'field':\n if (!content.field.fieldId) {\n return null;\n }\n\n const field = schema.fields[content.field.fieldId];\n if (!field) {\n return null;\n }\n\n return (\n <Cell span={content.field.span}>\n <FormFieldInput\n key={content.field.fieldId}\n field={field}\n inputRef={(ref) => setInputRef(content.field.fieldId, ref)}\n />\n </Cell>\n );\n\n case 'container':\n if (!content.container.children?.length) {\n return null;\n }\n\n return (\n <Cell span={content.container.span}>\n <Layout>\n {content.container.children.map((child, index) => (\n <RenderLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${contentIndex}-level-${level}-child-${index}`}\n content={child}\n level={level + 1}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n setInputRef={setInputRef}\n />\n ))}\n </Layout>\n </Cell>\n );\n\n case 'component':\n if (!content.component.componentId) {\n return null;\n }\n\n const Component = overrides?.components?.[content.component.componentId];\n if (!Component) {\n return null;\n }\n\n return (\n <Cell span={content.component.span}>\n <Component\n form={pageState?.form as any}\n entity={entity as Record<string, any>}\n />\n </Cell>\n );\n\n default:\n return null;\n }\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,MAAM,QAAQ,oBAAoB;AACjD,SAASC,SAAS,QAAQ,kCAAkC;AAC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KAAA,CAAAyB,aAAA,CAACxB,IAAI;QAACyB,IAAI,EAAEf,OAAO,CAACmB,SAAS,CAACJ;MAAK,gBACjC1B,KAAA,CAAAyB,aAAA,CAACvB,MAAM,QACJS,OAAO,CAACmB,SAAS,CAACC,QAAQ,CAACE,GAAG,CAAC,CAACC,KAAK,EAAEC,KAAK,kBAC3CnC,KAAA,CAAAyB,aAAA,CAAClB,mBAAmB;QAClBoB,GAAG,EAAE,GAAGd,SAAS,SAASC,SAAS,YAAYC,YAAY,UAAUH,KAAK,UAAUuB,KAAK,EAAG;QAC5FxB,OAAO,EAAEuB,KAAM;QACftB,KAAK,EAAEA,KAAK,GAAG,CAAE;QACjBC,SAAS,EAAEA,SAAU;QACrBC,SAAS,EAAEA,SAAU;QACrBC,YAAY,EAAEoB,KAAM;QACpBnB,WAAW,EAAEA;MAAY,CAC1B,CACF,CACK,CACJ,CAAC;IAGX,KAAK,WAAW;MACd,IAAI,CAACL,OAAO,CAACyB,SAAS,CAACC,WAAW,EAAE;QAClC,OAAO,IAAI;MACb;MAEA,MAAMC,SAAS,GAAGpB,SAAS,aAAAR,qBAAA,GAATQ,SAAS,CAAEqB,UAAU,qBAArB7B,qBAAA,CAAwBC,OAAO,CAACyB,SAAS,CAACC,WAAW,CAAC;MACxE,IAAI,CAACC,SAAS,EAAE;QACd,OAAO,IAAI;MACb;MAEA,oBACEtC,KAAA,CAAAyB,aAAA,CAACxB,IAAI;QAACyB,IAAI,EAAEf,OAAO,CAACyB,SAAS,CAACV;MAAK,gBACjC1B,KAAA,CAAAyB,aAAA,CAACa,SAAS;QACRE,IAAI,EAAErB,SAAS,oBAATA,SAAS,CAAEqB,IAAY;QAC7BpB,MAAM,EAAEA;MAA8B,CACvC,CACG,CAAC;IAGX;MACE,OAAO,IAAI;EACf;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","Cell","Layout","useSchema","useAutoPatternsOverridesContext","useEntityPageContext","FormFieldInput","RenderLayoutContent","_ref","_content$container$ch","_overrides$components","content","level","sectionId","cardIndex","contentIndex","setInputRef","schema","overrides","pageState","entity","type","field","fieldId","fields","createElement","span","key","inputRef","ref","container","children","length","map","child","index","component","componentId","Component","components","form"],"sources":["../../../../../src/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.tsx"],"sourcesContent":["import React from 'react';\nimport { Cell, Layout } from '@wix/design-system';\nimport { useSchema } from '../../../providers/SchemaContext';\nimport { useAutoPatternsOverridesContext } from '../../../providers';\nimport { useEntityPageContext } from '@wix/patterns';\nimport { FormFieldInput } from '../Fields/FormFieldInput';\nimport { LayoutContent } from '../../../types';\nimport { BaseInputRef } from '../Fields/types';\n\nexport interface RenderLayoutContentProps {\n content: LayoutContent;\n level: number;\n sectionId: string;\n cardIndex: number;\n contentIndex: number;\n setInputRef: (id: string, input: BaseInputRef) => void;\n}\n\nexport const RenderLayoutContent: React.FC<RenderLayoutContentProps> = ({\n content,\n level,\n sectionId,\n cardIndex,\n contentIndex,\n setInputRef,\n}) => {\n const schema = useSchema();\n const overrides = useAutoPatternsOverridesContext();\n const pageState = useEntityPageContext();\n\n const entity = pageState.entity;\n\n switch (content.type) {\n case 'field':\n if (!content.field.fieldId) {\n return null;\n }\n\n const field = schema.fields[content.field.fieldId];\n if (!field) {\n return null;\n }\n\n return (\n <Cell span={content.field.span}>\n <FormFieldInput\n key={content.field.fieldId}\n field={field}\n inputRef={(ref) => setInputRef(content.field.fieldId, ref)}\n />\n </Cell>\n );\n\n case 'container':\n if (!content.container.children?.length) {\n return null;\n }\n\n return (\n <Cell span={content.container.span}>\n <Layout>\n {content.container.children.map((child, index) => (\n <RenderLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${contentIndex}-level-${level}-child-${index}`}\n content={child}\n level={level + 1}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n setInputRef={setInputRef}\n />\n ))}\n </Layout>\n </Cell>\n );\n\n case 'component':\n if (!content.component.componentId) {\n return null;\n }\n\n const Component = overrides?.components?.[content.component.componentId];\n if (!Component) {\n return null;\n }\n\n return (\n <Cell span={content.component.span}>\n <Component\n form={pageState?.form as any}\n entity={entity as Record<string, any>}\n />\n </Cell>\n );\n\n default:\n return null;\n }\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,MAAM,QAAQ,oBAAoB;AACjD,SAASC,SAAS,QAAQ,kCAAkC;AAC5D,SAASC,+BAA+B,QAAQ,oBAAoB;AACpE,SAASC,oBAAoB,QAAQ,eAAe;AACpD,SAASC,cAAc,QAAQ,0BAA0B;AAazD,OAAO,MAAMC,mBAAuD,GAAGC,IAAA,IAOjE;EAAA,IAAAC,qBAAA,EAAAC,qBAAA;EAAA,IAPkE;IACtEC,OAAO;IACPC,KAAK;IACLC,SAAS;IACTC,SAAS;IACTC,YAAY;IACZC;EACF,CAAC,GAAAR,IAAA;EACC,MAAMS,MAAM,GAAGd,SAAS,CAAC,CAAC;EAC1B,MAAMe,SAAS,GAAGd,+BAA+B,CAAC,CAAC;EACnD,MAAMe,SAAS,GAAGd,oBAAoB,CAAC,CAAC;EAExC,MAAMe,MAAM,GAAGD,SAAS,CAACC,MAAM;EAE/B,QAAQT,OAAO,CAACU,IAAI;IAClB,KAAK,OAAO;MACV,IAAI,CAACV,OAAO,CAACW,KAAK,CAACC,OAAO,EAAE;QAC1B,OAAO,IAAI;MACb;MAEA,MAAMD,KAAK,GAAGL,MAAM,CAACO,MAAM,CAACb,OAAO,CAACW,KAAK,CAACC,OAAO,CAAC;MAClD,IAAI,CAACD,KAAK,EAAE;QACV,OAAO,IAAI;MACb;MAEA,oBACEtB,KAAA,CAAAyB,aAAA,CAACxB,IAAI;QAACyB,IAAI,EAAEf,OAAO,CAACW,KAAK,CAACI;MAAK,gBAC7B1B,KAAA,CAAAyB,aAAA,CAACnB,cAAc;QACbqB,GAAG,EAAEhB,OAAO,CAACW,KAAK,CAACC,OAAQ;QAC3BD,KAAK,EAAEA,KAAM;QACbM,QAAQ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AACa,SAAS;QACRE,IAAI,EAAErB,SAAS,oBAATA,SAAS,CAAEqB,IAAY;QAC7BpB,MAAM,EAAEA;MAA8B,CACvC,CACG,CAAC;IAGX;MACE,OAAO,IAAI;EACf;AACF,CAAC","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Cell, Layout } from '@wix/design-system';
3
3
  import { useSchema } from '../../../providers/SchemaContext';
4
- import { usePatternsWizardOverridesContext } from '../../../providers';
4
+ import { useAutoPatternsOverridesContext } from '../../../providers';
5
5
  import { RenderViewField } from '../RenderLayout/RenderViewField';
6
6
  // TODO: remove this component and use RenderLayoutContent instead
7
7
  export const RenderViewLayoutContent = _ref => {
@@ -15,7 +15,7 @@ export const RenderViewLayoutContent = _ref => {
15
15
  contentIndex
16
16
  } = _ref;
17
17
  const schema = useSchema();
18
- const overrides = usePatternsWizardOverridesContext();
18
+ const overrides = useAutoPatternsOverridesContext();
19
19
  switch (content.type) {
20
20
  case 'field':
21
21
  if (!content.field.fieldId) {
@@ -1 +1 @@
1
- {"version":3,"names":["React","Cell","Layout","useSchema","usePatternsWizardOverridesContext","RenderViewField","RenderViewLayoutContent","_ref","_content$container$ch","_overrides$components","entity","content","level","sectionId","cardIndex","contentIndex","schema","overrides","type","field","fieldId","fields","createElement","span","container","children","length","map","child","index","key","component","componentId","Component","components"],"sources":["../../../../../src/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.tsx"],"sourcesContent":["import React from 'react';\nimport { Cell, Layout } from '@wix/design-system';\nimport { useSchema } from '../../../providers/SchemaContext';\nimport { usePatternsWizardOverridesContext } from '../../../providers';\nimport { RenderViewField } from '../RenderLayout/RenderViewField';\nimport { RenderLayoutContentProps } from '../RenderLayout';\n\ninterface RenderViewLayoutContentProps\n extends Omit<RenderLayoutContentProps, 'setInputRef'> {\n entity: Record<string, any>;\n}\n\n// TODO: remove this component and use RenderLayoutContent instead\nexport const RenderViewLayoutContent: React.FC<\n RenderViewLayoutContentProps\n> = ({ entity, content, level, sectionId, cardIndex, contentIndex }) => {\n const schema = useSchema();\n const overrides = usePatternsWizardOverridesContext();\n\n switch (content.type) {\n case 'field':\n if (!content.field.fieldId) {\n return null;\n }\n\n const field = schema.fields[content.field.fieldId];\n if (!field) {\n return null;\n }\n\n return (\n <RenderViewField\n field={field}\n fieldId={content.field.fieldId}\n entity={entity}\n span={content.field.span}\n />\n );\n\n case 'container':\n if (!content.container.children?.length) {\n return null;\n }\n\n return (\n <Cell span={content.container.span}>\n <Layout>\n {content.container.children.map((child, index) => (\n <RenderViewLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${contentIndex}-level-${level}-child-${index}`}\n entity={entity}\n content={child}\n level={level + 1}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n />\n ))}\n </Layout>\n </Cell>\n );\n\n case 'component':\n if (!content.component.componentId) {\n return null;\n }\n\n const Component = overrides?.components?.[content.component.componentId];\n if (!Component) {\n return null;\n }\n\n return (\n <Cell span={content.component.span}>\n <Component entity={entity} />\n </Cell>\n );\n\n default:\n return null;\n }\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,MAAM,QAAQ,oBAAoB;AACjD,SAASC,SAAS,QAAQ,kCAAkC;AAC5D,SAASC,iCAAiC,QAAQ,oBAAoB;AACtE,SAASC,eAAe,QAAQ,iCAAiC;AAQjE;AACA,OAAO,MAAMC,uBAEZ,GAAGC,IAAA,IAAoE;EAAA,IAAAC,qBAAA,EAAAC,qBAAA;EAAA,IAAnE;IAAEC,MAAM;IAAEC,OAAO;IAAEC,KAAK;IAAEC,SAAS;IAAEC,SAAS;IAAEC;EAAa,CAAC,GAAAR,IAAA;EACjE,MAAMS,MAAM,GAAGb,SAAS,CAAC,CAAC;EAC1B,MAAMc,SAAS,GAAGb,iCAAiC,CAAC,CAAC;EAErD,QAAQO,OAAO,CAACO,IAAI;IAClB,KAAK,OAAO;MACV,IAAI,CAACP,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C,SAAS,GAAGhB,SAAS,aAAAR,qBAAA,GAATQ,SAAS,CAAEiB,UAAU,qBAArBzB,qBAAA,CAAwBE,OAAO,CAACoB,SAAS,CAACC,WAAW,CAAC;MACxE,IAAI,CAACC,SAAS,EAAE;QACd,OAAO,IAAI;MACb;MAEA,oBACEjC,KAAA,CAAAsB,aAAA,CAACrB,IAAI;QAACsB,IAAI,EAAEZ,OAAO,CAACoB,SAAS,CAACR;MAAK,gBACjCvB,KAAA,CAAAsB,aAAA,CAACW,SAAS;QAACvB,MAAM,EAAEA;MAAO,CAAE,CACxB,CAAC;IAGX;MACE,OAAO,IAAI;EACf;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","Cell","Layout","useSchema","useAutoPatternsOverridesContext","RenderViewField","RenderViewLayoutContent","_ref","_content$container$ch","_overrides$components","entity","content","level","sectionId","cardIndex","contentIndex","schema","overrides","type","field","fieldId","fields","createElement","span","container","children","length","map","child","index","key","component","componentId","Component","components"],"sources":["../../../../../src/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.tsx"],"sourcesContent":["import React from 'react';\nimport { Cell, Layout } from '@wix/design-system';\nimport { useSchema } from '../../../providers/SchemaContext';\nimport { useAutoPatternsOverridesContext } from '../../../providers';\nimport { RenderViewField } from '../RenderLayout/RenderViewField';\nimport { RenderLayoutContentProps } from '../RenderLayout';\n\ninterface RenderViewLayoutContentProps\n extends Omit<RenderLayoutContentProps, 'setInputRef'> {\n entity: Record<string, any>;\n}\n\n// TODO: remove this component and use RenderLayoutContent instead\nexport const RenderViewLayoutContent: React.FC<\n RenderViewLayoutContentProps\n> = ({ entity, content, level, sectionId, cardIndex, contentIndex }) => {\n const schema = useSchema();\n const overrides = useAutoPatternsOverridesContext();\n\n switch (content.type) {\n case 'field':\n if (!content.field.fieldId) {\n return null;\n }\n\n const field = schema.fields[content.field.fieldId];\n if (!field) {\n return null;\n }\n\n return (\n <RenderViewField\n field={field}\n fieldId={content.field.fieldId}\n entity={entity}\n span={content.field.span}\n />\n );\n\n case 'container':\n if (!content.container.children?.length) {\n return null;\n }\n\n return (\n <Cell span={content.container.span}>\n <Layout>\n {content.container.children.map((child, index) => (\n <RenderViewLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${contentIndex}-level-${level}-child-${index}`}\n entity={entity}\n content={child}\n level={level + 1}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n />\n ))}\n </Layout>\n </Cell>\n );\n\n case 'component':\n if (!content.component.componentId) {\n return null;\n }\n\n const Component = overrides?.components?.[content.component.componentId];\n if (!Component) {\n return null;\n }\n\n return (\n <Cell span={content.component.span}>\n <Component entity={entity} />\n </Cell>\n );\n\n default:\n return null;\n }\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,MAAM,QAAQ,oBAAoB;AACjD,SAASC,SAAS,QAAQ,kCAAkC;AAC5D,SAASC,+BAA+B,QAAQ,oBAAoB;AACpE,SAASC,eAAe,QAAQ,iCAAiC;AAQjE;AACA,OAAO,MAAMC,uBAEZ,GAAGC,IAAA,IAAoE;EAAA,IAAAC,qBAAA,EAAAC,qBAAA;EAAA,IAAnE;IAAEC,MAAM;IAAEC,OAAO;IAAEC,KAAK;IAAEC,SAAS;IAAEC,SAAS;IAAEC;EAAa,CAAC,GAAAR,IAAA;EACjE,MAAMS,MAAM,GAAGb,SAAS,CAAC,CAAC;EAC1B,MAAMc,SAAS,GAAGb,+BAA+B,CAAC,CAAC;EAEnD,QAAQO,OAAO,CAACO,IAAI;IAClB,KAAK,OAAO;MACV,IAAI,CAACP,OAAO,CAACQ,KAAK,CAACC,OAAO,EAAE;QAC1B,OAAO,IAAI;MACb;MAEA,MAAMD,KAAK,GAAGH,MAAM,CAACK,MAAM,CAACV,OAAO,CAACQ,KAAK,CAACC,OAAO,CAAC;MAClD,IAAI,CAACD,KAAK,EAAE;QACV,OAAO,IAAI;MACb;MAEA,oBACEnB,KAAA,CAAAsB,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ACsB,IAAI,EAAEZ,OAAO,CAACoB,SAAS,CAACR;MAAK,gBACjCvB,KAAA,CAAAsB,aAAA,CAACW,SAAS;QAACvB,MAAM,EAAEA;MAAO,CAAE,CACxB,CAAC;IAGX;MACE,OAAO,IAAI;EACf;AACF,CAAC","ignoreList":[]}
@@ -3,6 +3,7 @@ import { usePagePath } from '../../hooks';
3
3
  import { PatternsReactRoute, PatternsReactRouter } from '@wix/patterns/router';
4
4
  import { AutoPatternsPage } from './AutoPatternsPage';
5
5
  import { Navigate } from 'react-router-dom';
6
+ import { useWixPatternsContainer } from '@wix/patterns';
6
7
  const pageTypeToRouteType = {
7
8
  collectionPage: 'collection',
8
9
  entityPage: 'editEntity'
@@ -14,7 +15,10 @@ export const AutoPatternsRoutes = _ref => {
14
15
  const {
15
16
  getPagePath
16
17
  } = usePagePath(config);
17
- if (config.layout === 'panel') {
18
+ const {
19
+ layoutType
20
+ } = useWixPatternsContainer();
21
+ if (layoutType === 'panel') {
18
22
  return /*#__PURE__*/React.createElement(React.Fragment, null, config.pages.map(page => {
19
23
  return /*#__PURE__*/React.createElement(AutoPatternsPage, {
20
24
  key: page.id,
@@ -1 +1 @@
1
- {"version":3,"names":["React","usePagePath","PatternsReactRoute","PatternsReactRouter","AutoPatternsPage","Navigate","pageTypeToRouteType","collectionPage","entityPage","AutoPatternsRoutes","_ref","config","getPagePath","layout","createElement","Fragment","pages","map","page","key","id","pageConfig","mainPage","find","appMainPage","routes","routePath","type","path","element","filter","Boolean","mainPagePath","push","to"],"sources":["../../../../src/components/AutoPatternsRoute/AutoPatternsRoutes.tsx"],"sourcesContent":["import React from 'react';\nimport { usePagePath } from '../../hooks';\nimport { PatternsReactRoute, PatternsReactRouter } from '@wix/patterns/router';\nimport { AutoPatternsPage } from './AutoPatternsPage';\nimport type { RouteType } from '@wix/patterns/dist/types/components/Router/types';\nimport { Navigate } from 'react-router-dom';\nimport { AppConfig } from '../../types';\n\nconst pageTypeToRouteType: Record<string, RouteType> = {\n collectionPage: 'collection',\n entityPage: 'editEntity',\n};\n\nexport const AutoPatternsRoutes = ({ config }: { config: AppConfig }) => {\n const { getPagePath } = usePagePath(config);\n\n if (config.layout === 'panel') {\n return (\n <>\n {config.pages.map((page) => {\n return <AutoPatternsPage key={page.id} pageConfig={page} />;\n })}\n </>\n );\n }\n\n const mainPage = config.pages.find((page) => page.appMainPage);\n\n const routes = config.pages\n .map((page) => {\n const routePath = getPagePath(page.id);\n\n if (!routePath) {\n return null;\n }\n\n return (\n <PatternsReactRoute\n key={page.id}\n type={pageTypeToRouteType[page.type] ?? 'other'}\n path={routePath}\n element={<AutoPatternsPage pageConfig={page} />}\n />\n );\n })\n .filter(Boolean);\n\n if (mainPage) {\n const mainPagePath = getPagePath(mainPage.id);\n\n if (mainPagePath) {\n routes.push(\n <PatternsReactRoute\n key=\"main-redirect\"\n type=\"other\"\n path=\"/\"\n element={<Navigate to={mainPagePath} />}\n />,\n );\n }\n }\n\n return <PatternsReactRouter>{routes}</PatternsReactRouter>;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,WAAW,QAAQ,aAAa;AACzC,SAASC,kBAAkB,EAAEC,mBAAmB,QAAQ,sBAAsB;AAC9E,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,SAASC,QAAQ,QAAQ,kBAAkB;AAG3C,MAAMC,mBAA8C,GAAG;EACrDC,cAAc,EAAE,YAAY;EAC5BC,UAAU,EAAE;AACd,CAAC;AAED,OAAO,MAAMC,kBAAkB,GAAGC,IAAA,IAAuC;EAAA,IAAtC;IAAEC;EAA8B,CAAC,GAAAD,IAAA;EAClE,MAAM;IAAEE;EAAY,CAAC,GAAGX,WAAW,CAACU,MAAM,CAAC;EAE3C,IAAIA,MAAM,CAACE,MAAM,KAAK,OAAO,EAAE;IAC7B,oBACEb,KAAA,CAAAc,aAAA,CAAAd,KAAA,CAAAe,QAAA,QACGJ,MAAM,CAACK,KAAK,CAACC,GAAG,CAAEC,IAAI,IA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,MAA4B,CAAC;AAC5D,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","usePagePath","PatternsReactRoute","PatternsReactRouter","AutoPatternsPage","Navigate","useWixPatternsContainer","pageTypeToRouteType","collectionPage","entityPage","AutoPatternsRoutes","_ref","config","getPagePath","layoutType","createElement","Fragment","pages","map","page","key","id","pageConfig","mainPage","find","appMainPage","routes","routePath","type","path","element","filter","Boolean","mainPagePath","push","to"],"sources":["../../../../src/components/AutoPatternsRoute/AutoPatternsRoutes.tsx"],"sourcesContent":["import React from 'react';\nimport { usePagePath } from '../../hooks';\nimport { PatternsReactRoute, PatternsReactRouter } from '@wix/patterns/router';\nimport { AutoPatternsPage } from './AutoPatternsPage';\nimport type { RouteType } from '@wix/patterns/dist/types/components/Router/types';\nimport { Navigate } from 'react-router-dom';\nimport { AppConfig } from '../../types';\nimport { useWixPatternsContainer } from '@wix/patterns';\n\nconst pageTypeToRouteType: Record<string, RouteType> = {\n collectionPage: 'collection',\n entityPage: 'editEntity',\n};\n\nexport const AutoPatternsRoutes = ({ config }: { config: AppConfig }) => {\n const { getPagePath } = usePagePath(config);\n const { layoutType } = useWixPatternsContainer();\n\n if (layoutType === 'panel') {\n return (\n <>\n {config.pages.map((page) => {\n return <AutoPatternsPage key={page.id} pageConfig={page} />;\n })}\n </>\n );\n }\n\n const mainPage = config.pages.find((page) => page.appMainPage);\n\n const routes = config.pages\n .map((page) => {\n const routePath = getPagePath(page.id);\n\n if (!routePath) {\n return null;\n }\n\n return (\n <PatternsReactRoute\n key={page.id}\n type={pageTypeToRouteType[page.type] ?? 'other'}\n path={routePath}\n element={<AutoPatternsPage pageConfig={page} />}\n />\n );\n })\n .filter(Boolean);\n\n if (mainPage) {\n const mainPagePath = getPagePath(mainPage.id);\n\n if (mainPagePath) {\n routes.push(\n <PatternsReactRoute\n key=\"main-redirect\"\n type=\"other\"\n path=\"/\"\n element={<Navigate to={mainPagePath} />}\n />,\n );\n }\n }\n\n return <PatternsReactRouter>{routes}</Pat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I,CAACE,EAAG;MACbO,IAAI,EAAErB,mBAAmB,CAACY,IAAI,CAACS,IAAI,CAAC,IAAI,OAAQ;MAChDC,IAAI,EAAEF,SAAU;MAChBG,OAAO,eAAE9B,KAAA,CAAAe,aAAA,CAACX,gBAAgB;QAACkB,UAAU,EAAEH;MAAK,CAAE;IAAE,CACjD,CAAC;EAEN,CAAC,CAAC,CACDY,MAAM,CAACC,OAAO,CAAC;EAElB,IAAIT,QAAQ,EAAE;IACZ,MAAMU,YAAY,GAAGpB,WAAW,CAACU,QAAQ,CAACF,EAAE,CAAC;IAE7C,IAAIY,YAAY,EAAE;MAChBP,MAAM,CAACQ,IAAI,cACTlC,KAAA,CAAAe,aAAA,CAACb,kBAAkB;QACjBkB,GAAG,EAAC,eAAe;QACnBQ,IAAI,EAAC,OAAO;QACZC,IAAI,EAAC,GAAG;QACRC,OAAO,eAAE9B,KAAA,CAAAe,aAAA,CAACV,QAAQ;UAAC8B,EAAE,EAAEF;QAAa,CAAE;MAAE,CACzC,CACH,CAAC;IACH;EACF;EAEA,oBAAOjC,KAAA,CAAAe,aAAA,CAACZ,mBAAmB,QAAEuB,MAA4B,CAAC;AAC5D,CAAC","ignoreList":[]}
@@ -2,14 +2,14 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import * as modals from './modals';
4
4
  import { useModalContext } from '../providers/ModalContext';
5
- import { usePatternsWizardOverridesContext } from '../providers';
5
+ import { useAutoPatternsOverridesContext } from '../providers';
6
6
  export const ModalRenderer = () => {
7
7
  var _overrides$modals;
8
8
  const {
9
9
  modal,
10
10
  closeModal
11
11
  } = useModalContext();
12
- const overrides = usePatternsWizardOverridesContext();
12
+ const overrides = useAutoPatternsOverridesContext();
13
13
  if (!modal.id) {
14
14
  return null;
15
15
  }
@@ -1 +1 @@
1
- {"version":3,"names":["React","modals","useModalContext","usePatternsWizardOverridesContext","ModalRenderer","_overrides$modals","modal","closeModal","overrides","id","ModalComponent","console","warn","createElement","_extends","props","onClose"],"sources":["../../../src/components/ModalRenderer.tsx"],"sourcesContent":["import React from 'react';\nimport * as modals from './modals';\nimport { useModalContext } from '../providers/ModalContext';\nimport { usePatternsWizardOverridesContext } from '../providers';\n\nexport const ModalRenderer = () => {\n const { modal, closeModal } = useModalContext();\n const overrides = usePatternsWizardOverridesContext();\n\n if (!modal.id) {\n return null;\n }\n\n const ModalComponent =\n overrides?.modals?.[modal.id] ||\n (modals as Record<string, React.ComponentType<any>>)[modal.id];\n\n if (!ModalComponent) {\n console.warn(`No modal registered for id: ${modal.id}`);\n return null;\n }\n\n return <ModalComponent {...modal.props} onClose={closeModal} />;\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAO,KAAKC,MAAM,MAAM,UAAU;AAClC,SAASC,eAAe,QAAQ,2BAA2B;AAC3D,SAASC,iCAAiC,QAAQ,cAAc;AAEhE,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EAAA,IAAAC,iBAAA;EACjC,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGL,eAAe,CAAC,CAAC;EAC/C,MAAMM,SAAS,GAAGL,iCAAiC,CAAC,CAAC;EAErD,IAAI,CAACG,KAAK,CAACG,EAAE,EAAE;IACb,OAAO,IAAI;EACb;EAEA,MAAMC,cAAc,GAClB,CAAAF,SAAS,aAAAH,iBAAA,GAATG,SAAS,CAAEP,MAAM,qBAAjBI,iBAAA,CAAoBC,KAAK,CAACG,EAAE,CAAC,KAC5BR,MAAM,CAA8CK,KAAK,CAACG,EAAE,CAAC;EAEhE,IAAI,CAACC,cAAc,EAAE;IACnBC,OAAO,CAACC,IAAI,CAAC,+BAA+BN,KAAK,CAACG,EAAE,EAAE,CAAC;IACvD,OAAO,IAAI;EACb;EAEA,oBAAOT,KAAA,CAAAa,aAAA,CAACH,cAAc,EAAAI,QAAA,KAAKR,KAAK,CAACS,KAAK;IAAEC,OAAO,EAAET;EAAW,EAAE,CAAC;AACjE,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","modals","useModalContext","useAutoPatternsOverridesContext","ModalRenderer","_overrides$modals","modal","closeModal","overrides","id","ModalComponent","console","warn","createElement","_extends","props","onClose"],"sources":["../../../src/components/ModalRenderer.tsx"],"sourcesContent":["import React from 'react';\nimport * as modals from './modals';\nimport { useModalContext } from '../providers/ModalContext';\nimport { useAutoPatternsOverridesContext } from '../providers';\n\nexport const ModalRenderer = () => {\n const { modal, closeModal } = useModalContext();\n const overrides = useAutoPatternsOverridesContext();\n\n if (!modal.id) {\n return null;\n }\n\n const ModalComponent =\n overrides?.modals?.[modal.id] ||\n (modals as Record<string, React.ComponentType<any>>)[modal.id];\n\n if (!ModalComponent) {\n console.warn(`No modal registered for id: ${modal.id}`);\n return null;\n }\n\n return <ModalComponent {...modal.props} onClose={closeModal} />;\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAO,KAAKC,MAAM,MAAM,UAAU;AAClC,SAASC,eAAe,QAAQ,2BAA2B;AAC3D,SAASC,+BAA+B,QAAQ,cAAc;AAE9D,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EAAA,IAAAC,iBAAA;EACjC,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGL,eAAe,CAAC,CAAC;EAC/C,MAAMM,SAAS,GAAGL,+BAA+B,CAAC,CAAC;EAEnD,IAAI,CAACG,KAAK,CAACG,EAAE,EAAE;IACb,OAAO,IAAI;EACb;EAEA,MAAMC,cAAc,GAClB,CAAAF,SAAS,aAAAH,iBAAA,GAATG,SAAS,CAAEP,MAAM,qBAAjBI,iBAAA,CAAoBC,KAAK,CAACG,EAAE,CAAC,KAC5BR,MAAM,CAA8CK,KAAK,CAACG,EAAE,CAAC;EAEhE,IAAI,CAACC,cAAc,EAAE;IACnBC,OAAO,CAACC,IAAI,CAAC,+BAA+BN,KAAK,CAACG,EAAE,EAAE,CAAC;IACvD,OAAO,IAAI;EACb;EAEA,oBAAOT,KAAA,CAAAa,aAAA,CAACH,cAAc,EAAAI,QAAA,KAAKR,KAAK,CAACS,KAAK;IAAEC,OAAO,EAAET;EAAW,EAAE,CAAC;AACjE,CAAC","ignoreList":[]}
@@ -19,6 +19,10 @@ export const CmsFieldTypeToPatternsFieldType = {
19
19
  };
20
20
  export async function fetchCmsSchema(collectionId) {
21
21
  const schema = await errorHandler.withErrorHandler(async () => collections.getDataCollection(collectionId), {});
22
+ return schema;
23
+ }
24
+ export function transformCmsSchema(schema) {
25
+ const collectionId = schema._id;
22
26
  const transformedFields = (schema.fields || []).reduce((acc, field) => {
23
27
  var _field$capabilities, _field$capabilities2, _field$typeMetadata;
24
28
  if (!field.key) {
@@ -1 +1 @@
1
- {"version":3,"names":["collections","items","fetchCmsData","errorHandler","CmsFieldTypeToPatternsFieldType","Type","TEXT","DATE","DATETIME","NUMBER","BOOLEAN","URL","ADDRESS","OBJECT","RICH_TEXT","RICH_CONTENT","ARRAY","ARRAY_STRING","REFERENCE","IMAGE","fetchCmsSchema","collectionId","schema","withErrorHandler","getDataCollection","transformedFields","fields","reduce","acc","field","_field$capabilities","_field$capabilities2","_field$typeMetadata","key","fieldType","type","baseField","id","displayName","validation","numberRange","min","undefined","max","stringLengthRange","minLength","maxLength","required","capabilities","supportedQueryOperators","queryOperators","sortable","typeMetadata","reference","referencedCollectionId","referenceField","referenceMetadata","nonReferenceType","nonReferenceField","schemaConfig","displayField","idField","actions","get","entityId","create","entity","insert","update","delete","remove","bulkDelete","entityIds","bulkRemove","find","query","options"],"sources":["../../../../src/dataSourceAdapters/cms/cmsAdapter.ts"],"sourcesContent":["import { Field, SchemaConfig, PatternsFieldType } from '../../types';\nimport { collections, items } from '@wix/data';\nimport { fetchCmsData } from './fetchCmsData';\nimport { errorHandler } from '@wix/essentials';\n\nexport const CmsFieldTypeToPatternsFieldType: Partial<\n Record<collections.Type, PatternsFieldType>\n> = {\n [collections.Type.TEXT]: 'SHORT_TEXT',\n [collections.Type.DATE]: 'DATE',\n [collections.Type.DATETIME]: 'DATETIME',\n [collections.Type.NUMBER]: 'NUMBER',\n [collections.Type.BOOLEAN]: 'BOOLEAN',\n [collections.Type.URL]: 'URL',\n [collections.Type.ADDRESS]: 'SHORT_TEXT',\n [collections.Type.OBJECT]: 'LONG_TEXT',\n [collections.Type.RICH_TEXT]: 'LONG_TEXT',\n [collections.Type.RICH_CONTENT]: 'SHORT_TEXT',\n [collections.Type.ARRAY]: 'ARRAY',\n [collections.Type.ARRAY_STRING]: 'ARRAY',\n [collections.Type.REFERENCE]: 'REFERENCE',\n [collections.Type.IMAGE]: 'IMAGE',\n};\n\nexport async function fetchCmsSchema(\n collectionId: string,\n): Promise<SchemaConfig> {\n const schema = await errorHandler.withErrorHandler(\n async () => collections.getDataCollection(collectionId),\n {},\n );\n const transformedFields = (schema.fields || []).reduce<Record<string, Field>>(\n (acc, field) => {\n if (!field.key) {\n return acc;\n }\n\n const fieldType = field.type\n ? CmsFieldTypeToPatternsFieldType[field.type] || 'SHORT_TEXT'\n : 'SHORT_TEXT';\n const baseField = {\n id: field.key,\n displayName: field.displayName || '',\n validation: {\n numberRange: field.numberRange\n ? {\n min: field.numberRange.min ?? undefined,\n max: field.numberRange.max ?? undefined,\n }\n : undefined,\n stringLengthRange: field.stringLengthRange\n ? {\n minLength: field.stringLengthRange.minLength ?? undefined,\n maxLength: field.stringLengthRange.maxLength ?? undefined,\n }\n : undefined,\n required: field.required ?? false,\n },\n capabilities: {\n supportedQueryOperators: field.capabilities?.queryOperators || [],\n sortable: field.capabilities?.sortable || false,\n },\n };\n\n if (\n fieldType === 'REFERENCE' &&\n field.typeMetadata?.reference?.referencedCollectionId\n ) {\n const referenceField: Field = {\n ...baseField,\n type: 'REFERENCE',\n referenceMetadata: {\n referencedCollectionId:\n field.typeMetadata.reference.referencedCollectionId,\n },\n };\n acc[field.key] = referenceField;\n } else {\n const nonReferenceType =\n fieldType === 'REFERENCE' ? 'SHORT_TEXT' : fieldType;\n const nonReferenceField: Field = {\n ...baseField,\n type: nonReferenceType,\n };\n acc[field.key] = nonReferenceField;\n }\n\n return acc;\n },\n {},\n );\n\n const schemaConfig: SchemaConfig = {\n id: collectionId,\n displayField: schema.displayField ?? '_id',\n idField: '_id',\n fields: transformedFields,\n actions: {\n get: (entityId: string) => {\n return items.get(collectionId, entityId);\n },\n create: (entity) => {\n return items.insert(collectionId, entity);\n },\n update: (entity) => {\n return items.update(collectionId, entity);\n },\n delete: (entityId) => {\n return items.remove(collectionId, entityId);\n },\n bulkDelete: (entityIds) => {\n return items.bulkRemove(collectionId, entityIds);\n },\n find: async (\n query,\n options: {\n searchableFieldIds?: string[];\n filterFieldMapping?: Record<string, { fieldId: string }>;\n } = {},\n ) => {\n return fetchCmsData(collectionId, query, transformedFields, options);\n },\n },\n };\n\n return schemaConfig;\n}\n"],"mappings":"AACA,SAASA,WAAW,EAAEC,KAAK,QAAQ,WAAW;AAC9C,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,OAAO,MAAMC,+BAEZ,GAAG;EACF,CAACJ,WAAW,CAACK,IAAI,CAACC,IAAI,GAAG,YAAY;EACrC,CAACN,WAAW,CAACK,IAAI,CAACE,IAAI,GAAG,MAAM;EAC/B,CAACP,WAAW,CAACK,IAAI,CAACG,QAAQ,GAAG,UAAU;EACvC,CAACR,WAAW,CAACK,IAAI,CAACI,MAAM,GAAG,QAAQ;EACnC,CAACT,WAAW,CAACK,IAAI,CAACK,OAAO,GAAG,SAAS;EACrC,CAACV,WAAW,CAACK,IAAI,CAACM,GAAG,GAAG,KAAK;EAC7B,CAACX,WAAW,CAACK,IAAI,CAACO,OAAO,GAAG,YAAY;EACxC,CAACZ,WAAW,CAACK,IAAI,CAACQ,MAAM,GAAG,WAAW;EACtC,CAACb,WAAW,CAACK,IAAI,CAACS,SAAS,GAAG,WAAW;EACzC,CAACd,WAAW,CAACK,IAAI,CAACU,YAAY,GAAG,YAAY;EAC7C,CAACf,WAAW,CAACK,IA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,CAAC8D,GAAG,CAAC1C,YAAY,EAAE2C,QAAQ,CAAC;MAC1C,CAAC;MACDC,MAAM,EAAGC,MAAM,IAAK;QAClB,OAAOjE,KAAK,CAACkE,MAAM,CAAC9C,YAAY,EAAE6C,MAAM,CAAC;MAC3C,CAAC;MACDE,MAAM,EAAGF,MAAM,IAAK;QAClB,OAAOjE,KAAK,CAACmE,MAAM,CAAC/C,YAAY,EAAE6C,MAAM,CAAC;MAC3C,CAAC;MACDG,MAAM,EAAGL,QAAQ,IAAK;QACpB,OAAO/D,KAAK,CAACqE,MAAM,CAACjD,YAAY,EAAE2C,QAAQ,CAAC;MAC7C,CAAC;MACDO,UAAU,EAAGC,SAAS,IAAK;QACzB,OAAOvE,KAAK,CAACwE,UAAU,CAACpD,YAAY,EAAEmD,SAAS,CAAC;MAClD,CAAC;MACDE,IAAI,EAAE,eAAAA,CACJC,KAAK,EACLC,OAGC,EACE;QAAA,IAJHA,OAGC;UAHDA,OAGC,GAAG,CAAC,CAAC;QAAA;QAEN,OAAO1E,YAAY,CAACmB,YAAY,EAAEsD,KAAK,EAAElD,iBAAiB,EAAEmD,OAAO,CAAC;MACtE;IACF;EACF,CAAC;EAED,OAAOjB,YAAY;AACrB","ignoreList":[]}
1
+ {"version":3,"names":["collections","items","fetchCmsData","errorHandler","CmsFieldTypeToPatternsFieldType","Type","TEXT","DATE","DATETIME","NUMBER","BOOLEAN","URL","ADDRESS","OBJECT","RICH_TEXT","RICH_CONTENT","ARRAY","ARRAY_STRING","REFERENCE","IMAGE","fetchCmsSchema","collectionId","schema","withErrorHandler","getDataCollection","transformCmsSchema","_id","transformedFields","fields","reduce","acc","field","_field$capabilities","_field$capabilities2","_field$typeMetadata","key","fieldType","type","baseField","id","displayName","validation","numberRange","min","undefined","max","stringLengthRange","minLength","maxLength","required","capabilities","supportedQueryOperators","queryOperators","sortable","typeMetadata","reference","referencedCollectionId","referenceField","referenceMetadata","nonReferenceType","nonReferenceField","schemaConfig","displayField","idField","actions","get","entityId","create","entity","insert","update","delete","remove","bulkDelete","entityIds","bulkRemove","find","query","options"],"sources":["../../../../src/dataSourceAdapters/cms/cmsAdapter.ts"],"sourcesContent":["import { Field, SchemaConfig, PatternsFieldType } from '../../types';\nimport { collections, items } from '@wix/data';\nimport { fetchCmsData } from './fetchCmsData';\nimport { errorHandler } from '@wix/essentials';\n\nexport const CmsFieldTypeToPatternsFieldType: Partial<\n Record<collections.Type, PatternsFieldType>\n> = {\n [collections.Type.TEXT]: 'SHORT_TEXT',\n [collections.Type.DATE]: 'DATE',\n [collections.Type.DATETIME]: 'DATETIME',\n [collections.Type.NUMBER]: 'NUMBER',\n [collections.Type.BOOLEAN]: 'BOOLEAN',\n [collections.Type.URL]: 'URL',\n [collections.Type.ADDRESS]: 'SHORT_TEXT',\n [collections.Type.OBJECT]: 'LONG_TEXT',\n [collections.Type.RICH_TEXT]: 'LONG_TEXT',\n [collections.Type.RICH_CONTENT]: 'SHORT_TEXT',\n [collections.Type.ARRAY]: 'ARRAY',\n [collections.Type.ARRAY_STRING]: 'ARRAY',\n [collections.Type.REFERENCE]: 'REFERENCE',\n [collections.Type.IMAGE]: 'IMAGE',\n};\n\nexport async function fetchCmsSchema(\n collectionId: string,\n): Promise<collections.DataCollection> {\n const schema = await errorHandler.withErrorHandler(\n async () => collections.getDataCollection(collectionId),\n {},\n );\n return schema;\n}\n\nexport function transformCmsSchema(\n schema: collections.DataCollection,\n): SchemaConfig {\n const collectionId = schema._id as string;\n\n const transformedFields = (schema.fields || []).reduce<Record<string, Field>>(\n (acc, field) => {\n if (!field.key) {\n return acc;\n }\n\n const fieldType = field.type\n ? CmsFieldTypeToPatternsFieldType[field.type] || 'SHORT_TEXT'\n : 'SHORT_TEXT';\n const baseField = {\n id: field.key,\n displayName: field.displayName || '',\n validation: {\n numberRange: field.numberRange\n ? {\n min: field.numberRange.min ?? undefined,\n max: field.numberRange.max ?? undefined,\n }\n : undefined,\n stringLengthRange: field.stringLengthRange\n ? {\n minLength: field.stringLengthRange.minLength ?? undefined,\n maxLength: field.stringLengthRange.maxLength ?? undefined,\n }\n : undefined,\n required: field.required ?? false,\n },\n capabilities: {\n supportedQueryOperators: field.capabilities?.queryOperators || [],\n sortable: field.capabilities?.sortable || false,\n },\n };\n\n if (\n fieldType === 'REFERENCE' &&\n field.typeMetadata?.reference?.referencedCollectionId\n ) {\n const referenceField: Field = {\n ...baseField,\n type: 'REFERENCE',\n referenceMetadata: {\n referencedCollectionId:\n field.typeMetadata.reference.referencedCollectionId,\n },\n };\n acc[field.key] = referenceField;\n } else {\n const nonReferenceType =\n fieldType === 'REFERENCE' ? 'SHORT_TEXT' : fieldType;\n const nonReferenceField: Field = {\n ...baseField,\n type: nonReferenceType,\n };\n acc[field.key] = nonReferenceField;\n }\n\n return acc;\n },\n {},\n );\n\n const schemaConfig: SchemaConfig = {\n id: collectionId,\n displayField: schema.displayField ?? '_id',\n idField: '_id',\n fields: transformedFields,\n actions: {\n get: (entityId: string) => {\n return items.get(collectionId, entityId);\n },\n create: (entity) => {\n return items.insert(collectionId, entity);\n },\n update: (entity) => {\n return items.update(collectionId, entity);\n },\n delete: (entityId) => {\n return items.remove(collectionId, entityId);\n },\n bulkDelete: (entityIds) => {\n return items.bulkRemove(collectionId, entityIds);\n },\n find: async (\n query,\n options: {\n searchableFieldIds?: string[];\n filterFieldMapping?: Record<string, { fieldId: string }>;\n } = {},\n ) => {\n return fetchCmsData(collectionId, query, transformedFields, options);\n },\n },\n };\n\n return schemaConfig;\n}\n"],"mappings":"AACA,SAASA,WAAW,EAAEC,KAAK,QAAQ,WAAW;AAC9C,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,OAAO,MAAMC,+BAEZ,GAAG;EACF,CAACJ,WAAW,CAACK,IAAI,CAACC,IAAI,GAAG,YAAY;EACrC,CAACN,WAAW,CAACK,IAAI,CAACE,IAAI,GAAG,MAAM;EAC/B,CAACP,WAAW,CAACK,IAAI,CAACG,Q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,EAAEmD,OAAO,CAAC;MACtE;IACF;EACF,CAAC;EAED,OAAOjB,YAAY;AACrB","ignoreList":[]}
@@ -31,7 +31,7 @@ export async function fetchCmsData(collectionId, query, fields, options) {
31
31
  if (referenceFieldIds.length > 0) {
32
32
  dataQuery = dataQuery.include(...referenceFieldIds);
33
33
  }
34
- const res = await dataQuery.skip(query.offset).limit(query.limit).find({
34
+ const res = await dataQuery.skip(query.offset ?? 0).limit(query.limit).find({
35
35
  returnTotalCount: true
36
36
  });
37
37
  return {
@@ -1 +1 @@
1
- {"version":3,"names":["items","addFiltersToDataQuery","addSearchToDataQuery","addSortToDataQuery","fetchCmsData","collectionId","query","fields","options","searchableFieldIds","filterFieldMapping","dataQuery","referenceFieldIds","Object","values","filter","field","type","includes","id","map","length","include","res","skip","offset","limit","find","returnTotalCount","total","totalCount"],"sources":["../../../../src/dataSourceAdapters/cms/fetchCmsData.ts"],"sourcesContent":["import { items } from '@wix/data';\nimport { Field, Query } from '../../types';\nimport { addFiltersToDataQuery, addSearchToDataQuery } from './filterUtils';\nimport { addSortToDataQuery } from './sortUtils';\n\nexport async function fetchCmsData(\n collectionId: string,\n query: Query,\n fields: Record<string, Field | undefined>,\n options: {\n searchableFieldIds?: string[];\n filterFieldMapping?: Record<string, { fieldId: string }>;\n } = {},\n) {\n const { searchableFieldIds = [], filterFieldMapping } = options;\n\n let dataQuery = items.query(collectionId);\n dataQuery = addSearchToDataQuery({\n dataQuery,\n query,\n fields,\n searchableFieldIds,\n });\n dataQuery = addFiltersToDataQuery({\n dataQuery,\n query,\n fields,\n filterFieldMapping,\n });\n dataQuery = addSortToDataQuery({\n dataQuery,\n query,\n fields,\n });\n\n const referenceFieldIds = Object.values(fields)\n .filter(\n (field): field is Field =>\n !!field &&\n field.type === 'REFERENCE' &&\n searchableFieldIds.includes(field.id),\n )\n .map((field) => field.id);\n\n if (referenceFieldIds.length > 0) {\n dataQuery = dataQuery.include(...referenceFieldIds);\n }\n\n const res = await dataQuery\n .skip(query.offset)\n .limit(query.limit)\n .find({ returnTotalCount: true });\n\n return {\n items: res.items,\n total: res.totalCount ?? 0,\n };\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,WAAW;AAEjC,SAASC,qBAAqB,EAAEC,oBAAoB,QAAQ,eAAe;AAC3E,SAASC,kBAAkB,QAAQ,aAAa;AAEhD,OAAO,eAAeC,YAAYA,CAChCC,YAAoB,EACpBC,KAAY,EACZC,MAAyC,EACzCC,OAGC,EACD;EAAA,IAJAA,OAGC;IAHDA,OAGC,GAAG,CAAC,CAAC;EAAA;EAEN,MAAM;IAAEC,kBAAkB,GAAG,EAAE;IAAEC;EAAmB,CAAC,GAAGF,OAAO;EAE/D,IAAIG,SAAS,GAAGX,KAAK,CAACM,KAAK,CAACD,YAAY,CAAC;EACzCM,SAAS,GAAGT,oBAAoB,CAAC;IAC/BS,SAAS;IACTL,KAAK;IACLC,MAAM;IACNE;EACF,CAAC,CAAC;EACFE,SAAS,GAAGV,qBAAqB,CAAC;IAChCU,SAAS;IACTL,KAAK;IACLC,MAAM;IACNG;EACF,CAAC,CAAC;EACFC,SAAS,GAAGR,kBAAkB,CAAC;IAC7BQ,SAAS;IACTL,KAAK;IACLC;EACF,CAAC,CAAC;EAEF,MAAMK,iBAAiB,GAAGC,MAAM,CAACC,MAAM,CAACP,MAAM,CAAC,CAC5CQ,MAAM,CACJC,KAAK,IACJ,CAAC,CAACA,KAAK,IACPA,KAAK,CAACC,IAAI,KAAK,WAAW,IAC1BR,kBAAkB,CAACS,QAAQ,CAACF,KAAK,CAACG,EAAE,CACxC,CAAC,CACAC,GAAG,CAAEJ,KAAK,IAAKA,KAAK,CAACG,EAAE,CAAC;EAE3B,IAAIP,iBAAiB,CAACS,MAAM,GAAG,CAAC,EAAE;IAChCV,SAAS,GAAGA,SAAS,CAACW,OAAO,CAAC,GAAGV,iBAAiB,CAAC;EACrD;EAEA,MAAMW,GAAG,GAAG,MAAMZ,SAAS,CACxBa,IAAI,CAAClB,KAAK,CAACmB,MAAM,CAAC,CAClBC,KAAK,CAACpB,KAAK,CAACoB,KAAK,CAAC,CAClBC,IAAI,CAAC;IAAEC,gBAAgB,EAAE;EAAK,CAAC,CAAC;EAEnC,OAAO;IACL5B,KAAK,EAAEuB,GAAG,CAACvB,KAAK;IAChB6B,KAAK,EAAEN,GAAG,CAACO,UAAU,IAAI;EAC3B,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["items","addFiltersToDataQuery","addSearchToDataQuery","addSortToDataQuery","fetchCmsData","collectionId","query","fields","options","searchableFieldIds","filterFieldMapping","dataQuery","referenceFieldIds","Object","values","filter","field","type","includes","id","map","length","include","res","skip","offset","limit","find","returnTotalCount","total","totalCount"],"sources":["../../../../src/dataSourceAdapters/cms/fetchCmsData.ts"],"sourcesContent":["import { items } from '@wix/data';\nimport { Field, Query } from '../../types';\nimport { addFiltersToDataQuery, addSearchToDataQuery } from './filterUtils';\nimport { addSortToDataQuery } from './sortUtils';\n\nexport async function fetchCmsData(\n collectionId: string,\n query: Query,\n fields: Record<string, Field | undefined>,\n options: {\n searchableFieldIds?: string[];\n filterFieldMapping?: Record<string, { fieldId: string }>;\n } = {},\n) {\n const { searchableFieldIds = [], filterFieldMapping } = options;\n\n let dataQuery = items.query(collectionId);\n dataQuery = addSearchToDataQuery({\n dataQuery,\n query,\n fields,\n searchableFieldIds,\n });\n dataQuery = addFiltersToDataQuery({\n dataQuery,\n query,\n fields,\n filterFieldMapping,\n });\n dataQuery = addSortToDataQuery({\n dataQuery,\n query,\n fields,\n });\n\n const referenceFieldIds = Object.values(fields)\n .filter(\n (field): field is Field =>\n !!field &&\n field.type === 'REFERENCE' &&\n searchableFieldIds.includes(field.id),\n )\n .map((field) => field.id);\n\n if (referenceFieldIds.length > 0) {\n dataQuery = dataQuery.include(...referenceFieldIds);\n }\n\n const res = await dataQuery\n .skip(query.offset ?? 0)\n .limit(query.limit)\n .find({ returnTotalCount: true });\n\n return {\n items: res.items,\n total: res.totalCount ?? 0,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