@lowdefy/docs-content 6.1.0 → 7.1.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 (284) hide show
  1. package/README.md +1 -0
  2. package/content/actions/downloadcsv.md +1 -1
  3. package/content/actions/emailotpsend.md +58 -0
  4. package/content/actions/emailotpverify.md +79 -0
  5. package/content/actions/getlocalstorage.md +43 -0
  6. package/content/actions/link.md +47 -1
  7. package/content/actions/login.md +25 -5
  8. package/content/actions/logout.md +7 -5
  9. package/content/actions/magiclinkverify.md +117 -0
  10. package/content/actions/pdfmake.md +2 -2
  11. package/content/actions/posthogalias.md +29 -0
  12. package/content/actions/posthogcapture.md +49 -0
  13. package/content/actions/posthogcapturepageleave.md +38 -0
  14. package/content/actions/posthogfeatureflag.md +50 -0
  15. package/content/actions/posthoggroup.md +37 -0
  16. package/content/actions/posthogidentify.md +54 -0
  17. package/content/actions/posthoginit.md +96 -0
  18. package/content/actions/posthogoptin.md +29 -0
  19. package/content/actions/posthogoptout.md +29 -0
  20. package/content/actions/posthogpageview.md +37 -0
  21. package/content/actions/posthogreloadfeatureflags.md +47 -0
  22. package/content/actions/posthogreset.md +28 -0
  23. package/content/actions/posthogsetpersonproperties.md +36 -0
  24. package/content/actions/removelocalstorage.md +28 -0
  25. package/content/actions/resetvalidation.md +7 -3
  26. package/content/actions/setdarkmode.md +3 -3
  27. package/content/actions/setglobal.md +2 -0
  28. package/content/actions/setlocale.md +1 -1
  29. package/content/actions/setlocalstorage.md +34 -0
  30. package/content/actions/validate.md +7 -4
  31. package/content/adapter-reference/mongodbauthadapter.md +46 -0
  32. package/content/agents/agent-endpoint-tools.md +24 -0
  33. package/content/agents/agent-properties.md +13 -3
  34. package/content/agents/agent-server-hooks.md +1 -1
  35. package/content/agents/agentchat.md +43 -7
  36. package/content/agents/agentconversations.md +42 -8
  37. package/content/agents/agents-introduction.md +107 -0
  38. package/content/callback-reference/auth0logoutcallback.md +54 -0
  39. package/content/concepts/ai-agent-docs.md +455 -106
  40. package/content/concepts/blocks.md +150 -0
  41. package/content/concepts/connections-and-requests.md +402 -0
  42. package/content/concepts/custom-html.md +42 -0
  43. package/content/concepts/custom-styling.md +50 -5
  44. package/content/concepts/dynamic-page-content.md +309 -0
  45. package/content/concepts/events-and-actions.md +154 -2
  46. package/content/concepts/four-primitives.md +31 -0
  47. package/content/concepts/html-attributes.md +293 -0
  48. package/content/concepts/i18n.md +8 -3
  49. package/content/concepts/keyboard-shortcuts.md +2 -2
  50. package/content/concepts/layout-overview.md +1 -1
  51. package/content/concepts/logger.md +99 -0
  52. package/content/concepts/lowdefy-api.md +1319 -0
  53. package/content/concepts/lowdefy-schema.md +136 -3
  54. package/content/concepts/menus.md +8 -7
  55. package/content/concepts/module-authoring.md +76 -5
  56. package/content/concepts/modules.md +3 -1
  57. package/content/concepts/notifications.md +180 -0
  58. package/content/concepts/operators.md +7 -0
  59. package/content/concepts/page-and-app-state.md +252 -0
  60. package/content/concepts/page-paths.md +209 -0
  61. package/content/concepts/theming.md +582 -0
  62. package/content/connections/aigateway.md +375 -0
  63. package/content/connections/anthropic.md +169 -2
  64. package/content/connections/awss3.md +178 -2
  65. package/content/connections/axioshttp.md +181 -0
  66. package/content/connections/google.md +169 -2
  67. package/content/connections/mongodb.md +1014 -3
  68. package/content/connections/openai-connection.md +169 -2
  69. package/content/connections/sendgridmail.md +2 -0
  70. package/content/connections/smtp.md +3 -1
  71. package/content/connections/treg.md +329 -0
  72. package/content/container-blocks/affix.md +47 -7
  73. package/content/container-blocks/alert.md +76 -24
  74. package/content/container-blocks/badge.md +100 -24
  75. package/content/container-blocks/box.md +9 -9
  76. package/content/container-blocks/card.md +132 -27
  77. package/content/container-blocks/carousel.md +60 -7
  78. package/content/container-blocks/collapse.md +153 -9
  79. package/content/container-blocks/configprovider.md +35 -13
  80. package/content/container-blocks/confirmmodal.md +69 -23
  81. package/content/container-blocks/content.md +62 -98
  82. package/content/container-blocks/descriptions.md +45 -4
  83. package/content/container-blocks/drawer.md +139 -28
  84. package/content/container-blocks/dropdownmenu.md +119 -31
  85. package/content/container-blocks/flex.md +40 -62
  86. package/content/container-blocks/footer.md +15 -11
  87. package/content/container-blocks/googlemapsheatmap.md +1 -1
  88. package/content/container-blocks/googlemapsscript.md +2 -2
  89. package/content/container-blocks/header.md +71 -36
  90. package/content/container-blocks/label.md +34 -7
  91. package/content/container-blocks/layout.md +52 -34
  92. package/content/container-blocks/masonry.md +17 -71
  93. package/content/container-blocks/mobilemenu.md +131 -88
  94. package/content/container-blocks/modal.md +161 -26
  95. package/content/container-blocks/pageheadermenu.md +138 -31
  96. package/content/container-blocks/pagesidebarlayout.md +230 -27
  97. package/content/container-blocks/pagesidermenu.md +153 -43
  98. package/content/container-blocks/popover.md +34 -31
  99. package/content/container-blocks/result.md +32 -21
  100. package/content/container-blocks/sider.md +85 -122
  101. package/content/container-blocks/span.md +7 -7
  102. package/content/container-blocks/spinner.md +3 -3
  103. package/content/container-blocks/splitter.md +150 -68
  104. package/content/container-blocks/tabs.md +64 -12
  105. package/content/container-blocks/tooltip.md +22 -46
  106. package/content/container-blocks/watermark.md +22 -4
  107. package/content/controls/parallel_for.md +21 -2
  108. package/content/controls/reject.md +24 -3
  109. package/content/controls/return.md +17 -1
  110. package/content/controls/throw.md +1 -0
  111. package/content/controls/try.md +4 -2
  112. package/content/controls/while.md +46 -0
  113. package/content/deployment/deployment-environments.md +10 -7
  114. package/content/deployment/docker.md +22 -7
  115. package/content/deployment/node-server.md +4 -0
  116. package/content/deployment/vercel.md +17 -6
  117. package/content/display-blocks/aggrid.md +36 -19
  118. package/content/display-blocks/anchor.md +16 -15
  119. package/content/display-blocks/avatar.md +57 -37
  120. package/content/display-blocks/breadcrumb.md +70 -21
  121. package/content/display-blocks/button.md +93 -19
  122. package/content/display-blocks/calendar.md +12 -0
  123. package/content/display-blocks/clickablehtml.md +239 -0
  124. package/content/display-blocks/dangeroushtml.md +1 -1
  125. package/content/display-blocks/difflist.md +1 -1
  126. package/content/display-blocks/difftimeline.md +1 -1
  127. package/content/display-blocks/divider.md +64 -3
  128. package/content/display-blocks/dropdownbutton.md +81 -30
  129. package/content/display-blocks/echart.md +35 -1
  130. package/content/display-blocks/eventlog.md +363 -0
  131. package/content/display-blocks/floatbutton.md +129 -42
  132. package/content/display-blocks/html.md +61 -1
  133. package/content/display-blocks/icon.md +250 -67
  134. package/content/display-blocks/img.md +2 -2
  135. package/content/display-blocks/menu.md +146 -73
  136. package/content/display-blocks/message.md +38 -124
  137. package/content/display-blocks/notification.md +94 -222
  138. package/content/display-blocks/paragraph.md +59 -9
  139. package/content/display-blocks/pollingtimer.md +263 -0
  140. package/content/display-blocks/progress.md +96 -17
  141. package/content/display-blocks/qrcode.md +19 -4
  142. package/content/display-blocks/s3download.md +1 -1
  143. package/content/display-blocks/search.md +19 -9
  144. package/content/display-blocks/skeletonbutton.md +1 -0
  145. package/content/display-blocks/skeletoninput.md +1 -0
  146. package/content/display-blocks/statistic.md +75 -17
  147. package/content/display-blocks/steps.md +58 -25
  148. package/content/display-blocks/table.md +2527 -0
  149. package/content/display-blocks/tablelight.md +621 -0
  150. package/content/display-blocks/tag.md +102 -17
  151. package/content/display-blocks/title.md +50 -11
  152. package/content/display-blocks/tour.md +33 -23
  153. package/content/input-blocks/autocomplete.md +81 -9
  154. package/content/input-blocks/buttonselector.md +45 -8
  155. package/content/input-blocks/captcha.md +40 -0
  156. package/content/input-blocks/checkboxselector.md +97 -7
  157. package/content/input-blocks/checkboxswitch.md +33 -3
  158. package/content/input-blocks/colorselector.md +63 -14
  159. package/content/input-blocks/daterangeselector.md +165 -45
  160. package/content/input-blocks/dateselector.md +139 -41
  161. package/content/input-blocks/datetimeselector.md +158 -49
  162. package/content/input-blocks/inputgallery.md +3 -3
  163. package/content/input-blocks/intentinput.md +207 -0
  164. package/content/input-blocks/monthselector.md +120 -52
  165. package/content/input-blocks/multipleselector.md +150 -39
  166. package/content/input-blocks/numberinput.md +98 -12
  167. package/content/input-blocks/pagination.md +70 -14
  168. package/content/input-blocks/paragraphinput.md +51 -37
  169. package/content/input-blocks/passwordinput.md +60 -6
  170. package/content/input-blocks/phonenumberinput.md +59 -26
  171. package/content/input-blocks/placesautocomplete.md +319 -0
  172. package/content/input-blocks/radioselector.md +83 -7
  173. package/content/input-blocks/ratingslider.md +57 -26
  174. package/content/input-blocks/s3uploadbutton.md +24 -24
  175. package/content/input-blocks/s3uploaddragger.md +3 -3
  176. package/content/input-blocks/s3uploadphoto.md +5 -5
  177. package/content/input-blocks/segmentedselector.md +72 -32
  178. package/content/input-blocks/selector.md +109 -21
  179. package/content/input-blocks/switch.md +65 -17
  180. package/content/input-blocks/tableinput.md +445 -0
  181. package/content/input-blocks/tagmultipleselector.md +114 -0
  182. package/content/input-blocks/tagselector.md +114 -0
  183. package/content/input-blocks/textarea.md +32 -3
  184. package/content/input-blocks/textinput.md +70 -29
  185. package/content/input-blocks/tiptapinput.md +1 -1
  186. package/content/input-blocks/tiptapmentioninput.md +2 -2
  187. package/content/input-blocks/titleinput.md +39 -12
  188. package/content/input-blocks/treeinput.md +49 -25
  189. package/content/input-blocks/treemultipleselector.md +127 -10
  190. package/content/input-blocks/treeselector.md +97 -9
  191. package/content/input-blocks/upload.md +64 -15
  192. package/content/input-blocks/uploaddragger.md +17 -1
  193. package/content/input-blocks/uploadphoto.md +18 -1
  194. package/content/input-blocks/weekselector.md +120 -55
  195. package/content/learn/introduction.md +27 -0
  196. package/content/learn/quickstart.md +53 -0
  197. package/content/list-blocks/controlledlist.md +24 -15
  198. package/content/list-blocks/list.md +11 -11
  199. package/content/list-blocks/masonrylist.md +7 -34
  200. package/content/migration/auth-upgrade.md +337 -0
  201. package/content/migration/upgrade-guide.md +1 -0
  202. package/content/migration/v3-to-v4.md +417 -0
  203. package/content/migration/v6-to-v7.md +620 -0
  204. package/content/operators/_agent.md +155 -0
  205. package/content/operators/_app.md +2 -1
  206. package/content/operators/_array.md +122 -1
  207. package/content/operators/_build.md +1 -0
  208. package/content/operators/_credential.md +57 -0
  209. package/content/operators/_cron.md +292 -0
  210. package/content/operators/_date.md +2 -0
  211. package/content/operators/_error.md +24 -1
  212. package/content/operators/_get.md +6 -6
  213. package/content/operators/_hmac.md +78 -0
  214. package/content/operators/_js.md +2 -1
  215. package/content/operators/_location.md +1 -1
  216. package/content/operators/_media.md +13 -0
  217. package/content/operators/_module.md +56 -2
  218. package/content/operators/_operator.md +17 -3
  219. package/content/operators/_path_params.md +82 -0
  220. package/content/operators/_ref.md +258 -0
  221. package/content/operators/_request.md +1 -1
  222. package/content/operators/_request_details.md +6 -0
  223. package/content/operators/_type.md +14 -3
  224. package/content/operators/_url_query.md +2 -0
  225. package/content/operators/_user.md +3 -3
  226. package/content/plugins/plugins-actions.md +10 -0
  227. package/content/plugins/plugins-connections.md +25 -0
  228. package/content/plugins/plugins-dev.md +66 -0
  229. package/content/plugins/plugins-icon-sets.md +267 -0
  230. package/content/plugins/plugins-introduction.md +27 -1
  231. package/content/plugins/plugins.md +19 -0
  232. package/content/plugins/posthog.md +359 -0
  233. package/content/provider-reference/auth-js-providers.md +107 -0
  234. package/content/provider-reference/openidconnectprovider.md +44 -0
  235. package/content/recipes/recipes.md +16 -0
  236. package/content/reference/actions-reference.md +31 -0
  237. package/content/reference/blocks-reference.md +35 -0
  238. package/content/reference/cli.md +403 -0
  239. package/content/reference/connections-reference.md +23 -0
  240. package/content/reference/operators-reference.md +47 -0
  241. package/content/reference/reference.md +16 -0
  242. package/content/reference/schema-reference.md +12 -0
  243. package/content/testing/config-tests.md +677 -0
  244. package/content/testing/e2e-configuration.md +31 -1
  245. package/content/testing/e2e-getting-started.md +1 -1
  246. package/content/testing/e2e-introduction.md +1 -1
  247. package/content/testing/e2e-writing-tests.md +12 -1
  248. package/content/testing/explore-pull-request.md +136 -0
  249. package/content/testing/journey-data-sets.md +326 -0
  250. package/content/tutorial/tutorial-actions-operators.md +2 -2
  251. package/content/tutorial/tutorial-add-blocks.md +2 -2
  252. package/content/tutorial/tutorial-create-page.md +48 -2
  253. package/content/tutorial/tutorial-display-data-page.md +3 -3
  254. package/content/tutorial/tutorial-requests-api.md +155 -0
  255. package/content/tutorial/tutorial-requests-sql.md +153 -0
  256. package/content/tutorial/tutorial-start.md +66 -1
  257. package/content/user-authentication/auth-configuration.md +267 -0
  258. package/content/user-authentication/auth-providers.md +24 -0
  259. package/content/user-authentication/auth-steps.md +141 -0
  260. package/content/user-authentication/login-and-logout.md +160 -8
  261. package/content/user-authentication/mcp-oauth.md +424 -0
  262. package/content/user-authentication/organizations.md +246 -0
  263. package/content/user-authentication/protected-pages-apis.md +97 -0
  264. package/content/user-authentication/roles.md +49 -0
  265. package/content/user-authentication/two-factor.md +229 -0
  266. package/content/user-authentication/user-object.md +58 -0
  267. package/content/user-authentication/users-introduction.md +8 -0
  268. package/content/websockets/websocket-publish.md +105 -0
  269. package/content/websockets/websocket-subscriptions.md +136 -0
  270. package/content/websockets/websockets-introduction.md +101 -0
  271. package/hazards.json +44 -0
  272. package/index.json +3691 -14
  273. package/package.json +11 -1
  274. package/scripts/collectImportedFiles.js +80 -0
  275. package/scripts/extractAgentDocs.js +41 -30
  276. package/scripts/hashDocSources.js +38 -0
  277. package/scripts/isRedirectPage.js +26 -0
  278. package/scripts/recordSourceHashes.js +100 -0
  279. package/scripts/resolvePageSections.js +42 -0
  280. package/scripts/sectionKind.js +27 -0
  281. package/content/concepts/cli.md +0 -223
  282. package/content/other/introduction.md +0 -39
  283. package/content/other/next-auth-providers.md +0 -3
  284. /package/content/{other → actions}/updatesession.md +0 -0
@@ -1,5 +1,51 @@
1
1
  # 2. Creating a page
2
2
 
3
+ Let's create a page for a web form where users can log a new ticket.
4
+
5
+ #### 2.1. Create `new-ticket.yaml`
6
+
7
+ Create a new YAML file in the project directory (the same directory as the `lowdefy.yaml` file) called `new-ticket.yaml`, with the following content:
8
+
9
+ ```yaml
10
+ id: new-ticket
11
+ type: PageHeaderMenu
12
+ properties:
13
+ title: New ticket # The title in the browser tab.
14
+ layout:
15
+ justify: center # Center the contents of the page.
16
+ blocks:
17
+ - id: content_card
18
+ type: Card
19
+ layout:
20
+ size: 800 # Set the size of the card so it does not fill the full screen.
21
+ gap: 16 # Make a 16px gap between all blocks in this card.
22
+ blocks:
23
+ - id: page_heading
24
+ type: Title
25
+ properties:
26
+ content: Log a ticket # Change the title on the page.
27
+ level: 3 # Make the title a little smaller (an html `<h3>`).
28
+ ```
29
+
30
+ #### 2.2. Update `lowdefy.yaml`
31
+
32
+ Change the `lowdefy.yaml` to look like this:
33
+
34
+ ```yaml
35
+ name: lowdefy-project-template
36
+ lowdefy: 7.0.0
37
+
38
+ pages:
39
+ ################ -------- Copy from here -------- ################
40
+ - _ref: new-ticket.yaml
41
+ ################ -------- Copy to here ---------- ################
42
+ - id: welcome
43
+ type: PageHeaderMenu
44
+ properties:
45
+ title: Welcome
46
+ # ...
47
+ ```
48
+
3
49
  > Indentation is important
4
50
 
5
51
  #### 2.3. Navigate to the new page
@@ -33,13 +79,13 @@ menus:
33
79
  - id: new-ticket
34
80
  type: MenuLink
35
81
  properties:
36
- icon: AiOutlineAlert
82
+ icon: Siren
37
83
  title: New ticket
38
84
  pageId: new-ticket
39
85
  - id: welcome
40
86
  type: MenuLink
41
87
  properties:
42
- icon: AiOutlineHome
88
+ icon: home
43
89
  title: Home
44
90
  pageId: welcome
45
91
  ################ -------- Copy to here ---------- ################
@@ -140,20 +140,20 @@ menus:
140
140
  - id: welcome
141
141
  type: MenuLink
142
142
  properties:
143
- icon: AiOutlineHome
143
+ icon: home
144
144
  title: Home
145
145
  pageId: welcome
146
146
  - id: new-ticket
147
147
  type: MenuLink
148
148
  properties:
149
- icon: AiOutlineAlert
149
+ icon: Siren
150
150
  title: New ticket
151
151
  pageId: new-ticket
152
152
  ################ -------- Copy from here -------- ################
153
153
  - id: view-tickets
154
154
  type: MenuLink
155
155
  properties:
156
- icon: AiOutlineDatabase
156
+ icon: Database
157
157
  title: View tickets
158
158
  pageId: view-tickets
159
159
  ############### -------- Copy to here ---------- ################
@@ -0,0 +1,155 @@
1
+ # 5. API / HTTP requests
2
+
3
+ If you have been following along, you can continue with your current config. Else, you can find the config from the previous section [here](https://github.com/lowdefy/lowdefy-example-tutorial/tree/main/04-interactive-pages).
4
+
5
+ We will now add a `AxiosHttp` [connection and request](/connections-and-requests) to get the list of products that tickets can be logged for from an external API endpoint.
6
+
7
+ ## Configuring the AxiosHttp Connection and Request
8
+
9
+ We want to add a [`Selector`](/Selector) block to our form that will allow the user to select which product they are logging a ticket about, from a preset list of options. This list of preset product options will be obtained from the [DummyJSON](https://dummyjson.com/) API.
10
+
11
+ For this, we will make use of an [`AxiosHttp`](/AxiosHttp) connection as described in the following steps:
12
+
13
+ #### 5.1. Adding a new connection to the app
14
+
15
+ In your `lowdefy.yaml` file, add the following:
16
+
17
+ ##### `lowdefy.yaml`
18
+
19
+ ```yaml
20
+ name: lowdefy-project-template
21
+ version: 7.0.0
22
+
23
+ ################ -------- Copy from here -------- ################
24
+ connections:
25
+ - id: dummy_api
26
+ type: AxiosHttp
27
+ properties:
28
+ baseURL: https://dummyjson.com/
29
+ ################ ------- Copy to here ----------- ################
30
+
31
+ menus:
32
+ # ...
33
+ ```
34
+
35
+ #### 5.2. Adding a request to the page
36
+
37
+ In your `new-ticket.yaml` file, add the following request:
38
+
39
+ ##### `pages/new-ticket.yaml`
40
+
41
+ ```yaml
42
+ id: new-ticket
43
+ type: PageHeaderMenu
44
+ ################ -------- Copy from here -------- ################
45
+ requests:
46
+ - id: get_products
47
+ type: AxiosHttp
48
+ connectionId: dummy_api
49
+ properties:
50
+ url: /products
51
+ ################ ------- Copy to here ----------- ################
52
+
53
+ properties:
54
+ title: New ticket # The title in the browser tab.
55
+ layout:
56
+ justify: center # Center the contents of the page
57
+ blocks:
58
+ # ...
59
+ ```
60
+
61
+ #### 5.3. Triggering the request on page load
62
+
63
+ In your `new-ticket.yaml` file, add an onMount event that calls `get_products` request:
64
+
65
+ ##### `pages/new-ticket.yaml`
66
+
67
+ ```yaml
68
+ requests:
69
+ - id: get_products
70
+ type: AxiosHttp
71
+ connectionId: dummy_api
72
+ properties:
73
+ url: /products
74
+
75
+ ################ -------- Copy from here -------- ################
76
+ events:
77
+ onMount:
78
+ - id: fetch_products
79
+ type: Request
80
+ params: get_products
81
+ ################ ------- Copy to here ----------- ################
82
+
83
+ properties:
84
+ title: New ticket # The title in the browser tab.
85
+ layout:
86
+ justify: center # Center the contents of the page
87
+ blocks:
88
+ # ...
89
+ ```
90
+
91
+ #### 5.4. Using the request response as selector options
92
+
93
+ In your `new-ticket.yaml` file, add the a Selector block and populate it with the results from the `get_products` request. We will make use of [`_array.map`](/_array#map_title) operator to get the product titles from the response obtained from the request. This is done as follows:
94
+
95
+ ##### `pages/new-ticket.yaml`
96
+
97
+ ```yaml
98
+ id: new-ticket
99
+ # ...
100
+ blocks:
101
+ - id: content_card
102
+ # ...
103
+ blocks:
104
+ - id: page_heading
105
+ type: Title
106
+ properties:
107
+ content: Log a ticket # Change the title on the page.
108
+ level: 3 # Make the title a little smaller (an html `<h3>`).
109
+ - id: ticket_title
110
+ type: TextInput
111
+ properties:
112
+ title: Title
113
+ - id: ticket_type
114
+ type: ButtonSelector
115
+ properties:
116
+ title: Ticket type
117
+ options: # Set the allowed options
118
+ - Suggestion
119
+ - Complaint
120
+ - Question
121
+
122
+ ################ ------- Copy from here -------- ################
123
+ - id: product
124
+ type: Selector
125
+ required: true
126
+ properties:
127
+ title: Product
128
+ options:
129
+ # Map over API response to create an array of product titles
130
+ _array.map:
131
+ # use dot notation to access value in response object properties
132
+ - _request: get_products.data.products
133
+ - _function:
134
+ __args: 0.title
135
+ ################ ------- Copy to here -------- ################
136
+
137
+ - id: ticket_description
138
+ type: TextArea
139
+ properties:
140
+ title: Description
141
+ ```
142
+
143
+ ### What happened
144
+
145
+ We defined the [`AxiosHttp`](/AxiosHttp) connection to be used to obtain the list of products that tickets can be created for.
146
+
147
+ We also defined an [`AxiosHttp`](/AxiosHttp) request, to fetch the products data when the page is mounted. To do this, we used the onMount event to execute the Request action to make the API call.
148
+
149
+ We then mapped the request response to the product selector options by using the [_request](/_request) and [_array.map](/_array#map_title) operators.
150
+
151
+ > You can find the final configuration files for this section [here](https://github.com/lowdefy/lowdefy-example-tutorial/tree/main/05-requests-api).
152
+
153
+ ### Up next
154
+
155
+ Next we will save the form data to a SQLite database file.
@@ -20,3 +20,156 @@ We will make use of an SQLite database with a table called `tickets`, that has t
20
20
  - created_date
21
21
 
22
22
  The database used in this tutorial can be downloaded <a href="/tutorial/tutorial_db.sqlite" download>here</a>.
23
+
24
+ Alternatively, install [SQLite](https://www.sqlite.org/) on your computer and use the following to create the needed table:
25
+
26
+ ```
27
+ CREATE TABLE tickets (
28
+ ticket_title varchar(100),
29
+ ticket_type varchar(50),
30
+ ticket_description varchar(200),
31
+ product varchar(100),
32
+ purchase_in_last_month real,
33
+ created_date real
34
+ );
35
+ ```
36
+
37
+ #### 6.2. Setting app environment variables
38
+
39
+ Create a file called `.env` in your project directory with the following content:
40
+
41
+ ##### `.env`
42
+ ```
43
+ LOWDEFY_SECRET_SQLITE_FILENAME= __ABSOLUTE_PATH_TO_SQLITE_DB_FILE__
44
+ ```
45
+
46
+ #### 5.2.3. Setting the connection environment variable secrets
47
+
48
+ In your `lowdefy.yaml` file, add the following:
49
+
50
+ ##### `lowdefy.yaml`
51
+
52
+ ```yaml
53
+ name: lowdefy-project-template
54
+ version: 7.0.0
55
+
56
+ connections:
57
+ # ...
58
+ ################ -------- Copy from here -------- ################
59
+ - id: knex
60
+ type: Knex
61
+ properties:
62
+ client: sqlite
63
+ connection:
64
+ filename:
65
+ _secret: SQLITE_FILENAME
66
+ ################ ------- Copy to here ----------- ################
67
+
68
+ menus:
69
+ # ...
70
+ ```
71
+
72
+ #### 6.3. Creating a save data request
73
+
74
+ In your `new-ticket.yaml` file, add the following request:
75
+
76
+ ##### `pages/new-ticket.yaml`
77
+
78
+ ```yaml
79
+ id: new-ticket
80
+ type: PageHeaderMenu
81
+ requests:
82
+ # ...
83
+ ################ -------- Copy from here -------- ################
84
+ - id: save_new_ticket
85
+ type: KnexRaw
86
+ connectionId: knex
87
+ payload:
88
+ _state: true
89
+ properties:
90
+ query: |
91
+ INSERT INTO tickets (
92
+ ticket_title,
93
+ ticket_type,
94
+ ticket_description,
95
+ product,
96
+ purchase_in_last_month,
97
+ created_date)
98
+ VALUES(
99
+ :ticket_title,
100
+ :ticket_type,
101
+ :ticket_description,
102
+ :product,
103
+ :purchase_in_last_month,
104
+ :created_date)
105
+ parameters:
106
+ ticket_title:
107
+ _payload: ticket_title
108
+ ticket_type:
109
+ _payload: ticket_type
110
+ ticket_description:
111
+ _payload: ticket_description
112
+ product:
113
+ _payload: product
114
+ purchase_in_last_month:
115
+ _payload: purchase_in_last_month
116
+ created_date:
117
+ _date: now
118
+ ################ ------- Copy to here ----------- ################
119
+
120
+ properties:
121
+ title: New ticket # The title in the browser tab.
122
+ layout:
123
+ justify: center # Center the contents of the page
124
+ blocks:
125
+ # ...
126
+ ```
127
+
128
+ #### 6.4. Triggering the save data request
129
+
130
+ In your `new-ticket.yaml` file, add the following action to the submit button:
131
+
132
+ ##### `pages/new-ticket.yaml`
133
+
134
+ ```yaml
135
+ id: new-ticket
136
+ # ...
137
+ blocks:
138
+ - id: content_card
139
+ # ...
140
+ blocks:
141
+ - id: page_heading
142
+ # ...
143
+ # ...
144
+ # ...
145
+ - id: submit_button
146
+ type: Button
147
+ #...
148
+ events:
149
+ onClick:
150
+ - id: validate
151
+ type: Validate
152
+ ################ -------- Copy from here -------- ################
153
+ - id: save_new_ticket # Make a request to the SQLite database
154
+ type: Request
155
+ params: save_new_ticket
156
+ - id: reset # Reset the form once data has been submitted
157
+ type: Reset
158
+ ################ ------- Copy to here ----------- ################
159
+ ```
160
+
161
+ If you click the submit button, your form data should be added into the tickets table.
162
+
163
+ ### What happened
164
+
165
+ We set up the table and column names we will be using in our SQLite database. We need to do this to use the `SQLite` connection.
166
+
167
+ We defined the `Knex` connection, with the SQLite client.
168
+
169
+ We also defined a `KnexRaw` request, to save the data to our SQLite database, and called that request when clicking the submit button. This was done by making use of the `onCLick` event on the button to execute the [`Request`](/Request) action to make the API call.
170
+
171
+ > You can find the final configuration files for this section [here](https://github.com/lowdefy/lowdefy-example-tutorial/tree/main/06-requests-sql).
172
+
173
+ ### Up next
174
+
175
+ Next, we will add a new page to display all open tickets an a table.
@@ -4,7 +4,7 @@ In this tutorial, we will be creating a simple ticketing app that allows users t
4
4
 
5
5
  ### Requirements
6
6
 
7
- The Lowdefy CLI (Command Line Interface) is needed to run the development server. To run the Lowdefy CLI you need to install Node.js at version 22 or greater. If you don't have it installed, download Node.js from https://nodejs.org/en/download/, and follow the installation steps for your computer. All of the default settings given by the installer are fine for what we need. You will also need a text editor to modify the Lowdefy configuration files.
7
+ The Lowdefy CLI (Command Line Interface) is needed to run the development server. To run the Lowdefy CLI you need to install Node.js at version 24 or greater. If you don't have it installed, download Node.js from https://nodejs.org/en/download/, and follow the installation steps for your computer. All of the default settings given by the installer are fine for what we need. You will also need a text editor to modify the Lowdefy configuration files.
8
8
 
9
9
  Lowdefy also requires [`pnpm`](https://pnpm.io/) to be installed. We recommend making activating [Corepack](https://nodejs.org/api/corepack.html), even though it is an experimental feature, as this is the simplest way to install `pnpm`. Alternative methods to install `pnpm` can also be found [here](https://pnpm.io/installation). To activate Corepack, run the following in your computer's command line interface (Windows CMD, Terminal on MacOS).
10
10
 
@@ -58,6 +58,71 @@ Made by a Lowdefy 🤖
58
58
 
59
59
  > __Error: Could not find "lowdefy.yaml"__: Make sure your current working directory contains the _lowdefy.yaml_ file. You can verify this by running the `dir` (Windows) or `ls` (MacOS) command.
60
60
 
61
+ #### 1.5. Open the configuration file
62
+
63
+ Open the `lowdefy.yaml` file using a text editor like [VS Code](https://code.visualstudio.com/download). The content of the file should look like this:
64
+
65
+ ```yaml
66
+ lowdefy: 7.0.0
67
+ name: Lowdefy starter
68
+
69
+ pages:
70
+ - id: welcome
71
+ type: PageHeaderMenu
72
+ properties:
73
+ title: Welcome
74
+ slots:
75
+ content:
76
+ justify: center
77
+ blocks:
78
+ - id: content_card
79
+ type: Card
80
+ style:
81
+ maxWidth: 800
82
+ blocks:
83
+ - id: content
84
+ type: Result
85
+ properties:
86
+ title: Welcome to your Lowdefy app
87
+ subTitle: We are excited to see what you are going to build
88
+ icon:
89
+ name: heart
90
+ color: '#f00'
91
+ slots:
92
+ extra:
93
+ blocks:
94
+ - id: docs_button
95
+ type: Button
96
+ properties:
97
+ size: large
98
+ title: Let's build something
99
+ events:
100
+ onClick:
101
+ - id: link_to_docs
102
+ type: Link
103
+ params:
104
+ url: https://docs.lowdefy.com
105
+ newWindow: true
106
+ footer:
107
+ blocks:
108
+ - id: footer
109
+ type: Paragraph
110
+ properties:
111
+ type: secondary
112
+ content: |
113
+ Made by a Lowdefy 🤖
114
+ ```
115
+
116
+ This configuration completely describes the app you are running.
117
+
118
+ #### 1.6. Make some changes
119
+
120
+ Let's modify the button to link to the Lowdefy Discord community instead of to the Lowdefy docs.
121
+
122
+ First, change `Let's build something` to `Join Lowdefy on Discord`, then save the file. Your page should automatically refresh and you should see the changed text of the button.
123
+
124
+ Next, update the link url to the Lowdefy Discord link, replace `https://docs.lowdefy.com` with [`https://discord.gg/QQY9eJ7A2D`](https://discord.gg/QQY9eJ7A2D), then save the file. If you now click the button it should open a new window linking to the Lowdefy Discord Channel - Join our community to ask questions or learn more regarding Lowdefy ❤️
125
+
61
126
  ### What happened
62
127
 
63
128
  The Lowdefy CLI helps you develop a Lowdefy app.