@viu/emporix-sdk 2.34.0 → 2.35.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/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @viu/emporix-sdk
2
2
 
3
+ ## 2.35.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#273](https://github.com/viuteam/emporix-sdk/pull/273) [`23406dc`](https://github.com/viuteam/emporix-sdk/commit/23406dc3b99bde255c3c01157f3ee6093bbc490a) Thanks [@amnael1](https://github.com/amnael1)! - feat(sdk): expose the customer password-migration endpoints
8
+
9
+ `client.customerAdmin` gains the four operations Emporix added to the Customer
10
+ Service: `getPasswordMigrationRetention`, `configurePasswordMigrationRetention`
11
+ and `deletePasswordMigrationRetention` for the retention window, plus
12
+ `importCustomers` for the bulk import.
13
+
14
+ Together they cover migrating customers off a legacy shop. Configure a retention
15
+ window, import customers carrying `legacyAuth`, and each legacy password hash is
16
+ replaced with an Emporix hash on that customer's first successful login. Without
17
+ an active config the import is rejected — the order matters.
18
+
19
+ `importCustomers` answers **207 Multi-Status**, so per-item failures arrive as
20
+ data with their own `code` rather than throwing. Inspect every entry.
21
+
22
+ All four need a service token with `customer.import_read` or
23
+ `customer.import_manage`, so there are no React hooks — see `docs/customer-admin.md`.
24
+
25
+ ### Patch Changes
26
+
27
+ - [#272](https://github.com/viuteam/emporix-sdk/pull/272) [`87552e7`](https://github.com/viuteam/emporix-sdk/commit/87552e72d5e2de7d1523c3664c49d3cd2f643214) Thanks [@viu-release-bot](https://github.com/apps/viu-release-bot)! - chore(sdk): sync generated types with upstream Emporix API specs
28
+
29
+ Updated services: customer-service
30
+
3
31
  ## 2.34.0
4
32
 
5
33
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -995,7 +995,7 @@ var HttpClient = class {
995
995
  };
996
996
 
997
997
  // package.json
998
- var version = "2.34.0";
998
+ var version = "2.35.0";
999
999
 
1000
1000
  // src/version.ts
1001
1001
  var SDK_VERSION = version;
@@ -8390,6 +8390,9 @@ var CustomerAdminService = class {
8390
8390
  customerPath(customerNumber) {
8391
8391
  return `${this.base()}/${encodeURIComponent(customerNumber)}`;
8392
8392
  }
8393
+ configPath() {
8394
+ return `/customer/${this.ctx.tenant}/config/password-migration-retention`;
8395
+ }
8393
8396
  addressPath(customerNumber, addressId) {
8394
8397
  return `${this.customerPath(customerNumber)}/addresses/${encodeURIComponent(addressId)}`;
8395
8398
  }
@@ -8480,6 +8483,59 @@ var CustomerAdminService = class {
8480
8483
  query: { tags: tags.join(",") }
8481
8484
  });
8482
8485
  }
8486
+ // --- Password-migration retention ---
8487
+ /**
8488
+ * Retrieves the tenant's password-migration retention config. Requires the
8489
+ * `customer.import_read` scope. An unconfigured tenant answers with an empty
8490
+ * object rather than a 404.
8491
+ */
8492
+ async getPasswordMigrationRetention(auth2 = SERVICE35) {
8493
+ return this.ctx.http.request({
8494
+ method: "GET",
8495
+ path: this.configPath(),
8496
+ auth: auth2
8497
+ });
8498
+ }
8499
+ /**
8500
+ * Creates or updates the retention config (`POST`). Requires the
8501
+ * `customer.import_manage` scope. **Call this before importing customers with
8502
+ * `legacyAuth`** — that import is rejected without an active config. Re-POST with
8503
+ * an earlier `retentionEndDate` to shorten a running window.
8504
+ */
8505
+ async configurePasswordMigrationRetention(input, auth2 = SERVICE35) {
8506
+ return this.ctx.http.request({
8507
+ method: "POST",
8508
+ path: this.configPath(),
8509
+ auth: auth2,
8510
+ body: input
8511
+ });
8512
+ }
8513
+ /**
8514
+ * Removes the retention config. Requires the `customer.import_manage` scope.
8515
+ * Intended for after the migration window: when the window ends, unmigrated
8516
+ * accounts need a password reset and their legacy credentials are cleared.
8517
+ */
8518
+ async deletePasswordMigrationRetention(auth2 = SERVICE35) {
8519
+ await this.ctx.http.request({ method: "DELETE", path: this.configPath(), auth: auth2 });
8520
+ }
8521
+ // --- Bulk import ---
8522
+ /**
8523
+ * Bulk-imports customers (`POST /customers/import`). Requires the
8524
+ * `customer.import_manage` scope.
8525
+ *
8526
+ * Responds **207 Multi-Status**: per-item failures do **not** throw — inspect each
8527
+ * entry's `code`. Each item must carry exactly one of `account.passwordHash` or
8528
+ * `account.legacyAuth`, and importing `legacyAuth` requires an active retention
8529
+ * config (see `configurePasswordMigrationRetention`).
8530
+ */
8531
+ async importCustomers(input, auth2 = SERVICE35) {
8532
+ return this.ctx.http.request({
8533
+ method: "POST",
8534
+ path: `${this.base()}/import`,
8535
+ auth: auth2,
8536
+ body: input
8537
+ });
8538
+ }
8483
8539
  };
8484
8540
 
8485
8541
  // src/services/approval.ts