@omni-commerce/sdk 0.17.0 → 0.19.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/dist/index.js CHANGED
@@ -33,7 +33,7 @@ function normalizeClientOptions(options = {}) {
33
33
  }
34
34
 
35
35
  // src/version.ts
36
- var SDK_VERSION = "0.17.0";
36
+ var SDK_VERSION = "0.19.0";
37
37
  var SDK_USER_AGENT = `omnicommerce-js/${SDK_VERSION}`;
38
38
 
39
39
  // src/environments.ts
@@ -1276,6 +1276,86 @@ var AopClient = class {
1276
1276
  });
1277
1277
  }
1278
1278
  };
1279
+ var ApiClient = class {
1280
+ constructor(_http) {
1281
+ __publicField(this, "_http", _http);
1282
+ }
1283
+ /**
1284
+ * Discover a published merchant agent
1285
+ *
1286
+ * A2A 1.0 Agent Card for any configured agent published to a customer deployment. Private model settings, prompts and publisher identity are excluded.
1287
+ *
1288
+ * `GET /api/embed/{deploymentId}/.well-known/agent-card.json`
1289
+ */
1290
+ getEmbedwellKnownagentCardJson(request, requestOptions) {
1291
+ const { deploymentId } = request ?? {};
1292
+ return this._http.request({
1293
+ method: "GET",
1294
+ path: `/api/embed/${encodePathParam("deploymentId", deploymentId)}/.well-known/agent-card.json`,
1295
+ query: void 0,
1296
+ body: void 0,
1297
+ ...mergeRequestOptions(requestOptions)
1298
+ });
1299
+ }
1300
+ /**
1301
+ * Call a merchant agent using A2A
1302
+ *
1303
+ * Official A2A 1.0 JSON-RPC SendMessage, GetTask and CancelTask.
1304
+
1305
+ ### Authentication
1306
+
1307
+ Uses the existing customer JWT from /api/embed/{deploymentId}/session; send the same Origin when creating and using the session.
1308
+
1309
+ ### Messages
1310
+
1311
+ SendMessage accepts text user messages with a UUID messageId and up to 4000 characters. For asynchronous execution set configuration.returnImmediately=true and retrieve the task. Every task is bound to the customer session.
1312
+
1313
+ Bot verification and storefront protection apply. Payment proofs belong in the checkout completion endpoint, outside model messages.
1314
+
1315
+ ### Signed offers and buyer agents
1316
+
1317
+ Payable offers in purchase-offers artifacts include checkoutJwt when the platform signing key is configured. Requests may carry a Web Bot Auth signature; the verified agent orig
1318
+ *
1319
+ * `POST /api/embed/{deploymentId}/a2a`
1320
+ */
1321
+ embeda2a(request, requestOptions) {
1322
+ const { deploymentId, ...body } = request ?? {};
1323
+ return this._http.request({
1324
+ method: "POST",
1325
+ path: `/api/embed/${encodePathParam("deploymentId", deploymentId)}/a2a`,
1326
+ query: void 0,
1327
+ body,
1328
+ ...mergeRequestOptions(requestOptions)
1329
+ });
1330
+ }
1331
+ /**
1332
+ * Manage customer-owned purchase offers
1333
+ *
1334
+ * ### Operations
1335
+
1336
+ create: offers[] (1–5), with stable requestId, exact purchasable product/variant IDs, quantities, shipping country and optional unitAmount proposals. get/cancel: sessionIds[] (1–20). complete: sessionId, paymentProof, and buyer approval of cartVersion, totalAmount and currency. pay: sessionId and the same exact approval; returns checkoutUrl for Stripe-hosted card entry.
1337
+
1338
+ ### Results and safeguards
1339
+
1340
+ Batches return ordered per-target results, succeededCount and failedCount. At most ten unpaid offers may be held per customer. Merchant-approved currency, countries, shipping and tax terms are required. Shopify-listed products return the supported Shopify checkout handoff.
1341
+
1342
+ ### Payment
1343
+
1344
+ Completion reuses the existing Stripe ACP or x402 rail. Hosted card checkout requires this org
1345
+ *
1346
+ * `POST /api/embed/{deploymentId}/checkout-sessions/{operation}`
1347
+ */
1348
+ embedcheckoutSessions(request, requestOptions) {
1349
+ const { deploymentId, operation, ...body } = request ?? {};
1350
+ return this._http.request({
1351
+ method: "POST",
1352
+ path: `/api/embed/${encodePathParam("deploymentId", deploymentId)}/checkout-sessions/${encodePathParam("operation", operation)}`,
1353
+ query: void 0,
1354
+ body,
1355
+ ...mergeRequestOptions(requestOptions)
1356
+ });
1357
+ }
1358
+ };
1279
1359
  var BrandKitsClient = class {
1280
1360
  constructor(_http) {
1281
1361
  __publicField(this, "_http", _http);
@@ -1655,7 +1735,7 @@ var CheckoutSessionsClient = class {
1655
1735
  /**
1656
1736
  * Complete Agentic Checkout Session
1657
1737
  *
1658
- * Settle the selected rail and create a native `agentic` order. Settlement failures return 402 and leave the session in `ready_for_payment`.
1738
+ * Settle the selected rail and create a native `agentic` order. Definitive settlement failures return 402. Pending confirmation locks the offer in `payment_pending`; durable recovery resumes the same attempt.
1659
1739
  *
1660
1740
  * `POST /api/v1/checkout-sessions/{sessionId}/complete`
1661
1741
  */
@@ -1670,6 +1750,45 @@ var CheckoutSessionsClient = class {
1670
1750
  });
1671
1751
  }
1672
1752
  };
1753
+ var CommerceClient = class {
1754
+ constructor(_http) {
1755
+ __publicField(this, "_http", _http);
1756
+ }
1757
+ /**
1758
+ * Await Commerce Jobs
1759
+ *
1760
+ * Wait for a mixed batch of returned commerce correlations: inventory_job, price_event, publish_job, delist_batch, store_switch, omni_delete, zalora_import, enrichment_batch, order_action and return_action. Maximum 50000 entries; IDs are trimmed and duplicates collapse by kind/id in first-requested order. timeoutMs=0 reads once; bounded waits allow up to 120000ms. Catalog jobs require catalog:read; order/return jobs require orders:read; mixed batches require both. Session callers include organizationId. Every job retains its target identity, status, errors and available label artifacts. Missing or inaccessible fulfillment jobs fail explicitly. needs_review is an uncertain outcome, never automatic success or authorization to resubmit. data.success describes completion; use state verification
1761
+ *
1762
+ * `POST /api/v1/commerce/jobs/await`
1763
+ */
1764
+ awaitJobs(request, requestOptions) {
1765
+ const { ...body } = request ?? {};
1766
+ return this._http.request({
1767
+ method: "POST",
1768
+ path: "/api/v1/commerce/jobs/await",
1769
+ query: void 0,
1770
+ body,
1771
+ ...mergeRequestOptions(requestOptions)
1772
+ });
1773
+ }
1774
+ /**
1775
+ * Verify Commerce State
1776
+ *
1777
+ * Perform fresh marketplace verification using the canonical services for every supported marketplace. For products provide productIds plus expected, or targets[{productId,expected}] for mixed values. For order and return operations provide their returned order_action/return_action correlations; product and fulfillment checks may share one request. Maximum 50000 entries per target array, with bounded concurrency. Catalog verification requires catalog:read; fulfillment verification requires orders:read; mixed batches require both. Session callers include organizationId. Missing, unauthorized, unsupported and unconfirmed targets fail explicitly. A return decision can be confirmed while later lifecycle steps remain pending. Labels confirm generated artifacts, not physical printing. Provider acc
1778
+ *
1779
+ * `POST /api/v1/commerce/state/verify`
1780
+ */
1781
+ verifyState(request, requestOptions) {
1782
+ const { ...body } = request ?? {};
1783
+ return this._http.request({
1784
+ method: "POST",
1785
+ path: "/api/v1/commerce/state/verify",
1786
+ query: void 0,
1787
+ body,
1788
+ ...mergeRequestOptions(requestOptions)
1789
+ });
1790
+ }
1791
+ };
1673
1792
  var CompareClient = class {
1674
1793
  constructor(_http) {
1675
1794
  __publicField(this, "_http", _http);
@@ -2374,6 +2493,104 @@ var OrdersClient = class {
2374
2493
  ...mergeRequestOptions(requestOptions)
2375
2494
  });
2376
2495
  }
2496
+ /**
2497
+ * Check Order Action Options
2498
+ *
2499
+ * ### Authorization
2500
+
2501
+ Requires orders:write.
2502
+
2503
+ ### Choices
2504
+
2505
+ Read current marketplace choices for ship, cancel, labels or update_tracking for 1–50 order UUIDs using repeated orderIds query parameters. The shared order service checks status, store connection and marketplace capability. Results preserve first-requested order, with explicit per-order errors. Use the exact choice payload and supply any fields marked requiresInput. An unsupported marketplace operation is an explicit failure, not a silently skipped order. Ship arranges shipment; labels generates printable files. Fulfillment behavior is identical to the existing single-order API and workspace UI.
2506
+ *
2507
+ * `GET /api/v1/orders/actions`
2508
+ */
2509
+ listBatchActionOptions(request, requestOptions) {
2510
+ const { orderIds, action, organizationId } = request ?? {};
2511
+ return this._http.request({
2512
+ method: "GET",
2513
+ path: "/api/v1/orders/actions",
2514
+ query: { orderIds, action, organizationId },
2515
+ body: void 0,
2516
+ ...mergeRequestOptions(requestOptions)
2517
+ });
2518
+ }
2519
+ /**
2520
+ * Process Order Actions
2521
+ *
2522
+ * ### Authorization
2523
+
2524
+ Requires orders:write.
2525
+
2526
+ ### Batch submission
2527
+
2528
+ Queue 1–50 distinct order operations with a UUID requestId. Each operation has orderId, action (ship, cancel, labels or update_tracking), and optional payload. Use exact marketplace choices from GET /api/v1/orders/actions and supply required carrier, tracking, pickup/drop-off or cancellation details. One operation per order is allowed in a batch; later stages such as labels after shipment require another submission. All targets are authorized before any enqueue. Per-order failures are isolated; results retain request order and include every accepted jobId. data.success means all submissions were accepted, not that marketplace processing finished.
2529
+
2530
+ ### Recovery and completion
2531
+
2532
+ Retain requestId and unchanged operations for retr
2533
+ *
2534
+ * `POST /api/v1/orders/actions`
2535
+ */
2536
+ processActions(request, requestOptions) {
2537
+ const { ...body } = request ?? {};
2538
+ return this._http.request({
2539
+ method: "POST",
2540
+ path: "/api/v1/orders/actions",
2541
+ query: void 0,
2542
+ body,
2543
+ ...mergeRequestOptions(requestOptions)
2544
+ });
2545
+ }
2546
+ /**
2547
+ * Get Order Action Jobs
2548
+ *
2549
+ * ### Authorization
2550
+
2551
+ Requires orders:read.
2552
+
2553
+ ### Outcomes and labels
2554
+
2555
+ Read every requested order action job in one batch of 1–50 UUIDs using repeated jobIds parameters. Results preserve first-requested order. data.success is true only when every requested job succeeded; failedCount includes failed and not_supported, while pendingCount includes queued and running. Successful label jobs contain downloadable files in labels[]. A missing or cross-organization job returns 404; current store restrictions apply to all targets. The top-level completed status describes the lookup, not job completion. No raw provider acknowledgements are exposed.
2556
+ *
2557
+ * `GET /api/v1/orders/actions/jobs`
2558
+ */
2559
+ getActionJobs(request, requestOptions) {
2560
+ const { jobIds, organizationId } = request ?? {};
2561
+ return this._http.request({
2562
+ method: "GET",
2563
+ path: "/api/v1/orders/actions/jobs",
2564
+ query: { jobIds, organizationId },
2565
+ body: void 0,
2566
+ ...mergeRequestOptions(requestOptions)
2567
+ });
2568
+ }
2569
+ /**
2570
+ * Create Picking List
2571
+ *
2572
+ * ### Authorization
2573
+
2574
+ Requires orders:read. API keys resolve organization scope from their credential; session callers include organizationId.
2575
+
2576
+ ### PDF output
2577
+
2578
+ Create a private PDF picking list for 1–500 order UUIDs, trimmed and deduplicated in first-requested order. Missing or inaccessible orders fail the complete selection without creating a partial document. The same grouping, product quantities, SKU/variation and currency-labeled prices as the workspace Orders page are used. timeZone accepts an IANA time zone; omitted API requests use UTC. This does not arrange shipment or change orders.
2579
+
2580
+ The result contains structured list data, every orderId, a saved documentId and a signed HTTPS downloadUrl valid until expiresAt (five minutes). Generate a fresh list for a new download URL. Download the
2581
+ *
2582
+ * `POST /api/v1/orders/picking-list`
2583
+ */
2584
+ createPickingList(request, requestOptions) {
2585
+ const { ...body } = request ?? {};
2586
+ return this._http.request({
2587
+ method: "POST",
2588
+ path: "/api/v1/orders/picking-list",
2589
+ query: void 0,
2590
+ body,
2591
+ ...mergeRequestOptions(requestOptions)
2592
+ });
2593
+ }
2377
2594
  };
2378
2595
  var OrganizationsClient = class {
2379
2596
  constructor(_http) {
@@ -3334,6 +3551,96 @@ var ReturnsClient = class {
3334
3551
  ...mergeRequestOptions(requestOptions)
3335
3552
  });
3336
3553
  }
3554
+ /**
3555
+ * Check Return Actions
3556
+ *
3557
+ * ### Authorization
3558
+
3559
+ Requires orders:write.
3560
+
3561
+ ### Eligibility
3562
+
3563
+ Read live marketplace decisions for 1–50 OmniCommerce return UUIDs using repeated returnIds query parameters. Refreshes the saved return state through the same service as the order UI. All targets are organization- and store-scoped before marketplace access. Results preserve first-requested order; one provider failure does not block another store. data.success describes eligibility checks, not whether an action is available. Completed, cancelled and other terminal returns have no actions. Check actions.length and limitation; never infer eligibility from status alone. Amazon and WhatsApp currently return explicit processing limitations. Other marketplaces expose only decisions supported by their current API state. No buyer remarks,
3564
+ *
3565
+ * `GET /api/v1/returns/actions`
3566
+ */
3567
+ listActions(request, requestOptions) {
3568
+ const { returnIds, organizationId } = request ?? {};
3569
+ return this._http.request({
3570
+ method: "GET",
3571
+ path: "/api/v1/returns/actions",
3572
+ query: { returnIds, organizationId },
3573
+ body: void 0,
3574
+ ...mergeRequestOptions(requestOptions)
3575
+ });
3576
+ }
3577
+ /**
3578
+ * Process Returns
3579
+ *
3580
+ * ### Authorization
3581
+
3582
+ Requires orders:write.
3583
+
3584
+ ### Submit decisions
3585
+
3586
+ Queue 1–50 selected return decisions, including a one-element batch for a single return. Use only actionId/version pairs from a fresh eligibility check. Identical duplicate return operations are deduplicated in first-requested order; conflicting duplicates are rejected. requestId is a UUID idempotency key: retry the same key and unchanged operations after a transport failure. An active matching decision is reused; conflicting active decisions return 409. Returns HTTP 202 with every returnId and jobId. The durable worker rechecks current permissions, store identity, eligibility and version immediately before writing, then verifies the marketplace result. Follow links.poll or GET /api/v1/returns/actions/jobs with every jobIds e
3587
+ *
3588
+ * `POST /api/v1/returns/actions`
3589
+ */
3590
+ process(request, requestOptions) {
3591
+ const { ...body } = request ?? {};
3592
+ return this._http.request({
3593
+ method: "POST",
3594
+ path: "/api/v1/returns/actions",
3595
+ query: void 0,
3596
+ body,
3597
+ ...mergeRequestOptions(requestOptions)
3598
+ });
3599
+ }
3600
+ /**
3601
+ * Get Return Action Jobs
3602
+ *
3603
+ * ### Authorization
3604
+
3605
+ Requires orders:read.
3606
+
3607
+ ### Job outcomes
3608
+
3609
+ Read the current state of 1–50 return-processing job UUIDs in one request using repeated jobIds parameters. Use every job ID returned by submission. Results preserve first-requested order. pendingCount counts queued, running and submitting; succeededCount counts succeeded; failedCount includes failed and needs_review. data.success is true only if every requested job succeeded. The top-level completed status refers to this lookup, not to the jobs. Missing or cross-organization jobs return 404; jobs outside assigned stores are forbidden. Evidence contains accepted/verified flags and before/after marketplace statuses, without raw provider payloads.
3610
+ *
3611
+ * `GET /api/v1/returns/actions/jobs`
3612
+ */
3613
+ getActionJobs(request, requestOptions) {
3614
+ const { jobIds, organizationId } = request ?? {};
3615
+ return this._http.request({
3616
+ method: "GET",
3617
+ path: "/api/v1/returns/actions/jobs",
3618
+ query: { jobIds, organizationId },
3619
+ body: void 0,
3620
+ ...mergeRequestOptions(requestOptions)
3621
+ });
3622
+ }
3623
+ /**
3624
+ * Get Order Returns
3625
+ *
3626
+ * Requires orders:read. Read stored return requests for 1–50 order UUIDs using repeated orderIds query parameters.
3627
+
3628
+ ### Return identity
3629
+
3630
+ Results preserve first-requested order and include distinct active and historical return requests. processingEligible is a local candidate flag, not live eligibility. Pass returnId values to GET /api/v1/returns/actions before choosing a decision. Every order is authorized before reading returns, including store restrictions; no buyer data is exposed.
3631
+ *
3632
+ * `GET /api/v1/returns/orders`
3633
+ */
3634
+ listForOrders(request, requestOptions) {
3635
+ const { orderIds, organizationId } = request ?? {};
3636
+ return this._http.request({
3637
+ method: "GET",
3638
+ path: "/api/v1/returns/orders",
3639
+ query: { orderIds, organizationId },
3640
+ body: void 0,
3641
+ ...mergeRequestOptions(requestOptions)
3642
+ });
3643
+ }
3337
3644
  };
3338
3645
  var ReviewsClient = class {
3339
3646
  constructor(_http) {
@@ -3928,11 +4235,13 @@ var OmniGeneratedClient = class {
3928
4235
  __publicField(this, "agents");
3929
4236
  __publicField(this, "analytics");
3930
4237
  __publicField(this, "aop");
4238
+ __publicField(this, "api");
3931
4239
  __publicField(this, "brandKits");
3932
4240
  __publicField(this, "brandsgateway");
3933
4241
  __publicField(this, "campaigns");
3934
4242
  __publicField(this, "catalog");
3935
4243
  __publicField(this, "checkoutSessions");
4244
+ __publicField(this, "commerce");
3936
4245
  __publicField(this, "compare");
3937
4246
  __publicField(this, "directory");
3938
4247
  __publicField(this, "documents");
@@ -3965,11 +4274,13 @@ var OmniGeneratedClient = class {
3965
4274
  this.agents = new AgentsClient(this._http);
3966
4275
  this.analytics = new AnalyticsClient(this._http);
3967
4276
  this.aop = new AopClient(this._http);
4277
+ this.api = new ApiClient(this._http);
3968
4278
  this.brandKits = new BrandKitsClient(this._http);
3969
4279
  this.brandsgateway = new BrandsgatewayClient(this._http);
3970
4280
  this.campaigns = new CampaignsClient(this._http);
3971
4281
  this.catalog = new CatalogClient(this._http);
3972
4282
  this.checkoutSessions = new CheckoutSessionsClient(this._http);
4283
+ this.commerce = new CommerceClient(this._http);
3973
4284
  this.compare = new CompareClient(this._http);
3974
4285
  this.directory = new DirectoryClient(this._http);
3975
4286
  this.documents = new DocumentsClient(this._http);