@diagonal-hq/pages 0.5.0 → 0.5.2

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 (2) hide show
  1. package/dist/index.d.ts +26 -6
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -6542,7 +6542,7 @@ export type SdkHooks = {
6542
6542
  * Keys are isolated from the app's other React Query caches. Begin a key with
6543
6543
  * `'records'` when the endpoint's result depends on resource records, for example
6544
6544
  * `['records', resource.id, 'summary']`; successful resource create/update/delete/restore
6545
- * operations then invalidate it automatically. Other keys refresh only through their
6545
+ * operations and record form submits then invalidate it automatically. Other keys refresh only through their
6546
6546
  * returned `invalidate` function.
6547
6547
  *
6548
6548
  * Keep the key the same between renders. A clock read such as `Date.now()` in the key
@@ -7781,6 +7781,9 @@ export type SdkHooks = {
7781
7781
  * `form.errors` contains only 422 field validation. Other failures are available
7782
7782
  * as `form.failure`; for example, branch on
7783
7783
  * `Sdk.utils.error.isConflict(form.failure)` without inspecting status codes.
7784
+ * A successful submit refreshes no other page data. Call the `invalidate()` of the
7785
+ * data that the workflow changed in `onSuccess`, or `Sdk.hooks.useInvalidateAll()`
7786
+ * when the page cannot name it.
7784
7787
  * Success callbacks receive the parsed workflow body directly. Synchronous
7785
7788
  * output can be a scalar, list, record, or object; asynchronous workflows return
7786
7789
  * `{ execution_id }`. Narrow the value before reading authored output fields.
@@ -7866,6 +7869,12 @@ export type SdkHooks = {
7866
7869
  * `reset()` also starts a fresh key lifecycle. The hook does not poll asynchronous
7867
7870
  * executions.
7868
7871
  *
7872
+ * A successful run refreshes no other page data. When the workflow changes data that
7873
+ * the page shows, call that data's `invalidate()` in `onSuccess`. Use
7874
+ * `Sdk.hooks.useInvalidateAll()` only when the page cannot name what changed. A
7875
+ * workflow that only reads, such as a search called inside a `Sdk.hooks.useApi`
7876
+ * fetcher, needs no `onSuccess`.
7877
+ *
7869
7878
  * @example
7870
7879
  * ```tsx
7871
7880
  * function ReserveButton({ slotId }) {
@@ -11057,8 +11066,8 @@ export type FormFieldInputProps = {
11057
11066
 
11058
11067
  /**
11059
11068
  * Prefix segments for `context.errors` lookups. Location fields read
11060
- * `<prefix>.<subfield>` errors for `line1`, `line2`, `city`, `state`,
11061
- * `postal_code`, and `country`. Pass `['display_address']` for errors such as
11069
+ * `<prefix>.<subfield>` errors for `display_name`, `line1`, `line2`, `city`,
11070
+ * `state`, `postal_code`, and `country`. Pass `['display_address']` for errors such as
11062
11071
  * `display_address.line1`, shown beside Address line 1.
11063
11072
  * Nested inline-create drafts append their draft index and child field key,
11064
11073
  * so a caller rendering the `files` relation passes `['files']` for errors
@@ -11632,9 +11641,15 @@ export type FormLocationInputProps = PrimitiveFormFieldProps & {
11632
11641
 
11633
11642
  /**
11634
11643
  * Per-subfield validation errors, keyed by address field name
11635
- * (`line1`, `line2`, `city`, `state`, `postal_code`, `country`).
11644
+ * (`display_name`, `line1`, `line2`, `city`, `state`, `postal_code`, `country`).
11636
11645
  */
11637
11646
  errors?: LocationAddressFormErrors;
11647
+
11648
+ /**
11649
+ * Show the editable Display name row above Address line 1 in the expanded fields.
11650
+ * Defaults to `true`. Pass `false` on a form that should not collect a display name.
11651
+ */
11652
+ showDisplayName?: boolean;
11638
11653
  };
11639
11654
 
11640
11655
  export type LocationValue = {
@@ -11652,7 +11667,10 @@ export type LocationValue = {
11652
11667
  };
11653
11668
 
11654
11669
  export type LocationAddressFormErrors = Partial<
11655
- Record<'line1' | 'line2' | 'city' | 'state' | 'postal_code' | 'country', string | string[]>
11670
+ Record<
11671
+ 'display_name' | 'line1' | 'line2' | 'city' | 'state' | 'postal_code' | 'country',
11672
+ string | string[]
11673
+ >
11656
11674
  >;
11657
11675
 
11658
11676
  export type FormMarkdownInputProps = Omit<
@@ -14239,7 +14257,9 @@ export type WorkflowFormProps = {
14239
14257
  * suppress. */
14240
14258
  successMessage?: string | null;
14241
14259
 
14242
- /** Called after a successful submission with the workflow's response payload. */
14260
+ /** Called after a successful submission with the workflow's response payload. A
14261
+ * submission refreshes no other page data, so call the `invalidate()` of the data
14262
+ * that the workflow changed here. */
14243
14263
  onSuccess?: (response: SdkWorkflowResponse) => void;
14244
14264
 
14245
14265
  /** Called when the submission resolves with a non-2xx response, with
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diagonal-hq/pages",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "The Page SDK for the pages of file-based Diagonal workspaces.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {