blixify-ui-web-mcp 0.1.1

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 (245) hide show
  1. package/README.md +5 -0
  2. package/lib/components/action/button/README.md +75 -0
  3. package/lib/components/action/button/button.stories.tsx +138 -0
  4. package/lib/components/action/buttonGroup/README.md +79 -0
  5. package/lib/components/action/buttonGroup/buttonGroup.stories.tsx +104 -0
  6. package/lib/components/action/iconButton/README.md +39 -0
  7. package/lib/components/action/iconButton/iconButton.stories.tsx +22 -0
  8. package/lib/components/action/radioList/README.md +98 -0
  9. package/lib/components/action/radioList/radioList.stories.tsx +181 -0
  10. package/lib/components/action/slider/README.md +86 -0
  11. package/lib/components/action/slider/slider.stories.tsx +133 -0
  12. package/lib/components/action/textButton/README.md +34 -0
  13. package/lib/components/action/textButton/textButton.stories.tsx +16 -0
  14. package/lib/components/action/toggle/README.md +39 -0
  15. package/lib/components/action/toggle/toggle.stories.tsx +23 -0
  16. package/lib/components/advanced/collapse/README.md +106 -0
  17. package/lib/components/advanced/collapse/collapse.stories.tsx +165 -0
  18. package/lib/components/advanced/infoWindow/README.md +69 -0
  19. package/lib/components/advanced/infoWindow/infoWindow.stories.tsx +112 -0
  20. package/lib/components/advanced/popUp/README.md +95 -0
  21. package/lib/components/advanced/popUp/popUp.stories.tsx +189 -0
  22. package/lib/components/auth/bareSignIn/README.md +78 -0
  23. package/lib/components/auth/bareSignIn/bareSignIn.stories.tsx +141 -0
  24. package/lib/components/auth/bareSignUp/README.md +130 -0
  25. package/lib/components/auth/bareSignUp/bareSignUp.stories.tsx +159 -0
  26. package/lib/components/auth/signIn/README.md +53 -0
  27. package/lib/components/auth/signIn/signIn.stories.tsx +120 -0
  28. package/lib/components/auth/signUp/README.md +136 -0
  29. package/lib/components/auth/signUp/signUp.stories.tsx +193 -0
  30. package/lib/components/chart/README.md +13 -0
  31. package/lib/components/chart/areaChart/README.md +133 -0
  32. package/lib/components/chart/areaChart/areaChart.stories.tsx +199 -0
  33. package/lib/components/chart/barChart/README.md +193 -0
  34. package/lib/components/chart/barChart/barChart.stories.tsx +318 -0
  35. package/lib/components/chart/boxPlotChart/README.md +124 -0
  36. package/lib/components/chart/boxPlotChart/boxPlotChart.stories.tsx +104 -0
  37. package/lib/components/chart/bubbleChart/README.md +166 -0
  38. package/lib/components/chart/bubbleChart/bubbleChart.stories.tsx +144 -0
  39. package/lib/components/chart/card/README.md +107 -0
  40. package/lib/components/chart/card/card.stories.tsx +89 -0
  41. package/lib/components/chart/ganttChart/README.md +142 -0
  42. package/lib/components/chart/ganttChart/ganttChart.stories.tsx +138 -0
  43. package/lib/components/chart/heatmapChart/README.md +125 -0
  44. package/lib/components/chart/heatmapChart/heatmapChart.stories.tsx +106 -0
  45. package/lib/components/chart/lineChart/README.md +140 -0
  46. package/lib/components/chart/lineChart/lineChart.stories.tsx +152 -0
  47. package/lib/components/chart/pieChart/README.md +117 -0
  48. package/lib/components/chart/pieChart/pieChart.stories.tsx +180 -0
  49. package/lib/components/chart/polarAreaChart/README.md +126 -0
  50. package/lib/components/chart/polarAreaChart/polarAreaChart.stories.tsx +106 -0
  51. package/lib/components/chart/radarChart/README.md +57 -0
  52. package/lib/components/chart/radarChart/radarChart.stories.tsx +36 -0
  53. package/lib/components/chart/radialBar/README.md +152 -0
  54. package/lib/components/chart/radialBar/radialChart.stories.tsx +136 -0
  55. package/lib/components/chart/rangeBarChart/README.md +323 -0
  56. package/lib/components/chart/rangeBarChart/rangeBarChart.stories.tsx +208 -0
  57. package/lib/components/chart/statsCard/README.md +97 -0
  58. package/lib/components/chart/statsCard/statsCard.stories.tsx +183 -0
  59. package/lib/components/chart/treemapChart/README.md +142 -0
  60. package/lib/components/chart/treemapChart/treemapChart.stories.tsx +122 -0
  61. package/lib/components/chat/chatAnchor/README.md +113 -0
  62. package/lib/components/chat/chatAnchor/chatAnchor.stories.tsx +156 -0
  63. package/lib/components/chat/chatBase/README.md +223 -0
  64. package/lib/components/chat/chatBase/chatBase.stories.tsx +306 -0
  65. package/lib/components/chat/chatDashboard/README.md +161 -0
  66. package/lib/components/chat/chatDashboard/chatDashboard.stories.tsx +154 -0
  67. package/lib/components/data/dataGraph/README.md +13 -0
  68. package/lib/components/data/dataGraph/dataGraph.stories.tsx +84 -0
  69. package/lib/components/data/dataReference/README.md +62 -0
  70. package/lib/components/data/dataReference/dataReference.stories.tsx +53 -0
  71. package/lib/components/data/dataTemplate/README.md +903 -0
  72. package/lib/components/data/dataTemplate/dataModule.stories.tsx +196 -0
  73. package/lib/components/data/dataTemplate/dataTemplate.stories.tsx +337 -0
  74. package/lib/components/data/dataWrapper/README.md +1077 -0
  75. package/lib/components/data/dataWrapper/dataWrapper.stories.tsx +831 -0
  76. package/lib/components/data/queryForm/README.md +56 -0
  77. package/lib/components/data/queryForm/queryForm.stories.tsx +85 -0
  78. package/lib/components/data/readQuery/README.md +282 -0
  79. package/lib/components/data/readQuery/readQuery.stories.tsx +256 -0
  80. package/lib/components/data/readQueryHoc/README.md +89 -0
  81. package/lib/components/data/readQueryHoc/readQueryHoc.stories.tsx +33 -0
  82. package/lib/components/data/writeQuery/README.md +178 -0
  83. package/lib/components/data/writeQuery/writeQuery.stories.tsx +209 -0
  84. package/lib/components/design/actionSection/README.md +47 -0
  85. package/lib/components/design/actionSection/actionSection.stories.tsx +74 -0
  86. package/lib/components/design/banner/README.md +43 -0
  87. package/lib/components/design/banner/banner.stories.tsx +34 -0
  88. package/lib/components/design/bannerAction/README.md +44 -0
  89. package/lib/components/design/bannerAction/bannerAction.stories.tsx +25 -0
  90. package/lib/components/design/blogSection/README.md +111 -0
  91. package/lib/components/design/blogSection/blogSection.stories.tsx +72 -0
  92. package/lib/components/design/carouselSection/README.md +82 -0
  93. package/lib/components/design/carouselSection/carouselSection.stories.tsx +52 -0
  94. package/lib/components/design/designList/README.md +60 -0
  95. package/lib/components/design/designList/designList.stories.tsx +44 -0
  96. package/lib/components/design/faq/README.md +121 -0
  97. package/lib/components/design/faq/faq.stories.tsx +103 -0
  98. package/lib/components/design/fileGrid/README.md +87 -0
  99. package/lib/components/design/fileGrid/fileGrid.stories.tsx +110 -0
  100. package/lib/components/design/fileViewer/README.md +40 -0
  101. package/lib/components/design/fileViewer/fileViewer.stories.tsx +28 -0
  102. package/lib/components/design/footerSection/README.md +62 -0
  103. package/lib/components/design/footerSection/footerSection.stories.tsx +84 -0
  104. package/lib/components/design/googleReview/README.md +45 -0
  105. package/lib/components/design/googleReview/googleReview.stories.tsx +33 -0
  106. package/lib/components/design/heroSection/README.md +48 -0
  107. package/lib/components/design/heroSection/heroSection.stories.tsx +85 -0
  108. package/lib/components/design/iconList/README.md +60 -0
  109. package/lib/components/design/iconList/iconList.stories.tsx +41 -0
  110. package/lib/components/design/imageGallery/README.md +56 -0
  111. package/lib/components/design/imageGallery/imageGallery.stories.tsx +45 -0
  112. package/lib/components/design/imageZoom/README.md +47 -0
  113. package/lib/components/design/imageZoom/imageZoom.stories.tsx +30 -0
  114. package/lib/components/design/leftContent/README.md +47 -0
  115. package/lib/components/design/leftContent/leftContent.stories.tsx +32 -0
  116. package/lib/components/design/logoCloud/README.md +42 -0
  117. package/lib/components/design/logoCloud/logoCloud.stories.tsx +44 -0
  118. package/lib/components/design/onboarding/README.md +100 -0
  119. package/lib/components/design/onboarding/onboarding.stories.tsx +113 -0
  120. package/lib/components/design/pricing/README.md +112 -0
  121. package/lib/components/design/pricing/pricing.stories.tsx +86 -0
  122. package/lib/components/design/rightContent/README.md +47 -0
  123. package/lib/components/design/rightContent/rightContent.stories.tsx +32 -0
  124. package/lib/components/design/sectionList/README.md +51 -0
  125. package/lib/components/design/sectionList/sectionList.stories.tsx +35 -0
  126. package/lib/components/design/teams/README.md +62 -0
  127. package/lib/components/design/teams/teams.stories.tsx +61 -0
  128. package/lib/components/display/alert/README.md +82 -0
  129. package/lib/components/display/alert/alert.stories.tsx +71 -0
  130. package/lib/components/display/calendar/README.md +113 -0
  131. package/lib/components/display/calendar/calendar.stories.tsx +159 -0
  132. package/lib/components/display/clipboard/README.md +36 -0
  133. package/lib/components/display/clipboard/clipboard.stories.tsx +32 -0
  134. package/lib/components/display/detailList/README.md +61 -0
  135. package/lib/components/display/detailList/detailList.stories.tsx +131 -0
  136. package/lib/components/display/drawer/README.md +74 -0
  137. package/lib/components/display/drawer/drawer.stories.tsx +66 -0
  138. package/lib/components/display/emptyState/README.md +38 -0
  139. package/lib/components/display/emptyState/emptyState.stories.tsx +22 -0
  140. package/lib/components/display/feeds/README.md +80 -0
  141. package/lib/components/display/feeds/feeds.stories.tsx +75 -0
  142. package/lib/components/display/flexTable/README.md +160 -0
  143. package/lib/components/display/flexTable/flexTable.stories.tsx +313 -0
  144. package/lib/components/display/grid/README.md +121 -0
  145. package/lib/components/display/grid/grid.stories.tsx +234 -0
  146. package/lib/components/display/kanban/README.md +78 -0
  147. package/lib/components/display/kanban/kanban.stories.tsx +133 -0
  148. package/lib/components/display/list/README.md +109 -0
  149. package/lib/components/display/list/list.stories.tsx +188 -0
  150. package/lib/components/display/loading/README.md +25 -0
  151. package/lib/components/display/loading/loading.stories.tsx +15 -0
  152. package/lib/components/display/mapView/README.md +99 -0
  153. package/lib/components/display/mapView/mapView.stories.tsx +225 -0
  154. package/lib/components/display/modal/README.md +43 -0
  155. package/lib/components/display/modal/modal.stories.tsx +81 -0
  156. package/lib/components/display/notification/README.md +43 -0
  157. package/lib/components/display/notification/notification.stories.tsx +30 -0
  158. package/lib/components/display/progress/README.md +25 -0
  159. package/lib/components/display/progress/progress.stories.tsx +15 -0
  160. package/lib/components/display/stepper/README.md +96 -0
  161. package/lib/components/display/stepper/stepper.stories.tsx +175 -0
  162. package/lib/components/display/table/README.md +176 -0
  163. package/lib/components/display/table/table.stories.tsx +330 -0
  164. package/lib/components/display/tag/README.md +74 -0
  165. package/lib/components/display/tag/tag.stories.tsx +79 -0
  166. package/lib/components/input/address/README.md +132 -0
  167. package/lib/components/input/address/address.stories.tsx +147 -0
  168. package/lib/components/input/canvas/README.md +131 -0
  169. package/lib/components/input/canvas/canvas.stories.tsx +165 -0
  170. package/lib/components/input/checkbox/README.md +61 -0
  171. package/lib/components/input/checkbox/checkbox.stories.tsx +30 -0
  172. package/lib/components/input/datePicker/README.md +124 -0
  173. package/lib/components/input/datePicker/datePicker.stories.tsx +197 -0
  174. package/lib/components/input/form/README.md +55 -0
  175. package/lib/components/input/form/form.stories.tsx +143 -0
  176. package/lib/components/input/markdown/README.md +146 -0
  177. package/lib/components/input/markdown/markdown.stories.tsx +40 -0
  178. package/lib/components/input/monthYearPicker/README.md +69 -0
  179. package/lib/components/input/monthYearPicker/monthYearPicker.stories.tsx +47 -0
  180. package/lib/components/input/netPromoterScore/README.md +52 -0
  181. package/lib/components/input/netPromoterScore/netPromoterScore.stories.tsx +30 -0
  182. package/lib/components/input/rating/README.md +51 -0
  183. package/lib/components/input/rating/rating.stories.tsx +30 -0
  184. package/lib/components/input/select/README.md +108 -0
  185. package/lib/components/input/select/select.stories.tsx +286 -0
  186. package/lib/components/input/signature/README.md +106 -0
  187. package/lib/components/input/signature/signature.stories.tsx +188 -0
  188. package/lib/components/input/textArea/README.md +55 -0
  189. package/lib/components/input/textArea/textArea.stories.tsx +30 -0
  190. package/lib/components/input/textInput/README.md +81 -0
  191. package/lib/components/input/textInput/textinput.stories.tsx +231 -0
  192. package/lib/components/input/uploadInput/README.md +134 -0
  193. package/lib/components/input/uploadInput/uploadInput.stories.tsx +193 -0
  194. package/lib/components/navigation/bars/README.md +40 -0
  195. package/lib/components/navigation/bars/bars.stories.tsx +85 -0
  196. package/lib/components/navigation/bottomTab/README.md +53 -0
  197. package/lib/components/navigation/bottomTab/bottomTab.stories.tsx +32 -0
  198. package/lib/components/navigation/breadcrumb/README.md +48 -0
  199. package/lib/components/navigation/breadcrumb/breadcrumb.stories.tsx +27 -0
  200. package/lib/components/navigation/header/README.md +149 -0
  201. package/lib/components/navigation/header/header.stories.tsx +107 -0
  202. package/lib/components/navigation/leftNav/README.md +91 -0
  203. package/lib/components/navigation/leftNav/leftNav.stories.tsx +106 -0
  204. package/lib/components/navigation/tabs/README.md +75 -0
  205. package/lib/components/navigation/tabs/tabs.stories.tsx +60 -0
  206. package/lib/components/structure/column/README.md +40 -0
  207. package/lib/components/structure/column/column.stories.tsx +26 -0
  208. package/lib/components/structure/container/README.md +34 -0
  209. package/lib/components/structure/container/container.stories.tsx +19 -0
  210. package/lib/components/structure/link/README.md +55 -0
  211. package/lib/components/structure/link/link.stories.tsx +30 -0
  212. package/lib/components/structure/text/README.md +42 -0
  213. package/lib/components/structure/text/text.stories.tsx +39 -0
  214. package/lib/components/template/authPage/authPage.stories.tsx +68 -0
  215. package/lib/components/template/landingPage/landingPage.stories.tsx +288 -0
  216. package/lib/components/template/productListing/productListing.stories.tsx +297 -0
  217. package/lib/components/template/productOverview/productOverview.stories.tsx +194 -0
  218. package/lib/components/template/shoppingCart/shoppingCart.stories.tsx +252 -0
  219. package/lib/components/template/userHomePage/userHomePage.stories.tsx +605 -0
  220. package/lib/components/template/userRankingDashboard/userRankingDashboard.stories.tsx +481 -0
  221. package/lib/mcp/server.d.ts +2 -0
  222. package/lib/mcp/server.d.ts.map +1 -0
  223. package/lib/mcp/server.js +33 -0
  224. package/lib/mcp/server.js.map +1 -0
  225. package/lib/mcp/tools/getBackendComponent.d.ts +13 -0
  226. package/lib/mcp/tools/getBackendComponent.d.ts.map +1 -0
  227. package/lib/mcp/tools/getBackendComponent.js +119 -0
  228. package/lib/mcp/tools/getBackendComponent.js.map +1 -0
  229. package/lib/mcp/tools/getComponent.d.ts +17 -0
  230. package/lib/mcp/tools/getComponent.d.ts.map +1 -0
  231. package/lib/mcp/tools/getComponent.js +118 -0
  232. package/lib/mcp/tools/getComponent.js.map +1 -0
  233. package/lib/mcp/tools/listComponents.d.ts +13 -0
  234. package/lib/mcp/tools/listComponents.d.ts.map +1 -0
  235. package/lib/mcp/tools/listComponents.js +113 -0
  236. package/lib/mcp/tools/listComponents.js.map +1 -0
  237. package/lib/mcp/tools/listTemplates.d.ts +13 -0
  238. package/lib/mcp/tools/listTemplates.d.ts.map +1 -0
  239. package/lib/mcp/tools/listTemplates.js +68 -0
  240. package/lib/mcp/tools/listTemplates.js.map +1 -0
  241. package/lib/mcp/tools/suggestTemplate.d.ts +17 -0
  242. package/lib/mcp/tools/suggestTemplate.d.ts.map +1 -0
  243. package/lib/mcp/tools/suggestTemplate.js +212 -0
  244. package/lib/mcp/tools/suggestTemplate.js.map +1 -0
  245. package/package.json +23 -0
@@ -0,0 +1,89 @@
1
+ # Read Query HOC
2
+
3
+ <!-- STORY -->
4
+
5
+ <hr>
6
+
7
+ Read Query Higher Order Component for database actions
8
+
9
+ ##### Import
10
+
11
+ ```js
12
+ import { ReadQueryHoc } from "blixify-ui-web/components/data/readQueryHoc";
13
+ ```
14
+
15
+ ##### Usage
16
+
17
+ ```jsx
18
+ <ReadQueryHoc
19
+ database={{
20
+ dbModule: axios,
21
+ dbType: "fbServer",
22
+ dbCollection: "tasks",
23
+ dbEndpoint: "http://localhost:3000",
24
+ }}
25
+ cond={{
26
+ type: "list",
27
+ query: [{ type: ">", value: 1, queryId: "count" }],
28
+ limit: 1,
29
+ sort: { sortId: "count", type: "asc" },
30
+ cursor: 20,
31
+ }}
32
+ />
33
+ ```
34
+
35
+ ##### Props
36
+
37
+ | Name | Type | Description | Optional |
38
+ | --------- | ------------ | ----------- ||
39
+ | `database` | `Database Class` | DB Module ||
40
+ | `cond` | `ReadQuery Class` | Query Class ||
41
+ | `onChangeData` | `(dataClass : {data : any, count : any }) => {}` | Called when new data is received ||
42
+
43
+ ##### Database Class
44
+
45
+ | Name | Type | Description | Optional |
46
+ | --------- | ------------ | ----------- ||
47
+ | `dbModule` | `axios or firebase` | Class ||
48
+ | `dbType` | `mongoServer/fbServer/firebase` | string ||
49
+ | `dbCollection` | `string` | Collection to call ||
50
+ | `dbEndpoint` | `string` | Eg api.example.com | true |
51
+ | `dbAPIToken` | `string` | API Token | true|
52
+ | `dbUserToken` | `string` | User ID Token | true |
53
+
54
+ ##### ReadQuery Class
55
+
56
+ | Name | Type | Description | Optional |
57
+ | ----------- | ----------- | ------------------ | ---------------------------- |
58
+ | `type` | `get/list` | Query Type | |
59
+ | `id` | `string` | Read ID | Required for get query |
60
+ | `query` | `Query` | Query Class | true |
61
+ | `cursor` | `any` | Last index of item | true |
62
+ | `limit` | `number` | Limitation of data | Required for firebase module |
63
+ | `sort` | `Sort` | Sort Class | true |
64
+ | `aggregate` | `Aggregate` | Aggregate Class | true |
65
+
66
+ ##### Query Class
67
+
68
+ | Name | Type | Description | Optional |
69
+ | ----------- | -------------------- | -------------- | ------------------------------------ |
70
+ | `type` | `search/=/>/</></in` | Query Type | |
71
+ | `value` | `any` | Value of query | Value will be a list during >< query |
72
+ | `queryId` | `string` | Query Id | Required except search |
73
+ | `searchIds` | `string[]` | Search Ids | Required during search |
74
+
75
+ ##### Aggregate Class
76
+
77
+ | Name | Type | Description | Optional |
78
+ | --------- | --------------------- | -------------------- | -------------------------------------------------------------- |
79
+ | `type` | `count/avg/sum/value` | Aggregate Type | |
80
+ | `queryId` | `string` | Query Id | Required except search |
81
+ | `dateId` | `string` | Date Id | Required for date range filter |
82
+ | `range` | `string[]` | string array of date | format of date range "DD/MM/YYYY HH:mm:ss-DD/MM/YYYY HH:mm:ss" |
83
+
84
+ ##### Sort Class
85
+
86
+ | Name | Type | Description | Optional |
87
+ | -------- | ---------- | ------------ | -------- |
88
+ | `sortId` | `string` | Sort Id | |
89
+ | `type` | `asc/desc` | Type of Sort | |
@@ -0,0 +1,33 @@
1
+ import { storiesOf } from "@storybook/react";
2
+ import axios from "axios";
3
+ import React from "react";
4
+ import { ReadQueryHoc } from ".";
5
+ import README from "./README.md";
6
+
7
+ const stories = storiesOf("Data", module);
8
+
9
+ stories.addParameters({
10
+ readme: {
11
+ content: README,
12
+ },
13
+ });
14
+
15
+ stories.add("ReadQueryHoc", () => {
16
+ return (
17
+ <ReadQueryHoc
18
+ database={{
19
+ dbModule: axios,
20
+ dbType: "fbServer",
21
+ dbCollection: "tasks",
22
+ dbEndpoint: "http://localhost:3000",
23
+ }}
24
+ cond={{
25
+ type: "list",
26
+ query: [{ type: ">", value: 1, queryId: "count" }],
27
+ limit: 1,
28
+ sort: { sortId: "count", type: "asc" },
29
+ cursor: 20,
30
+ }}
31
+ />
32
+ );
33
+ });
@@ -0,0 +1,178 @@
1
+ # Write Query
2
+
3
+ <!-- STORY -->
4
+
5
+ <hr>
6
+
7
+ `WriteQuery` is a low-level utility class for writing data to MongoDB (via server) or Firebase. Use it when you need direct create/update/delete access outside of DataTemplate or DataTemplateWrapper — for example, custom form submissions, batch operations, or programmatic data mutations.
8
+
9
+ ## How It Works
10
+
11
+ 1. Instantiate `WriteQuery` with your database config
12
+ 2. Call `.call(queryType, queryData)` with the operation and payload
13
+ 3. Returns `true` on success, or throws on error
14
+
15
+ ## Setup
16
+
17
+ ```ts
18
+ import axios from "axios";
19
+ import { WriteQuery } from "blixify-ui-web/data/writeQuery";
20
+
21
+ const query = new WriteQuery({
22
+ dbModule: axios,
23
+ dbType: "mongoDB", // "mongoDB" | "fbServer" | "firebase"
24
+ dbCollection: "tasks",
25
+ dbEndpoint: "https://api.example.com/api/mongoData",
26
+ dbAPIToken: "your-api-token", // optional
27
+ dbUserToken: "user-id-token", // optional
28
+ });
29
+ ```
30
+
31
+ ## Usage Examples
32
+
33
+ ### Create a record
34
+
35
+ ```ts
36
+ await query.call("create", {
37
+ data: {
38
+ name: "New Task",
39
+ status: "pending",
40
+ createdAt: new Date().toISOString(),
41
+ },
42
+ });
43
+ ```
44
+
45
+ ### Update a record
46
+
47
+ ```ts
48
+ await query.call("update", {
49
+ id: "abc123",
50
+ data: { status: "completed" },
51
+ });
52
+ ```
53
+
54
+ ### Unset (remove) fields on update
55
+
56
+ ```ts
57
+ await query.call("update", {
58
+ id: "abc123",
59
+ data: { status: "active" },
60
+ unsetData: { tempField: 1, legacyNote: 1 }, // removes these fields
61
+ });
62
+ ```
63
+
64
+ ### Upsert — create if not found
65
+
66
+ ```ts
67
+ await query.call("update", {
68
+ id: "abc123",
69
+ data: { name: "Task", status: "pending" },
70
+ upsert: true, // creates the doc if it doesn't exist
71
+ });
72
+ ```
73
+
74
+ ### Delete a record
75
+
76
+ ```ts
77
+ await query.call("delete", { id: "abc123" });
78
+ ```
79
+
80
+ ### Batch create
81
+
82
+ ```ts
83
+ await query.call("batchCreate", {
84
+ data: [
85
+ { name: "Task A", status: "pending" },
86
+ { name: "Task B", status: "pending" },
87
+ ],
88
+ });
89
+ ```
90
+
91
+ ### Batch delete by IDs
92
+
93
+ ```ts
94
+ await query.call("batchDelete", {
95
+ id: ["abc123", "def456", "ghi789"],
96
+ });
97
+ ```
98
+
99
+ ### Batch delete by query
100
+
101
+ ```ts
102
+ await query.call("batchDelete", {
103
+ query: [{ queryId: "status", type: "=", value: "archived" }],
104
+ });
105
+ ```
106
+
107
+ ### Batch update by query
108
+
109
+ ```ts
110
+ await query.call("batchUpdate", {
111
+ query: [{ queryId: "status", type: "=", value: "pending" }],
112
+ data: { status: "active" },
113
+ });
114
+ ```
115
+
116
+ ### Batch update with OR query
117
+
118
+ ```ts
119
+ await query.call("batchUpdate", {
120
+ query: [
121
+ { queryId: "status", type: "=", value: "draft" },
122
+ { queryId: "status", type: "=", value: "pending" },
123
+ ],
124
+ data: { status: "active" },
125
+ isOrQuery: true, // match either condition
126
+ });
127
+ ```
128
+
129
+ ### Unique constraint on create
130
+
131
+ ```ts
132
+ await query.call("create", {
133
+ data: { email: "[email]", name: "[name]" },
134
+ unique: "email", // reject if a doc with this email already exists
135
+ });
136
+ ```
137
+
138
+ ### Stop response (fire and forget)
139
+
140
+ ```ts
141
+ await query.call("create", {
142
+ data: { name: "Log Entry", event: "login" },
143
+ stopRes: true, // don't wait for response body
144
+ });
145
+ ```
146
+
147
+ ---
148
+
149
+ ## Constructor
150
+
151
+ | Param | Type | Description | Optional |
152
+ | -------------- | --------------------------------- | -------------------- | -------- |
153
+ | `dbModule` | `axios \| firebase` | HTTP/Firebase module | |
154
+ | `dbType` | `mongoDB \| fbServer \| firebase` | Backend type | |
155
+ | `dbCollection` | `string` | Collection name | |
156
+ | `dbEndpoint` | `string` | API base URL | ✓ |
157
+ | `dbAPIToken` | `string` | API token | ✓ |
158
+ | `dbUserToken` | `string` | User ID token | ✓ |
159
+
160
+ ## Call Method
161
+
162
+ | Param | Type | Description |
163
+ | ----------- | ------------------------------------------------------------------------- | --------------------------------------------------------- |
164
+ | `queryType` | `create \| update \| delete \| batchCreate \| batchDelete \| batchUpdate` | Operation type. Batch ops require `mongoDB` or `fbServer` |
165
+ | `queryData` | `WriteQueryData` | Payload — see table below |
166
+
167
+ ## WriteQueryData
168
+
169
+ | Param | Type | Description | Optional |
170
+ | ----------- | -------------------- | ------------------------------------------------ | ------------------------------------------------------------- |
171
+ | `id` | `string \| string[]` | Document ID(s) | Required for `update`, `delete`, `batchDelete` by ID |
172
+ | `data` | `any \| any[]` | Document data | Required for `create`, `update`, `batchCreate`, `batchUpdate` |
173
+ | `unsetData` | `any` | Fields to remove on update `{ fieldName: 1 }` | ✓ |
174
+ | `query` | `Query[]` | Filter for `batchDelete` / `batchUpdate` | ✓ |
175
+ | `isOrQuery` | `boolean` | Use OR between query conditions in `batchUpdate` | ✓ |
176
+ | `upsert` | `boolean` | Create doc if not found during `update` | ✓ |
177
+ | `unique` | `string` | Field name to enforce uniqueness on `create` | ✓ |
178
+ | `stopRes` | `boolean` | Skip waiting for response body | ✓ |
@@ -0,0 +1,209 @@
1
+ import { storiesOf } from "@storybook/react";
2
+ import axios from "axios";
3
+ import React, { useState } from "react";
4
+ import { WriteQuery } from ".";
5
+ import { Button } from "../../action/button";
6
+ import { StorySection } from "../../storyUtils";
7
+ import README from "./README.md";
8
+
9
+ const stories = storiesOf("Data", module);
10
+
11
+ stories.addParameters({
12
+ readme: { content: README },
13
+ });
14
+
15
+ const query = new WriteQuery({
16
+ dbModule: axios,
17
+ dbType: "mongoDB",
18
+ dbCollection: "tasks",
19
+ dbEndpoint: "https://api.example.com/api/mongoData",
20
+ });
21
+
22
+ stories.add("Write Query", () => {
23
+ const [result, setResult] = useState<string>("");
24
+
25
+ const run = async (label: string, fn: () => Promise<any>) => {
26
+ try {
27
+ const res = await fn();
28
+ setResult(`[${label}] Success: ${JSON.stringify(res)}`);
29
+ } catch (err: any) {
30
+ setResult(`[${label}] Error: ${err?.message ?? String(err)}`);
31
+ }
32
+ };
33
+
34
+ return (
35
+ <div className="flex flex-col gap-6 w-full p-4">
36
+ <StorySection
37
+ title="Create a Record"
38
+ description="Insert a new document into the collection."
39
+ >
40
+ <Button
41
+ text="Create"
42
+ type="light"
43
+ onClick={() =>
44
+ run("create", () =>
45
+ query.call("create", {
46
+ data: {
47
+ name: "New Task",
48
+ status: "pending",
49
+ createdAt: new Date().toISOString(),
50
+ },
51
+ })
52
+ )
53
+ }
54
+ />
55
+ </StorySection>
56
+
57
+ <StorySection
58
+ title="Update a Record"
59
+ description="Update specific fields on an existing document by ID."
60
+ >
61
+ <Button
62
+ text="Update"
63
+ type="light"
64
+ onClick={() =>
65
+ run("update", () =>
66
+ query.call("update", {
67
+ id: "abc123",
68
+ data: { status: "completed" },
69
+ })
70
+ )
71
+ }
72
+ />
73
+ </StorySection>
74
+
75
+ <StorySection
76
+ title="Unset Fields on Update"
77
+ description="Remove specific fields from a document using unsetData."
78
+ >
79
+ <Button
80
+ text="Unset Fields"
81
+ type="light"
82
+ onClick={() =>
83
+ run("unset", () =>
84
+ query.call("update", {
85
+ id: "abc123",
86
+ data: { status: "active" },
87
+ unsetData: { tempField: 1, legacyNote: 1 }, // removes these fields
88
+ })
89
+ )
90
+ }
91
+ />
92
+ </StorySection>
93
+
94
+ <StorySection
95
+ title="Upsert — Create if Not Found"
96
+ description="Update a document, or create it if it doesn't exist yet."
97
+ >
98
+ <Button
99
+ text="Upsert"
100
+ type="light"
101
+ onClick={() =>
102
+ run("upsert", () =>
103
+ query.call("update", {
104
+ id: "abc123",
105
+ data: { name: "Task", status: "pending" },
106
+ upsert: true,
107
+ })
108
+ )
109
+ }
110
+ />
111
+ </StorySection>
112
+
113
+ <StorySection
114
+ title="Delete a Record"
115
+ description="Delete a single document by ID."
116
+ >
117
+ <Button
118
+ text="Delete"
119
+ type="light"
120
+ onClick={() =>
121
+ run("delete", () => query.call("delete", { id: "abc123" }))
122
+ }
123
+ />
124
+ </StorySection>
125
+
126
+ <StorySection
127
+ title="Batch Create"
128
+ description="Insert multiple documents in one call. Requires mongoDB or fbServer."
129
+ >
130
+ <Button
131
+ text="Batch Create"
132
+ type="light"
133
+ onClick={() =>
134
+ run("batchCreate", () =>
135
+ query.call("batchCreate", {
136
+ data: [
137
+ { name: "Task A", status: "pending" },
138
+ { name: "Task B", status: "pending" },
139
+ ],
140
+ })
141
+ )
142
+ }
143
+ />
144
+ </StorySection>
145
+
146
+ <StorySection
147
+ title="Batch Delete by IDs"
148
+ description="Delete multiple documents by passing an array of IDs."
149
+ >
150
+ <Button
151
+ text="Batch Delete by IDs"
152
+ type="light"
153
+ onClick={() =>
154
+ run("batchDelete-ids", () =>
155
+ query.call("batchDelete", {
156
+ id: ["abc123", "def456", "ghi789"],
157
+ })
158
+ )
159
+ }
160
+ />
161
+ </StorySection>
162
+
163
+ <StorySection
164
+ title="Batch Delete by Query"
165
+ description="Delete all documents matching a filter condition."
166
+ >
167
+ <Button
168
+ text="Batch Delete by Query"
169
+ type="light"
170
+ onClick={() =>
171
+ run("batchDelete-query", () =>
172
+ query.call("batchDelete", {
173
+ query: [{ queryId: "status", type: "=", value: "archived" }],
174
+ })
175
+ )
176
+ }
177
+ />
178
+ </StorySection>
179
+
180
+ <StorySection
181
+ title="Batch Update by Query"
182
+ description="Update all documents matching a filter. Use isOrQuery to switch from AND to OR logic."
183
+ >
184
+ <Button
185
+ text="Batch Update"
186
+ type="light"
187
+ onClick={() =>
188
+ run("batchUpdate", () =>
189
+ query.call("batchUpdate", {
190
+ query: [
191
+ { queryId: "status", type: "=", value: "draft" },
192
+ { queryId: "status", type: "=", value: "pending" },
193
+ ],
194
+ data: { status: "active" },
195
+ isOrQuery: true, // match either condition
196
+ })
197
+ )
198
+ }
199
+ />
200
+ </StorySection>
201
+
202
+ {result && (
203
+ <div className="mt-4 p-3 bg-gray-100 rounded text-xs text-gray-700 break-all">
204
+ {result}
205
+ </div>
206
+ )}
207
+ </div>
208
+ );
209
+ });
@@ -0,0 +1,47 @@
1
+ # Action Section
2
+
3
+ <!-- STORY -->
4
+
5
+ <hr>
6
+
7
+ Action Section as call to action section of a Website
8
+
9
+ ##### Import
10
+
11
+ ```js
12
+ import { ActionSection } from "blixify-ui-web/lib";
13
+ ```
14
+
15
+ ##### Usage
16
+
17
+ ```jsx
18
+ <ActionSection
19
+ title="Join Blixify Space Now !"
20
+ buttonText="Sign Up Now"
21
+ buttonLink="./signup"
22
+ />
23
+ ```
24
+
25
+ ##### Custom Styling
26
+
27
+ ```jsx
28
+ <ActionSection
29
+ title="Custom Padding"
30
+ buttonText="Custom Button"
31
+ buttonLink="./custom"
32
+ className="px-8 py-16"
33
+ />
34
+ ```
35
+
36
+ ##### Optional props
37
+
38
+ | Name | Type | Default | Description |
39
+ | ------------------ | ------------------ | ---------------------------------------------- | --------------------------------------------------- |
40
+ | `title` | `string` | Title | |
41
+ | `buttonText` | `string` | Button Text | |
42
+ | `buttonLink` | `string` | Button navigation | |
43
+ | `linkProps` | `Link Props Class` | Refer to Link Component for more documentation | |
44
+ | `backgroundImgSrc` | `string` | | Set image as background image |
45
+ | `customComponent` | `ReactElement` | | Set customize component within the section |
46
+ | `onClick` | `function` | `() => {}` | |
47
+ | `className` | `string` | | Custom Tailwind classes to override default styling |
@@ -0,0 +1,74 @@
1
+ import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
2
+ import { storiesOf } from "@storybook/react";
3
+ import React from "react";
4
+ import { ActionSection } from ".";
5
+ import { Button } from "../../action/button";
6
+ import README from "./README.md"; // TypeScript declaration exists in types.d.ts
7
+
8
+ const stories = storiesOf("Design", module);
9
+
10
+ stories.addParameters({
11
+ readme: {
12
+ content: README,
13
+ },
14
+ });
15
+
16
+ // Sample background image URL (you can replace with actual image)
17
+ const sampleBackgroundImage =
18
+ "https://images.unsplash.com/photo-1516541196182-6bdb0516ed27?q=80&w=987&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D";
19
+
20
+ stories.add("Action Section", () => {
21
+ return (
22
+ <div className="divide-y-8">
23
+ <ActionSection
24
+ title={"Join Blixify Space Now ! "}
25
+ buttonText="Sign Up Now"
26
+ buttonLink="./signup"
27
+ />
28
+ <ActionSection
29
+ backgroundImgSrc={sampleBackgroundImage}
30
+ customComponent={
31
+ <div className="flex flex-col w-9/12 sm:w-8/12">
32
+ <h5 className="text-xl text-primary-600 font-bold sm:w-8/12 sm:text-2xl md:text-3xl">
33
+ Create an account to receive latest updates from us
34
+ </h5>
35
+ <p className="text-md mt-2">
36
+ Pawsome Bargains: Unleash Savings for Your Furry Friends at our
37
+ Pet Shop!
38
+ </p>
39
+ <Button
40
+ text="Sign Up"
41
+ className="max-w-md mt-5"
42
+ type="normal"
43
+ size="small"
44
+ />
45
+ </div>
46
+ }
47
+ />
48
+ <ActionSection
49
+ customComponent={
50
+ <div className="flex items-center justify-between w-full">
51
+ <div className="flex items-center gap-3">
52
+ <div className="flex items-center justify-center w-8 h-8 bg-yellow-500 rounded-full">
53
+ <ExclamationTriangleIcon className="w-5 h-5 text-white" />
54
+ </div>
55
+ <div>
56
+ <h5 className="text-lg font-semibold">
57
+ Account expires in 7 days
58
+ </h5>
59
+ <p className="text-sm text-gray-800">
60
+ Renew your subscription to continue
61
+ </p>
62
+ </div>
63
+ </div>
64
+ <div className="flex gap-2">
65
+ <Button text="Renew" type="normal" size="small" />
66
+ <Button text="Learn More" type="light" size="small" />
67
+ </div>
68
+ </div>
69
+ }
70
+ className="px-4 py-6 bg-white border-2 border-gray-200"
71
+ />
72
+ </div>
73
+ );
74
+ });
@@ -0,0 +1,43 @@
1
+ # Banner
2
+
3
+ <!-- STORY -->
4
+
5
+ <hr>
6
+
7
+ Banner to be displayed at top of a website for emergency notification
8
+
9
+ ##### Import
10
+
11
+ ```js
12
+ import { Banner } from "blixify-ui-web/lib";
13
+ ```
14
+
15
+ ##### Usage
16
+
17
+ ```jsx
18
+ const renderContent = () => {
19
+ return (
20
+ <>
21
+ <p className="text-xs sm:text-sm text-white">
22
+ Lorem ipsum dolor sit amet.
23
+ <a
24
+ className="underline"
25
+ target="_blank"
26
+ rel="noreferrer"
27
+ href="https://blixify.co"
28
+ >
29
+ https://blixify.co
30
+ </a>
31
+ </p>
32
+ </>
33
+ );
34
+ };
35
+
36
+ return <Banner content={renderContent()} />;
37
+ ```
38
+
39
+ ##### Required props
40
+
41
+ | Name | Type | Description | |
42
+ | --------- | ------- | -------------- | -------------- |
43
+ | `content` | `string | React Element` | Banner content |