@quantidia/sdk 1.0.8 → 1.0.9

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 (3) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +161 -3
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,16 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
7
7
 
8
8
  ---
9
9
 
10
+ ## [1.0.8] - 2026-06-11
11
+
12
+ ### Fixed
13
+ - `./ui` export path corrected from `dist/ui.mjs` → `dist/ui.js` so `import from "@quantidia/sdk/ui"` resolves correctly in Vite, webpack and other bundlers
14
+
15
+ ### Added
16
+ - NPM / ES Module documentation in README
17
+
18
+ ---
19
+
10
20
  ## [1.0.7] - 2026-06-10
11
21
 
12
22
  ### Changed
package/README.md CHANGED
@@ -138,14 +138,172 @@ await SDK.openSigningWithLogin({
138
138
 
139
139
  ## NPM / ES Module
140
140
 
141
- > 📖 Full NPM and ES Module documentation is in progress.
141
+ ### Installation
142
142
 
143
143
  ```bash
144
144
  npm install @quantidia/sdk
145
145
  ```
146
146
 
147
- ```ts
148
- import { init, openSigningWithLogin, addDocuments, clearDocuments } from "@quantidia/sdk/ui";
147
+ ### Imports
148
+
149
+ The package ships two entry points:
150
+
151
+ | Entry point | Contents |
152
+ |---|---|
153
+ | `@quantidia/sdk` | OpenAPI REST client (generated) |
154
+ | `@quantidia/sdk/ui` | Signing UI — `init`, `openSigningWithLogin`, `addDocuments`, `clearDocuments`, `close`, `listSignedDocuments`, `getSignedDocumentBytes` |
155
+
156
+ ```js
157
+ import {
158
+ init,
159
+ addDocuments,
160
+ clearDocuments,
161
+ openSigningWithLogin,
162
+ } from "@quantidia/sdk/ui";
163
+ ```
164
+
165
+ TypeScript types are included — no `@types` package needed.
166
+
167
+ ---
168
+
169
+ ### 1. Initialize
170
+
171
+ Call `init()` once, before any other function. The same options apply as in the CDN version.
172
+
173
+ ```js
174
+ init({
175
+ baseUrl: "https://your-backend.example.com/integration",
176
+ apiBase: "https://your-backend.example.com",
177
+ view: "full", // "full" | "restricted" | "gateway"
178
+ forceNexu: false,
179
+ nexuUrl: "https://localhost:9895/rest/certificates",
180
+ nexuSignUrl: "https://localhost:9895/rest/sign",
181
+ });
182
+ ```
183
+
184
+ | Option | Type | Required | Description |
185
+ |---|---|---|---|
186
+ | `baseUrl` | `string` | Yes | Base URL of the signing integration endpoint |
187
+ | `apiBase` | `string` | Yes | Base URL of the API (without path) |
188
+ | `view` | `string` | No | Signing UI view mode (`"full"` default) |
189
+ | `forceNexu` | `boolean` | No | Always use Nexu for local certificate signing |
190
+ | `nexuUrl` | `string` | No | Nexu certificates endpoint |
191
+ | `nexuSignUrl` | `string` | No | Nexu sign endpoint |
192
+
193
+ ---
194
+
195
+ ### 2. Load documents
196
+
197
+ ```js
198
+ // From a file input element
199
+ fileInput.addEventListener("change", async (e) => {
200
+ const files = Array.from(e.target.files);
201
+
202
+ clearDocuments();
203
+ const docIds = await addDocuments(files);
204
+
205
+ console.log("Loaded doc IDs:", docIds);
206
+ });
207
+ ```
208
+
209
+ ```js
210
+ // From a URL
211
+ async function fileFromUrl(url, filename) {
212
+ const res = await fetch(url);
213
+ const blob = await res.blob();
214
+ return new File([blob], filename, { type: "application/pdf" });
215
+ }
216
+
217
+ const file = await fileFromUrl("/documents/contract.pdf", "contract.pdf");
218
+ clearDocuments();
219
+ const docIds = await addDocuments([file]);
220
+ ```
221
+
222
+ `addDocuments(files: File[])` returns `Promise<string[]>` — the list of document IDs to pass to the signing call.
223
+
224
+ ---
225
+
226
+ ### 3. Open the signing modal
227
+
228
+ #### With username and password
229
+
230
+ ```js
231
+ try {
232
+ const result = await openSigningWithLogin({
233
+ authLogin: {
234
+ authReference: {
235
+ environmentId: "your-environment-id",
236
+ userId: "external-user-id",
237
+ subscriptionId: "subscription-id",
238
+ companyId: "company-id",
239
+ },
240
+ authLogin: {
241
+ username: "user@example.com",
242
+ password: "userpassword",
243
+ },
244
+ },
245
+ headersOverride: {
246
+ apiKey: "your-api-key",
247
+ acceptLanguage: "es-AR",
248
+ },
249
+ docId: docIds[0],
250
+ docIds,
251
+ });
252
+
253
+ console.log("Signed:", result);
254
+ } catch (err) {
255
+ console.error("Signing failed or cancelled:", err.message);
256
+ }
257
+ ```
258
+
259
+ #### With an access token
260
+
261
+ ```js
262
+ const result = await openSigningWithLogin({
263
+ authLogin: {
264
+ authReference: {
265
+ environmentId: "your-environment-id",
266
+ },
267
+ authLogin: {
268
+ accessToken: "eyJhbGci...",
269
+ },
270
+ },
271
+ headersOverride: {
272
+ apiKey: "your-api-key",
273
+ },
274
+ docId: docIds[0],
275
+ docIds,
276
+ });
277
+ ```
278
+
279
+ `openSigningWithLogin` returns a `Promise` that resolves when the user completes signing and rejects if the user cancels or an error occurs.
280
+
281
+ ---
282
+
283
+ ### Bundler notes
284
+
285
+ **Vite / webpack / Rollup** — no special configuration needed from `@quantidia/sdk ≥ 1.0.8`.
286
+
287
+ If you are pinned to an older version (`< 1.0.8`), add a manual alias in `vite.config.js` to work around an incorrect exports path in those releases:
288
+
289
+ ```js
290
+ // vite.config.js (only needed for @quantidia/sdk < 1.0.8)
291
+ import { defineConfig } from "vite";
292
+ import path from "path";
293
+ import { fileURLToPath } from "url";
294
+
295
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
296
+
297
+ export default defineConfig({
298
+ resolve: {
299
+ alias: {
300
+ "@quantidia/sdk/ui": path.resolve(
301
+ __dirname,
302
+ "node_modules/@quantidia/sdk/dist/ui.js"
303
+ ),
304
+ },
305
+ },
306
+ });
149
307
  ```
150
308
 
151
309
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantidia/sdk",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Quantidia SDK for digital signature integrations (Fortify, Nexu, cloud signing)",
5
5
  "type": "module",
6
6
  "main": "./dist/quantidia-sdk.cjs",