@lightsparkdev/core 1.4.1 → 1.4.3

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.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AppendUnitsOptions, ab as ById, am as Complete, C as ConfigKeys, o as CurrencyAmountArg, k as CurrencyAmountInputObj, m as CurrencyAmountObj, n as CurrencyAmountPreferenceObj, V as CurrencyCodes, T as CurrencyLocales, j as CurrencyMap, f as CurrencyUnit, g as CurrencyUnitType, af as DeepPartial, D as DeprecatedCurrencyAmountObj, aa as ExpandRecursively, ae as ExtractByTypename, ag as JSONLiteral, ai as JSONObject, ah as JSONType, a9 as Maybe, aj as NN, ac as OmitTypename, al as PartialBy, an as RequiredKeys, S as SDKCurrencyAmountType, U as UmaCurrency, l as UmaCurrencyAmount, z as abbrCurrencyUnit, b as b64decode, a as b64encode, O as bytesToHex, $ as clamp, i as convertCurrencyAmount, h as convertCurrencyAmountValue, R as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, _ as deleteLocalStorageItem, e as ensureArray, N as errorToJSON, B as formatCurrencyStr, w as getCurrencyAmount, Q as getCurrentLocale, L as getErrorMsg, Y as getLocalStorageBoolean, X as getLocalStorageConfigItem, P as hexToBytes, G as isBrowser, p as isCurrencyAmountInputObj, s as isCurrencyAmountObj, t as isCurrencyAmountPreferenceObj, y as isCurrencyMap, r as isDeprecatedCurrencyAmountObj, J as isError, M as isErrorMsg, K as isErrorWithMessage, H as isNode, a2 as isNumber, a7 as isObject, a8 as isRecord, v as isSDKCurrencyAmount, I as isTest, ad as isType, a6 as isUint8Array, q as isUmaCurrencyAmount, a0 as linearInterpolate, W as localeToCurrencyCode, F as localeToCurrencySymbol, a5 as lsidToUUID, x as mapCurrencyAmount, ak as notNullUndefined, a3 as pollUntil, a1 as round, E as separateCurrencyStrParts, Z as setLocalStorageBoolean, a4 as sleep, u as urlsafe_b64decode } from './index-DZbfPQqd.cjs';
1
+ export { A as AppendUnitsOptions, ad as ById, ao as Complete, C as ConfigKeys, o as CurrencyAmountArg, k as CurrencyAmountInputObj, m as CurrencyAmountObj, n as CurrencyAmountPreferenceObj, X as CurrencyCodes, W as CurrencyLocales, j as CurrencyMap, f as CurrencyUnit, g as CurrencyUnitType, ah as DeepPartial, D as DeprecatedCurrencyAmountObj, ac as ExpandRecursively, ag as ExtractByTypename, ai as JSONLiteral, ak as JSONObject, aj as JSONType, ab as Maybe, al as NN, ae as OmitTypename, an as PartialBy, ap as RequiredKeys, S as SDKCurrencyAmountType, aq as StateCode, U as UmaCurrency, l as UmaCurrencyAmount, z as abbrCurrencyUnit, b as b64decode, a as b64encode, Q as bytesToHex, a1 as clamp, i as convertCurrencyAmount, h as convertCurrencyAmountValue, V as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, a0 as deleteLocalStorageItem, e as ensureArray, P as errorToJSON, B as formatCurrencyStr, G as formatInviteAmount, w as getCurrencyAmount, T as getCurrentLocale, N as getErrorMsg, _ as getLocalStorageBoolean, Z as getLocalStorageConfigItem, R as hexToBytes, K as isBare, H as isBrowser, p as isCurrencyAmountInputObj, s as isCurrencyAmountObj, t as isCurrencyAmountPreferenceObj, y as isCurrencyMap, r as isDeprecatedCurrencyAmountObj, L as isError, O as isErrorMsg, M as isErrorWithMessage, I as isNode, a4 as isNumber, a9 as isObject, aa as isRecord, v as isSDKCurrencyAmount, J as isTest, af as isType, a8 as isUint8Array, q as isUmaCurrencyAmount, a2 as linearInterpolate, Y as localeToCurrencyCode, F as localeToCurrencySymbol, a7 as lsidToUUID, x as mapCurrencyAmount, am as notNullUndefined, a5 as pollUntil, a3 as round, E as separateCurrencyStrParts, $ as setLocalStorageBoolean, a6 as sleep, u as urlsafe_b64decode, as as zipcodeToState, ar as zipcodeToStateCode } from './index-gUXiTlhb.cjs';
2
2
  import { Observable } from 'zen-observable-ts';
3
3
 
4
4
  type Headers = Record<string, string>;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AppendUnitsOptions, ab as ById, am as Complete, C as ConfigKeys, o as CurrencyAmountArg, k as CurrencyAmountInputObj, m as CurrencyAmountObj, n as CurrencyAmountPreferenceObj, V as CurrencyCodes, T as CurrencyLocales, j as CurrencyMap, f as CurrencyUnit, g as CurrencyUnitType, af as DeepPartial, D as DeprecatedCurrencyAmountObj, aa as ExpandRecursively, ae as ExtractByTypename, ag as JSONLiteral, ai as JSONObject, ah as JSONType, a9 as Maybe, aj as NN, ac as OmitTypename, al as PartialBy, an as RequiredKeys, S as SDKCurrencyAmountType, U as UmaCurrency, l as UmaCurrencyAmount, z as abbrCurrencyUnit, b as b64decode, a as b64encode, O as bytesToHex, $ as clamp, i as convertCurrencyAmount, h as convertCurrencyAmountValue, R as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, _ as deleteLocalStorageItem, e as ensureArray, N as errorToJSON, B as formatCurrencyStr, w as getCurrencyAmount, Q as getCurrentLocale, L as getErrorMsg, Y as getLocalStorageBoolean, X as getLocalStorageConfigItem, P as hexToBytes, G as isBrowser, p as isCurrencyAmountInputObj, s as isCurrencyAmountObj, t as isCurrencyAmountPreferenceObj, y as isCurrencyMap, r as isDeprecatedCurrencyAmountObj, J as isError, M as isErrorMsg, K as isErrorWithMessage, H as isNode, a2 as isNumber, a7 as isObject, a8 as isRecord, v as isSDKCurrencyAmount, I as isTest, ad as isType, a6 as isUint8Array, q as isUmaCurrencyAmount, a0 as linearInterpolate, W as localeToCurrencyCode, F as localeToCurrencySymbol, a5 as lsidToUUID, x as mapCurrencyAmount, ak as notNullUndefined, a3 as pollUntil, a1 as round, E as separateCurrencyStrParts, Z as setLocalStorageBoolean, a4 as sleep, u as urlsafe_b64decode } from './index-DZbfPQqd.js';
1
+ export { A as AppendUnitsOptions, ad as ById, ao as Complete, C as ConfigKeys, o as CurrencyAmountArg, k as CurrencyAmountInputObj, m as CurrencyAmountObj, n as CurrencyAmountPreferenceObj, X as CurrencyCodes, W as CurrencyLocales, j as CurrencyMap, f as CurrencyUnit, g as CurrencyUnitType, ah as DeepPartial, D as DeprecatedCurrencyAmountObj, ac as ExpandRecursively, ag as ExtractByTypename, ai as JSONLiteral, ak as JSONObject, aj as JSONType, ab as Maybe, al as NN, ae as OmitTypename, an as PartialBy, ap as RequiredKeys, S as SDKCurrencyAmountType, aq as StateCode, U as UmaCurrency, l as UmaCurrencyAmount, z as abbrCurrencyUnit, b as b64decode, a as b64encode, Q as bytesToHex, a1 as clamp, i as convertCurrencyAmount, h as convertCurrencyAmountValue, V as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, a0 as deleteLocalStorageItem, e as ensureArray, P as errorToJSON, B as formatCurrencyStr, G as formatInviteAmount, w as getCurrencyAmount, T as getCurrentLocale, N as getErrorMsg, _ as getLocalStorageBoolean, Z as getLocalStorageConfigItem, R as hexToBytes, K as isBare, H as isBrowser, p as isCurrencyAmountInputObj, s as isCurrencyAmountObj, t as isCurrencyAmountPreferenceObj, y as isCurrencyMap, r as isDeprecatedCurrencyAmountObj, L as isError, O as isErrorMsg, M as isErrorWithMessage, I as isNode, a4 as isNumber, a9 as isObject, aa as isRecord, v as isSDKCurrencyAmount, J as isTest, af as isType, a8 as isUint8Array, q as isUmaCurrencyAmount, a2 as linearInterpolate, Y as localeToCurrencyCode, F as localeToCurrencySymbol, a7 as lsidToUUID, x as mapCurrencyAmount, am as notNullUndefined, a5 as pollUntil, a3 as round, E as separateCurrencyStrParts, $ as setLocalStorageBoolean, a6 as sleep, u as urlsafe_b64decode, as as zipcodeToState, ar as zipcodeToStateCode } from './index-gUXiTlhb.js';
2
2
  import { Observable } from 'zen-observable-ts';
3
3
 
4
4
  type Headers = Record<string, string>;
package/dist/index.js CHANGED
@@ -15,12 +15,14 @@ import {
15
15
  ensureArray,
16
16
  errorToJSON,
17
17
  formatCurrencyStr,
18
+ formatInviteAmount,
18
19
  getCurrencyAmount,
19
20
  getCurrentLocale,
20
21
  getErrorMsg,
21
22
  getLocalStorageBoolean,
22
23
  getLocalStorageConfigItem,
23
24
  hexToBytes,
25
+ isBare,
24
26
  isBrowser,
25
27
  isCurrencyAmountInputObj,
26
28
  isCurrencyAmountObj,
@@ -50,8 +52,10 @@ import {
50
52
  separateCurrencyStrParts,
51
53
  setLocalStorageBoolean,
52
54
  sleep,
53
- urlsafe_b64decode
54
- } from "./chunk-NV53XYAS.js";
55
+ urlsafe_b64decode,
56
+ zipcodeToState,
57
+ zipcodeToStateCode
58
+ } from "./chunk-36QHRQJC.js";
55
59
 
56
60
  // src/auth/LightsparkAuthException.ts
57
61
  var LightsparkAuthException = class extends LightsparkException_default {
@@ -487,7 +491,6 @@ var logger = new Logger("@lightsparkdev/core");
487
491
  // src/requester/Requester.ts
488
492
  import dayjs from "dayjs";
489
493
  import utc from "dayjs/plugin/utc.js";
490
- import { createClient } from "graphql-ws";
491
494
  import { Observable } from "zen-observable-ts";
492
495
  var DEFAULT_BASE_URL = "api.lightspark.com";
493
496
  dayjs.extend(utc);
@@ -513,6 +516,9 @@ var Requester = class {
513
516
  if (!this.resolveWsClient) {
514
517
  return this.wsClient;
515
518
  }
519
+ if (isBare) {
520
+ return null;
521
+ }
516
522
  let websocketImpl;
517
523
  if (isNode && typeof WebSocket === "undefined") {
518
524
  const wsModule = await import("ws");
@@ -522,6 +528,8 @@ var Requester = class {
522
528
  if (baseUrl.startsWith("http://")) {
523
529
  websocketProtocol = "ws";
524
530
  }
531
+ const graphqlWsModule = await import("graphql-ws");
532
+ const { createClient } = graphqlWsModule;
525
533
  const wsClient = createClient({
526
534
  url: `${websocketProtocol}://${this.stripProtocol(this.baseUrl)}/${this.schemaEndpoint}`,
527
535
  connectionParams: () => authProvider.addWsConnectionParams({}),
@@ -575,6 +583,12 @@ var Requester = class {
575
583
  void (async () => {
576
584
  try {
577
585
  const wsClient = await this.wsClient;
586
+ if (!wsClient) {
587
+ throw new LightsparkException_default(
588
+ "WebSocketNotInitialized",
589
+ "WebSocket client is not initialized or is not available in the current environment."
590
+ );
591
+ }
578
592
  if (!canceled) {
579
593
  cleanup = wsClient.subscribe(bodyData, {
580
594
  next: (data) => observer.next(data),
@@ -783,12 +797,14 @@ export {
783
797
  ensureArray,
784
798
  errorToJSON,
785
799
  formatCurrencyStr,
800
+ formatInviteAmount,
786
801
  getCurrencyAmount,
787
802
  getCurrentLocale,
788
803
  getErrorMsg,
789
804
  getLocalStorageBoolean,
790
805
  getLocalStorageConfigItem,
791
806
  hexToBytes,
807
+ isBare,
792
808
  isBrowser,
793
809
  isCurrencyAmountInputObj,
794
810
  isCurrencyAmountObj,
@@ -819,5 +835,7 @@ export {
819
835
  separateCurrencyStrParts,
820
836
  setLocalStorageBoolean,
821
837
  sleep,
822
- urlsafe_b64decode
838
+ urlsafe_b64decode,
839
+ zipcodeToState,
840
+ zipcodeToStateCode
823
841
  };