@colixsystems/widget-sdk 0.221.0 → 0.221.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -84,7 +84,11 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
84
84
 
85
85
  ## Status
86
86
 
87
- `v0.221.0` — pre-publish. The package surface (types, function names, export paths) is the v1 contract; runtime behaviour for some hooks is stubbed (each hook documents what's wired and what isn't). It is **not yet published to npm**.
87
+ `v0.221.1` — pre-publish. The package surface (types, function names, export paths) is the v1 contract; runtime behaviour for some hooks is stubbed (each hook documents what's wired and what isn't). It is **not yet published to npm**.
88
+
89
+ ### What's new in 0.221.1 (contract 1.177.1)
90
+
91
+ **`useFileSignature`: one failed poll no longer outlives the next answer.** `error` is the last call that failed, and a `refresh()` or `verify()` that succeeds now clears it. While `status` is `'pending'` an `error` means a poll failed: keep polling and keep showing the order. Fix only; nothing was added or removed.
88
92
 
89
93
  ### What's new in 0.221.0 (contract 1.177.0)
90
94
 
package/dist/contract.cjs CHANGED
@@ -1559,7 +1559,10 @@ const HOOKS = [
1559
1559
  "be cancelled. cancel() resolves to what became of the order, which is " +
1560
1560
  "then still pending or already complete: read status after it, never " +
1561
1561
  "assume 'cancelled'. nameRefusal is set when the order failed because " +
1562
- "the signer's name cannot be shown on the document. Reads " +
1562
+ "the signer's name cannot be shown on the document. error is the last " +
1563
+ "call that failed, and a refresh() or verify() that succeeds clears it: " +
1564
+ "while status is 'pending' an error means one poll failed, so keep " +
1565
+ "polling and keep showing the order. Reads " +
1563
1566
  "ctx.filestore.signatures.{initiate,status,cancel,verify}.",
1564
1567
  returnShape: {
1565
1568
  status: "'pending' | 'complete' | 'failed' | 'cancelled' | null",
@@ -5868,7 +5871,10 @@ const CONTRACT = deepFreeze({
5868
5871
  // and attach to it in one handler. A FILE column's file goes in its
5869
5872
  // row's record space; useCamera / useImageEditor point at
5870
5873
  // useFilestoreUpload, since widget code cannot reach ctx.assets.
5871
- version: "1.177.0",
5874
+ // 1.177.1: fix (sc-10410) — a `refresh()` or `verify()` that succeeds
5875
+ // clears `useFileSignature`'s `error`; it used to keep one failed poll's
5876
+ // error for the rest of the order.
5877
+ version: "1.177.1",
5872
5878
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
5873
5879
  hooks: HOOKS,
5874
5880
  primitives: PRIMITIVES,
package/dist/contract.js CHANGED
@@ -1559,7 +1559,10 @@ const HOOKS = [
1559
1559
  "be cancelled. cancel() resolves to what became of the order, which is " +
1560
1560
  "then still pending or already complete: read status after it, never " +
1561
1561
  "assume 'cancelled'. nameRefusal is set when the order failed because " +
1562
- "the signer's name cannot be shown on the document. Reads " +
1562
+ "the signer's name cannot be shown on the document. error is the last " +
1563
+ "call that failed, and a refresh() or verify() that succeeds clears it: " +
1564
+ "while status is 'pending' an error means one poll failed, so keep " +
1565
+ "polling and keep showing the order. Reads " +
1563
1566
  "ctx.filestore.signatures.{initiate,status,cancel,verify}.",
1564
1567
  returnShape: {
1565
1568
  status: "'pending' | 'complete' | 'failed' | 'cancelled' | null",
@@ -5864,7 +5867,10 @@ const CONTRACT = deepFreeze({
5864
5867
  // and attach to it in one handler. A FILE column's file goes in its
5865
5868
  // row's record space; useCamera / useImageEditor point at
5866
5869
  // useFilestoreUpload, since widget code cannot reach ctx.assets.
5867
- version: "1.177.0",
5870
+ // 1.177.1: fix (sc-10410) — a `refresh()` or `verify()` that succeeds
5871
+ // clears `useFileSignature`'s `error`; it used to keep one failed poll's
5872
+ // error for the rest of the order.
5873
+ version: "1.177.1",
5868
5874
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
5869
5875
  hooks: HOOKS,
5870
5876
  primitives: PRIMITIVES,
@@ -40,7 +40,9 @@ const userIdOf = (ctx) => (ctx.user && ctx.user.id) || "";
40
40
  * with `hintCode: "sealing"`. `hintCode` is where the order stands;
41
41
  * `nameRefusal` (`{ reason, characters }`) is set when it failed because the
42
42
  * signer's name cannot be shown. `autoStartToken` is set only while opening
43
- * BankID can still help. Reads
43
+ * BankID can still help. `error` is the last call that failed; a `refresh()`
44
+ * or `verify()` that succeeds clears it, so one failed poll does not outlive
45
+ * the next answer. Reads
44
46
  * `ctx.filestore.signatures.{initiate,status,cancel,verify}`. When `fileId` is
45
47
  * null/empty the hook collapses to a no-op.
46
48
  *
@@ -128,7 +130,8 @@ export function useFileSignature(fileId, existingSignatureId = null) {
128
130
  const res = await sigRef.current.status(id);
129
131
  // A cancel or a new order since this poll was sent: its answer is old news.
130
132
  if (answersRef.current !== asked) return;
131
- apply(forScope, (base) => ({ order: signOrderStateAfterAnswer(base.order, res) }));
133
+ // An answer means the order can be reached again: an earlier failure is over.
134
+ apply(forScope, (base) => ({ order: signOrderStateAfterAnswer(base.order, res), error: null }));
132
135
  } catch (err) {
133
136
  if (answersRef.current !== asked) return;
134
137
  apply(forScope, () => ({ error: toPermissionError(err) }));
@@ -156,7 +159,7 @@ export function useFileSignature(fileId, existingSignatureId = null) {
156
159
  if (!id) return null;
157
160
  try {
158
161
  const v = await sigRef.current.verify(id);
159
- apply(forScope, () => ({ verdict: v }));
162
+ apply(forScope, () => ({ verdict: v, error: null }));
160
163
  return v;
161
164
  } catch (err) {
162
165
  const refusal = toPermissionError(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colixsystems/widget-sdk",
3
- "version": "0.221.0",
3
+ "version": "0.221.1",
4
4
  "description": "Common widget interface for AppStudio. Implements WidgetManifest, WidgetContext, property schema, and helper hooks.",
5
5
  "homepage": "https://github.com/Colix-AB/AppStudio",
6
6
  "type": "module",
package/src/contract.js CHANGED
@@ -1559,7 +1559,10 @@ const HOOKS = [
1559
1559
  "be cancelled. cancel() resolves to what became of the order, which is " +
1560
1560
  "then still pending or already complete: read status after it, never " +
1561
1561
  "assume 'cancelled'. nameRefusal is set when the order failed because " +
1562
- "the signer's name cannot be shown on the document. Reads " +
1562
+ "the signer's name cannot be shown on the document. error is the last " +
1563
+ "call that failed, and a refresh() or verify() that succeeds clears it: " +
1564
+ "while status is 'pending' an error means one poll failed, so keep " +
1565
+ "polling and keep showing the order. Reads " +
1563
1566
  "ctx.filestore.signatures.{initiate,status,cancel,verify}.",
1564
1567
  returnShape: {
1565
1568
  status: "'pending' | 'complete' | 'failed' | 'cancelled' | null",
@@ -5864,7 +5867,10 @@ const CONTRACT = deepFreeze({
5864
5867
  // and attach to it in one handler. A FILE column's file goes in its
5865
5868
  // row's record space; useCamera / useImageEditor point at
5866
5869
  // useFilestoreUpload, since widget code cannot reach ctx.assets.
5867
- version: "1.177.0",
5870
+ // 1.177.1: fix (sc-10410) — a `refresh()` or `verify()` that succeeds
5871
+ // clears `useFileSignature`'s `error`; it used to keep one failed poll's
5872
+ // error for the rest of the order.
5873
+ version: "1.177.1",
5868
5874
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
5869
5875
  hooks: HOOKS,
5870
5876
  primitives: PRIMITIVES,