@duely/client
Advanced tools
Comparing version 0.4.8 to 0.4.9
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@apollo/client"),require("@duely/core"),require("react")):"function"==typeof define&&define.amd?define(["@apollo/client","@duely/core","react"],t):"object"==typeof exports?exports["@duely/client"]=t(require("@apollo/client"),require("@duely/core"),require("react")):e["@duely/client"]=t(e["@apollo/client"],e["@duely/core"],e.react)}(this,(function(e,t,n){return(()=>{var r={329:(e,t,n)=>{e.exports=n(516).Observable},516:(e,t)=>{"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}t.Observable=void 0;var i=function(){return"function"==typeof Symbol},u=function(e){return i()&&Boolean(Symbol[e])},c=function(e){return u(e)?Symbol[e]:"@@"+e};i()&&!u("observable")&&(Symbol.observable=Symbol("observable"));var a=c("iterator"),l=c("observable"),s=c("species");function d(e,t){var n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function f(e){var t=e.constructor;return void 0!==t&&null===(t=t[s])&&(t=void 0),void 0!==t?t:O}function v(e){return e instanceof O}function p(e){p.log?p.log(e):setTimeout((function(){throw e}))}function _(e){Promise.resolve().then((function(){try{e()}catch(e){p(e)}}))}function g(e){var t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{var n=d(t,"unsubscribe");n&&n.call(t)}}catch(e){p(e)}}function y(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function m(e,t,n){e._state="running";var r=e._observer;try{var o=d(r,t);switch(t){case"next":o&&o.call(r,n);break;case"error":if(y(e),!o)throw n;o.call(r,n);break;case"complete":y(e),o&&o.call(r)}}catch(e){p(e)}"closed"===e._state?g(e):"running"===e._state&&(e._state="ready")}function b(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void _((function(){return function(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var n=0;n<t.length&&(m(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e)}))):void m(e,t,n);e._queue.push({type:t,value:n})}}var h=function(){function e(t,r){n(this,e),this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var o=new w(this);try{this._cleanup=r.call(void 0,o)}catch(e){o.error(e)}"initializing"===this._state&&(this._state="ready")}return o(e,[{key:"unsubscribe",value:function(){"closed"!==this._state&&(y(this),g(this))}},{key:"closed",get:function(){return"closed"===this._state}}]),e}(),w=function(){function e(t){n(this,e),this._subscription=t}return o(e,[{key:"next",value:function(e){b(this._subscription,"next",e)}},{key:"error",value:function(e){b(this._subscription,"error",e)}},{key:"complete",value:function(){b(this._subscription,"complete")}},{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),O=function(){function e(t){if(n(this,e),!(this instanceof e))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof t)throw new TypeError("Observable initializer must be a function");this._subscriber=t}return o(e,[{key:"subscribe",value:function(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new h(e,this._subscriber)}},{key:"forEach",value:function(e){var t=this;return new Promise((function(n,r){if("function"==typeof e)var o=t.subscribe({next:function(t){try{e(t,i)}catch(e){r(e),o.unsubscribe()}},error:r,complete:n});else r(new TypeError(e+" is not a function"));function i(){o.unsubscribe(),n()}}))}},{key:"map",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(f(this))((function(n){return t.subscribe({next:function(t){try{t=e(t)}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})}))}},{key:"filter",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(f(this))((function(n){return t.subscribe({next:function(t){try{if(!e(t))return}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})}))}},{key:"reduce",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=f(this),r=arguments.length>1,o=!1,i=arguments[1],u=i;return new n((function(n){return t.subscribe({next:function(t){var i=!o;if(o=!0,!i||r)try{u=e(u,t)}catch(e){return n.error(e)}else u=t},error:function(e){n.error(e)},complete:function(){if(!o&&!r)return n.error(new TypeError("Cannot reduce an empty sequence"));n.next(u),n.complete()}})}))}},{key:"concat",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=f(this);return new o((function(t){var r,i=0;return function e(u){r=u.subscribe({next:function(e){t.next(e)},error:function(e){t.error(e)},complete:function(){i===n.length?(r=void 0,t.complete()):e(o.from(n[i++]))}})}(e),function(){r&&(r.unsubscribe(),r=void 0)}}))}},{key:"flatMap",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=f(this);return new n((function(r){var o=[],i=t.subscribe({next:function(t){if(e)try{t=e(t)}catch(e){return r.error(e)}var i=n.from(t).subscribe({next:function(e){r.next(e)},error:function(e){r.error(e)},complete:function(){var e=o.indexOf(i);e>=0&&o.splice(e,1),u()}});o.push(i)},error:function(e){r.error(e)},complete:function(){u()}});function u(){i.closed&&0===o.length&&r.complete()}return function(){o.forEach((function(e){return e.unsubscribe()})),i.unsubscribe()}}))}},{key:l,value:function(){return this}}],[{key:"from",value:function(t){var n="function"==typeof this?this:e;if(null==t)throw new TypeError(t+" is not an object");var r=d(t,l);if(r){var o=r.call(t);if(Object(o)!==o)throw new TypeError(o+" is not an object");return v(o)&&o.constructor===n?o:new n((function(e){return o.subscribe(e)}))}if(u("iterator")&&(r=d(t,a)))return new n((function(e){_((function(){if(!e.closed){var n=!0,o=!1,i=void 0;try{for(var u,c=r.call(t)[Symbol.iterator]();!(n=(u=c.next()).done);n=!0){var a=u.value;if(e.next(a),e.closed)return}}catch(e){o=!0,i=e}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}e.complete()}}))}));if(Array.isArray(t))return new n((function(e){_((function(){if(!e.closed){for(var n=0;n<t.length;++n)if(e.next(t[n]),e.closed)return;e.complete()}}))}));throw new TypeError(t+" is not observable")}},{key:"of",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o="function"==typeof this?this:e;return new o((function(e){_((function(){if(!e.closed){for(var t=0;t<n.length;++t)if(e.next(n[t]),e.closed)return;e.complete()}}))}))}},{key:s,get:function(){return this}}]),e}();t.Observable=O,i()&&Object.defineProperty(O,Symbol("extensions"),{value:{symbol:l,hostReportError:p},configurable:!0})},74:t=>{"use strict";t.exports=e},620:e=>{"use strict";e.exports=t},297:e=>{"use strict";e.exports=n}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={exports:{}};return r[e](n,n.exports,i),n.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};return(()=>{"use strict";i.r(u),i.d(u,{agencies_Q:()=>Se,agency_Q:()=>xe,agency_customers_Q:()=>Me,agency_pages_Q:()=>ct,agency_products_Q:()=>Fe,agency_stripe_account_Q:()=>Qe,agency_stripe_account_balance_Q:()=>Ce,agency_stripe_account_balance_transactions_Q:()=>Te,agency_stripe_account_payment_intents_Q:()=>Ee,agency_stripe_account_update_url_Q:()=>Ae,agency_subscription_plan_Q:()=>at,agency_thank_you_page_settings_Q:()=>it,calculate_transaction_fee_Q:()=>yt,client:()=>M,countries_Q:()=>De,country_spec_Q:()=>ke,create_agency_M:()=>W,create_agency_thank_you_page_setting_M:()=>ne,create_customer_M:()=>X,create_integration_M:()=>fe,create_integration_config_M:()=>pe,create_page_block_M:()=>le,create_price_M:()=>te,create_product_M:()=>G,create_product_thank_you_page_setting_M:()=>re,current_agency_Q:()=>nt,current_agency_extended_Q:()=>rt,current_agency_stripe_account_update_url_Q:()=>ot,current_subdomain_Q:()=>Be,current_user_Q:()=>Oe,current_user_agencies_Q:()=>Ue,customer_Q:()=>Ie,delete_agency_thank_you_page_setting_M:()=>ue,delete_customer_M:()=>ee,delete_page_block_M:()=>de,delete_product_M:()=>K,delete_product_thank_you_page_setting_M:()=>ce,form_field_Q:()=>Re,form_fields_Q:()=>ze,image_Q:()=>qe,images_Q:()=>Pe,integration_Q:()=>Ve,integration_config_Q:()=>We,integration_configs_Q:()=>$e,integration_type_Q:()=>Ge,integration_types_Q:()=>Je,integrations_Q:()=>He,log_in_M:()=>L,log_out_M:()=>Y,mutate:()=>F,order_Q:()=>Ke,order_item_Q:()=>Ze,order_items_Q:()=>et,orders_Q:()=>Xe,page_Q:()=>lt,page_block_Q:()=>dt,page_block_definition_Q:()=>vt,page_block_definition_by_name_Q:()=>gt,page_by_url_Q:()=>st,page_definition_Q:()=>ft,page_definition_by_name_Q:()=>pt,page_definition_by_url_path_Q:()=>_t,product_Q:()=>Le,product_and_agency_from_url_parts_Q:()=>tt,product_thank_you_page_settings_Q:()=>ut,products_Q:()=>Ye,query:()=>we,services_agreement_Q:()=>je,start_password_reset_M:()=>V,start_sign_up_M:()=>H,subdomain_public_Q:()=>Ne,update_agency_M:()=>$,update_agency_thank_you_page_setting_M:()=>oe,update_customer_M:()=>Z,update_integration_M:()=>ve,update_integration_config_M:()=>_e,update_page_M:()=>ae,update_page_block_M:()=>se,update_product_M:()=>J,update_product_thank_you_page_setting_M:()=>ie,useMutation:()=>he,useQuery:()=>U,verify_password_reset_M:()=>R,verify_sign_up_M:()=>z});var e=i(74),t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,n)};function n(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};Object.create,Object.create;var c="Invariant Violation",a=Object.setPrototypeOf,l=void 0===a?function(e,t){return e.__proto__=t,e}:a,s=function(e){function t(n){void 0===n&&(n=c);var r=e.call(this,"number"==typeof n?c+": "+n+" (see https://github.com/apollographql/invariant-packages)":n)||this;return r.framesToPop=1,r.name=c,l(r,t.prototype),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t}(Error);function d(e,t){if(!e)throw new s(t)}var f,v=["log","warn","error","silent"],p=v.indexOf("log");function _(e){return function(){if(v.indexOf(e)>=p)return console[e].apply(console,arguments)}}(f=d||(d={})).log=_("log"),f.warn=_("warn"),f.error=_("error");var g,y=i(329),m=i.n(y);function b(e,t){return t?t(e):m().of()}function h(e){return"function"==typeof e?new O(e):e}function w(e){return e.request.length<=1}n((function(e,t){var n=g.call(this,e)||this;return n.link=t,n}),g=Error);var O=function(){function e(e){e&&(this.request=e)}return e.empty=function(){return new e((function(){return m().of()}))},e.from=function(t){return 0===t.length?e.empty():t.map(h).reduce((function(e,t){return e.concat(t)}))},e.split=function(t,n,r){var o=h(n),i=h(r||new e(b));return w(o)&&w(i)?new e((function(e){return t(e)?o.request(e)||m().of():i.request(e)||m().of()})):new e((function(e,n){return t(e)?o.request(e,n)||m().of():i.request(e,n)||m().of()}))},e.execute=function(e,t){return e.request(function(e,t){var n=r({},e);return Object.defineProperty(t,"setContext",{enumerable:!1,value:function(e){n=r(r({},n),"function"==typeof e?e(n):e)}}),Object.defineProperty(t,"getContext",{enumerable:!1,value:function(){return r({},n)}}),t}(t.context,function(e){var t={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return t.operationName||(t.operationName="string"!=typeof t.query?t.query.definitions.filter((function(e){return"OperationDefinition"===e.kind&&e.name})).map((function(e){return e.name.value}))[0]||void 0:""),t}(function(e){for(var t=["query","operationName","variables","extensions","context"],n=0,r=Object.keys(e);n<r.length;n++){var o=r[n];if(t.indexOf(o)<0)throw new s(26)}return e}(t))))||m().of()},e.concat=function(t,n){var r=h(t);if(w(r))return r;var o=h(n);return w(o)?new e((function(e){return r.request(e,(function(e){return o.request(e)||m().of()}))||m().of()})):new e((function(e,t){return r.request(e,(function(e){return o.request(e,t)||m().of()}))||m().of()}))},e.prototype.split=function(t,n,r){return this.concat(e.split(t,n,r||new e(b)))},e.prototype.concat=function(t){return e.concat(this,t)},e.prototype.request=function(e,t){throw new s(21)},e.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},e.prototype.setOnError=function(e){return this.onError=e,this},e}();function D(e){return new O((function(t,n){return new(m())((function(r){var o,i,u;try{o=n(t).subscribe({next:function(o){o.errors&&(u=e({graphQLErrors:o.errors,response:o,operation:t,forward:n}))?i=u.subscribe({next:r.next.bind(r),error:r.error.bind(r),complete:r.complete.bind(r)}):r.next(o)},error:function(o){(u=e({operation:t,networkError:o,graphQLErrors:o&&o.result&&o.result.errors,forward:n}))?i=u.subscribe({next:r.next.bind(r),error:r.error.bind(r),complete:r.complete.bind(r)}):r.error(o)},complete:function(){u||r.complete.bind(r)()}})}catch(o){e({networkError:o,operation:t,forward:n}),r.error(o)}return function(){o&&o.unsubscribe(),i&&o.unsubscribe()}}))}))}!function(e){function t(t){var n=e.call(this)||this;return n.link=D(t),n}n(t,e),t.prototype.request=function(e,t){return this.link.request(e,t)}}(O);var k=i(620),q=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,c)}a((r=r.apply(e,t||[])).next())}))};const P="undefined"==typeof window;let j=P?()=>null:()=>(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("user-jwt"))||(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("visitor-jwt"));const x=new e.InMemoryCache({typePolicies:{}}),S=new e.HttpLink({uri:"https://api.duely.app/graphql"});let Q=null;const A=S,C=(T=(t,{headers:n})=>q(void 0,void 0,void 0,(function*(){let t=yield function(){return q(this,void 0,void 0,(function*(){let t=j();return t||(Q||(Q=(0,e.toPromise)(e.ApolloLink.execute(S,{query:k.BeginVisitDocument})).then((({data:n})=>q(this,void 0,void 0,(function*(){if(!(null==n?void 0:n.begin_visit.success))throw Error(null==n?void 0:n.begin_visit.message);{const r=n.begin_visit.jwt;if(P){const{data:n}=yield(0,e.toPromise)(e.ApolloLink.execute(S,{query:k.LogInDocument,variables:{email_address:"serviceaccount@duely.app",password:process.env.DUELY_SERVICE_ACCOUNT_PASSWORD},context:{headers:{authorization:`Bearer ${r}`}}}));(null==n?void 0:n.log_in.success)?(t=n.log_in.jwt,j=()=>t):console.error(null==n?void 0:n.log_in.message)}else localStorage.setItem("visitor-jwt",r)}}))))),yield Q,j())}))}();return t?{headers:Object.assign(Object.assign({},n),{authorization:`Bearer ${t}`})}:{}})),new O((function(e,t){var n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,[]);return new(m())((function(r){var o,i=!1;return Promise.resolve(n).then((function(t){return T(0,e.getContext())})).then(e.setContext).then((function(){i||(o=t(e).subscribe({next:r.next.bind(r),error:r.error.bind(r),complete:r.complete.bind(r)}))})).catch(r.error.bind(r)),function(){i=!0,o&&o.unsubscribe()}}))})));var T;const E=D((({graphQLErrors:e,networkError:t,operation:n,forward:r})=>{var o;if(e)for(let t of e)switch(console.log(t),null===(o=t.extensions)||void 0===o?void 0:o.code){case"UNAUTHENTICATED":return P||(localStorage.removeItem("user-jwt"),localStorage.removeItem("visitor-jwt")),r(n)}})),M=new e.ApolloClient({ssrMode:P,link:e.ApolloLink.from([E,C,A]),cache:x,connectToDevTools:!1});var I=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};function U(t,n,r){const{query:o,result:i,variables:u}=t,c=I(t,["query","result","variables"]),a=(0,e.useQuery)(o,Object.assign(Object.assign({variables:Object.assign(Object.assign({},u),n)},c),r)),{data:l,networkStatus:s,loading:d}=a,f=I(a,["data","networkStatus","loading"]),v=s?s<7:d,p=l&&i(l);return Object.assign({data:p,loading:v,initialLoading:d},f)}var N=i(297),B=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,c)}a((r=r.apply(e,t||[])).next())}))};function F(e,t,n){return B(this,void 0,void 0,(function*(){const{result:r,after:o,variables:i}=e,u=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["result","after","variables"]),c=Object.assign(Object.assign({},i),t),{data:a}=yield M.mutate(Object.assign(Object.assign({variables:c},u),n)),l=a&&r(a);return o&&(yield o(M.cache,null!=l?l:null,c)),l}))}const L={mutation:k.LogInDocument,result:e=>null==e?void 0:e.log_in,after(e,t){return B(this,void 0,void 0,(function*(){(null==t?void 0:t.success)&&t.jwt&&("undefined"!=typeof window&&localStorage.setItem("user-jwt",t.jwt),yield M.resetStore())}))}},Y={mutation:k.LogOutDocument,result:e=>null==e?void 0:e.log_out,after(e,t){return B(this,void 0,void 0,(function*(){(null==t?void 0:t.success)&&("undefined"!=typeof window&&localStorage.removeItem("user-jwt"),yield M.resetStore())}))}},R={mutation:k.VerifyPasswordResetDocument,result:e=>null==e?void 0:e.verify_password_reset},z={mutation:k.VerifySignUpDocument,result:e=>null==e?void 0:e.verify_sign_up},V={mutation:k.StartPasswordResetDocument,result:e=>null==e?void 0:e.start_password_reset},H={mutation:k.StartSignUpDocument,result:e=>null==e?void 0:e.start_sign_up},W={mutation:k.CreateAgencyDocument,result:e=>null==e?void 0:e.create_agency},$={mutation:k.UpdateAgencyDocument,result:e=>null==e?void 0:e.update_agency},G={mutation:k.CreateProductDocument,result:e=>null==e?void 0:e.create_product,after(e,t){return B(this,void 0,void 0,(function*(){if(!(null==t?void 0:t.success)||!t.product)return;const{product:n}=t;e.modify({id:e.identify(n.agency),fields:{products(t=[],{readField:r}){const o=e.writeFragment({data:n,fragment:k.ProductFragmentDoc,fragmentName:"product"});return t.some((e=>r("id",e)===n.id))?t:[...t,o]}}})}))}},J={mutation:k.UpdateProductDocument,result:e=>null==e?void 0:e.update_product},K={mutation:k.DeleteProductDocument,result:e=>null==e?void 0:e.delete_product,after(e,t){return B(this,void 0,void 0,(function*(){if(!(null==t?void 0:t.success)||!t.product)return;const n=e.identify(t.product);e.evict({id:n}),e.gc()}))}},X={mutation:k.CreateCustomerDocument,result:e=>null==e?void 0:e.create_customer,after(e,t){return B(this,void 0,void 0,(function*(){if(!(null==t?void 0:t.success)||!t.customer)return;const{customer:n}=t;e.modify({id:e.identify(n.stripe_account),fields:{customers(t=[],{readField:r}){const o=e.writeFragment({data:n,fragment:k.CustomerFragmentDoc,fragmentName:"customer"});return t.some((e=>r("id",e)===n.id))?t:[...t,o]}}})}))}},Z={mutation:k.UpdateCustomerDocument,result:e=>null==e?void 0:e.update_customer},ee={mutation:k.DeleteCustomerDocument,result:e=>null==e?void 0:e.delete_customer,after(e,t){return B(this,void 0,void 0,(function*(){if(!(null==t?void 0:t.success)||!t.customer)return;const n=e.identify(t.customer);e.evict({id:n}),e.gc()}))}},te={mutation:k.CreatePriceDocument,result:e=>null==e?void 0:e.create_price},ne={mutation:k.CreateAgencyThankYouPageSettingDocument,result:e=>null==e?void 0:e.create_agency_thank_you_page_setting,after(t,n,r){var o;return B(this,void 0,void 0,(function*(){if(!(null==n?void 0:n.success)||!n.setting)return;const{agency:i=null}=null!==(o=M.readQuery({query:k.AgencyThankYouPageSettingDocument,variables:{agency_id:r.agency_id}}))&&void 0!==o?o:{};(null==i?void 0:i.settings)&&t.modify({id:t.identify(i.settings),fields:{thank_you_page_setting:()=>t.writeFragment({data:n.setting,fragment:e.gql` | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@apollo/client"),require("@duely/core"),require("react")):"function"==typeof define&&define.amd?define(["@apollo/client","@duely/core","react"],t):"object"==typeof exports?exports["@duely/client"]=t(require("@apollo/client"),require("@duely/core"),require("react")):e["@duely/client"]=t(e["@apollo/client"],e["@duely/core"],e.react)}(this,(function(e,t,n){return(()=>{var r={329:(e,t,n)=>{e.exports=n(516).Observable},516:(e,t)=>{"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}t.Observable=void 0;var i=function(){return"function"==typeof Symbol},u=function(e){return i()&&Boolean(Symbol[e])},c=function(e){return u(e)?Symbol[e]:"@@"+e};i()&&!u("observable")&&(Symbol.observable=Symbol("observable"));var a=c("iterator"),l=c("observable"),s=c("species");function d(e,t){var n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function f(e){var t=e.constructor;return void 0!==t&&null===(t=t[s])&&(t=void 0),void 0!==t?t:O}function v(e){return e instanceof O}function p(e){p.log?p.log(e):setTimeout((function(){throw e}))}function _(e){Promise.resolve().then((function(){try{e()}catch(e){p(e)}}))}function y(e){var t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{var n=d(t,"unsubscribe");n&&n.call(t)}}catch(e){p(e)}}function g(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function m(e,t,n){e._state="running";var r=e._observer;try{var o=d(r,t);switch(t){case"next":o&&o.call(r,n);break;case"error":if(g(e),!o)throw n;o.call(r,n);break;case"complete":g(e),o&&o.call(r)}}catch(e){p(e)}"closed"===e._state?y(e):"running"===e._state&&(e._state="ready")}function b(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void _((function(){return function(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var n=0;n<t.length&&(m(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e)}))):void m(e,t,n);e._queue.push({type:t,value:n})}}var h=function(){function e(t,r){n(this,e),this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var o=new w(this);try{this._cleanup=r.call(void 0,o)}catch(e){o.error(e)}"initializing"===this._state&&(this._state="ready")}return o(e,[{key:"unsubscribe",value:function(){"closed"!==this._state&&(g(this),y(this))}},{key:"closed",get:function(){return"closed"===this._state}}]),e}(),w=function(){function e(t){n(this,e),this._subscription=t}return o(e,[{key:"next",value:function(e){b(this._subscription,"next",e)}},{key:"error",value:function(e){b(this._subscription,"error",e)}},{key:"complete",value:function(){b(this._subscription,"complete")}},{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),O=function(){function e(t){if(n(this,e),!(this instanceof e))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof t)throw new TypeError("Observable initializer must be a function");this._subscriber=t}return o(e,[{key:"subscribe",value:function(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new h(e,this._subscriber)}},{key:"forEach",value:function(e){var t=this;return new Promise((function(n,r){if("function"==typeof e)var o=t.subscribe({next:function(t){try{e(t,i)}catch(e){r(e),o.unsubscribe()}},error:r,complete:n});else r(new TypeError(e+" is not a function"));function i(){o.unsubscribe(),n()}}))}},{key:"map",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(f(this))((function(n){return t.subscribe({next:function(t){try{t=e(t)}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})}))}},{key:"filter",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(f(this))((function(n){return t.subscribe({next:function(t){try{if(!e(t))return}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})}))}},{key:"reduce",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=f(this),r=arguments.length>1,o=!1,i=arguments[1],u=i;return new n((function(n){return t.subscribe({next:function(t){var i=!o;if(o=!0,!i||r)try{u=e(u,t)}catch(e){return n.error(e)}else u=t},error:function(e){n.error(e)},complete:function(){if(!o&&!r)return n.error(new TypeError("Cannot reduce an empty sequence"));n.next(u),n.complete()}})}))}},{key:"concat",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=f(this);return new o((function(t){var r,i=0;return function e(u){r=u.subscribe({next:function(e){t.next(e)},error:function(e){t.error(e)},complete:function(){i===n.length?(r=void 0,t.complete()):e(o.from(n[i++]))}})}(e),function(){r&&(r.unsubscribe(),r=void 0)}}))}},{key:"flatMap",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=f(this);return new n((function(r){var o=[],i=t.subscribe({next:function(t){if(e)try{t=e(t)}catch(e){return r.error(e)}var i=n.from(t).subscribe({next:function(e){r.next(e)},error:function(e){r.error(e)},complete:function(){var e=o.indexOf(i);e>=0&&o.splice(e,1),u()}});o.push(i)},error:function(e){r.error(e)},complete:function(){u()}});function u(){i.closed&&0===o.length&&r.complete()}return function(){o.forEach((function(e){return e.unsubscribe()})),i.unsubscribe()}}))}},{key:l,value:function(){return this}}],[{key:"from",value:function(t){var n="function"==typeof this?this:e;if(null==t)throw new TypeError(t+" is not an object");var r=d(t,l);if(r){var o=r.call(t);if(Object(o)!==o)throw new TypeError(o+" is not an object");return v(o)&&o.constructor===n?o:new n((function(e){return o.subscribe(e)}))}if(u("iterator")&&(r=d(t,a)))return new n((function(e){_((function(){if(!e.closed){var n=!0,o=!1,i=void 0;try{for(var u,c=r.call(t)[Symbol.iterator]();!(n=(u=c.next()).done);n=!0){var a=u.value;if(e.next(a),e.closed)return}}catch(e){o=!0,i=e}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}e.complete()}}))}));if(Array.isArray(t))return new n((function(e){_((function(){if(!e.closed){for(var n=0;n<t.length;++n)if(e.next(t[n]),e.closed)return;e.complete()}}))}));throw new TypeError(t+" is not observable")}},{key:"of",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o="function"==typeof this?this:e;return new o((function(e){_((function(){if(!e.closed){for(var t=0;t<n.length;++t)if(e.next(n[t]),e.closed)return;e.complete()}}))}))}},{key:s,get:function(){return this}}]),e}();t.Observable=O,i()&&Object.defineProperty(O,Symbol("extensions"),{value:{symbol:l,hostReportError:p},configurable:!0})},74:t=>{"use strict";t.exports=e},620:e=>{"use strict";e.exports=t},297:e=>{"use strict";e.exports=n}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={exports:{}};return r[e](n,n.exports,i),n.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};return(()=>{"use strict";i.r(u),i.d(u,{agencies_Q:()=>Ce,agency_Q:()=>Qe,agency_customers_Q:()=>Ue,agency_pages_Q:()=>vt,agency_products_Q:()=>Ye,agency_stripe_account_Q:()=>Ae,agency_stripe_account_balance_Q:()=>Ee,agency_stripe_account_balance_transactions_Q:()=>Me,agency_stripe_account_payment_intents_Q:()=>Ie,agency_stripe_account_update_url_Q:()=>Te,agency_subscription_plan_Q:()=>pt,agency_thank_you_page_settings_Q:()=>dt,calculate_transaction_fee_Q:()=>Dt,client:()=>M,countries_Q:()=>qe,country_spec_Q:()=>Pe,create_agency_M:()=>W,create_agency_thank_you_page_setting_M:()=>ne,create_credential_M:()=>fe,create_customer_M:()=>X,create_integration_M:()=>pe,create_integration_config_M:()=>ye,create_page_block_M:()=>le,create_price_M:()=>te,create_product_M:()=>G,create_product_thank_you_page_setting_M:()=>re,credential_Q:()=>We,credential_type_Q:()=>Ge,credential_types_Q:()=>Je,credentials_Q:()=>$e,current_agency_Q:()=>at,current_agency_extended_Q:()=>lt,current_agency_stripe_account_update_url_Q:()=>st,current_subdomain_Q:()=>Le,current_user_Q:()=>ke,current_user_agencies_Q:()=>Be,customer_Q:()=>Ne,delete_agency_thank_you_page_setting_M:()=>ue,delete_customer_M:()=>ee,delete_page_block_M:()=>de,delete_product_M:()=>K,delete_product_thank_you_page_setting_M:()=>ce,form_field_Q:()=>Ve,form_fields_Q:()=>He,image_Q:()=>je,images_Q:()=>xe,integration_Q:()=>Ke,integration_config_Q:()=>Ze,integration_configs_Q:()=>et,integration_type_Q:()=>tt,integration_types_Q:()=>nt,integrations_Q:()=>Xe,log_in_M:()=>L,log_out_M:()=>Y,mutate:()=>F,order_Q:()=>rt,order_item_Q:()=>it,order_items_Q:()=>ut,orders_Q:()=>ot,page_Q:()=>_t,page_block_Q:()=>gt,page_block_definition_Q:()=>bt,page_block_definition_by_name_Q:()=>Ot,page_by_url_Q:()=>yt,page_definition_Q:()=>mt,page_definition_by_name_Q:()=>ht,page_definition_by_url_path_Q:()=>wt,product_Q:()=>Re,product_and_agency_from_url_parts_Q:()=>ct,product_thank_you_page_settings_Q:()=>ft,products_Q:()=>ze,query:()=>De,services_agreement_Q:()=>Se,start_password_reset_M:()=>V,start_sign_up_M:()=>H,subdomain_public_Q:()=>Fe,update_agency_M:()=>$,update_agency_thank_you_page_setting_M:()=>oe,update_credential_M:()=>ve,update_customer_M:()=>Z,update_integration_M:()=>_e,update_integration_config_M:()=>ge,update_page_M:()=>ae,update_page_block_M:()=>se,update_product_M:()=>J,update_product_thank_you_page_setting_M:()=>ie,useMutation:()=>Oe,useQuery:()=>U,verify_password_reset_M:()=>R,verify_sign_up_M:()=>z});var e=i(74),t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,n)};function n(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};Object.create,Object.create;var c="Invariant Violation",a=Object.setPrototypeOf,l=void 0===a?function(e,t){return e.__proto__=t,e}:a,s=function(e){function t(n){void 0===n&&(n=c);var r=e.call(this,"number"==typeof n?c+": "+n+" (see https://github.com/apollographql/invariant-packages)":n)||this;return r.framesToPop=1,r.name=c,l(r,t.prototype),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t}(Error);function d(e,t){if(!e)throw new s(t)}var f,v=["log","warn","error","silent"],p=v.indexOf("log");function _(e){return function(){if(v.indexOf(e)>=p)return console[e].apply(console,arguments)}}(f=d||(d={})).log=_("log"),f.warn=_("warn"),f.error=_("error");var y,g=i(329),m=i.n(g);function b(e,t){return t?t(e):m().of()}function h(e){return"function"==typeof e?new O(e):e}function w(e){return e.request.length<=1}n((function(e,t){var n=y.call(this,e)||this;return n.link=t,n}),y=Error);var O=function(){function e(e){e&&(this.request=e)}return e.empty=function(){return new e((function(){return m().of()}))},e.from=function(t){return 0===t.length?e.empty():t.map(h).reduce((function(e,t){return e.concat(t)}))},e.split=function(t,n,r){var o=h(n),i=h(r||new e(b));return w(o)&&w(i)?new e((function(e){return t(e)?o.request(e)||m().of():i.request(e)||m().of()})):new e((function(e,n){return t(e)?o.request(e,n)||m().of():i.request(e,n)||m().of()}))},e.execute=function(e,t){return e.request(function(e,t){var n=r({},e);return Object.defineProperty(t,"setContext",{enumerable:!1,value:function(e){n=r(r({},n),"function"==typeof e?e(n):e)}}),Object.defineProperty(t,"getContext",{enumerable:!1,value:function(){return r({},n)}}),t}(t.context,function(e){var t={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return t.operationName||(t.operationName="string"!=typeof t.query?t.query.definitions.filter((function(e){return"OperationDefinition"===e.kind&&e.name})).map((function(e){return e.name.value}))[0]||void 0:""),t}(function(e){for(var t=["query","operationName","variables","extensions","context"],n=0,r=Object.keys(e);n<r.length;n++){var o=r[n];if(t.indexOf(o)<0)throw new s(26)}return e}(t))))||m().of()},e.concat=function(t,n){var r=h(t);if(w(r))return r;var o=h(n);return w(o)?new e((function(e){return r.request(e,(function(e){return o.request(e)||m().of()}))||m().of()})):new e((function(e,t){return r.request(e,(function(e){return o.request(e,t)||m().of()}))||m().of()}))},e.prototype.split=function(t,n,r){return this.concat(e.split(t,n,r||new e(b)))},e.prototype.concat=function(t){return e.concat(this,t)},e.prototype.request=function(e,t){throw new s(21)},e.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},e.prototype.setOnError=function(e){return this.onError=e,this},e}();function D(e){return new O((function(t,n){return new(m())((function(r){var o,i,u;try{o=n(t).subscribe({next:function(o){o.errors&&(u=e({graphQLErrors:o.errors,response:o,operation:t,forward:n}))?i=u.subscribe({next:r.next.bind(r),error:r.error.bind(r),complete:r.complete.bind(r)}):r.next(o)},error:function(o){(u=e({operation:t,networkError:o,graphQLErrors:o&&o.result&&o.result.errors,forward:n}))?i=u.subscribe({next:r.next.bind(r),error:r.error.bind(r),complete:r.complete.bind(r)}):r.error(o)},complete:function(){u||r.complete.bind(r)()}})}catch(o){e({networkError:o,operation:t,forward:n}),r.error(o)}return function(){o&&o.unsubscribe(),i&&o.unsubscribe()}}))}))}!function(e){function t(t){var n=e.call(this)||this;return n.link=D(t),n}n(t,e),t.prototype.request=function(e,t){return this.link.request(e,t)}}(O);var k=i(620),q=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,c)}a((r=r.apply(e,t||[])).next())}))};const P="undefined"==typeof window;let j=P?()=>null:()=>(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("user-jwt"))||(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("visitor-jwt"));const x=new e.InMemoryCache({typePolicies:{}}),S=new e.HttpLink({uri:"https://api.duely.app/graphql"});let Q=null;const C=S,A=(T=(t,{headers:n})=>q(void 0,void 0,void 0,(function*(){let t=yield function(){return q(this,void 0,void 0,(function*(){let t=j();return t||(Q||(Q=(0,e.toPromise)(e.ApolloLink.execute(S,{query:k.BeginVisitDocument})).then((({data:n})=>q(this,void 0,void 0,(function*(){if(!(null==n?void 0:n.begin_visit.success))throw Error(null==n?void 0:n.begin_visit.message);{const r=n.begin_visit.jwt;if(P){const{data:n}=yield(0,e.toPromise)(e.ApolloLink.execute(S,{query:k.LogInDocument,variables:{email_address:"serviceaccount@duely.app",password:process.env.DUELY_SERVICE_ACCOUNT_PASSWORD},context:{headers:{authorization:`Bearer ${r}`}}}));(null==n?void 0:n.log_in.success)?(t=n.log_in.jwt,j=()=>t):console.error(null==n?void 0:n.log_in.message)}else localStorage.setItem("visitor-jwt",r)}}))))),yield Q,j())}))}();return t?{headers:Object.assign(Object.assign({},n),{authorization:`Bearer ${t}`})}:{}})),new O((function(e,t){var n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,[]);return new(m())((function(r){var o,i=!1;return Promise.resolve(n).then((function(t){return T(0,e.getContext())})).then(e.setContext).then((function(){i||(o=t(e).subscribe({next:r.next.bind(r),error:r.error.bind(r),complete:r.complete.bind(r)}))})).catch(r.error.bind(r)),function(){i=!0,o&&o.unsubscribe()}}))})));var T;const E=D((({graphQLErrors:e,networkError:t,operation:n,forward:r})=>{var o;if(e)for(let t of e)switch(console.log(t),null===(o=t.extensions)||void 0===o?void 0:o.code){case"UNAUTHENTICATED":return P||(localStorage.removeItem("user-jwt"),localStorage.removeItem("visitor-jwt")),r(n)}})),M=new e.ApolloClient({ssrMode:P,link:e.ApolloLink.from([E,A,C]),cache:x,connectToDevTools:!1});var I=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};function U(t,n,r){const{query:o,result:i,variables:u}=t,c=I(t,["query","result","variables"]),a=(0,e.useQuery)(o,Object.assign(Object.assign({variables:Object.assign(Object.assign({},u),n)},c),r)),{data:l,networkStatus:s,loading:d}=a,f=I(a,["data","networkStatus","loading"]),v=s?s<7:d,p=l&&i(l);return Object.assign({data:p,loading:v,initialLoading:d},f)}var N=i(297),B=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,c)}a((r=r.apply(e,t||[])).next())}))};function F(e,t,n){return B(this,void 0,void 0,(function*(){const{result:r,after:o,variables:i}=e,u=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["result","after","variables"]),c=Object.assign(Object.assign({},i),t),{data:a}=yield M.mutate(Object.assign(Object.assign({variables:c},u),n)),l=a&&r(a);return o&&(yield o(M.cache,null!=l?l:null,c)),l}))}const L={mutation:k.LogInDocument,result:e=>null==e?void 0:e.log_in,after(e,t){return B(this,void 0,void 0,(function*(){(null==t?void 0:t.success)&&t.jwt&&("undefined"!=typeof window&&localStorage.setItem("user-jwt",t.jwt),yield M.resetStore())}))}},Y={mutation:k.LogOutDocument,result:e=>null==e?void 0:e.log_out,after(e,t){return B(this,void 0,void 0,(function*(){(null==t?void 0:t.success)&&("undefined"!=typeof window&&localStorage.removeItem("user-jwt"),yield M.resetStore())}))}},R={mutation:k.VerifyPasswordResetDocument,result:e=>null==e?void 0:e.verify_password_reset},z={mutation:k.VerifySignUpDocument,result:e=>null==e?void 0:e.verify_sign_up},V={mutation:k.StartPasswordResetDocument,result:e=>null==e?void 0:e.start_password_reset},H={mutation:k.StartSignUpDocument,result:e=>null==e?void 0:e.start_sign_up},W={mutation:k.CreateAgencyDocument,result:e=>null==e?void 0:e.create_agency},$={mutation:k.UpdateAgencyDocument,result:e=>null==e?void 0:e.update_agency},G={mutation:k.CreateProductDocument,result:e=>null==e?void 0:e.create_product,after(e,t){return B(this,void 0,void 0,(function*(){if(!(null==t?void 0:t.success)||!t.product)return;const{product:n}=t;e.modify({id:e.identify(n.agency),fields:{products(t=[],{readField:r}){const o=e.writeFragment({data:n,fragment:k.ProductFragmentDoc,fragmentName:"product"});return t.some((e=>r("id",e)===n.id))?t:[...t,o]}}})}))}},J={mutation:k.UpdateProductDocument,result:e=>null==e?void 0:e.update_product},K={mutation:k.DeleteProductDocument,result:e=>null==e?void 0:e.delete_product,after(e,t){return B(this,void 0,void 0,(function*(){if(!(null==t?void 0:t.success)||!t.product)return;const n=e.identify(t.product);e.evict({id:n}),e.gc()}))}},X={mutation:k.CreateCustomerDocument,result:e=>null==e?void 0:e.create_customer,after(e,t){return B(this,void 0,void 0,(function*(){if(!(null==t?void 0:t.success)||!t.customer)return;const{customer:n}=t;e.modify({id:e.identify(n.stripe_account),fields:{customers(t=[],{readField:r}){const o=e.writeFragment({data:n,fragment:k.CustomerFragmentDoc,fragmentName:"customer"});return t.some((e=>r("id",e)===n.id))?t:[...t,o]}}})}))}},Z={mutation:k.UpdateCustomerDocument,result:e=>null==e?void 0:e.update_customer},ee={mutation:k.DeleteCustomerDocument,result:e=>null==e?void 0:e.delete_customer,after(e,t){return B(this,void 0,void 0,(function*(){if(!(null==t?void 0:t.success)||!t.customer)return;const n=e.identify(t.customer);e.evict({id:n}),e.gc()}))}},te={mutation:k.CreatePriceDocument,result:e=>null==e?void 0:e.create_price},ne={mutation:k.CreateAgencyThankYouPageSettingDocument,result:e=>null==e?void 0:e.create_agency_thank_you_page_setting,after(t,n,r){var o;return B(this,void 0,void 0,(function*(){if(!(null==n?void 0:n.success)||!n.setting)return;const{agency:i=null}=null!==(o=M.readQuery({query:k.AgencyThankYouPageSettingDocument,variables:{agency_id:r.agency_id}}))&&void 0!==o?o:{};(null==i?void 0:i.settings)&&t.modify({id:t.identify(i.settings),fields:{thank_you_page_setting:()=>t.writeFragment({data:n.setting,fragment:e.gql` | ||
fragment agency_thank_you_page_setting on AgencyThankYouPageSetting { | ||
@@ -11,3 +11,3 @@ id | ||
} | ||
`,fragmentName:"product_thank_you_page_setting"})}})}))}},oe={mutation:k.UpdateAgencyThankYouPageSettingDocument,result:e=>null==e?void 0:e.update_agency_thank_you_page_setting},ie={mutation:k.UpdateProductThankYouPageSettingDocument,result:e=>null==e?void 0:e.update_product_thank_you_page_setting},ue={mutation:k.DeleteAgencyThankYouPageSettingDocument,result:e=>null==e?void 0:e.delete_agency_thank_you_page_setting,after(e,t){return B(this,void 0,void 0,(function*(){if(!(null==t?void 0:t.success)||!t.setting)return;const n=e.identify(t.setting);e.evict({id:n}),e.gc()}))}},ce={mutation:k.DeleteProductThankYouPageSettingDocument,result:e=>null==e?void 0:e.delete_product_thank_you_page_setting,after(e,t){return B(this,void 0,void 0,(function*(){if(!(null==t?void 0:t.success)||!t.setting)return;const n=e.identify(t.setting);e.evict({id:n}),e.gc()}))}},ae={mutation:k.UpdatePageDocument,result:e=>null==e?void 0:e.update_page},le={mutation:k.CreatePageBlockDocument,result:e=>null==e?void 0:e.create_page_block,after(e,t){return B(this,void 0,void 0,(function*(){if(!(null==t?void 0:t.success)||!t.page_block)return;const{page_block:n}=t;e.modify({id:e.identify(n.page),fields:{blocks(t=[],{readField:r}){const o=e.writeFragment({data:n,fragment:k.Page_BlockFragmentDoc,fragmentName:"page_block"});return t.some((e=>r("id",e)===n.id))?t:[...t,o]}}})}))}},se={mutation:k.UpdatePageBlockDocument,result:e=>null==e?void 0:e.update_page_block},de={mutation:k.DeletePageBlockDocument,result:e=>null==e?void 0:e.delete_page_block,after(e,t){return B(this,void 0,void 0,(function*(){if(!(null==t?void 0:t.success)||!t.page_block)return;const n=e.identify(t.page_block);e.evict({id:n}),e.gc()}))}},fe={mutation:k.CreateIntegrationDocument,result:e=>null==e?void 0:e.create_integration},ve={mutation:k.UpdateIntegrationDocument,result:e=>null==e?void 0:e.update_integration},pe={mutation:k.CreateIntegrationConfigDocument,result:e=>null==e?void 0:e.create_integration_config},_e={mutation:k.UpdateIntegrationConfigDocument,result:e=>null==e?void 0:e.update_integration_config};const ge={loading:!1,error:void 0,data:void 0},ye={loading:!0,error:void 0,data:void 0},me=e=>({loading:!1,error:e,data:void 0}),be={resetErrorMs:6e3};function he(e,t){const n=(0,N.useRef)(0),{resetErrorMs:r}=Object.assign(Object.assign({},be),t),[o,i]=(0,N.useState)(ge);return[(0,N.useCallback)(((t,o)=>{return u=this,c=void 0,l=function*(){n.current&&(clearTimeout(n.current),n.current=0),i(ye);try{const u=yield F(e,t,o);return u&&!u.success?(i(me(u)),r>0&&(n.current=window.setTimeout((()=>i(ge)),r))):i({loading:!1,error:void 0,data:u}),u}catch(e){return i(me(e)),r>0&&(n.current=window.setTimeout((()=>i(ge)),r)),null}},new((a=void 0)||(a=Promise))((function(e,t){function n(e){try{o(l.next(e))}catch(e){t(e)}}function r(e){try{o(l.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):(o=t.value,o instanceof a?o:new a((function(e){e(o)}))).then(n,r)}o((l=l.apply(u,c||[])).next())}));var u,c,a,l}),[e,r]),o]}function we(e,t,n){return r=this,o=void 0,u=function*(){const{result:r,variables:o}=e,i=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["result","variables"]),u=Object.assign(Object.assign({},o),t),{data:c}=yield M.query(Object.assign(Object.assign({variables:u},i),n));return r(c)},new((i=void 0)||(i=Promise))((function(e,t){function n(e){try{a(u.next(e))}catch(e){t(e)}}function c(e){try{a(u.throw(e))}catch(e){t(e)}}function a(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(n,c)}a((u=u.apply(r,o||[])).next())}));var r,o,i,u}const Oe={query:k.CurrentUserDocument,notifyOnNetworkStatusChange:!0,result:e=>null==e?void 0:e.current_user},De={query:k.CountriesDocument,result:e=>{var t;return null===(t=null==e?void 0:e.country_codes)||void 0===t?void 0:t.map((e=>k.CountryUtil.fromCode(e)))}},ke={query:k.CountrySpecDocument,result:e=>null==e?void 0:e.country_spec},qe={query:k.ImageDocument,result:e=>null==e?void 0:e.image},Pe={query:k.ImagesDocument,result:e=>null==e?void 0:e.images},je={query:k.ServicesAgreementDocument,result:e=>{var t,n;return null===(n=null===(t=null==e?void 0:e.markdowns)||void 0===t?void 0:t[0])||void 0===n?void 0:n.data}},xe={query:k.AgencyDocument,result:e=>null==e?void 0:e.agency},Se={query:k.AgenciesDocument,result:e=>null==e?void 0:e.agencies},Qe={query:k.AgencyStripeAccountDocument,result:e=>{var t;return null===(t=null==e?void 0:e.agency)||void 0===t?void 0:t.stripe_account}},Ae={query:k.AgencyStripeAccountUpdateUrlDocument,fetchPolicy:"no-cache",result:e=>{var t,n,r;return null===(r=null===(n=null===(t=null==e?void 0:e.agency)||void 0===t?void 0:t.stripe_account)||void 0===n?void 0:n.account_update_url)||void 0===r?void 0:r.url}},Ce={query:k.AgencyStripeAccountBalanceDocument,result:e=>{var t,n;return null===(n=null===(t=null==e?void 0:e.agency)||void 0===t?void 0:t.stripe_account)||void 0===n?void 0:n.balance}},Te={query:k.AgencyStripeAccountBalanceTransactionsDocument,result:e=>{var t,n;return null===(n=null===(t=null==e?void 0:e.agency)||void 0===t?void 0:t.stripe_account)||void 0===n?void 0:n.balance_transactions}},Ee={query:k.AgencyStripeAccountPaymentIntentsDocument,result:e=>{var t,n;return null===(n=null===(t=null==e?void 0:e.agency)||void 0===t?void 0:t.stripe_account)||void 0===n?void 0:n.payment_intents}},Me={query:k.AgencyCustomersDocument,result:e=>{var t,n;return null===(n=null===(t=null==e?void 0:e.agency)||void 0===t?void 0:t.stripe_account)||void 0===n?void 0:n.customers}},Ie={query:k.CustomerDocument,result:e=>null==e?void 0:e.customer},Ue={query:k.CurrentUserAgenciesDocument,notifyOnNetworkStatusChange:!0,result:e=>{var t;return null===(t=null==e?void 0:e.current_user)||void 0===t?void 0:t.memberships.map((e=>Object.assign(Object.assign({},e.subdomain.agency),{subdomain:e.subdomain})))}},Ne={query:k.SubdomainPublicDocument,result:e=>{var t;return null===(t=null==e?void 0:e.subdomains)||void 0===t?void 0:t[0]}},Be=Object.assign(Object.assign({},Ne),{variables:{subdomain_name:function(){var e,t;const n=new URL(window.location.href),r=n.hostname.toLowerCase();if("localhost"===r||function(e){var t=e.split(".").map((e=>parseInt(e,10)));return 4===t.length&&!t.some(isNaN)&&(10===t[0]||172===t[0]&&t[1]>=16&&t[1]<=31||192===t[0]&&168===t[1])}(r)){let r=null!==(t=null===(e=n.searchParams.get("subdomain"))||void 0===e?void 0:e.toLowerCase())&&void 0!==t?t:null;return null!==r?(sessionStorage.setItem("development-subdomain",r),r):sessionStorage.getItem("development-subdomain")}if("duely.app"!==r){if(r.endsWith(".duely.app"))return r.slice(0,-".duely.app".length);throw new Error("Not implemented.")}return null}()}}),Fe={query:k.AgencyProductsDocument,result:e=>{var t;return null===(t=null==e?void 0:e.agency)||void 0===t?void 0:t.products}},Le={query:k.ProductDocument,result:e=>null==e?void 0:e.product},Ye={query:k.ProductsDocument,result:e=>null==e?void 0:e.products},Re={query:k.FormFieldDocument,result:e=>null==e?void 0:e.form_field},ze={query:k.FormFieldsDocument,result:e=>null==e?void 0:e.form_fields},Ve={query:k.IntegrationDocument,result:e=>null==e?void 0:e.integration},He={query:k.IntegrationsDocument,result:e=>null==e?void 0:e.integrations},We={query:k.IntegrationConfigDocument,result:e=>null==e?void 0:e.integration_config},$e={query:k.IntegrationConfigsDocument,result:e=>null==e?void 0:e.integration_configs},Ge={query:k.IntegrationTypeDocument,result:e=>null==e?void 0:e.integration_type},Je={query:k.IntegrationTypesDocument,result:e=>null==e?void 0:e.integration_types},Ke={query:k.OrderDocument,result:e=>null==e?void 0:e.order},Xe={query:k.OrdersDocument,result:e=>null==e?void 0:e.orders},Ze={query:k.OrderItemDocument,result:e=>null==e?void 0:e.order_item},et={query:k.OrderItemsDocument,result:e=>null==e?void 0:e.order_items},tt={query:k.ProductAndAgencyFromUrlPartsDocument,result:e=>{var t,n,r;return null===(r=null===(n=null===(t=null==e?void 0:e.subdomains)||void 0===t?void 0:t[0])||void 0===n?void 0:n.agency.products)||void 0===r?void 0:r[0]}},nt=Object.assign(Object.assign({},Be),{query:k.SubdomainAgencyDocument,result:e=>{var t,n;return null===(n=null===(t=null==e?void 0:e.subdomains)||void 0===t?void 0:t[0])||void 0===n?void 0:n.agency}}),rt=Object.assign(Object.assign({},Be),{query:k.SubdomainAgencyExtendedDocument,result:e=>{var t,n;return null===(n=null===(t=null==e?void 0:e.subdomains)||void 0===t?void 0:t[0])||void 0===n?void 0:n.agency}}),ot=Object.assign(Object.assign({},Be),{query:k.SubdomainAgencyStripeAccountUpdateUrlDocument,fetchPolicy:"no-cache",result:e=>{var t,n,r,o,i;return null===(i=null===(o=null===(r=null===(n=null===(t=null==e?void 0:e.subdomains)||void 0===t?void 0:t[0])||void 0===n?void 0:n.agency)||void 0===r?void 0:r.stripe_account)||void 0===o?void 0:o.account_update_url)||void 0===i?void 0:i.url}}),it={query:k.AgencyThankYouPageSettingDocument,result:e=>{var t,n;return null===(n=null===(t=null==e?void 0:e.agency)||void 0===t?void 0:t.settings)||void 0===n?void 0:n.thank_you_page_setting}},ut={query:k.ProductThankYouPageSettingDocument,result:e=>{var t,n;return null===(n=null===(t=null==e?void 0:e.product)||void 0===t?void 0:t.settings)||void 0===n?void 0:n.thank_you_page_setting}},ct={query:k.AgencyPagesDocument,result:e=>null==e?void 0:e.pages},at={query:k.AgencySubscriptionPlanDocument,result:e=>{var t;return null===(t=null==e?void 0:e.agency)||void 0===t?void 0:t.subscription_plan}},lt={query:k.PageDocument,result:e=>null==e?void 0:e.page},st={query:k.PageByUrlDocument,result:e=>null==e?void 0:e.page_by_url},dt={query:k.PageBlockDocument,result:e=>null==e?void 0:e.page_block},ft={query:k.PageDefinitionDocument,result:e=>null==e?void 0:e.page_definition},vt={query:k.PageBlockDefinitionDocument,result:e=>null==e?void 0:e.page_block_definition},pt={query:k.PageDefinitionsByNameDocument,result:e=>{var t;return null===(t=null==e?void 0:e.page_definitions)||void 0===t?void 0:t[0]}},_t={query:k.PageDefinitionByUrlPathDocument,result:e=>null==e?void 0:e.page_definition_by_url_path},gt={query:k.PageBlockDefinitionsByNameDocument,result:e=>{var t;return null===(t=null==e?void 0:e.page_block_definitions)||void 0===t?void 0:t[0]}},yt={query:k.CalculateTransactionFeeDocument,result:e=>{var t;return null===(t=null==e?void 0:e.subscription_plan)||void 0===t?void 0:t.calculate_fee}}})(),u})()})); | ||
`,fragmentName:"product_thank_you_page_setting"})}})}))}},oe={mutation:k.UpdateAgencyThankYouPageSettingDocument,result:e=>null==e?void 0:e.update_agency_thank_you_page_setting},ie={mutation:k.UpdateProductThankYouPageSettingDocument,result:e=>null==e?void 0:e.update_product_thank_you_page_setting},ue={mutation:k.DeleteAgencyThankYouPageSettingDocument,result:e=>null==e?void 0:e.delete_agency_thank_you_page_setting,after(e,t){return B(this,void 0,void 0,(function*(){if(!(null==t?void 0:t.success)||!t.setting)return;const n=e.identify(t.setting);e.evict({id:n}),e.gc()}))}},ce={mutation:k.DeleteProductThankYouPageSettingDocument,result:e=>null==e?void 0:e.delete_product_thank_you_page_setting,after(e,t){return B(this,void 0,void 0,(function*(){if(!(null==t?void 0:t.success)||!t.setting)return;const n=e.identify(t.setting);e.evict({id:n}),e.gc()}))}},ae={mutation:k.UpdatePageDocument,result:e=>null==e?void 0:e.update_page},le={mutation:k.CreatePageBlockDocument,result:e=>null==e?void 0:e.create_page_block,after(e,t){return B(this,void 0,void 0,(function*(){if(!(null==t?void 0:t.success)||!t.page_block)return;const{page_block:n}=t;e.modify({id:e.identify(n.page),fields:{blocks(t=[],{readField:r}){const o=e.writeFragment({data:n,fragment:k.Page_BlockFragmentDoc,fragmentName:"page_block"});return t.some((e=>r("id",e)===n.id))?t:[...t,o]}}})}))}},se={mutation:k.UpdatePageBlockDocument,result:e=>null==e?void 0:e.update_page_block},de={mutation:k.DeletePageBlockDocument,result:e=>null==e?void 0:e.delete_page_block,after(e,t){return B(this,void 0,void 0,(function*(){if(!(null==t?void 0:t.success)||!t.page_block)return;const n=e.identify(t.page_block);e.evict({id:n}),e.gc()}))}},fe={mutation:k.CreateCredentialDocument,result:e=>null==e?void 0:e.create_credential},ve={mutation:k.UpdateCredentialDocument,result:e=>null==e?void 0:e.update_credential},pe={mutation:k.CreateIntegrationDocument,result:e=>null==e?void 0:e.create_integration},_e={mutation:k.UpdateIntegrationDocument,result:e=>null==e?void 0:e.update_integration},ye={mutation:k.CreateIntegrationConfigDocument,result:e=>null==e?void 0:e.create_integration_config},ge={mutation:k.UpdateIntegrationConfigDocument,result:e=>null==e?void 0:e.update_integration_config};const me={loading:!1,error:void 0,data:void 0},be={loading:!0,error:void 0,data:void 0},he=e=>({loading:!1,error:e,data:void 0}),we={resetErrorMs:6e3};function Oe(e,t){const n=(0,N.useRef)(0),{resetErrorMs:r}=Object.assign(Object.assign({},we),t),[o,i]=(0,N.useState)(me);return[(0,N.useCallback)(((t,o)=>{return u=this,c=void 0,l=function*(){n.current&&(clearTimeout(n.current),n.current=0),i(be);try{const u=yield F(e,t,o);return u&&!u.success?(i(he(u)),r>0&&(n.current=window.setTimeout((()=>i(me)),r))):i({loading:!1,error:void 0,data:u}),u}catch(e){return i(he(e)),r>0&&(n.current=window.setTimeout((()=>i(me)),r)),null}},new((a=void 0)||(a=Promise))((function(e,t){function n(e){try{o(l.next(e))}catch(e){t(e)}}function r(e){try{o(l.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):(o=t.value,o instanceof a?o:new a((function(e){e(o)}))).then(n,r)}o((l=l.apply(u,c||[])).next())}));var u,c,a,l}),[e,r]),o]}function De(e,t,n){return r=this,o=void 0,u=function*(){const{result:r,variables:o}=e,i=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["result","variables"]),u=Object.assign(Object.assign({},o),t),{data:c}=yield M.query(Object.assign(Object.assign({variables:u},i),n));return r(c)},new((i=void 0)||(i=Promise))((function(e,t){function n(e){try{a(u.next(e))}catch(e){t(e)}}function c(e){try{a(u.throw(e))}catch(e){t(e)}}function a(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(n,c)}a((u=u.apply(r,o||[])).next())}));var r,o,i,u}const ke={query:k.CurrentUserDocument,notifyOnNetworkStatusChange:!0,result:e=>null==e?void 0:e.current_user},qe={query:k.CountriesDocument,result:e=>{var t;return null===(t=null==e?void 0:e.country_codes)||void 0===t?void 0:t.map((e=>k.CountryUtil.fromCode(e)))}},Pe={query:k.CountrySpecDocument,result:e=>null==e?void 0:e.country_spec},je={query:k.ImageDocument,result:e=>null==e?void 0:e.image},xe={query:k.ImagesDocument,result:e=>null==e?void 0:e.images},Se={query:k.ServicesAgreementDocument,result:e=>{var t,n;return null===(n=null===(t=null==e?void 0:e.markdowns)||void 0===t?void 0:t[0])||void 0===n?void 0:n.data}},Qe={query:k.AgencyDocument,result:e=>null==e?void 0:e.agency},Ce={query:k.AgenciesDocument,result:e=>null==e?void 0:e.agencies},Ae={query:k.AgencyStripeAccountDocument,result:e=>{var t;return null===(t=null==e?void 0:e.agency)||void 0===t?void 0:t.stripe_account}},Te={query:k.AgencyStripeAccountUpdateUrlDocument,fetchPolicy:"no-cache",result:e=>{var t,n,r;return null===(r=null===(n=null===(t=null==e?void 0:e.agency)||void 0===t?void 0:t.stripe_account)||void 0===n?void 0:n.account_update_url)||void 0===r?void 0:r.url}},Ee={query:k.AgencyStripeAccountBalanceDocument,result:e=>{var t,n;return null===(n=null===(t=null==e?void 0:e.agency)||void 0===t?void 0:t.stripe_account)||void 0===n?void 0:n.balance}},Me={query:k.AgencyStripeAccountBalanceTransactionsDocument,result:e=>{var t,n;return null===(n=null===(t=null==e?void 0:e.agency)||void 0===t?void 0:t.stripe_account)||void 0===n?void 0:n.balance_transactions}},Ie={query:k.AgencyStripeAccountPaymentIntentsDocument,result:e=>{var t,n;return null===(n=null===(t=null==e?void 0:e.agency)||void 0===t?void 0:t.stripe_account)||void 0===n?void 0:n.payment_intents}},Ue={query:k.AgencyCustomersDocument,result:e=>{var t,n;return null===(n=null===(t=null==e?void 0:e.agency)||void 0===t?void 0:t.stripe_account)||void 0===n?void 0:n.customers}},Ne={query:k.CustomerDocument,result:e=>null==e?void 0:e.customer},Be={query:k.CurrentUserAgenciesDocument,notifyOnNetworkStatusChange:!0,result:e=>{var t;return null===(t=null==e?void 0:e.current_user)||void 0===t?void 0:t.memberships.map((e=>Object.assign(Object.assign({},e.subdomain.agency),{subdomain:e.subdomain})))}},Fe={query:k.SubdomainPublicDocument,result:e=>{var t;return null===(t=null==e?void 0:e.subdomains)||void 0===t?void 0:t[0]}},Le=Object.assign(Object.assign({},Fe),{variables:{subdomain_name:function(){var e,t;const n=new URL(window.location.href),r=n.hostname.toLowerCase();if("localhost"===r||function(e){var t=e.split(".").map((e=>parseInt(e,10)));return 4===t.length&&!t.some(isNaN)&&(10===t[0]||172===t[0]&&t[1]>=16&&t[1]<=31||192===t[0]&&168===t[1])}(r)){let r=null!==(t=null===(e=n.searchParams.get("subdomain"))||void 0===e?void 0:e.toLowerCase())&&void 0!==t?t:null;return null!==r?(sessionStorage.setItem("development-subdomain",r),r):sessionStorage.getItem("development-subdomain")}if("duely.app"!==r){if(r.endsWith(".duely.app"))return r.slice(0,-".duely.app".length);throw new Error("Not implemented.")}return null}()}}),Ye={query:k.AgencyProductsDocument,result:e=>{var t;return null===(t=null==e?void 0:e.agency)||void 0===t?void 0:t.products}},Re={query:k.ProductDocument,result:e=>null==e?void 0:e.product},ze={query:k.ProductsDocument,result:e=>null==e?void 0:e.products},Ve={query:k.FormFieldDocument,result:e=>null==e?void 0:e.form_field},He={query:k.FormFieldsDocument,result:e=>null==e?void 0:e.form_fields},We={query:k.CredentialDocument,result:e=>null==e?void 0:e.credential},$e={query:k.CredentialsDocument,result:e=>null==e?void 0:e.credentials},Ge={query:k.CredentialTypeDocument,result:e=>null==e?void 0:e.credential_type},Je={query:k.CredentialTypesDocument,result:e=>null==e?void 0:e.credential_types},Ke={query:k.IntegrationDocument,result:e=>null==e?void 0:e.integration},Xe={query:k.IntegrationsDocument,result:e=>null==e?void 0:e.integrations},Ze={query:k.IntegrationConfigDocument,result:e=>null==e?void 0:e.integration_config},et={query:k.IntegrationConfigsDocument,result:e=>null==e?void 0:e.integration_configs},tt={query:k.IntegrationTypeDocument,result:e=>null==e?void 0:e.integration_type},nt={query:k.IntegrationTypesDocument,result:e=>null==e?void 0:e.integration_types},rt={query:k.OrderDocument,result:e=>null==e?void 0:e.order},ot={query:k.OrdersDocument,result:e=>null==e?void 0:e.orders},it={query:k.OrderItemDocument,result:e=>null==e?void 0:e.order_item},ut={query:k.OrderItemsDocument,result:e=>null==e?void 0:e.order_items},ct={query:k.ProductAndAgencyFromUrlPartsDocument,result:e=>{var t,n,r;return null===(r=null===(n=null===(t=null==e?void 0:e.subdomains)||void 0===t?void 0:t[0])||void 0===n?void 0:n.agency.products)||void 0===r?void 0:r[0]}},at=Object.assign(Object.assign({},Le),{query:k.SubdomainAgencyDocument,result:e=>{var t,n;return null===(n=null===(t=null==e?void 0:e.subdomains)||void 0===t?void 0:t[0])||void 0===n?void 0:n.agency}}),lt=Object.assign(Object.assign({},Le),{query:k.SubdomainAgencyExtendedDocument,result:e=>{var t,n;return null===(n=null===(t=null==e?void 0:e.subdomains)||void 0===t?void 0:t[0])||void 0===n?void 0:n.agency}}),st=Object.assign(Object.assign({},Le),{query:k.SubdomainAgencyStripeAccountUpdateUrlDocument,fetchPolicy:"no-cache",result:e=>{var t,n,r,o,i;return null===(i=null===(o=null===(r=null===(n=null===(t=null==e?void 0:e.subdomains)||void 0===t?void 0:t[0])||void 0===n?void 0:n.agency)||void 0===r?void 0:r.stripe_account)||void 0===o?void 0:o.account_update_url)||void 0===i?void 0:i.url}}),dt={query:k.AgencyThankYouPageSettingDocument,result:e=>{var t,n;return null===(n=null===(t=null==e?void 0:e.agency)||void 0===t?void 0:t.settings)||void 0===n?void 0:n.thank_you_page_setting}},ft={query:k.ProductThankYouPageSettingDocument,result:e=>{var t,n;return null===(n=null===(t=null==e?void 0:e.product)||void 0===t?void 0:t.settings)||void 0===n?void 0:n.thank_you_page_setting}},vt={query:k.AgencyPagesDocument,result:e=>null==e?void 0:e.pages},pt={query:k.AgencySubscriptionPlanDocument,result:e=>{var t;return null===(t=null==e?void 0:e.agency)||void 0===t?void 0:t.subscription_plan}},_t={query:k.PageDocument,result:e=>null==e?void 0:e.page},yt={query:k.PageByUrlDocument,result:e=>null==e?void 0:e.page_by_url},gt={query:k.PageBlockDocument,result:e=>null==e?void 0:e.page_block},mt={query:k.PageDefinitionDocument,result:e=>null==e?void 0:e.page_definition},bt={query:k.PageBlockDefinitionDocument,result:e=>null==e?void 0:e.page_block_definition},ht={query:k.PageDefinitionsByNameDocument,result:e=>{var t;return null===(t=null==e?void 0:e.page_definitions)||void 0===t?void 0:t[0]}},wt={query:k.PageDefinitionByUrlPathDocument,result:e=>null==e?void 0:e.page_definition_by_url_path},Ot={query:k.PageBlockDefinitionsByNameDocument,result:e=>{var t;return null===(t=null==e?void 0:e.page_block_definitions)||void 0===t?void 0:t[0]}},Dt={query:k.CalculateTransactionFeeDocument,result:e=>{var t;return null===(t=null==e?void 0:e.subscription_plan)||void 0===t?void 0:t.calculate_fee}}})(),u})()})); | ||
//# sourceMappingURL=index.js.map |
import { ApolloCache, MutationOptions, NormalizedCacheObject } from '@apollo/client'; | ||
import { CreateAgencyDocument, CreateAgencyThankYouPageSettingDocument, CreateCustomerDocument, CreateIntegrationConfigDocument, CreateIntegrationDocument, CreatePageBlockDocument, CreatePriceDocument, CreateProductDocument, CreateProductThankYouPageSettingDocument, DeleteAgencyThankYouPageSettingDocument, DeleteCustomerDocument, DeletePageBlockDocument, DeleteProductDocument, DeleteProductThankYouPageSettingDocument, LogInDocument, LogOutDocument, StartPasswordResetDocument, StartSignUpDocument, UpdateAgencyDocument, UpdateAgencyThankYouPageSettingDocument, UpdateCustomerDocument, UpdateIntegrationConfigDocument, UpdateIntegrationDocument, UpdatePageBlockDocument, UpdatePageDocument, UpdateProductDocument, UpdateProductThankYouPageSettingDocument, VerifyPasswordResetDocument, VerifySignUpDocument } from '@duely/core'; | ||
import { CreateAgencyDocument, CreateAgencyThankYouPageSettingDocument, CreateCredentialDocument, CreateCustomerDocument, CreateIntegrationConfigDocument, CreateIntegrationDocument, CreatePageBlockDocument, CreatePriceDocument, CreateProductDocument, CreateProductThankYouPageSettingDocument, DeleteAgencyThankYouPageSettingDocument, DeleteCustomerDocument, DeletePageBlockDocument, DeleteProductDocument, DeleteProductThankYouPageSettingDocument, LogInDocument, LogOutDocument, StartPasswordResetDocument, StartSignUpDocument, UpdateAgencyDocument, UpdateAgencyThankYouPageSettingDocument, UpdateCredentialDocument, UpdateCustomerDocument, UpdateIntegrationConfigDocument, UpdateIntegrationDocument, UpdatePageBlockDocument, UpdatePageDocument, UpdateProductDocument, UpdateProductThankYouPageSettingDocument, VerifyPasswordResetDocument, VerifySignUpDocument } from '@duely/core'; | ||
import { ResultOf, TypedDocumentNode, VariablesOf } from '@graphql-typed-document-node/core'; | ||
@@ -788,2 +788,64 @@ export interface TypedMutationOptions<TDocumentNode extends TypedDocumentNode<unknown, unknown>> extends MutationOptions<ResultOf<TDocumentNode>, VariablesOf<TDocumentNode>> { | ||
}; | ||
export declare const create_credential_M: { | ||
mutation: TypedDocumentNode<import("@duely/core").CreateCredentialMutation, import("@duely/core").Exact<{ | ||
agency_id: string; | ||
credential_type_id: string; | ||
data: any; | ||
name: string; | ||
}>>; | ||
result: (d: ResultOf<typeof CreateCredentialDocument>) => { | ||
__typename?: "CredentialMutationResult" | undefined; | ||
} & Pick<import("@duely/core").CredentialMutationResult, "success" | "message"> & { | ||
credential?: import("@duely/core").Maybe<{ | ||
__typename?: "Credential" | undefined; | ||
} & { | ||
__typename?: "Credential" | undefined; | ||
} & Pick<import("@duely/core").Credential, "data" | "id"> & { | ||
agency: { | ||
__typename?: "Agency" | undefined; | ||
} & Pick<import("@duely/core").Agency, "id">; | ||
credential_type: { | ||
__typename?: "CredentialType" | undefined; | ||
} & { | ||
__typename?: "CredentialType" | undefined; | ||
} & Pick<import("@duely/core").CredentialType, "id" | "name"> & { | ||
fields?: import("@duely/core").Maybe<({ | ||
__typename?: "FormField" | undefined; | ||
} & { | ||
__typename?: "FormField" | undefined; | ||
} & Pick<import("@duely/core").FormField, "id" | "name" | "type" | "label" | "default">)[]> | undefined; | ||
}; | ||
}> | undefined; | ||
}; | ||
}; | ||
export declare const update_credential_M: { | ||
mutation: TypedDocumentNode<import("@duely/core").UpdateCredentialMutation, import("@duely/core").Exact<{ | ||
credential_id: string; | ||
data: any; | ||
}>>; | ||
result: (d: ResultOf<typeof UpdateCredentialDocument>) => { | ||
__typename?: "CredentialMutationResult" | undefined; | ||
} & Pick<import("@duely/core").CredentialMutationResult, "success" | "message"> & { | ||
credential?: import("@duely/core").Maybe<{ | ||
__typename?: "Credential" | undefined; | ||
} & { | ||
__typename?: "Credential" | undefined; | ||
} & Pick<import("@duely/core").Credential, "data" | "id"> & { | ||
agency: { | ||
__typename?: "Agency" | undefined; | ||
} & Pick<import("@duely/core").Agency, "id">; | ||
credential_type: { | ||
__typename?: "CredentialType" | undefined; | ||
} & { | ||
__typename?: "CredentialType" | undefined; | ||
} & Pick<import("@duely/core").CredentialType, "id" | "name"> & { | ||
fields?: import("@duely/core").Maybe<({ | ||
__typename?: "FormField" | undefined; | ||
} & { | ||
__typename?: "FormField" | undefined; | ||
} & Pick<import("@duely/core").FormField, "id" | "name" | "type" | "label" | "default">)[]> | undefined; | ||
}; | ||
}> | undefined; | ||
}; | ||
}; | ||
export declare const create_integration_M: { | ||
@@ -790,0 +852,0 @@ mutation: TypedDocumentNode<import("@duely/core").CreateIntegrationMutation, import("@duely/core").Exact<{ |
{ | ||
"name": "@duely/client", | ||
"version": "0.4.8", | ||
"version": "0.4.9", | ||
"description": "GraphQL client by Duely (wrapper for @apollo/client)", | ||
@@ -35,5 +35,5 @@ "repository": "github:uoleevi/duely", | ||
"@apollo/client": "^3.3.20", | ||
"@duely/core": "0.4.4", | ||
"@duely/core": "0.4.5", | ||
"react": "^17.0.2" | ||
} | ||
} |
@@ -12,2 +12,3 @@ import { | ||
CreateAgencyThankYouPageSettingDocument, | ||
CreateCredentialDocument, | ||
CreateCustomerDocument, | ||
@@ -35,2 +36,3 @@ CreateIntegrationConfigDocument, | ||
UpdateAgencyThankYouPageSettingDocument, | ||
UpdateCredentialDocument, | ||
UpdateCustomerDocument, | ||
@@ -486,2 +488,13 @@ UpdateIntegrationConfigDocument, | ||
export const create_credential_M = { | ||
mutation: CreateCredentialDocument, | ||
result: (d: ResultOf<typeof CreateCredentialDocument>) => d?.create_credential | ||
}; | ||
export const update_credential_M = { | ||
mutation: UpdateCredentialDocument, | ||
result: (d: ResultOf<typeof UpdateCredentialDocument>) => d?.update_credential | ||
}; | ||
export const create_integration_M = { | ||
@@ -488,0 +501,0 @@ mutation: CreateIntegrationDocument, |
@@ -52,3 +52,7 @@ import { | ||
ImageDocument, | ||
ImagesDocument | ||
ImagesDocument, | ||
CredentialDocument, | ||
CredentialsDocument, | ||
CredentialTypeDocument, | ||
CredentialTypesDocument | ||
} from '@duely/core'; | ||
@@ -264,2 +268,22 @@ import { QueryOptions } from '@apollo/client'; | ||
export const credential_Q = { | ||
query: CredentialDocument, | ||
result: (d: ResultOf<typeof CredentialDocument>) => d?.credential | ||
}; | ||
export const credentials_Q = { | ||
query: CredentialsDocument, | ||
result: (d: ResultOf<typeof CredentialsDocument>) => d?.credentials | ||
}; | ||
export const credential_type_Q = { | ||
query: CredentialTypeDocument, | ||
result: (d: ResultOf<typeof CredentialTypeDocument>) => d?.credential_type | ||
}; | ||
export const credential_types_Q = { | ||
query: CredentialTypesDocument, | ||
result: (d: ResultOf<typeof CredentialTypesDocument>) => d?.credential_types | ||
}; | ||
export const integration_Q = { | ||
@@ -266,0 +290,0 @@ query: IntegrationDocument, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
371107
4076