@wix/auto-patterns 1.23.0 → 1.24.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 (182) hide show
  1. package/dist/cjs/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js +12 -323
  2. package/dist/cjs/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js.map +1 -1
  3. package/dist/cjs/components/AutoPatternsEntityPage/EditModeEntityPage.js +172 -0
  4. package/dist/cjs/components/AutoPatternsEntityPage/EditModeEntityPage.js.map +1 -0
  5. package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.js +78 -0
  6. package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.js.map +1 -0
  7. package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js +119 -0
  8. package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js.map +1 -0
  9. package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.js +79 -0
  10. package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.js.map +1 -0
  11. package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/index.js +16 -0
  12. package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/index.js.map +1 -0
  13. package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.js +77 -0
  14. package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.js.map +1 -0
  15. package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js +109 -0
  16. package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js.map +1 -0
  17. package/dist/cjs/components/AutoPatternsEntityPage/ViewModeEntityPage.js +196 -0
  18. package/dist/cjs/components/AutoPatternsEntityPage/ViewModeEntityPage.js.map +1 -0
  19. package/dist/cjs/components/AutoPatternsEntityPage/index.js +12 -0
  20. package/dist/cjs/components/AutoPatternsEntityPage/index.js.map +1 -1
  21. package/dist/cjs/hooks/useEntityPageActions.js +105 -0
  22. package/dist/cjs/hooks/useEntityPageActions.js.map +1 -0
  23. package/dist/cjs/hooks/useEntityPageMoreActions.js +10 -0
  24. package/dist/cjs/hooks/useEntityPageMoreActions.js.map +1 -1
  25. package/dist/cjs/hooks/useNavigateEditEntityAction.js +50 -0
  26. package/dist/cjs/hooks/useNavigateEditEntityAction.js.map +1 -0
  27. package/dist/cjs/hooks/useNavigationUtils.js +12 -1
  28. package/dist/cjs/hooks/useNavigationUtils.js.map +1 -1
  29. package/dist/cjs/providers/PatternsWizardOverridesContext.js.map +1 -1
  30. package/dist/cjs/types/EntityPageConfig.js.map +1 -1
  31. package/dist/cjs/types/actions/entityPageActions.js.map +1 -1
  32. package/dist/cjs/utils/actions/types.js.map +1 -1
  33. package/dist/docs/action_cell.md +6 -2
  34. package/dist/docs/app_config_structure.md +49 -4
  35. package/dist/docs/auto-patterns-guide.md +305 -39
  36. package/dist/docs/bulk_actions.md +6 -2
  37. package/dist/docs/collection_page_actions.md +14 -4
  38. package/dist/docs/entity_page.md +65 -1
  39. package/dist/docs/entity_page_actions.md +13 -11
  40. package/dist/docs/entity_page_view_actions.md +137 -0
  41. package/dist/docs/index.md +6 -2
  42. package/dist/docs/pages_configuration.md +1 -11
  43. package/dist/docs/sdk_utilities.md +11 -4
  44. package/dist/docs/wix_fqdn_custom_data_source.md +25 -5
  45. package/dist/esm/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js +4 -3
  46. package/dist/esm/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js.map +1 -1
  47. package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js +2 -1
  48. package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
  49. package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js +9 -196
  50. package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js.map +1 -1
  51. package/dist/esm/components/AutoPatternsEntityPage/EditModeEntityPage.js +115 -0
  52. package/dist/esm/components/AutoPatternsEntityPage/EditModeEntityPage.js.map +1 -0
  53. package/dist/esm/components/AutoPatternsEntityPage/Fields/DateInput.js +10 -6
  54. package/dist/esm/components/AutoPatternsEntityPage/Fields/DateInput.js.map +1 -1
  55. package/dist/esm/components/AutoPatternsEntityPage/Fields/DateTime.js +23 -16
  56. package/dist/esm/components/AutoPatternsEntityPage/Fields/DateTime.js.map +1 -1
  57. package/dist/esm/components/AutoPatternsEntityPage/Fields/FormFieldInput.js +3 -2
  58. package/dist/esm/components/AutoPatternsEntityPage/Fields/FormFieldInput.js.map +1 -1
  59. package/dist/esm/components/AutoPatternsEntityPage/Fields/ImageInput.js +9 -6
  60. package/dist/esm/components/AutoPatternsEntityPage/Fields/ImageInput.js.map +1 -1
  61. package/dist/esm/components/AutoPatternsEntityPage/Fields/LongText.js +8 -6
  62. package/dist/esm/components/AutoPatternsEntityPage/Fields/LongText.js.map +1 -1
  63. package/dist/esm/components/AutoPatternsEntityPage/Fields/Number.js +10 -8
  64. package/dist/esm/components/AutoPatternsEntityPage/Fields/Number.js.map +1 -1
  65. package/dist/esm/components/AutoPatternsEntityPage/Fields/ShortText.js +12 -10
  66. package/dist/esm/components/AutoPatternsEntityPage/Fields/ShortText.js.map +1 -1
  67. package/dist/esm/components/AutoPatternsEntityPage/Fields/Url.js +8 -6
  68. package/dist/esm/components/AutoPatternsEntityPage/Fields/Url.js.map +1 -1
  69. package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.js +33 -0
  70. package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.js.map +1 -0
  71. package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js +70 -0
  72. package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js.map +1 -0
  73. package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.js +48 -0
  74. package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.js.map +1 -0
  75. package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/index.js +3 -0
  76. package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/index.js.map +1 -0
  77. package/dist/esm/components/AutoPatternsEntityPage/SkeletonEntity.js +7 -4
  78. package/dist/esm/components/AutoPatternsEntityPage/SkeletonEntity.js.map +1 -1
  79. package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.js +31 -0
  80. package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.js.map +1 -0
  81. package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js +66 -0
  82. package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js.map +1 -0
  83. package/dist/esm/components/AutoPatternsEntityPage/ViewModeEntityPage.js +109 -0
  84. package/dist/esm/components/AutoPatternsEntityPage/ViewModeEntityPage.js.map +1 -0
  85. package/dist/esm/components/AutoPatternsEntityPage/index.js +2 -0
  86. package/dist/esm/components/AutoPatternsEntityPage/index.js.map +1 -1
  87. package/dist/esm/components/ModalRenderer.js +2 -1
  88. package/dist/esm/components/ModalRenderer.js.map +1 -1
  89. package/dist/esm/components/modals/actions/BulkDeleteModal.js +12 -7
  90. package/dist/esm/components/modals/actions/BulkDeleteModal.js.map +1 -1
  91. package/dist/esm/components/modals/actions/CreateModal.js +11 -6
  92. package/dist/esm/components/modals/actions/CreateModal.js.map +1 -1
  93. package/dist/esm/components/modals/actions/EditModal.js +11 -6
  94. package/dist/esm/components/modals/actions/EditModal.js.map +1 -1
  95. package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js +4 -3
  96. package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
  97. package/dist/esm/dataSourceAdapters/cms/filterUtils.js +2 -1
  98. package/dist/esm/dataSourceAdapters/cms/filterUtils.js.map +1 -1
  99. package/dist/esm/dataSourceAdapters/cms/sortUtils.js +2 -2
  100. package/dist/esm/dataSourceAdapters/cms/sortUtils.js.map +1 -1
  101. package/dist/esm/hooks/useActionCell.js +12 -8
  102. package/dist/esm/hooks/useActionCell.js.map +1 -1
  103. package/dist/esm/hooks/useBaseTableFeatures.js +2 -1
  104. package/dist/esm/hooks/useBaseTableFeatures.js.map +1 -1
  105. package/dist/esm/hooks/useBulkActionToolbar.js +2 -2
  106. package/dist/esm/hooks/useBulkActionToolbar.js.map +1 -1
  107. package/dist/esm/hooks/useCollectionPageActions.js +3 -3
  108. package/dist/esm/hooks/useCollectionPageActions.js.map +1 -1
  109. package/dist/esm/hooks/useCollectionPageOnRowClickActions.js +1 -1
  110. package/dist/esm/hooks/useCollectionPageOnRowClickActions.js.map +1 -1
  111. package/dist/esm/hooks/useColumns.js +12 -7
  112. package/dist/esm/hooks/useColumns.js.map +1 -1
  113. package/dist/esm/hooks/useCommonCollectionFeatures.js +8 -7
  114. package/dist/esm/hooks/useCommonCollectionFeatures.js.map +1 -1
  115. package/dist/esm/hooks/useEmptyStates.js +6 -5
  116. package/dist/esm/hooks/useEmptyStates.js.map +1 -1
  117. package/dist/esm/hooks/useEntityPageActions.js +82 -0
  118. package/dist/esm/hooks/useEntityPageActions.js.map +1 -0
  119. package/dist/esm/hooks/useEntityPageMoreActions.js +11 -1
  120. package/dist/esm/hooks/useEntityPageMoreActions.js.map +1 -1
  121. package/dist/esm/hooks/useFilters.js +7 -7
  122. package/dist/esm/hooks/useFilters.js.map +1 -1
  123. package/dist/esm/hooks/useNavigateEditEntityAction.js +46 -0
  124. package/dist/esm/hooks/useNavigateEditEntityAction.js.map +1 -0
  125. package/dist/esm/hooks/useNavigationUtils.js +15 -3
  126. package/dist/esm/hooks/useNavigationUtils.js.map +1 -1
  127. package/dist/esm/hooks/usePagePath.js +4 -3
  128. package/dist/esm/hooks/usePagePath.js.map +1 -1
  129. package/dist/esm/hooks/useTableFeatures.js +2 -1
  130. package/dist/esm/hooks/useTableFeatures.js.map +1 -1
  131. package/dist/esm/providers/PatternsWizardOverridesContext.js.map +1 -1
  132. package/dist/esm/providers/SchemaContext.js +3 -2
  133. package/dist/esm/providers/SchemaContext.js.map +1 -1
  134. package/dist/esm/providers/SchemaRegistryContext.js +1 -1
  135. package/dist/esm/providers/SchemaRegistryContext.js.map +1 -1
  136. package/dist/esm/types/EntityPageConfig.js.map +1 -1
  137. package/dist/esm/types/actions/entityPageActions.js.map +1 -1
  138. package/dist/esm/utils/actions/customAction.js +2 -1
  139. package/dist/esm/utils/actions/customAction.js.map +1 -1
  140. package/dist/esm/utils/actions/deleteAction.js +10 -5
  141. package/dist/esm/utils/actions/deleteAction.js.map +1 -1
  142. package/dist/esm/utils/actions/types.js.map +1 -1
  143. package/dist/esm/utils/filterCreators.js +11 -11
  144. package/dist/esm/utils/filterCreators.js.map +1 -1
  145. package/dist/types/components/AutoPatternsEntityPage/AutoPatternsEntityPage.d.ts.map +1 -1
  146. package/dist/types/components/AutoPatternsEntityPage/EditModeEntityPage.d.ts +6 -0
  147. package/dist/types/components/AutoPatternsEntityPage/EditModeEntityPage.d.ts.map +1 -0
  148. package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.d.ts +11 -0
  149. package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.d.ts.map +1 -0
  150. package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.d.ts +13 -0
  151. package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.d.ts.map +1 -0
  152. package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.d.ts +8 -0
  153. package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.d.ts.map +1 -0
  154. package/dist/types/components/AutoPatternsEntityPage/RenderLayout/index.d.ts +3 -0
  155. package/dist/types/components/AutoPatternsEntityPage/RenderLayout/index.d.ts.map +1 -0
  156. package/dist/types/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.d.ts +8 -0
  157. package/dist/types/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.d.ts.map +1 -0
  158. package/dist/types/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.d.ts +8 -0
  159. package/dist/types/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.d.ts.map +1 -0
  160. package/dist/types/components/AutoPatternsEntityPage/ViewModeEntityPage.d.ts +8 -0
  161. package/dist/types/components/AutoPatternsEntityPage/ViewModeEntityPage.d.ts.map +1 -0
  162. package/dist/types/components/AutoPatternsEntityPage/index.d.ts +2 -0
  163. package/dist/types/components/AutoPatternsEntityPage/index.d.ts.map +1 -1
  164. package/dist/types/hooks/useEntityPageActions.d.ts +9 -0
  165. package/dist/types/hooks/useEntityPageActions.d.ts.map +1 -0
  166. package/dist/types/hooks/useEntityPageHeaderTexts.d.ts.map +1 -1
  167. package/dist/types/hooks/useEntityPageMoreActions.d.ts +2 -2
  168. package/dist/types/hooks/useEntityPageMoreActions.d.ts.map +1 -1
  169. package/dist/types/hooks/useNavigateEditEntityAction.d.ts +6 -0
  170. package/dist/types/hooks/useNavigateEditEntityAction.d.ts.map +1 -0
  171. package/dist/types/hooks/useNavigationUtils.d.ts +1 -0
  172. package/dist/types/hooks/useNavigationUtils.d.ts.map +1 -1
  173. package/dist/types/providers/PatternsWizardOverridesContext.d.ts +2 -2
  174. package/dist/types/providers/PatternsWizardOverridesContext.d.ts.map +1 -1
  175. package/dist/types/types/EntityPageConfig.d.ts +20 -4
  176. package/dist/types/types/EntityPageConfig.d.ts.map +1 -1
  177. package/dist/types/types/actions/entityPageActions.d.ts +24 -5
  178. package/dist/types/types/actions/entityPageActions.d.ts.map +1 -1
  179. package/dist/types/utils/actions/types.d.ts +1 -1
  180. package/dist/types/utils/actions/types.d.ts.map +1 -1
  181. package/package.json +15 -15
  182. package/dist/docs/config_schema.md +0 -184
@@ -17,6 +17,13 @@
17
17
  - Not designating exactly one page as `appMainPage: true`
18
18
  - Missing or inconsistent page relationships (parentPageId/entityPageId)
19
19
  - Setting `stickyColumns` to invalid values (negative, zero, or exceeding column count)
20
+ - **Missing custom property**: When `entityTypeSource: 'custom'`, forgetting to include the required `custom: { id: "..." }` property will cause TypeScript errors
21
+ - **Using incorrect field types**: Mismatching page type with configuration object (e.g., `type: 'entityPage'` with `collectionPage` field)
22
+ - **Including fields from wrong page type**: Adding both `collectionPage` and `entityPage` fields in the same page configuration
23
+ - **Missing action layout properties**: Not including `action` property when `type: 'action'` or `menu` property when `type: 'menu'`
24
+ - **Missing action type properties**: Not including `create`, `update`, `delete`, or `bulkDelete` properties when required by the action type
25
+ - **Including wrong action properties**: Adding properties from different action types in the same action configuration
26
+ - **Action type mismatches**: Using action cell types in collection actions, or bulk action types in regular actions
20
27
 
21
28
  ```ts
22
29
  export interface AppConfig {
@@ -46,6 +53,9 @@ export interface AppConfig {
46
53
  collection: {
47
54
  collectionId: string; // ID of the Wix Data collection
48
55
  entityTypeSource: 'cms' | 'custom'; // Data source type.
56
+ custom?: { // REQUIRED when entityTypeSource is 'custom'
57
+ id: string; // ID matching your custom data source identifier
58
+ };
49
59
  };
50
60
  create?: { // Required when type is 'create'
51
61
  mode: 'page'; // Create mode
@@ -73,8 +83,8 @@ export interface AppConfig {
73
83
  collection: {
74
84
  collectionId: string; // ID of the Wix Data collection
75
85
  entityTypeSource: 'cms' | 'custom'; // Data source type.
76
- custom?: {
77
- id: string;
86
+ custom?: { // REQUIRED when entityTypeSource is 'custom'
87
+ id: string; // ID matching your custom data source identifier
78
88
  };
79
89
  reflectQueryInUrl?: boolean; // Reflects query state (search, filters, sorting) in the browser URL. Default: false
80
90
  selectAllScope?: 'page' | 'all'; // Controls "Select All" scope. 'all' selects entire collection, 'page' selects only visible items. Default: 'all'
@@ -295,6 +305,7 @@ export interface AppConfig {
295
305
  ]; // End of components array
296
306
  };
297
307
  entityPage?: {
308
+ mode?: 'edit' | 'view'; // Entity page mode. Default: 'edit'
298
309
  route: {
299
310
  path: string; // Route path for the entity page (e.g., '/product/:entityId')
300
311
  params: {
@@ -307,6 +318,40 @@ export interface AppConfig {
307
318
  subtitle?: {
308
319
  text: string; // Entity page subtitle
309
320
  };
321
+ actions?: { // Action configuration varies by mode
322
+ // Edit mode: only moreActions supported
323
+ // View mode: primaryActions, secondaryActions, and moreActions supported
324
+ primaryActions?: { // View mode only
325
+ type: 'action' | 'menu';
326
+ action?: {
327
+ item: {
328
+ id: string;
329
+ type: 'create' | 'custom';
330
+ label?: string;
331
+ create?: { // Required when type is 'create'
332
+ mode: 'page';
333
+ page: {
334
+ id: string; // Entity page ID to navigate to
335
+ };
336
+ };
337
+ };
338
+ };
339
+ menu?: {
340
+ label: string;
341
+ items: {}[]; // Array of action configurations, same structure as action.item, can include dividers
342
+ };
343
+ };
344
+ secondaryActions?: { // View mode only - same structure as primaryActions
345
+ type: 'action' | 'menu';
346
+ action?: {}; // Same structure as primaryActions.action
347
+ menu?: {}; // Same structure as primaryActions.menu
348
+ };
349
+ moreActions?: { // Both modes
350
+ id: string;
351
+ type: 'custom';
352
+ label?: string;
353
+ }[];
354
+ };
310
355
  parentPageId?: string; // ID of the parent collection page
311
356
  layout?: {
312
357
  // Main layout section
@@ -338,8 +383,8 @@ export interface AppConfig {
338
383
  };
339
384
  collectionId: string; // Related collection ID
340
385
  entityTypeSource: 'cms' | 'custom'; // Data source type.
341
- custom?: {
342
- id: string;
386
+ custom?: { // REQUIRED when entityTypeSource is 'custom'
387
+ id: string; // ID matching your custom data source identifier
343
388
  };
344
389
  };
345
390
  }[];
@@ -95,6 +95,13 @@ It is configured using a TypeScript file conforming to the `AppConfig` interface
95
95
  - Not designating exactly one page as `appMainPage: true`
96
96
  - Missing or inconsistent page relationships (parentPageId/entityPageId)
97
97
  - Setting `stickyColumns` to invalid values (negative, zero, or exceeding column count)
98
+ - **Missing custom property**: When `entityTypeSource: 'custom'`, forgetting to include the required `custom: { id: "..." }` property will cause TypeScript errors
99
+ - **Using incorrect field types**: Mismatching page type with configuration object (e.g., `type: 'entityPage'` with `collectionPage` field)
100
+ - **Including fields from wrong page type**: Adding both `collectionPage` and `entityPage` fields in the same page configuration
101
+ - **Missing action layout properties**: Not including `action` property when `type: 'action'` or `menu` property when `type: 'menu'`
102
+ - **Missing action type properties**: Not including `create`, `update`, `delete`, or `bulkDelete` properties when required by the action type
103
+ - **Including wrong action properties**: Adding properties from different action types in the same action configuration
104
+ - **Action type mismatches**: Using action cell types in collection actions, or bulk action types in regular actions
98
105
 
99
106
  ```ts
100
107
  export interface AppConfig {
@@ -124,6 +131,9 @@ export interface AppConfig {
124
131
  collection: {
125
132
  collectionId: string; // ID of the Wix Data collection
126
133
  entityTypeSource: 'cms' | 'custom'; // Data source type.
134
+ custom?: { // REQUIRED when entityTypeSource is 'custom'
135
+ id: string; // ID matching your custom data source identifier
136
+ };
127
137
  };
128
138
  create?: { // Required when type is 'create'
129
139
  mode: 'page'; // Create mode
@@ -151,8 +161,8 @@ export interface AppConfig {
151
161
  collection: {
152
162
  collectionId: string; // ID of the Wix Data collection
153
163
  entityTypeSource: 'cms' | 'custom'; // Data source type.
154
- custom?: {
155
- id: string;
164
+ custom?: { // REQUIRED when entityTypeSource is 'custom'
165
+ id: string; // ID matching your custom data source identifier
156
166
  };
157
167
  reflectQueryInUrl?: boolean; // Reflects query state (search, filters, sorting) in the browser URL. Default: false
158
168
  selectAllScope?: 'page' | 'all'; // Controls "Select All" scope. 'all' selects entire collection, 'page' selects only visible items. Default: 'all'
@@ -373,6 +383,7 @@ export interface AppConfig {
373
383
  ]; // End of components array
374
384
  };
375
385
  entityPage?: {
386
+ mode?: 'edit' | 'view'; // Entity page mode. Default: 'edit'
376
387
  route: {
377
388
  path: string; // Route path for the entity page (e.g., '/product/:entityId')
378
389
  params: {
@@ -385,6 +396,40 @@ export interface AppConfig {
385
396
  subtitle?: {
386
397
  text: string; // Entity page subtitle
387
398
  };
399
+ actions?: { // Action configuration varies by mode
400
+ // Edit mode: only moreActions supported
401
+ // View mode: primaryActions, secondaryActions, and moreActions supported
402
+ primaryActions?: { // View mode only
403
+ type: 'action' | 'menu';
404
+ action?: {
405
+ item: {
406
+ id: string;
407
+ type: 'create' | 'custom';
408
+ label?: string;
409
+ create?: { // Required when type is 'create'
410
+ mode: 'page';
411
+ page: {
412
+ id: string; // Entity page ID to navigate to
413
+ };
414
+ };
415
+ };
416
+ };
417
+ menu?: {
418
+ label: string;
419
+ items: {}[]; // Array of action configurations, same structure as action.item, can include dividers
420
+ };
421
+ };
422
+ secondaryActions?: { // View mode only - same structure as primaryActions
423
+ type: 'action' | 'menu';
424
+ action?: {}; // Same structure as primaryActions.action
425
+ menu?: {}; // Same structure as primaryActions.menu
426
+ };
427
+ moreActions?: { // Both modes
428
+ id: string;
429
+ type: 'custom';
430
+ label?: string;
431
+ }[];
432
+ };
388
433
  parentPageId?: string; // ID of the parent collection page
389
434
  layout?: {
390
435
  // Main layout section
@@ -416,8 +461,8 @@ export interface AppConfig {
416
461
  };
417
462
  collectionId: string; // Related collection ID
418
463
  entityTypeSource: 'cms' | 'custom'; // Data source type.
419
- custom?: {
420
- id: string;
464
+ custom?: { // REQUIRED when entityTypeSource is 'custom'
465
+ id: string; // ID matching your custom data source identifier
421
466
  };
422
467
  };
423
468
  }[];
@@ -516,7 +561,6 @@ Notice how the `label` is derived from the `value` by capitalizing the first let
516
561
  - **Pages array must contain exactly two pages** - one collectionPage and one entityPage
517
562
  - **Exactly one page must have `appMainPage: true`** to designate it as the main page
518
563
  - **All page IDs referenced in relationships must exist in the configuration** - validate all `parentPageId` and `entityPageId` references
519
- - **Bind `type` strictly to matching fields** - if `type: 'collectionPage'`, only `collectionPage` field exists (no `entityPage` field), and vice versa
520
564
 
521
565
  ## Default Generation
522
566
 
@@ -529,12 +573,6 @@ Notice how the `label` is derived from the `value` by capitalizing the first let
529
573
  * The route path **must** include a descriptive segment (e.g., `/product/:entityId`, `/pet/:entityId`)
530
574
  * **Never use just `/:entityId`** - this conflicts with the collection page route and breaks routing
531
575
 
532
- ## Type and Structure Binding
533
-
534
- * If `type: 'collectionPage'`, then **only** `collectionPage` field exists (no `entityPage` field).
535
- * If `type: 'entityPage'`, then **only** `entityPage` field exists (no `collectionPage` field).
536
- * **No cross-mixing** allowed.
537
-
538
576
  ## Page Connection Configuration
539
577
 
540
578
  ### Main Page Designation
@@ -599,11 +637,8 @@ A two-way connection must be established between collection pages and entity pag
599
637
  * **Route Structure**: Entity pages must use `/[segment]/:entityId` format (e.g., `/product/:entityId` or `/pets/:entityId`), never just `/:entityId`
600
638
  * **Route Parameters Configuration**: All entity pages must have both a dynamic parameter in `route.path` and a matching configuration in `route.params`
601
639
 
602
- ## ⚠️ Common Type and Route Mistakes to Avoid
640
+ ## ⚠️ Common Route and Configuration Mistakes to Avoid
603
641
 
604
- - Using incorrect field types
605
- - Missing required fields
606
- - Including fields from wrong page type
607
642
  - Missing route.params for entity pages
608
643
  - Using `/:entityId` instead of `/segment/:entityId` for entity page routes (causes routing conflicts)
609
644
 
@@ -787,11 +822,15 @@ Custom collection page actions execute JavaScript code that you define for colle
787
822
  // Your collection export logic here
788
823
  console.log(`Exporting collection: ${collectionId}`);
789
824
  // Export and update all items on server
790
- return await schema.actions.bulkUpdate({ lastExported: new Date() });
825
+ // Handle potential undefined schema
826
+ if (schema) {
827
+ return await schema.actions.bulkUpdate({ lastExported: new Date() });
828
+ }
829
+ return Promise.resolve(); // fallback when schema is unavailable
791
830
  },
792
831
  successToast: 'Collection exported successfully',
793
832
  errorToast: (err, {retry}) => ({
794
- text: 'Export failed',
833
+ message: 'Export failed',
795
834
  action: { text: 'Retry', onClick: retry }
796
835
  })
797
836
  }
@@ -1014,10 +1053,16 @@ export const quickToggle: CustomActionCollectionPageActionOnRowClickResolver = (
1014
1053
  const updatedItem = { ...item, isActive: !item.isActive };
1015
1054
 
1016
1055
  optimisticActions.updateOne(updatedItem, {
1017
- submit: async (items) => schema.actions.update(items[0]),
1056
+ submit: async (items) => {
1057
+ // Handle potential undefined schema
1058
+ if (schema) {
1059
+ return await schema.actions.update(items[0]);
1060
+ }
1061
+ return items[0]; // fallback when schema is unavailable
1062
+ },
1018
1063
  successToast: `${item.name} toggled successfully`,
1019
1064
  errorToast: (err, {retry}) => ({
1020
- text: 'Toggle failed',
1065
+ message: 'Toggle failed',
1021
1066
  action: { text: 'Retry', onClick: retry }
1022
1067
  })
1023
1068
  });
@@ -1120,9 +1165,15 @@ const optimisticActions = sdk.getOptimisticActions(sdk.collectionId);
1120
1165
  const schema = sdk.getSchema(sdk.collectionId);
1121
1166
 
1122
1167
  optimisticActions.operation(items, {
1123
- submit: async (items) => schema.actions.serverMethod(items),
1168
+ submit: async (items) => {
1169
+ // Handle potential undefined schema
1170
+ if (schema) {
1171
+ return await schema.actions.serverMethod(items);
1172
+ }
1173
+ return items; // fallback when schema is unavailable
1174
+ },
1124
1175
  successToast: 'Success message',
1125
- errorToast: (err, {retry}) => ({ text: 'Error message', action: { text: 'Retry', onClick: retry }})
1176
+ errorToast: (err, {retry}) => ({ message: 'Error message', action: { text: 'Retry', onClick: retry }})
1126
1177
  });
1127
1178
  ```
1128
1179
 
@@ -1153,7 +1204,7 @@ interface OptimisticParams<T> {
1153
1204
  }
1154
1205
 
1155
1206
  interface ToastConfig {
1156
- text: string;
1207
+ message: string; // Note: Use 'message' property, not 'text'
1157
1208
  action?: { text: string; onClick: () => void };
1158
1209
  }
1159
1210
  ```
@@ -1162,9 +1213,10 @@ interface ToastConfig {
1162
1213
 
1163
1214
  **Before using optimistic actions:**
1164
1215
  - Verify `sdk.getOptimisticActions(collectionId)` returns valid instance
1165
- - Verify `sdk.getSchema(collectionId)` returns valid schema
1216
+ - **Always check for undefined schema**: `sdk.getSchema(collectionId)` can return `undefined` - handle this case in your submit functions
1166
1217
  - For delete operations: `showUndoToast: true` is mandatory
1167
1218
  - All `submit` functions must return a Promise
1219
+ - **Toast property**: Use `message` property in ToastConfig, not `text`
1168
1220
 
1169
1221
  **SDK Parameter:** Available in custom actions and modals. See SDK Utilities section for complete interface.
1170
1222
 
@@ -1480,11 +1532,15 @@ Custom actions execute JavaScript code that you define. These actions receive pa
1480
1532
  optimisticActions.updateOne(updatedItem, {
1481
1533
  submit: async (items) => {
1482
1534
  // Your download logic here + update server
1483
- return await schema.actions.update(items[0]);
1535
+ // Handle potential undefined schema
1536
+ if (schema) {
1537
+ return await schema.actions.update(items[0]);
1538
+ }
1539
+ return items[0]; // fallback when schema is unavailable
1484
1540
  },
1485
1541
  successToast: 'Pet details downloaded',
1486
1542
  errorToast: (err, {retry}) => ({
1487
- text: 'Download failed',
1543
+ message: 'Download failed',
1488
1544
  action: { text: 'Retry', onClick: retry }
1489
1545
  })
1490
1546
  });
@@ -1714,11 +1770,15 @@ Custom bulk actions execute JavaScript code that you define for bulk operations.
1714
1770
  a.click();
1715
1771
 
1716
1772
  // Update server with export timestamp
1717
- return await schema.actions.update(items);
1773
+ // Handle potential undefined schema
1774
+ if (schema) {
1775
+ return await schema.actions.update(items);
1776
+ }
1777
+ return items; // fallback when schema is unavailable
1718
1778
  },
1719
1779
  successToast: `${selectedValues.length} pets exported`,
1720
1780
  errorToast: (err, {retry}) => ({
1721
- text: 'Export failed',
1781
+ message: 'Export failed',
1722
1782
  action: { text: 'Retry', onClick: retry }
1723
1783
  })
1724
1784
  });
@@ -1898,8 +1958,72 @@ All entity pages must have:
1898
1958
 
1899
1959
  * Displays details for a **single entity**.
1900
1960
  * Always tied to a single Wix collection.
1961
+ * Supports **two distinct modes**: **view mode** and **edit mode** with separate page configurations.
1962
+
1963
+ ## Entity Page Modes
1964
+
1965
+ AutoPatterns supports two entity page modes that can be configured as separate pages:
1966
+
1967
+ ### Edit Mode (Default)
1968
+ - **Purpose**: Allows users to modify entity data
1969
+ - **UI**: Uses `@wix/patterns` `EntityPage` component with built-in Save/Cancel actions
1970
+ - **Actions**: Only supports `moreActions` (custom actions in the "more" menu)
1971
+ - **Default Mode**: When `mode` is not specified, defaults to edit mode
1972
+
1973
+ ### View Mode
1974
+ - **Purpose**: Displays entity data in read-only format with rich action capabilities
1975
+ - **Actions**: Supports `primaryActions`, `secondaryActions`, and `moreActions` (collection-style actions)
1976
+ - **Mode**: Must be explicitly set with `mode: 'view'`
1901
1977
 
1902
- > The custom actions must be defined inside the `moreActions` array.
1978
+
1979
+ ## Routing Patterns
1980
+
1981
+ When implementing both view and edit modes for the same entity, use these routing patterns:
1982
+
1983
+ - **View Mode**: `/entity/:entityId` (e.g., `/product/:productId`)
1984
+ - **Edit Mode**: `/entity/edit/:entityId` (e.g., `/product/edit/:productId`)
1985
+
1986
+ This pattern allows:
1987
+ - Clear distinction between view and edit URLs
1988
+ - Natural navigation flow between modes
1989
+
1990
+ ## View Mode: Purpose and API
1991
+
1992
+ ### Purpose of View Mode
1993
+ View mode is primarily intended for **read-only entity presentation** with rich action capabilities by default; however, it also supports interactive or editable custom components if needed:
1994
+
1995
+ - **Data Display**: Present entity information in a clean, read-only format
1996
+ - **Action Hub**: Provide primary, secondary, and more actions for entity operations
1997
+ - **Navigation Center**: Enable seamless transitions to edit mode and other workflows
1998
+ - **Rich Content**: Display images, rich text, and complex data types optimally
1999
+
2000
+
2001
+ See [Entity Page View Actions](./entity_page_view_actions.md) for detailed action configuration.
2002
+
2003
+ #### Out-of-the-Box Features
2004
+
2005
+ **Automatic Edit Navigation**: When a corresponding edit mode page exists, view mode automatically adds an "Edit [EntityName]" action to the more actions menu.
2006
+
2007
+ **Back Navigation**: Automatic "Back" button that navigates to the parent collection page.
2008
+
2009
+ ## Action Configuration
2010
+
2011
+ Entity page action configuration depends on the mode:
2012
+
2013
+ - **Edit Mode**: Supports only `moreActions`. See [Entity Page Actions](./entity_page_actions.md)
2014
+ - **View Mode**: Supports full action API (`primaryActions`, `secondaryActions`, `moreActions`). See [Entity Page View Actions](./entity_page_view_actions.md)
2015
+
2016
+ ### Edit Mode Actions
2017
+ - **Supported**: `moreActions` only
2018
+ - **Built-in**: Save and Cancel actions are automatically provided
2019
+ - **Custom Actions**: Must be defined in the `moreActions` array
2020
+
2021
+ ### View Mode Actions
2022
+ - **Supported**: `primaryActions`, `secondaryActions`, and `moreActions`
2023
+ - **Pattern**: Follows collection page action patterns
2024
+ - **Flexibility**: Full control over all action areas
2025
+
2026
+ > The custom actions must be defined inside the `moreActions` array for edit mode, but view mode supports actions in all areas.
1903
2027
 
1904
2028
  > Note: You do not need to define a custom action to navigate to the entity page. This behavior is built-in — clicking on a row in the collection table automatically navigates to the corresponding entity page.
1905
2029
 
@@ -1991,11 +2115,13 @@ All entity pages must have:
1991
2115
 
1992
2116
  ---
1993
2117
 
1994
- ## Entity Page Actions: `moreActions` Support
2118
+ ## Entity Page Edit Mode Actions: `moreActions` Support
1995
2119
 
1996
- Entity pages in AutoPatternsApp support not only a primary action (such as "Save" or "Delete") but also a flexible set of **more actions** (sometimes called "secondary actions" or `moreActions`). These allow you to provide additional contextual actions for the entity, such as custom logic, or grouped actions.
2120
+ Entity pages in **edit mode** support not only built-in actions (such as "Save" and "Cancel") but also a flexible set of **more actions** (sometimes called "secondary actions" or `moreActions`). These allow you to provide additional contextual actions for the entity, such as custom logic, or grouped actions.
1997
2121
 
1998
- > **Note:** All custom actions for entity pages must be placed in the `moreActions` array. Do not place custom actions as primary actions on entity pages. The `moreActions` array is the only supported location for custom actions on entity pages.
2122
+ > **Note:** This documentation covers **edit mode** entity pages only. Edit mode supports only `moreActions`. For **view mode** entity pages that support `primaryActions`, `secondaryActions`, and `moreActions`, see [Entity Page View Actions](./entity_page_view_actions.md).
2123
+
2124
+ > **Edit Mode Limitation:** All custom actions for edit mode entity pages must be placed in the `moreActions` array. Do not place custom actions as primary actions on edit mode entity pages. The `moreActions` array is the only supported location for custom actions on edit mode entity pages.
1999
2125
 
2000
2126
  ### Configuration Structure
2001
2127
 
@@ -2032,16 +2158,16 @@ Entity pages in AutoPatternsApp support not only a primary action (such as "Save
2032
2158
 
2033
2159
  ---
2034
2160
 
2035
- ### CustomEntityPageMoreActionsActionResolver
2161
+ ### CustomEntityPageActionResolver
2036
2162
 
2037
- The `CustomEntityPageMoreActionsActionResolver` type is used to implement custom actions for the `moreActions` menu on entity pages in AutoPatternsApp. Each action in the `moreActions` array must have a corresponding resolver function registered in your overrides.
2163
+ The `CustomEntityPageActionResolver` type is used to implement custom actions for the `moreActions` menu on entity pages in AutoPatternsApp. Each action in the `moreActions` array must have a corresponding resolver function registered in your overrides.
2038
2164
 
2039
2165
  #### Function Signature
2040
2166
 
2041
2167
  ```typescript
2042
- import { CustomEntityPageMoreActionsActionResolver } from '@wix/auto-patterns/types';
2168
+ import { CustomEntityPageActionResolver } from '@wix/auto-patterns/types';
2043
2169
 
2044
- export const myMoreAction: CustomEntityPageMoreActionsActionResolver = (params) => {
2170
+ export const myMoreAction: CustomEntityPageActionResolver = (params) => {
2045
2171
  const { actionParams: { entity, form } , sdk } = params;
2046
2172
 
2047
2173
  return {
@@ -2060,10 +2186,10 @@ export const myMoreAction: CustomEntityPageMoreActionsActionResolver = (params)
2060
2186
 
2061
2187
  ---
2062
2188
 
2063
- #### Key Points for CustomEntityPageMoreActionsActionResolver
2189
+ #### Key Points for CustomEntityPageActionResolver
2064
2190
 
2065
2191
  - The action `id` in the configuration MUST exactly match the function name exported from your actions folder.
2066
- - The implementation must use the `CustomEntityPageMoreActionsActionResolver` type.
2192
+ - The implementation must use the `CustomEntityPageActionResolver` type.
2067
2193
  - The implementation must be exported as a named export (not default export).
2068
2194
  - The function receives `{ actionParams, sdk }` as parameters.
2069
2195
  - The returned object must include at least a `label` and an `onClick` handler (optionally an `icon`).
@@ -2076,13 +2202,153 @@ export const myMoreAction: CustomEntityPageMoreActionsActionResolver = (params)
2076
2202
  ✓ Each action type only includes its required field(s)
2077
2203
  ✓ Custom actions match implementations in overrides
2078
2204
  ✓ The resolver is exported and registered in the `actions` property of your `PatternsWizardOverridesProvider`
2079
- ✓ The function signature matches `CustomEntityPageMoreActionsActionResolver`
2205
+ ✓ The function signature matches `CustomEntityPageActionResolver`
2080
2206
  ✓ The returned object includes `label`, `onClick`, and optionally `icon`
2081
2207
 
2082
2208
  ---
2083
2209
 
2084
2210
  **Summary:**
2085
- The `CustomEntityPageMoreActionsActionResolver` enables you to add custom, contextual actions to the "More Actions" menu on your entity pages. Implement the resolver, export it, and reference it by `id` in your config for seamless integration.
2211
+ The `CustomEntityPageActionResolver` enables you to add custom, contextual actions to the "More Actions" menu on your entity pages. Implement the resolver, export it, and reference it by `id` in your config for seamless integration.
2212
+
2213
+ ---
2214
+
2215
+ # Entity Page View Mode Actions
2216
+
2217
+ View mode supports the complete collection-style actions API, providing maximum flexibility for entity operations.
2218
+
2219
+ ## Supported Action Types
2220
+
2221
+ ### Primary Actions
2222
+ The main call-to-action, typically for the most common operation:
2223
+
2224
+ ```typescript
2225
+ primaryActions: {
2226
+ type: 'action',
2227
+ action: {
2228
+ item: {
2229
+ id: 'createEntity',
2230
+ label: 'Create New',
2231
+ type: 'create',
2232
+ create: {
2233
+ mode: 'page',
2234
+ page: { id: 'EntityEditPageId' }
2235
+ }
2236
+ }
2237
+ }
2238
+ }
2239
+ ```
2240
+
2241
+ ### Secondary Actions
2242
+ Supporting actions displayed alongside primary actions:
2243
+
2244
+ ```typescript
2245
+ secondaryActions: {
2246
+ type: 'action',
2247
+ action: {
2248
+ item: {
2249
+ id: 'duplicateEntity',
2250
+ label: 'Duplicate',
2251
+ type: 'custom',
2252
+ }
2253
+ }
2254
+ }
2255
+ ```
2256
+
2257
+ ### More Actions
2258
+ Additional contextual actions in dropdown menu:
2259
+
2260
+ ```typescript
2261
+ moreActions: [
2262
+ {
2263
+ id: 'shareEntity',
2264
+ type: 'custom',
2265
+ label: 'Share',
2266
+ }
2267
+ ]
2268
+ ```
2269
+
2270
+ ## Action Menu Support
2271
+
2272
+ View mode also supports menu-style actions for grouping related operations:
2273
+
2274
+ ```typescript
2275
+ primaryActions: {
2276
+ type: 'menu',
2277
+ menu: {
2278
+ label: 'Actions',
2279
+ items: [
2280
+ {
2281
+ id: 'duplicateProduct',
2282
+ label: 'Duplicate',
2283
+ type: 'custom',
2284
+ },
2285
+ { type: 'divider' },
2286
+ {
2287
+ id: 'shareProduct',
2288
+ type: 'custom',
2289
+ label: 'Share'
2290
+ }
2291
+ ]
2292
+ }
2293
+ }
2294
+ ```
2295
+
2296
+ ## Automatic Edit Action
2297
+
2298
+ View mode automatically provides an "Edit [EntityName]" action in the more actions menu when:
2299
+ - An edit mode page exists for the same collection
2300
+ - The edit page has no explicit mode or `mode: 'edit'`
2301
+ - The view page has `mode: 'view'`
2302
+
2303
+ This action is automatically added and doesn't need to be configured manually.
2304
+
2305
+ ## Action Resolvers
2306
+
2307
+ View mode actions follow the same resolver patterns as collection page actions:
2308
+
2309
+ ### For Standard Actions (create)
2310
+ These actions are handled automatically by the AutoPatterns framework using the configuration provided.
2311
+
2312
+ ### For Custom Actions
2313
+ Custom actions require resolver implementations:
2314
+
2315
+ ```typescript
2316
+ import { CustomEntityPageActionResolver } from '@wix/auto-patterns/types';
2317
+
2318
+ export const duplicateProduct: CustomEntityPageActionResolver = (params) => {
2319
+ const { actionParams: { entity }, sdk } = params;
2320
+
2321
+ const schema = sdk.getSchema(sdk.collectionId);
2322
+ return {
2323
+ label: 'Duplicate Product',
2324
+ icon: <DuplicateIcon />, // optional
2325
+ onClick: async () => {
2326
+ // Your custom duplication logic here
2327
+ await schema.actions.create({
2328
+ ...entity,
2329
+ name: `${entity.name} (Copy)`
2330
+ });
2331
+ },
2332
+ };
2333
+ };
2334
+ ```
2335
+
2336
+ ## Best Practices
2337
+
2338
+ ### When to Use Each Action Type
2339
+
2340
+ **Primary Actions**: Use for the most common user action (typically "Create" or main workflow action)
2341
+
2342
+ **Secondary Actions**: Use for supporting workflows like "Duplicate"
2343
+
2344
+ **More Actions**: Use for:
2345
+ - Less common operations
2346
+ - Administrative functions
2347
+ - Actions that need confirmation
2348
+
2349
+ ### Navigation Patterns
2350
+
2351
+ 1. **View → Create**: Use primary actions with `type: 'create'`
2086
2352
 
2087
2353
  ---
2088
2354
 
@@ -106,11 +106,15 @@ Custom bulk actions execute JavaScript code that you define for bulk operations.
106
106
  a.click();
107
107
 
108
108
  // Update server with export timestamp
109
- return await schema.actions.update(items);
109
+ // Handle potential undefined schema
110
+ if (schema) {
111
+ return await schema.actions.update(items);
112
+ }
113
+ return items; // fallback when schema is unavailable
110
114
  },
111
115
  successToast: `${selectedValues.length} pets exported`,
112
116
  errorToast: (err, {retry}) => ({
113
- text: 'Export failed',
117
+ message: 'Export failed',
114
118
  action: { text: 'Retry', onClick: retry }
115
119
  })
116
120
  });
@@ -87,11 +87,15 @@ Custom collection page actions execute JavaScript code that you define for colle
87
87
  // Your collection export logic here
88
88
  console.log(`Exporting collection: ${collectionId}`);
89
89
  // Export and update all items on server
90
- return await schema.actions.bulkUpdate({ lastExported: new Date() });
90
+ // Handle potential undefined schema
91
+ if (schema) {
92
+ return await schema.actions.bulkUpdate({ lastExported: new Date() });
93
+ }
94
+ return Promise.resolve(); // fallback when schema is unavailable
91
95
  },
92
96
  successToast: 'Collection exported successfully',
93
97
  errorToast: (err, {retry}) => ({
94
- text: 'Export failed',
98
+ message: 'Export failed',
95
99
  action: { text: 'Retry', onClick: retry }
96
100
  })
97
101
  }
@@ -314,10 +318,16 @@ export const quickToggle: CustomActionCollectionPageActionOnRowClickResolver = (
314
318
  const updatedItem = { ...item, isActive: !item.isActive };
315
319
 
316
320
  optimisticActions.updateOne(updatedItem, {
317
- submit: async (items) => schema.actions.update(items[0]),
321
+ submit: async (items) => {
322
+ // Handle potential undefined schema
323
+ if (schema) {
324
+ return await schema.actions.update(items[0]);
325
+ }
326
+ return items[0]; // fallback when schema is unavailable
327
+ },
318
328
  successToast: `${item.name} toggled successfully`,
319
329
  errorToast: (err, {retry}) => ({
320
- text: 'Toggle failed',
330
+ message: 'Toggle failed',
321
331
  action: { text: 'Retry', onClick: retry }
322
332
  })
323
333
  });