diff --git a/dist/@fleetbase/sdk.min.js b/dist/@fleetbase/sdk.min.js index 5763f63..8eb3663 100644 --- a/dist/@fleetbase/sdk.min.js +++ b/dist/@fleetbase/sdk.min.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("axios"),require("date-fns")):"function"==typeof define&&define.amd?define(["exports","axios","date-fns"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@fleetbase/sdk"]={},t.axios)}(this,(function(t,e){"use strict";function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=n(e);function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function o(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,i=new Array(e);n3&&void 0!==arguments[3]?arguments[3]:[];if(z(t))if(i.length<=C)t.splice.apply(t,[e,n].concat(E(i)));else{t.splice(e,n);for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:N,n=[],i=new Set,r="function"==typeof e?e:function(t){return get(t,e)};return t.forEach((function(t){var e=r(t);i.has(e)||(i.add(e),n.push(t))})),n},q=function(t){return t instanceof Q},B=function(t,e){return z(t)?t[e]:q(t)?t.objectAt(e):null},U=function(t,e){return 2===D.length?function(n){return e===n[t]}:function(e){return Boolean(e[t])}},I=function(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=t.length,r=n;r2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0,r=t.length;n<0&&(n+=r);var o=i&&e!=e?function(t){return t!=t}:function(t){return t===e};return I(t,o,n)},M=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return L(t,e,n,[]),t},G=function(t,e,n){return L(t,e,0,[n]),n},Q=function(t){d(n,t);var e=A(n);function n(){for(var t=arguments.length,i=new Array(t),r=0;r0}},{key:"empty",get:function(){return 0===this.length}},{key:"first",get:function(){return B(this,0)}},{key:"last",get:function(){return B(this,this.length-1)}},{key:"replace",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return L(this,t,e,n),this}},{key:"objectsAt",value:function(t){var e=this;return t.map((function(t){return B(e,t)}))}},{key:"objectAt",value:function(t){return B(this,t)}},{key:"indexOf",value:function(t,e){return K(this,t,e,!1)}},{key:"lastIndexOf",value:function(t,e){var n=this.length;(void 0===e||e>=n)&&(e=n-1),e<0&&(e+=n);for(var i=e;i>=0;i--)if(B(this,i)===t)return i;return-1}},{key:"includes",value:function(t,e){return-1!==K(this,t,e,!0)}},{key:"findBy",value:function(){return J(this,U.apply(void 0,arguments))}},{key:"findIndexBy",value:function(){return I(this,U.apply(void 0,arguments))}},{key:"isEvery",value:function(){return H(this,U.apply(void 0,arguments))}},{key:"isAny",value:function(){return W(this,U.apply(void 0,arguments))}},{key:"invoke",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i=0;){B(this,e)===t&&this.removeAt(e)}return this}},{key:"removeObjects",value:function(t){for(var e=t.length-1;e>=0;e--)this.removeObject(t[e]);return this}},{key:"addObject",value:function(t){return this.includes(t)||this.pushObject(t),this}},{key:"addObjects",value:function(t){var e=this;return t.forEach((function(t){return e.addObject(t)})),this}}]),n}(k(Array)),V=function(t){var e=null==t;if(e)return e;if("number"==typeof t.size)return!t.size;var n=s(t);if("object"===n){var i=t.size;if("number"==typeof i)return!i}if("number"==typeof t.length&&"function"!==n)return!t.length;if("object"===n){var r=t.length;if("number"==typeof r)return!r}return!1},Z=function(t){return V(t)||"string"==typeof t&&!1===/\S/.test(t)};function Y(t){return isFinite(t)&&Math.abs(t)<=90}function X(t){return isFinite(t)&&Math.abs(t)<=180&&Math.abs(t)>=90}function tt(t){return t instanceof vt}var et=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^[+]?[\s./0-9]*[(]?[0-9]{1,4}[)]?[-\s./0-9]*$/g.test(t)},nt=function(){var t,e,n,i,r;return!("undefined"==typeof process||"object"!==s(null===(t=process)||void 0===t?void 0:t.env)&&-1===(null===(e=process.release)||void 0===e||null===(n=e.name)||void 0===n?void 0:n.search(/node|io.js/))||"undefined"!=typeof window&&"ReactNative"!==(null===(i=window)||void 0===i||null===(r=i.navigator)||void 0===r?void 0:r.product))},it=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return nt()?It("adapter","NodeAdapter",t):It("adapter","BrowserAdapter",t)},rt=Array.isArray,ot=function(){function t(e){c(this,t),this.place=e,this.geometry=null==e?void 0:e.geometry,this.components=this.parseComponents(),this.attributes=this.parseProperties()}return l(t,[{key:"parse",value:function(){this.parseComponents(),this.parseProperties()}},{key:"parseComponents",value:function(){var t;return((null===(t=this.place)||void 0===t?void 0:t.address_components)||[]).reduce((function(t,e){return e.types.forEach((function(n){t[n]=e})),t}),{})}},{key:"parseProperties",value:function(){var t,e={streetNumber:this.get("street_number"),streetName:this.get("route"),coordinates:null!==(t=this.geometry)&&void 0!==t&&t.location?Object.values(this.geometry.location):[0,0],city:this.or(["locality","sublocality","sublocality_level_1","neighborhood","administrative_area_level_3","administrative_area_level_2"]),county:this.get("administrative_area_level_2"),stateShort:this.get("administrative_area_level_1",!0),stateLong:this.get("administrative_area_level_1"),countryShort:this.get("country",!0),country:this.get("country",!0),countryLong:this.get("country"),postalCode:this.get("postal_code")};return e.address=[e.streetNumber,e.streetName].filter(Boolean).join(" "),e}},{key:"all",value:function(){return this.attributes}},{key:"or",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=0;e1&&void 0!==arguments[1]&&arguments[1];return t in this.components?e?this.components[t].short_name:this.components[t].long_name:null}},{key:"setAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.attributes=o(o({},this.attributes),t),this}},{key:"setAttribute",value:function(t,e){return this.attributes[t]=e,this}},{key:"getAttribute",value:function(t){return this.attributes[t]||null}}]),t}(),st=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;c(this,t),this.type="Point",this.coordinates=[n,e]}return l(t,[{key:"latitude",get:function(){return this.coordinates[1]}},{key:"longitude",get:function(){return this.coordinates[0]}},{key:"lat",value:function(){return this.latitude}},{key:"lng",value:function(){return this.longitude}},{key:"serialize",value:function(){return{type:"Point",coorindates:[this.lat(),this.lng()]}}},{key:"toJson",value:function(){return this.serialize()}},{key:"toString",value:function(){return"(".concat(this.latitude,", ").concat(this.longitude,")")}}],[{key:"fromGeoJson",value:function(e){var n=x(e.coordinates,2);return longitude=n[0],latitude=n[1],new t(latitude,longitude)}}]),t}(),at=function(t){return"object"===s(t)&&!V(null==t?void 0:t.attributes)&&"object"===s(null==t?void 0:t.attributes)},ut=function(t,e){var n=t();return Array.isArray(n)||"object"===s(n)?ct(n,e):null},ct=function t(e,n){var i=e,r=s(e),o="object"===r,a="function"===r,u=Array.isArray(e),c="string"===s(n)&&n.includes(".")?n.split("."):[n];if(u||o){for(var h=0;h0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;c(this,t),this.actions=e,this.bind=n}return l(t,[{key:"extend",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=t||this.bind;if(!e)return this;if(null!=this&&this.actions&&"object"===s(this.actions))for(var n in this.actions){var i=this.actions[n];"function"==typeof i?ht(e,n,i.bind(e)):ht(e,n,i)}return this}}]),t}(),vt=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};c(this,t),this.attributes=e,this.dirtyAttributes={},this.changes={},this.isLoading=!1,this.isSaving=!1,this.isDestroying=!1,this.isReloading=!1,this.resource=i,this.options=r,this.version=r.version||"v1",this.setAdapter(n)}return l(t,[{key:"setAdapter",value:function(t){var e;return this.adapter=t,this.store=new Ht(this.resource,t,{onAfterFetch:this.syncAttributes.bind(this),actions:null===(e=this.options)||void 0===e?void 0:e.actions}),this}},{key:"id",get:function(){return this.getAttribute("id")}},{key:"create",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.mergeAttributes(e);return this.setFlags(["isLoading","isSaving"]),this.store.create(n).then((function(e){return t.setFlags(["isLoading","isSaving"],!1),e}))}},{key:"update",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.setFlags(["isLoading","isSaving"]),this.store.update(this.attributes.id,e).then((function(e){return t.setFlags(["isLoading","isSaving"],!1),e}))}},{key:"destroy",value:function(){var t=this;return this.setFlags(["isLoading","isDestroying"]),this.store.destroy(this.attributes.id).then((function(e){return t.setFlags(["isLoading","isDestroying"],!1),e}))}},{key:"reload",value:function(){var t=this;return this.setFlags(["isLoading","isReloading"]),this.store.findRecord(this.attributes.id).then((function(e){return t.reset(),e}))}},{key:"setFlags",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=["isLoading","isSaving","isReloading","isDestroying"],i=0;i0&&void 0!==arguments[0]?arguments[0]:{},e=this.getAttributes();return V(this.id)?this.create(e):!0===t.onlyDirty?this.savedirty():this.update(e)}},{key:"saveDirty",value:function(){for(var t=Object.keys(this.dirtyAttributes),e={},n=0;n0}},{key:"mutate",value:function(t,e){this.attributes[t]=e}},{key:"setAttribute",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(null===n&&"object"===s(t))return this.setAttributes(t);var i=null!==(e=null==this?void 0:this.attributes[t])&&void 0!==e?e:null;return ht(this.attributes,t,n),ht(this.dirtyAttributes,t,i),z(null==this?void 0:this.changes[t])||(this.changes[t]=[]),this.changes[t].push({property:t,previousValue:i,value:n,changedAt:new Date}),this}},{key:"setAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var e in t)this.setAttribute(e,t[e]);return this}},{key:"getAttribute",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=ct(null!==(e=null==this?void 0:this.attributes)&&void 0!==e?e:{},t);return void 0===i?n:i}},{key:"hasAttribute",value:function(t){if(z(t)){var e,n=t,i=Object.keys(null!==(e=this.attributes)&&void 0!==e?e:{});return n.every((function(t){return i.includes(t)}))}return!(null==this||!this.attributes)&&t in this.attributes}},{key:"hasAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.hasAttribute(t)}},{key:"isAttributeFilled",value:function(t){var e=this;return z(t)?this.hasAttribute(t)&&t.every((function(t){return!V(e.getAttribute(t))})):this.hasAttribute(t)&&!V(this.getAttribute(t))}},{key:"getAttributes",value:function(t){var e={};if(null==t)return this.getAttributes(Object.keys(this.attributes));if("string"==typeof t)return this.getAttribute(Array.prototype.slice.call(arguments));if(!z(t))throw new Error("No attribute properties provided!");for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=null!==(t=null==this?void 0:this.attributes)&&void 0!==t?t:{};return this.attributes=o(o({},n),e),this.attributes}},{key:"syncAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.attributes=t}}]),t}(),dt=new lt({getDistanceAndTime:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.get("".concat(this.namespace,"/").concat(t,"/distance-and-time"),e,n)},getNextActivity:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.get("".concat(this.namespace,"/").concat(t,"/next-activity"),e,n)},dispatch:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/dispatch"),e,n).then(this.afterFetch.bind(this))},start:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/start"),e,n).then(this.afterFetch.bind(this))},updateActivity:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/update-activity"),e,n).then(this.afterFetch.bind(this))},setDestination:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return tt(e)&&(e=e.id),this.adapter.post("".concat(this.namespace,"/").concat(t,"/set-destination/").concat(e),n,i).then(this.afterFetch.bind(this))},captureQrCode:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return tt(e)&&(e=e.id),this.adapter.post("".concat(this.namespace,"/").concat(t,"/capture-qr").concat(e?"/"+e:""),n,i)},captureSignature:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return tt(e)&&(e=e.id),this.adapter.post("".concat(this.namespace,"/").concat(t,"/capture-signature").concat(e?"/"+e:""),n,i)},complete:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/complete"),e,n).then(this.afterFetch.bind(this))},cancel:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.delete("".concat(this.namespace,"/").concat(t,"/cancel"),e,n).then(this.afterFetch.bind(this))}}),ft=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"order",o({actions:dt},r))}return l(n,[{key:"getDistanceAndTime",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.getDistanceAndTime(this.id,t,e)}},{key:"dispatch",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.dispatch(this.id,t,e)}},{key:"start",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.start(this.id,t,e)}},{key:"setDestination",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.store.setDestination(this.id,t,e,n)}},{key:"captureQrCode",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.store.captureQrCode(this.id,t,e,n)}},{key:"captureSignature",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.store.captureSignature(this.id,t,e,n)}},{key:"getNextActivity",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.getNextActivity(this.id,t,e)}},{key:"updateActivity",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.updateActivity(this.id,t,e)}},{key:"cancel",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.cancel(this.id,t,e)}},{key:"complete",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.complete(this.id,t,e)}},{key:"isDispatched",get:function(){return null!==this.getAttribute("dispatched_at")}},{key:"isNotDispatched",get:function(){return null==this.getAttribute("dispatched_at")}},{key:"isStarted",get:function(){return null!==this.getAttribute("started_at")}},{key:"isNotStarted",get:function(){return null==this.getAttribute("started_at")}},{key:"isCompleted",get:function(){return"completed"==this.getAttribute("status")}},{key:"isCanceled",get:function(){return"canceled"==this.getAttribute("status")}},{key:"isEnroute",get:function(){return"driver_enroute"==this.getAttribute("status")||"enroute"===this.getAttribute("status")}},{key:"isInProgress",get:function(){return this.isStarted&&!this.isCanceled&&!this.isCompleted}},{key:"scheduledAt",get:function(){return this.isAttributeFilled("scheduled_at")?new Date(this.getAttribute("scheduled_at")):null}},{key:"startedAt",get:function(){return this.isAttributeFilled("started_at")?new Date(this.getAttribute("started_at")):null}},{key:"dispatchedAt",get:function(){return this.isAttributeFilled("dispatched_at")?new Date(this.getAttribute("dispatched_at")):null}},{key:"status",get:function(){return this.getAttribute("status")}}]),n}(vt),gt=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"payload",r)}return l(n,[{key:"attach",value:function(t){}},{key:"entities",get:function(){}},{key:"dropoff",get:function(){}},{key:"pickup",get:function(){}},{key:"waypoints",get:function(){return new Q(this.waypoints)}}]),n}(vt),pt=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"entity",r)}return n}(vt),yt=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"place",r)}return l(n,[{key:"latitude",get:function(){var t;return null===(t=this.getAttribute("location",new st))||void 0===t?void 0:t.coordinates[1]}},{key:"longitude",get:function(){var t;return null===(t=this.getAttribute("location",new st))||void 0===t?void 0:t.coordinates[0]}},{key:"coordinates",get:function(){return[this.latitude,this.longitude]}},{key:"setOwner",value:function(t){return tt(t)&&this.setAttribute("owner",t.id),"string"==typeof t&&this.setAttribute("owner",t),this}}],[{key:"fromGoogleAddress",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.getAttribute("coordinates"),o=x(r,2),s=o[0],a=o[1],u={name:null,address:t.getAttribute("address"),location:new st(s,a),street1:t.getAttribute("streetName"),street2:null,city:t.getAttribute("city"),province:t.getAttribute("stateLong"),postal_code:t.getAttribute("postalCode"),neighborhood:t.get("neighborhood"),district:t.getAttribute("county"),building:t.get("building"),country:t.getAttribute("countryShort"),phone:null,security_access_code:null};return new n(u,e,i)}}]),n}(vt),bt=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"waypoint",r)}return n}(yt),kt=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"tracking-status",r)}return n}(vt),mt=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"vehicle",r)}return n}(vt),wt=new lt({login:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(et(t))return this.adapter.post("drivers/login-with-sms",{phone:t});if(!e)throw new Error("Login requires password!");return this.adapter.post("drivers/login",o({identity:t,password:e},n)).then(this.afterFetch.bind(this))},verifyCode:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("drivers/verify-code",o({identity:t,code:e},n)).then(this.afterFetch.bind(this))},track:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("drivers/".concat(t,"/track"),e,n).then(this.afterFetch.bind(this))},retrieve:function(t){return this.findRecord(t)},syncDevice:function(t){return this.adapter.setHeaders({"Driver-Token":this.token}).post("drivers/register-device",t)}}),At=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"driver",o({actions:wt},r))}return l(n,[{key:"latitude",get:function(){var t;return null===(t=this.getAttribute("location",new Point))||void 0===t?void 0:t.coordinates[1]}},{key:"longitude",get:function(){var t;return null===(t=this.getAttribute("location",new Point))||void 0===t?void 0:t.coordinates[0]}},{key:"coordinates",get:function(){return[this.latitude,this.longitude]}},{key:"token",get:function(){return this.getAttribute("token")}},{key:"isOnline",get:function(){return!0===this.getAttribute("online")}},{key:"track",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.track(this.id,t,e)}},{key:"syncDevice",value:function(t){return this.store.syncDevice(t)}}]),n}(vt),xt=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"vendor",r)}return n}(vt),Et=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"contact",r)}return n}(vt),Rt=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"zone",r)}return n}(vt),$t=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"service-area",r)}return n}(vt),jt=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"service-rate",r)}return n}(vt),Ot=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"service-quote",r)}return l(n,[{key:"fromPreliminary",value:function(){}},{key:"fromPayload",value:function(){}}]),n}(vt),St=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};c(this,t),this.version=e.version||"v1",this.host=e.host||null,this.namespace=e.namespace||null,this.headers=e.headers||{}},_t=function(t){d(n,t);var e=A(n);function n(t){var i;return c(this,n),(i=e.call(this,t)).setHeaders({Authorization:"Bearer ".concat(t.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;browser"}),i}return l(n,[{key:"setHeaders",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.headers=o(o({},this.headers),t),this}},{key:"parseJSON",value:function(t){return new Promise((function(e,n){return t.json().then((function(n){return e({statusText:t.statusText,status:t.status,ok:t.ok,json:n})})).catch((function(){n(new Error("Oops! Something went wrong when handling your request."))}))}))}},{key:"request",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise((function(s,a){return fetch(r.url||"".concat(e.host,"/").concat(e.namespace,"/").concat(t),o({method:n,mode:r.mode||"cors",headers:new Headers(o(o({},e.headers||{}),r.headers||{}))},i)).then(e.parseJSON).then((function(t){return t.ok?s(t.json):a(new Error(t.json.errors?t.json.errors[0]:t.statusText))})).catch((function(t){a(t)}))}))}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=Z(e)?"":new URLSearchParams(e).toString();return this.request("".concat(t).concat(i?"?".concat(i):""),"GET",{},n)}},{key:"post",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"POST",{body:JSON.stringify(e)},n)}},{key:"put",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"PUT",{body:JSON.stringify(e)},n)}},{key:"delete",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.request(t,"DELETE",{},e)}},{key:"patch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"PATCH",{body:JSON.stringify(e)},n)}}]),n}(St),Pt=function(t){d(n,t);var e=A(n);function n(t){var r;return c(this,n),(r=e.call(this,t)).axios=i.default.create({baseURL:"".concat(r.host,"/").concat(r.namespace),headers:{Authorization:"Bearer ".concat(t.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;node"}}),r}return l(n,[{key:"setHeaders",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.axios.defaults.headers.common;return this.axios.defaults.headers.common=o(o({},e),t),this}},{key:"transform",value:function(t){return t.data}},{key:"handleError",value:function(t){if(t.response){var e=t.response.data;if(z(e.errors))throw new Error(e.errors[0]);if(e.error)throw new Error(e.error)}throw t}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=Z(e)?"":new URLSearchParams(e).toString();return this.axios.get("".concat(t).concat(i?"?".concat(i):""),n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"post",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.post(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"put",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.put(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"delete",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.axios.delete(t,e).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"patch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.patch(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}}]),n}(St),Ft=function(t){d(n,t);var e=A(n);function n(){return c(this,n),e.apply(this,arguments)}return n}(St),zt=function(){function t(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];c(this,t),v(this,"uncountableWords",["equipment","information","rice","money","species","series","fish","sheep","moose","deer","news"]),v(this,"pluralRules",[[new RegExp("(m)an$","gi"),"$1en"],[new RegExp("(pe)rson$","gi"),"$1ople"],[new RegExp("(child)$","gi"),"$1ren"],[new RegExp("^(ox)$","gi"),"$1en"],[new RegExp("(ax|test)is$","gi"),"$1es"],[new RegExp("(octop|vir)us$","gi"),"$1i"],[new RegExp("(alias|status)$","gi"),"$1es"],[new RegExp("(bu)s$","gi"),"$1ses"],[new RegExp("(buffal|tomat|potat)o$","gi"),"$1oes"],[new RegExp("([ti])um$","gi"),"$1a"],[new RegExp("sis$","gi"),"ses"],[new RegExp("(?:([^f])fe|([lr])f)$","gi"),"$1$2ves"],[new RegExp("(hive)$","gi"),"$1s"],[new RegExp("([^aeiouy]|qu)y$","gi"),"$1ies"],[new RegExp("(x|ch|ss|sh)$","gi"),"$1es"],[new RegExp("(matr|vert|ind)ix|ex$","gi"),"$1ices"],[new RegExp("([m|l])ouse$","gi"),"$1ice"],[new RegExp("(quiz)$","gi"),"$1zes"],[new RegExp("s$","gi"),"s"],[new RegExp("$","gi"),"s"]]),v(this,"singularRules",[[new RegExp("(m)en$","gi"),"$1an"],[new RegExp("(pe)ople$","gi"),"$1rson"],[new RegExp("(child)ren$","gi"),"$1"],[new RegExp("([ti])a$","gi"),"$1um"],[new RegExp("((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$","gi"),"$1$2sis"],[new RegExp("(hive)s$","gi"),"$1"],[new RegExp("(tive)s$","gi"),"$1"],[new RegExp("(curve)s$","gi"),"$1"],[new RegExp("([lr])ves$","gi"),"$1f"],[new RegExp("([^fo])ves$","gi"),"$1fe"],[new RegExp("([^aeiouy]|qu)ies$","gi"),"$1y"],[new RegExp("(s)eries$","gi"),"$1eries"],[new RegExp("(m)ovies$","gi"),"$1ovie"],[new RegExp("(x|ch|ss|sh)es$","gi"),"$1"],[new RegExp("([m|l])ice$","gi"),"$1ouse"],[new RegExp("(bus)es$","gi"),"$1"],[new RegExp("(o)es$","gi"),"$1"],[new RegExp("(shoe)s$","gi"),"$1"],[new RegExp("(cris|ax|test)es$","gi"),"$1is"],[new RegExp("(octop|vir)i$","gi"),"$1us"],[new RegExp("(alias|status)es$","gi"),"$1"],[new RegExp("^(ox)en","gi"),"$1"],[new RegExp("(vert|ind)ices$","gi"),"$1ex"],[new RegExp("(matr)ices$","gi"),"$1ix"],[new RegExp("(quiz)zes$","gi"),"$1"],[new RegExp("s$","gi"),""]]),v(this,"nonTitlecasedWords",["and","or","nor","a","an","the","so","but","to","of","at","by","from","into","on","onto","off","out","in","over","with","for"]),v(this,"idSuffix",new RegExp("(_ids|_id)$","g")),v(this,"underbar",new RegExp("_","g")),v(this,"spaceOrUnderbar",new RegExp("[ _]","g")),v(this,"uppercase",new RegExp("([A-Z])","g")),v(this,"underbarPrefix",new RegExp("^_")),this.str=e,this.chain=n}return l(t,[{key:"get",value:function(){return this.str}},{key:"applyRules",value:function(t,e,n,i){if(i)t=i;else if(!(n.indexOf(t.toLowerCase())>-1))for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:null;return t=t||this.str,this.applyRules(t,this.pluralRules,this.uncountableWords,e)}},{key:"singularize",value:function(t,e){return t=t||this.str,this.applyRules(t,this.singularRules,this.uncountableWords,e)}},{key:"camelize",value:function(t,e){for(var n=(t=t||this.str).split("/"),i=0;i1&&void 0!==arguments[1]&&arguments[1];return t=t||this.str,t=this.underscore(this.demodulize(t))+(e?"":"_")+"id",this.str=t,!0===this.chain?this:t}},{key:"ordinalize",value:function(t){for(var e=(t=t||this.str).split(" "),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];if(t.actions=z(e)?e:[e],!z(e))return e instanceof lt&&e.extend(t),t;for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{};c(this,t),this.resource=e,this.adapter=n||it(),this.namespace=Dt(e),this.storage=new Q,this.options=i,this.extendActions(i.actions)}return l(t,[{key:"extendActions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Jt(this,t)}},{key:"deposit",value:function(t){return t}},{key:"serialize",value:function(t){return It("resource",Tt(this.resource),t,this.adapter)}},{key:"afterFetch",value:function(t){return Wt(this,t)}},{key:"create",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var i=u(regeneratorRuntime.mark((function i(r,o){var s;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.adapter.post("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=i.sent,r(s);case 4:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}())}},{key:"update",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(function(){var r=u(regeneratorRuntime.mark((function r(o,s){var a;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e.adapter.put("".concat(e.namespace,"/").concat(t),n,i).then(e.afterFetch.bind(e)).catch(s);case 2:a=r.sent,o(a);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"findRecord",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var i=u(regeneratorRuntime.mark((function i(r,o){var s;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,e.adapter.get("".concat(e.namespace,"/").concat(t),{},n).then(e.afterFetch.bind(e)).catch(o);case 2:s=i.sent,r(s);case 4:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}())}},{key:"findAll",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(){var n=u(regeneratorRuntime.mark((function n(i,r){var o;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.adapter.get("".concat(t.namespace),{},e).then(t.afterFetch.bind(t)).catch(r);case 2:o=n.sent,i(o);case 4:case"end":return n.stop()}}),n)})));return function(t,e){return n.apply(this,arguments)}}())}},{key:"query",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var i=u(regeneratorRuntime.mark((function i(r,o){var s;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.adapter.get("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=i.sent,r(s);case 4:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}())}},{key:"queryRecord",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.single=!0,new Promise(function(){var i=u(regeneratorRuntime.mark((function i(r,o){var s;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.adapter.get("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=i.sent,r(s);case 4:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}())}},{key:"destroy",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=tt(t)?t.getAttribute("id"):t;return new Promise(function(){var t=u(regeneratorRuntime.mark((function t(r,o){var s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.adapter.delete("".concat(e.namespace,"/").concat(i),{},n).then(e.afterFetch.bind(e)).catch(o);case 2:s=t.sent,r(s);case 4:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}())}}]),t}(),Kt=function(){function t(e){var n,i,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(c(this,t),this.version=null!==(n=o.version)&&void 0!==n?n:"v1",this.options={version:this.version,host:null!==(i=o.host)&&void 0!==i?i:"https://api.fleetbase.io",namespace:null!==(r=o.namespace)&&void 0!==r?r:this.version,debug:s,publicKey:e},"string"!=typeof e||0===e.length)throw new Error("⚠️ Invalid public key given to Fleetbase SDK");if(!nt()&&e.toLowerCase().startsWith("$"))throw new Error("Secret key provided. You must use a public key with Fleetbase Javascript SDK!");this.adapter=o.adapter||it(this.options),this.orders=new Ht("order",this.adapter).extendActions(dt),this.entities=new Ht("entity",this.adapter),this.places=new Ht("place",this.adapter),this.drivers=new Ht("driver",this.adapter).extendActions(wt),this.vehicles=new Ht("vehicle",this.adapter),this.vendors=new Ht("vendor",this.adapter),this.contacts=new Ht("contact",this.adapter)}return l(t,[{key:"setAdapter",value:function(t){this.adapter=t}},{key:"getAdapter",value:function(){return this.adapter}}],[{key:"newInstance",value:function(){return y(t,Array.prototype.slice.call(arguments))}}]),t}();t.Adapter=St,t.BrowserAdapter=_t,t.Collection=Q,t.Contact=Et,t.Driver=At,t.EmberJsAdapter=Ft,t.Entity=pt,t.GoogleAddress=ot,t.NodeAdapter=Pt,t.Order=ft,t.Payload=gt,t.Place=yt,t.Point=st,t.Resource=vt,t.ServiceArea=$t,t.ServiceQuote=Ot,t.ServiceRate=jt,t.Store=Ht,t.StoreActions=lt,t.TrackingStatus=kt,t.Vehicle=mt,t.Vendor=xt,t.Waypoint=bt,t.Zone=Rt,t.camelize=Lt,t.classify=Tt,t.dasherize=Nt,t.default=Kt,t.extendStoreActions=Jt,t.isLatitude=Y,t.isLongitude=X,t.isNodeEnvironment=nt,t.isResource=tt,t.pluralize=Dt,t.singularize=Ct})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("axios"),require("date-fns")):"function"==typeof define&&define.amd?define(["exports","axios","date-fns"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@fleetbase/sdk"]={},t.axios)}(this,(function(t,e){"use strict";function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=n(e);function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function o(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,i=new Array(e);n3&&void 0!==arguments[3]?arguments[3]:[];if(z(t))if(i.length<=C)t.splice.apply(t,[e,n].concat(E(i)));else{t.splice(e,n);for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:N,n=[],i=new Set,r="function"==typeof e?e:function(t){return get(t,e)};return t.forEach((function(t){var e=r(t);i.has(e)||(i.add(e),n.push(t))})),n},q=function(t){return t instanceof Q},B=function(t,e){return z(t)?t[e]:q(t)?t.objectAt(e):null},U=function(t,e){return 2===D.length?function(n){return e===n[t]}:function(e){return Boolean(e[t])}},I=function(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=t.length,r=n;r2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0,r=t.length;n<0&&(n+=r);var o=i&&e!=e?function(t){return t!=t}:function(t){return t===e};return I(t,o,n)},G=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return L(t,e,n,[]),t},H=function(t,e,n){return L(t,e,0,[n]),n},Q=function(t){d(n,t);var e=A(n);function n(){for(var t=arguments.length,i=new Array(t),r=0;r0}},{key:"empty",get:function(){return 0===this.length}},{key:"first",get:function(){return B(this,0)}},{key:"last",get:function(){return B(this,this.length-1)}},{key:"replace",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return L(this,t,e,n),this}},{key:"objectsAt",value:function(t){var e=this;return t.map((function(t){return B(e,t)}))}},{key:"objectAt",value:function(t){return B(this,t)}},{key:"indexOf",value:function(t,e){return M(this,t,e,!1)}},{key:"lastIndexOf",value:function(t,e){var n=this.length;(void 0===e||e>=n)&&(e=n-1),e<0&&(e+=n);for(var i=e;i>=0;i--)if(B(this,i)===t)return i;return-1}},{key:"includes",value:function(t,e){return-1!==M(this,t,e,!0)}},{key:"findBy",value:function(){return J(this,U.apply(void 0,arguments))}},{key:"findIndexBy",value:function(){return I(this,U.apply(void 0,arguments))}},{key:"isEvery",value:function(){return K(this,U.apply(void 0,arguments))}},{key:"isAny",value:function(){return W(this,U.apply(void 0,arguments))}},{key:"invoke",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i=0;){B(this,e)===t&&this.removeAt(e)}return this}},{key:"removeObjects",value:function(t){for(var e=t.length-1;e>=0;e--)this.removeObject(t[e]);return this}},{key:"addObject",value:function(t){return this.includes(t)||this.pushObject(t),this}},{key:"addObjects",value:function(t){var e=this;return t.forEach((function(t){return e.addObject(t)})),this}}]),n}(k(Array)),V=function(t){var e=null==t;if(e)return e;if("number"==typeof t.size)return!t.size;var n=s(t);if("object"===n){var i=t.size;if("number"==typeof i)return!i}if("number"==typeof t.length&&"function"!==n)return!t.length;if("object"===n){var r=t.length;if("number"==typeof r)return!r}return!1},Z=function(t){return V(t)||"string"==typeof t&&!1===/\S/.test(t)};function Y(t){return isFinite(t)&&Math.abs(t)<=90}function X(t){return isFinite(t)&&Math.abs(t)<=180&&Math.abs(t)>=90}function tt(t){return t instanceof vt}var et=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^[+]?[\s./0-9]*[(]?[0-9]{1,4}[)]?[-\s./0-9]*$/g.test(t)},nt=function(){var t,e,n,i,r;return!("undefined"==typeof process||"object"!==s(null===(t=process)||void 0===t?void 0:t.env)&&-1===(null===(e=process.release)||void 0===e||null===(n=e.name)||void 0===n?void 0:n.search(/node|io.js/))||"undefined"!=typeof window&&"ReactNative"!==(null===(i=window)||void 0===i||null===(r=i.navigator)||void 0===r?void 0:r.product))},it=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return nt()?It("adapter","NodeAdapter",t):It("adapter","BrowserAdapter",t)},rt=Array.isArray,ot=function(){function t(e){c(this,t),this.place=e,this.geometry=null==e?void 0:e.geometry,this.components=this.parseComponents(),this.attributes=this.parseProperties()}return l(t,[{key:"parse",value:function(){this.parseComponents(),this.parseProperties()}},{key:"parseComponents",value:function(){var t;return((null===(t=this.place)||void 0===t?void 0:t.address_components)||[]).reduce((function(t,e){return e.types.forEach((function(n){t[n]=e})),t}),{})}},{key:"parseProperties",value:function(){var t,e={streetNumber:this.get("street_number"),streetName:this.get("route"),coordinates:null!==(t=this.geometry)&&void 0!==t&&t.location?Object.values(this.geometry.location):[0,0],city:this.or(["locality","sublocality","sublocality_level_1","neighborhood","administrative_area_level_3","administrative_area_level_2"]),county:this.get("administrative_area_level_2"),stateShort:this.get("administrative_area_level_1",!0),stateLong:this.get("administrative_area_level_1"),countryShort:this.get("country",!0),country:this.get("country",!0),countryLong:this.get("country"),postalCode:this.get("postal_code")};return e.address=[e.streetNumber,e.streetName].filter(Boolean).join(" "),e}},{key:"all",value:function(){return this.attributes}},{key:"or",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=0;e1&&void 0!==arguments[1]&&arguments[1];return t in this.components?e?this.components[t].short_name:this.components[t].long_name:null}},{key:"setAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.attributes=o(o({},this.attributes),t),this}},{key:"setAttribute",value:function(t,e){return this.attributes[t]=e,this}},{key:"getAttribute",value:function(t){return this.attributes[t]||null}}]),t}(),st=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;c(this,t),this.type="Point",this.coordinates=[n,e]}return l(t,[{key:"latitude",get:function(){return this.coordinates[1]}},{key:"longitude",get:function(){return this.coordinates[0]}},{key:"lat",value:function(){return this.latitude}},{key:"lng",value:function(){return this.longitude}},{key:"serialize",value:function(){return{type:"Point",coorindates:[this.lat(),this.lng()]}}},{key:"toJson",value:function(){return this.serialize()}},{key:"toString",value:function(){return"(".concat(this.latitude,", ").concat(this.longitude,")")}}],[{key:"fromGeoJson",value:function(e){var n=x(e.coordinates,2);return longitude=n[0],latitude=n[1],new t(latitude,longitude)}}]),t}(),at=function(t){return"object"===s(t)&&!V(null==t?void 0:t.attributes)&&"object"===s(null==t?void 0:t.attributes)},ut=function(t,e){var n=t();return Array.isArray(n)||"object"===s(n)?ct(n,e):null},ct=function t(e,n){var i=e,r=s(e),o="object"===r,a="function"===r,u=Array.isArray(e),c="string"===s(n)&&n.includes(".")?n.split("."):[n];if(u||o){for(var h=0;h0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;c(this,t),this.actions=e,this.bind=n}return l(t,[{key:"extend",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=t||this.bind;if(!e)return this;if(null!=this&&this.actions&&"object"===s(this.actions))for(var n in this.actions){var i=this.actions[n];"function"==typeof i?ht(e,n,i.bind(e)):ht(e,n,i)}return this}}]),t}(),vt=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};c(this,t),this.attributes=e,this.dirtyAttributes={},this.changes={},this.isLoading=!1,this.isSaving=!1,this.isDestroying=!1,this.isReloading=!1,this.resource=i,this.options=r,this.version=r.version||"v1",this.setAdapter(n)}return l(t,[{key:"setAdapter",value:function(t){var e;return this.adapter=t,this.store=new Kt(this.resource,t,{onAfterFetch:this.syncAttributes.bind(this),actions:null===(e=this.options)||void 0===e?void 0:e.actions}),this}},{key:"id",get:function(){return this.getAttribute("id")}},{key:"create",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.mergeAttributes(e);return this.setFlags(["isLoading","isSaving"]),this.store.create(n).then((function(e){return t.setFlags(["isLoading","isSaving"],!1),e}))}},{key:"update",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.setFlags(["isLoading","isSaving"]),this.store.update(this.attributes.id,e).then((function(e){return t.setFlags(["isLoading","isSaving"],!1),e}))}},{key:"destroy",value:function(){var t=this;return this.setFlags(["isLoading","isDestroying"]),this.store.destroy(this.attributes.id).then((function(e){return t.setFlags(["isLoading","isDestroying"],!1),e}))}},{key:"reload",value:function(){var t=this;return this.setFlags(["isLoading","isReloading"]),this.store.findRecord(this.attributes.id).then((function(e){return t.reset(),e}))}},{key:"setFlags",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=["isLoading","isSaving","isReloading","isDestroying"],i=0;i0&&void 0!==arguments[0]?arguments[0]:{},e=this.getAttributes();return V(this.id)?this.create(e):!0===t.onlyDirty?this.savedirty():this.update(e)}},{key:"saveDirty",value:function(){for(var t=Object.keys(this.dirtyAttributes),e={},n=0;n0}},{key:"mutate",value:function(t,e){this.attributes[t]=e}},{key:"setAttribute",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(null===n&&"object"===s(t))return this.setAttributes(t);var i=null!==(e=null==this?void 0:this.attributes[t])&&void 0!==e?e:null;return ht(this.attributes,t,n),ht(this.dirtyAttributes,t,i),z(null==this?void 0:this.changes[t])||(this.changes[t]=[]),this.changes[t].push({property:t,previousValue:i,value:n,changedAt:new Date}),this}},{key:"setAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var e in t)this.setAttribute(e,t[e]);return this}},{key:"getAttribute",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=ct(null!==(e=null==this?void 0:this.attributes)&&void 0!==e?e:{},t);return void 0===i?n:i}},{key:"hasAttribute",value:function(t){if(z(t)){var e,n=t,i=Object.keys(null!==(e=this.attributes)&&void 0!==e?e:{});return n.every((function(t){return i.includes(t)}))}return!(null==this||!this.attributes)&&t in this.attributes}},{key:"hasAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.hasAttribute(t)}},{key:"isAttributeFilled",value:function(t){var e=this;return z(t)?this.hasAttribute(t)&&t.every((function(t){return!V(e.getAttribute(t))})):this.hasAttribute(t)&&!V(this.getAttribute(t))}},{key:"getAttributes",value:function(t){var e={};if(null==t)return this.getAttributes(Object.keys(this.attributes));if("string"==typeof t)return this.getAttribute(Array.prototype.slice.call(arguments));if(!z(t))throw new Error("No attribute properties provided!");for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=null!==(t=null==this?void 0:this.attributes)&&void 0!==t?t:{};return this.attributes=o(o({},n),e),this.attributes}},{key:"syncAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.attributes=t}}]),t}(),dt=new lt({getDistanceAndTime:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.get("".concat(this.namespace,"/").concat(t,"/distance-and-time"),e,n)},getNextActivity:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.get("".concat(this.namespace,"/").concat(t,"/next-activity"),e,n)},dispatch:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/dispatch"),e,n).then(this.afterFetch.bind(this))},start:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/start"),e,n).then(this.afterFetch.bind(this))},updateActivity:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/update-activity"),e,n).then(this.afterFetch.bind(this))},setDestination:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return tt(e)&&(e=e.id),this.adapter.post("".concat(this.namespace,"/").concat(t,"/set-destination/").concat(e),n,i).then(this.afterFetch.bind(this))},captureQrCode:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return tt(e)&&(e=e.id),this.adapter.post("".concat(this.namespace,"/").concat(t,"/capture-qr").concat(e?"/"+e:""),n,i)},captureSignature:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return tt(e)&&(e=e.id),this.adapter.post("".concat(this.namespace,"/").concat(t,"/capture-signature").concat(e?"/"+e:""),n,i)},complete:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/complete"),e,n).then(this.afterFetch.bind(this))},cancel:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.delete("".concat(this.namespace,"/").concat(t,"/cancel"),e,n).then(this.afterFetch.bind(this))}}),ft=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"order",o({actions:dt},r))}return l(n,[{key:"getDistanceAndTime",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.getDistanceAndTime(this.id,t,e)}},{key:"dispatch",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.dispatch(this.id,t,e)}},{key:"start",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.start(this.id,t,e)}},{key:"setDestination",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.store.setDestination(this.id,t,e,n)}},{key:"captureQrCode",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.store.captureQrCode(this.id,t,e,n)}},{key:"captureSignature",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.store.captureSignature(this.id,t,e,n)}},{key:"getNextActivity",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.getNextActivity(this.id,t,e)}},{key:"updateActivity",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.updateActivity(this.id,t,e)}},{key:"cancel",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.cancel(this.id,t,e)}},{key:"complete",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.complete(this.id,t,e)}},{key:"isDispatched",get:function(){return null!==this.getAttribute("dispatched_at")}},{key:"isNotDispatched",get:function(){return null==this.getAttribute("dispatched_at")}},{key:"isStarted",get:function(){return null!==this.getAttribute("started_at")}},{key:"isNotStarted",get:function(){return null==this.getAttribute("started_at")}},{key:"isCompleted",get:function(){return"completed"==this.getAttribute("status")}},{key:"isCanceled",get:function(){return"canceled"==this.getAttribute("status")}},{key:"isEnroute",get:function(){return"driver_enroute"==this.getAttribute("status")||"enroute"===this.getAttribute("status")}},{key:"isInProgress",get:function(){return this.isStarted&&!this.isCanceled&&!this.isCompleted}},{key:"scheduledAt",get:function(){return this.isAttributeFilled("scheduled_at")?new Date(this.getAttribute("scheduled_at")):null}},{key:"startedAt",get:function(){return this.isAttributeFilled("started_at")?new Date(this.getAttribute("started_at")):null}},{key:"dispatchedAt",get:function(){return this.isAttributeFilled("dispatched_at")?new Date(this.getAttribute("dispatched_at")):null}},{key:"status",get:function(){return this.getAttribute("status")}}]),n}(vt),gt=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"payload",r)}return l(n,[{key:"attach",value:function(t){}},{key:"entities",get:function(){}},{key:"dropoff",get:function(){}},{key:"pickup",get:function(){}},{key:"waypoints",get:function(){return new Q(this.waypoints)}}]),n}(vt),pt=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"entity",r)}return n}(vt),yt=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"place",r)}return l(n,[{key:"latitude",get:function(){var t;return null===(t=this.getAttribute("location",new st))||void 0===t?void 0:t.coordinates[1]}},{key:"longitude",get:function(){var t;return null===(t=this.getAttribute("location",new st))||void 0===t?void 0:t.coordinates[0]}},{key:"coordinates",get:function(){return[this.latitude,this.longitude]}},{key:"setOwner",value:function(t){return tt(t)&&this.setAttribute("owner",t.id),"string"==typeof t&&this.setAttribute("owner",t),this}}],[{key:"fromGoogleAddress",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.getAttribute("coordinates"),o=x(r,2),s=o[0],a=o[1],u={name:null,address:t.getAttribute("address"),location:new st(s,a),street1:t.getAttribute("streetName"),street2:null,city:t.getAttribute("city"),province:t.getAttribute("stateLong"),postal_code:t.getAttribute("postalCode"),neighborhood:t.get("neighborhood"),district:t.getAttribute("county"),building:t.get("building"),country:t.getAttribute("countryShort"),phone:null,security_access_code:null};return new n(u,e,i)}}]),n}(vt),bt=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"waypoint",r)}return n}(yt),kt=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"tracking-status",r)}return n}(vt),mt=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"vehicle",r)}return n}(vt),wt=new lt({login:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(et(t))return this.adapter.post("drivers/login-with-sms",{phone:t});if(!e)throw new Error("Login requires password!");return this.adapter.post("drivers/login",o({identity:t,password:e},n)).then(this.afterFetch.bind(this))},verifyCode:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("drivers/verify-code",o({identity:t,code:e},n)).then(this.afterFetch.bind(this))},track:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("drivers/".concat(t,"/track"),e,n).then(this.afterFetch.bind(this))},retrieve:function(t){return this.findRecord(t)},syncDevice:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("drivers/".concat(t,"/register-device"),e,n)}}),At=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"driver",o({actions:wt},r))}return l(n,[{key:"token",get:function(){return this.getAttribute("token")}},{key:"isOnline",get:function(){return!0===this.getAttribute("online")}},{key:"latitude",get:function(){var t;return null===(t=this.getAttribute("location",new Point))||void 0===t?void 0:t.coordinates[1]}},{key:"longitude",get:function(){var t;return null===(t=this.getAttribute("location",new Point))||void 0===t?void 0:t.coordinates[0]}},{key:"coordinates",get:function(){return[this.latitude,this.longitude]}},{key:"track",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.track(this.id,t,e)}},{key:"syncDevice",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.syncDevice(this.id,t,e)}}]),n}(vt),xt=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"vendor",r)}return n}(vt),Et=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"contact",r)}return n}(vt),Rt=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"zone",r)}return n}(vt),$t=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"service-area",r)}return n}(vt),jt=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"service-rate",r)}return n}(vt),Ot=function(t){d(n,t);var e=A(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"service-quote",r)}return l(n,[{key:"fromPreliminary",value:function(){}},{key:"fromPayload",value:function(){}}]),n}(vt),St=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};c(this,t),this.version=e.version||"v1",this.host=e.host||null,this.namespace=e.namespace||null,this.headers=e.headers||{}},_t=function(t){d(n,t);var e=A(n);function n(t){var i;return c(this,n),(i=e.call(this,t)).setHeaders({Authorization:"Bearer ".concat(t.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;browser"}),i}return l(n,[{key:"setHeaders",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.headers=o(o({},this.headers),t),this}},{key:"parseJSON",value:function(t){return new Promise((function(e,n){return t.json().then((function(n){return e({statusText:t.statusText,status:t.status,ok:t.ok,json:n})})).catch((function(){n(new Error("Oops! Something went wrong when handling your request."))}))}))}},{key:"request",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise((function(s,a){return fetch(r.url||"".concat(e.host,"/").concat(e.namespace,"/").concat(t),o({method:n,mode:r.mode||"cors",headers:new Headers(o(o({},e.headers||{}),r.headers||{}))},i)).then(e.parseJSON).then((function(t){return t.ok?s(t.json):a(new Error(t.json.errors?t.json.errors[0]:t.statusText))})).catch((function(t){a(t)}))}))}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=Z(e)?"":new URLSearchParams(e).toString();return this.request("".concat(t).concat(i?"?".concat(i):""),"GET",{},n)}},{key:"post",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"POST",{body:JSON.stringify(e)},n)}},{key:"put",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"PUT",{body:JSON.stringify(e)},n)}},{key:"delete",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.request(t,"DELETE",{},e)}},{key:"patch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"PATCH",{body:JSON.stringify(e)},n)}}]),n}(St),Pt=function(t){d(n,t);var e=A(n);function n(t){var r;return c(this,n),(r=e.call(this,t)).axios=i.default.create({baseURL:"".concat(r.host,"/").concat(r.namespace),headers:{Authorization:"Bearer ".concat(t.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;node"}}),r}return l(n,[{key:"setHeaders",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.axios.defaults.headers.common;return this.axios.defaults.headers.common=o(o({},e),t),this}},{key:"transform",value:function(t){return t.data}},{key:"handleError",value:function(t){if(t.response){var e=t.response.data;if(z(e.errors))throw new Error(e.errors[0]);if(e.error)throw new Error(e.error)}throw t}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=Z(e)?"":new URLSearchParams(e).toString();return this.axios.get("".concat(t).concat(i?"?".concat(i):""),n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"post",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.post(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"put",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.put(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"delete",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.axios.delete(t,e).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"patch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.patch(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}}]),n}(St),Ft=function(t){d(n,t);var e=A(n);function n(){return c(this,n),e.apply(this,arguments)}return n}(St),zt=function(){function t(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];c(this,t),v(this,"uncountableWords",["equipment","information","rice","money","species","series","fish","sheep","moose","deer","news"]),v(this,"pluralRules",[[new RegExp("(m)an$","gi"),"$1en"],[new RegExp("(pe)rson$","gi"),"$1ople"],[new RegExp("(child)$","gi"),"$1ren"],[new RegExp("^(ox)$","gi"),"$1en"],[new RegExp("(ax|test)is$","gi"),"$1es"],[new RegExp("(octop|vir)us$","gi"),"$1i"],[new RegExp("(alias|status)$","gi"),"$1es"],[new RegExp("(bu)s$","gi"),"$1ses"],[new RegExp("(buffal|tomat|potat)o$","gi"),"$1oes"],[new RegExp("([ti])um$","gi"),"$1a"],[new RegExp("sis$","gi"),"ses"],[new RegExp("(?:([^f])fe|([lr])f)$","gi"),"$1$2ves"],[new RegExp("(hive)$","gi"),"$1s"],[new RegExp("([^aeiouy]|qu)y$","gi"),"$1ies"],[new RegExp("(x|ch|ss|sh)$","gi"),"$1es"],[new RegExp("(matr|vert|ind)ix|ex$","gi"),"$1ices"],[new RegExp("([m|l])ouse$","gi"),"$1ice"],[new RegExp("(quiz)$","gi"),"$1zes"],[new RegExp("s$","gi"),"s"],[new RegExp("$","gi"),"s"]]),v(this,"singularRules",[[new RegExp("(m)en$","gi"),"$1an"],[new RegExp("(pe)ople$","gi"),"$1rson"],[new RegExp("(child)ren$","gi"),"$1"],[new RegExp("([ti])a$","gi"),"$1um"],[new RegExp("((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$","gi"),"$1$2sis"],[new RegExp("(hive)s$","gi"),"$1"],[new RegExp("(tive)s$","gi"),"$1"],[new RegExp("(curve)s$","gi"),"$1"],[new RegExp("([lr])ves$","gi"),"$1f"],[new RegExp("([^fo])ves$","gi"),"$1fe"],[new RegExp("([^aeiouy]|qu)ies$","gi"),"$1y"],[new RegExp("(s)eries$","gi"),"$1eries"],[new RegExp("(m)ovies$","gi"),"$1ovie"],[new RegExp("(x|ch|ss|sh)es$","gi"),"$1"],[new RegExp("([m|l])ice$","gi"),"$1ouse"],[new RegExp("(bus)es$","gi"),"$1"],[new RegExp("(o)es$","gi"),"$1"],[new RegExp("(shoe)s$","gi"),"$1"],[new RegExp("(cris|ax|test)es$","gi"),"$1is"],[new RegExp("(octop|vir)i$","gi"),"$1us"],[new RegExp("(alias|status)es$","gi"),"$1"],[new RegExp("^(ox)en","gi"),"$1"],[new RegExp("(vert|ind)ices$","gi"),"$1ex"],[new RegExp("(matr)ices$","gi"),"$1ix"],[new RegExp("(quiz)zes$","gi"),"$1"],[new RegExp("s$","gi"),""]]),v(this,"nonTitlecasedWords",["and","or","nor","a","an","the","so","but","to","of","at","by","from","into","on","onto","off","out","in","over","with","for"]),v(this,"idSuffix",new RegExp("(_ids|_id)$","g")),v(this,"underbar",new RegExp("_","g")),v(this,"spaceOrUnderbar",new RegExp("[ _]","g")),v(this,"uppercase",new RegExp("([A-Z])","g")),v(this,"underbarPrefix",new RegExp("^_")),this.str=e,this.chain=n}return l(t,[{key:"get",value:function(){return this.str}},{key:"applyRules",value:function(t,e,n,i){if(i)t=i;else if(!(n.indexOf(t.toLowerCase())>-1))for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:null;return t=t||this.str,this.applyRules(t,this.pluralRules,this.uncountableWords,e)}},{key:"singularize",value:function(t,e){return t=t||this.str,this.applyRules(t,this.singularRules,this.uncountableWords,e)}},{key:"camelize",value:function(t,e){for(var n=(t=t||this.str).split("/"),i=0;i1&&void 0!==arguments[1]&&arguments[1];return t=t||this.str,t=this.underscore(this.demodulize(t))+(e?"":"_")+"id",this.str=t,!0===this.chain?this:t}},{key:"ordinalize",value:function(t){for(var e=(t=t||this.str).split(" "),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];if(t.actions=z(e)?e:[e],!z(e))return e instanceof lt&&e.extend(t),t;for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{};c(this,t),this.resource=e,this.adapter=n||it(),this.namespace=Dt(e),this.storage=new Q,this.options=i,this.extendActions(i.actions)}return l(t,[{key:"extendActions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Jt(this,t)}},{key:"deposit",value:function(t){return t}},{key:"serialize",value:function(t){return It("resource",Tt(this.resource),t,this.adapter)}},{key:"afterFetch",value:function(t){return Wt(this,t)}},{key:"create",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var i=u(regeneratorRuntime.mark((function i(r,o){var s;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.adapter.post("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=i.sent,r(s);case 4:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}())}},{key:"update",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(function(){var r=u(regeneratorRuntime.mark((function r(o,s){var a;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e.adapter.put("".concat(e.namespace,"/").concat(t),n,i).then(e.afterFetch.bind(e)).catch(s);case 2:a=r.sent,o(a);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"findRecord",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var i=u(regeneratorRuntime.mark((function i(r,o){var s;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,e.adapter.get("".concat(e.namespace,"/").concat(t),{},n).then(e.afterFetch.bind(e)).catch(o);case 2:s=i.sent,r(s);case 4:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}())}},{key:"findAll",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(){var n=u(regeneratorRuntime.mark((function n(i,r){var o;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.adapter.get("".concat(t.namespace),{},e).then(t.afterFetch.bind(t)).catch(r);case 2:o=n.sent,i(o);case 4:case"end":return n.stop()}}),n)})));return function(t,e){return n.apply(this,arguments)}}())}},{key:"query",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var i=u(regeneratorRuntime.mark((function i(r,o){var s;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.adapter.get("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=i.sent,r(s);case 4:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}())}},{key:"queryRecord",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.single=!0,new Promise(function(){var i=u(regeneratorRuntime.mark((function i(r,o){var s;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.adapter.get("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=i.sent,r(s);case 4:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}())}},{key:"destroy",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=tt(t)?t.getAttribute("id"):t;return new Promise(function(){var t=u(regeneratorRuntime.mark((function t(r,o){var s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.adapter.delete("".concat(e.namespace,"/").concat(i),{},n).then(e.afterFetch.bind(e)).catch(o);case 2:s=t.sent,r(s);case 4:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}())}}]),t}(),Mt=function(){function t(e){var n,i,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(c(this,t),this.version=null!==(n=o.version)&&void 0!==n?n:"v1",this.options={version:this.version,host:null!==(i=o.host)&&void 0!==i?i:"https://api.fleetbase.io",namespace:null!==(r=o.namespace)&&void 0!==r?r:this.version,debug:s,publicKey:e},"string"!=typeof e||0===e.length)throw new Error("⚠️ Invalid public key given to Fleetbase SDK");if(!nt()&&e.toLowerCase().startsWith("$"))throw new Error("Secret key provided. You must use a public key with Fleetbase Javascript SDK!");this.adapter=o.adapter||it(this.options),this.orders=new Kt("order",this.adapter).extendActions(dt),this.entities=new Kt("entity",this.adapter),this.places=new Kt("place",this.adapter),this.drivers=new Kt("driver",this.adapter).extendActions(wt),this.vehicles=new Kt("vehicle",this.adapter),this.vendors=new Kt("vendor",this.adapter),this.contacts=new Kt("contact",this.adapter)}return l(t,[{key:"setAdapter",value:function(t){this.adapter=t}},{key:"getAdapter",value:function(){return this.adapter}}],[{key:"newInstance",value:function(){return y(t,Array.prototype.slice.call(arguments))}}]),t}();t.Adapter=St,t.BrowserAdapter=_t,t.Collection=Q,t.Contact=Et,t.Driver=At,t.EmberJsAdapter=Ft,t.Entity=pt,t.GoogleAddress=ot,t.NodeAdapter=Pt,t.Order=ft,t.Payload=gt,t.Place=yt,t.Point=st,t.Resource=vt,t.ServiceArea=$t,t.ServiceQuote=Ot,t.ServiceRate=jt,t.Store=Kt,t.StoreActions=lt,t.TrackingStatus=kt,t.Vehicle=mt,t.Vendor=xt,t.Waypoint=bt,t.Zone=Rt,t.camelize=Lt,t.classify=Tt,t.dasherize=Nt,t.default=Mt,t.extendStoreActions=Jt,t.isLatitude=Y,t.isLongitude=X,t.isNodeEnvironment=nt,t.isResource=tt,t.pluralize=Dt,t.singularize=Ct})); //# sourceMappingURL=sdk.min.js.map diff --git a/dist/@fleetbase/sdk.min.js.map b/dist/@fleetbase/sdk.min.js.map index a568036..f26d171 100644 --- a/dist/@fleetbase/sdk.min.js.map +++ b/dist/@fleetbase/sdk.min.js.map @@ -1 +1 @@ -{"version":3,"file":"sdk.min.js","sources":["../../src/utils/array.js","../../src/utils/collection.js","../../src/utils/is-empty.js","../../src/utils/is-blank.js","../../src/utils/is-latitude.js","../../src/utils/is-longitude.js","../../src/utils/is-resource.js","../../src/utils/is-phone.js","../../src/utils/is-node-environment.js","../../src/utils/detect-adapter.js","../../src/utils/google-address.js","../../src/utils/point.js","../../src/utils/object.js","../../src/utils/store-actions.js","../../src/resource.js","../../src/resources/order.js","../../src/resources/payload.js","../../src/resources/entity.js","../../src/resources/place.js","../../src/resources/waypoint.js","../../src/resources/tracking-status.js","../../src/resources/vehicle.js","../../src/resources/driver.js","../../src/resources/vendor.js","../../src/resources/contact.js","../../src/resources/zone.js","../../src/resources/service-area.js","../../src/resources/service-rate.js","../../src/resources/service-quote.js","../../src/adapter.js","../../src/adapters/browser.js","../../src/adapters/node.js","../../src/adapters/ember.js","../../src/utils/string.js","../../src/resolver.js","../../src/store.js","../../src/fleetbase.js"],"sourcesContent":["const { isArray } = Array;\n\nexport {\n isArray\n};\n","import { isArray } from './array';\n\n/**\n * Collection\n * Extended array inspired by Ember's NativeArray\n **/\n\nconst CHUNK_SIZE = 60000;\n\n// To avoid overflowing the stack, we splice up to CHUNK_SIZE items at a time.\n// See https://code.google.com/p/chromium/issues/detail?id=56588 for more details.\nconst replace = (array, start, deleteCount, items = []) => {\n if (isArray(array)) {\n if (items.length <= CHUNK_SIZE) {\n array.splice(start, deleteCount, ...items);\n } else {\n array.splice(start, deleteCount);\n\n for (let i = 0; i < items.length; i += CHUNK_SIZE) {\n let chunk = items.slice(i, i + CHUNK_SIZE);\n array.splice(start + i, 0, ...chunk);\n }\n }\n } else if (isCollection(arr)) {\n array.replace(start, deleteCount, items);\n }\n};\n\nconst identityFunction = (item) => item;\n\nconst uniqBy = (array, key = identityFunction) => {\n let ret = [];\n let seen = new Set();\n let getter = typeof key === 'function' ? key : (item) => get(item, key);\n\n array.forEach((item) => {\n let val = getter(item);\n if (!seen.has(val)) {\n seen.add(val);\n ret.push(item);\n }\n });\n\n return ret;\n};\n\nconst isCollection = (mixed) => mixed instanceof Collection;\n\nconst objectAt = (array, index) => {\n if (isArray(array)) {\n return array[index];\n } else if (isCollection(array)) {\n return array.objectAt(index);\n }\n\n return null;\n};\n\nconst iter = (key, value) => {\n let valueProvided = arguments.length === 2;\n return valueProvided ? (item) => value === item[key] : (item) => Boolean(item[key]);\n};\n\nconst findIndex = (array, predicate, startAt = 0) => {\n let len = array.length;\n for (let index = startAt; index < len; index++) {\n let item = objectAt(array, index);\n if (predicate(item, index, array)) {\n return index;\n }\n }\n return -1;\n};\n\nconst find = (array, callback, target) => {\n let predicate = callback.bind(target);\n let index = findIndex(array, predicate, 0);\n return index === -1 ? undefined : objectAt(array, index);\n};\n\nconst any = (array, callback, target) => {\n let predicate = callback.bind(target);\n return findIndex(array, predicate, 0) !== -1;\n};\n\nconst every = (array, callback, target) => {\n let cb = callback.bind(target);\n let predicate = (item, index, array) => !cb(item, index, array);\n return findIndex(array, predicate, 0) === -1;\n};\n\nconst indexOf = (array, val, startAt = 0, withNaNCheck) => {\n let len = array.length;\n\n if (startAt < 0) {\n startAt += len;\n }\n\n // SameValueZero comparison (NaN !== NaN)\n let predicate = withNaNCheck && val !== val ? (item) => item !== item : (item) => item === val;\n return findIndex(array, predicate, startAt);\n};\n\nconst removeAt = (array, index, len = 1) => {\n replace(array, index, len, []);\n return array;\n};\n\nconst insertAt = (array, index, item) => {\n replace(array, index, 0, [item]);\n return item;\n};\n\nclass Collection extends Array {\n constructor(...items) {\n if (isArray(arguments[0])) {\n super(...arguments[0]);\n } else {\n super(...arguments);\n }\n }\n\n get notEmpty() {\n return this.length > 0;\n }\n\n get empty() {\n return this.length === 0;\n }\n\n get first() {\n return objectAt(this, 0);\n }\n\n get last() {\n return objectAt(this, this.length - 1);\n }\n\n replace(start, deleteCount, items = []) {\n replace(this, start, deleteCount, items);\n\n return this;\n }\n\n objectsAt(indexes) {\n return indexes.map((idx) => objectAt(this, idx));\n }\n\n objectAt(index) {\n return objectAt(this, index);\n }\n\n indexOf(object, startAt) {\n return indexOf(this, object, startAt, false);\n }\n\n lastIndexOf(object, startAt) {\n let len = this.length;\n\n if (startAt === undefined || startAt >= len) {\n startAt = len - 1;\n }\n\n if (startAt < 0) {\n startAt += len;\n }\n\n for (let idx = startAt; idx >= 0; idx--) {\n if (objectAt(this, idx) === object) {\n return idx;\n }\n }\n\n return -1;\n }\n\n includes(object, startAt) {\n return indexOf(this, object, startAt, true) !== -1;\n }\n\n findBy() {\n return find(this, iter(...arguments));\n }\n\n findIndexBy() {\n return findIndex(this, iter(...arguments));\n }\n\n isEvery() {\n return every(this, iter(...arguments));\n }\n\n isAny() {\n return any(this, iter(...arguments));\n }\n\n invoke(methodName, ...args) {\n let ret = [];\n\n this.forEach((item) => ret.push(item[methodName]?.(...args)));\n\n return ret;\n }\n\n toArray() {\n return this.map((item) => item);\n }\n\n compact() {\n return this.filter((value) => value != null);\n }\n\n sortBy() {\n let sortKeys = arguments;\n\n return this.sort((a, b) => {\n for (let i = 0; i < sortKeys.length; i++) {\n let key = sortKeys[i];\n let propA = a[key];\n let propB = b[key];\n // return 1 or -1 else continue to the next sortKey\n let compareValue = compare(propA, propB);\n\n if (compareValue) {\n return compareValue;\n }\n }\n return 0;\n });\n }\n\n uniqBy(key) {\n return uniqBy(this, key);\n }\n\n without(value) {\n if (!this.includes(value)) {\n return this; // nothing to do\n }\n\n // SameValueZero comparison (NaN !== NaN)\n let predicate = value === value ? (item) => item !== value : (item) => item === item;\n return this.filter(predicate);\n }\n\n clear() {\n let len = this.length;\n if (len === 0) {\n return this;\n }\n\n this.replace(0, len, []);\n return this;\n }\n\n insertAt(idx, object) {\n insertAt(this, idx, object);\n return this;\n }\n\n replaceAt(idx, object) {\n return this.replace(idx, 1, [object]);\n }\n\n removeAt(start, len) {\n return removeAt(this, start, len);\n }\n\n pushObject(obj) {\n return this.insertAt(this.length, obj);\n }\n\n pushObjects(objects) {\n this.replace(this.length, 0, objects);\n return this;\n }\n\n popObject() {\n let len = this.length;\n if (len === 0) {\n return null;\n }\n\n let ret = objectAt(this, len - 1);\n this.removeAt(len - 1, 1);\n return ret;\n }\n\n shiftObject() {\n if (this.length === 0) {\n return null;\n }\n\n let ret = objectAt(this, 0);\n this.removeAt(0);\n return ret;\n }\n\n unshiftObject(obj) {\n return insertAt(this, 0, obj);\n }\n\n unshiftObjects(objects) {\n this.replace(0, 0, objects);\n return this;\n }\n\n reverseObjects() {\n let len = this.length;\n if (len === 0) {\n return this;\n }\n\n let objects = this.toArray().reverse();\n this.replace(0, len, objects);\n return this;\n }\n\n setObjects(objects) {\n if (objects.length === 0) {\n return this.clear();\n }\n\n let len = this.length;\n this.replace(0, len, objects);\n return this;\n }\n\n removeObject(obj) {\n let loc = this.length || 0;\n while (--loc >= 0) {\n let curObject = objectAt(this, loc);\n\n if (curObject === obj) {\n this.removeAt(loc);\n }\n }\n return this;\n }\n\n removeObjects(objects) {\n for (let i = objects.length - 1; i >= 0; i--) {\n this.removeObject(objects[i]);\n }\n\n return this;\n }\n\n addObject(obj) {\n let included = this.includes(obj);\n\n if (!included) {\n this.pushObject(obj);\n }\n\n return this;\n }\n\n addObjects(objects) {\n objects.forEach((obj) => this.addObject(obj));\n return this;\n }\n}\n\nexport default Collection;\n\nexport { replace, uniqBy, isCollection, objectAt, iter, findIndex, find, any, every, indexOf, removeAt, insertAt };\n","const isEmpty = (obj) => {\n const none = obj === null || obj === undefined;\n if (none) {\n return none;\n }\n\n if (typeof obj.size === 'number') {\n return !obj.size;\n }\n\n const objectType = typeof obj;\n\n if (objectType === 'object') {\n const { size } = obj;\n if (typeof size === 'number') {\n return !size;\n }\n }\n\n if (typeof obj.length === 'number' && objectType !== 'function') {\n return !obj.length;\n }\n\n if (objectType === 'object') {\n const { length } = obj;\n if (typeof length === 'number') {\n return !length;\n }\n }\n\n return false;\n};\n\nexport default isEmpty;\n","import isEmpty from './is-empty';\n\nconst isBlank = (obj) => isEmpty(obj) || (typeof obj === 'string' && /\\S/.test(obj) === false);\n\nexport default isBlank;\n","export default function isLatitude(coordinate) {\n return isFinite(coordinate) && Math.abs(coordinate) <= 90;\n}\n","export default function isLongitude(coordinate) {\n return isFinite(coordinate) && Math.abs(coordinate) <= 180 && Math.abs(coordinate) >= 90;\n}\n","import Resource from '../resource';\n\nexport default function isResource(record) {\n return record instanceof Resource;\n}\n","const isPhone = (phone = '') => {\n return /^[+]?[\\s./0-9]*[(]?[0-9]{1,4}[)]?[-\\s./0-9]*$/g.test(phone);\n}\n\nexport default isPhone;","/**\n * Determines if environment SDK is initialized in is Node, additionally checks pass if environment is ReactNative.\n * \n * @returns boolean\n */\nconst isNodeEnvironment = () => {\n return (typeof process !== 'undefined') && (typeof process?.env === 'object' || process.release?.name?.search(/node|io.js/) !== -1) && (typeof window === 'undefined' || window?.navigator?.product === 'ReactNative');\n};\n\nexport default isNodeEnvironment;","import { lookup } from '../resolver';\nimport isNodeEnvironment from './is-node-environment';\n\nconst detectAdapter = (options = {}) => {\n if (isNodeEnvironment()) {\n return lookup('adapter', 'NodeAdapter', options);\n }\n\n return lookup('adapter', 'BrowserAdapter', options);\n}\n\nexport default detectAdapter;","const { isArray } = Array;\n\nclass GoogleAddress {\n constructor(place) {\n this.place = place;\n this.geometry = place?.geometry;\n this.components = this.parseComponents();\n this.attributes = this.parseProperties();\n }\n\n parse() {\n this.parseComponents();\n this.parseProperties();\n }\n\n parseComponents() {\n const components = (this.place?.address_components || []).reduce(function (acc, data) {\n data.types.forEach(function (type) {\n acc[type] = data;\n });\n return acc;\n }, {});\n\n return components;\n }\n\n parseProperties() {\n const attributes = {\n streetNumber: this.get('street_number'),\n streetName: this.get('route'),\n coordinates: this.geometry?.location ? Object.values(this.geometry.location) : [0, 0],\n city: this.or(['locality', 'sublocality', 'sublocality_level_1', 'neighborhood', 'administrative_area_level_3', 'administrative_area_level_2']),\n county: this.get('administrative_area_level_2'),\n stateShort: this.get('administrative_area_level_1', true),\n stateLong: this.get('administrative_area_level_1'),\n countryShort: this.get('country', true),\n country: this.get('country', true),\n countryLong: this.get('country'),\n postalCode: this.get('postal_code'),\n };\n\n attributes.address = [attributes.streetNumber, attributes.streetName].filter(Boolean).join(' ');\n\n return attributes;\n }\n\n all() {\n return this.attributes;\n }\n\n or(keys = []) {\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n\n if (isArray(key)) {\n const pkey = key[0];\n const short = key[1];\n\n if (this.has(pkey)) {\n return this.get(pkey, short);\n }\n\n continue;\n }\n\n if (this.has(key)) {\n return this.get(key);\n }\n }\n\n return null;\n }\n\n has(key) {\n return (key in this.components);\n }\n\n get(key, short = false) {\n if (!(key in this.components)) {\n return null;\n }\n\n return short ? this.components[key].short_name : this.components[key].long_name;\n }\n\n setAttributes(attributes = {}) {\n this.attributes = {...this.attributes, ...attributes};\n\n return this;\n }\n\n setAttribute(key, value) {\n this.attributes[key] = value;\n\n return this;\n }\n\n getAttribute(key) {\n return this.attributes[key] || null;\n }\n}\n\nexport default GoogleAddress;\n","export default class Point {\n constructor(latitude = 0, longitude = 0) {\n this.type = 'Point';\n this.coordinates = [longitude, latitude];\n }\n\n get latitude() {\n return this.coordinates[1];\n }\n\n get longitude() {\n return this.coordinates[0];\n }\n\n lat() {\n return this.latitude;\n }\n\n lng() {\n return this.longitude;\n }\n\n static fromGeoJson(json) {\n [ longitude, latitude ] = json.coordinates;\n\n return new Point(latitude, longitude);\n }\n\n serialize() {\n return {\n type: 'Point',\n coorindates: [this.lat(), this.lng()]\n };\n }\n\n toJson() {\n return this.serialize();\n }\n\n toString() {\n return `(${this.latitude}, ${this.longitude})`;\n }\n}","import isEmpty from './is-empty';\n\nconst isResource = (mixed) => typeof mixed === 'object' && !isEmpty(mixed?.attributes) && typeof mixed?.attributes === 'object';\n\nconst isCallable = (object, property) => typeof object[property] === 'function';\n\nconst getResolved = (func, path) => {\n const resolved = func();\n return Array.isArray(resolved) || typeof resolved === 'object' ? get(resolved, path) : null;\n};\n\nconst invoke = (object, method) => {\n if (typeof object[method] === 'function') {\n return object[method].bind(object);\n }\n};\n\nconst get = (object, path) => {\n let current = object;\n\n const type = typeof object;\n const isObject = type === 'object';\n const isFunction = type === 'function';\n const isArray = Array.isArray(object);\n\n const pathType = typeof path;\n const pathIsString = pathType === 'string';\n const pathIsDotted = pathIsString && path.includes('.');\n const pathArray = pathIsDotted ? path.split('.') : [path];\n\n if (isArray || isObject) {\n for (let i = 0; i < pathArray.length; i++) {\n if (current && current[pathArray[i]] === undefined) {\n return null;\n } else if (current) {\n current = current[pathArray[i]];\n\n // if is resource then return get on it's attributes\n if (isResource(current) && pathArray[i + 1] !== undefined) {\n const newPath = pathArray.slice(i + 1).join('.');\n\n return get(current.attributes, newPath);\n }\n\n // resolve functions and continue\n if (typeof current === 'function') {\n const newPath = pathArray.slice(i + 1).join('.');\n return getResolved(current, newPath);\n }\n }\n }\n return current;\n }\n\n if (isFunction) {\n return getResolved(object, path);\n }\n};\n\nconst getProperties = (object, properties = []) => {\n const selected = {};\n let propertyNames = arguments;\n let i = 1;\n\n if (arguments.length === 2 && Array.isArray(properties)) {\n i = 0;\n propertyNames = arguments[1];\n }\n\n for (; i < propertyNames.length; i++) {\n selected[propertyNames[i]] = get(object, propertyNames[i]);\n }\n\n return selected;\n};\n\nconst set = (object, path, value) => {\n let current = object;\n const type = typeof object;\n const isObject = type === 'object';\n const isFunction = type === 'function';\n const isArray = Array.isArray(object);\n\n // if is function\n if (isFunction) {\n // throw error should be object or array or object like\n }\n\n const pathType = typeof path;\n const pathIsString = pathType === 'string';\n const pathIsDotted = pathIsString && path.includes('.');\n const pathArray = pathIsDotted ? path.split('.') : [path];\n const iterations = pathArray.length;\n\n if (isArray || isObject) {\n for (let i = 0; i < iterations - 1; i++) {\n if (!current[pathArray[i]]) {\n current[pathArray[i]] = {};\n }\n current = current[pathArray[i]];\n }\n\n current[pathArray[iterations - 1]] = value;\n }\n\n return value;\n};\n\nconst setProperties = (object, properties = {}) => {\n for (const property in properties) {\n set(object, property, properties[property]);\n }\n\n return object;\n};\n\nconst extend = (target, classes = []) => {\n if (arguments.length > 1) {\n classes = arguments;\n }\n for (let index = 0; index < classes.length; index++) {\n for (const property in classes[index]) {\n if (Object.prototype.hasOwnProperty.call(classes[index], property)) {\n target[property] = classes[index][property];\n }\n }\n }\n return target;\n};\n\nexport { set, get, getProperties, setProperties, extend, isCallable, invoke };\n","import { set } from './object';\n\nexport default class StoreActions {\n constructor(actions = {}, bind = null) {\n this.actions = actions;\n this.bind = bind;\n }\n\n extend(bindTo = null) {\n const binding = bindTo || this.bind;\n\n if (!binding) {\n return this;\n }\n\n if (this?.actions && typeof this.actions === 'object') {\n for (let action in this.actions) {\n const fn = this.actions[action];\n\n if (typeof fn !== 'function') {\n set(binding, action, fn);\n continue;\n }\n\n set(binding, action, fn.bind(binding));\n }\n }\n\n return this;\n }\n}\n","import Store from './store';\nimport { isEmpty } from './utils';\nimport { isArray } from './utils/array';\nimport { set, get } from './utils/object';\n\nclass Resource {\n /**\n\t * The base resource for all resources\n\n\t * @return {[type]} [description]\n\t */\n constructor(attributes = {}, adapter, resource, options = {}) {\n this.attributes = attributes;\n this.dirtyAttributes = {};\n this.changes = {};\n this.isLoading = false;\n this.isSaving = false;\n this.isDestroying = false;\n this.isReloading = false;\n this.resource = resource;\n this.options = options;\n this.version = options.version || 'v1';\n this.setAdapter(adapter);\n }\n\n /**\n * Set a new adapter to the resource instance, this will update the Store instance\n *\n * @param {Adapter} adapter\n * @return {Resource} this\n */\n setAdapter(adapter) {\n this.adapter = adapter;\n this.store = new Store(this.resource, adapter, {\n onAfterFetch: this.syncAttributes.bind(this),\n actions: this.options?.actions\n });\n\n return this;\n }\n\n /**\n * Getter for id attribute\n *\n * @var {String}\n */\n get id() {\n return this.getAttribute('id');\n }\n\n /**\n * Creates a new resource on the server\n *\n * @param {Object} payload [description]\n * @return {[type]} [description]\n */\n create(attributes = {}) {\n const data = this.mergeAttributes(attributes);\n this.setFlags(['isLoading', 'isSaving']);\n\n return this.store.create(data).then((response) => {\n this.setFlags(['isLoading', 'isSaving'], false);\n\n return response;\n });\n }\n\n /**\n * Creates a new resource on the server\n *\n * @param {Object} payload [description]\n * @return {[type]} [description]\n */\n update(attributes = {}) {\n this.setFlags(['isLoading', 'isSaving']);\n\n return this.store.update(this.attributes.id, attributes).then((response) => {\n this.setFlags(['isLoading', 'isSaving'], false);\n\n return response;\n });\n }\n\n /**\n * Deletes the resource instance on the server\n *\n * @return {[type]} [description]\n */\n destroy() {\n this.setFlags(['isLoading', 'isDestroying']);\n\n return this.store.destroy(this.attributes.id).then((response) => {\n this.setFlags(['isLoading', 'isDestroying'], false);\n\n return response;\n });\n }\n\n /**\n * Reloads the resource from the server.\n *\n * @return {[type]} [description]\n */\n reload() {\n this.setFlags(['isLoading', 'isReloading']);\n\n return this.store.findRecord(this.attributes.id).then((response) => {\n this.reset();\n\n return response;\n });\n }\n\n /**\n * Sets flag properties.\n *\n * @return this\n */\n setFlags(flags = [], state = true) {\n const validFlags = ['isLoading', 'isSaving', 'isReloading', 'isDestroying'];\n\n for(let i = 0; i < flags.length; i++) {\n const flag = flags[i];\n\n if (typeof flag !== 'string' || !validFlags.includes(flag)) {\n throw new Error(`${flag} is not a valid flag!`);\n }\n\n this[flag] = state;\n }\n\n return this;\n }\n\n /**\n * Resets tracked properties\n *\n * @return this\n */\n reset() {\n this.dirtyAttributes = {};\n this.changes = {};\n this.isLoading = false;\n this.isSaving = false;\n this.isReloading = false;\n\n return this;\n }\n\n /**\n * Emptys resource.\n *\n * @return this\n */\n empty() {\n this.reset();\n this.attribues = {};\n\n return this;\n }\n\n /**\n * Saves the resource instance on the server\n *\n * @return {[type]} [description]\n */\n save(options = {}) {\n const attributes = this.getAttributes();\n\n if (isEmpty(this.id)) {\n return this.create(attributes);\n }\n\n if (options.onlyDirty === true) {\n return this.savedirty();\n }\n\n return this.update(attributes);\n }\n\n /**\n * Saves only dirtied attributes.\n *\n * @return {[type]} [description]\n */\n saveDirty() {\n const dirtyAttributeKeys = Object.keys(this.dirtyAttributes);\n const dirtyAttributes = {};\n\n for (let i = 0; i < dirtyAttributeKeys.length; i++) {\n const key = dirtyAttributeKeys[i];\n dirtyAttributes[key] = this.getAttribute(key);\n }\n\n return this.update(dirtyAttributes);\n }\n\n /**\n * Returns the resource meta if exists.\n *\n * @return {Object}\n */\n get meta() {\n return this.getAttribute('meta', {});\n }\n\n /**\n * Returns the date instance resource was created.\n *\n * @return {Date}\n */\n get createdAt() {\n return this.isAttributeFilled('created_at') ? new Date(this.getAttribute('created_at')) : null;\n }\n\n /**\n * Returns the date instance resource was created.\n *\n * @return {Date}\n */\n get updatedAt() {\n return this.isAttributeFilled('updated_at') ? new Date(this.getAttribute('updated_at')) : null;\n }\n\n /**\n * Checks if resource is loaded from the server.\n *\n * @return {Boolean}\n */\n get isLoaded() {\n return this.hasAttributes(['created_at', 'id']);\n }\n\n /**\n * Checks if resource ihas no attributes\n *\n * @return {Boolean}\n */\n get isEmpty() {\n return Object.values(this?.attributes).length === 0;\n }\n\n /**\n * Checks if resource is not saved to server.\n *\n * @return {Boolean}\n */\n get isNew() {\n return !this.id;\n }\n\n /**\n * Checks if resource is not saved to server.\n *\n * @return {Boolean}\n */\n get isSaved() {\n return !this.isNew && this.isLoaded;\n }\n\n /**\n * Checks if resource is deleted on server.\n *\n * @return {Boolean}\n */\n get isDeleted() {\n return this.hasAttributes(['deleted', 'time']);\n }\n\n /**\n * Iterates over each attribute value and property executing a user supplied callback.\n *\n * @return {Object}\n */\n eachAttribute(callback) {\n if (typeof callback !== 'function') {\n return this;\n }\n\n Object.keys(this?.attributes ?? {}).forEach((property) => {\n const value = this.getAttribute(property);\n callback.call(this, value, property);\n });\n\n return this;\n }\n\n /**\n * Gets all changes\n *\n * @return {Object}\n */\n changes() {\n return this.changes;\n }\n\n /**\n * Gets all dirty attributes.\n *\n * @return {Object}\n */\n getDirtyAttributes() {\n return this.dirtyAttributes;\n }\n\n /**\n * Checks if property is dirty.\n *\n * @param {String} property [description]\n * @return {Boolean}\n */\n isDirty(property) {\n return property in this.dirtyAttributes;\n }\n\n /**\n * Checks if any properties is dirty.\n *\n * @return {Boolean}\n */\n hasDirtyAttributes() {\n return Object.keys(this?.dirtyAttributes ?? {}).length > 0;\n }\n\n /**\n * Updates a instance property without tracking changes or dirtying attribute.\n *\n * @param {String} property [description]\n * @param {mixed} value [description]\n */\n mutate(property, value) {\n this.attributes[property] = value;\n }\n\n /**\n * Set an instance property locally\n *\n * @param {String} property [description]\n * @param {mixed} value [description]\n */\n setAttribute(property, value = null) {\n if (value === null && typeof property === 'object') {\n return this.setAttributes(property);\n }\n\n const previousValue = this?.attributes[property] ?? null;\n\n // use object setter\n set(this.attributes, property, value);\n set(this.dirtyAttributes, property, previousValue);\n \n // this.attributes[property] = value;\n // this.dirtyAttributes[property] = previousValue;\n\n // track changes\n if (!isArray(this?.changes[property])) {\n this.changes[property] = [];\n }\n\n this.changes[property].push({\n property,\n previousValue,\n value,\n changedAt: new Date(),\n });\n\n return this;\n }\n\n /**\n * Set multiple instance properties locally\n *\n * @param {Object} properties [description]\n */\n setAttributes(attributes = {}) {\n for (let property in attributes) {\n this.setAttribute(property, attributes[property]);\n }\n\n return this;\n }\n\n /**\n * Get an attribute\n *\n * @param {String} attribute The attribute key to get\n * @param {mixed} defaultValue The default value if no attribute value\n */\n getAttribute(attribute, defaultValue = null) {\n const value = get(this?.attributes ?? {}, attribute);\n\n if (value === undefined) {\n return defaultValue;\n }\n\n return value;\n }\n\n /**\n * Checks if attribute exists.\n *\n * @param {String} property [description]\n * @return {Boolean}\n */\n hasAttribute(property) {\n if (isArray(property)) {\n const properties = property;\n const attributeKeys = Object.keys(this.attributes ?? {});\n \n return properties.every((prop) => attributeKeys.includes(prop));\n }\n\n if (!this?.attributes) {\n return false;\n }\n\n return property in this.attributes;\n }\n\n /**\n * Alias for checking if has multiple attributes.\n *\n * @param {Array} properties \n * @return {Boolean}\n */\n hasAttributes(properties = []) {\n return this.hasAttribute(properties);\n }\n\n /**\n * Returns true if attribute has value.\n *\n * @param {Array} properties \n * @return {Boolean}\n */\n isAttributeFilled(property) {\n if (isArray(property)) {\n return this.hasAttribute(property) && property.every((prop) => !isEmpty(this.getAttribute(prop)));\n }\n\n return this.hasAttribute(property) && !isEmpty(this.getAttribute(property));\n }\n\n /**\n * Get multiple attributes.\n *\n * @param {Array} properties [description]\n * @param {[type]} value [description]\n */\n getAttributes(properties) {\n const attributes = {};\n\n if (properties === null || properties === undefined) {\n return this.getAttributes(Object.keys(this.attributes));\n }\n\n if (typeof properties === 'string') {\n return this.getAttribute([...arguments]);\n }\n\n if (!isArray(properties)) {\n throw new Error('No attribute properties provided!');\n }\n\n for (let i = 0; i < properties.length; i++) {\n const property = properties[i];\n\n if (typeof property !== 'string') {\n continue;\n }\n\n let value = this.getAttribute(property);\n\n if (typeof value?.attributes === 'object' && !isArray(value?.attributes)) {\n value = value.attributes;\n }\n\n attributes[property] = value;\n }\n\n return attributes;\n }\n\n /**\n * Serialize resource to a POJO\n *\n * @returns {Object}\n */\n serialize() {\n return this.getAttributes();\n }\n\n /**\n * Merge and return attributes on the resource instance.\n *\n * @param {[type]} property [description]\n * @param {[type]} value [description]\n */\n mergeAttributes(attributes = {}) {\n const modelAttributes = this?.attributes ?? {};\n this.attributes = { ...modelAttributes, ...attributes };\n\n return this.attributes;\n }\n\n /**\n * Merge and return attributes on the resource instance.\n *\n * @param {[type]} property [description]\n * @param {[type]} value [description]\n */\n syncAttributes(json = {}) {\n this.attributes = json;\n }\n}\n\nexport default Resource;\n","import Resource from '../resource';\nimport { StoreActions, isResource } from '../utils';\nimport { isValid as isValidDate } from 'date-fns';\n\nconst orderActions = new StoreActions({\n getDistanceAndTime: function (id, params = {}, options = {}) {\n return this.adapter.get(`${this.namespace}/${id}/distance-and-time`, params, options);\n },\n\n getNextActivity: function (id, params = {}, options = {}) {\n return this.adapter.get(`${this.namespace}/${id}/next-activity`, params, options);\n },\n\n dispatch: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/dispatch`, params, options).then(this.afterFetch.bind(this));\n },\n\n start: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/start`, params, options).then(this.afterFetch.bind(this));\n },\n\n updateActivity: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/update-activity`, params, options).then(this.afterFetch.bind(this));\n },\n\n setDestination: function (id, destinationId, params = {}, options = {}) {\n if (isResource(destinationId)) {\n destinationId = destinationId.id;\n }\n\n return this.adapter.post(`${this.namespace}/${id}/set-destination/${destinationId}`, params, options).then(this.afterFetch.bind(this));\n },\n\n captureQrCode: function (id, subjectId = null, params = {}, options = {}) {\n if (isResource(subjectId)) {\n subjectId = subjectId.id;\n }\n\n return this.adapter.post(`${this.namespace}/${id}/capture-qr${!subjectId ? '' : '/' + subjectId}`, params, options);\n },\n\n captureSignature: function (id, subjectId = null, params = {}, options = {}) {\n if (isResource(subjectId)) {\n subjectId = subjectId.id;\n }\n\n return this.adapter.post(`${this.namespace}/${id}/capture-signature${!subjectId ? '' : '/' + subjectId}`, params, options);\n },\n\n complete: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/complete`, params, options).then(this.afterFetch.bind(this));\n },\n\n cancel: function (id, params = {}, options = {}) {\n return this.adapter.delete(`${this.namespace}/${id}/cancel`, params, options).then(this.afterFetch.bind(this));\n },\n});\n\nclass Order extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'order', { actions: orderActions, ...options });\n }\n\n getDistanceAndTime(params = {}, options = {}) {\n return this.store.getDistanceAndTime(this.id, params, options);\n }\n\n dispatch(params = {}, options = {}) {\n return this.store.dispatch(this.id, params, options);\n }\n\n start(params = {}, options = {}) {\n return this.store.start(this.id, params, options);\n }\n\n setDestination(destinationId, params = {}, options = {}) {\n return this.store.setDestination(this.id, destinationId, params, options);\n }\n\n captureQrCode(subjectId = null, params = {}, options = {}) {\n return this.store.captureQrCode(this.id, subjectId, params, options);\n }\n\n captureSignature(subjectId = null, params = {}, options = {}) {\n return this.store.captureSignature(this.id, subjectId, params, options);\n }\n\n getNextActivity(params = {}, options = {}) {\n return this.store.getNextActivity(this.id, params, options);\n }\n\n updateActivity(params = {}, options = {}) {\n return this.store.updateActivity(this.id, params, options);\n }\n\n cancel(params = {}, options = {}) {\n return this.store.cancel(this.id, params, options);\n }\n\n complete(params = {}, options = {}) {\n return this.store.complete(this.id, params, options);\n }\n\n get isDispatched() {\n return this.getAttribute('dispatched_at') !== null;\n }\n\n get isNotDispatched() {\n return this.getAttribute('dispatched_at') == null;\n }\n\n get isStarted() {\n return this.getAttribute('started_at') !== null;\n }\n\n get isNotStarted() {\n return this.getAttribute('started_at') == null;\n }\n\n get isCompleted() {\n return this.getAttribute('status') == 'completed';\n }\n\n get isCanceled() {\n return this.getAttribute('status') == 'canceled';\n }\n\n get isEnroute() {\n return this.getAttribute('status') == 'driver_enroute' || this.getAttribute('status') === 'enroute';\n }\n\n get isInProgress() {\n return this.isStarted && !this.isCanceled && !this.isCompleted;\n }\n\n get scheduledAt() {\n return this.isAttributeFilled('scheduled_at') ? new Date(this.getAttribute('scheduled_at')) : null;\n }\n\n get startedAt() {\n return this.isAttributeFilled('started_at') ? new Date(this.getAttribute('started_at')) : null;\n }\n\n get dispatchedAt() {\n return this.isAttributeFilled('dispatched_at') ? new Date(this.getAttribute('dispatched_at')) : null;\n }\n\n get status() {\n return this.getAttribute('status');\n }\n}\n\nexport default Order;\n\nexport { orderActions };\n","import Resource from '../resource';\nimport Collection from '../utils/collection';\n\nclass Payload extends Resource {\n\tconstructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'payload', options);\n }\n\t\n /**\n\t * Attaches an entity to an existing payload and returns\n\t * the payload with the entity attached\n\t *\n\t * @param {[type]} Entity entity [description]\n\t * @return {[type]} [description]\n\t */\n attach(entity) {\n // perform op return payload\n }\n\n /**\n\t * Returns all of the entities attached to this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get entities() {\n\n }\n\n /**\n\t * Returns the dropoff for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get dropoff() {\n\n }\n\n /**\n\t * Returns the pickup for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get pickup() {\n\n }\n\n /**\n\t * Returns all the waypoints for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get waypoints() {\n return new Collection(this.waypoints);\n }\n}\n\nexport default Payload;\n","import Resource from '../resource';\n\nclass Entity extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'entity', options);\n }\n}\n\nexport default Entity;\n","import Resource from '../resource';\nimport { isResource, Point } from '../utils';\n\nclass Place extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'place', options);\n }\n\n static fromGoogleAddress(googleAddress, adapter, options = {}) {\n const [ latitude, longitude ] = googleAddress.getAttribute('coordinates');\n const attributes = {\n name: null,\n address: googleAddress.getAttribute('address'),\n location: new Point(latitude, longitude),\n street1: googleAddress.getAttribute('streetName'),\n street2: null,\n city: googleAddress.getAttribute('city'),\n province: googleAddress.getAttribute('stateLong'),\n postal_code: googleAddress.getAttribute('postalCode'),\n neighborhood: googleAddress.get('neighborhood'),\n district: googleAddress.getAttribute('county'),\n building: googleAddress.get('building'),\n country: googleAddress.getAttribute('countryShort'),\n phone: null,\n security_access_code: null\n };\n\n return new Place(attributes, adapter, options);\n }\n\n /**\n * The latitude coordinate for the 'Place' location.\n * \n * @var {Integer}\n */\n get latitude() {\n return this.getAttribute('location', new Point())?.coordinates[1];\n }\n\n /**\n * The longitude coordinate for the 'Place' location.\n * \n * @var {Integer}\n */\n get longitude() {\n return this.getAttribute('location', new Point())?.coordinates[0];\n }\n\n /**\n * Array coordinate pair for Place location.\n * \n * @var {Array}\n */\n get coordinates() {\n const { latitude, longitude } = this;\n\n return [ latitude, longitude ];\n }\n\n /**\n * Set the owner of the place.\n * \n * @param {Object|String} owner\n * @return {Place}\n */\n setOwner(owner) {\n if (isResource(owner)) {\n this.setAttribute('owner', owner.id);\n }\n\n if (typeof owner === 'string') {\n this.setAttribute('owner', owner);\n }\n\n return this;\n }\n}\n\nexport default Place;\n","import Place from './place';\n\nclass Waypoint extends Place {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'waypoint', options);\n }\n}\n\nexport default Waypoint;\n","import Resource from '../resource';\n\nclass TrackingStatus extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'tracking-status', options);\n }\n}\n\nexport default TrackingStatus;\n","import Resource from '../resource';\n\nclass Vehicle extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'vehicle', options);\n }\n}\n\nexport default Vehicle;\n","import Resource from '../resource';\nimport { StoreActions, isPhone, isEmail } from '../utils';\n\nconst driverActions = new StoreActions({\n // const { error } = await fleetbase.drivers.login('+1 111-1111');\n login: function (identity, password = null, attributes = {}) {\n // handle phone number authentication\n if (isPhone(identity)) {\n return this.adapter.post('drivers/login-with-sms', { phone: identity });\n }\n\n if (!password) {\n throw new Error('Login requires password!');\n }\n\n return this.adapter.post('drivers/login', { identity, password, ...attributes }).then(this.afterFetch.bind(this));\n },\n\n verifyCode: function (identity, code, attributes = {}) {\n return this.adapter.post('drivers/verify-code', { identity, code, ...attributes }).then(this.afterFetch.bind(this));\n },\n\n track: function (id, params = {}, options = {}) {\n return this.adapter.post(`drivers/${id}/track`, params, options).then(this.afterFetch.bind(this));\n },\n\n retrieve: function (id) {\n return this.findRecord(id);\n },\n\n syncDevice(token) {\n return this.adapter.setHeaders({ 'Driver-Token': this.token }).post('drivers/register-device', token);\n },\n});\n\nclass Driver extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'driver', { actions: driverActions, ...options });\n }\n\n /**\n * The latitude coordinate for the 'Place' location.\n *\n * @var {Integer}\n */\n get latitude() {\n return this.getAttribute('location', new Point())?.coordinates[1];\n }\n\n /**\n * The longitude coordinate for the 'Place' location.\n *\n * @var {Integer}\n */\n get longitude() {\n return this.getAttribute('location', new Point())?.coordinates[0];\n }\n\n /**\n * Array coordinate pair for Place location.\n *\n * @var {Array}\n */\n get coordinates() {\n const { latitude, longitude } = this;\n\n return [latitude, longitude];\n }\n\n get token() {\n return this.getAttribute('token');\n }\n\n get isOnline() {\n return this.getAttribute('online') === true;\n }\n\n track(params = {}, options = {}) {\n return this.store.track(this.id, params, options);\n }\n\n syncDevice(token) {\n return this.store.syncDevice(token);\n }\n}\n\nexport default Driver;\nexport { driverActions };\n","import Resource from '../resource';\n\nclass Vendor extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'vendor', options);\n }\n}\n\nexport default Vendor;\n","import Resource from '../resource';\n\nclass Contact extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'contact', options);\n }\n}\n\nexport default Contact;\n","import Resource from '../resource';\n\nclass Zone extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'zone', options);\n }\n}\n\nexport default Zone;\n","import Resource from '../resource';\n\nclass ServiceArea extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-area', options);\n }\n}\n\nexport default ServiceArea;\n","import Resource from '../resource';\n\nclass ServiceRate extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-rate', options);\n }\n}\n\nexport default ServiceRate;\n","import Resource from '../resource';\n\nclass ServiceQuote extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-quote', options);\n }\n\n fromPreliminary() {\n\n }\n\n fromPayload() {\n \n }\n}\n\nexport default ServiceQuote;\n","class Adapter {\n /**\n\t * Creates a configured base adapter for Fleetbase.\n\t *\n\t * @param {Object} config Configuration options for adapter\n\t */\n constructor(config = {}) {\n this.version = config.version || 'v1';\n this.host = config.host || null;\n this.namespace = config.namespace || null;\n this.headers = config.headers || {};\n }\n}\n\nexport default Adapter;\n","import Adapter from '../adapter';\nimport { isBlank } from '../utils';\n\nclass BrowserAdapter extends Adapter {\n /**\n * Setup browser adapter.\n * @param {Object} config\n */\n constructor(config) {\n super(config);\n\n this.setHeaders({\n Authorization: `Bearer ${config.publicKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': '@fleetbase/sdk;browser'\n });\n }\n\n /**\n * Updates the adapter headers.\n *\n * @param {Object} headers\n */\n setHeaders(headers = {}) {\n this.headers = { ...this.headers, ...headers };\n\n return this;\n }\n\n /**\n * Parses the JSON returned by a network request\n *\n * @param {Object} response A response from a network request\n * @return {Object} The parsed JSON, status from the response\n *\n * @return {Promise}\n */\n parseJSON(response) {\n return new Promise((resolve, reject) => response\n .json()\n .then((json) => resolve({\n statusText: response.statusText,\n status: response.status,\n ok: response.ok,\n json,\n }))\n .catch(() => {\n reject(new Error('Oops! Something went wrong when handling your request.'));\n }));\n }\n\n /**\n * The base request method\n *\n * @param {String} path\n * @param {String} method\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n request(path, method = 'GET', data = {}, options = {}) {\n return new Promise((resolve, reject) => fetch(options.url || `${this.host}/${this.namespace}/${path}`, {\n method,\n mode: options.mode || 'cors',\n headers: new Headers({\n ...(this.headers || {}),\n ...(options.headers || {}),\n }),\n ...data,\n })\n .then(this.parseJSON)\n .then((response) => {\n if (response.ok) {\n return resolve(response.json);\n }\n\n return reject(new Error(response.json.errors ? response.json.errors[0] : response.statusText));\n })\n .catch((error) => {\n reject(error);\n }));\n }\n\n /**\n * Makes a GET request with fetch\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n get(path, query = {}, options = {}) {\n const urlParams = !isBlank(query) ? new URLSearchParams(query).toString() : '';\n\n return this.request(`${path}${urlParams ? `?${urlParams}` : ''}`, 'GET', {}, options);\n }\n\n /**\n * Makes a POST request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n post(path, data = {}, options = {}) {\n return this.request(path, 'POST', { body: JSON.stringify(data) }, options);\n }\n\n /**\n * Makes a PUT request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n put(path, data = {}, options = {}) {\n return this.request(path, 'PUT', { body: JSON.stringify(data) }, options);\n }\n\n /**\n * Makes a DELETE request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n delete(path, options = {}) {\n return this.request(path, 'DELETE', {}, options);\n }\n\n /**\n * Makes a PATCH request with fetch\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n patch(path, data = {}, options = {}) {\n return this.request(path, 'PATCH', { body: JSON.stringify(data) }, options);\n }\n}\n\nexport default BrowserAdapter;\n","import Adapter from '../adapter';\nimport { isBlank } from '../utils';\nimport { isArray } from '../utils/array';\nimport axios from 'axios';\n\nclass NodeAdapter extends Adapter {\n constructor(config) {\n super(config);\n\n this.axios = axios.create({\n baseURL: `${this.host}/${this.namespace}`,\n headers: {\n Authorization: `Bearer ${config.publicKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': '@fleetbase/sdk;node',\n },\n });\n }\n\n /**\n * Updates the adapter headers.\n *\n * @param {Object} headers\n */\n setHeaders(headers = {}) {\n const commonHeaders = this.axios.defaults.headers.common;\n this.axios.defaults.headers.common = { ...commonHeaders, ...headers };\n\n return this;\n }\n\n /**\n * Tranform the response, and return the response data from axios.\n *\n * @param {AxiosResponse} response\n * @returns {Object}\n */\n transform(response) {\n return response.data;\n }\n\n /**\n * Handles an erroneous request.\n *\n * @param {AxiosResponse} response\n * @returns {Object}\n */\n handleError(error) {\n if (error.response) {\n const { data } = error.response;\n\n if (isArray(data.errors)) {\n throw new Error(data.errors[0]);\n }\n\n if (data.error) {\n throw new Error(data.error);\n }\n }\n\n throw error;\n }\n\n /**\n * Makes a GET request with axios\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n get(path, query = {}, options = {}) {\n const urlParams = !isBlank(query) ? new URLSearchParams(query).toString() : '';\n\n return this.axios\n .get(`${path}${urlParams ? `?${urlParams}` : ''}`, options)\n .then(this.transform.bind(this))\n .catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a POST request with axios\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n post(path, data = {}, options = {}) {\n return this.axios.post(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a PUT request with axios\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n put(path, data = {}, options = {}) {\n return this.axios.put(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a DELETE request with axios\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n delete(path, options = {}) {\n return this.axios.delete(path, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a PATCH request with axios\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n patch(path, data = {}, options = {}) {\n return this.axios.patch(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n}\n\nexport default NodeAdapter;\n","import Adapter from '../adapter';\n\nclass EmberJsAdapter extends Adapter {}\n\nexport default EmberJsAdapter;\n","'use strict';\n\n/**\n * Javascript String\n *\n * instance\n * new String('hello_world').humanize().get() => \"Hello world\"\n *\n * instance\n * const string = new String();\n * string.humanize('hello_world').get() => \"Hello world\"\n * \n * no chain\n * new String('hello_world', false).humanize() => \"Hello world\"\n *\n * static\n * String.invoke('humanize', 'hello_world') => \"Hello world\"\n *\n * exports {}\n * humanize('hello_world') => \"Hello world\"\n */\n\nexport default class String {\n constructor(string, chain = true) {\n this.str = string;\n this.chain = chain;\n }\n\n uncountableWords = ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'moose', 'deer', 'news'];\n\n pluralRules = [\n [new RegExp('(m)an$', 'gi'), '$1en'],\n [new RegExp('(pe)rson$', 'gi'), '$1ople'],\n [new RegExp('(child)$', 'gi'), '$1ren'],\n [new RegExp('^(ox)$', 'gi'), '$1en'],\n [new RegExp('(ax|test)is$', 'gi'), '$1es'],\n [new RegExp('(octop|vir)us$', 'gi'), '$1i'],\n [new RegExp('(alias|status)$', 'gi'), '$1es'],\n [new RegExp('(bu)s$', 'gi'), '$1ses'],\n [new RegExp('(buffal|tomat|potat)o$', 'gi'), '$1oes'],\n [new RegExp('([ti])um$', 'gi'), '$1a'],\n [new RegExp('sis$', 'gi'), 'ses'],\n [new RegExp('(?:([^f])fe|([lr])f)$', 'gi'), '$1$2ves'],\n [new RegExp('(hive)$', 'gi'), '$1s'],\n [new RegExp('([^aeiouy]|qu)y$', 'gi'), '$1ies'],\n [new RegExp('(x|ch|ss|sh)$', 'gi'), '$1es'],\n [new RegExp('(matr|vert|ind)ix|ex$', 'gi'), '$1ices'],\n [new RegExp('([m|l])ouse$', 'gi'), '$1ice'],\n [new RegExp('(quiz)$', 'gi'), '$1zes'],\n [new RegExp('s$', 'gi'), 's'],\n [new RegExp('$', 'gi'), 's'],\n ];\n\n singularRules = [\n [new RegExp('(m)en$', 'gi'), '$1an'],\n [new RegExp('(pe)ople$', 'gi'), '$1rson'],\n [new RegExp('(child)ren$', 'gi'), '$1'],\n [new RegExp('([ti])a$', 'gi'), '$1um'],\n [new RegExp('((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$', 'gi'), '$1$2sis'],\n [new RegExp('(hive)s$', 'gi'), '$1'],\n [new RegExp('(tive)s$', 'gi'), '$1'],\n [new RegExp('(curve)s$', 'gi'), '$1'],\n [new RegExp('([lr])ves$', 'gi'), '$1f'],\n [new RegExp('([^fo])ves$', 'gi'), '$1fe'],\n [new RegExp('([^aeiouy]|qu)ies$', 'gi'), '$1y'],\n [new RegExp('(s)eries$', 'gi'), '$1eries'],\n [new RegExp('(m)ovies$', 'gi'), '$1ovie'],\n [new RegExp('(x|ch|ss|sh)es$', 'gi'), '$1'],\n [new RegExp('([m|l])ice$', 'gi'), '$1ouse'],\n [new RegExp('(bus)es$', 'gi'), '$1'],\n [new RegExp('(o)es$', 'gi'), '$1'],\n [new RegExp('(shoe)s$', 'gi'), '$1'],\n [new RegExp('(cris|ax|test)es$', 'gi'), '$1is'],\n [new RegExp('(octop|vir)i$', 'gi'), '$1us'],\n [new RegExp('(alias|status)es$', 'gi'), '$1'],\n [new RegExp('^(ox)en', 'gi'), '$1'],\n [new RegExp('(vert|ind)ices$', 'gi'), '$1ex'],\n [new RegExp('(matr)ices$', 'gi'), '$1ix'],\n [new RegExp('(quiz)zes$', 'gi'), '$1'],\n [new RegExp('s$', 'gi'), ''],\n ];\n\n nonTitlecasedWords = ['and', 'or', 'nor', 'a', 'an', 'the', 'so', 'but', 'to', 'of', 'at', 'by', 'from', 'into', 'on', 'onto', 'off', 'out', 'in', 'over', 'with', 'for'];\n\n idSuffix = new RegExp('(_ids|_id)$', 'g');\n underbar = new RegExp('_', 'g');\n spaceOrUnderbar = new RegExp('[ _]', 'g');\n uppercase = new RegExp('([A-Z])', 'g');\n underbarPrefix = new RegExp('^_');\n\n get() {\n return this.str;\n }\n\n applyRules(str, rules, skip, override) {\n if (override) {\n str = override;\n } else {\n var ignore = skip.indexOf(str.toLowerCase()) > -1;\n if (!ignore) {\n for (var x = 0; x < rules.length; x++) {\n if (str.match(rules[x][0])) {\n str = str.replace(rules[x][0], rules[x][1]);\n break;\n }\n }\n }\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.pluralize('person') -> 'people'\n String.pluralize('octopus') -> 'octopi'\n String.pluralize('Hat') -> 'Hats'\n String.pluralize('person', 'guys') -> 'guys' \n */\n pluralize(str, plural = null) {\n str = str || this.str;\n\n return this.applyRules(str, this.pluralRules, this.uncountableWords, plural);\n }\n\n /*\n String.singularize('person') -> 'person'\n String.singularize('octopi') -> 'octopus'\n String.singularize('hats') -> 'hat'\n String.singularize('guys', 'person') -> 'person'\n */\n singularize(str, singular) {\n str = str || this.str;\n\n return this.applyRules(str, this.singularRules, this.uncountableWords, singular);\n }\n\n /*\n String.camelize('message_properties') -> 'MessageProperties'\n String.camelize('message_properties', true) -> 'messageProperties'\n */\n camelize(str, lowFirstLetter) {\n str = str || this.str;\n\n let str_path = str.split('/');\n for (var i = 0; i < str_path.length; i++) {\n let str_arr = str_path[i].split('_');\n let initX = lowFirstLetter && i + 1 === str_path.length ? 1 : 0;\n\n for (let x = initX; x < str_arr.length; x++) {\n str_arr[x] = str_arr[x].charAt(0).toUpperCase() + str_arr[x].substring(1);\n }\n str_path[i] = str_arr.join('');\n }\n str = str_path.join('::');\n\n // fix\n if (lowFirstLetter === true) {\n let first = str.charAt(0).toLowerCase();\n let last = str.slice(1);\n str = first + last;\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.underscore('MessageProperties') -> 'message_properties'\n String.underscore('messageProperties') -> 'message_properties'\n */\n underscore(str) {\n str = str || this.str;\n\n var str_path = str.split('::');\n for (var i = 0; i < str_path.length; i++) {\n str_path[i] = str_path[i].replace(this.uppercase, '_$1');\n str_path[i] = str_path[i].replace(this.underbarPrefix, '');\n }\n str = str_path.join('/').toLowerCase();\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.humanize('message_properties') -> 'Message properties'\n String.humanize('message_properties') -> 'message properties'\n */\n humanize(str, lowFirstLetter) {\n str = str || this.str;\n\n var str = str.toLowerCase();\n str = str.replace(this.idSuffix, '');\n str = str.replace(this.underbar, ' ');\n if (!lowFirstLetter) {\n str = this.capitalize(str);\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.capitalize('message_properties') -> 'Message_properties'\n String.capitalize('message properties') -> 'Message properties'\n */\n capitalize(str) {\n str = str || this.str;\n\n str = str.toLowerCase();\n str = str.substring(0, 1).toUpperCase() + str.substring(1);\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.dasherize('message_properties') -> 'message-properties'\n String.dasherize('message properties') -> 'message-properties'\n */\n dasherize(str) {\n str = str || this.str;\n\n str = str.replace(this.spaceOrUnderbar, '-');\n str = str.toLowerCase();\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.normify('message_properties') -> 'Message Properties'\n String.normify('message properties') -> 'Message Properties'\n Inflactor.normify('Message_propertyId', true) -> 'Message Properties Id'\n */\n normify(str, allFirstUpper) {\n str = str || this.str;\n\n //var str = str.toLowerCase();\n if (allFirstUpper === true) {\n str = this.camelize(str);\n str = this.underscore(str);\n } else {\n str = str.toLowerCase();\n }\n\n str = str.replace(this.underbar, ' ');\n var str_arr = str.split(' ');\n for (var x = 0; x < str_arr.length; x++) {\n var d = str_arr[x].split('-');\n for (var i = 0; i < d.length; i++) {\n if (this.nonTitlecasedWords.indexOf(d[i].toLowerCase()) < 0) {\n d[i] = this.capitalize(d[i]);\n }\n }\n str_arr[x] = d.join('-');\n }\n str = str_arr.join(' ');\n str = str.substring(0, 1).toUpperCase() + str.substring(1);\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.demodulize('Message::Bus::Properties') -> 'Properties'\n */\n demodulize(str) {\n str = str || this.str;\n\n var str_arr = str.split('::');\n str = str_arr[str_arr.length - 1];\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.tableize('MessageBusProperty') -> 'message_bus_properties'\n */\n tableize(str) {\n str = str || this.str;\n\n str = this.pluralize(this.underscore(str));\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.classify('message_bus_properties') -> 'MessageBusProperty'\n */\n classify(str) {\n str = str || this.str;\n\n str = this.singularize(this.camelize(str));\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.foreignKey('MessageBusProperty') -> 'message_bus_property_id'\n String.foreignKey('MessageBusProperty', true) -> 'message_bus_propertyid'\n */\n foreignKey(str, dropIdUbar = false) {\n str = str || this.str;\n\n str = this.underscore(this.demodulize(str)) + (dropIdUbar ? '' : '_') + 'id';\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.ordinalize('the 1 pitch') -> 'the 1st pitch'\n */\n ordinalize(str) {\n str = str || this.str;\n\n var str_arr = str.split(' ');\n for (var x = 0; x < str_arr.length; x++) {\n var i = parseInt(str_arr[x]);\n if (i === NaN) {\n var ltd = str_arr[x].substring(str_arr[x].length - 2);\n var ld = str_arr[x].substring(str_arr[x].length - 1);\n var suf = 'th';\n if (ltd != '11' && ltd != '12' && ltd != '13') {\n if (ld === '1') {\n suf = 'st';\n } else if (ld === '2') {\n suf = 'nd';\n } else if (ld === '3') {\n suf = 'rd';\n }\n }\n str_arr[x] += suf;\n }\n }\n str = str_arr.join(' ');\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /**\n * @method invoke\n **/\n static invoke() {\n const argz = Object.values(arguments);\n const instance = new String(null, false);\n const method = arguments[0];\n argz.shift();\n\n if (typeof instance[method] === 'function') {\n return instance[method](...argz);\n }\n\n return null;\n }\n}\n\nconst pluralize = function() {\n const argz = ['pluralize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst singularize = function() {\n const argz = ['singularize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst humanize = function() {\n const argz = ['humanize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst underscore = function() {\n const argz = ['underscore', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst camelize = function() {\n const argz = ['camelize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst capitalize = function() {\n const argz = ['capitalize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst dasherize = function() {\n const argz = ['dasherize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst normify = function() {\n const argz = ['normify', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst demodulize = function() {\n const argz = ['demodulize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst tableize = function() {\n const argz = ['tableize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst classify = function() {\n const argz = ['classify', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst foreignKey = function() {\n const argz = ['foreignKey', ...arguments];\n\n return String.invoke(...argz);\n};\n\nexport {\n pluralize,\n singularize,\n humanize,\n underscore,\n camelize,\n capitalize,\n dasherize,\n normify,\n demodulize,\n tableize,\n classify,\n foreignKey\n}","import { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote } from './resources';\nimport { BrowserAdapter, NodeAdapter, EmberJsAdapter } from './adapters';\nimport { pluralize, singularize } from './utils/string';\n\nconst resources = {\n Contact,\n Driver,\n Entity,\n Order,\n Payload,\n Place,\n TrackingStatus,\n Vehicle,\n Vendor,\n Waypoint,\n Zone,\n ServiceArea,\n ServiceRate,\n ServiceQuote,\n};\n\nconst adapters = {\n BrowserAdapter,\n NodeAdapter,\n EmberJsAdapter,\n};\n\nclass Resolver {\n constructor() {\n this.resources = resources;\n this.adapters = adapters;\n\n return this.lookup(...arguments);\n }\n\n lookup(type, className) {\n const key = pluralize(type);\n const params = [...arguments].slice(2);\n\n if (!this[key]) {\n throw new Error('Attempted to resolve invalid type');\n }\n\n if (!this[key][className]) {\n throw new Error(`No ${singularize(type)} named ${className} to resolve`);\n }\n\n return new this[key][className](...params);\n }\n}\n\nconst lookup = function () {\n return new Resolver(...arguments);\n};\n\nexport { Resolver, lookup };\n","import { lookup } from './resolver';\nimport { pluralize, classify } from './utils/string';\nimport { isArray } from './utils/array';\nimport { Collection, detectAdapter, isResource, StoreActions } from './utils';\nimport { set, isCallable, invoke } from './utils/object';\n\nconst extendStoreActions = (store, actions = []) => {\n store.actions = isArray(actions) ? actions : [actions];\n\n if (isArray(actions)) {\n for (let i = 0; i < actions.length; i++) {\n const action = actions[i];\n\n store.extendActions(action);\n }\n return;\n }\n\n if (actions instanceof StoreActions) {\n actions.extend(store);\n }\n\n return store;\n};\n\nconst afterFetch = (store, json) => {\n if (typeof store.options.onAfterFetch === 'function') {\n store.options.onAfterFetch(json);\n }\n\n if (isArray(json)) {\n const serialized = [];\n\n for (let i = 0; i < json.length; i++) {\n serialized.push(store.afterFetch(json[i]));\n }\n\n return new Collection(...serialized);\n }\n\n const resourceInstance = store.serialize(json);\n return store.deposit(resourceInstance);\n};\n\nclass Store {\n constructor(resource, adapter, options = {}) {\n this.resource = resource;\n this.adapter = adapter || detectAdapter();\n this.namespace = pluralize(resource);\n this.storage = new Collection();\n this.options = options;\n this.extendActions(options.actions);\n }\n\n extendActions(actions = []) {\n return extendStoreActions(this, actions);\n }\n\n deposit(resourceInstance) {\n // this.storage[this.namespace].pushObject(resourceInstance);\n\n return resourceInstance;\n }\n\n serialize(json) {\n return lookup('resource', classify(this.resource), json, this.adapter);\n }\n\n afterFetch(json) {\n return afterFetch(this, json);\n }\n\n create(attributes = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.post(`${this.namespace}`, attributes, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n update(id, attributes = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.put(`${this.namespace}/${id}`, attributes, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n findRecord(id, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}/${id}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n findAll(options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n query(query = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, query, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n queryRecord(query = {}, options = {}) {\n query.single = true;\n\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, query, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n destroy(record, options = {}) {\n const id = isResource(record) ? record.getAttribute('id') : record;\n\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.delete(`${this.namespace}/${id}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n}\n\nexport default Store;\n\nexport { extendStoreActions, afterFetch };\n","import Store from './store';\nimport Resource from './resource';\nimport { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote } from './resources';\nimport { BrowserAdapter, NodeAdapter, EmberJsAdapter, Adapter } from './adapters';\nimport { isNodeEnvironment, detectAdapter, isLatitude, isLongitude, Point, isResource, GoogleAddress, Collection, StoreActions } from './utils';\nimport { pluralize, singularize, classify, dasherize, camelize } from './utils/string';\nimport { extendStoreActions } from './store';\nimport { orderActions } from './resources/order';\nimport { driverActions } from './resources/driver';\n\n/**\n * // instance\n * const fleetbase = new Fleetbase();\n *\n * const contact = fleetbase.contacts.create({\n * \t\tname: 'Ron',\n * \t\tphone: '+65 9999 8888'\n * });\n *\n * constact.update({ name: 'Hollywood Ron' });\n *\n * // export\n * import { Contact } from '@fleetbase/sdk';\n *\n * const contact = new Contact({\n * \t\tname: 'Ron',\n * \t\tphone: '+65 9999 8888'\n * });\n *\n * contact.save();\n */\n\nexport default class Fleetbase {\n /**\n * Builds an instance of the Fleetbase SDK\n *\n * @param {String} publicKey The public key issued\n * @param {Object} config The version of resource to access\n * @param {Boolean} debug Debug mode for SDK\n * @return {Fleetbase} Instance\n */\n constructor(publicKey, config = {}, debug = false) {\n this.version = config.version ?? 'v1';\n this.options = {\n version: this.version,\n host: config.host ?? 'https://api.fleetbase.io',\n namespace: config.namespace ?? this.version,\n debug,\n publicKey,\n };\n\n if (typeof publicKey !== 'string' || publicKey.length === 0) {\n throw new Error('⚠️ Invalid public key given to Fleetbase SDK');\n }\n\n if (!isNodeEnvironment() && publicKey.toLowerCase().startsWith('$')) {\n throw new Error('Secret key provided. You must use a public key with Fleetbase Javascript SDK!');\n }\n\n this.adapter = config.adapter || detectAdapter(this.options);\n\n this.orders = new Store('order', this.adapter).extendActions(orderActions);\n this.entities = new Store('entity', this.adapter);\n this.places = new Store('place', this.adapter);\n this.drivers = new Store('driver', this.adapter).extendActions(driverActions);\n this.vehicles = new Store('vehicle', this.adapter);\n this.vendors = new Store('vendor', this.adapter);\n this.contacts = new Store('contact', this.adapter);\n }\n\n static newInstance() {\n return new Fleetbase(...arguments);\n }\n\n setAdapter(adapter) {\n this.adapter = adapter;\n }\n\n getAdapter() {\n return this.adapter;\n }\n}\n\nexport {\n Store,\n Resource,\n Contact,\n Driver,\n Entity,\n Order,\n Payload,\n Place,\n TrackingStatus,\n Vehicle,\n Vendor,\n Waypoint,\n Zone,\n ServiceArea,\n ServiceRate,\n ServiceQuote,\n BrowserAdapter,\n NodeAdapter,\n EmberJsAdapter,\n Adapter,\n isNodeEnvironment,\n isLatitude,\n isLongitude,\n Point,\n isResource,\n GoogleAddress,\n Collection,\n StoreActions,\n extendStoreActions,\n pluralize,\n singularize,\n classify,\n dasherize,\n camelize,\n};\n"],"names":["isArray","Array","CHUNK_SIZE","replace","array","start","deleteCount","items","length","splice","i","chunk","slice","isCollection","arr","identityFunction","item","uniqBy","key","ret","seen","Set","getter","get","forEach","val","has","add","push","mixed","Collection","objectAt","index","iter","value","arguments","Boolean","findIndex","predicate","startAt","len","find","callback","target","bind","undefined","any","every","cb","indexOf","withNaNCheck","removeAt","insertAt","this","indexes","map","idx","_this2","object","methodName","args","_item$methodName","filter","sortKeys","sort","a","b","propA","propB","compareValue","compare","includes","obj","objects","toArray","reverse","clear","loc","removeObject","pushObject","_this3","addObject","isEmpty","none","size","objectType","isBlank","test","isLatitude","coordinate","isFinite","Math","abs","isLongitude","isResource","record","Resource","isPhone","phone","isNodeEnvironment","process","_typeof","_process","env","release","name","search","window","navigator","product","detectAdapter","options","lookup","GoogleAddress","place","geometry","components","parseComponents","attributes","parseProperties","address_components","reduce","acc","data","types","type","streetNumber","streetName","coordinates","location","Object","values","city","or","county","stateShort","stateLong","countryShort","country","countryLong","postalCode","address","join","keys","pkey","short","short_name","long_name","Point","latitude","longitude","coorindates","lat","lng","serialize","json","getResolved","func","path","resolved","current","isObject","isFunction","pathArray","split","newPath","set","iterations","StoreActions","actions","bindTo","binding","action","fn","adapter","resource","dirtyAttributes","changes","isLoading","isSaving","isDestroying","isReloading","version","setAdapter","store","Store","onAfterFetch","syncAttributes","_this$options","getAttribute","mergeAttributes","setFlags","create","then","response","_this","update","id","destroy","findRecord","_this4","reset","flags","state","validFlags","flag","Error","attribues","getAttributes","onlyDirty","savedirty","dirtyAttributeKeys","isAttributeFilled","Date","hasAttributes","isNew","isLoaded","property","_this5","call","setAttributes","previousValue","changedAt","setAttribute","attribute","defaultValue","properties","attributeKeys","prop","hasAttribute","_this6","_value","_value2","modelAttributes","orderActions","getDistanceAndTime","params","namespace","getNextActivity","dispatch","post","afterFetch","updateActivity","setDestination","destinationId","captureQrCode","subjectId","captureSignature","complete","cancel","Order","isStarted","isCanceled","isCompleted","Payload","entity","waypoints","Entity","Place","_this$getAttribute","_this$getAttribute2","owner","googleAddress","street1","street2","province","postal_code","neighborhood","district","building","security_access_code","Waypoint","TrackingStatus","Vehicle","driverActions","login","identity","password","verifyCode","code","track","retrieve","syncDevice","token","setHeaders","Driver","Vendor","Contact","Zone","ServiceArea","ServiceRate","ServiceQuote","Adapter","config","host","headers","BrowserAdapter","Authorization","publicKey","Promise","resolve","reject","statusText","status","ok","method","fetch","url","mode","Headers","parseJSON","errors","error","query","urlParams","URLSearchParams","toString","request","body","JSON","stringify","NodeAdapter","axios","baseURL","commonHeaders","defaults","common","transform","handleError","put","patch","EmberJsAdapter","String","string","chain","RegExp","str","rules","skip","override","toLowerCase","x","match","plural","applyRules","pluralRules","uncountableWords","singular","singularRules","lowFirstLetter","str_path","str_arr","charAt","toUpperCase","substring","first","last","uppercase","underbarPrefix","idSuffix","underbar","capitalize","spaceOrUnderbar","allFirstUpper","camelize","underscore","d","nonTitlecasedWords","pluralize","singularize","dropIdUbar","demodulize","NaN","parseInt","ltd","ld","suf","argz","instance","shift","invoke","dasherize","classify","resources","adapters","Resolver","className","extendStoreActions","extend","extendActions","serialized","resourceInstance","deposit","storage","single","_this7","Fleetbase","debug","startsWith","orders","entities","places","drivers","vehicles","vendors","contacts"],"mappings":"48JAAA,IAAQA,EAAYC,MAAZD,8CCOFE,EAAa,IAIbC,EAAU,SAACC,EAAOC,EAAOC,OAAaC,yDAAQ,MAC5CP,EAAQI,MACJG,EAAMC,QAAUN,EAChBE,EAAMK,aAANL,GAAaC,EAAOC,YAAgBC,SACjC,CACHH,EAAMK,OAAOJ,EAAOC,OAEf,IAAII,EAAI,EAAGA,EAAIH,EAAMC,OAAQE,GAAKR,EAAY,KAC3CS,EAAQJ,EAAMK,MAAMF,EAAGA,EAAIR,GAC/BE,EAAMK,aAANL,GAAaC,EAAQK,EAAG,YAAMC,WAG/BE,EAAaC,MACpBV,EAAMD,QAAQE,EAAOC,EAAaC,IAIpCQ,EAAmB,SAACC,UAASA,GAE7BC,EAAS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AAKyH,SAASuN,cAAc3J,SACxDsK,SAAW,IAAIvN,GAAM,SAAUpI,KAAKyH,cACpCmO,OAAS,IAAIxN,GAAM,QAASpI,KAAKyH,cACjCoO,QAAU,IAAIzN,GAAM,SAAUpI,KAAKyH,SAASuN,cAAcnH,SAC1DiI,SAAW,IAAI1N,GAAM,UAAWpI,KAAKyH,cACrCsO,QAAU,IAAI3N,GAAM,SAAUpI,KAAKyH,cACnCuO,SAAW,IAAI5N,GAAM,UAAWpI,KAAKyH,6CAO9C,SAAWA,QACFA,QAAUA,4BAGnB,kBACWzH,KAAKyH,qCAThB,oBACe8N,6BAAazW"} \ No newline at end of file +{"version":3,"file":"sdk.min.js","sources":["../../src/utils/array.js","../../src/utils/collection.js","../../src/utils/is-empty.js","../../src/utils/is-blank.js","../../src/utils/is-latitude.js","../../src/utils/is-longitude.js","../../src/utils/is-resource.js","../../src/utils/is-phone.js","../../src/utils/is-node-environment.js","../../src/utils/detect-adapter.js","../../src/utils/google-address.js","../../src/utils/point.js","../../src/utils/object.js","../../src/utils/store-actions.js","../../src/resource.js","../../src/resources/order.js","../../src/resources/payload.js","../../src/resources/entity.js","../../src/resources/place.js","../../src/resources/waypoint.js","../../src/resources/tracking-status.js","../../src/resources/vehicle.js","../../src/resources/driver.js","../../src/resources/vendor.js","../../src/resources/contact.js","../../src/resources/zone.js","../../src/resources/service-area.js","../../src/resources/service-rate.js","../../src/resources/service-quote.js","../../src/adapter.js","../../src/adapters/browser.js","../../src/adapters/node.js","../../src/adapters/ember.js","../../src/utils/string.js","../../src/resolver.js","../../src/store.js","../../src/fleetbase.js"],"sourcesContent":["const { isArray } = Array;\n\nexport {\n isArray\n};\n","import { isArray } from './array';\n\n/**\n * Collection\n * Extended array inspired by Ember's NativeArray\n **/\n\nconst CHUNK_SIZE = 60000;\n\n// To avoid overflowing the stack, we splice up to CHUNK_SIZE items at a time.\n// See https://code.google.com/p/chromium/issues/detail?id=56588 for more details.\nconst replace = (array, start, deleteCount, items = []) => {\n if (isArray(array)) {\n if (items.length <= CHUNK_SIZE) {\n array.splice(start, deleteCount, ...items);\n } else {\n array.splice(start, deleteCount);\n\n for (let i = 0; i < items.length; i += CHUNK_SIZE) {\n let chunk = items.slice(i, i + CHUNK_SIZE);\n array.splice(start + i, 0, ...chunk);\n }\n }\n } else if (isCollection(arr)) {\n array.replace(start, deleteCount, items);\n }\n};\n\nconst identityFunction = (item) => item;\n\nconst uniqBy = (array, key = identityFunction) => {\n let ret = [];\n let seen = new Set();\n let getter = typeof key === 'function' ? key : (item) => get(item, key);\n\n array.forEach((item) => {\n let val = getter(item);\n if (!seen.has(val)) {\n seen.add(val);\n ret.push(item);\n }\n });\n\n return ret;\n};\n\nconst isCollection = (mixed) => mixed instanceof Collection;\n\nconst objectAt = (array, index) => {\n if (isArray(array)) {\n return array[index];\n } else if (isCollection(array)) {\n return array.objectAt(index);\n }\n\n return null;\n};\n\nconst iter = (key, value) => {\n let valueProvided = arguments.length === 2;\n return valueProvided ? (item) => value === item[key] : (item) => Boolean(item[key]);\n};\n\nconst findIndex = (array, predicate, startAt = 0) => {\n let len = array.length;\n for (let index = startAt; index < len; index++) {\n let item = objectAt(array, index);\n if (predicate(item, index, array)) {\n return index;\n }\n }\n return -1;\n};\n\nconst find = (array, callback, target) => {\n let predicate = callback.bind(target);\n let index = findIndex(array, predicate, 0);\n return index === -1 ? undefined : objectAt(array, index);\n};\n\nconst any = (array, callback, target) => {\n let predicate = callback.bind(target);\n return findIndex(array, predicate, 0) !== -1;\n};\n\nconst every = (array, callback, target) => {\n let cb = callback.bind(target);\n let predicate = (item, index, array) => !cb(item, index, array);\n return findIndex(array, predicate, 0) === -1;\n};\n\nconst indexOf = (array, val, startAt = 0, withNaNCheck) => {\n let len = array.length;\n\n if (startAt < 0) {\n startAt += len;\n }\n\n // SameValueZero comparison (NaN !== NaN)\n let predicate = withNaNCheck && val !== val ? (item) => item !== item : (item) => item === val;\n return findIndex(array, predicate, startAt);\n};\n\nconst removeAt = (array, index, len = 1) => {\n replace(array, index, len, []);\n return array;\n};\n\nconst insertAt = (array, index, item) => {\n replace(array, index, 0, [item]);\n return item;\n};\n\nclass Collection extends Array {\n constructor(...items) {\n if (isArray(arguments[0])) {\n super(...arguments[0]);\n } else {\n super(...arguments);\n }\n }\n\n get notEmpty() {\n return this.length > 0;\n }\n\n get empty() {\n return this.length === 0;\n }\n\n get first() {\n return objectAt(this, 0);\n }\n\n get last() {\n return objectAt(this, this.length - 1);\n }\n\n replace(start, deleteCount, items = []) {\n replace(this, start, deleteCount, items);\n\n return this;\n }\n\n objectsAt(indexes) {\n return indexes.map((idx) => objectAt(this, idx));\n }\n\n objectAt(index) {\n return objectAt(this, index);\n }\n\n indexOf(object, startAt) {\n return indexOf(this, object, startAt, false);\n }\n\n lastIndexOf(object, startAt) {\n let len = this.length;\n\n if (startAt === undefined || startAt >= len) {\n startAt = len - 1;\n }\n\n if (startAt < 0) {\n startAt += len;\n }\n\n for (let idx = startAt; idx >= 0; idx--) {\n if (objectAt(this, idx) === object) {\n return idx;\n }\n }\n\n return -1;\n }\n\n includes(object, startAt) {\n return indexOf(this, object, startAt, true) !== -1;\n }\n\n findBy() {\n return find(this, iter(...arguments));\n }\n\n findIndexBy() {\n return findIndex(this, iter(...arguments));\n }\n\n isEvery() {\n return every(this, iter(...arguments));\n }\n\n isAny() {\n return any(this, iter(...arguments));\n }\n\n invoke(methodName, ...args) {\n let ret = [];\n\n this.forEach((item) => ret.push(item[methodName]?.(...args)));\n\n return ret;\n }\n\n toArray() {\n return this.map((item) => item);\n }\n\n compact() {\n return this.filter((value) => value != null);\n }\n\n sortBy() {\n let sortKeys = arguments;\n\n return this.sort((a, b) => {\n for (let i = 0; i < sortKeys.length; i++) {\n let key = sortKeys[i];\n let propA = a[key];\n let propB = b[key];\n // return 1 or -1 else continue to the next sortKey\n let compareValue = compare(propA, propB);\n\n if (compareValue) {\n return compareValue;\n }\n }\n return 0;\n });\n }\n\n uniqBy(key) {\n return uniqBy(this, key);\n }\n\n without(value) {\n if (!this.includes(value)) {\n return this; // nothing to do\n }\n\n // SameValueZero comparison (NaN !== NaN)\n let predicate = value === value ? (item) => item !== value : (item) => item === item;\n return this.filter(predicate);\n }\n\n clear() {\n let len = this.length;\n if (len === 0) {\n return this;\n }\n\n this.replace(0, len, []);\n return this;\n }\n\n insertAt(idx, object) {\n insertAt(this, idx, object);\n return this;\n }\n\n replaceAt(idx, object) {\n return this.replace(idx, 1, [object]);\n }\n\n removeAt(start, len) {\n return removeAt(this, start, len);\n }\n\n pushObject(obj) {\n return this.insertAt(this.length, obj);\n }\n\n pushObjects(objects) {\n this.replace(this.length, 0, objects);\n return this;\n }\n\n popObject() {\n let len = this.length;\n if (len === 0) {\n return null;\n }\n\n let ret = objectAt(this, len - 1);\n this.removeAt(len - 1, 1);\n return ret;\n }\n\n shiftObject() {\n if (this.length === 0) {\n return null;\n }\n\n let ret = objectAt(this, 0);\n this.removeAt(0);\n return ret;\n }\n\n unshiftObject(obj) {\n return insertAt(this, 0, obj);\n }\n\n unshiftObjects(objects) {\n this.replace(0, 0, objects);\n return this;\n }\n\n reverseObjects() {\n let len = this.length;\n if (len === 0) {\n return this;\n }\n\n let objects = this.toArray().reverse();\n this.replace(0, len, objects);\n return this;\n }\n\n setObjects(objects) {\n if (objects.length === 0) {\n return this.clear();\n }\n\n let len = this.length;\n this.replace(0, len, objects);\n return this;\n }\n\n removeObject(obj) {\n let loc = this.length || 0;\n while (--loc >= 0) {\n let curObject = objectAt(this, loc);\n\n if (curObject === obj) {\n this.removeAt(loc);\n }\n }\n return this;\n }\n\n removeObjects(objects) {\n for (let i = objects.length - 1; i >= 0; i--) {\n this.removeObject(objects[i]);\n }\n\n return this;\n }\n\n addObject(obj) {\n let included = this.includes(obj);\n\n if (!included) {\n this.pushObject(obj);\n }\n\n return this;\n }\n\n addObjects(objects) {\n objects.forEach((obj) => this.addObject(obj));\n return this;\n }\n}\n\nexport default Collection;\n\nexport { replace, uniqBy, isCollection, objectAt, iter, findIndex, find, any, every, indexOf, removeAt, insertAt };\n","const isEmpty = (obj) => {\n const none = obj === null || obj === undefined;\n if (none) {\n return none;\n }\n\n if (typeof obj.size === 'number') {\n return !obj.size;\n }\n\n const objectType = typeof obj;\n\n if (objectType === 'object') {\n const { size } = obj;\n if (typeof size === 'number') {\n return !size;\n }\n }\n\n if (typeof obj.length === 'number' && objectType !== 'function') {\n return !obj.length;\n }\n\n if (objectType === 'object') {\n const { length } = obj;\n if (typeof length === 'number') {\n return !length;\n }\n }\n\n return false;\n};\n\nexport default isEmpty;\n","import isEmpty from './is-empty';\n\nconst isBlank = (obj) => isEmpty(obj) || (typeof obj === 'string' && /\\S/.test(obj) === false);\n\nexport default isBlank;\n","export default function isLatitude(coordinate) {\n return isFinite(coordinate) && Math.abs(coordinate) <= 90;\n}\n","export default function isLongitude(coordinate) {\n return isFinite(coordinate) && Math.abs(coordinate) <= 180 && Math.abs(coordinate) >= 90;\n}\n","import Resource from '../resource';\n\nexport default function isResource(record) {\n return record instanceof Resource;\n}\n","const isPhone = (phone = '') => {\n return /^[+]?[\\s./0-9]*[(]?[0-9]{1,4}[)]?[-\\s./0-9]*$/g.test(phone);\n}\n\nexport default isPhone;","/**\n * Determines if environment SDK is initialized in is Node, additionally checks pass if environment is ReactNative.\n * \n * @returns boolean\n */\nconst isNodeEnvironment = () => {\n return (typeof process !== 'undefined') && (typeof process?.env === 'object' || process.release?.name?.search(/node|io.js/) !== -1) && (typeof window === 'undefined' || window?.navigator?.product === 'ReactNative');\n};\n\nexport default isNodeEnvironment;","import { lookup } from '../resolver';\nimport isNodeEnvironment from './is-node-environment';\n\nconst detectAdapter = (options = {}) => {\n if (isNodeEnvironment()) {\n return lookup('adapter', 'NodeAdapter', options);\n }\n\n return lookup('adapter', 'BrowserAdapter', options);\n}\n\nexport default detectAdapter;","const { isArray } = Array;\n\nclass GoogleAddress {\n constructor(place) {\n this.place = place;\n this.geometry = place?.geometry;\n this.components = this.parseComponents();\n this.attributes = this.parseProperties();\n }\n\n parse() {\n this.parseComponents();\n this.parseProperties();\n }\n\n parseComponents() {\n const components = (this.place?.address_components || []).reduce(function (acc, data) {\n data.types.forEach(function (type) {\n acc[type] = data;\n });\n return acc;\n }, {});\n\n return components;\n }\n\n parseProperties() {\n const attributes = {\n streetNumber: this.get('street_number'),\n streetName: this.get('route'),\n coordinates: this.geometry?.location ? Object.values(this.geometry.location) : [0, 0],\n city: this.or(['locality', 'sublocality', 'sublocality_level_1', 'neighborhood', 'administrative_area_level_3', 'administrative_area_level_2']),\n county: this.get('administrative_area_level_2'),\n stateShort: this.get('administrative_area_level_1', true),\n stateLong: this.get('administrative_area_level_1'),\n countryShort: this.get('country', true),\n country: this.get('country', true),\n countryLong: this.get('country'),\n postalCode: this.get('postal_code'),\n };\n\n attributes.address = [attributes.streetNumber, attributes.streetName].filter(Boolean).join(' ');\n\n return attributes;\n }\n\n all() {\n return this.attributes;\n }\n\n or(keys = []) {\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n\n if (isArray(key)) {\n const pkey = key[0];\n const short = key[1];\n\n if (this.has(pkey)) {\n return this.get(pkey, short);\n }\n\n continue;\n }\n\n if (this.has(key)) {\n return this.get(key);\n }\n }\n\n return null;\n }\n\n has(key) {\n return (key in this.components);\n }\n\n get(key, short = false) {\n if (!(key in this.components)) {\n return null;\n }\n\n return short ? this.components[key].short_name : this.components[key].long_name;\n }\n\n setAttributes(attributes = {}) {\n this.attributes = {...this.attributes, ...attributes};\n\n return this;\n }\n\n setAttribute(key, value) {\n this.attributes[key] = value;\n\n return this;\n }\n\n getAttribute(key) {\n return this.attributes[key] || null;\n }\n}\n\nexport default GoogleAddress;\n","export default class Point {\n constructor(latitude = 0, longitude = 0) {\n this.type = 'Point';\n this.coordinates = [longitude, latitude];\n }\n\n get latitude() {\n return this.coordinates[1];\n }\n\n get longitude() {\n return this.coordinates[0];\n }\n\n lat() {\n return this.latitude;\n }\n\n lng() {\n return this.longitude;\n }\n\n static fromGeoJson(json) {\n [ longitude, latitude ] = json.coordinates;\n\n return new Point(latitude, longitude);\n }\n\n serialize() {\n return {\n type: 'Point',\n coorindates: [this.lat(), this.lng()]\n };\n }\n\n toJson() {\n return this.serialize();\n }\n\n toString() {\n return `(${this.latitude}, ${this.longitude})`;\n }\n}","import isEmpty from './is-empty';\n\nconst isResource = (mixed) => typeof mixed === 'object' && !isEmpty(mixed?.attributes) && typeof mixed?.attributes === 'object';\n\nconst isCallable = (object, property) => typeof object[property] === 'function';\n\nconst getResolved = (func, path) => {\n const resolved = func();\n return Array.isArray(resolved) || typeof resolved === 'object' ? get(resolved, path) : null;\n};\n\nconst invoke = (object, method) => {\n if (typeof object[method] === 'function') {\n return object[method].bind(object);\n }\n};\n\nconst get = (object, path) => {\n let current = object;\n\n const type = typeof object;\n const isObject = type === 'object';\n const isFunction = type === 'function';\n const isArray = Array.isArray(object);\n\n const pathType = typeof path;\n const pathIsString = pathType === 'string';\n const pathIsDotted = pathIsString && path.includes('.');\n const pathArray = pathIsDotted ? path.split('.') : [path];\n\n if (isArray || isObject) {\n for (let i = 0; i < pathArray.length; i++) {\n if (current && current[pathArray[i]] === undefined) {\n return null;\n } else if (current) {\n current = current[pathArray[i]];\n\n // if is resource then return get on it's attributes\n if (isResource(current) && pathArray[i + 1] !== undefined) {\n const newPath = pathArray.slice(i + 1).join('.');\n\n return get(current.attributes, newPath);\n }\n\n // resolve functions and continue\n if (typeof current === 'function') {\n const newPath = pathArray.slice(i + 1).join('.');\n return getResolved(current, newPath);\n }\n }\n }\n return current;\n }\n\n if (isFunction) {\n return getResolved(object, path);\n }\n};\n\nconst getProperties = (object, properties = []) => {\n const selected = {};\n let propertyNames = arguments;\n let i = 1;\n\n if (arguments.length === 2 && Array.isArray(properties)) {\n i = 0;\n propertyNames = arguments[1];\n }\n\n for (; i < propertyNames.length; i++) {\n selected[propertyNames[i]] = get(object, propertyNames[i]);\n }\n\n return selected;\n};\n\nconst set = (object, path, value) => {\n let current = object;\n const type = typeof object;\n const isObject = type === 'object';\n const isFunction = type === 'function';\n const isArray = Array.isArray(object);\n\n // if is function\n if (isFunction) {\n // throw error should be object or array or object like\n }\n\n const pathType = typeof path;\n const pathIsString = pathType === 'string';\n const pathIsDotted = pathIsString && path.includes('.');\n const pathArray = pathIsDotted ? path.split('.') : [path];\n const iterations = pathArray.length;\n\n if (isArray || isObject) {\n for (let i = 0; i < iterations - 1; i++) {\n if (!current[pathArray[i]]) {\n current[pathArray[i]] = {};\n }\n current = current[pathArray[i]];\n }\n\n current[pathArray[iterations - 1]] = value;\n }\n\n return value;\n};\n\nconst setProperties = (object, properties = {}) => {\n for (const property in properties) {\n set(object, property, properties[property]);\n }\n\n return object;\n};\n\nconst extend = (target, classes = []) => {\n if (arguments.length > 1) {\n classes = arguments;\n }\n for (let index = 0; index < classes.length; index++) {\n for (const property in classes[index]) {\n if (Object.prototype.hasOwnProperty.call(classes[index], property)) {\n target[property] = classes[index][property];\n }\n }\n }\n return target;\n};\n\nexport { set, get, getProperties, setProperties, extend, isCallable, invoke };\n","import { set } from './object';\n\nexport default class StoreActions {\n constructor(actions = {}, bind = null) {\n this.actions = actions;\n this.bind = bind;\n }\n\n extend(bindTo = null) {\n const binding = bindTo || this.bind;\n\n if (!binding) {\n return this;\n }\n\n if (this?.actions && typeof this.actions === 'object') {\n for (let action in this.actions) {\n const fn = this.actions[action];\n\n if (typeof fn !== 'function') {\n set(binding, action, fn);\n continue;\n }\n\n set(binding, action, fn.bind(binding));\n }\n }\n\n return this;\n }\n}\n","import Store from './store';\nimport { isEmpty } from './utils';\nimport { isArray } from './utils/array';\nimport { set, get } from './utils/object';\n\nclass Resource {\n /**\n\t * The base resource for all resources\n\n\t * @return {[type]} [description]\n\t */\n constructor(attributes = {}, adapter, resource, options = {}) {\n this.attributes = attributes;\n this.dirtyAttributes = {};\n this.changes = {};\n this.isLoading = false;\n this.isSaving = false;\n this.isDestroying = false;\n this.isReloading = false;\n this.resource = resource;\n this.options = options;\n this.version = options.version || 'v1';\n this.setAdapter(adapter);\n }\n\n /**\n * Set a new adapter to the resource instance, this will update the Store instance\n *\n * @param {Adapter} adapter\n * @return {Resource} this\n */\n setAdapter(adapter) {\n this.adapter = adapter;\n this.store = new Store(this.resource, adapter, {\n onAfterFetch: this.syncAttributes.bind(this),\n actions: this.options?.actions\n });\n\n return this;\n }\n\n /**\n * Getter for id attribute\n *\n * @var {String}\n */\n get id() {\n return this.getAttribute('id');\n }\n\n /**\n * Creates a new resource on the server\n *\n * @param {Object} payload [description]\n * @return {[type]} [description]\n */\n create(attributes = {}) {\n const data = this.mergeAttributes(attributes);\n this.setFlags(['isLoading', 'isSaving']);\n\n return this.store.create(data).then((response) => {\n this.setFlags(['isLoading', 'isSaving'], false);\n\n return response;\n });\n }\n\n /**\n * Creates a new resource on the server\n *\n * @param {Object} payload [description]\n * @return {[type]} [description]\n */\n update(attributes = {}) {\n this.setFlags(['isLoading', 'isSaving']);\n\n return this.store.update(this.attributes.id, attributes).then((response) => {\n this.setFlags(['isLoading', 'isSaving'], false);\n\n return response;\n });\n }\n\n /**\n * Deletes the resource instance on the server\n *\n * @return {[type]} [description]\n */\n destroy() {\n this.setFlags(['isLoading', 'isDestroying']);\n\n return this.store.destroy(this.attributes.id).then((response) => {\n this.setFlags(['isLoading', 'isDestroying'], false);\n\n return response;\n });\n }\n\n /**\n * Reloads the resource from the server.\n *\n * @return {[type]} [description]\n */\n reload() {\n this.setFlags(['isLoading', 'isReloading']);\n\n return this.store.findRecord(this.attributes.id).then((response) => {\n this.reset();\n\n return response;\n });\n }\n\n /**\n * Sets flag properties.\n *\n * @return this\n */\n setFlags(flags = [], state = true) {\n const validFlags = ['isLoading', 'isSaving', 'isReloading', 'isDestroying'];\n\n for(let i = 0; i < flags.length; i++) {\n const flag = flags[i];\n\n if (typeof flag !== 'string' || !validFlags.includes(flag)) {\n throw new Error(`${flag} is not a valid flag!`);\n }\n\n this[flag] = state;\n }\n\n return this;\n }\n\n /**\n * Resets tracked properties\n *\n * @return this\n */\n reset() {\n this.dirtyAttributes = {};\n this.changes = {};\n this.isLoading = false;\n this.isSaving = false;\n this.isReloading = false;\n\n return this;\n }\n\n /**\n * Emptys resource.\n *\n * @return this\n */\n empty() {\n this.reset();\n this.attribues = {};\n\n return this;\n }\n\n /**\n * Saves the resource instance on the server\n *\n * @return {[type]} [description]\n */\n save(options = {}) {\n const attributes = this.getAttributes();\n\n if (isEmpty(this.id)) {\n return this.create(attributes);\n }\n\n if (options.onlyDirty === true) {\n return this.savedirty();\n }\n\n return this.update(attributes);\n }\n\n /**\n * Saves only dirtied attributes.\n *\n * @return {[type]} [description]\n */\n saveDirty() {\n const dirtyAttributeKeys = Object.keys(this.dirtyAttributes);\n const dirtyAttributes = {};\n\n for (let i = 0; i < dirtyAttributeKeys.length; i++) {\n const key = dirtyAttributeKeys[i];\n dirtyAttributes[key] = this.getAttribute(key);\n }\n\n return this.update(dirtyAttributes);\n }\n\n /**\n * Returns the resource meta if exists.\n *\n * @return {Object}\n */\n get meta() {\n return this.getAttribute('meta', {});\n }\n\n /**\n * Returns the date instance resource was created.\n *\n * @return {Date}\n */\n get createdAt() {\n return this.isAttributeFilled('created_at') ? new Date(this.getAttribute('created_at')) : null;\n }\n\n /**\n * Returns the date instance resource was created.\n *\n * @return {Date}\n */\n get updatedAt() {\n return this.isAttributeFilled('updated_at') ? new Date(this.getAttribute('updated_at')) : null;\n }\n\n /**\n * Checks if resource is loaded from the server.\n *\n * @return {Boolean}\n */\n get isLoaded() {\n return this.hasAttributes(['created_at', 'id']);\n }\n\n /**\n * Checks if resource ihas no attributes\n *\n * @return {Boolean}\n */\n get isEmpty() {\n return Object.values(this?.attributes).length === 0;\n }\n\n /**\n * Checks if resource is not saved to server.\n *\n * @return {Boolean}\n */\n get isNew() {\n return !this.id;\n }\n\n /**\n * Checks if resource is not saved to server.\n *\n * @return {Boolean}\n */\n get isSaved() {\n return !this.isNew && this.isLoaded;\n }\n\n /**\n * Checks if resource is deleted on server.\n *\n * @return {Boolean}\n */\n get isDeleted() {\n return this.hasAttributes(['deleted', 'time']);\n }\n\n /**\n * Iterates over each attribute value and property executing a user supplied callback.\n *\n * @return {Object}\n */\n eachAttribute(callback) {\n if (typeof callback !== 'function') {\n return this;\n }\n\n Object.keys(this?.attributes ?? {}).forEach((property) => {\n const value = this.getAttribute(property);\n callback.call(this, value, property);\n });\n\n return this;\n }\n\n /**\n * Gets all changes\n *\n * @return {Object}\n */\n changes() {\n return this.changes;\n }\n\n /**\n * Gets all dirty attributes.\n *\n * @return {Object}\n */\n getDirtyAttributes() {\n return this.dirtyAttributes;\n }\n\n /**\n * Checks if property is dirty.\n *\n * @param {String} property [description]\n * @return {Boolean}\n */\n isDirty(property) {\n return property in this.dirtyAttributes;\n }\n\n /**\n * Checks if any properties is dirty.\n *\n * @return {Boolean}\n */\n hasDirtyAttributes() {\n return Object.keys(this?.dirtyAttributes ?? {}).length > 0;\n }\n\n /**\n * Updates a instance property without tracking changes or dirtying attribute.\n *\n * @param {String} property [description]\n * @param {mixed} value [description]\n */\n mutate(property, value) {\n this.attributes[property] = value;\n }\n\n /**\n * Set an instance property locally\n *\n * @param {String} property [description]\n * @param {mixed} value [description]\n */\n setAttribute(property, value = null) {\n if (value === null && typeof property === 'object') {\n return this.setAttributes(property);\n }\n\n const previousValue = this?.attributes[property] ?? null;\n\n // use object setter\n set(this.attributes, property, value);\n set(this.dirtyAttributes, property, previousValue);\n \n // this.attributes[property] = value;\n // this.dirtyAttributes[property] = previousValue;\n\n // track changes\n if (!isArray(this?.changes[property])) {\n this.changes[property] = [];\n }\n\n this.changes[property].push({\n property,\n previousValue,\n value,\n changedAt: new Date(),\n });\n\n return this;\n }\n\n /**\n * Set multiple instance properties locally\n *\n * @param {Object} properties [description]\n */\n setAttributes(attributes = {}) {\n for (let property in attributes) {\n this.setAttribute(property, attributes[property]);\n }\n\n return this;\n }\n\n /**\n * Get an attribute\n *\n * @param {String} attribute The attribute key to get\n * @param {mixed} defaultValue The default value if no attribute value\n */\n getAttribute(attribute, defaultValue = null) {\n const value = get(this?.attributes ?? {}, attribute);\n\n if (value === undefined) {\n return defaultValue;\n }\n\n return value;\n }\n\n /**\n * Checks if attribute exists.\n *\n * @param {String} property [description]\n * @return {Boolean}\n */\n hasAttribute(property) {\n if (isArray(property)) {\n const properties = property;\n const attributeKeys = Object.keys(this.attributes ?? {});\n \n return properties.every((prop) => attributeKeys.includes(prop));\n }\n\n if (!this?.attributes) {\n return false;\n }\n\n return property in this.attributes;\n }\n\n /**\n * Alias for checking if has multiple attributes.\n *\n * @param {Array} properties \n * @return {Boolean}\n */\n hasAttributes(properties = []) {\n return this.hasAttribute(properties);\n }\n\n /**\n * Returns true if attribute has value.\n *\n * @param {Array} properties \n * @return {Boolean}\n */\n isAttributeFilled(property) {\n if (isArray(property)) {\n return this.hasAttribute(property) && property.every((prop) => !isEmpty(this.getAttribute(prop)));\n }\n\n return this.hasAttribute(property) && !isEmpty(this.getAttribute(property));\n }\n\n /**\n * Get multiple attributes.\n *\n * @param {Array} properties [description]\n * @param {[type]} value [description]\n */\n getAttributes(properties) {\n const attributes = {};\n\n if (properties === null || properties === undefined) {\n return this.getAttributes(Object.keys(this.attributes));\n }\n\n if (typeof properties === 'string') {\n return this.getAttribute([...arguments]);\n }\n\n if (!isArray(properties)) {\n throw new Error('No attribute properties provided!');\n }\n\n for (let i = 0; i < properties.length; i++) {\n const property = properties[i];\n\n if (typeof property !== 'string') {\n continue;\n }\n\n let value = this.getAttribute(property);\n\n if (typeof value?.attributes === 'object' && !isArray(value?.attributes)) {\n value = value.attributes;\n }\n\n attributes[property] = value;\n }\n\n return attributes;\n }\n\n /**\n * Serialize resource to a POJO\n *\n * @returns {Object}\n */\n serialize() {\n return this.getAttributes();\n }\n\n /**\n * Merge and return attributes on the resource instance.\n *\n * @param {[type]} property [description]\n * @param {[type]} value [description]\n */\n mergeAttributes(attributes = {}) {\n const modelAttributes = this?.attributes ?? {};\n this.attributes = { ...modelAttributes, ...attributes };\n\n return this.attributes;\n }\n\n /**\n * Merge and return attributes on the resource instance.\n *\n * @param {[type]} property [description]\n * @param {[type]} value [description]\n */\n syncAttributes(json = {}) {\n this.attributes = json;\n }\n}\n\nexport default Resource;\n","import Resource from '../resource';\nimport { StoreActions, isResource } from '../utils';\nimport { isValid as isValidDate } from 'date-fns';\n\nconst orderActions = new StoreActions({\n getDistanceAndTime: function (id, params = {}, options = {}) {\n return this.adapter.get(`${this.namespace}/${id}/distance-and-time`, params, options);\n },\n\n getNextActivity: function (id, params = {}, options = {}) {\n return this.adapter.get(`${this.namespace}/${id}/next-activity`, params, options);\n },\n\n dispatch: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/dispatch`, params, options).then(this.afterFetch.bind(this));\n },\n\n start: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/start`, params, options).then(this.afterFetch.bind(this));\n },\n\n updateActivity: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/update-activity`, params, options).then(this.afterFetch.bind(this));\n },\n\n setDestination: function (id, destinationId, params = {}, options = {}) {\n if (isResource(destinationId)) {\n destinationId = destinationId.id;\n }\n\n return this.adapter.post(`${this.namespace}/${id}/set-destination/${destinationId}`, params, options).then(this.afterFetch.bind(this));\n },\n\n captureQrCode: function (id, subjectId = null, params = {}, options = {}) {\n if (isResource(subjectId)) {\n subjectId = subjectId.id;\n }\n\n return this.adapter.post(`${this.namespace}/${id}/capture-qr${!subjectId ? '' : '/' + subjectId}`, params, options);\n },\n\n captureSignature: function (id, subjectId = null, params = {}, options = {}) {\n if (isResource(subjectId)) {\n subjectId = subjectId.id;\n }\n\n return this.adapter.post(`${this.namespace}/${id}/capture-signature${!subjectId ? '' : '/' + subjectId}`, params, options);\n },\n\n complete: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/complete`, params, options).then(this.afterFetch.bind(this));\n },\n\n cancel: function (id, params = {}, options = {}) {\n return this.adapter.delete(`${this.namespace}/${id}/cancel`, params, options).then(this.afterFetch.bind(this));\n },\n});\n\nclass Order extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'order', { actions: orderActions, ...options });\n }\n\n getDistanceAndTime(params = {}, options = {}) {\n return this.store.getDistanceAndTime(this.id, params, options);\n }\n\n dispatch(params = {}, options = {}) {\n return this.store.dispatch(this.id, params, options);\n }\n\n start(params = {}, options = {}) {\n return this.store.start(this.id, params, options);\n }\n\n setDestination(destinationId, params = {}, options = {}) {\n return this.store.setDestination(this.id, destinationId, params, options);\n }\n\n captureQrCode(subjectId = null, params = {}, options = {}) {\n return this.store.captureQrCode(this.id, subjectId, params, options);\n }\n\n captureSignature(subjectId = null, params = {}, options = {}) {\n return this.store.captureSignature(this.id, subjectId, params, options);\n }\n\n getNextActivity(params = {}, options = {}) {\n return this.store.getNextActivity(this.id, params, options);\n }\n\n updateActivity(params = {}, options = {}) {\n return this.store.updateActivity(this.id, params, options);\n }\n\n cancel(params = {}, options = {}) {\n return this.store.cancel(this.id, params, options);\n }\n\n complete(params = {}, options = {}) {\n return this.store.complete(this.id, params, options);\n }\n\n get isDispatched() {\n return this.getAttribute('dispatched_at') !== null;\n }\n\n get isNotDispatched() {\n return this.getAttribute('dispatched_at') == null;\n }\n\n get isStarted() {\n return this.getAttribute('started_at') !== null;\n }\n\n get isNotStarted() {\n return this.getAttribute('started_at') == null;\n }\n\n get isCompleted() {\n return this.getAttribute('status') == 'completed';\n }\n\n get isCanceled() {\n return this.getAttribute('status') == 'canceled';\n }\n\n get isEnroute() {\n return this.getAttribute('status') == 'driver_enroute' || this.getAttribute('status') === 'enroute';\n }\n\n get isInProgress() {\n return this.isStarted && !this.isCanceled && !this.isCompleted;\n }\n\n get scheduledAt() {\n return this.isAttributeFilled('scheduled_at') ? new Date(this.getAttribute('scheduled_at')) : null;\n }\n\n get startedAt() {\n return this.isAttributeFilled('started_at') ? new Date(this.getAttribute('started_at')) : null;\n }\n\n get dispatchedAt() {\n return this.isAttributeFilled('dispatched_at') ? new Date(this.getAttribute('dispatched_at')) : null;\n }\n\n get status() {\n return this.getAttribute('status');\n }\n}\n\nexport default Order;\n\nexport { orderActions };\n","import Resource from '../resource';\nimport Collection from '../utils/collection';\n\nclass Payload extends Resource {\n\tconstructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'payload', options);\n }\n\t\n /**\n\t * Attaches an entity to an existing payload and returns\n\t * the payload with the entity attached\n\t *\n\t * @param {[type]} Entity entity [description]\n\t * @return {[type]} [description]\n\t */\n attach(entity) {\n // perform op return payload\n }\n\n /**\n\t * Returns all of the entities attached to this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get entities() {\n\n }\n\n /**\n\t * Returns the dropoff for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get dropoff() {\n\n }\n\n /**\n\t * Returns the pickup for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get pickup() {\n\n }\n\n /**\n\t * Returns all the waypoints for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get waypoints() {\n return new Collection(this.waypoints);\n }\n}\n\nexport default Payload;\n","import Resource from '../resource';\n\nclass Entity extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'entity', options);\n }\n}\n\nexport default Entity;\n","import Resource from '../resource';\nimport { isResource, Point } from '../utils';\n\nclass Place extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'place', options);\n }\n\n static fromGoogleAddress(googleAddress, adapter, options = {}) {\n const [ latitude, longitude ] = googleAddress.getAttribute('coordinates');\n const attributes = {\n name: null,\n address: googleAddress.getAttribute('address'),\n location: new Point(latitude, longitude),\n street1: googleAddress.getAttribute('streetName'),\n street2: null,\n city: googleAddress.getAttribute('city'),\n province: googleAddress.getAttribute('stateLong'),\n postal_code: googleAddress.getAttribute('postalCode'),\n neighborhood: googleAddress.get('neighborhood'),\n district: googleAddress.getAttribute('county'),\n building: googleAddress.get('building'),\n country: googleAddress.getAttribute('countryShort'),\n phone: null,\n security_access_code: null\n };\n\n return new Place(attributes, adapter, options);\n }\n\n /**\n * The latitude coordinate for the 'Place' location.\n * \n * @var {Integer}\n */\n get latitude() {\n return this.getAttribute('location', new Point())?.coordinates[1];\n }\n\n /**\n * The longitude coordinate for the 'Place' location.\n * \n * @var {Integer}\n */\n get longitude() {\n return this.getAttribute('location', new Point())?.coordinates[0];\n }\n\n /**\n * Array coordinate pair for Place location.\n * \n * @var {Array}\n */\n get coordinates() {\n const { latitude, longitude } = this;\n\n return [ latitude, longitude ];\n }\n\n /**\n * Set the owner of the place.\n * \n * @param {Object|String} owner\n * @return {Place}\n */\n setOwner(owner) {\n if (isResource(owner)) {\n this.setAttribute('owner', owner.id);\n }\n\n if (typeof owner === 'string') {\n this.setAttribute('owner', owner);\n }\n\n return this;\n }\n}\n\nexport default Place;\n","import Place from './place';\n\nclass Waypoint extends Place {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'waypoint', options);\n }\n}\n\nexport default Waypoint;\n","import Resource from '../resource';\n\nclass TrackingStatus extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'tracking-status', options);\n }\n}\n\nexport default TrackingStatus;\n","import Resource from '../resource';\n\nclass Vehicle extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'vehicle', options);\n }\n}\n\nexport default Vehicle;\n","import Resource from '../resource';\nimport { StoreActions, isPhone, isEmail } from '../utils';\n\nconst driverActions = new StoreActions({\n // const { error } = await fleetbase.drivers.login('+1 111-1111');\n login: function (identity, password = null, attributes = {}) {\n // handle phone number authentication\n if (isPhone(identity)) {\n return this.adapter.post('drivers/login-with-sms', { phone: identity });\n }\n\n if (!password) {\n throw new Error('Login requires password!');\n }\n\n return this.adapter.post('drivers/login', { identity, password, ...attributes }).then(this.afterFetch.bind(this));\n },\n\n verifyCode: function (identity, code, attributes = {}) {\n return this.adapter.post('drivers/verify-code', { identity, code, ...attributes }).then(this.afterFetch.bind(this));\n },\n\n track: function (id, params = {}, options = {}) {\n return this.adapter.post(`drivers/${id}/track`, params, options).then(this.afterFetch.bind(this));\n },\n\n retrieve: function (id) {\n return this.findRecord(id);\n },\n\n syncDevice(id, params = {}, options = {}) {\n return this.adapter.post(`drivers/${id}/register-device`, params, options);\n },\n});\n\nclass Driver extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'driver', { actions: driverActions, ...options });\n }\n\n get token() {\n return this.getAttribute('token');\n }\n\n get isOnline() {\n return this.getAttribute('online') === true;\n }\n\n /**\n * The latitude coordinate for the 'Place' location.\n *\n * @var {Integer}\n */\n get latitude() {\n return this.getAttribute('location', new Point())?.coordinates[1];\n }\n\n /**\n * The longitude coordinate for the 'Place' location.\n *\n * @var {Integer}\n */\n get longitude() {\n return this.getAttribute('location', new Point())?.coordinates[0];\n }\n\n /**\n * Array coordinate pair for Place location.\n *\n * @var {Array}\n */\n get coordinates() {\n const { latitude, longitude } = this;\n\n return [latitude, longitude];\n }\n\n get token() {\n return this.getAttribute('token');\n }\n\n get isOnline() {\n return this.getAttribute('online') === true;\n }\n\n track(params = {}, options = {}) {\n return this.store.track(this.id, params, options);\n }\n\n syncDevice(params = {}, options = {}) {\n return this.store.syncDevice(this.id, params, options);\n }\n}\n\nexport default Driver;\nexport { driverActions };\n","import Resource from '../resource';\n\nclass Vendor extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'vendor', options);\n }\n}\n\nexport default Vendor;\n","import Resource from '../resource';\n\nclass Contact extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'contact', options);\n }\n}\n\nexport default Contact;\n","import Resource from '../resource';\n\nclass Zone extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'zone', options);\n }\n}\n\nexport default Zone;\n","import Resource from '../resource';\n\nclass ServiceArea extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-area', options);\n }\n}\n\nexport default ServiceArea;\n","import Resource from '../resource';\n\nclass ServiceRate extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-rate', options);\n }\n}\n\nexport default ServiceRate;\n","import Resource from '../resource';\n\nclass ServiceQuote extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-quote', options);\n }\n\n fromPreliminary() {\n\n }\n\n fromPayload() {\n \n }\n}\n\nexport default ServiceQuote;\n","class Adapter {\n /**\n\t * Creates a configured base adapter for Fleetbase.\n\t *\n\t * @param {Object} config Configuration options for adapter\n\t */\n constructor(config = {}) {\n this.version = config.version || 'v1';\n this.host = config.host || null;\n this.namespace = config.namespace || null;\n this.headers = config.headers || {};\n }\n}\n\nexport default Adapter;\n","import Adapter from '../adapter';\nimport { isBlank } from '../utils';\n\nclass BrowserAdapter extends Adapter {\n /**\n * Setup browser adapter.\n * @param {Object} config\n */\n constructor(config) {\n super(config);\n\n this.setHeaders({\n Authorization: `Bearer ${config.publicKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': '@fleetbase/sdk;browser'\n });\n }\n\n /**\n * Updates the adapter headers.\n *\n * @param {Object} headers\n */\n setHeaders(headers = {}) {\n this.headers = { ...this.headers, ...headers };\n\n return this;\n }\n\n /**\n * Parses the JSON returned by a network request\n *\n * @param {Object} response A response from a network request\n * @return {Object} The parsed JSON, status from the response\n *\n * @return {Promise}\n */\n parseJSON(response) {\n return new Promise((resolve, reject) => response\n .json()\n .then((json) => resolve({\n statusText: response.statusText,\n status: response.status,\n ok: response.ok,\n json,\n }))\n .catch(() => {\n reject(new Error('Oops! Something went wrong when handling your request.'));\n }));\n }\n\n /**\n * The base request method\n *\n * @param {String} path\n * @param {String} method\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n request(path, method = 'GET', data = {}, options = {}) {\n return new Promise((resolve, reject) => fetch(options.url || `${this.host}/${this.namespace}/${path}`, {\n method,\n mode: options.mode || 'cors',\n headers: new Headers({\n ...(this.headers || {}),\n ...(options.headers || {}),\n }),\n ...data,\n })\n .then(this.parseJSON)\n .then((response) => {\n if (response.ok) {\n return resolve(response.json);\n }\n\n return reject(new Error(response.json.errors ? response.json.errors[0] : response.statusText));\n })\n .catch((error) => {\n reject(error);\n }));\n }\n\n /**\n * Makes a GET request with fetch\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n get(path, query = {}, options = {}) {\n const urlParams = !isBlank(query) ? new URLSearchParams(query).toString() : '';\n\n return this.request(`${path}${urlParams ? `?${urlParams}` : ''}`, 'GET', {}, options);\n }\n\n /**\n * Makes a POST request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n post(path, data = {}, options = {}) {\n return this.request(path, 'POST', { body: JSON.stringify(data) }, options);\n }\n\n /**\n * Makes a PUT request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n put(path, data = {}, options = {}) {\n return this.request(path, 'PUT', { body: JSON.stringify(data) }, options);\n }\n\n /**\n * Makes a DELETE request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n delete(path, options = {}) {\n return this.request(path, 'DELETE', {}, options);\n }\n\n /**\n * Makes a PATCH request with fetch\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n patch(path, data = {}, options = {}) {\n return this.request(path, 'PATCH', { body: JSON.stringify(data) }, options);\n }\n}\n\nexport default BrowserAdapter;\n","import Adapter from '../adapter';\nimport { isBlank } from '../utils';\nimport { isArray } from '../utils/array';\nimport axios from 'axios';\n\nclass NodeAdapter extends Adapter {\n constructor(config) {\n super(config);\n\n this.axios = axios.create({\n baseURL: `${this.host}/${this.namespace}`,\n headers: {\n Authorization: `Bearer ${config.publicKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': '@fleetbase/sdk;node',\n },\n });\n }\n\n /**\n * Updates the adapter headers.\n *\n * @param {Object} headers\n */\n setHeaders(headers = {}) {\n const commonHeaders = this.axios.defaults.headers.common;\n this.axios.defaults.headers.common = { ...commonHeaders, ...headers };\n\n return this;\n }\n\n /**\n * Tranform the response, and return the response data from axios.\n *\n * @param {AxiosResponse} response\n * @returns {Object}\n */\n transform(response) {\n return response.data;\n }\n\n /**\n * Handles an erroneous request.\n *\n * @param {AxiosResponse} response\n * @returns {Object}\n */\n handleError(error) {\n if (error.response) {\n const { data } = error.response;\n\n if (isArray(data.errors)) {\n throw new Error(data.errors[0]);\n }\n\n if (data.error) {\n throw new Error(data.error);\n }\n }\n\n throw error;\n }\n\n /**\n * Makes a GET request with axios\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n get(path, query = {}, options = {}) {\n const urlParams = !isBlank(query) ? new URLSearchParams(query).toString() : '';\n\n return this.axios\n .get(`${path}${urlParams ? `?${urlParams}` : ''}`, options)\n .then(this.transform.bind(this))\n .catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a POST request with axios\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n post(path, data = {}, options = {}) {\n return this.axios.post(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a PUT request with axios\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n put(path, data = {}, options = {}) {\n return this.axios.put(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a DELETE request with axios\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n delete(path, options = {}) {\n return this.axios.delete(path, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a PATCH request with axios\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n patch(path, data = {}, options = {}) {\n return this.axios.patch(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n}\n\nexport default NodeAdapter;\n","import Adapter from '../adapter';\n\nclass EmberJsAdapter extends Adapter {}\n\nexport default EmberJsAdapter;\n","'use strict';\n\n/**\n * Javascript String\n *\n * instance\n * new String('hello_world').humanize().get() => \"Hello world\"\n *\n * instance\n * const string = new String();\n * string.humanize('hello_world').get() => \"Hello world\"\n * \n * no chain\n * new String('hello_world', false).humanize() => \"Hello world\"\n *\n * static\n * String.invoke('humanize', 'hello_world') => \"Hello world\"\n *\n * exports {}\n * humanize('hello_world') => \"Hello world\"\n */\n\nexport default class String {\n constructor(string, chain = true) {\n this.str = string;\n this.chain = chain;\n }\n\n uncountableWords = ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'moose', 'deer', 'news'];\n\n pluralRules = [\n [new RegExp('(m)an$', 'gi'), '$1en'],\n [new RegExp('(pe)rson$', 'gi'), '$1ople'],\n [new RegExp('(child)$', 'gi'), '$1ren'],\n [new RegExp('^(ox)$', 'gi'), '$1en'],\n [new RegExp('(ax|test)is$', 'gi'), '$1es'],\n [new RegExp('(octop|vir)us$', 'gi'), '$1i'],\n [new RegExp('(alias|status)$', 'gi'), '$1es'],\n [new RegExp('(bu)s$', 'gi'), '$1ses'],\n [new RegExp('(buffal|tomat|potat)o$', 'gi'), '$1oes'],\n [new RegExp('([ti])um$', 'gi'), '$1a'],\n [new RegExp('sis$', 'gi'), 'ses'],\n [new RegExp('(?:([^f])fe|([lr])f)$', 'gi'), '$1$2ves'],\n [new RegExp('(hive)$', 'gi'), '$1s'],\n [new RegExp('([^aeiouy]|qu)y$', 'gi'), '$1ies'],\n [new RegExp('(x|ch|ss|sh)$', 'gi'), '$1es'],\n [new RegExp('(matr|vert|ind)ix|ex$', 'gi'), '$1ices'],\n [new RegExp('([m|l])ouse$', 'gi'), '$1ice'],\n [new RegExp('(quiz)$', 'gi'), '$1zes'],\n [new RegExp('s$', 'gi'), 's'],\n [new RegExp('$', 'gi'), 's'],\n ];\n\n singularRules = [\n [new RegExp('(m)en$', 'gi'), '$1an'],\n [new RegExp('(pe)ople$', 'gi'), '$1rson'],\n [new RegExp('(child)ren$', 'gi'), '$1'],\n [new RegExp('([ti])a$', 'gi'), '$1um'],\n [new RegExp('((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$', 'gi'), '$1$2sis'],\n [new RegExp('(hive)s$', 'gi'), '$1'],\n [new RegExp('(tive)s$', 'gi'), '$1'],\n [new RegExp('(curve)s$', 'gi'), '$1'],\n [new RegExp('([lr])ves$', 'gi'), '$1f'],\n [new RegExp('([^fo])ves$', 'gi'), '$1fe'],\n [new RegExp('([^aeiouy]|qu)ies$', 'gi'), '$1y'],\n [new RegExp('(s)eries$', 'gi'), '$1eries'],\n [new RegExp('(m)ovies$', 'gi'), '$1ovie'],\n [new RegExp('(x|ch|ss|sh)es$', 'gi'), '$1'],\n [new RegExp('([m|l])ice$', 'gi'), '$1ouse'],\n [new RegExp('(bus)es$', 'gi'), '$1'],\n [new RegExp('(o)es$', 'gi'), '$1'],\n [new RegExp('(shoe)s$', 'gi'), '$1'],\n [new RegExp('(cris|ax|test)es$', 'gi'), '$1is'],\n [new RegExp('(octop|vir)i$', 'gi'), '$1us'],\n [new RegExp('(alias|status)es$', 'gi'), '$1'],\n [new RegExp('^(ox)en', 'gi'), '$1'],\n [new RegExp('(vert|ind)ices$', 'gi'), '$1ex'],\n [new RegExp('(matr)ices$', 'gi'), '$1ix'],\n [new RegExp('(quiz)zes$', 'gi'), '$1'],\n [new RegExp('s$', 'gi'), ''],\n ];\n\n nonTitlecasedWords = ['and', 'or', 'nor', 'a', 'an', 'the', 'so', 'but', 'to', 'of', 'at', 'by', 'from', 'into', 'on', 'onto', 'off', 'out', 'in', 'over', 'with', 'for'];\n\n idSuffix = new RegExp('(_ids|_id)$', 'g');\n underbar = new RegExp('_', 'g');\n spaceOrUnderbar = new RegExp('[ _]', 'g');\n uppercase = new RegExp('([A-Z])', 'g');\n underbarPrefix = new RegExp('^_');\n\n get() {\n return this.str;\n }\n\n applyRules(str, rules, skip, override) {\n if (override) {\n str = override;\n } else {\n var ignore = skip.indexOf(str.toLowerCase()) > -1;\n if (!ignore) {\n for (var x = 0; x < rules.length; x++) {\n if (str.match(rules[x][0])) {\n str = str.replace(rules[x][0], rules[x][1]);\n break;\n }\n }\n }\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.pluralize('person') -> 'people'\n String.pluralize('octopus') -> 'octopi'\n String.pluralize('Hat') -> 'Hats'\n String.pluralize('person', 'guys') -> 'guys' \n */\n pluralize(str, plural = null) {\n str = str || this.str;\n\n return this.applyRules(str, this.pluralRules, this.uncountableWords, plural);\n }\n\n /*\n String.singularize('person') -> 'person'\n String.singularize('octopi') -> 'octopus'\n String.singularize('hats') -> 'hat'\n String.singularize('guys', 'person') -> 'person'\n */\n singularize(str, singular) {\n str = str || this.str;\n\n return this.applyRules(str, this.singularRules, this.uncountableWords, singular);\n }\n\n /*\n String.camelize('message_properties') -> 'MessageProperties'\n String.camelize('message_properties', true) -> 'messageProperties'\n */\n camelize(str, lowFirstLetter) {\n str = str || this.str;\n\n let str_path = str.split('/');\n for (var i = 0; i < str_path.length; i++) {\n let str_arr = str_path[i].split('_');\n let initX = lowFirstLetter && i + 1 === str_path.length ? 1 : 0;\n\n for (let x = initX; x < str_arr.length; x++) {\n str_arr[x] = str_arr[x].charAt(0).toUpperCase() + str_arr[x].substring(1);\n }\n str_path[i] = str_arr.join('');\n }\n str = str_path.join('::');\n\n // fix\n if (lowFirstLetter === true) {\n let first = str.charAt(0).toLowerCase();\n let last = str.slice(1);\n str = first + last;\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.underscore('MessageProperties') -> 'message_properties'\n String.underscore('messageProperties') -> 'message_properties'\n */\n underscore(str) {\n str = str || this.str;\n\n var str_path = str.split('::');\n for (var i = 0; i < str_path.length; i++) {\n str_path[i] = str_path[i].replace(this.uppercase, '_$1');\n str_path[i] = str_path[i].replace(this.underbarPrefix, '');\n }\n str = str_path.join('/').toLowerCase();\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.humanize('message_properties') -> 'Message properties'\n String.humanize('message_properties') -> 'message properties'\n */\n humanize(str, lowFirstLetter) {\n str = str || this.str;\n\n var str = str.toLowerCase();\n str = str.replace(this.idSuffix, '');\n str = str.replace(this.underbar, ' ');\n if (!lowFirstLetter) {\n str = this.capitalize(str);\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.capitalize('message_properties') -> 'Message_properties'\n String.capitalize('message properties') -> 'Message properties'\n */\n capitalize(str) {\n str = str || this.str;\n\n str = str.toLowerCase();\n str = str.substring(0, 1).toUpperCase() + str.substring(1);\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.dasherize('message_properties') -> 'message-properties'\n String.dasherize('message properties') -> 'message-properties'\n */\n dasherize(str) {\n str = str || this.str;\n\n str = str.replace(this.spaceOrUnderbar, '-');\n str = str.toLowerCase();\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.normify('message_properties') -> 'Message Properties'\n String.normify('message properties') -> 'Message Properties'\n Inflactor.normify('Message_propertyId', true) -> 'Message Properties Id'\n */\n normify(str, allFirstUpper) {\n str = str || this.str;\n\n //var str = str.toLowerCase();\n if (allFirstUpper === true) {\n str = this.camelize(str);\n str = this.underscore(str);\n } else {\n str = str.toLowerCase();\n }\n\n str = str.replace(this.underbar, ' ');\n var str_arr = str.split(' ');\n for (var x = 0; x < str_arr.length; x++) {\n var d = str_arr[x].split('-');\n for (var i = 0; i < d.length; i++) {\n if (this.nonTitlecasedWords.indexOf(d[i].toLowerCase()) < 0) {\n d[i] = this.capitalize(d[i]);\n }\n }\n str_arr[x] = d.join('-');\n }\n str = str_arr.join(' ');\n str = str.substring(0, 1).toUpperCase() + str.substring(1);\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.demodulize('Message::Bus::Properties') -> 'Properties'\n */\n demodulize(str) {\n str = str || this.str;\n\n var str_arr = str.split('::');\n str = str_arr[str_arr.length - 1];\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.tableize('MessageBusProperty') -> 'message_bus_properties'\n */\n tableize(str) {\n str = str || this.str;\n\n str = this.pluralize(this.underscore(str));\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.classify('message_bus_properties') -> 'MessageBusProperty'\n */\n classify(str) {\n str = str || this.str;\n\n str = this.singularize(this.camelize(str));\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.foreignKey('MessageBusProperty') -> 'message_bus_property_id'\n String.foreignKey('MessageBusProperty', true) -> 'message_bus_propertyid'\n */\n foreignKey(str, dropIdUbar = false) {\n str = str || this.str;\n\n str = this.underscore(this.demodulize(str)) + (dropIdUbar ? '' : '_') + 'id';\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.ordinalize('the 1 pitch') -> 'the 1st pitch'\n */\n ordinalize(str) {\n str = str || this.str;\n\n var str_arr = str.split(' ');\n for (var x = 0; x < str_arr.length; x++) {\n var i = parseInt(str_arr[x]);\n if (i === NaN) {\n var ltd = str_arr[x].substring(str_arr[x].length - 2);\n var ld = str_arr[x].substring(str_arr[x].length - 1);\n var suf = 'th';\n if (ltd != '11' && ltd != '12' && ltd != '13') {\n if (ld === '1') {\n suf = 'st';\n } else if (ld === '2') {\n suf = 'nd';\n } else if (ld === '3') {\n suf = 'rd';\n }\n }\n str_arr[x] += suf;\n }\n }\n str = str_arr.join(' ');\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /**\n * @method invoke\n **/\n static invoke() {\n const argz = Object.values(arguments);\n const instance = new String(null, false);\n const method = arguments[0];\n argz.shift();\n\n if (typeof instance[method] === 'function') {\n return instance[method](...argz);\n }\n\n return null;\n }\n}\n\nconst pluralize = function() {\n const argz = ['pluralize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst singularize = function() {\n const argz = ['singularize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst humanize = function() {\n const argz = ['humanize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst underscore = function() {\n const argz = ['underscore', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst camelize = function() {\n const argz = ['camelize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst capitalize = function() {\n const argz = ['capitalize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst dasherize = function() {\n const argz = ['dasherize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst normify = function() {\n const argz = ['normify', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst demodulize = function() {\n const argz = ['demodulize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst tableize = function() {\n const argz = ['tableize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst classify = function() {\n const argz = ['classify', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst foreignKey = function() {\n const argz = ['foreignKey', ...arguments];\n\n return String.invoke(...argz);\n};\n\nexport {\n pluralize,\n singularize,\n humanize,\n underscore,\n camelize,\n capitalize,\n dasherize,\n normify,\n demodulize,\n tableize,\n classify,\n foreignKey\n}","import { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote } from './resources';\nimport { BrowserAdapter, NodeAdapter, EmberJsAdapter } from './adapters';\nimport { pluralize, singularize } from './utils/string';\n\nconst resources = {\n Contact,\n Driver,\n Entity,\n Order,\n Payload,\n Place,\n TrackingStatus,\n Vehicle,\n Vendor,\n Waypoint,\n Zone,\n ServiceArea,\n ServiceRate,\n ServiceQuote,\n};\n\nconst adapters = {\n BrowserAdapter,\n NodeAdapter,\n EmberJsAdapter,\n};\n\nclass Resolver {\n constructor() {\n this.resources = resources;\n this.adapters = adapters;\n\n return this.lookup(...arguments);\n }\n\n lookup(type, className) {\n const key = pluralize(type);\n const params = [...arguments].slice(2);\n\n if (!this[key]) {\n throw new Error('Attempted to resolve invalid type');\n }\n\n if (!this[key][className]) {\n throw new Error(`No ${singularize(type)} named ${className} to resolve`);\n }\n\n return new this[key][className](...params);\n }\n}\n\nconst lookup = function () {\n return new Resolver(...arguments);\n};\n\nexport { Resolver, lookup };\n","import { lookup } from './resolver';\nimport { pluralize, classify } from './utils/string';\nimport { isArray } from './utils/array';\nimport { Collection, detectAdapter, isResource, StoreActions } from './utils';\nimport { set, isCallable, invoke } from './utils/object';\n\nconst extendStoreActions = (store, actions = []) => {\n store.actions = isArray(actions) ? actions : [actions];\n\n if (isArray(actions)) {\n for (let i = 0; i < actions.length; i++) {\n const action = actions[i];\n\n store.extendActions(action);\n }\n return;\n }\n\n if (actions instanceof StoreActions) {\n actions.extend(store);\n }\n\n return store;\n};\n\nconst afterFetch = (store, json) => {\n if (typeof store.options.onAfterFetch === 'function') {\n store.options.onAfterFetch(json);\n }\n\n if (isArray(json)) {\n const serialized = [];\n\n for (let i = 0; i < json.length; i++) {\n serialized.push(store.afterFetch(json[i]));\n }\n\n return new Collection(...serialized);\n }\n\n const resourceInstance = store.serialize(json);\n return store.deposit(resourceInstance);\n};\n\nclass Store {\n constructor(resource, adapter, options = {}) {\n this.resource = resource;\n this.adapter = adapter || detectAdapter();\n this.namespace = pluralize(resource);\n this.storage = new Collection();\n this.options = options;\n this.extendActions(options.actions);\n }\n\n extendActions(actions = []) {\n return extendStoreActions(this, actions);\n }\n\n deposit(resourceInstance) {\n // this.storage[this.namespace].pushObject(resourceInstance);\n\n return resourceInstance;\n }\n\n serialize(json) {\n return lookup('resource', classify(this.resource), json, this.adapter);\n }\n\n afterFetch(json) {\n return afterFetch(this, json);\n }\n\n create(attributes = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.post(`${this.namespace}`, attributes, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n update(id, attributes = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.put(`${this.namespace}/${id}`, attributes, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n findRecord(id, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}/${id}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n findAll(options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n query(query = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, query, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n queryRecord(query = {}, options = {}) {\n query.single = true;\n\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, query, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n destroy(record, options = {}) {\n const id = isResource(record) ? record.getAttribute('id') : record;\n\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.delete(`${this.namespace}/${id}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n}\n\nexport default Store;\n\nexport { extendStoreActions, afterFetch };\n","import Store from './store';\nimport Resource from './resource';\nimport { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote } from './resources';\nimport { BrowserAdapter, NodeAdapter, EmberJsAdapter, Adapter } from './adapters';\nimport { isNodeEnvironment, detectAdapter, isLatitude, isLongitude, Point, isResource, GoogleAddress, Collection, StoreActions } from './utils';\nimport { pluralize, singularize, classify, dasherize, camelize } from './utils/string';\nimport { extendStoreActions } from './store';\nimport { orderActions } from './resources/order';\nimport { driverActions } from './resources/driver';\n\n/**\n * // instance\n * const fleetbase = new Fleetbase();\n *\n * const contact = fleetbase.contacts.create({\n * \t\tname: 'Ron',\n * \t\tphone: '+65 9999 8888'\n * });\n *\n * constact.update({ name: 'Hollywood Ron' });\n *\n * // export\n * import { Contact } from '@fleetbase/sdk';\n *\n * const contact = new Contact({\n * \t\tname: 'Ron',\n * \t\tphone: '+65 9999 8888'\n * });\n *\n * contact.save();\n */\n\nexport default class Fleetbase {\n /**\n * Builds an instance of the Fleetbase SDK\n *\n * @param {String} publicKey The public key issued\n * @param {Object} config The version of resource to access\n * @param {Boolean} debug Debug mode for SDK\n * @return {Fleetbase} Instance\n */\n constructor(publicKey, config = {}, debug = false) {\n this.version = config.version ?? 'v1';\n this.options = {\n version: this.version,\n host: config.host ?? 'https://api.fleetbase.io',\n namespace: config.namespace ?? this.version,\n debug,\n publicKey,\n };\n\n if (typeof publicKey !== 'string' || publicKey.length === 0) {\n throw new Error('⚠️ Invalid public key given to Fleetbase SDK');\n }\n\n if (!isNodeEnvironment() && publicKey.toLowerCase().startsWith('$')) {\n throw new Error('Secret key provided. You must use a public key with Fleetbase Javascript SDK!');\n }\n\n this.adapter = config.adapter || detectAdapter(this.options);\n\n this.orders = new Store('order', this.adapter).extendActions(orderActions);\n this.entities = new Store('entity', this.adapter);\n this.places = new Store('place', this.adapter);\n this.drivers = new Store('driver', this.adapter).extendActions(driverActions);\n this.vehicles = new Store('vehicle', this.adapter);\n this.vendors = new Store('vendor', this.adapter);\n this.contacts = new Store('contact', this.adapter);\n }\n\n static newInstance() {\n return new Fleetbase(...arguments);\n }\n\n setAdapter(adapter) {\n this.adapter = adapter;\n }\n\n getAdapter() {\n return this.adapter;\n }\n}\n\nexport {\n Store,\n Resource,\n Contact,\n Driver,\n Entity,\n Order,\n Payload,\n Place,\n TrackingStatus,\n Vehicle,\n Vendor,\n Waypoint,\n Zone,\n ServiceArea,\n ServiceRate,\n ServiceQuote,\n BrowserAdapter,\n NodeAdapter,\n EmberJsAdapter,\n Adapter,\n isNodeEnvironment,\n isLatitude,\n isLongitude,\n Point,\n isResource,\n GoogleAddress,\n Collection,\n StoreActions,\n extendStoreActions,\n pluralize,\n singularize,\n classify,\n dasherize,\n camelize,\n};\n"],"names":["isArray","Array","CHUNK_SIZE","replace","array","start","deleteCount","items","length","splice","i","chunk","slice","isCollection","arr","identityFunction","item","uniqBy","key","ret","seen","Set","getter","get","forEach","val","has","add","push","mixed","Collection","objectAt","index","iter","value","arguments","Boolean","findIndex","predicate","startAt","len","find","callback","target","bind","undefined","any","every","cb","indexOf","withNaNCheck","removeAt","insertAt","this","indexes","map","idx","_this2","object","methodName","args","_item$methodName","filter","sortKeys","sort","a","b","propA","propB","compareValue","compare","includes","obj","objects","toArray","reverse","clear","loc","removeObject","pushObject","_this3","addObject","isEmpty","none","size","objectType","isBlank","test","isLatitude","coordinate","isFinite","Math","abs","isLongitude","isResource","record","Resource","isPhone","phone","isNodeEnvironment","process","_typeof","_process","env","release","name","search","window","navigator","product","detectAdapter","options","lookup","GoogleAddress","place","geometry","components","parseComponents","attributes","parseProperties","address_components","reduce","acc","data","types","type","streetNumber","streetName","coordinates","location","Object","values","city","or","county","stateShort","stateLong","countryShort","country","countryLong","postalCode","address","join","keys","pkey","short","short_name","long_name","Point","latitude","longitude","coorindates","lat","lng","serialize","json","getResolved","func","path","resolved","current","isObject","isFunction","pathArray","split","newPath","set","iterations","StoreActions","actions","bindTo","binding","action","fn","adapter","resource","dirtyAttributes","changes","isLoading","isSaving","isDestroying","isReloading","version","setAdapter","store","Store","onAfterFetch","syncAttributes","_this$options","getAttribute","mergeAttributes","setFlags","create","then","response","_this","update","id","destroy","findRecord","_this4","reset","flags","state","validFlags","flag","Error","attribues","getAttributes","onlyDirty","savedirty","dirtyAttributeKeys","isAttributeFilled","Date","hasAttributes","isNew","isLoaded","property","_this5","call","setAttributes","previousValue","changedAt","setAttribute","attribute","defaultValue","properties","attributeKeys","prop","hasAttribute","_this6","_value","_value2","modelAttributes","orderActions","getDistanceAndTime","params","namespace","getNextActivity","dispatch","post","afterFetch","updateActivity","setDestination","destinationId","captureQrCode","subjectId","captureSignature","complete","cancel","Order","isStarted","isCanceled","isCompleted","Payload","entity","waypoints","Entity","Place","_this$getAttribute","_this$getAttribute2","owner","googleAddress","street1","street2","province","postal_code","neighborhood","district","building","security_access_code","Waypoint","TrackingStatus","Vehicle","driverActions","login","identity","password","verifyCode","code","track","retrieve","syncDevice","Driver","Vendor","Contact","Zone","ServiceArea","ServiceRate","ServiceQuote","Adapter","config","host","headers","BrowserAdapter","setHeaders","Authorization","publicKey","Promise","resolve","reject","statusText","status","ok","method","fetch","url","mode","Headers","parseJSON","errors","error","query","urlParams","URLSearchParams","toString","request","body","JSON","stringify","NodeAdapter","axios","baseURL","commonHeaders","defaults","common","transform","handleError","put","patch","EmberJsAdapter","String","string","chain","RegExp","str","rules","skip","override","toLowerCase","x","match","plural","applyRules","pluralRules","uncountableWords","singular","singularRules","lowFirstLetter","str_path","str_arr","charAt","toUpperCase","substring","first","last","uppercase","underbarPrefix","idSuffix","underbar","capitalize","spaceOrUnderbar","allFirstUpper","camelize","underscore","d","nonTitlecasedWords","pluralize","singularize","dropIdUbar","demodulize","NaN","parseInt","ltd","ld","suf","argz","instance","shift","invoke","dasherize","classify","resources","adapters","Resolver","className","extendStoreActions","extend","extendActions","serialized","resourceInstance","deposit","storage","single","_this7","Fleetbase","debug","startsWith","orders","entities","places","drivers","vehicles","vendors","contacts"],"mappings":"48JAAA,IAAQA,EAAYC,MAAZD,8CCOFE,EAAa,IAIbC,EAAU,SAACC,E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ChGCyM,yBASLlG,aAAWN,yDAAS,GAAIyG,4EAC3BtN,kBAAU6G,EAAO7G,uBAAW,UAC5BvE,QAAU,CACXuE,QAASjI,KAAKiI,QACd8G,eAAMD,EAAOC,oBAAQ,2BACrBvD,oBAAWsD,EAAOtD,yBAAaxL,KAAKiI,QACpCsN,MAAAA,EACAnG,UAAAA,GAGqB,iBAAdA,GAA+C,IAArBA,EAAUjS,aACrC,IAAIsM,MAAM,oDAGf3G,MAAuBsM,EAAU0C,cAAc0D,WAAW,WACrD,IAAI/L,MAAM,sFAGfhC,QAAUqH,EAAOrH,SAAWhE,GAAczD,KAAK0D,cAE/C+R,OAAS,IAAIrN,GAAM,QAASpI,KAAKyH,SAASsN,cAAc1J,SACxDqK,SAAW,IAAItN,GAAM,SAAUpI,KAAKyH,cACpCkO,OAAS,IAAIvN,GAAM,QAASpI,KAAKyH,cACjCmO,QAAU,IAAIxN,GAAM,SAAUpI,KAAKyH,SAASsN,cAAclH,SAC1DgI,SAAW,IAAIzN,GAAM,UAAWpI,KAAKyH,cACrCqO,QAAU,IAAI1N,GAAM,SAAUpI,KAAKyH,cACnCsO,SAAW,IAAI3N,GAAM,UAAWpI,KAAKyH,6CAO9C,SAAWA,QACFA,QAAUA,4BAGnB,kBACWzH,KAAKyH,qCAThB,oBACe6N,6BAAaxW"} \ No newline at end of file diff --git a/dist/cjs/fleetbase.js b/dist/cjs/fleetbase.js index 88f9437..5e620bc 100644 --- a/dist/cjs/fleetbase.js +++ b/dist/cjs/fleetbase.js @@ -1,2 +1,2 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("axios");function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}require("date-fns");var n=e(t);function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n3&&void 0!==arguments[3]?arguments[3]:[];if(E(t))if(r.length<=6e4)t.splice.apply(t,[e,n].concat(w(r)));else{t.splice(e,n);for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:0,r=t.length,i=n;i2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3?arguments[3]:void 0,i=t.length;n<0&&(n+=i);var o=r&&e!=e?function(t){return t!=t}:function(t){return t===e};return P(t,o,n)},L=function(t,e,n){return $(t,e,0,[n]),n},N=function(t){v(n,y(Array));var e=k(n);function n(){for(var t=arguments.length,r=new Array(t),i=0;i0}},{key:"empty",get:function(){return 0===this.length}},{key:"first",get:function(){return S(this,0)}},{key:"last",get:function(){return S(this,this.length-1)}},{key:"replace",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return $(this,t,e,n),this}},{key:"objectsAt",value:function(t){var e=this;return t.map((function(t){return S(e,t)}))}},{key:"objectAt",value:function(t){return S(this,t)}},{key:"indexOf",value:function(t,e){return C(this,t,e,!1)}},{key:"lastIndexOf",value:function(t,e){var n=this.length;(void 0===e||e>=n)&&(e=n-1),e<0&&(e+=n);for(var r=e;r>=0;r--)if(S(this,r)===t)return r;return-1}},{key:"includes",value:function(t,e){return-1!==C(this,t,e,!0)}},{key:"findBy",value:function(){return F(this,_.apply(void 0,arguments))}},{key:"findIndexBy",value:function(){return P(this,_.apply(void 0,arguments))}},{key:"isEvery",value:function(){return D(this,_.apply(void 0,arguments))}},{key:"isAny",value:function(){return z(this,_.apply(void 0,arguments))}},{key:"invoke",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:j,n=[],r=new Set,i="function"==typeof e?e:function(t){return get(t,e)};return t.forEach((function(t){var e=i(t);r.has(e)||(r.add(e),n.push(t))})),n}(this,t)}},{key:"without",value:function(t){if(!this.includes(t))return this;var e=t==t?function(e){return e!==t}:function(t){return t==t};return this.filter(e)}},{key:"clear",value:function(){var t=this.length;return 0===t||this.replace(0,t,[]),this}},{key:"insertAt",value:function(t,e){return L(this,t,e),this}},{key:"replaceAt",value:function(t,e){return this.replace(t,1,[e])}},{key:"removeAt",value:function(t,e){return function(t,e){return $(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,[]),t}(this,t,e)}},{key:"pushObject",value:function(t){return this.insertAt(this.length,t)}},{key:"pushObjects",value:function(t){return this.replace(this.length,0,t),this}},{key:"popObject",value:function(){var t=this.length;if(0===t)return null;var e=S(this,t-1);return this.removeAt(t-1,1),e}},{key:"shiftObject",value:function(){if(0===this.length)return null;var t=S(this,0);return this.removeAt(0),t}},{key:"unshiftObject",value:function(t){return L(this,0,t)}},{key:"unshiftObjects",value:function(t){return this.replace(0,0,t),this}},{key:"reverseObjects",value:function(){var t=this.length;if(0===t)return this;var e=this.toArray().reverse();return this.replace(0,t,e),this}},{key:"setObjects",value:function(t){if(0===t.length)return this.clear();var e=this.length;return this.replace(0,e,t),this}},{key:"removeObject",value:function(t){for(var e=this.length||0;--e>=0;){S(this,e)===t&&this.removeAt(e)}return this}},{key:"removeObjects",value:function(t){for(var e=t.length-1;e>=0;e--)this.removeObject(t[e]);return this}},{key:"addObject",value:function(t){return this.includes(t)||this.pushObject(t),this}},{key:"addObjects",value:function(t){var e=this;return t.forEach((function(t){return e.addObject(t)})),this}}]),n}(),T=function(t){var e=null==t;if(e)return e;if("number"==typeof t.size)return!t.size;var n=o(t);if("object"===n){var r=t.size;if("number"==typeof r)return!r}if("number"==typeof t.length&&"function"!==n)return!t.length;if("object"===n){var i=t.length;if("number"==typeof i)return!i}return!1},q=function(t){return T(t)||"string"==typeof t&&!1===/\S/.test(t)};function B(t){return t instanceof Z}var U=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^[+]?[\s./0-9]*[(]?[0-9]{1,4}[)]?[-\s./0-9]*$/g.test(t)},I=function(){var t,e,n,r,i;return!("undefined"==typeof process||"object"!==o(null===(t=process)||void 0===t?void 0:t.env)&&-1===(null===(e=process.release)||void 0===e||null===(n=e.name)||void 0===n?void 0:n.search(/node|io.js/))||"undefined"!=typeof window&&"ReactNative"!==(null===(r=window)||void 0===r||null===(i=r.navigator)||void 0===i?void 0:i.product))},J=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return I()?Rt("adapter","NodeAdapter",t):Rt("adapter","BrowserAdapter",t)},W=Array.isArray,M=function(){function t(e){u(this,t),this.place=e,this.geometry=null==e?void 0:e.geometry,this.components=this.parseComponents(),this.attributes=this.parseProperties()}return h(t,[{key:"parse",value:function(){this.parseComponents(),this.parseProperties()}},{key:"parseComponents",value:function(){var t;return((null===(t=this.place)||void 0===t?void 0:t.address_components)||[]).reduce((function(t,e){return e.types.forEach((function(n){t[n]=e})),t}),{})}},{key:"parseProperties",value:function(){var t,e={streetNumber:this.get("street_number"),streetName:this.get("route"),coordinates:null!==(t=this.geometry)&&void 0!==t&&t.location?Object.values(this.geometry.location):[0,0],city:this.or(["locality","sublocality","sublocality_level_1","neighborhood","administrative_area_level_3","administrative_area_level_2"]),county:this.get("administrative_area_level_2"),stateShort:this.get("administrative_area_level_1",!0),stateLong:this.get("administrative_area_level_1"),countryShort:this.get("country",!0),country:this.get("country",!0),countryLong:this.get("country"),postalCode:this.get("postal_code")};return e.address=[e.streetNumber,e.streetName].filter(Boolean).join(" "),e}},{key:"all",value:function(){return this.attributes}},{key:"or",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=0;e1&&void 0!==arguments[1]&&arguments[1];return t in this.components?e?this.components[t].short_name:this.components[t].long_name:null}},{key:"setAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.attributes=i(i({},this.attributes),t),this}},{key:"setAttribute",value:function(t,e){return this.attributes[t]=e,this}},{key:"getAttribute",value:function(t){return this.attributes[t]||null}}]),t}(),H=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;u(this,t),this.type="Point",this.coordinates=[n,e]}return h(t,[{key:"latitude",get:function(){return this.coordinates[1]}},{key:"longitude",get:function(){return this.coordinates[0]}},{key:"lat",value:function(){return this.latitude}},{key:"lng",value:function(){return this.longitude}},{key:"serialize",value:function(){return{type:"Point",coorindates:[this.lat(),this.lng()]}}},{key:"toJson",value:function(){return this.serialize()}},{key:"toString",value:function(){return"(".concat(this.latitude,", ").concat(this.longitude,")")}}],[{key:"fromGeoJson",value:function(e){var n=m(e.coordinates,2);return longitude=n[0],latitude=n[1],new t(latitude,longitude)}}]),t}();"undefined"==typeof arguments||arguments;var K=function(t,e){var n=t();return Array.isArray(n)||"object"===o(n)?G(n,e):null},G=function t(e,n){var r,i=e,s=o(e),a="object"===s,u="function"===s,c=Array.isArray(e),h="string"===o(n)&&n.includes(".")?n.split("."):[n];if(c||a){for(var l=0;l0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;u(this,t),this.actions=e,this.bind=n}return h(t,[{key:"extend",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=t||this.bind;if(!e)return this;if(null!=this&&this.actions&&"object"===o(this.actions))for(var n in this.actions){var r=this.actions[n];"function"==typeof r?Q(e,n,r.bind(e)):Q(e,n,r)}return this}}]),t}(),Z=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};u(this,t),this.attributes=e,this.dirtyAttributes={},this.changes={},this.isLoading=!1,this.isSaving=!1,this.isDestroying=!1,this.isReloading=!1,this.resource=r,this.options=i,this.version=i.version||"v1",this.setAdapter(n)}return h(t,[{key:"setAdapter",value:function(t){var e;return this.adapter=t,this.store=new jt(this.resource,t,{onAfterFetch:this.syncAttributes.bind(this),actions:null===(e=this.options)||void 0===e?void 0:e.actions}),this}},{key:"id",get:function(){return this.getAttribute("id")}},{key:"create",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.mergeAttributes(e);return this.setFlags(["isLoading","isSaving"]),this.store.create(n).then((function(e){return t.setFlags(["isLoading","isSaving"],!1),e}))}},{key:"update",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.setFlags(["isLoading","isSaving"]),this.store.update(this.attributes.id,e).then((function(e){return t.setFlags(["isLoading","isSaving"],!1),e}))}},{key:"destroy",value:function(){var t=this;return this.setFlags(["isLoading","isDestroying"]),this.store.destroy(this.attributes.id).then((function(e){return t.setFlags(["isLoading","isDestroying"],!1),e}))}},{key:"reload",value:function(){var t=this;return this.setFlags(["isLoading","isReloading"]),this.store.findRecord(this.attributes.id).then((function(e){return t.reset(),e}))}},{key:"setFlags",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=["isLoading","isSaving","isReloading","isDestroying"],r=0;r0&&void 0!==arguments[0]?arguments[0]:{},e=this.getAttributes();return T(this.id)?this.create(e):!0===t.onlyDirty?this.savedirty():this.update(e)}},{key:"saveDirty",value:function(){for(var t=Object.keys(this.dirtyAttributes),e={},n=0;n0}},{key:"mutate",value:function(t,e){this.attributes[t]=e}},{key:"setAttribute",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(null===n&&"object"===o(t))return this.setAttributes(t);var r=null!==(e=null==this?void 0:this.attributes[t])&&void 0!==e?e:null;return Q(this.attributes,t,n),Q(this.dirtyAttributes,t,r),E(null==this?void 0:this.changes[t])||(this.changes[t]=[]),this.changes[t].push({property:t,previousValue:r,value:n,changedAt:new Date}),this}},{key:"setAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var e in t)this.setAttribute(e,t[e]);return this}},{key:"getAttribute",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=G(null!==(e=null==this?void 0:this.attributes)&&void 0!==e?e:{},t);return void 0===r?n:r}},{key:"hasAttribute",value:function(t){if(E(t)){var e,n=t,r=Object.keys(null!==(e=this.attributes)&&void 0!==e?e:{});return n.every((function(t){return r.includes(t)}))}return!(null==this||!this.attributes)&&t in this.attributes}},{key:"hasAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.hasAttribute(t)}},{key:"isAttributeFilled",value:function(t){var e=this;return E(t)?this.hasAttribute(t)&&t.every((function(t){return!T(e.getAttribute(t))})):this.hasAttribute(t)&&!T(this.getAttribute(t))}},{key:"getAttributes",value:function(t){var e={};if(null==t)return this.getAttributes(Object.keys(this.attributes));if("string"==typeof t)return this.getAttribute(Array.prototype.slice.call(arguments));if(!E(t))throw new Error("No attribute properties provided!");for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=null!==(t=null==this?void 0:this.attributes)&&void 0!==t?t:{};return this.attributes=i(i({},n),e),this.attributes}},{key:"syncAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.attributes=t}}]),t}(),Y=new V({getDistanceAndTime:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.get("".concat(this.namespace,"/").concat(t,"/distance-and-time"),e,n)},getNextActivity:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.get("".concat(this.namespace,"/").concat(t,"/next-activity"),e,n)},dispatch:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/dispatch"),e,n).then(this.afterFetch.bind(this))},start:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/start"),e,n).then(this.afterFetch.bind(this))},updateActivity:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/update-activity"),e,n).then(this.afterFetch.bind(this))},setDestination:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return B(e)&&(e=e.id),this.adapter.post("".concat(this.namespace,"/").concat(t,"/set-destination/").concat(e),n,r).then(this.afterFetch.bind(this))},captureQrCode:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return B(e)&&(e=e.id),this.adapter.post("".concat(this.namespace,"/").concat(t,"/capture-qr").concat(e?"/"+e:""),n,r)},captureSignature:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return B(e)&&(e=e.id),this.adapter.post("".concat(this.namespace,"/").concat(t,"/capture-signature").concat(e?"/"+e:""),n,r)},complete:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/complete"),e,n).then(this.afterFetch.bind(this))},cancel:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.delete("".concat(this.namespace,"/").concat(t,"/cancel"),e,n).then(this.afterFetch.bind(this))}}),X=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"order",i({actions:Y},o))}return h(n,[{key:"getDistanceAndTime",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.getDistanceAndTime(this.id,t,e)}},{key:"dispatch",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.dispatch(this.id,t,e)}},{key:"start",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.start(this.id,t,e)}},{key:"setDestination",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.store.setDestination(this.id,t,e,n)}},{key:"captureQrCode",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.store.captureQrCode(this.id,t,e,n)}},{key:"captureSignature",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.store.captureSignature(this.id,t,e,n)}},{key:"getNextActivity",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.getNextActivity(this.id,t,e)}},{key:"updateActivity",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.updateActivity(this.id,t,e)}},{key:"cancel",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.cancel(this.id,t,e)}},{key:"complete",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.complete(this.id,t,e)}},{key:"isDispatched",get:function(){return null!==this.getAttribute("dispatched_at")}},{key:"isNotDispatched",get:function(){return null==this.getAttribute("dispatched_at")}},{key:"isStarted",get:function(){return null!==this.getAttribute("started_at")}},{key:"isNotStarted",get:function(){return null==this.getAttribute("started_at")}},{key:"isCompleted",get:function(){return"completed"==this.getAttribute("status")}},{key:"isCanceled",get:function(){return"canceled"==this.getAttribute("status")}},{key:"isEnroute",get:function(){return"driver_enroute"==this.getAttribute("status")||"enroute"===this.getAttribute("status")}},{key:"isInProgress",get:function(){return this.isStarted&&!this.isCanceled&&!this.isCompleted}},{key:"scheduledAt",get:function(){return this.isAttributeFilled("scheduled_at")?new Date(this.getAttribute("scheduled_at")):null}},{key:"startedAt",get:function(){return this.isAttributeFilled("started_at")?new Date(this.getAttribute("started_at")):null}},{key:"dispatchedAt",get:function(){return this.isAttributeFilled("dispatched_at")?new Date(this.getAttribute("dispatched_at")):null}},{key:"status",get:function(){return this.getAttribute("status")}}]),n}(),tt=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"payload",i)}return h(n,[{key:"attach",value:function(t){}},{key:"entities",get:function(){}},{key:"dropoff",get:function(){}},{key:"pickup",get:function(){}},{key:"waypoints",get:function(){return new N(this.waypoints)}}]),n}(),et=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"entity",i)}return n}(),nt=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"place",i)}return h(n,[{key:"latitude",get:function(){var t;return null===(t=this.getAttribute("location",new H))||void 0===t?void 0:t.coordinates[1]}},{key:"longitude",get:function(){var t;return null===(t=this.getAttribute("location",new H))||void 0===t?void 0:t.coordinates[0]}},{key:"coordinates",get:function(){return[this.latitude,this.longitude]}},{key:"setOwner",value:function(t){return B(t)&&this.setAttribute("owner",t.id),"string"==typeof t&&this.setAttribute("owner",t),this}}],[{key:"fromGoogleAddress",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.getAttribute("coordinates"),o=m(i,2),s=o[0],a=o[1],u={name:null,address:t.getAttribute("address"),location:new H(s,a),street1:t.getAttribute("streetName"),street2:null,city:t.getAttribute("city"),province:t.getAttribute("stateLong"),postal_code:t.getAttribute("postalCode"),neighborhood:t.get("neighborhood"),district:t.getAttribute("county"),building:t.get("building"),country:t.getAttribute("countryShort"),phone:null,security_access_code:null};return new n(u,e,r)}}]),n}(),rt=function(t){v(n,nt);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"waypoint",i)}return n}(),it=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"tracking-status",i)}return n}(),ot=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"vehicle",i)}return n}(),st=new V({login:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(U(t))return this.adapter.post("drivers/login-with-sms",{phone:t});if(!e)throw new Error("Login requires password!");return this.adapter.post("drivers/login",i({identity:t,password:e},n)).then(this.afterFetch.bind(this))},verifyCode:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("drivers/verify-code",i({identity:t,code:e},n)).then(this.afterFetch.bind(this))},track:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("drivers/".concat(t,"/track"),e,n).then(this.afterFetch.bind(this))},retrieve:function(t){return this.findRecord(t)},syncDevice:function(t){return this.adapter.setHeaders({"Driver-Token":this.token}).post("drivers/register-device",t)}}),at=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"driver",i({actions:st},o))}return h(n,[{key:"latitude",get:function(){var t;return null===(t=this.getAttribute("location",new Point))||void 0===t?void 0:t.coordinates[1]}},{key:"longitude",get:function(){var t;return null===(t=this.getAttribute("location",new Point))||void 0===t?void 0:t.coordinates[0]}},{key:"coordinates",get:function(){return[this.latitude,this.longitude]}},{key:"token",get:function(){return this.getAttribute("token")}},{key:"isOnline",get:function(){return!0===this.getAttribute("online")}},{key:"track",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.track(this.id,t,e)}},{key:"syncDevice",value:function(t){return this.store.syncDevice(t)}}]),n}(),ut=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"vendor",i)}return n}(),ct=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"contact",i)}return n}(),ht=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"zone",i)}return n}(),lt=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"service-area",i)}return n}(),vt=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"service-rate",i)}return n}(),dt=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"service-quote",i)}return h(n,[{key:"fromPreliminary",value:function(){}},{key:"fromPayload",value:function(){}}]),n}(),ft=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u(this,t),this.version=e.version||"v1",this.host=e.host||null,this.namespace=e.namespace||null,this.headers=e.headers||{}},gt=function(t){v(n,ft);var e=k(n);function n(t){var r;return u(this,n),(r=e.call(this,t)).setHeaders({Authorization:"Bearer ".concat(t.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;browser"}),r}return h(n,[{key:"setHeaders",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.headers=i(i({},this.headers),t),this}},{key:"parseJSON",value:function(t){return new Promise((function(e,n){return t.json().then((function(n){return e({statusText:t.statusText,status:t.status,ok:t.ok,json:n})})).catch((function(){n(new Error("Oops! Something went wrong when handling your request."))}))}))}},{key:"request",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise((function(s,a){return fetch(o.url||"".concat(e.host,"/").concat(e.namespace,"/").concat(t),i({method:n,mode:o.mode||"cors",headers:new Headers(i(i({},e.headers||{}),o.headers||{}))},r)).then(e.parseJSON).then((function(t){return t.ok?s(t.json):a(new Error(t.json.errors?t.json.errors[0]:t.statusText))})).catch((function(t){a(t)}))}))}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=q(e)?"":new URLSearchParams(e).toString();return this.request("".concat(t).concat(r?"?".concat(r):""),"GET",{},n)}},{key:"post",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"POST",{body:JSON.stringify(e)},n)}},{key:"put",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"PUT",{body:JSON.stringify(e)},n)}},{key:"delete",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.request(t,"DELETE",{},e)}},{key:"patch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"PATCH",{body:JSON.stringify(e)},n)}}]),n}(),pt=function(t){v(r,ft);var e=k(r);function r(t){var i;return u(this,r),(i=e.call(this,t)).axios=n.default.create({baseURL:"".concat(i.host,"/").concat(i.namespace),headers:{Authorization:"Bearer ".concat(t.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;node"}}),i}return h(r,[{key:"setHeaders",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.axios.defaults.headers.common;return this.axios.defaults.headers.common=i(i({},e),t),this}},{key:"transform",value:function(t){return t.data}},{key:"handleError",value:function(t){if(t.response){var e=t.response.data;if(E(e.errors))throw new Error(e.errors[0]);if(e.error)throw new Error(e.error)}throw t}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=q(e)?"":new URLSearchParams(e).toString();return this.axios.get("".concat(t).concat(r?"?".concat(r):""),n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"post",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.post(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"put",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.put(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"delete",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.axios.delete(t,e).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"patch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.patch(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}}]),r}(),yt=function(t){v(n,ft);var e=k(n);function n(){return u(this,n),e.apply(this,arguments)}return n}(),bt=function(){function t(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];u(this,t),l(this,"uncountableWords",["equipment","information","rice","money","species","series","fish","sheep","moose","deer","news"]),l(this,"pluralRules",[[new RegExp("(m)an$","gi"),"$1en"],[new RegExp("(pe)rson$","gi"),"$1ople"],[new RegExp("(child)$","gi"),"$1ren"],[new RegExp("^(ox)$","gi"),"$1en"],[new RegExp("(ax|test)is$","gi"),"$1es"],[new RegExp("(octop|vir)us$","gi"),"$1i"],[new RegExp("(alias|status)$","gi"),"$1es"],[new RegExp("(bu)s$","gi"),"$1ses"],[new RegExp("(buffal|tomat|potat)o$","gi"),"$1oes"],[new RegExp("([ti])um$","gi"),"$1a"],[new RegExp("sis$","gi"),"ses"],[new RegExp("(?:([^f])fe|([lr])f)$","gi"),"$1$2ves"],[new RegExp("(hive)$","gi"),"$1s"],[new RegExp("([^aeiouy]|qu)y$","gi"),"$1ies"],[new RegExp("(x|ch|ss|sh)$","gi"),"$1es"],[new RegExp("(matr|vert|ind)ix|ex$","gi"),"$1ices"],[new RegExp("([m|l])ouse$","gi"),"$1ice"],[new RegExp("(quiz)$","gi"),"$1zes"],[new RegExp("s$","gi"),"s"],[new RegExp("$","gi"),"s"]]),l(this,"singularRules",[[new RegExp("(m)en$","gi"),"$1an"],[new RegExp("(pe)ople$","gi"),"$1rson"],[new RegExp("(child)ren$","gi"),"$1"],[new RegExp("([ti])a$","gi"),"$1um"],[new RegExp("((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$","gi"),"$1$2sis"],[new RegExp("(hive)s$","gi"),"$1"],[new RegExp("(tive)s$","gi"),"$1"],[new RegExp("(curve)s$","gi"),"$1"],[new RegExp("([lr])ves$","gi"),"$1f"],[new RegExp("([^fo])ves$","gi"),"$1fe"],[new RegExp("([^aeiouy]|qu)ies$","gi"),"$1y"],[new RegExp("(s)eries$","gi"),"$1eries"],[new RegExp("(m)ovies$","gi"),"$1ovie"],[new RegExp("(x|ch|ss|sh)es$","gi"),"$1"],[new RegExp("([m|l])ice$","gi"),"$1ouse"],[new RegExp("(bus)es$","gi"),"$1"],[new RegExp("(o)es$","gi"),"$1"],[new RegExp("(shoe)s$","gi"),"$1"],[new RegExp("(cris|ax|test)es$","gi"),"$1is"],[new RegExp("(octop|vir)i$","gi"),"$1us"],[new RegExp("(alias|status)es$","gi"),"$1"],[new RegExp("^(ox)en","gi"),"$1"],[new RegExp("(vert|ind)ices$","gi"),"$1ex"],[new RegExp("(matr)ices$","gi"),"$1ix"],[new RegExp("(quiz)zes$","gi"),"$1"],[new RegExp("s$","gi"),""]]),l(this,"nonTitlecasedWords",["and","or","nor","a","an","the","so","but","to","of","at","by","from","into","on","onto","off","out","in","over","with","for"]),l(this,"idSuffix",new RegExp("(_ids|_id)$","g")),l(this,"underbar",new RegExp("_","g")),l(this,"spaceOrUnderbar",new RegExp("[ _]","g")),l(this,"uppercase",new RegExp("([A-Z])","g")),l(this,"underbarPrefix",new RegExp("^_")),this.str=e,this.chain=n}return h(t,[{key:"get",value:function(){return this.str}},{key:"applyRules",value:function(t,e,n,r){if(r)t=r;else if(!(n.indexOf(t.toLowerCase())>-1))for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:null;return t=t||this.str,this.applyRules(t,this.pluralRules,this.uncountableWords,e)}},{key:"singularize",value:function(t,e){return t=t||this.str,this.applyRules(t,this.singularRules,this.uncountableWords,e)}},{key:"camelize",value:function(t,e){for(var n=(t=t||this.str).split("/"),r=0;r1&&void 0!==arguments[1]&&arguments[1];return t=t||this.str,t=this.underscore(this.demodulize(t))+(e?"":"_")+"id",this.str=t,!0===this.chain?this:t}},{key:"ordinalize",value:function(t){for(var e=(t=t||this.str).split(" "),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];if(t.actions=E(e)?e:[e],!E(e))return e instanceof V&&e.extend(t),t;for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{};u(this,t),this.resource=e,this.adapter=n||J(),this.namespace=kt(e),this.storage=new N,this.options=r,this.extendActions(r.actions)}return h(t,[{key:"extendActions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return $t(this,t)}},{key:"deposit",value:function(t){return t}},{key:"serialize",value:function(t){return Rt("resource",wt(this.resource),t,this.adapter)}},{key:"afterFetch",value:function(t){return function(t,e){if("function"==typeof t.options.onAfterFetch&&t.options.onAfterFetch(e),E(e)){for(var n=[],r=0;r0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var r=a(regeneratorRuntime.mark((function r(i,o){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.adapter.post("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=r.sent,i(s);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"update",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(function(){var i=a(regeneratorRuntime.mark((function i(o,s){var a;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,e.adapter.put("".concat(e.namespace,"/").concat(t),n,r).then(e.afterFetch.bind(e)).catch(s);case 2:a=i.sent,o(a);case 4:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}())}},{key:"findRecord",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var r=a(regeneratorRuntime.mark((function r(i,o){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e.adapter.get("".concat(e.namespace,"/").concat(t),{},n).then(e.afterFetch.bind(e)).catch(o);case 2:s=r.sent,i(s);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"findAll",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(){var n=a(regeneratorRuntime.mark((function n(r,i){var o;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.adapter.get("".concat(t.namespace),{},e).then(t.afterFetch.bind(t)).catch(i);case 2:o=n.sent,r(o);case 4:case"end":return n.stop()}}),n)})));return function(t,e){return n.apply(this,arguments)}}())}},{key:"query",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var r=a(regeneratorRuntime.mark((function r(i,o){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.adapter.get("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=r.sent,i(s);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"queryRecord",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.single=!0,new Promise(function(){var r=a(regeneratorRuntime.mark((function r(i,o){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.adapter.get("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=r.sent,i(s);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"destroy",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=B(t)?t.getAttribute("id"):t;return new Promise(function(){var t=a(regeneratorRuntime.mark((function t(i,o){var s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.adapter.delete("".concat(e.namespace,"/").concat(r),{},n).then(e.afterFetch.bind(e)).catch(o);case 2:s=t.sent,i(s);case 4:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}())}}]),t}(),Ot=function(){function t(e){var n,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(u(this,t),this.version=null!==(n=o.version)&&void 0!==n?n:"v1",this.options={version:this.version,host:null!==(r=o.host)&&void 0!==r?r:"https://api.fleetbase.io",namespace:null!==(i=o.namespace)&&void 0!==i?i:this.version,debug:s,publicKey:e},"string"!=typeof e||0===e.length)throw new Error("⚠️ Invalid public key given to Fleetbase SDK");if(!I()&&e.toLowerCase().startsWith("$"))throw new Error("Secret key provided. You must use a public key with Fleetbase Javascript SDK!");this.adapter=o.adapter||J(this.options),this.orders=new jt("order",this.adapter).extendActions(Y),this.entities=new jt("entity",this.adapter),this.places=new jt("place",this.adapter),this.drivers=new jt("driver",this.adapter).extendActions(st),this.vehicles=new jt("vehicle",this.adapter),this.vendors=new jt("vendor",this.adapter),this.contacts=new jt("contact",this.adapter)}return h(t,[{key:"setAdapter",value:function(t){this.adapter=t}},{key:"getAdapter",value:function(){return this.adapter}}],[{key:"newInstance",value:function(){return p(t,Array.prototype.slice.call(arguments))}}]),t}();exports.Adapter=ft,exports.BrowserAdapter=gt,exports.Collection=N,exports.Contact=ct,exports.Driver=at,exports.EmberJsAdapter=yt,exports.Entity=et,exports.GoogleAddress=M,exports.NodeAdapter=pt,exports.Order=X,exports.Payload=tt,exports.Place=nt,exports.Point=H,exports.Resource=Z,exports.ServiceArea=lt,exports.ServiceQuote=dt,exports.ServiceRate=vt,exports.Store=jt,exports.StoreActions=V,exports.TrackingStatus=it,exports.Vehicle=ot,exports.Vendor=ut,exports.Waypoint=rt,exports.Zone=ht,exports.camelize=function(){var t=["camelize"].concat(Array.prototype.slice.call(arguments));return bt.invoke.apply(bt,w(t))},exports.classify=wt,exports.dasherize=function(){var t=["dasherize"].concat(Array.prototype.slice.call(arguments));return bt.invoke.apply(bt,w(t))},exports.default=Ot,exports.extendStoreActions=$t,exports.isLatitude=function(t){return isFinite(t)&&Math.abs(t)<=90},exports.isLongitude=function(t){return isFinite(t)&&Math.abs(t)<=180&&Math.abs(t)>=90},exports.isNodeEnvironment=I,exports.isResource=B,exports.pluralize=kt,exports.singularize=mt; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("axios");function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}require("date-fns");var n=e(t);function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n3&&void 0!==arguments[3]?arguments[3]:[];if(E(t))if(r.length<=6e4)t.splice.apply(t,[e,n].concat(w(r)));else{t.splice(e,n);for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:0,r=t.length,i=n;i2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3?arguments[3]:void 0,i=t.length;n<0&&(n+=i);var o=r&&e!=e?function(t){return t!=t}:function(t){return t===e};return P(t,o,n)},L=function(t,e,n){return $(t,e,0,[n]),n},N=function(t){v(n,y(Array));var e=k(n);function n(){for(var t=arguments.length,r=new Array(t),i=0;i0}},{key:"empty",get:function(){return 0===this.length}},{key:"first",get:function(){return S(this,0)}},{key:"last",get:function(){return S(this,this.length-1)}},{key:"replace",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return $(this,t,e,n),this}},{key:"objectsAt",value:function(t){var e=this;return t.map((function(t){return S(e,t)}))}},{key:"objectAt",value:function(t){return S(this,t)}},{key:"indexOf",value:function(t,e){return C(this,t,e,!1)}},{key:"lastIndexOf",value:function(t,e){var n=this.length;(void 0===e||e>=n)&&(e=n-1),e<0&&(e+=n);for(var r=e;r>=0;r--)if(S(this,r)===t)return r;return-1}},{key:"includes",value:function(t,e){return-1!==C(this,t,e,!0)}},{key:"findBy",value:function(){return F(this,_.apply(void 0,arguments))}},{key:"findIndexBy",value:function(){return P(this,_.apply(void 0,arguments))}},{key:"isEvery",value:function(){return D(this,_.apply(void 0,arguments))}},{key:"isAny",value:function(){return z(this,_.apply(void 0,arguments))}},{key:"invoke",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:j,n=[],r=new Set,i="function"==typeof e?e:function(t){return get(t,e)};return t.forEach((function(t){var e=i(t);r.has(e)||(r.add(e),n.push(t))})),n}(this,t)}},{key:"without",value:function(t){if(!this.includes(t))return this;var e=t==t?function(e){return e!==t}:function(t){return t==t};return this.filter(e)}},{key:"clear",value:function(){var t=this.length;return 0===t||this.replace(0,t,[]),this}},{key:"insertAt",value:function(t,e){return L(this,t,e),this}},{key:"replaceAt",value:function(t,e){return this.replace(t,1,[e])}},{key:"removeAt",value:function(t,e){return function(t,e){return $(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,[]),t}(this,t,e)}},{key:"pushObject",value:function(t){return this.insertAt(this.length,t)}},{key:"pushObjects",value:function(t){return this.replace(this.length,0,t),this}},{key:"popObject",value:function(){var t=this.length;if(0===t)return null;var e=S(this,t-1);return this.removeAt(t-1,1),e}},{key:"shiftObject",value:function(){if(0===this.length)return null;var t=S(this,0);return this.removeAt(0),t}},{key:"unshiftObject",value:function(t){return L(this,0,t)}},{key:"unshiftObjects",value:function(t){return this.replace(0,0,t),this}},{key:"reverseObjects",value:function(){var t=this.length;if(0===t)return this;var e=this.toArray().reverse();return this.replace(0,t,e),this}},{key:"setObjects",value:function(t){if(0===t.length)return this.clear();var e=this.length;return this.replace(0,e,t),this}},{key:"removeObject",value:function(t){for(var e=this.length||0;--e>=0;){S(this,e)===t&&this.removeAt(e)}return this}},{key:"removeObjects",value:function(t){for(var e=t.length-1;e>=0;e--)this.removeObject(t[e]);return this}},{key:"addObject",value:function(t){return this.includes(t)||this.pushObject(t),this}},{key:"addObjects",value:function(t){var e=this;return t.forEach((function(t){return e.addObject(t)})),this}}]),n}(),T=function(t){var e=null==t;if(e)return e;if("number"==typeof t.size)return!t.size;var n=o(t);if("object"===n){var r=t.size;if("number"==typeof r)return!r}if("number"==typeof t.length&&"function"!==n)return!t.length;if("object"===n){var i=t.length;if("number"==typeof i)return!i}return!1},q=function(t){return T(t)||"string"==typeof t&&!1===/\S/.test(t)};function B(t){return t instanceof Z}var U=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^[+]?[\s./0-9]*[(]?[0-9]{1,4}[)]?[-\s./0-9]*$/g.test(t)},I=function(){var t,e,n,r,i;return!("undefined"==typeof process||"object"!==o(null===(t=process)||void 0===t?void 0:t.env)&&-1===(null===(e=process.release)||void 0===e||null===(n=e.name)||void 0===n?void 0:n.search(/node|io.js/))||"undefined"!=typeof window&&"ReactNative"!==(null===(r=window)||void 0===r||null===(i=r.navigator)||void 0===i?void 0:i.product))},J=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return I()?Rt("adapter","NodeAdapter",t):Rt("adapter","BrowserAdapter",t)},W=Array.isArray,M=function(){function t(e){u(this,t),this.place=e,this.geometry=null==e?void 0:e.geometry,this.components=this.parseComponents(),this.attributes=this.parseProperties()}return h(t,[{key:"parse",value:function(){this.parseComponents(),this.parseProperties()}},{key:"parseComponents",value:function(){var t;return((null===(t=this.place)||void 0===t?void 0:t.address_components)||[]).reduce((function(t,e){return e.types.forEach((function(n){t[n]=e})),t}),{})}},{key:"parseProperties",value:function(){var t,e={streetNumber:this.get("street_number"),streetName:this.get("route"),coordinates:null!==(t=this.geometry)&&void 0!==t&&t.location?Object.values(this.geometry.location):[0,0],city:this.or(["locality","sublocality","sublocality_level_1","neighborhood","administrative_area_level_3","administrative_area_level_2"]),county:this.get("administrative_area_level_2"),stateShort:this.get("administrative_area_level_1",!0),stateLong:this.get("administrative_area_level_1"),countryShort:this.get("country",!0),country:this.get("country",!0),countryLong:this.get("country"),postalCode:this.get("postal_code")};return e.address=[e.streetNumber,e.streetName].filter(Boolean).join(" "),e}},{key:"all",value:function(){return this.attributes}},{key:"or",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=0;e1&&void 0!==arguments[1]&&arguments[1];return t in this.components?e?this.components[t].short_name:this.components[t].long_name:null}},{key:"setAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.attributes=i(i({},this.attributes),t),this}},{key:"setAttribute",value:function(t,e){return this.attributes[t]=e,this}},{key:"getAttribute",value:function(t){return this.attributes[t]||null}}]),t}(),K=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;u(this,t),this.type="Point",this.coordinates=[n,e]}return h(t,[{key:"latitude",get:function(){return this.coordinates[1]}},{key:"longitude",get:function(){return this.coordinates[0]}},{key:"lat",value:function(){return this.latitude}},{key:"lng",value:function(){return this.longitude}},{key:"serialize",value:function(){return{type:"Point",coorindates:[this.lat(),this.lng()]}}},{key:"toJson",value:function(){return this.serialize()}},{key:"toString",value:function(){return"(".concat(this.latitude,", ").concat(this.longitude,")")}}],[{key:"fromGeoJson",value:function(e){var n=m(e.coordinates,2);return longitude=n[0],latitude=n[1],new t(latitude,longitude)}}]),t}();"undefined"==typeof arguments||arguments;var G=function(t,e){var n=t();return Array.isArray(n)||"object"===o(n)?H(n,e):null},H=function t(e,n){var r,i=e,s=o(e),a="object"===s,u="function"===s,c=Array.isArray(e),h="string"===o(n)&&n.includes(".")?n.split("."):[n];if(c||a){for(var l=0;l0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;u(this,t),this.actions=e,this.bind=n}return h(t,[{key:"extend",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=t||this.bind;if(!e)return this;if(null!=this&&this.actions&&"object"===o(this.actions))for(var n in this.actions){var r=this.actions[n];"function"==typeof r?Q(e,n,r.bind(e)):Q(e,n,r)}return this}}]),t}(),Z=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};u(this,t),this.attributes=e,this.dirtyAttributes={},this.changes={},this.isLoading=!1,this.isSaving=!1,this.isDestroying=!1,this.isReloading=!1,this.resource=r,this.options=i,this.version=i.version||"v1",this.setAdapter(n)}return h(t,[{key:"setAdapter",value:function(t){var e;return this.adapter=t,this.store=new jt(this.resource,t,{onAfterFetch:this.syncAttributes.bind(this),actions:null===(e=this.options)||void 0===e?void 0:e.actions}),this}},{key:"id",get:function(){return this.getAttribute("id")}},{key:"create",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.mergeAttributes(e);return this.setFlags(["isLoading","isSaving"]),this.store.create(n).then((function(e){return t.setFlags(["isLoading","isSaving"],!1),e}))}},{key:"update",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.setFlags(["isLoading","isSaving"]),this.store.update(this.attributes.id,e).then((function(e){return t.setFlags(["isLoading","isSaving"],!1),e}))}},{key:"destroy",value:function(){var t=this;return this.setFlags(["isLoading","isDestroying"]),this.store.destroy(this.attributes.id).then((function(e){return t.setFlags(["isLoading","isDestroying"],!1),e}))}},{key:"reload",value:function(){var t=this;return this.setFlags(["isLoading","isReloading"]),this.store.findRecord(this.attributes.id).then((function(e){return t.reset(),e}))}},{key:"setFlags",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=["isLoading","isSaving","isReloading","isDestroying"],r=0;r0&&void 0!==arguments[0]?arguments[0]:{},e=this.getAttributes();return T(this.id)?this.create(e):!0===t.onlyDirty?this.savedirty():this.update(e)}},{key:"saveDirty",value:function(){for(var t=Object.keys(this.dirtyAttributes),e={},n=0;n0}},{key:"mutate",value:function(t,e){this.attributes[t]=e}},{key:"setAttribute",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(null===n&&"object"===o(t))return this.setAttributes(t);var r=null!==(e=null==this?void 0:this.attributes[t])&&void 0!==e?e:null;return Q(this.attributes,t,n),Q(this.dirtyAttributes,t,r),E(null==this?void 0:this.changes[t])||(this.changes[t]=[]),this.changes[t].push({property:t,previousValue:r,value:n,changedAt:new Date}),this}},{key:"setAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var e in t)this.setAttribute(e,t[e]);return this}},{key:"getAttribute",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=H(null!==(e=null==this?void 0:this.attributes)&&void 0!==e?e:{},t);return void 0===r?n:r}},{key:"hasAttribute",value:function(t){if(E(t)){var e,n=t,r=Object.keys(null!==(e=this.attributes)&&void 0!==e?e:{});return n.every((function(t){return r.includes(t)}))}return!(null==this||!this.attributes)&&t in this.attributes}},{key:"hasAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.hasAttribute(t)}},{key:"isAttributeFilled",value:function(t){var e=this;return E(t)?this.hasAttribute(t)&&t.every((function(t){return!T(e.getAttribute(t))})):this.hasAttribute(t)&&!T(this.getAttribute(t))}},{key:"getAttributes",value:function(t){var e={};if(null==t)return this.getAttributes(Object.keys(this.attributes));if("string"==typeof t)return this.getAttribute(Array.prototype.slice.call(arguments));if(!E(t))throw new Error("No attribute properties provided!");for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=null!==(t=null==this?void 0:this.attributes)&&void 0!==t?t:{};return this.attributes=i(i({},n),e),this.attributes}},{key:"syncAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.attributes=t}}]),t}(),Y=new V({getDistanceAndTime:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.get("".concat(this.namespace,"/").concat(t,"/distance-and-time"),e,n)},getNextActivity:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.get("".concat(this.namespace,"/").concat(t,"/next-activity"),e,n)},dispatch:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/dispatch"),e,n).then(this.afterFetch.bind(this))},start:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/start"),e,n).then(this.afterFetch.bind(this))},updateActivity:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/update-activity"),e,n).then(this.afterFetch.bind(this))},setDestination:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return B(e)&&(e=e.id),this.adapter.post("".concat(this.namespace,"/").concat(t,"/set-destination/").concat(e),n,r).then(this.afterFetch.bind(this))},captureQrCode:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return B(e)&&(e=e.id),this.adapter.post("".concat(this.namespace,"/").concat(t,"/capture-qr").concat(e?"/"+e:""),n,r)},captureSignature:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return B(e)&&(e=e.id),this.adapter.post("".concat(this.namespace,"/").concat(t,"/capture-signature").concat(e?"/"+e:""),n,r)},complete:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/complete"),e,n).then(this.afterFetch.bind(this))},cancel:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.delete("".concat(this.namespace,"/").concat(t,"/cancel"),e,n).then(this.afterFetch.bind(this))}}),X=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"order",i({actions:Y},o))}return h(n,[{key:"getDistanceAndTime",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.getDistanceAndTime(this.id,t,e)}},{key:"dispatch",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.dispatch(this.id,t,e)}},{key:"start",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.start(this.id,t,e)}},{key:"setDestination",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.store.setDestination(this.id,t,e,n)}},{key:"captureQrCode",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.store.captureQrCode(this.id,t,e,n)}},{key:"captureSignature",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.store.captureSignature(this.id,t,e,n)}},{key:"getNextActivity",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.getNextActivity(this.id,t,e)}},{key:"updateActivity",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.updateActivity(this.id,t,e)}},{key:"cancel",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.cancel(this.id,t,e)}},{key:"complete",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.complete(this.id,t,e)}},{key:"isDispatched",get:function(){return null!==this.getAttribute("dispatched_at")}},{key:"isNotDispatched",get:function(){return null==this.getAttribute("dispatched_at")}},{key:"isStarted",get:function(){return null!==this.getAttribute("started_at")}},{key:"isNotStarted",get:function(){return null==this.getAttribute("started_at")}},{key:"isCompleted",get:function(){return"completed"==this.getAttribute("status")}},{key:"isCanceled",get:function(){return"canceled"==this.getAttribute("status")}},{key:"isEnroute",get:function(){return"driver_enroute"==this.getAttribute("status")||"enroute"===this.getAttribute("status")}},{key:"isInProgress",get:function(){return this.isStarted&&!this.isCanceled&&!this.isCompleted}},{key:"scheduledAt",get:function(){return this.isAttributeFilled("scheduled_at")?new Date(this.getAttribute("scheduled_at")):null}},{key:"startedAt",get:function(){return this.isAttributeFilled("started_at")?new Date(this.getAttribute("started_at")):null}},{key:"dispatchedAt",get:function(){return this.isAttributeFilled("dispatched_at")?new Date(this.getAttribute("dispatched_at")):null}},{key:"status",get:function(){return this.getAttribute("status")}}]),n}(),tt=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"payload",i)}return h(n,[{key:"attach",value:function(t){}},{key:"entities",get:function(){}},{key:"dropoff",get:function(){}},{key:"pickup",get:function(){}},{key:"waypoints",get:function(){return new N(this.waypoints)}}]),n}(),et=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"entity",i)}return n}(),nt=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"place",i)}return h(n,[{key:"latitude",get:function(){var t;return null===(t=this.getAttribute("location",new K))||void 0===t?void 0:t.coordinates[1]}},{key:"longitude",get:function(){var t;return null===(t=this.getAttribute("location",new K))||void 0===t?void 0:t.coordinates[0]}},{key:"coordinates",get:function(){return[this.latitude,this.longitude]}},{key:"setOwner",value:function(t){return B(t)&&this.setAttribute("owner",t.id),"string"==typeof t&&this.setAttribute("owner",t),this}}],[{key:"fromGoogleAddress",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.getAttribute("coordinates"),o=m(i,2),s=o[0],a=o[1],u={name:null,address:t.getAttribute("address"),location:new K(s,a),street1:t.getAttribute("streetName"),street2:null,city:t.getAttribute("city"),province:t.getAttribute("stateLong"),postal_code:t.getAttribute("postalCode"),neighborhood:t.get("neighborhood"),district:t.getAttribute("county"),building:t.get("building"),country:t.getAttribute("countryShort"),phone:null,security_access_code:null};return new n(u,e,r)}}]),n}(),rt=function(t){v(n,nt);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"waypoint",i)}return n}(),it=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"tracking-status",i)}return n}(),ot=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"vehicle",i)}return n}(),st=new V({login:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(U(t))return this.adapter.post("drivers/login-with-sms",{phone:t});if(!e)throw new Error("Login requires password!");return this.adapter.post("drivers/login",i({identity:t,password:e},n)).then(this.afterFetch.bind(this))},verifyCode:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("drivers/verify-code",i({identity:t,code:e},n)).then(this.afterFetch.bind(this))},track:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("drivers/".concat(t,"/track"),e,n).then(this.afterFetch.bind(this))},retrieve:function(t){return this.findRecord(t)},syncDevice:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("drivers/".concat(t,"/register-device"),e,n)}}),at=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"driver",i({actions:st},o))}return h(n,[{key:"token",get:function(){return this.getAttribute("token")}},{key:"isOnline",get:function(){return!0===this.getAttribute("online")}},{key:"latitude",get:function(){var t;return null===(t=this.getAttribute("location",new Point))||void 0===t?void 0:t.coordinates[1]}},{key:"longitude",get:function(){var t;return null===(t=this.getAttribute("location",new Point))||void 0===t?void 0:t.coordinates[0]}},{key:"coordinates",get:function(){return[this.latitude,this.longitude]}},{key:"track",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.track(this.id,t,e)}},{key:"syncDevice",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.syncDevice(this.id,t,e)}}]),n}(),ut=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"vendor",i)}return n}(),ct=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"contact",i)}return n}(),ht=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"zone",i)}return n}(),lt=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"service-area",i)}return n}(),vt=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"service-rate",i)}return n}(),dt=function(t){v(n,Z);var e=k(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"service-quote",i)}return h(n,[{key:"fromPreliminary",value:function(){}},{key:"fromPayload",value:function(){}}]),n}(),ft=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u(this,t),this.version=e.version||"v1",this.host=e.host||null,this.namespace=e.namespace||null,this.headers=e.headers||{}},gt=function(t){v(n,ft);var e=k(n);function n(t){var r;return u(this,n),(r=e.call(this,t)).setHeaders({Authorization:"Bearer ".concat(t.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;browser"}),r}return h(n,[{key:"setHeaders",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.headers=i(i({},this.headers),t),this}},{key:"parseJSON",value:function(t){return new Promise((function(e,n){return t.json().then((function(n){return e({statusText:t.statusText,status:t.status,ok:t.ok,json:n})})).catch((function(){n(new Error("Oops! Something went wrong when handling your request."))}))}))}},{key:"request",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise((function(s,a){return fetch(o.url||"".concat(e.host,"/").concat(e.namespace,"/").concat(t),i({method:n,mode:o.mode||"cors",headers:new Headers(i(i({},e.headers||{}),o.headers||{}))},r)).then(e.parseJSON).then((function(t){return t.ok?s(t.json):a(new Error(t.json.errors?t.json.errors[0]:t.statusText))})).catch((function(t){a(t)}))}))}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=q(e)?"":new URLSearchParams(e).toString();return this.request("".concat(t).concat(r?"?".concat(r):""),"GET",{},n)}},{key:"post",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"POST",{body:JSON.stringify(e)},n)}},{key:"put",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"PUT",{body:JSON.stringify(e)},n)}},{key:"delete",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.request(t,"DELETE",{},e)}},{key:"patch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"PATCH",{body:JSON.stringify(e)},n)}}]),n}(),pt=function(t){v(r,ft);var e=k(r);function r(t){var i;return u(this,r),(i=e.call(this,t)).axios=n.default.create({baseURL:"".concat(i.host,"/").concat(i.namespace),headers:{Authorization:"Bearer ".concat(t.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;node"}}),i}return h(r,[{key:"setHeaders",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.axios.defaults.headers.common;return this.axios.defaults.headers.common=i(i({},e),t),this}},{key:"transform",value:function(t){return t.data}},{key:"handleError",value:function(t){if(t.response){var e=t.response.data;if(E(e.errors))throw new Error(e.errors[0]);if(e.error)throw new Error(e.error)}throw t}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=q(e)?"":new URLSearchParams(e).toString();return this.axios.get("".concat(t).concat(r?"?".concat(r):""),n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"post",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.post(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"put",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.put(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"delete",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.axios.delete(t,e).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"patch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.patch(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}}]),r}(),yt=function(t){v(n,ft);var e=k(n);function n(){return u(this,n),e.apply(this,arguments)}return n}(),bt=function(){function t(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];u(this,t),l(this,"uncountableWords",["equipment","information","rice","money","species","series","fish","sheep","moose","deer","news"]),l(this,"pluralRules",[[new RegExp("(m)an$","gi"),"$1en"],[new RegExp("(pe)rson$","gi"),"$1ople"],[new RegExp("(child)$","gi"),"$1ren"],[new RegExp("^(ox)$","gi"),"$1en"],[new RegExp("(ax|test)is$","gi"),"$1es"],[new RegExp("(octop|vir)us$","gi"),"$1i"],[new RegExp("(alias|status)$","gi"),"$1es"],[new RegExp("(bu)s$","gi"),"$1ses"],[new RegExp("(buffal|tomat|potat)o$","gi"),"$1oes"],[new RegExp("([ti])um$","gi"),"$1a"],[new RegExp("sis$","gi"),"ses"],[new RegExp("(?:([^f])fe|([lr])f)$","gi"),"$1$2ves"],[new RegExp("(hive)$","gi"),"$1s"],[new RegExp("([^aeiouy]|qu)y$","gi"),"$1ies"],[new RegExp("(x|ch|ss|sh)$","gi"),"$1es"],[new RegExp("(matr|vert|ind)ix|ex$","gi"),"$1ices"],[new RegExp("([m|l])ouse$","gi"),"$1ice"],[new RegExp("(quiz)$","gi"),"$1zes"],[new RegExp("s$","gi"),"s"],[new RegExp("$","gi"),"s"]]),l(this,"singularRules",[[new RegExp("(m)en$","gi"),"$1an"],[new RegExp("(pe)ople$","gi"),"$1rson"],[new RegExp("(child)ren$","gi"),"$1"],[new RegExp("([ti])a$","gi"),"$1um"],[new RegExp("((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$","gi"),"$1$2sis"],[new RegExp("(hive)s$","gi"),"$1"],[new RegExp("(tive)s$","gi"),"$1"],[new RegExp("(curve)s$","gi"),"$1"],[new RegExp("([lr])ves$","gi"),"$1f"],[new RegExp("([^fo])ves$","gi"),"$1fe"],[new RegExp("([^aeiouy]|qu)ies$","gi"),"$1y"],[new RegExp("(s)eries$","gi"),"$1eries"],[new RegExp("(m)ovies$","gi"),"$1ovie"],[new RegExp("(x|ch|ss|sh)es$","gi"),"$1"],[new RegExp("([m|l])ice$","gi"),"$1ouse"],[new RegExp("(bus)es$","gi"),"$1"],[new RegExp("(o)es$","gi"),"$1"],[new RegExp("(shoe)s$","gi"),"$1"],[new RegExp("(cris|ax|test)es$","gi"),"$1is"],[new RegExp("(octop|vir)i$","gi"),"$1us"],[new RegExp("(alias|status)es$","gi"),"$1"],[new RegExp("^(ox)en","gi"),"$1"],[new RegExp("(vert|ind)ices$","gi"),"$1ex"],[new RegExp("(matr)ices$","gi"),"$1ix"],[new RegExp("(quiz)zes$","gi"),"$1"],[new RegExp("s$","gi"),""]]),l(this,"nonTitlecasedWords",["and","or","nor","a","an","the","so","but","to","of","at","by","from","into","on","onto","off","out","in","over","with","for"]),l(this,"idSuffix",new RegExp("(_ids|_id)$","g")),l(this,"underbar",new RegExp("_","g")),l(this,"spaceOrUnderbar",new RegExp("[ _]","g")),l(this,"uppercase",new RegExp("([A-Z])","g")),l(this,"underbarPrefix",new RegExp("^_")),this.str=e,this.chain=n}return h(t,[{key:"get",value:function(){return this.str}},{key:"applyRules",value:function(t,e,n,r){if(r)t=r;else if(!(n.indexOf(t.toLowerCase())>-1))for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:null;return t=t||this.str,this.applyRules(t,this.pluralRules,this.uncountableWords,e)}},{key:"singularize",value:function(t,e){return t=t||this.str,this.applyRules(t,this.singularRules,this.uncountableWords,e)}},{key:"camelize",value:function(t,e){for(var n=(t=t||this.str).split("/"),r=0;r1&&void 0!==arguments[1]&&arguments[1];return t=t||this.str,t=this.underscore(this.demodulize(t))+(e?"":"_")+"id",this.str=t,!0===this.chain?this:t}},{key:"ordinalize",value:function(t){for(var e=(t=t||this.str).split(" "),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];if(t.actions=E(e)?e:[e],!E(e))return e instanceof V&&e.extend(t),t;for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{};u(this,t),this.resource=e,this.adapter=n||J(),this.namespace=kt(e),this.storage=new N,this.options=r,this.extendActions(r.actions)}return h(t,[{key:"extendActions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return $t(this,t)}},{key:"deposit",value:function(t){return t}},{key:"serialize",value:function(t){return Rt("resource",wt(this.resource),t,this.adapter)}},{key:"afterFetch",value:function(t){return function(t,e){if("function"==typeof t.options.onAfterFetch&&t.options.onAfterFetch(e),E(e)){for(var n=[],r=0;r0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var r=a(regeneratorRuntime.mark((function r(i,o){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.adapter.post("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=r.sent,i(s);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"update",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(function(){var i=a(regeneratorRuntime.mark((function i(o,s){var a;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,e.adapter.put("".concat(e.namespace,"/").concat(t),n,r).then(e.afterFetch.bind(e)).catch(s);case 2:a=i.sent,o(a);case 4:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}())}},{key:"findRecord",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var r=a(regeneratorRuntime.mark((function r(i,o){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e.adapter.get("".concat(e.namespace,"/").concat(t),{},n).then(e.afterFetch.bind(e)).catch(o);case 2:s=r.sent,i(s);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"findAll",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(){var n=a(regeneratorRuntime.mark((function n(r,i){var o;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.adapter.get("".concat(t.namespace),{},e).then(t.afterFetch.bind(t)).catch(i);case 2:o=n.sent,r(o);case 4:case"end":return n.stop()}}),n)})));return function(t,e){return n.apply(this,arguments)}}())}},{key:"query",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var r=a(regeneratorRuntime.mark((function r(i,o){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.adapter.get("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=r.sent,i(s);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"queryRecord",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.single=!0,new Promise(function(){var r=a(regeneratorRuntime.mark((function r(i,o){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.adapter.get("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=r.sent,i(s);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"destroy",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=B(t)?t.getAttribute("id"):t;return new Promise(function(){var t=a(regeneratorRuntime.mark((function t(i,o){var s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.adapter.delete("".concat(e.namespace,"/").concat(r),{},n).then(e.afterFetch.bind(e)).catch(o);case 2:s=t.sent,i(s);case 4:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}())}}]),t}(),Ot=function(){function t(e){var n,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(u(this,t),this.version=null!==(n=o.version)&&void 0!==n?n:"v1",this.options={version:this.version,host:null!==(r=o.host)&&void 0!==r?r:"https://api.fleetbase.io",namespace:null!==(i=o.namespace)&&void 0!==i?i:this.version,debug:s,publicKey:e},"string"!=typeof e||0===e.length)throw new Error("⚠️ Invalid public key given to Fleetbase SDK");if(!I()&&e.toLowerCase().startsWith("$"))throw new Error("Secret key provided. You must use a public key with Fleetbase Javascript SDK!");this.adapter=o.adapter||J(this.options),this.orders=new jt("order",this.adapter).extendActions(Y),this.entities=new jt("entity",this.adapter),this.places=new jt("place",this.adapter),this.drivers=new jt("driver",this.adapter).extendActions(st),this.vehicles=new jt("vehicle",this.adapter),this.vendors=new jt("vendor",this.adapter),this.contacts=new jt("contact",this.adapter)}return h(t,[{key:"setAdapter",value:function(t){this.adapter=t}},{key:"getAdapter",value:function(){return this.adapter}}],[{key:"newInstance",value:function(){return p(t,Array.prototype.slice.call(arguments))}}]),t}();exports.Adapter=ft,exports.BrowserAdapter=gt,exports.Collection=N,exports.Contact=ct,exports.Driver=at,exports.EmberJsAdapter=yt,exports.Entity=et,exports.GoogleAddress=M,exports.NodeAdapter=pt,exports.Order=X,exports.Payload=tt,exports.Place=nt,exports.Point=K,exports.Resource=Z,exports.ServiceArea=lt,exports.ServiceQuote=dt,exports.ServiceRate=vt,exports.Store=jt,exports.StoreActions=V,exports.TrackingStatus=it,exports.Vehicle=ot,exports.Vendor=ut,exports.Waypoint=rt,exports.Zone=ht,exports.camelize=function(){var t=["camelize"].concat(Array.prototype.slice.call(arguments));return bt.invoke.apply(bt,w(t))},exports.classify=wt,exports.dasherize=function(){var t=["dasherize"].concat(Array.prototype.slice.call(arguments));return bt.invoke.apply(bt,w(t))},exports.default=Ot,exports.extendStoreActions=$t,exports.isLatitude=function(t){return isFinite(t)&&Math.abs(t)<=90},exports.isLongitude=function(t){return isFinite(t)&&Math.abs(t)<=180&&Math.abs(t)>=90},exports.isNodeEnvironment=I,exports.isResource=B,exports.pluralize=kt,exports.singularize=mt; //# sourceMappingURL=fleetbase.js.map diff --git a/dist/cjs/fleetbase.js.map b/dist/cjs/fleetbase.js.map index 1d115d3..7345513 100644 --- a/dist/cjs/fleetbase.js.map +++ b/dist/cjs/fleetbase.js.map @@ -1 +1 @@ -{"version":3,"file":"fleetbase.js","sources":["../../src/utils/array.js","../../src/utils/collection.js","../../src/utils/is-empty.js","../../src/utils/is-blank.js","../../src/utils/is-resource.js","../../src/utils/is-phone.js","../../src/utils/is-node-environment.js","../../src/utils/detect-adapter.js","../../src/utils/google-address.js","../../src/utils/point.js","../../src/utils/object.js","../../src/utils/store-actions.js","../../src/resource.js","../../src/resources/order.js","../../src/resources/payload.js","../../src/resources/entity.js","../../src/resources/place.js","../../src/resources/waypoint.js","../../src/resources/tracking-status.js","../../src/resources/vehicle.js","../../src/resources/driver.js","../../src/resources/vendor.js","../../src/resources/contact.js","../../src/resources/zone.js","../../src/resources/service-area.js","../../src/resources/service-rate.js","../../src/resources/service-quote.js","../../src/adapter.js","../../src/adapters/browser.js","../../src/adapters/node.js","../../src/adapters/ember.js","../../src/utils/string.js","../../src/resolver.js","../../src/store.js","../../src/fleetbase.js","../../src/utils/is-latitude.js","../../src/utils/is-longitude.js"],"sourcesContent":["const { isArray } = Array;\n\nexport {\n isArray\n};\n","import { isArray } from './array';\n\n/**\n * Collection\n * Extended array inspired by Ember's NativeArray\n **/\n\nconst CHUNK_SIZE = 60000;\n\n// To avoid overflowing the stack, we splice up to CHUNK_SIZE items at a time.\n// See https://code.google.com/p/chromium/issues/detail?id=56588 for more details.\nconst replace = (array, start, deleteCount, items = []) => {\n if (isArray(array)) {\n if (items.length <= CHUNK_SIZE) {\n array.splice(start, deleteCount, ...items);\n } else {\n array.splice(start, deleteCount);\n\n for (let i = 0; i < items.length; i += CHUNK_SIZE) {\n let chunk = items.slice(i, i + CHUNK_SIZE);\n array.splice(start + i, 0, ...chunk);\n }\n }\n } else if (isCollection(arr)) {\n array.replace(start, deleteCount, items);\n }\n};\n\nconst identityFunction = (item) => item;\n\nconst uniqBy = (array, key = identityFunction) => {\n let ret = [];\n let seen = new Set();\n let getter = typeof key === 'function' ? key : (item) => get(item, key);\n\n array.forEach((item) => {\n let val = getter(item);\n if (!seen.has(val)) {\n seen.add(val);\n ret.push(item);\n }\n });\n\n return ret;\n};\n\nconst isCollection = (mixed) => mixed instanceof Collection;\n\nconst objectAt = (array, index) => {\n if (isArray(array)) {\n return array[index];\n } else if (isCollection(array)) {\n return array.objectAt(index);\n }\n\n return null;\n};\n\nconst iter = (key, value) => {\n let valueProvided = arguments.length === 2;\n return valueProvided ? (item) => value === item[key] : (item) => Boolean(item[key]);\n};\n\nconst findIndex = (array, predicate, startAt = 0) => {\n let len = array.length;\n for (let index = startAt; index < len; index++) {\n let item = objectAt(array, index);\n if (predicate(item, index, array)) {\n return index;\n }\n }\n return -1;\n};\n\nconst find = (array, callback, target) => {\n let predicate = callback.bind(target);\n let index = findIndex(array, predicate, 0);\n return index === -1 ? undefined : objectAt(array, index);\n};\n\nconst any = (array, callback, target) => {\n let predicate = callback.bind(target);\n return findIndex(array, predicate, 0) !== -1;\n};\n\nconst every = (array, callback, target) => {\n let cb = callback.bind(target);\n let predicate = (item, index, array) => !cb(item, index, array);\n return findIndex(array, predicate, 0) === -1;\n};\n\nconst indexOf = (array, val, startAt = 0, withNaNCheck) => {\n let len = array.length;\n\n if (startAt < 0) {\n startAt += len;\n }\n\n // SameValueZero comparison (NaN !== NaN)\n let predicate = withNaNCheck && val !== val ? (item) => item !== item : (item) => item === val;\n return findIndex(array, predicate, startAt);\n};\n\nconst removeAt = (array, index, len = 1) => {\n replace(array, index, len, []);\n return array;\n};\n\nconst insertAt = (array, index, item) => {\n replace(array, index, 0, [item]);\n return item;\n};\n\nclass Collection extends Array {\n constructor(...items) {\n if (isArray(arguments[0])) {\n super(...arguments[0]);\n } else {\n super(...arguments);\n }\n }\n\n get notEmpty() {\n return this.length > 0;\n }\n\n get empty() {\n return this.length === 0;\n }\n\n get first() {\n return objectAt(this, 0);\n }\n\n get last() {\n return objectAt(this, this.length - 1);\n }\n\n replace(start, deleteCount, items = []) {\n replace(this, start, deleteCount, items);\n\n return this;\n }\n\n objectsAt(indexes) {\n return indexes.map((idx) => objectAt(this, idx));\n }\n\n objectAt(index) {\n return objectAt(this, index);\n }\n\n indexOf(object, startAt) {\n return indexOf(this, object, startAt, false);\n }\n\n lastIndexOf(object, startAt) {\n let len = this.length;\n\n if (startAt === undefined || startAt >= len) {\n startAt = len - 1;\n }\n\n if (startAt < 0) {\n startAt += len;\n }\n\n for (let idx = startAt; idx >= 0; idx--) {\n if (objectAt(this, idx) === object) {\n return idx;\n }\n }\n\n return -1;\n }\n\n includes(object, startAt) {\n return indexOf(this, object, startAt, true) !== -1;\n }\n\n findBy() {\n return find(this, iter(...arguments));\n }\n\n findIndexBy() {\n return findIndex(this, iter(...arguments));\n }\n\n isEvery() {\n return every(this, iter(...arguments));\n }\n\n isAny() {\n return any(this, iter(...arguments));\n }\n\n invoke(methodName, ...args) {\n let ret = [];\n\n this.forEach((item) => ret.push(item[methodName]?.(...args)));\n\n return ret;\n }\n\n toArray() {\n return this.map((item) => item);\n }\n\n compact() {\n return this.filter((value) => value != null);\n }\n\n sortBy() {\n let sortKeys = arguments;\n\n return this.sort((a, b) => {\n for (let i = 0; i < sortKeys.length; i++) {\n let key = sortKeys[i];\n let propA = a[key];\n let propB = b[key];\n // return 1 or -1 else continue to the next sortKey\n let compareValue = compare(propA, propB);\n\n if (compareValue) {\n return compareValue;\n }\n }\n return 0;\n });\n }\n\n uniqBy(key) {\n return uniqBy(this, key);\n }\n\n without(value) {\n if (!this.includes(value)) {\n return this; // nothing to do\n }\n\n // SameValueZero comparison (NaN !== NaN)\n let predicate = value === value ? (item) => item !== value : (item) => item === item;\n return this.filter(predicate);\n }\n\n clear() {\n let len = this.length;\n if (len === 0) {\n return this;\n }\n\n this.replace(0, len, []);\n return this;\n }\n\n insertAt(idx, object) {\n insertAt(this, idx, object);\n return this;\n }\n\n replaceAt(idx, object) {\n return this.replace(idx, 1, [object]);\n }\n\n removeAt(start, len) {\n return removeAt(this, start, len);\n }\n\n pushObject(obj) {\n return this.insertAt(this.length, obj);\n }\n\n pushObjects(objects) {\n this.replace(this.length, 0, objects);\n return this;\n }\n\n popObject() {\n let len = this.length;\n if (len === 0) {\n return null;\n }\n\n let ret = objectAt(this, len - 1);\n this.removeAt(len - 1, 1);\n return ret;\n }\n\n shiftObject() {\n if (this.length === 0) {\n return null;\n }\n\n let ret = objectAt(this, 0);\n this.removeAt(0);\n return ret;\n }\n\n unshiftObject(obj) {\n return insertAt(this, 0, obj);\n }\n\n unshiftObjects(objects) {\n this.replace(0, 0, objects);\n return this;\n }\n\n reverseObjects() {\n let len = this.length;\n if (len === 0) {\n return this;\n }\n\n let objects = this.toArray().reverse();\n this.replace(0, len, objects);\n return this;\n }\n\n setObjects(objects) {\n if (objects.length === 0) {\n return this.clear();\n }\n\n let len = this.length;\n this.replace(0, len, objects);\n return this;\n }\n\n removeObject(obj) {\n let loc = this.length || 0;\n while (--loc >= 0) {\n let curObject = objectAt(this, loc);\n\n if (curObject === obj) {\n this.removeAt(loc);\n }\n }\n return this;\n }\n\n removeObjects(objects) {\n for (let i = objects.length - 1; i >= 0; i--) {\n this.removeObject(objects[i]);\n }\n\n return this;\n }\n\n addObject(obj) {\n let included = this.includes(obj);\n\n if (!included) {\n this.pushObject(obj);\n }\n\n return this;\n }\n\n addObjects(objects) {\n objects.forEach((obj) => this.addObject(obj));\n return this;\n }\n}\n\nexport default Collection;\n\nexport { replace, uniqBy, isCollection, objectAt, iter, findIndex, find, any, every, indexOf, removeAt, insertAt };\n","const isEmpty = (obj) => {\n const none = obj === null || obj === undefined;\n if (none) {\n return none;\n }\n\n if (typeof obj.size === 'number') {\n return !obj.size;\n }\n\n const objectType = typeof obj;\n\n if (objectType === 'object') {\n const { size } = obj;\n if (typeof size === 'number') {\n return !size;\n }\n }\n\n if (typeof obj.length === 'number' && objectType !== 'function') {\n return !obj.length;\n }\n\n if (objectType === 'object') {\n const { length } = obj;\n if (typeof length === 'number') {\n return !length;\n }\n }\n\n return false;\n};\n\nexport default isEmpty;\n","import isEmpty from './is-empty';\n\nconst isBlank = (obj) => isEmpty(obj) || (typeof obj === 'string' && /\\S/.test(obj) === false);\n\nexport default isBlank;\n","import Resource from '../resource';\n\nexport default function isResource(record) {\n return record instanceof Resource;\n}\n","const isPhone = (phone = '') => {\n return /^[+]?[\\s./0-9]*[(]?[0-9]{1,4}[)]?[-\\s./0-9]*$/g.test(phone);\n}\n\nexport default isPhone;","/**\n * Determines if environment SDK is initialized in is Node, additionally checks pass if environment is ReactNative.\n * \n * @returns boolean\n */\nconst isNodeEnvironment = () => {\n return (typeof process !== 'undefined') && (typeof process?.env === 'object' || process.release?.name?.search(/node|io.js/) !== -1) && (typeof window === 'undefined' || window?.navigator?.product === 'ReactNative');\n};\n\nexport default isNodeEnvironment;","import { lookup } from '../resolver';\nimport isNodeEnvironment from './is-node-environment';\n\nconst detectAdapter = (options = {}) => {\n if (isNodeEnvironment()) {\n return lookup('adapter', 'NodeAdapter', options);\n }\n\n return lookup('adapter', 'BrowserAdapter', options);\n}\n\nexport default detectAdapter;","const { isArray } = Array;\n\nclass GoogleAddress {\n constructor(place) {\n this.place = place;\n this.geometry = place?.geometry;\n this.components = this.parseComponents();\n this.attributes = this.parseProperties();\n }\n\n parse() {\n this.parseComponents();\n this.parseProperties();\n }\n\n parseComponents() {\n const components = (this.place?.address_components || []).reduce(function (acc, data) {\n data.types.forEach(function (type) {\n acc[type] = data;\n });\n return acc;\n }, {});\n\n return components;\n }\n\n parseProperties() {\n const attributes = {\n streetNumber: this.get('street_number'),\n streetName: this.get('route'),\n coordinates: this.geometry?.location ? Object.values(this.geometry.location) : [0, 0],\n city: this.or(['locality', 'sublocality', 'sublocality_level_1', 'neighborhood', 'administrative_area_level_3', 'administrative_area_level_2']),\n county: this.get('administrative_area_level_2'),\n stateShort: this.get('administrative_area_level_1', true),\n stateLong: this.get('administrative_area_level_1'),\n countryShort: this.get('country', true),\n country: this.get('country', true),\n countryLong: this.get('country'),\n postalCode: this.get('postal_code'),\n };\n\n attributes.address = [attributes.streetNumber, attributes.streetName].filter(Boolean).join(' ');\n\n return attributes;\n }\n\n all() {\n return this.attributes;\n }\n\n or(keys = []) {\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n\n if (isArray(key)) {\n const pkey = key[0];\n const short = key[1];\n\n if (this.has(pkey)) {\n return this.get(pkey, short);\n }\n\n continue;\n }\n\n if (this.has(key)) {\n return this.get(key);\n }\n }\n\n return null;\n }\n\n has(key) {\n return (key in this.components);\n }\n\n get(key, short = false) {\n if (!(key in this.components)) {\n return null;\n }\n\n return short ? this.components[key].short_name : this.components[key].long_name;\n }\n\n setAttributes(attributes = {}) {\n this.attributes = {...this.attributes, ...attributes};\n\n return this;\n }\n\n setAttribute(key, value) {\n this.attributes[key] = value;\n\n return this;\n }\n\n getAttribute(key) {\n return this.attributes[key] || null;\n }\n}\n\nexport default GoogleAddress;\n","export default class Point {\n constructor(latitude = 0, longitude = 0) {\n this.type = 'Point';\n this.coordinates = [longitude, latitude];\n }\n\n get latitude() {\n return this.coordinates[1];\n }\n\n get longitude() {\n return this.coordinates[0];\n }\n\n lat() {\n return this.latitude;\n }\n\n lng() {\n return this.longitude;\n }\n\n static fromGeoJson(json) {\n [ longitude, latitude ] = json.coordinates;\n\n return new Point(latitude, longitude);\n }\n\n serialize() {\n return {\n type: 'Point',\n coorindates: [this.lat(), this.lng()]\n };\n }\n\n toJson() {\n return this.serialize();\n }\n\n toString() {\n return `(${this.latitude}, ${this.longitude})`;\n }\n}","import isEmpty from './is-empty';\n\nconst isResource = (mixed) => typeof mixed === 'object' && !isEmpty(mixed?.attributes) && typeof mixed?.attributes === 'object';\n\nconst isCallable = (object, property) => typeof object[property] === 'function';\n\nconst getResolved = (func, path) => {\n const resolved = func();\n return Array.isArray(resolved) || typeof resolved === 'object' ? get(resolved, path) : null;\n};\n\nconst invoke = (object, method) => {\n if (typeof object[method] === 'function') {\n return object[method].bind(object);\n }\n};\n\nconst get = (object, path) => {\n let current = object;\n\n const type = typeof object;\n const isObject = type === 'object';\n const isFunction = type === 'function';\n const isArray = Array.isArray(object);\n\n const pathType = typeof path;\n const pathIsString = pathType === 'string';\n const pathIsDotted = pathIsString && path.includes('.');\n const pathArray = pathIsDotted ? path.split('.') : [path];\n\n if (isArray || isObject) {\n for (let i = 0; i < pathArray.length; i++) {\n if (current && current[pathArray[i]] === undefined) {\n return null;\n } else if (current) {\n current = current[pathArray[i]];\n\n // if is resource then return get on it's attributes\n if (isResource(current) && pathArray[i + 1] !== undefined) {\n const newPath = pathArray.slice(i + 1).join('.');\n\n return get(current.attributes, newPath);\n }\n\n // resolve functions and continue\n if (typeof current === 'function') {\n const newPath = pathArray.slice(i + 1).join('.');\n return getResolved(current, newPath);\n }\n }\n }\n return current;\n }\n\n if (isFunction) {\n return getResolved(object, path);\n }\n};\n\nconst getProperties = (object, properties = []) => {\n const selected = {};\n let propertyNames = arguments;\n let i = 1;\n\n if (arguments.length === 2 && Array.isArray(properties)) {\n i = 0;\n propertyNames = arguments[1];\n }\n\n for (; i < propertyNames.length; i++) {\n selected[propertyNames[i]] = get(object, propertyNames[i]);\n }\n\n return selected;\n};\n\nconst set = (object, path, value) => {\n let current = object;\n const type = typeof object;\n const isObject = type === 'object';\n const isFunction = type === 'function';\n const isArray = Array.isArray(object);\n\n // if is function\n if (isFunction) {\n // throw error should be object or array or object like\n }\n\n const pathType = typeof path;\n const pathIsString = pathType === 'string';\n const pathIsDotted = pathIsString && path.includes('.');\n const pathArray = pathIsDotted ? path.split('.') : [path];\n const iterations = pathArray.length;\n\n if (isArray || isObject) {\n for (let i = 0; i < iterations - 1; i++) {\n if (!current[pathArray[i]]) {\n current[pathArray[i]] = {};\n }\n current = current[pathArray[i]];\n }\n\n current[pathArray[iterations - 1]] = value;\n }\n\n return value;\n};\n\nconst setProperties = (object, properties = {}) => {\n for (const property in properties) {\n set(object, property, properties[property]);\n }\n\n return object;\n};\n\nconst extend = (target, classes = []) => {\n if (arguments.length > 1) {\n classes = arguments;\n }\n for (let index = 0; index < classes.length; index++) {\n for (const property in classes[index]) {\n if (Object.prototype.hasOwnProperty.call(classes[index], property)) {\n target[property] = classes[index][property];\n }\n }\n }\n return target;\n};\n\nexport { set, get, getProperties, setProperties, extend, isCallable, invoke };\n","import { set } from './object';\n\nexport default class StoreActions {\n constructor(actions = {}, bind = null) {\n this.actions = actions;\n this.bind = bind;\n }\n\n extend(bindTo = null) {\n const binding = bindTo || this.bind;\n\n if (!binding) {\n return this;\n }\n\n if (this?.actions && typeof this.actions === 'object') {\n for (let action in this.actions) {\n const fn = this.actions[action];\n\n if (typeof fn !== 'function') {\n set(binding, action, fn);\n continue;\n }\n\n set(binding, action, fn.bind(binding));\n }\n }\n\n return this;\n }\n}\n","import Store from './store';\nimport { isEmpty } from './utils';\nimport { isArray } from './utils/array';\nimport { set, get } from './utils/object';\n\nclass Resource {\n /**\n\t * The base resource for all resources\n\n\t * @return {[type]} [description]\n\t */\n constructor(attributes = {}, adapter, resource, options = {}) {\n this.attributes = attributes;\n this.dirtyAttributes = {};\n this.changes = {};\n this.isLoading = false;\n this.isSaving = false;\n this.isDestroying = false;\n this.isReloading = false;\n this.resource = resource;\n this.options = options;\n this.version = options.version || 'v1';\n this.setAdapter(adapter);\n }\n\n /**\n * Set a new adapter to the resource instance, this will update the Store instance\n *\n * @param {Adapter} adapter\n * @return {Resource} this\n */\n setAdapter(adapter) {\n this.adapter = adapter;\n this.store = new Store(this.resource, adapter, {\n onAfterFetch: this.syncAttributes.bind(this),\n actions: this.options?.actions\n });\n\n return this;\n }\n\n /**\n * Getter for id attribute\n *\n * @var {String}\n */\n get id() {\n return this.getAttribute('id');\n }\n\n /**\n * Creates a new resource on the server\n *\n * @param {Object} payload [description]\n * @return {[type]} [description]\n */\n create(attributes = {}) {\n const data = this.mergeAttributes(attributes);\n this.setFlags(['isLoading', 'isSaving']);\n\n return this.store.create(data).then((response) => {\n this.setFlags(['isLoading', 'isSaving'], false);\n\n return response;\n });\n }\n\n /**\n * Creates a new resource on the server\n *\n * @param {Object} payload [description]\n * @return {[type]} [description]\n */\n update(attributes = {}) {\n this.setFlags(['isLoading', 'isSaving']);\n\n return this.store.update(this.attributes.id, attributes).then((response) => {\n this.setFlags(['isLoading', 'isSaving'], false);\n\n return response;\n });\n }\n\n /**\n * Deletes the resource instance on the server\n *\n * @return {[type]} [description]\n */\n destroy() {\n this.setFlags(['isLoading', 'isDestroying']);\n\n return this.store.destroy(this.attributes.id).then((response) => {\n this.setFlags(['isLoading', 'isDestroying'], false);\n\n return response;\n });\n }\n\n /**\n * Reloads the resource from the server.\n *\n * @return {[type]} [description]\n */\n reload() {\n this.setFlags(['isLoading', 'isReloading']);\n\n return this.store.findRecord(this.attributes.id).then((response) => {\n this.reset();\n\n return response;\n });\n }\n\n /**\n * Sets flag properties.\n *\n * @return this\n */\n setFlags(flags = [], state = true) {\n const validFlags = ['isLoading', 'isSaving', 'isReloading', 'isDestroying'];\n\n for(let i = 0; i < flags.length; i++) {\n const flag = flags[i];\n\n if (typeof flag !== 'string' || !validFlags.includes(flag)) {\n throw new Error(`${flag} is not a valid flag!`);\n }\n\n this[flag] = state;\n }\n\n return this;\n }\n\n /**\n * Resets tracked properties\n *\n * @return this\n */\n reset() {\n this.dirtyAttributes = {};\n this.changes = {};\n this.isLoading = false;\n this.isSaving = false;\n this.isReloading = false;\n\n return this;\n }\n\n /**\n * Emptys resource.\n *\n * @return this\n */\n empty() {\n this.reset();\n this.attribues = {};\n\n return this;\n }\n\n /**\n * Saves the resource instance on the server\n *\n * @return {[type]} [description]\n */\n save(options = {}) {\n const attributes = this.getAttributes();\n\n if (isEmpty(this.id)) {\n return this.create(attributes);\n }\n\n if (options.onlyDirty === true) {\n return this.savedirty();\n }\n\n return this.update(attributes);\n }\n\n /**\n * Saves only dirtied attributes.\n *\n * @return {[type]} [description]\n */\n saveDirty() {\n const dirtyAttributeKeys = Object.keys(this.dirtyAttributes);\n const dirtyAttributes = {};\n\n for (let i = 0; i < dirtyAttributeKeys.length; i++) {\n const key = dirtyAttributeKeys[i];\n dirtyAttributes[key] = this.getAttribute(key);\n }\n\n return this.update(dirtyAttributes);\n }\n\n /**\n * Returns the resource meta if exists.\n *\n * @return {Object}\n */\n get meta() {\n return this.getAttribute('meta', {});\n }\n\n /**\n * Returns the date instance resource was created.\n *\n * @return {Date}\n */\n get createdAt() {\n return this.isAttributeFilled('created_at') ? new Date(this.getAttribute('created_at')) : null;\n }\n\n /**\n * Returns the date instance resource was created.\n *\n * @return {Date}\n */\n get updatedAt() {\n return this.isAttributeFilled('updated_at') ? new Date(this.getAttribute('updated_at')) : null;\n }\n\n /**\n * Checks if resource is loaded from the server.\n *\n * @return {Boolean}\n */\n get isLoaded() {\n return this.hasAttributes(['created_at', 'id']);\n }\n\n /**\n * Checks if resource ihas no attributes\n *\n * @return {Boolean}\n */\n get isEmpty() {\n return Object.values(this?.attributes).length === 0;\n }\n\n /**\n * Checks if resource is not saved to server.\n *\n * @return {Boolean}\n */\n get isNew() {\n return !this.id;\n }\n\n /**\n * Checks if resource is not saved to server.\n *\n * @return {Boolean}\n */\n get isSaved() {\n return !this.isNew && this.isLoaded;\n }\n\n /**\n * Checks if resource is deleted on server.\n *\n * @return {Boolean}\n */\n get isDeleted() {\n return this.hasAttributes(['deleted', 'time']);\n }\n\n /**\n * Iterates over each attribute value and property executing a user supplied callback.\n *\n * @return {Object}\n */\n eachAttribute(callback) {\n if (typeof callback !== 'function') {\n return this;\n }\n\n Object.keys(this?.attributes ?? {}).forEach((property) => {\n const value = this.getAttribute(property);\n callback.call(this, value, property);\n });\n\n return this;\n }\n\n /**\n * Gets all changes\n *\n * @return {Object}\n */\n changes() {\n return this.changes;\n }\n\n /**\n * Gets all dirty attributes.\n *\n * @return {Object}\n */\n getDirtyAttributes() {\n return this.dirtyAttributes;\n }\n\n /**\n * Checks if property is dirty.\n *\n * @param {String} property [description]\n * @return {Boolean}\n */\n isDirty(property) {\n return property in this.dirtyAttributes;\n }\n\n /**\n * Checks if any properties is dirty.\n *\n * @return {Boolean}\n */\n hasDirtyAttributes() {\n return Object.keys(this?.dirtyAttributes ?? {}).length > 0;\n }\n\n /**\n * Updates a instance property without tracking changes or dirtying attribute.\n *\n * @param {String} property [description]\n * @param {mixed} value [description]\n */\n mutate(property, value) {\n this.attributes[property] = value;\n }\n\n /**\n * Set an instance property locally\n *\n * @param {String} property [description]\n * @param {mixed} value [description]\n */\n setAttribute(property, value = null) {\n if (value === null && typeof property === 'object') {\n return this.setAttributes(property);\n }\n\n const previousValue = this?.attributes[property] ?? null;\n\n // use object setter\n set(this.attributes, property, value);\n set(this.dirtyAttributes, property, previousValue);\n \n // this.attributes[property] = value;\n // this.dirtyAttributes[property] = previousValue;\n\n // track changes\n if (!isArray(this?.changes[property])) {\n this.changes[property] = [];\n }\n\n this.changes[property].push({\n property,\n previousValue,\n value,\n changedAt: new Date(),\n });\n\n return this;\n }\n\n /**\n * Set multiple instance properties locally\n *\n * @param {Object} properties [description]\n */\n setAttributes(attributes = {}) {\n for (let property in attributes) {\n this.setAttribute(property, attributes[property]);\n }\n\n return this;\n }\n\n /**\n * Get an attribute\n *\n * @param {String} attribute The attribute key to get\n * @param {mixed} defaultValue The default value if no attribute value\n */\n getAttribute(attribute, defaultValue = null) {\n const value = get(this?.attributes ?? {}, attribute);\n\n if (value === undefined) {\n return defaultValue;\n }\n\n return value;\n }\n\n /**\n * Checks if attribute exists.\n *\n * @param {String} property [description]\n * @return {Boolean}\n */\n hasAttribute(property) {\n if (isArray(property)) {\n const properties = property;\n const attributeKeys = Object.keys(this.attributes ?? {});\n \n return properties.every((prop) => attributeKeys.includes(prop));\n }\n\n if (!this?.attributes) {\n return false;\n }\n\n return property in this.attributes;\n }\n\n /**\n * Alias for checking if has multiple attributes.\n *\n * @param {Array} properties \n * @return {Boolean}\n */\n hasAttributes(properties = []) {\n return this.hasAttribute(properties);\n }\n\n /**\n * Returns true if attribute has value.\n *\n * @param {Array} properties \n * @return {Boolean}\n */\n isAttributeFilled(property) {\n if (isArray(property)) {\n return this.hasAttribute(property) && property.every((prop) => !isEmpty(this.getAttribute(prop)));\n }\n\n return this.hasAttribute(property) && !isEmpty(this.getAttribute(property));\n }\n\n /**\n * Get multiple attributes.\n *\n * @param {Array} properties [description]\n * @param {[type]} value [description]\n */\n getAttributes(properties) {\n const attributes = {};\n\n if (properties === null || properties === undefined) {\n return this.getAttributes(Object.keys(this.attributes));\n }\n\n if (typeof properties === 'string') {\n return this.getAttribute([...arguments]);\n }\n\n if (!isArray(properties)) {\n throw new Error('No attribute properties provided!');\n }\n\n for (let i = 0; i < properties.length; i++) {\n const property = properties[i];\n\n if (typeof property !== 'string') {\n continue;\n }\n\n let value = this.getAttribute(property);\n\n if (typeof value?.attributes === 'object' && !isArray(value?.attributes)) {\n value = value.attributes;\n }\n\n attributes[property] = value;\n }\n\n return attributes;\n }\n\n /**\n * Serialize resource to a POJO\n *\n * @returns {Object}\n */\n serialize() {\n return this.getAttributes();\n }\n\n /**\n * Merge and return attributes on the resource instance.\n *\n * @param {[type]} property [description]\n * @param {[type]} value [description]\n */\n mergeAttributes(attributes = {}) {\n const modelAttributes = this?.attributes ?? {};\n this.attributes = { ...modelAttributes, ...attributes };\n\n return this.attributes;\n }\n\n /**\n * Merge and return attributes on the resource instance.\n *\n * @param {[type]} property [description]\n * @param {[type]} value [description]\n */\n syncAttributes(json = {}) {\n this.attributes = json;\n }\n}\n\nexport default Resource;\n","import Resource from '../resource';\nimport { StoreActions, isResource } from '../utils';\nimport { isValid as isValidDate } from 'date-fns';\n\nconst orderActions = new StoreActions({\n getDistanceAndTime: function (id, params = {}, options = {}) {\n return this.adapter.get(`${this.namespace}/${id}/distance-and-time`, params, options);\n },\n\n getNextActivity: function (id, params = {}, options = {}) {\n return this.adapter.get(`${this.namespace}/${id}/next-activity`, params, options);\n },\n\n dispatch: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/dispatch`, params, options).then(this.afterFetch.bind(this));\n },\n\n start: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/start`, params, options).then(this.afterFetch.bind(this));\n },\n\n updateActivity: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/update-activity`, params, options).then(this.afterFetch.bind(this));\n },\n\n setDestination: function (id, destinationId, params = {}, options = {}) {\n if (isResource(destinationId)) {\n destinationId = destinationId.id;\n }\n\n return this.adapter.post(`${this.namespace}/${id}/set-destination/${destinationId}`, params, options).then(this.afterFetch.bind(this));\n },\n\n captureQrCode: function (id, subjectId = null, params = {}, options = {}) {\n if (isResource(subjectId)) {\n subjectId = subjectId.id;\n }\n\n return this.adapter.post(`${this.namespace}/${id}/capture-qr${!subjectId ? '' : '/' + subjectId}`, params, options);\n },\n\n captureSignature: function (id, subjectId = null, params = {}, options = {}) {\n if (isResource(subjectId)) {\n subjectId = subjectId.id;\n }\n\n return this.adapter.post(`${this.namespace}/${id}/capture-signature${!subjectId ? '' : '/' + subjectId}`, params, options);\n },\n\n complete: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/complete`, params, options).then(this.afterFetch.bind(this));\n },\n\n cancel: function (id, params = {}, options = {}) {\n return this.adapter.delete(`${this.namespace}/${id}/cancel`, params, options).then(this.afterFetch.bind(this));\n },\n});\n\nclass Order extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'order', { actions: orderActions, ...options });\n }\n\n getDistanceAndTime(params = {}, options = {}) {\n return this.store.getDistanceAndTime(this.id, params, options);\n }\n\n dispatch(params = {}, options = {}) {\n return this.store.dispatch(this.id, params, options);\n }\n\n start(params = {}, options = {}) {\n return this.store.start(this.id, params, options);\n }\n\n setDestination(destinationId, params = {}, options = {}) {\n return this.store.setDestination(this.id, destinationId, params, options);\n }\n\n captureQrCode(subjectId = null, params = {}, options = {}) {\n return this.store.captureQrCode(this.id, subjectId, params, options);\n }\n\n captureSignature(subjectId = null, params = {}, options = {}) {\n return this.store.captureSignature(this.id, subjectId, params, options);\n }\n\n getNextActivity(params = {}, options = {}) {\n return this.store.getNextActivity(this.id, params, options);\n }\n\n updateActivity(params = {}, options = {}) {\n return this.store.updateActivity(this.id, params, options);\n }\n\n cancel(params = {}, options = {}) {\n return this.store.cancel(this.id, params, options);\n }\n\n complete(params = {}, options = {}) {\n return this.store.complete(this.id, params, options);\n }\n\n get isDispatched() {\n return this.getAttribute('dispatched_at') !== null;\n }\n\n get isNotDispatched() {\n return this.getAttribute('dispatched_at') == null;\n }\n\n get isStarted() {\n return this.getAttribute('started_at') !== null;\n }\n\n get isNotStarted() {\n return this.getAttribute('started_at') == null;\n }\n\n get isCompleted() {\n return this.getAttribute('status') == 'completed';\n }\n\n get isCanceled() {\n return this.getAttribute('status') == 'canceled';\n }\n\n get isEnroute() {\n return this.getAttribute('status') == 'driver_enroute' || this.getAttribute('status') === 'enroute';\n }\n\n get isInProgress() {\n return this.isStarted && !this.isCanceled && !this.isCompleted;\n }\n\n get scheduledAt() {\n return this.isAttributeFilled('scheduled_at') ? new Date(this.getAttribute('scheduled_at')) : null;\n }\n\n get startedAt() {\n return this.isAttributeFilled('started_at') ? new Date(this.getAttribute('started_at')) : null;\n }\n\n get dispatchedAt() {\n return this.isAttributeFilled('dispatched_at') ? new Date(this.getAttribute('dispatched_at')) : null;\n }\n\n get status() {\n return this.getAttribute('status');\n }\n}\n\nexport default Order;\n\nexport { orderActions };\n","import Resource from '../resource';\nimport Collection from '../utils/collection';\n\nclass Payload extends Resource {\n\tconstructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'payload', options);\n }\n\t\n /**\n\t * Attaches an entity to an existing payload and returns\n\t * the payload with the entity attached\n\t *\n\t * @param {[type]} Entity entity [description]\n\t * @return {[type]} [description]\n\t */\n attach(entity) {\n // perform op return payload\n }\n\n /**\n\t * Returns all of the entities attached to this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get entities() {\n\n }\n\n /**\n\t * Returns the dropoff for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get dropoff() {\n\n }\n\n /**\n\t * Returns the pickup for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get pickup() {\n\n }\n\n /**\n\t * Returns all the waypoints for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get waypoints() {\n return new Collection(this.waypoints);\n }\n}\n\nexport default Payload;\n","import Resource from '../resource';\n\nclass Entity extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'entity', options);\n }\n}\n\nexport default Entity;\n","import Resource from '../resource';\nimport { isResource, Point } from '../utils';\n\nclass Place extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'place', options);\n }\n\n static fromGoogleAddress(googleAddress, adapter, options = {}) {\n const [ latitude, longitude ] = googleAddress.getAttribute('coordinates');\n const attributes = {\n name: null,\n address: googleAddress.getAttribute('address'),\n location: new Point(latitude, longitude),\n street1: googleAddress.getAttribute('streetName'),\n street2: null,\n city: googleAddress.getAttribute('city'),\n province: googleAddress.getAttribute('stateLong'),\n postal_code: googleAddress.getAttribute('postalCode'),\n neighborhood: googleAddress.get('neighborhood'),\n district: googleAddress.getAttribute('county'),\n building: googleAddress.get('building'),\n country: googleAddress.getAttribute('countryShort'),\n phone: null,\n security_access_code: null\n };\n\n return new Place(attributes, adapter, options);\n }\n\n /**\n * The latitude coordinate for the 'Place' location.\n * \n * @var {Integer}\n */\n get latitude() {\n return this.getAttribute('location', new Point())?.coordinates[1];\n }\n\n /**\n * The longitude coordinate for the 'Place' location.\n * \n * @var {Integer}\n */\n get longitude() {\n return this.getAttribute('location', new Point())?.coordinates[0];\n }\n\n /**\n * Array coordinate pair for Place location.\n * \n * @var {Array}\n */\n get coordinates() {\n const { latitude, longitude } = this;\n\n return [ latitude, longitude ];\n }\n\n /**\n * Set the owner of the place.\n * \n * @param {Object|String} owner\n * @return {Place}\n */\n setOwner(owner) {\n if (isResource(owner)) {\n this.setAttribute('owner', owner.id);\n }\n\n if (typeof owner === 'string') {\n this.setAttribute('owner', owner);\n }\n\n return this;\n }\n}\n\nexport default Place;\n","import Place from './place';\n\nclass Waypoint extends Place {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'waypoint', options);\n }\n}\n\nexport default Waypoint;\n","import Resource from '../resource';\n\nclass TrackingStatus extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'tracking-status', options);\n }\n}\n\nexport default TrackingStatus;\n","import Resource from '../resource';\n\nclass Vehicle extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'vehicle', options);\n }\n}\n\nexport default Vehicle;\n","import Resource from '../resource';\nimport { StoreActions, isPhone, isEmail } from '../utils';\n\nconst driverActions = new StoreActions({\n // const { error } = await fleetbase.drivers.login('+1 111-1111');\n login: function (identity, password = null, attributes = {}) {\n // handle phone number authentication\n if (isPhone(identity)) {\n return this.adapter.post('drivers/login-with-sms', { phone: identity });\n }\n\n if (!password) {\n throw new Error('Login requires password!');\n }\n\n return this.adapter.post('drivers/login', { identity, password, ...attributes }).then(this.afterFetch.bind(this));\n },\n\n verifyCode: function (identity, code, attributes = {}) {\n return this.adapter.post('drivers/verify-code', { identity, code, ...attributes }).then(this.afterFetch.bind(this));\n },\n\n track: function (id, params = {}, options = {}) {\n return this.adapter.post(`drivers/${id}/track`, params, options).then(this.afterFetch.bind(this));\n },\n\n retrieve: function (id) {\n return this.findRecord(id);\n },\n\n syncDevice(token) {\n return this.adapter.setHeaders({ 'Driver-Token': this.token }).post('drivers/register-device', token);\n },\n});\n\nclass Driver extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'driver', { actions: driverActions, ...options });\n }\n\n /**\n * The latitude coordinate for the 'Place' location.\n *\n * @var {Integer}\n */\n get latitude() {\n return this.getAttribute('location', new Point())?.coordinates[1];\n }\n\n /**\n * The longitude coordinate for the 'Place' location.\n *\n * @var {Integer}\n */\n get longitude() {\n return this.getAttribute('location', new Point())?.coordinates[0];\n }\n\n /**\n * Array coordinate pair for Place location.\n *\n * @var {Array}\n */\n get coordinates() {\n const { latitude, longitude } = this;\n\n return [latitude, longitude];\n }\n\n get token() {\n return this.getAttribute('token');\n }\n\n get isOnline() {\n return this.getAttribute('online') === true;\n }\n\n track(params = {}, options = {}) {\n return this.store.track(this.id, params, options);\n }\n\n syncDevice(token) {\n return this.store.syncDevice(token);\n }\n}\n\nexport default Driver;\nexport { driverActions };\n","import Resource from '../resource';\n\nclass Vendor extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'vendor', options);\n }\n}\n\nexport default Vendor;\n","import Resource from '../resource';\n\nclass Contact extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'contact', options);\n }\n}\n\nexport default Contact;\n","import Resource from '../resource';\n\nclass Zone extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'zone', options);\n }\n}\n\nexport default Zone;\n","import Resource from '../resource';\n\nclass ServiceArea extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-area', options);\n }\n}\n\nexport default ServiceArea;\n","import Resource from '../resource';\n\nclass ServiceRate extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-rate', options);\n }\n}\n\nexport default ServiceRate;\n","import Resource from '../resource';\n\nclass ServiceQuote extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-quote', options);\n }\n\n fromPreliminary() {\n\n }\n\n fromPayload() {\n \n }\n}\n\nexport default ServiceQuote;\n","class Adapter {\n /**\n\t * Creates a configured base adapter for Fleetbase.\n\t *\n\t * @param {Object} config Configuration options for adapter\n\t */\n constructor(config = {}) {\n this.version = config.version || 'v1';\n this.host = config.host || null;\n this.namespace = config.namespace || null;\n this.headers = config.headers || {};\n }\n}\n\nexport default Adapter;\n","import Adapter from '../adapter';\nimport { isBlank } from '../utils';\n\nclass BrowserAdapter extends Adapter {\n /**\n * Setup browser adapter.\n * @param {Object} config\n */\n constructor(config) {\n super(config);\n\n this.setHeaders({\n Authorization: `Bearer ${config.publicKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': '@fleetbase/sdk;browser'\n });\n }\n\n /**\n * Updates the adapter headers.\n *\n * @param {Object} headers\n */\n setHeaders(headers = {}) {\n this.headers = { ...this.headers, ...headers };\n\n return this;\n }\n\n /**\n * Parses the JSON returned by a network request\n *\n * @param {Object} response A response from a network request\n * @return {Object} The parsed JSON, status from the response\n *\n * @return {Promise}\n */\n parseJSON(response) {\n return new Promise((resolve, reject) => response\n .json()\n .then((json) => resolve({\n statusText: response.statusText,\n status: response.status,\n ok: response.ok,\n json,\n }))\n .catch(() => {\n reject(new Error('Oops! Something went wrong when handling your request.'));\n }));\n }\n\n /**\n * The base request method\n *\n * @param {String} path\n * @param {String} method\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n request(path, method = 'GET', data = {}, options = {}) {\n return new Promise((resolve, reject) => fetch(options.url || `${this.host}/${this.namespace}/${path}`, {\n method,\n mode: options.mode || 'cors',\n headers: new Headers({\n ...(this.headers || {}),\n ...(options.headers || {}),\n }),\n ...data,\n })\n .then(this.parseJSON)\n .then((response) => {\n if (response.ok) {\n return resolve(response.json);\n }\n\n return reject(new Error(response.json.errors ? response.json.errors[0] : response.statusText));\n })\n .catch((error) => {\n reject(error);\n }));\n }\n\n /**\n * Makes a GET request with fetch\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n get(path, query = {}, options = {}) {\n const urlParams = !isBlank(query) ? new URLSearchParams(query).toString() : '';\n\n return this.request(`${path}${urlParams ? `?${urlParams}` : ''}`, 'GET', {}, options);\n }\n\n /**\n * Makes a POST request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n post(path, data = {}, options = {}) {\n return this.request(path, 'POST', { body: JSON.stringify(data) }, options);\n }\n\n /**\n * Makes a PUT request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n put(path, data = {}, options = {}) {\n return this.request(path, 'PUT', { body: JSON.stringify(data) }, options);\n }\n\n /**\n * Makes a DELETE request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n delete(path, options = {}) {\n return this.request(path, 'DELETE', {}, options);\n }\n\n /**\n * Makes a PATCH request with fetch\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n patch(path, data = {}, options = {}) {\n return this.request(path, 'PATCH', { body: JSON.stringify(data) }, options);\n }\n}\n\nexport default BrowserAdapter;\n","import Adapter from '../adapter';\nimport { isBlank } from '../utils';\nimport { isArray } from '../utils/array';\nimport axios from 'axios';\n\nclass NodeAdapter extends Adapter {\n constructor(config) {\n super(config);\n\n this.axios = axios.create({\n baseURL: `${this.host}/${this.namespace}`,\n headers: {\n Authorization: `Bearer ${config.publicKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': '@fleetbase/sdk;node',\n },\n });\n }\n\n /**\n * Updates the adapter headers.\n *\n * @param {Object} headers\n */\n setHeaders(headers = {}) {\n const commonHeaders = this.axios.defaults.headers.common;\n this.axios.defaults.headers.common = { ...commonHeaders, ...headers };\n\n return this;\n }\n\n /**\n * Tranform the response, and return the response data from axios.\n *\n * @param {AxiosResponse} response\n * @returns {Object}\n */\n transform(response) {\n return response.data;\n }\n\n /**\n * Handles an erroneous request.\n *\n * @param {AxiosResponse} response\n * @returns {Object}\n */\n handleError(error) {\n if (error.response) {\n const { data } = error.response;\n\n if (isArray(data.errors)) {\n throw new Error(data.errors[0]);\n }\n\n if (data.error) {\n throw new Error(data.error);\n }\n }\n\n throw error;\n }\n\n /**\n * Makes a GET request with axios\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n get(path, query = {}, options = {}) {\n const urlParams = !isBlank(query) ? new URLSearchParams(query).toString() : '';\n\n return this.axios\n .get(`${path}${urlParams ? `?${urlParams}` : ''}`, options)\n .then(this.transform.bind(this))\n .catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a POST request with axios\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n post(path, data = {}, options = {}) {\n return this.axios.post(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a PUT request with axios\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n put(path, data = {}, options = {}) {\n return this.axios.put(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a DELETE request with axios\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n delete(path, options = {}) {\n return this.axios.delete(path, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a PATCH request with axios\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n patch(path, data = {}, options = {}) {\n return this.axios.patch(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n}\n\nexport default NodeAdapter;\n","import Adapter from '../adapter';\n\nclass EmberJsAdapter extends Adapter {}\n\nexport default EmberJsAdapter;\n","'use strict';\n\n/**\n * Javascript String\n *\n * instance\n * new String('hello_world').humanize().get() => \"Hello world\"\n *\n * instance\n * const string = new String();\n * string.humanize('hello_world').get() => \"Hello world\"\n * \n * no chain\n * new String('hello_world', false).humanize() => \"Hello world\"\n *\n * static\n * String.invoke('humanize', 'hello_world') => \"Hello world\"\n *\n * exports {}\n * humanize('hello_world') => \"Hello world\"\n */\n\nexport default class String {\n constructor(string, chain = true) {\n this.str = string;\n this.chain = chain;\n }\n\n uncountableWords = ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'moose', 'deer', 'news'];\n\n pluralRules = [\n [new RegExp('(m)an$', 'gi'), '$1en'],\n [new RegExp('(pe)rson$', 'gi'), '$1ople'],\n [new RegExp('(child)$', 'gi'), '$1ren'],\n [new RegExp('^(ox)$', 'gi'), '$1en'],\n [new RegExp('(ax|test)is$', 'gi'), '$1es'],\n [new RegExp('(octop|vir)us$', 'gi'), '$1i'],\n [new RegExp('(alias|status)$', 'gi'), '$1es'],\n [new RegExp('(bu)s$', 'gi'), '$1ses'],\n [new RegExp('(buffal|tomat|potat)o$', 'gi'), '$1oes'],\n [new RegExp('([ti])um$', 'gi'), '$1a'],\n [new RegExp('sis$', 'gi'), 'ses'],\n [new RegExp('(?:([^f])fe|([lr])f)$', 'gi'), '$1$2ves'],\n [new RegExp('(hive)$', 'gi'), '$1s'],\n [new RegExp('([^aeiouy]|qu)y$', 'gi'), '$1ies'],\n [new RegExp('(x|ch|ss|sh)$', 'gi'), '$1es'],\n [new RegExp('(matr|vert|ind)ix|ex$', 'gi'), '$1ices'],\n [new RegExp('([m|l])ouse$', 'gi'), '$1ice'],\n [new RegExp('(quiz)$', 'gi'), '$1zes'],\n [new RegExp('s$', 'gi'), 's'],\n [new RegExp('$', 'gi'), 's'],\n ];\n\n singularRules = [\n [new RegExp('(m)en$', 'gi'), '$1an'],\n [new RegExp('(pe)ople$', 'gi'), '$1rson'],\n [new RegExp('(child)ren$', 'gi'), '$1'],\n [new RegExp('([ti])a$', 'gi'), '$1um'],\n [new RegExp('((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$', 'gi'), '$1$2sis'],\n [new RegExp('(hive)s$', 'gi'), '$1'],\n [new RegExp('(tive)s$', 'gi'), '$1'],\n [new RegExp('(curve)s$', 'gi'), '$1'],\n [new RegExp('([lr])ves$', 'gi'), '$1f'],\n [new RegExp('([^fo])ves$', 'gi'), '$1fe'],\n [new RegExp('([^aeiouy]|qu)ies$', 'gi'), '$1y'],\n [new RegExp('(s)eries$', 'gi'), '$1eries'],\n [new RegExp('(m)ovies$', 'gi'), '$1ovie'],\n [new RegExp('(x|ch|ss|sh)es$', 'gi'), '$1'],\n [new RegExp('([m|l])ice$', 'gi'), '$1ouse'],\n [new RegExp('(bus)es$', 'gi'), '$1'],\n [new RegExp('(o)es$', 'gi'), '$1'],\n [new RegExp('(shoe)s$', 'gi'), '$1'],\n [new RegExp('(cris|ax|test)es$', 'gi'), '$1is'],\n [new RegExp('(octop|vir)i$', 'gi'), '$1us'],\n [new RegExp('(alias|status)es$', 'gi'), '$1'],\n [new RegExp('^(ox)en', 'gi'), '$1'],\n [new RegExp('(vert|ind)ices$', 'gi'), '$1ex'],\n [new RegExp('(matr)ices$', 'gi'), '$1ix'],\n [new RegExp('(quiz)zes$', 'gi'), '$1'],\n [new RegExp('s$', 'gi'), ''],\n ];\n\n nonTitlecasedWords = ['and', 'or', 'nor', 'a', 'an', 'the', 'so', 'but', 'to', 'of', 'at', 'by', 'from', 'into', 'on', 'onto', 'off', 'out', 'in', 'over', 'with', 'for'];\n\n idSuffix = new RegExp('(_ids|_id)$', 'g');\n underbar = new RegExp('_', 'g');\n spaceOrUnderbar = new RegExp('[ _]', 'g');\n uppercase = new RegExp('([A-Z])', 'g');\n underbarPrefix = new RegExp('^_');\n\n get() {\n return this.str;\n }\n\n applyRules(str, rules, skip, override) {\n if (override) {\n str = override;\n } else {\n var ignore = skip.indexOf(str.toLowerCase()) > -1;\n if (!ignore) {\n for (var x = 0; x < rules.length; x++) {\n if (str.match(rules[x][0])) {\n str = str.replace(rules[x][0], rules[x][1]);\n break;\n }\n }\n }\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.pluralize('person') -> 'people'\n String.pluralize('octopus') -> 'octopi'\n String.pluralize('Hat') -> 'Hats'\n String.pluralize('person', 'guys') -> 'guys' \n */\n pluralize(str, plural = null) {\n str = str || this.str;\n\n return this.applyRules(str, this.pluralRules, this.uncountableWords, plural);\n }\n\n /*\n String.singularize('person') -> 'person'\n String.singularize('octopi') -> 'octopus'\n String.singularize('hats') -> 'hat'\n String.singularize('guys', 'person') -> 'person'\n */\n singularize(str, singular) {\n str = str || this.str;\n\n return this.applyRules(str, this.singularRules, this.uncountableWords, singular);\n }\n\n /*\n String.camelize('message_properties') -> 'MessageProperties'\n String.camelize('message_properties', true) -> 'messageProperties'\n */\n camelize(str, lowFirstLetter) {\n str = str || this.str;\n\n let str_path = str.split('/');\n for (var i = 0; i < str_path.length; i++) {\n let str_arr = str_path[i].split('_');\n let initX = lowFirstLetter && i + 1 === str_path.length ? 1 : 0;\n\n for (let x = initX; x < str_arr.length; x++) {\n str_arr[x] = str_arr[x].charAt(0).toUpperCase() + str_arr[x].substring(1);\n }\n str_path[i] = str_arr.join('');\n }\n str = str_path.join('::');\n\n // fix\n if (lowFirstLetter === true) {\n let first = str.charAt(0).toLowerCase();\n let last = str.slice(1);\n str = first + last;\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.underscore('MessageProperties') -> 'message_properties'\n String.underscore('messageProperties') -> 'message_properties'\n */\n underscore(str) {\n str = str || this.str;\n\n var str_path = str.split('::');\n for (var i = 0; i < str_path.length; i++) {\n str_path[i] = str_path[i].replace(this.uppercase, '_$1');\n str_path[i] = str_path[i].replace(this.underbarPrefix, '');\n }\n str = str_path.join('/').toLowerCase();\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.humanize('message_properties') -> 'Message properties'\n String.humanize('message_properties') -> 'message properties'\n */\n humanize(str, lowFirstLetter) {\n str = str || this.str;\n\n var str = str.toLowerCase();\n str = str.replace(this.idSuffix, '');\n str = str.replace(this.underbar, ' ');\n if (!lowFirstLetter) {\n str = this.capitalize(str);\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.capitalize('message_properties') -> 'Message_properties'\n String.capitalize('message properties') -> 'Message properties'\n */\n capitalize(str) {\n str = str || this.str;\n\n str = str.toLowerCase();\n str = str.substring(0, 1).toUpperCase() + str.substring(1);\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.dasherize('message_properties') -> 'message-properties'\n String.dasherize('message properties') -> 'message-properties'\n */\n dasherize(str) {\n str = str || this.str;\n\n str = str.replace(this.spaceOrUnderbar, '-');\n str = str.toLowerCase();\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.normify('message_properties') -> 'Message Properties'\n String.normify('message properties') -> 'Message Properties'\n Inflactor.normify('Message_propertyId', true) -> 'Message Properties Id'\n */\n normify(str, allFirstUpper) {\n str = str || this.str;\n\n //var str = str.toLowerCase();\n if (allFirstUpper === true) {\n str = this.camelize(str);\n str = this.underscore(str);\n } else {\n str = str.toLowerCase();\n }\n\n str = str.replace(this.underbar, ' ');\n var str_arr = str.split(' ');\n for (var x = 0; x < str_arr.length; x++) {\n var d = str_arr[x].split('-');\n for (var i = 0; i < d.length; i++) {\n if (this.nonTitlecasedWords.indexOf(d[i].toLowerCase()) < 0) {\n d[i] = this.capitalize(d[i]);\n }\n }\n str_arr[x] = d.join('-');\n }\n str = str_arr.join(' ');\n str = str.substring(0, 1).toUpperCase() + str.substring(1);\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.demodulize('Message::Bus::Properties') -> 'Properties'\n */\n demodulize(str) {\n str = str || this.str;\n\n var str_arr = str.split('::');\n str = str_arr[str_arr.length - 1];\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.tableize('MessageBusProperty') -> 'message_bus_properties'\n */\n tableize(str) {\n str = str || this.str;\n\n str = this.pluralize(this.underscore(str));\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.classify('message_bus_properties') -> 'MessageBusProperty'\n */\n classify(str) {\n str = str || this.str;\n\n str = this.singularize(this.camelize(str));\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.foreignKey('MessageBusProperty') -> 'message_bus_property_id'\n String.foreignKey('MessageBusProperty', true) -> 'message_bus_propertyid'\n */\n foreignKey(str, dropIdUbar = false) {\n str = str || this.str;\n\n str = this.underscore(this.demodulize(str)) + (dropIdUbar ? '' : '_') + 'id';\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.ordinalize('the 1 pitch') -> 'the 1st pitch'\n */\n ordinalize(str) {\n str = str || this.str;\n\n var str_arr = str.split(' ');\n for (var x = 0; x < str_arr.length; x++) {\n var i = parseInt(str_arr[x]);\n if (i === NaN) {\n var ltd = str_arr[x].substring(str_arr[x].length - 2);\n var ld = str_arr[x].substring(str_arr[x].length - 1);\n var suf = 'th';\n if (ltd != '11' && ltd != '12' && ltd != '13') {\n if (ld === '1') {\n suf = 'st';\n } else if (ld === '2') {\n suf = 'nd';\n } else if (ld === '3') {\n suf = 'rd';\n }\n }\n str_arr[x] += suf;\n }\n }\n str = str_arr.join(' ');\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /**\n * @method invoke\n **/\n static invoke() {\n const argz = Object.values(arguments);\n const instance = new String(null, false);\n const method = arguments[0];\n argz.shift();\n\n if (typeof instance[method] === 'function') {\n return instance[method](...argz);\n }\n\n return null;\n }\n}\n\nconst pluralize = function() {\n const argz = ['pluralize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst singularize = function() {\n const argz = ['singularize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst humanize = function() {\n const argz = ['humanize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst underscore = function() {\n const argz = ['underscore', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst camelize = function() {\n const argz = ['camelize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst capitalize = function() {\n const argz = ['capitalize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst dasherize = function() {\n const argz = ['dasherize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst normify = function() {\n const argz = ['normify', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst demodulize = function() {\n const argz = ['demodulize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst tableize = function() {\n const argz = ['tableize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst classify = function() {\n const argz = ['classify', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst foreignKey = function() {\n const argz = ['foreignKey', ...arguments];\n\n return String.invoke(...argz);\n};\n\nexport {\n pluralize,\n singularize,\n humanize,\n underscore,\n camelize,\n capitalize,\n dasherize,\n normify,\n demodulize,\n tableize,\n classify,\n foreignKey\n}","import { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote } from './resources';\nimport { BrowserAdapter, NodeAdapter, EmberJsAdapter } from './adapters';\nimport { pluralize, singularize } from './utils/string';\n\nconst resources = {\n Contact,\n Driver,\n Entity,\n Order,\n Payload,\n Place,\n TrackingStatus,\n Vehicle,\n Vendor,\n Waypoint,\n Zone,\n ServiceArea,\n ServiceRate,\n ServiceQuote,\n};\n\nconst adapters = {\n BrowserAdapter,\n NodeAdapter,\n EmberJsAdapter,\n};\n\nclass Resolver {\n constructor() {\n this.resources = resources;\n this.adapters = adapters;\n\n return this.lookup(...arguments);\n }\n\n lookup(type, className) {\n const key = pluralize(type);\n const params = [...arguments].slice(2);\n\n if (!this[key]) {\n throw new Error('Attempted to resolve invalid type');\n }\n\n if (!this[key][className]) {\n throw new Error(`No ${singularize(type)} named ${className} to resolve`);\n }\n\n return new this[key][className](...params);\n }\n}\n\nconst lookup = function () {\n return new Resolver(...arguments);\n};\n\nexport { Resolver, lookup };\n","import { lookup } from './resolver';\nimport { pluralize, classify } from './utils/string';\nimport { isArray } from './utils/array';\nimport { Collection, detectAdapter, isResource, StoreActions } from './utils';\nimport { set, isCallable, invoke } from './utils/object';\n\nconst extendStoreActions = (store, actions = []) => {\n store.actions = isArray(actions) ? actions : [actions];\n\n if (isArray(actions)) {\n for (let i = 0; i < actions.length; i++) {\n const action = actions[i];\n\n store.extendActions(action);\n }\n return;\n }\n\n if (actions instanceof StoreActions) {\n actions.extend(store);\n }\n\n return store;\n};\n\nconst afterFetch = (store, json) => {\n if (typeof store.options.onAfterFetch === 'function') {\n store.options.onAfterFetch(json);\n }\n\n if (isArray(json)) {\n const serialized = [];\n\n for (let i = 0; i < json.length; i++) {\n serialized.push(store.afterFetch(json[i]));\n }\n\n return new Collection(...serialized);\n }\n\n const resourceInstance = store.serialize(json);\n return store.deposit(resourceInstance);\n};\n\nclass Store {\n constructor(resource, adapter, options = {}) {\n this.resource = resource;\n this.adapter = adapter || detectAdapter();\n this.namespace = pluralize(resource);\n this.storage = new Collection();\n this.options = options;\n this.extendActions(options.actions);\n }\n\n extendActions(actions = []) {\n return extendStoreActions(this, actions);\n }\n\n deposit(resourceInstance) {\n // this.storage[this.namespace].pushObject(resourceInstance);\n\n return resourceInstance;\n }\n\n serialize(json) {\n return lookup('resource', classify(this.resource), json, this.adapter);\n }\n\n afterFetch(json) {\n return afterFetch(this, json);\n }\n\n create(attributes = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.post(`${this.namespace}`, attributes, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n update(id, attributes = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.put(`${this.namespace}/${id}`, attributes, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n findRecord(id, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}/${id}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n findAll(options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n query(query = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, query, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n queryRecord(query = {}, options = {}) {\n query.single = true;\n\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, query, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n destroy(record, options = {}) {\n const id = isResource(record) ? record.getAttribute('id') : record;\n\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.delete(`${this.namespace}/${id}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n}\n\nexport default Store;\n\nexport { extendStoreActions, afterFetch };\n","import Store from './store';\nimport Resource from './resource';\nimport { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote } from './resources';\nimport { BrowserAdapter, NodeAdapter, EmberJsAdapter, Adapter } from './adapters';\nimport { isNodeEnvironment, detectAdapter, isLatitude, isLongitude, Point, isResource, GoogleAddress, Collection, StoreActions } from './utils';\nimport { pluralize, singularize, classify, dasherize, camelize } from './utils/string';\nimport { extendStoreActions } from './store';\nimport { orderActions } from './resources/order';\nimport { driverActions } from './resources/driver';\n\n/**\n * // instance\n * const fleetbase = new Fleetbase();\n *\n * const contact = fleetbase.contacts.create({\n * \t\tname: 'Ron',\n * \t\tphone: '+65 9999 8888'\n * });\n *\n * constact.update({ name: 'Hollywood Ron' });\n *\n * // export\n * import { Contact } from '@fleetbase/sdk';\n *\n * const contact = new Contact({\n * \t\tname: 'Ron',\n * \t\tphone: '+65 9999 8888'\n * });\n *\n * contact.save();\n */\n\nexport default class Fleetbase {\n /**\n * Builds an instance of the Fleetbase SDK\n *\n * @param {String} publicKey The public key issued\n * @param {Object} config The version of resource to access\n * @param {Boolean} debug Debug mode for SDK\n * @return {Fleetbase} Instance\n */\n constructor(publicKey, config = {}, debug = false) {\n this.version = config.version ?? 'v1';\n this.options = {\n version: this.version,\n host: config.host ?? 'https://api.fleetbase.io',\n namespace: config.namespace ?? this.version,\n debug,\n publicKey,\n };\n\n if (typeof publicKey !== 'string' || publicKey.length === 0) {\n throw new Error('⚠️ Invalid public key given to Fleetbase SDK');\n }\n\n if (!isNodeEnvironment() && publicKey.toLowerCase().startsWith('$')) {\n throw new Error('Secret key provided. You must use a public key with Fleetbase Javascript SDK!');\n }\n\n this.adapter = config.adapter || detectAdapter(this.options);\n\n this.orders = new Store('order', this.adapter).extendActions(orderActions);\n this.entities = new Store('entity', this.adapter);\n this.places = new Store('place', this.adapter);\n this.drivers = new Store('driver', this.adapter).extendActions(driverActions);\n this.vehicles = new Store('vehicle', this.adapter);\n this.vendors = new Store('vendor', this.adapter);\n this.contacts = new Store('contact', this.adapter);\n }\n\n static newInstance() {\n return new Fleetbase(...arguments);\n }\n\n setAdapter(adapter) {\n this.adapter = adapter;\n }\n\n getAdapter() {\n return this.adapter;\n }\n}\n\nexport {\n Store,\n Resource,\n Contact,\n Driver,\n Entity,\n Order,\n Payload,\n Place,\n TrackingStatus,\n Vehicle,\n Vendor,\n Waypoint,\n Zone,\n ServiceArea,\n ServiceRate,\n ServiceQuote,\n BrowserAdapter,\n NodeAdapter,\n EmberJsAdapter,\n Adapter,\n isNodeEnvironment,\n isLatitude,\n isLongitude,\n Point,\n isResource,\n GoogleAddress,\n Collection,\n StoreActions,\n extendStoreActions,\n pluralize,\n singularize,\n classify,\n dasherize,\n camelize,\n};\n","export default function isLatitude(coordinate) {\n return isFinite(coordinate) && Math.abs(coordinate) <= 90;\n}\n","export default function isLongitude(coordinate) {\n return isFinite(coordinate) && Math.abs(coordinate) <= 180 && Math.abs(coordinate) >= 90;\n}\n"],"names":["isArray","Array","replace","array","start","deleteCount","items","length","splice","i","chunk","slice","isCollection","arr","identityFunction","item","mixed","Collection","objectAt","index","iter","key","value","arguments","Boolean","findIndex","predicate","startAt","len","find","callback","target","bind","undefined","any","every","cb","indexOf","val","withNaNCheck","insertAt","this","indexes","map","idx","_this2","object","methodName","args","ret","forEach","push","_item$methodName","filter","sortKeys","sort","a","b","propA","propB","compareValue","compare","seen","Set","getter","get","has","add","uniqBy","includes","removeAt","obj","objects","toArray","reverse","clear","loc","removeObject","pushObject","_this3","addObject","isEmpty","none","size","objectType","isBlank","test","isResource","record","Resource","isPhone","phone","isNodeEnvironment","process","_typeof","_process","env","release","name","search","window","navigator","product","detectAdapter","options","lookup","GoogleAddress","place","geometry","components","parseComponents","attributes","parseProperties","address_components","reduce","acc","data","types","type","streetNumber","streetName","coordinates","location","Object","values","city","or","county","stateShort","stateLong","countryShort","country","countryLong","postalCode","address","join","keys","pkey","short","short_name","long_name","Point","latitude","longitude","coorindates","lat","lng","serialize","json","getResolved","func","path","resolved","current","isObject","isFunction","pathArray","split","newPath","set","iterations","StoreActions","actions","bindTo","binding","action","fn","adapter","resource","dirtyAttributes","changes","isLoading","isSaving","isDestroying","isReloading","version","setAdapter","store","Store","onAfterFetch","syncAttributes","_this$options","getAttribute","mergeAttributes","setFlags","create","then","response","_this","update","id","destroy","findRecord","_this4","reset","flags","state","validFlags","flag","Error","attribues","getAttributes","onlyDirty","savedirty","dirtyAttributeKeys","isAttributeFilled","Date","hasAttributes","isNew","isLoaded","property","_this5","call","setAttributes","previousValue","changedAt","setAttribute","attribute","defaultValue","properties","attributeKeys","prop","hasAttribute","_this6","_value","_value2","modelAttributes","orderActions","getDistanceAndTime","params","namespace","getNextActivity","dispatch","post","afterFetch","updateActivity","setDestination","destinationId","captureQrCode","subjectId","captureSignature","complete","cancel","Order","isStarted","isCanceled","isCompleted","Payload","entity","waypoints","Entity","Place","_this$getAttribute","_this$getAttribute2","owner","googleAddress","street1","street2","province","postal_code","neighborhood","district","building","security_access_code","Waypoint","TrackingStatus","Vehicle","driverActions","login","identity","password","verifyCode","code","track","retrieve","syncDevice","token","setHeaders","Driver","Vendor","Contact","Zone","ServiceArea","ServiceRate","ServiceQuote","Adapter","config","host","headers","BrowserAdapter","Authorization","publicKey","Promise","resolve","reject","statusText","status","ok","method","fetch","url","mode","Headers","parseJSON","errors","error","query","urlParams","URLSearchParams","toString","request","body","JSON","stringify","NodeAdapter","axios","baseURL","commonHeaders","defaults","common","transform","handleError","put","patch","EmberJsAdapter","String","string","chain","RegExp","str","rules","skip","override","toLowerCase","x","match","plural","applyRules","pluralRules","uncountableWords","singular","singularRules","lowFirstLetter","str_path","str_arr","charAt","toUpperCase","substring","first","last","uppercase","underbarPrefix","idSuffix","underbar","capitalize","spaceOrUnderbar","allFirstUpper","camelize","underscore","d","nonTitlecasedWords","pluralize","singularize","dropIdUbar","demodulize","NaN","parseInt","ltd","ld","suf","argz","instance","shift","invoke","classify","resources","adapters","Resolver","className","extendStoreActions","extend","extendActions","storage","resourceInstance","serialized","deposit","single","_this7","Fleetbase","debug","startsWith","orders","entities","places","drivers","vehicles","vendors","contacts","coordinate","isFinite","Math","abs"],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gM,MAAM,oDAGf3G,KAAuBuM,EAAU0C,cAAcyD,WAAW,WACrD,IAAI/L,MAAM,sFAGfhC,QAAUuH,EAAOvH,SAAWhE,EAAc9D,KAAK+D,cAE/C+R,OAAS,IAAIrN,GAAM,QAASzI,KAAK8H,SAASsN,cAAc1J,QACxDqK,SAAW,IAAItN,GAAM,SAAUzI,KAAK8H,cACpCkO,OAAS,IAAIvN,GAAM,QAASzI,KAAK8H,cACjCmO,QAAU,IAAIxN,GAAM,SAAUzI,KAAK8H,SAASsN,cAAclH,SAC1DgI,SAAW,IAAIzN,GAAM,UAAWzI,KAAK8H,cACrCqO,QAAU,IAAI1N,GAAM,SAAUzI,KAAK8H,cACnCsO,SAAW,IAAI3N,GAAM,UAAWzI,KAAK8H,6CAO9C,SAAWA,QACFA,QAAUA,4BAGnB,kBACW9H,KAAK8H,qCAThB,oBACe6N,6BAAa7W,ghBHgZf,eACP2V,GAAQ,8CAAe3V,mBAEtB8S,GAAOgD,aAAPhD,KAAiB6C,2CASV,eACRA,GAAQ,+CAAgB3V,mBAEvB8S,GAAOgD,aAAPhD,KAAiB6C,yEIteb,SAAoB4B,UACxBC,SAASD,IAAeE,KAAKC,IAAIH,IAAe,wBCD5C,SAAqBA,UACzBC,SAASD,IAAeE,KAAKC,IAAIH,IAAe,KAAOE,KAAKC,IAAIH,IAAe"} \ No newline at end of file +{"version":3,"file":"fleetbase.js","sources":["../../src/utils/array.js","../../src/utils/collection.js","../../src/utils/is-empty.js","../../src/utils/is-blank.js","../../src/utils/is-resource.js","../../src/utils/is-phone.js","../../src/utils/is-node-environment.js","../../src/utils/detect-adapter.js","../../src/utils/google-address.js","../../src/utils/point.js","../../src/utils/object.js","../../src/utils/store-actions.js","../../src/resource.js","../../src/resources/order.js","../../src/resources/payload.js","../../src/resources/entity.js","../../src/resources/place.js","../../src/resources/waypoint.js","../../src/resources/tracking-status.js","../../src/resources/vehicle.js","../../src/resources/driver.js","../../src/resources/vendor.js","../../src/resources/contact.js","../../src/resources/zone.js","../../src/resources/service-area.js","../../src/resources/service-rate.js","../../src/resources/service-quote.js","../../src/adapter.js","../../src/adapters/browser.js","../../src/adapters/node.js","../../src/adapters/ember.js","../../src/utils/string.js","../../src/resolver.js","../../src/store.js","../../src/fleetbase.js","../../src/utils/is-latitude.js","../../src/utils/is-longitude.js"],"sourcesContent":["const { isArray } = Array;\n\nexport {\n isArray\n};\n","import { isArray } from './array';\n\n/**\n * Collection\n * Extended array inspired by Ember's NativeArray\n **/\n\nconst CHUNK_SIZE = 60000;\n\n// To avoid overflowing the stack, we splice up to CHUNK_SIZE items at a time.\n// See https://code.google.com/p/chromium/issues/detail?id=56588 for more details.\nconst replace = (array, start, deleteCount, items = []) => {\n if (isArray(array)) {\n if (items.length <= CHUNK_SIZE) {\n array.splice(start, deleteCount, ...items);\n } else {\n array.splice(start, deleteCount);\n\n for (let i = 0; i < items.length; i += CHUNK_SIZE) {\n let chunk = items.slice(i, i + CHUNK_SIZE);\n array.splice(start + i, 0, ...chunk);\n }\n }\n } else if (isCollection(arr)) {\n array.replace(start, deleteCount, items);\n }\n};\n\nconst identityFunction = (item) => item;\n\nconst uniqBy = (array, key = identityFunction) => {\n let ret = [];\n let seen = new Set();\n let getter = typeof key === 'function' ? key : (item) => get(item, key);\n\n array.forEach((item) => {\n let val = getter(item);\n if (!seen.has(val)) {\n seen.add(val);\n ret.push(item);\n }\n });\n\n return ret;\n};\n\nconst isCollection = (mixed) => mixed instanceof Collection;\n\nconst objectAt = (array, index) => {\n if (isArray(array)) {\n return array[index];\n } else if (isCollection(array)) {\n return array.objectAt(index);\n }\n\n return null;\n};\n\nconst iter = (key, value) => {\n let valueProvided = arguments.length === 2;\n return valueProvided ? (item) => value === item[key] : (item) => Boolean(item[key]);\n};\n\nconst findIndex = (array, predicate, startAt = 0) => {\n let len = array.length;\n for (let index = startAt; index < len; index++) {\n let item = objectAt(array, index);\n if (predicate(item, index, array)) {\n return index;\n }\n }\n return -1;\n};\n\nconst find = (array, callback, target) => {\n let predicate = callback.bind(target);\n let index = findIndex(array, predicate, 0);\n return index === -1 ? undefined : objectAt(array, index);\n};\n\nconst any = (array, callback, target) => {\n let predicate = callback.bind(target);\n return findIndex(array, predicate, 0) !== -1;\n};\n\nconst every = (array, callback, target) => {\n let cb = callback.bind(target);\n let predicate = (item, index, array) => !cb(item, index, array);\n return findIndex(array, predicate, 0) === -1;\n};\n\nconst indexOf = (array, val, startAt = 0, withNaNCheck) => {\n let len = array.length;\n\n if (startAt < 0) {\n startAt += len;\n }\n\n // SameValueZero comparison (NaN !== NaN)\n let predicate = withNaNCheck && val !== val ? (item) => item !== item : (item) => item === val;\n return findIndex(array, predicate, startAt);\n};\n\nconst removeAt = (array, index, len = 1) => {\n replace(array, index, len, []);\n return array;\n};\n\nconst insertAt = (array, index, item) => {\n replace(array, index, 0, [item]);\n return item;\n};\n\nclass Collection extends Array {\n constructor(...items) {\n if (isArray(arguments[0])) {\n super(...arguments[0]);\n } else {\n super(...arguments);\n }\n }\n\n get notEmpty() {\n return this.length > 0;\n }\n\n get empty() {\n return this.length === 0;\n }\n\n get first() {\n return objectAt(this, 0);\n }\n\n get last() {\n return objectAt(this, this.length - 1);\n }\n\n replace(start, deleteCount, items = []) {\n replace(this, start, deleteCount, items);\n\n return this;\n }\n\n objectsAt(indexes) {\n return indexes.map((idx) => objectAt(this, idx));\n }\n\n objectAt(index) {\n return objectAt(this, index);\n }\n\n indexOf(object, startAt) {\n return indexOf(this, object, startAt, false);\n }\n\n lastIndexOf(object, startAt) {\n let len = this.length;\n\n if (startAt === undefined || startAt >= len) {\n startAt = len - 1;\n }\n\n if (startAt < 0) {\n startAt += len;\n }\n\n for (let idx = startAt; idx >= 0; idx--) {\n if (objectAt(this, idx) === object) {\n return idx;\n }\n }\n\n return -1;\n }\n\n includes(object, startAt) {\n return indexOf(this, object, startAt, true) !== -1;\n }\n\n findBy() {\n return find(this, iter(...arguments));\n }\n\n findIndexBy() {\n return findIndex(this, iter(...arguments));\n }\n\n isEvery() {\n return every(this, iter(...arguments));\n }\n\n isAny() {\n return any(this, iter(...arguments));\n }\n\n invoke(methodName, ...args) {\n let ret = [];\n\n this.forEach((item) => ret.push(item[methodName]?.(...args)));\n\n return ret;\n }\n\n toArray() {\n return this.map((item) => item);\n }\n\n compact() {\n return this.filter((value) => value != null);\n }\n\n sortBy() {\n let sortKeys = arguments;\n\n return this.sort((a, b) => {\n for (let i = 0; i < sortKeys.length; i++) {\n let key = sortKeys[i];\n let propA = a[key];\n let propB = b[key];\n // return 1 or -1 else continue to the next sortKey\n let compareValue = compare(propA, propB);\n\n if (compareValue) {\n return compareValue;\n }\n }\n return 0;\n });\n }\n\n uniqBy(key) {\n return uniqBy(this, key);\n }\n\n without(value) {\n if (!this.includes(value)) {\n return this; // nothing to do\n }\n\n // SameValueZero comparison (NaN !== NaN)\n let predicate = value === value ? (item) => item !== value : (item) => item === item;\n return this.filter(predicate);\n }\n\n clear() {\n let len = this.length;\n if (len === 0) {\n return this;\n }\n\n this.replace(0, len, []);\n return this;\n }\n\n insertAt(idx, object) {\n insertAt(this, idx, object);\n return this;\n }\n\n replaceAt(idx, object) {\n return this.replace(idx, 1, [object]);\n }\n\n removeAt(start, len) {\n return removeAt(this, start, len);\n }\n\n pushObject(obj) {\n return this.insertAt(this.length, obj);\n }\n\n pushObjects(objects) {\n this.replace(this.length, 0, objects);\n return this;\n }\n\n popObject() {\n let len = this.length;\n if (len === 0) {\n return null;\n }\n\n let ret = objectAt(this, len - 1);\n this.removeAt(len - 1, 1);\n return ret;\n }\n\n shiftObject() {\n if (this.length === 0) {\n return null;\n }\n\n let ret = objectAt(this, 0);\n this.removeAt(0);\n return ret;\n }\n\n unshiftObject(obj) {\n return insertAt(this, 0, obj);\n }\n\n unshiftObjects(objects) {\n this.replace(0, 0, objects);\n return this;\n }\n\n reverseObjects() {\n let len = this.length;\n if (len === 0) {\n return this;\n }\n\n let objects = this.toArray().reverse();\n this.replace(0, len, objects);\n return this;\n }\n\n setObjects(objects) {\n if (objects.length === 0) {\n return this.clear();\n }\n\n let len = this.length;\n this.replace(0, len, objects);\n return this;\n }\n\n removeObject(obj) {\n let loc = this.length || 0;\n while (--loc >= 0) {\n let curObject = objectAt(this, loc);\n\n if (curObject === obj) {\n this.removeAt(loc);\n }\n }\n return this;\n }\n\n removeObjects(objects) {\n for (let i = objects.length - 1; i >= 0; i--) {\n this.removeObject(objects[i]);\n }\n\n return this;\n }\n\n addObject(obj) {\n let included = this.includes(obj);\n\n if (!included) {\n this.pushObject(obj);\n }\n\n return this;\n }\n\n addObjects(objects) {\n objects.forEach((obj) => this.addObject(obj));\n return this;\n }\n}\n\nexport default Collection;\n\nexport { replace, uniqBy, isCollection, objectAt, iter, findIndex, find, any, every, indexOf, removeAt, insertAt };\n","const isEmpty = (obj) => {\n const none = obj === null || obj === undefined;\n if (none) {\n return none;\n }\n\n if (typeof obj.size === 'number') {\n return !obj.size;\n }\n\n const objectType = typeof obj;\n\n if (objectType === 'object') {\n const { size } = obj;\n if (typeof size === 'number') {\n return !size;\n }\n }\n\n if (typeof obj.length === 'number' && objectType !== 'function') {\n return !obj.length;\n }\n\n if (objectType === 'object') {\n const { length } = obj;\n if (typeof length === 'number') {\n return !length;\n }\n }\n\n return false;\n};\n\nexport default isEmpty;\n","import isEmpty from './is-empty';\n\nconst isBlank = (obj) => isEmpty(obj) || (typeof obj === 'string' && /\\S/.test(obj) === false);\n\nexport default isBlank;\n","import Resource from '../resource';\n\nexport default function isResource(record) {\n return record instanceof Resource;\n}\n","const isPhone = (phone = '') => {\n return /^[+]?[\\s./0-9]*[(]?[0-9]{1,4}[)]?[-\\s./0-9]*$/g.test(phone);\n}\n\nexport default isPhone;","/**\n * Determines if environment SDK is initialized in is Node, additionally checks pass if environment is ReactNative.\n * \n * @returns boolean\n */\nconst isNodeEnvironment = () => {\n return (typeof process !== 'undefined') && (typeof process?.env === 'object' || process.release?.name?.search(/node|io.js/) !== -1) && (typeof window === 'undefined' || window?.navigator?.product === 'ReactNative');\n};\n\nexport default isNodeEnvironment;","import { lookup } from '../resolver';\nimport isNodeEnvironment from './is-node-environment';\n\nconst detectAdapter = (options = {}) => {\n if (isNodeEnvironment()) {\n return lookup('adapter', 'NodeAdapter', options);\n }\n\n return lookup('adapter', 'BrowserAdapter', options);\n}\n\nexport default detectAdapter;","const { isArray } = Array;\n\nclass GoogleAddress {\n constructor(place) {\n this.place = place;\n this.geometry = place?.geometry;\n this.components = this.parseComponents();\n this.attributes = this.parseProperties();\n }\n\n parse() {\n this.parseComponents();\n this.parseProperties();\n }\n\n parseComponents() {\n const components = (this.place?.address_components || []).reduce(function (acc, data) {\n data.types.forEach(function (type) {\n acc[type] = data;\n });\n return acc;\n }, {});\n\n return components;\n }\n\n parseProperties() {\n const attributes = {\n streetNumber: this.get('street_number'),\n streetName: this.get('route'),\n coordinates: this.geometry?.location ? Object.values(this.geometry.location) : [0, 0],\n city: this.or(['locality', 'sublocality', 'sublocality_level_1', 'neighborhood', 'administrative_area_level_3', 'administrative_area_level_2']),\n county: this.get('administrative_area_level_2'),\n stateShort: this.get('administrative_area_level_1', true),\n stateLong: this.get('administrative_area_level_1'),\n countryShort: this.get('country', true),\n country: this.get('country', true),\n countryLong: this.get('country'),\n postalCode: this.get('postal_code'),\n };\n\n attributes.address = [attributes.streetNumber, attributes.streetName].filter(Boolean).join(' ');\n\n return attributes;\n }\n\n all() {\n return this.attributes;\n }\n\n or(keys = []) {\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n\n if (isArray(key)) {\n const pkey = key[0];\n const short = key[1];\n\n if (this.has(pkey)) {\n return this.get(pkey, short);\n }\n\n continue;\n }\n\n if (this.has(key)) {\n return this.get(key);\n }\n }\n\n return null;\n }\n\n has(key) {\n return (key in this.components);\n }\n\n get(key, short = false) {\n if (!(key in this.components)) {\n return null;\n }\n\n return short ? this.components[key].short_name : this.components[key].long_name;\n }\n\n setAttributes(attributes = {}) {\n this.attributes = {...this.attributes, ...attributes};\n\n return this;\n }\n\n setAttribute(key, value) {\n this.attributes[key] = value;\n\n return this;\n }\n\n getAttribute(key) {\n return this.attributes[key] || null;\n }\n}\n\nexport default GoogleAddress;\n","export default class Point {\n constructor(latitude = 0, longitude = 0) {\n this.type = 'Point';\n this.coordinates = [longitude, latitude];\n }\n\n get latitude() {\n return this.coordinates[1];\n }\n\n get longitude() {\n return this.coordinates[0];\n }\n\n lat() {\n return this.latitude;\n }\n\n lng() {\n return this.longitude;\n }\n\n static fromGeoJson(json) {\n [ longitude, latitude ] = json.coordinates;\n\n return new Point(latitude, longitude);\n }\n\n serialize() {\n return {\n type: 'Point',\n coorindates: [this.lat(), this.lng()]\n };\n }\n\n toJson() {\n return this.serialize();\n }\n\n toString() {\n return `(${this.latitude}, ${this.longitude})`;\n }\n}","import isEmpty from './is-empty';\n\nconst isResource = (mixed) => typeof mixed === 'object' && !isEmpty(mixed?.attributes) && typeof mixed?.attributes === 'object';\n\nconst isCallable = (object, property) => typeof object[property] === 'function';\n\nconst getResolved = (func, path) => {\n const resolved = func();\n return Array.isArray(resolved) || typeof resolved === 'object' ? get(resolved, path) : null;\n};\n\nconst invoke = (object, method) => {\n if (typeof object[method] === 'function') {\n return object[method].bind(object);\n }\n};\n\nconst get = (object, path) => {\n let current = object;\n\n const type = typeof object;\n const isObject = type === 'object';\n const isFunction = type === 'function';\n const isArray = Array.isArray(object);\n\n const pathType = typeof path;\n const pathIsString = pathType === 'string';\n const pathIsDotted = pathIsString && path.includes('.');\n const pathArray = pathIsDotted ? path.split('.') : [path];\n\n if (isArray || isObject) {\n for (let i = 0; i < pathArray.length; i++) {\n if (current && current[pathArray[i]] === undefined) {\n return null;\n } else if (current) {\n current = current[pathArray[i]];\n\n // if is resource then return get on it's attributes\n if (isResource(current) && pathArray[i + 1] !== undefined) {\n const newPath = pathArray.slice(i + 1).join('.');\n\n return get(current.attributes, newPath);\n }\n\n // resolve functions and continue\n if (typeof current === 'function') {\n const newPath = pathArray.slice(i + 1).join('.');\n return getResolved(current, newPath);\n }\n }\n }\n return current;\n }\n\n if (isFunction) {\n return getResolved(object, path);\n }\n};\n\nconst getProperties = (object, properties = []) => {\n const selected = {};\n let propertyNames = arguments;\n let i = 1;\n\n if (arguments.length === 2 && Array.isArray(properties)) {\n i = 0;\n propertyNames = arguments[1];\n }\n\n for (; i < propertyNames.length; i++) {\n selected[propertyNames[i]] = get(object, propertyNames[i]);\n }\n\n return selected;\n};\n\nconst set = (object, path, value) => {\n let current = object;\n const type = typeof object;\n const isObject = type === 'object';\n const isFunction = type === 'function';\n const isArray = Array.isArray(object);\n\n // if is function\n if (isFunction) {\n // throw error should be object or array or object like\n }\n\n const pathType = typeof path;\n const pathIsString = pathType === 'string';\n const pathIsDotted = pathIsString && path.includes('.');\n const pathArray = pathIsDotted ? path.split('.') : [path];\n const iterations = pathArray.length;\n\n if (isArray || isObject) {\n for (let i = 0; i < iterations - 1; i++) {\n if (!current[pathArray[i]]) {\n current[pathArray[i]] = {};\n }\n current = current[pathArray[i]];\n }\n\n current[pathArray[iterations - 1]] = value;\n }\n\n return value;\n};\n\nconst setProperties = (object, properties = {}) => {\n for (const property in properties) {\n set(object, property, properties[property]);\n }\n\n return object;\n};\n\nconst extend = (target, classes = []) => {\n if (arguments.length > 1) {\n classes = arguments;\n }\n for (let index = 0; index < classes.length; index++) {\n for (const property in classes[index]) {\n if (Object.prototype.hasOwnProperty.call(classes[index], property)) {\n target[property] = classes[index][property];\n }\n }\n }\n return target;\n};\n\nexport { set, get, getProperties, setProperties, extend, isCallable, invoke };\n","import { set } from './object';\n\nexport default class StoreActions {\n constructor(actions = {}, bind = null) {\n this.actions = actions;\n this.bind = bind;\n }\n\n extend(bindTo = null) {\n const binding = bindTo || this.bind;\n\n if (!binding) {\n return this;\n }\n\n if (this?.actions && typeof this.actions === 'object') {\n for (let action in this.actions) {\n const fn = this.actions[action];\n\n if (typeof fn !== 'function') {\n set(binding, action, fn);\n continue;\n }\n\n set(binding, action, fn.bind(binding));\n }\n }\n\n return this;\n }\n}\n","import Store from './store';\nimport { isEmpty } from './utils';\nimport { isArray } from './utils/array';\nimport { set, get } from './utils/object';\n\nclass Resource {\n /**\n\t * The base resource for all resources\n\n\t * @return {[type]} [description]\n\t */\n constructor(attributes = {}, adapter, resource, options = {}) {\n this.attributes = attributes;\n this.dirtyAttributes = {};\n this.changes = {};\n this.isLoading = false;\n this.isSaving = false;\n this.isDestroying = false;\n this.isReloading = false;\n this.resource = resource;\n this.options = options;\n this.version = options.version || 'v1';\n this.setAdapter(adapter);\n }\n\n /**\n * Set a new adapter to the resource instance, this will update the Store instance\n *\n * @param {Adapter} adapter\n * @return {Resource} this\n */\n setAdapter(adapter) {\n this.adapter = adapter;\n this.store = new Store(this.resource, adapter, {\n onAfterFetch: this.syncAttributes.bind(this),\n actions: this.options?.actions\n });\n\n return this;\n }\n\n /**\n * Getter for id attribute\n *\n * @var {String}\n */\n get id() {\n return this.getAttribute('id');\n }\n\n /**\n * Creates a new resource on the server\n *\n * @param {Object} payload [description]\n * @return {[type]} [description]\n */\n create(attributes = {}) {\n const data = this.mergeAttributes(attributes);\n this.setFlags(['isLoading', 'isSaving']);\n\n return this.store.create(data).then((response) => {\n this.setFlags(['isLoading', 'isSaving'], false);\n\n return response;\n });\n }\n\n /**\n * Creates a new resource on the server\n *\n * @param {Object} payload [description]\n * @return {[type]} [description]\n */\n update(attributes = {}) {\n this.setFlags(['isLoading', 'isSaving']);\n\n return this.store.update(this.attributes.id, attributes).then((response) => {\n this.setFlags(['isLoading', 'isSaving'], false);\n\n return response;\n });\n }\n\n /**\n * Deletes the resource instance on the server\n *\n * @return {[type]} [description]\n */\n destroy() {\n this.setFlags(['isLoading', 'isDestroying']);\n\n return this.store.destroy(this.attributes.id).then((response) => {\n this.setFlags(['isLoading', 'isDestroying'], false);\n\n return response;\n });\n }\n\n /**\n * Reloads the resource from the server.\n *\n * @return {[type]} [description]\n */\n reload() {\n this.setFlags(['isLoading', 'isReloading']);\n\n return this.store.findRecord(this.attributes.id).then((response) => {\n this.reset();\n\n return response;\n });\n }\n\n /**\n * Sets flag properties.\n *\n * @return this\n */\n setFlags(flags = [], state = true) {\n const validFlags = ['isLoading', 'isSaving', 'isReloading', 'isDestroying'];\n\n for(let i = 0; i < flags.length; i++) {\n const flag = flags[i];\n\n if (typeof flag !== 'string' || !validFlags.includes(flag)) {\n throw new Error(`${flag} is not a valid flag!`);\n }\n\n this[flag] = state;\n }\n\n return this;\n }\n\n /**\n * Resets tracked properties\n *\n * @return this\n */\n reset() {\n this.dirtyAttributes = {};\n this.changes = {};\n this.isLoading = false;\n this.isSaving = false;\n this.isReloading = false;\n\n return this;\n }\n\n /**\n * Emptys resource.\n *\n * @return this\n */\n empty() {\n this.reset();\n this.attribues = {};\n\n return this;\n }\n\n /**\n * Saves the resource instance on the server\n *\n * @return {[type]} [description]\n */\n save(options = {}) {\n const attributes = this.getAttributes();\n\n if (isEmpty(this.id)) {\n return this.create(attributes);\n }\n\n if (options.onlyDirty === true) {\n return this.savedirty();\n }\n\n return this.update(attributes);\n }\n\n /**\n * Saves only dirtied attributes.\n *\n * @return {[type]} [description]\n */\n saveDirty() {\n const dirtyAttributeKeys = Object.keys(this.dirtyAttributes);\n const dirtyAttributes = {};\n\n for (let i = 0; i < dirtyAttributeKeys.length; i++) {\n const key = dirtyAttributeKeys[i];\n dirtyAttributes[key] = this.getAttribute(key);\n }\n\n return this.update(dirtyAttributes);\n }\n\n /**\n * Returns the resource meta if exists.\n *\n * @return {Object}\n */\n get meta() {\n return this.getAttribute('meta', {});\n }\n\n /**\n * Returns the date instance resource was created.\n *\n * @return {Date}\n */\n get createdAt() {\n return this.isAttributeFilled('created_at') ? new Date(this.getAttribute('created_at')) : null;\n }\n\n /**\n * Returns the date instance resource was created.\n *\n * @return {Date}\n */\n get updatedAt() {\n return this.isAttributeFilled('updated_at') ? new Date(this.getAttribute('updated_at')) : null;\n }\n\n /**\n * Checks if resource is loaded from the server.\n *\n * @return {Boolean}\n */\n get isLoaded() {\n return this.hasAttributes(['created_at', 'id']);\n }\n\n /**\n * Checks if resource ihas no attributes\n *\n * @return {Boolean}\n */\n get isEmpty() {\n return Object.values(this?.attributes).length === 0;\n }\n\n /**\n * Checks if resource is not saved to server.\n *\n * @return {Boolean}\n */\n get isNew() {\n return !this.id;\n }\n\n /**\n * Checks if resource is not saved to server.\n *\n * @return {Boolean}\n */\n get isSaved() {\n return !this.isNew && this.isLoaded;\n }\n\n /**\n * Checks if resource is deleted on server.\n *\n * @return {Boolean}\n */\n get isDeleted() {\n return this.hasAttributes(['deleted', 'time']);\n }\n\n /**\n * Iterates over each attribute value and property executing a user supplied callback.\n *\n * @return {Object}\n */\n eachAttribute(callback) {\n if (typeof callback !== 'function') {\n return this;\n }\n\n Object.keys(this?.attributes ?? {}).forEach((property) => {\n const value = this.getAttribute(property);\n callback.call(this, value, property);\n });\n\n return this;\n }\n\n /**\n * Gets all changes\n *\n * @return {Object}\n */\n changes() {\n return this.changes;\n }\n\n /**\n * Gets all dirty attributes.\n *\n * @return {Object}\n */\n getDirtyAttributes() {\n return this.dirtyAttributes;\n }\n\n /**\n * Checks if property is dirty.\n *\n * @param {String} property [description]\n * @return {Boolean}\n */\n isDirty(property) {\n return property in this.dirtyAttributes;\n }\n\n /**\n * Checks if any properties is dirty.\n *\n * @return {Boolean}\n */\n hasDirtyAttributes() {\n return Object.keys(this?.dirtyAttributes ?? {}).length > 0;\n }\n\n /**\n * Updates a instance property without tracking changes or dirtying attribute.\n *\n * @param {String} property [description]\n * @param {mixed} value [description]\n */\n mutate(property, value) {\n this.attributes[property] = value;\n }\n\n /**\n * Set an instance property locally\n *\n * @param {String} property [description]\n * @param {mixed} value [description]\n */\n setAttribute(property, value = null) {\n if (value === null && typeof property === 'object') {\n return this.setAttributes(property);\n }\n\n const previousValue = this?.attributes[property] ?? null;\n\n // use object setter\n set(this.attributes, property, value);\n set(this.dirtyAttributes, property, previousValue);\n \n // this.attributes[property] = value;\n // this.dirtyAttributes[property] = previousValue;\n\n // track changes\n if (!isArray(this?.changes[property])) {\n this.changes[property] = [];\n }\n\n this.changes[property].push({\n property,\n previousValue,\n value,\n changedAt: new Date(),\n });\n\n return this;\n }\n\n /**\n * Set multiple instance properties locally\n *\n * @param {Object} properties [description]\n */\n setAttributes(attributes = {}) {\n for (let property in attributes) {\n this.setAttribute(property, attributes[property]);\n }\n\n return this;\n }\n\n /**\n * Get an attribute\n *\n * @param {String} attribute The attribute key to get\n * @param {mixed} defaultValue The default value if no attribute value\n */\n getAttribute(attribute, defaultValue = null) {\n const value = get(this?.attributes ?? {}, attribute);\n\n if (value === undefined) {\n return defaultValue;\n }\n\n return value;\n }\n\n /**\n * Checks if attribute exists.\n *\n * @param {String} property [description]\n * @return {Boolean}\n */\n hasAttribute(property) {\n if (isArray(property)) {\n const properties = property;\n const attributeKeys = Object.keys(this.attributes ?? {});\n \n return properties.every((prop) => attributeKeys.includes(prop));\n }\n\n if (!this?.attributes) {\n return false;\n }\n\n return property in this.attributes;\n }\n\n /**\n * Alias for checking if has multiple attributes.\n *\n * @param {Array} properties \n * @return {Boolean}\n */\n hasAttributes(properties = []) {\n return this.hasAttribute(properties);\n }\n\n /**\n * Returns true if attribute has value.\n *\n * @param {Array} properties \n * @return {Boolean}\n */\n isAttributeFilled(property) {\n if (isArray(property)) {\n return this.hasAttribute(property) && property.every((prop) => !isEmpty(this.getAttribute(prop)));\n }\n\n return this.hasAttribute(property) && !isEmpty(this.getAttribute(property));\n }\n\n /**\n * Get multiple attributes.\n *\n * @param {Array} properties [description]\n * @param {[type]} value [description]\n */\n getAttributes(properties) {\n const attributes = {};\n\n if (properties === null || properties === undefined) {\n return this.getAttributes(Object.keys(this.attributes));\n }\n\n if (typeof properties === 'string') {\n return this.getAttribute([...arguments]);\n }\n\n if (!isArray(properties)) {\n throw new Error('No attribute properties provided!');\n }\n\n for (let i = 0; i < properties.length; i++) {\n const property = properties[i];\n\n if (typeof property !== 'string') {\n continue;\n }\n\n let value = this.getAttribute(property);\n\n if (typeof value?.attributes === 'object' && !isArray(value?.attributes)) {\n value = value.attributes;\n }\n\n attributes[property] = value;\n }\n\n return attributes;\n }\n\n /**\n * Serialize resource to a POJO\n *\n * @returns {Object}\n */\n serialize() {\n return this.getAttributes();\n }\n\n /**\n * Merge and return attributes on the resource instance.\n *\n * @param {[type]} property [description]\n * @param {[type]} value [description]\n */\n mergeAttributes(attributes = {}) {\n const modelAttributes = this?.attributes ?? {};\n this.attributes = { ...modelAttributes, ...attributes };\n\n return this.attributes;\n }\n\n /**\n * Merge and return attributes on the resource instance.\n *\n * @param {[type]} property [description]\n * @param {[type]} value [description]\n */\n syncAttributes(json = {}) {\n this.attributes = json;\n }\n}\n\nexport default Resource;\n","import Resource from '../resource';\nimport { StoreActions, isResource } from '../utils';\nimport { isValid as isValidDate } from 'date-fns';\n\nconst orderActions = new StoreActions({\n getDistanceAndTime: function (id, params = {}, options = {}) {\n return this.adapter.get(`${this.namespace}/${id}/distance-and-time`, params, options);\n },\n\n getNextActivity: function (id, params = {}, options = {}) {\n return this.adapter.get(`${this.namespace}/${id}/next-activity`, params, options);\n },\n\n dispatch: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/dispatch`, params, options).then(this.afterFetch.bind(this));\n },\n\n start: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/start`, params, options).then(this.afterFetch.bind(this));\n },\n\n updateActivity: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/update-activity`, params, options).then(this.afterFetch.bind(this));\n },\n\n setDestination: function (id, destinationId, params = {}, options = {}) {\n if (isResource(destinationId)) {\n destinationId = destinationId.id;\n }\n\n return this.adapter.post(`${this.namespace}/${id}/set-destination/${destinationId}`, params, options).then(this.afterFetch.bind(this));\n },\n\n captureQrCode: function (id, subjectId = null, params = {}, options = {}) {\n if (isResource(subjectId)) {\n subjectId = subjectId.id;\n }\n\n return this.adapter.post(`${this.namespace}/${id}/capture-qr${!subjectId ? '' : '/' + subjectId}`, params, options);\n },\n\n captureSignature: function (id, subjectId = null, params = {}, options = {}) {\n if (isResource(subjectId)) {\n subjectId = subjectId.id;\n }\n\n return this.adapter.post(`${this.namespace}/${id}/capture-signature${!subjectId ? '' : '/' + subjectId}`, params, options);\n },\n\n complete: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/complete`, params, options).then(this.afterFetch.bind(this));\n },\n\n cancel: function (id, params = {}, options = {}) {\n return this.adapter.delete(`${this.namespace}/${id}/cancel`, params, options).then(this.afterFetch.bind(this));\n },\n});\n\nclass Order extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'order', { actions: orderActions, ...options });\n }\n\n getDistanceAndTime(params = {}, options = {}) {\n return this.store.getDistanceAndTime(this.id, params, options);\n }\n\n dispatch(params = {}, options = {}) {\n return this.store.dispatch(this.id, params, options);\n }\n\n start(params = {}, options = {}) {\n return this.store.start(this.id, params, options);\n }\n\n setDestination(destinationId, params = {}, options = {}) {\n return this.store.setDestination(this.id, destinationId, params, options);\n }\n\n captureQrCode(subjectId = null, params = {}, options = {}) {\n return this.store.captureQrCode(this.id, subjectId, params, options);\n }\n\n captureSignature(subjectId = null, params = {}, options = {}) {\n return this.store.captureSignature(this.id, subjectId, params, options);\n }\n\n getNextActivity(params = {}, options = {}) {\n return this.store.getNextActivity(this.id, params, options);\n }\n\n updateActivity(params = {}, options = {}) {\n return this.store.updateActivity(this.id, params, options);\n }\n\n cancel(params = {}, options = {}) {\n return this.store.cancel(this.id, params, options);\n }\n\n complete(params = {}, options = {}) {\n return this.store.complete(this.id, params, options);\n }\n\n get isDispatched() {\n return this.getAttribute('dispatched_at') !== null;\n }\n\n get isNotDispatched() {\n return this.getAttribute('dispatched_at') == null;\n }\n\n get isStarted() {\n return this.getAttribute('started_at') !== null;\n }\n\n get isNotStarted() {\n return this.getAttribute('started_at') == null;\n }\n\n get isCompleted() {\n return this.getAttribute('status') == 'completed';\n }\n\n get isCanceled() {\n return this.getAttribute('status') == 'canceled';\n }\n\n get isEnroute() {\n return this.getAttribute('status') == 'driver_enroute' || this.getAttribute('status') === 'enroute';\n }\n\n get isInProgress() {\n return this.isStarted && !this.isCanceled && !this.isCompleted;\n }\n\n get scheduledAt() {\n return this.isAttributeFilled('scheduled_at') ? new Date(this.getAttribute('scheduled_at')) : null;\n }\n\n get startedAt() {\n return this.isAttributeFilled('started_at') ? new Date(this.getAttribute('started_at')) : null;\n }\n\n get dispatchedAt() {\n return this.isAttributeFilled('dispatched_at') ? new Date(this.getAttribute('dispatched_at')) : null;\n }\n\n get status() {\n return this.getAttribute('status');\n }\n}\n\nexport default Order;\n\nexport { orderActions };\n","import Resource from '../resource';\nimport Collection from '../utils/collection';\n\nclass Payload extends Resource {\n\tconstructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'payload', options);\n }\n\t\n /**\n\t * Attaches an entity to an existing payload and returns\n\t * the payload with the entity attached\n\t *\n\t * @param {[type]} Entity entity [description]\n\t * @return {[type]} [description]\n\t */\n attach(entity) {\n // perform op return payload\n }\n\n /**\n\t * Returns all of the entities attached to this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get entities() {\n\n }\n\n /**\n\t * Returns the dropoff for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get dropoff() {\n\n }\n\n /**\n\t * Returns the pickup for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get pickup() {\n\n }\n\n /**\n\t * Returns all the waypoints for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get waypoints() {\n return new Collection(this.waypoints);\n }\n}\n\nexport default Payload;\n","import Resource from '../resource';\n\nclass Entity extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'entity', options);\n }\n}\n\nexport default Entity;\n","import Resource from '../resource';\nimport { isResource, Point } from '../utils';\n\nclass Place extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'place', options);\n }\n\n static fromGoogleAddress(googleAddress, adapter, options = {}) {\n const [ latitude, longitude ] = googleAddress.getAttribute('coordinates');\n const attributes = {\n name: null,\n address: googleAddress.getAttribute('address'),\n location: new Point(latitude, longitude),\n street1: googleAddress.getAttribute('streetName'),\n street2: null,\n city: googleAddress.getAttribute('city'),\n province: googleAddress.getAttribute('stateLong'),\n postal_code: googleAddress.getAttribute('postalCode'),\n neighborhood: googleAddress.get('neighborhood'),\n district: googleAddress.getAttribute('county'),\n building: googleAddress.get('building'),\n country: googleAddress.getAttribute('countryShort'),\n phone: null,\n security_access_code: null\n };\n\n return new Place(attributes, adapter, options);\n }\n\n /**\n * The latitude coordinate for the 'Place' location.\n * \n * @var {Integer}\n */\n get latitude() {\n return this.getAttribute('location', new Point())?.coordinates[1];\n }\n\n /**\n * The longitude coordinate for the 'Place' location.\n * \n * @var {Integer}\n */\n get longitude() {\n return this.getAttribute('location', new Point())?.coordinates[0];\n }\n\n /**\n * Array coordinate pair for Place location.\n * \n * @var {Array}\n */\n get coordinates() {\n const { latitude, longitude } = this;\n\n return [ latitude, longitude ];\n }\n\n /**\n * Set the owner of the place.\n * \n * @param {Object|String} owner\n * @return {Place}\n */\n setOwner(owner) {\n if (isResource(owner)) {\n this.setAttribute('owner', owner.id);\n }\n\n if (typeof owner === 'string') {\n this.setAttribute('owner', owner);\n }\n\n return this;\n }\n}\n\nexport default Place;\n","import Place from './place';\n\nclass Waypoint extends Place {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'waypoint', options);\n }\n}\n\nexport default Waypoint;\n","import Resource from '../resource';\n\nclass TrackingStatus extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'tracking-status', options);\n }\n}\n\nexport default TrackingStatus;\n","import Resource from '../resource';\n\nclass Vehicle extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'vehicle', options);\n }\n}\n\nexport default Vehicle;\n","import Resource from '../resource';\nimport { StoreActions, isPhone, isEmail } from '../utils';\n\nconst driverActions = new StoreActions({\n // const { error } = await fleetbase.drivers.login('+1 111-1111');\n login: function (identity, password = null, attributes = {}) {\n // handle phone number authentication\n if (isPhone(identity)) {\n return this.adapter.post('drivers/login-with-sms', { phone: identity });\n }\n\n if (!password) {\n throw new Error('Login requires password!');\n }\n\n return this.adapter.post('drivers/login', { identity, password, ...attributes }).then(this.afterFetch.bind(this));\n },\n\n verifyCode: function (identity, code, attributes = {}) {\n return this.adapter.post('drivers/verify-code', { identity, code, ...attributes }).then(this.afterFetch.bind(this));\n },\n\n track: function (id, params = {}, options = {}) {\n return this.adapter.post(`drivers/${id}/track`, params, options).then(this.afterFetch.bind(this));\n },\n\n retrieve: function (id) {\n return this.findRecord(id);\n },\n\n syncDevice(id, params = {}, options = {}) {\n return this.adapter.post(`drivers/${id}/register-device`, params, options);\n },\n});\n\nclass Driver extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'driver', { actions: driverActions, ...options });\n }\n\n get token() {\n return this.getAttribute('token');\n }\n\n get isOnline() {\n return this.getAttribute('online') === true;\n }\n\n /**\n * The latitude coordinate for the 'Place' location.\n *\n * @var {Integer}\n */\n get latitude() {\n return this.getAttribute('location', new Point())?.coordinates[1];\n }\n\n /**\n * The longitude coordinate for the 'Place' location.\n *\n * @var {Integer}\n */\n get longitude() {\n return this.getAttribute('location', new Point())?.coordinates[0];\n }\n\n /**\n * Array coordinate pair for Place location.\n *\n * @var {Array}\n */\n get coordinates() {\n const { latitude, longitude } = this;\n\n return [latitude, longitude];\n }\n\n get token() {\n return this.getAttribute('token');\n }\n\n get isOnline() {\n return this.getAttribute('online') === true;\n }\n\n track(params = {}, options = {}) {\n return this.store.track(this.id, params, options);\n }\n\n syncDevice(params = {}, options = {}) {\n return this.store.syncDevice(this.id, params, options);\n }\n}\n\nexport default Driver;\nexport { driverActions };\n","import Resource from '../resource';\n\nclass Vendor extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'vendor', options);\n }\n}\n\nexport default Vendor;\n","import Resource from '../resource';\n\nclass Contact extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'contact', options);\n }\n}\n\nexport default Contact;\n","import Resource from '../resource';\n\nclass Zone extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'zone', options);\n }\n}\n\nexport default Zone;\n","import Resource from '../resource';\n\nclass ServiceArea extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-area', options);\n }\n}\n\nexport default ServiceArea;\n","import Resource from '../resource';\n\nclass ServiceRate extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-rate', options);\n }\n}\n\nexport default ServiceRate;\n","import Resource from '../resource';\n\nclass ServiceQuote extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-quote', options);\n }\n\n fromPreliminary() {\n\n }\n\n fromPayload() {\n \n }\n}\n\nexport default ServiceQuote;\n","class Adapter {\n /**\n\t * Creates a configured base adapter for Fleetbase.\n\t *\n\t * @param {Object} config Configuration options for adapter\n\t */\n constructor(config = {}) {\n this.version = config.version || 'v1';\n this.host = config.host || null;\n this.namespace = config.namespace || null;\n this.headers = config.headers || {};\n }\n}\n\nexport default Adapter;\n","import Adapter from '../adapter';\nimport { isBlank } from '../utils';\n\nclass BrowserAdapter extends Adapter {\n /**\n * Setup browser adapter.\n * @param {Object} config\n */\n constructor(config) {\n super(config);\n\n this.setHeaders({\n Authorization: `Bearer ${config.publicKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': '@fleetbase/sdk;browser'\n });\n }\n\n /**\n * Updates the adapter headers.\n *\n * @param {Object} headers\n */\n setHeaders(headers = {}) {\n this.headers = { ...this.headers, ...headers };\n\n return this;\n }\n\n /**\n * Parses the JSON returned by a network request\n *\n * @param {Object} response A response from a network request\n * @return {Object} The parsed JSON, status from the response\n *\n * @return {Promise}\n */\n parseJSON(response) {\n return new Promise((resolve, reject) => response\n .json()\n .then((json) => resolve({\n statusText: response.statusText,\n status: response.status,\n ok: response.ok,\n json,\n }))\n .catch(() => {\n reject(new Error('Oops! Something went wrong when handling your request.'));\n }));\n }\n\n /**\n * The base request method\n *\n * @param {String} path\n * @param {String} method\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n request(path, method = 'GET', data = {}, options = {}) {\n return new Promise((resolve, reject) => fetch(options.url || `${this.host}/${this.namespace}/${path}`, {\n method,\n mode: options.mode || 'cors',\n headers: new Headers({\n ...(this.headers || {}),\n ...(options.headers || {}),\n }),\n ...data,\n })\n .then(this.parseJSON)\n .then((response) => {\n if (response.ok) {\n return resolve(response.json);\n }\n\n return reject(new Error(response.json.errors ? response.json.errors[0] : response.statusText));\n })\n .catch((error) => {\n reject(error);\n }));\n }\n\n /**\n * Makes a GET request with fetch\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n get(path, query = {}, options = {}) {\n const urlParams = !isBlank(query) ? new URLSearchParams(query).toString() : '';\n\n return this.request(`${path}${urlParams ? `?${urlParams}` : ''}`, 'GET', {}, options);\n }\n\n /**\n * Makes a POST request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n post(path, data = {}, options = {}) {\n return this.request(path, 'POST', { body: JSON.stringify(data) }, options);\n }\n\n /**\n * Makes a PUT request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n put(path, data = {}, options = {}) {\n return this.request(path, 'PUT', { body: JSON.stringify(data) }, options);\n }\n\n /**\n * Makes a DELETE request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n delete(path, options = {}) {\n return this.request(path, 'DELETE', {}, options);\n }\n\n /**\n * Makes a PATCH request with fetch\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n patch(path, data = {}, options = {}) {\n return this.request(path, 'PATCH', { body: JSON.stringify(data) }, options);\n }\n}\n\nexport default BrowserAdapter;\n","import Adapter from '../adapter';\nimport { isBlank } from '../utils';\nimport { isArray } from '../utils/array';\nimport axios from 'axios';\n\nclass NodeAdapter extends Adapter {\n constructor(config) {\n super(config);\n\n this.axios = axios.create({\n baseURL: `${this.host}/${this.namespace}`,\n headers: {\n Authorization: `Bearer ${config.publicKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': '@fleetbase/sdk;node',\n },\n });\n }\n\n /**\n * Updates the adapter headers.\n *\n * @param {Object} headers\n */\n setHeaders(headers = {}) {\n const commonHeaders = this.axios.defaults.headers.common;\n this.axios.defaults.headers.common = { ...commonHeaders, ...headers };\n\n return this;\n }\n\n /**\n * Tranform the response, and return the response data from axios.\n *\n * @param {AxiosResponse} response\n * @returns {Object}\n */\n transform(response) {\n return response.data;\n }\n\n /**\n * Handles an erroneous request.\n *\n * @param {AxiosResponse} response\n * @returns {Object}\n */\n handleError(error) {\n if (error.response) {\n const { data } = error.response;\n\n if (isArray(data.errors)) {\n throw new Error(data.errors[0]);\n }\n\n if (data.error) {\n throw new Error(data.error);\n }\n }\n\n throw error;\n }\n\n /**\n * Makes a GET request with axios\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n get(path, query = {}, options = {}) {\n const urlParams = !isBlank(query) ? new URLSearchParams(query).toString() : '';\n\n return this.axios\n .get(`${path}${urlParams ? `?${urlParams}` : ''}`, options)\n .then(this.transform.bind(this))\n .catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a POST request with axios\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n post(path, data = {}, options = {}) {\n return this.axios.post(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a PUT request with axios\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n put(path, data = {}, options = {}) {\n return this.axios.put(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a DELETE request with axios\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n delete(path, options = {}) {\n return this.axios.delete(path, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a PATCH request with axios\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n patch(path, data = {}, options = {}) {\n return this.axios.patch(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n}\n\nexport default NodeAdapter;\n","import Adapter from '../adapter';\n\nclass EmberJsAdapter extends Adapter {}\n\nexport default EmberJsAdapter;\n","'use strict';\n\n/**\n * Javascript String\n *\n * instance\n * new String('hello_world').humanize().get() => \"Hello world\"\n *\n * instance\n * const string = new String();\n * string.humanize('hello_world').get() => \"Hello world\"\n * \n * no chain\n * new String('hello_world', false).humanize() => \"Hello world\"\n *\n * static\n * String.invoke('humanize', 'hello_world') => \"Hello world\"\n *\n * exports {}\n * humanize('hello_world') => \"Hello world\"\n */\n\nexport default class String {\n constructor(string, chain = true) {\n this.str = string;\n this.chain = chain;\n }\n\n uncountableWords = ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'moose', 'deer', 'news'];\n\n pluralRules = [\n [new RegExp('(m)an$', 'gi'), '$1en'],\n [new RegExp('(pe)rson$', 'gi'), '$1ople'],\n [new RegExp('(child)$', 'gi'), '$1ren'],\n [new RegExp('^(ox)$', 'gi'), '$1en'],\n [new RegExp('(ax|test)is$', 'gi'), '$1es'],\n [new RegExp('(octop|vir)us$', 'gi'), '$1i'],\n [new RegExp('(alias|status)$', 'gi'), '$1es'],\n [new RegExp('(bu)s$', 'gi'), '$1ses'],\n [new RegExp('(buffal|tomat|potat)o$', 'gi'), '$1oes'],\n [new RegExp('([ti])um$', 'gi'), '$1a'],\n [new RegExp('sis$', 'gi'), 'ses'],\n [new RegExp('(?:([^f])fe|([lr])f)$', 'gi'), '$1$2ves'],\n [new RegExp('(hive)$', 'gi'), '$1s'],\n [new RegExp('([^aeiouy]|qu)y$', 'gi'), '$1ies'],\n [new RegExp('(x|ch|ss|sh)$', 'gi'), '$1es'],\n [new RegExp('(matr|vert|ind)ix|ex$', 'gi'), '$1ices'],\n [new RegExp('([m|l])ouse$', 'gi'), '$1ice'],\n [new RegExp('(quiz)$', 'gi'), '$1zes'],\n [new RegExp('s$', 'gi'), 's'],\n [new RegExp('$', 'gi'), 's'],\n ];\n\n singularRules = [\n [new RegExp('(m)en$', 'gi'), '$1an'],\n [new RegExp('(pe)ople$', 'gi'), '$1rson'],\n [new RegExp('(child)ren$', 'gi'), '$1'],\n [new RegExp('([ti])a$', 'gi'), '$1um'],\n [new RegExp('((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$', 'gi'), '$1$2sis'],\n [new RegExp('(hive)s$', 'gi'), '$1'],\n [new RegExp('(tive)s$', 'gi'), '$1'],\n [new RegExp('(curve)s$', 'gi'), '$1'],\n [new RegExp('([lr])ves$', 'gi'), '$1f'],\n [new RegExp('([^fo])ves$', 'gi'), '$1fe'],\n [new RegExp('([^aeiouy]|qu)ies$', 'gi'), '$1y'],\n [new RegExp('(s)eries$', 'gi'), '$1eries'],\n [new RegExp('(m)ovies$', 'gi'), '$1ovie'],\n [new RegExp('(x|ch|ss|sh)es$', 'gi'), '$1'],\n [new RegExp('([m|l])ice$', 'gi'), '$1ouse'],\n [new RegExp('(bus)es$', 'gi'), '$1'],\n [new RegExp('(o)es$', 'gi'), '$1'],\n [new RegExp('(shoe)s$', 'gi'), '$1'],\n [new RegExp('(cris|ax|test)es$', 'gi'), '$1is'],\n [new RegExp('(octop|vir)i$', 'gi'), '$1us'],\n [new RegExp('(alias|status)es$', 'gi'), '$1'],\n [new RegExp('^(ox)en', 'gi'), '$1'],\n [new RegExp('(vert|ind)ices$', 'gi'), '$1ex'],\n [new RegExp('(matr)ices$', 'gi'), '$1ix'],\n [new RegExp('(quiz)zes$', 'gi'), '$1'],\n [new RegExp('s$', 'gi'), ''],\n ];\n\n nonTitlecasedWords = ['and', 'or', 'nor', 'a', 'an', 'the', 'so', 'but', 'to', 'of', 'at', 'by', 'from', 'into', 'on', 'onto', 'off', 'out', 'in', 'over', 'with', 'for'];\n\n idSuffix = new RegExp('(_ids|_id)$', 'g');\n underbar = new RegExp('_', 'g');\n spaceOrUnderbar = new RegExp('[ _]', 'g');\n uppercase = new RegExp('([A-Z])', 'g');\n underbarPrefix = new RegExp('^_');\n\n get() {\n return this.str;\n }\n\n applyRules(str, rules, skip, override) {\n if (override) {\n str = override;\n } else {\n var ignore = skip.indexOf(str.toLowerCase()) > -1;\n if (!ignore) {\n for (var x = 0; x < rules.length; x++) {\n if (str.match(rules[x][0])) {\n str = str.replace(rules[x][0], rules[x][1]);\n break;\n }\n }\n }\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.pluralize('person') -> 'people'\n String.pluralize('octopus') -> 'octopi'\n String.pluralize('Hat') -> 'Hats'\n String.pluralize('person', 'guys') -> 'guys' \n */\n pluralize(str, plural = null) {\n str = str || this.str;\n\n return this.applyRules(str, this.pluralRules, this.uncountableWords, plural);\n }\n\n /*\n String.singularize('person') -> 'person'\n String.singularize('octopi') -> 'octopus'\n String.singularize('hats') -> 'hat'\n String.singularize('guys', 'person') -> 'person'\n */\n singularize(str, singular) {\n str = str || this.str;\n\n return this.applyRules(str, this.singularRules, this.uncountableWords, singular);\n }\n\n /*\n String.camelize('message_properties') -> 'MessageProperties'\n String.camelize('message_properties', true) -> 'messageProperties'\n */\n camelize(str, lowFirstLetter) {\n str = str || this.str;\n\n let str_path = str.split('/');\n for (var i = 0; i < str_path.length; i++) {\n let str_arr = str_path[i].split('_');\n let initX = lowFirstLetter && i + 1 === str_path.length ? 1 : 0;\n\n for (let x = initX; x < str_arr.length; x++) {\n str_arr[x] = str_arr[x].charAt(0).toUpperCase() + str_arr[x].substring(1);\n }\n str_path[i] = str_arr.join('');\n }\n str = str_path.join('::');\n\n // fix\n if (lowFirstLetter === true) {\n let first = str.charAt(0).toLowerCase();\n let last = str.slice(1);\n str = first + last;\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.underscore('MessageProperties') -> 'message_properties'\n String.underscore('messageProperties') -> 'message_properties'\n */\n underscore(str) {\n str = str || this.str;\n\n var str_path = str.split('::');\n for (var i = 0; i < str_path.length; i++) {\n str_path[i] = str_path[i].replace(this.uppercase, '_$1');\n str_path[i] = str_path[i].replace(this.underbarPrefix, '');\n }\n str = str_path.join('/').toLowerCase();\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.humanize('message_properties') -> 'Message properties'\n String.humanize('message_properties') -> 'message properties'\n */\n humanize(str, lowFirstLetter) {\n str = str || this.str;\n\n var str = str.toLowerCase();\n str = str.replace(this.idSuffix, '');\n str = str.replace(this.underbar, ' ');\n if (!lowFirstLetter) {\n str = this.capitalize(str);\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.capitalize('message_properties') -> 'Message_properties'\n String.capitalize('message properties') -> 'Message properties'\n */\n capitalize(str) {\n str = str || this.str;\n\n str = str.toLowerCase();\n str = str.substring(0, 1).toUpperCase() + str.substring(1);\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.dasherize('message_properties') -> 'message-properties'\n String.dasherize('message properties') -> 'message-properties'\n */\n dasherize(str) {\n str = str || this.str;\n\n str = str.replace(this.spaceOrUnderbar, '-');\n str = str.toLowerCase();\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.normify('message_properties') -> 'Message Properties'\n String.normify('message properties') -> 'Message Properties'\n Inflactor.normify('Message_propertyId', true) -> 'Message Properties Id'\n */\n normify(str, allFirstUpper) {\n str = str || this.str;\n\n //var str = str.toLowerCase();\n if (allFirstUpper === true) {\n str = this.camelize(str);\n str = this.underscore(str);\n } else {\n str = str.toLowerCase();\n }\n\n str = str.replace(this.underbar, ' ');\n var str_arr = str.split(' ');\n for (var x = 0; x < str_arr.length; x++) {\n var d = str_arr[x].split('-');\n for (var i = 0; i < d.length; i++) {\n if (this.nonTitlecasedWords.indexOf(d[i].toLowerCase()) < 0) {\n d[i] = this.capitalize(d[i]);\n }\n }\n str_arr[x] = d.join('-');\n }\n str = str_arr.join(' ');\n str = str.substring(0, 1).toUpperCase() + str.substring(1);\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.demodulize('Message::Bus::Properties') -> 'Properties'\n */\n demodulize(str) {\n str = str || this.str;\n\n var str_arr = str.split('::');\n str = str_arr[str_arr.length - 1];\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.tableize('MessageBusProperty') -> 'message_bus_properties'\n */\n tableize(str) {\n str = str || this.str;\n\n str = this.pluralize(this.underscore(str));\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.classify('message_bus_properties') -> 'MessageBusProperty'\n */\n classify(str) {\n str = str || this.str;\n\n str = this.singularize(this.camelize(str));\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.foreignKey('MessageBusProperty') -> 'message_bus_property_id'\n String.foreignKey('MessageBusProperty', true) -> 'message_bus_propertyid'\n */\n foreignKey(str, dropIdUbar = false) {\n str = str || this.str;\n\n str = this.underscore(this.demodulize(str)) + (dropIdUbar ? '' : '_') + 'id';\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.ordinalize('the 1 pitch') -> 'the 1st pitch'\n */\n ordinalize(str) {\n str = str || this.str;\n\n var str_arr = str.split(' ');\n for (var x = 0; x < str_arr.length; x++) {\n var i = parseInt(str_arr[x]);\n if (i === NaN) {\n var ltd = str_arr[x].substring(str_arr[x].length - 2);\n var ld = str_arr[x].substring(str_arr[x].length - 1);\n var suf = 'th';\n if (ltd != '11' && ltd != '12' && ltd != '13') {\n if (ld === '1') {\n suf = 'st';\n } else if (ld === '2') {\n suf = 'nd';\n } else if (ld === '3') {\n suf = 'rd';\n }\n }\n str_arr[x] += suf;\n }\n }\n str = str_arr.join(' ');\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /**\n * @method invoke\n **/\n static invoke() {\n const argz = Object.values(arguments);\n const instance = new String(null, false);\n const method = arguments[0];\n argz.shift();\n\n if (typeof instance[method] === 'function') {\n return instance[method](...argz);\n }\n\n return null;\n }\n}\n\nconst pluralize = function() {\n const argz = ['pluralize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst singularize = function() {\n const argz = ['singularize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst humanize = function() {\n const argz = ['humanize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst underscore = function() {\n const argz = ['underscore', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst camelize = function() {\n const argz = ['camelize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst capitalize = function() {\n const argz = ['capitalize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst dasherize = function() {\n const argz = ['dasherize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst normify = function() {\n const argz = ['normify', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst demodulize = function() {\n const argz = ['demodulize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst tableize = function() {\n const argz = ['tableize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst classify = function() {\n const argz = ['classify', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst foreignKey = function() {\n const argz = ['foreignKey', ...arguments];\n\n return String.invoke(...argz);\n};\n\nexport {\n pluralize,\n singularize,\n humanize,\n underscore,\n camelize,\n capitalize,\n dasherize,\n normify,\n demodulize,\n tableize,\n classify,\n foreignKey\n}","import { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote } from './resources';\nimport { BrowserAdapter, NodeAdapter, EmberJsAdapter } from './adapters';\nimport { pluralize, singularize } from './utils/string';\n\nconst resources = {\n Contact,\n Driver,\n Entity,\n Order,\n Payload,\n Place,\n TrackingStatus,\n Vehicle,\n Vendor,\n Waypoint,\n Zone,\n ServiceArea,\n ServiceRate,\n ServiceQuote,\n};\n\nconst adapters = {\n BrowserAdapter,\n NodeAdapter,\n EmberJsAdapter,\n};\n\nclass Resolver {\n constructor() {\n this.resources = resources;\n this.adapters = adapters;\n\n return this.lookup(...arguments);\n }\n\n lookup(type, className) {\n const key = pluralize(type);\n const params = [...arguments].slice(2);\n\n if (!this[key]) {\n throw new Error('Attempted to resolve invalid type');\n }\n\n if (!this[key][className]) {\n throw new Error(`No ${singularize(type)} named ${className} to resolve`);\n }\n\n return new this[key][className](...params);\n }\n}\n\nconst lookup = function () {\n return new Resolver(...arguments);\n};\n\nexport { Resolver, lookup };\n","import { lookup } from './resolver';\nimport { pluralize, classify } from './utils/string';\nimport { isArray } from './utils/array';\nimport { Collection, detectAdapter, isResource, StoreActions } from './utils';\nimport { set, isCallable, invoke } from './utils/object';\n\nconst extendStoreActions = (store, actions = []) => {\n store.actions = isArray(actions) ? actions : [actions];\n\n if (isArray(actions)) {\n for (let i = 0; i < actions.length; i++) {\n const action = actions[i];\n\n store.extendActions(action);\n }\n return;\n }\n\n if (actions instanceof StoreActions) {\n actions.extend(store);\n }\n\n return store;\n};\n\nconst afterFetch = (store, json) => {\n if (typeof store.options.onAfterFetch === 'function') {\n store.options.onAfterFetch(json);\n }\n\n if (isArray(json)) {\n const serialized = [];\n\n for (let i = 0; i < json.length; i++) {\n serialized.push(store.afterFetch(json[i]));\n }\n\n return new Collection(...serialized);\n }\n\n const resourceInstance = store.serialize(json);\n return store.deposit(resourceInstance);\n};\n\nclass Store {\n constructor(resource, adapter, options = {}) {\n this.resource = resource;\n this.adapter = adapter || detectAdapter();\n this.namespace = pluralize(resource);\n this.storage = new Collection();\n this.options = options;\n this.extendActions(options.actions);\n }\n\n extendActions(actions = []) {\n return extendStoreActions(this, actions);\n }\n\n deposit(resourceInstance) {\n // this.storage[this.namespace].pushObject(resourceInstance);\n\n return resourceInstance;\n }\n\n serialize(json) {\n return lookup('resource', classify(this.resource), json, this.adapter);\n }\n\n afterFetch(json) {\n return afterFetch(this, json);\n }\n\n create(attributes = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.post(`${this.namespace}`, attributes, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n update(id, attributes = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.put(`${this.namespace}/${id}`, attributes, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n findRecord(id, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}/${id}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n findAll(options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n query(query = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, query, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n queryRecord(query = {}, options = {}) {\n query.single = true;\n\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, query, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n destroy(record, options = {}) {\n const id = isResource(record) ? record.getAttribute('id') : record;\n\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.delete(`${this.namespace}/${id}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n}\n\nexport default Store;\n\nexport { extendStoreActions, afterFetch };\n","import Store from './store';\nimport Resource from './resource';\nimport { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote } from './resources';\nimport { BrowserAdapter, NodeAdapter, EmberJsAdapter, Adapter } from './adapters';\nimport { isNodeEnvironment, detectAdapter, isLatitude, isLongitude, Point, isResource, GoogleAddress, Collection, StoreActions } from './utils';\nimport { pluralize, singularize, classify, dasherize, camelize } from './utils/string';\nimport { extendStoreActions } from './store';\nimport { orderActions } from './resources/order';\nimport { driverActions } from './resources/driver';\n\n/**\n * // instance\n * const fleetbase = new Fleetbase();\n *\n * const contact = fleetbase.contacts.create({\n * \t\tname: 'Ron',\n * \t\tphone: '+65 9999 8888'\n * });\n *\n * constact.update({ name: 'Hollywood Ron' });\n *\n * // export\n * import { Contact } from '@fleetbase/sdk';\n *\n * const contact = new Contact({\n * \t\tname: 'Ron',\n * \t\tphone: '+65 9999 8888'\n * });\n *\n * contact.save();\n */\n\nexport default class Fleetbase {\n /**\n * Builds an instance of the Fleetbase SDK\n *\n * @param {String} publicKey The public key issued\n * @param {Object} config The version of resource to access\n * @param {Boolean} debug Debug mode for SDK\n * @return {Fleetbase} Instance\n */\n constructor(publicKey, config = {}, debug = false) {\n this.version = config.version ?? 'v1';\n this.options = {\n version: this.version,\n host: config.host ?? 'https://api.fleetbase.io',\n namespace: config.namespace ?? this.version,\n debug,\n publicKey,\n };\n\n if (typeof publicKey !== 'string' || publicKey.length === 0) {\n throw new Error('⚠️ Invalid public key given to Fleetbase SDK');\n }\n\n if (!isNodeEnvironment() && publicKey.toLowerCase().startsWith('$')) {\n throw new Error('Secret key provided. You must use a public key with Fleetbase Javascript SDK!');\n }\n\n this.adapter = config.adapter || detectAdapter(this.options);\n\n this.orders = new Store('order', this.adapter).extendActions(orderActions);\n this.entities = new Store('entity', this.adapter);\n this.places = new Store('place', this.adapter);\n this.drivers = new Store('driver', this.adapter).extendActions(driverActions);\n this.vehicles = new Store('vehicle', this.adapter);\n this.vendors = new Store('vendor', this.adapter);\n this.contacts = new Store('contact', this.adapter);\n }\n\n static newInstance() {\n return new Fleetbase(...arguments);\n }\n\n setAdapter(adapter) {\n this.adapter = adapter;\n }\n\n getAdapter() {\n return this.adapter;\n }\n}\n\nexport {\n Store,\n Resource,\n Contact,\n Driver,\n Entity,\n Order,\n Payload,\n Place,\n TrackingStatus,\n Vehicle,\n Vendor,\n Waypoint,\n Zone,\n ServiceArea,\n ServiceRate,\n ServiceQuote,\n BrowserAdapter,\n NodeAdapter,\n EmberJsAdapter,\n Adapter,\n isNodeEnvironment,\n isLatitude,\n isLongitude,\n Point,\n isResource,\n GoogleAddress,\n Collection,\n StoreActions,\n extendStoreActions,\n pluralize,\n singularize,\n classify,\n dasherize,\n camelize,\n};\n","export default function isLatitude(coordinate) {\n return isFinite(coordinate) && Math.abs(coordinate) <= 90;\n}\n","export default function isLongitude(coordinate) {\n return isFinite(coordinate) && Math.abs(coordinate) <= 180 && Math.abs(coordinate) >= 90;\n}\n"],"names":["isArray","Array","replace","array","start","deleteCount","items","length","splice","i","chunk","slice","isCollection","arr","identityFunction","item","mixed","Collection","objectAt","index","iter","key","value","arguments","Boolean","findIndex","predicate","startAt","len","find","callback","target","bind","undefined","any","every","cb","indexOf","val","withNaNCheck","insertAt","this","indexes","map","idx","_this2","object","methodName","args","ret","forEach","push","_item$methodName","filter","sortKeys","sort","a","b","propA","propB","compareValue","compare","seen","Set","getter","get","has","add","uniqBy","includes","removeAt","obj","objects","toArray","reverse","clear","loc","removeObject","pushObject","_this3","addObject","isEmpty","none","size","objectType","isBlank","test","isResource","record","Resource","isPhone","phone","isNodeEnvironment","process","_typeof","_process","env","release","name","search","window","navigator","product","detectAdapter","options","lookup","GoogleAddress","place","geometry","components","parseComponents","attributes","parseProperties","address_components","reduce","acc","data","types","type","streetNumber","streetName","coordinates","location","Object","values","city","or","county","stateShort","stateLong","countryShort","country","countryLong","postalCode","address","join","keys","pkey","short","short_name","long_name","Point","latitude","longitude","coorindates","lat","lng","serialize","json","getResolved","func","path","resolved","current","isObject","isFunction","pathArray","split","newPath","set","iterations","StoreActions","actions","bindTo","binding","action","fn","adapter","resource","dirtyAttributes","changes","isLoading","isSaving","isDestroying","isReloading","version","setAdapter","store","Store","onAfterFetch","syncAttributes","_this$options","getAttribute","mergeAttributes","setFlags","create","then","response","_this","update","id","destroy","findRecord","_this4","reset","flags","state","validFlags","flag","Error","attribues","getAttributes","onlyDirty","savedirty","dirtyAttributeKeys","isAttributeFilled","Date","hasAttributes","isNew","isLoaded","property","_this5","call","setAttributes","previousValue","changedAt","setAttribute","attribute","defaultValue","properties","attributeKeys","prop","hasAttribute","_this6","_value","_value2","modelAttributes","orderActions","getDistanceAndTime","params","namespace","getNextActivity","dispatch","post","afterFetch","updateActivity","setDestination","destinationId","captureQrCode","subjectId","captureSignature","complete","cancel","Order","isStarted","isCanceled","isCompleted","Payload","entity","waypoints","Entity","Place","_this$getAttribute","_this$getAttribute2","owner","googleAddress","street1","street2","province","postal_code","neighborhood","district","building","security_access_code","Waypoint","TrackingStatus","Vehicle","driverActions","login","identity","password","verifyCode","code","track","retrieve","syncDevice","Driver","Vendor","Contact","Zone","ServiceArea","ServiceRate","ServiceQuote","Adapter","config","host","headers","BrowserAdapter","setHeaders","Authorization","publicKey","Promise","resolve","reject","statusText","status","ok","method","fetch","url","mode","Headers","parseJSON","errors","error","query","urlParams","URLSearchParams","toString","request","body","JSON","stringify","NodeAdapter","axios","baseURL","commonHeaders","defaults","common","transform","handleError","put","patch","EmberJsAdapter","String","string","chain","RegExp","str","rules","skip","override","toLowerCase","x","match","plural","applyRules","pluralRules","uncountableWords","singular","singularRules","lowFirstLetter","str_path","str_arr","charAt","toUpperCase","substring","first","last","uppercase","underbarPrefix","idSuffix","underbar","capitalize","spaceOrUnderbar","allFirstUpper","camelize","underscore","d","nonTitlecasedWords","pluralize","singularize","dropIdUbar","demodulize","NaN","parseInt","ltd","ld","suf","argz","instance","shift","invoke","classify","resources","adapters","Resolver","className","extendStoreActions","extend","extendActions","storage","resourceInstance","serialized","deposit","single","_this7","Fleetbase","debug","startsWith","orders","entities","places","drivers","vehicles","vendors","contacts","coordinate","isFinite","Math","abs"],"mappings":"kuJAAA,IAAQA,EAAYC,MAAZD,yDCWFE,EAAU,SAACC,EAAOC,EAAOC,OAAaC,yDAAQ,MAC5CN,EAAQG,MACJG,EAAMC,QANC,IAOPJ,EAAMK,aAANL,GAAaC,EAAOC,YAAgBC,SACjC,CACHH,EAAMK,OAAOJ,EAAOC,OAEf,IAAII,EAAI,EAAGA,EAAIH,EAAMC,OAAQE,GAX3B,IAW4C,KAC3CC,EAAQJ,EAAMK,MAAMF,EAAGA,EAZxB,KAaHN,EAAMK,aAANL,GAAaC,EAAQK,EAAG,YAAMC,WAG/BE,EAAaC,MACpBV,EAAMD,QAAQE,EAAOC,EAAaC,IAIpCQ,EAAmB,SAACC,UAASA,GAkB7BH,EAAe,SAACI,UAAUA,aAAiBC,GAE3CC,EAAW,SAACf,EAAOgB,UACjBnB,EAAQG,GACDA,EAAMgB,GACNP,EAAaT,GACbA,EAAMe,SAASC,GAGnB,MAGLC,EAAO,SAACC,EAAKC,UAC0B,IAArBC,EAAUhB,OACP,SAACQ,UAASO,IAAUP,EAAKM,IAAO,SAACN,UAASS,QAAQT,EAAKM,MAG5EI,EAAY,SAACtB,EAAOuB,WAAWC,yDAAU,EACvCC,EAAMzB,EAAMI,OACPY,EAAQQ,EAASR,EAAQS,EAAKT,IAAS,KACxCJ,EAAOG,EAASf,EAAOgB,MACvBO,EAAUX,EAAMI,EAAOhB,UAChBgB,SAGP,GAGNU,EAAO,SAAC1B,EA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,IAAe"} \ No newline at end of file diff --git a/dist/esm/fleetbase.js b/dist/esm/fleetbase.js index 36a65a0..76a13ca 100644 --- a/dist/esm/fleetbase.js +++ b/dist/esm/fleetbase.js @@ -1,2 +1,2 @@ -import t from"axios";import"date-fns";function e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function n(t){for(var n=1;nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n3&&void 0!==arguments[3]?arguments[3]:[];if(A(t))if(i.length<=6e4)t.splice.apply(t,[e,n].concat(k(i)));else{t.splice(e,n);for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:0,i=t.length,r=n;r2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0,r=t.length;n<0&&(n+=r);var o=i&&e!=e?function(t){return t!=t}:function(t){return t===e};return S(t,o,n)},z=function(t,e,n){return $(t,e,0,[n]),n},C=function(t){h(n,g(Array));var e=y(n);function n(){for(var t=arguments.length,i=new Array(t),r=0;r0}},{key:"empty",get:function(){return 0===this.length}},{key:"first",get:function(){return j(this,0)}},{key:"last",get:function(){return j(this,this.length-1)}},{key:"replace",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return $(this,t,e,n),this}},{key:"objectsAt",value:function(t){var e=this;return t.map((function(t){return j(e,t)}))}},{key:"objectAt",value:function(t){return j(this,t)}},{key:"indexOf",value:function(t,e){return D(this,t,e,!1)}},{key:"lastIndexOf",value:function(t,e){var n=this.length;(void 0===e||e>=n)&&(e=n-1),e<0&&(e+=n);for(var i=e;i>=0;i--)if(j(this,i)===t)return i;return-1}},{key:"includes",value:function(t,e){return-1!==D(this,t,e,!0)}},{key:"findBy",value:function(){return _(this,O.apply(void 0,arguments))}},{key:"findIndexBy",value:function(){return S(this,O.apply(void 0,arguments))}},{key:"isEvery",value:function(){return F(this,O.apply(void 0,arguments))}},{key:"isAny",value:function(){return P(this,O.apply(void 0,arguments))}},{key:"invoke",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i1&&void 0!==arguments[1]?arguments[1]:R,n=[],i=new Set,r="function"==typeof e?e:function(t){return get(t,e)};return t.forEach((function(t){var e=r(t);i.has(e)||(i.add(e),n.push(t))})),n}(this,t)}},{key:"without",value:function(t){if(!this.includes(t))return this;var e=t==t?function(e){return e!==t}:function(t){return t==t};return this.filter(e)}},{key:"clear",value:function(){var t=this.length;return 0===t||this.replace(0,t,[]),this}},{key:"insertAt",value:function(t,e){return z(this,t,e),this}},{key:"replaceAt",value:function(t,e){return this.replace(t,1,[e])}},{key:"removeAt",value:function(t,e){return function(t,e){return $(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,[]),t}(this,t,e)}},{key:"pushObject",value:function(t){return this.insertAt(this.length,t)}},{key:"pushObjects",value:function(t){return this.replace(this.length,0,t),this}},{key:"popObject",value:function(){var t=this.length;if(0===t)return null;var e=j(this,t-1);return this.removeAt(t-1,1),e}},{key:"shiftObject",value:function(){if(0===this.length)return null;var t=j(this,0);return this.removeAt(0),t}},{key:"unshiftObject",value:function(t){return z(this,0,t)}},{key:"unshiftObjects",value:function(t){return this.replace(0,0,t),this}},{key:"reverseObjects",value:function(){var t=this.length;if(0===t)return this;var e=this.toArray().reverse();return this.replace(0,t,e),this}},{key:"setObjects",value:function(t){if(0===t.length)return this.clear();var e=this.length;return this.replace(0,e,t),this}},{key:"removeObject",value:function(t){for(var e=this.length||0;--e>=0;){j(this,e)===t&&this.removeAt(e)}return this}},{key:"removeObjects",value:function(t){for(var e=t.length-1;e>=0;e--)this.removeObject(t[e]);return this}},{key:"addObject",value:function(t){return this.includes(t)||this.pushObject(t),this}},{key:"addObjects",value:function(t){var e=this;return t.forEach((function(t){return e.addObject(t)})),this}}]),n}(),L=function(t){var e=null==t;if(e)return e;if("number"==typeof t.size)return!t.size;var n=i(t);if("object"===n){var r=t.size;if("number"==typeof r)return!r}if("number"==typeof t.length&&"function"!==n)return!t.length;if("object"===n){var o=t.length;if("number"==typeof o)return!o}return!1},N=function(t){return L(t)||"string"==typeof t&&!1===/\S/.test(t)};function T(t){return isFinite(t)&&Math.abs(t)<=90}function q(t){return isFinite(t)&&Math.abs(t)<=180&&Math.abs(t)>=90}function B(t){return t instanceof Z}var U=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^[+]?[\s./0-9]*[(]?[0-9]{1,4}[)]?[-\s./0-9]*$/g.test(t)},I=function(){var t,e,n,r,o;return!("undefined"==typeof process||"object"!==i(null===(t=process)||void 0===t?void 0:t.env)&&-1===(null===(e=process.release)||void 0===e||null===(n=e.name)||void 0===n?void 0:n.search(/node|io.js/))||"undefined"!=typeof window&&"ReactNative"!==(null===(r=window)||void 0===r||null===(o=r.navigator)||void 0===o?void 0:o.product))},J=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return I()?jt("adapter","NodeAdapter",t):jt("adapter","BrowserAdapter",t)},W=Array.isArray,H=function(){function t(e){s(this,t),this.place=e,this.geometry=null==e?void 0:e.geometry,this.components=this.parseComponents(),this.attributes=this.parseProperties()}return u(t,[{key:"parse",value:function(){this.parseComponents(),this.parseProperties()}},{key:"parseComponents",value:function(){var t;return((null===(t=this.place)||void 0===t?void 0:t.address_components)||[]).reduce((function(t,e){return e.types.forEach((function(n){t[n]=e})),t}),{})}},{key:"parseProperties",value:function(){var t,e={streetNumber:this.get("street_number"),streetName:this.get("route"),coordinates:null!==(t=this.geometry)&&void 0!==t&&t.location?Object.values(this.geometry.location):[0,0],city:this.or(["locality","sublocality","sublocality_level_1","neighborhood","administrative_area_level_3","administrative_area_level_2"]),county:this.get("administrative_area_level_2"),stateShort:this.get("administrative_area_level_1",!0),stateLong:this.get("administrative_area_level_1"),countryShort:this.get("country",!0),country:this.get("country",!0),countryLong:this.get("country"),postalCode:this.get("postal_code")};return e.address=[e.streetNumber,e.streetName].filter(Boolean).join(" "),e}},{key:"all",value:function(){return this.attributes}},{key:"or",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=0;e1&&void 0!==arguments[1]&&arguments[1];return t in this.components?e?this.components[t].short_name:this.components[t].long_name:null}},{key:"setAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.attributes=n(n({},this.attributes),t),this}},{key:"setAttribute",value:function(t,e){return this.attributes[t]=e,this}},{key:"getAttribute",value:function(t){return this.attributes[t]||null}}]),t}(),K=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;s(this,t),this.type="Point",this.coordinates=[n,e]}return u(t,[{key:"latitude",get:function(){return this.coordinates[1]}},{key:"longitude",get:function(){return this.coordinates[0]}},{key:"lat",value:function(){return this.latitude}},{key:"lng",value:function(){return this.longitude}},{key:"serialize",value:function(){return{type:"Point",coorindates:[this.lat(),this.lng()]}}},{key:"toJson",value:function(){return this.serialize()}},{key:"toString",value:function(){return"(".concat(this.latitude,", ").concat(this.longitude,")")}}],[{key:"fromGeoJson",value:function(e){var n=b(e.coordinates,2);return longitude=n[0],latitude=n[1],new t(latitude,longitude)}}]),t}();"undefined"==typeof arguments||arguments;var M=function(t,e){var n=t();return Array.isArray(n)||"object"===i(n)?G(n,e):null},G=function t(e,n){var r,o=e,s=i(e),a="object"===s,u="function"===s,c=Array.isArray(e),h="string"===i(n)&&n.includes(".")?n.split("."):[n];if(c||a){for(var l=0;l0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;s(this,t),this.actions=e,this.bind=n}return u(t,[{key:"extend",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=t||this.bind;if(!e)return this;if(null!=this&&this.actions&&"object"===i(this.actions))for(var n in this.actions){var r=this.actions[n];"function"==typeof r?Q(e,n,r.bind(e)):Q(e,n,r)}return this}}]),t}(),Z=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};s(this,t),this.attributes=e,this.dirtyAttributes={},this.changes={},this.isLoading=!1,this.isSaving=!1,this.isDestroying=!1,this.isReloading=!1,this.resource=i,this.options=r,this.version=r.version||"v1",this.setAdapter(n)}return u(t,[{key:"setAdapter",value:function(t){var e;return this.adapter=t,this.store=new St(this.resource,t,{onAfterFetch:this.syncAttributes.bind(this),actions:null===(e=this.options)||void 0===e?void 0:e.actions}),this}},{key:"id",get:function(){return this.getAttribute("id")}},{key:"create",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.mergeAttributes(e);return this.setFlags(["isLoading","isSaving"]),this.store.create(n).then((function(e){return t.setFlags(["isLoading","isSaving"],!1),e}))}},{key:"update",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.setFlags(["isLoading","isSaving"]),this.store.update(this.attributes.id,e).then((function(e){return t.setFlags(["isLoading","isSaving"],!1),e}))}},{key:"destroy",value:function(){var t=this;return this.setFlags(["isLoading","isDestroying"]),this.store.destroy(this.attributes.id).then((function(e){return t.setFlags(["isLoading","isDestroying"],!1),e}))}},{key:"reload",value:function(){var t=this;return this.setFlags(["isLoading","isReloading"]),this.store.findRecord(this.attributes.id).then((function(e){return t.reset(),e}))}},{key:"setFlags",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=["isLoading","isSaving","isReloading","isDestroying"],i=0;i0&&void 0!==arguments[0]?arguments[0]:{},e=this.getAttributes();return L(this.id)?this.create(e):!0===t.onlyDirty?this.savedirty():this.update(e)}},{key:"saveDirty",value:function(){for(var t=Object.keys(this.dirtyAttributes),e={},n=0;n0}},{key:"mutate",value:function(t,e){this.attributes[t]=e}},{key:"setAttribute",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(null===n&&"object"===i(t))return this.setAttributes(t);var r=null!==(e=null==this?void 0:this.attributes[t])&&void 0!==e?e:null;return Q(this.attributes,t,n),Q(this.dirtyAttributes,t,r),A(null==this?void 0:this.changes[t])||(this.changes[t]=[]),this.changes[t].push({property:t,previousValue:r,value:n,changedAt:new Date}),this}},{key:"setAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var e in t)this.setAttribute(e,t[e]);return this}},{key:"getAttribute",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=G(null!==(e=null==this?void 0:this.attributes)&&void 0!==e?e:{},t);return void 0===i?n:i}},{key:"hasAttribute",value:function(t){if(A(t)){var e,n=t,i=Object.keys(null!==(e=this.attributes)&&void 0!==e?e:{});return n.every((function(t){return i.includes(t)}))}return!(null==this||!this.attributes)&&t in this.attributes}},{key:"hasAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.hasAttribute(t)}},{key:"isAttributeFilled",value:function(t){var e=this;return A(t)?this.hasAttribute(t)&&t.every((function(t){return!L(e.getAttribute(t))})):this.hasAttribute(t)&&!L(this.getAttribute(t))}},{key:"getAttributes",value:function(t){var e={};if(null==t)return this.getAttributes(Object.keys(this.attributes));if("string"==typeof t)return this.getAttribute(Array.prototype.slice.call(arguments));if(!A(t))throw new Error("No attribute properties provided!");for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},i=null!==(t=null==this?void 0:this.attributes)&&void 0!==t?t:{};return this.attributes=n(n({},i),e),this.attributes}},{key:"syncAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.attributes=t}}]),t}(),Y=new V({getDistanceAndTime:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.get("".concat(this.namespace,"/").concat(t,"/distance-and-time"),e,n)},getNextActivity:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.get("".concat(this.namespace,"/").concat(t,"/next-activity"),e,n)},dispatch:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/dispatch"),e,n).then(this.afterFetch.bind(this))},start:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/start"),e,n).then(this.afterFetch.bind(this))},updateActivity:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/update-activity"),e,n).then(this.afterFetch.bind(this))},setDestination:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return B(e)&&(e=e.id),this.adapter.post("".concat(this.namespace,"/").concat(t,"/set-destination/").concat(e),n,i).then(this.afterFetch.bind(this))},captureQrCode:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return B(e)&&(e=e.id),this.adapter.post("".concat(this.namespace,"/").concat(t,"/capture-qr").concat(e?"/"+e:""),n,i)},captureSignature:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return B(e)&&(e=e.id),this.adapter.post("".concat(this.namespace,"/").concat(t,"/capture-signature").concat(e?"/"+e:""),n,i)},complete:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/complete"),e,n).then(this.afterFetch.bind(this))},cancel:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.delete("".concat(this.namespace,"/").concat(t,"/cancel"),e,n).then(this.afterFetch.bind(this))}}),X=function(t){h(i,Z);var e=y(i);function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,i),e.call(this,t,r,"order",n({actions:Y},o))}return u(i,[{key:"getDistanceAndTime",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.getDistanceAndTime(this.id,t,e)}},{key:"dispatch",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.dispatch(this.id,t,e)}},{key:"start",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.start(this.id,t,e)}},{key:"setDestination",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.store.setDestination(this.id,t,e,n)}},{key:"captureQrCode",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.store.captureQrCode(this.id,t,e,n)}},{key:"captureSignature",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.store.captureSignature(this.id,t,e,n)}},{key:"getNextActivity",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.getNextActivity(this.id,t,e)}},{key:"updateActivity",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.updateActivity(this.id,t,e)}},{key:"cancel",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.cancel(this.id,t,e)}},{key:"complete",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.complete(this.id,t,e)}},{key:"isDispatched",get:function(){return null!==this.getAttribute("dispatched_at")}},{key:"isNotDispatched",get:function(){return null==this.getAttribute("dispatched_at")}},{key:"isStarted",get:function(){return null!==this.getAttribute("started_at")}},{key:"isNotStarted",get:function(){return null==this.getAttribute("started_at")}},{key:"isCompleted",get:function(){return"completed"==this.getAttribute("status")}},{key:"isCanceled",get:function(){return"canceled"==this.getAttribute("status")}},{key:"isEnroute",get:function(){return"driver_enroute"==this.getAttribute("status")||"enroute"===this.getAttribute("status")}},{key:"isInProgress",get:function(){return this.isStarted&&!this.isCanceled&&!this.isCompleted}},{key:"scheduledAt",get:function(){return this.isAttributeFilled("scheduled_at")?new Date(this.getAttribute("scheduled_at")):null}},{key:"startedAt",get:function(){return this.isAttributeFilled("started_at")?new Date(this.getAttribute("started_at")):null}},{key:"dispatchedAt",get:function(){return this.isAttributeFilled("dispatched_at")?new Date(this.getAttribute("dispatched_at")):null}},{key:"status",get:function(){return this.getAttribute("status")}}]),i}(),tt=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"payload",r)}return u(n,[{key:"attach",value:function(t){}},{key:"entities",get:function(){}},{key:"dropoff",get:function(){}},{key:"pickup",get:function(){}},{key:"waypoints",get:function(){return new C(this.waypoints)}}]),n}(),et=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"entity",r)}return n}(),nt=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"place",r)}return u(n,[{key:"latitude",get:function(){var t;return null===(t=this.getAttribute("location",new K))||void 0===t?void 0:t.coordinates[1]}},{key:"longitude",get:function(){var t;return null===(t=this.getAttribute("location",new K))||void 0===t?void 0:t.coordinates[0]}},{key:"coordinates",get:function(){return[this.latitude,this.longitude]}},{key:"setOwner",value:function(t){return B(t)&&this.setAttribute("owner",t.id),"string"==typeof t&&this.setAttribute("owner",t),this}}],[{key:"fromGoogleAddress",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.getAttribute("coordinates"),o=b(r,2),s=o[0],a=o[1],u={name:null,address:t.getAttribute("address"),location:new K(s,a),street1:t.getAttribute("streetName"),street2:null,city:t.getAttribute("city"),province:t.getAttribute("stateLong"),postal_code:t.getAttribute("postalCode"),neighborhood:t.get("neighborhood"),district:t.getAttribute("county"),building:t.get("building"),country:t.getAttribute("countryShort"),phone:null,security_access_code:null};return new n(u,e,i)}}]),n}(),it=function(t){h(n,nt);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"waypoint",r)}return n}(),rt=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"tracking-status",r)}return n}(),ot=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"vehicle",r)}return n}(),st=new V({login:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(U(t))return this.adapter.post("drivers/login-with-sms",{phone:t});if(!e)throw new Error("Login requires password!");return this.adapter.post("drivers/login",n({identity:t,password:e},i)).then(this.afterFetch.bind(this))},verifyCode:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("drivers/verify-code",n({identity:t,code:e},i)).then(this.afterFetch.bind(this))},track:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("drivers/".concat(t,"/track"),e,n).then(this.afterFetch.bind(this))},retrieve:function(t){return this.findRecord(t)},syncDevice:function(t){return this.adapter.setHeaders({"Driver-Token":this.token}).post("drivers/register-device",t)}}),at=function(t){h(i,Z);var e=y(i);function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,i),e.call(this,t,r,"driver",n({actions:st},o))}return u(i,[{key:"latitude",get:function(){var t;return null===(t=this.getAttribute("location",new Point))||void 0===t?void 0:t.coordinates[1]}},{key:"longitude",get:function(){var t;return null===(t=this.getAttribute("location",new Point))||void 0===t?void 0:t.coordinates[0]}},{key:"coordinates",get:function(){return[this.latitude,this.longitude]}},{key:"token",get:function(){return this.getAttribute("token")}},{key:"isOnline",get:function(){return!0===this.getAttribute("online")}},{key:"track",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.track(this.id,t,e)}},{key:"syncDevice",value:function(t){return this.store.syncDevice(t)}}]),i}(),ut=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"vendor",r)}return n}(),ct=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"contact",r)}return n}(),ht=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"zone",r)}return n}(),lt=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"service-area",r)}return n}(),vt=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"service-rate",r)}return n}(),dt=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"service-quote",r)}return u(n,[{key:"fromPreliminary",value:function(){}},{key:"fromPayload",value:function(){}}]),n}(),ft=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s(this,t),this.version=e.version||"v1",this.host=e.host||null,this.namespace=e.namespace||null,this.headers=e.headers||{}},gt=function(t){h(i,ft);var e=y(i);function i(t){var n;return s(this,i),(n=e.call(this,t)).setHeaders({Authorization:"Bearer ".concat(t.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;browser"}),n}return u(i,[{key:"setHeaders",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.headers=n(n({},this.headers),t),this}},{key:"parseJSON",value:function(t){return new Promise((function(e,n){return t.json().then((function(n){return e({statusText:t.statusText,status:t.status,ok:t.ok,json:n})})).catch((function(){n(new Error("Oops! Something went wrong when handling your request."))}))}))}},{key:"request",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise((function(s,a){return fetch(o.url||"".concat(e.host,"/").concat(e.namespace,"/").concat(t),n({method:i,mode:o.mode||"cors",headers:new Headers(n(n({},e.headers||{}),o.headers||{}))},r)).then(e.parseJSON).then((function(t){return t.ok?s(t.json):a(new Error(t.json.errors?t.json.errors[0]:t.statusText))})).catch((function(t){a(t)}))}))}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=N(e)?"":new URLSearchParams(e).toString();return this.request("".concat(t).concat(i?"?".concat(i):""),"GET",{},n)}},{key:"post",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"POST",{body:JSON.stringify(e)},n)}},{key:"put",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"PUT",{body:JSON.stringify(e)},n)}},{key:"delete",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.request(t,"DELETE",{},e)}},{key:"patch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"PATCH",{body:JSON.stringify(e)},n)}}]),i}(),pt=function(e){h(r,ft);var i=y(r);function r(e){var n;return s(this,r),(n=i.call(this,e)).axios=t.create({baseURL:"".concat(n.host,"/").concat(n.namespace),headers:{Authorization:"Bearer ".concat(e.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;node"}}),n}return u(r,[{key:"setHeaders",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.axios.defaults.headers.common;return this.axios.defaults.headers.common=n(n({},e),t),this}},{key:"transform",value:function(t){return t.data}},{key:"handleError",value:function(t){if(t.response){var e=t.response.data;if(A(e.errors))throw new Error(e.errors[0]);if(e.error)throw new Error(e.error)}throw t}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=N(e)?"":new URLSearchParams(e).toString();return this.axios.get("".concat(t).concat(i?"?".concat(i):""),n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"post",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.post(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"put",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.put(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"delete",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.axios.delete(t,e).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"patch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.patch(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}}]),r}(),yt=function(t){h(n,ft);var e=y(n);function n(){return s(this,n),e.apply(this,arguments)}return n}(),bt=function(){function t(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];s(this,t),c(this,"uncountableWords",["equipment","information","rice","money","species","series","fish","sheep","moose","deer","news"]),c(this,"pluralRules",[[new RegExp("(m)an$","gi"),"$1en"],[new RegExp("(pe)rson$","gi"),"$1ople"],[new RegExp("(child)$","gi"),"$1ren"],[new RegExp("^(ox)$","gi"),"$1en"],[new RegExp("(ax|test)is$","gi"),"$1es"],[new RegExp("(octop|vir)us$","gi"),"$1i"],[new RegExp("(alias|status)$","gi"),"$1es"],[new RegExp("(bu)s$","gi"),"$1ses"],[new RegExp("(buffal|tomat|potat)o$","gi"),"$1oes"],[new RegExp("([ti])um$","gi"),"$1a"],[new RegExp("sis$","gi"),"ses"],[new RegExp("(?:([^f])fe|([lr])f)$","gi"),"$1$2ves"],[new RegExp("(hive)$","gi"),"$1s"],[new RegExp("([^aeiouy]|qu)y$","gi"),"$1ies"],[new RegExp("(x|ch|ss|sh)$","gi"),"$1es"],[new RegExp("(matr|vert|ind)ix|ex$","gi"),"$1ices"],[new RegExp("([m|l])ouse$","gi"),"$1ice"],[new RegExp("(quiz)$","gi"),"$1zes"],[new RegExp("s$","gi"),"s"],[new RegExp("$","gi"),"s"]]),c(this,"singularRules",[[new RegExp("(m)en$","gi"),"$1an"],[new RegExp("(pe)ople$","gi"),"$1rson"],[new RegExp("(child)ren$","gi"),"$1"],[new RegExp("([ti])a$","gi"),"$1um"],[new RegExp("((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$","gi"),"$1$2sis"],[new RegExp("(hive)s$","gi"),"$1"],[new RegExp("(tive)s$","gi"),"$1"],[new RegExp("(curve)s$","gi"),"$1"],[new RegExp("([lr])ves$","gi"),"$1f"],[new RegExp("([^fo])ves$","gi"),"$1fe"],[new RegExp("([^aeiouy]|qu)ies$","gi"),"$1y"],[new RegExp("(s)eries$","gi"),"$1eries"],[new RegExp("(m)ovies$","gi"),"$1ovie"],[new RegExp("(x|ch|ss|sh)es$","gi"),"$1"],[new RegExp("([m|l])ice$","gi"),"$1ouse"],[new RegExp("(bus)es$","gi"),"$1"],[new RegExp("(o)es$","gi"),"$1"],[new RegExp("(shoe)s$","gi"),"$1"],[new RegExp("(cris|ax|test)es$","gi"),"$1is"],[new RegExp("(octop|vir)i$","gi"),"$1us"],[new RegExp("(alias|status)es$","gi"),"$1"],[new RegExp("^(ox)en","gi"),"$1"],[new RegExp("(vert|ind)ices$","gi"),"$1ex"],[new RegExp("(matr)ices$","gi"),"$1ix"],[new RegExp("(quiz)zes$","gi"),"$1"],[new RegExp("s$","gi"),""]]),c(this,"nonTitlecasedWords",["and","or","nor","a","an","the","so","but","to","of","at","by","from","into","on","onto","off","out","in","over","with","for"]),c(this,"idSuffix",new RegExp("(_ids|_id)$","g")),c(this,"underbar",new RegExp("_","g")),c(this,"spaceOrUnderbar",new RegExp("[ _]","g")),c(this,"uppercase",new RegExp("([A-Z])","g")),c(this,"underbarPrefix",new RegExp("^_")),this.str=e,this.chain=n}return u(t,[{key:"get",value:function(){return this.str}},{key:"applyRules",value:function(t,e,n,i){if(i)t=i;else if(!(n.indexOf(t.toLowerCase())>-1))for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:null;return t=t||this.str,this.applyRules(t,this.pluralRules,this.uncountableWords,e)}},{key:"singularize",value:function(t,e){return t=t||this.str,this.applyRules(t,this.singularRules,this.uncountableWords,e)}},{key:"camelize",value:function(t,e){for(var n=(t=t||this.str).split("/"),i=0;i1&&void 0!==arguments[1]&&arguments[1];return t=t||this.str,t=this.underscore(this.demodulize(t))+(e?"":"_")+"id",this.str=t,!0===this.chain?this:t}},{key:"ordinalize",value:function(t){for(var e=(t=t||this.str).split(" "),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];if(t.actions=A(e)?e:[e],!A(e))return e instanceof V&&e.extend(t),t;for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{};s(this,t),this.resource=e,this.adapter=n||J(),this.namespace=kt(e),this.storage=new C,this.options=i,this.extendActions(i.actions)}return u(t,[{key:"extendActions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Ot(this,t)}},{key:"deposit",value:function(t){return t}},{key:"serialize",value:function(t){return jt("resource",xt(this.resource),t,this.adapter)}},{key:"afterFetch",value:function(t){return function(t,e){if("function"==typeof t.options.onAfterFetch&&t.options.onAfterFetch(e),A(e)){for(var n=[],i=0;i0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var i=o(regeneratorRuntime.mark((function i(r,o){var s;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.adapter.post("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=i.sent,r(s);case 4:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}())}},{key:"update",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(function(){var r=o(regeneratorRuntime.mark((function r(o,s){var a;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e.adapter.put("".concat(e.namespace,"/").concat(t),n,i).then(e.afterFetch.bind(e)).catch(s);case 2:a=r.sent,o(a);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"findRecord",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var i=o(regeneratorRuntime.mark((function i(r,o){var s;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,e.adapter.get("".concat(e.namespace,"/").concat(t),{},n).then(e.afterFetch.bind(e)).catch(o);case 2:s=i.sent,r(s);case 4:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}())}},{key:"findAll",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(){var n=o(regeneratorRuntime.mark((function n(i,r){var o;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.adapter.get("".concat(t.namespace),{},e).then(t.afterFetch.bind(t)).catch(r);case 2:o=n.sent,i(o);case 4:case"end":return n.stop()}}),n)})));return function(t,e){return n.apply(this,arguments)}}())}},{key:"query",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var i=o(regeneratorRuntime.mark((function i(r,o){var s;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.adapter.get("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=i.sent,r(s);case 4:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}())}},{key:"queryRecord",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.single=!0,new Promise(function(){var i=o(regeneratorRuntime.mark((function i(r,o){var s;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.adapter.get("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=i.sent,r(s);case 4:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}())}},{key:"destroy",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=B(t)?t.getAttribute("id"):t;return new Promise(function(){var t=o(regeneratorRuntime.mark((function t(r,o){var s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.adapter.delete("".concat(e.namespace,"/").concat(i),{},n).then(e.afterFetch.bind(e)).catch(o);case 2:s=t.sent,r(s);case 4:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}())}}]),t}(),_t=function(){function t(e){var n,i,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(s(this,t),this.version=null!==(n=o.version)&&void 0!==n?n:"v1",this.options={version:this.version,host:null!==(i=o.host)&&void 0!==i?i:"https://api.fleetbase.io",namespace:null!==(r=o.namespace)&&void 0!==r?r:this.version,debug:a,publicKey:e},"string"!=typeof e||0===e.length)throw new Error("⚠️ Invalid public key given to Fleetbase SDK");if(!I()&&e.toLowerCase().startsWith("$"))throw new Error("Secret key provided. You must use a public key with Fleetbase Javascript SDK!");this.adapter=o.adapter||J(this.options),this.orders=new St("order",this.adapter).extendActions(Y),this.entities=new St("entity",this.adapter),this.places=new St("place",this.adapter),this.drivers=new St("driver",this.adapter).extendActions(st),this.vehicles=new St("vehicle",this.adapter),this.vendors=new St("vendor",this.adapter),this.contacts=new St("contact",this.adapter)}return u(t,[{key:"setAdapter",value:function(t){this.adapter=t}},{key:"getAdapter",value:function(){return this.adapter}}],[{key:"newInstance",value:function(){return f(t,Array.prototype.slice.call(arguments))}}]),t}();export{ft as Adapter,gt as BrowserAdapter,C as Collection,ct as Contact,at as Driver,yt as EmberJsAdapter,et as Entity,H as GoogleAddress,pt as NodeAdapter,X as Order,tt as Payload,nt as Place,K as Point,Z as Resource,lt as ServiceArea,dt as ServiceQuote,vt as ServiceRate,St as Store,V as StoreActions,rt as TrackingStatus,ot as Vehicle,ut as Vendor,it as Waypoint,ht as Zone,wt as camelize,xt as classify,At as dasherize,_t as default,Ot as extendStoreActions,T as isLatitude,q as isLongitude,I as isNodeEnvironment,B as isResource,kt as pluralize,mt as singularize}; +import t from"axios";import"date-fns";function e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function n(t){for(var n=1;nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n3&&void 0!==arguments[3]?arguments[3]:[];if(A(t))if(i.length<=6e4)t.splice.apply(t,[e,n].concat(k(i)));else{t.splice(e,n);for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:0,i=t.length,r=n;r2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0,r=t.length;n<0&&(n+=r);var o=i&&e!=e?function(t){return t!=t}:function(t){return t===e};return S(t,o,n)},D=function(t,e,n){return $(t,e,0,[n]),n},C=function(t){h(n,g(Array));var e=y(n);function n(){for(var t=arguments.length,i=new Array(t),r=0;r0}},{key:"empty",get:function(){return 0===this.length}},{key:"first",get:function(){return j(this,0)}},{key:"last",get:function(){return j(this,this.length-1)}},{key:"replace",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return $(this,t,e,n),this}},{key:"objectsAt",value:function(t){var e=this;return t.map((function(t){return j(e,t)}))}},{key:"objectAt",value:function(t){return j(this,t)}},{key:"indexOf",value:function(t,e){return z(this,t,e,!1)}},{key:"lastIndexOf",value:function(t,e){var n=this.length;(void 0===e||e>=n)&&(e=n-1),e<0&&(e+=n);for(var i=e;i>=0;i--)if(j(this,i)===t)return i;return-1}},{key:"includes",value:function(t,e){return-1!==z(this,t,e,!0)}},{key:"findBy",value:function(){return _(this,O.apply(void 0,arguments))}},{key:"findIndexBy",value:function(){return S(this,O.apply(void 0,arguments))}},{key:"isEvery",value:function(){return F(this,O.apply(void 0,arguments))}},{key:"isAny",value:function(){return P(this,O.apply(void 0,arguments))}},{key:"invoke",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i1&&void 0!==arguments[1]?arguments[1]:R,n=[],i=new Set,r="function"==typeof e?e:function(t){return get(t,e)};return t.forEach((function(t){var e=r(t);i.has(e)||(i.add(e),n.push(t))})),n}(this,t)}},{key:"without",value:function(t){if(!this.includes(t))return this;var e=t==t?function(e){return e!==t}:function(t){return t==t};return this.filter(e)}},{key:"clear",value:function(){var t=this.length;return 0===t||this.replace(0,t,[]),this}},{key:"insertAt",value:function(t,e){return D(this,t,e),this}},{key:"replaceAt",value:function(t,e){return this.replace(t,1,[e])}},{key:"removeAt",value:function(t,e){return function(t,e){return $(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,[]),t}(this,t,e)}},{key:"pushObject",value:function(t){return this.insertAt(this.length,t)}},{key:"pushObjects",value:function(t){return this.replace(this.length,0,t),this}},{key:"popObject",value:function(){var t=this.length;if(0===t)return null;var e=j(this,t-1);return this.removeAt(t-1,1),e}},{key:"shiftObject",value:function(){if(0===this.length)return null;var t=j(this,0);return this.removeAt(0),t}},{key:"unshiftObject",value:function(t){return D(this,0,t)}},{key:"unshiftObjects",value:function(t){return this.replace(0,0,t),this}},{key:"reverseObjects",value:function(){var t=this.length;if(0===t)return this;var e=this.toArray().reverse();return this.replace(0,t,e),this}},{key:"setObjects",value:function(t){if(0===t.length)return this.clear();var e=this.length;return this.replace(0,e,t),this}},{key:"removeObject",value:function(t){for(var e=this.length||0;--e>=0;){j(this,e)===t&&this.removeAt(e)}return this}},{key:"removeObjects",value:function(t){for(var e=t.length-1;e>=0;e--)this.removeObject(t[e]);return this}},{key:"addObject",value:function(t){return this.includes(t)||this.pushObject(t),this}},{key:"addObjects",value:function(t){var e=this;return t.forEach((function(t){return e.addObject(t)})),this}}]),n}(),L=function(t){var e=null==t;if(e)return e;if("number"==typeof t.size)return!t.size;var n=i(t);if("object"===n){var r=t.size;if("number"==typeof r)return!r}if("number"==typeof t.length&&"function"!==n)return!t.length;if("object"===n){var o=t.length;if("number"==typeof o)return!o}return!1},N=function(t){return L(t)||"string"==typeof t&&!1===/\S/.test(t)};function T(t){return isFinite(t)&&Math.abs(t)<=90}function q(t){return isFinite(t)&&Math.abs(t)<=180&&Math.abs(t)>=90}function B(t){return t instanceof Z}var U=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^[+]?[\s./0-9]*[(]?[0-9]{1,4}[)]?[-\s./0-9]*$/g.test(t)},I=function(){var t,e,n,r,o;return!("undefined"==typeof process||"object"!==i(null===(t=process)||void 0===t?void 0:t.env)&&-1===(null===(e=process.release)||void 0===e||null===(n=e.name)||void 0===n?void 0:n.search(/node|io.js/))||"undefined"!=typeof window&&"ReactNative"!==(null===(r=window)||void 0===r||null===(o=r.navigator)||void 0===o?void 0:o.product))},J=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return I()?jt("adapter","NodeAdapter",t):jt("adapter","BrowserAdapter",t)},W=Array.isArray,K=function(){function t(e){s(this,t),this.place=e,this.geometry=null==e?void 0:e.geometry,this.components=this.parseComponents(),this.attributes=this.parseProperties()}return u(t,[{key:"parse",value:function(){this.parseComponents(),this.parseProperties()}},{key:"parseComponents",value:function(){var t;return((null===(t=this.place)||void 0===t?void 0:t.address_components)||[]).reduce((function(t,e){return e.types.forEach((function(n){t[n]=e})),t}),{})}},{key:"parseProperties",value:function(){var t,e={streetNumber:this.get("street_number"),streetName:this.get("route"),coordinates:null!==(t=this.geometry)&&void 0!==t&&t.location?Object.values(this.geometry.location):[0,0],city:this.or(["locality","sublocality","sublocality_level_1","neighborhood","administrative_area_level_3","administrative_area_level_2"]),county:this.get("administrative_area_level_2"),stateShort:this.get("administrative_area_level_1",!0),stateLong:this.get("administrative_area_level_1"),countryShort:this.get("country",!0),country:this.get("country",!0),countryLong:this.get("country"),postalCode:this.get("postal_code")};return e.address=[e.streetNumber,e.streetName].filter(Boolean).join(" "),e}},{key:"all",value:function(){return this.attributes}},{key:"or",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=0;e1&&void 0!==arguments[1]&&arguments[1];return t in this.components?e?this.components[t].short_name:this.components[t].long_name:null}},{key:"setAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.attributes=n(n({},this.attributes),t),this}},{key:"setAttribute",value:function(t,e){return this.attributes[t]=e,this}},{key:"getAttribute",value:function(t){return this.attributes[t]||null}}]),t}(),M=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;s(this,t),this.type="Point",this.coordinates=[n,e]}return u(t,[{key:"latitude",get:function(){return this.coordinates[1]}},{key:"longitude",get:function(){return this.coordinates[0]}},{key:"lat",value:function(){return this.latitude}},{key:"lng",value:function(){return this.longitude}},{key:"serialize",value:function(){return{type:"Point",coorindates:[this.lat(),this.lng()]}}},{key:"toJson",value:function(){return this.serialize()}},{key:"toString",value:function(){return"(".concat(this.latitude,", ").concat(this.longitude,")")}}],[{key:"fromGeoJson",value:function(e){var n=b(e.coordinates,2);return longitude=n[0],latitude=n[1],new t(latitude,longitude)}}]),t}();"undefined"==typeof arguments||arguments;var H=function(t,e){var n=t();return Array.isArray(n)||"object"===i(n)?G(n,e):null},G=function t(e,n){var r,o=e,s=i(e),a="object"===s,u="function"===s,c=Array.isArray(e),h="string"===i(n)&&n.includes(".")?n.split("."):[n];if(c||a){for(var l=0;l0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;s(this,t),this.actions=e,this.bind=n}return u(t,[{key:"extend",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=t||this.bind;if(!e)return this;if(null!=this&&this.actions&&"object"===i(this.actions))for(var n in this.actions){var r=this.actions[n];"function"==typeof r?Q(e,n,r.bind(e)):Q(e,n,r)}return this}}]),t}(),Z=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};s(this,t),this.attributes=e,this.dirtyAttributes={},this.changes={},this.isLoading=!1,this.isSaving=!1,this.isDestroying=!1,this.isReloading=!1,this.resource=i,this.options=r,this.version=r.version||"v1",this.setAdapter(n)}return u(t,[{key:"setAdapter",value:function(t){var e;return this.adapter=t,this.store=new St(this.resource,t,{onAfterFetch:this.syncAttributes.bind(this),actions:null===(e=this.options)||void 0===e?void 0:e.actions}),this}},{key:"id",get:function(){return this.getAttribute("id")}},{key:"create",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.mergeAttributes(e);return this.setFlags(["isLoading","isSaving"]),this.store.create(n).then((function(e){return t.setFlags(["isLoading","isSaving"],!1),e}))}},{key:"update",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.setFlags(["isLoading","isSaving"]),this.store.update(this.attributes.id,e).then((function(e){return t.setFlags(["isLoading","isSaving"],!1),e}))}},{key:"destroy",value:function(){var t=this;return this.setFlags(["isLoading","isDestroying"]),this.store.destroy(this.attributes.id).then((function(e){return t.setFlags(["isLoading","isDestroying"],!1),e}))}},{key:"reload",value:function(){var t=this;return this.setFlags(["isLoading","isReloading"]),this.store.findRecord(this.attributes.id).then((function(e){return t.reset(),e}))}},{key:"setFlags",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=["isLoading","isSaving","isReloading","isDestroying"],i=0;i0&&void 0!==arguments[0]?arguments[0]:{},e=this.getAttributes();return L(this.id)?this.create(e):!0===t.onlyDirty?this.savedirty():this.update(e)}},{key:"saveDirty",value:function(){for(var t=Object.keys(this.dirtyAttributes),e={},n=0;n0}},{key:"mutate",value:function(t,e){this.attributes[t]=e}},{key:"setAttribute",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(null===n&&"object"===i(t))return this.setAttributes(t);var r=null!==(e=null==this?void 0:this.attributes[t])&&void 0!==e?e:null;return Q(this.attributes,t,n),Q(this.dirtyAttributes,t,r),A(null==this?void 0:this.changes[t])||(this.changes[t]=[]),this.changes[t].push({property:t,previousValue:r,value:n,changedAt:new Date}),this}},{key:"setAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var e in t)this.setAttribute(e,t[e]);return this}},{key:"getAttribute",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=G(null!==(e=null==this?void 0:this.attributes)&&void 0!==e?e:{},t);return void 0===i?n:i}},{key:"hasAttribute",value:function(t){if(A(t)){var e,n=t,i=Object.keys(null!==(e=this.attributes)&&void 0!==e?e:{});return n.every((function(t){return i.includes(t)}))}return!(null==this||!this.attributes)&&t in this.attributes}},{key:"hasAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.hasAttribute(t)}},{key:"isAttributeFilled",value:function(t){var e=this;return A(t)?this.hasAttribute(t)&&t.every((function(t){return!L(e.getAttribute(t))})):this.hasAttribute(t)&&!L(this.getAttribute(t))}},{key:"getAttributes",value:function(t){var e={};if(null==t)return this.getAttributes(Object.keys(this.attributes));if("string"==typeof t)return this.getAttribute(Array.prototype.slice.call(arguments));if(!A(t))throw new Error("No attribute properties provided!");for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},i=null!==(t=null==this?void 0:this.attributes)&&void 0!==t?t:{};return this.attributes=n(n({},i),e),this.attributes}},{key:"syncAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.attributes=t}}]),t}(),Y=new V({getDistanceAndTime:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.get("".concat(this.namespace,"/").concat(t,"/distance-and-time"),e,n)},getNextActivity:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.get("".concat(this.namespace,"/").concat(t,"/next-activity"),e,n)},dispatch:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/dispatch"),e,n).then(this.afterFetch.bind(this))},start:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/start"),e,n).then(this.afterFetch.bind(this))},updateActivity:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/update-activity"),e,n).then(this.afterFetch.bind(this))},setDestination:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return B(e)&&(e=e.id),this.adapter.post("".concat(this.namespace,"/").concat(t,"/set-destination/").concat(e),n,i).then(this.afterFetch.bind(this))},captureQrCode:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return B(e)&&(e=e.id),this.adapter.post("".concat(this.namespace,"/").concat(t,"/capture-qr").concat(e?"/"+e:""),n,i)},captureSignature:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return B(e)&&(e=e.id),this.adapter.post("".concat(this.namespace,"/").concat(t,"/capture-signature").concat(e?"/"+e:""),n,i)},complete:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("".concat(this.namespace,"/").concat(t,"/complete"),e,n).then(this.afterFetch.bind(this))},cancel:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.delete("".concat(this.namespace,"/").concat(t,"/cancel"),e,n).then(this.afterFetch.bind(this))}}),X=function(t){h(i,Z);var e=y(i);function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,i),e.call(this,t,r,"order",n({actions:Y},o))}return u(i,[{key:"getDistanceAndTime",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.getDistanceAndTime(this.id,t,e)}},{key:"dispatch",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.dispatch(this.id,t,e)}},{key:"start",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.start(this.id,t,e)}},{key:"setDestination",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.store.setDestination(this.id,t,e,n)}},{key:"captureQrCode",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.store.captureQrCode(this.id,t,e,n)}},{key:"captureSignature",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.store.captureSignature(this.id,t,e,n)}},{key:"getNextActivity",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.getNextActivity(this.id,t,e)}},{key:"updateActivity",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.updateActivity(this.id,t,e)}},{key:"cancel",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.cancel(this.id,t,e)}},{key:"complete",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.complete(this.id,t,e)}},{key:"isDispatched",get:function(){return null!==this.getAttribute("dispatched_at")}},{key:"isNotDispatched",get:function(){return null==this.getAttribute("dispatched_at")}},{key:"isStarted",get:function(){return null!==this.getAttribute("started_at")}},{key:"isNotStarted",get:function(){return null==this.getAttribute("started_at")}},{key:"isCompleted",get:function(){return"completed"==this.getAttribute("status")}},{key:"isCanceled",get:function(){return"canceled"==this.getAttribute("status")}},{key:"isEnroute",get:function(){return"driver_enroute"==this.getAttribute("status")||"enroute"===this.getAttribute("status")}},{key:"isInProgress",get:function(){return this.isStarted&&!this.isCanceled&&!this.isCompleted}},{key:"scheduledAt",get:function(){return this.isAttributeFilled("scheduled_at")?new Date(this.getAttribute("scheduled_at")):null}},{key:"startedAt",get:function(){return this.isAttributeFilled("started_at")?new Date(this.getAttribute("started_at")):null}},{key:"dispatchedAt",get:function(){return this.isAttributeFilled("dispatched_at")?new Date(this.getAttribute("dispatched_at")):null}},{key:"status",get:function(){return this.getAttribute("status")}}]),i}(),tt=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"payload",r)}return u(n,[{key:"attach",value:function(t){}},{key:"entities",get:function(){}},{key:"dropoff",get:function(){}},{key:"pickup",get:function(){}},{key:"waypoints",get:function(){return new C(this.waypoints)}}]),n}(),et=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"entity",r)}return n}(),nt=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"place",r)}return u(n,[{key:"latitude",get:function(){var t;return null===(t=this.getAttribute("location",new M))||void 0===t?void 0:t.coordinates[1]}},{key:"longitude",get:function(){var t;return null===(t=this.getAttribute("location",new M))||void 0===t?void 0:t.coordinates[0]}},{key:"coordinates",get:function(){return[this.latitude,this.longitude]}},{key:"setOwner",value:function(t){return B(t)&&this.setAttribute("owner",t.id),"string"==typeof t&&this.setAttribute("owner",t),this}}],[{key:"fromGoogleAddress",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.getAttribute("coordinates"),o=b(r,2),s=o[0],a=o[1],u={name:null,address:t.getAttribute("address"),location:new M(s,a),street1:t.getAttribute("streetName"),street2:null,city:t.getAttribute("city"),province:t.getAttribute("stateLong"),postal_code:t.getAttribute("postalCode"),neighborhood:t.get("neighborhood"),district:t.getAttribute("county"),building:t.get("building"),country:t.getAttribute("countryShort"),phone:null,security_access_code:null};return new n(u,e,i)}}]),n}(),it=function(t){h(n,nt);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"waypoint",r)}return n}(),rt=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"tracking-status",r)}return n}(),ot=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"vehicle",r)}return n}(),st=new V({login:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(U(t))return this.adapter.post("drivers/login-with-sms",{phone:t});if(!e)throw new Error("Login requires password!");return this.adapter.post("drivers/login",n({identity:t,password:e},i)).then(this.afterFetch.bind(this))},verifyCode:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("drivers/verify-code",n({identity:t,code:e},i)).then(this.afterFetch.bind(this))},track:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("drivers/".concat(t,"/track"),e,n).then(this.afterFetch.bind(this))},retrieve:function(t){return this.findRecord(t)},syncDevice:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("drivers/".concat(t,"/register-device"),e,n)}}),at=function(t){h(i,Z);var e=y(i);function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,i),e.call(this,t,r,"driver",n({actions:st},o))}return u(i,[{key:"token",get:function(){return this.getAttribute("token")}},{key:"isOnline",get:function(){return!0===this.getAttribute("online")}},{key:"latitude",get:function(){var t;return null===(t=this.getAttribute("location",new Point))||void 0===t?void 0:t.coordinates[1]}},{key:"longitude",get:function(){var t;return null===(t=this.getAttribute("location",new Point))||void 0===t?void 0:t.coordinates[0]}},{key:"coordinates",get:function(){return[this.latitude,this.longitude]}},{key:"track",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.track(this.id,t,e)}},{key:"syncDevice",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.syncDevice(this.id,t,e)}}]),i}(),ut=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"vendor",r)}return n}(),ct=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"contact",r)}return n}(),ht=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"zone",r)}return n}(),lt=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"service-area",r)}return n}(),vt=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"service-rate",r)}return n}(),dt=function(t){h(n,Z);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,i,"service-quote",r)}return u(n,[{key:"fromPreliminary",value:function(){}},{key:"fromPayload",value:function(){}}]),n}(),ft=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s(this,t),this.version=e.version||"v1",this.host=e.host||null,this.namespace=e.namespace||null,this.headers=e.headers||{}},gt=function(t){h(i,ft);var e=y(i);function i(t){var n;return s(this,i),(n=e.call(this,t)).setHeaders({Authorization:"Bearer ".concat(t.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;browser"}),n}return u(i,[{key:"setHeaders",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.headers=n(n({},this.headers),t),this}},{key:"parseJSON",value:function(t){return new Promise((function(e,n){return t.json().then((function(n){return e({statusText:t.statusText,status:t.status,ok:t.ok,json:n})})).catch((function(){n(new Error("Oops! Something went wrong when handling your request."))}))}))}},{key:"request",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise((function(s,a){return fetch(o.url||"".concat(e.host,"/").concat(e.namespace,"/").concat(t),n({method:i,mode:o.mode||"cors",headers:new Headers(n(n({},e.headers||{}),o.headers||{}))},r)).then(e.parseJSON).then((function(t){return t.ok?s(t.json):a(new Error(t.json.errors?t.json.errors[0]:t.statusText))})).catch((function(t){a(t)}))}))}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=N(e)?"":new URLSearchParams(e).toString();return this.request("".concat(t).concat(i?"?".concat(i):""),"GET",{},n)}},{key:"post",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"POST",{body:JSON.stringify(e)},n)}},{key:"put",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"PUT",{body:JSON.stringify(e)},n)}},{key:"delete",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.request(t,"DELETE",{},e)}},{key:"patch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"PATCH",{body:JSON.stringify(e)},n)}}]),i}(),pt=function(e){h(r,ft);var i=y(r);function r(e){var n;return s(this,r),(n=i.call(this,e)).axios=t.create({baseURL:"".concat(n.host,"/").concat(n.namespace),headers:{Authorization:"Bearer ".concat(e.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;node"}}),n}return u(r,[{key:"setHeaders",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.axios.defaults.headers.common;return this.axios.defaults.headers.common=n(n({},e),t),this}},{key:"transform",value:function(t){return t.data}},{key:"handleError",value:function(t){if(t.response){var e=t.response.data;if(A(e.errors))throw new Error(e.errors[0]);if(e.error)throw new Error(e.error)}throw t}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=N(e)?"":new URLSearchParams(e).toString();return this.axios.get("".concat(t).concat(i?"?".concat(i):""),n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"post",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.post(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"put",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.put(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"delete",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.axios.delete(t,e).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"patch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.patch(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}}]),r}(),yt=function(t){h(n,ft);var e=y(n);function n(){return s(this,n),e.apply(this,arguments)}return n}(),bt=function(){function t(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];s(this,t),c(this,"uncountableWords",["equipment","information","rice","money","species","series","fish","sheep","moose","deer","news"]),c(this,"pluralRules",[[new RegExp("(m)an$","gi"),"$1en"],[new RegExp("(pe)rson$","gi"),"$1ople"],[new RegExp("(child)$","gi"),"$1ren"],[new RegExp("^(ox)$","gi"),"$1en"],[new RegExp("(ax|test)is$","gi"),"$1es"],[new RegExp("(octop|vir)us$","gi"),"$1i"],[new RegExp("(alias|status)$","gi"),"$1es"],[new RegExp("(bu)s$","gi"),"$1ses"],[new RegExp("(buffal|tomat|potat)o$","gi"),"$1oes"],[new RegExp("([ti])um$","gi"),"$1a"],[new RegExp("sis$","gi"),"ses"],[new RegExp("(?:([^f])fe|([lr])f)$","gi"),"$1$2ves"],[new RegExp("(hive)$","gi"),"$1s"],[new RegExp("([^aeiouy]|qu)y$","gi"),"$1ies"],[new RegExp("(x|ch|ss|sh)$","gi"),"$1es"],[new RegExp("(matr|vert|ind)ix|ex$","gi"),"$1ices"],[new RegExp("([m|l])ouse$","gi"),"$1ice"],[new RegExp("(quiz)$","gi"),"$1zes"],[new RegExp("s$","gi"),"s"],[new RegExp("$","gi"),"s"]]),c(this,"singularRules",[[new RegExp("(m)en$","gi"),"$1an"],[new RegExp("(pe)ople$","gi"),"$1rson"],[new RegExp("(child)ren$","gi"),"$1"],[new RegExp("([ti])a$","gi"),"$1um"],[new RegExp("((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$","gi"),"$1$2sis"],[new RegExp("(hive)s$","gi"),"$1"],[new RegExp("(tive)s$","gi"),"$1"],[new RegExp("(curve)s$","gi"),"$1"],[new RegExp("([lr])ves$","gi"),"$1f"],[new RegExp("([^fo])ves$","gi"),"$1fe"],[new RegExp("([^aeiouy]|qu)ies$","gi"),"$1y"],[new RegExp("(s)eries$","gi"),"$1eries"],[new RegExp("(m)ovies$","gi"),"$1ovie"],[new RegExp("(x|ch|ss|sh)es$","gi"),"$1"],[new RegExp("([m|l])ice$","gi"),"$1ouse"],[new RegExp("(bus)es$","gi"),"$1"],[new RegExp("(o)es$","gi"),"$1"],[new RegExp("(shoe)s$","gi"),"$1"],[new RegExp("(cris|ax|test)es$","gi"),"$1is"],[new RegExp("(octop|vir)i$","gi"),"$1us"],[new RegExp("(alias|status)es$","gi"),"$1"],[new RegExp("^(ox)en","gi"),"$1"],[new RegExp("(vert|ind)ices$","gi"),"$1ex"],[new RegExp("(matr)ices$","gi"),"$1ix"],[new RegExp("(quiz)zes$","gi"),"$1"],[new RegExp("s$","gi"),""]]),c(this,"nonTitlecasedWords",["and","or","nor","a","an","the","so","but","to","of","at","by","from","into","on","onto","off","out","in","over","with","for"]),c(this,"idSuffix",new RegExp("(_ids|_id)$","g")),c(this,"underbar",new RegExp("_","g")),c(this,"spaceOrUnderbar",new RegExp("[ _]","g")),c(this,"uppercase",new RegExp("([A-Z])","g")),c(this,"underbarPrefix",new RegExp("^_")),this.str=e,this.chain=n}return u(t,[{key:"get",value:function(){return this.str}},{key:"applyRules",value:function(t,e,n,i){if(i)t=i;else if(!(n.indexOf(t.toLowerCase())>-1))for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:null;return t=t||this.str,this.applyRules(t,this.pluralRules,this.uncountableWords,e)}},{key:"singularize",value:function(t,e){return t=t||this.str,this.applyRules(t,this.singularRules,this.uncountableWords,e)}},{key:"camelize",value:function(t,e){for(var n=(t=t||this.str).split("/"),i=0;i1&&void 0!==arguments[1]&&arguments[1];return t=t||this.str,t=this.underscore(this.demodulize(t))+(e?"":"_")+"id",this.str=t,!0===this.chain?this:t}},{key:"ordinalize",value:function(t){for(var e=(t=t||this.str).split(" "),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];if(t.actions=A(e)?e:[e],!A(e))return e instanceof V&&e.extend(t),t;for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{};s(this,t),this.resource=e,this.adapter=n||J(),this.namespace=kt(e),this.storage=new C,this.options=i,this.extendActions(i.actions)}return u(t,[{key:"extendActions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Ot(this,t)}},{key:"deposit",value:function(t){return t}},{key:"serialize",value:function(t){return jt("resource",xt(this.resource),t,this.adapter)}},{key:"afterFetch",value:function(t){return function(t,e){if("function"==typeof t.options.onAfterFetch&&t.options.onAfterFetch(e),A(e)){for(var n=[],i=0;i0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var i=o(regeneratorRuntime.mark((function i(r,o){var s;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.adapter.post("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=i.sent,r(s);case 4:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}())}},{key:"update",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(function(){var r=o(regeneratorRuntime.mark((function r(o,s){var a;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e.adapter.put("".concat(e.namespace,"/").concat(t),n,i).then(e.afterFetch.bind(e)).catch(s);case 2:a=r.sent,o(a);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"findRecord",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var i=o(regeneratorRuntime.mark((function i(r,o){var s;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,e.adapter.get("".concat(e.namespace,"/").concat(t),{},n).then(e.afterFetch.bind(e)).catch(o);case 2:s=i.sent,r(s);case 4:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}())}},{key:"findAll",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(){var n=o(regeneratorRuntime.mark((function n(i,r){var o;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.adapter.get("".concat(t.namespace),{},e).then(t.afterFetch.bind(t)).catch(r);case 2:o=n.sent,i(o);case 4:case"end":return n.stop()}}),n)})));return function(t,e){return n.apply(this,arguments)}}())}},{key:"query",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var i=o(regeneratorRuntime.mark((function i(r,o){var s;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.adapter.get("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=i.sent,r(s);case 4:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}())}},{key:"queryRecord",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.single=!0,new Promise(function(){var i=o(regeneratorRuntime.mark((function i(r,o){var s;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.adapter.get("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=i.sent,r(s);case 4:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}())}},{key:"destroy",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=B(t)?t.getAttribute("id"):t;return new Promise(function(){var t=o(regeneratorRuntime.mark((function t(r,o){var s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.adapter.delete("".concat(e.namespace,"/").concat(i),{},n).then(e.afterFetch.bind(e)).catch(o);case 2:s=t.sent,r(s);case 4:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}())}}]),t}(),_t=function(){function t(e){var n,i,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(s(this,t),this.version=null!==(n=o.version)&&void 0!==n?n:"v1",this.options={version:this.version,host:null!==(i=o.host)&&void 0!==i?i:"https://api.fleetbase.io",namespace:null!==(r=o.namespace)&&void 0!==r?r:this.version,debug:a,publicKey:e},"string"!=typeof e||0===e.length)throw new Error("⚠️ Invalid public key given to Fleetbase SDK");if(!I()&&e.toLowerCase().startsWith("$"))throw new Error("Secret key provided. You must use a public key with Fleetbase Javascript SDK!");this.adapter=o.adapter||J(this.options),this.orders=new St("order",this.adapter).extendActions(Y),this.entities=new St("entity",this.adapter),this.places=new St("place",this.adapter),this.drivers=new St("driver",this.adapter).extendActions(st),this.vehicles=new St("vehicle",this.adapter),this.vendors=new St("vendor",this.adapter),this.contacts=new St("contact",this.adapter)}return u(t,[{key:"setAdapter",value:function(t){this.adapter=t}},{key:"getAdapter",value:function(){return this.adapter}}],[{key:"newInstance",value:function(){return f(t,Array.prototype.slice.call(arguments))}}]),t}();export{ft as Adapter,gt as BrowserAdapter,C as Collection,ct as Contact,at as Driver,yt as EmberJsAdapter,et as Entity,K as GoogleAddress,pt as NodeAdapter,X as Order,tt as Payload,nt as Place,M as Point,Z as Resource,lt as ServiceArea,dt as ServiceQuote,vt as ServiceRate,St as Store,V as StoreActions,rt as TrackingStatus,ot as Vehicle,ut as Vendor,it as Waypoint,ht as Zone,wt as camelize,xt as classify,At as dasherize,_t as default,Ot as extendStoreActions,T as isLatitude,q as isLongitude,I as isNodeEnvironment,B as isResource,kt as pluralize,mt as singularize}; //# sourceMappingURL=fleetbase.js.map diff --git a/dist/esm/fleetbase.js.map b/dist/esm/fleetbase.js.map index 226924f..8fc839e 100644 --- a/dist/esm/fleetbase.js.map +++ b/dist/esm/fleetbase.js.map @@ -1 +1 @@ -{"version":3,"file":"fleetbase.js","sources":["../../src/utils/array.js","../../src/utils/collection.js","../../src/utils/is-empty.js","../../src/utils/is-blank.js","../../src/utils/is-latitude.js","../../src/utils/is-longitude.js","../../src/utils/is-resource.js","../../src/utils/is-phone.js","../../src/utils/is-node-environment.js","../../src/utils/detect-adapter.js","../../src/utils/google-address.js","../../src/utils/point.js","../../src/utils/object.js","../../src/utils/store-actions.js","../../src/resource.js","../../src/resources/order.js","../../src/resources/payload.js","../../src/resources/entity.js","../../src/resources/place.js","../../src/resources/waypoint.js","../../src/resources/tracking-status.js","../../src/resources/vehicle.js","../../src/resources/driver.js","../../src/resources/vendor.js","../../src/resources/contact.js","../../src/resources/zone.js","../../src/resources/service-area.js","../../src/resources/service-rate.js","../../src/resources/service-quote.js","../../src/adapter.js","../../src/adapters/browser.js","../../src/adapters/node.js","../../src/adapters/ember.js","../../src/utils/string.js","../../src/resolver.js","../../src/store.js","../../src/fleetbase.js"],"sourcesContent":["const { isArray } = Array;\n\nexport {\n isArray\n};\n","import { isArray } from './array';\n\n/**\n * Collection\n * Extended array inspired by Ember's NativeArray\n **/\n\nconst CHUNK_SIZE = 60000;\n\n// To avoid overflowing the stack, we splice up to CHUNK_SIZE items at a time.\n// See https://code.google.com/p/chromium/issues/detail?id=56588 for more details.\nconst replace = (array, start, deleteCount, items = []) => {\n if (isArray(array)) {\n if (items.length <= CHUNK_SIZE) {\n array.splice(start, deleteCount, ...items);\n } else {\n array.splice(start, deleteCount);\n\n for (let i = 0; i < items.length; i += CHUNK_SIZE) {\n let chunk = items.slice(i, i + CHUNK_SIZE);\n array.splice(start + i, 0, ...chunk);\n }\n }\n } else if (isCollection(arr)) {\n array.replace(start, deleteCount, items);\n }\n};\n\nconst identityFunction = (item) => item;\n\nconst uniqBy = (array, key = identityFunction) => {\n let ret = [];\n let seen = new Set();\n let getter = typeof key === 'function' ? key : (item) => get(item, key);\n\n array.forEach((item) => {\n let val = getter(item);\n if (!seen.has(val)) {\n seen.add(val);\n ret.push(item);\n }\n });\n\n return ret;\n};\n\nconst isCollection = (mixed) => mixed instanceof Collection;\n\nconst objectAt = (array, index) => {\n if (isArray(array)) {\n return array[index];\n } else if (isCollection(array)) {\n return array.objectAt(index);\n }\n\n return null;\n};\n\nconst iter = (key, value) => {\n let valueProvided = arguments.length === 2;\n return valueProvided ? (item) => value === item[key] : (item) => Boolean(item[key]);\n};\n\nconst findIndex = (array, predicate, startAt = 0) => {\n let len = array.length;\n for (let index = startAt; index < len; index++) {\n let item = objectAt(array, index);\n if (predicate(item, index, array)) {\n return index;\n }\n }\n return -1;\n};\n\nconst find = (array, callback, target) => {\n let predicate = callback.bind(target);\n let index = findIndex(array, predicate, 0);\n return index === -1 ? undefined : objectAt(array, index);\n};\n\nconst any = (array, callback, target) => {\n let predicate = callback.bind(target);\n return findIndex(array, predicate, 0) !== -1;\n};\n\nconst every = (array, callback, target) => {\n let cb = callback.bind(target);\n let predicate = (item, index, array) => !cb(item, index, array);\n return findIndex(array, predicate, 0) === -1;\n};\n\nconst indexOf = (array, val, startAt = 0, withNaNCheck) => {\n let len = array.length;\n\n if (startAt < 0) {\n startAt += len;\n }\n\n // SameValueZero comparison (NaN !== NaN)\n let predicate = withNaNCheck && val !== val ? (item) => item !== item : (item) => item === val;\n return findIndex(array, predicate, startAt);\n};\n\nconst removeAt = (array, index, len = 1) => {\n replace(array, index, len, []);\n return array;\n};\n\nconst insertAt = (array, index, item) => {\n replace(array, index, 0, [item]);\n return item;\n};\n\nclass Collection extends Array {\n constructor(...items) {\n if (isArray(arguments[0])) {\n super(...arguments[0]);\n } else {\n super(...arguments);\n }\n }\n\n get notEmpty() {\n return this.length > 0;\n }\n\n get empty() {\n return this.length === 0;\n }\n\n get first() {\n return objectAt(this, 0);\n }\n\n get last() {\n return objectAt(this, this.length - 1);\n }\n\n replace(start, deleteCount, items = []) {\n replace(this, start, deleteCount, items);\n\n return this;\n }\n\n objectsAt(indexes) {\n return indexes.map((idx) => objectAt(this, idx));\n }\n\n objectAt(index) {\n return objectAt(this, index);\n }\n\n indexOf(object, startAt) {\n return indexOf(this, object, startAt, false);\n }\n\n lastIndexOf(object, startAt) {\n let len = this.length;\n\n if (startAt === undefined || startAt >= len) {\n startAt = len - 1;\n }\n\n if (startAt < 0) {\n startAt += len;\n }\n\n for (let idx = startAt; idx >= 0; idx--) {\n if (objectAt(this, idx) === object) {\n return idx;\n }\n }\n\n return -1;\n }\n\n includes(object, startAt) {\n return indexOf(this, object, startAt, true) !== -1;\n }\n\n findBy() {\n return find(this, iter(...arguments));\n }\n\n findIndexBy() {\n return findIndex(this, iter(...arguments));\n }\n\n isEvery() {\n return every(this, iter(...arguments));\n }\n\n isAny() {\n return any(this, iter(...arguments));\n }\n\n invoke(methodName, ...args) {\n let ret = [];\n\n this.forEach((item) => ret.push(item[methodName]?.(...args)));\n\n return ret;\n }\n\n toArray() {\n return this.map((item) => item);\n }\n\n compact() {\n return this.filter((value) => value != null);\n }\n\n sortBy() {\n let sortKeys = arguments;\n\n return this.sort((a, b) => {\n for (let i = 0; i < sortKeys.length; i++) {\n let key = sortKeys[i];\n let propA = a[key];\n let propB = b[key];\n // return 1 or -1 else continue to the next sortKey\n let compareValue = compare(propA, propB);\n\n if (compareValue) {\n return compareValue;\n }\n }\n return 0;\n });\n }\n\n uniqBy(key) {\n return uniqBy(this, key);\n }\n\n without(value) {\n if (!this.includes(value)) {\n return this; // nothing to do\n }\n\n // SameValueZero comparison (NaN !== NaN)\n let predicate = value === value ? (item) => item !== value : (item) => item === item;\n return this.filter(predicate);\n }\n\n clear() {\n let len = this.length;\n if (len === 0) {\n return this;\n }\n\n this.replace(0, len, []);\n return this;\n }\n\n insertAt(idx, object) {\n insertAt(this, idx, object);\n return this;\n }\n\n replaceAt(idx, object) {\n return this.replace(idx, 1, [object]);\n }\n\n removeAt(start, len) {\n return removeAt(this, start, len);\n }\n\n pushObject(obj) {\n return this.insertAt(this.length, obj);\n }\n\n pushObjects(objects) {\n this.replace(this.length, 0, objects);\n return this;\n }\n\n popObject() {\n let len = this.length;\n if (len === 0) {\n return null;\n }\n\n let ret = objectAt(this, len - 1);\n this.removeAt(len - 1, 1);\n return ret;\n }\n\n shiftObject() {\n if (this.length === 0) {\n return null;\n }\n\n let ret = objectAt(this, 0);\n this.removeAt(0);\n return ret;\n }\n\n unshiftObject(obj) {\n return insertAt(this, 0, obj);\n }\n\n unshiftObjects(objects) {\n this.replace(0, 0, objects);\n return this;\n }\n\n reverseObjects() {\n let len = this.length;\n if (len === 0) {\n return this;\n }\n\n let objects = this.toArray().reverse();\n this.replace(0, len, objects);\n return this;\n }\n\n setObjects(objects) {\n if (objects.length === 0) {\n return this.clear();\n }\n\n let len = this.length;\n this.replace(0, len, objects);\n return this;\n }\n\n removeObject(obj) {\n let loc = this.length || 0;\n while (--loc >= 0) {\n let curObject = objectAt(this, loc);\n\n if (curObject === obj) {\n this.removeAt(loc);\n }\n }\n return this;\n }\n\n removeObjects(objects) {\n for (let i = objects.length - 1; i >= 0; i--) {\n this.removeObject(objects[i]);\n }\n\n return this;\n }\n\n addObject(obj) {\n let included = this.includes(obj);\n\n if (!included) {\n this.pushObject(obj);\n }\n\n return this;\n }\n\n addObjects(objects) {\n objects.forEach((obj) => this.addObject(obj));\n return this;\n }\n}\n\nexport default Collection;\n\nexport { replace, uniqBy, isCollection, objectAt, iter, findIndex, find, any, every, indexOf, removeAt, insertAt };\n","const isEmpty = (obj) => {\n const none = obj === null || obj === undefined;\n if (none) {\n return none;\n }\n\n if (typeof obj.size === 'number') {\n return !obj.size;\n }\n\n const objectType = typeof obj;\n\n if (objectType === 'object') {\n const { size } = obj;\n if (typeof size === 'number') {\n return !size;\n }\n }\n\n if (typeof obj.length === 'number' && objectType !== 'function') {\n return !obj.length;\n }\n\n if (objectType === 'object') {\n const { length } = obj;\n if (typeof length === 'number') {\n return !length;\n }\n }\n\n return false;\n};\n\nexport default isEmpty;\n","import isEmpty from './is-empty';\n\nconst isBlank = (obj) => isEmpty(obj) || (typeof obj === 'string' && /\\S/.test(obj) === false);\n\nexport default isBlank;\n","export default function isLatitude(coordinate) {\n return isFinite(coordinate) && Math.abs(coordinate) <= 90;\n}\n","export default function isLongitude(coordinate) {\n return isFinite(coordinate) && Math.abs(coordinate) <= 180 && Math.abs(coordinate) >= 90;\n}\n","import Resource from '../resource';\n\nexport default function isResource(record) {\n return record instanceof Resource;\n}\n","const isPhone = (phone = '') => {\n return /^[+]?[\\s./0-9]*[(]?[0-9]{1,4}[)]?[-\\s./0-9]*$/g.test(phone);\n}\n\nexport default isPhone;","/**\n * Determines if environment SDK is initialized in is Node, additionally checks pass if environment is ReactNative.\n * \n * @returns boolean\n */\nconst isNodeEnvironment = () => {\n return (typeof process !== 'undefined') && (typeof process?.env === 'object' || process.release?.name?.search(/node|io.js/) !== -1) && (typeof window === 'undefined' || window?.navigator?.product === 'ReactNative');\n};\n\nexport default isNodeEnvironment;","import { lookup } from '../resolver';\nimport isNodeEnvironment from './is-node-environment';\n\nconst detectAdapter = (options = {}) => {\n if (isNodeEnvironment()) {\n return lookup('adapter', 'NodeAdapter', options);\n }\n\n return lookup('adapter', 'BrowserAdapter', options);\n}\n\nexport default detectAdapter;","const { isArray } = Array;\n\nclass GoogleAddress {\n constructor(place) {\n this.place = place;\n this.geometry = place?.geometry;\n this.components = this.parseComponents();\n this.attributes = this.parseProperties();\n }\n\n parse() {\n this.parseComponents();\n this.parseProperties();\n }\n\n parseComponents() {\n const components = (this.place?.address_components || []).reduce(function (acc, data) {\n data.types.forEach(function (type) {\n acc[type] = data;\n });\n return acc;\n }, {});\n\n return components;\n }\n\n parseProperties() {\n const attributes = {\n streetNumber: this.get('street_number'),\n streetName: this.get('route'),\n coordinates: this.geometry?.location ? Object.values(this.geometry.location) : [0, 0],\n city: this.or(['locality', 'sublocality', 'sublocality_level_1', 'neighborhood', 'administrative_area_level_3', 'administrative_area_level_2']),\n county: this.get('administrative_area_level_2'),\n stateShort: this.get('administrative_area_level_1', true),\n stateLong: this.get('administrative_area_level_1'),\n countryShort: this.get('country', true),\n country: this.get('country', true),\n countryLong: this.get('country'),\n postalCode: this.get('postal_code'),\n };\n\n attributes.address = [attributes.streetNumber, attributes.streetName].filter(Boolean).join(' ');\n\n return attributes;\n }\n\n all() {\n return this.attributes;\n }\n\n or(keys = []) {\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n\n if (isArray(key)) {\n const pkey = key[0];\n const short = key[1];\n\n if (this.has(pkey)) {\n return this.get(pkey, short);\n }\n\n continue;\n }\n\n if (this.has(key)) {\n return this.get(key);\n }\n }\n\n return null;\n }\n\n has(key) {\n return (key in this.components);\n }\n\n get(key, short = false) {\n if (!(key in this.components)) {\n return null;\n }\n\n return short ? this.components[key].short_name : this.components[key].long_name;\n }\n\n setAttributes(attributes = {}) {\n this.attributes = {...this.attributes, ...attributes};\n\n return this;\n }\n\n setAttribute(key, value) {\n this.attributes[key] = value;\n\n return this;\n }\n\n getAttribute(key) {\n return this.attributes[key] || null;\n }\n}\n\nexport default GoogleAddress;\n","export default class Point {\n constructor(latitude = 0, longitude = 0) {\n this.type = 'Point';\n this.coordinates = [longitude, latitude];\n }\n\n get latitude() {\n return this.coordinates[1];\n }\n\n get longitude() {\n return this.coordinates[0];\n }\n\n lat() {\n return this.latitude;\n }\n\n lng() {\n return this.longitude;\n }\n\n static fromGeoJson(json) {\n [ longitude, latitude ] = json.coordinates;\n\n return new Point(latitude, longitude);\n }\n\n serialize() {\n return {\n type: 'Point',\n coorindates: [this.lat(), this.lng()]\n };\n }\n\n toJson() {\n return this.serialize();\n }\n\n toString() {\n return `(${this.latitude}, ${this.longitude})`;\n }\n}","import isEmpty from './is-empty';\n\nconst isResource = (mixed) => typeof mixed === 'object' && !isEmpty(mixed?.attributes) && typeof mixed?.attributes === 'object';\n\nconst isCallable = (object, property) => typeof object[property] === 'function';\n\nconst getResolved = (func, path) => {\n const resolved = func();\n return Array.isArray(resolved) || typeof resolved === 'object' ? get(resolved, path) : null;\n};\n\nconst invoke = (object, method) => {\n if (typeof object[method] === 'function') {\n return object[method].bind(object);\n }\n};\n\nconst get = (object, path) => {\n let current = object;\n\n const type = typeof object;\n const isObject = type === 'object';\n const isFunction = type === 'function';\n const isArray = Array.isArray(object);\n\n const pathType = typeof path;\n const pathIsString = pathType === 'string';\n const pathIsDotted = pathIsString && path.includes('.');\n const pathArray = pathIsDotted ? path.split('.') : [path];\n\n if (isArray || isObject) {\n for (let i = 0; i < pathArray.length; i++) {\n if (current && current[pathArray[i]] === undefined) {\n return null;\n } else if (current) {\n current = current[pathArray[i]];\n\n // if is resource then return get on it's attributes\n if (isResource(current) && pathArray[i + 1] !== undefined) {\n const newPath = pathArray.slice(i + 1).join('.');\n\n return get(current.attributes, newPath);\n }\n\n // resolve functions and continue\n if (typeof current === 'function') {\n const newPath = pathArray.slice(i + 1).join('.');\n return getResolved(current, newPath);\n }\n }\n }\n return current;\n }\n\n if (isFunction) {\n return getResolved(object, path);\n }\n};\n\nconst getProperties = (object, properties = []) => {\n const selected = {};\n let propertyNames = arguments;\n let i = 1;\n\n if (arguments.length === 2 && Array.isArray(properties)) {\n i = 0;\n propertyNames = arguments[1];\n }\n\n for (; i < propertyNames.length; i++) {\n selected[propertyNames[i]] = get(object, propertyNames[i]);\n }\n\n return selected;\n};\n\nconst set = (object, path, value) => {\n let current = object;\n const type = typeof object;\n const isObject = type === 'object';\n const isFunction = type === 'function';\n const isArray = Array.isArray(object);\n\n // if is function\n if (isFunction) {\n // throw error should be object or array or object like\n }\n\n const pathType = typeof path;\n const pathIsString = pathType === 'string';\n const pathIsDotted = pathIsString && path.includes('.');\n const pathArray = pathIsDotted ? path.split('.') : [path];\n const iterations = pathArray.length;\n\n if (isArray || isObject) {\n for (let i = 0; i < iterations - 1; i++) {\n if (!current[pathArray[i]]) {\n current[pathArray[i]] = {};\n }\n current = current[pathArray[i]];\n }\n\n current[pathArray[iterations - 1]] = value;\n }\n\n return value;\n};\n\nconst setProperties = (object, properties = {}) => {\n for (const property in properties) {\n set(object, property, properties[property]);\n }\n\n return object;\n};\n\nconst extend = (target, classes = []) => {\n if (arguments.length > 1) {\n classes = arguments;\n }\n for (let index = 0; index < classes.length; index++) {\n for (const property in classes[index]) {\n if (Object.prototype.hasOwnProperty.call(classes[index], property)) {\n target[property] = classes[index][property];\n }\n }\n }\n return target;\n};\n\nexport { set, get, getProperties, setProperties, extend, isCallable, invoke };\n","import { set } from './object';\n\nexport default class StoreActions {\n constructor(actions = {}, bind = null) {\n this.actions = actions;\n this.bind = bind;\n }\n\n extend(bindTo = null) {\n const binding = bindTo || this.bind;\n\n if (!binding) {\n return this;\n }\n\n if (this?.actions && typeof this.actions === 'object') {\n for (let action in this.actions) {\n const fn = this.actions[action];\n\n if (typeof fn !== 'function') {\n set(binding, action, fn);\n continue;\n }\n\n set(binding, action, fn.bind(binding));\n }\n }\n\n return this;\n }\n}\n","import Store from './store';\nimport { isEmpty } from './utils';\nimport { isArray } from './utils/array';\nimport { set, get } from './utils/object';\n\nclass Resource {\n /**\n\t * The base resource for all resources\n\n\t * @return {[type]} [description]\n\t */\n constructor(attributes = {}, adapter, resource, options = {}) {\n this.attributes = attributes;\n this.dirtyAttributes = {};\n this.changes = {};\n this.isLoading = false;\n this.isSaving = false;\n this.isDestroying = false;\n this.isReloading = false;\n this.resource = resource;\n this.options = options;\n this.version = options.version || 'v1';\n this.setAdapter(adapter);\n }\n\n /**\n * Set a new adapter to the resource instance, this will update the Store instance\n *\n * @param {Adapter} adapter\n * @return {Resource} this\n */\n setAdapter(adapter) {\n this.adapter = adapter;\n this.store = new Store(this.resource, adapter, {\n onAfterFetch: this.syncAttributes.bind(this),\n actions: this.options?.actions\n });\n\n return this;\n }\n\n /**\n * Getter for id attribute\n *\n * @var {String}\n */\n get id() {\n return this.getAttribute('id');\n }\n\n /**\n * Creates a new resource on the server\n *\n * @param {Object} payload [description]\n * @return {[type]} [description]\n */\n create(attributes = {}) {\n const data = this.mergeAttributes(attributes);\n this.setFlags(['isLoading', 'isSaving']);\n\n return this.store.create(data).then((response) => {\n this.setFlags(['isLoading', 'isSaving'], false);\n\n return response;\n });\n }\n\n /**\n * Creates a new resource on the server\n *\n * @param {Object} payload [description]\n * @return {[type]} [description]\n */\n update(attributes = {}) {\n this.setFlags(['isLoading', 'isSaving']);\n\n return this.store.update(this.attributes.id, attributes).then((response) => {\n this.setFlags(['isLoading', 'isSaving'], false);\n\n return response;\n });\n }\n\n /**\n * Deletes the resource instance on the server\n *\n * @return {[type]} [description]\n */\n destroy() {\n this.setFlags(['isLoading', 'isDestroying']);\n\n return this.store.destroy(this.attributes.id).then((response) => {\n this.setFlags(['isLoading', 'isDestroying'], false);\n\n return response;\n });\n }\n\n /**\n * Reloads the resource from the server.\n *\n * @return {[type]} [description]\n */\n reload() {\n this.setFlags(['isLoading', 'isReloading']);\n\n return this.store.findRecord(this.attributes.id).then((response) => {\n this.reset();\n\n return response;\n });\n }\n\n /**\n * Sets flag properties.\n *\n * @return this\n */\n setFlags(flags = [], state = true) {\n const validFlags = ['isLoading', 'isSaving', 'isReloading', 'isDestroying'];\n\n for(let i = 0; i < flags.length; i++) {\n const flag = flags[i];\n\n if (typeof flag !== 'string' || !validFlags.includes(flag)) {\n throw new Error(`${flag} is not a valid flag!`);\n }\n\n this[flag] = state;\n }\n\n return this;\n }\n\n /**\n * Resets tracked properties\n *\n * @return this\n */\n reset() {\n this.dirtyAttributes = {};\n this.changes = {};\n this.isLoading = false;\n this.isSaving = false;\n this.isReloading = false;\n\n return this;\n }\n\n /**\n * Emptys resource.\n *\n * @return this\n */\n empty() {\n this.reset();\n this.attribues = {};\n\n return this;\n }\n\n /**\n * Saves the resource instance on the server\n *\n * @return {[type]} [description]\n */\n save(options = {}) {\n const attributes = this.getAttributes();\n\n if (isEmpty(this.id)) {\n return this.create(attributes);\n }\n\n if (options.onlyDirty === true) {\n return this.savedirty();\n }\n\n return this.update(attributes);\n }\n\n /**\n * Saves only dirtied attributes.\n *\n * @return {[type]} [description]\n */\n saveDirty() {\n const dirtyAttributeKeys = Object.keys(this.dirtyAttributes);\n const dirtyAttributes = {};\n\n for (let i = 0; i < dirtyAttributeKeys.length; i++) {\n const key = dirtyAttributeKeys[i];\n dirtyAttributes[key] = this.getAttribute(key);\n }\n\n return this.update(dirtyAttributes);\n }\n\n /**\n * Returns the resource meta if exists.\n *\n * @return {Object}\n */\n get meta() {\n return this.getAttribute('meta', {});\n }\n\n /**\n * Returns the date instance resource was created.\n *\n * @return {Date}\n */\n get createdAt() {\n return this.isAttributeFilled('created_at') ? new Date(this.getAttribute('created_at')) : null;\n }\n\n /**\n * Returns the date instance resource was created.\n *\n * @return {Date}\n */\n get updatedAt() {\n return this.isAttributeFilled('updated_at') ? new Date(this.getAttribute('updated_at')) : null;\n }\n\n /**\n * Checks if resource is loaded from the server.\n *\n * @return {Boolean}\n */\n get isLoaded() {\n return this.hasAttributes(['created_at', 'id']);\n }\n\n /**\n * Checks if resource ihas no attributes\n *\n * @return {Boolean}\n */\n get isEmpty() {\n return Object.values(this?.attributes).length === 0;\n }\n\n /**\n * Checks if resource is not saved to server.\n *\n * @return {Boolean}\n */\n get isNew() {\n return !this.id;\n }\n\n /**\n * Checks if resource is not saved to server.\n *\n * @return {Boolean}\n */\n get isSaved() {\n return !this.isNew && this.isLoaded;\n }\n\n /**\n * Checks if resource is deleted on server.\n *\n * @return {Boolean}\n */\n get isDeleted() {\n return this.hasAttributes(['deleted', 'time']);\n }\n\n /**\n * Iterates over each attribute value and property executing a user supplied callback.\n *\n * @return {Object}\n */\n eachAttribute(callback) {\n if (typeof callback !== 'function') {\n return this;\n }\n\n Object.keys(this?.attributes ?? {}).forEach((property) => {\n const value = this.getAttribute(property);\n callback.call(this, value, property);\n });\n\n return this;\n }\n\n /**\n * Gets all changes\n *\n * @return {Object}\n */\n changes() {\n return this.changes;\n }\n\n /**\n * Gets all dirty attributes.\n *\n * @return {Object}\n */\n getDirtyAttributes() {\n return this.dirtyAttributes;\n }\n\n /**\n * Checks if property is dirty.\n *\n * @param {String} property [description]\n * @return {Boolean}\n */\n isDirty(property) {\n return property in this.dirtyAttributes;\n }\n\n /**\n * Checks if any properties is dirty.\n *\n * @return {Boolean}\n */\n hasDirtyAttributes() {\n return Object.keys(this?.dirtyAttributes ?? {}).length > 0;\n }\n\n /**\n * Updates a instance property without tracking changes or dirtying attribute.\n *\n * @param {String} property [description]\n * @param {mixed} value [description]\n */\n mutate(property, value) {\n this.attributes[property] = value;\n }\n\n /**\n * Set an instance property locally\n *\n * @param {String} property [description]\n * @param {mixed} value [description]\n */\n setAttribute(property, value = null) {\n if (value === null && typeof property === 'object') {\n return this.setAttributes(property);\n }\n\n const previousValue = this?.attributes[property] ?? null;\n\n // use object setter\n set(this.attributes, property, value);\n set(this.dirtyAttributes, property, previousValue);\n \n // this.attributes[property] = value;\n // this.dirtyAttributes[property] = previousValue;\n\n // track changes\n if (!isArray(this?.changes[property])) {\n this.changes[property] = [];\n }\n\n this.changes[property].push({\n property,\n previousValue,\n value,\n changedAt: new Date(),\n });\n\n return this;\n }\n\n /**\n * Set multiple instance properties locally\n *\n * @param {Object} properties [description]\n */\n setAttributes(attributes = {}) {\n for (let property in attributes) {\n this.setAttribute(property, attributes[property]);\n }\n\n return this;\n }\n\n /**\n * Get an attribute\n *\n * @param {String} attribute The attribute key to get\n * @param {mixed} defaultValue The default value if no attribute value\n */\n getAttribute(attribute, defaultValue = null) {\n const value = get(this?.attributes ?? {}, attribute);\n\n if (value === undefined) {\n return defaultValue;\n }\n\n return value;\n }\n\n /**\n * Checks if attribute exists.\n *\n * @param {String} property [description]\n * @return {Boolean}\n */\n hasAttribute(property) {\n if (isArray(property)) {\n const properties = property;\n const attributeKeys = Object.keys(this.attributes ?? {});\n \n return properties.every((prop) => attributeKeys.includes(prop));\n }\n\n if (!this?.attributes) {\n return false;\n }\n\n return property in this.attributes;\n }\n\n /**\n * Alias for checking if has multiple attributes.\n *\n * @param {Array} properties \n * @return {Boolean}\n */\n hasAttributes(properties = []) {\n return this.hasAttribute(properties);\n }\n\n /**\n * Returns true if attribute has value.\n *\n * @param {Array} properties \n * @return {Boolean}\n */\n isAttributeFilled(property) {\n if (isArray(property)) {\n return this.hasAttribute(property) && property.every((prop) => !isEmpty(this.getAttribute(prop)));\n }\n\n return this.hasAttribute(property) && !isEmpty(this.getAttribute(property));\n }\n\n /**\n * Get multiple attributes.\n *\n * @param {Array} properties [description]\n * @param {[type]} value [description]\n */\n getAttributes(properties) {\n const attributes = {};\n\n if (properties === null || properties === undefined) {\n return this.getAttributes(Object.keys(this.attributes));\n }\n\n if (typeof properties === 'string') {\n return this.getAttribute([...arguments]);\n }\n\n if (!isArray(properties)) {\n throw new Error('No attribute properties provided!');\n }\n\n for (let i = 0; i < properties.length; i++) {\n const property = properties[i];\n\n if (typeof property !== 'string') {\n continue;\n }\n\n let value = this.getAttribute(property);\n\n if (typeof value?.attributes === 'object' && !isArray(value?.attributes)) {\n value = value.attributes;\n }\n\n attributes[property] = value;\n }\n\n return attributes;\n }\n\n /**\n * Serialize resource to a POJO\n *\n * @returns {Object}\n */\n serialize() {\n return this.getAttributes();\n }\n\n /**\n * Merge and return attributes on the resource instance.\n *\n * @param {[type]} property [description]\n * @param {[type]} value [description]\n */\n mergeAttributes(attributes = {}) {\n const modelAttributes = this?.attributes ?? {};\n this.attributes = { ...modelAttributes, ...attributes };\n\n return this.attributes;\n }\n\n /**\n * Merge and return attributes on the resource instance.\n *\n * @param {[type]} property [description]\n * @param {[type]} value [description]\n */\n syncAttributes(json = {}) {\n this.attributes = json;\n }\n}\n\nexport default Resource;\n","import Resource from '../resource';\nimport { StoreActions, isResource } from '../utils';\nimport { isValid as isValidDate } from 'date-fns';\n\nconst orderActions = new StoreActions({\n getDistanceAndTime: function (id, params = {}, options = {}) {\n return this.adapter.get(`${this.namespace}/${id}/distance-and-time`, params, options);\n },\n\n getNextActivity: function (id, params = {}, options = {}) {\n return this.adapter.get(`${this.namespace}/${id}/next-activity`, params, options);\n },\n\n dispatch: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/dispatch`, params, options).then(this.afterFetch.bind(this));\n },\n\n start: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/start`, params, options).then(this.afterFetch.bind(this));\n },\n\n updateActivity: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/update-activity`, params, options).then(this.afterFetch.bind(this));\n },\n\n setDestination: function (id, destinationId, params = {}, options = {}) {\n if (isResource(destinationId)) {\n destinationId = destinationId.id;\n }\n\n return this.adapter.post(`${this.namespace}/${id}/set-destination/${destinationId}`, params, options).then(this.afterFetch.bind(this));\n },\n\n captureQrCode: function (id, subjectId = null, params = {}, options = {}) {\n if (isResource(subjectId)) {\n subjectId = subjectId.id;\n }\n\n return this.adapter.post(`${this.namespace}/${id}/capture-qr${!subjectId ? '' : '/' + subjectId}`, params, options);\n },\n\n captureSignature: function (id, subjectId = null, params = {}, options = {}) {\n if (isResource(subjectId)) {\n subjectId = subjectId.id;\n }\n\n return this.adapter.post(`${this.namespace}/${id}/capture-signature${!subjectId ? '' : '/' + subjectId}`, params, options);\n },\n\n complete: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/complete`, params, options).then(this.afterFetch.bind(this));\n },\n\n cancel: function (id, params = {}, options = {}) {\n return this.adapter.delete(`${this.namespace}/${id}/cancel`, params, options).then(this.afterFetch.bind(this));\n },\n});\n\nclass Order extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'order', { actions: orderActions, ...options });\n }\n\n getDistanceAndTime(params = {}, options = {}) {\n return this.store.getDistanceAndTime(this.id, params, options);\n }\n\n dispatch(params = {}, options = {}) {\n return this.store.dispatch(this.id, params, options);\n }\n\n start(params = {}, options = {}) {\n return this.store.start(this.id, params, options);\n }\n\n setDestination(destinationId, params = {}, options = {}) {\n return this.store.setDestination(this.id, destinationId, params, options);\n }\n\n captureQrCode(subjectId = null, params = {}, options = {}) {\n return this.store.captureQrCode(this.id, subjectId, params, options);\n }\n\n captureSignature(subjectId = null, params = {}, options = {}) {\n return this.store.captureSignature(this.id, subjectId, params, options);\n }\n\n getNextActivity(params = {}, options = {}) {\n return this.store.getNextActivity(this.id, params, options);\n }\n\n updateActivity(params = {}, options = {}) {\n return this.store.updateActivity(this.id, params, options);\n }\n\n cancel(params = {}, options = {}) {\n return this.store.cancel(this.id, params, options);\n }\n\n complete(params = {}, options = {}) {\n return this.store.complete(this.id, params, options);\n }\n\n get isDispatched() {\n return this.getAttribute('dispatched_at') !== null;\n }\n\n get isNotDispatched() {\n return this.getAttribute('dispatched_at') == null;\n }\n\n get isStarted() {\n return this.getAttribute('started_at') !== null;\n }\n\n get isNotStarted() {\n return this.getAttribute('started_at') == null;\n }\n\n get isCompleted() {\n return this.getAttribute('status') == 'completed';\n }\n\n get isCanceled() {\n return this.getAttribute('status') == 'canceled';\n }\n\n get isEnroute() {\n return this.getAttribute('status') == 'driver_enroute' || this.getAttribute('status') === 'enroute';\n }\n\n get isInProgress() {\n return this.isStarted && !this.isCanceled && !this.isCompleted;\n }\n\n get scheduledAt() {\n return this.isAttributeFilled('scheduled_at') ? new Date(this.getAttribute('scheduled_at')) : null;\n }\n\n get startedAt() {\n return this.isAttributeFilled('started_at') ? new Date(this.getAttribute('started_at')) : null;\n }\n\n get dispatchedAt() {\n return this.isAttributeFilled('dispatched_at') ? new Date(this.getAttribute('dispatched_at')) : null;\n }\n\n get status() {\n return this.getAttribute('status');\n }\n}\n\nexport default Order;\n\nexport { orderActions };\n","import Resource from '../resource';\nimport Collection from '../utils/collection';\n\nclass Payload extends Resource {\n\tconstructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'payload', options);\n }\n\t\n /**\n\t * Attaches an entity to an existing payload and returns\n\t * the payload with the entity attached\n\t *\n\t * @param {[type]} Entity entity [description]\n\t * @return {[type]} [description]\n\t */\n attach(entity) {\n // perform op return payload\n }\n\n /**\n\t * Returns all of the entities attached to this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get entities() {\n\n }\n\n /**\n\t * Returns the dropoff for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get dropoff() {\n\n }\n\n /**\n\t * Returns the pickup for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get pickup() {\n\n }\n\n /**\n\t * Returns all the waypoints for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get waypoints() {\n return new Collection(this.waypoints);\n }\n}\n\nexport default Payload;\n","import Resource from '../resource';\n\nclass Entity extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'entity', options);\n }\n}\n\nexport default Entity;\n","import Resource from '../resource';\nimport { isResource, Point } from '../utils';\n\nclass Place extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'place', options);\n }\n\n static fromGoogleAddress(googleAddress, adapter, options = {}) {\n const [ latitude, longitude ] = googleAddress.getAttribute('coordinates');\n const attributes = {\n name: null,\n address: googleAddress.getAttribute('address'),\n location: new Point(latitude, longitude),\n street1: googleAddress.getAttribute('streetName'),\n street2: null,\n city: googleAddress.getAttribute('city'),\n province: googleAddress.getAttribute('stateLong'),\n postal_code: googleAddress.getAttribute('postalCode'),\n neighborhood: googleAddress.get('neighborhood'),\n district: googleAddress.getAttribute('county'),\n building: googleAddress.get('building'),\n country: googleAddress.getAttribute('countryShort'),\n phone: null,\n security_access_code: null\n };\n\n return new Place(attributes, adapter, options);\n }\n\n /**\n * The latitude coordinate for the 'Place' location.\n * \n * @var {Integer}\n */\n get latitude() {\n return this.getAttribute('location', new Point())?.coordinates[1];\n }\n\n /**\n * The longitude coordinate for the 'Place' location.\n * \n * @var {Integer}\n */\n get longitude() {\n return this.getAttribute('location', new Point())?.coordinates[0];\n }\n\n /**\n * Array coordinate pair for Place location.\n * \n * @var {Array}\n */\n get coordinates() {\n const { latitude, longitude } = this;\n\n return [ latitude, longitude ];\n }\n\n /**\n * Set the owner of the place.\n * \n * @param {Object|String} owner\n * @return {Place}\n */\n setOwner(owner) {\n if (isResource(owner)) {\n this.setAttribute('owner', owner.id);\n }\n\n if (typeof owner === 'string') {\n this.setAttribute('owner', owner);\n }\n\n return this;\n }\n}\n\nexport default Place;\n","import Place from './place';\n\nclass Waypoint extends Place {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'waypoint', options);\n }\n}\n\nexport default Waypoint;\n","import Resource from '../resource';\n\nclass TrackingStatus extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'tracking-status', options);\n }\n}\n\nexport default TrackingStatus;\n","import Resource from '../resource';\n\nclass Vehicle extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'vehicle', options);\n }\n}\n\nexport default Vehicle;\n","import Resource from '../resource';\nimport { StoreActions, isPhone, isEmail } from '../utils';\n\nconst driverActions = new StoreActions({\n // const { error } = await fleetbase.drivers.login('+1 111-1111');\n login: function (identity, password = null, attributes = {}) {\n // handle phone number authentication\n if (isPhone(identity)) {\n return this.adapter.post('drivers/login-with-sms', { phone: identity });\n }\n\n if (!password) {\n throw new Error('Login requires password!');\n }\n\n return this.adapter.post('drivers/login', { identity, password, ...attributes }).then(this.afterFetch.bind(this));\n },\n\n verifyCode: function (identity, code, attributes = {}) {\n return this.adapter.post('drivers/verify-code', { identity, code, ...attributes }).then(this.afterFetch.bind(this));\n },\n\n track: function (id, params = {}, options = {}) {\n return this.adapter.post(`drivers/${id}/track`, params, options).then(this.afterFetch.bind(this));\n },\n\n retrieve: function (id) {\n return this.findRecord(id);\n },\n\n syncDevice(token) {\n return this.adapter.setHeaders({ 'Driver-Token': this.token }).post('drivers/register-device', token);\n },\n});\n\nclass Driver extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'driver', { actions: driverActions, ...options });\n }\n\n /**\n * The latitude coordinate for the 'Place' location.\n *\n * @var {Integer}\n */\n get latitude() {\n return this.getAttribute('location', new Point())?.coordinates[1];\n }\n\n /**\n * The longitude coordinate for the 'Place' location.\n *\n * @var {Integer}\n */\n get longitude() {\n return this.getAttribute('location', new Point())?.coordinates[0];\n }\n\n /**\n * Array coordinate pair for Place location.\n *\n * @var {Array}\n */\n get coordinates() {\n const { latitude, longitude } = this;\n\n return [latitude, longitude];\n }\n\n get token() {\n return this.getAttribute('token');\n }\n\n get isOnline() {\n return this.getAttribute('online') === true;\n }\n\n track(params = {}, options = {}) {\n return this.store.track(this.id, params, options);\n }\n\n syncDevice(token) {\n return this.store.syncDevice(token);\n }\n}\n\nexport default Driver;\nexport { driverActions };\n","import Resource from '../resource';\n\nclass Vendor extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'vendor', options);\n }\n}\n\nexport default Vendor;\n","import Resource from '../resource';\n\nclass Contact extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'contact', options);\n }\n}\n\nexport default Contact;\n","import Resource from '../resource';\n\nclass Zone extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'zone', options);\n }\n}\n\nexport default Zone;\n","import Resource from '../resource';\n\nclass ServiceArea extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-area', options);\n }\n}\n\nexport default ServiceArea;\n","import Resource from '../resource';\n\nclass ServiceRate extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-rate', options);\n }\n}\n\nexport default ServiceRate;\n","import Resource from '../resource';\n\nclass ServiceQuote extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-quote', options);\n }\n\n fromPreliminary() {\n\n }\n\n fromPayload() {\n \n }\n}\n\nexport default ServiceQuote;\n","class Adapter {\n /**\n\t * Creates a configured base adapter for Fleetbase.\n\t *\n\t * @param {Object} config Configuration options for adapter\n\t */\n constructor(config = {}) {\n this.version = config.version || 'v1';\n this.host = config.host || null;\n this.namespace = config.namespace || null;\n this.headers = config.headers || {};\n }\n}\n\nexport default Adapter;\n","import Adapter from '../adapter';\nimport { isBlank } from '../utils';\n\nclass BrowserAdapter extends Adapter {\n /**\n * Setup browser adapter.\n * @param {Object} config\n */\n constructor(config) {\n super(config);\n\n this.setHeaders({\n Authorization: `Bearer ${config.publicKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': '@fleetbase/sdk;browser'\n });\n }\n\n /**\n * Updates the adapter headers.\n *\n * @param {Object} headers\n */\n setHeaders(headers = {}) {\n this.headers = { ...this.headers, ...headers };\n\n return this;\n }\n\n /**\n * Parses the JSON returned by a network request\n *\n * @param {Object} response A response from a network request\n * @return {Object} The parsed JSON, status from the response\n *\n * @return {Promise}\n */\n parseJSON(response) {\n return new Promise((resolve, reject) => response\n .json()\n .then((json) => resolve({\n statusText: response.statusText,\n status: response.status,\n ok: response.ok,\n json,\n }))\n .catch(() => {\n reject(new Error('Oops! Something went wrong when handling your request.'));\n }));\n }\n\n /**\n * The base request method\n *\n * @param {String} path\n * @param {String} method\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n request(path, method = 'GET', data = {}, options = {}) {\n return new Promise((resolve, reject) => fetch(options.url || `${this.host}/${this.namespace}/${path}`, {\n method,\n mode: options.mode || 'cors',\n headers: new Headers({\n ...(this.headers || {}),\n ...(options.headers || {}),\n }),\n ...data,\n })\n .then(this.parseJSON)\n .then((response) => {\n if (response.ok) {\n return resolve(response.json);\n }\n\n return reject(new Error(response.json.errors ? response.json.errors[0] : response.statusText));\n })\n .catch((error) => {\n reject(error);\n }));\n }\n\n /**\n * Makes a GET request with fetch\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n get(path, query = {}, options = {}) {\n const urlParams = !isBlank(query) ? new URLSearchParams(query).toString() : '';\n\n return this.request(`${path}${urlParams ? `?${urlParams}` : ''}`, 'GET', {}, options);\n }\n\n /**\n * Makes a POST request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n post(path, data = {}, options = {}) {\n return this.request(path, 'POST', { body: JSON.stringify(data) }, options);\n }\n\n /**\n * Makes a PUT request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n put(path, data = {}, options = {}) {\n return this.request(path, 'PUT', { body: JSON.stringify(data) }, options);\n }\n\n /**\n * Makes a DELETE request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n delete(path, options = {}) {\n return this.request(path, 'DELETE', {}, options);\n }\n\n /**\n * Makes a PATCH request with fetch\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n patch(path, data = {}, options = {}) {\n return this.request(path, 'PATCH', { body: JSON.stringify(data) }, options);\n }\n}\n\nexport default BrowserAdapter;\n","import Adapter from '../adapter';\nimport { isBlank } from '../utils';\nimport { isArray } from '../utils/array';\nimport axios from 'axios';\n\nclass NodeAdapter extends Adapter {\n constructor(config) {\n super(config);\n\n this.axios = axios.create({\n baseURL: `${this.host}/${this.namespace}`,\n headers: {\n Authorization: `Bearer ${config.publicKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': '@fleetbase/sdk;node',\n },\n });\n }\n\n /**\n * Updates the adapter headers.\n *\n * @param {Object} headers\n */\n setHeaders(headers = {}) {\n const commonHeaders = this.axios.defaults.headers.common;\n this.axios.defaults.headers.common = { ...commonHeaders, ...headers };\n\n return this;\n }\n\n /**\n * Tranform the response, and return the response data from axios.\n *\n * @param {AxiosResponse} response\n * @returns {Object}\n */\n transform(response) {\n return response.data;\n }\n\n /**\n * Handles an erroneous request.\n *\n * @param {AxiosResponse} response\n * @returns {Object}\n */\n handleError(error) {\n if (error.response) {\n const { data } = error.response;\n\n if (isArray(data.errors)) {\n throw new Error(data.errors[0]);\n }\n\n if (data.error) {\n throw new Error(data.error);\n }\n }\n\n throw error;\n }\n\n /**\n * Makes a GET request with axios\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n get(path, query = {}, options = {}) {\n const urlParams = !isBlank(query) ? new URLSearchParams(query).toString() : '';\n\n return this.axios\n .get(`${path}${urlParams ? `?${urlParams}` : ''}`, options)\n .then(this.transform.bind(this))\n .catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a POST request with axios\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n post(path, data = {}, options = {}) {\n return this.axios.post(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a PUT request with axios\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n put(path, data = {}, options = {}) {\n return this.axios.put(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a DELETE request with axios\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n delete(path, options = {}) {\n return this.axios.delete(path, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a PATCH request with axios\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n patch(path, data = {}, options = {}) {\n return this.axios.patch(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n}\n\nexport default NodeAdapter;\n","import Adapter from '../adapter';\n\nclass EmberJsAdapter extends Adapter {}\n\nexport default EmberJsAdapter;\n","'use strict';\n\n/**\n * Javascript String\n *\n * instance\n * new String('hello_world').humanize().get() => \"Hello world\"\n *\n * instance\n * const string = new String();\n * string.humanize('hello_world').get() => \"Hello world\"\n * \n * no chain\n * new String('hello_world', false).humanize() => \"Hello world\"\n *\n * static\n * String.invoke('humanize', 'hello_world') => \"Hello world\"\n *\n * exports {}\n * humanize('hello_world') => \"Hello world\"\n */\n\nexport default class String {\n constructor(string, chain = true) {\n this.str = string;\n this.chain = chain;\n }\n\n uncountableWords = ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'moose', 'deer', 'news'];\n\n pluralRules = [\n [new RegExp('(m)an$', 'gi'), '$1en'],\n [new RegExp('(pe)rson$', 'gi'), '$1ople'],\n [new RegExp('(child)$', 'gi'), '$1ren'],\n [new RegExp('^(ox)$', 'gi'), '$1en'],\n [new RegExp('(ax|test)is$', 'gi'), '$1es'],\n [new RegExp('(octop|vir)us$', 'gi'), '$1i'],\n [new RegExp('(alias|status)$', 'gi'), '$1es'],\n [new RegExp('(bu)s$', 'gi'), '$1ses'],\n [new RegExp('(buffal|tomat|potat)o$', 'gi'), '$1oes'],\n [new RegExp('([ti])um$', 'gi'), '$1a'],\n [new RegExp('sis$', 'gi'), 'ses'],\n [new RegExp('(?:([^f])fe|([lr])f)$', 'gi'), '$1$2ves'],\n [new RegExp('(hive)$', 'gi'), '$1s'],\n [new RegExp('([^aeiouy]|qu)y$', 'gi'), '$1ies'],\n [new RegExp('(x|ch|ss|sh)$', 'gi'), '$1es'],\n [new RegExp('(matr|vert|ind)ix|ex$', 'gi'), '$1ices'],\n [new RegExp('([m|l])ouse$', 'gi'), '$1ice'],\n [new RegExp('(quiz)$', 'gi'), '$1zes'],\n [new RegExp('s$', 'gi'), 's'],\n [new RegExp('$', 'gi'), 's'],\n ];\n\n singularRules = [\n [new RegExp('(m)en$', 'gi'), '$1an'],\n [new RegExp('(pe)ople$', 'gi'), '$1rson'],\n [new RegExp('(child)ren$', 'gi'), '$1'],\n [new RegExp('([ti])a$', 'gi'), '$1um'],\n [new RegExp('((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$', 'gi'), '$1$2sis'],\n [new RegExp('(hive)s$', 'gi'), '$1'],\n [new RegExp('(tive)s$', 'gi'), '$1'],\n [new RegExp('(curve)s$', 'gi'), '$1'],\n [new RegExp('([lr])ves$', 'gi'), '$1f'],\n [new RegExp('([^fo])ves$', 'gi'), '$1fe'],\n [new RegExp('([^aeiouy]|qu)ies$', 'gi'), '$1y'],\n [new RegExp('(s)eries$', 'gi'), '$1eries'],\n [new RegExp('(m)ovies$', 'gi'), '$1ovie'],\n [new RegExp('(x|ch|ss|sh)es$', 'gi'), '$1'],\n [new RegExp('([m|l])ice$', 'gi'), '$1ouse'],\n [new RegExp('(bus)es$', 'gi'), '$1'],\n [new RegExp('(o)es$', 'gi'), '$1'],\n [new RegExp('(shoe)s$', 'gi'), '$1'],\n [new RegExp('(cris|ax|test)es$', 'gi'), '$1is'],\n [new RegExp('(octop|vir)i$', 'gi'), '$1us'],\n [new RegExp('(alias|status)es$', 'gi'), '$1'],\n [new RegExp('^(ox)en', 'gi'), '$1'],\n [new RegExp('(vert|ind)ices$', 'gi'), '$1ex'],\n [new RegExp('(matr)ices$', 'gi'), '$1ix'],\n [new RegExp('(quiz)zes$', 'gi'), '$1'],\n [new RegExp('s$', 'gi'), ''],\n ];\n\n nonTitlecasedWords = ['and', 'or', 'nor', 'a', 'an', 'the', 'so', 'but', 'to', 'of', 'at', 'by', 'from', 'into', 'on', 'onto', 'off', 'out', 'in', 'over', 'with', 'for'];\n\n idSuffix = new RegExp('(_ids|_id)$', 'g');\n underbar = new RegExp('_', 'g');\n spaceOrUnderbar = new RegExp('[ _]', 'g');\n uppercase = new RegExp('([A-Z])', 'g');\n underbarPrefix = new RegExp('^_');\n\n get() {\n return this.str;\n }\n\n applyRules(str, rules, skip, override) {\n if (override) {\n str = override;\n } else {\n var ignore = skip.indexOf(str.toLowerCase()) > -1;\n if (!ignore) {\n for (var x = 0; x < rules.length; x++) {\n if (str.match(rules[x][0])) {\n str = str.replace(rules[x][0], rules[x][1]);\n break;\n }\n }\n }\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.pluralize('person') -> 'people'\n String.pluralize('octopus') -> 'octopi'\n String.pluralize('Hat') -> 'Hats'\n String.pluralize('person', 'guys') -> 'guys' \n */\n pluralize(str, plural = null) {\n str = str || this.str;\n\n return this.applyRules(str, this.pluralRules, this.uncountableWords, plural);\n }\n\n /*\n String.singularize('person') -> 'person'\n String.singularize('octopi') -> 'octopus'\n String.singularize('hats') -> 'hat'\n String.singularize('guys', 'person') -> 'person'\n */\n singularize(str, singular) {\n str = str || this.str;\n\n return this.applyRules(str, this.singularRules, this.uncountableWords, singular);\n }\n\n /*\n String.camelize('message_properties') -> 'MessageProperties'\n String.camelize('message_properties', true) -> 'messageProperties'\n */\n camelize(str, lowFirstLetter) {\n str = str || this.str;\n\n let str_path = str.split('/');\n for (var i = 0; i < str_path.length; i++) {\n let str_arr = str_path[i].split('_');\n let initX = lowFirstLetter && i + 1 === str_path.length ? 1 : 0;\n\n for (let x = initX; x < str_arr.length; x++) {\n str_arr[x] = str_arr[x].charAt(0).toUpperCase() + str_arr[x].substring(1);\n }\n str_path[i] = str_arr.join('');\n }\n str = str_path.join('::');\n\n // fix\n if (lowFirstLetter === true) {\n let first = str.charAt(0).toLowerCase();\n let last = str.slice(1);\n str = first + last;\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.underscore('MessageProperties') -> 'message_properties'\n String.underscore('messageProperties') -> 'message_properties'\n */\n underscore(str) {\n str = str || this.str;\n\n var str_path = str.split('::');\n for (var i = 0; i < str_path.length; i++) {\n str_path[i] = str_path[i].replace(this.uppercase, '_$1');\n str_path[i] = str_path[i].replace(this.underbarPrefix, '');\n }\n str = str_path.join('/').toLowerCase();\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.humanize('message_properties') -> 'Message properties'\n String.humanize('message_properties') -> 'message properties'\n */\n humanize(str, lowFirstLetter) {\n str = str || this.str;\n\n var str = str.toLowerCase();\n str = str.replace(this.idSuffix, '');\n str = str.replace(this.underbar, ' ');\n if (!lowFirstLetter) {\n str = this.capitalize(str);\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.capitalize('message_properties') -> 'Message_properties'\n String.capitalize('message properties') -> 'Message properties'\n */\n capitalize(str) {\n str = str || this.str;\n\n str = str.toLowerCase();\n str = str.substring(0, 1).toUpperCase() + str.substring(1);\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.dasherize('message_properties') -> 'message-properties'\n String.dasherize('message properties') -> 'message-properties'\n */\n dasherize(str) {\n str = str || this.str;\n\n str = str.replace(this.spaceOrUnderbar, '-');\n str = str.toLowerCase();\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.normify('message_properties') -> 'Message Properties'\n String.normify('message properties') -> 'Message Properties'\n Inflactor.normify('Message_propertyId', true) -> 'Message Properties Id'\n */\n normify(str, allFirstUpper) {\n str = str || this.str;\n\n //var str = str.toLowerCase();\n if (allFirstUpper === true) {\n str = this.camelize(str);\n str = this.underscore(str);\n } else {\n str = str.toLowerCase();\n }\n\n str = str.replace(this.underbar, ' ');\n var str_arr = str.split(' ');\n for (var x = 0; x < str_arr.length; x++) {\n var d = str_arr[x].split('-');\n for (var i = 0; i < d.length; i++) {\n if (this.nonTitlecasedWords.indexOf(d[i].toLowerCase()) < 0) {\n d[i] = this.capitalize(d[i]);\n }\n }\n str_arr[x] = d.join('-');\n }\n str = str_arr.join(' ');\n str = str.substring(0, 1).toUpperCase() + str.substring(1);\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.demodulize('Message::Bus::Properties') -> 'Properties'\n */\n demodulize(str) {\n str = str || this.str;\n\n var str_arr = str.split('::');\n str = str_arr[str_arr.length - 1];\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.tableize('MessageBusProperty') -> 'message_bus_properties'\n */\n tableize(str) {\n str = str || this.str;\n\n str = this.pluralize(this.underscore(str));\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.classify('message_bus_properties') -> 'MessageBusProperty'\n */\n classify(str) {\n str = str || this.str;\n\n str = this.singularize(this.camelize(str));\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.foreignKey('MessageBusProperty') -> 'message_bus_property_id'\n String.foreignKey('MessageBusProperty', true) -> 'message_bus_propertyid'\n */\n foreignKey(str, dropIdUbar = false) {\n str = str || this.str;\n\n str = this.underscore(this.demodulize(str)) + (dropIdUbar ? '' : '_') + 'id';\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.ordinalize('the 1 pitch') -> 'the 1st pitch'\n */\n ordinalize(str) {\n str = str || this.str;\n\n var str_arr = str.split(' ');\n for (var x = 0; x < str_arr.length; x++) {\n var i = parseInt(str_arr[x]);\n if (i === NaN) {\n var ltd = str_arr[x].substring(str_arr[x].length - 2);\n var ld = str_arr[x].substring(str_arr[x].length - 1);\n var suf = 'th';\n if (ltd != '11' && ltd != '12' && ltd != '13') {\n if (ld === '1') {\n suf = 'st';\n } else if (ld === '2') {\n suf = 'nd';\n } else if (ld === '3') {\n suf = 'rd';\n }\n }\n str_arr[x] += suf;\n }\n }\n str = str_arr.join(' ');\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /**\n * @method invoke\n **/\n static invoke() {\n const argz = Object.values(arguments);\n const instance = new String(null, false);\n const method = arguments[0];\n argz.shift();\n\n if (typeof instance[method] === 'function') {\n return instance[method](...argz);\n }\n\n return null;\n }\n}\n\nconst pluralize = function() {\n const argz = ['pluralize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst singularize = function() {\n const argz = ['singularize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst humanize = function() {\n const argz = ['humanize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst underscore = function() {\n const argz = ['underscore', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst camelize = function() {\n const argz = ['camelize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst capitalize = function() {\n const argz = ['capitalize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst dasherize = function() {\n const argz = ['dasherize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst normify = function() {\n const argz = ['normify', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst demodulize = function() {\n const argz = ['demodulize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst tableize = function() {\n const argz = ['tableize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst classify = function() {\n const argz = ['classify', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst foreignKey = function() {\n const argz = ['foreignKey', ...arguments];\n\n return String.invoke(...argz);\n};\n\nexport {\n pluralize,\n singularize,\n humanize,\n underscore,\n camelize,\n capitalize,\n dasherize,\n normify,\n demodulize,\n tableize,\n classify,\n foreignKey\n}","import { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote } from './resources';\nimport { BrowserAdapter, NodeAdapter, EmberJsAdapter } from './adapters';\nimport { pluralize, singularize } from './utils/string';\n\nconst resources = {\n Contact,\n Driver,\n Entity,\n Order,\n Payload,\n Place,\n TrackingStatus,\n Vehicle,\n Vendor,\n Waypoint,\n Zone,\n ServiceArea,\n ServiceRate,\n ServiceQuote,\n};\n\nconst adapters = {\n BrowserAdapter,\n NodeAdapter,\n EmberJsAdapter,\n};\n\nclass Resolver {\n constructor() {\n this.resources = resources;\n this.adapters = adapters;\n\n return this.lookup(...arguments);\n }\n\n lookup(type, className) {\n const key = pluralize(type);\n const params = [...arguments].slice(2);\n\n if (!this[key]) {\n throw new Error('Attempted to resolve invalid type');\n }\n\n if (!this[key][className]) {\n throw new Error(`No ${singularize(type)} named ${className} to resolve`);\n }\n\n return new this[key][className](...params);\n }\n}\n\nconst lookup = function () {\n return new Resolver(...arguments);\n};\n\nexport { Resolver, lookup };\n","import { lookup } from './resolver';\nimport { pluralize, classify } from './utils/string';\nimport { isArray } from './utils/array';\nimport { Collection, detectAdapter, isResource, StoreActions } from './utils';\nimport { set, isCallable, invoke } from './utils/object';\n\nconst extendStoreActions = (store, actions = []) => {\n store.actions = isArray(actions) ? actions : [actions];\n\n if (isArray(actions)) {\n for (let i = 0; i < actions.length; i++) {\n const action = actions[i];\n\n store.extendActions(action);\n }\n return;\n }\n\n if (actions instanceof StoreActions) {\n actions.extend(store);\n }\n\n return store;\n};\n\nconst afterFetch = (store, json) => {\n if (typeof store.options.onAfterFetch === 'function') {\n store.options.onAfterFetch(json);\n }\n\n if (isArray(json)) {\n const serialized = [];\n\n for (let i = 0; i < json.length; i++) {\n serialized.push(store.afterFetch(json[i]));\n }\n\n return new Collection(...serialized);\n }\n\n const resourceInstance = store.serialize(json);\n return store.deposit(resourceInstance);\n};\n\nclass Store {\n constructor(resource, adapter, options = {}) {\n this.resource = resource;\n this.adapter = adapter || detectAdapter();\n this.namespace = pluralize(resource);\n this.storage = new Collection();\n this.options = options;\n this.extendActions(options.actions);\n }\n\n extendActions(actions = []) {\n return extendStoreActions(this, actions);\n }\n\n deposit(resourceInstance) {\n // this.storage[this.namespace].pushObject(resourceInstance);\n\n return resourceInstance;\n }\n\n serialize(json) {\n return lookup('resource', classify(this.resource), json, this.adapter);\n }\n\n afterFetch(json) {\n return afterFetch(this, json);\n }\n\n create(attributes = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.post(`${this.namespace}`, attributes, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n update(id, attributes = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.put(`${this.namespace}/${id}`, attributes, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n findRecord(id, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}/${id}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n findAll(options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n query(query = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, query, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n queryRecord(query = {}, options = {}) {\n query.single = true;\n\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, query, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n destroy(record, options = {}) {\n const id = isResource(record) ? record.getAttribute('id') : record;\n\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.delete(`${this.namespace}/${id}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n}\n\nexport default Store;\n\nexport { extendStoreActions, afterFetch };\n","import Store from './store';\nimport Resource from './resource';\nimport { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote } from './resources';\nimport { BrowserAdapter, NodeAdapter, EmberJsAdapter, Adapter } from './adapters';\nimport { isNodeEnvironment, detectAdapter, isLatitude, isLongitude, Point, isResource, GoogleAddress, Collection, StoreActions } from './utils';\nimport { pluralize, singularize, classify, dasherize, camelize } from './utils/string';\nimport { extendStoreActions } from './store';\nimport { orderActions } from './resources/order';\nimport { driverActions } from './resources/driver';\n\n/**\n * // instance\n * const fleetbase = new Fleetbase();\n *\n * const contact = fleetbase.contacts.create({\n * \t\tname: 'Ron',\n * \t\tphone: '+65 9999 8888'\n * });\n *\n * constact.update({ name: 'Hollywood Ron' });\n *\n * // export\n * import { Contact } from '@fleetbase/sdk';\n *\n * const contact = new Contact({\n * \t\tname: 'Ron',\n * \t\tphone: '+65 9999 8888'\n * });\n *\n * contact.save();\n */\n\nexport default class Fleetbase {\n /**\n * Builds an instance of the Fleetbase SDK\n *\n * @param {String} publicKey The public key issued\n * @param {Object} config The version of resource to access\n * @param {Boolean} debug Debug mode for SDK\n * @return {Fleetbase} Instance\n */\n constructor(publicKey, config = {}, debug = false) {\n this.version = config.version ?? 'v1';\n this.options = {\n version: this.version,\n host: config.host ?? 'https://api.fleetbase.io',\n namespace: config.namespace ?? this.version,\n debug,\n publicKey,\n };\n\n if (typeof publicKey !== 'string' || publicKey.length === 0) {\n throw new Error('⚠️ Invalid public key given to Fleetbase SDK');\n }\n\n if (!isNodeEnvironment() && publicKey.toLowerCase().startsWith('$')) {\n throw new Error('Secret key provided. You must use a public key with Fleetbase Javascript SDK!');\n }\n\n this.adapter = config.adapter || detectAdapter(this.options);\n\n this.orders = new Store('order', this.adapter).extendActions(orderActions);\n this.entities = new Store('entity', this.adapter);\n this.places = new Store('place', this.adapter);\n this.drivers = new Store('driver', this.adapter).extendActions(driverActions);\n this.vehicles = new Store('vehicle', this.adapter);\n this.vendors = new Store('vendor', this.adapter);\n this.contacts = new Store('contact', this.adapter);\n }\n\n static newInstance() {\n return new Fleetbase(...arguments);\n }\n\n setAdapter(adapter) {\n this.adapter = adapter;\n }\n\n getAdapter() {\n return this.adapter;\n }\n}\n\nexport {\n Store,\n Resource,\n Contact,\n Driver,\n Entity,\n Order,\n Payload,\n Place,\n TrackingStatus,\n Vehicle,\n Vendor,\n Waypoint,\n Zone,\n ServiceArea,\n ServiceRate,\n ServiceQuote,\n BrowserAdapter,\n NodeAdapter,\n EmberJsAdapter,\n Adapter,\n isNodeEnvironment,\n isLatitude,\n isLongitude,\n Point,\n isResource,\n GoogleAddress,\n Collection,\n StoreActions,\n extendStoreActions,\n pluralize,\n singularize,\n classify,\n dasherize,\n camelize,\n};\n"],"names":["isArray","Array","replace","array","start","deleteCount","items","length","splice","i","chunk","slice","isCollection","arr","identityFunction","item","mixed","Collection","objectAt","index","iter","key","value","arguments","Boolean","findIndex","predicate","startAt","len","find","callback","target","bind","undefined","any","every","cb","indexOf","val","withNaNCheck","insertAt","this","indexes","map","idx","_this2","object","methodName","args","ret","forEach","push","_item$methodName","filter","sortKeys","sort","a","b","propA","propB","compareValue","compare","seen","Set","getter","get","has","add","uniqBy","includes","removeAt","obj","objects","toArray","reverse","clear","loc","removeObject","pushObject","_this3","addObject","isEmpty","none","size","objectType","isBlank","test","isLatitude","coordinate","isFinite","Math","abs","isLongitude","isResource","record","Resource","isPhone","phone","isNodeEnvironment","process","_typeof","_process","env","release","name","search","window","navigator","product","detectAdapter","options","lookup","GoogleAddress","place","geometry","components","parseComponents","attributes","parseProperties","address_components","reduce","acc","data","types","type","streetNumber","streetName","coordinates","location","Object","values","city","or","county","stateShort","stateLong","countryShort","country","countryLong","postalCode","address","join","keys","pkey","short","short_name","long_name","Point","latitude","longitude","coorindates","lat","lng","serialize","json","getResolved","func","path","resolved","current","isObject","isFunction","pathArray","split","newPath","set","iterations","StoreActions","actions","bindTo","binding","action","fn","adapter","resource","dirtyAttributes","changes","isLoading","isSaving","isDestroying","isReloading","version","setAdapter","store","Store","onAfterFetch","syncAttributes","_this$options","getAttribute","mergeAttributes","setFlags","create","then","response","_this","update","id","destroy","findRecord","_this4","reset","flags","state","validFlags","flag","Error","attribues","getAttributes","onlyDirty","savedirty","dirtyAttributeKeys","isAttributeFilled","Date","hasAttributes","isNew","isLoaded","property","_this5","call","setAttributes","previousValue","changedAt","setAttribute","attribute","defaultValue","properties","attributeKeys","prop","hasAttribute","_this6","_value","_value2","modelAttributes","orderActions","getDistanceAndTime","params","namespace","getNextActivity","dispatch","post","afterFetch","updateActivity","setDestination","destinationId","captureQrCode","subjectId","captureSignature","complete","cancel","Order","isStarted","isCanceled","isCompleted","Payload","entity","waypoints","Entity","Place","_this$getAttribute","_this$getAttribute2","owner","googleAddress","street1","street2","province","postal_code","neighborhood","district","building","security_access_code","Waypoint","TrackingStatus","Vehicle","driverActions","login","identity","password","verifyCode","code","track","retrieve","syncDevice","token","setHeaders","Driver","Vendor","Contact","Zone","ServiceArea","ServiceRate","ServiceQuote","Adapter","config","host","headers","BrowserAdapter","Authorization","publicKey","Promise","resolve","reject","statusText","status","ok","method","fetch","url","mode","Headers","parseJSON","errors","error","query","urlParams","URLSearchParams","toString","request","body","JSON","stringify","NodeAdapter","axios","baseURL","commonHeaders","defaults","common","transform","handleError","put","patch","EmberJsAdapter","String","string","chain","RegExp","str","rules","skip","override","toLowerCase","x","match","plural","applyRules","pluralRules","uncountableWords","singular","singularRules","lowFirstLetter","str_path","str_arr","charAt","toUpperCase","substring","first","last","uppercase","underbarPrefix","idSuffix","underbar","capitalize","spaceOrUnderbar","allFirstUpper","camelize","underscore","d","nonTitlecasedWords","pluralize","singularize","dropIdUbar","demodulize","NaN","parseInt","ltd","ld","suf","argz","instance","shift","invoke","dasherize","classify","resources","adapters","Resolver","className","extendStoreActions","extend","extendActions","storage","resourceInstance","serialized","deposit","single","_this7","Fleetbase","debug","startsWith","orders","entities","places","drivers","vehicles","vendors","contacts"],"mappings":"skJAAA,IAAQA,EAAYC,MAAZD,yDCWFE,EAAU,SAACC,EAAOC,EAAOC,OAAaC,yDAAQ,MAC5CN,EAAQG,MACJG,EAAMC,QANC,IAOPJ,EAAMK,aAANL,GAAaC,EAAOC,YAAgBC,SACjC,CACHH,EAAMK,OAAOJ,EAAOC,OAEf,IAAII,EAAI,EAAGA,EAAI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,MAAAA,EACAnG,UAAAA,GAGqB,iBAAdA,GAA+C,IAArBA,EAAUlS,aACrC,IAAIsM,MAAM,oDAGf3G,KAAuBuM,EAAU0C,cAAc0D,WAAW,WACrD,IAAIhM,MAAM,sFAGfhC,QAAUuH,EAAOvH,SAAWhE,EAAcpE,KAAKqE,cAE/CgS,OAAS,IAAItN,GAAM,QAAS/I,KAAKoI,SAASuN,cAAc3J,QACxDsK,SAAW,IAAIvN,GAAM,SAAU/I,KAAKoI,cACpCmO,OAAS,IAAIxN,GAAM,QAAS/I,KAAKoI,cACjCoO,QAAU,IAAIzN,GAAM,SAAU/I,KAAKoI,SAASuN,cAAcnH,SAC1DiI,SAAW,IAAI1N,GAAM,UAAW/I,KAAKoI,cACrCsO,QAAU,IAAI3N,GAAM,SAAU/I,KAAKoI,cACnCuO,SAAW,IAAI5N,GAAM,UAAW/I,KAAKoI,6CAO9C,SAAWA,QACFA,QAAUA,4BAGnB,kBACWpI,KAAKoI,qCAThB,oBACe8N,6BAAapX"} \ No newline at end of file +{"version":3,"file":"fleetbase.js","sources":["../../src/utils/array.js","../../src/utils/collection.js","../../src/utils/is-empty.js","../../src/utils/is-blank.js","../../src/utils/is-latitude.js","../../src/utils/is-longitude.js","../../src/utils/is-resource.js","../../src/utils/is-phone.js","../../src/utils/is-node-environment.js","../../src/utils/detect-adapter.js","../../src/utils/google-address.js","../../src/utils/point.js","../../src/utils/object.js","../../src/utils/store-actions.js","../../src/resource.js","../../src/resources/order.js","../../src/resources/payload.js","../../src/resources/entity.js","../../src/resources/place.js","../../src/resources/waypoint.js","../../src/resources/tracking-status.js","../../src/resources/vehicle.js","../../src/resources/driver.js","../../src/resources/vendor.js","../../src/resources/contact.js","../../src/resources/zone.js","../../src/resources/service-area.js","../../src/resources/service-rate.js","../../src/resources/service-quote.js","../../src/adapter.js","../../src/adapters/browser.js","../../src/adapters/node.js","../../src/adapters/ember.js","../../src/utils/string.js","../../src/resolver.js","../../src/store.js","../../src/fleetbase.js"],"sourcesContent":["const { isArray } = Array;\n\nexport {\n isArray\n};\n","import { isArray } from './array';\n\n/**\n * Collection\n * Extended array inspired by Ember's NativeArray\n **/\n\nconst CHUNK_SIZE = 60000;\n\n// To avoid overflowing the stack, we splice up to CHUNK_SIZE items at a time.\n// See https://code.google.com/p/chromium/issues/detail?id=56588 for more details.\nconst replace = (array, start, deleteCount, items = []) => {\n if (isArray(array)) {\n if (items.length <= CHUNK_SIZE) {\n array.splice(start, deleteCount, ...items);\n } else {\n array.splice(start, deleteCount);\n\n for (let i = 0; i < items.length; i += CHUNK_SIZE) {\n let chunk = items.slice(i, i + CHUNK_SIZE);\n array.splice(start + i, 0, ...chunk);\n }\n }\n } else if (isCollection(arr)) {\n array.replace(start, deleteCount, items);\n }\n};\n\nconst identityFunction = (item) => item;\n\nconst uniqBy = (array, key = identityFunction) => {\n let ret = [];\n let seen = new Set();\n let getter = typeof key === 'function' ? key : (item) => get(item, key);\n\n array.forEach((item) => {\n let val = getter(item);\n if (!seen.has(val)) {\n seen.add(val);\n ret.push(item);\n }\n });\n\n return ret;\n};\n\nconst isCollection = (mixed) => mixed instanceof Collection;\n\nconst objectAt = (array, index) => {\n if (isArray(array)) {\n return array[index];\n } else if (isCollection(array)) {\n return array.objectAt(index);\n }\n\n return null;\n};\n\nconst iter = (key, value) => {\n let valueProvided = arguments.length === 2;\n return valueProvided ? (item) => value === item[key] : (item) => Boolean(item[key]);\n};\n\nconst findIndex = (array, predicate, startAt = 0) => {\n let len = array.length;\n for (let index = startAt; index < len; index++) {\n let item = objectAt(array, index);\n if (predicate(item, index, array)) {\n return index;\n }\n }\n return -1;\n};\n\nconst find = (array, callback, target) => {\n let predicate = callback.bind(target);\n let index = findIndex(array, predicate, 0);\n return index === -1 ? undefined : objectAt(array, index);\n};\n\nconst any = (array, callback, target) => {\n let predicate = callback.bind(target);\n return findIndex(array, predicate, 0) !== -1;\n};\n\nconst every = (array, callback, target) => {\n let cb = callback.bind(target);\n let predicate = (item, index, array) => !cb(item, index, array);\n return findIndex(array, predicate, 0) === -1;\n};\n\nconst indexOf = (array, val, startAt = 0, withNaNCheck) => {\n let len = array.length;\n\n if (startAt < 0) {\n startAt += len;\n }\n\n // SameValueZero comparison (NaN !== NaN)\n let predicate = withNaNCheck && val !== val ? (item) => item !== item : (item) => item === val;\n return findIndex(array, predicate, startAt);\n};\n\nconst removeAt = (array, index, len = 1) => {\n replace(array, index, len, []);\n return array;\n};\n\nconst insertAt = (array, index, item) => {\n replace(array, index, 0, [item]);\n return item;\n};\n\nclass Collection extends Array {\n constructor(...items) {\n if (isArray(arguments[0])) {\n super(...arguments[0]);\n } else {\n super(...arguments);\n }\n }\n\n get notEmpty() {\n return this.length > 0;\n }\n\n get empty() {\n return this.length === 0;\n }\n\n get first() {\n return objectAt(this, 0);\n }\n\n get last() {\n return objectAt(this, this.length - 1);\n }\n\n replace(start, deleteCount, items = []) {\n replace(this, start, deleteCount, items);\n\n return this;\n }\n\n objectsAt(indexes) {\n return indexes.map((idx) => objectAt(this, idx));\n }\n\n objectAt(index) {\n return objectAt(this, index);\n }\n\n indexOf(object, startAt) {\n return indexOf(this, object, startAt, false);\n }\n\n lastIndexOf(object, startAt) {\n let len = this.length;\n\n if (startAt === undefined || startAt >= len) {\n startAt = len - 1;\n }\n\n if (startAt < 0) {\n startAt += len;\n }\n\n for (let idx = startAt; idx >= 0; idx--) {\n if (objectAt(this, idx) === object) {\n return idx;\n }\n }\n\n return -1;\n }\n\n includes(object, startAt) {\n return indexOf(this, object, startAt, true) !== -1;\n }\n\n findBy() {\n return find(this, iter(...arguments));\n }\n\n findIndexBy() {\n return findIndex(this, iter(...arguments));\n }\n\n isEvery() {\n return every(this, iter(...arguments));\n }\n\n isAny() {\n return any(this, iter(...arguments));\n }\n\n invoke(methodName, ...args) {\n let ret = [];\n\n this.forEach((item) => ret.push(item[methodName]?.(...args)));\n\n return ret;\n }\n\n toArray() {\n return this.map((item) => item);\n }\n\n compact() {\n return this.filter((value) => value != null);\n }\n\n sortBy() {\n let sortKeys = arguments;\n\n return this.sort((a, b) => {\n for (let i = 0; i < sortKeys.length; i++) {\n let key = sortKeys[i];\n let propA = a[key];\n let propB = b[key];\n // return 1 or -1 else continue to the next sortKey\n let compareValue = compare(propA, propB);\n\n if (compareValue) {\n return compareValue;\n }\n }\n return 0;\n });\n }\n\n uniqBy(key) {\n return uniqBy(this, key);\n }\n\n without(value) {\n if (!this.includes(value)) {\n return this; // nothing to do\n }\n\n // SameValueZero comparison (NaN !== NaN)\n let predicate = value === value ? (item) => item !== value : (item) => item === item;\n return this.filter(predicate);\n }\n\n clear() {\n let len = this.length;\n if (len === 0) {\n return this;\n }\n\n this.replace(0, len, []);\n return this;\n }\n\n insertAt(idx, object) {\n insertAt(this, idx, object);\n return this;\n }\n\n replaceAt(idx, object) {\n return this.replace(idx, 1, [object]);\n }\n\n removeAt(start, len) {\n return removeAt(this, start, len);\n }\n\n pushObject(obj) {\n return this.insertAt(this.length, obj);\n }\n\n pushObjects(objects) {\n this.replace(this.length, 0, objects);\n return this;\n }\n\n popObject() {\n let len = this.length;\n if (len === 0) {\n return null;\n }\n\n let ret = objectAt(this, len - 1);\n this.removeAt(len - 1, 1);\n return ret;\n }\n\n shiftObject() {\n if (this.length === 0) {\n return null;\n }\n\n let ret = objectAt(this, 0);\n this.removeAt(0);\n return ret;\n }\n\n unshiftObject(obj) {\n return insertAt(this, 0, obj);\n }\n\n unshiftObjects(objects) {\n this.replace(0, 0, objects);\n return this;\n }\n\n reverseObjects() {\n let len = this.length;\n if (len === 0) {\n return this;\n }\n\n let objects = this.toArray().reverse();\n this.replace(0, len, objects);\n return this;\n }\n\n setObjects(objects) {\n if (objects.length === 0) {\n return this.clear();\n }\n\n let len = this.length;\n this.replace(0, len, objects);\n return this;\n }\n\n removeObject(obj) {\n let loc = this.length || 0;\n while (--loc >= 0) {\n let curObject = objectAt(this, loc);\n\n if (curObject === obj) {\n this.removeAt(loc);\n }\n }\n return this;\n }\n\n removeObjects(objects) {\n for (let i = objects.length - 1; i >= 0; i--) {\n this.removeObject(objects[i]);\n }\n\n return this;\n }\n\n addObject(obj) {\n let included = this.includes(obj);\n\n if (!included) {\n this.pushObject(obj);\n }\n\n return this;\n }\n\n addObjects(objects) {\n objects.forEach((obj) => this.addObject(obj));\n return this;\n }\n}\n\nexport default Collection;\n\nexport { replace, uniqBy, isCollection, objectAt, iter, findIndex, find, any, every, indexOf, removeAt, insertAt };\n","const isEmpty = (obj) => {\n const none = obj === null || obj === undefined;\n if (none) {\n return none;\n }\n\n if (typeof obj.size === 'number') {\n return !obj.size;\n }\n\n const objectType = typeof obj;\n\n if (objectType === 'object') {\n const { size } = obj;\n if (typeof size === 'number') {\n return !size;\n }\n }\n\n if (typeof obj.length === 'number' && objectType !== 'function') {\n return !obj.length;\n }\n\n if (objectType === 'object') {\n const { length } = obj;\n if (typeof length === 'number') {\n return !length;\n }\n }\n\n return false;\n};\n\nexport default isEmpty;\n","import isEmpty from './is-empty';\n\nconst isBlank = (obj) => isEmpty(obj) || (typeof obj === 'string' && /\\S/.test(obj) === false);\n\nexport default isBlank;\n","export default function isLatitude(coordinate) {\n return isFinite(coordinate) && Math.abs(coordinate) <= 90;\n}\n","export default function isLongitude(coordinate) {\n return isFinite(coordinate) && Math.abs(coordinate) <= 180 && Math.abs(coordinate) >= 90;\n}\n","import Resource from '../resource';\n\nexport default function isResource(record) {\n return record instanceof Resource;\n}\n","const isPhone = (phone = '') => {\n return /^[+]?[\\s./0-9]*[(]?[0-9]{1,4}[)]?[-\\s./0-9]*$/g.test(phone);\n}\n\nexport default isPhone;","/**\n * Determines if environment SDK is initialized in is Node, additionally checks pass if environment is ReactNative.\n * \n * @returns boolean\n */\nconst isNodeEnvironment = () => {\n return (typeof process !== 'undefined') && (typeof process?.env === 'object' || process.release?.name?.search(/node|io.js/) !== -1) && (typeof window === 'undefined' || window?.navigator?.product === 'ReactNative');\n};\n\nexport default isNodeEnvironment;","import { lookup } from '../resolver';\nimport isNodeEnvironment from './is-node-environment';\n\nconst detectAdapter = (options = {}) => {\n if (isNodeEnvironment()) {\n return lookup('adapter', 'NodeAdapter', options);\n }\n\n return lookup('adapter', 'BrowserAdapter', options);\n}\n\nexport default detectAdapter;","const { isArray } = Array;\n\nclass GoogleAddress {\n constructor(place) {\n this.place = place;\n this.geometry = place?.geometry;\n this.components = this.parseComponents();\n this.attributes = this.parseProperties();\n }\n\n parse() {\n this.parseComponents();\n this.parseProperties();\n }\n\n parseComponents() {\n const components = (this.place?.address_components || []).reduce(function (acc, data) {\n data.types.forEach(function (type) {\n acc[type] = data;\n });\n return acc;\n }, {});\n\n return components;\n }\n\n parseProperties() {\n const attributes = {\n streetNumber: this.get('street_number'),\n streetName: this.get('route'),\n coordinates: this.geometry?.location ? Object.values(this.geometry.location) : [0, 0],\n city: this.or(['locality', 'sublocality', 'sublocality_level_1', 'neighborhood', 'administrative_area_level_3', 'administrative_area_level_2']),\n county: this.get('administrative_area_level_2'),\n stateShort: this.get('administrative_area_level_1', true),\n stateLong: this.get('administrative_area_level_1'),\n countryShort: this.get('country', true),\n country: this.get('country', true),\n countryLong: this.get('country'),\n postalCode: this.get('postal_code'),\n };\n\n attributes.address = [attributes.streetNumber, attributes.streetName].filter(Boolean).join(' ');\n\n return attributes;\n }\n\n all() {\n return this.attributes;\n }\n\n or(keys = []) {\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n\n if (isArray(key)) {\n const pkey = key[0];\n const short = key[1];\n\n if (this.has(pkey)) {\n return this.get(pkey, short);\n }\n\n continue;\n }\n\n if (this.has(key)) {\n return this.get(key);\n }\n }\n\n return null;\n }\n\n has(key) {\n return (key in this.components);\n }\n\n get(key, short = false) {\n if (!(key in this.components)) {\n return null;\n }\n\n return short ? this.components[key].short_name : this.components[key].long_name;\n }\n\n setAttributes(attributes = {}) {\n this.attributes = {...this.attributes, ...attributes};\n\n return this;\n }\n\n setAttribute(key, value) {\n this.attributes[key] = value;\n\n return this;\n }\n\n getAttribute(key) {\n return this.attributes[key] || null;\n }\n}\n\nexport default GoogleAddress;\n","export default class Point {\n constructor(latitude = 0, longitude = 0) {\n this.type = 'Point';\n this.coordinates = [longitude, latitude];\n }\n\n get latitude() {\n return this.coordinates[1];\n }\n\n get longitude() {\n return this.coordinates[0];\n }\n\n lat() {\n return this.latitude;\n }\n\n lng() {\n return this.longitude;\n }\n\n static fromGeoJson(json) {\n [ longitude, latitude ] = json.coordinates;\n\n return new Point(latitude, longitude);\n }\n\n serialize() {\n return {\n type: 'Point',\n coorindates: [this.lat(), this.lng()]\n };\n }\n\n toJson() {\n return this.serialize();\n }\n\n toString() {\n return `(${this.latitude}, ${this.longitude})`;\n }\n}","import isEmpty from './is-empty';\n\nconst isResource = (mixed) => typeof mixed === 'object' && !isEmpty(mixed?.attributes) && typeof mixed?.attributes === 'object';\n\nconst isCallable = (object, property) => typeof object[property] === 'function';\n\nconst getResolved = (func, path) => {\n const resolved = func();\n return Array.isArray(resolved) || typeof resolved === 'object' ? get(resolved, path) : null;\n};\n\nconst invoke = (object, method) => {\n if (typeof object[method] === 'function') {\n return object[method].bind(object);\n }\n};\n\nconst get = (object, path) => {\n let current = object;\n\n const type = typeof object;\n const isObject = type === 'object';\n const isFunction = type === 'function';\n const isArray = Array.isArray(object);\n\n const pathType = typeof path;\n const pathIsString = pathType === 'string';\n const pathIsDotted = pathIsString && path.includes('.');\n const pathArray = pathIsDotted ? path.split('.') : [path];\n\n if (isArray || isObject) {\n for (let i = 0; i < pathArray.length; i++) {\n if (current && current[pathArray[i]] === undefined) {\n return null;\n } else if (current) {\n current = current[pathArray[i]];\n\n // if is resource then return get on it's attributes\n if (isResource(current) && pathArray[i + 1] !== undefined) {\n const newPath = pathArray.slice(i + 1).join('.');\n\n return get(current.attributes, newPath);\n }\n\n // resolve functions and continue\n if (typeof current === 'function') {\n const newPath = pathArray.slice(i + 1).join('.');\n return getResolved(current, newPath);\n }\n }\n }\n return current;\n }\n\n if (isFunction) {\n return getResolved(object, path);\n }\n};\n\nconst getProperties = (object, properties = []) => {\n const selected = {};\n let propertyNames = arguments;\n let i = 1;\n\n if (arguments.length === 2 && Array.isArray(properties)) {\n i = 0;\n propertyNames = arguments[1];\n }\n\n for (; i < propertyNames.length; i++) {\n selected[propertyNames[i]] = get(object, propertyNames[i]);\n }\n\n return selected;\n};\n\nconst set = (object, path, value) => {\n let current = object;\n const type = typeof object;\n const isObject = type === 'object';\n const isFunction = type === 'function';\n const isArray = Array.isArray(object);\n\n // if is function\n if (isFunction) {\n // throw error should be object or array or object like\n }\n\n const pathType = typeof path;\n const pathIsString = pathType === 'string';\n const pathIsDotted = pathIsString && path.includes('.');\n const pathArray = pathIsDotted ? path.split('.') : [path];\n const iterations = pathArray.length;\n\n if (isArray || isObject) {\n for (let i = 0; i < iterations - 1; i++) {\n if (!current[pathArray[i]]) {\n current[pathArray[i]] = {};\n }\n current = current[pathArray[i]];\n }\n\n current[pathArray[iterations - 1]] = value;\n }\n\n return value;\n};\n\nconst setProperties = (object, properties = {}) => {\n for (const property in properties) {\n set(object, property, properties[property]);\n }\n\n return object;\n};\n\nconst extend = (target, classes = []) => {\n if (arguments.length > 1) {\n classes = arguments;\n }\n for (let index = 0; index < classes.length; index++) {\n for (const property in classes[index]) {\n if (Object.prototype.hasOwnProperty.call(classes[index], property)) {\n target[property] = classes[index][property];\n }\n }\n }\n return target;\n};\n\nexport { set, get, getProperties, setProperties, extend, isCallable, invoke };\n","import { set } from './object';\n\nexport default class StoreActions {\n constructor(actions = {}, bind = null) {\n this.actions = actions;\n this.bind = bind;\n }\n\n extend(bindTo = null) {\n const binding = bindTo || this.bind;\n\n if (!binding) {\n return this;\n }\n\n if (this?.actions && typeof this.actions === 'object') {\n for (let action in this.actions) {\n const fn = this.actions[action];\n\n if (typeof fn !== 'function') {\n set(binding, action, fn);\n continue;\n }\n\n set(binding, action, fn.bind(binding));\n }\n }\n\n return this;\n }\n}\n","import Store from './store';\nimport { isEmpty } from './utils';\nimport { isArray } from './utils/array';\nimport { set, get } from './utils/object';\n\nclass Resource {\n /**\n\t * The base resource for all resources\n\n\t * @return {[type]} [description]\n\t */\n constructor(attributes = {}, adapter, resource, options = {}) {\n this.attributes = attributes;\n this.dirtyAttributes = {};\n this.changes = {};\n this.isLoading = false;\n this.isSaving = false;\n this.isDestroying = false;\n this.isReloading = false;\n this.resource = resource;\n this.options = options;\n this.version = options.version || 'v1';\n this.setAdapter(adapter);\n }\n\n /**\n * Set a new adapter to the resource instance, this will update the Store instance\n *\n * @param {Adapter} adapter\n * @return {Resource} this\n */\n setAdapter(adapter) {\n this.adapter = adapter;\n this.store = new Store(this.resource, adapter, {\n onAfterFetch: this.syncAttributes.bind(this),\n actions: this.options?.actions\n });\n\n return this;\n }\n\n /**\n * Getter for id attribute\n *\n * @var {String}\n */\n get id() {\n return this.getAttribute('id');\n }\n\n /**\n * Creates a new resource on the server\n *\n * @param {Object} payload [description]\n * @return {[type]} [description]\n */\n create(attributes = {}) {\n const data = this.mergeAttributes(attributes);\n this.setFlags(['isLoading', 'isSaving']);\n\n return this.store.create(data).then((response) => {\n this.setFlags(['isLoading', 'isSaving'], false);\n\n return response;\n });\n }\n\n /**\n * Creates a new resource on the server\n *\n * @param {Object} payload [description]\n * @return {[type]} [description]\n */\n update(attributes = {}) {\n this.setFlags(['isLoading', 'isSaving']);\n\n return this.store.update(this.attributes.id, attributes).then((response) => {\n this.setFlags(['isLoading', 'isSaving'], false);\n\n return response;\n });\n }\n\n /**\n * Deletes the resource instance on the server\n *\n * @return {[type]} [description]\n */\n destroy() {\n this.setFlags(['isLoading', 'isDestroying']);\n\n return this.store.destroy(this.attributes.id).then((response) => {\n this.setFlags(['isLoading', 'isDestroying'], false);\n\n return response;\n });\n }\n\n /**\n * Reloads the resource from the server.\n *\n * @return {[type]} [description]\n */\n reload() {\n this.setFlags(['isLoading', 'isReloading']);\n\n return this.store.findRecord(this.attributes.id).then((response) => {\n this.reset();\n\n return response;\n });\n }\n\n /**\n * Sets flag properties.\n *\n * @return this\n */\n setFlags(flags = [], state = true) {\n const validFlags = ['isLoading', 'isSaving', 'isReloading', 'isDestroying'];\n\n for(let i = 0; i < flags.length; i++) {\n const flag = flags[i];\n\n if (typeof flag !== 'string' || !validFlags.includes(flag)) {\n throw new Error(`${flag} is not a valid flag!`);\n }\n\n this[flag] = state;\n }\n\n return this;\n }\n\n /**\n * Resets tracked properties\n *\n * @return this\n */\n reset() {\n this.dirtyAttributes = {};\n this.changes = {};\n this.isLoading = false;\n this.isSaving = false;\n this.isReloading = false;\n\n return this;\n }\n\n /**\n * Emptys resource.\n *\n * @return this\n */\n empty() {\n this.reset();\n this.attribues = {};\n\n return this;\n }\n\n /**\n * Saves the resource instance on the server\n *\n * @return {[type]} [description]\n */\n save(options = {}) {\n const attributes = this.getAttributes();\n\n if (isEmpty(this.id)) {\n return this.create(attributes);\n }\n\n if (options.onlyDirty === true) {\n return this.savedirty();\n }\n\n return this.update(attributes);\n }\n\n /**\n * Saves only dirtied attributes.\n *\n * @return {[type]} [description]\n */\n saveDirty() {\n const dirtyAttributeKeys = Object.keys(this.dirtyAttributes);\n const dirtyAttributes = {};\n\n for (let i = 0; i < dirtyAttributeKeys.length; i++) {\n const key = dirtyAttributeKeys[i];\n dirtyAttributes[key] = this.getAttribute(key);\n }\n\n return this.update(dirtyAttributes);\n }\n\n /**\n * Returns the resource meta if exists.\n *\n * @return {Object}\n */\n get meta() {\n return this.getAttribute('meta', {});\n }\n\n /**\n * Returns the date instance resource was created.\n *\n * @return {Date}\n */\n get createdAt() {\n return this.isAttributeFilled('created_at') ? new Date(this.getAttribute('created_at')) : null;\n }\n\n /**\n * Returns the date instance resource was created.\n *\n * @return {Date}\n */\n get updatedAt() {\n return this.isAttributeFilled('updated_at') ? new Date(this.getAttribute('updated_at')) : null;\n }\n\n /**\n * Checks if resource is loaded from the server.\n *\n * @return {Boolean}\n */\n get isLoaded() {\n return this.hasAttributes(['created_at', 'id']);\n }\n\n /**\n * Checks if resource ihas no attributes\n *\n * @return {Boolean}\n */\n get isEmpty() {\n return Object.values(this?.attributes).length === 0;\n }\n\n /**\n * Checks if resource is not saved to server.\n *\n * @return {Boolean}\n */\n get isNew() {\n return !this.id;\n }\n\n /**\n * Checks if resource is not saved to server.\n *\n * @return {Boolean}\n */\n get isSaved() {\n return !this.isNew && this.isLoaded;\n }\n\n /**\n * Checks if resource is deleted on server.\n *\n * @return {Boolean}\n */\n get isDeleted() {\n return this.hasAttributes(['deleted', 'time']);\n }\n\n /**\n * Iterates over each attribute value and property executing a user supplied callback.\n *\n * @return {Object}\n */\n eachAttribute(callback) {\n if (typeof callback !== 'function') {\n return this;\n }\n\n Object.keys(this?.attributes ?? {}).forEach((property) => {\n const value = this.getAttribute(property);\n callback.call(this, value, property);\n });\n\n return this;\n }\n\n /**\n * Gets all changes\n *\n * @return {Object}\n */\n changes() {\n return this.changes;\n }\n\n /**\n * Gets all dirty attributes.\n *\n * @return {Object}\n */\n getDirtyAttributes() {\n return this.dirtyAttributes;\n }\n\n /**\n * Checks if property is dirty.\n *\n * @param {String} property [description]\n * @return {Boolean}\n */\n isDirty(property) {\n return property in this.dirtyAttributes;\n }\n\n /**\n * Checks if any properties is dirty.\n *\n * @return {Boolean}\n */\n hasDirtyAttributes() {\n return Object.keys(this?.dirtyAttributes ?? {}).length > 0;\n }\n\n /**\n * Updates a instance property without tracking changes or dirtying attribute.\n *\n * @param {String} property [description]\n * @param {mixed} value [description]\n */\n mutate(property, value) {\n this.attributes[property] = value;\n }\n\n /**\n * Set an instance property locally\n *\n * @param {String} property [description]\n * @param {mixed} value [description]\n */\n setAttribute(property, value = null) {\n if (value === null && typeof property === 'object') {\n return this.setAttributes(property);\n }\n\n const previousValue = this?.attributes[property] ?? null;\n\n // use object setter\n set(this.attributes, property, value);\n set(this.dirtyAttributes, property, previousValue);\n \n // this.attributes[property] = value;\n // this.dirtyAttributes[property] = previousValue;\n\n // track changes\n if (!isArray(this?.changes[property])) {\n this.changes[property] = [];\n }\n\n this.changes[property].push({\n property,\n previousValue,\n value,\n changedAt: new Date(),\n });\n\n return this;\n }\n\n /**\n * Set multiple instance properties locally\n *\n * @param {Object} properties [description]\n */\n setAttributes(attributes = {}) {\n for (let property in attributes) {\n this.setAttribute(property, attributes[property]);\n }\n\n return this;\n }\n\n /**\n * Get an attribute\n *\n * @param {String} attribute The attribute key to get\n * @param {mixed} defaultValue The default value if no attribute value\n */\n getAttribute(attribute, defaultValue = null) {\n const value = get(this?.attributes ?? {}, attribute);\n\n if (value === undefined) {\n return defaultValue;\n }\n\n return value;\n }\n\n /**\n * Checks if attribute exists.\n *\n * @param {String} property [description]\n * @return {Boolean}\n */\n hasAttribute(property) {\n if (isArray(property)) {\n const properties = property;\n const attributeKeys = Object.keys(this.attributes ?? {});\n \n return properties.every((prop) => attributeKeys.includes(prop));\n }\n\n if (!this?.attributes) {\n return false;\n }\n\n return property in this.attributes;\n }\n\n /**\n * Alias for checking if has multiple attributes.\n *\n * @param {Array} properties \n * @return {Boolean}\n */\n hasAttributes(properties = []) {\n return this.hasAttribute(properties);\n }\n\n /**\n * Returns true if attribute has value.\n *\n * @param {Array} properties \n * @return {Boolean}\n */\n isAttributeFilled(property) {\n if (isArray(property)) {\n return this.hasAttribute(property) && property.every((prop) => !isEmpty(this.getAttribute(prop)));\n }\n\n return this.hasAttribute(property) && !isEmpty(this.getAttribute(property));\n }\n\n /**\n * Get multiple attributes.\n *\n * @param {Array} properties [description]\n * @param {[type]} value [description]\n */\n getAttributes(properties) {\n const attributes = {};\n\n if (properties === null || properties === undefined) {\n return this.getAttributes(Object.keys(this.attributes));\n }\n\n if (typeof properties === 'string') {\n return this.getAttribute([...arguments]);\n }\n\n if (!isArray(properties)) {\n throw new Error('No attribute properties provided!');\n }\n\n for (let i = 0; i < properties.length; i++) {\n const property = properties[i];\n\n if (typeof property !== 'string') {\n continue;\n }\n\n let value = this.getAttribute(property);\n\n if (typeof value?.attributes === 'object' && !isArray(value?.attributes)) {\n value = value.attributes;\n }\n\n attributes[property] = value;\n }\n\n return attributes;\n }\n\n /**\n * Serialize resource to a POJO\n *\n * @returns {Object}\n */\n serialize() {\n return this.getAttributes();\n }\n\n /**\n * Merge and return attributes on the resource instance.\n *\n * @param {[type]} property [description]\n * @param {[type]} value [description]\n */\n mergeAttributes(attributes = {}) {\n const modelAttributes = this?.attributes ?? {};\n this.attributes = { ...modelAttributes, ...attributes };\n\n return this.attributes;\n }\n\n /**\n * Merge and return attributes on the resource instance.\n *\n * @param {[type]} property [description]\n * @param {[type]} value [description]\n */\n syncAttributes(json = {}) {\n this.attributes = json;\n }\n}\n\nexport default Resource;\n","import Resource from '../resource';\nimport { StoreActions, isResource } from '../utils';\nimport { isValid as isValidDate } from 'date-fns';\n\nconst orderActions = new StoreActions({\n getDistanceAndTime: function (id, params = {}, options = {}) {\n return this.adapter.get(`${this.namespace}/${id}/distance-and-time`, params, options);\n },\n\n getNextActivity: function (id, params = {}, options = {}) {\n return this.adapter.get(`${this.namespace}/${id}/next-activity`, params, options);\n },\n\n dispatch: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/dispatch`, params, options).then(this.afterFetch.bind(this));\n },\n\n start: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/start`, params, options).then(this.afterFetch.bind(this));\n },\n\n updateActivity: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/update-activity`, params, options).then(this.afterFetch.bind(this));\n },\n\n setDestination: function (id, destinationId, params = {}, options = {}) {\n if (isResource(destinationId)) {\n destinationId = destinationId.id;\n }\n\n return this.adapter.post(`${this.namespace}/${id}/set-destination/${destinationId}`, params, options).then(this.afterFetch.bind(this));\n },\n\n captureQrCode: function (id, subjectId = null, params = {}, options = {}) {\n if (isResource(subjectId)) {\n subjectId = subjectId.id;\n }\n\n return this.adapter.post(`${this.namespace}/${id}/capture-qr${!subjectId ? '' : '/' + subjectId}`, params, options);\n },\n\n captureSignature: function (id, subjectId = null, params = {}, options = {}) {\n if (isResource(subjectId)) {\n subjectId = subjectId.id;\n }\n\n return this.adapter.post(`${this.namespace}/${id}/capture-signature${!subjectId ? '' : '/' + subjectId}`, params, options);\n },\n\n complete: function (id, params = {}, options = {}) {\n return this.adapter.post(`${this.namespace}/${id}/complete`, params, options).then(this.afterFetch.bind(this));\n },\n\n cancel: function (id, params = {}, options = {}) {\n return this.adapter.delete(`${this.namespace}/${id}/cancel`, params, options).then(this.afterFetch.bind(this));\n },\n});\n\nclass Order extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'order', { actions: orderActions, ...options });\n }\n\n getDistanceAndTime(params = {}, options = {}) {\n return this.store.getDistanceAndTime(this.id, params, options);\n }\n\n dispatch(params = {}, options = {}) {\n return this.store.dispatch(this.id, params, options);\n }\n\n start(params = {}, options = {}) {\n return this.store.start(this.id, params, options);\n }\n\n setDestination(destinationId, params = {}, options = {}) {\n return this.store.setDestination(this.id, destinationId, params, options);\n }\n\n captureQrCode(subjectId = null, params = {}, options = {}) {\n return this.store.captureQrCode(this.id, subjectId, params, options);\n }\n\n captureSignature(subjectId = null, params = {}, options = {}) {\n return this.store.captureSignature(this.id, subjectId, params, options);\n }\n\n getNextActivity(params = {}, options = {}) {\n return this.store.getNextActivity(this.id, params, options);\n }\n\n updateActivity(params = {}, options = {}) {\n return this.store.updateActivity(this.id, params, options);\n }\n\n cancel(params = {}, options = {}) {\n return this.store.cancel(this.id, params, options);\n }\n\n complete(params = {}, options = {}) {\n return this.store.complete(this.id, params, options);\n }\n\n get isDispatched() {\n return this.getAttribute('dispatched_at') !== null;\n }\n\n get isNotDispatched() {\n return this.getAttribute('dispatched_at') == null;\n }\n\n get isStarted() {\n return this.getAttribute('started_at') !== null;\n }\n\n get isNotStarted() {\n return this.getAttribute('started_at') == null;\n }\n\n get isCompleted() {\n return this.getAttribute('status') == 'completed';\n }\n\n get isCanceled() {\n return this.getAttribute('status') == 'canceled';\n }\n\n get isEnroute() {\n return this.getAttribute('status') == 'driver_enroute' || this.getAttribute('status') === 'enroute';\n }\n\n get isInProgress() {\n return this.isStarted && !this.isCanceled && !this.isCompleted;\n }\n\n get scheduledAt() {\n return this.isAttributeFilled('scheduled_at') ? new Date(this.getAttribute('scheduled_at')) : null;\n }\n\n get startedAt() {\n return this.isAttributeFilled('started_at') ? new Date(this.getAttribute('started_at')) : null;\n }\n\n get dispatchedAt() {\n return this.isAttributeFilled('dispatched_at') ? new Date(this.getAttribute('dispatched_at')) : null;\n }\n\n get status() {\n return this.getAttribute('status');\n }\n}\n\nexport default Order;\n\nexport { orderActions };\n","import Resource from '../resource';\nimport Collection from '../utils/collection';\n\nclass Payload extends Resource {\n\tconstructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'payload', options);\n }\n\t\n /**\n\t * Attaches an entity to an existing payload and returns\n\t * the payload with the entity attached\n\t *\n\t * @param {[type]} Entity entity [description]\n\t * @return {[type]} [description]\n\t */\n attach(entity) {\n // perform op return payload\n }\n\n /**\n\t * Returns all of the entities attached to this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get entities() {\n\n }\n\n /**\n\t * Returns the dropoff for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get dropoff() {\n\n }\n\n /**\n\t * Returns the pickup for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get pickup() {\n\n }\n\n /**\n\t * Returns all the waypoints for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get waypoints() {\n return new Collection(this.waypoints);\n }\n}\n\nexport default Payload;\n","import Resource from '../resource';\n\nclass Entity extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'entity', options);\n }\n}\n\nexport default Entity;\n","import Resource from '../resource';\nimport { isResource, Point } from '../utils';\n\nclass Place extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'place', options);\n }\n\n static fromGoogleAddress(googleAddress, adapter, options = {}) {\n const [ latitude, longitude ] = googleAddress.getAttribute('coordinates');\n const attributes = {\n name: null,\n address: googleAddress.getAttribute('address'),\n location: new Point(latitude, longitude),\n street1: googleAddress.getAttribute('streetName'),\n street2: null,\n city: googleAddress.getAttribute('city'),\n province: googleAddress.getAttribute('stateLong'),\n postal_code: googleAddress.getAttribute('postalCode'),\n neighborhood: googleAddress.get('neighborhood'),\n district: googleAddress.getAttribute('county'),\n building: googleAddress.get('building'),\n country: googleAddress.getAttribute('countryShort'),\n phone: null,\n security_access_code: null\n };\n\n return new Place(attributes, adapter, options);\n }\n\n /**\n * The latitude coordinate for the 'Place' location.\n * \n * @var {Integer}\n */\n get latitude() {\n return this.getAttribute('location', new Point())?.coordinates[1];\n }\n\n /**\n * The longitude coordinate for the 'Place' location.\n * \n * @var {Integer}\n */\n get longitude() {\n return this.getAttribute('location', new Point())?.coordinates[0];\n }\n\n /**\n * Array coordinate pair for Place location.\n * \n * @var {Array}\n */\n get coordinates() {\n const { latitude, longitude } = this;\n\n return [ latitude, longitude ];\n }\n\n /**\n * Set the owner of the place.\n * \n * @param {Object|String} owner\n * @return {Place}\n */\n setOwner(owner) {\n if (isResource(owner)) {\n this.setAttribute('owner', owner.id);\n }\n\n if (typeof owner === 'string') {\n this.setAttribute('owner', owner);\n }\n\n return this;\n }\n}\n\nexport default Place;\n","import Place from './place';\n\nclass Waypoint extends Place {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'waypoint', options);\n }\n}\n\nexport default Waypoint;\n","import Resource from '../resource';\n\nclass TrackingStatus extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'tracking-status', options);\n }\n}\n\nexport default TrackingStatus;\n","import Resource from '../resource';\n\nclass Vehicle extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'vehicle', options);\n }\n}\n\nexport default Vehicle;\n","import Resource from '../resource';\nimport { StoreActions, isPhone, isEmail } from '../utils';\n\nconst driverActions = new StoreActions({\n // const { error } = await fleetbase.drivers.login('+1 111-1111');\n login: function (identity, password = null, attributes = {}) {\n // handle phone number authentication\n if (isPhone(identity)) {\n return this.adapter.post('drivers/login-with-sms', { phone: identity });\n }\n\n if (!password) {\n throw new Error('Login requires password!');\n }\n\n return this.adapter.post('drivers/login', { identity, password, ...attributes }).then(this.afterFetch.bind(this));\n },\n\n verifyCode: function (identity, code, attributes = {}) {\n return this.adapter.post('drivers/verify-code', { identity, code, ...attributes }).then(this.afterFetch.bind(this));\n },\n\n track: function (id, params = {}, options = {}) {\n return this.adapter.post(`drivers/${id}/track`, params, options).then(this.afterFetch.bind(this));\n },\n\n retrieve: function (id) {\n return this.findRecord(id);\n },\n\n syncDevice(id, params = {}, options = {}) {\n return this.adapter.post(`drivers/${id}/register-device`, params, options);\n },\n});\n\nclass Driver extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'driver', { actions: driverActions, ...options });\n }\n\n get token() {\n return this.getAttribute('token');\n }\n\n get isOnline() {\n return this.getAttribute('online') === true;\n }\n\n /**\n * The latitude coordinate for the 'Place' location.\n *\n * @var {Integer}\n */\n get latitude() {\n return this.getAttribute('location', new Point())?.coordinates[1];\n }\n\n /**\n * The longitude coordinate for the 'Place' location.\n *\n * @var {Integer}\n */\n get longitude() {\n return this.getAttribute('location', new Point())?.coordinates[0];\n }\n\n /**\n * Array coordinate pair for Place location.\n *\n * @var {Array}\n */\n get coordinates() {\n const { latitude, longitude } = this;\n\n return [latitude, longitude];\n }\n\n get token() {\n return this.getAttribute('token');\n }\n\n get isOnline() {\n return this.getAttribute('online') === true;\n }\n\n track(params = {}, options = {}) {\n return this.store.track(this.id, params, options);\n }\n\n syncDevice(params = {}, options = {}) {\n return this.store.syncDevice(this.id, params, options);\n }\n}\n\nexport default Driver;\nexport { driverActions };\n","import Resource from '../resource';\n\nclass Vendor extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'vendor', options);\n }\n}\n\nexport default Vendor;\n","import Resource from '../resource';\n\nclass Contact extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'contact', options);\n }\n}\n\nexport default Contact;\n","import Resource from '../resource';\n\nclass Zone extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'zone', options);\n }\n}\n\nexport default Zone;\n","import Resource from '../resource';\n\nclass ServiceArea extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-area', options);\n }\n}\n\nexport default ServiceArea;\n","import Resource from '../resource';\n\nclass ServiceRate extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-rate', options);\n }\n}\n\nexport default ServiceRate;\n","import Resource from '../resource';\n\nclass ServiceQuote extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-quote', options);\n }\n\n fromPreliminary() {\n\n }\n\n fromPayload() {\n \n }\n}\n\nexport default ServiceQuote;\n","class Adapter {\n /**\n\t * Creates a configured base adapter for Fleetbase.\n\t *\n\t * @param {Object} config Configuration options for adapter\n\t */\n constructor(config = {}) {\n this.version = config.version || 'v1';\n this.host = config.host || null;\n this.namespace = config.namespace || null;\n this.headers = config.headers || {};\n }\n}\n\nexport default Adapter;\n","import Adapter from '../adapter';\nimport { isBlank } from '../utils';\n\nclass BrowserAdapter extends Adapter {\n /**\n * Setup browser adapter.\n * @param {Object} config\n */\n constructor(config) {\n super(config);\n\n this.setHeaders({\n Authorization: `Bearer ${config.publicKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': '@fleetbase/sdk;browser'\n });\n }\n\n /**\n * Updates the adapter headers.\n *\n * @param {Object} headers\n */\n setHeaders(headers = {}) {\n this.headers = { ...this.headers, ...headers };\n\n return this;\n }\n\n /**\n * Parses the JSON returned by a network request\n *\n * @param {Object} response A response from a network request\n * @return {Object} The parsed JSON, status from the response\n *\n * @return {Promise}\n */\n parseJSON(response) {\n return new Promise((resolve, reject) => response\n .json()\n .then((json) => resolve({\n statusText: response.statusText,\n status: response.status,\n ok: response.ok,\n json,\n }))\n .catch(() => {\n reject(new Error('Oops! Something went wrong when handling your request.'));\n }));\n }\n\n /**\n * The base request method\n *\n * @param {String} path\n * @param {String} method\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n request(path, method = 'GET', data = {}, options = {}) {\n return new Promise((resolve, reject) => fetch(options.url || `${this.host}/${this.namespace}/${path}`, {\n method,\n mode: options.mode || 'cors',\n headers: new Headers({\n ...(this.headers || {}),\n ...(options.headers || {}),\n }),\n ...data,\n })\n .then(this.parseJSON)\n .then((response) => {\n if (response.ok) {\n return resolve(response.json);\n }\n\n return reject(new Error(response.json.errors ? response.json.errors[0] : response.statusText));\n })\n .catch((error) => {\n reject(error);\n }));\n }\n\n /**\n * Makes a GET request with fetch\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n get(path, query = {}, options = {}) {\n const urlParams = !isBlank(query) ? new URLSearchParams(query).toString() : '';\n\n return this.request(`${path}${urlParams ? `?${urlParams}` : ''}`, 'GET', {}, options);\n }\n\n /**\n * Makes a POST request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n post(path, data = {}, options = {}) {\n return this.request(path, 'POST', { body: JSON.stringify(data) }, options);\n }\n\n /**\n * Makes a PUT request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n put(path, data = {}, options = {}) {\n return this.request(path, 'PUT', { body: JSON.stringify(data) }, options);\n }\n\n /**\n * Makes a DELETE request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n delete(path, options = {}) {\n return this.request(path, 'DELETE', {}, options);\n }\n\n /**\n * Makes a PATCH request with fetch\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n patch(path, data = {}, options = {}) {\n return this.request(path, 'PATCH', { body: JSON.stringify(data) }, options);\n }\n}\n\nexport default BrowserAdapter;\n","import Adapter from '../adapter';\nimport { isBlank } from '../utils';\nimport { isArray } from '../utils/array';\nimport axios from 'axios';\n\nclass NodeAdapter extends Adapter {\n constructor(config) {\n super(config);\n\n this.axios = axios.create({\n baseURL: `${this.host}/${this.namespace}`,\n headers: {\n Authorization: `Bearer ${config.publicKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': '@fleetbase/sdk;node',\n },\n });\n }\n\n /**\n * Updates the adapter headers.\n *\n * @param {Object} headers\n */\n setHeaders(headers = {}) {\n const commonHeaders = this.axios.defaults.headers.common;\n this.axios.defaults.headers.common = { ...commonHeaders, ...headers };\n\n return this;\n }\n\n /**\n * Tranform the response, and return the response data from axios.\n *\n * @param {AxiosResponse} response\n * @returns {Object}\n */\n transform(response) {\n return response.data;\n }\n\n /**\n * Handles an erroneous request.\n *\n * @param {AxiosResponse} response\n * @returns {Object}\n */\n handleError(error) {\n if (error.response) {\n const { data } = error.response;\n\n if (isArray(data.errors)) {\n throw new Error(data.errors[0]);\n }\n\n if (data.error) {\n throw new Error(data.error);\n }\n }\n\n throw error;\n }\n\n /**\n * Makes a GET request with axios\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n get(path, query = {}, options = {}) {\n const urlParams = !isBlank(query) ? new URLSearchParams(query).toString() : '';\n\n return this.axios\n .get(`${path}${urlParams ? `?${urlParams}` : ''}`, options)\n .then(this.transform.bind(this))\n .catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a POST request with axios\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n post(path, data = {}, options = {}) {\n return this.axios.post(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a PUT request with axios\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n put(path, data = {}, options = {}) {\n return this.axios.put(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a DELETE request with axios\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n delete(path, options = {}) {\n return this.axios.delete(path, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a PATCH request with axios\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n patch(path, data = {}, options = {}) {\n return this.axios.patch(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n}\n\nexport default NodeAdapter;\n","import Adapter from '../adapter';\n\nclass EmberJsAdapter extends Adapter {}\n\nexport default EmberJsAdapter;\n","'use strict';\n\n/**\n * Javascript String\n *\n * instance\n * new String('hello_world').humanize().get() => \"Hello world\"\n *\n * instance\n * const string = new String();\n * string.humanize('hello_world').get() => \"Hello world\"\n * \n * no chain\n * new String('hello_world', false).humanize() => \"Hello world\"\n *\n * static\n * String.invoke('humanize', 'hello_world') => \"Hello world\"\n *\n * exports {}\n * humanize('hello_world') => \"Hello world\"\n */\n\nexport default class String {\n constructor(string, chain = true) {\n this.str = string;\n this.chain = chain;\n }\n\n uncountableWords = ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'moose', 'deer', 'news'];\n\n pluralRules = [\n [new RegExp('(m)an$', 'gi'), '$1en'],\n [new RegExp('(pe)rson$', 'gi'), '$1ople'],\n [new RegExp('(child)$', 'gi'), '$1ren'],\n [new RegExp('^(ox)$', 'gi'), '$1en'],\n [new RegExp('(ax|test)is$', 'gi'), '$1es'],\n [new RegExp('(octop|vir)us$', 'gi'), '$1i'],\n [new RegExp('(alias|status)$', 'gi'), '$1es'],\n [new RegExp('(bu)s$', 'gi'), '$1ses'],\n [new RegExp('(buffal|tomat|potat)o$', 'gi'), '$1oes'],\n [new RegExp('([ti])um$', 'gi'), '$1a'],\n [new RegExp('sis$', 'gi'), 'ses'],\n [new RegExp('(?:([^f])fe|([lr])f)$', 'gi'), '$1$2ves'],\n [new RegExp('(hive)$', 'gi'), '$1s'],\n [new RegExp('([^aeiouy]|qu)y$', 'gi'), '$1ies'],\n [new RegExp('(x|ch|ss|sh)$', 'gi'), '$1es'],\n [new RegExp('(matr|vert|ind)ix|ex$', 'gi'), '$1ices'],\n [new RegExp('([m|l])ouse$', 'gi'), '$1ice'],\n [new RegExp('(quiz)$', 'gi'), '$1zes'],\n [new RegExp('s$', 'gi'), 's'],\n [new RegExp('$', 'gi'), 's'],\n ];\n\n singularRules = [\n [new RegExp('(m)en$', 'gi'), '$1an'],\n [new RegExp('(pe)ople$', 'gi'), '$1rson'],\n [new RegExp('(child)ren$', 'gi'), '$1'],\n [new RegExp('([ti])a$', 'gi'), '$1um'],\n [new RegExp('((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$', 'gi'), '$1$2sis'],\n [new RegExp('(hive)s$', 'gi'), '$1'],\n [new RegExp('(tive)s$', 'gi'), '$1'],\n [new RegExp('(curve)s$', 'gi'), '$1'],\n [new RegExp('([lr])ves$', 'gi'), '$1f'],\n [new RegExp('([^fo])ves$', 'gi'), '$1fe'],\n [new RegExp('([^aeiouy]|qu)ies$', 'gi'), '$1y'],\n [new RegExp('(s)eries$', 'gi'), '$1eries'],\n [new RegExp('(m)ovies$', 'gi'), '$1ovie'],\n [new RegExp('(x|ch|ss|sh)es$', 'gi'), '$1'],\n [new RegExp('([m|l])ice$', 'gi'), '$1ouse'],\n [new RegExp('(bus)es$', 'gi'), '$1'],\n [new RegExp('(o)es$', 'gi'), '$1'],\n [new RegExp('(shoe)s$', 'gi'), '$1'],\n [new RegExp('(cris|ax|test)es$', 'gi'), '$1is'],\n [new RegExp('(octop|vir)i$', 'gi'), '$1us'],\n [new RegExp('(alias|status)es$', 'gi'), '$1'],\n [new RegExp('^(ox)en', 'gi'), '$1'],\n [new RegExp('(vert|ind)ices$', 'gi'), '$1ex'],\n [new RegExp('(matr)ices$', 'gi'), '$1ix'],\n [new RegExp('(quiz)zes$', 'gi'), '$1'],\n [new RegExp('s$', 'gi'), ''],\n ];\n\n nonTitlecasedWords = ['and', 'or', 'nor', 'a', 'an', 'the', 'so', 'but', 'to', 'of', 'at', 'by', 'from', 'into', 'on', 'onto', 'off', 'out', 'in', 'over', 'with', 'for'];\n\n idSuffix = new RegExp('(_ids|_id)$', 'g');\n underbar = new RegExp('_', 'g');\n spaceOrUnderbar = new RegExp('[ _]', 'g');\n uppercase = new RegExp('([A-Z])', 'g');\n underbarPrefix = new RegExp('^_');\n\n get() {\n return this.str;\n }\n\n applyRules(str, rules, skip, override) {\n if (override) {\n str = override;\n } else {\n var ignore = skip.indexOf(str.toLowerCase()) > -1;\n if (!ignore) {\n for (var x = 0; x < rules.length; x++) {\n if (str.match(rules[x][0])) {\n str = str.replace(rules[x][0], rules[x][1]);\n break;\n }\n }\n }\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.pluralize('person') -> 'people'\n String.pluralize('octopus') -> 'octopi'\n String.pluralize('Hat') -> 'Hats'\n String.pluralize('person', 'guys') -> 'guys' \n */\n pluralize(str, plural = null) {\n str = str || this.str;\n\n return this.applyRules(str, this.pluralRules, this.uncountableWords, plural);\n }\n\n /*\n String.singularize('person') -> 'person'\n String.singularize('octopi') -> 'octopus'\n String.singularize('hats') -> 'hat'\n String.singularize('guys', 'person') -> 'person'\n */\n singularize(str, singular) {\n str = str || this.str;\n\n return this.applyRules(str, this.singularRules, this.uncountableWords, singular);\n }\n\n /*\n String.camelize('message_properties') -> 'MessageProperties'\n String.camelize('message_properties', true) -> 'messageProperties'\n */\n camelize(str, lowFirstLetter) {\n str = str || this.str;\n\n let str_path = str.split('/');\n for (var i = 0; i < str_path.length; i++) {\n let str_arr = str_path[i].split('_');\n let initX = lowFirstLetter && i + 1 === str_path.length ? 1 : 0;\n\n for (let x = initX; x < str_arr.length; x++) {\n str_arr[x] = str_arr[x].charAt(0).toUpperCase() + str_arr[x].substring(1);\n }\n str_path[i] = str_arr.join('');\n }\n str = str_path.join('::');\n\n // fix\n if (lowFirstLetter === true) {\n let first = str.charAt(0).toLowerCase();\n let last = str.slice(1);\n str = first + last;\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.underscore('MessageProperties') -> 'message_properties'\n String.underscore('messageProperties') -> 'message_properties'\n */\n underscore(str) {\n str = str || this.str;\n\n var str_path = str.split('::');\n for (var i = 0; i < str_path.length; i++) {\n str_path[i] = str_path[i].replace(this.uppercase, '_$1');\n str_path[i] = str_path[i].replace(this.underbarPrefix, '');\n }\n str = str_path.join('/').toLowerCase();\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.humanize('message_properties') -> 'Message properties'\n String.humanize('message_properties') -> 'message properties'\n */\n humanize(str, lowFirstLetter) {\n str = str || this.str;\n\n var str = str.toLowerCase();\n str = str.replace(this.idSuffix, '');\n str = str.replace(this.underbar, ' ');\n if (!lowFirstLetter) {\n str = this.capitalize(str);\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.capitalize('message_properties') -> 'Message_properties'\n String.capitalize('message properties') -> 'Message properties'\n */\n capitalize(str) {\n str = str || this.str;\n\n str = str.toLowerCase();\n str = str.substring(0, 1).toUpperCase() + str.substring(1);\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.dasherize('message_properties') -> 'message-properties'\n String.dasherize('message properties') -> 'message-properties'\n */\n dasherize(str) {\n str = str || this.str;\n\n str = str.replace(this.spaceOrUnderbar, '-');\n str = str.toLowerCase();\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.normify('message_properties') -> 'Message Properties'\n String.normify('message properties') -> 'Message Properties'\n Inflactor.normify('Message_propertyId', true) -> 'Message Properties Id'\n */\n normify(str, allFirstUpper) {\n str = str || this.str;\n\n //var str = str.toLowerCase();\n if (allFirstUpper === true) {\n str = this.camelize(str);\n str = this.underscore(str);\n } else {\n str = str.toLowerCase();\n }\n\n str = str.replace(this.underbar, ' ');\n var str_arr = str.split(' ');\n for (var x = 0; x < str_arr.length; x++) {\n var d = str_arr[x].split('-');\n for (var i = 0; i < d.length; i++) {\n if (this.nonTitlecasedWords.indexOf(d[i].toLowerCase()) < 0) {\n d[i] = this.capitalize(d[i]);\n }\n }\n str_arr[x] = d.join('-');\n }\n str = str_arr.join(' ');\n str = str.substring(0, 1).toUpperCase() + str.substring(1);\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.demodulize('Message::Bus::Properties') -> 'Properties'\n */\n demodulize(str) {\n str = str || this.str;\n\n var str_arr = str.split('::');\n str = str_arr[str_arr.length - 1];\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.tableize('MessageBusProperty') -> 'message_bus_properties'\n */\n tableize(str) {\n str = str || this.str;\n\n str = this.pluralize(this.underscore(str));\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.classify('message_bus_properties') -> 'MessageBusProperty'\n */\n classify(str) {\n str = str || this.str;\n\n str = this.singularize(this.camelize(str));\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.foreignKey('MessageBusProperty') -> 'message_bus_property_id'\n String.foreignKey('MessageBusProperty', true) -> 'message_bus_propertyid'\n */\n foreignKey(str, dropIdUbar = false) {\n str = str || this.str;\n\n str = this.underscore(this.demodulize(str)) + (dropIdUbar ? '' : '_') + 'id';\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.ordinalize('the 1 pitch') -> 'the 1st pitch'\n */\n ordinalize(str) {\n str = str || this.str;\n\n var str_arr = str.split(' ');\n for (var x = 0; x < str_arr.length; x++) {\n var i = parseInt(str_arr[x]);\n if (i === NaN) {\n var ltd = str_arr[x].substring(str_arr[x].length - 2);\n var ld = str_arr[x].substring(str_arr[x].length - 1);\n var suf = 'th';\n if (ltd != '11' && ltd != '12' && ltd != '13') {\n if (ld === '1') {\n suf = 'st';\n } else if (ld === '2') {\n suf = 'nd';\n } else if (ld === '3') {\n suf = 'rd';\n }\n }\n str_arr[x] += suf;\n }\n }\n str = str_arr.join(' ');\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /**\n * @method invoke\n **/\n static invoke() {\n const argz = Object.values(arguments);\n const instance = new String(null, false);\n const method = arguments[0];\n argz.shift();\n\n if (typeof instance[method] === 'function') {\n return instance[method](...argz);\n }\n\n return null;\n }\n}\n\nconst pluralize = function() {\n const argz = ['pluralize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst singularize = function() {\n const argz = ['singularize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst humanize = function() {\n const argz = ['humanize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst underscore = function() {\n const argz = ['underscore', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst camelize = function() {\n const argz = ['camelize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst capitalize = function() {\n const argz = ['capitalize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst dasherize = function() {\n const argz = ['dasherize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst normify = function() {\n const argz = ['normify', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst demodulize = function() {\n const argz = ['demodulize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst tableize = function() {\n const argz = ['tableize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst classify = function() {\n const argz = ['classify', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst foreignKey = function() {\n const argz = ['foreignKey', ...arguments];\n\n return String.invoke(...argz);\n};\n\nexport {\n pluralize,\n singularize,\n humanize,\n underscore,\n camelize,\n capitalize,\n dasherize,\n normify,\n demodulize,\n tableize,\n classify,\n foreignKey\n}","import { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote } from './resources';\nimport { BrowserAdapter, NodeAdapter, EmberJsAdapter } from './adapters';\nimport { pluralize, singularize } from './utils/string';\n\nconst resources = {\n Contact,\n Driver,\n Entity,\n Order,\n Payload,\n Place,\n TrackingStatus,\n Vehicle,\n Vendor,\n Waypoint,\n Zone,\n ServiceArea,\n ServiceRate,\n ServiceQuote,\n};\n\nconst adapters = {\n BrowserAdapter,\n NodeAdapter,\n EmberJsAdapter,\n};\n\nclass Resolver {\n constructor() {\n this.resources = resources;\n this.adapters = adapters;\n\n return this.lookup(...arguments);\n }\n\n lookup(type, className) {\n const key = pluralize(type);\n const params = [...arguments].slice(2);\n\n if (!this[key]) {\n throw new Error('Attempted to resolve invalid type');\n }\n\n if (!this[key][className]) {\n throw new Error(`No ${singularize(type)} named ${className} to resolve`);\n }\n\n return new this[key][className](...params);\n }\n}\n\nconst lookup = function () {\n return new Resolver(...arguments);\n};\n\nexport { Resolver, lookup };\n","import { lookup } from './resolver';\nimport { pluralize, classify } from './utils/string';\nimport { isArray } from './utils/array';\nimport { Collection, detectAdapter, isResource, StoreActions } from './utils';\nimport { set, isCallable, invoke } from './utils/object';\n\nconst extendStoreActions = (store, actions = []) => {\n store.actions = isArray(actions) ? actions : [actions];\n\n if (isArray(actions)) {\n for (let i = 0; i < actions.length; i++) {\n const action = actions[i];\n\n store.extendActions(action);\n }\n return;\n }\n\n if (actions instanceof StoreActions) {\n actions.extend(store);\n }\n\n return store;\n};\n\nconst afterFetch = (store, json) => {\n if (typeof store.options.onAfterFetch === 'function') {\n store.options.onAfterFetch(json);\n }\n\n if (isArray(json)) {\n const serialized = [];\n\n for (let i = 0; i < json.length; i++) {\n serialized.push(store.afterFetch(json[i]));\n }\n\n return new Collection(...serialized);\n }\n\n const resourceInstance = store.serialize(json);\n return store.deposit(resourceInstance);\n};\n\nclass Store {\n constructor(resource, adapter, options = {}) {\n this.resource = resource;\n this.adapter = adapter || detectAdapter();\n this.namespace = pluralize(resource);\n this.storage = new Collection();\n this.options = options;\n this.extendActions(options.actions);\n }\n\n extendActions(actions = []) {\n return extendStoreActions(this, actions);\n }\n\n deposit(resourceInstance) {\n // this.storage[this.namespace].pushObject(resourceInstance);\n\n return resourceInstance;\n }\n\n serialize(json) {\n return lookup('resource', classify(this.resource), json, this.adapter);\n }\n\n afterFetch(json) {\n return afterFetch(this, json);\n }\n\n create(attributes = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.post(`${this.namespace}`, attributes, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n update(id, attributes = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.put(`${this.namespace}/${id}`, attributes, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n findRecord(id, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}/${id}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n findAll(options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n query(query = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, query, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n queryRecord(query = {}, options = {}) {\n query.single = true;\n\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, query, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n destroy(record, options = {}) {\n const id = isResource(record) ? record.getAttribute('id') : record;\n\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.delete(`${this.namespace}/${id}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n}\n\nexport default Store;\n\nexport { extendStoreActions, afterFetch };\n","import Store from './store';\nimport Resource from './resource';\nimport { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote } from './resources';\nimport { BrowserAdapter, NodeAdapter, EmberJsAdapter, Adapter } from './adapters';\nimport { isNodeEnvironment, detectAdapter, isLatitude, isLongitude, Point, isResource, GoogleAddress, Collection, StoreActions } from './utils';\nimport { pluralize, singularize, classify, dasherize, camelize } from './utils/string';\nimport { extendStoreActions } from './store';\nimport { orderActions } from './resources/order';\nimport { driverActions } from './resources/driver';\n\n/**\n * // instance\n * const fleetbase = new Fleetbase();\n *\n * const contact = fleetbase.contacts.create({\n * \t\tname: 'Ron',\n * \t\tphone: '+65 9999 8888'\n * });\n *\n * constact.update({ name: 'Hollywood Ron' });\n *\n * // export\n * import { Contact } from '@fleetbase/sdk';\n *\n * const contact = new Contact({\n * \t\tname: 'Ron',\n * \t\tphone: '+65 9999 8888'\n * });\n *\n * contact.save();\n */\n\nexport default class Fleetbase {\n /**\n * Builds an instance of the Fleetbase SDK\n *\n * @param {String} publicKey The public key issued\n * @param {Object} config The version of resource to access\n * @param {Boolean} debug Debug mode for SDK\n * @return {Fleetbase} Instance\n */\n constructor(publicKey, config = {}, debug = false) {\n this.version = config.version ?? 'v1';\n this.options = {\n version: this.version,\n host: config.host ?? 'https://api.fleetbase.io',\n namespace: config.namespace ?? this.version,\n debug,\n publicKey,\n };\n\n if (typeof publicKey !== 'string' || publicKey.length === 0) {\n throw new Error('⚠️ Invalid public key given to Fleetbase SDK');\n }\n\n if (!isNodeEnvironment() && publicKey.toLowerCase().startsWith('$')) {\n throw new Error('Secret key provided. You must use a public key with Fleetbase Javascript SDK!');\n }\n\n this.adapter = config.adapter || detectAdapter(this.options);\n\n this.orders = new Store('order', this.adapter).extendActions(orderActions);\n this.entities = new Store('entity', this.adapter);\n this.places = new Store('place', this.adapter);\n this.drivers = new Store('driver', this.adapter).extendActions(driverActions);\n this.vehicles = new Store('vehicle', this.adapter);\n this.vendors = new Store('vendor', this.adapter);\n this.contacts = new Store('contact', this.adapter);\n }\n\n static newInstance() {\n return new Fleetbase(...arguments);\n }\n\n setAdapter(adapter) {\n this.adapter = adapter;\n }\n\n getAdapter() {\n return this.adapter;\n }\n}\n\nexport {\n Store,\n Resource,\n Contact,\n Driver,\n Entity,\n Order,\n Payload,\n Place,\n TrackingStatus,\n Vehicle,\n Vendor,\n Waypoint,\n Zone,\n ServiceArea,\n ServiceRate,\n ServiceQuote,\n BrowserAdapter,\n NodeAdapter,\n EmberJsAdapter,\n Adapter,\n isNodeEnvironment,\n isLatitude,\n isLongitude,\n Point,\n isResource,\n GoogleAddress,\n Collection,\n StoreActions,\n extendStoreActions,\n pluralize,\n singularize,\n classify,\n dasherize,\n camelize,\n};\n"],"names":["isArray","Array","replace","array","start","deleteCount","items","length","splice","i","chunk","slice","isCollection","arr","identityFunction","item","mixed","Collection","objectAt","index","iter","key","value","arguments","Boolean","findIndex","predicate","startAt","len","find","callback","target","bind","undefined","any","every","cb","indexOf","val","withNaNCheck","insertAt","this","indexes","map","idx","_this2","object","methodName","args","ret","forEach","push","_item$methodName","filter","sortKeys","sort","a","b","propA","propB","compareValue","compare","seen","Set","getter","get","has","add","uniqBy","includes","removeAt","obj","objects","toArray","reverse","clear","loc","removeObject","pushObject","_this3","addObject","isEmpty","none","size","objectType","isBlank","test","isLatitude","coordinate","isFinite","Math","abs","isLongitude","isResource","record","Resource","isPhone","phone","isNodeEnvironment","process","_typeof","_process","env","release","name","search","window","navigator","product","detectAdapter","options","lookup","GoogleAddress","place","geometry","components","parseComponents","attributes","parseProperties","address_components","reduce","acc","data","types","type","streetNumber","streetName","coordinates","location","Object","values","city","or","county","stateShort","stateLong","countryShort","country","countryLong","postalCode","address","join","keys","pkey","short","short_name","long_name","Point","latitude","longitude","coorindates","lat","lng","serialize","json","getResolved","func","path","resolved","current","isObject","isFunction","pathArray","split","newPath","set","iterations","StoreActions","actions","bindTo","binding","action","fn","adapter","resource","dirtyAttributes","changes","isLoading","isSaving","isDestroying","isReloading","version","setAdapter","store","Store","onAfterFetch","syncAttributes","_this$options","getAttribute","mergeAttributes","setFlags","create","then","response","_this","update","id","destroy","findRecord","_this4","reset","flags","state","validFlags","flag","Error","attribues","getAttributes","onlyDirty","savedirty","dirtyAttributeKeys","isAttributeFilled","Date","hasAttributes","isNew","isLoaded","property","_this5","call","setAttributes","previousValue","changedAt","setAttribute","attribute","defaultValue","properties","attributeKeys","prop","hasAttribute","_this6","_value","_value2","modelAttributes","orderActions","getDistanceAndTime","params","namespace","getNextActivity","dispatch","post","afterFetch","updateActivity","setDestination","destinationId","captureQrCode","subjectId","captureSignature","complete","cancel","Order","isStarted","isCanceled","isCompleted","Payload","entity","waypoints","Entity","Place","_this$getAttribute","_this$getAttribute2","owner","googleAddress","street1","street2","province","postal_code","neighborhood","district","building","security_access_code","Waypoint","TrackingStatus","Vehicle","driverActions","login","identity","password","verifyCode","code","track","retrieve","syncDevice","Driver","Vendor","Contact","Zone","ServiceArea","ServiceRate","ServiceQuote","Adapter","config","host","headers","BrowserAdapter","setHeaders","Authorization","publicKey","Promise","resolve","reject","statusText","status","ok","method","fetch","url","mode","Headers","parseJSON","errors","error","query","urlParams","URLSearchParams","toString","request","body","JSON","stringify","NodeAdapter","axios","baseURL","commonHeaders","defaults","common","transform","handleError","put","patch","EmberJsAdapter","String","string","chain","RegExp","str","rules","skip","override","toLowerCase","x","match","plural","applyRules","pluralRules","uncountableWords","singular","singularRules","lowFirstLetter","str_path","str_arr","charAt","toUpperCase","substring","first","last","uppercase","underbarPrefix","idSuffix","underbar","capitalize","spaceOrUnderbar","allFirstUpper","camelize","underscore","d","nonTitlecasedWords","pluralize","singularize","dropIdUbar","demodulize","NaN","parseInt","ltd","ld","suf","argz","instance","shift","invoke","dasherize","classify","resources","adapters","Resolver","className","extendStoreActions","extend","extendActions","storage","resourceInstance","serialized","deposit","single","_this7","Fleetbase","debug","startsWith","orders","entities","places","drivers","vehicles","vendors","contacts"],"mappings":"skJAAA,IAAQA,EAAYC,MAAZD,yDCWFE,EAAU,SAACC,EAAOC,EAAOC,OAAaC,yDAAQ,MAC5CN,EAAQG,MACJG,EAAMC,QANC,IAOPJ,EAAMK,aAANL,GAAaC,EAAOC,YAAgBC,SACjC,CACHH,EAAMK,OAAOJ,EAAOC,OAEf,IAAII,EAAI,EAAGA,EAAIH,EAAMC,OAAQE,GAX3B,IAW4C,KAC3CC,EAAQJ,EAAMK,MAAMF,EAAGA,EAZxB,KAaHN,EAAMK,aAANL,GAAaC,EAAQK,EAAG,YAAMC,WAG/BE,EAAaC,MACpBV,EAAMD,QAAQE,EAAOC,EAAaC,IAIpCQ,EAAmB,SAACC,UAASA,GAkB7BH,EAAe,SAACI,UAAUA,aAAiBC,GAE3CC,EAAW,SAACf,EAAOgB,UACjBnB,EAAQG,GACDA,EAAMgB,GACNP,EAAaT,GACbA,EAAMe,SAASC,GAGnB,MAGLC,EAAO,SAACC,EAAKC,UAC0B,IAArBC,EAAUhB,OACP,SAACQ,UAASO,IAAUP,EAAKM,IAAO,SAACN,UAASS,QAAQT,EAAKM,MAG5EI,EAAY,SAACtB,EAAOuB,WAAWC,yDAAU,EACvCC,EAAMzB,EAAMI,OACPY,EAAQQ,EAASR,EAAQS,EAAKT,IAAS,KACxCJ,EAAOG,EAASf,EAAOgB,MACvBO,EAAUX,EAAMI,EAAOhB,UAChBgB,SAGP,GAGNU,EAAO,SAAC1B,EAAO2B,EAAUC,OACvBL,EAAYI,EAASE,KAAKD,GAC1BZ,EAAQM,EAAUtB,EAAOuB,EAAW,UACtB,IAAXP,OAAec,EAAYf,EAASf,EAAOgB,IAGhDe,EAAM,SAAC/B,EAAO2B,EAAUC,OACtBL,EAAYI,EAASE,KAAKD,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nG,cAAQgB,yDAAU,GAChBsF,EAAKvG,EAAWC,GAAUA,EAAO8F,aAAa,MAAQ9F,SAErD,IAAI2M,oDAAQ,WAAOC,EAASC,yGACR8F,EAAK5N,yBAAkB4N,EAAK7J,sBAAaxC,GAAM,GAAItF,GAASkF,KAAKyM,EAAKzJ,WAAWhN,KAAKyW,UAAa9F,UAApH1G,SAENyG,EAAQzG,gHChGCyM,yBASLlG,aAAWN,yDAAS,GAAIyG,4EAC3BtN,kBAAU6G,EAAO7G,uBAAW,UAC5BvE,QAAU,CACXuE,QAAS5I,KAAK4I,QACd8G,eAAMD,EAAOC,oBAAQ,2BACrBvD,oBAAWsD,EAAOtD,yBAAanM,KAAK4I,QACpCsN,MAAAA,EACAnG,UAAAA,GAGqB,iBAAdA,GAA+C,IAArBA,EAAUjS,aACrC,IAAIsM,MAAM,oDAGf3G,KAAuBsM,EAAU0C,cAAc0D,WAAW,WACrD,IAAI/L,MAAM,sFAGfhC,QAAUqH,EAAOrH,SAAWhE,EAAcpE,KAAKqE,cAE/C+R,OAAS,IAAIrN,GAAM,QAAS/I,KAAKoI,SAASsN,cAAc1J,QACxDqK,SAAW,IAAItN,GAAM,SAAU/I,KAAKoI,cACpCkO,OAAS,IAAIvN,GAAM,QAAS/I,KAAKoI,cACjCmO,QAAU,IAAIxN,GAAM,SAAU/I,KAAKoI,SAASsN,cAAclH,SAC1DgI,SAAW,IAAIzN,GAAM,UAAW/I,KAAKoI,cACrCqO,QAAU,IAAI1N,GAAM,SAAU/I,KAAKoI,cACnCsO,SAAW,IAAI3N,GAAM,UAAW/I,KAAKoI,6CAO9C,SAAWA,QACFA,QAAUA,4BAGnB,kBACWpI,KAAKoI,qCAThB,oBACe6N,6BAAanX"} \ No newline at end of file diff --git a/package.json b/package.json index ade7aeb..a425b78 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fleetbase/sdk", - "version": "1.2.4", + "version": "1.2.5", "description": "Fleetbase JS & Node SDK", "main": "dist/cjs/fleetbase.js", "module": "dist/esm/fleetbase.js", diff --git a/src/resources/driver.js b/src/resources/driver.js index 97edb48..ab90486 100644 --- a/src/resources/driver.js +++ b/src/resources/driver.js @@ -28,8 +28,8 @@ const driverActions = new StoreActions({ return this.findRecord(id); }, - syncDevice(token) { - return this.adapter.setHeaders({ 'Driver-Token': this.token }).post('drivers/register-device', token); + syncDevice(id, params = {}, options = {}) { + return this.adapter.post(`drivers/${id}/register-device`, params, options); }, }); @@ -38,6 +38,14 @@ class Driver extends Resource { super(attributes, adapter, 'driver', { actions: driverActions, ...options }); } + get token() { + return this.getAttribute('token'); + } + + get isOnline() { + return this.getAttribute('online') === true; + } + /** * The latitude coordinate for the 'Place' location. * @@ -79,8 +87,8 @@ class Driver extends Resource { return this.store.track(this.id, params, options); } - syncDevice(token) { - return this.store.syncDevice(token); + syncDevice(params = {}, options = {}) { + return this.store.syncDevice(this.id, params, options); } }