@shipengine/react-api 1.0.0-next.5 → 1.0.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/hooks/account-settings/index.d.ts +2 -0
- package/hooks/{use-get-account-settings.d.ts → account-settings/use-get-account-settings.d.ts} +1 -1
- package/hooks/account-settings/use-update-account-settings.d.ts +5 -0
- package/hooks/addresses/index.d.ts +2 -0
- package/hooks/{use-parse-address.d.ts → addresses/use-parse-address.d.ts} +1 -1
- package/hooks/{use-validate-addresses.d.ts → addresses/use-validate-addresses.d.ts} +1 -1
- package/hooks/carriers/index.d.ts +12 -0
- package/hooks/{use-add-funds.d.ts → carriers/use-add-funds.d.ts} +1 -1
- package/hooks/{use-connect-carrier.d.ts → carriers/use-connect-carrier.d.ts} +1 -1
- package/hooks/carriers/use-get-auto-funding-configuration.d.ts +4 -0
- package/hooks/{use-get-carrier-by-id.d.ts → carriers/use-get-carrier-by-id.d.ts} +1 -1
- package/hooks/carriers/use-get-countries-by-carrier.d.ts +5 -0
- package/hooks/carriers/use-get-currencies-by-carrier.d.ts +5 -0
- package/hooks/carriers/use-get-package-rating-group-by-carrier.d.ts +5 -0
- package/hooks/carriers/use-get-services-by-carrier.d.ts +7 -0
- package/hooks/carriers/use-get-wallet-history.d.ts +10 -0
- package/hooks/carriers/use-get-zones-by-carrier.d.ts +4 -0
- package/hooks/{use-list-carriers.d.ts → carriers/use-list-carriers.d.ts} +1 -1
- package/hooks/carriers/use-update-auto-funding.d.ts +5 -0
- package/hooks/custom-packages/index.d.ts +1 -0
- package/hooks/{use-list-custom-package-types.d.ts → custom-packages/use-list-custom-package-types.d.ts} +1 -1
- package/hooks/funding-sources/index.d.ts +6 -0
- package/hooks/funding-sources/use-create-funding-source.d.ts +7 -0
- package/hooks/funding-sources/use-funding-sources-add-funds.d.ts +7 -0
- package/hooks/funding-sources/use-get-funding-source-by-id.d.ts +4 -0
- package/hooks/funding-sources/use-list-funding-sources.d.ts +4 -0
- package/hooks/funding-sources/use-register-carrier.d.ts +5 -0
- package/hooks/funding-sources/use-update-funding-source.d.ts +12 -0
- package/hooks/index.d.ts +15 -33
- package/hooks/insurance/index.d.ts +1 -0
- package/hooks/{use-get-insurance-account.d.ts → insurance/use-get-insurance-account.d.ts} +1 -1
- package/hooks/labels/index.d.ts +4 -0
- package/hooks/{use-create-label.d.ts → labels/use-create-label.d.ts} +1 -1
- package/hooks/{use-get-label.d.ts → labels/use-get-label.d.ts} +1 -1
- package/hooks/{use-list-labels.d.ts → labels/use-list-labels.d.ts} +1 -1
- package/hooks/{use-void-label.d.ts → labels/use-void-label.d.ts} +1 -1
- package/hooks/order-sources/index.d.ts +2 -0
- package/hooks/order-sources/use-list-order-sources.d.ts +6 -0
- package/hooks/{use-refresh-order-source.d.ts → order-sources/use-refresh-order-source.d.ts} +2 -2
- package/hooks/rate-cards/index.d.ts +8 -0
- package/hooks/rate-cards/use-create-rate-card.d.ts +6 -0
- package/hooks/rate-cards/use-delete-rate-card.d.ts +4 -0
- package/hooks/rate-cards/use-download-rate-card.d.ts +5 -0
- package/hooks/rate-cards/use-get-rate-card-by-id.d.ts +5 -0
- package/hooks/rate-cards/use-list-rate-cards.d.ts +5 -0
- package/hooks/rate-cards/use-publish-rate-card.d.ts +5 -0
- package/hooks/rate-cards/use-update-rate-card.d.ts +6 -0
- package/hooks/rate-cards/use-upload-rate-card.d.ts +9 -0
- package/hooks/rates/index.d.ts +1 -0
- package/hooks/{use-calculate-rates.d.ts → rates/use-calculate-rates.d.ts} +1 -1
- package/hooks/sales-orders/index.d.ts +3 -0
- package/hooks/{use-get-sales-order.d.ts → sales-orders/use-get-sales-order.d.ts} +1 -1
- package/hooks/{use-list-sales-orders.d.ts → sales-orders/use-list-sales-orders.d.ts} +1 -1
- package/hooks/{use-notify-sales-order.d.ts → sales-orders/use-notify-sales-order.d.ts} +1 -1
- package/hooks/sales-orders-shipment/index.d.ts +4 -0
- package/hooks/{use-create-sales-order-shipment.d.ts → sales-orders-shipment/use-create-sales-order-shipment.d.ts} +1 -1
- package/hooks/{use-get-sales-order-shipment.d.ts → sales-orders-shipment/use-get-sales-order-shipment.d.ts} +1 -1
- package/hooks/{use-list-sales-order-shipments.d.ts → sales-orders-shipment/use-list-sales-order-shipments.d.ts} +1 -1
- package/hooks/{use-update-sales-order-shipment.d.ts → sales-orders-shipment/use-update-sales-order-shipment.d.ts} +1 -1
- package/hooks/shipments/index.d.ts +4 -0
- package/hooks/shipments/use-create-shipment.d.ts +10 -0
- package/hooks/shipments/use-get-shipment-rates.d.ts +6 -0
- package/hooks/shipments/use-get-shipment.d.ts +6 -0
- package/hooks/shipments/use-list-shipments.d.ts +7 -0
- package/hooks/warehouses/index.d.ts +4 -0
- package/hooks/{use-create-warehouse.d.ts → warehouses/use-create-warehouse.d.ts} +1 -1
- package/hooks/{use-delete-warehouse.d.ts → warehouses/use-delete-warehouse.d.ts} +1 -1
- package/hooks/warehouses/use-list-warehouses.d.ts +10 -0
- package/hooks/{use-update-warehouse.d.ts → warehouses/use-update-warehouse.d.ts} +1 -1
- package/index.js +1559 -16
- package/index.mjs +1412 -3264
- package/package.json +5 -4
- package/hooks/use-get-auto-funding-configuration.d.ts +0 -4
- package/hooks/use-get-shipment.d.ts +0 -6
- package/hooks/use-get-wallet-transaction-history.d.ts +0 -5
- package/hooks/use-list-order-sources.d.ts +0 -6
- package/hooks/use-list-warehouses.d.ts +0 -7
- package/hooks/use-update-account-settings.d.ts +0 -10
- package/hooks/use-update-auto-funding.d.ts +0 -5
- package/hooks/use-update-billing.d.ts +0 -8
package/index.js
CHANGED
|
@@ -1,16 +1,1559 @@
|
|
|
1
|
-
|
|
2
|
-
`),function(d){if(l=d.indexOf(":"),i=r.trim(d.substr(0,l)).toLowerCase(),s=r.trim(d.substr(l+1)),i){if(a[i]&&e.indexOf(i)>=0)return;i==="set-cookie"?a[i]=(a[i]?a[i]:[]).concat([s]):a[i]=a[i]?a[i]+", "+s:s}}),a},We}var Ve,ft;function ma(){if(ft)return Ve;ft=1;var r=D;return Ve=r.isStandardBrowserEnv()?function(){var t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a"),a;function i(s){var l=s;return t&&(n.setAttribute("href",l),l=n.href),n.setAttribute("href",l),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return a=i(window.location.href),function(l){var c=r.isString(l)?i(l):l;return c.protocol===a.protocol&&c.host===a.host}}():function(){return function(){return!0}}(),Ve}var He,pt;function De(){if(pt)return He;pt=1;function r(e){this.message=e}return r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,He=r,He}var Ke,dt;function ht(){if(dt)return Ke;dt=1;var r=D,e=fa(),t=pa(),n=Zt,a=ya(),i=va(),s=ma(),l=tn(),c=rn,d=De();return Ke=function(o){return new Promise(function(p,y){var v=o.data,m=o.headers,h=o.responseType,g;function O(){o.cancelToken&&o.cancelToken.unsubscribe(g),o.signal&&o.signal.removeEventListener("abort",g)}r.isFormData(v)&&delete m["Content-Type"];var S=new XMLHttpRequest;if(o.auth){var R=o.auth.username||"",B=o.auth.password?unescape(encodeURIComponent(o.auth.password)):"";m.Authorization="Basic "+btoa(R+":"+B)}var N=a(o.baseURL,o.url);S.open(o.method.toUpperCase(),n(N,o.params,o.paramsSerializer),!0),S.timeout=o.timeout;function H(){if(S){var P="getAllResponseHeaders"in S?i(S.getAllResponseHeaders()):null,$=!h||h==="text"||h==="json"?S.responseText:S.response,_={data:$,status:S.status,statusText:S.statusText,headers:P,config:o,request:S};e(function(k){p(k),O()},function(k){y(k),O()},_),S=null}}if("onloadend"in S?S.onloadend=H:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(H)},S.onabort=function(){S&&(y(l("Request aborted",o,"ECONNABORTED",S)),S=null)},S.onerror=function(){y(l("Network Error",o,null,S)),S=null},S.ontimeout=function(){var $=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",_=o.transitional||c;o.timeoutErrorMessage&&($=o.timeoutErrorMessage),y(l($,o,_.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",S)),S=null},r.isStandardBrowserEnv()){var M=(o.withCredentials||s(N))&&o.xsrfCookieName?t.read(o.xsrfCookieName):void 0;M&&(m[o.xsrfHeaderName]=M)}"setRequestHeader"in S&&r.forEach(m,function($,_){typeof v>"u"&&_.toLowerCase()==="content-type"?delete m[_]:S.setRequestHeader(_,$)}),r.isUndefined(o.withCredentials)||(S.withCredentials=!!o.withCredentials),h&&h!=="json"&&(S.responseType=o.responseType),typeof o.onDownloadProgress=="function"&&S.addEventListener("progress",o.onDownloadProgress),typeof o.onUploadProgress=="function"&&S.upload&&S.upload.addEventListener("progress",o.onUploadProgress),(o.cancelToken||o.signal)&&(g=function(P){S&&(y(!P||P&&P.type?new d("canceled"):P),S.abort(),S=null)},o.cancelToken&&o.cancelToken.subscribe(g),o.signal&&(o.signal.aborted?g():o.signal.addEventListener("abort",g))),v||(v=null),S.send(v)})},Ke}var C=D,yt=ca,ga=en,Sa=rn,wa={"Content-Type":"application/x-www-form-urlencoded"};function vt(r,e){!C.isUndefined(r)&&C.isUndefined(r["Content-Type"])&&(r["Content-Type"]=e)}function ba(){var r;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(r=ht()),r}function Aa(r,e,t){if(C.isString(r))try{return(e||JSON.parse)(r),C.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(r)}var Te={transitional:Sa,adapter:ba(),transformRequest:[function(e,t){return yt(t,"Accept"),yt(t,"Content-Type"),C.isFormData(e)||C.isArrayBuffer(e)||C.isBuffer(e)||C.isStream(e)||C.isFile(e)||C.isBlob(e)?e:C.isArrayBufferView(e)?e.buffer:C.isURLSearchParams(e)?(vt(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):C.isObject(e)||t&&t["Content-Type"]==="application/json"?(vt(t,"application/json"),Aa(e)):e}],transformResponse:[function(e){var t=this.transitional||Te.transitional,n=t&&t.silentJSONParsing,a=t&&t.forcedJSONParsing,i=!n&&this.responseType==="json";if(i||a&&C.isString(e)&&e.length)try{return JSON.parse(e)}catch(s){if(i)throw s.name==="SyntaxError"?ga(s,this,"E_JSON_PARSE"):s}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};C.forEach(["delete","get","head"],function(e){Te.headers[e]={}});C.forEach(["post","put","patch"],function(e){Te.headers[e]=C.merge(wa)});var qr=Te,Ea=D,Oa=qr,Pa=function(e,t,n){var a=this||Oa;return Ea.forEach(n,function(s){e=s.call(a,e,t)}),e},Qe,mt;function nn(){return mt||(mt=1,Qe=function(e){return!!(e&&e.__CANCEL__)}),Qe}var gt=D,Je=Pa,Ia=nn(),Ra=qr,xa=De();function Xe(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new xa("canceled")}var Ca=function(e){Xe(e),e.headers=e.headers||{},e.data=Je.call(e,e.data,e.headers,e.transformRequest),e.headers=gt.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),gt.forEach(["delete","get","head","post","put","patch","common"],function(a){delete e.headers[a]});var t=e.adapter||Ra.adapter;return t(e).then(function(a){return Xe(e),a.data=Je.call(e,a.data,a.headers,e.transformResponse),a},function(a){return Ia(a)||(Xe(e),a&&a.response&&(a.response.data=Je.call(e,a.response.data,a.response.headers,e.transformResponse))),Promise.reject(a)})},T=D,an=function(e,t){t=t||{};var n={};function a(u,o){return T.isPlainObject(u)&&T.isPlainObject(o)?T.merge(u,o):T.isPlainObject(o)?T.merge({},o):T.isArray(o)?o.slice():o}function i(u){if(T.isUndefined(t[u])){if(!T.isUndefined(e[u]))return a(void 0,e[u])}else return a(e[u],t[u])}function s(u){if(!T.isUndefined(t[u]))return a(void 0,t[u])}function l(u){if(T.isUndefined(t[u])){if(!T.isUndefined(e[u]))return a(void 0,e[u])}else return a(void 0,t[u])}function c(u){if(u in t)return a(e[u],t[u]);if(u in e)return a(void 0,e[u])}var d={url:s,method:s,data:s,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:c};return T.forEach(Object.keys(e).concat(Object.keys(t)),function(o){var f=d[o]||i,p=f(o);T.isUndefined(p)&&f!==c||(n[o]=p)}),n},Ye,St;function on(){return St||(St=1,Ye={version:"0.26.1"}),Ye}var Fa=on().version,zr={};["object","boolean","number","function","string","symbol"].forEach(function(r,e){zr[r]=function(n){return typeof n===r||"a"+(e<1?"n ":" ")+r}});var wt={};zr.transitional=function(e,t,n){function a(i,s){return"[Axios v"+Fa+"] Transitional option '"+i+"'"+s+(n?". "+n:"")}return function(i,s,l){if(e===!1)throw new Error(a(s," has been removed"+(t?" in "+t:"")));return t&&!wt[s]&&(wt[s]=!0,console.warn(a(s," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,s,l):!0}};function Na(r,e,t){if(typeof r!="object")throw new TypeError("options must be an object");for(var n=Object.keys(r),a=n.length;a-- >0;){var i=n[a],s=e[i];if(s){var l=r[i],c=l===void 0||s(l,i,r);if(c!==!0)throw new TypeError("option "+i+" must be "+c);continue}if(t!==!0)throw Error("Unknown option "+i)}}var $a={assertOptions:Na,validators:zr},sn=D,_a=Zt,bt=ua,At=Ca,Le=an,un=$a,ie=un.validators;function we(r){this.defaults=r,this.interceptors={request:new bt,response:new bt}}we.prototype.request=function(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Le(this.defaults,t),t.method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var n=t.transitional;n!==void 0&&un.assertOptions(n,{silentJSONParsing:ie.transitional(ie.boolean),forcedJSONParsing:ie.transitional(ie.boolean),clarifyTimeoutError:ie.transitional(ie.boolean)},!1);var a=[],i=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(t)===!1||(i=i&&p.synchronous,a.unshift(p.fulfilled,p.rejected))});var s=[];this.interceptors.response.forEach(function(p){s.push(p.fulfilled,p.rejected)});var l;if(!i){var c=[At,void 0];for(Array.prototype.unshift.apply(c,a),c=c.concat(s),l=Promise.resolve(t);c.length;)l=l.then(c.shift(),c.shift());return l}for(var d=t;a.length;){var u=a.shift(),o=a.shift();try{d=u(d)}catch(f){o(f);break}}try{l=At(d)}catch(f){return Promise.reject(f)}for(;s.length;)l=l.then(s.shift(),s.shift());return l};we.prototype.getUri=function(e){return e=Le(this.defaults,e),_a(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};sn.forEach(["delete","get","head","options"],function(e){we.prototype[e]=function(t,n){return this.request(Le(n||{},{method:e,url:t,data:(n||{}).data}))}});sn.forEach(["post","put","patch"],function(e){we.prototype[e]=function(t,n,a){return this.request(Le(a||{},{method:e,url:t,data:n}))}});var Da=we,Ze,Et;function Ta(){if(Et)return Ze;Et=1;var r=De();function e(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var n;this.promise=new Promise(function(s){n=s});var a=this;this.promise.then(function(i){if(a._listeners){var s,l=a._listeners.length;for(s=0;s<l;s++)a._listeners[s](i);a._listeners=null}}),this.promise.then=function(i){var s,l=new Promise(function(c){a.subscribe(c),s=c}).then(i);return l.cancel=function(){a.unsubscribe(s)},l},t(function(s){a.reason||(a.reason=new r(s),n(a.reason))})}return e.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},e.prototype.subscribe=function(n){if(this.reason){n(this.reason);return}this._listeners?this._listeners.push(n):this._listeners=[n]},e.prototype.unsubscribe=function(n){if(this._listeners){var a=this._listeners.indexOf(n);a!==-1&&this._listeners.splice(a,1)}},e.source=function(){var n,a=new e(function(s){n=s});return{token:a,cancel:n}},Ze=e,Ze}var er,Ot;function La(){return Ot||(Ot=1,er=function(e){return function(n){return e.apply(null,n)}}),er}var rr,Pt;function ka(){if(Pt)return rr;Pt=1;var r=D;return rr=function(t){return r.isObject(t)&&t.isAxiosError===!0},rr}var It=D,Ma=Qt,Ie=Da,Ua=an,Ba=qr;function ln(r){var e=new Ie(r),t=Ma(Ie.prototype.request,e);return It.extend(t,Ie.prototype,e),It.extend(t,e),t.create=function(a){return ln(Ua(r,a))},t}var G=ln(Ba);G.Axios=Ie;G.Cancel=De();G.CancelToken=Ta();G.isCancel=nn();G.VERSION=on().version;G.all=function(e){return Promise.all(e)};G.spread=La();G.isAxiosError=ka();Wn.exports=G;Re.default=G;(function(r){r.exports=Re})(Gn);const vr=zn(dr);var xe={},qa={get exports(){return xe},set exports(r){xe=r}};(function(r){(function(){var e,t,n,a,i,s,l,c,d;t={},c=this,r!==null&&r.exports?r.exports=t:c.ipaddr=t,l=function(u,o,f,p){var y,v;if(u.length!==o.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");for(y=0;p>0;){if(v=f-p,v<0&&(v=0),u[y]>>v!==o[y]>>v)return!1;p-=f,y+=1}return!0},t.subnetMatch=function(u,o,f){var p,y,v,m,h;f==null&&(f="unicast");for(v in o)for(m=o[v],m[0]&&!(m[0]instanceof Array)&&(m=[m]),p=0,y=m.length;p<y;p++)if(h=m[p],u.kind()===h[0].kind()&&u.match.apply(u,h))return v;return f},t.IPv4=function(){function u(o){var f,p,y;if(o.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");for(f=0,p=o.length;f<p;f++)if(y=o[f],!(0<=y&&y<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=o}return u.prototype.kind=function(){return"ipv4"},u.prototype.toString=function(){return this.octets.join(".")},u.prototype.toNormalizedString=function(){return this.toString()},u.prototype.toByteArray=function(){return this.octets.slice(0)},u.prototype.match=function(o,f){var p;if(f===void 0&&(p=o,o=p[0],f=p[1]),o.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return l(this.octets,o.octets,8,f)},u.prototype.SpecialRanges={unspecified:[[new u([0,0,0,0]),8]],broadcast:[[new u([255,255,255,255]),32]],multicast:[[new u([224,0,0,0]),4]],linkLocal:[[new u([169,254,0,0]),16]],loopback:[[new u([127,0,0,0]),8]],carrierGradeNat:[[new u([100,64,0,0]),10]],private:[[new u([10,0,0,0]),8],[new u([172,16,0,0]),12],[new u([192,168,0,0]),16]],reserved:[[new u([192,0,0,0]),24],[new u([192,0,2,0]),24],[new u([192,88,99,0]),24],[new u([198,51,100,0]),24],[new u([203,0,113,0]),24],[new u([240,0,0,0]),4]]},u.prototype.range=function(){return t.subnetMatch(this,this.SpecialRanges)},u.prototype.toIPv4MappedAddress=function(){return t.IPv6.parse("::ffff:"+this.toString())},u.prototype.prefixLengthFromSubnetMask=function(){var o,f,p,y,v,m,h;for(h={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},o=0,v=!1,f=p=3;p>=0;f=p+=-1)if(y=this.octets[f],y in h){if(m=h[y],v&&m!==0)return null;m!==8&&(v=!0),o+=m}else return null;return 32-o},u}(),n="(0?\\d+|0x[a-f0-9]+)",a={fourOctet:new RegExp("^"+n+"\\."+n+"\\."+n+"\\."+n+"$","i"),longValue:new RegExp("^"+n+"$","i")},t.IPv4.parser=function(u){var o,f,p,y,v;if(f=function(m){return m[0]==="0"&&m[1]!=="x"?parseInt(m,8):parseInt(m)},o=u.match(a.fourOctet))return function(){var m,h,g,O;for(g=o.slice(1,6),O=[],m=0,h=g.length;m<h;m++)p=g[m],O.push(f(p));return O}();if(o=u.match(a.longValue)){if(v=f(o[1]),v>4294967295||v<0)throw new Error("ipaddr: address outside defined range");return function(){var m,h;for(h=[],y=m=0;m<=24;y=m+=8)h.push(v>>y&255);return h}().reverse()}else return null},t.IPv6=function(){function u(o,f){var p,y,v,m,h,g;if(o.length===16)for(this.parts=[],p=y=0;y<=14;p=y+=2)this.parts.push(o[p]<<8|o[p+1]);else if(o.length===8)this.parts=o;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(g=this.parts,v=0,m=g.length;v<m;v++)if(h=g[v],!(0<=h&&h<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");f&&(this.zoneId=f)}return u.prototype.kind=function(){return"ipv6"},u.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,"::")},u.prototype.toRFC5952String=function(){var o,f,p,y,v;for(y=/((^|:)(0(:|$)){2,})/g,v=this.toNormalizedString(),o=0,f=-1;p=y.exec(v);)p[0].length>f&&(o=p.index,f=p[0].length);return f<0?v:v.substring(0,o)+"::"+v.substring(o+f)},u.prototype.toByteArray=function(){var o,f,p,y,v;for(o=[],v=this.parts,f=0,p=v.length;f<p;f++)y=v[f],o.push(y>>8),o.push(y&255);return o},u.prototype.toNormalizedString=function(){var o,f,p;return o=function(){var y,v,m,h;for(m=this.parts,h=[],y=0,v=m.length;y<v;y++)f=m[y],h.push(f.toString(16));return h}.call(this).join(":"),p="",this.zoneId&&(p="%"+this.zoneId),o+p},u.prototype.toFixedLengthString=function(){var o,f,p;return o=function(){var y,v,m,h;for(m=this.parts,h=[],y=0,v=m.length;y<v;y++)f=m[y],h.push(f.toString(16).padStart(4,"0"));return h}.call(this).join(":"),p="",this.zoneId&&(p="%"+this.zoneId),o+p},u.prototype.match=function(o,f){var p;if(f===void 0&&(p=o,o=p[0],f=p[1]),o.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return l(this.parts,o.parts,16,f)},u.prototype.SpecialRanges={unspecified:[new u([0,0,0,0,0,0,0,0]),128],linkLocal:[new u([65152,0,0,0,0,0,0,0]),10],multicast:[new u([65280,0,0,0,0,0,0,0]),8],loopback:[new u([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new u([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new u([0,0,0,0,0,65535,0,0]),96],rfc6145:[new u([0,0,0,0,65535,0,0,0]),96],rfc6052:[new u([100,65435,0,0,0,0,0,0]),96],"6to4":[new u([8194,0,0,0,0,0,0,0]),16],teredo:[new u([8193,0,0,0,0,0,0,0]),32],reserved:[[new u([8193,3512,0,0,0,0,0,0]),32]]},u.prototype.range=function(){return t.subnetMatch(this,this.SpecialRanges)},u.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},u.prototype.toIPv4Address=function(){var o,f,p;if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");return p=this.parts.slice(-2),o=p[0],f=p[1],new t.IPv4([o>>8,o&255,f>>8,f&255])},u.prototype.prefixLengthFromSubnetMask=function(){var o,f,p,y,v,m,h;for(h={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},o=0,v=!1,f=p=7;p>=0;f=p+=-1)if(y=this.parts[f],y in h){if(m=h[y],v&&m!==0)return null;m!==16&&(v=!0),o+=m}else return null;return 128-o},u}(),i="(?:[0-9a-f]+::?)+",d="%[0-9a-z]{1,}",s={zoneIndex:new RegExp(d,"i"),native:new RegExp("^(::)?("+i+")?([0-9a-f]+)?(::)?("+d+")?$","i"),transitional:new RegExp("^((?:"+i+")|(?:::)(?:"+i+")?)"+(n+"\\."+n+"\\."+n+"\\."+n)+("("+d+")?$"),"i")},e=function(u,o){var f,p,y,v,m,h;if(u.indexOf("::")!==u.lastIndexOf("::"))return null;for(h=(u.match(s.zoneIndex)||[])[0],h&&(h=h.substring(1),u=u.replace(/%.+$/,"")),f=0,p=-1;(p=u.indexOf(":",p+1))>=0;)f++;if(u.substr(0,2)==="::"&&f--,u.substr(-2,2)==="::"&&f--,f>o)return null;for(m=o-f,v=":";m--;)v+="0:";return u=u.replace("::",v),u[0]===":"&&(u=u.slice(1)),u[u.length-1]===":"&&(u=u.slice(0,-1)),o=function(){var g,O,S,R;for(S=u.split(":"),R=[],g=0,O=S.length;g<O;g++)y=S[g],R.push(parseInt(y,16));return R}(),{parts:o,zoneId:h}},t.IPv6.parser=function(u){var o,f,p,y,v,m,h;if(s.native.test(u))return e(u,8);if((y=u.match(s.transitional))&&(h=y[6]||"",o=e(y[1].slice(0,-1)+h,6),o.parts)){for(m=[parseInt(y[2]),parseInt(y[3]),parseInt(y[4]),parseInt(y[5])],f=0,p=m.length;f<p;f++)if(v=m[f],!(0<=v&&v<=255))return null;return o.parts.push(m[0]<<8|m[1]),o.parts.push(m[2]<<8|m[3]),{parts:o.parts,zoneId:o.zoneId}}return null},t.IPv4.isIPv4=t.IPv6.isIPv6=function(u){return this.parser(u)!==null},t.IPv4.isValid=function(u){try{return new this(this.parser(u)),!0}catch{return!1}},t.IPv4.isValidFourPartDecimal=function(u){return!!(t.IPv4.isValid(u)&&u.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},t.IPv6.isValid=function(u){var o;if(typeof u=="string"&&u.indexOf(":")===-1)return!1;try{return o=this.parser(u),new this(o.parts,o.zoneId),!0}catch{return!1}},t.IPv4.parse=function(u){var o;if(o=this.parser(u),o===null)throw new Error("ipaddr: string is not formatted like ip address");return new this(o)},t.IPv6.parse=function(u){var o;if(o=this.parser(u),o.parts===null)throw new Error("ipaddr: string is not formatted like ip address");return new this(o.parts,o.zoneId)},t.IPv4.parseCIDR=function(u){var o,f,p;if((f=u.match(/^(.+)\/(\d+)$/))&&(o=parseInt(f[2]),o>=0&&o<=32))return p=[this.parse(f[1]),o],Object.defineProperty(p,"toString",{value:function(){return this.join("/")}}),p;throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},t.IPv4.subnetMaskFromPrefixLength=function(u){var o,f,p;if(u=parseInt(u),u<0||u>32)throw new Error("ipaddr: invalid IPv4 prefix length");for(p=[0,0,0,0],f=0,o=Math.floor(u/8);f<o;)p[f]=255,f++;return o<4&&(p[o]=Math.pow(2,u%8)-1<<8-u%8),new this(p)},t.IPv4.broadcastAddressFromCIDR=function(u){var o,f,p,y,v;try{for(o=this.parseCIDR(u),p=o[0].toByteArray(),v=this.subnetMaskFromPrefixLength(o[1]).toByteArray(),y=[],f=0;f<4;)y.push(parseInt(p[f],10)|parseInt(v[f],10)^255),f++;return new this(y)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},t.IPv4.networkAddressFromCIDR=function(u){var o,f,p,y,v;try{for(o=this.parseCIDR(u),p=o[0].toByteArray(),v=this.subnetMaskFromPrefixLength(o[1]).toByteArray(),y=[],f=0;f<4;)y.push(parseInt(p[f],10)&parseInt(v[f],10)),f++;return new this(y)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},t.IPv6.parseCIDR=function(u){var o,f,p;if((f=u.match(/^(.+)\/(\d+)$/))&&(o=parseInt(f[2]),o>=0&&o<=128))return p=[this.parse(f[1]),o],Object.defineProperty(p,"toString",{value:function(){return this.join("/")}}),p;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},t.isValid=function(u){return t.IPv6.isValid(u)||t.IPv4.isValid(u)},t.parse=function(u){if(t.IPv6.isValid(u))return t.IPv6.parse(u);if(t.IPv4.isValid(u))return t.IPv4.parse(u);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},t.parseCIDR=function(u){try{return t.IPv6.parseCIDR(u)}catch{try{return t.IPv4.parseCIDR(u)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},t.fromByteArray=function(u){var o;if(o=u.length,o===4)return new t.IPv4(u);if(o===16)return new t.IPv6(u);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},t.process=function(u){var o;return o=this.parse(u),o.kind()==="ipv6"&&o.isIPv4MappedAddress()?o.toIPv4Address():o}}).call(Kt)})(qa);const jr=r=>Array.isArray(r)&&r.every(e=>Gr(e)),Gr=r=>!!r.errorCode,za=async()=>{try{const r=await vr.get("https://api.ipify.org/?format=json");return r.data.ip&&xe.isValid(r.data.ip)?xe.parse(r.data.ip).toString():void 0}catch{return}};class cn{constructor(e){this.client=e,this.list=()=>this.client.get("/v1/carriers"),this.get=t=>this.client.get(`/v1/carriers/${t}`),this.connect=async({carrierCode:t,...n})=>{const a=await za();return a?await this.client.post(`/v1/registration/${t}`,{...n,endUserIpAddress:a}):Promise.reject([new U("Unable to get IP address")])},this.addFunds=(t,n)=>this.client.put(`/v1/carriers/${t}/add_funds`,n),this.updateAutoFunding=(t,n)=>this.client.post(`/v1/carriers/${t}/auto_funding`,n),this.getAutoFunding=t=>this.client.get(`/v1/carriers/${t}/auto_funding`),this.client=e}}var mr={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},Wr={};function tr(r){return typeof r=="string"?mr[r.toLowerCase()]:r}function gr(r,e){return gr=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t},gr(r,e)}function ja(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Sr(r,e,t){return Sr=ja()?Reflect.construct:function(n,a,i){var s=[null];s.push.apply(s,a);var l=new(Function.bind.apply(n,s));return i&&gr(l,i.prototype),l},Sr.apply(null,arguments)}function ee(r){if(r==null)return r;if(Array.isArray(r))return r.slice();if(typeof r=="object"){var e={};return Object.keys(r).forEach(function(t){e[t]=r[t]}),e}return r}function wr(r){return r===void 0?"undefined":r===null?"null":Array.isArray(r)?"[ "+r.map(function(e){return wr(e)}).join(", ")+" ]":typeof r=="object"?JSON.stringify(r):typeof r=="function"?"[Function: "+r.name+"]":typeof r=="boolean"||typeof r=="number"?r:"'"+r.toString()+"'"}function Y(r){if(typeof r!="string"){for(var e=new Array(arguments.length),t=0;t<arguments.length;t++)e[t]=wr(arguments[t]);return e.join(" ")}for(var n=/%[sdj%]/g,a=1,i=arguments,s=i.length,l=String(r).replace(n,function(d){if(d==="%%")return"%";if(a>=s)return d;switch(d){case"%s":return String(i[a++]);case"%d":return Number(i[a++]);case"%j":try{return JSON.stringify(i[a++])}catch{return"[Circular]"}default:return d}}),c=i[a];a<s;c=i[++a])l+=c===null||typeof c!="object"?" "+c:" "+wr(c);return l}function Ga(r,e){var t=r.split(`
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
`),o.push(e.err.stack)),n.apply(console,o)},r.getDefaultCss=function(){return Rt},r}(),ve={},Ka={get exports(){return ve},set exports(r){ve=r}};(function(r){(function(e){var t=function(h,g,O){if(!d(g)||o(g)||f(g)||p(g)||c(g))return g;var S,R=0,B=0;if(u(g))for(S=[],B=g.length;R<B;R++)S.push(t(h,g[R],O));else{S={};for(var N in g)Object.prototype.hasOwnProperty.call(g,N)&&(S[h(N,O)]=t(h,g[N],O))}return S},n=function(h,g){g=g||{};var O=g.separator||"_",S=g.split||/(?=[A-Z])/;return h.split(S).join(O)},a=function(h){return y(h)?h:(h=h.replace(/[\-_\s]+(.)?/g,function(g,O){return O?O.toUpperCase():""}),h.substr(0,1).toLowerCase()+h.substr(1))},i=function(h){var g=a(h);return g.substr(0,1).toUpperCase()+g.substr(1)},s=function(h,g){return n(h,g).toLowerCase()},l=Object.prototype.toString,c=function(h){return typeof h=="function"},d=function(h){return h===Object(h)},u=function(h){return l.call(h)=="[object Array]"},o=function(h){return l.call(h)=="[object Date]"},f=function(h){return l.call(h)=="[object RegExp]"},p=function(h){return l.call(h)=="[object Boolean]"},y=function(h){return h=h-0,h===h},v=function(h,g){var O=g&&"process"in g?g.process:g;return typeof O!="function"?h:function(S,R){return O(S,h,R)}},m={camelize:a,decamelize:s,pascalize:i,depascalize:s,camelizeKeys:function(h,g){return t(v(a,g),h)},decamelizeKeys:function(h,g){return t(v(s,g),h,g)},pascalizeKeys:function(h,g){return t(v(i,g),h)},depascalizeKeys:function(){return this.decamelizeKeys.apply(this,arguments)}};r.exports?r.exports=m:e.humps=m})(Kt)})(Ka);var Qa=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var a=42;e[t]=a;for(t in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var i=Object.getOwnPropertySymbols(e);if(i.length!==1||i[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(e,t);if(s.value!==a||s.enumerable!==!0)return!1}return!0},xt=typeof Symbol<"u"&&Symbol,Ja=Qa,Xa=function(){return typeof xt!="function"||typeof Symbol!="function"||typeof xt("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Ja()},Ya="Function.prototype.bind called on incompatible ",nr=Array.prototype.slice,Za=Object.prototype.toString,ei="[object Function]",ri=function(e){var t=this;if(typeof t!="function"||Za.call(t)!==ei)throw new TypeError(Ya+t);for(var n=nr.call(arguments,1),a,i=function(){if(this instanceof a){var u=t.apply(this,n.concat(nr.call(arguments)));return Object(u)===u?u:this}else return t.apply(e,n.concat(nr.call(arguments)))},s=Math.max(0,t.length-n.length),l=[],c=0;c<s;c++)l.push("$"+c);if(a=Function("binder","return function ("+l.join(",")+"){ return binder.apply(this,arguments); }")(i),t.prototype){var d=function(){};d.prototype=t.prototype,a.prototype=new d,d.prototype=null}return a},ti=ri,Hr=Function.prototype.bind||ti,ni=Hr,ai=ni.call(Function.call,Object.prototype.hasOwnProperty),w,ce=SyntaxError,hn=Function,le=TypeError,ar=function(r){try{return hn('"use strict"; return ('+r+").constructor;")()}catch{}},te=Object.getOwnPropertyDescriptor;if(te)try{te({},"")}catch{te=null}var ir=function(){throw new le},ii=te?function(){try{return arguments.callee,ir}catch{try{return te(arguments,"callee").get}catch{return ir}}}():ir,se=Xa(),z=Object.getPrototypeOf||function(r){return r.__proto__},ue={},oi=typeof Uint8Array>"u"?w:z(Uint8Array),ne={"%AggregateError%":typeof AggregateError>"u"?w:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?w:ArrayBuffer,"%ArrayIteratorPrototype%":se?z([][Symbol.iterator]()):w,"%AsyncFromSyncIteratorPrototype%":w,"%AsyncFunction%":ue,"%AsyncGenerator%":ue,"%AsyncGeneratorFunction%":ue,"%AsyncIteratorPrototype%":ue,"%Atomics%":typeof Atomics>"u"?w:Atomics,"%BigInt%":typeof BigInt>"u"?w:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?w:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?w:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?w:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?w:Float32Array,"%Float64Array%":typeof Float64Array>"u"?w:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?w:FinalizationRegistry,"%Function%":hn,"%GeneratorFunction%":ue,"%Int8Array%":typeof Int8Array>"u"?w:Int8Array,"%Int16Array%":typeof Int16Array>"u"?w:Int16Array,"%Int32Array%":typeof Int32Array>"u"?w:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":se?z(z([][Symbol.iterator]())):w,"%JSON%":typeof JSON=="object"?JSON:w,"%Map%":typeof Map>"u"?w:Map,"%MapIteratorPrototype%":typeof Map>"u"||!se?w:z(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?w:Promise,"%Proxy%":typeof Proxy>"u"?w:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?w:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?w:Set,"%SetIteratorPrototype%":typeof Set>"u"||!se?w:z(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?w:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":se?z(""[Symbol.iterator]()):w,"%Symbol%":se?Symbol:w,"%SyntaxError%":ce,"%ThrowTypeError%":ii,"%TypedArray%":oi,"%TypeError%":le,"%Uint8Array%":typeof Uint8Array>"u"?w:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?w:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?w:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?w:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?w:WeakMap,"%WeakRef%":typeof WeakRef>"u"?w:WeakRef,"%WeakSet%":typeof WeakSet>"u"?w:WeakSet};try{null.error}catch(r){var si=z(z(r));ne["%Error.prototype%"]=si}var ui=function r(e){var t;if(e==="%AsyncFunction%")t=ar("async function () {}");else if(e==="%GeneratorFunction%")t=ar("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=ar("async function* () {}");else if(e==="%AsyncGenerator%"){var n=r("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&(t=z(a.prototype))}return ne[e]=t,t},Ct={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},be=Hr,Ce=ai,li=be.call(Function.call,Array.prototype.concat),ci=be.call(Function.apply,Array.prototype.splice),Ft=be.call(Function.call,String.prototype.replace),Fe=be.call(Function.call,String.prototype.slice),fi=be.call(Function.call,RegExp.prototype.exec),pi=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,di=/\\(\\)?/g,hi=function(e){var t=Fe(e,0,1),n=Fe(e,-1);if(t==="%"&&n!=="%")throw new ce("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new ce("invalid intrinsic syntax, expected opening `%`");var a=[];return Ft(e,pi,function(i,s,l,c){a[a.length]=l?Ft(c,di,"$1"):s||i}),a},yi=function(e,t){var n=e,a;if(Ce(Ct,n)&&(a=Ct[n],n="%"+a[0]+"%"),Ce(ne,n)){var i=ne[n];if(i===ue&&(i=ui(n)),typeof i>"u"&&!t)throw new le("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:a,name:n,value:i}}throw new ce("intrinsic "+e+" does not exist!")},Kr=function(e,t){if(typeof e!="string"||e.length===0)throw new le("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new le('"allowMissing" argument must be a boolean');if(fi(/^%?[^%]*%?$/,e)===null)throw new ce("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=hi(e),a=n.length>0?n[0]:"",i=yi("%"+a+"%",t),s=i.name,l=i.value,c=!1,d=i.alias;d&&(a=d[0],ci(n,li([0,1],d)));for(var u=1,o=!0;u<n.length;u+=1){var f=n[u],p=Fe(f,0,1),y=Fe(f,-1);if((p==='"'||p==="'"||p==="`"||y==='"'||y==="'"||y==="`")&&p!==y)throw new ce("property names with quotes must have matching quotes");if((f==="constructor"||!o)&&(c=!0),a+="."+f,s="%"+a+"%",Ce(ne,s))l=ne[s];else if(l!=null){if(!(f in l)){if(!t)throw new le("base intrinsic for "+e+" exists, but the property is not available.");return}if(te&&u+1>=n.length){var v=te(l,f);o=!!v,o&&"get"in v&&!("originalValue"in v.get)?l=v.get:l=l[f]}else o=Ce(l,f),l=l[f];o&&!c&&(ne[s]=l)}}return l},Er={},vi={get exports(){return Er},set exports(r){Er=r}};(function(r){var e=Hr,t=Kr,n=t("%Function.prototype.apply%"),a=t("%Function.prototype.call%"),i=t("%Reflect.apply%",!0)||e.call(a,n),s=t("%Object.getOwnPropertyDescriptor%",!0),l=t("%Object.defineProperty%",!0),c=t("%Math.max%");if(l)try{l({},"a",{value:1})}catch{l=null}r.exports=function(o){var f=i(e,a,arguments);if(s&&l){var p=s(f,"length");p.configurable&&l(f,"length",{value:1+c(0,o.length-(arguments.length-1))})}return f};var d=function(){return i(e,n,arguments)};l?l(r.exports,"apply",{value:d}):r.exports.apply=d})(vi);var yn=Kr,vn=Er,mi=vn(yn("String.prototype.indexOf")),gi=function(e,t){var n=yn(e,!!t);return typeof n=="function"&&mi(e,".prototype.")>-1?vn(n):n};const Si={},wi=Object.freeze(Object.defineProperty({__proto__:null,default:Si},Symbol.toStringTag,{value:"Module"})),bi=jn(wi);var Qr=typeof Map=="function"&&Map.prototype,or=Object.getOwnPropertyDescriptor&&Qr?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Ne=Qr&&or&&typeof or.get=="function"?or.get:null,Nt=Qr&&Map.prototype.forEach,Jr=typeof Set=="function"&&Set.prototype,sr=Object.getOwnPropertyDescriptor&&Jr?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,$e=Jr&&sr&&typeof sr.get=="function"?sr.get:null,$t=Jr&&Set.prototype.forEach,Ai=typeof WeakMap=="function"&&WeakMap.prototype,me=Ai?WeakMap.prototype.has:null,Ei=typeof WeakSet=="function"&&WeakSet.prototype,ge=Ei?WeakSet.prototype.has:null,Oi=typeof WeakRef=="function"&&WeakRef.prototype,_t=Oi?WeakRef.prototype.deref:null,Pi=Boolean.prototype.valueOf,Ii=Object.prototype.toString,Ri=Function.prototype.toString,xi=String.prototype.match,Xr=String.prototype.slice,Q=String.prototype.replace,Ci=String.prototype.toUpperCase,Dt=String.prototype.toLowerCase,mn=RegExp.prototype.test,Tt=Array.prototype.concat,j=Array.prototype.join,Fi=Array.prototype.slice,Lt=Math.floor,Or=typeof BigInt=="function"?BigInt.prototype.valueOf:null,ur=Object.getOwnPropertySymbols,Pr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,fe=typeof Symbol=="function"&&typeof Symbol.iterator=="object",F=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===fe||"symbol")?Symbol.toStringTag:null,gn=Object.prototype.propertyIsEnumerable,kt=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function Mt(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||mn.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var n=r<0?-Lt(-r):Lt(r);if(n!==r){var a=String(n),i=Xr.call(e,a.length+1);return Q.call(a,t,"$&_")+"."+Q.call(Q.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Q.call(e,t,"$&_")}var Ir=bi,Ut=Ir.custom,Bt=wn(Ut)?Ut:null,Ni=function r(e,t,n,a){var i=t||{};if(K(i,"quoteStyle")&&i.quoteStyle!=="single"&&i.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(K(i,"maxStringLength")&&(typeof i.maxStringLength=="number"?i.maxStringLength<0&&i.maxStringLength!==1/0:i.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=K(i,"customInspect")?i.customInspect:!0;if(typeof s!="boolean"&&s!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(K(i,"indent")&&i.indent!==null&&i.indent!==" "&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(K(i,"numericSeparator")&&typeof i.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=i.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return An(e,i);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var c=String(e);return l?Mt(e,c):c}if(typeof e=="bigint"){var d=String(e)+"n";return l?Mt(e,d):d}var u=typeof i.depth>"u"?5:i.depth;if(typeof n>"u"&&(n=0),n>=u&&u>0&&typeof e=="object")return Rr(e)?"[Array]":"[Object]";var o=Qi(i,n);if(typeof a>"u")a=[];else if(bn(a,e)>=0)return"[Circular]";function f(L,k,W){if(k&&(a=Fi.call(a),a.push(k)),W){var he={depth:i.depth};return K(i,"quoteStyle")&&(he.quoteStyle=i.quoteStyle),r(L,he,n+1,a)}return r(L,i,n+1,a)}if(typeof e=="function"&&!qt(e)){var p=Bi(e),y=Ae(e,f);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(y.length>0?" { "+j.call(y,", ")+" }":"")}if(wn(e)){var v=fe?Q.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Pr.call(e);return typeof e=="object"&&!fe?ye(v):v}if(Vi(e)){for(var m="<"+Dt.call(String(e.nodeName)),h=e.attributes||[],g=0;g<h.length;g++)m+=" "+h[g].name+"="+Sn($i(h[g].value),"double",i);return m+=">",e.childNodes&&e.childNodes.length&&(m+="..."),m+="</"+Dt.call(String(e.nodeName))+">",m}if(Rr(e)){if(e.length===0)return"[]";var O=Ae(e,f);return o&&!Ki(O)?"["+xr(O,o)+"]":"[ "+j.call(O,", ")+" ]"}if(Di(e)){var S=Ae(e,f);return!("cause"in Error.prototype)&&"cause"in e&&!gn.call(e,"cause")?"{ ["+String(e)+"] "+j.call(Tt.call("[cause]: "+f(e.cause),S),", ")+" }":S.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+j.call(S,", ")+" }"}if(typeof e=="object"&&s){if(Bt&&typeof e[Bt]=="function"&&Ir)return Ir(e,{depth:u-n});if(s!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(qi(e)){var R=[];return Nt&&Nt.call(e,function(L,k){R.push(f(k,e,!0)+" => "+f(L,e))}),zt("Map",Ne.call(e),R,o)}if(Gi(e)){var B=[];return $t&&$t.call(e,function(L){B.push(f(L,e))}),zt("Set",$e.call(e),B,o)}if(zi(e))return lr("WeakMap");if(Wi(e))return lr("WeakSet");if(ji(e))return lr("WeakRef");if(Li(e))return ye(f(Number(e)));if(Mi(e))return ye(f(Or.call(e)));if(ki(e))return ye(Pi.call(e));if(Ti(e))return ye(f(String(e)));if(!_i(e)&&!qt(e)){var N=Ae(e,f),H=kt?kt(e)===Object.prototype:e instanceof Object||e.constructor===Object,M=e instanceof Object?"":"null prototype",P=!H&&F&&Object(e)===e&&F in e?Xr.call(X(e),8,-1):M?"Object":"",$=H||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",_=$+(P||M?"["+j.call(Tt.call([],P||[],M||[]),": ")+"] ":"");return N.length===0?_+"{}":o?_+"{"+xr(N,o)+"}":_+"{ "+j.call(N,", ")+" }"}return String(e)};function Sn(r,e,t){var n=(t.quoteStyle||e)==="double"?'"':"'";return n+r+n}function $i(r){return Q.call(String(r),/"/g,""")}function Rr(r){return X(r)==="[object Array]"&&(!F||!(typeof r=="object"&&F in r))}function _i(r){return X(r)==="[object Date]"&&(!F||!(typeof r=="object"&&F in r))}function qt(r){return X(r)==="[object RegExp]"&&(!F||!(typeof r=="object"&&F in r))}function Di(r){return X(r)==="[object Error]"&&(!F||!(typeof r=="object"&&F in r))}function Ti(r){return X(r)==="[object String]"&&(!F||!(typeof r=="object"&&F in r))}function Li(r){return X(r)==="[object Number]"&&(!F||!(typeof r=="object"&&F in r))}function ki(r){return X(r)==="[object Boolean]"&&(!F||!(typeof r=="object"&&F in r))}function wn(r){if(fe)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Pr)return!1;try{return Pr.call(r),!0}catch{}return!1}function Mi(r){if(!r||typeof r!="object"||!Or)return!1;try{return Or.call(r),!0}catch{}return!1}var Ui=Object.prototype.hasOwnProperty||function(r){return r in this};function K(r,e){return Ui.call(r,e)}function X(r){return Ii.call(r)}function Bi(r){if(r.name)return r.name;var e=xi.call(Ri.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function bn(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,n=r.length;t<n;t++)if(r[t]===e)return t;return-1}function qi(r){if(!Ne||!r||typeof r!="object")return!1;try{Ne.call(r);try{$e.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function zi(r){if(!me||!r||typeof r!="object")return!1;try{me.call(r,me);try{ge.call(r,ge)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function ji(r){if(!_t||!r||typeof r!="object")return!1;try{return _t.call(r),!0}catch{}return!1}function Gi(r){if(!$e||!r||typeof r!="object")return!1;try{$e.call(r);try{Ne.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function Wi(r){if(!ge||!r||typeof r!="object")return!1;try{ge.call(r,ge);try{me.call(r,me)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function Vi(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function An(r,e){if(r.length>e.maxStringLength){var t=r.length-e.maxStringLength,n="... "+t+" more character"+(t>1?"s":"");return An(Xr.call(r,0,e.maxStringLength),e)+n}var a=Q.call(Q.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Hi);return Sn(a,"single",e)}function Hi(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+Ci.call(e.toString(16))}function ye(r){return"Object("+r+")"}function lr(r){return r+" { ? }"}function zt(r,e,t,n){var a=n?xr(t,n):j.call(t,", ");return r+" ("+e+") {"+a+"}"}function Ki(r){for(var e=0;e<r.length;e++)if(bn(r[e],`
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
`+e.prev}function Ae(r,e){var t=Rr(r),n=[];if(t){n.length=r.length;for(var a=0;a<r.length;a++)n[a]=K(r,a)?e(r[a],r):""}var i=typeof ur=="function"?ur(r):[],s;if(fe){s={};for(var l=0;l<i.length;l++)s["$"+i[l]]=i[l]}for(var c in r)K(r,c)&&(t&&String(Number(c))===c&&c<r.length||fe&&s["$"+c]instanceof Symbol||(mn.call(/[^\w$]/,c)?n.push(e(c,r)+": "+e(r[c],r)):n.push(c+": "+e(r[c],r))));if(typeof ur=="function")for(var d=0;d<i.length;d++)gn.call(r,i[d])&&n.push("["+e(i[d])+"]: "+e(r[i[d]],r));return n}var Yr=Kr,de=gi,Ji=Ni,Xi=Yr("%TypeError%"),Ee=Yr("%WeakMap%",!0),Oe=Yr("%Map%",!0),Yi=de("WeakMap.prototype.get",!0),Zi=de("WeakMap.prototype.set",!0),eo=de("WeakMap.prototype.has",!0),ro=de("Map.prototype.get",!0),to=de("Map.prototype.set",!0),no=de("Map.prototype.has",!0),Zr=function(r,e){for(var t=r,n;(n=t.next)!==null;t=n)if(n.key===e)return t.next=n.next,n.next=r.next,r.next=n,n},ao=function(r,e){var t=Zr(r,e);return t&&t.value},io=function(r,e,t){var n=Zr(r,e);n?n.value=t:r.next={key:e,next:r.next,value:t}},oo=function(r,e){return!!Zr(r,e)},so=function(){var e,t,n,a={assert:function(i){if(!a.has(i))throw new Xi("Side channel does not contain "+Ji(i))},get:function(i){if(Ee&&i&&(typeof i=="object"||typeof i=="function")){if(e)return Yi(e,i)}else if(Oe){if(t)return ro(t,i)}else if(n)return ao(n,i)},has:function(i){if(Ee&&i&&(typeof i=="object"||typeof i=="function")){if(e)return eo(e,i)}else if(Oe){if(t)return no(t,i)}else if(n)return oo(n,i);return!1},set:function(i,s){Ee&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new Ee),Zi(e,i,s)):Oe?(t||(t=new Oe),to(t,i,s)):(n||(n={key:{},next:null}),io(n,i,s))}};return a},uo=String.prototype.replace,lo=/%20/g,cr={RFC1738:"RFC1738",RFC3986:"RFC3986"},et={default:cr.RFC3986,formatters:{RFC1738:function(r){return uo.call(r,lo,"+")},RFC3986:function(r){return String(r)}},RFC1738:cr.RFC1738,RFC3986:cr.RFC3986},co=et,fr=Object.prototype.hasOwnProperty,re=Array.isArray,q=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),fo=function(e){for(;e.length>1;){var t=e.pop(),n=t.obj[t.prop];if(re(n)){for(var a=[],i=0;i<n.length;++i)typeof n[i]<"u"&&a.push(n[i]);t.obj[t.prop]=a}}},En=function(e,t){for(var n=t&&t.plainObjects?Object.create(null):{},a=0;a<e.length;++a)typeof e[a]<"u"&&(n[a]=e[a]);return n},po=function r(e,t,n){if(!t)return e;if(typeof t!="object"){if(re(e))e.push(t);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!fr.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);var a=e;return re(e)&&!re(t)&&(a=En(e,n)),re(e)&&re(t)?(t.forEach(function(i,s){if(fr.call(e,s)){var l=e[s];l&&typeof l=="object"&&i&&typeof i=="object"?e[s]=r(l,i,n):e.push(i)}else e[s]=i}),e):Object.keys(t).reduce(function(i,s){var l=t[s];return fr.call(i,s)?i[s]=r(i[s],l,n):i[s]=l,i},a)},ho=function(e,t){return Object.keys(t).reduce(function(n,a){return n[a]=t[a],n},e)},yo=function(r,e,t){var n=r.replace(/\+/g," ");if(t==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},vo=function(e,t,n,a,i){if(e.length===0)return e;var s=e;if(typeof e=="symbol"?s=Symbol.prototype.toString.call(e):typeof e!="string"&&(s=String(e)),n==="iso-8859-1")return escape(s).replace(/%u[0-9a-f]{4}/gi,function(u){return"%26%23"+parseInt(u.slice(2),16)+"%3B"});for(var l="",c=0;c<s.length;++c){var d=s.charCodeAt(c);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||i===co.RFC1738&&(d===40||d===41)){l+=s.charAt(c);continue}if(d<128){l=l+q[d];continue}if(d<2048){l=l+(q[192|d>>6]+q[128|d&63]);continue}if(d<55296||d>=57344){l=l+(q[224|d>>12]+q[128|d>>6&63]+q[128|d&63]);continue}c+=1,d=65536+((d&1023)<<10|s.charCodeAt(c)&1023),l+=q[240|d>>18]+q[128|d>>12&63]+q[128|d>>6&63]+q[128|d&63]}return l},mo=function(e){for(var t=[{obj:{o:e},prop:"o"}],n=[],a=0;a<t.length;++a)for(var i=t[a],s=i.obj[i.prop],l=Object.keys(s),c=0;c<l.length;++c){var d=l[c],u=s[d];typeof u=="object"&&u!==null&&n.indexOf(u)===-1&&(t.push({obj:s,prop:d}),n.push(u))}return fo(t),e},go=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},So=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},wo=function(e,t){return[].concat(e,t)},bo=function(e,t){if(re(e)){for(var n=[],a=0;a<e.length;a+=1)n.push(t(e[a]));return n}return t(e)},On={arrayToObject:En,assign:ho,combine:wo,compact:mo,decode:yo,encode:vo,isBuffer:So,isRegExp:go,maybeMap:bo,merge:po},Pn=so,Cr=On,Se=et,Ao=Object.prototype.hasOwnProperty,jt={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},V=Array.isArray,Eo=String.prototype.split,Oo=Array.prototype.push,In=function(r,e){Oo.apply(r,V(e)?e:[e])},Po=Date.prototype.toISOString,Gt=Se.default,x={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:Cr.encode,encodeValuesOnly:!1,format:Gt,formatter:Se.formatters[Gt],indices:!1,serializeDate:function(e){return Po.call(e)},skipNulls:!1,strictNullHandling:!1},Io=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},pr={},Ro=function r(e,t,n,a,i,s,l,c,d,u,o,f,p,y,v,m){for(var h=e,g=m,O=0,S=!1;(g=g.get(pr))!==void 0&&!S;){var R=g.get(e);if(O+=1,typeof R<"u"){if(R===O)throw new RangeError("Cyclic object value");S=!0}typeof g.get(pr)>"u"&&(O=0)}if(typeof c=="function"?h=c(t,h):h instanceof Date?h=o(h):n==="comma"&&V(h)&&(h=Cr.maybeMap(h,function(ke){return ke instanceof Date?o(ke):ke})),h===null){if(i)return l&&!y?l(t,x.encoder,v,"key",f):t;h=""}if(Io(h)||Cr.isBuffer(h)){if(l){var B=y?t:l(t,x.encoder,v,"key",f);if(n==="comma"&&y){for(var N=Eo.call(String(h),","),H="",M=0;M<N.length;++M)H+=(M===0?"":",")+p(l(N[M],x.encoder,v,"value",f));return[p(B)+(a&&V(h)&&N.length===1?"[]":"")+"="+H]}return[p(B)+"="+p(l(h,x.encoder,v,"value",f))]}return[p(t)+"="+p(String(h))]}var P=[];if(typeof h>"u")return P;var $;if(n==="comma"&&V(h))$=[{value:h.length>0?h.join(",")||null:void 0}];else if(V(c))$=c;else{var _=Object.keys(h);$=d?_.sort(d):_}for(var L=a&&V(h)&&h.length===1?t+"[]":t,k=0;k<$.length;++k){var W=$[k],he=typeof W=="object"&&typeof W.value<"u"?W.value:h[W];if(!(s&&he===null)){var Bn=V(h)?typeof n=="function"?n(L,W):L:L+(u?"."+W:"["+W+"]");m.set(e,O);var tt=Pn();tt.set(pr,m),In(P,r(he,Bn,n,a,i,s,l,c,d,u,o,f,p,y,v,tt))}}return P},xo=function(e){if(!e)return x;if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var t=e.charset||x.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=Se.default;if(typeof e.format<"u"){if(!Ao.call(Se.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var a=Se.formatters[n],i=x.filter;return(typeof e.filter=="function"||V(e.filter))&&(i=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:x.addQueryPrefix,allowDots:typeof e.allowDots>"u"?x.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:x.charsetSentinel,delimiter:typeof e.delimiter>"u"?x.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:x.encode,encoder:typeof e.encoder=="function"?e.encoder:x.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:x.encodeValuesOnly,filter:i,format:n,formatter:a,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:x.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:x.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:x.strictNullHandling}},Co=function(r,e){var t=r,n=xo(e),a,i;typeof n.filter=="function"?(i=n.filter,t=i("",t)):V(n.filter)&&(i=n.filter,a=i);var s=[];if(typeof t!="object"||t===null)return"";var l;e&&e.arrayFormat in jt?l=e.arrayFormat:e&&"indices"in e?l=e.indices?"indices":"repeat":l="indices";var c=jt[l];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var d=c==="comma"&&e&&e.commaRoundTrip;a||(a=Object.keys(t)),n.sort&&a.sort(n.sort);for(var u=Pn(),o=0;o<a.length;++o){var f=a[o];n.skipNulls&&t[f]===null||In(s,Ro(t[f],f,c,d,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,u))}var p=s.join(n.delimiter),y=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?y+="utf8=%26%2310003%3B&":y+="utf8=%E2%9C%93&"),p.length>0?y+p:""},pe=On,Fr=Object.prototype.hasOwnProperty,Fo=Array.isArray,I={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:pe.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},No=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},Rn=function(r,e){return r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1?r.split(","):r},$o="utf8=%26%2310003%3B",_o="utf8=%E2%9C%93",Do=function(e,t){var n={},a=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,i=t.parameterLimit===1/0?void 0:t.parameterLimit,s=a.split(t.delimiter,i),l=-1,c,d=t.charset;if(t.charsetSentinel)for(c=0;c<s.length;++c)s[c].indexOf("utf8=")===0&&(s[c]===_o?d="utf-8":s[c]===$o&&(d="iso-8859-1"),l=c,c=s.length);for(c=0;c<s.length;++c)if(c!==l){var u=s[c],o=u.indexOf("]="),f=o===-1?u.indexOf("="):o+1,p,y;f===-1?(p=t.decoder(u,I.decoder,d,"key"),y=t.strictNullHandling?null:""):(p=t.decoder(u.slice(0,f),I.decoder,d,"key"),y=pe.maybeMap(Rn(u.slice(f+1),t),function(v){return t.decoder(v,I.decoder,d,"value")})),y&&t.interpretNumericEntities&&d==="iso-8859-1"&&(y=No(y)),u.indexOf("[]=")>-1&&(y=Fo(y)?[y]:y),Fr.call(n,p)?n[p]=pe.combine(n[p],y):n[p]=y}return n},To=function(r,e,t,n){for(var a=n?e:Rn(e,t),i=r.length-1;i>=0;--i){var s,l=r[i];if(l==="[]"&&t.parseArrays)s=[].concat(a);else{s=t.plainObjects?Object.create(null):{};var c=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,d=parseInt(c,10);!t.parseArrays&&c===""?s={0:a}:!isNaN(d)&&l!==c&&String(d)===c&&d>=0&&t.parseArrays&&d<=t.arrayLimit?(s=[],s[d]=a):c!=="__proto__"&&(s[c]=a)}a=s}return a},Lo=function(e,t,n,a){if(e){var i=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,s=/(\[[^[\]]*])/,l=/(\[[^[\]]*])/g,c=n.depth>0&&s.exec(i),d=c?i.slice(0,c.index):i,u=[];if(d){if(!n.plainObjects&&Fr.call(Object.prototype,d)&&!n.allowPrototypes)return;u.push(d)}for(var o=0;n.depth>0&&(c=l.exec(i))!==null&&o<n.depth;){if(o+=1,!n.plainObjects&&Fr.call(Object.prototype,c[1].slice(1,-1))&&!n.allowPrototypes)return;u.push(c[1])}return c&&u.push("["+i.slice(c.index)+"]"),To(u,t,n,a)}},ko=function(e){if(!e)return I;if(e.decoder!==null&&e.decoder!==void 0&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=typeof e.charset>"u"?I.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?I.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:I.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:I.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:I.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:I.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:I.comma,decoder:typeof e.decoder=="function"?e.decoder:I.decoder,delimiter:typeof e.delimiter=="string"||pe.isRegExp(e.delimiter)?e.delimiter:I.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:I.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:I.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:I.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:I.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:I.strictNullHandling}},Mo=function(r,e){var t=ko(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?Object.create(null):{};for(var n=typeof r=="string"?Do(r,t):r,a=t.plainObjects?Object.create(null):{},i=Object.keys(n),s=0;s<i.length;++s){var l=i[s],c=Lo(l,n[l],t,typeof r=="string");a=pe.merge(a,c,t)}return t.allowSparse===!0?a:pe.compact(a)},Uo=Co,Bo=Mo,qo=et,zo={formats:qo,parse:Bo,stringify:Uo};class xn{constructor(e){this.client=e,this.list=()=>this.client.get("/v1/packages"),this.client=e}}class Cn{constructor(e){this.client=e,this.get=t=>this.client.get(`/v1/insurance/${t}/balance`),this.client=e}}class Fn{constructor(e){this.client=e,this.get=t=>this.client.get(`/v1/labels/${t}`),this.list=(t={})=>this.client.get("/v1/labels",{params:t}),this.createByRateId=(t,n)=>this.client.post(`/v1/labels/rates/${t}`,n),this.void=t=>this.client.put(`/v1/labels/${t}/void`),this.client=e}}class Nn{constructor(e){this.client=e,this.list=()=>this.client.get("/v-beta/order_sources"),this.get=t=>this.client.get(`/v-beta/order_sources/${t}`),this.refresh=t=>this.client.put(`/v-beta/order_sources/${t}/refresh`),this.client=e}}class $n{constructor(e){this.client=e,this.calculateByShipmentId=(t,n)=>this.client.post("/v1/rates",{rateOptions:n,shipmentId:t}),this.client=e}}class _n{constructor(e){this.client=e,this.list=(t={})=>this.client.post("/v-beta/shipments/list",t),this.get=t=>this.client.get(`/v-beta/shipments/${t}`),this.create=(t,n)=>this.client.post(`/v-beta/shipments/sales_order/${t}`,n),this.update=(t,n)=>this.client.put(`/v-beta/shipments/${t}`,n),this.client=e}}class Dn{constructor(e){this.client=e,this.list=(t={})=>this.client.get("/v-beta/sales_orders",{params:t}),this.get=t=>this.client.get(`/v-beta/sales_orders/${t}`),this.notifyShipped=(t,n)=>this.client.post(`/v-beta/sales_orders/${t}/notify`,n),this.client=e}}class Tn{constructor(e){this.client=e,this.list=()=>this.client.get("/v1/warehouses"),this.create=t=>this.client.post("/v1/warehouses",t),this.update=(t,n)=>this.client.put(`/v1/warehouses/${t}`,n),this.delete=t=>this.client.delete(`/v1/warehouses/${t}`),this.client=e}}const Wt=pn({name:"shipengine-api",serializers:{...Vr,req:r=>({headers:r.headers,method:r.method,url:r.url}),res:r=>({data:r.data,headers:r.config.headers,method:r.config.method,statusCode:r.status,url:r.config.url})},streams:[{stream:new dn}]}),jo=r=>!!r.errors&&jr(r.errors);class Nr{constructor(e,{baseURL:t,headers:n,getToken:a}){const i=vr.create({baseURL:t,headers:{...n,Authorization:`Bearer ${e}`,"Content-Type":"application/json"},paramsSerializer:s=>zo.stringify(ve.decamelizeKeys(s),{arrayFormat:"brackets"}),transformRequest:[s=>ve.decamelizeKeys(s),s=>JSON.stringify(s)],transformResponse:[s=>{if(s)return JSON.parse(s)},s=>ve.camelizeKeys(s)]});i.interceptors.response.use(s=>(Wt.info({req:s.config,res:s},"%s %s: %s %s",s.config.method?.toUpperCase(),s.config.url,s.status,s.statusText),s),async s=>{if(Wt.error({err:s,req:s.config,res:s.response},"%s %s: %s %s - %s",s.config?.method?.toUpperCase(),s.config?.url,s.response?.status,s.response?.statusText,s.message),s.response?.status===401){const l=await a(),c=s.config;return c&&(c.headers||={},c.headers.Authorization=`Bearer ${l}`),vr(c)}return s.response?.data?jo(s.response.data)?Promise.reject(s.response.data.errors.map(l=>U.fromObject(l))):jr(s.response.data)?Promise.reject(s.response.data.map(l=>U.fromObject(l))):Gr(s.response.data)?Promise.reject([U.fromObject(s.response.data)]):Promise.reject([new U(s.response.data)]):Promise.reject([new U(s.message)])}),this.client=i}set token(e){this.client.defaults.headers.common.Authorization=`Bearer ${e}`}get accountSettings(){return new Vt(this.client)}get addresses(){return new Ht(this.client)}get carriers(){return new cn(this.client)}get customPackages(){return new xn(this.client)}get insurance(){return new Cn(this.client)}get labels(){return new Fn(this.client)}get orderSources(){return new Nn(this.client)}get rates(){return new $n(this.client)}get salesOrderShipments(){return new _n(this.client)}get salesOrders(){return new Dn(this.client)}get warehouses(){return new Tn(this.client)}}const rt=$r.createContext(void 0),Go=({baseURL:r,children:e,headers:t,getToken:n})=>{const[a,i]=$r.useState(()=>{const l=n();if(typeof l=="string")return new Nr(l,{baseURL:r,getToken:n,headers:t??{}});l.then(c=>i(new Nr(c,{baseURL:r,getToken:n,headers:t??{}})))}),s=new b.QueryClient;return a?Me.jsx(rt.Provider,{value:{client:a},children:Me.jsx(b.QueryClientProvider,{client:s,children:e})}):Me.jsx("div",{style:{alignItems:"center",display:"flex",height:"100%",justifyContent:"center",width:"100%"},children:"Loading..."})},E=()=>{const r=$r.useContext(rt);if(!r)throw new Error("useShipEngine must be called within a ShipEngineProvider");return r},Ln=r=>new Promise(e=>{setTimeout(()=>e(!0),r)}),A=r=>r.forEach(console.log),kn=[];process.env.NODE_ENV==="production"&&kn.push({stream:new dn});const Wo=pn({name:"shipengine",serializers:{...Vr,req:r=>({headers:r.headers,method:r.method,url:r.url}),res:r=>({data:r.data,headers:r.config.headers,method:r.config.method,statusCode:r.status,url:r.config.url})},streams:kn}),Mn=(r,e=10,t=1e3)=>Promise.resolve().then(r).catch(function n(a){if(e-=1,e>0)return Ln(t).then(r).catch(n);throw a}),Vo=r=>{const{client:e}=E();return b.useMutation({mutationFn:async t=>(await e.carriers.addFunds(r,t)).data,mutationKey:["useAddFunds"],onError:A})},Ho=()=>{const{client:r}=E();return b.useMutation({mutationFn:async({rateOptions:e,shipmentId:t})=>(await r.rates.calculateByShipmentId(t,e)).data,mutationKey:["useCalculateRates"],onError:A})},Ko=()=>{const{client:r}=E();return b.useMutation({mutationFn:async e=>(await r.carriers.connect(e)).data,mutationKey:["useConnectCarrier"],onError:A})},Qo=()=>{const{client:r}=E();return b.useMutation({mutationFn:async({rateId:e,...t})=>(await r.labels.createByRateId(e,t)).data,mutationKey:["useCreateLabel"],onError:A})},Jo=()=>{const{client:r}=E();return b.useMutation({mutationFn:async({salesOrderId:e,...t})=>(await r.salesOrderShipments.create(e,t)).data,mutationKey:["useCreateSalesOrderShipment"],onError:A})},Xo=()=>{const{client:r}=E();return b.useMutation({mutationFn:async e=>(await r.warehouses.create(e)).data,mutationKey:["useCreateWarehouse"],onError:A})},Yo=()=>{const{client:r}=E();return b.useMutation({mutationFn:async({warehouseId:e})=>(await r.warehouses.delete(e)).data,mutationKey:["useDeleteWarehouse"],onError:A})},Zo=()=>{const{client:r}=E();return b.useQuery({onError:A,queryFn:()=>r.accountSettings.get(),queryKey:["getAccountSettings"],select:e=>e.data})},es=r=>{const{client:e}=E();return b.useQuery({enabled:r!==void 0,onError:A,queryFn:()=>r?e.carriers.getAutoFunding(r):Promise.reject(new Error("carrierId is required.")),queryKey:["useGetAutoFundingConfiguration",r],select:t=>t.data})},rs=r=>{const{client:e}=E();return b.useQuery({enabled:!!r,onError:A,queryFn:()=>r?e.carriers.get(r):Promise.reject(new Error("carrierId is require")),queryKey:["useGetCarrierById",r],select:t=>t.data,staleTime:5*60*1e3})},ts=r=>{const{client:e}=E();return b.useQuery({enabled:r!==void 0,onError:A,queryFn:()=>r?e.insurance.get(r):Promise.reject(new Error("insuranceProvider is required")),queryKey:["useGetInsuranceAccount",r],select:t=>t.data})},ns=r=>{const{client:e}=E();return b.useQuery({enabled:r!==void 0,onError:A,queryFn:()=>r?e.labels.get(r):Promise.reject(new Error("labelId is require")),queryKey:["useGetLabel",r],select:t=>t.data})},as=r=>{const{client:e}=E();return b.useQuery({enabled:r!==void 0,onError:A,queryFn:()=>r?e.salesOrders.get(r):Promise.reject(new Error("salesOrderId is required")),queryKey:["useGetSalesOrder",r],select:t=>t.data})},is=r=>{const{client:e}=E();return b.useQuery({enabled:r!==void 0,onError:A,queryFn:()=>r?e.salesOrderShipments.get(r):Promise.reject(new Error("shipmentId is required")),queryKey:["useGetSalesOrderShipment",r],select:t=>t.data})},os=r=>{const{client:e}=E();return b.useQuery({enabled:r!==void 0,onError:A,queryFn:()=>r?e.salesOrderShipments.get(r):Promise.reject(new Error("shipmentId is required")),queryKey:["useGetShipment",r],select:t=>t.data})},ss=()=>({links:{transactionHistoryReport:"http://link.to.entire.dataset.as.csv"},page:1,pages:4,total:275,transactions:[{amount:50.65,balance:10,carrierId:"string",carrierProvider:"string carrier name",labelId:"string",transactionDate:"",transactionId:"string",transactionType:"fund"},{amount:50.65,balance:10,carrierId:"string",carrierProvider:"string carrier name",labelId:"string",transactionDate:"",transactionId:"string",transactionType:"purchase"}]}),us=()=>{const{client:r}=E();return b.useQuery({onError:A,queryFn:()=>r.carriers.list(),queryKey:["useListCarriers"],select:e=>e.data.carriers})},ls=()=>{const{client:r}=E();return b.useQuery({onError:A,queryFn:()=>r.customPackages.list(),queryKey:["useListCustomPackageTypes"],select:e=>e.data.packages})},cs=r=>{const{client:e}=E();return b.useQuery({enabled:r&&Object.values(r).some(t=>t!==void 0),onError:A,queryFn:()=>e.labels.list(r),queryKey:["useListLabels",r],select:t=>t.data.labels})},fs=()=>{const{client:r}=E();return b.useQuery({onError:A,queryFn:()=>r.orderSources.list(),queryKey:["useListOrderSources"],select:e=>e.data.orderSources})},ps=r=>{const{client:e}=E();return b.useQuery({enabled:r&&Object.values(r).some(t=>t!==void 0),onError:A,queryFn:()=>e.salesOrderShipments.list(r),queryKey:["useListSalesOrderShipments",r],select:t=>t.data.shipments})},ds=(r={})=>{const{client:e}=E();return b.useQuery({enabled:r&&Object.values(r).some(t=>t!==void 0),onError:A,queryFn:()=>e.salesOrders.list(r),queryKey:["useListSalesOrders",r],select:t=>t.data.salesOrders})},hs=()=>{const{client:r}=E();return b.useQuery({onError:A,queryFn:()=>r.warehouses.list(),queryKey:["useListWarehouses"],select:e=>e.data.warehouses})},ys=()=>{const{client:r}=E();return b.useMutation({mutationFn:async({salesOrderId:e,...t})=>(await r.salesOrders.notifyShipped(e,t)).data,mutationKey:["useNotifySalesOrder"],onError:A})},vs=()=>{const{client:r}=E();return b.useMutation({mutationFn:async({address:e,text:t})=>(await r.addresses.parse(t,e)).data,mutationKey:["useParseAddress"],onError:A})},Un=()=>{const{client:r}=E();return b.useMutation({mutationFn:async e=>(await r.orderSources.refresh(e)).data,mutationKey:["useRefreshOrderSourceAsync"]})},ms=()=>{const{client:r}=E(),{mutateAsync:e}=Un();return b.useMutation({mutationFn:async t=>(await e(t),await Mn(async()=>{const{data:a}=await r.orderSources.get(t);if(["preparing_update","updating"].includes(a.refreshInfo.status))throw new U("Order source is still refreshing");return a},20)),mutationKey:["useRefreshOrderSource"],onError:A})},gs=()=>b.useMutation({mutationFn:async r=>(await Promise.resolve({data:{defaultLabelLayout:"4x6",dimension:"inch",weight:"ounce"},errors:[],isLoading:!1,isValidating:!1})).data,mutationKey:["useUpdateAccountSettings"],onError:A}),Ss=r=>{const{client:e}=E(),t=b.useQueryClient();return b.useMutation({mutationFn:async n=>(await e.carriers.updateAutoFunding(r,n)).data,mutationKey:["useUpdateAutoFunding"],onError:A,onSuccess:n=>{t.invalidateQueries(["useGetAutoFunding",r],{exact:!0})}})},ws=()=>b.useMutation({mutationFn:async r=>(await Promise.resolve({data:{},errors:[],isLoading:!1,isValidating:!1})).data,mutationKey:["useUpdateBilling"],onError:A}),bs=()=>{const{client:r}=E();return b.useMutation({mutationFn:async({shipmentId:e,...t})=>(await r.salesOrderShipments.update(e,t)).data,mutationKey:["useUpdateSalesOrderShipment"],onError:A})},As=()=>{const{client:r}=E();return b.useMutation({mutationFn:async({warehouseId:e,...t})=>(await r.warehouses.update(e,t)).data,mutationKey:["useUpdateWarehouse"],onError:A})},Es=()=>{const{client:r}=E();return b.useMutation({mutationFn:async e=>(await r.addresses.validate(e)).data,mutationKey:["useValidateAddresses"],onError:A})},Os=()=>{const{client:r}=E();return b.useMutation({mutationFn:async e=>(await r.labels.void(e)).data,mutationKey:["useVoidLabel"],onError:A})};exports.AccountSettingsAPI=Vt;exports.AddressesAPI=Ht;exports.CarriersAPI=cn;exports.CodedError=U;exports.ConfirmationType=Tr;exports.CreditCardVendor=_r;exports.Currency=Dr;exports.CustomPackagesAPI=xn;exports.CustomsContentsType=Lr;exports.CustomsNonDeliveryType=kr;exports.InsuranceAPI=Cn;exports.InsuranceProviderType=Mr;exports.LabelsAPI=Fn;exports.OrderSourcesAPI=Nn;exports.RatesAPI=$n;exports.SE=qn;exports.SalesOrderShipmentsAPI=_n;exports.SalesOrdersAPI=Dn;exports.ShipEngine=Go;exports.ShipEngineAPI=Nr;exports.ShipEngineContext=rt;exports.WarehousesAPI=Tn;exports.delay=Ln;exports.isCodedError=Gr;exports.isCodedErrors=jr;exports.logger=Wo;exports.onError=A;exports.retryUntil=Mn;exports.useAddFunds=Vo;exports.useCalculateRates=Ho;exports.useConnectCarrier=Ko;exports.useCreateLabel=Qo;exports.useCreateSalesOrderShipment=Jo;exports.useCreateWarehouse=Xo;exports.useDeleteWarehouse=Yo;exports.useGetAccountSettings=Zo;exports.useGetAutoFundingConfiguration=es;exports.useGetCarrierById=rs;exports.useGetInsuranceAccount=ts;exports.useGetLabel=ns;exports.useGetSalesOrder=as;exports.useGetSalesOrderShipment=is;exports.useGetShipment=os;exports.useGetWalletTransactionHistory=ss;exports.useListCarriers=us;exports.useListCustomPackageTypes=ls;exports.useListLabels=cs;exports.useListOrderSources=fs;exports.useListSalesOrderShipments=ps;exports.useListSalesOrders=ds;exports.useListWarehouses=hs;exports.useNotifySalesOrderShipped=ys;exports.useParseAddress=vs;exports.useRefreshOrderSource=ms;exports.useRefreshOrderSourceAsync=Un;exports.useShipEngine=E;exports.useUpdateAccountSettings=gs;exports.useUpdateAutoFunding=Ss;exports.useUpdateBilling=ws;exports.useUpdateSalesOrderShipment=bs;exports.useUpdateWarehouse=As;exports.useValidateAddresses=Es;exports.useVoidLabel=Os;
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const reactQuery = require('@tanstack/react-query');
|
|
6
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
const react = require('react');
|
|
8
|
+
const jsApi = require('@shipengine/js-api');
|
|
9
|
+
|
|
10
|
+
const ShipEngineContext = react.createContext(void 0);
|
|
11
|
+
const ShipEngine = ({ baseURL, children, headers, getToken }) => {
|
|
12
|
+
const [client, setClient] = react.useState(() => {
|
|
13
|
+
const token = getToken();
|
|
14
|
+
if (typeof token === "string")
|
|
15
|
+
return new jsApi.ShipEngineAPI(token, {
|
|
16
|
+
baseURL,
|
|
17
|
+
getToken,
|
|
18
|
+
headers: headers != null ? headers : {}
|
|
19
|
+
});
|
|
20
|
+
token.then(
|
|
21
|
+
(t) => setClient(
|
|
22
|
+
new jsApi.ShipEngineAPI(t, {
|
|
23
|
+
baseURL,
|
|
24
|
+
getToken,
|
|
25
|
+
headers: headers != null ? headers : {}
|
|
26
|
+
})
|
|
27
|
+
)
|
|
28
|
+
);
|
|
29
|
+
return void 0;
|
|
30
|
+
});
|
|
31
|
+
const queryClient = new reactQuery.QueryClient();
|
|
32
|
+
if (!client) {
|
|
33
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
style: {
|
|
37
|
+
alignItems: "center",
|
|
38
|
+
display: "flex",
|
|
39
|
+
height: "100%",
|
|
40
|
+
justifyContent: "center",
|
|
41
|
+
width: "100%"
|
|
42
|
+
},
|
|
43
|
+
children: "Loading..."
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ShipEngineContext.Provider, { value: { client }, children: /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children }) });
|
|
48
|
+
};
|
|
49
|
+
const useShipEngine = () => {
|
|
50
|
+
const shipengine = react.useContext(ShipEngineContext);
|
|
51
|
+
if (!shipengine) {
|
|
52
|
+
throw new Error("useShipEngine must be called within a ShipEngineProvider");
|
|
53
|
+
}
|
|
54
|
+
return shipengine;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const delay = (ms) => new Promise((resolve) => {
|
|
58
|
+
setTimeout(() => resolve(true), ms);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const onError = (errors) => errors.forEach(console.log);
|
|
62
|
+
|
|
63
|
+
var o={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},l={};function a(e){return "string"==typeof e?o[e.toLowerCase()]:e}function c(e,r){return c=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e},c(e,r)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return !1;if(Reflect.construct.sham)return !1;if("function"==typeof Proxy)return !0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return !1}}function f(e,r,t){return f=u()?Reflect.construct:function(e,r,t){var s=[null];s.push.apply(s,r);var i=new(Function.bind.apply(e,s));return t&&c(i,t.prototype),i},f.apply(null,arguments)}function h(e){if(null==e)return e;if(Array.isArray(e))return e.slice();if("object"==typeof e){var r={};return Object.keys(e).forEach(function(t){r[t]=e[t];}),r}return e}function v(e){return void 0===e?"undefined":null===e?"null":Array.isArray(e)?"[ "+e.map(function(e){return v(e)}).join(", ")+" ]":"object"==typeof e?JSON.stringify(e):"function"==typeof e?"[Function: "+e.name+"]":"boolean"==typeof e||"number"==typeof e?e:"'"+e.toString()+"'"}function p(e){if("string"!=typeof e){for(var r=new Array(arguments.length),t=0;t<arguments.length;t++)r[t]=v(arguments[t]);return r.join(" ")}for(var s=/%[sdj%]/g,i=1,n=arguments,o=n.length,l=String(e).replace(s,function(e){if("%%"===e)return "%";if(i>=o)return e;switch(e){case"%s":return String(n[i++]);case"%d":return Number(n[i++]);case"%j":try{return JSON.stringify(n[i++])}catch(e){return "[Circular]"}default:return e}}),a=n[i];i<o;a=n[++i])l+=null===a||"object"!=typeof a?" "+a:" "+v(a);return l}function m(e,r){var t=e.split("\n");t[0]&&t[0].indexOf("call-stack-error")>=0&&t.shift();var s=t[r],i=null;if(s){var n=/^\s*(at|.*@)\s*(.+)?$/.exec(s);i=Array.isArray(n)&&n[2]?n[2]:s;}return i}Object.keys(o).forEach(function(e){l[o[e]]=e;});var y={};function d(e,r){if(r){if(y[r])return;y[r]=!0;}console.error(e+"\n");}function g(e){return y[e]}function w(){var e=[];return function(r,t){return t&&"object"==typeof t?-1!==e.indexOf(t)?"[Circular]":(e.push(t),t):t}}var b=/*#__PURE__*/function(){function e(){}return e.prototype.write=function(e){e.level<30?console.log(e):e.level<40?console.info(e):e.level<50?console.warn(e):console.error(e),e.err&&e.err.stack&&console.error(e.err.stack),e.obj&&console.log(e.obj);},e}(),j=/*#__PURE__*/function(){function e(r,t,s){var i,n,o,l,a=this;if(!(this instanceof e))return new e(r,t);if(void 0!==t&&(i=r,r=t,!(i instanceof e)))throw new TypeError("invalid Logger creation: do not pass a second arg");if(!r)throw new TypeError("options (object) is required");if(i){if(r.name)throw new TypeError("invalid options.name: child cannot set logger name")}else if(!r.name)throw new TypeError("options.name (string) is required");if(r.stream&&r.streams)throw new TypeError('cannot mix "streams" and "stream" options');if(r.streams&&!Array.isArray(r.streams))throw new TypeError("invalid options.streams: must be an array");if(r.serializers&&("object"!=typeof r.serializers||Array.isArray(r.serializers)))throw new TypeError("invalid options.serializers: must be an object");if(i&&s){this._level=i._level,this.streams=i.streams,this.serializers=i.serializers,this.src=i.src,n=this.fields={};var c=Object.keys(i.fields);for(l=0;l<c.length;l++)n[o=c[l]]=i.fields[o];var u=Object.keys(r);for(l=0;l<u.length;l++)n[o=u[l]]=r[o];}else {if(i){for(this._level=i._level,this.streams=[],l=0;l<i.streams.length;l++){var f=h(i.streams[l]);this.streams.push(f);}this.serializers=h(i.serializers),this.src=i.src,this.fields=h(i.fields),r.level&&this.level(r.level);}else this._level=Number.POSITIVE_INFINITY,this.streams=[],this.serializers=null,this.src=!1,this.fields={};r.stream?this.addStream({type:"stream",stream:r.stream,level:r.level}):r.streams?r.streams.forEach(function(e){a.addStream(e,r.level);}):i&&r.level?this.level(r.level):i||this.addStream({type:"raw",stream:new b,level:r.level}),r.serializers&&this.addSerializers(r.serializers),r.src&&(this.src=!0),delete(n=h(r)).stream,delete n.level,delete n.streams,delete n.serializers,delete n.src,this.serializers&&this._applySerializers(n),Object.keys(n).forEach(function(e){a.fields[e]=n[e];});}}var r=e.prototype;return r.addStream=function(e,r){void 0===r&&(r=30),(e=h(e)).type="raw",e.level=a(e.level||r),e.level<this._level&&(this._level=e.level),this.streams.push(e),delete this.haveNonRawStreams;},r.addSerializers=function(e){var r=this;this.serializers||(this.serializers={}),Object.keys(e).forEach(function(t){var s=e[t];if("function"!=typeof s)throw new TypeError(p('invalid serializer for "%s" field: must be a function',t));r.serializers[t]=s;});},r.child=function(e,r){return new this.constructor(this,e||{},r)},r.level=function(e){if(void 0===e)return this._level;for(var r=a(e),t=this.streams.length,s=0;s<t;s++)this.streams[s].level=r;this._level=r;},r.levels=function(e,r){if(void 0===e)return this.streams.map(function(e){return e.level});var t;if("number"==typeof e){if(void 0===(t=this.streams[e]))throw new Error("invalid stream index: "+e)}else {for(var s=this.streams.length,i=0;i<s;i++){var n=this.streams[i];if(n.name===e){t=n;break}}if(!t)throw new Error(p('no stream with name "%s"',e))}if(void 0===r)return t.level;var o=a(r);t.level=o,o<this._level&&(this._level=o);},r._applySerializers=function(e,r){var t=this;Object.keys(this.serializers).forEach(function(s){if(!(void 0===e[s]||r&&r[s]))try{e[s]=t.serializers[s](e[s]);}catch(r){d(p('bunyan: ERROR: Exception thrown from the "%s" Bunyan serializer. This should never happen. This is a bugin that serializer function.\n%s',s,r.stack||r)),e[s]=p('(Error in Bunyan log "%s" serializer broke field. See stderr for details.)',s);}});},r._emit=function(e,r){var t,s;if(void 0===this.haveNonRawStreams)for(this.haveNonRawStreams=!1,t=0;t<this.streams.length;t++)if(!this.streams[t].raw){this.haveNonRawStreams=!0;break}if(r||this.haveNonRawStreams)try{s=JSON.stringify(e,w())+"\n";}catch(r){var i=r.stack.split(/\n/g,2).join("\n");d('bunyan: ERROR: Exception in `JSON.stringify(rec)`. You can install the "safe-json-stringify" module to have Bunyan fallback to safer stringification. Record:\n'+function(e,r){return r||(r=" "),r+e.split(/\r?\n/g).join("\n"+r)}(p("%s\n%s",e,r.stack)),i),s=p("(Exception in JSON.stringify(rec): %j. See stderr for details.)\n",r.message);}if(r)return s;var n=e.level;for(t=0;t<this.streams.length;t++){var o=this.streams[t];o.level<=n&&o.stream.write(e);}return s},e}();function z(e){return function(){var r=this;function t(t){var n;t[0]instanceof Error?(s={err:r.serializers&&r.serializers.err?r.serializers.err(t[0]):k.err(t[0])},n={err:!0},i=1===t.length?[s.err.message]:Array.prototype.slice.call(t,1)):"object"!=typeof t[0]&&null!==t[0]||Array.isArray(t[0])?(s=null,i=Array.prototype.slice.call(t)):(s=t[0],i=1===t.length&&s.err&&s.err instanceof Error?[s.err.message]:Array.prototype.slice.call(t,1));var o=h(r.fields);o.level=e;var a=s?h(s):null;if(a&&(r.serializers&&r._applySerializers(a,n),Object.keys(a).forEach(function(e){o[e]=a[e];})),o.levelName=l[e],o.msg=i.length?p.apply(r,i):"",o.time||(o.time=new Date),r.src&&!o.src)try{throw new Error("call-stack-error")}catch(e){var c=e.stack?m(e.stack,2):"";c||g("src")||d("Unable to determine src line info","src"),o.src=c||"";}return o.v=1,o}var s=null,i=arguments,n=null;if(0===arguments.length)return this._level<=e;this._level>e||(n=t(i),this._emit(n));}}function S(e){var r=e.stack||e.toString();if(e.cause&&"function"==typeof e.cause){var t=e.cause();t&&(r+="\nCaused by: "+S(t));}return r}j.prototype.trace=z(10),j.prototype.debug=z(20),j.prototype.info=z(30),j.prototype.warn=z(40),j.prototype.error=z(50),j.prototype.fatal=z(60);var k={err:function(e){return e&&e.stack?{message:e.message,name:e.name,stack:S(e),code:e.code,signal:e.signal}:e}};function E(){return f(j,[].slice.call(arguments))}var A={levels:{trace:"color: DeepPink",debug:"color: GoldenRod",info:"color: DarkTurquoise",warn:"color: Purple",error:"color: Crimson",fatal:"color: Black"},def:"color: DimGray",msg:"color: SteelBlue",src:"color: DimGray; font-style: italic; font-size: 0.9em"},R=/*#__PURE__*/function(){function e(e){var r=void 0===e?{}:e,t=r.logByLevel,s=r.css,i=void 0===s?A:s;this.logByLevel=void 0!==t&&t,this.css=i;}return e.prototype.write=function(e){var r,t,s=this.css.def,i=this.css.msg,n=this.css.src,o=e.childName?e.name+"/"+e.childName:e.name,a=l[e.level],c=(Array(6-a.length).join(" ")+a).toUpperCase();this.logByLevel?(10===e.level?a="debug":60===e.level&&(a="error"),t="function"==typeof console[a]?console[a]:console.log):t=console.log,r=e.level<20?this.css.levels.trace:e.level<30?this.css.levels.debug:e.level<40?this.css.levels.info:e.level<50?this.css.levels.warn:e.level<60?this.css.levels.error:this.css.levels.fatal;var u=function(e,r){return Array(r+1-(e+"").length).join("0")+e},f=[];f.push("[%s:%s:%s:%s] %c%s%c: %s: %c%s "+(e.src?"%c%s":"")),f.push(u(e.time.getHours(),2)),f.push(u(e.time.getMinutes(),2)),f.push(u(e.time.getSeconds(),2)),f.push(u(e.time.getMilliseconds(),4)),f.push(r),f.push(c),f.push(s),f.push(o),f.push(i),f.push(e.msg),e.src&&(f.push(n),f.push(e.src)),e.obj&&(f.push("\n"),f.push(e.obj)),e.err&&e.err.stack&&(f.push("\n"),f.push(e.err.stack)),t.apply(console,f);},e.getDefaultCss=function(){return A},e}();
|
|
64
|
+
|
|
65
|
+
var __defProp$1 = Object.defineProperty;
|
|
66
|
+
var __defProps$1 = Object.defineProperties;
|
|
67
|
+
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
68
|
+
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
69
|
+
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
70
|
+
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
71
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
72
|
+
var __spreadValues$1 = (a, b) => {
|
|
73
|
+
for (var prop in b || (b = {}))
|
|
74
|
+
if (__hasOwnProp$7.call(b, prop))
|
|
75
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
76
|
+
if (__getOwnPropSymbols$7)
|
|
77
|
+
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
78
|
+
if (__propIsEnum$7.call(b, prop))
|
|
79
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
80
|
+
}
|
|
81
|
+
return a;
|
|
82
|
+
};
|
|
83
|
+
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
84
|
+
const streams = [];
|
|
85
|
+
if (process.env.NODE_ENV === "production") {
|
|
86
|
+
streams.push({
|
|
87
|
+
stream: new R()
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
const logger = E({
|
|
91
|
+
name: "shipengine",
|
|
92
|
+
serializers: __spreadProps$1(__spreadValues$1({}, k), {
|
|
93
|
+
req: (req) => ({
|
|
94
|
+
headers: req.headers,
|
|
95
|
+
method: req.method,
|
|
96
|
+
url: req.url
|
|
97
|
+
}),
|
|
98
|
+
res: (res) => ({
|
|
99
|
+
data: res.data,
|
|
100
|
+
headers: res.config.headers,
|
|
101
|
+
method: res.config.method,
|
|
102
|
+
statusCode: res.status,
|
|
103
|
+
url: res.config.url
|
|
104
|
+
})
|
|
105
|
+
}),
|
|
106
|
+
streams
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const retryUntil = (callbackFn, retries = 10, timeoutBetweenAttempts = 1e3) => Promise.resolve().then(callbackFn).catch(function retry(error) {
|
|
110
|
+
retries -= 1;
|
|
111
|
+
if (retries > 0) {
|
|
112
|
+
return delay(timeoutBetweenAttempts).then(callbackFn).catch(retry);
|
|
113
|
+
}
|
|
114
|
+
throw error;
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const useGetAccountSettings = () => {
|
|
118
|
+
const { client } = useShipEngine();
|
|
119
|
+
return reactQuery.useQuery({
|
|
120
|
+
onError,
|
|
121
|
+
queryFn: () => client.accountSettings.get(),
|
|
122
|
+
queryKey: ["getAccountSettings"],
|
|
123
|
+
select: (result) => result.data
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
var __async$p = (__this, __arguments, generator) => {
|
|
128
|
+
return new Promise((resolve, reject) => {
|
|
129
|
+
var fulfilled = (value) => {
|
|
130
|
+
try {
|
|
131
|
+
step(generator.next(value));
|
|
132
|
+
} catch (e) {
|
|
133
|
+
reject(e);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
var rejected = (value) => {
|
|
137
|
+
try {
|
|
138
|
+
step(generator.throw(value));
|
|
139
|
+
} catch (e) {
|
|
140
|
+
reject(e);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
144
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
const useUpdateAccountSettings = () => {
|
|
148
|
+
const { client } = useShipEngine();
|
|
149
|
+
return reactQuery.useMutation({
|
|
150
|
+
mutationFn: (settings) => __async$p(void 0, null, function* () {
|
|
151
|
+
const result = yield client.accountSettings.update(settings);
|
|
152
|
+
return result.data;
|
|
153
|
+
}),
|
|
154
|
+
mutationKey: ["useUpdateAccountSettings"],
|
|
155
|
+
onError
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
var __async$o = (__this, __arguments, generator) => {
|
|
160
|
+
return new Promise((resolve, reject) => {
|
|
161
|
+
var fulfilled = (value) => {
|
|
162
|
+
try {
|
|
163
|
+
step(generator.next(value));
|
|
164
|
+
} catch (e) {
|
|
165
|
+
reject(e);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
var rejected = (value) => {
|
|
169
|
+
try {
|
|
170
|
+
step(generator.throw(value));
|
|
171
|
+
} catch (e) {
|
|
172
|
+
reject(e);
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
176
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
const useParseAddress = () => {
|
|
180
|
+
const { client } = useShipEngine();
|
|
181
|
+
return reactQuery.useMutation({
|
|
182
|
+
mutationFn: (_0) => __async$o(void 0, [_0], function* ({ address, text }) {
|
|
183
|
+
const result = yield client.addresses.parse(text, address);
|
|
184
|
+
return result.data;
|
|
185
|
+
}),
|
|
186
|
+
mutationKey: ["useParseAddress"],
|
|
187
|
+
onError
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
var __async$n = (__this, __arguments, generator) => {
|
|
192
|
+
return new Promise((resolve, reject) => {
|
|
193
|
+
var fulfilled = (value) => {
|
|
194
|
+
try {
|
|
195
|
+
step(generator.next(value));
|
|
196
|
+
} catch (e) {
|
|
197
|
+
reject(e);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
var rejected = (value) => {
|
|
201
|
+
try {
|
|
202
|
+
step(generator.throw(value));
|
|
203
|
+
} catch (e) {
|
|
204
|
+
reject(e);
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
208
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
const useValidateAddresses = () => {
|
|
212
|
+
const { client } = useShipEngine();
|
|
213
|
+
return reactQuery.useMutation({
|
|
214
|
+
mutationFn: (addresses) => __async$n(void 0, null, function* () {
|
|
215
|
+
const result = yield client.addresses.validate(addresses);
|
|
216
|
+
return result.data;
|
|
217
|
+
}),
|
|
218
|
+
mutationKey: ["useValidateAddresses"],
|
|
219
|
+
onError
|
|
220
|
+
});
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
var __async$m = (__this, __arguments, generator) => {
|
|
224
|
+
return new Promise((resolve, reject) => {
|
|
225
|
+
var fulfilled = (value) => {
|
|
226
|
+
try {
|
|
227
|
+
step(generator.next(value));
|
|
228
|
+
} catch (e) {
|
|
229
|
+
reject(e);
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
var rejected = (value) => {
|
|
233
|
+
try {
|
|
234
|
+
step(generator.throw(value));
|
|
235
|
+
} catch (e) {
|
|
236
|
+
reject(e);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
240
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
241
|
+
});
|
|
242
|
+
};
|
|
243
|
+
const useAddFunds = (carrierId) => {
|
|
244
|
+
const { client } = useShipEngine();
|
|
245
|
+
return reactQuery.useMutation({
|
|
246
|
+
mutationFn: (funds) => __async$m(void 0, null, function* () {
|
|
247
|
+
const result = yield client.carriers.addFunds(carrierId, funds);
|
|
248
|
+
return result.data;
|
|
249
|
+
}),
|
|
250
|
+
mutationKey: ["useAddFunds"],
|
|
251
|
+
onError
|
|
252
|
+
});
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
var __async$l = (__this, __arguments, generator) => {
|
|
256
|
+
return new Promise((resolve, reject) => {
|
|
257
|
+
var fulfilled = (value) => {
|
|
258
|
+
try {
|
|
259
|
+
step(generator.next(value));
|
|
260
|
+
} catch (e) {
|
|
261
|
+
reject(e);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
var rejected = (value) => {
|
|
265
|
+
try {
|
|
266
|
+
step(generator.throw(value));
|
|
267
|
+
} catch (e) {
|
|
268
|
+
reject(e);
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
272
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
273
|
+
});
|
|
274
|
+
};
|
|
275
|
+
const useConnectCarrier = () => {
|
|
276
|
+
const { client } = useShipEngine();
|
|
277
|
+
return reactQuery.useMutation({
|
|
278
|
+
mutationFn: (params) => __async$l(void 0, null, function* () {
|
|
279
|
+
const result = yield client.carriers.connect(params);
|
|
280
|
+
return result.data;
|
|
281
|
+
}),
|
|
282
|
+
mutationKey: ["useConnectCarrier"],
|
|
283
|
+
onError
|
|
284
|
+
});
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
const useGetAutoFundingConfiguration = (carrierId) => {
|
|
288
|
+
const { client } = useShipEngine();
|
|
289
|
+
return reactQuery.useQuery({
|
|
290
|
+
enabled: carrierId !== void 0,
|
|
291
|
+
onError,
|
|
292
|
+
queryFn: () => {
|
|
293
|
+
if (carrierId)
|
|
294
|
+
return client.carriers.getAutoFunding(carrierId);
|
|
295
|
+
return Promise.reject(new Error("carrierId is required."));
|
|
296
|
+
},
|
|
297
|
+
queryKey: ["useGetAutoFundingConfiguration", carrierId],
|
|
298
|
+
select: (result) => result.data
|
|
299
|
+
});
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
const useGetCarrierById = (carrierId) => {
|
|
303
|
+
const { client } = useShipEngine();
|
|
304
|
+
return reactQuery.useQuery({
|
|
305
|
+
enabled: !!carrierId,
|
|
306
|
+
onError,
|
|
307
|
+
queryFn: () => {
|
|
308
|
+
if (carrierId)
|
|
309
|
+
return client.carriers.get(carrierId);
|
|
310
|
+
return Promise.reject(new Error("carrierId is require"));
|
|
311
|
+
},
|
|
312
|
+
queryKey: ["useGetCarrierById", carrierId],
|
|
313
|
+
select: (result) => result.data,
|
|
314
|
+
// Fresh for 5 minutes
|
|
315
|
+
staleTime: 5 * 60 * 1e3
|
|
316
|
+
});
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
const useGetCountriesByCarrier = (carrierId) => {
|
|
320
|
+
const { client } = useShipEngine();
|
|
321
|
+
return reactQuery.useQuery({
|
|
322
|
+
enabled: !!carrierId,
|
|
323
|
+
onError,
|
|
324
|
+
queryFn: () => {
|
|
325
|
+
if (carrierId)
|
|
326
|
+
return client.carriers.getCountries(carrierId);
|
|
327
|
+
return Promise.reject(new Error("carrierId is require"));
|
|
328
|
+
},
|
|
329
|
+
queryKey: ["useGetCountriesByCarrier", carrierId],
|
|
330
|
+
select: (result) => result.data.countries,
|
|
331
|
+
// Fresh for 5 minutes
|
|
332
|
+
staleTime: 5 * 60 * 1e3
|
|
333
|
+
});
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
const useGetCurrenciesByCarrier = (carrierId) => {
|
|
337
|
+
const { client } = useShipEngine();
|
|
338
|
+
return reactQuery.useQuery({
|
|
339
|
+
enabled: !!carrierId,
|
|
340
|
+
onError,
|
|
341
|
+
queryFn: () => {
|
|
342
|
+
if (carrierId)
|
|
343
|
+
return client.carriers.getCurrencies(carrierId);
|
|
344
|
+
return Promise.reject(new Error("carrierId is require"));
|
|
345
|
+
},
|
|
346
|
+
queryKey: ["useGetCurrenciesByCarrier", carrierId],
|
|
347
|
+
select: (result) => result.data.currencies,
|
|
348
|
+
// Fresh for 5 minutes
|
|
349
|
+
staleTime: 5 * 60 * 1e3
|
|
350
|
+
});
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
const useGetPackageRatingGroupByCarrier = (carrierId) => {
|
|
354
|
+
const { client } = useShipEngine();
|
|
355
|
+
return reactQuery.useQuery({
|
|
356
|
+
enabled: !!carrierId,
|
|
357
|
+
onError,
|
|
358
|
+
queryFn: () => {
|
|
359
|
+
if (carrierId)
|
|
360
|
+
return client.carriers.getPackageRatingGroup(carrierId);
|
|
361
|
+
return Promise.reject(new Error("carrierId is required"));
|
|
362
|
+
},
|
|
363
|
+
queryKey: ["useGetRatePackageFormatsByCarrier", carrierId],
|
|
364
|
+
select: (result) => result.data.packageRatingGroup,
|
|
365
|
+
// Fresh for 5 minutes
|
|
366
|
+
staleTime: 5 * 60 * 1e3
|
|
367
|
+
});
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
const useGetServicesByCarrier = (carrierId) => {
|
|
371
|
+
const { client } = useShipEngine();
|
|
372
|
+
return reactQuery.useQuery({
|
|
373
|
+
enabled: !!carrierId,
|
|
374
|
+
onError,
|
|
375
|
+
queryFn: () => {
|
|
376
|
+
if (carrierId)
|
|
377
|
+
return client.carriers.getServices(carrierId);
|
|
378
|
+
return Promise.reject(new Error("carrierId is required"));
|
|
379
|
+
},
|
|
380
|
+
queryKey: ["useGetServicesByCarrier", carrierId],
|
|
381
|
+
select: (result) => result.data.services,
|
|
382
|
+
// Fresh for 5 minutes
|
|
383
|
+
staleTime: 5 * 60 * 1e3
|
|
384
|
+
});
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
const useGetWalletHistory = ({
|
|
388
|
+
enabled,
|
|
389
|
+
page,
|
|
390
|
+
range
|
|
391
|
+
}) => {
|
|
392
|
+
const { client } = useShipEngine();
|
|
393
|
+
const [startDate, endDate] = range;
|
|
394
|
+
return reactQuery.useQuery({
|
|
395
|
+
enabled,
|
|
396
|
+
keepPreviousData: true,
|
|
397
|
+
// See https://react-query-v3.tanstack.com/guides/paginated-queries#better-paginated-queries-with-keeppreviousdata
|
|
398
|
+
onError,
|
|
399
|
+
queryFn: () => client.carriers.getWalletHistory(startDate, endDate, page),
|
|
400
|
+
queryKey: ["useGetWalletHistory", startDate, endDate, page],
|
|
401
|
+
select: (result) => result.data
|
|
402
|
+
});
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
const useListCarriers = () => {
|
|
406
|
+
const { client } = useShipEngine();
|
|
407
|
+
return reactQuery.useQuery({
|
|
408
|
+
onError,
|
|
409
|
+
queryFn: () => client.carriers.list(),
|
|
410
|
+
queryKey: ["useListCarriers"],
|
|
411
|
+
select: (result) => result.data.carriers
|
|
412
|
+
});
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
var __async$k = (__this, __arguments, generator) => {
|
|
416
|
+
return new Promise((resolve, reject) => {
|
|
417
|
+
var fulfilled = (value) => {
|
|
418
|
+
try {
|
|
419
|
+
step(generator.next(value));
|
|
420
|
+
} catch (e) {
|
|
421
|
+
reject(e);
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
var rejected = (value) => {
|
|
425
|
+
try {
|
|
426
|
+
step(generator.throw(value));
|
|
427
|
+
} catch (e) {
|
|
428
|
+
reject(e);
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
432
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
433
|
+
});
|
|
434
|
+
};
|
|
435
|
+
const useUpdateAutoFunding = (carrierId) => {
|
|
436
|
+
const { client } = useShipEngine();
|
|
437
|
+
const queryClient = reactQuery.useQueryClient();
|
|
438
|
+
return reactQuery.useMutation({
|
|
439
|
+
mutationFn: (options) => __async$k(void 0, null, function* () {
|
|
440
|
+
const result = yield client.carriers.updateAutoFunding(carrierId, options);
|
|
441
|
+
return result.data;
|
|
442
|
+
}),
|
|
443
|
+
mutationKey: ["useUpdateAutoFunding"],
|
|
444
|
+
onError,
|
|
445
|
+
onSuccess: (_) => {
|
|
446
|
+
queryClient.invalidateQueries(["useGetAutoFunding", carrierId], { exact: true });
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
const useGetZonesByCarrier = (carrierId) => {
|
|
452
|
+
const { client } = useShipEngine();
|
|
453
|
+
return reactQuery.useQuery({
|
|
454
|
+
enabled: !!carrierId,
|
|
455
|
+
onError,
|
|
456
|
+
queryFn: () => {
|
|
457
|
+
if (carrierId)
|
|
458
|
+
return client.carriers.getZones(carrierId);
|
|
459
|
+
return Promise.reject(new Error("carrierId is required"));
|
|
460
|
+
},
|
|
461
|
+
queryKey: ["useGetZonesByCarrier", carrierId],
|
|
462
|
+
select: (result) => result.data.zones,
|
|
463
|
+
// Fresh for 5 minutes
|
|
464
|
+
staleTime: 5 * 60 * 1e3
|
|
465
|
+
});
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
const useListCustomPackageTypes = () => {
|
|
469
|
+
const { client } = useShipEngine();
|
|
470
|
+
return reactQuery.useQuery({
|
|
471
|
+
onError,
|
|
472
|
+
queryFn: () => client.customPackages.list(),
|
|
473
|
+
queryKey: ["useListCustomPackageTypes"],
|
|
474
|
+
select: (result) => result.data.packages
|
|
475
|
+
});
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
var __async$j = (__this, __arguments, generator) => {
|
|
479
|
+
return new Promise((resolve, reject) => {
|
|
480
|
+
var fulfilled = (value) => {
|
|
481
|
+
try {
|
|
482
|
+
step(generator.next(value));
|
|
483
|
+
} catch (e) {
|
|
484
|
+
reject(e);
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
var rejected = (value) => {
|
|
488
|
+
try {
|
|
489
|
+
step(generator.throw(value));
|
|
490
|
+
} catch (e) {
|
|
491
|
+
reject(e);
|
|
492
|
+
}
|
|
493
|
+
};
|
|
494
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
495
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
496
|
+
});
|
|
497
|
+
};
|
|
498
|
+
const useCreateFundingSource = () => {
|
|
499
|
+
const { client } = useShipEngine();
|
|
500
|
+
return reactQuery.useMutation({
|
|
501
|
+
mutationFn: (fundingSource) => __async$j(void 0, null, function* () {
|
|
502
|
+
const result = yield client.fundingSources.create(fundingSource);
|
|
503
|
+
return result.data;
|
|
504
|
+
}),
|
|
505
|
+
mutationKey: ["useCreateFundingSource"],
|
|
506
|
+
onError
|
|
507
|
+
});
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
var __async$i = (__this, __arguments, generator) => {
|
|
511
|
+
return new Promise((resolve, reject) => {
|
|
512
|
+
var fulfilled = (value) => {
|
|
513
|
+
try {
|
|
514
|
+
step(generator.next(value));
|
|
515
|
+
} catch (e) {
|
|
516
|
+
reject(e);
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
var rejected = (value) => {
|
|
520
|
+
try {
|
|
521
|
+
step(generator.throw(value));
|
|
522
|
+
} catch (e) {
|
|
523
|
+
reject(e);
|
|
524
|
+
}
|
|
525
|
+
};
|
|
526
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
527
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
528
|
+
});
|
|
529
|
+
};
|
|
530
|
+
const useFundingSourcesAddFunds = (fundingSourceId) => {
|
|
531
|
+
const { client } = useShipEngine();
|
|
532
|
+
return reactQuery.useMutation({
|
|
533
|
+
mutationFn: (funds) => __async$i(void 0, null, function* () {
|
|
534
|
+
const result = yield client.fundingSources.addFunds(funds, fundingSourceId);
|
|
535
|
+
return result.data;
|
|
536
|
+
}),
|
|
537
|
+
mutationKey: ["useFundingSourcesAddFunds"],
|
|
538
|
+
onError
|
|
539
|
+
});
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
const useGetFundingSourceById = (fundingSourceId) => {
|
|
543
|
+
const { client } = useShipEngine();
|
|
544
|
+
return reactQuery.useQuery({
|
|
545
|
+
onError,
|
|
546
|
+
queryFn: () => client.fundingSources.get(fundingSourceId),
|
|
547
|
+
queryKey: ["getFundingSourceById"],
|
|
548
|
+
select: (result) => result.data
|
|
549
|
+
});
|
|
550
|
+
};
|
|
551
|
+
|
|
552
|
+
const useListFundingSources = () => {
|
|
553
|
+
const { client } = useShipEngine();
|
|
554
|
+
return reactQuery.useQuery({
|
|
555
|
+
onError,
|
|
556
|
+
queryFn: () => client.fundingSources.list(),
|
|
557
|
+
queryKey: ["useListFundingSources"],
|
|
558
|
+
select: (result) => result.data.fundingSources
|
|
559
|
+
});
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
var __async$h = (__this, __arguments, generator) => {
|
|
563
|
+
return new Promise((resolve, reject) => {
|
|
564
|
+
var fulfilled = (value) => {
|
|
565
|
+
try {
|
|
566
|
+
step(generator.next(value));
|
|
567
|
+
} catch (e) {
|
|
568
|
+
reject(e);
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
var rejected = (value) => {
|
|
572
|
+
try {
|
|
573
|
+
step(generator.throw(value));
|
|
574
|
+
} catch (e) {
|
|
575
|
+
reject(e);
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
579
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
580
|
+
});
|
|
581
|
+
};
|
|
582
|
+
const useRegisterCarrier = () => {
|
|
583
|
+
const { client } = useShipEngine();
|
|
584
|
+
return reactQuery.useMutation({
|
|
585
|
+
mutationFn: (carrier) => __async$h(void 0, null, function* () {
|
|
586
|
+
const result = yield client.fundingSources.registerCarrier(carrier);
|
|
587
|
+
return result.data;
|
|
588
|
+
}),
|
|
589
|
+
mutationKey: ["useRegisterCarrier"],
|
|
590
|
+
onError
|
|
591
|
+
});
|
|
592
|
+
};
|
|
593
|
+
|
|
594
|
+
var __async$g = (__this, __arguments, generator) => {
|
|
595
|
+
return new Promise((resolve, reject) => {
|
|
596
|
+
var fulfilled = (value) => {
|
|
597
|
+
try {
|
|
598
|
+
step(generator.next(value));
|
|
599
|
+
} catch (e) {
|
|
600
|
+
reject(e);
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
var rejected = (value) => {
|
|
604
|
+
try {
|
|
605
|
+
step(generator.throw(value));
|
|
606
|
+
} catch (e) {
|
|
607
|
+
reject(e);
|
|
608
|
+
}
|
|
609
|
+
};
|
|
610
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
611
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
612
|
+
});
|
|
613
|
+
};
|
|
614
|
+
const useUpdateFundingSource = () => {
|
|
615
|
+
const { client } = useShipEngine();
|
|
616
|
+
return reactQuery.useMutation({
|
|
617
|
+
mutationFn: (_0) => __async$g(void 0, [_0], function* ({
|
|
618
|
+
billingInfo,
|
|
619
|
+
creditCardInfo,
|
|
620
|
+
fundingSourceId
|
|
621
|
+
}) {
|
|
622
|
+
const result = yield client.fundingSources.update(
|
|
623
|
+
billingInfo,
|
|
624
|
+
creditCardInfo,
|
|
625
|
+
fundingSourceId
|
|
626
|
+
);
|
|
627
|
+
return result.data;
|
|
628
|
+
}),
|
|
629
|
+
mutationKey: ["useUpdateFundingSource"],
|
|
630
|
+
onError
|
|
631
|
+
});
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
const useGetInsuranceAccount = (insuranceProvider) => {
|
|
635
|
+
const { client } = useShipEngine();
|
|
636
|
+
return reactQuery.useQuery({
|
|
637
|
+
enabled: insuranceProvider !== void 0,
|
|
638
|
+
onError,
|
|
639
|
+
queryFn: () => {
|
|
640
|
+
if (insuranceProvider)
|
|
641
|
+
return client.insurance.get(insuranceProvider);
|
|
642
|
+
return Promise.reject(new Error("insuranceProvider is required"));
|
|
643
|
+
},
|
|
644
|
+
queryKey: ["useGetInsuranceAccount", insuranceProvider],
|
|
645
|
+
select: (result) => result.data
|
|
646
|
+
});
|
|
647
|
+
};
|
|
648
|
+
|
|
649
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
650
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
651
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
652
|
+
var __objRest$5 = (source, exclude) => {
|
|
653
|
+
var target = {};
|
|
654
|
+
for (var prop in source)
|
|
655
|
+
if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
656
|
+
target[prop] = source[prop];
|
|
657
|
+
if (source != null && __getOwnPropSymbols$6)
|
|
658
|
+
for (var prop of __getOwnPropSymbols$6(source)) {
|
|
659
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
|
|
660
|
+
target[prop] = source[prop];
|
|
661
|
+
}
|
|
662
|
+
return target;
|
|
663
|
+
};
|
|
664
|
+
var __async$f = (__this, __arguments, generator) => {
|
|
665
|
+
return new Promise((resolve, reject) => {
|
|
666
|
+
var fulfilled = (value) => {
|
|
667
|
+
try {
|
|
668
|
+
step(generator.next(value));
|
|
669
|
+
} catch (e) {
|
|
670
|
+
reject(e);
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
var rejected = (value) => {
|
|
674
|
+
try {
|
|
675
|
+
step(generator.throw(value));
|
|
676
|
+
} catch (e) {
|
|
677
|
+
reject(e);
|
|
678
|
+
}
|
|
679
|
+
};
|
|
680
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
681
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
682
|
+
});
|
|
683
|
+
};
|
|
684
|
+
const useCreateLabel = () => {
|
|
685
|
+
const { client } = useShipEngine();
|
|
686
|
+
return reactQuery.useMutation({
|
|
687
|
+
mutationFn: (_a) => __async$f(void 0, null, function* () {
|
|
688
|
+
var _b = _a, { rateId } = _b, options = __objRest$5(_b, ["rateId"]);
|
|
689
|
+
const result = yield client.labels.createByRateId(rateId, options);
|
|
690
|
+
return result.data;
|
|
691
|
+
}),
|
|
692
|
+
mutationKey: ["useCreateLabel"],
|
|
693
|
+
onError
|
|
694
|
+
});
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
const useGetLabel = (labelId) => {
|
|
698
|
+
const { client } = useShipEngine();
|
|
699
|
+
return reactQuery.useQuery({
|
|
700
|
+
enabled: labelId !== void 0,
|
|
701
|
+
onError,
|
|
702
|
+
queryFn: () => {
|
|
703
|
+
if (labelId)
|
|
704
|
+
return client.labels.get(labelId);
|
|
705
|
+
return Promise.reject(new Error("labelId is require"));
|
|
706
|
+
},
|
|
707
|
+
queryKey: ["useGetLabel", labelId],
|
|
708
|
+
select: (result) => result.data
|
|
709
|
+
});
|
|
710
|
+
};
|
|
711
|
+
|
|
712
|
+
const useListLabels = (params) => {
|
|
713
|
+
const { client } = useShipEngine();
|
|
714
|
+
return reactQuery.useQuery({
|
|
715
|
+
enabled: params && Object.values(params).some((v) => v !== void 0),
|
|
716
|
+
onError,
|
|
717
|
+
queryFn: () => client.labels.list(params),
|
|
718
|
+
queryKey: ["useListLabels", params],
|
|
719
|
+
select: (result) => result.data.labels
|
|
720
|
+
});
|
|
721
|
+
};
|
|
722
|
+
|
|
723
|
+
var __async$e = (__this, __arguments, generator) => {
|
|
724
|
+
return new Promise((resolve, reject) => {
|
|
725
|
+
var fulfilled = (value) => {
|
|
726
|
+
try {
|
|
727
|
+
step(generator.next(value));
|
|
728
|
+
} catch (e) {
|
|
729
|
+
reject(e);
|
|
730
|
+
}
|
|
731
|
+
};
|
|
732
|
+
var rejected = (value) => {
|
|
733
|
+
try {
|
|
734
|
+
step(generator.throw(value));
|
|
735
|
+
} catch (e) {
|
|
736
|
+
reject(e);
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
740
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
741
|
+
});
|
|
742
|
+
};
|
|
743
|
+
const useVoidLabel = () => {
|
|
744
|
+
const { client } = useShipEngine();
|
|
745
|
+
return reactQuery.useMutation({
|
|
746
|
+
mutationFn: (labelId) => __async$e(void 0, null, function* () {
|
|
747
|
+
const result = yield client.labels.void(labelId);
|
|
748
|
+
return result.data;
|
|
749
|
+
}),
|
|
750
|
+
mutationKey: ["useVoidLabel"],
|
|
751
|
+
onError
|
|
752
|
+
});
|
|
753
|
+
};
|
|
754
|
+
|
|
755
|
+
const useListOrderSources = () => {
|
|
756
|
+
const { client } = useShipEngine();
|
|
757
|
+
return reactQuery.useQuery({
|
|
758
|
+
onError,
|
|
759
|
+
queryFn: () => client.orderSources.list(),
|
|
760
|
+
queryKey: ["useListOrderSources"],
|
|
761
|
+
select: (result) => result.data.orderSources
|
|
762
|
+
});
|
|
763
|
+
};
|
|
764
|
+
|
|
765
|
+
var __async$d = (__this, __arguments, generator) => {
|
|
766
|
+
return new Promise((resolve, reject) => {
|
|
767
|
+
var fulfilled = (value) => {
|
|
768
|
+
try {
|
|
769
|
+
step(generator.next(value));
|
|
770
|
+
} catch (e) {
|
|
771
|
+
reject(e);
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
var rejected = (value) => {
|
|
775
|
+
try {
|
|
776
|
+
step(generator.throw(value));
|
|
777
|
+
} catch (e) {
|
|
778
|
+
reject(e);
|
|
779
|
+
}
|
|
780
|
+
};
|
|
781
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
782
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
783
|
+
});
|
|
784
|
+
};
|
|
785
|
+
const useRefreshOrderSourceAsync = () => {
|
|
786
|
+
const { client } = useShipEngine();
|
|
787
|
+
return reactQuery.useMutation({
|
|
788
|
+
mutationFn: (orderSourceId) => __async$d(void 0, null, function* () {
|
|
789
|
+
const result = yield client.orderSources.refresh(orderSourceId);
|
|
790
|
+
return result.data;
|
|
791
|
+
}),
|
|
792
|
+
mutationKey: ["useRefreshOrderSourceAsync"]
|
|
793
|
+
});
|
|
794
|
+
};
|
|
795
|
+
const useRefreshOrderSource = () => {
|
|
796
|
+
const { client } = useShipEngine();
|
|
797
|
+
const { mutateAsync: refreshOrderSourceAsync } = useRefreshOrderSourceAsync();
|
|
798
|
+
return reactQuery.useMutation({
|
|
799
|
+
mutationFn: (orderSourceId) => __async$d(void 0, null, function* () {
|
|
800
|
+
yield refreshOrderSourceAsync(orderSourceId);
|
|
801
|
+
const waitResult = yield retryUntil(() => __async$d(void 0, null, function* () {
|
|
802
|
+
const { data: checkResult } = yield client.orderSources.get(orderSourceId);
|
|
803
|
+
if (["preparing_update", "updating"].includes(checkResult.refreshInfo.status)) {
|
|
804
|
+
throw new jsApi.SE.CodedError("Order source is still refreshing");
|
|
805
|
+
}
|
|
806
|
+
return checkResult;
|
|
807
|
+
}), 20);
|
|
808
|
+
return waitResult;
|
|
809
|
+
}),
|
|
810
|
+
mutationKey: ["useRefreshOrderSource"],
|
|
811
|
+
onError
|
|
812
|
+
});
|
|
813
|
+
};
|
|
814
|
+
|
|
815
|
+
var __async$c = (__this, __arguments, generator) => {
|
|
816
|
+
return new Promise((resolve, reject) => {
|
|
817
|
+
var fulfilled = (value) => {
|
|
818
|
+
try {
|
|
819
|
+
step(generator.next(value));
|
|
820
|
+
} catch (e) {
|
|
821
|
+
reject(e);
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
var rejected = (value) => {
|
|
825
|
+
try {
|
|
826
|
+
step(generator.throw(value));
|
|
827
|
+
} catch (e) {
|
|
828
|
+
reject(e);
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
832
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
833
|
+
});
|
|
834
|
+
};
|
|
835
|
+
const useCreateRateCard = () => {
|
|
836
|
+
const { client } = useShipEngine();
|
|
837
|
+
return reactQuery.useMutation({
|
|
838
|
+
mutationFn: (rateCard) => __async$c(void 0, null, function* () {
|
|
839
|
+
const result = yield client.rateCards.create(rateCard);
|
|
840
|
+
return result.data;
|
|
841
|
+
}),
|
|
842
|
+
mutationKey: ["useCreateRateCard"],
|
|
843
|
+
onError
|
|
844
|
+
});
|
|
845
|
+
};
|
|
846
|
+
|
|
847
|
+
const useDownloadRateCard = (rateCardId) => {
|
|
848
|
+
const { client } = useShipEngine();
|
|
849
|
+
return reactQuery.useQuery({
|
|
850
|
+
enabled: !!rateCardId.length,
|
|
851
|
+
onError,
|
|
852
|
+
queryFn: () => {
|
|
853
|
+
return client.rateCards.download(rateCardId);
|
|
854
|
+
},
|
|
855
|
+
queryKey: ["useDownloadRateCard", rateCardId]
|
|
856
|
+
});
|
|
857
|
+
};
|
|
858
|
+
|
|
859
|
+
const useGetRateCardById = (rateCardId) => {
|
|
860
|
+
const { client } = useShipEngine();
|
|
861
|
+
return reactQuery.useQuery({
|
|
862
|
+
enabled: !!rateCardId,
|
|
863
|
+
onError,
|
|
864
|
+
queryFn: () => {
|
|
865
|
+
return client.rateCards.get(rateCardId);
|
|
866
|
+
},
|
|
867
|
+
queryKey: ["useGetRateCardById", rateCardId],
|
|
868
|
+
select: (result) => result.data
|
|
869
|
+
});
|
|
870
|
+
};
|
|
871
|
+
|
|
872
|
+
const useListRateCards = (carrierIds) => {
|
|
873
|
+
const { client } = useShipEngine();
|
|
874
|
+
return reactQuery.useQuery({
|
|
875
|
+
enabled: !!carrierIds.length,
|
|
876
|
+
onError,
|
|
877
|
+
queryFn: () => {
|
|
878
|
+
return client.rateCards.list(carrierIds);
|
|
879
|
+
},
|
|
880
|
+
queryKey: ["useListRateCards", carrierIds],
|
|
881
|
+
select: (result) => result.data.rateCards
|
|
882
|
+
});
|
|
883
|
+
};
|
|
884
|
+
|
|
885
|
+
var __async$b = (__this, __arguments, generator) => {
|
|
886
|
+
return new Promise((resolve, reject) => {
|
|
887
|
+
var fulfilled = (value) => {
|
|
888
|
+
try {
|
|
889
|
+
step(generator.next(value));
|
|
890
|
+
} catch (e) {
|
|
891
|
+
reject(e);
|
|
892
|
+
}
|
|
893
|
+
};
|
|
894
|
+
var rejected = (value) => {
|
|
895
|
+
try {
|
|
896
|
+
step(generator.throw(value));
|
|
897
|
+
} catch (e) {
|
|
898
|
+
reject(e);
|
|
899
|
+
}
|
|
900
|
+
};
|
|
901
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
902
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
903
|
+
});
|
|
904
|
+
};
|
|
905
|
+
const usePublishRateCard = () => {
|
|
906
|
+
const { client } = useShipEngine();
|
|
907
|
+
return reactQuery.useMutation({
|
|
908
|
+
mutationFn: (rateCardId) => __async$b(void 0, null, function* () {
|
|
909
|
+
return yield client.rateCards.publish(rateCardId);
|
|
910
|
+
}),
|
|
911
|
+
mutationKey: ["usePublishRateCard"],
|
|
912
|
+
onError
|
|
913
|
+
});
|
|
914
|
+
};
|
|
915
|
+
|
|
916
|
+
var __async$a = (__this, __arguments, generator) => {
|
|
917
|
+
return new Promise((resolve, reject) => {
|
|
918
|
+
var fulfilled = (value) => {
|
|
919
|
+
try {
|
|
920
|
+
step(generator.next(value));
|
|
921
|
+
} catch (e) {
|
|
922
|
+
reject(e);
|
|
923
|
+
}
|
|
924
|
+
};
|
|
925
|
+
var rejected = (value) => {
|
|
926
|
+
try {
|
|
927
|
+
step(generator.throw(value));
|
|
928
|
+
} catch (e) {
|
|
929
|
+
reject(e);
|
|
930
|
+
}
|
|
931
|
+
};
|
|
932
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
933
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
934
|
+
});
|
|
935
|
+
};
|
|
936
|
+
const useUpdateRateCard = () => {
|
|
937
|
+
const { client } = useShipEngine();
|
|
938
|
+
return reactQuery.useMutation({
|
|
939
|
+
mutationFn: (rateCard) => __async$a(void 0, null, function* () {
|
|
940
|
+
const result = yield client.rateCards.update(rateCard);
|
|
941
|
+
return result.data;
|
|
942
|
+
}),
|
|
943
|
+
mutationKey: ["useUpdateRateCard"],
|
|
944
|
+
onError
|
|
945
|
+
});
|
|
946
|
+
};
|
|
947
|
+
|
|
948
|
+
var __async$9 = (__this, __arguments, generator) => {
|
|
949
|
+
return new Promise((resolve, reject) => {
|
|
950
|
+
var fulfilled = (value) => {
|
|
951
|
+
try {
|
|
952
|
+
step(generator.next(value));
|
|
953
|
+
} catch (e) {
|
|
954
|
+
reject(e);
|
|
955
|
+
}
|
|
956
|
+
};
|
|
957
|
+
var rejected = (value) => {
|
|
958
|
+
try {
|
|
959
|
+
step(generator.throw(value));
|
|
960
|
+
} catch (e) {
|
|
961
|
+
reject(e);
|
|
962
|
+
}
|
|
963
|
+
};
|
|
964
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
965
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
966
|
+
});
|
|
967
|
+
};
|
|
968
|
+
const useUploadRateCard = () => {
|
|
969
|
+
const { client } = useShipEngine();
|
|
970
|
+
return reactQuery.useMutation({
|
|
971
|
+
mutationFn: (_0) => __async$9(void 0, [_0], function* ({ rateCardId, file }) {
|
|
972
|
+
const result = yield client.rateCards.upload(rateCardId, file);
|
|
973
|
+
return result.data;
|
|
974
|
+
}),
|
|
975
|
+
mutationKey: ["useUploadRateCard"],
|
|
976
|
+
onError
|
|
977
|
+
});
|
|
978
|
+
};
|
|
979
|
+
|
|
980
|
+
var __async$8 = (__this, __arguments, generator) => {
|
|
981
|
+
return new Promise((resolve, reject) => {
|
|
982
|
+
var fulfilled = (value) => {
|
|
983
|
+
try {
|
|
984
|
+
step(generator.next(value));
|
|
985
|
+
} catch (e) {
|
|
986
|
+
reject(e);
|
|
987
|
+
}
|
|
988
|
+
};
|
|
989
|
+
var rejected = (value) => {
|
|
990
|
+
try {
|
|
991
|
+
step(generator.throw(value));
|
|
992
|
+
} catch (e) {
|
|
993
|
+
reject(e);
|
|
994
|
+
}
|
|
995
|
+
};
|
|
996
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
997
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
998
|
+
});
|
|
999
|
+
};
|
|
1000
|
+
const useDeleteRateCard = () => {
|
|
1001
|
+
const { client } = useShipEngine();
|
|
1002
|
+
return reactQuery.useMutation({
|
|
1003
|
+
mutationFn: (rateCardId) => __async$8(void 0, null, function* () {
|
|
1004
|
+
const result = yield client.rateCards.delete(rateCardId);
|
|
1005
|
+
return result.data;
|
|
1006
|
+
}),
|
|
1007
|
+
mutationKey: ["useDeleteRateCard"],
|
|
1008
|
+
onError
|
|
1009
|
+
});
|
|
1010
|
+
};
|
|
1011
|
+
|
|
1012
|
+
var __async$7 = (__this, __arguments, generator) => {
|
|
1013
|
+
return new Promise((resolve, reject) => {
|
|
1014
|
+
var fulfilled = (value) => {
|
|
1015
|
+
try {
|
|
1016
|
+
step(generator.next(value));
|
|
1017
|
+
} catch (e) {
|
|
1018
|
+
reject(e);
|
|
1019
|
+
}
|
|
1020
|
+
};
|
|
1021
|
+
var rejected = (value) => {
|
|
1022
|
+
try {
|
|
1023
|
+
step(generator.throw(value));
|
|
1024
|
+
} catch (e) {
|
|
1025
|
+
reject(e);
|
|
1026
|
+
}
|
|
1027
|
+
};
|
|
1028
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1029
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
1030
|
+
});
|
|
1031
|
+
};
|
|
1032
|
+
const useCalculateRates = () => {
|
|
1033
|
+
const { client } = useShipEngine();
|
|
1034
|
+
return reactQuery.useMutation({
|
|
1035
|
+
mutationFn: (_0) => __async$7(void 0, [_0], function* ({ rateOptions, shipmentId }) {
|
|
1036
|
+
const result = yield client.rates.calculateByShipmentId(shipmentId, rateOptions);
|
|
1037
|
+
return result.data;
|
|
1038
|
+
}),
|
|
1039
|
+
mutationKey: ["useCalculateRates"],
|
|
1040
|
+
onError
|
|
1041
|
+
});
|
|
1042
|
+
};
|
|
1043
|
+
|
|
1044
|
+
const useGetSalesOrder = (salesOrderId) => {
|
|
1045
|
+
const { client } = useShipEngine();
|
|
1046
|
+
return reactQuery.useQuery({
|
|
1047
|
+
enabled: salesOrderId !== void 0,
|
|
1048
|
+
onError,
|
|
1049
|
+
queryFn: () => {
|
|
1050
|
+
if (salesOrderId)
|
|
1051
|
+
return client.salesOrders.get(salesOrderId);
|
|
1052
|
+
return Promise.reject(new Error("salesOrderId is required"));
|
|
1053
|
+
},
|
|
1054
|
+
queryKey: ["useGetSalesOrder", salesOrderId],
|
|
1055
|
+
select: (result) => result.data
|
|
1056
|
+
});
|
|
1057
|
+
};
|
|
1058
|
+
|
|
1059
|
+
const useListSalesOrders = (params = {}) => {
|
|
1060
|
+
const { client } = useShipEngine();
|
|
1061
|
+
return reactQuery.useQuery({
|
|
1062
|
+
enabled: params && Object.values(params).some((v) => v !== void 0),
|
|
1063
|
+
onError,
|
|
1064
|
+
queryFn: () => client.salesOrders.list(params),
|
|
1065
|
+
queryKey: ["useListSalesOrders", params],
|
|
1066
|
+
select: (result) => result.data.salesOrders
|
|
1067
|
+
});
|
|
1068
|
+
};
|
|
1069
|
+
|
|
1070
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
1071
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
1072
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
1073
|
+
var __objRest$4 = (source, exclude) => {
|
|
1074
|
+
var target = {};
|
|
1075
|
+
for (var prop in source)
|
|
1076
|
+
if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1077
|
+
target[prop] = source[prop];
|
|
1078
|
+
if (source != null && __getOwnPropSymbols$5)
|
|
1079
|
+
for (var prop of __getOwnPropSymbols$5(source)) {
|
|
1080
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
|
|
1081
|
+
target[prop] = source[prop];
|
|
1082
|
+
}
|
|
1083
|
+
return target;
|
|
1084
|
+
};
|
|
1085
|
+
var __async$6 = (__this, __arguments, generator) => {
|
|
1086
|
+
return new Promise((resolve, reject) => {
|
|
1087
|
+
var fulfilled = (value) => {
|
|
1088
|
+
try {
|
|
1089
|
+
step(generator.next(value));
|
|
1090
|
+
} catch (e) {
|
|
1091
|
+
reject(e);
|
|
1092
|
+
}
|
|
1093
|
+
};
|
|
1094
|
+
var rejected = (value) => {
|
|
1095
|
+
try {
|
|
1096
|
+
step(generator.throw(value));
|
|
1097
|
+
} catch (e) {
|
|
1098
|
+
reject(e);
|
|
1099
|
+
}
|
|
1100
|
+
};
|
|
1101
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1102
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
1103
|
+
});
|
|
1104
|
+
};
|
|
1105
|
+
const useNotifySalesOrderShipped = () => {
|
|
1106
|
+
const { client } = useShipEngine();
|
|
1107
|
+
return reactQuery.useMutation({
|
|
1108
|
+
mutationFn: (_a) => __async$6(void 0, null, function* () {
|
|
1109
|
+
var _b = _a, { salesOrderId } = _b, tracking = __objRest$4(_b, ["salesOrderId"]);
|
|
1110
|
+
const result = yield client.salesOrders.notifyShipped(salesOrderId, tracking);
|
|
1111
|
+
return result.data;
|
|
1112
|
+
}),
|
|
1113
|
+
mutationKey: ["useNotifySalesOrder"],
|
|
1114
|
+
onError
|
|
1115
|
+
});
|
|
1116
|
+
};
|
|
1117
|
+
|
|
1118
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
1119
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
1120
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
1121
|
+
var __objRest$3 = (source, exclude) => {
|
|
1122
|
+
var target = {};
|
|
1123
|
+
for (var prop in source)
|
|
1124
|
+
if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1125
|
+
target[prop] = source[prop];
|
|
1126
|
+
if (source != null && __getOwnPropSymbols$4)
|
|
1127
|
+
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
1128
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
1129
|
+
target[prop] = source[prop];
|
|
1130
|
+
}
|
|
1131
|
+
return target;
|
|
1132
|
+
};
|
|
1133
|
+
var __async$5 = (__this, __arguments, generator) => {
|
|
1134
|
+
return new Promise((resolve, reject) => {
|
|
1135
|
+
var fulfilled = (value) => {
|
|
1136
|
+
try {
|
|
1137
|
+
step(generator.next(value));
|
|
1138
|
+
} catch (e) {
|
|
1139
|
+
reject(e);
|
|
1140
|
+
}
|
|
1141
|
+
};
|
|
1142
|
+
var rejected = (value) => {
|
|
1143
|
+
try {
|
|
1144
|
+
step(generator.throw(value));
|
|
1145
|
+
} catch (e) {
|
|
1146
|
+
reject(e);
|
|
1147
|
+
}
|
|
1148
|
+
};
|
|
1149
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1150
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
1151
|
+
});
|
|
1152
|
+
};
|
|
1153
|
+
const useCreateSalesOrderShipment = () => {
|
|
1154
|
+
const { client } = useShipEngine();
|
|
1155
|
+
return reactQuery.useMutation({
|
|
1156
|
+
mutationFn: (_a) => __async$5(void 0, null, function* () {
|
|
1157
|
+
var _b = _a, { salesOrderId } = _b, shipment = __objRest$3(_b, ["salesOrderId"]);
|
|
1158
|
+
const result = yield client.salesOrderShipments.create(salesOrderId, shipment);
|
|
1159
|
+
return result.data;
|
|
1160
|
+
}),
|
|
1161
|
+
mutationKey: ["useCreateSalesOrderShipment"],
|
|
1162
|
+
onError
|
|
1163
|
+
});
|
|
1164
|
+
};
|
|
1165
|
+
|
|
1166
|
+
const useGetSalesOrderShipment = (shipmentId) => {
|
|
1167
|
+
const { client } = useShipEngine();
|
|
1168
|
+
return reactQuery.useQuery({
|
|
1169
|
+
enabled: shipmentId !== void 0,
|
|
1170
|
+
onError,
|
|
1171
|
+
queryFn: () => {
|
|
1172
|
+
if (shipmentId)
|
|
1173
|
+
return client.salesOrderShipments.get(shipmentId);
|
|
1174
|
+
return Promise.reject(new Error("shipmentId is required"));
|
|
1175
|
+
},
|
|
1176
|
+
queryKey: ["useGetSalesOrderShipment", shipmentId],
|
|
1177
|
+
select: (result) => result.data
|
|
1178
|
+
});
|
|
1179
|
+
};
|
|
1180
|
+
|
|
1181
|
+
const useListSalesOrderShipments = (params) => {
|
|
1182
|
+
const { client } = useShipEngine();
|
|
1183
|
+
return reactQuery.useQuery({
|
|
1184
|
+
enabled: params && Object.values(params).some((v) => v !== void 0),
|
|
1185
|
+
onError,
|
|
1186
|
+
queryFn: () => client.salesOrderShipments.list(params),
|
|
1187
|
+
queryKey: ["useListSalesOrderShipments", params],
|
|
1188
|
+
select: (result) => result.data.shipments
|
|
1189
|
+
});
|
|
1190
|
+
};
|
|
1191
|
+
|
|
1192
|
+
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
1193
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
1194
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
1195
|
+
var __objRest$2 = (source, exclude) => {
|
|
1196
|
+
var target = {};
|
|
1197
|
+
for (var prop in source)
|
|
1198
|
+
if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1199
|
+
target[prop] = source[prop];
|
|
1200
|
+
if (source != null && __getOwnPropSymbols$3)
|
|
1201
|
+
for (var prop of __getOwnPropSymbols$3(source)) {
|
|
1202
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
|
|
1203
|
+
target[prop] = source[prop];
|
|
1204
|
+
}
|
|
1205
|
+
return target;
|
|
1206
|
+
};
|
|
1207
|
+
var __async$4 = (__this, __arguments, generator) => {
|
|
1208
|
+
return new Promise((resolve, reject) => {
|
|
1209
|
+
var fulfilled = (value) => {
|
|
1210
|
+
try {
|
|
1211
|
+
step(generator.next(value));
|
|
1212
|
+
} catch (e) {
|
|
1213
|
+
reject(e);
|
|
1214
|
+
}
|
|
1215
|
+
};
|
|
1216
|
+
var rejected = (value) => {
|
|
1217
|
+
try {
|
|
1218
|
+
step(generator.throw(value));
|
|
1219
|
+
} catch (e) {
|
|
1220
|
+
reject(e);
|
|
1221
|
+
}
|
|
1222
|
+
};
|
|
1223
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1224
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
1225
|
+
});
|
|
1226
|
+
};
|
|
1227
|
+
const useUpdateSalesOrderShipment = () => {
|
|
1228
|
+
const { client } = useShipEngine();
|
|
1229
|
+
return reactQuery.useMutation({
|
|
1230
|
+
mutationFn: (_a) => __async$4(void 0, null, function* () {
|
|
1231
|
+
var _b = _a, { shipmentId } = _b, shipment = __objRest$2(_b, ["shipmentId"]);
|
|
1232
|
+
const result = yield client.salesOrderShipments.update(shipmentId, shipment);
|
|
1233
|
+
return result.data;
|
|
1234
|
+
}),
|
|
1235
|
+
mutationKey: ["useUpdateSalesOrderShipment"],
|
|
1236
|
+
onError
|
|
1237
|
+
});
|
|
1238
|
+
};
|
|
1239
|
+
|
|
1240
|
+
var __defProp = Object.defineProperty;
|
|
1241
|
+
var __defProps = Object.defineProperties;
|
|
1242
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
1243
|
+
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
1244
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
1245
|
+
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
1246
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1247
|
+
var __spreadValues = (a, b) => {
|
|
1248
|
+
for (var prop in b || (b = {}))
|
|
1249
|
+
if (__hasOwnProp$2.call(b, prop))
|
|
1250
|
+
__defNormalProp(a, prop, b[prop]);
|
|
1251
|
+
if (__getOwnPropSymbols$2)
|
|
1252
|
+
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
1253
|
+
if (__propIsEnum$2.call(b, prop))
|
|
1254
|
+
__defNormalProp(a, prop, b[prop]);
|
|
1255
|
+
}
|
|
1256
|
+
return a;
|
|
1257
|
+
};
|
|
1258
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1259
|
+
var __async$3 = (__this, __arguments, generator) => {
|
|
1260
|
+
return new Promise((resolve, reject) => {
|
|
1261
|
+
var fulfilled = (value) => {
|
|
1262
|
+
try {
|
|
1263
|
+
step(generator.next(value));
|
|
1264
|
+
} catch (e) {
|
|
1265
|
+
reject(e);
|
|
1266
|
+
}
|
|
1267
|
+
};
|
|
1268
|
+
var rejected = (value) => {
|
|
1269
|
+
try {
|
|
1270
|
+
step(generator.throw(value));
|
|
1271
|
+
} catch (e) {
|
|
1272
|
+
reject(e);
|
|
1273
|
+
}
|
|
1274
|
+
};
|
|
1275
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1276
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
1277
|
+
});
|
|
1278
|
+
};
|
|
1279
|
+
const useCreateShipment = () => {
|
|
1280
|
+
const { client } = useShipEngine();
|
|
1281
|
+
return reactQuery.useMutation({
|
|
1282
|
+
mutationFn: (shipment) => __async$3(void 0, null, function* () {
|
|
1283
|
+
var _a;
|
|
1284
|
+
if (shipment.warehouseId === void 0) {
|
|
1285
|
+
throw new jsApi.SE.CodedError("errorMessages.noWarehouses", {
|
|
1286
|
+
errorCode: "unknown",
|
|
1287
|
+
errorSource: "client",
|
|
1288
|
+
errorType: "business_rules"
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
const shipTo = (_a = shipment.shipTo) != null ? _a : {
|
|
1292
|
+
addressLine1: "",
|
|
1293
|
+
cityLocality: "",
|
|
1294
|
+
countryCode: "",
|
|
1295
|
+
name: "",
|
|
1296
|
+
phone: "",
|
|
1297
|
+
postalCode: "",
|
|
1298
|
+
stateProvince: ""
|
|
1299
|
+
};
|
|
1300
|
+
return (yield client.shipments.create(__spreadProps(__spreadValues({}, shipment), {
|
|
1301
|
+
shipTo
|
|
1302
|
+
}))).data;
|
|
1303
|
+
}),
|
|
1304
|
+
mutationKey: ["useCreateShipment"],
|
|
1305
|
+
onError
|
|
1306
|
+
});
|
|
1307
|
+
};
|
|
1308
|
+
|
|
1309
|
+
const useGetShipmentRates = (shipmentId, createdAtStart) => {
|
|
1310
|
+
const { client } = useShipEngine();
|
|
1311
|
+
return reactQuery.useQuery({
|
|
1312
|
+
enabled: shipmentId !== void 0,
|
|
1313
|
+
onError,
|
|
1314
|
+
queryFn: () => {
|
|
1315
|
+
if (shipmentId) {
|
|
1316
|
+
return client.shipments.getShipmentRates({ createdAtStart, shipmentId });
|
|
1317
|
+
}
|
|
1318
|
+
return Promise.reject(new Error("shipmentId is required"));
|
|
1319
|
+
},
|
|
1320
|
+
queryKey: ["useGetShipmentRates", shipmentId, createdAtStart],
|
|
1321
|
+
select: (result) => result.data
|
|
1322
|
+
});
|
|
1323
|
+
};
|
|
1324
|
+
|
|
1325
|
+
const useGetShipment = (shipmentId) => {
|
|
1326
|
+
const { client } = useShipEngine();
|
|
1327
|
+
return reactQuery.useQuery({
|
|
1328
|
+
enabled: shipmentId !== void 0,
|
|
1329
|
+
onError,
|
|
1330
|
+
queryFn: () => {
|
|
1331
|
+
if (!shipmentId) {
|
|
1332
|
+
return Promise.reject(new Error("shipmentId is required"));
|
|
1333
|
+
}
|
|
1334
|
+
return client.salesOrderShipments.get(shipmentId);
|
|
1335
|
+
},
|
|
1336
|
+
queryKey: ["useGetShipment", shipmentId],
|
|
1337
|
+
select: (result) => result.data
|
|
1338
|
+
});
|
|
1339
|
+
};
|
|
1340
|
+
|
|
1341
|
+
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
1342
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
1343
|
+
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
1344
|
+
var __objRest$1 = (source, exclude) => {
|
|
1345
|
+
var target = {};
|
|
1346
|
+
for (var prop in source)
|
|
1347
|
+
if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1348
|
+
target[prop] = source[prop];
|
|
1349
|
+
if (source != null && __getOwnPropSymbols$1)
|
|
1350
|
+
for (var prop of __getOwnPropSymbols$1(source)) {
|
|
1351
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
|
|
1352
|
+
target[prop] = source[prop];
|
|
1353
|
+
}
|
|
1354
|
+
return target;
|
|
1355
|
+
};
|
|
1356
|
+
const useListShipments = (_params) => {
|
|
1357
|
+
const _a = _params || {}, { enabled = true } = _a, params = __objRest$1(_a, ["enabled"]);
|
|
1358
|
+
const { client } = useShipEngine();
|
|
1359
|
+
return reactQuery.useQuery({
|
|
1360
|
+
enabled,
|
|
1361
|
+
onError,
|
|
1362
|
+
queryFn: () => client.shipments.list(params),
|
|
1363
|
+
queryKey: ["useListShipments", params],
|
|
1364
|
+
select: (result) => result.data
|
|
1365
|
+
});
|
|
1366
|
+
};
|
|
1367
|
+
|
|
1368
|
+
var __async$2 = (__this, __arguments, generator) => {
|
|
1369
|
+
return new Promise((resolve, reject) => {
|
|
1370
|
+
var fulfilled = (value) => {
|
|
1371
|
+
try {
|
|
1372
|
+
step(generator.next(value));
|
|
1373
|
+
} catch (e) {
|
|
1374
|
+
reject(e);
|
|
1375
|
+
}
|
|
1376
|
+
};
|
|
1377
|
+
var rejected = (value) => {
|
|
1378
|
+
try {
|
|
1379
|
+
step(generator.throw(value));
|
|
1380
|
+
} catch (e) {
|
|
1381
|
+
reject(e);
|
|
1382
|
+
}
|
|
1383
|
+
};
|
|
1384
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1385
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
1386
|
+
});
|
|
1387
|
+
};
|
|
1388
|
+
const useCreateWarehouse = () => {
|
|
1389
|
+
const { client } = useShipEngine();
|
|
1390
|
+
return reactQuery.useMutation({
|
|
1391
|
+
mutationFn: (data) => __async$2(void 0, null, function* () {
|
|
1392
|
+
const result = yield client.warehouses.create(data);
|
|
1393
|
+
return result.data;
|
|
1394
|
+
}),
|
|
1395
|
+
mutationKey: ["useCreateWarehouse"],
|
|
1396
|
+
onError
|
|
1397
|
+
});
|
|
1398
|
+
};
|
|
1399
|
+
|
|
1400
|
+
var __async$1 = (__this, __arguments, generator) => {
|
|
1401
|
+
return new Promise((resolve, reject) => {
|
|
1402
|
+
var fulfilled = (value) => {
|
|
1403
|
+
try {
|
|
1404
|
+
step(generator.next(value));
|
|
1405
|
+
} catch (e) {
|
|
1406
|
+
reject(e);
|
|
1407
|
+
}
|
|
1408
|
+
};
|
|
1409
|
+
var rejected = (value) => {
|
|
1410
|
+
try {
|
|
1411
|
+
step(generator.throw(value));
|
|
1412
|
+
} catch (e) {
|
|
1413
|
+
reject(e);
|
|
1414
|
+
}
|
|
1415
|
+
};
|
|
1416
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1417
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
1418
|
+
});
|
|
1419
|
+
};
|
|
1420
|
+
const useDeleteWarehouse = () => {
|
|
1421
|
+
const { client } = useShipEngine();
|
|
1422
|
+
return reactQuery.useMutation({
|
|
1423
|
+
mutationFn: (_0) => __async$1(void 0, [_0], function* ({ warehouseId }) {
|
|
1424
|
+
const result = yield client.warehouses.delete(warehouseId);
|
|
1425
|
+
return result.data;
|
|
1426
|
+
}),
|
|
1427
|
+
mutationKey: ["useDeleteWarehouse"],
|
|
1428
|
+
onError
|
|
1429
|
+
});
|
|
1430
|
+
};
|
|
1431
|
+
|
|
1432
|
+
const useListWarehouses = (options) => {
|
|
1433
|
+
var _a;
|
|
1434
|
+
const { client } = useShipEngine();
|
|
1435
|
+
return reactQuery.useQuery({
|
|
1436
|
+
enabled: (_a = options == null ? void 0 : options.enabled) != null ? _a : true,
|
|
1437
|
+
onError,
|
|
1438
|
+
queryFn: () => client.warehouses.list(),
|
|
1439
|
+
queryKey: ["useListWarehouses"],
|
|
1440
|
+
select: (result) => result.data.warehouses
|
|
1441
|
+
});
|
|
1442
|
+
};
|
|
1443
|
+
|
|
1444
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
1445
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1446
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
1447
|
+
var __objRest = (source, exclude) => {
|
|
1448
|
+
var target = {};
|
|
1449
|
+
for (var prop in source)
|
|
1450
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1451
|
+
target[prop] = source[prop];
|
|
1452
|
+
if (source != null && __getOwnPropSymbols)
|
|
1453
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
1454
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
1455
|
+
target[prop] = source[prop];
|
|
1456
|
+
}
|
|
1457
|
+
return target;
|
|
1458
|
+
};
|
|
1459
|
+
var __async = (__this, __arguments, generator) => {
|
|
1460
|
+
return new Promise((resolve, reject) => {
|
|
1461
|
+
var fulfilled = (value) => {
|
|
1462
|
+
try {
|
|
1463
|
+
step(generator.next(value));
|
|
1464
|
+
} catch (e) {
|
|
1465
|
+
reject(e);
|
|
1466
|
+
}
|
|
1467
|
+
};
|
|
1468
|
+
var rejected = (value) => {
|
|
1469
|
+
try {
|
|
1470
|
+
step(generator.throw(value));
|
|
1471
|
+
} catch (e) {
|
|
1472
|
+
reject(e);
|
|
1473
|
+
}
|
|
1474
|
+
};
|
|
1475
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1476
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
1477
|
+
});
|
|
1478
|
+
};
|
|
1479
|
+
const useUpdateWarehouse = () => {
|
|
1480
|
+
const { client } = useShipEngine();
|
|
1481
|
+
return reactQuery.useMutation({
|
|
1482
|
+
mutationFn: (_a) => __async(void 0, null, function* () {
|
|
1483
|
+
var _b = _a, { warehouseId } = _b, warehouse = __objRest(_b, ["warehouseId"]);
|
|
1484
|
+
const result = yield client.warehouses.update(warehouseId, warehouse);
|
|
1485
|
+
return result.data;
|
|
1486
|
+
}),
|
|
1487
|
+
mutationKey: ["useUpdateWarehouse"],
|
|
1488
|
+
onError
|
|
1489
|
+
});
|
|
1490
|
+
};
|
|
1491
|
+
|
|
1492
|
+
exports.ShipEngine = ShipEngine;
|
|
1493
|
+
exports.ShipEngineContext = ShipEngineContext;
|
|
1494
|
+
exports.delay = delay;
|
|
1495
|
+
exports.logger = logger;
|
|
1496
|
+
exports.onError = onError;
|
|
1497
|
+
exports.retryUntil = retryUntil;
|
|
1498
|
+
exports.useAddFunds = useAddFunds;
|
|
1499
|
+
exports.useCalculateRates = useCalculateRates;
|
|
1500
|
+
exports.useConnectCarrier = useConnectCarrier;
|
|
1501
|
+
exports.useCreateFundingSource = useCreateFundingSource;
|
|
1502
|
+
exports.useCreateLabel = useCreateLabel;
|
|
1503
|
+
exports.useCreateRateCard = useCreateRateCard;
|
|
1504
|
+
exports.useCreateSalesOrderShipment = useCreateSalesOrderShipment;
|
|
1505
|
+
exports.useCreateShipment = useCreateShipment;
|
|
1506
|
+
exports.useCreateWarehouse = useCreateWarehouse;
|
|
1507
|
+
exports.useDeleteRateCard = useDeleteRateCard;
|
|
1508
|
+
exports.useDeleteWarehouse = useDeleteWarehouse;
|
|
1509
|
+
exports.useDownloadRateCard = useDownloadRateCard;
|
|
1510
|
+
exports.useFundingSourcesAddFunds = useFundingSourcesAddFunds;
|
|
1511
|
+
exports.useGetAccountSettings = useGetAccountSettings;
|
|
1512
|
+
exports.useGetAutoFundingConfiguration = useGetAutoFundingConfiguration;
|
|
1513
|
+
exports.useGetCarrierById = useGetCarrierById;
|
|
1514
|
+
exports.useGetCountriesByCarrier = useGetCountriesByCarrier;
|
|
1515
|
+
exports.useGetCurrenciesByCarrier = useGetCurrenciesByCarrier;
|
|
1516
|
+
exports.useGetFundingSourceById = useGetFundingSourceById;
|
|
1517
|
+
exports.useGetInsuranceAccount = useGetInsuranceAccount;
|
|
1518
|
+
exports.useGetLabel = useGetLabel;
|
|
1519
|
+
exports.useGetPackageRatingGroupByCarrier = useGetPackageRatingGroupByCarrier;
|
|
1520
|
+
exports.useGetRateCardById = useGetRateCardById;
|
|
1521
|
+
exports.useGetSalesOrder = useGetSalesOrder;
|
|
1522
|
+
exports.useGetSalesOrderShipment = useGetSalesOrderShipment;
|
|
1523
|
+
exports.useGetServicesByCarrier = useGetServicesByCarrier;
|
|
1524
|
+
exports.useGetShipment = useGetShipment;
|
|
1525
|
+
exports.useGetShipmentRates = useGetShipmentRates;
|
|
1526
|
+
exports.useGetWalletHistory = useGetWalletHistory;
|
|
1527
|
+
exports.useGetZonesByCarrier = useGetZonesByCarrier;
|
|
1528
|
+
exports.useListCarriers = useListCarriers;
|
|
1529
|
+
exports.useListCustomPackageTypes = useListCustomPackageTypes;
|
|
1530
|
+
exports.useListFundingSources = useListFundingSources;
|
|
1531
|
+
exports.useListLabels = useListLabels;
|
|
1532
|
+
exports.useListOrderSources = useListOrderSources;
|
|
1533
|
+
exports.useListRateCards = useListRateCards;
|
|
1534
|
+
exports.useListSalesOrderShipments = useListSalesOrderShipments;
|
|
1535
|
+
exports.useListSalesOrders = useListSalesOrders;
|
|
1536
|
+
exports.useListShipments = useListShipments;
|
|
1537
|
+
exports.useListWarehouses = useListWarehouses;
|
|
1538
|
+
exports.useNotifySalesOrderShipped = useNotifySalesOrderShipped;
|
|
1539
|
+
exports.useParseAddress = useParseAddress;
|
|
1540
|
+
exports.usePublishRateCard = usePublishRateCard;
|
|
1541
|
+
exports.useRefreshOrderSource = useRefreshOrderSource;
|
|
1542
|
+
exports.useRefreshOrderSourceAsync = useRefreshOrderSourceAsync;
|
|
1543
|
+
exports.useRegisterCarrier = useRegisterCarrier;
|
|
1544
|
+
exports.useShipEngine = useShipEngine;
|
|
1545
|
+
exports.useUpdateAccountSettings = useUpdateAccountSettings;
|
|
1546
|
+
exports.useUpdateAutoFunding = useUpdateAutoFunding;
|
|
1547
|
+
exports.useUpdateFundingSource = useUpdateFundingSource;
|
|
1548
|
+
exports.useUpdateRateCard = useUpdateRateCard;
|
|
1549
|
+
exports.useUpdateSalesOrderShipment = useUpdateSalesOrderShipment;
|
|
1550
|
+
exports.useUpdateWarehouse = useUpdateWarehouse;
|
|
1551
|
+
exports.useUploadRateCard = useUploadRateCard;
|
|
1552
|
+
exports.useValidateAddresses = useValidateAddresses;
|
|
1553
|
+
exports.useVoidLabel = useVoidLabel;
|
|
1554
|
+
Object.keys(jsApi).forEach(k => {
|
|
1555
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
1556
|
+
enumerable: true,
|
|
1557
|
+
get: () => jsApi[k]
|
|
1558
|
+
});
|
|
1559
|
+
});
|