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.
- package/README.md +5 -0
- package/lib/components/action/button/README.md +75 -0
- package/lib/components/action/button/button.stories.tsx +138 -0
- package/lib/components/action/buttonGroup/README.md +79 -0
- package/lib/components/action/buttonGroup/buttonGroup.stories.tsx +104 -0
- package/lib/components/action/iconButton/README.md +39 -0
- package/lib/components/action/iconButton/iconButton.stories.tsx +22 -0
- package/lib/components/action/radioList/README.md +98 -0
- package/lib/components/action/radioList/radioList.stories.tsx +181 -0
- package/lib/components/action/slider/README.md +86 -0
- package/lib/components/action/slider/slider.stories.tsx +133 -0
- package/lib/components/action/textButton/README.md +34 -0
- package/lib/components/action/textButton/textButton.stories.tsx +16 -0
- package/lib/components/action/toggle/README.md +39 -0
- package/lib/components/action/toggle/toggle.stories.tsx +23 -0
- package/lib/components/advanced/collapse/README.md +106 -0
- package/lib/components/advanced/collapse/collapse.stories.tsx +165 -0
- package/lib/components/advanced/infoWindow/README.md +69 -0
- package/lib/components/advanced/infoWindow/infoWindow.stories.tsx +112 -0
- package/lib/components/advanced/popUp/README.md +95 -0
- package/lib/components/advanced/popUp/popUp.stories.tsx +189 -0
- package/lib/components/auth/bareSignIn/README.md +78 -0
- package/lib/components/auth/bareSignIn/bareSignIn.stories.tsx +141 -0
- package/lib/components/auth/bareSignUp/README.md +130 -0
- package/lib/components/auth/bareSignUp/bareSignUp.stories.tsx +159 -0
- package/lib/components/auth/signIn/README.md +53 -0
- package/lib/components/auth/signIn/signIn.stories.tsx +120 -0
- package/lib/components/auth/signUp/README.md +136 -0
- package/lib/components/auth/signUp/signUp.stories.tsx +193 -0
- package/lib/components/chart/README.md +13 -0
- package/lib/components/chart/areaChart/README.md +133 -0
- package/lib/components/chart/areaChart/areaChart.stories.tsx +199 -0
- package/lib/components/chart/barChart/README.md +193 -0
- package/lib/components/chart/barChart/barChart.stories.tsx +318 -0
- package/lib/components/chart/boxPlotChart/README.md +124 -0
- package/lib/components/chart/boxPlotChart/boxPlotChart.stories.tsx +104 -0
- package/lib/components/chart/bubbleChart/README.md +166 -0
- package/lib/components/chart/bubbleChart/bubbleChart.stories.tsx +144 -0
- package/lib/components/chart/card/README.md +107 -0
- package/lib/components/chart/card/card.stories.tsx +89 -0
- package/lib/components/chart/ganttChart/README.md +142 -0
- package/lib/components/chart/ganttChart/ganttChart.stories.tsx +138 -0
- package/lib/components/chart/heatmapChart/README.md +125 -0
- package/lib/components/chart/heatmapChart/heatmapChart.stories.tsx +106 -0
- package/lib/components/chart/lineChart/README.md +140 -0
- package/lib/components/chart/lineChart/lineChart.stories.tsx +152 -0
- package/lib/components/chart/pieChart/README.md +117 -0
- package/lib/components/chart/pieChart/pieChart.stories.tsx +180 -0
- package/lib/components/chart/polarAreaChart/README.md +126 -0
- package/lib/components/chart/polarAreaChart/polarAreaChart.stories.tsx +106 -0
- package/lib/components/chart/radarChart/README.md +57 -0
- package/lib/components/chart/radarChart/radarChart.stories.tsx +36 -0
- package/lib/components/chart/radialBar/README.md +152 -0
- package/lib/components/chart/radialBar/radialChart.stories.tsx +136 -0
- package/lib/components/chart/rangeBarChart/README.md +323 -0
- package/lib/components/chart/rangeBarChart/rangeBarChart.stories.tsx +208 -0
- package/lib/components/chart/statsCard/README.md +97 -0
- package/lib/components/chart/statsCard/statsCard.stories.tsx +183 -0
- package/lib/components/chart/treemapChart/README.md +142 -0
- package/lib/components/chart/treemapChart/treemapChart.stories.tsx +122 -0
- package/lib/components/chat/chatAnchor/README.md +113 -0
- package/lib/components/chat/chatAnchor/chatAnchor.stories.tsx +156 -0
- package/lib/components/chat/chatBase/README.md +223 -0
- package/lib/components/chat/chatBase/chatBase.stories.tsx +306 -0
- package/lib/components/chat/chatDashboard/README.md +161 -0
- package/lib/components/chat/chatDashboard/chatDashboard.stories.tsx +154 -0
- package/lib/components/data/dataGraph/README.md +13 -0
- package/lib/components/data/dataGraph/dataGraph.stories.tsx +84 -0
- package/lib/components/data/dataReference/README.md +62 -0
- package/lib/components/data/dataReference/dataReference.stories.tsx +53 -0
- package/lib/components/data/dataTemplate/README.md +903 -0
- package/lib/components/data/dataTemplate/dataModule.stories.tsx +196 -0
- package/lib/components/data/dataTemplate/dataTemplate.stories.tsx +337 -0
- package/lib/components/data/dataWrapper/README.md +1077 -0
- package/lib/components/data/dataWrapper/dataWrapper.stories.tsx +831 -0
- package/lib/components/data/queryForm/README.md +56 -0
- package/lib/components/data/queryForm/queryForm.stories.tsx +85 -0
- package/lib/components/data/readQuery/README.md +282 -0
- package/lib/components/data/readQuery/readQuery.stories.tsx +256 -0
- package/lib/components/data/readQueryHoc/README.md +89 -0
- package/lib/components/data/readQueryHoc/readQueryHoc.stories.tsx +33 -0
- package/lib/components/data/writeQuery/README.md +178 -0
- package/lib/components/data/writeQuery/writeQuery.stories.tsx +209 -0
- package/lib/components/design/actionSection/README.md +47 -0
- package/lib/components/design/actionSection/actionSection.stories.tsx +74 -0
- package/lib/components/design/banner/README.md +43 -0
- package/lib/components/design/banner/banner.stories.tsx +34 -0
- package/lib/components/design/bannerAction/README.md +44 -0
- package/lib/components/design/bannerAction/bannerAction.stories.tsx +25 -0
- package/lib/components/design/blogSection/README.md +111 -0
- package/lib/components/design/blogSection/blogSection.stories.tsx +72 -0
- package/lib/components/design/carouselSection/README.md +82 -0
- package/lib/components/design/carouselSection/carouselSection.stories.tsx +52 -0
- package/lib/components/design/designList/README.md +60 -0
- package/lib/components/design/designList/designList.stories.tsx +44 -0
- package/lib/components/design/faq/README.md +121 -0
- package/lib/components/design/faq/faq.stories.tsx +103 -0
- package/lib/components/design/fileGrid/README.md +87 -0
- package/lib/components/design/fileGrid/fileGrid.stories.tsx +110 -0
- package/lib/components/design/fileViewer/README.md +40 -0
- package/lib/components/design/fileViewer/fileViewer.stories.tsx +28 -0
- package/lib/components/design/footerSection/README.md +62 -0
- package/lib/components/design/footerSection/footerSection.stories.tsx +84 -0
- package/lib/components/design/googleReview/README.md +45 -0
- package/lib/components/design/googleReview/googleReview.stories.tsx +33 -0
- package/lib/components/design/heroSection/README.md +48 -0
- package/lib/components/design/heroSection/heroSection.stories.tsx +85 -0
- package/lib/components/design/iconList/README.md +60 -0
- package/lib/components/design/iconList/iconList.stories.tsx +41 -0
- package/lib/components/design/imageGallery/README.md +56 -0
- package/lib/components/design/imageGallery/imageGallery.stories.tsx +45 -0
- package/lib/components/design/imageZoom/README.md +47 -0
- package/lib/components/design/imageZoom/imageZoom.stories.tsx +30 -0
- package/lib/components/design/leftContent/README.md +47 -0
- package/lib/components/design/leftContent/leftContent.stories.tsx +32 -0
- package/lib/components/design/logoCloud/README.md +42 -0
- package/lib/components/design/logoCloud/logoCloud.stories.tsx +44 -0
- package/lib/components/design/onboarding/README.md +100 -0
- package/lib/components/design/onboarding/onboarding.stories.tsx +113 -0
- package/lib/components/design/pricing/README.md +112 -0
- package/lib/components/design/pricing/pricing.stories.tsx +86 -0
- package/lib/components/design/rightContent/README.md +47 -0
- package/lib/components/design/rightContent/rightContent.stories.tsx +32 -0
- package/lib/components/design/sectionList/README.md +51 -0
- package/lib/components/design/sectionList/sectionList.stories.tsx +35 -0
- package/lib/components/design/teams/README.md +62 -0
- package/lib/components/design/teams/teams.stories.tsx +61 -0
- package/lib/components/display/alert/README.md +82 -0
- package/lib/components/display/alert/alert.stories.tsx +71 -0
- package/lib/components/display/calendar/README.md +113 -0
- package/lib/components/display/calendar/calendar.stories.tsx +159 -0
- package/lib/components/display/clipboard/README.md +36 -0
- package/lib/components/display/clipboard/clipboard.stories.tsx +32 -0
- package/lib/components/display/detailList/README.md +61 -0
- package/lib/components/display/detailList/detailList.stories.tsx +131 -0
- package/lib/components/display/drawer/README.md +74 -0
- package/lib/components/display/drawer/drawer.stories.tsx +66 -0
- package/lib/components/display/emptyState/README.md +38 -0
- package/lib/components/display/emptyState/emptyState.stories.tsx +22 -0
- package/lib/components/display/feeds/README.md +80 -0
- package/lib/components/display/feeds/feeds.stories.tsx +75 -0
- package/lib/components/display/flexTable/README.md +160 -0
- package/lib/components/display/flexTable/flexTable.stories.tsx +313 -0
- package/lib/components/display/grid/README.md +121 -0
- package/lib/components/display/grid/grid.stories.tsx +234 -0
- package/lib/components/display/kanban/README.md +78 -0
- package/lib/components/display/kanban/kanban.stories.tsx +133 -0
- package/lib/components/display/list/README.md +109 -0
- package/lib/components/display/list/list.stories.tsx +188 -0
- package/lib/components/display/loading/README.md +25 -0
- package/lib/components/display/loading/loading.stories.tsx +15 -0
- package/lib/components/display/mapView/README.md +99 -0
- package/lib/components/display/mapView/mapView.stories.tsx +225 -0
- package/lib/components/display/modal/README.md +43 -0
- package/lib/components/display/modal/modal.stories.tsx +81 -0
- package/lib/components/display/notification/README.md +43 -0
- package/lib/components/display/notification/notification.stories.tsx +30 -0
- package/lib/components/display/progress/README.md +25 -0
- package/lib/components/display/progress/progress.stories.tsx +15 -0
- package/lib/components/display/stepper/README.md +96 -0
- package/lib/components/display/stepper/stepper.stories.tsx +175 -0
- package/lib/components/display/table/README.md +176 -0
- package/lib/components/display/table/table.stories.tsx +330 -0
- package/lib/components/display/tag/README.md +74 -0
- package/lib/components/display/tag/tag.stories.tsx +79 -0
- package/lib/components/input/address/README.md +132 -0
- package/lib/components/input/address/address.stories.tsx +147 -0
- package/lib/components/input/canvas/README.md +131 -0
- package/lib/components/input/canvas/canvas.stories.tsx +165 -0
- package/lib/components/input/checkbox/README.md +61 -0
- package/lib/components/input/checkbox/checkbox.stories.tsx +30 -0
- package/lib/components/input/datePicker/README.md +124 -0
- package/lib/components/input/datePicker/datePicker.stories.tsx +197 -0
- package/lib/components/input/form/README.md +55 -0
- package/lib/components/input/form/form.stories.tsx +143 -0
- package/lib/components/input/markdown/README.md +146 -0
- package/lib/components/input/markdown/markdown.stories.tsx +40 -0
- package/lib/components/input/monthYearPicker/README.md +69 -0
- package/lib/components/input/monthYearPicker/monthYearPicker.stories.tsx +47 -0
- package/lib/components/input/netPromoterScore/README.md +52 -0
- package/lib/components/input/netPromoterScore/netPromoterScore.stories.tsx +30 -0
- package/lib/components/input/rating/README.md +51 -0
- package/lib/components/input/rating/rating.stories.tsx +30 -0
- package/lib/components/input/select/README.md +108 -0
- package/lib/components/input/select/select.stories.tsx +286 -0
- package/lib/components/input/signature/README.md +106 -0
- package/lib/components/input/signature/signature.stories.tsx +188 -0
- package/lib/components/input/textArea/README.md +55 -0
- package/lib/components/input/textArea/textArea.stories.tsx +30 -0
- package/lib/components/input/textInput/README.md +81 -0
- package/lib/components/input/textInput/textinput.stories.tsx +231 -0
- package/lib/components/input/uploadInput/README.md +134 -0
- package/lib/components/input/uploadInput/uploadInput.stories.tsx +193 -0
- package/lib/components/navigation/bars/README.md +40 -0
- package/lib/components/navigation/bars/bars.stories.tsx +85 -0
- package/lib/components/navigation/bottomTab/README.md +53 -0
- package/lib/components/navigation/bottomTab/bottomTab.stories.tsx +32 -0
- package/lib/components/navigation/breadcrumb/README.md +48 -0
- package/lib/components/navigation/breadcrumb/breadcrumb.stories.tsx +27 -0
- package/lib/components/navigation/header/README.md +149 -0
- package/lib/components/navigation/header/header.stories.tsx +107 -0
- package/lib/components/navigation/leftNav/README.md +91 -0
- package/lib/components/navigation/leftNav/leftNav.stories.tsx +106 -0
- package/lib/components/navigation/tabs/README.md +75 -0
- package/lib/components/navigation/tabs/tabs.stories.tsx +60 -0
- package/lib/components/structure/column/README.md +40 -0
- package/lib/components/structure/column/column.stories.tsx +26 -0
- package/lib/components/structure/container/README.md +34 -0
- package/lib/components/structure/container/container.stories.tsx +19 -0
- package/lib/components/structure/link/README.md +55 -0
- package/lib/components/structure/link/link.stories.tsx +30 -0
- package/lib/components/structure/text/README.md +42 -0
- package/lib/components/structure/text/text.stories.tsx +39 -0
- package/lib/components/template/authPage/authPage.stories.tsx +68 -0
- package/lib/components/template/landingPage/landingPage.stories.tsx +288 -0
- package/lib/components/template/productListing/productListing.stories.tsx +297 -0
- package/lib/components/template/productOverview/productOverview.stories.tsx +194 -0
- package/lib/components/template/shoppingCart/shoppingCart.stories.tsx +252 -0
- package/lib/components/template/userHomePage/userHomePage.stories.tsx +605 -0
- package/lib/components/template/userRankingDashboard/userRankingDashboard.stories.tsx +481 -0
- package/lib/mcp/server.d.ts +2 -0
- package/lib/mcp/server.d.ts.map +1 -0
- package/lib/mcp/server.js +33 -0
- package/lib/mcp/server.js.map +1 -0
- package/lib/mcp/tools/getBackendComponent.d.ts +13 -0
- package/lib/mcp/tools/getBackendComponent.d.ts.map +1 -0
- package/lib/mcp/tools/getBackendComponent.js +119 -0
- package/lib/mcp/tools/getBackendComponent.js.map +1 -0
- package/lib/mcp/tools/getComponent.d.ts +17 -0
- package/lib/mcp/tools/getComponent.d.ts.map +1 -0
- package/lib/mcp/tools/getComponent.js +118 -0
- package/lib/mcp/tools/getComponent.js.map +1 -0
- package/lib/mcp/tools/listComponents.d.ts +13 -0
- package/lib/mcp/tools/listComponents.d.ts.map +1 -0
- package/lib/mcp/tools/listComponents.js +113 -0
- package/lib/mcp/tools/listComponents.js.map +1 -0
- package/lib/mcp/tools/listTemplates.d.ts +13 -0
- package/lib/mcp/tools/listTemplates.d.ts.map +1 -0
- package/lib/mcp/tools/listTemplates.js +68 -0
- package/lib/mcp/tools/listTemplates.js.map +1 -0
- package/lib/mcp/tools/suggestTemplate.d.ts +17 -0
- package/lib/mcp/tools/suggestTemplate.d.ts.map +1 -0
- package/lib/mcp/tools/suggestTemplate.js +212 -0
- package/lib/mcp/tools/suggestTemplate.js.map +1 -0
- 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 |
|