UNPKG

@getoccasion/sdk

Version:

An SDK library that enables access to Occasion's application, providing a rich DSL for creating and managing bookings.

7 lines (6 loc) 24 kB
/* Occasion Javascript SDK 0.2.3 (c) 2019 Peak Labs, LLC DBA Occasion App Occasion Javascript SDK may be freely distributed under the MIT license */ !function(root,factory){"function"==typeof define&&define.amd?define(["active-resource","axios","decimal.js-light","moment","underscore","underscore.string","moment-timezone-with-data-2010-2020"],function(a0,b1,c2,d3,e4,f5,g6){return root.Occasion=factory(a0,b1,c2,d3,e4,f5,g6)}):"object"==typeof module&&module.exports?module.exports=factory(require("active-resource"),require("axios"),require("decimal.js-light"),require("moment"),require("underscore"),require("underscore.string"),require("moment-timezone-with-data-2010-2020")):root.Occasion=factory(root["active-resource"],root.axios,root["decimal.js-light"],root.moment,root.underscore,root["underscore.string"],root["moment-timezone-with-data-2010-2020"])}(this,function(ActiveResource,axios,Decimal,moment,_,s){"use strict";function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target},_createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}();ActiveResource.Interfaces.JsonApi.contentType="application/json";var Occasion=function(){function Occasion(){_classCallCheck(this,Occasion)}return _createClass(Occasion,null,[{key:"Client",value:function(){var options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},url=options.baseUrl||Occasion.baseUrl,token=options.token,immutable=options.immutable||!1;if(!_.isString(token))throw"Token must be of type string";var encodedToken=window.btoa(unescape(encodeURIComponent(token+":"))),libraryOptions={headers:{Authorization:"Basic "+encodedToken},immutable:immutable,strictAttributes:!0},resourceLibrary=ActiveResource.createResourceLibrary(url,libraryOptions);return Occasion.Modules.each(function(initializeModule){initializeModule(resourceLibrary)}),resourceLibrary}}]),Occasion}();return Occasion.baseUrl="https://occ.sn/api/v1",Occasion.Modules=ActiveResource.prototype.Collection.build(),Occasion.__constructCalendar=function(month){var _ref=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},calendar=_ref.calendar,monthlyTimeSlotDaysBatchSize=_ref.monthlyTimeSlotDaysBatchSize,monthlyTimeSlotPreloadSize=_ref.monthlyTimeSlotPreloadSize,preload=_ref.preload,prevPagePromise=_ref.prevPagePromise,relation=_ref.relation,status=_ref.status,timeZone=_ref.timeZone,today=moment.tz(timeZone);status=status||"bookable";var lowerRange;lowerRange=month?month.tz(timeZone):today,lowerRange=lowerRange.startOf("month");var upperRange=lowerRange.clone().endOf("month"),numRequests=Math.ceil(upperRange.diff(lowerRange,"days")/monthlyTimeSlotDaysBatchSize);1>numRequests&&(numRequests=1);for(var i=0,requests=[],lower=lowerRange.clone(),upper=lowerRange.clone().add(monthlyTimeSlotDaysBatchSize,"days");numRequests>i;)i+1==numRequests&&(upper=upperRange.clone()),requests.push(relation.includes({product:"merchant"}).where({startsAt:{ge:lower.toDate(),le:upper.toDate()},status:status}).all()),lower.add(monthlyTimeSlotDaysBatchSize,"days"),upper.add(monthlyTimeSlotDaysBatchSize,"days"),i++;calendar=calendar||{},_.isUndefined(calendar.__currentPage)&&(calendar.__currentPage=0),_.isUndefined(calendar.__preloadedPages)&&(calendar.__preloadedPages=0),calendar.__preloading=!0;var currentPromise=Promise.all(requests).then(function(timeSlotsArray){for(var allTimeSlots=ActiveResource.Collection.build(timeSlotsArray).map(function(ts){return ts.toArray()}).flatten(),startDate=moment(lowerRange).startOf("month"),endDate=moment(lowerRange).endOf("month"),response=ActiveResource.CollectionResponse.build(),day=startDate;day.isSameOrBefore(endDate);)response.push({day:day,timeSlots:allTimeSlots.select(function(timeSlot){return timeSlot.startsAt.isSame(day,"day")})}),day=day.clone().add(1,"days");response.hasNextPage=function(){return!0};var commonPaginationOptions={calendar:calendar,monthlyTimeSlotDaysBatchSize:monthlyTimeSlotDaysBatchSize,monthlyTimeSlotPreloadSize:monthlyTimeSlotPreloadSize,relation:relation,status:status,timeZone:timeZone};return response.nextPage=function(preloadCount){return this.nextPromise||(this.nextPromise=Occasion.__constructCalendar(moment(upperRange).add(1,"days").startOf("month"),_extends({},commonPaginationOptions,{preload:preloadCount,prevPagePromise:currentPromise}))),_.isUndefined(preloadCount)&&(calendar.__currentPage+=1,!calendar.__preloading&&calendar.__preloadedPages<=calendar.__currentPage+monthlyTimeSlotPreloadSize/2&&calendar.__lastPreloadedPage.nextPage(monthlyTimeSlotPreloadSize)),this.nextPromise},("bookable"!==status||month&&!month.isSame(today,"month"))&&(response.hasPrevPage=function(){return!0},response.prevPage=function(){return this.prevPromise=this.prevPromise||prevPagePromise||Occasion.__constructCalendar(moment(lowerRange).subtract(1,"months"),_extends({},commonPaginationOptions,{preload:0})),calendar.__currentPage-=1,this.prevPromise}),monthlyTimeSlotPreloadSize>0&&(_.isUndefined(preload)?response.nextPage(monthlyTimeSlotPreloadSize-1):preload>0?response.nextPage(--preload):calendar.__preloading=!1),calendar.__preloadedPages+=1,calendar.__lastPreloadedPage=response,response});return currentPromise},Occasion.Modules.push(function(library){library.Answer=function(_library$Base){function Answer(){return _classCallCheck(this,Answer),_possibleConstructorReturn(this,(Answer.__proto__||Object.getPrototypeOf(Answer)).apply(this,arguments))}return _inherits(Answer,_library$Base),_createClass(Answer,[{key:"valid",value:function(){switch(this.question().formControl){case"checkbox":case"waiver":return!(this.question().required||"waiver"==this.question().formControl)||"YES"==this.value||"NO"!=this.value&&this.value;default:return!this.question().required||this.question().optionable&&this.option()||!this.question().optionable&&this.value&&""!=this.value}}}]),Answer}(library.Base),library.Answer.className="Answer",library.Answer.queryName="answers",library.Answer.attributes("value"),library.Answer.belongsTo("question"),library.Answer.belongsTo("option"),library.Answer.belongsTo("order",{inverseOf:"answers"})}),Occasion.Modules.push(function(library){library.Attendee=function(_library$Base2){function Attendee(){return _classCallCheck(this,Attendee),_possibleConstructorReturn(this,(Attendee.__proto__||Object.getPrototypeOf(Attendee)).apply(this,arguments))}return _inherits(Attendee,_library$Base2),_createClass(Attendee,[{key:"complete",value:function(){var _this4=this;return!this.order().product().attendeeQuestions.detect(function(question){return!_this4[question]||0==_this4[question].length})}}]),Attendee}(library.Base),library.Attendee.className="Attendee",library.Attendee.queryName="attendees",library.Attendee.attributes("address","age","city","country","email","firstName","gender","lastName","phone","state","zip"),library.Attendee.belongsTo("order",{inverseOf:"attendees"})}),Occasion.Modules.push(function(library){library.Coupon=function(_library$Base3){function Coupon(){return _classCallCheck(this,Coupon),_possibleConstructorReturn(this,(Coupon.__proto__||Object.getPrototypeOf(Coupon)).apply(this,arguments))}return _inherits(Coupon,_library$Base3),Coupon}(library.Base),library.Coupon.className="Coupon",library.Coupon.queryName="coupons",library.Coupon.belongsTo("merchant"),library.Coupon.hasMany("orders")}),Occasion.Modules.push(function(library){library.Currency=function(_library$Base4){function Currency(){return _classCallCheck(this,Currency),_possibleConstructorReturn(this,(Currency.__proto__||Object.getPrototypeOf(Currency)).apply(this,arguments))}return _inherits(Currency,_library$Base4),Currency}(library.Base),library.Currency.className="Currency",library.Currency.queryName="currencies",library.Currency.hasMany("merchants"),library.Currency.hasMany("orders")}),Occasion.Modules.push(function(library){library.Customer=function(_library$Base5){function Customer(){return _classCallCheck(this,Customer),_possibleConstructorReturn(this,(Customer.__proto__||Object.getPrototypeOf(Customer)).apply(this,arguments))}return _inherits(Customer,_library$Base5),_createClass(Customer,[{key:"ahoyEmailChanged",value:function(){}},{key:"complete",value:function(){return this.email&&this.firstName&&this.lastName&&this.email.length>0&&this.firstName.length>0&&this.lastName.length>0}}]),Customer}(library.Base),library.Customer.className="Customer",library.Customer.queryName="customers",library.Customer.attributes("email","firstName","lastName","zip"),library.Customer.hasMany("orders",{inverseOf:"customer"}),library.Customer.afterBuild(function(){var lastEmail=null,watchEmail=_.bind(function(){lastEmail!=this.email&&(_.bind(this.ahoyEmailChanged,this)(),lastEmail=this.email),setTimeout(watchEmail,500)},this);setTimeout(watchEmail,500)})}),Occasion.Modules.push(function(library){library.Label=function(_library$Base6){function Label(){return _classCallCheck(this,Label),_possibleConstructorReturn(this,(Label.__proto__||Object.getPrototypeOf(Label)).apply(this,arguments))}return _inherits(Label,_library$Base6),Label}(library.Base),library.Label.className="Label",library.Label.queryName="labels",library.Label.belongsTo("product")}),Occasion.Modules.push(function(library){library.Merchant=function(_library$Base7){function Merchant(){return _classCallCheck(this,Merchant),_possibleConstructorReturn(this,(Merchant.__proto__||Object.getPrototypeOf(Merchant)).apply(this,arguments))}return _inherits(Merchant,_library$Base7),Merchant}(library.Base),library.Merchant.className="Merchant",library.Merchant.queryName="merchants",library.Merchant.belongsTo("currency"),library.Merchant.hasMany("products"),library.Merchant.hasMany("venues")}),Occasion.Modules.push(function(library){library.Option=function(_library$Base8){function Option(){return _classCallCheck(this,Option),_possibleConstructorReturn(this,(Option.__proto__||Object.getPrototypeOf(Option)).apply(this,arguments))}return _inherits(Option,_library$Base8),Option}(library.Base),library.Option.className="Option",library.Option.queryName="options",library.Option.belongsTo("answer"),library.Option.belongsTo("question")}),Occasion.Modules.push(function(library){library.Order=function(_library$Base9){function Order(){return _classCallCheck(this,Order),_possibleConstructorReturn(this,(Order.__proto__||Object.getPrototypeOf(Order)).apply(this,arguments))}return _inherits(Order,_library$Base9),_createClass(Order,[{key:"charge",value:function(paymentMethod,amount){return this.transactions().build({amount:amount,paymentMethod:paymentMethod})}},{key:"editCharge",value:function(paymentMethod,amount){var transaction=this.transactions().target().detect(function(t){return t.paymentMethod()==paymentMethod});transaction&&(transaction.amount=amount)}},{key:"removeCharge",value:function(paymentMethod){var transaction=this.transactions().target().detect(function(t){return t.paymentMethod()==paymentMethod});transaction&&this.transactions().target()["delete"](transaction)}}],[{key:"construct",value:function(attributes){var order=this.includes("currency").build(attributes);order.sessionIdentifier=order.sessionIdentifier||Math.random().toString(36).substring(7)+"-"+Date.now(),null==order.customer()&&order.buildCustomer({email:null,firstName:null,lastName:null,zip:null});var promises=[new Promise(function(resolve){resolve(order)})];null!=order.product()&&(promises.push(order.product().questions().includes("options").perPage(500).load()),order.product().requiresTimeSlotSelection||promises.push(order.product().timeSlots().includes({product:"merchant"}).where({status:"bookable"}).perPage(500).all()));var _this=this;return Promise.all(promises).then(function(args){order=args[0];var questions=args[1],timeSlots=args[2];return void 0!=questions&&questions.inject(order,_this.__constructAnswer),void 0!=timeSlots&&order.timeSlots().assign(timeSlots,!1),order})}},{key:"__constructAnswer",value:function(order,question){if("static"!=question.category){var answer=order.answers().build({question:question});switch(question.formControl){case"drop_down":case"option_list":answer.assignOption(question.options().target().detect(function(o){return o["default"]}));break;case"spin_button":answer.value=question.min}}return order}}]),Order}(library.Base),library.Order.className="Order",library.Order.queryName="orders",library.Order.attributes("sessionIdentifier","status"),library.Order.attributes("couponAmount","dropInsDiscount","giftCardAmount","outstandingBalance","price","priceDueOnInitialOrder","quantity","subtotal","tax","taxPercentage","total","totalDiscount",{readOnly:!0}),library.Order.belongsTo("coupon"),library.Order.belongsTo("currency"),library.Order.belongsTo("customer",{autosave:!0,inverseOf:"orders"}),library.Order.belongsTo("merchant"),library.Order.belongsTo("product"),library.Order.hasMany("answers",{autosave:!0,inverseOf:"order"}),library.Order.hasMany("attendees",{autosave:!0,inverseOf:"order"}),library.Order.hasMany("timeSlots"),library.Order.hasMany("transactions",{autosave:!0,inverseOf:"order"}),library.Order.afterRequest(function(){var _this12=this;if(this.product()&&!this.product().attendeeQuestions.empty()){var diff=this.quantity-this.attendees().size();if(0!=diff)for(var i=0;i<Math.abs(diff);i++)diff>0?this.attendees().build():this.attendees().target().pop()}if(ActiveResource.Collection.build(["couponAmount","dropInsDiscount","giftCardAmount","outstandingBalance","price","priceDueOnInitialOrder","quantity","subtotal","tax","taxPercentage","total","totalDiscount"]).select(function(attr){return _this12[attr]}).each(function(attr){_this12[attr]=new Decimal(_this12[attr])}),this.outstandingBalance&&!this.outstandingBalance.isZero()){var giftCardTransactions=this.transactions().target().select(function(t){return t.paymentMethod()&&t.paymentMethod().isA(library.GiftCard)}),remainingBalanceTransaction=this.transactions().target().detect(function(t){return!(t.paymentMethod()&&t.paymentMethod().isA(library.GiftCard))});this.outstandingBalance.isPositive()?giftCardTransactions.empty()||giftCardTransactions.each(function(t){if(!_this12.outstandingBalance.isZero()){var amount=new Decimal(t.amount),giftCardValue=new Decimal(t.paymentMethod().value),remainingGiftCardBalance=giftCardValue.minus(amount);remainingGiftCardBalance.isZero()||(remainingGiftCardBalance.greaterThanOrEqualTo(_this12.outstandingBalance)?(amount=amount.plus(_this12.outstandingBalance),_this12.outstandingBalance=new Decimal(0)):(amount=remainingGiftCardBalance,_this12.outstandingBalance=_this12.outstandingBalance.minus(remainingGiftCardBalance)),t.amount=amount.toString(),_this12.transactions().target()["delete"](t),t.__createClone({cloner:_this12}))}}):giftCardTransactions.empty()||ActiveResource.Collection.build(giftCardTransactions.toArray().reverse()).each(function(t){if(!_this12.outstandingBalance.isZero()){var amount=new Decimal(t.amount);if(!amount.greaterThan(_this12.outstandingBalance.abs()))return _this12.outstandingBalance=_this12.outstandingBalance.plus(amount),void _this12.removeCharge(t.paymentMethod());amount=amount.plus(_this12.outstandingBalance),_this12.outstandingBalance=new Decimal(0),t.amount=amount.toString(),_this12.transactions().target()["delete"](t),t.__createClone({cloner:_this12})}}),giftCardTransactions.empty()||(this.giftCardAmount=this.transactions().target().select(function(t){return t.paymentMethod()&&t.paymentMethod().isA(library.GiftCard)}).inject(new Decimal(0),function(total,transaction){return total.plus(transaction.amount)})),remainingBalanceTransaction&&(remainingBalanceTransaction.amount=this.outstandingBalance.toString(),this.transactions().target()["delete"](remainingBalanceTransaction),remainingBalanceTransaction.__createClone({cloner:this}))}})}),Occasion.Modules.push(function(library){library.PaymentMethod=function(_library$Base10){function PaymentMethod(){return _classCallCheck(this,PaymentMethod),_possibleConstructorReturn(this,(PaymentMethod.__proto__||Object.getPrototypeOf(PaymentMethod)).apply(this,arguments))}return _inherits(PaymentMethod,_library$Base10),PaymentMethod}(library.Base),library.PaymentMethod.className="PaymentMethod",library.PaymentMethod.queryName="payment_methods",library.PaymentMethod.hasMany("transactions",{as:"paymentMethod"})}),Occasion.Modules.push(function(library){library.Product=function(_library$Base11){function Product(){return _classCallCheck(this,Product),_possibleConstructorReturn(this,(Product.__proto__||Object.getPrototypeOf(Product)).apply(this,arguments))}return _inherits(Product,_library$Base11),_createClass(Product,[{key:"constructCalendar",value:function(month){var options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Occasion.__constructCalendar(month,_extends({monthlyTimeSlotDaysBatchSize:this.monthlyTimeSlotDaysBatchSize,monthlyTimeSlotPreloadSize:this.monthlyTimeSlotPreloadSize,relation:this.timeSlots(),timeZone:this.merchant().timeZone},options))}}]),Product}(library.Base),library.Product.className="Product",library.Product.queryName="products",library.Product.belongsTo("merchant"),library.Product.belongsTo("venue"),library.Product.hasMany("labels"),library.Product.hasMany("orders"),library.Product.hasMany("questions"),library.Product.hasMany("redeemables"),library.Product.hasMany("timeSlots"),library.Product.afterRequest(function(){if(this.attendeeQuestions=ActiveResource.Collection.build(this.attendeeQuestions).map(function(q){return s.camelize(q,!0)}),this.firstTimeSlotStartsAt){if(!this.merchant())throw"Product has timeslots - but merchant.timeZone is not available; include merchant in response.";this.firstTimeSlotStartsAt=moment.tz(this.firstTimeSlotStartsAt,this.merchant().timeZone)}})}),Occasion.Modules.push(function(library){library.Question=function(_library$Base12){function Question(){return _classCallCheck(this,Question),_possibleConstructorReturn(this,(Question.__proto__||Object.getPrototypeOf(Question)).apply(this,arguments))}return _inherits(Question,_library$Base12),Question}(library.Base),library.Question.className="Question",library.Question.queryName="questions",library.Question.belongsTo("product"),library.Question.hasMany("answers"),library.Question.hasMany("options")}),Occasion.Modules.push(function(library){library.Redeemable=function(_library$Base13){function Redeemable(){return _classCallCheck(this,Redeemable),_possibleConstructorReturn(this,(Redeemable.__proto__||Object.getPrototypeOf(Redeemable)).apply(this,arguments))}return _inherits(Redeemable,_library$Base13),Redeemable}(library.Base),library.Redeemable.className="Redeemable",library.Redeemable.queryName="redeemables",library.Redeemable.belongsTo("product")}),Occasion.Modules.push(function(library){library.State=function(_library$Base14){function State(){return _classCallCheck(this,State),_possibleConstructorReturn(this,(State.__proto__||Object.getPrototypeOf(State)).apply(this,arguments))}return _inherits(State,_library$Base14),State}(library.Base),library.State.className="State",library.State.queryName="states"}),Occasion.Modules.push(function(library){var _class,_temp;library.TimeSlot=(_temp=_class=function(_library$Base15){function TimeSlot(){return _classCallCheck(this,TimeSlot),_possibleConstructorReturn(this,(TimeSlot.__proto__||Object.getPrototypeOf(TimeSlot)).apply(this,arguments))}return _inherits(TimeSlot,_library$Base15),_createClass(TimeSlot,[{key:"toString",value:function(format){var output;if(this.product().showTimeSlotDuration){var durationFormat,durationTimeSlot=this.startsAt.clone().add(this.duration);durationFormat=durationTimeSlot.isSame(this.startsAt,"day")?"LT":"LLLL",output=this.startsAt.format(format),output+=" - ",output+=durationTimeSlot.format(durationFormat)}else output=this.startsAt.format(format);return output}}]),TimeSlot}(library.Base),_class.constructCalendar=function(){var month=void 0,options=void 0;return moment.isMoment(arguments[0])?(month=arguments[0],options=arguments[1]||{}):options=arguments[0]||{},Occasion.__constructCalendar(month,_extends({monthlyTimeSlotDaysBatchSize:7,monthlyTimeSlotPreloadSize:4,relation:this},options))},_temp),library.TimeSlot.className="TimeSlot",library.TimeSlot.queryName="time_slots",library.TimeSlot.belongsTo("order"),library.TimeSlot.belongsTo("product"),library.TimeSlot.belongsTo("venue"),library.TimeSlot.afterRequest(function(){if(!this.product().merchant())throw"Must use includes({ product: 'merchant' }) in timeSlot request";this.startsAt=moment.tz(this.startsAt,this.product().merchant().timeZone),this.duration=moment.duration(this.duration,"minutes")})}),Occasion.Modules.push(function(library){library.Transaction=function(_library$Base16){function Transaction(){return _classCallCheck(this,Transaction),_possibleConstructorReturn(this,(Transaction.__proto__||Object.getPrototypeOf(Transaction)).apply(this,arguments))}return _inherits(Transaction,_library$Base16),Transaction}(library.Base),library.Transaction.className="Transaction",library.Transaction.queryName="transactions",library.Transaction.attributes("amount"),library.Transaction.belongsTo("order",{inverseOf:"transactions"}),library.Transaction.belongsTo("paymentMethod",{polymorphic:!0})}),Occasion.Modules.push(function(library){library.Venue=function(_library$Base17){function Venue(){return _classCallCheck(this,Venue),_possibleConstructorReturn(this,(Venue.__proto__||Object.getPrototypeOf(Venue)).apply(this,arguments))}return _inherits(Venue,_library$Base17),Venue}(library.Base),library.Venue.className="Venue",library.Venue.queryName="venues",library.Venue.belongsTo("merchant"),library.Venue.belongsTo("state"),library.Venue.hasMany("products")}),Occasion.Modules.push(function(library){library.CreditCard=function(_library$PaymentMetho){function CreditCard(){return _classCallCheck(this,CreditCard),_possibleConstructorReturn(this,(CreditCard.__proto__||Object.getPrototypeOf(CreditCard)).apply(this,arguments))}return _inherits(CreditCard,_library$PaymentMetho),CreditCard}(library.PaymentMethod),library.CreditCard.className="CreditCard",library.CreditCard.queryName="credit_cards",library.CreditCard.hasMany("transactions",{as:"paymentMethod"})}),Occasion.Modules.push(function(library){library.GiftCard=function(_library$PaymentMetho2){function GiftCard(){return _classCallCheck(this,GiftCard),_possibleConstructorReturn(this,(GiftCard.__proto__||Object.getPrototypeOf(GiftCard)).apply(this,arguments))}return _inherits(GiftCard,_library$PaymentMetho2),GiftCard}(library.PaymentMethod),library.GiftCard.className="GiftCard",library.GiftCard.queryName="gift_cards",library.GiftCard.belongsTo("customer"),library.GiftCard.hasMany("transactions",{as:"paymentMethod"})}),Occasion});