@ukiahinsure/a2ui-react-adapter 0.1.20 → 0.1.22
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/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as A2UIClientAdapter, a as A2UISurfaceMetadata, b as A2UISessionController, c as A2UIRoomLike } from './session-
|
|
2
|
-
export { d as A2UIActionDeliveryStatus, e as A2UIActionResult, f as A2UIActionState, g as A2UICapabilityEnvelope, h as A2UIClientActionEnvelope, i as A2UIClientAdapterOptions, j as A2UIClientErrorEnvelope, k as A2UIClientErrorEvent, l as A2UIEditingSnapshot, m as A2UIFieldControl, n as A2UIFieldDescriptor, o as A2UIFieldInteractionField, p as A2UIFieldInteractionGroup, q as A2UIFieldUpdateEvent, r as A2UIFieldValue, s as A2UIPendingAction, t as A2UIRendererActionEvent, u as A2UIServerEnvelope, v as A2UISessionControllerOptions, w as A2UISessionSnapshot, x as A2UISessionStatus, y as A2UIStreamParticipant, z as A2UISurfaceStructure, B as A2UITabDescriptor, C as A2UITrustedServerParticipant, D as A2UI_CAPABILITIES_TOPIC, E as A2UI_CLIENT_TOPIC, F as A2UI_PROTOCOL_VERSION, G as A2UI_SERVER_TOPIC, H as AckEnvelope, I as AckFieldError, J as AdapterSurface, K as CLIENT_ACTIONS, L as CLIENT_ERROR_CODES, M as ClientAction, N as ClientErrorCode, O as ENVELOPE_VERSION, P as MAX_ENVELOPE_BYTES, Q as ParticipantRole, S as SectionNavigation, R as SnapshotEnvelope, T as SurfaceUpdateEnvelope } from './session-
|
|
1
|
+
import { A as A2UIClientAdapter, a as A2UISurfaceMetadata, b as A2UISessionController, c as A2UIRoomLike } from './session-BU8eDAkA.js';
|
|
2
|
+
export { d as A2UIActionDeliveryStatus, e as A2UIActionResult, f as A2UIActionState, g as A2UICapabilityEnvelope, h as A2UIClientActionEnvelope, i as A2UIClientAdapterOptions, j as A2UIClientErrorEnvelope, k as A2UIClientErrorEvent, l as A2UIEditingSnapshot, m as A2UIFieldControl, n as A2UIFieldDescriptor, o as A2UIFieldInteractionField, p as A2UIFieldInteractionGroup, q as A2UIFieldUpdateEvent, r as A2UIFieldValue, s as A2UIPendingAction, t as A2UIRendererActionEvent, u as A2UIServerEnvelope, v as A2UISessionControllerOptions, w as A2UISessionSnapshot, x as A2UISessionStatus, y as A2UIStreamParticipant, z as A2UISurfaceStructure, B as A2UITabDescriptor, C as A2UITrustedServerParticipant, D as A2UI_CAPABILITIES_TOPIC, E as A2UI_CLIENT_TOPIC, F as A2UI_PROTOCOL_VERSION, G as A2UI_SERVER_TOPIC, H as AckEnvelope, I as AckFieldError, J as AdapterSurface, K as CLIENT_ACTIONS, L as CLIENT_ERROR_CODES, M as ClientAction, N as ClientErrorCode, O as ENVELOPE_VERSION, P as MAX_ENVELOPE_BYTES, Q as ParticipantRole, S as SectionNavigation, R as SnapshotEnvelope, T as SurfaceUpdateEnvelope } from './session-BU8eDAkA.js';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
|
|
5
5
|
/** Accessible host around the official A2UI v0.9.1 React surface. */
|
package/dist/index.js
CHANGED
|
@@ -90,6 +90,29 @@ function displayDate(value) {
|
|
|
90
90
|
const iso = parseDateDraft(value);
|
|
91
91
|
return iso ? `${iso.slice(5, 7)}/${iso.slice(8, 10)}/${iso.slice(0, 4)}` : value;
|
|
92
92
|
}
|
|
93
|
+
var calendarOverlayStyle = {
|
|
94
|
+
position: "absolute",
|
|
95
|
+
inset: 0,
|
|
96
|
+
width: "100%",
|
|
97
|
+
height: "100%",
|
|
98
|
+
margin: 0,
|
|
99
|
+
padding: 0,
|
|
100
|
+
border: 0,
|
|
101
|
+
opacity: 0,
|
|
102
|
+
cursor: "pointer",
|
|
103
|
+
fontSize: 16,
|
|
104
|
+
boxSizing: "border-box"
|
|
105
|
+
};
|
|
106
|
+
function openPicker(picker, fallback) {
|
|
107
|
+
if (picker && typeof picker.showPicker === "function") {
|
|
108
|
+
try {
|
|
109
|
+
picker.showPicker();
|
|
110
|
+
return;
|
|
111
|
+
} catch {
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
fallback?.();
|
|
115
|
+
}
|
|
93
116
|
function DateOnlyInput(props) {
|
|
94
117
|
const id = useId2();
|
|
95
118
|
const [draft, setDraft] = useState(() => displayDate(props.value || ""));
|
|
@@ -139,45 +162,38 @@ function DateOnlyInput(props) {
|
|
|
139
162
|
style: { ...inputStyle, minWidth: 0, flex: 1 }
|
|
140
163
|
}
|
|
141
164
|
),
|
|
142
|
-
/* @__PURE__ */
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
onChange: (event) => {
|
|
175
|
-
update(displayDate(event.currentTarget.value));
|
|
176
|
-
setPickerOpen(false);
|
|
177
|
-
},
|
|
178
|
-
style: pickerOpen ? inputStyle : { position: "absolute", opacity: 0, pointerEvents: "none", width: 1, height: 1, bottom: 0, right: 0 }
|
|
179
|
-
}
|
|
180
|
-
)
|
|
165
|
+
/* @__PURE__ */ jsxs2("span", { style: { position: "relative", display: "flex" }, children: [
|
|
166
|
+
/* @__PURE__ */ jsx2(
|
|
167
|
+
"button",
|
|
168
|
+
{
|
|
169
|
+
type: "button",
|
|
170
|
+
"aria-label": `Choose ${props.label || "date"} from calendar`,
|
|
171
|
+
style: inputStyle,
|
|
172
|
+
onClick: () => openPicker(pickerRef.current, () => setPickerOpen(true)),
|
|
173
|
+
children: "\u25A6"
|
|
174
|
+
}
|
|
175
|
+
),
|
|
176
|
+
/* @__PURE__ */ jsx2(
|
|
177
|
+
"input",
|
|
178
|
+
{
|
|
179
|
+
ref: pickerRef,
|
|
180
|
+
type: "date",
|
|
181
|
+
"aria-label": `${props.label || "Date"} calendar`,
|
|
182
|
+
tabIndex: pickerOpen ? 0 : -1,
|
|
183
|
+
"aria-hidden": !pickerOpen,
|
|
184
|
+
"data-a2ui-calendar-input": "true",
|
|
185
|
+
value: parsed || "",
|
|
186
|
+
min,
|
|
187
|
+
max,
|
|
188
|
+
onClick: (event) => openPicker(event.currentTarget),
|
|
189
|
+
onChange: (event) => {
|
|
190
|
+
update(displayDate(event.currentTarget.value));
|
|
191
|
+
setPickerOpen(false);
|
|
192
|
+
},
|
|
193
|
+
style: pickerOpen ? inputStyle : calendarOverlayStyle
|
|
194
|
+
}
|
|
195
|
+
)
|
|
196
|
+
] })
|
|
181
197
|
] })
|
|
182
198
|
] });
|
|
183
199
|
}
|
|
@@ -3582,6 +3598,7 @@ import { A2uiMessageListSchema as A2uiMessageListSchema2 } from "@a2ui/web_core/
|
|
|
3582
3598
|
|
|
3583
3599
|
// src/actions.ts
|
|
3584
3600
|
var DEFAULT_ACK_TIMEOUT_MS = 1e4;
|
|
3601
|
+
var MIN_STALL_MS = 2e4;
|
|
3585
3602
|
var SAFE_DETAIL = /^[A-Za-z0-9_.:-]{1,96}$/;
|
|
3586
3603
|
var MAX_IDENTIFIER_LENGTH = 256;
|
|
3587
3604
|
var EMPTY_ACTION_STATE = {
|
|
@@ -3885,11 +3902,25 @@ var A2UIClientActionBridge = class {
|
|
|
3885
3902
|
pending.timeoutId = void 0;
|
|
3886
3903
|
pending.deliveryStatus = "retryable";
|
|
3887
3904
|
this.#notify();
|
|
3905
|
+
this.#watchForStall(pending, generation);
|
|
3888
3906
|
}
|
|
3889
3907
|
}, this.#ackTimeoutMs());
|
|
3890
3908
|
this.#notify();
|
|
3891
3909
|
});
|
|
3892
3910
|
}
|
|
3911
|
+
/** A retried action that times out again is stalled; so is one left unretried. */
|
|
3912
|
+
#watchForStall(pending, generation) {
|
|
3913
|
+
if (pending.attemptCount >= 2) {
|
|
3914
|
+
this.#options.onStalled?.();
|
|
3915
|
+
return;
|
|
3916
|
+
}
|
|
3917
|
+
pending.timeoutId = globalThis.setTimeout(() => {
|
|
3918
|
+
if (this.#isCurrent(pending, generation) && pending.deliveryStatus === "retryable") {
|
|
3919
|
+
pending.timeoutId = void 0;
|
|
3920
|
+
this.#options.onStalled?.();
|
|
3921
|
+
}
|
|
3922
|
+
}, Math.max(this.#ackTimeoutMs() * 2, MIN_STALL_MS));
|
|
3923
|
+
}
|
|
3893
3924
|
#enqueue(operation) {
|
|
3894
3925
|
this.#publishQueue = this.#publishQueue.then(operation).catch(() => void 0);
|
|
3895
3926
|
}
|
|
@@ -4157,7 +4188,8 @@ var A2UISessionController = class {
|
|
|
4157
4188
|
reportClientError: (errorCode, surfaceId, detail) => this.#adapter.reportClientError(errorCode, surfaceId, detail),
|
|
4158
4189
|
onStateChange: (actions) => this.#handleActionStateChange(actions),
|
|
4159
4190
|
participantRole: this.#participantRole,
|
|
4160
|
-
ackTimeoutMs: options.actionAckTimeoutMs
|
|
4191
|
+
ackTimeoutMs: options.actionAckTimeoutMs,
|
|
4192
|
+
onStalled: () => this.resync()
|
|
4161
4193
|
});
|
|
4162
4194
|
}
|
|
4163
4195
|
get status() {
|
|
@@ -4173,6 +4205,18 @@ var A2UISessionController = class {
|
|
|
4173
4205
|
return this.#sessionSnapshot.actions;
|
|
4174
4206
|
}
|
|
4175
4207
|
/** Retry one or every delivery-failed/timed-out request with its original id. */
|
|
4208
|
+
/**
|
|
4209
|
+
* Drop pending actions and request an authoritative snapshot, as after a
|
|
4210
|
+
* reconnect. Used when an action is never acknowledged: the server's state
|
|
4211
|
+
* is the truth, and the form must not stay locked waiting for it.
|
|
4212
|
+
*/
|
|
4213
|
+
resync() {
|
|
4214
|
+
if (this.#closed || this.status !== "connected" || this.restoring) {
|
|
4215
|
+
return;
|
|
4216
|
+
}
|
|
4217
|
+
this.#actionBridge.discardPending();
|
|
4218
|
+
void this.#beginReconnectRestore();
|
|
4219
|
+
}
|
|
4176
4220
|
retryPendingAction(requestId) {
|
|
4177
4221
|
return this.#actionBridge.retryPendingAction(requestId);
|
|
4178
4222
|
}
|