@zerohash-sdk/csp-crypto-sell-js 1.5.0 → 1.6.1

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/README.md CHANGED
@@ -83,16 +83,16 @@ await cspCryptoSell.render(document.getElementById('container')!);
83
83
 
84
84
  ### Configuration
85
85
 
86
- | Prop | Type | Required | Default | Description |
87
- | ------------- | --------------------------------------- | -------- | -------- | -------------------------------------------------- |
88
- | `jwt` | `string` | Yes | - | JWT token for authentication with Connect |
89
- | `env` | `"prod" \| "cert" \| "dev" \| "local"` | No | `"prod"` | Target environment |
90
- | `theme` | `"auto" \| "light" \| "dark"` | No | `"auto"` | Theme mode for the interface |
91
- | `onCompleted` | `({ assetSymbol, amountSold }) => void` | No | - | Callback when the sell flow completes successfully |
92
- | `onError` | `({ errorCode, reason }) => void` | No | - | Callback for error events |
93
- | `onClose` | `() => void` | No | - | Callback when the widget is closed |
94
- | `onEvent` | `({ type, data }) => void` | No | - | Callback for general events |
95
- | `onLoaded` | `() => void` | No | - | Callback when the widget is loaded and ready |
86
+ | Prop | Type | Required | Default | Description |
87
+ | ------------- | --------------------------------------- | -------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
88
+ | `jwt` | `string` | Yes | - | JWT token for authentication with Connect |
89
+ | `env` | `"prod" \| "cert" \| "dev" \| "local"` | No | `"prod"` | Target environment. EU partners (JWT `payload.region='eu'`) are routed automatically to the EU CDN (`sdk-cdn.cert.zerohash.eu` / `sdk-cdn.zerohash.eu`). |
90
+ | `theme` | `"auto" \| "light" \| "dark"` | No | `"auto"` | Theme mode for the interface |
91
+ | `onCompleted` | `({ assetSymbol, amountSold }) => void` | No | - | Callback when the sell flow completes successfully |
92
+ | `onError` | `({ errorCode, reason }) => void` | No | - | Callback for error events |
93
+ | `onClose` | `() => void` | No | - | Callback when the widget is closed |
94
+ | `onEvent` | `({ type, data }) => void` | No | - | Callback for general events |
95
+ | `onLoaded` | `() => void` | No | - | Callback when the widget is loaded and ready |
96
96
 
97
97
  ### Methods
98
98
 
package/dist/index.d.ts CHANGED
@@ -362,6 +362,8 @@ declare class CspCryptoSell extends BaseJsSdk<CspCryptoSellConfig> {
362
362
  prod: string;
363
363
  sandbox: string;
364
364
  production: string;
365
+ 'eu-cert': string;
366
+ 'eu-prod': string;
365
367
  };
366
368
  protected webComponentTag: string;
367
369
  /**
package/dist/index.js CHANGED
@@ -41,15 +41,15 @@ const R = "production", z = "JWT token is required and must be a string.", x = {
41
41
  }, T = (e, t, r) => {
42
42
  const n = S(t, r);
43
43
  return e[n] ?? e[t] ?? e.prod;
44
- }, P = (e, t, r) => {
44
+ }, j = (e, t, r) => {
45
45
  const n = S(t, r);
46
46
  return e[n] ?? e[t];
47
47
  }, w = () => {
48
- }, j = () => {
48
+ }, k = () => {
49
49
  const e = new Uint8Array(8);
50
50
  return globalThis.crypto.getRandomValues(e), Array.from(e, (t) => t.toString(16).padStart(2, "0")).join("");
51
- }, k = (e, t) => {
52
- const r = j(), n = globalThis.__ZH_WEB_SDK_VERSION__, o = {};
51
+ }, P = (e, t) => {
52
+ const r = k(), n = globalThis.__ZH_WEB_SDK_VERSION__, o = {};
53
53
  e.claims.participantCode && (o.participant_code = e.claims.participantCode), e.claims.platformName && (o.platform_name = e.claims.platformName), e.claims.platformCode && (o.platform_code = e.claims.platformCode), e.claims.region && (o.region = e.claims.region), n && (o.zh_web_sdk_version = n);
54
54
  const a = {
55
55
  meta: {
@@ -77,7 +77,7 @@ const R = "production", z = "JWT token is required and must be a string.", x = {
77
77
  }, U = (e, t, r) => {
78
78
  if (!e || typeof fetch > "u")
79
79
  return;
80
- const { sessionId: n, payload: o } = k(t, r);
80
+ const { sessionId: n, payload: o } = P(t, r);
81
81
  try {
82
82
  fetch(e, {
83
83
  method: "POST",
@@ -95,7 +95,7 @@ const R = "production", z = "JWT token is required and must be a string.", x = {
95
95
  const u = `${t}-script-${s}`;
96
96
  if (customElements.get(t) || document.getElementById(u))
97
97
  return w;
98
- const v = W(d), D = e.report ?? ((l) => U(c && P(c, s, d), l, n));
98
+ const v = W(d), D = e.report ?? ((l) => U(c && j(c, s, d), l, n));
99
99
  let m = !1, y = 0, f;
100
100
  const h = () => {
101
101
  f !== void 0 && clearTimeout(f);
@@ -285,13 +285,17 @@ class V extends B {
285
285
  SCRIPT_LOAD_FAILED: "Failed to load the Connect CspCryptoSell script.",
286
286
  WEB_COMPONENT_NOT_DEFINED: "Web component is not defined. Script may not be loaded."
287
287
  };
288
+ // US partners stay on connect.xyz; EU partners (JWT payload.region='eu') get
289
+ // routed to sdk-cdn.zerohash.eu by BaseJsSdk.getScriptUrl via resolveEnvByRegion.
288
290
  scriptUrls = {
289
291
  local: "http://localhost:5173/csp-crypto-sell-web/index.js",
290
292
  dev: "https://connect-sdk.dev.0hash.com/csp-crypto-sell-web/index.js",
291
293
  cert: "https://sdk.sandbox.connect.xyz/csp-crypto-sell-web/index.js",
292
294
  prod: "https://sdk.connect.xyz/csp-crypto-sell-web/index.js",
293
295
  sandbox: "https://sdk.sandbox.connect.xyz/csp-crypto-sell-web/index.js",
294
- production: "https://sdk.connect.xyz/csp-crypto-sell-web/index.js"
296
+ production: "https://sdk.connect.xyz/csp-crypto-sell-web/index.js",
297
+ "eu-cert": "https://sdk-cdn.cert.zerohash.eu/csp-crypto-sell-web/index.js",
298
+ "eu-prod": "https://sdk-cdn.zerohash.eu/csp-crypto-sell-web/index.js"
295
299
  };
296
300
  webComponentTag = "zerohash-csp-crypto-sell";
297
301
  /**
@@ -1 +1 @@
1
- (function(i,u){typeof exports=="object"&&typeof module<"u"?u(exports):typeof define=="function"&&define.amd?define(["exports"],u):(i=typeof globalThis<"u"?globalThis:i||self,u(i.CspCryptoSell={}))})(this,(function(i){"use strict";const u="production",L="JWT token is required and must be a string.",v={dev:"https://grafana-faro-collector.dev.0hash.com/collect",cert:"https://grafana-faro-collector.cert.zerohash.com/collect",prod:"https://grafana-faro-collector.zerohash.com/collect","eu-cert":"https://grafana-faro-collector.cert.zerohash.eu/collect","eu-prod":"https://grafana-faro-collector.zerohash.eu/collect",sandbox:"https://grafana-faro-collector.cert.zerohash.com/collect",production:"https://grafana-faro-collector.zerohash.com/collect"},I=e=>{if(!e||typeof e!="string")return null;const t=e.split(".");if(t.length<2)return null;try{const r=t[1].replace(/-/g,"+").replace(/_/g,"/"),n=r+"===".slice(0,(4-r.length%4)%4),o=typeof atob<"u"?atob(n):Buffer.from(n,"base64").toString("utf-8"),d=JSON.parse(o)?.payload?.region;if(typeof d!="string")return null;const s=d.toLowerCase();return s==="us"||s==="eu"?s:null}catch{return null}},C=(e,t)=>I(t)!=="eu"?e:e==="cert"?"eu-cert":e==="prod"?"eu-prod":e,D=e=>{if(!e||typeof e!="string")return{};const t=e.split(".");if(t.length<2)return{};try{const r=t[1].replace(/-/g,"+").replace(/_/g,"/"),n=r+"===".slice(0,(4-r.length%4)%4),o=typeof atob<"u"?atob(n):Buffer.from(n,"base64").toString("utf-8"),c=JSON.parse(o),d=c?.payload??{},s=l=>typeof l=="string"&&l.length>0?l:void 0;return{participantCode:s(d.participant_code),platformName:s(d.platform_name),platformCode:s(c.platform_code),region:s(d.region)}}catch{return{}}},b=(e,t,r)=>{const n=C(t,r);return e[n]??e[t]??e.prod},A=(e,t,r)=>{const n=C(t,r);return e[n]??e[t]},E=()=>{},z=()=>{const e=new Uint8Array(8);return globalThis.crypto.getRandomValues(e),Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")},M=(e,t)=>{const r=z(),n=globalThis.__ZH_WEB_SDK_VERSION__,o={};e.claims.participantCode&&(o.participant_code=e.claims.participantCode),e.claims.platformName&&(o.platform_name=e.claims.platformName),e.claims.platformCode&&(o.platform_code=e.claims.platformCode),e.claims.region&&(o.region=e.claims.region),n&&(o.zh_web_sdk_version=n);const c={meta:{app:{name:e.appName,version:t??"unknown",environment:e.env},session:{id:r,attributes:o},browser:typeof navigator<"u"?{userAgent:navigator.userAgent}:void 0,page:typeof window<"u"?{url:window.location.origin}:void 0},logs:[{message:`Failed to load the script for ${e.webComponentTag} from ${e.env} environment.`,level:"error",timestamp:new Date().toISOString(),context:{web_component:e.webComponentTag,script_url:e.scriptUrl,reason:e.reason,tried_fallback:String(e.triedFallback),elapsed_ms:String(e.elapsedMs)}}]};return{sessionId:r,payload:c}},W=(e,t,r)=>{if(!e||typeof fetch>"u")return;const{sessionId:n,payload:o}=M(t,r);try{fetch(e,{method:"POST",headers:{"Content-Type":"application/json","x-faro-session-id":n},body:JSON.stringify(o),keepalive:!0}).catch(()=>{})}catch{}},j=e=>{const{webComponentTag:t,appName:r,appVersion:n,scriptUrls:o,fallbackScriptUrls:c,collectorUrls:d,env:s,jwt:l,timeoutMs:x=15e3,onLoad:k,onError:U}=e;if(typeof document>"u")return E;const h=`${t}-script-${s}`;if(customElements.get(t)||document.getElementById(h))return E;const F=D(l),B=e.report??(p=>W(d&&A(d,s,l),p,n));let f=!1,T=0,y;const g=()=>{y!==void 0&&clearTimeout(y)},w=(p,m,a)=>{if(f)return;const V=Math.round(performance.now()-T),O={webComponentTag:t,appName:r,env:s,scriptUrl:m,reason:p,triedFallback:a,elapsedMs:V,claims:F};B(O);const _=a?void 0:b(c??{},s,l);if(_&&_!==m){S(_,!0);return}f=!0,g(),document.getElementById(h)?.remove(),U?.(O)},S=(p,m)=>{g(),T=performance.now();const a=document.createElement("script");a.id=h,a.src=p,a.type="module",a.async=!0,a.onload=()=>{setTimeout(()=>{f||(customElements.get(t)?(f=!0,g(),k?.()):w("not-defined",p,m))},0)},a.onerror=()=>w("network",p,m),y=setTimeout(()=>w("timeout",p,m),x),document.getElementById(h)?.remove(),document.head.appendChild(a)},N=b(o,s,l);return N?(S(N,!1),()=>{f=!0,g()}):E};class P{config;state;scriptLoadingPromise;constructor(t){if(!t.jwt||typeof t.jwt!="string")throw new Error(L);this.config={...t,env:t.env||u,theme:t.theme},this.state={initialized:!1,scriptLoaded:!1,container:null,element:null}}async render(t){if(!t||!(t instanceof HTMLElement))throw new Error(this.errorMessages.INVALID_CONTAINER);if(this.state.initialized)throw new Error(this.errorMessages.ALREADY_RENDERED);try{await this.ensureScriptLoaded();const r=this.createWebComponent();t.innerHTML="",t.appendChild(r),this.state.container=t,this.state.element=r,this.state.initialized=!0}catch(r){throw console.error("Failed to render widget:",r),r}}updateConfig(t){if(!this.state.initialized||!this.state.element)throw new Error(this.errorMessages.NOT_RENDERED);const r=this.state.element;Object.entries(t).forEach(([n,o])=>{o&&(this.config[n]=o,r[n]=o)})}destroy(){this.state.initialized&&(this.state.element&&this.state.element.parentNode&&this.state.element.parentNode.removeChild(this.state.element),this.state.container&&(this.state.container.innerHTML=""),this.state.container=null,this.state.element=null,this.state.initialized=!1)}isRendered(){return this.state.initialized}getConfig(){return{...this.config}}getEnvironment(){return this.config.env||u}getScriptId(){return`${this.webComponentTag}-script-${this.getEnvironment()}`}isScriptLoaded(){return!!document.getElementById(this.getScriptId())}getWebComponent(){return customElements.get(this.webComponentTag)}getEffectiveScriptUrls(){return this.scriptUrls}async loadScript(){if(!(this.getWebComponent()||this.isScriptLoaded())){if(this.scriptLoadingPromise)return this.scriptLoadingPromise;this.scriptLoadingPromise=new Promise((t,r)=>{j({webComponentTag:this.webComponentTag,appName:this.webComponentTag,scriptUrls:this.getEffectiveScriptUrls(),collectorUrls:v,env:this.getEnvironment(),jwt:this.config.jwt,onLoad:t,onError:n=>{r(new Error(n.reason==="not-defined"?this.errorMessages.WEB_COMPONENT_NOT_DEFINED:`${this.errorMessages.SCRIPT_LOAD_FAILED} (${this.getEnvironment()})`))}})});try{await this.scriptLoadingPromise}catch(t){throw this.scriptLoadingPromise=void 0,t}return this.scriptLoadingPromise}}async waitForWebComponent(t=5e3){if(!this.getWebComponent())return new Promise((r,n)=>{const o=setTimeout(()=>{n(new Error(`Timeout waiting for ${this.webComponentTag} to be defined`))},t);customElements.whenDefined(this.webComponentTag).then(()=>{clearTimeout(o),r()}).catch(c=>{clearTimeout(o),n(c)})})}async ensureScriptLoaded(){if(!this.state.scriptLoaded)try{await this.loadScript(),await this.waitForWebComponent(),this.state.scriptLoaded=!0}catch(t){throw console.error("Failed to load Connect script:",t),t}}createWebComponent(){const t=document.createElement(this.webComponentTag);return Object.entries(this.config).forEach(([r,n])=>{n&&(t[r]=n)}),t}}i.ErrorCode=void 0,(function(e){e.NETWORK_ERROR="network_error",e.AUTH_ERROR="auth_error",e.NOT_FOUND_ERROR="not_found_error",e.VALIDATION_ERROR="validation_error",e.SERVER_ERROR="server_error",e.CLIENT_ERROR="client_error",e.UNKNOWN_ERROR="unknown_error"})(i.ErrorCode||(i.ErrorCode={}));class R extends P{errorMessages={ALREADY_RENDERED:"CspCryptoSell widget is already rendered. Call destroy() before rendering again.",NOT_RENDERED:"CspCryptoSell widget is not rendered. Call render() first.",INVALID_CONTAINER:"Invalid container element provided.",SCRIPT_LOAD_FAILED:"Failed to load the Connect CspCryptoSell script.",WEB_COMPONENT_NOT_DEFINED:"Web component is not defined. Script may not be loaded."};scriptUrls={local:"http://localhost:5173/csp-crypto-sell-web/index.js",dev:"https://connect-sdk.dev.0hash.com/csp-crypto-sell-web/index.js",cert:"https://sdk.sandbox.connect.xyz/csp-crypto-sell-web/index.js",prod:"https://sdk.connect.xyz/csp-crypto-sell-web/index.js",sandbox:"https://sdk.sandbox.connect.xyz/csp-crypto-sell-web/index.js",production:"https://sdk.connect.xyz/csp-crypto-sell-web/index.js"};webComponentTag="zerohash-csp-crypto-sell";render(t){return super.render(t)}updateConfig(t){return super.updateConfig(t)}getConfig(){return super.getConfig()}isRendered(){return super.isRendered()}destroy(){return super.destroy()}}i.CspCryptoSell=R,i.default=R,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1
+ (function(i,u){typeof exports=="object"&&typeof module<"u"?u(exports):typeof define=="function"&&define.amd?define(["exports"],u):(i=typeof globalThis<"u"?globalThis:i||self,u(i.CspCryptoSell={}))})(this,(function(i){"use strict";const u="production",L="JWT token is required and must be a string.",v={dev:"https://grafana-faro-collector.dev.0hash.com/collect",cert:"https://grafana-faro-collector.cert.zerohash.com/collect",prod:"https://grafana-faro-collector.zerohash.com/collect","eu-cert":"https://grafana-faro-collector.cert.zerohash.eu/collect","eu-prod":"https://grafana-faro-collector.zerohash.eu/collect",sandbox:"https://grafana-faro-collector.cert.zerohash.com/collect",production:"https://grafana-faro-collector.zerohash.com/collect"},I=e=>{if(!e||typeof e!="string")return null;const t=e.split(".");if(t.length<2)return null;try{const r=t[1].replace(/-/g,"+").replace(/_/g,"/"),n=r+"===".slice(0,(4-r.length%4)%4),o=typeof atob<"u"?atob(n):Buffer.from(n,"base64").toString("utf-8"),d=JSON.parse(o)?.payload?.region;if(typeof d!="string")return null;const s=d.toLowerCase();return s==="us"||s==="eu"?s:null}catch{return null}},b=(e,t)=>I(t)!=="eu"?e:e==="cert"?"eu-cert":e==="prod"?"eu-prod":e,D=e=>{if(!e||typeof e!="string")return{};const t=e.split(".");if(t.length<2)return{};try{const r=t[1].replace(/-/g,"+").replace(/_/g,"/"),n=r+"===".slice(0,(4-r.length%4)%4),o=typeof atob<"u"?atob(n):Buffer.from(n,"base64").toString("utf-8"),c=JSON.parse(o),d=c?.payload??{},s=l=>typeof l=="string"&&l.length>0?l:void 0;return{participantCode:s(d.participant_code),platformName:s(d.platform_name),platformCode:s(c.platform_code),region:s(d.region)}}catch{return{}}},C=(e,t,r)=>{const n=b(t,r);return e[n]??e[t]??e.prod},A=(e,t,r)=>{const n=b(t,r);return e[n]??e[t]},E=()=>{},z=()=>{const e=new Uint8Array(8);return globalThis.crypto.getRandomValues(e),Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")},M=(e,t)=>{const r=z(),n=globalThis.__ZH_WEB_SDK_VERSION__,o={};e.claims.participantCode&&(o.participant_code=e.claims.participantCode),e.claims.platformName&&(o.platform_name=e.claims.platformName),e.claims.platformCode&&(o.platform_code=e.claims.platformCode),e.claims.region&&(o.region=e.claims.region),n&&(o.zh_web_sdk_version=n);const c={meta:{app:{name:e.appName,version:t??"unknown",environment:e.env},session:{id:r,attributes:o},browser:typeof navigator<"u"?{userAgent:navigator.userAgent}:void 0,page:typeof window<"u"?{url:window.location.origin}:void 0},logs:[{message:`Failed to load the script for ${e.webComponentTag} from ${e.env} environment.`,level:"error",timestamp:new Date().toISOString(),context:{web_component:e.webComponentTag,script_url:e.scriptUrl,reason:e.reason,tried_fallback:String(e.triedFallback),elapsed_ms:String(e.elapsedMs)}}]};return{sessionId:r,payload:c}},j=(e,t,r)=>{if(!e||typeof fetch>"u")return;const{sessionId:n,payload:o}=M(t,r);try{fetch(e,{method:"POST",headers:{"Content-Type":"application/json","x-faro-session-id":n},body:JSON.stringify(o),keepalive:!0}).catch(()=>{})}catch{}},x=e=>{const{webComponentTag:t,appName:r,appVersion:n,scriptUrls:o,fallbackScriptUrls:c,collectorUrls:d,env:s,jwt:l,timeoutMs:k=15e3,onLoad:P,onError:U}=e;if(typeof document>"u")return E;const f=`${t}-script-${s}`;if(customElements.get(t)||document.getElementById(f))return E;const F=D(l),B=e.report??(p=>j(d&&A(d,s,l),p,n));let h=!1,T=0,y;const g=()=>{y!==void 0&&clearTimeout(y)},w=(p,m,a)=>{if(h)return;const V=Math.round(performance.now()-T),O={webComponentTag:t,appName:r,env:s,scriptUrl:m,reason:p,triedFallback:a,elapsedMs:V,claims:F};B(O);const _=a?void 0:C(c??{},s,l);if(_&&_!==m){S(_,!0);return}h=!0,g(),document.getElementById(f)?.remove(),U?.(O)},S=(p,m)=>{g(),T=performance.now();const a=document.createElement("script");a.id=f,a.src=p,a.type="module",a.async=!0,a.onload=()=>{setTimeout(()=>{h||(customElements.get(t)?(h=!0,g(),P?.()):w("not-defined",p,m))},0)},a.onerror=()=>w("network",p,m),y=setTimeout(()=>w("timeout",p,m),k),document.getElementById(f)?.remove(),document.head.appendChild(a)},N=C(o,s,l);return N?(S(N,!1),()=>{h=!0,g()}):E};class W{config;state;scriptLoadingPromise;constructor(t){if(!t.jwt||typeof t.jwt!="string")throw new Error(L);this.config={...t,env:t.env||u,theme:t.theme},this.state={initialized:!1,scriptLoaded:!1,container:null,element:null}}async render(t){if(!t||!(t instanceof HTMLElement))throw new Error(this.errorMessages.INVALID_CONTAINER);if(this.state.initialized)throw new Error(this.errorMessages.ALREADY_RENDERED);try{await this.ensureScriptLoaded();const r=this.createWebComponent();t.innerHTML="",t.appendChild(r),this.state.container=t,this.state.element=r,this.state.initialized=!0}catch(r){throw console.error("Failed to render widget:",r),r}}updateConfig(t){if(!this.state.initialized||!this.state.element)throw new Error(this.errorMessages.NOT_RENDERED);const r=this.state.element;Object.entries(t).forEach(([n,o])=>{o&&(this.config[n]=o,r[n]=o)})}destroy(){this.state.initialized&&(this.state.element&&this.state.element.parentNode&&this.state.element.parentNode.removeChild(this.state.element),this.state.container&&(this.state.container.innerHTML=""),this.state.container=null,this.state.element=null,this.state.initialized=!1)}isRendered(){return this.state.initialized}getConfig(){return{...this.config}}getEnvironment(){return this.config.env||u}getScriptId(){return`${this.webComponentTag}-script-${this.getEnvironment()}`}isScriptLoaded(){return!!document.getElementById(this.getScriptId())}getWebComponent(){return customElements.get(this.webComponentTag)}getEffectiveScriptUrls(){return this.scriptUrls}async loadScript(){if(!(this.getWebComponent()||this.isScriptLoaded())){if(this.scriptLoadingPromise)return this.scriptLoadingPromise;this.scriptLoadingPromise=new Promise((t,r)=>{x({webComponentTag:this.webComponentTag,appName:this.webComponentTag,scriptUrls:this.getEffectiveScriptUrls(),collectorUrls:v,env:this.getEnvironment(),jwt:this.config.jwt,onLoad:t,onError:n=>{r(new Error(n.reason==="not-defined"?this.errorMessages.WEB_COMPONENT_NOT_DEFINED:`${this.errorMessages.SCRIPT_LOAD_FAILED} (${this.getEnvironment()})`))}})});try{await this.scriptLoadingPromise}catch(t){throw this.scriptLoadingPromise=void 0,t}return this.scriptLoadingPromise}}async waitForWebComponent(t=5e3){if(!this.getWebComponent())return new Promise((r,n)=>{const o=setTimeout(()=>{n(new Error(`Timeout waiting for ${this.webComponentTag} to be defined`))},t);customElements.whenDefined(this.webComponentTag).then(()=>{clearTimeout(o),r()}).catch(c=>{clearTimeout(o),n(c)})})}async ensureScriptLoaded(){if(!this.state.scriptLoaded)try{await this.loadScript(),await this.waitForWebComponent(),this.state.scriptLoaded=!0}catch(t){throw console.error("Failed to load Connect script:",t),t}}createWebComponent(){const t=document.createElement(this.webComponentTag);return Object.entries(this.config).forEach(([r,n])=>{n&&(t[r]=n)}),t}}i.ErrorCode=void 0,(function(e){e.NETWORK_ERROR="network_error",e.AUTH_ERROR="auth_error",e.NOT_FOUND_ERROR="not_found_error",e.VALIDATION_ERROR="validation_error",e.SERVER_ERROR="server_error",e.CLIENT_ERROR="client_error",e.UNKNOWN_ERROR="unknown_error"})(i.ErrorCode||(i.ErrorCode={}));class R extends W{errorMessages={ALREADY_RENDERED:"CspCryptoSell widget is already rendered. Call destroy() before rendering again.",NOT_RENDERED:"CspCryptoSell widget is not rendered. Call render() first.",INVALID_CONTAINER:"Invalid container element provided.",SCRIPT_LOAD_FAILED:"Failed to load the Connect CspCryptoSell script.",WEB_COMPONENT_NOT_DEFINED:"Web component is not defined. Script may not be loaded."};scriptUrls={local:"http://localhost:5173/csp-crypto-sell-web/index.js",dev:"https://connect-sdk.dev.0hash.com/csp-crypto-sell-web/index.js",cert:"https://sdk.sandbox.connect.xyz/csp-crypto-sell-web/index.js",prod:"https://sdk.connect.xyz/csp-crypto-sell-web/index.js",sandbox:"https://sdk.sandbox.connect.xyz/csp-crypto-sell-web/index.js",production:"https://sdk.connect.xyz/csp-crypto-sell-web/index.js","eu-cert":"https://sdk-cdn.cert.zerohash.eu/csp-crypto-sell-web/index.js","eu-prod":"https://sdk-cdn.zerohash.eu/csp-crypto-sell-web/index.js"};webComponentTag="zerohash-csp-crypto-sell";render(t){return super.render(t)}updateConfig(t){return super.updateConfig(t)}getConfig(){return super.getConfig()}isRendered(){return super.isRendered()}destroy(){return super.destroy()}}i.CspCryptoSell=R,i.default=R,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerohash-sdk/csp-crypto-sell-js",
3
- "version": "1.5.0",
3
+ "version": "1.6.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",