@cimplify/sdk 0.106.1 → 0.106.2

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/advanced.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkSFG2LMRD_js = require('./chunk-SFG2LMRD.js');
3
+ var chunkB7JH5D3J_js = require('./chunk-B7JH5D3J.js');
4
4
  require('./chunk-EV2EVOYS.js');
5
5
  require('./chunk-UYFTOIFW.js');
6
6
  require('./chunk-AVXA4F6G.js');
@@ -10,77 +10,77 @@ require('./chunk-OWW5GUSB.js');
10
10
 
11
11
  Object.defineProperty(exports, "AuthService", {
12
12
  enumerable: true,
13
- get: function () { return chunkSFG2LMRD_js.AuthService; }
13
+ get: function () { return chunkB7JH5D3J_js.AuthService; }
14
14
  });
15
15
  Object.defineProperty(exports, "BusinessService", {
16
16
  enumerable: true,
17
- get: function () { return chunkSFG2LMRD_js.BusinessService; }
17
+ get: function () { return chunkB7JH5D3J_js.BusinessService; }
18
18
  });
19
19
  Object.defineProperty(exports, "CartOperations", {
20
20
  enumerable: true,
21
- get: function () { return chunkSFG2LMRD_js.CartOperations; }
21
+ get: function () { return chunkB7JH5D3J_js.CartOperations; }
22
22
  });
23
23
  Object.defineProperty(exports, "CatalogueQueries", {
24
24
  enumerable: true,
25
- get: function () { return chunkSFG2LMRD_js.CatalogueQueries; }
25
+ get: function () { return chunkB7JH5D3J_js.CatalogueQueries; }
26
26
  });
27
27
  Object.defineProperty(exports, "CheckoutOperations", {
28
28
  enumerable: true,
29
- get: function () { return chunkSFG2LMRD_js.CheckoutService; }
29
+ get: function () { return chunkB7JH5D3J_js.CheckoutService; }
30
30
  });
31
31
  Object.defineProperty(exports, "CheckoutService", {
32
32
  enumerable: true,
33
- get: function () { return chunkSFG2LMRD_js.CheckoutService; }
33
+ get: function () { return chunkB7JH5D3J_js.CheckoutService; }
34
34
  });
35
35
  Object.defineProperty(exports, "CimplifyElement", {
36
36
  enumerable: true,
37
- get: function () { return chunkSFG2LMRD_js.CimplifyElement; }
37
+ get: function () { return chunkB7JH5D3J_js.CimplifyElement; }
38
38
  });
39
39
  Object.defineProperty(exports, "CimplifyElements", {
40
40
  enumerable: true,
41
- get: function () { return chunkSFG2LMRD_js.CimplifyElements; }
41
+ get: function () { return chunkB7JH5D3J_js.CimplifyElements; }
42
42
  });
43
43
  Object.defineProperty(exports, "ELEMENT_TYPES", {
44
44
  enumerable: true,
45
- get: function () { return chunkSFG2LMRD_js.ELEMENT_TYPES; }
45
+ get: function () { return chunkB7JH5D3J_js.ELEMENT_TYPES; }
46
46
  });
47
47
  Object.defineProperty(exports, "EVENT_TYPES", {
48
48
  enumerable: true,
49
- get: function () { return chunkSFG2LMRD_js.EVENT_TYPES; }
49
+ get: function () { return chunkB7JH5D3J_js.EVENT_TYPES; }
50
50
  });
51
51
  Object.defineProperty(exports, "FxService", {
52
52
  enumerable: true,
53
- get: function () { return chunkSFG2LMRD_js.FxService; }
53
+ get: function () { return chunkB7JH5D3J_js.FxService; }
54
54
  });
55
55
  Object.defineProperty(exports, "InventoryService", {
56
56
  enumerable: true,
57
- get: function () { return chunkSFG2LMRD_js.InventoryService; }
57
+ get: function () { return chunkB7JH5D3J_js.InventoryService; }
58
58
  });
59
59
  Object.defineProperty(exports, "LinkService", {
60
60
  enumerable: true,
61
- get: function () { return chunkSFG2LMRD_js.LinkService; }
61
+ get: function () { return chunkB7JH5D3J_js.LinkService; }
62
62
  });
63
63
  Object.defineProperty(exports, "LiteService", {
64
64
  enumerable: true,
65
- get: function () { return chunkSFG2LMRD_js.LiteService; }
65
+ get: function () { return chunkB7JH5D3J_js.LiteService; }
66
66
  });
67
67
  Object.defineProperty(exports, "MESSAGE_TYPES", {
68
68
  enumerable: true,
69
- get: function () { return chunkSFG2LMRD_js.MESSAGE_TYPES; }
69
+ get: function () { return chunkB7JH5D3J_js.MESSAGE_TYPES; }
70
70
  });
71
71
  Object.defineProperty(exports, "OrderQueries", {
72
72
  enumerable: true,
73
- get: function () { return chunkSFG2LMRD_js.OrderQueries; }
73
+ get: function () { return chunkB7JH5D3J_js.OrderQueries; }
74
74
  });
75
75
  Object.defineProperty(exports, "SchedulingService", {
76
76
  enumerable: true,
77
- get: function () { return chunkSFG2LMRD_js.SchedulingService; }
77
+ get: function () { return chunkB7JH5D3J_js.SchedulingService; }
78
78
  });
79
79
  Object.defineProperty(exports, "createElements", {
80
80
  enumerable: true,
81
- get: function () { return chunkSFG2LMRD_js.createElements; }
81
+ get: function () { return chunkB7JH5D3J_js.createElements; }
82
82
  });
83
83
  Object.defineProperty(exports, "generateIdempotencyKey", {
84
84
  enumerable: true,
85
- get: function () { return chunkSFG2LMRD_js.generateIdempotencyKey; }
85
+ get: function () { return chunkB7JH5D3J_js.generateIdempotencyKey; }
86
86
  });
package/dist/advanced.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { AuthService, BusinessService, CartOperations, CatalogueQueries, CheckoutService as CheckoutOperations, CheckoutService, CimplifyElement, CimplifyElements, ELEMENT_TYPES, EVENT_TYPES, FxService, InventoryService, LinkService, LiteService, MESSAGE_TYPES, OrderQueries, SchedulingService, createElements, generateIdempotencyKey } from './chunk-YHR6LFQ7.mjs';
1
+ export { AuthService, BusinessService, CartOperations, CatalogueQueries, CheckoutService as CheckoutOperations, CheckoutService, CimplifyElement, CimplifyElements, ELEMENT_TYPES, EVENT_TYPES, FxService, InventoryService, LinkService, LiteService, MESSAGE_TYPES, OrderQueries, SchedulingService, createElements, generateIdempotencyKey } from './chunk-T3MXI7JD.mjs';
2
2
  import './chunk-33VCYWVL.mjs';
3
3
  import './chunk-NYDVVNZI.mjs';
4
4
  import './chunk-NJYR6GGM.mjs';
@@ -1,5 +1,5 @@
1
1
  import { createMockApp } from './chunk-L4XKIMUO.mjs';
2
- import { createCimplifyClient } from './chunk-ABAK4YVY.mjs';
2
+ import { createCimplifyClient } from './chunk-LJAZ7H4I.mjs';
3
3
  import { PAYMENT_METHOD, ORDER_TYPE, AUTHORIZATION_TYPE, CHECKOUT_NEXT_ACTION } from './chunk-33VCYWVL.mjs';
4
4
  import { PURCHASE_INTENT_SOURCE_KIND, PURCHASE_INTENT_SELLABLE_KIND, PURCHASE_INTENT_OFFER_KIND, PURCHASE_INTENT_LINE_CONFIGURATION_KIND, PURCHASE_INTENT_PAYMENT_METHOD, PURCHASE_INTENT_MOBILE_MONEY_NETWORK, MOBILE_MONEY_TENDER_AUTHORITY_KIND, CHECKOUT_COMPLIANCE_REASON, CHECKOUT_COMPLIANCE_LANE, PURCHASE_SURFACE, PURCHASE_DISPOSITION, PAYMENT_INSTRUMENT_DISPLAY_KIND, CHECKOUT_PROTECTION_STATUS, PAYMENT_OPTION_NEXT_ACTION, PAYMENT_OPTION_STATUS, PURCHASE_INTENT_PAYMENT_PROVIDER, PAYMENT_COLLECTION_MODE, PURCHASING_PRINCIPAL_KIND, CHECKOUT_PURCHASE_SURFACE, NATIVE_PURCHASE_PLATFORM, PURCHASE_INTENT_STATUS, CHECKOUT_TERMS_COMPONENT, CHECKOUT_TERMS_DELTA_KIND, CHECKOUT_MATERIAL_TERMS_COMPONENT, PURCHASE_INTENT_CONFIRM_STATUS, CHECKOUT_INVALIDATION_REASON } from './chunk-NJYR6GGM.mjs';
5
5
  import { z } from 'zod';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkNJK3THWT_js = require('./chunk-NJK3THWT.js');
4
- var chunkQKL5L5IU_js = require('./chunk-QKL5L5IU.js');
4
+ var chunkBCLGREHS_js = require('./chunk-BCLGREHS.js');
5
5
  var chunkEV2EVOYS_js = require('./chunk-EV2EVOYS.js');
6
6
  var chunkAVXA4F6G_js = require('./chunk-AVXA4F6G.js');
7
7
  var zod = require('zod');
@@ -1204,7 +1204,7 @@ function createTestClient(options = {}) {
1204
1204
  if (echoed) sessionToken = echoed;
1205
1205
  return res;
1206
1206
  };
1207
- const client = chunkQKL5L5IU_js.createCimplifyClient({
1207
+ const client = chunkBCLGREHS_js.createCimplifyClient({
1208
1208
  baseUrl: TEST_BASE_URL,
1209
1209
  // Link mock lives at /v1/link on the same Hono app, so point the SDK's
1210
1210
  // separate Link transport at the same TEST_BASE_URL.
@@ -3976,44 +3976,46 @@ var CimplifyElements = class {
3976
3976
  async applyAccessToken(token, generation) {
3977
3977
  if (this.authGeneration !== generation) return { kind: "incomplete" };
3978
3978
  this.authEstablishmentInProgress = true;
3979
- this.accessToken = null;
3980
- this.accountId = null;
3981
- this.customerId = null;
3982
- this.customerData = null;
3983
- this.addressData = null;
3984
- this.paymentData = null;
3985
- this.client.setAccessToken(token);
3986
- const claim = await this.client.support.claimConversation();
3987
- if (!this.isAuthGenerationCurrent(generation, token)) return { kind: "incomplete" };
3988
- if (!claim.ok && claim.error.code !== "already_claimed") {
3989
- if (this.client.hasClaimedSessionAuthority()) {
3990
- this.client.clearSession();
3991
- } else {
3992
- this.client.setAccessToken(null);
3979
+ try {
3980
+ this.accessToken = null;
3981
+ this.accountId = null;
3982
+ this.customerId = null;
3983
+ this.customerData = null;
3984
+ this.addressData = null;
3985
+ this.paymentData = null;
3986
+ this.client.setAccessToken(token);
3987
+ const claim = await this.client.support.claimConversation();
3988
+ if (!this.isAuthGenerationCurrent(generation, token)) return { kind: "incomplete" };
3989
+ if (!claim.ok && claim.error.code !== "already_claimed") {
3990
+ if (this.client.hasClaimedSessionAuthority()) {
3991
+ this.client.clearSession();
3992
+ } else {
3993
+ this.client.setAccessToken(null);
3994
+ }
3995
+ return {
3996
+ kind: "claim_failed",
3997
+ code: claim.error.code,
3998
+ message: claim.error.userMessage
3999
+ };
3993
4000
  }
3994
- this.authEstablishmentInProgress = false;
4001
+ this.accessToken = token;
4002
+ this.accountId = decodeJwtSub(token);
4003
+ if (!await this.hydrateCustomerData(generation, token, true)) {
4004
+ return { kind: "incomplete" };
4005
+ }
4006
+ if (!this.isAuthGenerationCurrent(generation, token)) return { kind: "incomplete" };
3995
4007
  return {
3996
- kind: "claim_failed",
3997
- code: claim.error.code,
3998
- message: claim.error.userMessage
4008
+ kind: "authenticated",
4009
+ data: {
4010
+ accountId: this.accountId ?? "",
4011
+ customerId: this.customerId ?? "",
4012
+ token,
4013
+ customer: this.customerData ?? { name: "", email: null, phone: null }
4014
+ }
3999
4015
  };
4016
+ } finally {
4017
+ this.authEstablishmentInProgress = false;
4000
4018
  }
4001
- this.accessToken = token;
4002
- this.accountId = decodeJwtSub(token);
4003
- if (!await this.hydrateCustomerData(generation, token, true)) {
4004
- return { kind: "incomplete" };
4005
- }
4006
- if (!this.isAuthGenerationCurrent(generation, token)) return { kind: "incomplete" };
4007
- this.authEstablishmentInProgress = false;
4008
- return {
4009
- kind: "authenticated",
4010
- data: {
4011
- accountId: this.accountId ?? "",
4012
- customerId: this.customerId ?? "",
4013
- token,
4014
- customer: this.customerData ?? { name: "", email: null, phone: null }
4015
- }
4016
- };
4017
4019
  }
4018
4020
  async waitForAuthEstablishment(timeoutMs) {
4019
4021
  const deadline = Date.now() + timeoutMs;