encore-api-services
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -24,3 +24,4 @@ import { BasketData } from '../typings'; | ||
hasDiscount(): boolean; | ||
getBasketData(): BasketData; | ||
private reduceBasketItemsAmount; | ||
} |
import { BasketData, DeliveryData } from '../typings'; | ||
import { Environment } from '../../typings'; | ||
export declare const getBasketApi: (environment: Environment) => { | ||
upsertBasket: (basketData: BasketData) => Promise<BasketData>; | ||
getBasket: (reference: string) => Promise<BasketData>; | ||
getDeliveries: (reference: string) => Promise<DeliveryData[]>; | ||
}; |
import { Basket, BasketItemsCollection, Delivery } from '../models'; | ||
import { Environment } from '../../typings'; | ||
import { BasketData, BasketItemData } from '../typings'; | ||
export declare const getBasketRepository: (environment: Environment) => { | ||
getBasket: (reference: string) => Promise<Basket>; | ||
getDeliveries: (basketReference: string, basketItems: BasketItemsCollection) => Promise<Delivery[]>; | ||
createBasket: (basketData: BasketData) => Promise<Basket>; | ||
addItem: (basket: Basket, basketItem: BasketItemData) => Promise<Basket>; | ||
removeItem: (basket: Basket, itemId: number) => Promise<Basket>; | ||
}; |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("apiServices",[],e):"object"==typeof exports?exports.apiServices=e():t.apiServices=e()}(window,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=8)}([function(t,e,n){"use strict";var r=n(2),o=n(10),i=Object.prototype.toString;function u(t){return"[object Array]"===i.call(t)}function s(t){return null!==t&&"object"==typeof t}function a(t){return"[object Function]"===i.call(t)}function c(t,e){if(null!==t&&void 0!==t)if("object"!=typeof t&&(t=[t]),u(t))for(var n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.call(null,t[o],o,t)}t.exports={isArray:u,isArrayBuffer:function(t){return"[object ArrayBuffer]"===i.call(t)},isBuffer:o,isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:s,isUndefined:function(t){return void 0===t},isDate:function(t){return"[object Date]"===i.call(t)},isFile:function(t){return"[object File]"===i.call(t)},isBlob:function(t){return"[object Blob]"===i.call(t)},isFunction:a,isStream:function(t){return s(t)&&a(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:c,merge:function t(){var e={};function n(n,r){"object"==typeof e[r]&&"object"==typeof n?e[r]=t(e[r],n):e[r]=n}for(var r=0,o=arguments.length;r<o;r++)c(arguments[r],n);return e},extend:function(t,e,n){return c(e,function(e,o){t[o]=n&&"function"==typeof e?r(e,n):e}),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(t,e,n){"use strict";var r=n(0),o=n(12),i={"Content-Type":"application/x-www-form-urlencoded"};function u(t,e){!r.isUndefined(t)&&r.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var s={adapter:function(){var t;return"undefined"!=typeof XMLHttpRequest?t=n(3):"undefined"!=typeof process&&(t=n(3)),t}(),transformRequest:[function(t,e){return o(e,"Content-Type"),r.isFormData(t)||r.isArrayBuffer(t)||r.isBuffer(t)||r.isStream(t)||r.isFile(t)||r.isBlob(t)?t:r.isArrayBufferView(t)?t.buffer:r.isURLSearchParams(t)?(u(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):r.isObject(t)?(u(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],function(t){s.headers[t]={}}),r.forEach(["post","put","patch"],function(t){s.headers[t]=r.merge(i)}),t.exports=s},function(t,e,n){"use strict";t.exports=function(t,e){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return t.apply(e,n)}}},function(t,e,n){"use strict";var r=n(0),o=n(13),i=n(15),u=n(16),s=n(17),a=n(4),c="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||n(18);t.exports=function(t){return new Promise(function(e,f){var p=t.data,l=t.headers;r.isFormData(p)&&delete l["Content-Type"];var h=new XMLHttpRequest,d="onreadystatechange",y=!1;if("undefined"==typeof window||!window.XDomainRequest||"withCredentials"in h||s(t.url)||(h=new window.XDomainRequest,d="onload",y=!0,h.onprogress=function(){},h.ontimeout=function(){}),t.auth){var m=t.auth.username||"",v=t.auth.password||"";l.Authorization="Basic "+c(m+":"+v)}if(h.open(t.method.toUpperCase(),i(t.url,t.params,t.paramsSerializer),!0),h.timeout=t.timeout,h[d]=function(){if(h&&(4===h.readyState||y)&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in h?u(h.getAllResponseHeaders()):null,r={data:t.responseType&&"text"!==t.responseType?h.response:h.responseText,status:1223===h.status?204:h.status,statusText:1223===h.status?"No Content":h.statusText,headers:n,config:t,request:h};o(e,f,r),h=null}},h.onerror=function(){f(a("Network Error",t,null,h)),h=null},h.ontimeout=function(){f(a("timeout of "+t.timeout+"ms exceeded",t,"ECONNABORTED",h)),h=null},r.isStandardBrowserEnv()){var g=n(19),w=(t.withCredentials||s(t.url))&&t.xsrfCookieName?g.read(t.xsrfCookieName):void 0;w&&(l[t.xsrfHeaderName]=w)}if("setRequestHeader"in h&&r.forEach(l,function(t,e){void 0===p&&"content-type"===e.toLowerCase()?delete l[e]:h.setRequestHeader(e,t)}),t.withCredentials&&(h.withCredentials=!0),t.responseType)try{h.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&h.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&h.upload&&h.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then(function(t){h&&(h.abort(),f(t),h=null)}),void 0===p&&(p=null),h.send(p)})}},function(t,e,n){"use strict";var r=n(14);t.exports=function(t,e,n,o,i){var u=new Error(t);return r(u,e,n,o,i)}},function(t,e,n){"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},function(t,e,n){"use strict";function r(t){this.message=t}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,t.exports=r},function(t,e,n){t.exports=n(9)},function(t,e,n){"use strict";var r,o,i,u;n.r(e),function(t){t.Dev="dev",t.Qa="qa",t.Staging="staging",t.Prod="prod"}(r||(r={})),function(t){t.Collection="collection",t.Postage="postage",t.Eticket="eticket"}(o||(o={})),function(t){t.Active="active",t.Expired="expired",t.Confirmed="confirmed"}(i||(i={})),function(t){t.Show="SHW",t.Attraction="ATT",t.Flexitickets="FLX",t.GiftVoucher="GVC",t.Postage="PST"}(u||(u={}));var s,a,c,f,p,l=n(7),h=n.n(l),d=function(){return(d=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},y=function(t){var e={baseURL:t},n=h.a.create(e);return n.interceptors.response.use(m,v),n},m=function(t){var e=t.data;return e?d({},t,{data:e.response}):t},v=function(t){var e=t.response;return e?e.data.context.errors:[]},g=((s={})[r.Dev]="https://basket.dev.aws.encoretix.co.uk/api/v1",s[r.Qa]="https://basket.qa.aws.encoretix.co.uk/api/v1",s[r.Staging]="https://basket.staging.aws.encoretix.co.uk/api/v1",s[r.Prod]="https://basket.prod.aws.encoretix.co.uk/api/v1",s),w=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function s(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):new n(function(e){e(t.value)}).then(u,s)}a((r=r.apply(t,e||[])).next())})},b=function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},x=function(t){var e=y(g[t]);return{getBasket:function(t){return w(void 0,void 0,void 0,function(){var n;return b(this,function(r){switch(r.label){case 0:return n="/baskets/"+t,[4,e.get(n)];case 1:return[2,r.sent().data]}})})},getDeliveries:function(t){return w(void 0,void 0,void 0,function(){var n;return b(this,function(r){switch(r.label){case 0:return n="/baskets/"+t+"/deliveryOptions",[4,e.get(n)];case 1:return[2,r.sent().data]}})})}}},S=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function s(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):new n(function(e){e(t.value)}).then(u,s)}a((r=r.apply(t,e||[])).next())})},k=function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},P=function(){function t(t){var e=t.id,n=t.quantity,r=t.productId,o=t.productName,i=t.productType,u=t.faceValue,s=t.salePrice,a=t.date,c=t.seats,f=t.venueId;this.id=e,this.quantity=n,this.productId=r,this.productName=o,this.productType=i,this.faceValue=u,this.salePrice=s,this.date=new Date(a),this.seats=c,this.venueId=f}return t.prototype.getId=function(){return this.id},t.prototype.getQuantity=function(){return this.quantity},t.prototype.getProductId=function(){return this.productId},t.prototype.getProductName=function(){return this.productName},t.prototype.isVoucher=function(){return this.productType===u.GiftVoucher},t.prototype.isPostage=function(){return this.productType===u.Postage},t.prototype.isFlexiticket=function(){return this.productType===u.Flexitickets},t.prototype.isShow=function(){return this.productType===u.Show},t.prototype.isAttraction=function(){return this.productType===u.Attraction},t.prototype.getProductType=function(){return this.productType},t.prototype.getFaceValue=function(){return this.faceValue},t.prototype.getSalePrice=function(){return this.salePrice},t.prototype.getFaceValueAmount=function(){return this.faceValue.value},t.prototype.getSalePriceAmount=function(){return this.salePrice.value},t.prototype.hasDiscount=function(){return this.getFaceValueAmount()>this.getSalePriceAmount()},t.prototype.getDiscount=function(){return this.quantity*(this.getFaceValueAmount()-this.getSalePriceAmount())},t.prototype.getTotalPrice=function(){return this.quantity*this.getSalePriceAmount()},t.prototype.getPriceBeforeDiscount=function(){return this.quantity*this.getFaceValueAmount()},t.prototype.getDate=function(){return this.date},t.prototype.getSeats=function(){return this.seats},t.prototype.setProductDetails=function(t){this.productPromise=t},t.prototype.getProductDetails=function(){return S(this,void 0,void 0,function(){return k(this,function(t){return[2,this.productPromise]})})},t.prototype.setImages=function(t){return this.images=t},t.prototype.getImages=function(){return this.images},t.prototype.getVenueId=function(){return this.venueId},t}(),A=function(){return(A=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},C=function(){function t(t){this.items=[],this.items=t.map(function(t,e){return new P(A({},t,{id:(e+1).toString()}))})}return t.prototype.getItems=function(){return this.items.slice()},t.prototype.hasVoucher=function(){return this.items.some(function(t){return t.isVoucher()})},t.prototype.hasPostage=function(){return this.items.some(function(t){return t.isPostage()})},t.prototype.hasFlexiticket=function(){return this.items.some(function(t){return t.isFlexiticket()})},t.prototype.hasShow=function(){return this.items.some(function(t){return t.isShow()})},t.prototype.hasAttraction=function(){return this.items.some(function(t){return t.isAttraction()})},t.prototype.getLength=function(){return this.items.length},t.prototype.getAttractions=function(){return this.items.filter(function(t){return t.isAttraction()})},t.prototype.getFlexitickets=function(){return this.items.filter(function(t){return t.isFlexiticket()})},t.prototype.getPostage=function(){return this.items.find(function(t){return t.isPostage()})},t}(),T=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function s(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):new n(function(e){e(t.value)}).then(u,s)}a((r=r.apply(t,e||[])).next())})},E=function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},D=function(){function t(t){this.basketData=t;var e=t.reservations,n=t.expiredAt,r=t.status,o=t.reference;this.itemsCollection=new C(e),this.expiredAt=new Date(n),this.status=r,this.reference=o}return t.prototype.getExpiredDate=function(){return this.expiredAt},t.prototype.isExpired=function(){return this.status===i.Expired||this.expiredAt<new Date},t.prototype.isPaid=function(){return this.status===i.Confirmed},t.prototype.getReference=function(){return this.reference},t.prototype.getItemsCollection=function(){return this.itemsCollection},t.prototype.setDeliveries=function(t){this.deliveriesPromise=t},t.prototype.getDeliveries=function(){return T(this,void 0,void 0,function(){return E(this,function(t){return[2,this.deliveriesPromise]})})},t.prototype.isEmpty=function(){return!this.itemsCollection.getLength()},t.prototype.getTotalPrice=function(){return this.reduceBasketItemsAmount(function(t,e){return t+e.getTotalPrice()})},t.prototype.getTotalDiscount=function(){return this.reduceBasketItemsAmount(function(t,e){return t+e.getDiscount()})},t.prototype.getTotalPriceBeforeDiscount=function(){return this.reduceBasketItemsAmount(function(t,e){return t+e.getPriceBeforeDiscount()})},t.prototype.hasDiscount=function(){return this.itemsCollection.getItems().some(function(t){return t.hasDiscount()})},t.prototype.reduceBasketItemsAmount=function(t){return this.itemsCollection.getItems().reduce(t,0)},t}(),B=((a={})[o.Collection]={name:"Collect at the Box Office",voucherName:"Free postal delivery",attractionName:"Print at home voucher"},a[o.Postage]={name:"By Post – UK Addresses only"},a[o.Eticket]={name:"Print at Home"},a),j=function(){function t(t,e){var n=t.method,r=t.charge;this.amount=r,this.method=n,this.setName(e)}return t.prototype.getAmount=function(){return this.amount},t.prototype.getMethod=function(){return this.method},t.prototype.getName=function(){return this.name},t.prototype.setName=function(t){this.name=this.method===o.Collection?this.getCollectionDeliveryName(t):B[this.method].name},t.prototype.getCollectionDeliveryName=function(t){var e=B[o.Collection];return t.hasVoucher()?e.voucherName:t.hasAttraction()?e.attractionName:e.name},t}(),R=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function s(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):new n(function(e){e(t.value)}).then(u,s)}a((r=r.apply(t,e||[])).next())})},O=function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},N=function(t){var e=x(t);return{getBasket:function(t){return R(void 0,void 0,void 0,function(){var n;return O(this,function(r){switch(r.label){case 0:return[4,e.getBasket(t)];case 1:return n=r.sent(),[2,new D(n)]}})})},getDeliveries:function(t,n){return R(void 0,void 0,void 0,function(){return O(this,function(r){switch(r.label){case 0:return[4,e.getDeliveries(t)];case 1:return[2,r.sent().map(function(t){return new j(t,n)})]}})})}}};!function(t){t.Products="products"}(c||(c={})),function(t){t.Square="square",t.Landscape="landscape",t.Portrait="portrait",t.Default="default"}(f||(f={}));var q,I=((p={})[r.Dev]={api:"https://content-service.devtixuk.io/api/v1",images:"https://content-service.devtixuk.com/images"},p[r.Qa]={api:"https://content-service.qatixuk.io/api/v1",images:"https://content-service.qatixuk.com/images"},p[r.Staging]={api:"https://content-service.stagetixuk.io/api/v1",images:"https://content-service.stagetixuk.com/images"},p[r.Prod]={api:"https://content-service.tixuk.io/api/v1",images:"https://content-service.tixuk.com/images"},p),F=((q={})[f.Default]=[{screenSize:"xxl",imageSize:80},{screenSize:"xl",imageSize:64},{screenSize:"lg",imageSize:48},{screenSize:"md",imageSize:64},{screenSize:"sm",imageSize:64}],q),L=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function s(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):new n(function(e){e(t.value)}).then(u,s)}a((r=r.apply(t,e||[])).next())})},U=function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},V=function(t){var e=I[t],n=y(e.api);return{getProduct:function(t){return L(void 0,void 0,void 0,function(){var e;return U(this,function(r){switch(r.label){case 0:return e="/products/"+t,[4,n.get(e)];case 1:return[2,r.sent().data]}})})},getImages:function(t,n,r){return void 0===r&&(r=f.Default),F[r].map(function(o){var i=o.screenSize,u=o.imageSize;return{screenSize:i,url:e.images+"/"+t+"/"+n+"/"+r+"?width="+u}})}}},z=function(){function t(t){var e=t.name,n=t.showType,r=t.venue,o=t.id;this.name=e,this.type=n,this.venue=r,this.id=o}return t.prototype.getName=function(){return this.name},t.prototype.getType=function(){return this.type},t.prototype.getVenue=function(){return this.venue},t}(),_=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function s(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):new n(function(e){e(t.value)}).then(u,s)}a((r=r.apply(t,e||[])).next())})},G=function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},H=function(t){var e=V(t),n=e.getImages,r=e.getProduct;return{getProduct:function(t){return _(void 0,void 0,void 0,function(){var e;return G(this,function(n){switch(n.label){case 0:return[4,r(t)];case 1:return e=n.sent(),[2,new z(e)]}})})},getImages:n}};n.d(e,"Environment",function(){return r}),n.d(e,"getBasketApi",function(){return x}),n.d(e,"getBasketRepository",function(){return N}),n.d(e,"DeliveryMethod",function(){return o}),n.d(e,"BasketStatus",function(){return i}),n.d(e,"ProductType",function(){return u}),n.d(e,"Basket",function(){return D}),n.d(e,"Delivery",function(){return j}),n.d(e,"BasketItemsCollection",function(){return C}),n.d(e,"BasketItem",function(){return P}),n.d(e,"getContentServiceRepository",function(){return H}),n.d(e,"getContentServiceApi",function(){return V}),n.d(e,"Product",function(){return z}),n.d(e,"EntityType",function(){return c}),n.d(e,"ImageOrientation",function(){return f})},function(t,e,n){"use strict";var r=n(0),o=n(2),i=n(11),u=n(1);function s(t){var e=new i(t),n=o(i.prototype.request,e);return r.extend(n,i.prototype,e),r.extend(n,e),n}var a=s(u);a.Axios=i,a.create=function(t){return s(r.merge(u,t))},a.Cancel=n(6),a.CancelToken=n(25),a.isCancel=n(5),a.all=function(t){return Promise.all(t)},a.spread=n(26),t.exports=a,t.exports.default=a},function(t,e){function n(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)} | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("apiServices",[],e):"object"==typeof exports?exports.apiServices=e():t.apiServices=e()}(window,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=8)}([function(t,e,n){"use strict";var r=n(2),o=n(10),i=Object.prototype.toString;function u(t){return"[object Array]"===i.call(t)}function s(t){return null!==t&&"object"==typeof t}function a(t){return"[object Function]"===i.call(t)}function c(t,e){if(null!==t&&void 0!==t)if("object"!=typeof t&&(t=[t]),u(t))for(var n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.call(null,t[o],o,t)}t.exports={isArray:u,isArrayBuffer:function(t){return"[object ArrayBuffer]"===i.call(t)},isBuffer:o,isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:s,isUndefined:function(t){return void 0===t},isDate:function(t){return"[object Date]"===i.call(t)},isFile:function(t){return"[object File]"===i.call(t)},isBlob:function(t){return"[object Blob]"===i.call(t)},isFunction:a,isStream:function(t){return s(t)&&a(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:c,merge:function t(){var e={};function n(n,r){"object"==typeof e[r]&&"object"==typeof n?e[r]=t(e[r],n):e[r]=n}for(var r=0,o=arguments.length;r<o;r++)c(arguments[r],n);return e},extend:function(t,e,n){return c(e,function(e,o){t[o]=n&&"function"==typeof e?r(e,n):e}),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(t,e,n){"use strict";var r=n(0),o=n(12),i={"Content-Type":"application/x-www-form-urlencoded"};function u(t,e){!r.isUndefined(t)&&r.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var s={adapter:function(){var t;return"undefined"!=typeof XMLHttpRequest?t=n(3):"undefined"!=typeof process&&(t=n(3)),t}(),transformRequest:[function(t,e){return o(e,"Content-Type"),r.isFormData(t)||r.isArrayBuffer(t)||r.isBuffer(t)||r.isStream(t)||r.isFile(t)||r.isBlob(t)?t:r.isArrayBufferView(t)?t.buffer:r.isURLSearchParams(t)?(u(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):r.isObject(t)?(u(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],function(t){s.headers[t]={}}),r.forEach(["post","put","patch"],function(t){s.headers[t]=r.merge(i)}),t.exports=s},function(t,e,n){"use strict";t.exports=function(t,e){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return t.apply(e,n)}}},function(t,e,n){"use strict";var r=n(0),o=n(13),i=n(15),u=n(16),s=n(17),a=n(4),c="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||n(18);t.exports=function(t){return new Promise(function(e,f){var p=t.data,l=t.headers;r.isFormData(p)&&delete l["Content-Type"];var h=new XMLHttpRequest,d="onreadystatechange",y=!1;if("undefined"==typeof window||!window.XDomainRequest||"withCredentials"in h||s(t.url)||(h=new window.XDomainRequest,d="onload",y=!0,h.onprogress=function(){},h.ontimeout=function(){}),t.auth){var m=t.auth.username||"",v=t.auth.password||"";l.Authorization="Basic "+c(m+":"+v)}if(h.open(t.method.toUpperCase(),i(t.url,t.params,t.paramsSerializer),!0),h.timeout=t.timeout,h[d]=function(){if(h&&(4===h.readyState||y)&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in h?u(h.getAllResponseHeaders()):null,r={data:t.responseType&&"text"!==t.responseType?h.response:h.responseText,status:1223===h.status?204:h.status,statusText:1223===h.status?"No Content":h.statusText,headers:n,config:t,request:h};o(e,f,r),h=null}},h.onerror=function(){f(a("Network Error",t,null,h)),h=null},h.ontimeout=function(){f(a("timeout of "+t.timeout+"ms exceeded",t,"ECONNABORTED",h)),h=null},r.isStandardBrowserEnv()){var g=n(19),w=(t.withCredentials||s(t.url))&&t.xsrfCookieName?g.read(t.xsrfCookieName):void 0;w&&(l[t.xsrfHeaderName]=w)}if("setRequestHeader"in h&&r.forEach(l,function(t,e){void 0===p&&"content-type"===e.toLowerCase()?delete l[e]:h.setRequestHeader(e,t)}),t.withCredentials&&(h.withCredentials=!0),t.responseType)try{h.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&h.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&h.upload&&h.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then(function(t){h&&(h.abort(),f(t),h=null)}),void 0===p&&(p=null),h.send(p)})}},function(t,e,n){"use strict";var r=n(14);t.exports=function(t,e,n,o,i){var u=new Error(t);return r(u,e,n,o,i)}},function(t,e,n){"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},function(t,e,n){"use strict";function r(t){this.message=t}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,t.exports=r},function(t,e,n){t.exports=n(9)},function(t,e,n){"use strict";var r,o,i,u;n.r(e),function(t){t.Dev="dev",t.Qa="qa",t.Staging="staging",t.Prod="prod"}(r||(r={})),function(t){t.Collection="collection",t.Postage="postage",t.Eticket="eticket"}(o||(o={})),function(t){t.Active="active",t.Expired="expired",t.Confirmed="confirmed"}(i||(i={})),function(t){t.Show="SHW",t.Attraction="ATT",t.Flexitickets="FLX",t.GiftVoucher="GVC",t.Postage="PST"}(u||(u={}));var s,a,c,f,p,l=n(7),h=n.n(l),d=function(){return(d=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},y=function(t){var e={baseURL:t},n=h.a.create(e);return n.interceptors.response.use(m,v),n},m=function(t){var e=t.data;return e?d({},t,{data:e.response}):t},v=function(t){var e=t.response;return e?e.data.context.errors:[]},g=((s={})[r.Dev]="https://basket.dev.aws.encoretix.co.uk/api/v1",s[r.Qa]="https://basket.qa.aws.encoretix.co.uk/api/v1",s[r.Staging]="https://basket.staging.aws.encoretix.co.uk/api/v1",s[r.Prod]="https://basket.prod.aws.encoretix.co.uk/api/v1",s),w=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function s(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):new n(function(e){e(t.value)}).then(u,s)}a((r=r.apply(t,e||[])).next())})},b=function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},x=function(t){var e=y(g[t]);return{upsertBasket:function(t){return w(void 0,void 0,void 0,function(){return b(this,function(n){switch(n.label){case 0:return[4,e.patch("/baskets",t)];case 1:return[2,n.sent().data]}})})},getBasket:function(t){return w(void 0,void 0,void 0,function(){var n;return b(this,function(r){switch(r.label){case 0:return n="/baskets/"+t,[4,e.get(n)];case 1:return[2,r.sent().data]}})})},getDeliveries:function(t){return w(void 0,void 0,void 0,function(){var n;return b(this,function(r){switch(r.label){case 0:return n="/baskets/"+t+"/deliveryOptions",[4,e.get(n)];case 1:return[2,r.sent().data]}})})}}},k=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function s(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):new n(function(e){e(t.value)}).then(u,s)}a((r=r.apply(t,e||[])).next())})},S=function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},P=function(){function t(t){var e=t.id,n=t.quantity,r=t.productId,o=t.productName,i=t.productType,u=t.faceValue,s=t.salePrice,a=t.date,c=t.seats,f=t.venueId;this.id=e,this.quantity=n,this.productId=r,this.productName=o,this.productType=i,this.faceValue=u,this.salePrice=s,this.date=new Date(a),this.seats=c,this.venueId=f}return t.prototype.getId=function(){return this.id},t.prototype.getQuantity=function(){return this.quantity},t.prototype.getProductId=function(){return this.productId},t.prototype.getProductName=function(){return this.productName},t.prototype.isVoucher=function(){return this.productType===u.GiftVoucher},t.prototype.isPostage=function(){return this.productType===u.Postage},t.prototype.isFlexiticket=function(){return this.productType===u.Flexitickets},t.prototype.isShow=function(){return this.productType===u.Show},t.prototype.isAttraction=function(){return this.productType===u.Attraction},t.prototype.getProductType=function(){return this.productType},t.prototype.getFaceValue=function(){return this.faceValue},t.prototype.getSalePrice=function(){return this.salePrice},t.prototype.getFaceValueAmount=function(){return this.faceValue.value},t.prototype.getSalePriceAmount=function(){return this.salePrice.value},t.prototype.hasDiscount=function(){return this.getFaceValueAmount()>this.getSalePriceAmount()},t.prototype.getDiscount=function(){return this.quantity*(this.getFaceValueAmount()-this.getSalePriceAmount())},t.prototype.getTotalPrice=function(){return this.quantity*this.getSalePriceAmount()},t.prototype.getPriceBeforeDiscount=function(){return this.quantity*this.getFaceValueAmount()},t.prototype.getDate=function(){return this.date},t.prototype.getSeats=function(){return this.seats},t.prototype.setProductDetails=function(t){this.productPromise=t},t.prototype.getProductDetails=function(){return k(this,void 0,void 0,function(){return S(this,function(t){return[2,this.productPromise]})})},t.prototype.setImages=function(t){return this.images=t},t.prototype.getImages=function(){return this.images},t.prototype.getVenueId=function(){return this.venueId},t}(),A=function(){return(A=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},C=function(){function t(t){this.items=[],this.items=t.map(function(t,e){return new P(A({},t,{id:(e+1).toString()}))})}return t.prototype.getItems=function(){return this.items.slice()},t.prototype.hasVoucher=function(){return this.items.some(function(t){return t.isVoucher()})},t.prototype.hasPostage=function(){return this.items.some(function(t){return t.isPostage()})},t.prototype.hasFlexiticket=function(){return this.items.some(function(t){return t.isFlexiticket()})},t.prototype.hasShow=function(){return this.items.some(function(t){return t.isShow()})},t.prototype.hasAttraction=function(){return this.items.some(function(t){return t.isAttraction()})},t.prototype.getLength=function(){return this.items.length},t.prototype.getAttractions=function(){return this.items.filter(function(t){return t.isAttraction()})},t.prototype.getFlexitickets=function(){return this.items.filter(function(t){return t.isFlexiticket()})},t.prototype.getPostage=function(){return this.items.find(function(t){return t.isPostage()})},t}(),T=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function s(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):new n(function(e){e(t.value)}).then(u,s)}a((r=r.apply(t,e||[])).next())})},D=function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},E=function(){function t(t){this.basketData=t;var e=t.reservations,n=t.expiredAt,r=t.status,o=t.reference;this.itemsCollection=new C(e),this.expiredAt=new Date(n),this.status=r,this.reference=o}return t.prototype.getExpiredDate=function(){return this.expiredAt},t.prototype.isExpired=function(){return this.status===i.Expired||this.expiredAt<new Date},t.prototype.isPaid=function(){return this.status===i.Confirmed},t.prototype.getReference=function(){return this.reference},t.prototype.getItemsCollection=function(){return this.itemsCollection},t.prototype.setDeliveries=function(t){this.deliveriesPromise=t},t.prototype.getDeliveries=function(){return T(this,void 0,void 0,function(){return D(this,function(t){return[2,this.deliveriesPromise]})})},t.prototype.isEmpty=function(){return!this.itemsCollection.getLength()},t.prototype.getTotalPrice=function(){return this.reduceBasketItemsAmount(function(t,e){return t+e.getTotalPrice()})},t.prototype.getTotalDiscount=function(){return this.reduceBasketItemsAmount(function(t,e){return t+e.getDiscount()})},t.prototype.getTotalPriceBeforeDiscount=function(){return this.reduceBasketItemsAmount(function(t,e){return t+e.getPriceBeforeDiscount()})},t.prototype.hasDiscount=function(){return this.itemsCollection.getItems().some(function(t){return t.hasDiscount()})},t.prototype.getBasketData=function(){return this.basketData},t.prototype.reduceBasketItemsAmount=function(t){return this.itemsCollection.getItems().reduce(t,0)},t}(),B=((a={})[o.Collection]={name:"Collect at the Box Office",voucherName:"Free postal delivery",attractionName:"Print at home voucher"},a[o.Postage]={name:"By Post – UK Addresses only"},a[o.Eticket]={name:"Print at Home"},a),j=function(){function t(t,e){var n=t.method,r=t.charge;this.amount=r,this.method=n,this.setName(e)}return t.prototype.getAmount=function(){return this.amount},t.prototype.getMethod=function(){return this.method},t.prototype.getName=function(){return this.name},t.prototype.setName=function(t){this.name=this.method===o.Collection?this.getCollectionDeliveryName(t):B[this.method].name},t.prototype.getCollectionDeliveryName=function(t){var e=B[o.Collection];return t.hasVoucher()?e.voucherName:t.hasAttraction()?e.attractionName:e.name},t}(),R=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function s(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):new n(function(e){e(t.value)}).then(u,s)}a((r=r.apply(t,e||[])).next())})},I=function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},O=function(t){var e=x(t);return{getBasket:function(t){return R(void 0,void 0,void 0,function(){var n;return I(this,function(r){switch(r.label){case 0:return[4,e.getBasket(t)];case 1:return n=r.sent(),[2,new E(n)]}})})},getDeliveries:function(t,n){return R(void 0,void 0,void 0,function(){return I(this,function(r){switch(r.label){case 0:return[4,e.getDeliveries(t)];case 1:return[2,r.sent().map(function(t){return new j(t,n)})]}})})},createBasket:function(t){return R(void 0,void 0,void 0,function(){var n;return I(this,function(r){switch(r.label){case 0:return[4,e.upsertBasket(t)];case 1:return n=r.sent(),[2,new E(n)]}})})},addItem:function(t,n){return R(void 0,void 0,void 0,function(){var r,o;return I(this,function(i){switch(i.label){case 0:return(r=t.getBasketData()).reservations=r.reservations.concat([n]),[4,e.upsertBasket(r)];case 1:return o=i.sent(),[2,new E(o)]}})})},removeItem:function(t,n){return R(void 0,void 0,void 0,function(){var r,o;return I(this,function(i){switch(i.label){case 0:return(r=t.getBasketData()).reservations.splice(n,1),[4,e.upsertBasket(r)];case 1:return o=i.sent(),[2,new E(o)]}})})}}};!function(t){t.Products="products"}(c||(c={})),function(t){t.Square="square",t.Landscape="landscape",t.Portrait="portrait",t.Default="default"}(f||(f={}));var N,q=((p={})[r.Dev]={api:"https://content-service.devtixuk.io/api/v1",images:"https://content-service.devtixuk.com/images"},p[r.Qa]={api:"https://content-service.qatixuk.io/api/v1",images:"https://content-service.qatixuk.com/images"},p[r.Staging]={api:"https://content-service.stagetixuk.io/api/v1",images:"https://content-service.stagetixuk.com/images"},p[r.Prod]={api:"https://content-service.tixuk.io/api/v1",images:"https://content-service.tixuk.com/images"},p),F=((N={})[f.Default]=[{screenSize:"xxl",imageSize:80},{screenSize:"xl",imageSize:64},{screenSize:"lg",imageSize:48},{screenSize:"md",imageSize:64},{screenSize:"sm",imageSize:64}],N),L=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function s(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):new n(function(e){e(t.value)}).then(u,s)}a((r=r.apply(t,e||[])).next())})},U=function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},V=function(t){var e=q[t],n=y(e.api);return{getProduct:function(t){return L(void 0,void 0,void 0,function(){var e;return U(this,function(r){switch(r.label){case 0:return e="/products/"+t,[4,n.get(e)];case 1:return[2,r.sent().data]}})})},getImages:function(t,n,r){return void 0===r&&(r=f.Default),F[r].map(function(o){var i=o.screenSize,u=o.imageSize;return{screenSize:i,url:e.images+"/"+t+"/"+n+"/"+r+"?width="+u}})}}},z=function(){function t(t){var e=t.name,n=t.showType,r=t.venue,o=t.id;this.name=e,this.type=n,this.venue=r,this.id=o}return t.prototype.getName=function(){return this.name},t.prototype.getType=function(){return this.type},t.prototype.getVenue=function(){return this.venue},t}(),_=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function s(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):new n(function(e){e(t.value)}).then(u,s)}a((r=r.apply(t,e||[])).next())})},G=function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},H=function(t){var e=V(t),n=e.getImages,r=e.getProduct;return{getProduct:function(t){return _(void 0,void 0,void 0,function(){var e;return G(this,function(n){switch(n.label){case 0:return[4,r(t)];case 1:return e=n.sent(),[2,new z(e)]}})})},getImages:n}};n.d(e,"Environment",function(){return r}),n.d(e,"getBasketApi",function(){return x}),n.d(e,"getBasketRepository",function(){return O}),n.d(e,"DeliveryMethod",function(){return o}),n.d(e,"BasketStatus",function(){return i}),n.d(e,"ProductType",function(){return u}),n.d(e,"Basket",function(){return E}),n.d(e,"Delivery",function(){return j}),n.d(e,"BasketItemsCollection",function(){return C}),n.d(e,"BasketItem",function(){return P}),n.d(e,"getContentServiceRepository",function(){return H}),n.d(e,"getContentServiceApi",function(){return V}),n.d(e,"Product",function(){return z}),n.d(e,"EntityType",function(){return c}),n.d(e,"ImageOrientation",function(){return f})},function(t,e,n){"use strict";var r=n(0),o=n(2),i=n(11),u=n(1);function s(t){var e=new i(t),n=o(i.prototype.request,e);return r.extend(n,i.prototype,e),r.extend(n,e),n}var a=s(u);a.Axios=i,a.create=function(t){return s(r.merge(u,t))},a.Cancel=n(6),a.CancelToken=n(25),a.isCancel=n(5),a.all=function(t){return Promise.all(t)},a.spread=n(26),t.exports=a,t.exports.default=a},function(t,e){function n(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)} | ||
/*! | ||
@@ -3,0 +3,0 @@ * Determine if an object is a Buffer |
{ | ||
"name": "encore-api-services", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
44993
427