@capillarytech/blaze-ui 5.21.0 → 5.22.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 (177) hide show
  1. package/CapLanguageProvider/actions.js +125 -0
  2. package/CapLanguageProvider/actions.js.map +1 -0
  3. package/CapLanguageProvider/constants.js +37 -0
  4. package/CapLanguageProvider/constants.js.map +1 -0
  5. package/package.json +1 -1
  6. package/CapActionBar/README.md +0 -11
  7. package/CapAdvancedIcon/README.md +0 -185
  8. package/CapAdvancedIcon/use-cases.md +0 -44
  9. package/CapAlert/README.md +0 -144
  10. package/CapAppNotEnabled/README.md +0 -84
  11. package/CapAskAira/README.md +0 -328
  12. package/CapBanner/README.md +0 -4
  13. package/CapBlock/README.md +0 -175
  14. package/CapBorderedBox/Status.md +0 -40
  15. package/CapCSVFileUploader/README.md +0 -124
  16. package/CapCSVFileUploader/Status.md +0 -47
  17. package/CapCard/README.md +0 -85
  18. package/CapCard/Status.md +0 -41
  19. package/CapCardBox/README.md +0 -169
  20. package/CapCardBox/Status.md +0 -52
  21. package/CapCarousel/README.md +0 -190
  22. package/CapCarousel/Status.md +0 -73
  23. package/CapCheckbox/README.md +0 -254
  24. package/CapCheckbox/Status.md +0 -41
  25. package/CapColorPicker/README.md +0 -112
  26. package/CapColorPicker/Status.md +0 -52
  27. package/CapColorPicker/tests/USE_CASES_ANALYSIS.md +0 -92
  28. package/CapColoredTag/README.md +0 -167
  29. package/CapColoredTag/Status.md +0 -49
  30. package/CapConditionPreview/MIGRATION_ANALYSIS.md +0 -70
  31. package/CapConditionPreview/README.md +0 -40
  32. package/CapConditionPreview/tests/USE_CASES_CapConditionPreview.md +0 -65
  33. package/CapCustomCard/README.md +0 -182
  34. package/CapCustomCard/Status.md +0 -40
  35. package/CapCustomCarousel/Status.md +0 -69
  36. package/CapCustomCheckboxList/README.md +0 -178
  37. package/CapCustomCheckboxList/Status.md +0 -52
  38. package/CapCustomCheckboxList/tests/USE_CASES_ANALYSIS.md +0 -174
  39. package/CapCustomList/README.md +0 -117
  40. package/CapCustomList/Status.md +0 -77
  41. package/CapCustomList/tests/USE_CASES_ANALYSIS.md +0 -124
  42. package/CapCustomSelect/README.md +0 -38
  43. package/CapDatePicker/README.md +0 -139
  44. package/CapDateRangePicker/README.md +0 -159
  45. package/CapDateTimePicker/README.md +0 -136
  46. package/CapDateTimeRangePicker/README.md +0 -243
  47. package/CapDivider/README.md +0 -122
  48. package/CapDrawer/README.md +0 -207
  49. package/CapDrawer/Status.md +0 -52
  50. package/CapDrawer/tests/MISSING_USE_CASES.md +0 -170
  51. package/CapDropdown/README.md +0 -515
  52. package/CapDropdown/Status.md +0 -45
  53. package/CapDropdown/tests/USE_CASES_ANALYSIS.md +0 -137
  54. package/CapError/README.md +0 -88
  55. package/CapErrorBoundary/CapErrorBoundary-use-cases.md +0 -89
  56. package/CapErrorBoundary/README.md +0 -150
  57. package/CapErrorStateIllustration/README.md +0 -222
  58. package/CapErrorStateIllustration/USE_CASES.md +0 -33
  59. package/CapExpressionEditor/README.md +0 -32
  60. package/CapForm/README.md +0 -132
  61. package/CapForm/Status.md +0 -40
  62. package/CapForm/tests/PHASE1_UNFULFILLED_USE_CASES.md +0 -113
  63. package/CapForm/tests/USE_CASES_ANALYSIS.md +0 -119
  64. package/CapFormItem/README.md +0 -320
  65. package/CapFormItem/Status.md +0 -73
  66. package/CapFormItem/tests/USE_CASES_ANALYSIS.md +0 -84
  67. package/CapGraph/README.md +0 -69
  68. package/CapGraph/USE_CASES.md +0 -66
  69. package/CapHamburgerMenu/README.md +0 -234
  70. package/CapHamburgerMenu/USE_CASES.md +0 -48
  71. package/CapHeader/Status.md +0 -41
  72. package/CapHeading/README.md +0 -220
  73. package/CapHeading/Status.md +0 -41
  74. package/CapIcon/README.md +0 -207
  75. package/CapIllustration/Status.md +0 -41
  76. package/CapImage/README.md +0 -50
  77. package/CapImportMFEComponent/README.md +0 -121
  78. package/CapInfoNote/Status.md +0 -40
  79. package/CapInfoNote/tests/USE_CASES_ANALYSIS.md +0 -114
  80. package/CapInput/README.md +0 -196
  81. package/CapInput/Status.md +0 -123
  82. package/CapInput/tests/USE_CASES_ANALYSIS.md +0 -169
  83. package/CapLanguageProvider/CapLanguageProvider-use-cases.md +0 -56
  84. package/CapLanguageProvider/README.md +0 -206
  85. package/CapLevelGraphRenderer/CapLevelGraphRenderer-test-cases.md +0 -50
  86. package/CapLevelGraphRenderer/README.md +0 -123
  87. package/CapLevelGraphRenderer/Tooltip_MIGRATION_ANALYSIS.md +0 -120
  88. package/CapLink/README.md +0 -203
  89. package/CapLink/Status.md +0 -32
  90. package/CapLink/tests/CapLink.missingUseCases.md +0 -95
  91. package/CapList/README.md +0 -129
  92. package/CapList/Status.md +0 -69
  93. package/CapListLayout/README.md +0 -7
  94. package/CapLogin/README.md +0 -7
  95. package/CapMenu/README.md +0 -86
  96. package/CapModal/README.md +0 -357
  97. package/CapModal/Status.md +0 -52
  98. package/CapModal/tests/USE_CASES_GAPS.md +0 -207
  99. package/CapMultiSelect/README.md +0 -170
  100. package/CapMultiSelect/tests/USE_CASES_ANALYSIS.md +0 -29
  101. package/CapMultiSelectDatePicker/README.md +0 -11
  102. package/CapNavigation/README.md +0 -72
  103. package/CapNotification/README.md +0 -228
  104. package/CapNotificationDropdown/README.md +0 -5
  105. package/CapPopover/README.md +0 -234
  106. package/CapProgress/Status.md +0 -40
  107. package/CapRadio/Status.md +0 -54
  108. package/CapRadioButton/README.md +0 -152
  109. package/CapRadioButton/Status.md +0 -70
  110. package/CapRadioButton/tests/USE_CASES_ANALYSIS.md +0 -120
  111. package/CapRadioCard/README.md +0 -161
  112. package/CapRadioCard/Status.md +0 -78
  113. package/CapRadioGroup/README.md +0 -141
  114. package/CapRadioGroup/Status.md +0 -59
  115. package/CapReorderComponent/README.md +0 -179
  116. package/CapReorderComponent/Status.md +0 -41
  117. package/CapRoadMap/README.md +0 -126
  118. package/CapRoadMap/Status.md +0 -53
  119. package/CapRoadMap/tests/USE_CASE_GAPS.md +0 -92
  120. package/CapRow/README.md +0 -424
  121. package/CapSKUUploader/README.md +0 -189
  122. package/CapSKUUploader/Status.md +0 -66
  123. package/CapSecondaryTopBar/README.md +0 -7
  124. package/CapSelect/README.md +0 -243
  125. package/CapSelectFilter/README.md +0 -121
  126. package/CapShape/README.md +0 -96
  127. package/CapShape/Status.md +0 -36
  128. package/CapShape/tests/USE_CASES_ANALYSIS.md +0 -120
  129. package/CapSideBar/README.md +0 -298
  130. package/CapSideBar/Status.md +0 -5
  131. package/CapSlideBox/README.md +0 -68
  132. package/CapSlider/README.md +0 -423
  133. package/CapSlider/Status.md +0 -48
  134. package/CapSlider/tests/TEST_COVERAGE.md +0 -118
  135. package/CapSnackBar/README.md +0 -222
  136. package/CapSnackBar/Status.md +0 -41
  137. package/CapSomethingWentWrong/README.md +0 -97
  138. package/CapSplit/README.md +0 -19
  139. package/CapStatisticCard/README.md +0 -138
  140. package/CapStatus/README.md +0 -148
  141. package/CapStatus/Status.md +0 -40
  142. package/CapSteps/Status.md +0 -40
  143. package/CapStepsAccordian/README.md +0 -305
  144. package/CapStepsAccordian/Status.md +0 -48
  145. package/CapSupportVideosWrapper/README.md +0 -14
  146. package/CapSwitch/README.md +0 -351
  147. package/CapTab/README.md +0 -406
  148. package/CapTab/Status.md +0 -104
  149. package/CapTab/tests/USE_CASE_GAPS.md +0 -143
  150. package/CapTabV3/ANALYSIS.md +0 -60
  151. package/CapTabV3/README.md +0 -156
  152. package/CapTabV3/Status.md +0 -52
  153. package/CapTabV3/tests/USE_CASE_GAPS.md +0 -149
  154. package/CapTable/README.md +0 -160
  155. package/CapTable/Status.md +0 -41
  156. package/CapTag/README.md +0 -16
  157. package/CapTagDropdown/README.md +0 -171
  158. package/CapTagDropdown/Status.md +0 -55
  159. package/CapTimePicker/README.md +0 -170
  160. package/CapTooltip/README.md +0 -336
  161. package/CapTooltipWithInfo/Status.md +0 -75
  162. package/CapTopBar/README.md +0 -146
  163. package/CapTree/README.md +0 -124
  164. package/CapTree/Status.md +0 -48
  165. package/CapTree/tests/STATUS.md +0 -154
  166. package/CapTreeSelect/README.md +0 -217
  167. package/CapTreeSelect/Status.md +0 -52
  168. package/CapTruncateList/README.md +0 -13
  169. package/CapUnifiedSelect/README.md +0 -40
  170. package/CapUploader/README.md +0 -313
  171. package/CapUploader/Status.md +0 -76
  172. package/CapUploader/tests/USE_CASES_ANALYSIS.md +0 -225
  173. package/CapUserProfile/README.md +0 -105
  174. package/CapUserProfile/Status.md +0 -95
  175. package/CapVirtualList/README.md +0 -162
  176. package/CapVirtualList/Status.md +0 -71
  177. package/assets/HOCs/ComponentWithLabelHOC/README.md +0 -230
@@ -1,328 +0,0 @@
1
- # CapAskAira
2
-
3
- CapAskAira is a collection of AI-powered “Ask AiRA” bot components and shared logic built on Redux, Redux-Saga, and React. It lives in **blaze-ui** (published as `@capillarytech/cap-ui-library`) and is consumed by apps such as **cap-loyalty-ui**, **garuda-ui**, **cap-campaigns-v2**, **cap-creatives-ui**, and **reon-bi-webapp**.
4
-
5
- This document describes the **technical architecture** of CapAskAira and how to **integrate and test** it in consuming repositories.
6
-
7
- ---
8
-
9
- ## Table of contents
10
-
11
- 1. [Overview](#overview)
12
- 2. [Technical architecture](#technical-architecture)
13
- 3. [Bot catalog](#bot-catalog)
14
- 4. [Integration guide](#integration-guide)
15
- 5. [Testing in consuming repos](#testing-in-consuming-repos)
16
-
17
- ---
18
-
19
- ## Overview
20
-
21
- - **Purpose**: Reusable AI assistant UIs (rule writing, summarization, content generation, documentation chat, media generation, configuration, audience filters) that plug into existing Capillary apps.
22
- - **Stack**: React, Redux (Immutable.js state), Redux-Saga, SCSS, react-intl.
23
- - **Data sources**: REST APIs and/or WebSockets depending on the bot. APIs are called via a **request + getAPICallObject** contract supplied by the consuming app.
24
- - **Publishing**: Built and exported from **blaze-ui**; consuming apps depend on `@capillarytech/cap-ui-library` and import from `@capillarytech/cap-ui-library/CapAskAira` (or deeper paths for sagas/selectors).
25
-
26
- ---
27
-
28
- ## Technical architecture
29
-
30
- ### Module layout
31
-
32
- ```
33
- CapAskAira/
34
- ├── index.ts # Public API: default export (bot map) + reducer + domain + sagas
35
- ├── constants.ts # DOMAIN, WS_DOMAIN, AIRA_REDUCER_DOMAIN, rootClsPrefix
36
- ├── reducer.ts # askAiraReducer (combines all bot sub-reducers)
37
- ├── selector.ts # selectAskAiraDomain(state)
38
- ├── util.ts # getWebsocketConnection, popup positioning, name helpers
39
- ├── rootStyles.ts # Root SCSS entry
40
- ├── styles.scss # Shared styles ($clsPrefix: cap-ask-aira)
41
- ├── hooks/
42
- │ └── useWebsocket.tsx # WebSocket hook used by ContentGenerationBot, DocumentationChatBot
43
- ├── UtilComponents/ # Shared UI: AiraContainer, Popup, InputBox, ErrorBar, Icons, etc.
44
- ├── RuleGenerationBot/ # Rule writing (single rule)
45
- ├── RuleSummarizationBot/ # Rule + summarization (write & explain)
46
- ├── ContentGenerationBot/ # Content suggestions over WebSocket
47
- ├── DocumentationBot/ # Documentation UI
48
- ├── DocumentationChatBot/ # Doc Q&A (WebSocket + optional REST feedback)
49
- ├── ConfigurationBot/ # Configuration copilot
50
- ├── CapAiMediaGeneration/ # Image/video generation
51
- ├── AudienceFilterBot/ # Audience filter suggestions
52
- ├── tests/ # Module-level tests and mock data
53
- └── README.md # This file
54
- ```
55
-
56
- ### Redux state shape
57
-
58
- - The **root** Redux key used by CapAskAira is **`ASK_AIRA`** (`AIRA_REDUCER_DOMAIN`).
59
- - `askAiraReducer` is a **combined reducer** over four sub-domains:
60
-
61
- | Sub-domain constant | Bot(s) | Role |
62
- |----------------------------------|---------------------------|-------------------------------|
63
- | `RULE_REDUCER_DOMAIN` | RuleGenerationBot | Rule generation state |
64
- | `DOC_BOT_REDUCER_DOMAIN` | DocumentationChatBot | Doc chat messages state |
65
- | `AI_MEDIA_GENERATION` | CapAiMediaGeneration | Media generation state |
66
- | `RULE_SUMMARIZATION_REDUCER_DOMAIN` | RuleSummarizationBot | Rule + summarization state |
67
-
68
- - State under `ASK_AIRA` is **Immutable.js** (e.g. `fromJS`). Selectors typically use `selectAskAiraDomain(state)` then bot-specific selectors (e.g. `makeSelectRuleGenData`) that read from the corresponding sub-domain and return plain JS where needed.
69
-
70
- ### Sagas
71
-
72
- - **Saga per bot**: Each bot that uses Redux has its own saga module (e.g. `RuleSummarizationBot/saga.ts`, `CapAiMediaGeneration/saga.ts`). They export **watcher** generators (e.g. `watchGetRule`, `watchGetRuleSummarize`) and a **default export** array of watchers.
73
- - **Exposed from CapAskAira**:
74
- - `ruleGenSaga` — RuleGenerationBot
75
- - `docChatBotSaga` — DocumentationChatBot
76
- - `mediaGenSaga` — CapAiMediaGeneration
77
- - `ruleSummarizationBotSaga` — RuleSummarizationBot
78
- - **Consuming apps** do **not** use a single “root” CapAskAira saga. Instead they:
79
- - **Inject** the relevant watchers into the component (or route) that mounts the bot, e.g. by importing watchers from `@capillarytech/cap-ui-library/CapAskAira/RuleSummarizationBot/saga` and composing them in the app’s own saga with `all([...localWatchers, watchGetRule(), watchGetRuleSummarize(), ...])`.
80
- - Or add a saga that runs the default export array (e.g. `ruleSummarizationBotSaga`) if the app’s injector supports array-of-sagas.
81
- - **Bots that don’t need a saga in the app**: ContentGenerationBot and DocumentationChatBot (for the chat stream) use **WebSockets** only; no Redux saga is required for the stream. DocumentationChatBot may still use Redux for feedback; if so, its saga must be run.
82
-
83
- ### Data flow (high level)
84
-
85
- 1. **REST-only bots** (e.g. RuleSummarizationBot, RuleGenerationBot):
86
- Component is connected to Redux (state + actions). User action → dispatch → saga → API via `request` + `getAPICallObject` → dispatch success/failure → component reads from selector.
87
-
88
- 2. **WebSocket bots** (e.g. ContentGenerationBot):
89
- Component uses `useWebsocket(WEBSOCKET_URL, onMessage, onError)`. Messages are processed in the component (or helper); no saga for the stream. Optional two-way binding with parent via `text` / `setText` props.
90
-
91
- 3. **Hybrid** (e.g. DocumentationChatBot):
92
- WebSocket for streaming answers; optional REST for feedback, with state in Redux and saga for API calls.
93
-
94
- ### Shared utilities
95
-
96
- - **`constants.ts`**
97
- - `DOMAIN`: API base URL (dev: e.g. `http://localhost:2100`, prod: often `''` so app host is used).
98
- - `WS_DOMAIN`: WebSocket base (prod: `wss://${window.location.host}`; dev can be `ws://localhost:2100`).
99
- - `AIRA_REDUCER_DOMAIN = 'ASK_AIRA'`.
100
- - `rootClsPrefix = 'cap-ask-aira'`.
101
- - **`util.ts`**
102
- - `getWebsocketConnection(websocketUrl)` — returns a `Promise<WebSocket>`; in dev can pass auth via subprotocol.
103
- - `getAnchoredPopupPosition`, `getBottomRightPopupPosition` — for floating popup placement.
104
- - `handleEmptyValue`, `getFullNameByFirstNameLastName` — display helpers.
105
- - **`hooks/useWebsocket.tsx`**
106
- - `(websocketUrl, onMessage?, onError?)` → `{ sendMessage, resetConnection }`. Used by ContentGenerationBot and DocumentationChatBot.
107
- - **`UtilComponents/AiraContainer.tsx`**
108
- - Wraps bot content with a floating/fixed Aira icon, popup, title, and optional tooltip. Handles `iconPlacement` (`float-br`, `fixed-br-beamer`), `popupPlacement`, and `rootStyle`. Used by most bots.
109
-
110
- ### API contract (consuming app)
111
-
112
- Bots that call REST APIs expect the **page/container** to provide:
113
-
114
- - **`request`**: function `(url: string, options?: unknown) => Promise<unknown>` (e.g. fetch wrapper).
115
- - **`getAPICallObject`**: function `(method: string, payload: unknown) => unknown` that returns the body/options for the request (e.g. auth headers, JSON body).
116
-
117
- URLs are built inside CapAskAira (e.g. RuleSummarizationBot uses `ASK_AIRA_ENDPOINT` from `constants.ts` plus paths like `/rule_expr/write_rule`, `/rule_expr/summarize_rule`). The app only needs to pass a generic `request` + `getAPICallObject` that work with the app’s auth and API layer.
118
-
119
- ---
120
-
121
- ## Bot catalog
122
-
123
- | Bot | Description | Redux state | Saga required in app | Typical use case |
124
- |-------------------------|--------------------------------------|------------------|----------------------|-------------------------------------------|
125
- | RuleGenerationBot | Generate a single rule from query | Yes (ruleGen) | Yes (ruleGenSaga) | One-off rule writing |
126
- | RuleSummarizationBot | Write rule + summarize/explain rule | Yes (rule summarization) | Yes (ruleSummarizationBotSaga) | Workflow/rule editors (e.g. cap-loyalty-ui, garuda-ui) |
127
- | ContentGenerationBot | AI content suggestions (streaming) | No | No | Message/template authoring (e.g. cap-creatives-ui) |
128
- | DocumentationBot | Documentation UI | No | No | In-app docs |
129
- | DocumentationChatBot | Doc Q&A (streaming + feedback) | Yes (doc chat) | Yes (docChatBotSaga) if using feedback | Help / doc search |
130
- | ConfigurationBot | Configuration copilot | No | No | Guided setup |
131
- | CapAiMediaGeneration | Image/video generation | Yes (media) | Yes (mediaGenSaga) | Creatives (e.g. cap-creatives-ui) |
132
- | AudienceFilterBot | Audience filter suggestions | No (props) | No | Audience builder UIs |
133
-
134
- - **ContentGenerationBot** uses `WS_DOMAIN` and a path such as `/arya/api/v1/ask-aira-service/content_gen/get_ai_suggestions` (see `ContentGenerationBot/constants.ts`).
135
- - **RuleSummarizationBot** uses REST endpoints under `ASK_AIRA_ENDPOINT` (e.g. `/rule_expr/write_rule`, `/rule_expr/summarize_rule`, like/dislike).
136
-
137
- ---
138
-
139
- ## Integration guide
140
-
141
- ### 1. Add the reducer
142
-
143
- In the app’s root reducer (e.g. `initialReducer.js`):
144
-
145
- ```javascript
146
- import { AIRA_REDUCER_DOMAIN, askAiraReducer } from '@capillarytech/cap-ui-library/CapAskAira';
147
-
148
- export const initialReducer = {
149
- // ...other reducers
150
- [AIRA_REDUCER_DOMAIN]: askAiraReducer,
151
- };
152
- ```
153
-
154
- - Use the **exact** key `AIRA_REDUCER_DOMAIN` (`'ASK_AIRA'`) so CapAskAira selectors work.
155
-
156
- ### 2. Add sagas for the bots you use
157
-
158
- Only add sagas for bots that use Redux and expose a saga (see table above).
159
-
160
- **Option A – Inject into the same container that renders the bot**
161
-
162
- Example: **RuleSummarizationBot** in a workflow config page. In that page’s saga (e.g. `ConfigureWorkflows/saga.js`):
163
-
164
- ```javascript
165
- import {
166
- watchGetRule,
167
- watchGetRuleSummarize,
168
- watchUpdateLikeResultRule,
169
- watchUpdateLikeResultSummarize,
170
- watchUpdateDislikeResultRule,
171
- watchUpdateDislikeResultSummarize,
172
- } from '@capillarytech/cap-ui-library/CapAskAira/RuleSummarizationBot/saga';
173
-
174
- export default function* configureWorkflowSaga() {
175
- yield all([
176
- // ...your existing watchers
177
- watchGetRule(),
178
- watchGetRuleSummarize(),
179
- watchUpdateLikeResultRule(),
180
- watchUpdateLikeResultSummarize(),
181
- watchUpdateDislikeResultRule(),
182
- watchUpdateDislikeResultSummarize(),
183
- ]);
184
- }
185
- ```
186
-
187
- Then inject this saga with your existing `injectSaga` (e.g. key `'configureWorkflow'`). The component that renders `CapAskAira.RuleSummarizationBot` must be **connected** to Redux and pass `askAiraData` and `actions` from the store (see step 3).
188
-
189
- **Option B – CapAiMediaGeneration**
190
-
191
- Example: **cap-creatives-ui** BeeEditor. In `BeeEditor/sagas.js`:
192
-
193
- ```javascript
194
- import { watchForMediaGeneration } from '@capillarytech/cap-ui-library/CapAskAira/CapAiMediaGeneration/saga';
195
-
196
- export default [
197
- watchCreateCustomRow,
198
- watchForMediaGeneration,
199
- ];
200
- ```
201
-
202
- Ensure this saga is injected where the media generation UI is used (e.g. same route or parent).
203
-
204
- ### 3. Render the bot and connect to Redux (when required)
205
-
206
- **RuleSummarizationBot** (e.g. next to a rule editor):
207
-
208
- - The container must be **connected** to Redux and map:
209
- - `askAiraData`: from selector `makeSelectRuleGenData()` (or equivalent for rule summarization domain).
210
- - `actions`: bound action creators for `getRule`, `getRuleSummarize`, `resetRule`, `updateLikeResultRule`, `updateDislikeResultRule`, `updateLikeResultSummarize`, `updateDislikeResultSummarize`.
211
- - Pass **request** and **getAPICallObject** from your API layer (e.g. from `services/api` and a method that builds auth/body).
212
- - Pass **activity** (e.g. event type) so the backend can scope the rule.
213
-
214
- Example (conceptually, as in cap-loyalty-ui):
215
-
216
- ```jsx
217
- import CapAskAira from '@capillarytech/cap-ui-library/CapAskAira';
218
- import { request, getAPICallObject } from '../../../services/api';
219
-
220
- // In connected component:
221
- <CapAskAira.RuleSummarizationBot
222
- activity={eventType}
223
- request={request}
224
- getAPICallObject={getAPICallObject}
225
- iconPlacement="float-br"
226
- />
227
- ```
228
-
229
- `askAiraData` and `actions` are usually provided by the same `connect`/`createStructuredSelector` that wraps the page.
230
-
231
- **ContentGenerationBot** (no Redux/saga):
232
-
233
- - No reducer or saga needed. Just pass **text** and **setText** to bind to parent state, plus optional labels and layout:
234
-
235
- ```jsx
236
- <CapAskAira.ContentGenerationBot
237
- text={templateMessage || ''}
238
- setText={(text) => onTemplateValueChange({ target: { value: text } }, MESSAGE_TEXT)}
239
- iconPlacement="float-br"
240
- iconSize="1.6rem"
241
- rootStyle={{ bottom: '0.5rem', right: '1.2rem', left: 'auto' }}
242
- />
243
- ```
244
-
245
- **CapAiMediaGeneration**:
246
-
247
- - Reducer is already under `ASK_AIRA` via `askAiraReducer`. Inject `watchForMediaGeneration` as above. Connect the component so it receives `imageDetails` (and any other state) and bound actions from the CapAiMediaGeneration reducer/actions.
248
-
249
- ### 4. Environment / backend
250
-
251
- - **DOMAIN** and **WS_DOMAIN** in CapAskAira `constants.ts` drive API and WebSocket URLs. In production they often rely on `window.location.host`. For local dev, point them to your backend (e.g. `http://localhost:2100` and `ws://localhost:2100`).
252
- - Ensure the consuming app’s auth (e.g. token, org id) is passed through `request` and `getAPICallObject` so that CapAskAira’s API calls are authenticated. WebSocket auth in dev may use subprotocols (see `getWebsocketConnection` in `util.ts`).
253
-
254
- ### 5. Feature flags
255
-
256
- Consuming apps often gate bots with a feature flag or permission (e.g. `!isAiRuleWritingDisabled`, `!isAiContentBotDisabled`). Render the bot only when the feature is enabled.
257
-
258
- ---
259
-
260
- ## Testing in consuming repos
261
-
262
- ### Unit tests
263
-
264
- - **Reducer**: Ensure the root reducer includes `[AIRA_REDUCER_DOMAIN]: askAiraReducer`. You can snapshot the initial state or dispatch unknown actions and assert the Ask Aira slice still exists.
265
- - **Selectors**: If you have selectors that depend on `ASK_AIRA`, build a minimal Immutable state with `fromJS({ ASK_AIRA: { ... } })` and test your selectors.
266
- - **Containers that render a bot**: Mock the CapAskAira module and assert that the correct bot component is rendered with expected props (e.g. `request`, `getAPICallObject`, `activity` for RuleSummarizationBot).
267
-
268
- Example pattern (mock default export and named exports):
269
-
270
- ```javascript
271
- jest.mock('@capillarytech/cap-ui-library/CapAskAira', () => ({
272
- __esModule: true,
273
- default: {
274
- RuleSummarizationBot: () => null,
275
- ContentGenerationBot: () => null,
276
- // ...other bots as needed
277
- },
278
- AIRA_REDUCER_DOMAIN: 'ASK_AIRA',
279
- askAiraReducer: jest.fn((state = {}) => state),
280
- }));
281
- ```
282
-
283
- - **Saga tests**: For pages that compose CapAskAira watchers (e.g. RuleSummarizationBot watchers), either:
284
- - Test your own saga and mock the CapAskAira saga imports, or
285
- - Import the real watchers and run them in `expectSaga` (or similar) and assert on dispatched actions and API calls.
286
-
287
- ### Integration / E2E
288
-
289
- - **Backend**: Point DOMAIN/WS_DOMAIN to a test or stub backend so that opening the bot and submitting a query doesn’t depend on production.
290
- - **Auth**: Use test tokens/org so that `request` and `getAPICallObject` send valid auth headers; or stub `request`/`getAPICallObject` in tests to return fixed responses.
291
- - **Feature flags**: Enable the relevant AiRA feature flag (or override) in the test environment so the bot is visible and clickable.
292
-
293
- ### Snapshot and visual
294
-
295
- - **Snapshots**: If you snapshot a container that includes a bot, the snapshot will include the bot’s subtree. Keep snapshots updated when you change bot props or upgrade the library. Mocking the bot (as above) keeps snapshots stable if you only care about the parent layout.
296
- - **Visual/regression**: Run visual tests against a build that includes the real CapAskAira; ensure the floating icon and popup don’t break layout (z-index, overflow, or positioning).
297
-
298
- ### Testing CapAskAira in Storybook
299
-
300
- - **Storybook on nightly:** When Storybook is run or deployed on the nightly host, it uses the host origin and gets cookies/token automatically; no code change is needed.
301
- - **Local Storybook against nightly (temporary change):** To test CapAskAira stories locally against a real backend (e.g. nightly), make a **temporary** change in `components/CapAskAira/constants.ts`:
302
- - Set `DOMAIN` to your nightly API base (e.g. `'https://crm-nightly-new.cc.capillarytech.com'`).
303
- - Set `WS_DOMAIN` to the matching WebSocket base (e.g. `'wss://crm-nightly-new.cc.capillarytech.com'`).
304
- - Revert these before committing. Document locally if your team needs to repeat this.
305
-
306
- ### Running CapAskAira tests in blaze-ui
307
-
308
- From the **blaze-ui** repo:
309
-
310
- ```bash
311
- npm test -- components/CapAskAira
312
- ```
313
-
314
- This runs the tests under `components/CapAskAira/tests` and per-bot test folders (e.g. `RuleSummarizationBot/tests`, `ContentGenerationBot/tests`). Use this to validate changes before publishing and consuming in other repos.
315
-
316
- ---
317
-
318
- ## Summary
319
-
320
- | Step | Action |
321
- |------|--------|
322
- | Reducer | Add `[AIRA_REDUCER_DOMAIN]: askAiraReducer` to root reducer. |
323
- | Saga | For RuleSummarizationBot, RuleGenerationBot, DocumentationChatBot, CapAiMediaGeneration: import their watchers and run them in the saga for the route/container that mounts the bot. |
324
- | Connect | For bots that use Redux, connect the container and pass `askAiraData`, `actions`, `request`, `getAPICallObject` (and any bot-specific props like `activity`). |
325
- | REST/WS | Provide `request` + `getAPICallObject`; ensure DOMAIN/WS_DOMAIN and auth work for your environment. |
326
- | Tests | Mock CapAskAira in unit tests; use real or stubbed backend and auth in integration; run `npm test -- --testPathPattern=CapAskAira` in blaze-ui for library changes. |
327
-
328
- For more detail on a specific bot, see its folder under `components/CapAskAira` (e.g. `RuleSummarizationBot/`, `ContentGenerationBot/`) for types, constants, API helpers, and selectors.
@@ -1,4 +0,0 @@
1
- # CapBanner Migration (v3→v6)
2
-
3
- ## Breaking Changes from cap-ui-library v8.x
4
- **No breaking changes from cap-ui-library v8.x**
@@ -1,175 +0,0 @@
1
- # CapBlock
2
-
3
- A collapsible container component with optional delete functionality. Features a colored left border and can display content that can be expanded or collapsed.
4
-
5
- ## Migration from cap-ui-library
6
-
7
- This component has been migrated from `@capillarytech/cap-ui-library` to `@capillarytech/blaze-ui` with the following changes:
8
-
9
- ### Breaking Changes
10
-
11
- **No breaking changes** - The API remains fully compatible with cap-ui-library v8.x.
12
-
13
- ### Improvements
14
-
15
- 1. **TypeScript Support**: Full TypeScript type definitions for all props
16
- 2. **SCSS Modules**: Styles converted from styled-components to SCSS modules
17
- 3. **Better Testing**: Tests updated to use @testing-library/react
18
- 4. **Storybook**: Comprehensive Storybook stories added
19
-
20
- ## Installation
21
-
22
- ```tsx
23
- import CapBlock from '@capillarytech/blaze-ui/CapBlock';
24
- // Or
25
- import { CapBlock } from '@capillarytech/blaze-ui';
26
- ```
27
-
28
- ## Props
29
-
30
- | Prop | Type | Default | Description |
31
- |------|------|---------|-------------|
32
- | `width` | `string` | `'800px'` | Width of the block container |
33
- | `borderLeftColor` | `string` | `CAP_SECONDARY.base` | Color of the left border |
34
- | `isDeleteEnabled` | `boolean` | `false` | Whether the delete icon is enabled |
35
- | `deleteCallback` | `() => void` | - | Callback function when delete icon is clicked |
36
- | `isCollapseEnabled` | `boolean` | `false` | Whether the collapse/expand icon is enabled |
37
- | `componentName` | `string` | `'path'` | Name used in tooltip messages |
38
- | `children` | `ReactNode` | - | Content to render inside the block |
39
- | `className` | `string` | - | Additional CSS class name |
40
- | `deleteBlockMsg` | `string` | `''` | Message for delete tooltip (from translations) |
41
- | `collapseBlockMsg` | `string` | `''` | Message for collapse tooltip (from translations) |
42
- | `expandBlockMsg` | `string` | `''` | Message for expand tooltip (from translations) |
43
- | `pathBlockText` | `ReactNode` | - | Additional content at the bottom (always visible) |
44
-
45
- ## Usage Examples
46
-
47
- ### Basic Usage
48
-
49
- ```tsx
50
- import CapBlock from '@capillarytech/blaze-ui/CapBlock';
51
-
52
- <CapBlock>
53
- <p>This is the content inside the block.</p>
54
- </CapBlock>
55
- ```
56
-
57
- ### With Delete Feature
58
-
59
- ```tsx
60
- <CapBlock
61
- isDeleteEnabled
62
- deleteCallback={() => console.log('Delete clicked')}
63
- deleteBlockMsg="Delete"
64
- componentName="section"
65
- >
66
- <p>Click the delete icon to remove this block.</p>
67
- </CapBlock>
68
- ```
69
-
70
- ### With Collapse Feature
71
-
72
- ```tsx
73
- <CapBlock
74
- isCollapseEnabled
75
- collapseBlockMsg="Collapse"
76
- expandBlockMsg="Expand"
77
- componentName="section"
78
- >
79
- <p>This content can be collapsed and expanded.</p>
80
- </CapBlock>
81
- ```
82
-
83
- ### Custom Styling
84
-
85
- ```tsx
86
- <CapBlock
87
- width="600px"
88
- borderLeftColor="#47af46"
89
- className="custom-block"
90
- >
91
- <p>Custom width and border color.</p>
92
- </CapBlock>
93
- ```
94
-
95
- ### With All Features
96
-
97
- ```tsx
98
- <CapBlock
99
- width="700px"
100
- borderLeftColor="#2466ea"
101
- isDeleteEnabled
102
- isCollapseEnabled
103
- deleteCallback={() => handleDelete()}
104
- deleteBlockMsg="Delete"
105
- collapseBlockMsg="Collapse"
106
- expandBlockMsg="Expand"
107
- componentName="user settings"
108
- pathBlockText={<span>Updated: Today</span>}
109
- >
110
- <h4>User Settings</h4>
111
- <p>Configure your preferences here.</p>
112
- </CapBlock>
113
- ```
114
-
115
- ### Nested Blocks
116
-
117
- ```tsx
118
- <CapBlock width="700px" borderLeftColor="#2466ea">
119
- <h4>Outer Block</h4>
120
- <CapBlock width="600px" borderLeftColor="#47af46">
121
- <p>Inner Block Content</p>
122
- </CapBlock>
123
- </CapBlock>
124
- ```
125
-
126
- ## Internationalization
127
-
128
- The component uses `LocaleHoc` for internationalization. The following props support translated strings:
129
-
130
- - `deleteBlockMsg` - Message shown in delete tooltip
131
- - `collapseBlockMsg` - Message shown in collapse tooltip
132
- - `expandBlockMsg` - Message shown in expand tooltip
133
-
134
- Example with react-intl:
135
-
136
- ```tsx
137
- import { useIntl } from 'react-intl';
138
-
139
- const MyComponent = () => {
140
- const intl = useIntl();
141
-
142
- return (
143
- <CapBlock
144
- isCollapseEnabled
145
- deleteBlockMsg={intl.formatMessage({ id: 'delete.block' })}
146
- collapseBlockMsg={intl.formatMessage({ id: 'collapse.block' })}
147
- expandBlockMsg={intl.formatMessage({ id: 'expand.block' })}
148
- >
149
- Content
150
- </CapBlock>
151
- );
152
- };
153
- ```
154
-
155
- ## TypeScript Types
156
-
157
- ```tsx
158
- import type { CapBlockProps } from '@capillarytech/blaze-ui/CapBlock';
159
- ```
160
-
161
- ## Styling
162
-
163
- The component uses SCSS modules with the following CSS class prefix: `cap-block`.
164
-
165
- Custom styling can be applied via:
166
- - `className` prop
167
- - CSS overrides targeting `.cap-block` class
168
- - Inline `width` and `borderLeftColor` are applied via style attribute
169
-
170
- ### CSS Variables Used
171
-
172
- The component uses these CSS variables from the design system:
173
- - Border color: `$CAP_G07` (grey border)
174
- - Delete background: `$CAP_COLOR_05` (light red)
175
- - Collapse background: `$CAP_G06` (light grey)
@@ -1,40 +0,0 @@
1
- # Migration Status: CapBorderedBox
2
-
3
- **Last Updated**: 2026-01-31 19:26:57
4
-
5
- ## Migration Steps
6
-
7
- - [x] **Step 0**: Setup branch and remote tracking
8
- - [x] **Step 1**: Migration Prompt 1 (Main migration)
9
- - [x] **Step 2**: Migration Prompt 2 (Storybook support)
10
- - [x] **Step 3**: Migration Prompt 3 (Unit tests)
11
- - [x] **Step 4**: Migration Prompt 4 (Visual test cases)
12
- - [x] **Step 5**: Linting (ESLint)
13
- - [x] **Step 6**: Pre-build Validation
14
- - [x] **Step 7**: Build blaze-ui
15
- - [x] **Step 8**: Visual Testing
16
- - [x] **Step 9**: CSS Analysis (if mismatches found)
17
- - [x] **Step 9.5**: CSS Analysis Completed
18
- - [x] **Step 10**: Git Commit & Push to branch (pre-commit hook will run tests)
19
- - [x] **Step 11**: Create Pull Request
20
-
21
- ## Visual Testing Results
22
-
23
- **Last Test**: 2026-01-31 19:26:57
24
- **Maximum Mismatch**: 0%
25
-
26
- ### Mismatched Variants:
27
- -
28
-
29
-
30
- ## CSS Fixes Applied
31
-
32
- **Date**: 2026-01-25 04:02:29
33
- **Summary**: CSS fixes applied based on visual testing analysis.
34
-
35
- _See full analysis in: `/Users/sarahkhader/repos/migration/blaze-ui/tools/visual-testing/report/CapBorderedBox/css-fix-analysis.md`_
36
-
37
-
38
- ## Notes
39
-
40
- _No notes yet._
@@ -1,124 +0,0 @@
1
- # CapCSVFileUploader
2
-
3
- CapCSVFileUploader component migrated from Ant Design v3 to v6.
4
-
5
- ## Migration Summary
6
-
7
- This component has been migrated from `cap-ui-library` to `blaze-ui` with the following changes:
8
-
9
- - Converted from JavaScript class component to TypeScript functional component
10
- - Uses SCSS modules for styling (imported as `import * as styles from './styles.scss'`)
11
- - Removed PropTypes and defaultProps (replaced with TypeScript types and default parameters)
12
- - Replaced `UNSAFE_componentWillReceiveProps` with `useEffect` hooks
13
- - Maintained backward compatibility with the existing API
14
-
15
- ## Breaking Changes
16
-
17
- **No breaking changes** - The component maintains **100% backward compatibility** with existing code. All props work exactly as before.
18
-
19
- ## Deprecated Props
20
-
21
- **No deprecated props** - This component does not use Ant Design components directly. It uses:
22
- - Native HTML `<input type="file">` element
23
- - `CapTag` component (which wraps Ant Design Tag, but that's handled in CapTag migration)
24
-
25
- ## Props
26
-
27
- | Prop | Type | Default | Description |
28
- |------|------|---------|-------------|
29
- | `fileName` | `string` | `''` | The name of the uploaded file |
30
- | `errorMessage` | `string` | - | Error message to display |
31
- | `numberOfEntriesMessage` | `string` | `'entries'` | Message text for number of entries |
32
- | `sampleCsvFilePath` | `string` | - | Path to sample CSV file for download |
33
- | `onUpload` | `(event: React.ChangeEvent<HTMLInputElement>) => void` | - | Callback when file is uploaded |
34
- | `showNumberOfEntries` | `boolean` | `true` | Whether to show the number of entries |
35
- | `onChipClose` | `() => void` | - | Callback when file chip is closed |
36
- | `checkFileSize` | `boolean` | `true` | Whether to check file size (5MB limit) |
37
- | `getNumberOfEntries` | `(count: number) => void` | - | Callback with the number of entries found |
38
- | `lineCount` | `number` | `0` | Initial line count |
39
- | `sampleCsvName` | `string` | `'Sample.csv'` | Name of the sample CSV file link |
40
- | `chooseFileBtnTxt` | `string` | `'Choose file'` | Text for the choose file button |
41
- | `fileSizeExceededTxt` | `string` | `'File size is greater than 5 MB'` | Error message when file size exceeds limit |
42
- | `csvFileErrorTxt` | `string` | `'Please upload a CSV file'` | Error message for non-CSV files |
43
- | `csvFileNoEntryTxt` | `string` | `'Please upload a file with atleast one entry'` | Error message for empty CSV files |
44
- | `isStoreFilter` | `boolean` | `false` | Whether this is used for store filtering |
45
- | `reuploadFileMsg` | `string` | `'Reupload file'` | Message for reupload button |
46
- | `storeUploadInfo` | `StoreUploadInfo[]` | - | Store upload information array |
47
- | `referenceId` | `string` | - | Reference ID for store upload tracking |
48
- | `failedStorePathIdentifier` | `string` | - | Identifier for failed store path |
49
- | `disabled` | `boolean` | - | Whether the uploader is disabled |
50
- | `storeSource` | `string` | - | Source of the store data |
51
-
52
- ## Usage Examples
53
-
54
- ### Basic Usage
55
-
56
- ```tsx
57
- import { CapCSVFileUploader } from '@capillarytech/blaze-ui';
58
-
59
- function FileUpload() {
60
- const handleUpload = (event: React.ChangeEvent<HTMLInputElement>) => {
61
- console.log('File uploaded:', event.target.files?.[0]);
62
- };
63
-
64
- return (
65
- <CapCSVFileUploader
66
- onUpload={handleUpload}
67
- sampleCsvFilePath="/path/to/sample.csv"
68
- />
69
- );
70
- }
71
- ```
72
-
73
- ### With Custom Messages
74
-
75
- ```tsx
76
- <CapCSVFileUploader
77
- onUpload={handleUpload}
78
- chooseFileBtnTxt="Select CSV File"
79
- csvFileErrorTxt="Only CSV files are allowed"
80
- fileSizeExceededTxt="File must be less than 5MB"
81
- />
82
- ```
83
-
84
- ### Store Filter Usage
85
-
86
- ```tsx
87
- <CapCSVFileUploader
88
- onUpload={handleUpload}
89
- isStoreFilter={true}
90
- storeUploadInfo={storeUploadInfo}
91
- referenceId={referenceId}
92
- failedStorePathIdentifier={failedStorePathIdentifier}
93
- storeSource={storeSource}
94
- disabled={disabled}
95
- />
96
- ```
97
-
98
- ## Code Improvements
99
-
100
- 1. **TypeScript support**: Full TypeScript definitions with proper prop types
101
- 2. **Functional component**: Converted from class component to functional component with hooks
102
- 3. **Modern React patterns**: Uses `useState` and `useEffect` instead of class state and lifecycle methods
103
- 4. **Removed deprecated APIs**: Replaced `UNSAFE_componentWillReceiveProps` with `useEffect` hooks
104
- 5. **SCSS modules**: Uses SCSS modules for styling with proper class name handling
105
-
106
- ## What Stayed the Same
107
-
108
- - All component props and behavior
109
- - DOM structure and component hierarchy
110
- - Conditional rendering logic
111
- - File validation logic (CSV check, file size check)
112
- - Entry counting logic
113
- - Error message display logic
114
- - API surface area (backward compatible)
115
-
116
- ## What Changed
117
-
118
- - **Removed**: `PropTypes` (replaced with TypeScript types)
119
- - **Removed**: `defaultProps` (replaced with default parameters)
120
- - **Removed**: Class component (replaced with functional component)
121
- - **Removed**: `UNSAFE_componentWillReceiveProps` (replaced with `useEffect`)
122
- - **Added**: TypeScript type definitions in `types.ts`
123
- - **Added**: SCSS module imports (`import * as styles`)
124
- - **Updated**: State management to use `useState` hooks