@wix/auto-patterns 1.28.0 → 1.30.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 (212) 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/hooks/index.js +0 -7
  18. package/dist/cjs/hooks/index.js.map +1 -1
  19. package/dist/cjs/hooks/useAppContextSync.js +24 -0
  20. package/dist/cjs/hooks/useAppContextSync.js.map +1 -0
  21. package/dist/cjs/hooks/useAutoPatternsOptimisticActions.js +2 -2
  22. package/dist/cjs/hooks/useAutoPatternsOptimisticActions.js.map +1 -1
  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/useEmptyStates.js +1 -1
  28. package/dist/cjs/hooks/useEmptyStates.js.map +1 -1
  29. package/dist/cjs/hooks/useEntityPageHeaderTexts.js +2 -2
  30. package/dist/cjs/hooks/useEntityPageHeaderTexts.js.map +1 -1
  31. package/dist/cjs/hooks/useFilters.js +2 -2
  32. package/dist/cjs/hooks/useFilters.js.map +1 -1
  33. package/dist/cjs/hooks/useGridFeatures.js +10 -2
  34. package/dist/cjs/hooks/useGridFeatures.js.map +1 -1
  35. package/dist/cjs/hooks/useTableFeatures.js +12 -4
  36. package/dist/cjs/hooks/useTableFeatures.js.map +1 -1
  37. package/dist/cjs/hooks/useTableGridSwitchFeatures.js +10 -2
  38. package/dist/cjs/hooks/useTableGridSwitchFeatures.js.map +1 -1
  39. package/dist/cjs/providers/AppContext.js +10 -8
  40. package/dist/cjs/providers/AppContext.js.map +1 -1
  41. package/dist/cjs/providers/AppContextData.js +40 -0
  42. package/dist/cjs/providers/AppContextData.js.map +1 -0
  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/ItemsContext.js +14 -11
  46. package/dist/cjs/providers/ItemsContext.js.map +1 -1
  47. package/dist/cjs/providers/SchemaContext.js +24 -7
  48. package/dist/cjs/providers/SchemaContext.js.map +1 -1
  49. package/dist/cjs/providers/index.js +11 -4
  50. package/dist/cjs/providers/index.js.map +1 -1
  51. package/dist/cjs/types/BaseSDK.js.map +1 -1
  52. package/dist/cjs/types/CollectionPageConfig.js.map +1 -1
  53. package/dist/cjs/types/EntityPageConfig.js.map +1 -1
  54. package/dist/cjs/types/actions/actionCell.js.map +1 -1
  55. package/dist/cjs/types/actions/base.js.map +1 -1
  56. package/dist/cjs/types/actions/bulkActions.js.map +1 -1
  57. package/dist/cjs/types/actions/collectionPageActions.js.map +1 -1
  58. package/dist/cjs/types/actions/entityPageActions.js.map +1 -1
  59. package/dist/cjs/types/fetchData.js.map +1 -1
  60. package/dist/cjs/types/types.js.map +1 -1
  61. package/dist/cjs/utils/actions/resolveAction.js +2 -1
  62. package/dist/cjs/utils/actions/resolveAction.js.map +1 -1
  63. package/dist/cjs/utils/actions/types.js.map +1 -1
  64. package/dist/cjs/utils/vibe.js +11 -0
  65. package/dist/cjs/utils/vibe.js.map +1 -0
  66. package/dist/docs/action_cell.md +18 -8
  67. package/dist/docs/app_config_structure.md +36 -1
  68. package/dist/docs/app_context.md +109 -0
  69. package/dist/docs/auto-patterns-guide.md +244 -64
  70. package/dist/docs/bulk_actions.md +10 -5
  71. package/dist/docs/collection_page.md +1 -1
  72. package/dist/docs/collection_page_actions.md +16 -9
  73. package/dist/docs/custom_overrides.md +21 -21
  74. package/dist/docs/entity_page.md +10 -10
  75. package/dist/docs/entity_page_actions.md +11 -4
  76. package/dist/docs/index.md +4 -0
  77. package/dist/docs/installation.md +3 -3
  78. package/dist/docs/resolved_action.md +6 -2
  79. package/dist/docs/wix_fqdn_custom_data_source.md +2 -2
  80. package/dist/esm/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js +2 -25
  81. package/dist/esm/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js.map +1 -1
  82. package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js +2 -2
  83. package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
  84. package/dist/esm/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.js +29 -0
  85. package/dist/esm/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.js.map +1 -0
  86. package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js +2 -2
  87. package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js.map +1 -1
  88. package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js +2 -2
  89. package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js.map +1 -1
  90. package/dist/esm/components/AutoPatternsRoute/AutoPatternsRoutes.js +5 -1
  91. package/dist/esm/components/AutoPatternsRoute/AutoPatternsRoutes.js.map +1 -1
  92. package/dist/esm/components/ModalRenderer.js +2 -2
  93. package/dist/esm/components/ModalRenderer.js.map +1 -1
  94. package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js +4 -0
  95. package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
  96. package/dist/esm/hooks/index.js +0 -1
  97. package/dist/esm/hooks/index.js.map +1 -1
  98. package/dist/esm/hooks/useAppContextSync.js +19 -0
  99. package/dist/esm/hooks/useAppContextSync.js.map +1 -0
  100. package/dist/esm/hooks/useAutoPatternsOptimisticActions.js +2 -2
  101. package/dist/esm/hooks/useAutoPatternsOptimisticActions.js.map +1 -1
  102. package/dist/esm/hooks/useBaseSDK.js +2 -2
  103. package/dist/esm/hooks/useBaseSDK.js.map +1 -1
  104. package/dist/esm/hooks/useColumns.js +2 -2
  105. package/dist/esm/hooks/useColumns.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/useFilters.js +2 -2
  111. package/dist/esm/hooks/useFilters.js.map +1 -1
  112. package/dist/esm/hooks/useGridFeatures.js +10 -2
  113. package/dist/esm/hooks/useGridFeatures.js.map +1 -1
  114. package/dist/esm/hooks/useTableFeatures.js +12 -4
  115. package/dist/esm/hooks/useTableFeatures.js.map +1 -1
  116. package/dist/esm/hooks/useTableGridSwitchFeatures.js +10 -2
  117. package/dist/esm/hooks/useTableGridSwitchFeatures.js.map +1 -1
  118. package/dist/esm/providers/AppContext.js +7 -5
  119. package/dist/esm/providers/AppContext.js.map +1 -1
  120. package/dist/esm/providers/AppContextData.js +26 -0
  121. package/dist/esm/providers/AppContextData.js.map +1 -0
  122. package/dist/esm/providers/AutoPatternsOverridesContext.js +19 -0
  123. package/dist/esm/providers/AutoPatternsOverridesContext.js.map +1 -0
  124. package/dist/esm/providers/ItemsContext.js +10 -7
  125. package/dist/esm/providers/ItemsContext.js.map +1 -1
  126. package/dist/esm/providers/SchemaContext.js +23 -6
  127. package/dist/esm/providers/SchemaContext.js.map +1 -1
  128. package/dist/esm/providers/index.js +2 -1
  129. package/dist/esm/providers/index.js.map +1 -1
  130. package/dist/esm/types/BaseSDK.js.map +1 -1
  131. package/dist/esm/types/CollectionPageConfig.js.map +1 -1
  132. package/dist/esm/types/EntityPageConfig.js.map +1 -1
  133. package/dist/esm/types/actions/actionCell.js.map +1 -1
  134. package/dist/esm/types/actions/base.js.map +1 -1
  135. package/dist/esm/types/actions/bulkActions.js.map +1 -1
  136. package/dist/esm/types/actions/collectionPageActions.js.map +1 -1
  137. package/dist/esm/types/actions/entityPageActions.js.map +1 -1
  138. package/dist/esm/types/fetchData.js.map +1 -1
  139. package/dist/esm/types/types.js.map +1 -1
  140. package/dist/esm/utils/actions/resolveAction.js +2 -1
  141. package/dist/esm/utils/actions/resolveAction.js.map +1 -1
  142. package/dist/esm/utils/actions/types.js.map +1 -1
  143. package/dist/esm/utils/vibe.js +6 -0
  144. package/dist/esm/utils/vibe.js.map +1 -0
  145. package/dist/types/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.d.ts.map +1 -1
  146. package/dist/types/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.d.ts +3 -0
  147. package/dist/types/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.d.ts.map +1 -0
  148. package/dist/types/components/AutoPatternsRoute/AutoPatternsRoutes.d.ts.map +1 -1
  149. package/dist/types/dataSourceAdapters/cms/cmsAdapter.d.ts +2 -1
  150. package/dist/types/dataSourceAdapters/cms/cmsAdapter.d.ts.map +1 -1
  151. package/dist/types/hooks/index.d.ts +0 -1
  152. package/dist/types/hooks/index.d.ts.map +1 -1
  153. package/dist/types/hooks/useAppContextSync.d.ts +2 -0
  154. package/dist/types/hooks/useAppContextSync.d.ts.map +1 -0
  155. package/dist/types/hooks/useEntityPageHeaderTexts.d.ts.map +1 -1
  156. package/dist/types/hooks/useGridFeatures.d.ts.map +1 -1
  157. package/dist/types/hooks/useTableFeatures.d.ts.map +1 -1
  158. package/dist/types/hooks/useTableGridSwitchFeatures.d.ts.map +1 -1
  159. package/dist/types/providers/AppContext.d.ts +2 -2
  160. package/dist/types/providers/AppContext.d.ts.map +1 -1
  161. package/dist/types/providers/AppContextData.d.ts +13 -0
  162. package/dist/types/providers/AppContextData.d.ts.map +1 -0
  163. package/dist/types/providers/{PatternsWizardOverridesContext.d.ts → AutoPatternsOverridesContext.d.ts} +12 -4
  164. package/dist/types/providers/AutoPatternsOverridesContext.d.ts.map +1 -0
  165. package/dist/types/providers/ItemsContext.d.ts +6 -4
  166. package/dist/types/providers/ItemsContext.d.ts.map +1 -1
  167. package/dist/types/providers/SchemaContext.d.ts.map +1 -1
  168. package/dist/types/providers/index.d.ts +2 -1
  169. package/dist/types/providers/index.d.ts.map +1 -1
  170. package/dist/types/types/BaseSDK.d.ts +2 -2
  171. package/dist/types/types/BaseSDK.d.ts.map +1 -1
  172. package/dist/types/types/CollectionPageConfig.d.ts +315 -0
  173. package/dist/types/types/CollectionPageConfig.d.ts.map +1 -1
  174. package/dist/types/types/EntityPageConfig.d.ts +111 -0
  175. package/dist/types/types/EntityPageConfig.d.ts.map +1 -1
  176. package/dist/types/types/actions/actionCell.d.ts +41 -0
  177. package/dist/types/types/actions/actionCell.d.ts.map +1 -1
  178. package/dist/types/types/actions/base.d.ts +85 -0
  179. package/dist/types/types/actions/base.d.ts.map +1 -1
  180. package/dist/types/types/actions/bulkActions.d.ts +40 -0
  181. package/dist/types/types/actions/bulkActions.d.ts.map +1 -1
  182. package/dist/types/types/actions/collectionPageActions.d.ts +30 -0
  183. package/dist/types/types/actions/collectionPageActions.d.ts.map +1 -1
  184. package/dist/types/types/actions/entityPageActions.d.ts +25 -0
  185. package/dist/types/types/actions/entityPageActions.d.ts.map +1 -1
  186. package/dist/types/types/fetchData.d.ts +35 -0
  187. package/dist/types/types/fetchData.d.ts.map +1 -1
  188. package/dist/types/types/types.d.ts +114 -2
  189. package/dist/types/types/types.d.ts.map +1 -1
  190. package/dist/types/utils/actions/resolveAction.d.ts +1 -0
  191. package/dist/types/utils/actions/resolveAction.d.ts.map +1 -1
  192. package/dist/types/utils/actions/types.d.ts +1 -0
  193. package/dist/types/utils/actions/types.d.ts.map +1 -1
  194. package/dist/types/utils/vibe.d.ts +2 -0
  195. package/dist/types/utils/vibe.d.ts.map +1 -0
  196. package/package.json +10 -10
  197. package/dist/cjs/dataSourceAdapters/factory.js +0 -14
  198. package/dist/cjs/dataSourceAdapters/factory.js.map +0 -1
  199. package/dist/cjs/hooks/useUpdateAppContextItems.js +0 -18
  200. package/dist/cjs/hooks/useUpdateAppContextItems.js.map +0 -1
  201. package/dist/cjs/providers/PatternsWizardOverridesContext.js.map +0 -1
  202. package/dist/esm/dataSourceAdapters/factory.js +0 -10
  203. package/dist/esm/dataSourceAdapters/factory.js.map +0 -1
  204. package/dist/esm/hooks/useUpdateAppContextItems.js +0 -13
  205. package/dist/esm/hooks/useUpdateAppContextItems.js.map +0 -1
  206. package/dist/esm/providers/PatternsWizardOverridesContext.js +0 -15
  207. package/dist/esm/providers/PatternsWizardOverridesContext.js.map +0 -1
  208. package/dist/types/dataSourceAdapters/factory.d.ts +0 -3
  209. package/dist/types/dataSourceAdapters/factory.d.ts.map +0 -1
  210. package/dist/types/hooks/useUpdateAppContextItems.d.ts +0 -2
  211. package/dist/types/hooks/useUpdateAppContextItems.d.ts.map +0 -1
  212. package/dist/types/providers/PatternsWizardOverridesContext.d.ts.map +0 -1
@@ -144,6 +144,7 @@ Custom actions execute JavaScript code that you define. These actions receive pa
144
144
  })
145
145
  });
146
146
  },
147
+ biName: 'download-pet-details-action' // MANDATORY: For analytics tracking
147
148
  };
148
149
  };
149
150
  ```
@@ -168,10 +169,11 @@ Custom actions execute JavaScript code that you define. These actions receive pa
168
169
  "id": "downloadPetDetails", // MUST match the function name exactly
169
170
  "type": "custom", // REQUIRED: Must be exactly "custom"
170
171
  "label": "Download Details", // Optional: Displayed text
172
+ "biName": "download-pet-details-action" // MANDATORY: Analytics tracking identifier
171
173
  }
172
174
  ```
173
175
 
174
- 5. Register your action in the `PatternsWizardOverridesProvider`:
176
+ 5. Register your action in the `AutoPatternsOverridesProvider`:
175
177
  ```typescript
176
178
  import { useActions } from '../components/actions';
177
179
 
@@ -179,9 +181,9 @@ Custom actions execute JavaScript code that you define. These actions receive pa
179
181
  const actions = useActions();
180
182
 
181
183
  return (
182
- <PatternsWizardOverridesProvider value={{ actions }}>
184
+ <AutoPatternsOverridesProvider value={{ actions }}>
183
185
  <AutoPatternsApp configuration={config} />
184
- </PatternsWizardOverridesProvider>
186
+ </AutoPatternsOverridesProvider>
185
187
  );
186
188
  }
187
189
  ```
@@ -196,13 +198,21 @@ Custom actions execute JavaScript code that you define. These actions receive pa
196
198
 
197
199
  1. `id` must:
198
200
  - Match exactly the function name of the custom action implementation
199
- - Be registered in the `actions` property of your `PatternsWizardOverridesProvider`
201
+ - Be registered in the `actions` property of your `AutoPatternsOverridesProvider`
200
202
  - Follow JavaScript identifier naming rules (camelCase recommended)
201
203
 
202
- 2. The implementation must return an object with:
203
- - `label`: Text displayed for the action
204
+ 2. `biName` must:
205
+ - Be included in every action configuration (MANDATORY)
206
+ - Use descriptive, kebab-case naming (e.g., "download-pet-details-action")
207
+ - Be unique across the application
208
+ - Follow the pattern: `{action-purpose}-action`
209
+ - Enable analytics tracking for user interactions
210
+
211
+ 2. The implementation must return a `ResolvedAction` object with:
212
+ - `label`: Text displayed for the action
204
213
  - `icon`: An Icon component from "@wix/wix-ui-icons-common"
205
214
  - `onClick`: Handler function for the action
215
+ - `biName`: Business intelligence name for analytics tracking. Must match the `biName` in your action configuration (required)
206
216
  - `hidden` (optional): Boolean to hide the action when true
207
217
 
208
218
  3. The implementation must:
@@ -238,13 +248,13 @@ Follow this decision process when implementing ActionCell:
238
248
  - Complex, full-entity edits → Use `mode: "page"` to navigate to entity page
239
249
 
240
250
  6. **Custom Implementation**:
241
- - For `custom` actions, you must provide implementations in your code and register them with `PatternsWizardOverridesProvider`
251
+ - For `custom` actions, you must provide implementations in your code and register them with `AutoPatternsOverridesProvider`
242
252
 
243
253
  ### ActionCell Validation Checklist
244
254
 
245
255
  AI agents should verify these requirements before generating ActionCell configurations:
246
256
 
247
- ✓ ActionCell is placed directly inside `table` or `grid` configuration
257
+ ✓ ActionCell is placed at the collection component level (`collectionPage.components[*].actionCell`) as a sibling to `collection`, `layout`, etc. — NOT inside `table` or `grid`
248
258
  ✓ Each action has a unique `id` and correct `type` value
249
259
  ✓ Each action type only includes its required field(s)
250
260
  ✓ Update page action refers to a valid entity page ID
@@ -1,5 +1,33 @@
1
1
  # AppConfig Structure
2
2
 
3
+ ## ⚠️ CRITICAL REQUIREMENT: Mandatory `biName` Property
4
+
5
+ **Every action configuration in auto-patterns MUST include a `biName` property.** This is not optional - it's a mandatory requirement for all auto-patterns applications.
6
+
7
+ ### Why `biName` is Mandatory:
8
+ - **Analytics Tracking**: Enables tracking of user interactions with actions
9
+ - **Feature Usage**: Helps understand which features are most/least used
10
+ - **User Behavior**: Provides insights into user workflows and preferences
11
+ - **Business Intelligence**: Supports data-driven decision making
12
+ - **A/B Testing**: Enables testing different action configurations
13
+ - **Compliance**: Required for proper application monitoring and reporting
14
+
15
+ ### `biName` Requirements:
16
+ - **MUST be included** in every action configuration
17
+ - **Use descriptive, kebab-case naming** (e.g., "toggle-vaccination-action")
18
+ - **Must be unique** across the application
19
+ - **Follow the pattern**: `{action-purpose}-action`
20
+
21
+ ### Example:
22
+ ```json
23
+ {
24
+ "id": "toggleVaccination",
25
+ "type": "custom",
26
+ "label": "Toggle Vaccination",
27
+ "biName": "toggle-vaccination-action" // MANDATORY
28
+ }
29
+ ```
30
+
3
31
  ## Configuration Rules
4
32
 
5
33
  - **Configuration must come only from a TypeScript file** - never inline or from other sources
@@ -24,6 +52,8 @@
24
52
  - **Missing action type properties**: Not including `create`, `update`, `delete`, or `bulkDelete` properties when required by the action type
25
53
  - **Including wrong action properties**: Adding properties from different action types in the same action configuration
26
54
  - **Action type mismatches**: Using action cell types in collection actions, or bulk action types in regular actions
55
+ - **Missing `biName` property**: Every action configuration MUST include a `biName` property for analytics tracking
56
+ - **Generic `biName` values**: Using generic names like "action" or "button" instead of descriptive, kebab-case names
27
57
 
28
58
  ```ts
29
59
  export interface AppConfig {
@@ -50,6 +80,7 @@ export interface AppConfig {
50
80
  id: string; // Unique identifier for the action
51
81
  type: 'create' | 'custom'; // Action type
52
82
  label?: string; // Text displayed for the action
83
+ biName: string; // MANDATORY: Business intelligence name for analytics tracking
53
84
  collection: {
54
85
  collectionId: string; // ID of the Wix Data collection
55
86
  entityTypeSource: 'cms' | 'custom'; // Data source type.
@@ -144,6 +175,7 @@ export interface AppConfig {
144
175
  type: 'update' | 'delete' | 'custom'; // Action type
145
176
  label?: string; // Text displayed for the action
146
177
  skin?: string; // Visual appearance of the action button (see Action Button Skin Values section)
178
+ biName: string; // MANDATORY: Business intelligence name for analytics tracking
147
179
  disabled?: boolean; // Whether the action is disabled
148
180
  tooltip?: string; // Tooltip text shown on hover
149
181
  update?: { // Required when type is 'update'
@@ -196,6 +228,7 @@ export interface AppConfig {
196
228
  id: string; // Unique identifier for the bulk action
197
229
  type: 'bulkDelete' | 'custom'; // Bulk action type
198
230
  label?: string; // Text displayed for the action
231
+ biName: string; // MANDATORY: Business intelligence name for analytics tracking
199
232
  bulkDelete?: { // Required when type is 'bulkDelete'
200
233
  mode: 'modal'; // Currently only 'modal' is supported
201
234
  modal: {
@@ -301,7 +334,7 @@ export interface AppConfig {
301
334
  } |
302
335
  {
303
336
  type: 'custom'; // Component type for custom slot components
304
- id: string; // Unique identifier that maps to a custom React component provided through PatternsWizardOverridesProvider slots
337
+ id: string; // Unique identifier that maps to a custom React component provided through AutoPatternsOverridesProvider slots
305
338
  }
306
339
  ]; // End of components array
307
340
  };
@@ -333,6 +366,7 @@ export interface AppConfig {
333
366
  id: string;
334
367
  type: 'create' | 'custom';
335
368
  label?: string;
369
+ biName: string; // MANDATORY: Business intelligence name for analytics tracking
336
370
  create?: { // Required when type is 'create'
337
371
  mode: 'page';
338
372
  page: {
@@ -355,6 +389,7 @@ export interface AppConfig {
355
389
  id: string;
356
390
  type: 'custom';
357
391
  label?: string;
392
+ biName: string; // MANDATORY: Business intelligence name for analytics tracking
358
393
  }[];
359
394
  };
360
395
  parentPageId?: string; // ID of the parent collection page
@@ -0,0 +1,109 @@
1
+ # AppContext
2
+
3
+ The AppContext feature allows you to add components outside the main AutoPatternsApp flow while still accessing the collection data.
4
+
5
+ ## 1. Adding Components as Children
6
+
7
+ Components that need to be rendered outside the main AutoPatternsApp interface (such as modals or side panels) should be passed as children:
8
+
9
+ ```tsx
10
+ import { AutoPatternsApp } from '@wix/auto-patterns';
11
+ import { MyModal } from './MyModal';
12
+ import { MySidePanel } from './MySidePanel';
13
+
14
+ <AutoPatternsApp configuration={config}>
15
+ <MyModal />
16
+ <MySidePanel />
17
+ </AutoPatternsApp>
18
+ ```
19
+
20
+ These children components are typically:
21
+ - **Modals** - for custom actions, forms, or dialogs
22
+ - **Side Panels** - for additional information or controls
23
+ - **Overlay Components** - that need to appear on top of the main interface
24
+
25
+ ## 2. Accessing Collection Data
26
+
27
+ Use the `useAppContext` hook to access the current collection items from within your child components:
28
+
29
+ ```tsx
30
+ import React from 'react';
31
+ import { useAppContext } from '@wix/auto-patterns';
32
+
33
+ export const MyModal: React.FC = () => {
34
+ const { items } = useAppContext();
35
+
36
+ return (
37
+ <div>
38
+ <p>Current collection has {items.length} items</p>
39
+ {/* Your modal content */}
40
+ </div>
41
+ );
42
+ };
43
+ ```
44
+
45
+ The `items` array contains the current filtered and paginated collection data that matches what's displayed in the table/grid.
46
+
47
+ ## 3. Refreshing Collection Data
48
+
49
+ The `useAppContext` hook also provides a `refreshCollection` function that allows you to refresh the collection data from within your child components:
50
+
51
+ ```tsx
52
+ import React from 'react';
53
+ import { useAppContext } from '@wix/auto-patterns';
54
+
55
+ export const RefreshButton: React.FC = () => {
56
+ const { refreshCollection } = useAppContext();
57
+
58
+ return (
59
+ <button onClick={refreshCollection}>
60
+ Refresh Collection
61
+ </button>
62
+ );
63
+ };
64
+ ```
65
+
66
+ ### Use Cases for refreshCollection
67
+
68
+ - **Manual Refresh**: Provide users with a button to manually refresh data
69
+ - **Post-Operation Refresh**: Refresh data after completing custom operations in modals
70
+ - **Data Synchronization**: Ensure child components have the latest data after external changes
71
+ - **Real-time Updates**: Refresh data when receiving updates from external sources
72
+
73
+ ### Example: Modal with Refresh Capability
74
+
75
+ ```tsx
76
+ import React from 'react';
77
+ import { useAppContext } from '@wix/auto-patterns';
78
+ import { Button, Modal } from '@wix/design-system';
79
+
80
+ export const DataUpdateModal: React.FC = () => {
81
+ const { items, refreshCollection } = useAppContext();
82
+
83
+ const handleUpdate = async () => {
84
+ // Perform your custom update operation
85
+ await updateExternalData();
86
+
87
+ // Refresh the collection to show updated data
88
+ refreshCollection();
89
+ };
90
+
91
+ return (
92
+ <Modal>
93
+ <Modal.Content>
94
+ <p>Current items: {items.length}</p>
95
+ <Button onClick={handleUpdate}>
96
+ Update and Refresh
97
+ </Button>
98
+ </Modal.Content>
99
+ </Modal>
100
+ );
101
+ };
102
+ ```
103
+
104
+ ### Important Notes
105
+
106
+ - **Automatic Refresh**: The `refreshCollection` function will refresh the current collection with the same filters, sorting, and pagination settings
107
+ - **Performance**: Use this function judiciously to avoid unnecessary API calls
108
+ - **User Experience**: Consider showing loading states during refresh operations
109
+ - **Error Handling**: The refresh operation will automatically handle errors and display appropriate messages to users