@lowdefy/docs-content 6.0.0 → 7.0.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.
- package/README.md +1 -0
- package/content/actions/downloadcsv.md +1 -1
- package/content/actions/emailotpsend.md +58 -0
- package/content/actions/emailotpverify.md +79 -0
- package/content/actions/getlocalstorage.md +43 -0
- package/content/actions/link.md +47 -1
- package/content/actions/login.md +25 -5
- package/content/actions/logout.md +7 -5
- package/content/actions/magiclinkverify.md +117 -0
- package/content/actions/pdfmake.md +2 -2
- package/content/actions/posthogalias.md +29 -0
- package/content/actions/posthogcapture.md +49 -0
- package/content/actions/posthogcapturepageleave.md +38 -0
- package/content/actions/posthogfeatureflag.md +50 -0
- package/content/actions/posthoggroup.md +37 -0
- package/content/actions/posthogidentify.md +54 -0
- package/content/actions/posthoginit.md +96 -0
- package/content/actions/posthogoptin.md +29 -0
- package/content/actions/posthogoptout.md +29 -0
- package/content/actions/posthogpageview.md +37 -0
- package/content/actions/posthogreloadfeatureflags.md +47 -0
- package/content/actions/posthogreset.md +28 -0
- package/content/actions/posthogsetpersonproperties.md +36 -0
- package/content/actions/removelocalstorage.md +28 -0
- package/content/actions/resetvalidation.md +5 -3
- package/content/actions/setdarkmode.md +3 -3
- package/content/actions/setglobal.md +2 -0
- package/content/actions/setlocale.md +1 -1
- package/content/actions/setlocalstorage.md +34 -0
- package/content/actions/setstate.md +2 -0
- package/content/actions/validate.md +7 -4
- package/content/adapter-reference/mongodbauthadapter.md +46 -0
- package/content/agents/agent-endpoint-tools.md +24 -0
- package/content/agents/agent-properties.md +13 -3
- package/content/agents/agent-server-hooks.md +1 -1
- package/content/agents/agentchat.md +41 -4
- package/content/agents/agentconversations.md +42 -8
- package/content/agents/agents-introduction.md +107 -0
- package/content/callback-reference/auth0logoutcallback.md +54 -0
- package/content/concepts/ai-agent-docs.md +455 -106
- package/content/concepts/blocks.md +150 -0
- package/content/concepts/connections-and-requests.md +402 -0
- package/content/concepts/custom-html.md +42 -0
- package/content/concepts/custom-styling.md +50 -5
- package/content/concepts/dynamic-page-content.md +309 -0
- package/content/concepts/events-and-actions.md +185 -2
- package/content/concepts/four-primitives.md +31 -0
- package/content/concepts/html-attributes.md +293 -0
- package/content/concepts/i18n.md +12 -3
- package/content/concepts/keyboard-shortcuts.md +2 -2
- package/content/concepts/layout-overview.md +1 -1
- package/content/concepts/logger.md +99 -0
- package/content/concepts/lowdefy-api.md +1319 -0
- package/content/concepts/lowdefy-schema.md +144 -3
- package/content/concepts/menus.md +8 -7
- package/content/concepts/module-authoring.md +76 -5
- package/content/concepts/modules.md +3 -1
- package/content/concepts/notifications.md +180 -0
- package/content/concepts/operators.md +7 -0
- package/content/concepts/page-and-app-state.md +252 -0
- package/content/concepts/page-paths.md +209 -0
- package/content/concepts/theming.md +582 -0
- package/content/connections/aigateway.md +375 -0
- package/content/connections/anthropic.md +169 -2
- package/content/connections/awss3.md +178 -2
- package/content/connections/axioshttp.md +181 -0
- package/content/connections/google.md +169 -2
- package/content/connections/mongodb.md +1014 -3
- package/content/connections/openai-connection.md +169 -2
- package/content/connections/sendgridmail.md +3 -0
- package/content/connections/smtp.md +16 -0
- package/content/connections/treg.md +329 -0
- package/content/container-blocks/affix.md +47 -7
- package/content/container-blocks/alert.md +76 -24
- package/content/container-blocks/badge.md +100 -24
- package/content/container-blocks/box.md +9 -9
- package/content/container-blocks/card.md +132 -27
- package/content/container-blocks/carousel.md +60 -7
- package/content/container-blocks/collapse.md +153 -9
- package/content/container-blocks/configprovider.md +35 -13
- package/content/container-blocks/confirmmodal.md +69 -23
- package/content/container-blocks/content.md +62 -98
- package/content/container-blocks/descriptions.md +45 -4
- package/content/container-blocks/drawer.md +139 -28
- package/content/container-blocks/dropdownmenu.md +119 -31
- package/content/container-blocks/flex.md +40 -62
- package/content/container-blocks/footer.md +15 -11
- package/content/container-blocks/googlemapsheatmap.md +1 -1
- package/content/container-blocks/googlemapsscript.md +2 -2
- package/content/container-blocks/header.md +71 -36
- package/content/container-blocks/label.md +34 -7
- package/content/container-blocks/layout.md +52 -34
- package/content/container-blocks/masonry.md +17 -71
- package/content/container-blocks/mobilemenu.md +131 -88
- package/content/container-blocks/modal.md +161 -26
- package/content/container-blocks/pageheadermenu.md +138 -31
- package/content/container-blocks/pagesidebarlayout.md +230 -27
- package/content/container-blocks/pagesidermenu.md +153 -43
- package/content/container-blocks/popover.md +34 -31
- package/content/container-blocks/result.md +32 -21
- package/content/container-blocks/sider.md +85 -122
- package/content/container-blocks/span.md +7 -7
- package/content/container-blocks/spinner.md +3 -3
- package/content/container-blocks/splitter.md +150 -68
- package/content/container-blocks/tabs.md +64 -12
- package/content/container-blocks/tooltip.md +22 -46
- package/content/container-blocks/watermark.md +22 -4
- package/content/controls/parallel_for.md +21 -2
- package/content/controls/reject.md +26 -3
- package/content/controls/return.md +17 -1
- package/content/controls/throw.md +30 -2
- package/content/controls/try.md +24 -2
- package/content/controls/while.md +46 -0
- package/content/deployment/deployment-environments.md +146 -0
- package/content/deployment/docker.md +23 -7
- package/content/deployment/node-server.md +4 -0
- package/content/deployment/vercel.md +25 -19
- package/content/display-blocks/aggrid.md +33 -16
- package/content/display-blocks/anchor.md +16 -15
- package/content/display-blocks/avatar.md +57 -37
- package/content/display-blocks/breadcrumb.md +70 -21
- package/content/display-blocks/button.md +93 -19
- package/content/display-blocks/calendar.md +12 -0
- package/content/display-blocks/clickablehtml.md +239 -0
- package/content/display-blocks/dangeroushtml.md +1 -1
- package/content/display-blocks/difflist.md +1 -1
- package/content/display-blocks/difftimeline.md +1 -1
- package/content/display-blocks/divider.md +64 -3
- package/content/display-blocks/dropdownbutton.md +81 -30
- package/content/display-blocks/echart.md +35 -1
- package/content/display-blocks/eventlog.md +363 -0
- package/content/display-blocks/floatbutton.md +129 -42
- package/content/display-blocks/html.md +61 -1
- package/content/display-blocks/icon.md +250 -67
- package/content/display-blocks/img.md +2 -2
- package/content/display-blocks/menu.md +146 -73
- package/content/display-blocks/message.md +38 -124
- package/content/display-blocks/notification.md +94 -222
- package/content/display-blocks/paragraph.md +59 -9
- package/content/display-blocks/pollingtimer.md +263 -0
- package/content/display-blocks/progress.md +96 -17
- package/content/display-blocks/qrcode.md +19 -4
- package/content/display-blocks/s3download.md +1 -1
- package/content/display-blocks/search.md +19 -9
- package/content/display-blocks/skeletonbutton.md +1 -0
- package/content/display-blocks/skeletoninput.md +1 -0
- package/content/display-blocks/statistic.md +75 -17
- package/content/display-blocks/steps.md +58 -25
- package/content/display-blocks/table.md +2527 -0
- package/content/display-blocks/tablelight.md +621 -0
- package/content/display-blocks/tag.md +102 -17
- package/content/display-blocks/title.md +50 -11
- package/content/display-blocks/tour.md +33 -23
- package/content/input-blocks/autocomplete.md +81 -9
- package/content/input-blocks/buttonselector.md +45 -8
- package/content/input-blocks/captcha.md +40 -0
- package/content/input-blocks/checkboxselector.md +97 -7
- package/content/input-blocks/checkboxswitch.md +33 -3
- package/content/input-blocks/colorselector.md +63 -14
- package/content/input-blocks/daterangeselector.md +165 -45
- package/content/input-blocks/dateselector.md +139 -41
- package/content/input-blocks/datetimeselector.md +158 -49
- package/content/input-blocks/inputgallery.md +3 -3
- package/content/input-blocks/intentinput.md +207 -0
- package/content/input-blocks/monthselector.md +120 -52
- package/content/input-blocks/multipleselector.md +150 -39
- package/content/input-blocks/numberinput.md +98 -12
- package/content/input-blocks/pagination.md +70 -14
- package/content/input-blocks/paragraphinput.md +51 -37
- package/content/input-blocks/passwordinput.md +60 -6
- package/content/input-blocks/phonenumberinput.md +59 -26
- package/content/input-blocks/placesautocomplete.md +319 -0
- package/content/input-blocks/radioselector.md +83 -7
- package/content/input-blocks/ratingslider.md +57 -26
- package/content/input-blocks/s3uploadbutton.md +24 -24
- package/content/input-blocks/s3uploaddragger.md +3 -3
- package/content/input-blocks/s3uploadphoto.md +5 -5
- package/content/input-blocks/segmentedselector.md +72 -32
- package/content/input-blocks/selector.md +109 -21
- package/content/input-blocks/switch.md +65 -17
- package/content/input-blocks/tableinput.md +445 -0
- package/content/input-blocks/tagmultipleselector.md +114 -0
- package/content/input-blocks/tagselector.md +114 -0
- package/content/input-blocks/textarea.md +32 -3
- package/content/input-blocks/textinput.md +70 -29
- package/content/input-blocks/tiptapinput.md +1 -1
- package/content/input-blocks/tiptapmentioninput.md +2 -2
- package/content/input-blocks/titleinput.md +39 -12
- package/content/input-blocks/treeinput.md +49 -25
- package/content/input-blocks/treemultipleselector.md +127 -10
- package/content/input-blocks/treeselector.md +97 -9
- package/content/input-blocks/upload.md +64 -15
- package/content/input-blocks/uploaddragger.md +17 -1
- package/content/input-blocks/uploadphoto.md +18 -1
- package/content/input-blocks/weekselector.md +120 -55
- package/content/learn/introduction.md +27 -0
- package/content/learn/quickstart.md +53 -0
- package/content/learn/showcase.md +8 -0
- package/content/list-blocks/controlledlist.md +24 -15
- package/content/list-blocks/list.md +11 -11
- package/content/list-blocks/masonrylist.md +7 -34
- package/content/migration/auth-upgrade.md +337 -0
- package/content/migration/upgrade-guide.md +1 -0
- package/content/migration/v3-to-v4.md +417 -0
- package/content/migration/v6-to-v7.md +620 -0
- package/content/operators/_agent.md +155 -0
- package/content/operators/_app.md +2 -1
- package/content/operators/_array.md +122 -1
- package/content/operators/_build.md +1 -0
- package/content/operators/_credential.md +57 -0
- package/content/operators/_cron.md +292 -0
- package/content/operators/_date.md +2 -0
- package/content/operators/_error.md +196 -0
- package/content/operators/_get.md +6 -6
- package/content/operators/_hmac.md +78 -0
- package/content/operators/_js.md +2 -1
- package/content/operators/_location.md +1 -1
- package/content/operators/_media.md +13 -0
- package/content/operators/_module.md +56 -2
- package/content/operators/_operator.md +17 -3
- package/content/operators/_path_params.md +82 -0
- package/content/operators/_ref.md +258 -0
- package/content/operators/_request.md +1 -1
- package/content/operators/_request_details.md +6 -0
- package/content/operators/_type.md +14 -3
- package/content/operators/_url_query.md +2 -0
- package/content/operators/_user.md +3 -3
- package/content/plugins/plugins-actions.md +10 -0
- package/content/plugins/plugins-connections.md +25 -0
- package/content/plugins/plugins-dev.md +66 -0
- package/content/plugins/plugins-icon-sets.md +267 -0
- package/content/plugins/plugins-introduction.md +27 -1
- package/content/plugins/plugins.md +19 -0
- package/content/plugins/posthog.md +359 -0
- package/content/provider-reference/auth-js-providers.md +107 -0
- package/content/provider-reference/openidconnectprovider.md +44 -0
- package/content/recipes/recipes.md +16 -0
- package/content/reference/actions-reference.md +31 -0
- package/content/reference/blocks-reference.md +35 -0
- package/content/reference/cli.md +403 -0
- package/content/reference/connections-reference.md +23 -0
- package/content/reference/operators-reference.md +47 -0
- package/content/reference/reference.md +16 -0
- package/content/reference/schema-reference.md +12 -0
- package/content/testing/config-tests.md +677 -0
- package/content/testing/e2e-configuration.md +31 -1
- package/content/testing/e2e-getting-started.md +1 -1
- package/content/testing/e2e-introduction.md +1 -1
- package/content/testing/e2e-writing-tests.md +12 -1
- package/content/testing/explore-pull-request.md +136 -0
- package/content/testing/journey-data-sets.md +326 -0
- package/content/tutorial/tutorial-actions-operators.md +2 -2
- package/content/tutorial/tutorial-add-blocks.md +2 -2
- package/content/tutorial/tutorial-create-page.md +48 -2
- package/content/tutorial/tutorial-display-data-page.md +3 -3
- package/content/tutorial/tutorial-requests-api.md +155 -0
- package/content/tutorial/tutorial-requests-sql.md +153 -0
- package/content/tutorial/tutorial-start.md +66 -1
- package/content/user-authentication/auth-configuration.md +267 -0
- package/content/user-authentication/auth-providers.md +24 -0
- package/content/user-authentication/auth-steps.md +141 -0
- package/content/user-authentication/login-and-logout.md +160 -8
- package/content/user-authentication/mcp-oauth.md +424 -0
- package/content/user-authentication/organizations.md +246 -0
- package/content/user-authentication/protected-pages-apis.md +97 -0
- package/content/user-authentication/roles.md +49 -0
- package/content/user-authentication/two-factor.md +229 -0
- package/content/user-authentication/user-object.md +58 -0
- package/content/user-authentication/users-introduction.md +8 -0
- package/content/websockets/websocket-publish.md +105 -0
- package/content/websockets/websocket-subscriptions.md +136 -0
- package/content/websockets/websockets-introduction.md +101 -0
- package/hazards.json +56 -0
- package/index.json +3472 -14
- package/package.json +10 -1
- package/scripts/extractAgentDocs.js +41 -30
- package/scripts/hashDocSources.js +38 -0
- package/scripts/isRedirectPage.js +26 -0
- package/scripts/recordSourceHashes.js +97 -0
- package/scripts/resolvePageSections.js +42 -0
- package/scripts/sectionKind.js +27 -0
- package/content/concepts/cli.md +0 -223
- package/content/other/introduction.md +0 -39
- package/content/other/next-auth-providers.md +0 -3
- /package/content/{other → actions}/updatesession.md +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# PostHogFeatureFlag
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(params: {
|
|
5
|
+
key: string,
|
|
6
|
+
default?: any,
|
|
7
|
+
enabled?: boolean,
|
|
8
|
+
payload?: boolean,
|
|
9
|
+
}): Promise<any>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The `PostHogFeatureFlag` action reads a PostHog feature flag and returns its value, so it can be used further down the action chain with the [`_actions`](/_actions) operator.
|
|
13
|
+
|
|
14
|
+
The value is whatever PostHog resolved for this person when flags were last loaded; the action does not wait for a network call. When the person or their groups just changed, reload the flags first with [`PostHogReloadFeatureFlags`](/PostHogReloadFeatureFlags).
|
|
15
|
+
|
|
16
|
+
Reading a flag value, with or without `enabled`, sends a `$feature_flag_called` event to PostHog, which is what PostHog experiments use to count exposures. Reading a payload does not.
|
|
17
|
+
|
|
18
|
+
When PostHog is disabled, not initialised, or `posthog-js` could not be loaded, the action returns `default`. Invalid params always throw, even when PostHog is disabled.
|
|
19
|
+
|
|
20
|
+
The action is part of the [`@lowdefy/plugin-posthog`](/PostHog) plugin, which is included by default. See the [PostHog guide](/PostHog) for how the actions fit together.
|
|
21
|
+
|
|
22
|
+
#### Parameters
|
|
23
|
+
|
|
24
|
+
###### object
|
|
25
|
+
- `key: string`: __Required__ - The feature flag key.
|
|
26
|
+
- `default: any`: Returned when the flag has no value for this person, and when PostHog is disabled. Defaults to `null`.
|
|
27
|
+
- `enabled: boolean`: Return a boolean, using `isFeatureEnabled`, instead of the variant value.
|
|
28
|
+
- `payload: boolean`: Return the flag payload, using `getFeatureFlagPayload`, instead of the flag value. Takes precedence over `enabled`.
|
|
29
|
+
|
|
30
|
+
#### Response
|
|
31
|
+
|
|
32
|
+
The flag value, the payload, or a boolean, depending on the params. `default` when the flag has no value.
|
|
33
|
+
|
|
34
|
+
#### Examples
|
|
35
|
+
|
|
36
|
+
###### Store a flag variant in state:
|
|
37
|
+
```yaml
|
|
38
|
+
events:
|
|
39
|
+
onMount:
|
|
40
|
+
- id: read_flag
|
|
41
|
+
type: PostHogFeatureFlag
|
|
42
|
+
params:
|
|
43
|
+
key: new-checkout
|
|
44
|
+
default: control
|
|
45
|
+
- id: store_flag
|
|
46
|
+
type: SetState
|
|
47
|
+
params:
|
|
48
|
+
checkout_variant:
|
|
49
|
+
_actions: read_flag.response
|
|
50
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# PostHogGroup
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(params: {
|
|
5
|
+
type: string,
|
|
6
|
+
key: string,
|
|
7
|
+
properties?: object,
|
|
8
|
+
}): Promise<null>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The `PostHogGroup` action associates the current person with a group, so events can be analysed per organization, team or account. The association sticks until [`PostHogReset`](/PostHogReset) is called, so run it after [`PostHogIdentify`](/PostHogIdentify). Group types have to be enabled on the PostHog project.
|
|
12
|
+
|
|
13
|
+
When PostHog is disabled or `posthog-js` could not be loaded, the action does nothing. Invalid params always throw, even when PostHog is disabled.
|
|
14
|
+
|
|
15
|
+
The action is part of the [`@lowdefy/plugin-posthog`](/PostHog) plugin, which is included by default. See the [PostHog guide](/PostHog) for how the actions fit together.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
###### object
|
|
20
|
+
- `type: string`: __Required__ - The group type, for example `organization`.
|
|
21
|
+
- `key: string`: __Required__ - The id of the group instance.
|
|
22
|
+
- `properties: object`: Group properties.
|
|
23
|
+
|
|
24
|
+
#### Examples
|
|
25
|
+
|
|
26
|
+
###### Associate the person with their organization:
|
|
27
|
+
```yaml
|
|
28
|
+
- id: set_group
|
|
29
|
+
type: PostHogGroup
|
|
30
|
+
params:
|
|
31
|
+
type: organization
|
|
32
|
+
key:
|
|
33
|
+
_user: organizationId
|
|
34
|
+
properties:
|
|
35
|
+
plan:
|
|
36
|
+
_user: plan
|
|
37
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# PostHogIdentify
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(params: {
|
|
5
|
+
id?: string | null,
|
|
6
|
+
properties?: object,
|
|
7
|
+
propertiesOnce?: object,
|
|
8
|
+
}): Promise<null>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The `PostHogIdentify` action ties the current browser session to a person in [PostHog](https://posthog.com). Run it once the user is known, usually right after [`PostHogInit`](/PostHogInit) in the shared page `onInit` actions, or after a successful login.
|
|
12
|
+
|
|
13
|
+
A missing, `null` or empty `id` is a no-op, so on a public page the anonymous session is left alone. That anonymous session is what a later `PostHogIdentify` merges into the person, which is what makes signup funnels work.
|
|
14
|
+
|
|
15
|
+
The action is safe to run on every page. It reads the identity `posthog-js` already holds:
|
|
16
|
+
|
|
17
|
+
- __Same person__: when `id` is already the current `distinct_id`, it only updates the person properties, if any are given. `posthog-js` skips a property update identical to the previous one.
|
|
18
|
+
- __Person swap__: PostHog refuses to move an identified `distinct_id` onto a different person, so when the browser is identified as someone else, the action calls `reset()` before identifying the new person.
|
|
19
|
+
- __Anonymous visitor__: identified without a reset, so the anonymous session merges into the person.
|
|
20
|
+
|
|
21
|
+
Never send personally identifiable information as a person property.
|
|
22
|
+
|
|
23
|
+
When PostHog is disabled or `posthog-js` could not be loaded, the action does nothing. Invalid params always throw, even when PostHog is disabled.
|
|
24
|
+
|
|
25
|
+
The action is part of the [`@lowdefy/plugin-posthog`](/PostHog) plugin, which is included by default. See the [PostHog guide](/PostHog) for how the actions fit together.
|
|
26
|
+
|
|
27
|
+
#### Parameters
|
|
28
|
+
|
|
29
|
+
###### object
|
|
30
|
+
- `id: string`: The person's id.
|
|
31
|
+
- `properties: object`: Person properties to set. `null` and `undefined` values are dropped, so an absent value never overwrites one PostHog already has.
|
|
32
|
+
- `propertiesOnce: object`: Person properties that are only set the first time, for example a signup date.
|
|
33
|
+
|
|
34
|
+
#### Examples
|
|
35
|
+
|
|
36
|
+
###### Identify the logged in user on every page:
|
|
37
|
+
```yaml
|
|
38
|
+
# shared/posthog_init.yaml
|
|
39
|
+
- id: init_posthog
|
|
40
|
+
type: PostHogInit
|
|
41
|
+
params:
|
|
42
|
+
apiKey:
|
|
43
|
+
_build.env: POSTHOG_API_KEY
|
|
44
|
+
- id: identify_person
|
|
45
|
+
type: PostHogIdentify
|
|
46
|
+
params:
|
|
47
|
+
id:
|
|
48
|
+
_user: id
|
|
49
|
+
properties:
|
|
50
|
+
role:
|
|
51
|
+
_user: role
|
|
52
|
+
locale:
|
|
53
|
+
_locale: active
|
|
54
|
+
```
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# PostHogInit
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(params: {
|
|
5
|
+
apiKey?: string,
|
|
6
|
+
apiHost?: string,
|
|
7
|
+
options?: object,
|
|
8
|
+
debug?: boolean,
|
|
9
|
+
enabled?: boolean,
|
|
10
|
+
captureEventFailures?: boolean,
|
|
11
|
+
maskDataText?: boolean,
|
|
12
|
+
}): Promise<null>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The `PostHogInit` action downloads and initialises the [PostHog](https://posthog.com) `posthog-js` browser SDK. Every other PostHog action does nothing until it has run, so run it from the app's root `events.onInitAsync` in `lowdefy.yaml`, which runs once per app load on whichever page opens first and does not hold the first render.
|
|
16
|
+
|
|
17
|
+
`PostHogInit` is idempotent: the first call loads PostHog, and later calls with the same `apiKey` do nothing, so running it from every page's events instead is also safe. Calling it with a different `apiKey` throws, because a second PostHog instance would split the session. With `enabled: false`, `posthog-js` is never downloaded and every other PostHog action becomes a silent no-op. A later call with `enabled: true` still loads PostHog; a call with `enabled: false` after PostHog was loaded throws.
|
|
18
|
+
|
|
19
|
+
Every event carries the deployment environment: when the app declares [`config.environments`](/lowdefy-schema), `PostHogInit` registers the current environment's name (`LOWDEFY_ENVIRONMENT`) as the `environment` super property, so staging and production events can be told apart in one PostHog project. It also registers `lowdefy_build_id` and `lowdefy_app_version` (the app's `version`), so events can be split before and after a deploy, and a `lowdefy_config_key` can be mapped back to the config of the build that sent it.
|
|
20
|
+
|
|
21
|
+
Events carry Lowdefy semantics. Autocaptured clicks, rage clicks and dead clicks get `lowdefy_page_id`, `lowdefy_block_id`, `lowdefy_block_type`, `lowdefy_block_ids` (every enclosing block, innermost first), `lowdefy_option: true` on a dropdown option, `lowdefy_text` (the text of the control the click reached, such as a button or menu item, even when the click landed on its icon or a wrapper) and, inside a grid, `lowdefy_row` and `lowdefy_column`. Every other event gets `lowdefy_page_id`. This adds properties only, never events, and has no switch. A block with the `ph-no-capture` class is not autocaptured, so it is never enriched.
|
|
22
|
+
|
|
23
|
+
Click text that shows the app's data never leaves the browser. On every event, a clicked text (`$el_text`, `lowdefy_text`, the `text` entries of `$elements_chain` and `$elements`, `$selected_content` and link targets) is kept only when the config of the page, the menus, the i18n messages or the antd locale spell it out, so grid and table cell values, options and menu items a request fills, labels built from records and `Dynamic` block output are removed, while button titles, menu and tab labels, column headers, literal options and modal __OK__ and __Cancel__ stay. Element attributes other than the tag, classes, `class`, `role`, `type`, `row-index`, `col-id`, `nth-child` and `nth-of-type` are removed, including `title`, `aria-label`, `value`, `placeholder`, `alt` and `data-*`, and `id` is kept only as a block wrapper id (`bl-<blockId>`). Classes and `data-ph-capture-attribute-<name>` values (sent as property `<name>`) are not masked, so never build them from data. The other `lowdefy_*` properties stay, so a click on data still records its block, row and column. URLs are not masked: `$current_url`, `$pathname`, query values and `lowdefy_path_params` are sent unchanged. Set `maskDataText: false` to send full click text, or `options.mask_all_text: true` to send none. A block `class` of `ph-sensitive` masks that block's config text too, but only within the block's own DOM: popups it renders into the page body (`Dropdown` and `DropdownButton` items, table and grid `MenuCell` menus, `Modal`, `Drawer`) are outside it. Session replay is not covered: set `options.session_recording.maskTextSelector: '*'` to mask all text in recordings, or give a block a `class` of `ph-mask`. See [Click text masking](/PostHog#click-text-masking).
|
|
24
|
+
|
|
25
|
+
When a block or app event fails, `PostHogInit` captures a `lowdefy_event_failed` event with `lowdefy_event_scope` (`page` or `app`), `lowdefy_page_id`, `lowdefy_block_id`, `lowdefy_block_type`, `lowdefy_event_name`, `lowdefy_debounce_ms`, `lowdefy_action_id`, `lowdefy_action_type`, `lowdefy_error_name`, `lowdefy_config_key` and `lowdefy_invalid_blocks` (the blocks a `Validate` found invalid). It carries ids only, never error messages or values, and is timestamped when the event's actions started. Failures in the app's `onInit` and in the first page's `onInit` are captured too, although `PostHogInit` runs later in `onInitAsync`: Lowdefy holds up to 20 failures until PostHog starts. At most 50 are captured per app load, held failures included. Set `captureEventFailures: false` to turn it off.
|
|
26
|
+
|
|
27
|
+
An environment with `posthog: { enabled: false }` in `config.environments` switches PostHog off there: `PostHogInit` behaves as `enabled: false` whatever its params say, needs no `apiKey`, and every other PostHog action is a no-op.
|
|
28
|
+
|
|
29
|
+
If `posthog-js` fails to download, for example on a flaky network, a warning is logged to the browser console and the other PostHog actions do nothing.
|
|
30
|
+
|
|
31
|
+
The action is part of the [`@lowdefy/plugin-posthog`](/PostHog) plugin, which is included by default. See the [PostHog guide](/PostHog) for how the actions fit together.
|
|
32
|
+
|
|
33
|
+
#### Parameters
|
|
34
|
+
|
|
35
|
+
###### object
|
|
36
|
+
- `apiKey: string`: __Required__ unless `enabled` is `false` - The PostHog project API key. This is a public, write only key that is meant to ship in the browser bundle, so read it with [`_build.env`](/_build). Never use a personal API key here.
|
|
37
|
+
- `apiHost: string`: The PostHog ingestion host. Defaults to `https://us.i.posthog.com`. Use `https://eu.i.posthog.com` for the EU cloud, or the host of a self hosted instance.
|
|
38
|
+
- `options: object`: Passed through to `posthog.init` as its config object. Set `capture_pageview: history_change` to capture a pageview on every client side navigation. Other common options are `person_profiles`, `capture_pageleave`, `autocapture`, `disable_session_recording`, `persistence` and `opt_out_capturing_by_default`. See the [posthog-js config reference](https://posthog.com/docs/libraries/js/config).
|
|
39
|
+
- `debug: boolean`: Log everything PostHog does to the browser console.
|
|
40
|
+
- `enabled: boolean`: Set to `false` to skip loading PostHog. Defaults to `true`.
|
|
41
|
+
- `captureEventFailures: boolean`: Capture a `lowdefy_event_failed` event when a block or app event fails. Defaults to `true`.
|
|
42
|
+
- `maskDataText: boolean`: Mask click text that the page config, menus, i18n messages or antd locale do not spell out, and element attributes outside the structural allow-list, before events are sent. Set to `false` to send full click text. Defaults to `true`.
|
|
43
|
+
|
|
44
|
+
#### Response
|
|
45
|
+
|
|
46
|
+
`null`, once `posthog-js` has loaded.
|
|
47
|
+
|
|
48
|
+
#### Examples
|
|
49
|
+
|
|
50
|
+
###### Initialise PostHog once per app load:
|
|
51
|
+
```yaml
|
|
52
|
+
# lowdefy.yaml
|
|
53
|
+
events:
|
|
54
|
+
onInitAsync:
|
|
55
|
+
_ref: shared/posthog_init.yaml
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```yaml
|
|
59
|
+
# shared/posthog_init.yaml
|
|
60
|
+
- id: init_posthog
|
|
61
|
+
type: PostHogInit
|
|
62
|
+
params:
|
|
63
|
+
apiKey:
|
|
64
|
+
_build.env: POSTHOG_API_KEY
|
|
65
|
+
enabled:
|
|
66
|
+
_build.ne:
|
|
67
|
+
- _build.env: POSTHOG_API_KEY
|
|
68
|
+
- null
|
|
69
|
+
options:
|
|
70
|
+
capture_pageview: history_change
|
|
71
|
+
person_profiles: identified_only
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
With `POSTHOG_API_KEY` unset, for example in local development, `enabled` is `false` and PostHog is never loaded.
|
|
75
|
+
|
|
76
|
+
###### Turn off the failure event:
|
|
77
|
+
```yaml
|
|
78
|
+
- id: init_posthog
|
|
79
|
+
type: PostHogInit
|
|
80
|
+
params:
|
|
81
|
+
apiKey:
|
|
82
|
+
_build.env: POSTHOG_API_KEY
|
|
83
|
+
captureEventFailures: false
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
###### Send full click text:
|
|
87
|
+
```yaml
|
|
88
|
+
- id: init_posthog
|
|
89
|
+
type: PostHogInit
|
|
90
|
+
params:
|
|
91
|
+
apiKey:
|
|
92
|
+
_build.env: POSTHOG_API_KEY
|
|
93
|
+
maskDataText: false
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Only turn masking off when the people who use the app have agreed that PostHog may store the data they click on.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# PostHogOptIn
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(void): Promise<null>
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
The `PostHogOptIn` action starts capturing for this person. Pair it with [`PostHogOptOut`](/PostHogOptOut) and a [`PostHogInit`](/PostHogInit) that sets `options.opt_out_capturing_by_default: true` when consent is required before any data is sent. The choice is remembered in the persistence store configured on `PostHogInit`.
|
|
8
|
+
|
|
9
|
+
When PostHog is disabled or `posthog-js` could not be loaded, the action does nothing.
|
|
10
|
+
|
|
11
|
+
The action is part of the [`@lowdefy/plugin-posthog`](/PostHog) plugin, which is included by default. See the [PostHog guide](/PostHog) for how the actions fit together.
|
|
12
|
+
|
|
13
|
+
#### Parameters
|
|
14
|
+
|
|
15
|
+
The `PostHogOptIn` action does not take any parameters.
|
|
16
|
+
|
|
17
|
+
#### Examples
|
|
18
|
+
|
|
19
|
+
###### Accept analytics from a consent banner:
|
|
20
|
+
```yaml
|
|
21
|
+
- id: accept_analytics
|
|
22
|
+
type: Button
|
|
23
|
+
properties:
|
|
24
|
+
title: Accept
|
|
25
|
+
events:
|
|
26
|
+
onClick:
|
|
27
|
+
- id: opt_in
|
|
28
|
+
type: PostHogOptIn
|
|
29
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# PostHogOptOut
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(void): Promise<null>
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
The `PostHogOptOut` action stops capturing for this person. The choice is remembered in the persistence store configured on [`PostHogInit`](/PostHogInit). See [`PostHogOptIn`](/PostHogOptIn) for consent flows.
|
|
8
|
+
|
|
9
|
+
When PostHog is disabled or `posthog-js` could not be loaded, the action does nothing.
|
|
10
|
+
|
|
11
|
+
The action is part of the [`@lowdefy/plugin-posthog`](/PostHog) plugin, which is included by default. See the [PostHog guide](/PostHog) for how the actions fit together.
|
|
12
|
+
|
|
13
|
+
#### Parameters
|
|
14
|
+
|
|
15
|
+
The `PostHogOptOut` action does not take any parameters.
|
|
16
|
+
|
|
17
|
+
#### Examples
|
|
18
|
+
|
|
19
|
+
###### Reject analytics from a consent banner:
|
|
20
|
+
```yaml
|
|
21
|
+
- id: reject_analytics
|
|
22
|
+
type: Button
|
|
23
|
+
properties:
|
|
24
|
+
title: Reject
|
|
25
|
+
events:
|
|
26
|
+
onClick:
|
|
27
|
+
- id: opt_out
|
|
28
|
+
type: PostHogOptOut
|
|
29
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# PostHogPageview
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(params: {
|
|
5
|
+
properties?: object,
|
|
6
|
+
}): Promise<null>
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
The `PostHogPageview` action captures a `$pageview` event by hand.
|
|
10
|
+
|
|
11
|
+
A Lowdefy app routes on the client without a page load, so the `posthog-js` default only captures the first page. The simplest fix is to set `capture_pageview: history_change` in the [`PostHogInit`](/PostHogInit) options, which captures a pageview on every navigation, and not use this action at all. Use `PostHogPageview` when pageviews need extra properties or tighter control: set `capture_pageview: false` and run it from each page's `onMountAsync` event.
|
|
12
|
+
|
|
13
|
+
When PostHog is disabled or `posthog-js` could not be loaded, the action does nothing. Invalid params always throw, even when PostHog is disabled.
|
|
14
|
+
|
|
15
|
+
The action is part of the [`@lowdefy/plugin-posthog`](/PostHog) plugin, which is included by default. See the [PostHog guide](/PostHog) for how the actions fit together.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
###### object
|
|
20
|
+
- `properties: object`: Properties to add to the `$pageview` event.
|
|
21
|
+
|
|
22
|
+
#### Examples
|
|
23
|
+
|
|
24
|
+
###### Capture pageviews by hand:
|
|
25
|
+
```yaml
|
|
26
|
+
id: reports
|
|
27
|
+
type: PageHeaderMenu
|
|
28
|
+
events:
|
|
29
|
+
onInit:
|
|
30
|
+
_ref: shared/posthog_init.yaml # PostHogInit with options.capture_pageview: false
|
|
31
|
+
onMountAsync:
|
|
32
|
+
- id: capture_pageview
|
|
33
|
+
type: PostHogPageview
|
|
34
|
+
params:
|
|
35
|
+
properties:
|
|
36
|
+
section: reports
|
|
37
|
+
```
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# PostHogReloadFeatureFlags
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(params: {
|
|
5
|
+
timeout?: integer,
|
|
6
|
+
}): Promise<{ flags: string[], variants: object }>
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
The `PostHogReloadFeatureFlags` action asks PostHog to evaluate this person's feature flags again, and resolves once the new flags have arrived. Run it after [`PostHogIdentify`](/PostHogIdentify) or [`PostHogGroup`](/PostHogGroup) changed the targeting, then read the flags from its response or with [`PostHogFeatureFlag`](/PostHogFeatureFlag).
|
|
10
|
+
|
|
11
|
+
It resolves with empty results if PostHog does not answer within `timeout` milliseconds, so a flaky network can never stall the action chain. When PostHog is disabled or `posthog-js` could not be loaded, it resolves with empty results straight away.
|
|
12
|
+
|
|
13
|
+
The action is part of the [`@lowdefy/plugin-posthog`](/PostHog) plugin, which is included by default. See the [PostHog guide](/PostHog) for how the actions fit together.
|
|
14
|
+
|
|
15
|
+
#### Parameters
|
|
16
|
+
|
|
17
|
+
###### object
|
|
18
|
+
- `timeout: integer`: Milliseconds to wait for PostHog to answer. Defaults to `5000`. Must not be negative.
|
|
19
|
+
|
|
20
|
+
#### Response
|
|
21
|
+
|
|
22
|
+
An object:
|
|
23
|
+
- `flags: string[]`: The keys of the flags enabled for this person.
|
|
24
|
+
- `variants: object`: Every flag key mapped to its value.
|
|
25
|
+
|
|
26
|
+
When PostHog does not answer in time, or is disabled, the response is `{ flags: [], variants: {} }`.
|
|
27
|
+
|
|
28
|
+
#### Examples
|
|
29
|
+
|
|
30
|
+
###### Reload flags after switching organization:
|
|
31
|
+
```yaml
|
|
32
|
+
- id: set_group
|
|
33
|
+
type: PostHogGroup
|
|
34
|
+
params:
|
|
35
|
+
type: organization
|
|
36
|
+
key:
|
|
37
|
+
_state: organization_id
|
|
38
|
+
- id: reload_flags
|
|
39
|
+
type: PostHogReloadFeatureFlags
|
|
40
|
+
params:
|
|
41
|
+
timeout: 3000
|
|
42
|
+
- id: store_flags
|
|
43
|
+
type: SetState
|
|
44
|
+
params:
|
|
45
|
+
feature_flags:
|
|
46
|
+
_actions: reload_flags.response.variants
|
|
47
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# PostHogReset
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(params: {
|
|
5
|
+
resetDeviceId?: boolean,
|
|
6
|
+
}): Promise<null>
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
The `PostHogReset` action forgets the current person and starts a fresh anonymous session. Run it on sign out so the next person on a shared browser is not merged into this one.
|
|
10
|
+
|
|
11
|
+
When PostHog is disabled or `posthog-js` could not be loaded, the action does nothing. Invalid params always throw, even when PostHog is disabled.
|
|
12
|
+
|
|
13
|
+
The action is part of the [`@lowdefy/plugin-posthog`](/PostHog) plugin, which is included by default. See the [PostHog guide](/PostHog) for how the actions fit together.
|
|
14
|
+
|
|
15
|
+
#### Parameters
|
|
16
|
+
|
|
17
|
+
###### object
|
|
18
|
+
- `resetDeviceId: boolean`: Also generate a new device id, so the browser is not recognised as the same device. Defaults to `false`.
|
|
19
|
+
|
|
20
|
+
#### Examples
|
|
21
|
+
|
|
22
|
+
###### Reset PostHog on sign out:
|
|
23
|
+
```yaml
|
|
24
|
+
- id: reset_posthog
|
|
25
|
+
type: PostHogReset
|
|
26
|
+
- id: logout
|
|
27
|
+
type: Logout
|
|
28
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# PostHogSetPersonProperties
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(params: {
|
|
5
|
+
set?: object,
|
|
6
|
+
setOnce?: object,
|
|
7
|
+
}): Promise<null>
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
The `PostHogSetPersonProperties` action updates the properties of the person [`PostHogIdentify`](/PostHogIdentify) identified. Each call is a billable event; `posthog-js` skips a call identical to the previous one. Never send personally identifiable information.
|
|
11
|
+
|
|
12
|
+
When PostHog is disabled or `posthog-js` could not be loaded, the action does nothing. Invalid params always throw, even when PostHog is disabled.
|
|
13
|
+
|
|
14
|
+
The action is part of the [`@lowdefy/plugin-posthog`](/PostHog) plugin, which is included by default. See the [PostHog guide](/PostHog) for how the actions fit together.
|
|
15
|
+
|
|
16
|
+
#### Parameters
|
|
17
|
+
|
|
18
|
+
###### object
|
|
19
|
+
At least one of `set` or `setOnce` is required.
|
|
20
|
+
- `set: object`: Person properties to set.
|
|
21
|
+
- `setOnce: object`: Person properties that are only set if the person does not have them yet.
|
|
22
|
+
|
|
23
|
+
#### Examples
|
|
24
|
+
|
|
25
|
+
###### Record a plan change:
|
|
26
|
+
```yaml
|
|
27
|
+
- id: set_person_properties
|
|
28
|
+
type: PostHogSetPersonProperties
|
|
29
|
+
params:
|
|
30
|
+
set:
|
|
31
|
+
plan:
|
|
32
|
+
_state: selected_plan
|
|
33
|
+
setOnce:
|
|
34
|
+
first_plan:
|
|
35
|
+
_state: selected_plan
|
|
36
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# RemoveLocalStorage
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(params: {
|
|
5
|
+
key: string
|
|
6
|
+
}): void
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
The `RemoveLocalStorage` action removes a key from the browser's [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage). Removing a key that is not set does nothing.
|
|
10
|
+
|
|
11
|
+
Keys are kept per app, under a key that names the app's `slug` and base path. The action removes the app's key, and a value left under the bare key from before keys were kept per app.
|
|
12
|
+
|
|
13
|
+
Keys starting with `lowdefy_` or `lf-` are reserved for settings Lowdefy stores itself, such as the dark mode preference, and the action throws an error if one is used. If the browser blocks local storage, the action fails with an error that is shown to the user and triggers the event's `catch` actions, but is not logged as an app error.
|
|
14
|
+
|
|
15
|
+
#### Parameters
|
|
16
|
+
|
|
17
|
+
###### object
|
|
18
|
+
- `key: string`: __Required__ - The local storage key to remove. Keys starting with `lowdefy_` or `lf-` are reserved.
|
|
19
|
+
|
|
20
|
+
#### Examples
|
|
21
|
+
|
|
22
|
+
###### Clear a stored preference:
|
|
23
|
+
```yaml
|
|
24
|
+
- id: clear_preference
|
|
25
|
+
type: RemoveLocalStorage
|
|
26
|
+
params:
|
|
27
|
+
key: dashboard_filters
|
|
28
|
+
```
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
(blockId: string): void
|
|
6
6
|
(blockIds: string[]): void
|
|
7
7
|
(params: {
|
|
8
|
-
|
|
8
|
+
blockIds?: string|string[],
|
|
9
9
|
regex?: string|string[],
|
|
10
10
|
}): void
|
|
11
11
|
```
|
|
@@ -16,6 +16,8 @@ By default when a page is opened, no validation flags are set on any input field
|
|
|
16
16
|
|
|
17
17
|
The `ResetValidation` action `blockIds` or `regex` params are used to limit which blocks validation errors and warnings should be reset.
|
|
18
18
|
|
|
19
|
+
When the action runs in a list row, `$` in a blockId is replaced with the row index, as in `SetState` and `CallMethod`, so `list.$.name` matches the `name` input in the same row. `$` in a `regex` pattern keeps its regex meaning.
|
|
20
|
+
|
|
19
21
|
#### Parameters
|
|
20
22
|
|
|
21
23
|
###### void
|
|
@@ -28,7 +30,7 @@ A blockId of the block for which to lower validation flags.
|
|
|
28
30
|
An array of blockIds of the blocks for which to lower validation flags.
|
|
29
31
|
|
|
30
32
|
###### object
|
|
31
|
-
- `
|
|
33
|
+
- `blockIds?: string|string[]`: A blockId or an array of the blockIds of the blocks for which to lower validation flags
|
|
32
34
|
- `regex?: string|string[]`: A regex string pattern or an array of regex string patterns to match the blockIds for which to lower validation flags.
|
|
33
35
|
|
|
34
36
|
#### Examples
|
|
@@ -78,7 +80,7 @@ An array of blockIds of the blocks for which to lower validation flags.
|
|
|
78
80
|
- id: reset_foo_price_and_my_input
|
|
79
81
|
type: ResetValidation
|
|
80
82
|
params:
|
|
81
|
-
|
|
83
|
+
blockIds: my_input
|
|
82
84
|
regex:
|
|
83
85
|
- ^foo\.
|
|
84
86
|
- ^.*price.*$
|
|
@@ -12,7 +12,7 @@ The `SetDarkMode` action sets the user's dark mode preference. When called witho
|
|
|
12
12
|
- `'light'`: Force light mode.
|
|
13
13
|
- `'dark'`: Force dark mode.
|
|
14
14
|
|
|
15
|
-
The preference is persisted to `localStorage
|
|
15
|
+
The preference is persisted to `localStorage`, per app, and triggers re-rendering of the root Ant Design `ConfigProvider`. All blocks and `_media: darkMode` expressions update automatically.
|
|
16
16
|
|
|
17
17
|
> **Note:** If the app's `theme.darkMode` config is set to `'light'` or `'dark'`, the developer has locked the mode. `SetDarkMode` still stores the user's preference, but it won't take visual effect until the config is changed to `'system'`.
|
|
18
18
|
|
|
@@ -33,8 +33,8 @@ The preference is persisted to `localStorage` and triggers re-rendering of the r
|
|
|
33
33
|
_if:
|
|
34
34
|
test:
|
|
35
35
|
_media: darkMode
|
|
36
|
-
then:
|
|
37
|
-
else:
|
|
36
|
+
then: Sun
|
|
37
|
+
else: Moon
|
|
38
38
|
events:
|
|
39
39
|
onClick:
|
|
40
40
|
- id: toggle
|
|
@@ -8,6 +8,8 @@ The `SetGlobal` action sets values to the `global` object. It takes an object as
|
|
|
8
8
|
This is useful if you need to set a value that needs to be available across multiple pages in the app, like the id of a currently selected
|
|
9
9
|
object. `SetGlobal` works just like [`SetState`](/SetState), except it sets to the `global` object and not `state`.
|
|
10
10
|
|
|
11
|
+
To set global values once when the app loads, before the first page's events run, use `SetGlobal` in the app [`onInit` or `onInitAsync` events](/events-and-actions#app-events).
|
|
12
|
+
|
|
11
13
|
#### Parameters
|
|
12
14
|
|
|
13
15
|
###### object
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
}): void
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
The `SetLocale` action sets the user's active locale preference for the app. The preference is persisted to `localStorage
|
|
9
|
+
The `SetLocale` action sets the user's active locale preference for the app. The preference is persisted to `localStorage`, per app, and triggers re-rendering of the root Ant Design `ConfigProvider`. All blocks, `_t` translations, `_locale` operators, antd-built-in strings (date pickers, modals, validation), and dayjs date formatting update automatically.
|
|
10
10
|
|
|
11
11
|
- `locale`: A BCP 47 code declared in `config.i18n.locales` (e.g. `'en-US'`, `'de-DE'`).
|
|
12
12
|
- `'auto'` (or no params): Clears the user preference. The app falls back to the browser language best-fit, then to `config.i18n.defaultLocale`.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# SetLocalStorage
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
(params: {
|
|
5
|
+
key: string,
|
|
6
|
+
value: any
|
|
7
|
+
}): void
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
The `SetLocalStorage` action stores a value in the browser's [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage), under the given key. Values are serialized, so objects, arrays and dates are read back as the same types by the [`GetLocalStorage`](/GetLocalStorage) action.
|
|
11
|
+
|
|
12
|
+
Local storage is per browser and it is not sent to the server. Keys are kept per app: Lowdefy stores the value under a key that names the app's `slug` and base path, so apps served from the same origin do not read or overwrite each other's values. A value stored under the bare key before keys were kept per app is moved to the app's key the first time `GetLocalStorage` reads it.
|
|
13
|
+
|
|
14
|
+
Values set with this action are kept when a user signs out, so the next person to use the browser can read them. Do not store secrets, tokens or personal data in it.
|
|
15
|
+
|
|
16
|
+
Keys starting with `lowdefy_` or `lf-` are reserved for settings Lowdefy stores itself, such as the dark mode preference, and the action throws an error if one is used. If the browser blocks local storage, or the storage quota is full, the action fails with an error that is shown to the user and triggers the event's `catch` actions, but is not logged as an app error.
|
|
17
|
+
|
|
18
|
+
#### Parameters
|
|
19
|
+
|
|
20
|
+
###### object
|
|
21
|
+
- `key: string`: __Required__ - The local storage key to write to. Keys starting with `lowdefy_` or `lf-` are reserved.
|
|
22
|
+
- `value: any`: __Required__ - The value to store.
|
|
23
|
+
|
|
24
|
+
#### Examples
|
|
25
|
+
|
|
26
|
+
###### Remember a user preference:
|
|
27
|
+
```yaml
|
|
28
|
+
- id: save_preference
|
|
29
|
+
type: SetLocalStorage
|
|
30
|
+
params:
|
|
31
|
+
key: dashboard_filters
|
|
32
|
+
value:
|
|
33
|
+
_state: filters
|
|
34
|
+
```
|
|
@@ -8,6 +8,8 @@ The `SetState` action sets values in `state`. It takes an object as parameters,
|
|
|
8
8
|
This is useful if you want to initialize `state`, set a flag after an action has executed (eg. to disable a button), or to set the result
|
|
9
9
|
of a request to state.
|
|
10
10
|
|
|
11
|
+
Setting a parent object to `{}` or `null` does not clear an input that is hidden at that moment. A hidden input's value is removed from `state` but kept by the input, so the input writes its old value back when it shows again. To clear a form that has hidden inputs, set each input's own key, for example `contact.name: null`.
|
|
12
|
+
|
|
11
13
|
#### Parameters
|
|
12
14
|
|
|
13
15
|
###### object
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
(void): void
|
|
5
5
|
(blockId: string): void
|
|
6
6
|
(blockIds: string[]): void
|
|
7
|
-
(blockIds: string[]): void
|
|
8
7
|
(params: {
|
|
9
|
-
|
|
8
|
+
blockIds?: string|string[],
|
|
10
9
|
regex?: string|string[],
|
|
11
10
|
}): void
|
|
12
11
|
```
|
|
@@ -18,6 +17,10 @@ The first time a `Validate` action is called, validation errors and warnings are
|
|
|
18
17
|
|
|
19
18
|
The `Validate` action `blockIds` or `regex` params are used to limit which blocks are validated. Only the matched blocks will be validated, and validation results are shown for only those matched blocks.
|
|
20
19
|
|
|
20
|
+
Matching does not cascade to child blocks. A container's blockId matches only the container, which has no validation of its own, so the action validates nothing and succeeds. A blockId that matches no block also succeeds. To validate the inputs inside a container, match their blockIds, for example with `regex: ^contact\.` for inputs under `contact`.
|
|
21
|
+
|
|
22
|
+
When the action runs in a list row, `$` in a blockId is replaced with the row index, as in `SetState` and `CallMethod`, so `list.$.name` matches the `name` input in the same row. `$` in a `regex` pattern keeps its regex meaning.
|
|
23
|
+
|
|
21
24
|
#### Parameters
|
|
22
25
|
|
|
23
26
|
###### void
|
|
@@ -30,7 +33,7 @@ A blockId of the block to validate.
|
|
|
30
33
|
An array of blockIds of the blocks to validate.
|
|
31
34
|
|
|
32
35
|
###### object
|
|
33
|
-
- `
|
|
36
|
+
- `blockIds?: string|string[]`: A blockId or an array of the blockIds of the blocks to validate.
|
|
34
37
|
- `regex?: string|string[]`: A regex string pattern or an array of regex string patterns to match the blockIds to validate.
|
|
35
38
|
|
|
36
39
|
#### Examples
|
|
@@ -80,7 +83,7 @@ An array of blockIds of the blocks to validate.
|
|
|
80
83
|
- id: validate_foo_price_and_my_input
|
|
81
84
|
type: Validate
|
|
82
85
|
params:
|
|
83
|
-
|
|
86
|
+
blockIds: my_input
|
|
84
87
|
regex:
|
|
85
88
|
- ^foo\.
|
|
86
89
|
- ^.*price.*$
|