@verbumia/feedback 0.1.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/CONTRACT.md +165 -0
- package/LICENSE +21 -0
- package/README.md +80 -0
- package/dist/chunk-5NA2TFPG.js +1 -0
- package/dist/chunk-5NA2TFPG.js.map +1 -0
- package/dist/chunk-OX4RJD5H.js +242 -0
- package/dist/chunk-OX4RJD5H.js.map +1 -0
- package/dist/client-CPEcvn23.d.cts +159 -0
- package/dist/client-CPEcvn23.d.ts +159 -0
- package/dist/core/index.cjs +272 -0
- package/dist/core/index.cjs.map +1 -0
- package/dist/core/index.d.cts +18 -0
- package/dist/core/index.d.ts +18 -0
- package/dist/core/index.js +16 -0
- package/dist/core/index.js.map +1 -0
- package/dist/keys-BySe1O6V.d.ts +25 -0
- package/dist/keys-Dg_nv16u.d.cts +25 -0
- package/dist/native/index.cjs +575 -0
- package/dist/native/index.cjs.map +1 -0
- package/dist/native/index.d.cts +54 -0
- package/dist/native/index.d.ts +54 -0
- package/dist/native/index.js +322 -0
- package/dist/native/index.js.map +1 -0
- package/dist/react/index.cjs +644 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.cts +55 -0
- package/dist/react/index.d.ts +55 -0
- package/dist/react/index.js +384 -0
- package/dist/react/index.js.map +1 -0
- package/dist/svelte/index.cjs +306 -0
- package/dist/svelte/index.cjs.map +1 -0
- package/dist/svelte/index.d.cts +38 -0
- package/dist/svelte/index.d.ts +38 -0
- package/dist/svelte/index.js +52 -0
- package/dist/svelte/index.js.map +1 -0
- package/dist/vue/index.cjs +426 -0
- package/dist/vue/index.cjs.map +1 -0
- package/dist/vue/index.d.cts +39 -0
- package/dist/vue/index.d.ts +39 -0
- package/dist/vue/index.js +172 -0
- package/dist/vue/index.js.map +1 -0
- package/package.json +108 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire types for the Verbumia End-User Translation Evaluation API.
|
|
3
|
+
* Canonical reference: ./CONTRACT.md (frozen). Backend task 591.
|
|
4
|
+
*/
|
|
5
|
+
interface FeedbackConfig {
|
|
6
|
+
/** API base, no trailing slash needed. e.g. https://api.verbumia.ca */
|
|
7
|
+
apiBase: string;
|
|
8
|
+
/** Public project UUID the widget targets. */
|
|
9
|
+
projectId: string;
|
|
10
|
+
/**
|
|
11
|
+
* sessionId / grouping_key is MINTED SERVER-SIDE by the Verbumia
|
|
12
|
+
* backend at POST /v1/feedback/tos and returned in the token bundle
|
|
13
|
+
* (`TokenBundle.grouping_key`). The widget receives + sends it; it
|
|
14
|
+
* MUST NOT self-generate it. There is intentionally no client config
|
|
15
|
+
* field for it.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* NOTE: there is intentionally NO `tosVersion` field. The ToS version
|
|
19
|
+
* is a BUILD-TIME constant baked into @verbumia/feedback at release
|
|
20
|
+
* (`SDK_TOS_VERSION`, task 616) — integrators do not set it; the SDK
|
|
21
|
+
* sends it automatically.
|
|
22
|
+
*/
|
|
23
|
+
/** Optional opaque end-user id; server generates one when absent. */
|
|
24
|
+
endUserId?: string;
|
|
25
|
+
/** BCP-47 language the widget rates strings in (e.g. "fr"). */
|
|
26
|
+
language: string;
|
|
27
|
+
/** Optional locale tag stored for analytics. */
|
|
28
|
+
locale?: string;
|
|
29
|
+
/** Debounce window (ms) before a queued batch is flushed. Default 1500. */
|
|
30
|
+
flushDebounceMs?: number;
|
|
31
|
+
/** Max queued items before an immediate flush. Default 20. */
|
|
32
|
+
maxBatch?: number;
|
|
33
|
+
/** Injected fetch (tests / RN polyfills). Defaults to global fetch. */
|
|
34
|
+
fetchImpl?: typeof fetch;
|
|
35
|
+
}
|
|
36
|
+
interface TokenBundle {
|
|
37
|
+
access_token: string;
|
|
38
|
+
token_type: "Bearer";
|
|
39
|
+
expires_in: number;
|
|
40
|
+
refresh_token: string;
|
|
41
|
+
refresh_expires_in: number;
|
|
42
|
+
end_user_id: string;
|
|
43
|
+
tos_version: string;
|
|
44
|
+
grouping_key: string;
|
|
45
|
+
}
|
|
46
|
+
interface FeedbackString {
|
|
47
|
+
namespace: string;
|
|
48
|
+
key: string;
|
|
49
|
+
key_uuid: string;
|
|
50
|
+
language_uuid: string;
|
|
51
|
+
value: string;
|
|
52
|
+
translation_hash: string;
|
|
53
|
+
avg_stars: number | null;
|
|
54
|
+
ratings_count: number;
|
|
55
|
+
my_rating: number | null;
|
|
56
|
+
}
|
|
57
|
+
interface StringsResponse {
|
|
58
|
+
project_id: string;
|
|
59
|
+
language: string;
|
|
60
|
+
strings: FeedbackString[];
|
|
61
|
+
}
|
|
62
|
+
/** A 5-star rating queued for a rendered string variant. */
|
|
63
|
+
interface RatingInput {
|
|
64
|
+
namespace: string;
|
|
65
|
+
key: string;
|
|
66
|
+
language: string;
|
|
67
|
+
translation_hash: string;
|
|
68
|
+
stars: number;
|
|
69
|
+
}
|
|
70
|
+
/** A suggested alternative translation queued for moderation. */
|
|
71
|
+
interface SuggestionInput {
|
|
72
|
+
namespace: string;
|
|
73
|
+
key: string;
|
|
74
|
+
language: string;
|
|
75
|
+
translation_hash: string;
|
|
76
|
+
suggested_text: string;
|
|
77
|
+
comment?: string;
|
|
78
|
+
}
|
|
79
|
+
interface BatchResponse {
|
|
80
|
+
accepted: number;
|
|
81
|
+
rejected: number;
|
|
82
|
+
items: Array<Record<string, unknown>>;
|
|
83
|
+
}
|
|
84
|
+
/** A key the host app declares as on-screen. */
|
|
85
|
+
interface DeclaredKey {
|
|
86
|
+
namespace: string;
|
|
87
|
+
key: string;
|
|
88
|
+
}
|
|
89
|
+
declare class FeedbackError extends Error {
|
|
90
|
+
readonly status?: number | undefined;
|
|
91
|
+
readonly code?: string | undefined;
|
|
92
|
+
constructor(message: string, status?: number | undefined, code?: string | undefined);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Framework-agnostic Verbumia feedback client.
|
|
97
|
+
*
|
|
98
|
+
* Responsibilities:
|
|
99
|
+
* - versioned-ToS acceptance -> scoped end-user JWT bootstrap
|
|
100
|
+
* - transparent access-token refresh (rotating refresh token)
|
|
101
|
+
* - fetch on-screen strings for the widget
|
|
102
|
+
* - debounced + size-capped batched POST of ratings / suggestions,
|
|
103
|
+
* mirroring the missing-handler transport contract (ltm 280):
|
|
104
|
+
* best-effort, never throws into the host app render path.
|
|
105
|
+
*
|
|
106
|
+
* The React and React Native entry points are thin UI shells over this.
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
declare class FeedbackClient {
|
|
110
|
+
private cfg;
|
|
111
|
+
private fetchImpl;
|
|
112
|
+
private tokens;
|
|
113
|
+
private queue;
|
|
114
|
+
private timer;
|
|
115
|
+
private bootstrapping;
|
|
116
|
+
constructor(config: FeedbackConfig);
|
|
117
|
+
private base;
|
|
118
|
+
get endUserId(): string | undefined;
|
|
119
|
+
get hasConsented(): boolean;
|
|
120
|
+
/** Server-minted sessionId / grouping_key (from the token bundle).
|
|
121
|
+
* Available only after `acceptTos()`; never client-generated. */
|
|
122
|
+
get sessionId(): string | undefined;
|
|
123
|
+
/** BCP-47 language the widget is rating strings in. */
|
|
124
|
+
get language(): string;
|
|
125
|
+
/** ToS version the end user is asked to accept — the SDK's
|
|
126
|
+
* build-time constant (task 616). NOT integrator/server set. */
|
|
127
|
+
get tosVersion(): string;
|
|
128
|
+
/**
|
|
129
|
+
* Accept the ToS and bootstrap a scoped token. Idempotent: a second call
|
|
130
|
+
* returns the in-flight / existing bundle rather than re-accepting.
|
|
131
|
+
*/
|
|
132
|
+
acceptTos(): Promise<TokenBundle>;
|
|
133
|
+
private refresh;
|
|
134
|
+
/** Authenticated fetch with a single transparent refresh-on-401 retry. */
|
|
135
|
+
private authed;
|
|
136
|
+
/** Strings rendered on the current view, with this end user's prior rating. */
|
|
137
|
+
getStrings(opts?: {
|
|
138
|
+
keys?: Array<{
|
|
139
|
+
namespace: string;
|
|
140
|
+
key: string;
|
|
141
|
+
}>;
|
|
142
|
+
namespace?: string;
|
|
143
|
+
limit?: number;
|
|
144
|
+
}): Promise<StringsResponse>;
|
|
145
|
+
/** Queue a rating; flushed on debounce or when the batch fills. */
|
|
146
|
+
rate(payload: RatingInput): void;
|
|
147
|
+
/** Queue a suggestion; flushed on debounce or when the batch fills. */
|
|
148
|
+
suggest(payload: SuggestionInput): void;
|
|
149
|
+
private enqueue;
|
|
150
|
+
/**
|
|
151
|
+
* Flush queued items. Best-effort: a transport/auth failure re-queues the
|
|
152
|
+
* batch once and swallows the error so the host app never sees a throw.
|
|
153
|
+
*/
|
|
154
|
+
flush(): Promise<void>;
|
|
155
|
+
private postBatch;
|
|
156
|
+
private problem;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export { type BatchResponse as B, type DeclaredKey as D, FeedbackClient as F, type RatingInput as R, type StringsResponse as S, type TokenBundle as T, type FeedbackConfig as a, FeedbackError as b, type FeedbackString as c, type SuggestionInput as d };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire types for the Verbumia End-User Translation Evaluation API.
|
|
3
|
+
* Canonical reference: ./CONTRACT.md (frozen). Backend task 591.
|
|
4
|
+
*/
|
|
5
|
+
interface FeedbackConfig {
|
|
6
|
+
/** API base, no trailing slash needed. e.g. https://api.verbumia.ca */
|
|
7
|
+
apiBase: string;
|
|
8
|
+
/** Public project UUID the widget targets. */
|
|
9
|
+
projectId: string;
|
|
10
|
+
/**
|
|
11
|
+
* sessionId / grouping_key is MINTED SERVER-SIDE by the Verbumia
|
|
12
|
+
* backend at POST /v1/feedback/tos and returned in the token bundle
|
|
13
|
+
* (`TokenBundle.grouping_key`). The widget receives + sends it; it
|
|
14
|
+
* MUST NOT self-generate it. There is intentionally no client config
|
|
15
|
+
* field for it.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* NOTE: there is intentionally NO `tosVersion` field. The ToS version
|
|
19
|
+
* is a BUILD-TIME constant baked into @verbumia/feedback at release
|
|
20
|
+
* (`SDK_TOS_VERSION`, task 616) — integrators do not set it; the SDK
|
|
21
|
+
* sends it automatically.
|
|
22
|
+
*/
|
|
23
|
+
/** Optional opaque end-user id; server generates one when absent. */
|
|
24
|
+
endUserId?: string;
|
|
25
|
+
/** BCP-47 language the widget rates strings in (e.g. "fr"). */
|
|
26
|
+
language: string;
|
|
27
|
+
/** Optional locale tag stored for analytics. */
|
|
28
|
+
locale?: string;
|
|
29
|
+
/** Debounce window (ms) before a queued batch is flushed. Default 1500. */
|
|
30
|
+
flushDebounceMs?: number;
|
|
31
|
+
/** Max queued items before an immediate flush. Default 20. */
|
|
32
|
+
maxBatch?: number;
|
|
33
|
+
/** Injected fetch (tests / RN polyfills). Defaults to global fetch. */
|
|
34
|
+
fetchImpl?: typeof fetch;
|
|
35
|
+
}
|
|
36
|
+
interface TokenBundle {
|
|
37
|
+
access_token: string;
|
|
38
|
+
token_type: "Bearer";
|
|
39
|
+
expires_in: number;
|
|
40
|
+
refresh_token: string;
|
|
41
|
+
refresh_expires_in: number;
|
|
42
|
+
end_user_id: string;
|
|
43
|
+
tos_version: string;
|
|
44
|
+
grouping_key: string;
|
|
45
|
+
}
|
|
46
|
+
interface FeedbackString {
|
|
47
|
+
namespace: string;
|
|
48
|
+
key: string;
|
|
49
|
+
key_uuid: string;
|
|
50
|
+
language_uuid: string;
|
|
51
|
+
value: string;
|
|
52
|
+
translation_hash: string;
|
|
53
|
+
avg_stars: number | null;
|
|
54
|
+
ratings_count: number;
|
|
55
|
+
my_rating: number | null;
|
|
56
|
+
}
|
|
57
|
+
interface StringsResponse {
|
|
58
|
+
project_id: string;
|
|
59
|
+
language: string;
|
|
60
|
+
strings: FeedbackString[];
|
|
61
|
+
}
|
|
62
|
+
/** A 5-star rating queued for a rendered string variant. */
|
|
63
|
+
interface RatingInput {
|
|
64
|
+
namespace: string;
|
|
65
|
+
key: string;
|
|
66
|
+
language: string;
|
|
67
|
+
translation_hash: string;
|
|
68
|
+
stars: number;
|
|
69
|
+
}
|
|
70
|
+
/** A suggested alternative translation queued for moderation. */
|
|
71
|
+
interface SuggestionInput {
|
|
72
|
+
namespace: string;
|
|
73
|
+
key: string;
|
|
74
|
+
language: string;
|
|
75
|
+
translation_hash: string;
|
|
76
|
+
suggested_text: string;
|
|
77
|
+
comment?: string;
|
|
78
|
+
}
|
|
79
|
+
interface BatchResponse {
|
|
80
|
+
accepted: number;
|
|
81
|
+
rejected: number;
|
|
82
|
+
items: Array<Record<string, unknown>>;
|
|
83
|
+
}
|
|
84
|
+
/** A key the host app declares as on-screen. */
|
|
85
|
+
interface DeclaredKey {
|
|
86
|
+
namespace: string;
|
|
87
|
+
key: string;
|
|
88
|
+
}
|
|
89
|
+
declare class FeedbackError extends Error {
|
|
90
|
+
readonly status?: number | undefined;
|
|
91
|
+
readonly code?: string | undefined;
|
|
92
|
+
constructor(message: string, status?: number | undefined, code?: string | undefined);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Framework-agnostic Verbumia feedback client.
|
|
97
|
+
*
|
|
98
|
+
* Responsibilities:
|
|
99
|
+
* - versioned-ToS acceptance -> scoped end-user JWT bootstrap
|
|
100
|
+
* - transparent access-token refresh (rotating refresh token)
|
|
101
|
+
* - fetch on-screen strings for the widget
|
|
102
|
+
* - debounced + size-capped batched POST of ratings / suggestions,
|
|
103
|
+
* mirroring the missing-handler transport contract (ltm 280):
|
|
104
|
+
* best-effort, never throws into the host app render path.
|
|
105
|
+
*
|
|
106
|
+
* The React and React Native entry points are thin UI shells over this.
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
declare class FeedbackClient {
|
|
110
|
+
private cfg;
|
|
111
|
+
private fetchImpl;
|
|
112
|
+
private tokens;
|
|
113
|
+
private queue;
|
|
114
|
+
private timer;
|
|
115
|
+
private bootstrapping;
|
|
116
|
+
constructor(config: FeedbackConfig);
|
|
117
|
+
private base;
|
|
118
|
+
get endUserId(): string | undefined;
|
|
119
|
+
get hasConsented(): boolean;
|
|
120
|
+
/** Server-minted sessionId / grouping_key (from the token bundle).
|
|
121
|
+
* Available only after `acceptTos()`; never client-generated. */
|
|
122
|
+
get sessionId(): string | undefined;
|
|
123
|
+
/** BCP-47 language the widget is rating strings in. */
|
|
124
|
+
get language(): string;
|
|
125
|
+
/** ToS version the end user is asked to accept — the SDK's
|
|
126
|
+
* build-time constant (task 616). NOT integrator/server set. */
|
|
127
|
+
get tosVersion(): string;
|
|
128
|
+
/**
|
|
129
|
+
* Accept the ToS and bootstrap a scoped token. Idempotent: a second call
|
|
130
|
+
* returns the in-flight / existing bundle rather than re-accepting.
|
|
131
|
+
*/
|
|
132
|
+
acceptTos(): Promise<TokenBundle>;
|
|
133
|
+
private refresh;
|
|
134
|
+
/** Authenticated fetch with a single transparent refresh-on-401 retry. */
|
|
135
|
+
private authed;
|
|
136
|
+
/** Strings rendered on the current view, with this end user's prior rating. */
|
|
137
|
+
getStrings(opts?: {
|
|
138
|
+
keys?: Array<{
|
|
139
|
+
namespace: string;
|
|
140
|
+
key: string;
|
|
141
|
+
}>;
|
|
142
|
+
namespace?: string;
|
|
143
|
+
limit?: number;
|
|
144
|
+
}): Promise<StringsResponse>;
|
|
145
|
+
/** Queue a rating; flushed on debounce or when the batch fills. */
|
|
146
|
+
rate(payload: RatingInput): void;
|
|
147
|
+
/** Queue a suggestion; flushed on debounce or when the batch fills. */
|
|
148
|
+
suggest(payload: SuggestionInput): void;
|
|
149
|
+
private enqueue;
|
|
150
|
+
/**
|
|
151
|
+
* Flush queued items. Best-effort: a transport/auth failure re-queues the
|
|
152
|
+
* batch once and swallows the error so the host app never sees a throw.
|
|
153
|
+
*/
|
|
154
|
+
flush(): Promise<void>;
|
|
155
|
+
private postBatch;
|
|
156
|
+
private problem;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export { type BatchResponse as B, type DeclaredKey as D, FeedbackClient as F, type RatingInput as R, type StringsResponse as S, type TokenBundle as T, type FeedbackConfig as a, FeedbackError as b, type FeedbackString as c, type SuggestionInput as d };
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/core/index.ts
|
|
21
|
+
var core_exports = {};
|
|
22
|
+
__export(core_exports, {
|
|
23
|
+
FeedbackClient: () => FeedbackClient,
|
|
24
|
+
FeedbackError: () => FeedbackError,
|
|
25
|
+
SDK_TOS_VERSION: () => SDK_TOS_VERSION,
|
|
26
|
+
hasKeyRegistry: () => hasKeyRegistry,
|
|
27
|
+
resolveKeys: () => resolveKeys
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(core_exports);
|
|
30
|
+
|
|
31
|
+
// src/core/types.ts
|
|
32
|
+
var FeedbackError = class extends Error {
|
|
33
|
+
constructor(message, status, code) {
|
|
34
|
+
super(message);
|
|
35
|
+
this.status = status;
|
|
36
|
+
this.code = code;
|
|
37
|
+
this.name = "FeedbackError";
|
|
38
|
+
}
|
|
39
|
+
status;
|
|
40
|
+
code;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// src/core/tos.ts
|
|
44
|
+
var SDK_TOS_VERSION = "2026-05-18";
|
|
45
|
+
|
|
46
|
+
// src/core/client.ts
|
|
47
|
+
var SDK_LIB = "@verbumia/feedback";
|
|
48
|
+
var SDK_VER = "0.1.0";
|
|
49
|
+
var FeedbackClient = class {
|
|
50
|
+
cfg;
|
|
51
|
+
fetchImpl;
|
|
52
|
+
tokens = null;
|
|
53
|
+
queue = [];
|
|
54
|
+
timer = null;
|
|
55
|
+
bootstrapping = null;
|
|
56
|
+
constructor(config) {
|
|
57
|
+
this.cfg = {
|
|
58
|
+
flushDebounceMs: 1500,
|
|
59
|
+
maxBatch: 20,
|
|
60
|
+
...config
|
|
61
|
+
};
|
|
62
|
+
const f = config.fetchImpl ?? globalThis.fetch;
|
|
63
|
+
if (!f) {
|
|
64
|
+
throw new FeedbackError(
|
|
65
|
+
"no fetch implementation available; pass config.fetchImpl"
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
this.fetchImpl = f.bind(globalThis);
|
|
69
|
+
}
|
|
70
|
+
base() {
|
|
71
|
+
return this.cfg.apiBase.replace(/\/+$/, "");
|
|
72
|
+
}
|
|
73
|
+
get endUserId() {
|
|
74
|
+
return this.tokens?.end_user_id ?? this.cfg.endUserId;
|
|
75
|
+
}
|
|
76
|
+
get hasConsented() {
|
|
77
|
+
return this.tokens !== null;
|
|
78
|
+
}
|
|
79
|
+
/** Server-minted sessionId / grouping_key (from the token bundle).
|
|
80
|
+
* Available only after `acceptTos()`; never client-generated. */
|
|
81
|
+
get sessionId() {
|
|
82
|
+
return this.tokens?.grouping_key;
|
|
83
|
+
}
|
|
84
|
+
/** BCP-47 language the widget is rating strings in. */
|
|
85
|
+
get language() {
|
|
86
|
+
return this.cfg.language;
|
|
87
|
+
}
|
|
88
|
+
/** ToS version the end user is asked to accept — the SDK's
|
|
89
|
+
* build-time constant (task 616). NOT integrator/server set. */
|
|
90
|
+
get tosVersion() {
|
|
91
|
+
return SDK_TOS_VERSION;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Accept the ToS and bootstrap a scoped token. Idempotent: a second call
|
|
95
|
+
* returns the in-flight / existing bundle rather than re-accepting.
|
|
96
|
+
*/
|
|
97
|
+
async acceptTos() {
|
|
98
|
+
if (this.tokens) return this.tokens;
|
|
99
|
+
if (this.bootstrapping) return this.bootstrapping;
|
|
100
|
+
this.bootstrapping = (async () => {
|
|
101
|
+
const res = await this.fetchImpl(`${this.base()}/v1/feedback/tos`, {
|
|
102
|
+
method: "POST",
|
|
103
|
+
headers: { "Content-Type": "application/json" },
|
|
104
|
+
body: JSON.stringify({
|
|
105
|
+
// NO grouping_key: server-minted (task 599). It comes back in
|
|
106
|
+
// the token bundle and is bound into the JWT server-side.
|
|
107
|
+
project_id: this.cfg.projectId,
|
|
108
|
+
end_user_id: this.cfg.endUserId,
|
|
109
|
+
tos_version: SDK_TOS_VERSION,
|
|
110
|
+
locale: this.cfg.locale
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
if (!res.ok) throw await this.problem(res, "tos acceptance failed");
|
|
114
|
+
this.tokens = await res.json();
|
|
115
|
+
return this.tokens;
|
|
116
|
+
})();
|
|
117
|
+
try {
|
|
118
|
+
return await this.bootstrapping;
|
|
119
|
+
} finally {
|
|
120
|
+
this.bootstrapping = null;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
async refresh() {
|
|
124
|
+
if (!this.tokens) throw new FeedbackError("not consented");
|
|
125
|
+
const res = await this.fetchImpl(
|
|
126
|
+
`${this.base()}/v1/feedback/token/refresh`,
|
|
127
|
+
{
|
|
128
|
+
method: "POST",
|
|
129
|
+
headers: { "Content-Type": "application/json" },
|
|
130
|
+
body: JSON.stringify({ refresh_token: this.tokens.refresh_token })
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
if (!res.ok) {
|
|
134
|
+
this.tokens = null;
|
|
135
|
+
throw await this.problem(res, "token refresh failed");
|
|
136
|
+
}
|
|
137
|
+
this.tokens = await res.json();
|
|
138
|
+
}
|
|
139
|
+
/** Authenticated fetch with a single transparent refresh-on-401 retry. */
|
|
140
|
+
async authed(path, init, retry = true) {
|
|
141
|
+
if (!this.tokens) await this.acceptTos();
|
|
142
|
+
const res = await this.fetchImpl(`${this.base()}${path}`, {
|
|
143
|
+
...init,
|
|
144
|
+
headers: {
|
|
145
|
+
...init.headers ?? {},
|
|
146
|
+
Authorization: `Bearer ${this.tokens.access_token}`
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
if (res.status === 401 && retry) {
|
|
150
|
+
await this.refresh();
|
|
151
|
+
return this.authed(path, init, false);
|
|
152
|
+
}
|
|
153
|
+
return res;
|
|
154
|
+
}
|
|
155
|
+
/** Strings rendered on the current view, with this end user's prior rating. */
|
|
156
|
+
async getStrings(opts) {
|
|
157
|
+
const qs = new URLSearchParams({ language: this.cfg.language });
|
|
158
|
+
if (opts?.keys?.length) {
|
|
159
|
+
qs.set("keys", opts.keys.map((k) => `${k.namespace}:${k.key}`).join(","));
|
|
160
|
+
}
|
|
161
|
+
if (opts?.namespace) qs.set("namespace", opts.namespace);
|
|
162
|
+
if (opts?.limit) qs.set("limit", String(opts.limit));
|
|
163
|
+
const res = await this.authed(`/v1/feedback/strings?${qs}`, {
|
|
164
|
+
method: "GET"
|
|
165
|
+
});
|
|
166
|
+
if (!res.ok) throw await this.problem(res, "failed to load strings");
|
|
167
|
+
return await res.json();
|
|
168
|
+
}
|
|
169
|
+
/** Queue a rating; flushed on debounce or when the batch fills. */
|
|
170
|
+
rate(payload) {
|
|
171
|
+
this.enqueue({ kind: "rating", payload });
|
|
172
|
+
}
|
|
173
|
+
/** Queue a suggestion; flushed on debounce or when the batch fills. */
|
|
174
|
+
suggest(payload) {
|
|
175
|
+
this.enqueue({ kind: "suggestion", payload });
|
|
176
|
+
}
|
|
177
|
+
enqueue(item) {
|
|
178
|
+
this.queue.push(item);
|
|
179
|
+
if (this.queue.length >= this.cfg.maxBatch) {
|
|
180
|
+
void this.flush();
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (this.timer) clearTimeout(this.timer);
|
|
184
|
+
this.timer = setTimeout(() => void this.flush(), this.cfg.flushDebounceMs);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Flush queued items. Best-effort: a transport/auth failure re-queues the
|
|
188
|
+
* batch once and swallows the error so the host app never sees a throw.
|
|
189
|
+
*/
|
|
190
|
+
async flush() {
|
|
191
|
+
if (this.timer) {
|
|
192
|
+
clearTimeout(this.timer);
|
|
193
|
+
this.timer = null;
|
|
194
|
+
}
|
|
195
|
+
if (!this.queue.length) return;
|
|
196
|
+
const batch = this.queue;
|
|
197
|
+
this.queue = [];
|
|
198
|
+
const ratings = batch.filter((b) => b.kind === "rating").map((b) => b.payload);
|
|
199
|
+
const suggestions = batch.filter((b) => b.kind === "suggestion").map((b) => b.payload);
|
|
200
|
+
try {
|
|
201
|
+
if (ratings.length) {
|
|
202
|
+
await this.postBatch("/v1/feedback/ratings", { ratings });
|
|
203
|
+
}
|
|
204
|
+
if (suggestions.length) {
|
|
205
|
+
await this.postBatch("/v1/feedback/suggestions", { suggestions });
|
|
206
|
+
}
|
|
207
|
+
} catch {
|
|
208
|
+
this.queue.unshift(...batch);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
async postBatch(path, body) {
|
|
212
|
+
const res = await this.authed(path, {
|
|
213
|
+
method: "POST",
|
|
214
|
+
headers: { "Content-Type": "application/json", "X-SDK": `${SDK_LIB}@${SDK_VER}` },
|
|
215
|
+
body: JSON.stringify(body)
|
|
216
|
+
});
|
|
217
|
+
if (!res.ok) throw await this.problem(res, "batch post failed");
|
|
218
|
+
return await res.json();
|
|
219
|
+
}
|
|
220
|
+
async problem(res, fallback) {
|
|
221
|
+
let code;
|
|
222
|
+
let detail = fallback;
|
|
223
|
+
try {
|
|
224
|
+
const body = await res.json();
|
|
225
|
+
code = body.code;
|
|
226
|
+
if (body.detail) detail = body.detail;
|
|
227
|
+
} catch {
|
|
228
|
+
}
|
|
229
|
+
return new FeedbackError(detail, res.status, code);
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
// src/core/keys.ts
|
|
234
|
+
var REGISTRY_GLOBAL = "__verbumia_key_registry__";
|
|
235
|
+
function getRegistry() {
|
|
236
|
+
const g = globalThis;
|
|
237
|
+
const reg = g[REGISTRY_GLOBAL];
|
|
238
|
+
if (reg && typeof reg.snapshot === "function") {
|
|
239
|
+
return reg;
|
|
240
|
+
}
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
function hasKeyRegistry() {
|
|
244
|
+
return getRegistry() !== null;
|
|
245
|
+
}
|
|
246
|
+
function resolveKeys(explicit) {
|
|
247
|
+
if (explicit && explicit.length) return dedupe(explicit);
|
|
248
|
+
const reg = getRegistry();
|
|
249
|
+
if (reg) return dedupe(reg.snapshot());
|
|
250
|
+
return [];
|
|
251
|
+
}
|
|
252
|
+
function dedupe(keys) {
|
|
253
|
+
const seen = /* @__PURE__ */ new Set();
|
|
254
|
+
const out = [];
|
|
255
|
+
for (const k of keys) {
|
|
256
|
+
const id = `${k.namespace}:${k.key}`;
|
|
257
|
+
if (!seen.has(id)) {
|
|
258
|
+
seen.add(id);
|
|
259
|
+
out.push(k);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return out;
|
|
263
|
+
}
|
|
264
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
265
|
+
0 && (module.exports = {
|
|
266
|
+
FeedbackClient,
|
|
267
|
+
FeedbackError,
|
|
268
|
+
SDK_TOS_VERSION,
|
|
269
|
+
hasKeyRegistry,
|
|
270
|
+
resolveKeys
|
|
271
|
+
});
|
|
272
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/index.ts","../../src/core/types.ts","../../src/core/tos.ts","../../src/core/client.ts","../../src/core/keys.ts"],"sourcesContent":["export { FeedbackClient } from \"./client\";\nexport { SDK_TOS_VERSION } from \"./tos\";\nexport { hasKeyRegistry, resolveKeys } from \"./keys\";\nexport {\n type BatchResponse,\n type DeclaredKey,\n type FeedbackConfig,\n FeedbackError,\n type FeedbackString,\n type RatingInput,\n type StringsResponse,\n type SuggestionInput,\n type TokenBundle,\n} from \"./types\";\n","/**\n * Wire types for the Verbumia End-User Translation Evaluation API.\n * Canonical reference: ./CONTRACT.md (frozen). Backend task 591.\n */\n\nexport interface FeedbackConfig {\n /** API base, no trailing slash needed. e.g. https://api.verbumia.ca */\n apiBase: string;\n /** Public project UUID the widget targets. */\n projectId: string;\n /**\n * sessionId / grouping_key is MINTED SERVER-SIDE by the Verbumia\n * backend at POST /v1/feedback/tos and returned in the token bundle\n * (`TokenBundle.grouping_key`). The widget receives + sends it; it\n * MUST NOT self-generate it. There is intentionally no client config\n * field for it.\n */\n /**\n * NOTE: there is intentionally NO `tosVersion` field. The ToS version\n * is a BUILD-TIME constant baked into @verbumia/feedback at release\n * (`SDK_TOS_VERSION`, task 616) — integrators do not set it; the SDK\n * sends it automatically.\n */\n /** Optional opaque end-user id; server generates one when absent. */\n endUserId?: string;\n /** BCP-47 language the widget rates strings in (e.g. \"fr\"). */\n language: string;\n /** Optional locale tag stored for analytics. */\n locale?: string;\n /** Debounce window (ms) before a queued batch is flushed. Default 1500. */\n flushDebounceMs?: number;\n /** Max queued items before an immediate flush. Default 20. */\n maxBatch?: number;\n /** Injected fetch (tests / RN polyfills). Defaults to global fetch. */\n fetchImpl?: typeof fetch;\n}\n\nexport interface TokenBundle {\n access_token: string;\n token_type: \"Bearer\";\n expires_in: number;\n refresh_token: string;\n refresh_expires_in: number;\n end_user_id: string;\n tos_version: string;\n grouping_key: string;\n}\n\nexport interface FeedbackString {\n namespace: string;\n key: string;\n key_uuid: string;\n language_uuid: string;\n value: string;\n translation_hash: string;\n avg_stars: number | null;\n ratings_count: number;\n my_rating: number | null;\n}\n\nexport interface StringsResponse {\n project_id: string;\n language: string;\n strings: FeedbackString[];\n}\n\n/** A 5-star rating queued for a rendered string variant. */\nexport interface RatingInput {\n namespace: string;\n key: string;\n language: string;\n translation_hash: string;\n stars: number; // 1..5\n}\n\n/** A suggested alternative translation queued for moderation. */\nexport interface SuggestionInput {\n namespace: string;\n key: string;\n language: string;\n translation_hash: string;\n suggested_text: string;\n comment?: string;\n}\n\nexport interface BatchResponse {\n accepted: number;\n rejected: number;\n items: Array<Record<string, unknown>>;\n}\n\n/** A key the host app declares as on-screen. */\nexport interface DeclaredKey {\n namespace: string;\n key: string;\n}\n\nexport class FeedbackError extends Error {\n constructor(\n message: string,\n readonly status?: number,\n readonly code?: string,\n ) {\n super(message);\n this.name = \"FeedbackError\";\n }\n}\n","/**\n * BUILD-TIME ToS version constant (task 616, human decision option B).\n *\n * This is baked into the @verbumia/feedback PACKAGE at release. It is\n * NOT an integrator-set config field and NOT server-driven: a stale\n * (e.g. native) app must record consent to the ToS version IT shipped\n * and displayed, for legal correctness — never backend-latest.\n *\n * Releasing a ToS-TEXT change ⇒ bump this constant + cut a new\n * @verbumia/feedback release (per the human/real-CI publish handoff).\n * The backend accepts any version in its acceptable set and records it.\n */\nexport const SDK_TOS_VERSION = \"2026-05-18\";\n","/**\n * Framework-agnostic Verbumia feedback client.\n *\n * Responsibilities:\n * - versioned-ToS acceptance -> scoped end-user JWT bootstrap\n * - transparent access-token refresh (rotating refresh token)\n * - fetch on-screen strings for the widget\n * - debounced + size-capped batched POST of ratings / suggestions,\n * mirroring the missing-handler transport contract (ltm 280):\n * best-effort, never throws into the host app render path.\n *\n * The React and React Native entry points are thin UI shells over this.\n */\n\nimport {\n type BatchResponse,\n type FeedbackConfig,\n FeedbackError,\n type RatingInput,\n type StringsResponse,\n type SuggestionInput,\n type TokenBundle,\n} from \"./types\";\nimport { SDK_TOS_VERSION } from \"./tos\";\n\nconst SDK_LIB = \"@verbumia/feedback\";\nconst SDK_VER = \"0.1.0\";\n\ntype QueueItem =\n | { kind: \"rating\"; payload: RatingInput }\n | { kind: \"suggestion\"; payload: SuggestionInput };\n\nexport class FeedbackClient {\n private cfg: Required<\n Pick<FeedbackConfig, \"flushDebounceMs\" | \"maxBatch\">\n > &\n FeedbackConfig;\n private fetchImpl: typeof fetch;\n private tokens: TokenBundle | null = null;\n private queue: QueueItem[] = [];\n private timer: ReturnType<typeof setTimeout> | null = null;\n private bootstrapping: Promise<TokenBundle> | null = null;\n\n constructor(config: FeedbackConfig) {\n this.cfg = {\n flushDebounceMs: 1500,\n maxBatch: 20,\n ...config,\n };\n const f = config.fetchImpl ?? globalThis.fetch;\n if (!f) {\n throw new FeedbackError(\n \"no fetch implementation available; pass config.fetchImpl\",\n );\n }\n this.fetchImpl = f.bind(globalThis);\n }\n\n private base(): string {\n return this.cfg.apiBase.replace(/\\/+$/, \"\");\n }\n\n get endUserId(): string | undefined {\n return this.tokens?.end_user_id ?? this.cfg.endUserId;\n }\n\n get hasConsented(): boolean {\n return this.tokens !== null;\n }\n\n /** Server-minted sessionId / grouping_key (from the token bundle).\n * Available only after `acceptTos()`; never client-generated. */\n get sessionId(): string | undefined {\n return this.tokens?.grouping_key;\n }\n\n /** BCP-47 language the widget is rating strings in. */\n get language(): string {\n return this.cfg.language;\n }\n\n /** ToS version the end user is asked to accept — the SDK's\n * build-time constant (task 616). NOT integrator/server set. */\n get tosVersion(): string {\n return SDK_TOS_VERSION;\n }\n\n /**\n * Accept the ToS and bootstrap a scoped token. Idempotent: a second call\n * returns the in-flight / existing bundle rather than re-accepting.\n */\n async acceptTos(): Promise<TokenBundle> {\n if (this.tokens) return this.tokens;\n if (this.bootstrapping) return this.bootstrapping;\n this.bootstrapping = (async () => {\n const res = await this.fetchImpl(`${this.base()}/v1/feedback/tos`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n // NO grouping_key: server-minted (task 599). It comes back in\n // the token bundle and is bound into the JWT server-side.\n project_id: this.cfg.projectId,\n end_user_id: this.cfg.endUserId,\n tos_version: SDK_TOS_VERSION,\n locale: this.cfg.locale,\n }),\n });\n if (!res.ok) throw await this.problem(res, \"tos acceptance failed\");\n this.tokens = (await res.json()) as TokenBundle;\n return this.tokens;\n })();\n try {\n return await this.bootstrapping;\n } finally {\n this.bootstrapping = null;\n }\n }\n\n private async refresh(): Promise<void> {\n if (!this.tokens) throw new FeedbackError(\"not consented\");\n const res = await this.fetchImpl(\n `${this.base()}/v1/feedback/token/refresh`,\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ refresh_token: this.tokens.refresh_token }),\n },\n );\n if (!res.ok) {\n this.tokens = null; // force a fresh ToS step\n throw await this.problem(res, \"token refresh failed\");\n }\n this.tokens = (await res.json()) as TokenBundle;\n }\n\n /** Authenticated fetch with a single transparent refresh-on-401 retry. */\n private async authed(\n path: string,\n init: RequestInit,\n retry = true,\n ): Promise<Response> {\n if (!this.tokens) await this.acceptTos();\n const res = await this.fetchImpl(`${this.base()}${path}`, {\n ...init,\n headers: {\n ...(init.headers ?? {}),\n Authorization: `Bearer ${this.tokens!.access_token}`,\n },\n });\n if (res.status === 401 && retry) {\n await this.refresh();\n return this.authed(path, init, false);\n }\n return res;\n }\n\n /** Strings rendered on the current view, with this end user's prior rating. */\n async getStrings(opts?: {\n keys?: Array<{ namespace: string; key: string }>;\n namespace?: string;\n limit?: number;\n }): Promise<StringsResponse> {\n const qs = new URLSearchParams({ language: this.cfg.language });\n if (opts?.keys?.length) {\n qs.set(\"keys\", opts.keys.map((k) => `${k.namespace}:${k.key}`).join(\",\"));\n }\n if (opts?.namespace) qs.set(\"namespace\", opts.namespace);\n if (opts?.limit) qs.set(\"limit\", String(opts.limit));\n const res = await this.authed(`/v1/feedback/strings?${qs}`, {\n method: \"GET\",\n });\n if (!res.ok) throw await this.problem(res, \"failed to load strings\");\n return (await res.json()) as StringsResponse;\n }\n\n /** Queue a rating; flushed on debounce or when the batch fills. */\n rate(payload: RatingInput): void {\n this.enqueue({ kind: \"rating\", payload });\n }\n\n /** Queue a suggestion; flushed on debounce or when the batch fills. */\n suggest(payload: SuggestionInput): void {\n this.enqueue({ kind: \"suggestion\", payload });\n }\n\n private enqueue(item: QueueItem): void {\n this.queue.push(item);\n if (this.queue.length >= this.cfg.maxBatch) {\n void this.flush();\n return;\n }\n if (this.timer) clearTimeout(this.timer);\n this.timer = setTimeout(() => void this.flush(), this.cfg.flushDebounceMs);\n }\n\n /**\n * Flush queued items. Best-effort: a transport/auth failure re-queues the\n * batch once and swallows the error so the host app never sees a throw.\n */\n async flush(): Promise<void> {\n if (this.timer) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n if (!this.queue.length) return;\n const batch = this.queue;\n this.queue = [];\n const ratings = batch\n .filter((b) => b.kind === \"rating\")\n .map((b) => b.payload as RatingInput);\n const suggestions = batch\n .filter((b) => b.kind === \"suggestion\")\n .map((b) => b.payload as SuggestionInput);\n try {\n if (ratings.length) {\n await this.postBatch(\"/v1/feedback/ratings\", { ratings });\n }\n if (suggestions.length) {\n await this.postBatch(\"/v1/feedback/suggestions\", { suggestions });\n }\n } catch {\n // Re-queue once; feedback must never break the host app.\n this.queue.unshift(...batch);\n }\n }\n\n private async postBatch(\n path: string,\n body: unknown,\n ): Promise<BatchResponse> {\n const res = await this.authed(path, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", \"X-SDK\": `${SDK_LIB}@${SDK_VER}` },\n body: JSON.stringify(body),\n });\n if (!res.ok) throw await this.problem(res, \"batch post failed\");\n return (await res.json()) as BatchResponse;\n }\n\n private async problem(res: Response, fallback: string): Promise<FeedbackError> {\n let code: string | undefined;\n let detail = fallback;\n try {\n const body = (await res.json()) as { code?: string; detail?: string };\n code = body.code;\n if (body.detail) detail = body.detail;\n } catch {\n /* non-JSON body */\n }\n return new FeedbackError(detail, res.status, code);\n }\n}\n","/**\n * On-screen key discovery.\n *\n * Preferred source: the `@verbumia/*-i18n` SDK exposes a lightweight key\n * registry of keys it has rendered. When that registry is present on the\n * global (the i18n SDK publishes `globalThis.__verbumia_key_registry__`),\n * we read the keys touched on the current view. Otherwise the host app\n * passes an explicit `keys` list — the always-available fallback.\n *\n * The registry contract is intentionally tiny so any framework port of the\n * i18n SDK can implement it without depending on this package.\n */\n\nimport type { DeclaredKey } from \"./types\";\n\nconst REGISTRY_GLOBAL = \"__verbumia_key_registry__\";\n\ninterface KeyRegistry {\n /** Returns the keys rendered since the last `reset()` (or ever). */\n snapshot(): DeclaredKey[];\n reset?(): void;\n}\n\nfunction getRegistry(): KeyRegistry | null {\n const g = globalThis as Record<string, unknown>;\n const reg = g[REGISTRY_GLOBAL];\n if (\n reg &&\n typeof (reg as KeyRegistry).snapshot === \"function\"\n ) {\n return reg as KeyRegistry;\n }\n return null;\n}\n\n/** True when a compatible `@verbumia/*-i18n` registry is detectable. */\nexport function hasKeyRegistry(): boolean {\n return getRegistry() !== null;\n}\n\n/**\n * Resolve the on-screen keys: explicit `keys` prop always wins (it is the\n * customer's authoritative declaration); otherwise fall back to the i18n\n * registry snapshot; otherwise an empty list (widget shows \"no strings\").\n */\nexport function resolveKeys(explicit?: DeclaredKey[]): DeclaredKey[] {\n if (explicit && explicit.length) return dedupe(explicit);\n const reg = getRegistry();\n if (reg) return dedupe(reg.snapshot());\n return [];\n}\n\nfunction dedupe(keys: DeclaredKey[]): DeclaredKey[] {\n const seen = new Set<string>();\n const out: DeclaredKey[] = [];\n for (const k of keys) {\n const id = `${k.namespace}:${k.key}`;\n if (!seen.has(id)) {\n seen.add(id);\n out.push(k);\n }\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiGO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EACvC,YACE,SACS,QACA,MACT;AACA,UAAM,OAAO;AAHJ;AACA;AAGT,SAAK,OAAO;AAAA,EACd;AAAA,EALW;AAAA,EACA;AAKb;;;AC9FO,IAAM,kBAAkB;;;AC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7B,MACE,OACA,OAAQ,IAAoB,aAAa,YACzC;AACA,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAGO,SAAS,iBAA0B;AACxC,SAAO,YAAY,MAAM;AAC3B;AAOO,SAAS,YAAY,UAAyC;AACnE,MAAI,YAAY,SAAS,OAAQ,QAAO,OAAO,QAAQ;AACvD,QAAM,MAAM,YAAY;AACxB,MAAI,IAAK,QAAO,OAAO,IAAI,SAAS,CAAC;AACrC,SAAO,CAAC;AACV;AAEA,SAAS,OAAO,MAAoC;AAClD,QAAM,OAAO,oBAAI,IAAY;AAC7B,QAAM,MAAqB,CAAC;AAC5B,aAAW,KAAK,MAAM;AACpB,UAAM,KAAK,GAAG,EAAE,SAAS,IAAI,EAAE,GAAG;AAClC,QAAI,CAAC,KAAK,IAAI,EAAE,GAAG;AACjB,WAAK,IAAI,EAAE;AACX,UAAI,KAAK,CAAC;AAAA,IACZ;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { B as BatchResponse, D as DeclaredKey, F as FeedbackClient, a as FeedbackConfig, b as FeedbackError, c as FeedbackString, R as RatingInput, S as StringsResponse, d as SuggestionInput, T as TokenBundle } from '../client-CPEcvn23.cjs';
|
|
2
|
+
export { h as hasKeyRegistry, r as resolveKeys } from '../keys-Dg_nv16u.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* BUILD-TIME ToS version constant (task 616, human decision option B).
|
|
6
|
+
*
|
|
7
|
+
* This is baked into the @verbumia/feedback PACKAGE at release. It is
|
|
8
|
+
* NOT an integrator-set config field and NOT server-driven: a stale
|
|
9
|
+
* (e.g. native) app must record consent to the ToS version IT shipped
|
|
10
|
+
* and displayed, for legal correctness — never backend-latest.
|
|
11
|
+
*
|
|
12
|
+
* Releasing a ToS-TEXT change ⇒ bump this constant + cut a new
|
|
13
|
+
* @verbumia/feedback release (per the human/real-CI publish handoff).
|
|
14
|
+
* The backend accepts any version in its acceptable set and records it.
|
|
15
|
+
*/
|
|
16
|
+
declare const SDK_TOS_VERSION = "2026-05-18";
|
|
17
|
+
|
|
18
|
+
export { SDK_TOS_VERSION };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { B as BatchResponse, D as DeclaredKey, F as FeedbackClient, a as FeedbackConfig, b as FeedbackError, c as FeedbackString, R as RatingInput, S as StringsResponse, d as SuggestionInput, T as TokenBundle } from '../client-CPEcvn23.js';
|
|
2
|
+
export { h as hasKeyRegistry, r as resolveKeys } from '../keys-BySe1O6V.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* BUILD-TIME ToS version constant (task 616, human decision option B).
|
|
6
|
+
*
|
|
7
|
+
* This is baked into the @verbumia/feedback PACKAGE at release. It is
|
|
8
|
+
* NOT an integrator-set config field and NOT server-driven: a stale
|
|
9
|
+
* (e.g. native) app must record consent to the ToS version IT shipped
|
|
10
|
+
* and displayed, for legal correctness — never backend-latest.
|
|
11
|
+
*
|
|
12
|
+
* Releasing a ToS-TEXT change ⇒ bump this constant + cut a new
|
|
13
|
+
* @verbumia/feedback release (per the human/real-CI publish handoff).
|
|
14
|
+
* The backend accepts any version in its acceptable set and records it.
|
|
15
|
+
*/
|
|
16
|
+
declare const SDK_TOS_VERSION = "2026-05-18";
|
|
17
|
+
|
|
18
|
+
export { SDK_TOS_VERSION };
|