@voucherify/sdk 2.3.0 → 2.4.0

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.
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("axios"),require("qs"),require("form-data")):"function"==typeof define&&define.amd?define(["exports","axios","qs","form-data"],t):t((e=e||self).VoucherifySDK={},e.axios,e.Qs,e.FormData)}(this,(function(e,t,s,i){"use strict";var r;t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,s=s&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s,i=i&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i,(r=e.DiscountVouchersTypesEnum||(e.DiscountVouchersTypesEnum={})).AMOUNT="AMOUNT",r.PERCENT="PERCENT",r.UNIT="UNIT",r.FIXED="FIXED";class n extends Error{constructor(e,t,s){var i,r;super((null==(r=t=null!=(i=t)?i:{})?void 0:r.message)||function(e,t){return`Unexpected status code: ${t} - Details: ${e="string"==typeof e?e:JSON.stringify(e,null,2)}`}(t,e)),this.code=void 0,this.key=void 0,this.details=void 0,this.request_id=void 0,this.resource_id=void 0,this.resource_type=void 0,this.related_object_ids=void 0,this.related_object_type=void 0,this.related_object_total=void 0,this.cause=void 0,this.code=t.code,this.key=t.key,this.details=t.details,this.request_id=t.request_id,this.resource_id=t.resource_id,this.resource_type=t.resource_type,this.related_object_ids=t.related_object_ids,this.related_object_type=t.related_object_type,this.related_object_total=t.related_object_total,this.cause=s}}class o{constructor({basePath:e,baseURL:s,headers:i,exposeErrorCause:r,timeoutMs:o}){this.baseURL=void 0,this.basePath=void 0,this.headers=void 0,this.request=void 0,this.lastResponseHeaders=void 0,this.isLastResponseHeadersSet=void 0,this.exposeErrorCause=void 0,this.timeoutMs=void 0,this.basePath=e,this.baseURL=s,this.headers=i,this.exposeErrorCause=r,this.lastResponseHeaders={},this.isLastResponseHeadersSet=!1,this.timeoutMs=o,this.request=t.create({baseURL:`${this.baseURL}/${this.basePath}/`,headers:this.headers,responseType:"json"}),this.request.interceptors.response.use(void 0,e=>{var t;return null!=e&&null!=(t=e.response)&&t.status?Promise.reject(new n(e.response.status,e.response.data,!0===this.exposeErrorCause?e:void 0)):Promise.reject(e)})}isLastReponseHeadersSet(){return this.isLastResponseHeadersSet}getLastResponseHeaders(){return this.lastResponseHeaders}setLastResponseHeaders(e){this.lastResponseHeaders=e,this.isLastResponseHeadersSet=!0}setBaseUrl(e){this.baseURL=e,this.request.defaults.baseURL=`${e}/${this.basePath}/`}async get(e,t){const i=await this.request.get(e,{params:t,paramsSerializer:function(e){return s.stringify(e)},timeout:this.timeoutMs});return this.setLastResponseHeaders(i.headers),i.data}async post(e,t,i,r){const n=await this.request.post(e,t,{params:i,paramsSerializer:function(e){return s.stringify(e)},headers:r,timeout:this.timeoutMs});return this.setLastResponseHeaders(n.headers),n.data}async put(e,t,s){const i=await this.request.put(e,t,{params:s,timeout:this.timeoutMs});return this.setLastResponseHeaders(i.headers),i.data}async delete(e,t){const s=await this.request.delete(e,{params:t,timeout:this.timeoutMs});return this.setLastResponseHeaders(s.headers),s.data}}function a(e=""){return encodeURIComponent(e)}function c(e){return"string"==typeof e}function l(e){return null==e||c(e)}function u(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}function d(e){return null==e||u(e)}function h(){return"undefined"!=typeof window&&void 0!==window.document?"Browser":"object"==typeof self&&self.constructor&&"DedicatedWorkerGlobalScope"===self.constructor.name?"WebWorker":"undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node?"Node.js-"+process.version:"undefined"!=typeof window&&"nodejs"===window.name||navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")?"JsDom":"Unknown"}function p(e,t){if(!e)throw new Error(t)}function m(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>!t.includes(e)))}class g{constructor(e){this.client=void 0,this.client=e}get(e){return this.client.get("/async-actions/"+a(e))}list(e){return this.client.get("/async-actions",e)}}class v{constructor(e){this.client=void 0,this.client=e}examine(e={},t){return this.client.post("/campaigns/qualification",e,t)}}class y{constructor(e){this.client=void 0,this.qualifications=void 0,this.client=e,this.qualifications=new v(this.client)}create(e){return this.client.post("/campaigns",e)}update(e,t){return this.client.put("/campaigns/"+a(e),t)}get(e){return this.client.get("/campaigns/"+a(e))}delete(e,t={}){return this.client.delete("/campaigns/"+a(e),t)}addVoucher(e,t={},s={}){return this.client.post(`/campaigns/${a(e)}/vouchers`,t,s)}addCertainVoucher(e,t,s={}){return this.client.post(`/campaigns/${a(e)}/vouchers/${a(t)}`,s)}importVouchers(e,t){return this.client.post(`/campaigns/${a(e)}/import`,t)}list(e={}){return this.client.get("/campaigns",e)}async importVouchersCSV(e,t){p(h().startsWith("Node"),'Method "client.campaigns.importVouchersCSV(campaignId, filePath)" is only for Node environment');const s=(await import("fs")).default.createReadStream(t),r=new i;return r.append("file",s),this.client.post(`/campaigns/${e}/importCSV`,r)}enable(e){return this.client.post(`/campaigns/${a(e)}/enable`,{})}disable(e){return this.client.post(`/campaigns/${a(e)}/disable`,{})}}class f{constructor(e){this.client=void 0,this.client=e}list(e={}){return this.client.get("/publications",e)}create(e){return this.client.post("/publications",e)}}class b{constructor(e,t){this.client=void 0,this.exports=void 0,this.publications=void 0,this.client=e,this.exports=t,this.publications=new f(this.client)}}class w{constructor(e){this.client=void 0,this.client=e}create(e){return this.client.post("/exports",e)}get(e){return this.client.get("/exports/"+a(e))}delete(e){return this.client.delete("/exports/"+a(e))}}class _{constructor(e){this.client=void 0,this.client=e}create(e,t){return t={...t,event:e},this.client.post("/events",t)}}class ${constructor(e){this.client=void 0,this.client=e}create(e,t){return this.client.post(`/vouchers/${a(e)}/balance`,t)}}class S{constructor(e){this.client=void 0,this.client=e}examine(e,t={}){return this.client.post("/vouchers/qualification",e,t)}}class k{constructor(e,t){this.client=void 0,this.balance=void 0,this.qualifications=void 0,this.client=e,this.balance=t,this.qualifications=new S(this.client)}create(e){return this.client.post("/vouchers/"+a(e.code),e)}get(e){return this.client.get("/vouchers/"+a(e))}update(e){return this.client.put("/vouchers/"+a(e.code),e)}delete(e,t={}){return this.client.delete("/vouchers/"+a(e),t)}list(e={}){return this.client.get("/vouchers",e)}enable(e){return this.client.post(`/vouchers/${a(e)}/enable`,{})}disable(e){return this.client.post(`/vouchers/${a(e)}/disable`,{})}import(e){return this.client.post("/vouchers/import",e)}bulkUpdateMetadata(e){return this.client.post("/vouchers/metadata/async",e)}bulkUpdate(e){return this.client.post("/vouchers/bulk/async",e)}releaseValidationSession(e,t){return this.client.delete(`/vouchers/${a(e)}/sessions/${a(t)}`)}async importCSV(e){p(h().startsWith("Node"),'Method "client.vouchers.importCSV(filePath)" is only for Node environment');const t=(await import("fs")).default.createReadStream(e),s=new i;return s.append("file",t),this.client.post("/vouchers/importCSV",s)}}class V{constructor(e,t){this.client=void 0,this.promotions=void 0,this.client=e,this.promotions=t}validateVoucher(e,t={}){return this.client.post(`/vouchers/${a(e)}/validate`,t)}validate(e,t={}){return u(e)?this.promotions.validate(e):this.validateVoucher(e,t)}validateStackable(e){return this.client.post("/validations",e)}}class C{constructor(e){this.client=void 0,this.client=e}redeem(e,t={}){return this.client.post(`/vouchers/${a(e)}/redemption`,t)}redeemStackable(e){return this.client.post("/redemptions",e)}get(e){return this.client.get("/redemptions/"+a(e))}list(e={}){return this.client.get("/redemptions",e)}getForVoucher(e){return this.client.get(`/vouchers/${a(e)}/redemption`)}rollback(e,t){let s={},i={};if(c(t))s.reason=t;else if(u(t)){const{reason:e,tracking_id:r,customer:n}=t;s={reason:e||void 0,tracking_id:r||void 0},i={customer:n}}return this.client.post(`/redemptions/${a(e)}/rollback`,i,s)}rollbackStackable(e,t,s){return this.client.post(`/redemptions/${a(e)}/rollbacks`,t,s)}}class R{constructor(e){this.client=void 0,this.client=e}listAll(e={}){return this.client.get("/promotions/tiers",e)}list(e){return this.client.get(`/promotions/${a(e)}/tiers`)}get(e){return this.client.get("/promotions/tiers/"+a(e))}create(e,t){return this.client.post(`/promotions/${a(e)}/tiers`,t)}redeem(e,t){return this.client.post(`/promotions/tiers/${a(e)}/redemption`,t)}update(e){return this.client.put("/promotions/tiers/"+a(e.id),e)}delete(e){return this.client.delete("/promotions/tiers/"+a(e))}}class x{constructor(e,t){this.client=void 0,this.tiers=void 0,this.client=e,this.tiers=t}create(e){return this.client.post("/campaigns",e)}validate(e,t){return this.client.post("/promotions/validation",e,t)}}class j{constructor(e){this.client=void 0,this.client=e}create(e){return this.client.post("/customers",e)}get(e){return this.client.get("/customers/"+a(e))}list(e){return this.client.get("/customers",e)}async*scroll(e){var t;let s=null!=(t=e.starting_after)?t:"created_at"===e.order?"1970-01-01T00:00:00Z":"2200-01-01T00:00:00Z",i=await this.client.get("/customers",Object.assign({},e,{starting_after:s}));for(;0!==i.customers.length;){for(const t of i.customers)s="created_at"===e.order?s>t.created_at?s:t.created_at:s<t.created_at?s:t.created_at,yield t;if(!i.has_more)break;i=await this.client.get("/customers",Object.assign({},e,{starting_after:s}))}}update(e){const t="id"in e?e.id:e.source_id,s=m(e,["id"]);return this.client.put("/customers/"+a(t),s)}delete(e){return this.client.delete("/customers/"+a(e))}updateConsents(e,t){return this.client.put(`/customers/${a(e)}/consents`,t)}listActivities(e,t){return this.client.get(`/customers/${a(e)}/activities`,t)}async importCSV(e){p(h().startsWith("Node"),'Method "client.customers.importCSV(filePath)" is only for Node environment');const t=(await import("fs")).default.createReadStream(e),s=new i;return s.append("file",t),this.client.post("/customers/importCSV",s)}}class q{constructor(e){this.client=void 0,this.client=e}list(){return this.client.get("/consents")}}class I{constructor(e){this.client=void 0,this.client=e}create(e){return this.client.post("/orders",e)}get(e){return this.client.get("/orders/"+a(e))}update(e){return this.client.put("/orders/"+a(e.id||e.source_id),m(e,["id"]))}list(e={}){return this.client.get("/orders",e)}import(e){return this.client.post("/orders/import",e)}}class L{constructor(e){this.client=void 0,this.client=e}create(e){return this.client.post("/products",e)}get(e){return this.client.get("/products/"+a(e))}update(e){return this.client.put("/products/"+a(e.id||e.source_id),m(e,["id"]))}bulkUpdateMetadata(e){return this.client.post("/products/metadata/async",e)}bulkUpdate(e){return this.client.post("/products/bulk/async",e)}delete(e,t){return this.client.delete("/products/"+a(e),t)}list(e){return this.client.get("/products",e)}createSku(e,t){return this.client.post(`/products/${a(e)}/skus`,t)}getSku(e){return this.client.get("/skus/"+a(e))}updateSku(e,t){return this.client.put(`/products/${a(e)}/skus/${a(t.id||t.source_id)}`,m(t,["id"]))}deleteSku(e,t,s){return this.client.delete(`/products/${a(e)}/skus/${a(t)}`,s)}listSkus(e){return this.client.get(`/products/${a(e)}/skus`)}async importSkusCSV(e){p(h().startsWith("Node"),'Method "client.products.importSkusCSV(filePath)" is only for Node environment');const t=(await import("fs")).default.createReadStream(e),s=new i;return s.append("file",t),this.client.post("/skus/importCSV",s)}async importCSV(e){p(h().startsWith("Node"),'Method "client.products.importCSV(filePath)" is only for Node environment');const t=(await import("fs")).default.createReadStream(e),s=new i;return s.append("file",t),this.client.post("/products/importCSV",s)}}class A{constructor(e){this.client=void 0,this.client=e}list(e={}){return this.client.get("/rewards",e)}create(e){return this.client.post("/rewards",e)}get(e){return this.client.get("/rewards/"+a(e))}update(e){return this.client.put("/rewards/"+a(e.id),m(e,["id"]))}delete(e){return this.client.delete("/rewards/"+a(e))}listAssignments(e,t={}){return this.client.get(`/rewards/${a(e)}/assignments`,t)}createAssignment(e,t){return this.client.post(`/rewards/${a(e)}/assignments`,t)}updateAssignment(e,t){return this.client.put(`/rewards/${a(e)}/assignments/${a(t.id)}`,m(t,["id"]))}deleteAssignment(e,t){return this.client.delete(`/rewards/${a(e)}/assignments/${a(t)}`)}}class H{constructor(e){this.client=void 0,this.client=e}list(e={}){return this.client.get("/loyalties",e)}create(e){return this.client.post("/loyalties",e)}get(e){return this.client.get("/loyalties/"+a(e))}update(e){return this.client.put("/loyalties/"+a(e.id),m(e,["id"]))}delete(e,t){return this.client.delete("/loyalties/"+a(e),t)}listRewardAssignments(e,t={}){return this.client.get(`/loyalties/${a(e)}/rewards`,t)}createRewardAssignments(e,t){return this.client.post(`/loyalties/${a(e)}/rewards`,t)}updateRewardAssignment(e,t){return this.client.put(`/loyalties/${a(e)}/rewards/${t.id}`,m(t,["id"]))}deleteRewardAssignment(e,t){return this.client.delete(`/loyalties/${a(e)}/rewards/${t}`)}listEarningRules(e,t={}){return this.client.get(`/loyalties/${a(e)}/earning-rules`,t)}createEarningRule(e,t){return this.client.post(`/loyalties/${a(e)}/earning-rules`,t)}updateEarningRule(e,t){return this.client.put(`/loyalties/${a(e)}/earning-rules/${t.id}`,m(t,["id"]))}deleteEarningRule(e,t){return this.client.delete(`/loyalties/${a(e)}/earning-rules/${t}`)}listMembers(e,t){return this.client.get(`/loyalties/${a(e)}/members`,t)}createMember(e,t){return this.client.post(`/loyalties/${a(e)}/members`,t)}getMember(e,t){return this.client.get(`/loyalties/${a(e)}/members/${t}`)}getMemberActivities(e,t){return this.client.get(`/loyalties/${a(e)}/members/${t}/activities`)}addPoints(e,t,s){return this.client.post(`/loyalties/${a(e)}/members/${t}/balance`,s)}redeemReward(e,t,s){return this.client.post(`/loyalties/${a(e)}/members/${a(t)}/redemption`,s)}}class M{constructor(e){this.client=void 0,this.client=e}create(e){return this.client.post("/validation-rules",e)}get(e){return this.client.get("/validation-rules/"+a(e))}update(e){return this.client.put("/validation-rules/"+a(e.id),m(e,["id"]))}delete(e){return this.client.delete("/validation-rules/"+a(e))}createAssignment(e,t){return this.client.post(`/validation-rules/${a(e)}/assignments`,t)}deleteAssignment(e,t){return this.client.delete(`/validation-rules/${a(e)}/assignments/${a(t)}`)}validate(e,t={}){return this.client.post(`/validation-rules/${a(e)}/validation`,t)}list(e={}){return this.client.get("/validation-rules",e)}listAssignments(e,t={}){return this.client.get(`/validation-rules/${a(e)}/assignments`,t)}}class U{constructor(e){this.client=void 0,this.client=e}create(e){return this.client.post("/segments",e)}get(e){return this.client.get("/segments/"+a(e))}delete(e){return this.client.delete("/segments/"+a(e))}list(e){return this.client.get(`/customers/${a(e)}/segments`)}}class E{constructor(e){this.requestController=void 0,this.requestController=e}getLastResponseHeadersFromController(){return this.requestController.getLastResponseHeaders()}areLimitsAvailable(){return this.requestController.isLastReponseHeadersSet()}getRateLimit(){var e;const t=null!=(e=this.getLastResponseHeadersFromController()["x-rate-limit-limit"])?e:0;return parseInt(t,10)}getRateLimitRemaining(){var e;const t=null!=(e=this.getLastResponseHeadersFromController()["x-rate-limit-remaining"])?e:0;return parseInt(t,10)}getRetryAfter(){var e;const t=null!=(e=this.getLastResponseHeadersFromController()["retry-after"])?e:0;return parseInt(t,10)}}class N{constructor(e){this.client=void 0,this.client=e}list(){return this.client.get("/metadata-schemas")}get(e){return this.client.get("/metadata-schemas/"+a(e))}}class P{constructor(e){this.client=void 0,this.client=e}list(){return this.client.get("/categories")}create(e){return this.client.post("/categories",e)}get(e){return this.client.get("/categories/"+a(e))}delete(e){return this.client.delete("/categories/"+a(e))}update(e,t){return this.client.put("/categories/"+a(e),t)}}class O{constructor(e,t){this.client=void 0,this.trackingId=void 0,this.client=e,this.trackingId=t}setIdentity(e){this.trackingId=e}validate(e){var t,s;p(u(e)||c(e),'client.validate: expected "params" argument to be an object or a string');const i={};return c(e)?i.code=e:(i.code=e.code,i.item=e.items,i.amount=e.amount,i.metadata=e.metadata,i.order={metadata:e.orderMetadata},i.customer=e.customer,i.tracking_id=e.tracking_id||this.trackingId,i.session_type=e.session_type,i.session_key=e.session_key,i.session_ttl=e.session_ttl,i.session_ttl_unit=e.session_ttl_unit),i.code&&(i.code=i.code.replace(/[\r\n\t\f\v]/g,"").trim()),p(d(null==i?void 0:i.customer),'client.validate: expected "params.customer" to be an object'),p(l(null==i||null==(t=i.customer)?void 0:t.source_id),'client.validate: expected "params.customer.source_id" to be a string'),p(d(null==i||null==(s=i.customer)?void 0:s.metadata),'client.validate: expected "params.customer.metadata" to be an object'),this.client.get(i.code?"/validate":"/promotions/validation",i)}redeem(e,t={}){var s,i;return p(c(e),"client.redeem - please provide a valid Voucher code"),e=e.replace(/[\r\n\t\f\v]/g,"").trim(),t.customer=null!=(s=t.customer)?s:{},t.customer.source_id=null!=(i=t.customer.source_id)?i:this.trackingId,this.client.post("/redeem",t,{code:e})}publish(e,t={},s={}){var i,r,n,o,a;p(u(t),"client.publish - expected payload to be an object");const l={};return l.customer=null!=(i=t.customer)?i:{},l.customer.source_id=null!=(r=null==(n=t.customer)?void 0:n.source_id)?r:this.trackingId,l.channel=null!=(o=t.channel)?o:"Voucherify.js",p(c(null==(a=l.customer)?void 0:a.source_id),"client.publish - expected payload to contain customer source id or to have tracking id set up by Voucherify client"),s.campaign=e.replace(/[\r\n\t\f\v]/g,"").trim(),this.client.post("/publish",l,s)}track(e,t,s,i,r){var n,o;p(c(e),"client.track - expected event name to be an string"),p(u(t),"client.track - expected customer to be an object");const a={event:e,metadata:null!=s?s:{},customer:t,referral:null!=i?i:void 0,loyalty:null!=r?r:void 0};return a.customer.source_id=null!=(n=t.source_id)?n:this.trackingId,p(c(null==(o=a.customer)?void 0:o.source_id),"client.track - expected payload to contain customer source id or to have tracking id set up by Voucherify client"),this.client.post("/events",a)}listVouchers(e={}){const t={};return t.campaign=e.campaign,t.category=e.category,t.page=e.page,t.limit=e.limit,t.customer=e.customer,t.created_at=e.created_at,t.updated_at=e.updated_at,this.client.get("/vouchers",t)}createCustomer(e,t){return this.client.post("/customers",e,{},t?{"X-Voucherify-Double-Opt-In":!0}:{})}listConsents(){return this.client.get("/consents")}updateConsents(e,t){return this.client.put(`/customers/${a(e)}/consents`,t)}validateStackable(e){return this.client.post("/validations",e)}redeemStackable(e){return this.client.post("/redemptions",e)}}e.VoucherifyClientSide=function(e){var t,s,i;p(u(e),'VoucherifyCustomer: expected "options" argument to be an object'),p(c(e.clientApplicationId),'VoucherifyCustomer: "options.clientApplicationId" is required'),p(c(e.clientSecretKey),'VoucherifyCustomer: "options.clientSecretKey" is required'),p(l(e.apiUrl),'VoucherifyCustomer: expected "options.baseUrl" to be a string'),p(l(e.trackingId),'VoucherifyCustomer: expected "options.trackingId" to be a string');let r={"X-Client-Application-Id":e.clientApplicationId,"X-Client-Token":e.clientSecretKey,"X-Voucherify-Channel":h()+"-ClientSide-SDK-v2.3.0"};h().startsWith("Node")&&(p(c(e.origin),'VoucherifyCustomer: "options.origin" is required in Node.js'),r.origin=e.origin),u(e.customHeaders)&&(r=Object.assign({},r,e.customHeaders));const n=new o({basePath:"client/v1",baseURL:null!=(t=e.apiUrl)?t:"https://api.voucherify.io",headers:r,exposeErrorCause:null!=(s=e.exposeErrorCause)&&s,timeoutMs:null!=(i=e.timeoutMs)?i:0});return new O(n,e.trackingId)},e.VoucherifyServerSide=function(e){var t,s,i;p(u(e),'VoucherifyServerSide: the "options" argument must be an object'),p(c(e.applicationId),'VoucherifyServerSide: "options.applicationId" is required'),p(c(e.secretKey),'VoucherifyServerSide: "options.secretKey" is required'),p(l(e.apiVersion),'VoucherifyServerSide: expected "options.apiVersion" to be a string'),p(l(e.channel),'VoucherifyServerSide: expected "options.channel" to be a string');let r={"X-App-Id":e.applicationId,"X-App-Token":e.secretKey,"X-Voucherify-Channel":e.channel||h()+"-SDK-v2.3.0","Content-Type":"application/json"};e.apiVersion&&(r["X-Voucherify-API-Version"]=e.apiVersion),u(e.customHeaders)&&(r=Object.assign({},r,e.customHeaders)),h().startsWith("Node")||p(!0===e.dangerouslySetSecretKeyInBrowser,`VoucherifyServerSide: you're exposing your secretKey to a ${h().toLowerCase()} environment. This is generally considered a bad practice. Did you mean to use 'VoucherifyClientSide'?`);const n=new o({basePath:"v1",baseURL:null!=(t=e.apiUrl)?t:"https://api.voucherify.io",headers:r,exposeErrorCause:null!=(s=e.exposeErrorCause)&&s,timeoutMs:null!=(i=e.timeoutMs)?i:0}),a=new g(n),d=new $(n),m=new k(n,d),v=new y(n),f=new P(n),S=new w(n),O=new _(n),T=new b(n,S),D=new R(n),K=new x(n,D);return{vouchers:m,campaigns:v,categories:f,distributions:T,validations:new V(n,K),redemptions:new C(n),promotions:K,customers:new j(n),consents:new q(n),orders:new I(n),products:new L(n),rewards:new A(n),loyalties:new H(n),segments:new U(n),validationRules:new M(n),events:O,asyncActions:a,apiLimitsHandler:new E(n),metadataSchemas:new N(n)}},Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("axios"),require("qs"),require("form-data")):"function"==typeof define&&define.amd?define(["exports","axios","qs","form-data"],t):t((e=e||self).VoucherifySDK={},e.axios,e.Qs,e.FormData)}(this,(function(e,t,s,i){"use strict";var r;t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,s=s&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s,i=i&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i,(r=e.DiscountVouchersTypesEnum||(e.DiscountVouchersTypesEnum={})).AMOUNT="AMOUNT",r.PERCENT="PERCENT",r.UNIT="UNIT",r.FIXED="FIXED";class n extends Error{constructor(e,t,s){var i,r;super((null==(r=t=null!=(i=t)?i:{})?void 0:r.message)||function(e,t){return`Unexpected status code: ${t} - Details: ${e="string"==typeof e?e:JSON.stringify(e,null,2)}`}(t,e)),this.code=void 0,this.key=void 0,this.details=void 0,this.request_id=void 0,this.resource_id=void 0,this.resource_type=void 0,this.related_object_ids=void 0,this.related_object_type=void 0,this.related_object_total=void 0,this.cause=void 0,this.code=t.code,this.key=t.key,this.details=t.details,this.request_id=t.request_id,this.resource_id=t.resource_id,this.resource_type=t.resource_type,this.related_object_ids=t.related_object_ids,this.related_object_type=t.related_object_type,this.related_object_total=t.related_object_total,this.cause=s}}class o{constructor({basePath:e,baseURL:s,headers:i,exposeErrorCause:r,timeoutMs:o}){this.baseURL=void 0,this.basePath=void 0,this.headers=void 0,this.request=void 0,this.lastResponseHeaders=void 0,this.isLastResponseHeadersSet=void 0,this.exposeErrorCause=void 0,this.timeoutMs=void 0,this.basePath=e,this.baseURL=s,this.headers=i,this.exposeErrorCause=r,this.lastResponseHeaders={},this.isLastResponseHeadersSet=!1,this.timeoutMs=o,this.request=t.create({baseURL:`${this.baseURL}/${this.basePath}/`,headers:this.headers,responseType:"json"}),this.request.interceptors.response.use(void 0,e=>{var t;return null!=e&&null!=(t=e.response)&&t.status?Promise.reject(new n(e.response.status,e.response.data,!0===this.exposeErrorCause?e:void 0)):Promise.reject(e)})}isLastReponseHeadersSet(){return this.isLastResponseHeadersSet}getLastResponseHeaders(){return this.lastResponseHeaders}setLastResponseHeaders(e){this.lastResponseHeaders=e,this.isLastResponseHeadersSet=!0}setBaseUrl(e){this.baseURL=e,this.request.defaults.baseURL=`${e}/${this.basePath}/`}async get(e,t){const i=await this.request.get(e,{params:t,paramsSerializer:function(e){return s.stringify(e)},timeout:this.timeoutMs});return this.setLastResponseHeaders(i.headers),i.data}async post(e,t,i,r){const n=await this.request.post(e,t,{params:i,paramsSerializer:function(e){return s.stringify(e)},headers:r,timeout:this.timeoutMs});return this.setLastResponseHeaders(n.headers),n.data}async put(e,t,s){const i=await this.request.put(e,t,{params:s,timeout:this.timeoutMs});return this.setLastResponseHeaders(i.headers),i.data}async delete(e,t){const s=await this.request.delete(e,{params:t,timeout:this.timeoutMs});return this.setLastResponseHeaders(s.headers),s.data}}function a(e=""){return encodeURIComponent(e)}function c(e){return"string"==typeof e}function l(e){return null==e||c(e)}function u(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}function d(e){return null==e||u(e)}function h(){return"undefined"!=typeof window&&void 0!==window.document?"Browser":"object"==typeof self&&self.constructor&&"DedicatedWorkerGlobalScope"===self.constructor.name?"WebWorker":"undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node?"Node.js-"+process.version:"undefined"!=typeof window&&"nodejs"===window.name||navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")?"JsDom":"Unknown"}function p(e,t){if(!e)throw new Error(t)}function m(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>!t.includes(e)))}class g{constructor(e){this.client=void 0,this.client=e}get(e){return this.client.get("/async-actions/"+a(e))}list(e){return this.client.get("/async-actions",e)}}class v{constructor(e){this.client=void 0,this.client=e}examine(e={},t){return this.client.post("/campaigns/qualification",e,t)}}class y{constructor(e){this.client=void 0,this.qualifications=void 0,this.client=e,this.qualifications=new v(this.client)}create(e){return this.client.post("/campaigns",e)}update(e,t){return this.client.put("/campaigns/"+a(e),t)}get(e){return this.client.get("/campaigns/"+a(e))}delete(e,t={}){return this.client.delete("/campaigns/"+a(e),t)}addVoucher(e,t={},s={}){return this.client.post(`/campaigns/${a(e)}/vouchers`,t,s)}addCertainVoucher(e,t,s={}){return this.client.post(`/campaigns/${a(e)}/vouchers/${a(t)}`,s)}importVouchers(e,t){return this.client.post(`/campaigns/${a(e)}/import`,t)}list(e={}){return this.client.get("/campaigns",e)}async importVouchersCSV(e,t){p(h().startsWith("Node"),'Method "client.campaigns.importVouchersCSV(campaignId, filePath)" is only for Node environment');const s=(await import("fs")).default.createReadStream(t),r=new i;return r.append("file",s),this.client.post(`/campaigns/${e}/importCSV`,r)}enable(e){return this.client.post(`/campaigns/${a(e)}/enable`,{})}disable(e){return this.client.post(`/campaigns/${a(e)}/disable`,{})}}class f{constructor(e){this.client=void 0,this.client=e}list(e={}){return this.client.get("/publications",e)}create(e){return this.client.post("/publications",e)}}class b{constructor(e,t){this.client=void 0,this.exports=void 0,this.publications=void 0,this.client=e,this.exports=t,this.publications=new f(this.client)}}class w{constructor(e){this.client=void 0,this.client=e}create(e){return this.client.post("/exports",e)}get(e){return this.client.get("/exports/"+a(e))}delete(e){return this.client.delete("/exports/"+a(e))}}class ${constructor(e){this.client=void 0,this.client=e}create(e,t){return t={...t,event:e},this.client.post("/events",t)}}class _{constructor(e){this.client=void 0,this.client=e}create(e,t){return this.client.post(`/vouchers/${a(e)}/balance`,t)}}class S{constructor(e){this.client=void 0,this.client=e}examine(e,t={}){return this.client.post("/vouchers/qualification",e,t)}}class k{constructor(e,t){this.client=void 0,this.balance=void 0,this.qualifications=void 0,this.client=e,this.balance=t,this.qualifications=new S(this.client)}create(e){return this.client.post("/vouchers/"+a(e.code),e)}get(e){return this.client.get("/vouchers/"+a(e))}update(e){return this.client.put("/vouchers/"+a(e.code),e)}delete(e,t={}){return this.client.delete("/vouchers/"+a(e),t)}list(e={}){return this.client.get("/vouchers",e)}enable(e){return this.client.post(`/vouchers/${a(e)}/enable`,{})}disable(e){return this.client.post(`/vouchers/${a(e)}/disable`,{})}import(e){return this.client.post("/vouchers/import",e)}bulkUpdateMetadata(e){return this.client.post("/vouchers/metadata/async",e)}bulkUpdate(e){return this.client.post("/vouchers/bulk/async",e)}releaseValidationSession(e,t){return this.client.delete(`/vouchers/${a(e)}/sessions/${a(t)}`)}async importCSV(e){p(h().startsWith("Node"),'Method "client.vouchers.importCSV(filePath)" is only for Node environment');const t=(await import("fs")).default.createReadStream(e),s=new i;return s.append("file",t),this.client.post("/vouchers/importCSV",s)}}class V{constructor(e,t){this.client=void 0,this.promotions=void 0,this.client=e,this.promotions=t}validateVoucher(e,t={}){return this.client.post(`/vouchers/${a(e)}/validate`,t)}validate(e,t={}){return u(e)?this.promotions.validate(e):this.validateVoucher(e,t)}validateStackable(e){return this.client.post("/validations",e)}}class R{constructor(e){this.client=void 0,this.client=e}redeem(e,t={}){return this.client.post(`/vouchers/${a(e)}/redemption`,t)}redeemStackable(e){return this.client.post("/redemptions",e)}get(e){return this.client.get("/redemptions/"+a(e))}list(e={}){return this.client.get("/redemptions",e)}getForVoucher(e){return this.client.get(`/vouchers/${a(e)}/redemption`)}rollback(e,t){let s={},i={};if(c(t))s.reason=t;else if(u(t)){const{reason:e,tracking_id:r,customer:n}=t;s={reason:e||void 0,tracking_id:r||void 0},i={customer:n}}return this.client.post(`/redemptions/${a(e)}/rollback`,i,s)}rollbackStackable(e,t,s){return this.client.post(`/redemptions/${a(e)}/rollbacks`,t,s)}}class C{constructor(e){this.client=void 0,this.client=e}listAll(e={}){return this.client.get("/promotions/tiers",e)}list(e){return this.client.get(`/promotions/${a(e)}/tiers`)}get(e){return this.client.get("/promotions/tiers/"+a(e))}create(e,t){return this.client.post(`/promotions/${a(e)}/tiers`,t)}redeem(e,t){return this.client.post(`/promotions/tiers/${a(e)}/redemption`,t)}update(e){return this.client.put("/promotions/tiers/"+a(e.id),e)}delete(e){return this.client.delete("/promotions/tiers/"+a(e))}}class x{constructor(e,t){this.client=void 0,this.tiers=void 0,this.client=e,this.tiers=t}create(e){return this.client.post("/campaigns",e)}validate(e,t){return this.client.post("/promotions/validation",e,t)}}class j{constructor(e){this.client=void 0,this.client=e}create(e){return this.client.post("/customers",e)}get(e){return this.client.get("/customers/"+a(e))}list(e){return this.client.get("/customers",e)}async*scroll(e){var t;let s=null!=(t=e.starting_after)?t:"created_at"===e.order?"1970-01-01T00:00:00Z":"2200-01-01T00:00:00Z",i=await this.client.get("/customers",Object.assign({},e,{starting_after:s}));for(;0!==i.customers.length;){for(const t of i.customers)s="created_at"===e.order?s>t.created_at?s:t.created_at:s<t.created_at?s:t.created_at,yield t;if(!i.has_more)break;i=await this.client.get("/customers",Object.assign({},e,{starting_after:s}))}}update(e){const t="id"in e?e.id:e.source_id,s=m(e,["id"]);return this.client.put("/customers/"+a(t),s)}updateInBulk(e){return this.client.post("/customers/bulk/async",e)}updateMetadataInBulk(e){return this.client.post("/customers/metadata/async",e)}delete(e){return this.client.delete("/customers/"+a(e))}deletePermanently(e){return this.client.post(`/customers/${a(e)}/permanent-deletion`,{})}updateConsents(e,t){return this.client.put(`/customers/${a(e)}/consents`,t)}listActivities(e,t){return this.client.get(`/customers/${a(e)}/activities`,t)}async importCSV(e){p(h().startsWith("Node"),'Method "client.customers.importCSV(filePath)" is only for Node environment');const t=(await import("fs")).default.createReadStream(e),s=new i;return s.append("file",t),this.client.post("/customers/importCSV",s)}}class I{constructor(e){this.client=void 0,this.client=e}list(){return this.client.get("/consents")}}class q{constructor(e){this.client=void 0,this.client=e}create(e){return this.client.post("/orders",e)}get(e){return this.client.get("/orders/"+a(e))}update(e){return this.client.put("/orders/"+a(e.id||e.source_id),m(e,["id"]))}list(e={}){return this.client.get("/orders",e)}import(e){return this.client.post("/orders/import",e)}}class L{constructor(e){this.client=void 0,this.client=e}create(e){return this.client.post("/products",e)}get(e){return this.client.get("/products/"+a(e))}update(e){return this.client.put("/products/"+a(e.id||e.source_id),m(e,["id"]))}bulkUpdateMetadata(e){return this.client.post("/products/metadata/async",e)}bulkUpdate(e){return this.client.post("/products/bulk/async",e)}delete(e,t){return this.client.delete("/products/"+a(e),t)}list(e){return this.client.get("/products",e)}createSku(e,t){return this.client.post(`/products/${a(e)}/skus`,t)}getSku(e){return this.client.get("/skus/"+a(e))}updateSku(e,t){return this.client.put(`/products/${a(e)}/skus/${a(t.id||t.source_id)}`,m(t,["id"]))}deleteSku(e,t,s){return this.client.delete(`/products/${a(e)}/skus/${a(t)}`,s)}listSkus(e){return this.client.get(`/products/${a(e)}/skus`)}async importSkusCSV(e){p(h().startsWith("Node"),'Method "client.products.importSkusCSV(filePath)" is only for Node environment');const t=(await import("fs")).default.createReadStream(e),s=new i;return s.append("file",t),this.client.post("/skus/importCSV",s)}async importCSV(e){p(h().startsWith("Node"),'Method "client.products.importCSV(filePath)" is only for Node environment');const t=(await import("fs")).default.createReadStream(e),s=new i;return s.append("file",t),this.client.post("/products/importCSV",s)}}class A{constructor(e){this.client=void 0,this.client=e}list(e={}){return this.client.get("/rewards",e)}create(e){return this.client.post("/rewards",e)}get(e){return this.client.get("/rewards/"+a(e))}update(e){return this.client.put("/rewards/"+a(e.id),m(e,["id"]))}delete(e){return this.client.delete("/rewards/"+a(e))}listAssignments(e,t={}){return this.client.get(`/rewards/${a(e)}/assignments`,t)}createAssignment(e,t){return this.client.post(`/rewards/${a(e)}/assignments`,t)}updateAssignment(e,t){return this.client.put(`/rewards/${a(e)}/assignments/${a(t.id)}`,m(t,["id"]))}deleteAssignment(e,t){return this.client.delete(`/rewards/${a(e)}/assignments/${a(t)}`)}}class M{constructor(e){this.client=void 0,this.client=e}list(e={}){return this.client.get("/loyalties",e)}create(e){return this.client.post("/loyalties",e)}get(e){return this.client.get("/loyalties/"+a(e))}update(e){return this.client.put("/loyalties/"+a(e.id),m(e,["id"]))}delete(e,t){return this.client.delete("/loyalties/"+a(e),t)}listRewardAssignments(e,t={}){return this.client.get(`/loyalties/${a(e)}/rewards`,t)}createRewardAssignments(e,t){return this.client.post(`/loyalties/${a(e)}/rewards`,t)}updateRewardAssignment(e,t){return this.client.put(`/loyalties/${a(e)}/rewards/${t.id}`,m(t,["id"]))}deleteRewardAssignment(e,t){return this.client.delete(`/loyalties/${a(e)}/rewards/${t}`)}listEarningRules(e,t={}){return this.client.get(`/loyalties/${a(e)}/earning-rules`,t)}createEarningRule(e,t){return this.client.post(`/loyalties/${a(e)}/earning-rules`,t)}updateEarningRule(e,t){return this.client.put(`/loyalties/${a(e)}/earning-rules/${t.id}`,m(t,["id"]))}deleteEarningRule(e,t){return this.client.delete(`/loyalties/${a(e)}/earning-rules/${t}`)}getEarningRule(e,t){return this.client.get(`/loyalties/${a(e)}/earning-rules/${a(t)}`)}enableEarningRule(e,t){return this.client.post(`/loyalties/${a(e)}/earning-rules/${t}/enable`,{})}disableEarningRule(e,t){return this.client.post(`/loyalties/${a(e)}/earning-rules/${t}/disable`,{})}listMembers(e,t){return this.client.get(`/loyalties/${a(e)}/members`,t)}createMember(e,t){return this.client.post(`/loyalties/${a(e)}/members`,t)}getMember(e,t){return this.client.get(`/loyalties/${a(e)}/members/${t}`)}getMemberActivities(e,t){return this.client.get(`/loyalties/${a(e)}/members/${t}/activities`)}addPoints(e,t,s){return this.client.post(`/loyalties/${a(e)}/members/${t}/balance`,s)}redeemReward(e,t,s){return this.client.post(`/loyalties/${a(e)}/members/${a(t)}/redemption`,s)}}class E{constructor(e){this.client=void 0,this.client=e}create(e){return this.client.post("/validation-rules",e)}get(e){return this.client.get("/validation-rules/"+a(e))}update(e){return this.client.put("/validation-rules/"+a(e.id),m(e,["id"]))}delete(e){return this.client.delete("/validation-rules/"+a(e))}createAssignment(e,t){return this.client.post(`/validation-rules/${a(e)}/assignments`,t)}deleteAssignment(e,t){return this.client.delete(`/validation-rules/${a(e)}/assignments/${a(t)}`)}validate(e,t={}){return this.client.post(`/validation-rules/${a(e)}/validation`,t)}list(e={}){return this.client.get("/validation-rules",e)}listAssignments(e,t={}){return this.client.get(`/validation-rules/${a(e)}/assignments`,t)}}class H{constructor(e){this.client=void 0,this.client=e}create(e){return this.client.post("/segments",e)}get(e){return this.client.get("/segments/"+a(e))}delete(e){return this.client.delete("/segments/"+a(e))}list(e){return this.client.get(`/customers/${a(e)}/segments`)}}class U{constructor(e){this.requestController=void 0,this.requestController=e}getLastResponseHeadersFromController(){return this.requestController.getLastResponseHeaders()}areLimitsAvailable(){return this.requestController.isLastReponseHeadersSet()}getRateLimit(){var e;const t=null!=(e=this.getLastResponseHeadersFromController()["x-rate-limit-limit"])?e:0;return parseInt(t,10)}getRateLimitRemaining(){var e;const t=null!=(e=this.getLastResponseHeadersFromController()["x-rate-limit-remaining"])?e:0;return parseInt(t,10)}getRetryAfter(){var e;const t=null!=(e=this.getLastResponseHeadersFromController()["retry-after"])?e:0;return parseInt(t,10)}}class P{constructor(e){this.client=void 0,this.client=e}list(){return this.client.get("/metadata-schemas")}get(e){return this.client.get("/metadata-schemas/"+a(e))}}class N{constructor(e){this.client=void 0,this.client=e}list(){return this.client.get("/categories")}create(e){return this.client.post("/categories",e)}get(e){return this.client.get("/categories/"+a(e))}delete(e){return this.client.delete("/categories/"+a(e))}update(e,t){return this.client.put("/categories/"+a(e),t)}}class O{constructor(e,t){this.client=void 0,this.trackingId=void 0,this.client=e,this.trackingId=t}setIdentity(e){this.trackingId=e}validate(e){var t,s;p(u(e)||c(e),'client.validate: expected "params" argument to be an object or a string');const i={};return c(e)?i.code=e:(i.code=e.code,i.item=e.items,i.amount=e.amount,i.metadata=e.metadata,i.order={metadata:e.orderMetadata},i.customer=e.customer,i.tracking_id=e.tracking_id||this.trackingId,i.session_type=e.session_type,i.session_key=e.session_key,i.session_ttl=e.session_ttl,i.session_ttl_unit=e.session_ttl_unit),i.code&&(i.code=i.code.replace(/[\r\n\t\f\v]/g,"").trim()),p(d(null==i?void 0:i.customer),'client.validate: expected "params.customer" to be an object'),p(l(null==i||null==(t=i.customer)?void 0:t.source_id),'client.validate: expected "params.customer.source_id" to be a string'),p(d(null==i||null==(s=i.customer)?void 0:s.metadata),'client.validate: expected "params.customer.metadata" to be an object'),this.client.get(i.code?"/validate":"/promotions/validation",i)}redeem(e,t={}){var s,i;return p(c(e),"client.redeem - please provide a valid Voucher code"),e=e.replace(/[\r\n\t\f\v]/g,"").trim(),t.customer=null!=(s=t.customer)?s:{},t.customer.source_id=null!=(i=t.customer.source_id)?i:this.trackingId,this.client.post("/redeem",t,{code:e})}publish(e,t={},s={}){var i,r,n,o,a;p(u(t),"client.publish - expected payload to be an object");const l={};return l.customer=null!=(i=t.customer)?i:{},l.customer.source_id=null!=(r=null==(n=t.customer)?void 0:n.source_id)?r:this.trackingId,l.channel=null!=(o=t.channel)?o:"Voucherify.js",p(c(null==(a=l.customer)?void 0:a.source_id),"client.publish - expected payload to contain customer source id or to have tracking id set up by Voucherify client"),s.campaign=e.replace(/[\r\n\t\f\v]/g,"").trim(),this.client.post("/publish",l,s)}track(e,t,s,i,r){var n,o;p(c(e),"client.track - expected event name to be an string"),p(u(t),"client.track - expected customer to be an object");const a={event:e,metadata:null!=s?s:{},customer:t,referral:null!=i?i:void 0,loyalty:null!=r?r:void 0};return a.customer.source_id=null!=(n=t.source_id)?n:this.trackingId,p(c(null==(o=a.customer)?void 0:o.source_id),"client.track - expected payload to contain customer source id or to have tracking id set up by Voucherify client"),this.client.post("/events",a)}listVouchers(e={}){const t={};return t.campaign=e.campaign,t.category=e.category,t.page=e.page,t.limit=e.limit,t.customer=e.customer,t.created_at=e.created_at,t.updated_at=e.updated_at,this.client.get("/vouchers",t)}createCustomer(e,t){return this.client.post("/customers",e,{},t?{"X-Voucherify-Double-Opt-In":!0}:{})}listConsents(){return this.client.get("/consents")}updateConsents(e,t){return this.client.put(`/customers/${a(e)}/consents`,t)}validateStackable(e){return this.client.post("/validations",e)}redeemStackable(e){return this.client.post("/redemptions",e)}}e.VoucherifyClientSide=function(e){var t,s,i;p(u(e),'VoucherifyCustomer: expected "options" argument to be an object'),p(c(e.clientApplicationId),'VoucherifyCustomer: "options.clientApplicationId" is required'),p(c(e.clientSecretKey),'VoucherifyCustomer: "options.clientSecretKey" is required'),p(l(e.apiUrl),'VoucherifyCustomer: expected "options.baseUrl" to be a string'),p(l(e.trackingId),'VoucherifyCustomer: expected "options.trackingId" to be a string');let r={"X-Client-Application-Id":e.clientApplicationId,"X-Client-Token":e.clientSecretKey,"X-Voucherify-Channel":h()+"-ClientSide-SDK-v2.4.0"};h().startsWith("Node")&&(p(c(e.origin),'VoucherifyCustomer: "options.origin" is required in Node.js'),r.origin=e.origin),u(e.customHeaders)&&(r=Object.assign({},r,e.customHeaders));const n=new o({basePath:"client/v1",baseURL:null!=(t=e.apiUrl)?t:"https://api.voucherify.io",headers:r,exposeErrorCause:null!=(s=e.exposeErrorCause)&&s,timeoutMs:null!=(i=e.timeoutMs)?i:0});return new O(n,e.trackingId)},e.VoucherifyServerSide=function(e){var t,s,i;p(u(e),'VoucherifyServerSide: the "options" argument must be an object'),p(c(e.applicationId),'VoucherifyServerSide: "options.applicationId" is required'),p(c(e.secretKey),'VoucherifyServerSide: "options.secretKey" is required'),p(l(e.apiVersion),'VoucherifyServerSide: expected "options.apiVersion" to be a string'),p(l(e.channel),'VoucherifyServerSide: expected "options.channel" to be a string');let r={"X-App-Id":e.applicationId,"X-App-Token":e.secretKey,"X-Voucherify-Channel":e.channel||h()+"-SDK-v2.4.0","Content-Type":"application/json"};e.apiVersion&&(r["X-Voucherify-API-Version"]=e.apiVersion),u(e.customHeaders)&&(r=Object.assign({},r,e.customHeaders)),h().startsWith("Node")||p(!0===e.dangerouslySetSecretKeyInBrowser,`VoucherifyServerSide: you're exposing your secretKey to a ${h().toLowerCase()} environment. This is generally considered a bad practice. Did you mean to use 'VoucherifyClientSide'?`);const n=new o({basePath:"v1",baseURL:null!=(t=e.apiUrl)?t:"https://api.voucherify.io",headers:r,exposeErrorCause:null!=(s=e.exposeErrorCause)&&s,timeoutMs:null!=(i=e.timeoutMs)?i:0}),a=new g(n),d=new _(n),m=new k(n,d),v=new y(n),f=new N(n),S=new w(n),O=new $(n),T=new b(n,S),D=new C(n),K=new x(n,D);return{vouchers:m,campaigns:v,categories:f,distributions:T,validations:new V(n,K),redemptions:new R(n),promotions:K,customers:new j(n),consents:new I(n),orders:new q(n),products:new L(n),rewards:new A(n),loyalties:new M(n),segments:new H(n),validationRules:new E(n),events:O,asyncActions:a,apiLimitsHandler:new U(n),metadataSchemas:new P(n)}},Object.defineProperty(e,"__esModule",{value:!0})}));
2
2
  //# sourceMappingURL=voucherifysdk.umd.production.min.js.map