@siteping/widget 0.10.10 → 0.11.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 (122) hide show
  1. package/README.md +5 -4
  2. package/dist/chunk-CVWZCWBQ.js +9 -0
  3. package/dist/chunk-CVWZCWBQ.js.map +1 -0
  4. package/dist/chunk-CX5YE4V3.js +9 -0
  5. package/dist/chunk-CX5YE4V3.js.map +1 -0
  6. package/dist/chunk-KCOX2NRI.cjs +9 -0
  7. package/dist/chunk-KCOX2NRI.cjs.map +1 -0
  8. package/dist/chunk-QW2L5ARZ.cjs +9 -0
  9. package/dist/chunk-QW2L5ARZ.cjs.map +1 -0
  10. package/dist/concurrency.d.cts +14 -0
  11. package/dist/concurrency.d.ts +14 -0
  12. package/dist/de-73CTH2E4.cjs +2 -0
  13. package/dist/de-73CTH2E4.cjs.map +1 -0
  14. package/dist/de-GUUJUHYP.js +2 -0
  15. package/dist/de-GUUJUHYP.js.map +1 -0
  16. package/dist/deep-link.d.cts +14 -0
  17. package/dist/deep-link.d.ts +14 -0
  18. package/dist/email.d.cts +6 -3
  19. package/dist/email.d.ts +6 -3
  20. package/dist/errors.d.cts +18 -4
  21. package/dist/errors.d.ts +18 -4
  22. package/dist/{es-HEVFJPRI.js → es-3MXMSDUC.js} +2 -2
  23. package/dist/es-3MXMSDUC.js.map +1 -0
  24. package/dist/{es-5XQA3TPT.cjs → es-WJZ3XARH.cjs} +2 -2
  25. package/dist/es-WJZ3XARH.cjs.map +1 -0
  26. package/dist/filters.d.cts +31 -7
  27. package/dist/filters.d.ts +31 -7
  28. package/dist/fr-52F3ZCLQ.js +2 -0
  29. package/dist/fr-52F3ZCLQ.js.map +1 -0
  30. package/dist/fr-ZCRIJWI3.cjs +2 -0
  31. package/dist/fr-ZCRIJWI3.cjs.map +1 -0
  32. package/dist/i18n.d.cts +18 -0
  33. package/dist/i18n.d.ts +18 -0
  34. package/dist/index.cjs +3 -1588
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.cts +12 -1
  37. package/dist/index.d.ts +12 -1
  38. package/dist/index.global.js +4 -3389
  39. package/dist/index.global.js.map +1 -1
  40. package/dist/index.js +3 -1588
  41. package/dist/index.js.map +1 -1
  42. package/dist/it-MEUT3RCC.js +2 -0
  43. package/dist/it-MEUT3RCC.js.map +1 -0
  44. package/dist/it-TGUTW6MO.cjs +2 -0
  45. package/dist/it-TGUTW6MO.cjs.map +1 -0
  46. package/dist/ja-DOS7AWLW.cjs +2 -0
  47. package/dist/ja-DOS7AWLW.cjs.map +1 -0
  48. package/dist/ja-U7NRNGPQ.js +2 -0
  49. package/dist/ja-U7NRNGPQ.js.map +1 -0
  50. package/dist/panel-HGYK7HVK.cjs +2 -0
  51. package/dist/panel-HGYK7HVK.cjs.map +1 -0
  52. package/dist/panel-RE2IHZ4S.js +2 -0
  53. package/dist/panel-RE2IHZ4S.js.map +1 -0
  54. package/dist/panel-RHSIY6KS.cjs +2 -0
  55. package/dist/panel-RHSIY6KS.cjs.map +1 -0
  56. package/dist/panel-XVIF2WMU.js +2 -0
  57. package/dist/panel-XVIF2WMU.js.map +1 -0
  58. package/dist/pt-BZRBHCYN.cjs +2 -0
  59. package/dist/pt-BZRBHCYN.cjs.map +1 -0
  60. package/dist/pt-MOS5DVOG.js +2 -0
  61. package/dist/pt-MOS5DVOG.js.map +1 -0
  62. package/dist/react.cjs +3 -1588
  63. package/dist/react.cjs.map +1 -1
  64. package/dist/react.js +3 -1588
  65. package/dist/react.js.map +1 -1
  66. package/dist/ru-KDNRHHNZ.cjs +2 -0
  67. package/dist/ru-KDNRHHNZ.cjs.map +1 -0
  68. package/dist/ru-VSWB5NKK.js +2 -0
  69. package/dist/ru-VSWB5NKK.js.map +1 -0
  70. package/dist/schema.d.cts +54 -0
  71. package/dist/schema.d.ts +54 -0
  72. package/dist/screenshot-storage.d.cts +61 -19
  73. package/dist/screenshot-storage.d.ts +61 -19
  74. package/dist/siteping-core.d.cts +9 -6
  75. package/dist/siteping-core.d.ts +9 -6
  76. package/dist/store-helpers.d.cts +59 -15
  77. package/dist/store-helpers.d.ts +59 -15
  78. package/dist/type-utils.d.cts +8 -0
  79. package/dist/type-utils.d.ts +8 -0
  80. package/dist/types.d.cts +399 -33
  81. package/dist/types.d.ts +399 -33
  82. package/dist/wire.d.cts +35 -2
  83. package/dist/wire.d.ts +35 -2
  84. package/package.json +3 -1
  85. package/dist/chunk-AFLWWD6M.cjs +0 -1796
  86. package/dist/chunk-AFLWWD6M.cjs.map +0 -1
  87. package/dist/chunk-ATTI2TS4.js +0 -1796
  88. package/dist/chunk-ATTI2TS4.js.map +0 -1
  89. package/dist/chunk-BP5TH2CD.js +0 -1796
  90. package/dist/chunk-BP5TH2CD.js.map +0 -1
  91. package/dist/chunk-OSADAHGS.cjs +0 -1796
  92. package/dist/chunk-OSADAHGS.cjs.map +0 -1
  93. package/dist/de-AZUOIGF2.cjs +0 -2
  94. package/dist/de-AZUOIGF2.cjs.map +0 -1
  95. package/dist/de-MAGIJBFC.js +0 -2
  96. package/dist/de-MAGIJBFC.js.map +0 -1
  97. package/dist/es-5XQA3TPT.cjs.map +0 -1
  98. package/dist/es-HEVFJPRI.js.map +0 -1
  99. package/dist/fr-ERYSAH32.cjs +0 -2
  100. package/dist/fr-ERYSAH32.cjs.map +0 -1
  101. package/dist/fr-OM2PHLDH.js +0 -2
  102. package/dist/fr-OM2PHLDH.js.map +0 -1
  103. package/dist/it-NXAZR4K6.cjs +0 -2
  104. package/dist/it-NXAZR4K6.cjs.map +0 -1
  105. package/dist/it-OQVYHKKV.js +0 -2
  106. package/dist/it-OQVYHKKV.js.map +0 -1
  107. package/dist/panel-2FEECS2N.cjs +0 -2
  108. package/dist/panel-2FEECS2N.cjs.map +0 -1
  109. package/dist/panel-CSFFA5FF.cjs +0 -2
  110. package/dist/panel-CSFFA5FF.cjs.map +0 -1
  111. package/dist/panel-S2UR5BSD.js +0 -2
  112. package/dist/panel-S2UR5BSD.js.map +0 -1
  113. package/dist/panel-SGSUHR7V.js +0 -2
  114. package/dist/panel-SGSUHR7V.js.map +0 -1
  115. package/dist/pt-CODDT6VY.cjs +0 -2
  116. package/dist/pt-CODDT6VY.cjs.map +0 -1
  117. package/dist/pt-VUUNL42H.js +0 -2
  118. package/dist/pt-VUUNL42H.js.map +0 -1
  119. package/dist/ru-72WUEADV.cjs +0 -2
  120. package/dist/ru-72WUEADV.cjs.map +0 -1
  121. package/dist/ru-NDWY7Y36.js +0 -2
  122. package/dist/ru-NDWY7Y36.js.map +0 -1
package/dist/wire.d.cts CHANGED
@@ -9,16 +9,37 @@
9
9
  */
10
10
  import { SitepingError, SitepingNetworkError } from "./errors.cjs";
11
11
  import type { FeedbackQuery } from "./types.cjs";
12
+ /**
13
+ * A fresh `clientId` for a write the server dedupes a resend of — a feedback,
14
+ * or a reply in a thread.
15
+ */
16
+ export declare function newClientId(): string;
12
17
  /**
13
18
  * Encode a `FeedbackQuery` as the endpoint's expected query string.
14
19
  * Omitted/empty filters are not serialized; `statuses` uses the CSV form
15
20
  * the server's schema splits (`statuses=open,in_progress`).
16
21
  */
17
22
  export declare function feedbackQueryToSearchParams(query: FeedbackQuery): URLSearchParams;
23
+ /**
24
+ * Merge caller-supplied `extra` headers over a client's `defaults`
25
+ * (`Content-Type`, `Authorization` from `apiKey`). Header names are
26
+ * case-insensitive, so a default spelled differently is dropped and the
27
+ * explicit value replaces it — a plain object merge kept both, and fetch
28
+ * joined them (`authorization: "Basic x"` over an apiKey went out as
29
+ * "Bearer k, Basic x").
30
+ */
31
+ export declare function mergeRequestHeaders(defaults: Record<string, string>, extra: Record<string, string> | undefined): Record<string, string>;
32
+ /**
33
+ * Append `params` to `endpoint`, which may already carry a query string
34
+ * (`/api/siteping?tenant=acme`) or a fragment — naive `${endpoint}?${params}`
35
+ * produced `?tenant=acme?projectName=…`, a 400. Plain string work, so
36
+ * relative endpoints stay relative and nothing depends on `location`.
37
+ */
38
+ export declare function withSearchParams(endpoint: string, params: URLSearchParams): string;
18
39
  /**
19
40
  * Map a non-OK `Response` to the appropriate typed error:
20
- * - 401 / 403 → `SitepingAuthError`
21
- * - other 4xx → `SitepingValidationError`
41
+ * - 401 / 403 → `SitepingAuthError`, with its `status`
42
+ * - other 4xx → `SitepingValidationError`, with its `status`
22
43
  * - 5xx (or anything else) → generic `SitepingError` (code `"SERVER"`)
23
44
  *
24
45
  * The response body is consumed via `.text()` so the caller keeps the
@@ -26,6 +47,18 @@ export declare function feedbackQueryToSearchParams(query: FeedbackQuery): URLSe
26
47
  * to `"Unknown error"` (kept verbatim — host apps grep for it).
27
48
  */
28
49
  export declare function errorFromResponse(response: Response, label: string): Promise<SitepingError>;
50
+ /**
51
+ * Whether a failed reply met a full thread — a store's `StoreLimitError`, or
52
+ * a 409 (the endpoint's other 409, a clientId reused on another feedback,
53
+ * never comes from clients that mint one per reply). Retrying won't help.
54
+ */
55
+ export declare function isThreadFull(error: unknown): boolean;
56
+ /**
57
+ * Whether a failed reply delete found nothing to delete — a store's
58
+ * `StoreNotFoundError`, or a 404: it is gone already. (Unlike
59
+ * `isStoreNotFound`, no Prisma `P2025`: a browser source never meets one.)
60
+ */
61
+ export declare function isCommentGone(error: unknown): boolean;
29
62
  /**
30
63
  * Normalise an exception thrown by `fetch` (or a timeout AbortController)
31
64
  * into a `SitepingNetworkError`. AbortErrors count as network failures —
package/dist/wire.d.ts CHANGED
@@ -9,16 +9,37 @@
9
9
  */
10
10
  import { SitepingError, SitepingNetworkError } from "./errors.js";
11
11
  import type { FeedbackQuery } from "./types.js";
12
+ /**
13
+ * A fresh `clientId` for a write the server dedupes a resend of — a feedback,
14
+ * or a reply in a thread.
15
+ */
16
+ export declare function newClientId(): string;
12
17
  /**
13
18
  * Encode a `FeedbackQuery` as the endpoint's expected query string.
14
19
  * Omitted/empty filters are not serialized; `statuses` uses the CSV form
15
20
  * the server's schema splits (`statuses=open,in_progress`).
16
21
  */
17
22
  export declare function feedbackQueryToSearchParams(query: FeedbackQuery): URLSearchParams;
23
+ /**
24
+ * Merge caller-supplied `extra` headers over a client's `defaults`
25
+ * (`Content-Type`, `Authorization` from `apiKey`). Header names are
26
+ * case-insensitive, so a default spelled differently is dropped and the
27
+ * explicit value replaces it — a plain object merge kept both, and fetch
28
+ * joined them (`authorization: "Basic x"` over an apiKey went out as
29
+ * "Bearer k, Basic x").
30
+ */
31
+ export declare function mergeRequestHeaders(defaults: Record<string, string>, extra: Record<string, string> | undefined): Record<string, string>;
32
+ /**
33
+ * Append `params` to `endpoint`, which may already carry a query string
34
+ * (`/api/siteping?tenant=acme`) or a fragment — naive `${endpoint}?${params}`
35
+ * produced `?tenant=acme?projectName=…`, a 400. Plain string work, so
36
+ * relative endpoints stay relative and nothing depends on `location`.
37
+ */
38
+ export declare function withSearchParams(endpoint: string, params: URLSearchParams): string;
18
39
  /**
19
40
  * Map a non-OK `Response` to the appropriate typed error:
20
- * - 401 / 403 → `SitepingAuthError`
21
- * - other 4xx → `SitepingValidationError`
41
+ * - 401 / 403 → `SitepingAuthError`, with its `status`
42
+ * - other 4xx → `SitepingValidationError`, with its `status`
22
43
  * - 5xx (or anything else) → generic `SitepingError` (code `"SERVER"`)
23
44
  *
24
45
  * The response body is consumed via `.text()` so the caller keeps the
@@ -26,6 +47,18 @@ export declare function feedbackQueryToSearchParams(query: FeedbackQuery): URLSe
26
47
  * to `"Unknown error"` (kept verbatim — host apps grep for it).
27
48
  */
28
49
  export declare function errorFromResponse(response: Response, label: string): Promise<SitepingError>;
50
+ /**
51
+ * Whether a failed reply met a full thread — a store's `StoreLimitError`, or
52
+ * a 409 (the endpoint's other 409, a clientId reused on another feedback,
53
+ * never comes from clients that mint one per reply). Retrying won't help.
54
+ */
55
+ export declare function isThreadFull(error: unknown): boolean;
56
+ /**
57
+ * Whether a failed reply delete found nothing to delete — a store's
58
+ * `StoreNotFoundError`, or a 404: it is gone already. (Unlike
59
+ * `isStoreNotFound`, no Prisma `P2025`: a browser source never meets one.)
60
+ */
61
+ export declare function isCommentGone(error: unknown): boolean;
29
62
  /**
30
63
  * Normalise an exception thrown by `fetch` (or a timeout AbortController)
31
64
  * into a `SitepingNetworkError`. AbortErrors count as network failures —
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siteping/widget",
3
- "version": "0.10.10",
3
+ "version": "0.11.0",
4
4
  "description": "Feedback widget for client review during development — annotations, bugs, questions directly on the site",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -76,6 +76,8 @@
76
76
  "html2canvas-pro": "^2.4.3"
77
77
  },
78
78
  "devDependencies": {
79
+ "@siteping/adapter-localstorage": "workspace:*",
80
+ "@siteping/adapter-memory": "workspace:*",
79
81
  "@siteping/core": "workspace:*",
80
82
  "@size-limit/file": "^14.0.0",
81
83
  "@testing-library/react": "^16.3.3",