@voucherify/sdk 2.1.7 → 2.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @voucherify/sdk
2
2
 
3
+ ## 2.1.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8e7bf47`](https://github.com/voucherifyio/voucherify-js-sdk/commit/8e7bf477d969942fd59ae2fb6444b13662a260f6) [#195](https://github.com/voucherifyio/voucherify-js-sdk/pull/195) Thanks [@darekg11](https://github.com/darekg11)! - Add 'active' field to 'PromotionTier' interface. Add 'PromotionTierRedeemDetailsSimple' and 'PromotionTierRedeemDetails' types and reuse them in 'RedemptionsRedeemResponse' so that 'RedemptionsRedeemStackableRedemptionResult' can return promotion_tier property
8
+
3
9
  ## 2.1.7
4
10
 
5
11
  ### Patch Changes
@@ -32,6 +32,7 @@ export interface PromotionTier {
32
32
  };
33
33
  hierarchy: number;
34
34
  metadata?: Record<string, any>;
35
+ active?: boolean;
35
36
  }
36
37
  export interface PromotionTiersListAllParams {
37
38
  is_available?: boolean;
@@ -100,6 +101,25 @@ export interface PromotionTiersRedeemResponse {
100
101
  };
101
102
  };
102
103
  }
104
+ export interface PromotionTierRedeemDetailsSimple {
105
+ id: string;
106
+ name: string;
107
+ banner?: string;
108
+ campaign: {
109
+ id: string;
110
+ };
111
+ }
112
+ export declare type PromotionTierRedeemDetails = PromotionTier & {
113
+ summary: {
114
+ redemptions: {
115
+ total_redeemed: number;
116
+ };
117
+ orders: {
118
+ total_amount: number;
119
+ total_discount_amount: number;
120
+ };
121
+ };
122
+ };
103
123
  export declare type PromotionTiersUpdateParams = PromotionTiersCreateParams & {
104
124
  id: string;
105
125
  };
@@ -5,6 +5,7 @@ import { VouchersResponse } from './Vouchers';
5
5
  import { GiftRedemptionParams } from './Gift';
6
6
  import { ValidationSessionParams, ValidationSessionReleaseParams } from './ValidateSession';
7
7
  import { StackableOptions, StackableRedeemableParams } from './Stackable';
8
+ import { PromotionTierRedeemDetailsSimple, PromotionTierRedeemDetails } from './PromotionTiers';
8
9
  export interface RedemptionsRedeemBody {
9
10
  tracking_id?: string;
10
11
  customer?: Omit<SimpleCustomer, 'id'> & {
@@ -36,6 +37,7 @@ export interface RedemptionsRedeemResponse {
36
37
  loyalty_card?: {
37
38
  points: number;
38
39
  };
40
+ promotion_tier?: PromotionTierRedeemDetailsSimple | PromotionTierRedeemDetails;
39
41
  failure_code?: string;
40
42
  failure_message?: string;
41
43
  }
@@ -1449,7 +1449,7 @@ function VoucherifyServerSide(options) {
1449
1449
  let headers = {
1450
1450
  'X-App-Id': options.applicationId,
1451
1451
  'X-App-Token': options.secretKey,
1452
- 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.1.7"}`,
1452
+ 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.1.8"}`,
1453
1453
  'Content-Type': 'application/json'
1454
1454
  };
1455
1455
 
@@ -1699,7 +1699,7 @@ function VoucherifyClientSide(options) {
1699
1699
  let headers = {
1700
1700
  'X-Client-Application-Id': options.clientApplicationId,
1701
1701
  'X-Client-Token': options.clientSecretKey,
1702
- 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.1.7"}`
1702
+ 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.1.8"}`
1703
1703
  };
1704
1704
 
1705
1705
  if (environment().startsWith('Node')) {
@@ -1453,7 +1453,7 @@
1453
1453
  let headers = {
1454
1454
  'X-App-Id': options.applicationId,
1455
1455
  'X-App-Token': options.secretKey,
1456
- 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.1.7"}`,
1456
+ 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.1.8"}`,
1457
1457
  'Content-Type': 'application/json'
1458
1458
  };
1459
1459
 
@@ -1703,7 +1703,7 @@
1703
1703
  let headers = {
1704
1704
  'X-Client-Application-Id': options.clientApplicationId,
1705
1705
  'X-Client-Token': options.clientSecretKey,
1706
- 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.1.7"}`
1706
+ 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.1.8"}`
1707
1707
  };
1708
1708
 
1709
1709
  if (environment().startsWith('Node')) {
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("axios"),require("qs")):"function"==typeof define&&define.amd?define(["exports","axios","qs"],t):t((e=e||self).VoucherifySDK={},e.axios,e.Qs)}(this,(function(e,t,s){"use strict";var i;t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,s=s&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s,(i=e.DiscountVouchersTypesEnum||(e.DiscountVouchersTypesEnum={})).AMOUNT="AMOUNT",i.PERCENT="PERCENT",i.UNIT="UNIT",i.FIXED="FIXED";class r 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 n{constructor({basePath:e,baseURL:s,headers:i,exposeErrorCause:n}){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.basePath=e,this.baseURL=s,this.headers=i,this.exposeErrorCause=n,this.lastResponseHeaders={},this.isLastResponseHeadersSet=!1,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 r(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)}});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});return this.setLastResponseHeaders(n.headers),n.data}async put(e,t,s){const i=await this.request.put(e,t,{params:s});return this.setLastResponseHeaders(i.headers),i.data}async delete(e,t){const s=await this.request.delete(e,{params:t});return this.setLastResponseHeaders(s.headers),s.data}}function o(e=""){return encodeURIComponent(e)}function c(e){return"string"==typeof e}function a(e){return null==e||c(e)}function l(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}function u(e){return null==e||l(e)}function d(){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 h(e,t){if(!e)throw new Error(t)}function p(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>!t.includes(e)))}class m{constructor(e){this.client=void 0,this.client=e}get(e){return this.client.get("/async-actions/"+o(e))}list(e){return this.client.get("/async-actions",e)}}class g{constructor(e){this.client=void 0,this.client=e}examine(e={},t){return this.client.post("/campaigns/qualification",e,t)}}class v{constructor(e){this.client=void 0,this.qualifications=void 0,this.client=e,this.qualifications=new g(this.client)}create(e){return this.client.post("/campaigns",e)}update(e,t){return this.client.put("/campaigns/"+o(e),t)}get(e){return this.client.get("/campaigns/"+o(e))}delete(e,t={}){return this.client.delete("/campaigns/"+o(e),t)}addVoucher(e,t={},s={}){return this.client.post(`/campaigns/${o(e)}/vouchers`,t,s)}addCertainVoucher(e,t,s={}){return this.client.post(`/campaigns/${o(e)}/vouchers/${o(t)}`,s)}importVouchers(e,t){return this.client.post(`/campaigns/${o(e)}/import`,t)}list(e={}){return this.client.get("/campaigns",e)}}class y{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 y(this.client)}}class f{constructor(e){this.client=void 0,this.client=e}create(e){return this.client.post("/exports",e)}get(e){return this.client.get("/exports/"+o(e))}delete(e){return this.client.delete("/exports/"+o(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 w{constructor(e){this.client=void 0,this.client=e}create(e,t){return this.client.post(`/vouchers/${o(e)}/balance`,t)}}class ${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 $(this.client)}create(e){return this.client.post("/vouchers/"+o(e.code),e)}get(e){return this.client.get("/vouchers/"+o(e))}update(e){return this.client.put("/vouchers/"+o(e.code),e)}delete(e,t={}){return this.client.delete("/vouchers/"+o(e),t)}list(e={}){return this.client.get("/vouchers",e)}enable(e){return this.client.post(`/vouchers/${o(e)}/enable`,{})}disable(e){return this.client.post(`/vouchers/${o(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/${o(e)}/sessions/${o(t)}`)}}class R{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/${o(e)}/validate`,t)}validate(e,t={}){return l(e)?this.promotions.validate(e):this.validateVoucher(e,t)}validateStackable(e){return this.client.post("/validations",e)}}class S{constructor(e){this.client=void 0,this.client=e}redeem(e,t={}){return this.client.post(`/vouchers/${o(e)}/redemption`,t)}redeemStackable(e){return this.client.post("/redemptions",e)}get(e){return this.client.get("/redemptions/"+o(e))}list(e={}){return this.client.get("/redemptions",e)}getForVoucher(e){return this.client.get(`/vouchers/${o(e)}/redemption`)}rollback(e,t){let s={},i={};if(c(t))s.reason=t;else if(l(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/${o(e)}/rollback`,i,s)}rollbackStackable(e,t,s){return this.client.post(`/redemptions/${o(e)}/rollbacks`,t,s)}}class x{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/${o(e)}/tiers`)}create(e,t){return this.client.post(`/promotions/${o(e)}/tiers`,t)}redeem(e,t){return this.client.post(`/promotions/tiers/${o(e)}/redemption`,t)}update(e){return this.client.put("/promotions/tiers/"+o(e.id),e)}delete(e){return this.client.delete("/promotions/tiers/"+o(e))}}class C{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 V{constructor(e){this.client=void 0,this.client=e}create(e){return this.client.post("/customers",e)}get(e){return this.client.get("/customers/"+o(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=p(e,["id"]);return this.client.put("/customers/"+o(t),s)}delete(e){return this.client.delete("/customers/"+o(e))}updateConsents(e,t){return this.client.put(`/customers/${o(e)}/consents`,t)}listActivities(e,t){return this.client.get(`/customers/${o(e)}/activities`,t)}}class j{constructor(e){this.client=void 0,this.client=e}list(){return this.client.get("/consents")}}class L{constructor(e){this.client=void 0,this.client=e}create(e){return this.client.post("/orders",e)}get(e){return this.client.get("/orders/"+o(e))}update(e){return this.client.put("/orders/"+o(e.id||e.source_id),p(e,["id"]))}list(e={}){return this.client.get("/orders",e)}import(e){return this.client.post("/orders/import",e)}}class q{constructor(e){this.client=void 0,this.client=e}create(e){return this.client.post("/products",e)}get(e){return this.client.get("/products/"+o(e))}update(e){return this.client.put("/products/"+o(e.id||e.source_id),p(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/"+o(e),t)}list(e){return this.client.get("/products",e)}createSku(e,t){return this.client.post(`/products/${o(e)}/skus`,t)}getSku(e){return this.client.get("/skus/"+o(e))}updateSku(e,t){return this.client.put(`/products/${o(e)}/skus/${o(t.id||t.source_id)}`,p(t,["id"]))}deleteSku(e,t,s){return this.client.delete(`/products/${o(e)}/skus/${o(t)}`,s)}listSkus(e){return this.client.get(`/products/${o(e)}/skus`)}}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/"+o(e))}update(e){return this.client.put("/rewards/"+o(e.id),p(e,["id"]))}delete(e){return this.client.delete("/rewards/"+o(e))}listAssignments(e,t={}){return this.client.get(`/rewards/${o(e)}/assignments`,t)}createAssignment(e,t){return this.client.post(`/rewards/${o(e)}/assignments`,t)}updateAssignment(e,t){return this.client.put(`/rewards/${o(e)}/assignments/${o(t.id)}`,p(t,["id"]))}deleteAssignment(e,t){return this.client.delete(`/rewards/${o(e)}/assignments/${o(t)}`)}}class I{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/"+o(e))}update(e){return this.client.put("/loyalties/"+o(e.id),p(e,["id"]))}delete(e,t){return this.client.delete("/loyalties/"+o(e),t)}listRewardAssignments(e,t={}){return this.client.get(`/loyalties/${o(e)}/rewards`,t)}createRewardAssignments(e,t){return this.client.post(`/loyalties/${o(e)}/rewards`,t)}updateRewardAssignment(e,t){return this.client.put(`/loyalties/${o(e)}/rewards/${t.id}`,p(t,["id"]))}deleteRewardAssignment(e,t){return this.client.delete(`/loyalties/${o(e)}/rewards/${t}`)}listEarningRules(e,t={}){return this.client.get(`/loyalties/${o(e)}/earning-rules`,t)}createEarningRule(e,t){return this.client.post(`/loyalties/${o(e)}/earning-rules`,t)}updateEarningRule(e,t){return this.client.put(`/loyalties/${o(e)}/earning-rules/${t.id}`,p(t,["id"]))}deleteEarningRule(e,t){return this.client.delete(`/loyalties/${o(e)}/earning-rules/${t}`)}listMembers(e,t){return this.client.get(`/loyalties/${o(e)}/members`,t)}createMember(e,t){return this.client.post(`/loyalties/${o(e)}/members`,t)}getMember(e,t){return this.client.get(`/loyalties/${o(e)}/members/${t}`)}getMemberActivities(e,t){return this.client.get(`/loyalties/${o(e)}/members/${t}/activities`)}addPoints(e,t,s){return this.client.post(`/loyalties/${o(e)}/members/${t}/balance`,s)}redeemReward(e,t,s){return this.client.post(`/loyalties/${o(e)}/members/${o(t)}/redemption`,s)}}class H{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/"+o(e))}update(e){return this.client.put("/validation-rules/"+o(e.id),p(e,["id"]))}delete(e){return this.client.delete("/validation-rules/"+o(e))}createAssignment(e,t){return this.client.post(`/validation-rules/${o(e)}/assignments`,t)}deleteAssignment(e,t){return this.client.delete(`/validation-rules/${o(e)}/assignments/${o(t)}`)}validate(e,t={}){return this.client.post(`/validation-rules/${o(e)}/validation`,t)}list(e={}){return this.client.get("/validation-rules",e)}listAssignments(e,t={}){return this.client.get(`/validation-rules/${o(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/"+o(e))}delete(e){return this.client.delete("/segments/"+o(e))}list(e){return this.client.get(`/customers/${o(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 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/"+o(e))}}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;h(l(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()),h(u(null==i?void 0:i.customer),'client.validate: expected "params.customer" to be an object'),h(a(null==i||null==(t=i.customer)?void 0:t.source_id),'client.validate: expected "params.customer.source_id" to be a string'),h(u(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 h(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;h(l(t),"client.publish - expected payload to be an object");const u={};return u.customer=null!=(i=t.customer)?i:{},u.customer.source_id=null!=(r=null==(n=t.customer)?void 0:n.source_id)?r:this.trackingId,u.channel=null!=(o=t.channel)?o:"Voucherify.js",h(c(null==(a=u.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",u,s)}track(e,t,s,i,r){var n,o;h(c(e),"client.track - expected event name to be an string"),h(l(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,h(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/${o(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;h(l(e),'VoucherifyCustomer: expected "options" argument to be an object'),h(c(e.clientApplicationId),'VoucherifyCustomer: "options.clientApplicationId" is required'),h(c(e.clientSecretKey),'VoucherifyCustomer: "options.clientSecretKey" is required'),h(a(e.apiUrl),'VoucherifyCustomer: expected "options.baseUrl" to be a string'),h(a(e.trackingId),'VoucherifyCustomer: expected "options.trackingId" to be a string');let i={"X-Client-Application-Id":e.clientApplicationId,"X-Client-Token":e.clientSecretKey,"X-Voucherify-Channel":d()+"-ClientSide-SDK-v2.1.7"};d().startsWith("Node")&&(h(c(e.origin),'VoucherifyCustomer: "options.origin" is required in Node.js'),i.origin=e.origin),l(e.customHeaders)&&(i=Object.assign({},i,e.customHeaders));const r=new n({basePath:"client/v1",baseURL:null!=(t=e.apiUrl)?t:"https://api.voucherify.io",headers:i,exposeErrorCause:null!=(s=e.exposeErrorCause)&&s});return new O(r,e.trackingId)},e.VoucherifyServerSide=function(e){var t,s;h(l(e),'VoucherifyServerSide: the "options" argument must be an object'),h(c(e.applicationId),'VoucherifyServerSide: "options.applicationId" is required'),h(c(e.secretKey),'VoucherifyServerSide: "options.secretKey" is required'),h(a(e.apiVersion),'VoucherifyServerSide: expected "options.apiVersion" to be a string'),h(a(e.channel),'VoucherifyServerSide: expected "options.channel" to be a string');let i={"X-App-Id":e.applicationId,"X-App-Token":e.secretKey,"X-Voucherify-Channel":e.channel||d()+"-SDK-v2.1.7","Content-Type":"application/json"};e.apiVersion&&(i["X-Voucherify-API-Version"]=e.apiVersion),l(e.customHeaders)&&(i=Object.assign({},i,e.customHeaders)),d().startsWith("Node")||h(!0===e.dangerouslySetSecretKeyInBrowser,`VoucherifyServerSide: you're exposing your secretKey to a ${d().toLowerCase()} environment. This is generally considered a bad practice. Did you mean to use 'VoucherifyClientSide'?`);const r=new n({basePath:"v1",baseURL:null!=(t=e.apiUrl)?t:"https://api.voucherify.io",headers:i,exposeErrorCause:null!=(s=e.exposeErrorCause)&&s}),o=new m(r),u=new w(r),p=new k(r,u),g=new v(r),y=new f(r),$=new _(r),O=new b(r,y),T=new x(r),D=new C(r,T);return{vouchers:p,campaigns:g,distributions:O,validations:new R(r,D),redemptions:new S(r),promotions:D,customers:new V(r),consents:new j(r),orders:new L(r),products:new q(r),rewards:new A(r),loyalties:new I(r),segments:new U(r),validationRules:new H(r),events:$,asyncActions:o,apiLimitsHandler:new E(r),metadataSchemas:new P(r)}},Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("axios"),require("qs")):"function"==typeof define&&define.amd?define(["exports","axios","qs"],t):t((e=e||self).VoucherifySDK={},e.axios,e.Qs)}(this,(function(e,t,s){"use strict";var i;t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,s=s&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s,(i=e.DiscountVouchersTypesEnum||(e.DiscountVouchersTypesEnum={})).AMOUNT="AMOUNT",i.PERCENT="PERCENT",i.UNIT="UNIT",i.FIXED="FIXED";class r 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 n{constructor({basePath:e,baseURL:s,headers:i,exposeErrorCause:n}){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.basePath=e,this.baseURL=s,this.headers=i,this.exposeErrorCause=n,this.lastResponseHeaders={},this.isLastResponseHeadersSet=!1,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 r(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)}});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});return this.setLastResponseHeaders(n.headers),n.data}async put(e,t,s){const i=await this.request.put(e,t,{params:s});return this.setLastResponseHeaders(i.headers),i.data}async delete(e,t){const s=await this.request.delete(e,{params:t});return this.setLastResponseHeaders(s.headers),s.data}}function o(e=""){return encodeURIComponent(e)}function c(e){return"string"==typeof e}function a(e){return null==e||c(e)}function l(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}function u(e){return null==e||l(e)}function d(){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 h(e,t){if(!e)throw new Error(t)}function p(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>!t.includes(e)))}class m{constructor(e){this.client=void 0,this.client=e}get(e){return this.client.get("/async-actions/"+o(e))}list(e){return this.client.get("/async-actions",e)}}class g{constructor(e){this.client=void 0,this.client=e}examine(e={},t){return this.client.post("/campaigns/qualification",e,t)}}class v{constructor(e){this.client=void 0,this.qualifications=void 0,this.client=e,this.qualifications=new g(this.client)}create(e){return this.client.post("/campaigns",e)}update(e,t){return this.client.put("/campaigns/"+o(e),t)}get(e){return this.client.get("/campaigns/"+o(e))}delete(e,t={}){return this.client.delete("/campaigns/"+o(e),t)}addVoucher(e,t={},s={}){return this.client.post(`/campaigns/${o(e)}/vouchers`,t,s)}addCertainVoucher(e,t,s={}){return this.client.post(`/campaigns/${o(e)}/vouchers/${o(t)}`,s)}importVouchers(e,t){return this.client.post(`/campaigns/${o(e)}/import`,t)}list(e={}){return this.client.get("/campaigns",e)}}class y{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 y(this.client)}}class f{constructor(e){this.client=void 0,this.client=e}create(e){return this.client.post("/exports",e)}get(e){return this.client.get("/exports/"+o(e))}delete(e){return this.client.delete("/exports/"+o(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 w{constructor(e){this.client=void 0,this.client=e}create(e,t){return this.client.post(`/vouchers/${o(e)}/balance`,t)}}class ${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 $(this.client)}create(e){return this.client.post("/vouchers/"+o(e.code),e)}get(e){return this.client.get("/vouchers/"+o(e))}update(e){return this.client.put("/vouchers/"+o(e.code),e)}delete(e,t={}){return this.client.delete("/vouchers/"+o(e),t)}list(e={}){return this.client.get("/vouchers",e)}enable(e){return this.client.post(`/vouchers/${o(e)}/enable`,{})}disable(e){return this.client.post(`/vouchers/${o(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/${o(e)}/sessions/${o(t)}`)}}class R{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/${o(e)}/validate`,t)}validate(e,t={}){return l(e)?this.promotions.validate(e):this.validateVoucher(e,t)}validateStackable(e){return this.client.post("/validations",e)}}class S{constructor(e){this.client=void 0,this.client=e}redeem(e,t={}){return this.client.post(`/vouchers/${o(e)}/redemption`,t)}redeemStackable(e){return this.client.post("/redemptions",e)}get(e){return this.client.get("/redemptions/"+o(e))}list(e={}){return this.client.get("/redemptions",e)}getForVoucher(e){return this.client.get(`/vouchers/${o(e)}/redemption`)}rollback(e,t){let s={},i={};if(c(t))s.reason=t;else if(l(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/${o(e)}/rollback`,i,s)}rollbackStackable(e,t,s){return this.client.post(`/redemptions/${o(e)}/rollbacks`,t,s)}}class x{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/${o(e)}/tiers`)}create(e,t){return this.client.post(`/promotions/${o(e)}/tiers`,t)}redeem(e,t){return this.client.post(`/promotions/tiers/${o(e)}/redemption`,t)}update(e){return this.client.put("/promotions/tiers/"+o(e.id),e)}delete(e){return this.client.delete("/promotions/tiers/"+o(e))}}class C{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 V{constructor(e){this.client=void 0,this.client=e}create(e){return this.client.post("/customers",e)}get(e){return this.client.get("/customers/"+o(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=p(e,["id"]);return this.client.put("/customers/"+o(t),s)}delete(e){return this.client.delete("/customers/"+o(e))}updateConsents(e,t){return this.client.put(`/customers/${o(e)}/consents`,t)}listActivities(e,t){return this.client.get(`/customers/${o(e)}/activities`,t)}}class j{constructor(e){this.client=void 0,this.client=e}list(){return this.client.get("/consents")}}class L{constructor(e){this.client=void 0,this.client=e}create(e){return this.client.post("/orders",e)}get(e){return this.client.get("/orders/"+o(e))}update(e){return this.client.put("/orders/"+o(e.id||e.source_id),p(e,["id"]))}list(e={}){return this.client.get("/orders",e)}import(e){return this.client.post("/orders/import",e)}}class q{constructor(e){this.client=void 0,this.client=e}create(e){return this.client.post("/products",e)}get(e){return this.client.get("/products/"+o(e))}update(e){return this.client.put("/products/"+o(e.id||e.source_id),p(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/"+o(e),t)}list(e){return this.client.get("/products",e)}createSku(e,t){return this.client.post(`/products/${o(e)}/skus`,t)}getSku(e){return this.client.get("/skus/"+o(e))}updateSku(e,t){return this.client.put(`/products/${o(e)}/skus/${o(t.id||t.source_id)}`,p(t,["id"]))}deleteSku(e,t,s){return this.client.delete(`/products/${o(e)}/skus/${o(t)}`,s)}listSkus(e){return this.client.get(`/products/${o(e)}/skus`)}}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/"+o(e))}update(e){return this.client.put("/rewards/"+o(e.id),p(e,["id"]))}delete(e){return this.client.delete("/rewards/"+o(e))}listAssignments(e,t={}){return this.client.get(`/rewards/${o(e)}/assignments`,t)}createAssignment(e,t){return this.client.post(`/rewards/${o(e)}/assignments`,t)}updateAssignment(e,t){return this.client.put(`/rewards/${o(e)}/assignments/${o(t.id)}`,p(t,["id"]))}deleteAssignment(e,t){return this.client.delete(`/rewards/${o(e)}/assignments/${o(t)}`)}}class I{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/"+o(e))}update(e){return this.client.put("/loyalties/"+o(e.id),p(e,["id"]))}delete(e,t){return this.client.delete("/loyalties/"+o(e),t)}listRewardAssignments(e,t={}){return this.client.get(`/loyalties/${o(e)}/rewards`,t)}createRewardAssignments(e,t){return this.client.post(`/loyalties/${o(e)}/rewards`,t)}updateRewardAssignment(e,t){return this.client.put(`/loyalties/${o(e)}/rewards/${t.id}`,p(t,["id"]))}deleteRewardAssignment(e,t){return this.client.delete(`/loyalties/${o(e)}/rewards/${t}`)}listEarningRules(e,t={}){return this.client.get(`/loyalties/${o(e)}/earning-rules`,t)}createEarningRule(e,t){return this.client.post(`/loyalties/${o(e)}/earning-rules`,t)}updateEarningRule(e,t){return this.client.put(`/loyalties/${o(e)}/earning-rules/${t.id}`,p(t,["id"]))}deleteEarningRule(e,t){return this.client.delete(`/loyalties/${o(e)}/earning-rules/${t}`)}listMembers(e,t){return this.client.get(`/loyalties/${o(e)}/members`,t)}createMember(e,t){return this.client.post(`/loyalties/${o(e)}/members`,t)}getMember(e,t){return this.client.get(`/loyalties/${o(e)}/members/${t}`)}getMemberActivities(e,t){return this.client.get(`/loyalties/${o(e)}/members/${t}/activities`)}addPoints(e,t,s){return this.client.post(`/loyalties/${o(e)}/members/${t}/balance`,s)}redeemReward(e,t,s){return this.client.post(`/loyalties/${o(e)}/members/${o(t)}/redemption`,s)}}class H{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/"+o(e))}update(e){return this.client.put("/validation-rules/"+o(e.id),p(e,["id"]))}delete(e){return this.client.delete("/validation-rules/"+o(e))}createAssignment(e,t){return this.client.post(`/validation-rules/${o(e)}/assignments`,t)}deleteAssignment(e,t){return this.client.delete(`/validation-rules/${o(e)}/assignments/${o(t)}`)}validate(e,t={}){return this.client.post(`/validation-rules/${o(e)}/validation`,t)}list(e={}){return this.client.get("/validation-rules",e)}listAssignments(e,t={}){return this.client.get(`/validation-rules/${o(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/"+o(e))}delete(e){return this.client.delete("/segments/"+o(e))}list(e){return this.client.get(`/customers/${o(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 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/"+o(e))}}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;h(l(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()),h(u(null==i?void 0:i.customer),'client.validate: expected "params.customer" to be an object'),h(a(null==i||null==(t=i.customer)?void 0:t.source_id),'client.validate: expected "params.customer.source_id" to be a string'),h(u(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 h(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;h(l(t),"client.publish - expected payload to be an object");const u={};return u.customer=null!=(i=t.customer)?i:{},u.customer.source_id=null!=(r=null==(n=t.customer)?void 0:n.source_id)?r:this.trackingId,u.channel=null!=(o=t.channel)?o:"Voucherify.js",h(c(null==(a=u.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",u,s)}track(e,t,s,i,r){var n,o;h(c(e),"client.track - expected event name to be an string"),h(l(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,h(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/${o(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;h(l(e),'VoucherifyCustomer: expected "options" argument to be an object'),h(c(e.clientApplicationId),'VoucherifyCustomer: "options.clientApplicationId" is required'),h(c(e.clientSecretKey),'VoucherifyCustomer: "options.clientSecretKey" is required'),h(a(e.apiUrl),'VoucherifyCustomer: expected "options.baseUrl" to be a string'),h(a(e.trackingId),'VoucherifyCustomer: expected "options.trackingId" to be a string');let i={"X-Client-Application-Id":e.clientApplicationId,"X-Client-Token":e.clientSecretKey,"X-Voucherify-Channel":d()+"-ClientSide-SDK-v2.1.8"};d().startsWith("Node")&&(h(c(e.origin),'VoucherifyCustomer: "options.origin" is required in Node.js'),i.origin=e.origin),l(e.customHeaders)&&(i=Object.assign({},i,e.customHeaders));const r=new n({basePath:"client/v1",baseURL:null!=(t=e.apiUrl)?t:"https://api.voucherify.io",headers:i,exposeErrorCause:null!=(s=e.exposeErrorCause)&&s});return new O(r,e.trackingId)},e.VoucherifyServerSide=function(e){var t,s;h(l(e),'VoucherifyServerSide: the "options" argument must be an object'),h(c(e.applicationId),'VoucherifyServerSide: "options.applicationId" is required'),h(c(e.secretKey),'VoucherifyServerSide: "options.secretKey" is required'),h(a(e.apiVersion),'VoucherifyServerSide: expected "options.apiVersion" to be a string'),h(a(e.channel),'VoucherifyServerSide: expected "options.channel" to be a string');let i={"X-App-Id":e.applicationId,"X-App-Token":e.secretKey,"X-Voucherify-Channel":e.channel||d()+"-SDK-v2.1.8","Content-Type":"application/json"};e.apiVersion&&(i["X-Voucherify-API-Version"]=e.apiVersion),l(e.customHeaders)&&(i=Object.assign({},i,e.customHeaders)),d().startsWith("Node")||h(!0===e.dangerouslySetSecretKeyInBrowser,`VoucherifyServerSide: you're exposing your secretKey to a ${d().toLowerCase()} environment. This is generally considered a bad practice. Did you mean to use 'VoucherifyClientSide'?`);const r=new n({basePath:"v1",baseURL:null!=(t=e.apiUrl)?t:"https://api.voucherify.io",headers:i,exposeErrorCause:null!=(s=e.exposeErrorCause)&&s}),o=new m(r),u=new w(r),p=new k(r,u),g=new v(r),y=new f(r),$=new _(r),O=new b(r,y),T=new x(r),D=new C(r,T);return{vouchers:p,campaigns:g,distributions:O,validations:new R(r,D),redemptions:new S(r),promotions:D,customers:new V(r),consents:new j(r),orders:new L(r),products:new q(r),rewards:new A(r),loyalties:new I(r),segments:new U(r),validationRules:new H(r),events:$,asyncActions:o,apiLimitsHandler:new E(r),metadataSchemas:new P(r)}},Object.defineProperty(e,"__esModule",{value:!0})}));
2
2
  //# sourceMappingURL=voucherifysdk.umd.production.min.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voucherify/sdk",
3
- "version": "2.1.7",
3
+ "version": "2.1.8",
4
4
  "description": "Official Voucherify JS SDK",
5
5
  "author": "Voucherify",
6
6
  "license": "MIT",