From d079d6d17670078a3c9b1686fe94a63cbe45eb77 Mon Sep 17 00:00:00 2001 From: Doljinsuren Enkhbayar Date: Tue, 30 Jan 2024 13:44:05 +0800 Subject: [PATCH] changed request params --- dist/@fleetbase/sdk.min.js | 2 +- dist/@fleetbase/sdk.min.js.map | 2 +- dist/cjs/fleetbase.js | 2 +- dist/cjs/fleetbase.js.map | 2 +- dist/esm/fleetbase.js | 2 +- dist/esm/fleetbase.js.map | 2 +- package.json | 7 +++++-- src/resources/driver.js | 18 +++++++++++++++--- 8 files changed, 26 insertions(+), 11 deletions(-) diff --git a/dist/@fleetbase/sdk.min.js b/dist/@fleetbase/sdk.min.js index 03ce4bf..765fa50 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")):"function"==typeof define&&define.amd?define(["exports","axios"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@fleetbase/sdk"]={},t.axios)}(this,(function(t,e){"use strict";function n(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 r(t){for(var e=1;e=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:L(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function o(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function s(t,e,n,r,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,i)}function u(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){s(o,r,i,a,u,"next",t)}function u(t){s(o,r,i,a,u,"throw",t)}a(void 0)}))}}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}var O=Array.isArray,$=void 0===arguments?void 0:arguments,R=6e4,S=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(O(t))if(r.length<=R)t.splice.apply(t,[e,n].concat(A(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;return n<0&&(n+=i),F(t,r&&e!=e?function(t){return t!=t}:function(t){return t===e},n)},N=function(t,e,n){return S(t,e,0,[n]),n},T=function(t){f(n,t);var e=w(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 L(this,0)}},{key:"last",get:function(){return L(this,this.length-1)}},{key:"replace",value:function(t,e){return S(this,t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:[]),this}},{key:"objectsAt",value:function(t){var e=this;return t.map((function(t){return L(e,t)}))}},{key:"objectAt",value:function(t){return L(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 r=e;r>=0;r--)if(L(this,r)===t)return r;return-1}},{key:"includes",value:function(t,e){return-1!==D(this,t,e,!0)}},{key:"findBy",value:function(){return t=this,e=z.apply(void 0,arguments),r=e.bind(n),-1===(i=F(t,r,0))?void 0:L(t,i);var t,e,n,r,i}},{key:"findIndexBy",value:function(){return F(this,z.apply(void 0,arguments))}},{key:"isEvery",value:function(){return t=this,e=z.apply(void 0,arguments),r=e.bind(n),-1===F(t,(function(t,e,n){return!r(t,e,n)}),0);var t,e,n,r}},{key:"isAny",value:function(){return t=this,e=z.apply(void 0,arguments),r=e.bind(n),-1!==F(t,r,0);var t,e,n,r}},{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]:_,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 N(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 S(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=L(this,t-1);return this.removeAt(t-1,1),e}},{key:"shiftObject",value:function(){if(0===this.length)return null;var t=L(this,0);return this.removeAt(0),t}},{key:"unshiftObject",value:function(t){return N(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;){L(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}(b(Array)),C=function(t){var e=null==t;if(e)return e;if("number"==typeof t.size)return!t.size;var n=a(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 C(t)||"string"==typeof t&&!1===/\S/.test(t)};function I(t){return t instanceof V}var B=function(){var t,e,n;return!("undefined"==typeof process||"object"!==a(null===(t=process)||void 0===t?void 0:t.env)&&-1===(null===(e=process.release)||void 0===e||null===(e=e.name)||void 0===e?void 0:e.search(/node|io.js/))||"undefined"!=typeof window&&"ReactNative"!==(null===(n=window)||void 0===n||null===(n=n.navigator)||void 0===n?void 0:n.product))},G=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return B()?Ot("adapter","NodeAdapter",t):Ot("adapter","BrowserAdapter",t)},U=Array.isArray,J=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(){var t,e=j(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]);try{for(e.s();!(t=e.n()).done;){var n=t.value;if(U(n)){var r=n[0],i=n[1];if(this.has(r))return this.get(r,i)}else if(this.has(n))return this.get(n)}}catch(t){e.e(t)}finally{e.f()}return null}},{key:"has",value:function(t){return t in this.components}},{key:"get",value:function(t){var e=arguments.length>1&&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=r(r({},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}(),W=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=k(e.coordinates,2),r=n[0];return new t(n[1],r)}}]),t}(),K=function(t,e){var n=t();return Array.isArray(n)||"object"===a(n)?M(n,e):null},M=function t(e,n){var r,i=e,o=a(e),s="object"===o,u="function"===o,c=Array.isArray(e),h="string"===a(n)&&n.includes(".")?n.split("."):[n];if(c||s){for(var l=0;l0&&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)||this.bind;if(!t)return this;if(null!=this&&this.actions&&"object"===a(this.actions))for(var e in this.actions){var n=this.actions[e];"function"==typeof n?H(t,e,n.bind(t)):H(t,e,n)}return this}}]),t}(),V=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]:{};c(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 l(t,[{key:"setAdapter",value:function(t){var e;return this.adapter=t,this.store=new Rt(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 C(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"===a(t))return this.setAttributes(t);var r=null!==(e=null==this?void 0:this.attributes[t])&&void 0!==e?e:null;return H(this.attributes,t,n),H(this.dirtyAttributes,t,r),O(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=M(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(O(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 O(t)?this.hasAttribute(t)&&t.every((function(t){return!C(e.getAttribute(t))})):this.hasAttribute(t)&&!C(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(!O(t))throw new Error("No attribute properties provided!");var n,r=j(t);try{for(r.s();!(n=r.n()).done;){var i,o,s=n.value;if("string"==typeof s){var u=this.getAttribute(s);"object"!==a(null===(i=u)||void 0===i?void 0:i.attributes)||O(null===(o=u)||void 0===o?void 0:o.attributes)||(u=u.attributes),e[s]=u}}}catch(t){r.e(t)}finally{r.f()}return e}},{key:"serialize",value:function(){return this.getAttributes()}},{key:"mergeAttributes",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=null!==(t=null==this?void 0:this.attributes)&&void 0!==t?t:{};return this.attributes=r(r({},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 Q({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 I(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 I(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 I(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))}}),Z=function(t){f(n,t);var e=w(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"order",r({actions:Y},o))}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}(V),X=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"payload",i)}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 T(this.waypoints)}}]),n}(V),tt=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"entity",i)}return l(n)}(V),et=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"place",i)}return l(n,[{key:"latitude",get:function(){var t;return null===(t=this.getAttribute("location",new W))||void 0===t?void 0:t.coordinates[1]}},{key:"longitude",get:function(){var t;return null===(t=this.getAttribute("location",new W))||void 0===t?void 0:t.coordinates[0]}},{key:"coordinates",get:function(){return[this.latitude,this.longitude]}},{key:"setOwner",value:function(t){return I(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=k(t.getAttribute("coordinates"),2),o=i[0],a=i[1];return new n({name:null,address:t.getAttribute("address"),location:new W(o,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},e,r)}}]),n}(V),nt=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"waypoint",i)}return l(n)}(et),rt=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"tracking-status",i)}return l(n)}(V),it=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"vehicle",i)}return l(n)}(V),ot=new Q({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(function(){return/^[+]?[\s./0-9]*[(]?[0-9]{1,4}[)]?[-\s./0-9]*$/g.test(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")}(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",r({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",r({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))},listOrganizations: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,"/list-organizations"),e,n).then(this.afterFetch.bind(this))},switchOrganization: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,"/switch-organization"),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){f(n,t);var e=w(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"driver",r({actions:ot},o))}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)}},{key:"listOrganizations",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.listOrganizations(this.id,t,e)}},{key:"switchOrganization",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.switchOrganization(this.id,{next:t},e)}}]),n}(V),st=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"vendor",i)}return l(n)}(V),ut=new Q({current:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.adapter.get("".concat(this.namespace,"/current"),t,e)}}),ct=function(t){f(n,t);var e=w(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"organization",r({actions:ut},o))}return l(n)}(V),ht=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"contact",i)}return l(n)}(V),lt=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"zone",i)}return l(n)}(V),vt=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"service-area",i)}return l(n)}(V),ft=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"service-rate",i)}return l(n)}(V),dt=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"service-quote",i)}return l(n,[{key:"fromPreliminary",value:function(){}},{key:"fromPayload",value:function(){}}]),n}(V),pt=l((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||{}})),gt=function(t){f(n,t);var e=w(n);function n(t){var r;return c(this,n),(r=e.call(this,t)).setHeaders({Authorization:"Bearer ".concat(t.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;browser"}),r}return l(n,[{key:"setHeaders",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.headers=r(r({},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]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise((function(a,s){return fetch(o.url||"".concat(e.host,"/").concat(e.namespace,"/").concat(t),r({method:n,mode:o.mode||"cors",headers:new Headers(r(r({},e.headers||{}),o.headers||{}))},i)).then(e.parseJSON).then((function(t){return t.ok?a(t.json):s(new Error(t.json.errors?t.json.errors[0]:t.statusText))})).catch((function(t){s(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),yt=function(t){f(i,t);var n=w(i);function i(t){var r;return c(this,i),(r=n.call(this,t)).axios=e.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(i,[{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=r(r({},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(O(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))}}]),i}(pt),bt=function(t){f(n,t);var e=w(n);function n(){return c(this,n),e.apply(this,arguments)}return l(n)}(pt),mt=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,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=O(e)?e:[e],!O(e))return e instanceof Q&&e.extend(t),t;var n,r=j(e);try{for(r.s();!(n=r.n()).done;){var i=n.value;t.extendActions(i)}}catch(t){r.e(t)}finally{r.f()}},Rt=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};c(this,t),this.resource=e,this.adapter=n||G(),this.namespace=wt(e),this.storage=new T,this.options=r,this.extendActions(r.actions)}return l(t,[{key:"extendActions",value:function(){return $t(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:[])}},{key:"deposit",value:function(t){return t}},{key:"serialize",value:function(t){return Ot("resource",At(this.resource),t,this.adapter)}},{key:"afterFetch",value:function(t){return function(t,e){if("function"==typeof t.options.onAfterFetch&&t.options.onAfterFetch(e),O(e)){var n,r=[],i=j(e);try{for(i.s();!(n=i.n()).done;){var o=n.value;r.push(t.afterFetch(o))}}catch(t){i.e(t)}finally{i.f()}return y(T,r)}var a=t.serialize(e);return t.deposit(a)}(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 r=u(i().mark((function r(o,a){var s;return i().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(a);case 2:s=r.sent,o(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 o=u(i().mark((function o(a,s){var u;return i().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:u=i.sent,a(u);case 4:case"end":return i.stop()}}),o)})));return function(t,e){return o.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=u(i().mark((function r(o,a){var s;return i().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(a);case 2:s=r.sent,o(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=u(i().mark((function n(r,o){var a;return i().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(o);case 2:a=n.sent,r(a);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=u(i().mark((function r(o,a){var s;return i().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(a);case 2:s=r.sent,o(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=u(i().mark((function r(o,a){var s;return i().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(a);case 2:s=r.sent,o(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=I(t)?t.getAttribute("id"):t;return new Promise(function(){var t=u(i().mark((function t(o,a){var s;return i().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(a);case 2:s=t.sent,o(s);case 4:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}())}}]),t}(),St=function(){function t(e){var n,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=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!==(r=o.host)&&void 0!==r?r:"https://api.fleetbase.io",namespace:null!==(i=o.namespace)&&void 0!==i?i:this.version,debug:a,publicKey:e},"string"!=typeof e||0===e.length)throw new Error("⚠️ Invalid public key given to Fleetbase SDK");if(!B()&&e.toLowerCase().startsWith("$"))throw new Error("Secret key provided. You must use a public key with Fleetbase Javascript SDK!");this.adapter=o.adapter||G(this.options),this.orders=new Rt("order",this.adapter).extendActions(Y),this.entities=new Rt("entity",this.adapter),this.places=new Rt("place",this.adapter),this.drivers=new Rt("driver",this.adapter).extendActions(ot),this.vehicles=new Rt("vehicle",this.adapter),this.vendors=new Rt("vendor",this.adapter),this.contacts=new Rt("contact",this.adapter),this.organizations=new Rt("organization",this.adapter).extendActions(ut)}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=pt,t.BrowserAdapter=gt,t.Collection=T,t.Contact=ht,t.Driver=at,t.EmberJsAdapter=bt,t.Entity=tt,t.GoogleAddress=J,t.NodeAdapter=yt,t.Order=Z,t.Organization=ct,t.Payload=X,t.Place=et,t.Point=W,t.Resource=V,t.ServiceArea=vt,t.ServiceQuote=dt,t.ServiceRate=ft,t.Store=Rt,t.StoreActions=Q,t.TrackingStatus=rt,t.Vehicle=it,t.Vendor=st,t.Waypoint=nt,t.Zone=lt,t.camelize=function(){var t=["camelize"].concat(Array.prototype.slice.call(arguments));return mt.invoke.apply(mt,A(t))},t.classify=At,t.dasherize=function(){var t=["dasherize"].concat(Array.prototype.slice.call(arguments));return mt.invoke.apply(mt,A(t))},t.default=St,t.extendStoreActions=$t,t.isLatitude=function(t){return isFinite(t)&&Math.abs(t)<=90},t.isLongitude=function(t){return isFinite(t)&&Math.abs(t)<=180&&Math.abs(t)>=90},t.isNodeEnvironment=B,t.isResource=I,t.pluralize=wt,t.singularize=kt})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("axios")):"function"==typeof define&&define.amd?define(["exports","axios"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@fleetbase/sdk"]={},t.axios)}(this,(function(t,e){"use strict";function n(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 r(t){for(var e=1;e=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:L(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function o(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function s(t,e,n,r,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,i)}function u(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){s(o,r,i,a,u,"next",t)}function u(t){s(o,r,i,a,u,"throw",t)}a(void 0)}))}}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}var O=Array.isArray,$=void 0===arguments?void 0:arguments,R=6e4,S=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(O(t))if(r.length<=R)t.splice.apply(t,[e,n].concat(A(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;return n<0&&(n+=i),F(t,r&&e!=e?function(t){return t!=t}:function(t){return t===e},n)},N=function(t,e,n){return S(t,e,0,[n]),n},T=function(t){f(n,t);var e=w(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 L(this,0)}},{key:"last",get:function(){return L(this,this.length-1)}},{key:"replace",value:function(t,e){return S(this,t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:[]),this}},{key:"objectsAt",value:function(t){var e=this;return t.map((function(t){return L(e,t)}))}},{key:"objectAt",value:function(t){return L(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 r=e;r>=0;r--)if(L(this,r)===t)return r;return-1}},{key:"includes",value:function(t,e){return-1!==D(this,t,e,!0)}},{key:"findBy",value:function(){return t=this,e=z.apply(void 0,arguments),r=e.bind(n),-1===(i=F(t,r,0))?void 0:L(t,i);var t,e,n,r,i}},{key:"findIndexBy",value:function(){return F(this,z.apply(void 0,arguments))}},{key:"isEvery",value:function(){return t=this,e=z.apply(void 0,arguments),r=e.bind(n),-1===F(t,(function(t,e,n){return!r(t,e,n)}),0);var t,e,n,r}},{key:"isAny",value:function(){return t=this,e=z.apply(void 0,arguments),r=e.bind(n),-1!==F(t,r,0);var t,e,n,r}},{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]:_,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 N(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 S(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=L(this,t-1);return this.removeAt(t-1,1),e}},{key:"shiftObject",value:function(){if(0===this.length)return null;var t=L(this,0);return this.removeAt(0),t}},{key:"unshiftObject",value:function(t){return N(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;){L(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}(b(Array)),C=function(t){var e=null==t;if(e)return e;if("number"==typeof t.size)return!t.size;var n=a(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 C(t)||"string"==typeof t&&!1===/\S/.test(t)};function I(t){return t instanceof V}var B=function(){var t,e,n;return!("undefined"==typeof process||"object"!==a(null===(t=process)||void 0===t?void 0:t.env)&&-1===(null===(e=process.release)||void 0===e||null===(e=e.name)||void 0===e?void 0:e.search(/node|io.js/))||"undefined"!=typeof window&&"ReactNative"!==(null===(n=window)||void 0===n||null===(n=n.navigator)||void 0===n?void 0:n.product))},G=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return B()?$t("adapter","NodeAdapter",t):$t("adapter","BrowserAdapter",t)},U=Array.isArray,J=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(){var t,e=j(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]);try{for(e.s();!(t=e.n()).done;){var n=t.value;if(U(n)){var r=n[0],i=n[1];if(this.has(r))return this.get(r,i)}else if(this.has(n))return this.get(n)}}catch(t){e.e(t)}finally{e.f()}return null}},{key:"has",value:function(t){return t in this.components}},{key:"get",value:function(t){var e=arguments.length>1&&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=r(r({},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}(),W=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=k(e.coordinates,2),r=n[0];return new t(n[1],r)}}]),t}(),K=function(t,e){var n=t();return Array.isArray(n)||"object"===a(n)?M(n,e):null},M=function t(e,n){var r,i=e,o=a(e),s="object"===o,u="function"===o,c=Array.isArray(e),h="string"===a(n)&&n.includes(".")?n.split("."):[n];if(c||s){for(var l=0;l0&&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)||this.bind;if(!t)return this;if(null!=this&&this.actions&&"object"===a(this.actions))for(var e in this.actions){var n=this.actions[e];"function"==typeof n?H(t,e,n.bind(t)):H(t,e,n)}return this}}]),t}(),V=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]:{};c(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 l(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"],r=0;r0&&void 0!==arguments[0]?arguments[0]:{},e=this.getAttributes();return C(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"===a(t))return this.setAttributes(t);var r=null!==(e=null==this?void 0:this.attributes[t])&&void 0!==e?e:null;return H(this.attributes,t,n),H(this.dirtyAttributes,t,r),O(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=M(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(O(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 O(t)?this.hasAttribute(t)&&t.every((function(t){return!C(e.getAttribute(t))})):this.hasAttribute(t)&&!C(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(!O(t))throw new Error("No attribute properties provided!");var n,r=j(t);try{for(r.s();!(n=r.n()).done;){var i,o,s=n.value;if("string"==typeof s){var u=this.getAttribute(s);"object"!==a(null===(i=u)||void 0===i?void 0:i.attributes)||O(null===(o=u)||void 0===o?void 0:o.attributes)||(u=u.attributes),e[s]=u}}}catch(t){r.e(t)}finally{r.f()}return e}},{key:"serialize",value:function(){return this.getAttributes()}},{key:"mergeAttributes",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=null!==(t=null==this?void 0:this.attributes)&&void 0!==t?t:{};return this.attributes=r(r({},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 Q({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 I(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 I(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 I(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))}}),Z=function(t){f(n,t);var e=w(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"order",r({actions:Y},o))}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}(V),X=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"payload",i)}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 T(this.waypoints)}}]),n}(V),tt=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"entity",i)}return l(n)}(V),et=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"place",i)}return l(n,[{key:"latitude",get:function(){var t;return null===(t=this.getAttribute("location",new W))||void 0===t?void 0:t.coordinates[1]}},{key:"longitude",get:function(){var t;return null===(t=this.getAttribute("location",new W))||void 0===t?void 0:t.coordinates[0]}},{key:"coordinates",get:function(){return[this.latitude,this.longitude]}},{key:"setOwner",value:function(t){return I(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=k(t.getAttribute("coordinates"),2),o=i[0],a=i[1];return new n({name:null,address:t.getAttribute("address"),location:new W(o,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},e,r)}}]),n}(V),nt=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"waypoint",i)}return l(n)}(et),rt=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"tracking-status",i)}return l(n)}(V),it=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"vehicle",i)}return l(n)}(V),ot=new Q({current:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.adapter.get("".concat(this.namespace,"/current"),t,e)}}),at=function(t){f(n,t);var e=w(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"organization",r({actions:ot},o))}return l(n)}(V),st=function(t,e){return O(t)?t.map((function(t){return new at(t,e)})):new at(t,e)},ut=new Q({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(function(){return/^[+]?[\s./0-9]*[(]?[0-9]{1,4}[)]?[-\s./0-9]*$/g.test(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")}(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",r({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",r({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))},listOrganizations: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 this.adapter.get("drivers/".concat(t,"/organizations"),n,r).then((function(t){return st(t,e.adapter)}))},switchOrganization: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 this.adapter.post("drivers/".concat(t,"/switch-organization"),n,r).then((function(t){return st(t,e.adapter)}))},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)}}),ct=function(t){f(n,t);var e=w(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(this,n),e.call(this,t,i,"driver",r({actions:ut},o))}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)}},{key:"listOrganizations",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.listOrganizations(this.id,t,e)}},{key:"switchOrganization",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.switchOrganization(this.id,{next:t},e)}}]),n}(V),ht=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"vendor",i)}return l(n)}(V),lt=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"contact",i)}return l(n)}(V),vt=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"zone",i)}return l(n)}(V),ft=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"service-area",i)}return l(n)}(V),dt=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"service-rate",i)}return l(n)}(V),pt=function(t){f(n,t);var e=w(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 c(this,n),e.call(this,t,r,"service-quote",i)}return l(n,[{key:"fromPreliminary",value:function(){}},{key:"fromPayload",value:function(){}}]),n}(V),gt=l((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||{}})),yt=function(t){f(n,t);var e=w(n);function n(t){var r;return c(this,n),(r=e.call(this,t)).setHeaders({Authorization:"Bearer ".concat(t.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;browser"}),r}return l(n,[{key:"setHeaders",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.headers=r(r({},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]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise((function(a,s){return fetch(o.url||"".concat(e.host,"/").concat(e.namespace,"/").concat(t),r({method:n,mode:o.mode||"cors",headers:new Headers(r(r({},e.headers||{}),o.headers||{}))},i)).then(e.parseJSON).then((function(t){return t.ok?a(t.json):s(new Error(t.json.errors?t.json.errors[0]:t.statusText))})).catch((function(t){s(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}(gt),bt=function(t){f(i,t);var n=w(i);function i(t){var r;return c(this,i),(r=n.call(this,t)).axios=e.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(i,[{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=r(r({},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(O(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))}}]),i}(gt),mt=function(t){f(n,t);var e=w(n);function n(){return c(this,n),e.apply(this,arguments)}return l(n)}(gt),wt=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,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=O(e)?e:[e],!O(e))return e instanceof Q&&e.extend(t),t;var n,r=j(e);try{for(r.s();!(n=r.n()).done;){var i=n.value;t.extendActions(i)}}catch(t){r.e(t)}finally{r.f()}},St=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};c(this,t),this.resource=e,this.adapter=n||G(),this.namespace=kt(e),this.storage=new T,this.options=r,this.extendActions(r.actions)}return l(t,[{key:"extendActions",value:function(){return Rt(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:[])}},{key:"deposit",value:function(t){return t}},{key:"serialize",value:function(t){return $t("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),O(e)){var n,r=[],i=j(e);try{for(i.s();!(n=i.n()).done;){var o=n.value;r.push(t.afterFetch(o))}}catch(t){i.e(t)}finally{i.f()}return y(T,r)}var a=t.serialize(e);return t.deposit(a)}(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 r=u(i().mark((function r(o,a){var s;return i().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(a);case 2:s=r.sent,o(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 o=u(i().mark((function o(a,s){var u;return i().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:u=i.sent,a(u);case 4:case"end":return i.stop()}}),o)})));return function(t,e){return o.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=u(i().mark((function r(o,a){var s;return i().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(a);case 2:s=r.sent,o(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=u(i().mark((function n(r,o){var a;return i().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(o);case 2:a=n.sent,r(a);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=u(i().mark((function r(o,a){var s;return i().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(a);case 2:s=r.sent,o(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=u(i().mark((function r(o,a){var s;return i().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(a);case 2:s=r.sent,o(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=I(t)?t.getAttribute("id"):t;return new Promise(function(){var t=u(i().mark((function t(o,a){var s;return i().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(a);case 2:s=t.sent,o(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,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=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!==(r=o.host)&&void 0!==r?r:"https://api.fleetbase.io",namespace:null!==(i=o.namespace)&&void 0!==i?i:this.version,debug:a,publicKey:e},"string"!=typeof e||0===e.length)throw new Error("⚠️ Invalid public key given to Fleetbase SDK");if(!B()&&e.toLowerCase().startsWith("$"))throw new Error("Secret key provided. You must use a public key with Fleetbase Javascript SDK!");this.adapter=o.adapter||G(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(ut),this.vehicles=new St("vehicle",this.adapter),this.vendors=new St("vendor",this.adapter),this.contacts=new St("contact",this.adapter),this.organizations=new St("organization",this.adapter).extendActions(ot)}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=gt,t.BrowserAdapter=yt,t.Collection=T,t.Contact=lt,t.Driver=ct,t.EmberJsAdapter=mt,t.Entity=tt,t.GoogleAddress=J,t.NodeAdapter=bt,t.Order=Z,t.Organization=at,t.Payload=X,t.Place=et,t.Point=W,t.Resource=V,t.ServiceArea=ft,t.ServiceQuote=pt,t.ServiceRate=dt,t.Store=St,t.StoreActions=Q,t.TrackingStatus=rt,t.Vehicle=it,t.Vendor=ht,t.Waypoint=nt,t.Zone=vt,t.camelize=function(){var t=["camelize"].concat(Array.prototype.slice.call(arguments));return wt.invoke.apply(wt,A(t))},t.classify=xt,t.dasherize=function(){var t=["dasherize"].concat(Array.prototype.slice.call(arguments));return wt.invoke.apply(wt,A(t))},t.default=_t,t.extendStoreActions=Rt,t.isLatitude=function(t){return isFinite(t)&&Math.abs(t)<=90},t.isLongitude=function(t){return isFinite(t)&&Math.abs(t)<=180&&Math.abs(t)>=90},t.isNodeEnvironment=B,t.isResource=I,t.pluralize=kt,t.singularize=At})); //# sourceMappingURL=sdk.min.js.map diff --git a/dist/@fleetbase/sdk.min.js.map b/dist/@fleetbase/sdk.min.js.map index f2b47c0..e40623b 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-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/organization.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 { isArray };\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 (const element of sortKeys) {\n let key = element;\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","/**\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 (\n typeof process !== 'undefined' &&\n (typeof process?.env === 'object' || process.release?.name?.search(/node|io.js/) !== -1) &&\n (typeof window === 'undefined' || window?.navigator?.product === 'ReactNative')\n );\n};\n\nexport default isNodeEnvironment;\n","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;\n","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 (const element of keys) {\n const key = element;\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 const [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}\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 (const element of classes) {\n for (const property in element) {\n if (Object.prototype.hasOwnProperty.call(element, property)) {\n target[property] = element[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 // 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 (const element of properties) {\n const property = element;\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';\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 constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'payload', options);\n }\n\n /**\n * Attaches an entity to an existing payload and returns\n * the payload with the entity attached\n *\n * @param {[type]} Entity entity [description]\n * @return {[type]} [description]\n */\n attach(entity) {\n // perform op return payload\n }\n\n /**\n * Returns all of the entities attached to this payload\n *\n * @return {[type]} [description]\n */\n get entities() {}\n\n /**\n * Returns the dropoff for this payload\n *\n * @return {[type]} [description]\n */\n get dropoff() {}\n\n /**\n * Returns the pickup for this payload\n *\n * @return {[type]} [description]\n */\n get pickup() {}\n\n /**\n * Returns all the waypoints for this payload\n *\n * @return {[type]} [description]\n */\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 listOrganizations: function (id, params = {}, options = {}) {\n return this.adapter.post(`drivers/${id}/list-organizations`, params, options).then(this.afterFetch.bind(this));\n },\n\n switchOrganization: function (id, params = {}, options = {}) {\n return this.adapter.post(`drivers/${id}/switch-organization`, 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 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 listOrganizations(params = {}, options = {}) {\n return this.store.listOrganizations(this.id, params, options);\n }\n\n switchOrganization(organizationId, options = {}) {\n return this.store.switchOrganization(this.id, { next: organizationId }, 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';\nimport { StoreActions } from '../utils';\n\nconst organizationActions = new StoreActions({\n current: function (params = {}, options = {}) {\n return this.adapter.get(`${this.namespace}/current`, params, options);\n },\n});\n\nclass Organization extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'organization', { actions: organizationActions, ...options });\n }\n}\n\nexport default Organization;\nexport { organizationActions };\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 fromPayload() {}\n}\n\nexport default ServiceQuote;\n","class Adapter {\n /**\n * Creates a configured base adapter for Fleetbase.\n *\n * @param {Object} config Configuration options for adapter\n */\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) =>\n response\n .json()\n .then((json) =>\n resolve({\n statusText: response.statusText,\n status: response.status,\n ok: response.ok,\n json,\n })\n )\n .catch(() => {\n reject(new Error('Oops! Something went wrong when handling your request.'));\n })\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) =>\n 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 /**\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 { pluralize, singularize, humanize, underscore, camelize, capitalize, dasherize, normify, demodulize, tableize, classify, foreignKey };\n","import { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote, Organization } 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 Organization,\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 { Collection, StoreActions, detectAdapter, isResource } from './utils';\nimport { isArray } from './utils/array';\nimport { classify, pluralize } from './utils/string';\n\nconst extendStoreActions = (store, actions = []) => {\n store.actions = isArray(actions) ? actions : [actions];\n\n if (isArray(actions)) {\n for (const element of actions) {\n const action = element;\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 (const element of json) {\n serialized.push(store.afterFetch(element));\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 { afterFetch, extendStoreActions };\n","import Store from './store';\nimport Resource from './resource';\nimport { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote, Organization } 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';\nimport { organizationActions } from './resources/organization';\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 this.organizations = new Store('organization', this.adapter).extendActions(organizationActions);\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 Organization,\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","CHUNK_SIZE","replace","array","start","deleteCount","items","arguments","length","undefined","splice","apply","concat","_toConsumableArray","i","chunk","slice","isCollection","arr","identityFunction","item","mixed","Collection","objectAt","index","iter","key","value","Boolean","findIndex","predicate","startAt","len","indexOf","val","withNaNCheck","insertAt","_Array","_inherits","_super","_createSuper","_len","_key","_classCallCheck","_possibleConstructorReturn","call","_createClass","get","this","indexes","_this2","map","idx","object","callback","bind","target","cb","methodName","_len2","args","_key2","ret","forEach","_item$methodName","push","filter","sortKeys","sort","a","b","_step","_iterator","_createForOfIteratorHelper","s","n","done","propA","propB","compareValue","compare","err","e","f","seen","Set","getter","has","add","uniqBy","includes","removeAt","obj","objects","toArray","reverse","clear","loc","removeObject","pushObject","_this3","addObject","_wrapNativeSuper","isEmpty","none","size","objectType","_typeof","isBlank","test","isResource","record","Resource","isNodeEnvironment","_process","_process$release","_window","process","env","release","name","search","window","navigator","product","detectAdapter","options","lookup","GoogleAddress","place","geometry","components","parseComponents","attributes","parseProperties","_this$place","address_components","reduce","acc","data","types","type","_this$geometry","streetNumber","streetName","coordinates","location","Object","values","city","or","county","stateShort","stateLong","countryShort","country","countryLong","postalCode","address","join","pkey","short","short_name","long_name","_objectSpread","Point","latitude","longitude","coorindates","lat","lng","serialize","json","_json$coordinates","_slicedToArray","getResolved","func","path","resolved","current","isObject","isFunction","pathArray","split","newPath","set","iterations","StoreActions","actions","binding","action","fn","adapter","resource","dirtyAttributes","changes","isLoading","isSaving","isDestroying","isReloading","version","setAdapter","_this$options","store","Store","onAfterFetch","syncAttributes","getAttribute","_this","mergeAttributes","setFlags","create","then","response","update","id","destroy","_this4","findRecord","reset","flags","state","validFlags","flag","Error","attribues","getAttributes","onlyDirty","savedirty","dirtyAttributeKeys","keys","isAttributeFilled","Date","hasAttributes","isNew","isLoaded","_this$attributes","_this5","property","_this$dirtyAttributes","_this$attributes$prop","setAttributes","previousValue","changedAt","setAttribute","attribute","_this$attributes2","defaultValue","_this$attributes3","properties","attributeKeys","every","prop","hasAttribute","_this6","prototype","_value","_value2","_this$attributes4","modelAttributes","orderActions","getDistanceAndTime","params","namespace","getNextActivity","dispatch","post","afterFetch","updateActivity","setDestination","destinationId","captureQrCode","subjectId","captureSignature","complete","cancel","Order","_Resource","isStarted","isCanceled","isCompleted","Payload","entity","waypoints","Entity","Place","_this$getAttribute","_this$getAttribute2","owner","googleAddress","_googleAddress$getAtt2","street1","street2","province","postal_code","neighborhood","district","building","phone","security_access_code","Waypoint","_Place","TrackingStatus","Vehicle","driverActions","login","identity","password","isPhone","verifyCode","code","track","listOrganizations","switchOrganization","retrieve","syncDevice","Driver","organizationId","next","Vendor","organizationActions","Organization","Contact","Zone","ServiceArea","ServiceRate","ServiceQuote","Adapter","config","host","headers","BrowserAdapter","_Adapter","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","_defineProperty","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","_construct","extendStoreActions","extend","extendActions","storage","resourceInstance","_step2","serialized","_iterator2","element","deposit","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","wrap","_context","prev","sent","stop","_x","_x2","_ref2","_callee2","_context2","_x3","_x4","_ref3","_callee3","_context3","_x5","_x6","_ref4","_callee4","_context4","_x7","_x8","_ref5","_callee5","_context5","_x9","_x10","single","_ref6","_callee6","_context6","_x11","_x12","_this7","_ref7","_callee7","_context7","_x13","_x14","Fleetbase","_config$version","_config$host","_config$namespace","debug","startsWith","orders","entities","places","drivers","vehicles","vendors","contacts","organizations","coordinate","isFinite","Math","abs"],"mappings":"kgZAAA,IAAQA,EAAYC,MAAZD,8CCOFE,EAAa,IAIbC,EAAU,SAACC,EAAOC,EAAOC,GAA4B,IAAfC,EAAKC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,GAChD,GAAIR,EAAQI,GACR,GAAIG,EAAME,QAAUP,EAChBE,EAAMO,OAAMC,MAAZR,EAAaC,CAAAA,EAAOC,GAAWO,OAAAC,EAAKP,SACjC,CACHH,EAAMO,OAAON,EAAOC,GAEpB,IAAK,IAAIS,EAAI,EAAGA,EAAIR,EAAME,OAAQM,GAAKb,EAAY,CAC/C,IAAIc,EAAQT,EAAMU,MAAMF,EAAGA,EAAIb,GAC/BE,EAAMO,OAAMC,MAAZR,GAAaC,EAAQU,EAAG,GAACF,OAAAC,EAAKE,IAClC,CACJ,MACOE,EAAaC,MACpBf,EAAMD,QAAQE,EAAOC,EAAaC,EAE1C,EAEMa,EAAmB,SAACC,GAAI,OAAKA,CAAI,EAkBjCH,EAAe,SAACI,GAAK,OAAKA,aAAiBC,CAAU,EAErDC,EAAW,SAACpB,EAAOqB,GACrB,OAAIzB,EAAQI,GACDA,EAAMqB,GACNP,EAAad,GACbA,EAAMoB,SAASC,GAGnB,IACX,EAEMC,EAAO,SAACC,EAAKC,GAEf,OADyC,IAArBpB,EAAUC,OACP,SAACY,GAAI,OAAKO,IAAUP,EAAKM,EAAI,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,YAAUnZ,OAAAZ,MAAA+P,UAAA/O,MAAA6B,KAAKtC,YAE7B,OAAO0W,GAAOiD,OAAMvZ,MAAbsW,GAAMpW,EAAWkZ,GAC5B,4BAQkB,WACd,IAAMA,EAAI,CAAI,aAAWnZ,OAAAZ,MAAA+P,UAAA/O,MAAA6B,KAAKtC,YAE9B,OAAO0W,GAAOiD,OAAMvZ,MAAbsW,GAAMpW,EAAWkZ,GAC5B,oDIvee,SAAoB8E,GAC/B,OAAOC,SAASD,IAAeE,KAAKC,IAAIH,IAAe,EAC3D,gBCFe,SAAqBA,GAChC,OAAOC,SAASD,IAAeE,KAAKC,IAAIH,IAAe,KAAOE,KAAKC,IAAIH,IAAe,EAC1F"} \ 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-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/organization.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 { isArray };\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 (const element of sortKeys) {\n let key = element;\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","/**\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 (\n typeof process !== 'undefined' &&\n (typeof process?.env === 'object' || process.release?.name?.search(/node|io.js/) !== -1) &&\n (typeof window === 'undefined' || window?.navigator?.product === 'ReactNative')\n );\n};\n\nexport default isNodeEnvironment;\n","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;\n","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 (const element of keys) {\n const key = element;\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 const [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}\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 (const element of classes) {\n for (const property in element) {\n if (Object.prototype.hasOwnProperty.call(element, property)) {\n target[property] = element[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 // 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 (const element of properties) {\n const property = element;\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';\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 constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'payload', options);\n }\n\n /**\n * Attaches an entity to an existing payload and returns\n * the payload with the entity attached\n *\n * @param {[type]} Entity entity [description]\n * @return {[type]} [description]\n */\n attach(entity) {\n // perform op return payload\n }\n\n /**\n * Returns all of the entities attached to this payload\n *\n * @return {[type]} [description]\n */\n get entities() {}\n\n /**\n * Returns the dropoff for this payload\n *\n * @return {[type]} [description]\n */\n get dropoff() {}\n\n /**\n * Returns the pickup for this payload\n *\n * @return {[type]} [description]\n */\n get pickup() {}\n\n /**\n * Returns all the waypoints for this payload\n *\n * @return {[type]} [description]\n */\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 } from '../utils';\n\nconst organizationActions = new StoreActions({\n current: function (params = {}, options = {}) {\n return this.adapter.get(`${this.namespace}/current`, params, options);\n },\n});\n\nclass Organization extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'organization', { actions: organizationActions, ...options });\n }\n}\n\nexport default Organization;\nexport { organizationActions };\n","import Resource from '../resource';\nimport Organization from './organization';\nimport { StoreActions, isPhone, Collection } from '../utils';\nimport { isArray } from '../utils/array';\n\nconst serializeOrganizations = (response, adapter) => {\n if (isArray(response)) {\n return response.map((organizationJson) => {\n return new Organization(organizationJson, adapter);\n });\n }\n\n return new Organization(response, adapter);\n};\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 listOrganizations: function (id, params = {}, options = {}) {\n return this.adapter.get(`drivers/${id}/organizations`, params, options).then((response) => serializeOrganizations(response, this.adapter));\n },\n\n switchOrganization: function (id, params = {}, options = {}) {\n return this.adapter.post(`drivers/${id}/switch-organization`, params, options).then((response) => serializeOrganizations(response, this.adapter));\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 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 listOrganizations(params = {}, options = {}) {\n return this.store.listOrganizations(this.id, params, options);\n }\n\n switchOrganization(organizationId, options = {}) {\n return this.store.switchOrganization(this.id, { next: organizationId }, 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 fromPayload() {}\n}\n\nexport default ServiceQuote;\n","class Adapter {\n /**\n * Creates a configured base adapter for Fleetbase.\n *\n * @param {Object} config Configuration options for adapter\n */\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) =>\n response\n .json()\n .then((json) =>\n resolve({\n statusText: response.statusText,\n status: response.status,\n ok: response.ok,\n json,\n })\n )\n .catch(() => {\n reject(new Error('Oops! Something went wrong when handling your request.'));\n })\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) =>\n 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 /**\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 { pluralize, singularize, humanize, underscore, camelize, capitalize, dasherize, normify, demodulize, tableize, classify, foreignKey };\n","import { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote, Organization } 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 Organization,\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 { Collection, StoreActions, detectAdapter, isResource } from './utils';\nimport { isArray } from './utils/array';\nimport { classify, pluralize } from './utils/string';\n\nconst extendStoreActions = (store, actions = []) => {\n store.actions = isArray(actions) ? actions : [actions];\n\n if (isArray(actions)) {\n for (const element of actions) {\n const action = element;\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 (const element of json) {\n serialized.push(store.afterFetch(element));\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 { afterFetch, extendStoreActions };\n","import Store from './store';\nimport Resource from './resource';\nimport { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote, Organization } 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';\nimport { organizationActions } from './resources/organization';\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 this.organizations = new Store('organization', this.adapter).extendActions(organizationActions);\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 Organization,\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","CHUNK_SIZE","replace","array","start","deleteCount","items","arguments","length","undefined","splice","apply","concat","_toConsumableArray","i","chunk","slice","isCollection","arr","identityFunction","item","mixed","Collection","objectAt","index","iter","key","value","Boolean","findIndex","predicate","startAt","len","indexOf","val","withNaNCheck","insertAt","_Array","_inherits","_super","_createSuper","_len","_key","_classCallCheck","_possibleConstructorReturn","call","_createClass","get","this","indexes","_this2","map","idx","object","callback","bind","target","cb","methodName","_len2","args","_key2","ret","forEach","_item$methodName","push","filter","sortKeys","sort","a","b","_step","_iterator","_createForOfIteratorHelper","s","n","done","propA","propB","compareValue","compare","err","e","f","seen","Set","getter","has","add","uniqBy","includes","removeAt","obj","objects","toArray","reverse","clear","loc","removeObject","pushObject","_this3","addObject","_wrapNativeSuper","isEmpty","none","size","objectType","_typeof","isBlank","test","isResource","record","Resource","isNodeEnvironment","_process","_process$release","_window","process","env","release","name","search","window","navigator","product","detectAdapter","options","lookup","GoogleAddress","place","geometry","components","parseComponents","attributes","parseProperties","_this$place","address_components","reduce","acc","data","types","type","_this$geometry","streetNumber","streetName","coordinates","location","Object","values","city","or","county","stateShort","stateLong","countryShort","country","countryLong","postalCode","address","join","pkey","short","short_name","long_name","_objectSpread","Point","latitude","longitude","coorindates","lat","lng","serialize","json","_json$coordinates","_slicedToArray","getResolved","func","path","resolved","current","isObject","isFunction","pathArray","split","newPath","set","iterations","StoreActions","actions","binding","action","fn","adapter","resource","dirtyAttributes","changes","isLoading","isSaving","isDestroying","isReloading","version","setAdapter","_this$options","store","Store","onAfterFetch","syncAttributes","getAttribute","_this","mergeAttributes","setFlags","create","then","response","update","id","destroy","_this4","findRecord","reset","flags","state","validFlags","flag","Error","attribues","getAttributes","onlyDirty","savedirty","dirtyAttributeKeys","keys","isAttributeFilled","Date","hasAttributes","isNew","isLoaded","_this$attributes","_this5","property","_this$dirtyAttributes","_this$attributes$prop","setAttributes","previousValue","changedAt","setAttribute","attribute","_this$attributes2","defaultValue","_this$attributes3","properties","attributeKeys","every","prop","hasAttribute","_this6","prototype","_value","_value2","_this$attributes4","modelAttributes","orderActions","getDistanceAndTime","params","namespace","getNextActivity","dispatch","post","afterFetch","updateActivity","setDestination","destinationId","captureQrCode","subjectId","captureSignature","complete","cancel","Order","_Resource","isStarted","isCanceled","isCompleted","Payload","entity","waypoints","Entity","Place","_this$getAttribute","_this$getAttribute2","owner","googleAddress","_googleAddress$getAtt2","street1","street2","province","postal_code","neighborhood","district","building","phone","security_access_code","Waypoint","_Place","TrackingStatus","Vehicle","organizationActions","Organization","serializeOrganizations","organizationJson","driverActions","login","identity","password","isPhone","verifyCode","code","track","listOrganizations","switchOrganization","retrieve","syncDevice","Driver","organizationId","next","Vendor","Contact","Zone","ServiceArea","ServiceRate","ServiceQuote","Adapter","config","host","headers","BrowserAdapter","_Adapter","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","_defineProperty","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","_construct","extendStoreActions","extend","extendActions","storage","resourceInstance","_step2","serialized","_iterator2","element","deposit","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","wrap","_context","prev","sent","stop","_x","_x2","_ref2","_callee2","_context2","_x3","_x4","_ref3","_callee3","_context3","_x5","_x6","_ref4","_callee4","_context4","_x7","_x8","_ref5","_callee5","_context5","_x9","_x10","single","_ref6","_callee6","_context6","_x11","_x12","_this7","_ref7","_callee7","_context7","_x13","_x14","Fleetbase","_config$version","_config$host","_config$namespace","debug","startsWith","orders","entities","places","drivers","vehicles","vendors","contacts","organizations","coordinate","isFinite","Math","abs"],"mappings":"kgZAAA,IAAQA,EAAYC,MAAZD,8CCOFE,EAAa,IAIbC,EAAU,SAACC,EAAOC,EAAOC,GAA4B,IAAfC,EAAKC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,GAChD,GAAIR,EAAQI,GACR,GAAIG,EAAME,QAAUP,EAChBE,EAAMO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3D,gBCFe,SAAqBA,GAChC,OAAOC,SAASD,IAAeE,KAAKC,IAAIH,IAAe,KAAOE,KAAKC,IAAIH,IAAe,EAC1F"} \ No newline at end of file diff --git a/dist/cjs/fleetbase.js b/dist/cjs/fleetbase.js index c6b9bd2..f8678fe 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,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 n(t){for(var n=1;n=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var u=i.call(s,"catchLoc"),c=i.call(s,"finallyLoc");if(u&&c){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:L(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function i(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function s(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){s(o,r,i,a,u,"next",t)}function u(t){s(o,r,i,a,u,"throw",t)}a(void 0)}))}}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}var O=Array.isArray,j="undefined"==typeof arguments?void 0:arguments,$=6e4,R=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(O(t))if(r.length<=$)t.splice.apply(t,[e,n].concat(k(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;return n<0&&(n+=i),z(t,r&&e!=e?function(t){return t!=t}:function(t){return t===e},n)},D=function(t,e,n){return R(t,e,0,[n]),n},N=function(t){v(n,y(Array));var e=m(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 P(this,0)}},{key:"last",get:function(){return P(this,this.length-1)}},{key:"replace",value:function(t,e){return R(this,t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:[]),this}},{key:"objectsAt",value:function(t){var e=this;return t.map((function(t){return P(e,t)}))}},{key:"objectAt",value:function(t){return P(this,t)}},{key:"indexOf",value:function(t,e){return F(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(P(this,r)===t)return r;return-1}},{key:"includes",value:function(t,e){return-1!==F(this,t,e,!0)}},{key:"findBy",value:function(){return t=this,e=L.apply(void 0,arguments),r=e.bind(n),-1===(i=z(t,r,0))?void 0:P(t,i);var t,e,n,r,i}},{key:"findIndexBy",value:function(){return z(this,L.apply(void 0,arguments))}},{key:"isEvery",value:function(){return t=this,e=L.apply(void 0,arguments),r=e.bind(n),-1===z(t,(function(t,e,n){return!r(t,e,n)}),0);var t,e,n,r}},{key:"isAny",value:function(){return t=this,e=L.apply(void 0,arguments),r=e.bind(n),-1!==z(t,r,0);var t,e,n,r}},{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]:S,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 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 R(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=P(this,t-1);return this.removeAt(t-1,1),e}},{key:"shiftObject",value:function(){if(0===this.length)return null;var t=P(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;){P(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}(),C=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},T=function(t){return C(t)||"string"==typeof t&&!1===/\S/.test(t)};function q(t){return t instanceof Q}var I=function(){var t,e,n;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===(e=e.name)||void 0===e?void 0:e.search(/node|io.js/))||"undefined"!=typeof window&&"ReactNative"!==(null===(n=window)||void 0===n||null===(n=n.navigator)||void 0===n?void 0:n.product))},B=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return I()?Ot("adapter","NodeAdapter",t):Ot("adapter","BrowserAdapter",t)},G=Array.isArray,U=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(){var t,e=E(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]);try{for(e.s();!(t=e.n()).done;){var n=t.value;if(G(n)){var r=n[0],i=n[1];if(this.has(r))return this.get(r,i)}else if(this.has(n))return this.get(n)}}catch(t){e.e(t)}finally{e.f()}return null}},{key:"has",value:function(t){return t in this.components}},{key:"get",value:function(t){var e=arguments.length>1&&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}(),J=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=w(e.coordinates,2),r=n[0];return new t(n[1],r)}}]),t}();"undefined"==typeof arguments||arguments;var W=function(t,e){var n=t();return Array.isArray(n)||"object"===o(n)?M(n,e):null},M=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)||this.bind;if(!t)return this;if(null!=this&&this.actions&&"object"===o(this.actions))for(var e in this.actions){var n=this.actions[e];"function"==typeof n?K(t,e,n.bind(t)):K(t,e,n)}return this}}]),t}(),Q=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 $t(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 C(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 K(this.attributes,t,n),K(this.dirtyAttributes,t,r),O(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=M(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(O(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 O(t)?this.hasAttribute(t)&&t.every((function(t){return!C(e.getAttribute(t))})):this.hasAttribute(t)&&!C(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(!O(t))throw new Error("No attribute properties provided!");var n,r=E(t);try{for(r.s();!(n=r.n()).done;){var i,s,a=n.value;if("string"==typeof a){var u=this.getAttribute(a);"object"!==o(null===(i=u)||void 0===i?void 0:i.attributes)||O(null===(s=u)||void 0===s?void 0:s.attributes)||(u=u.attributes),e[a]=u}}}catch(t){r.e(t)}finally{r.f()}return e}},{key:"serialize",value:function(){return this.getAttributes()}},{key:"mergeAttributes",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=null!==(t=null==this?void 0:this.attributes)&&void 0!==t?t:{};return this.attributes=n(n({},r),e),this.attributes}},{key:"syncAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.attributes=t}}]),t}(),V=new H({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 q(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 q(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 q(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))}}),Y=function(t){v(r,Q);var e=m(r);function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,r),e.call(this,t,i,"order",n({actions:V},o))}return h(r,[{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")}}]),r}(),Z=function(t){v(n,Q);var e=m(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}(),X=function(t){v(n,Q);var e=m(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 h(n)}(),tt=function(t){v(n,Q);var e=m(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 J))||void 0===t?void 0:t.coordinates[1]}},{key:"longitude",get:function(){var t;return null===(t=this.getAttribute("location",new J))||void 0===t?void 0:t.coordinates[0]}},{key:"coordinates",get:function(){return[this.latitude,this.longitude]}},{key:"setOwner",value:function(t){return q(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=w(t.getAttribute("coordinates"),2),o=i[0],s=i[1];return new n({name:null,address:t.getAttribute("address"),location:new J(o,s),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},e,r)}}]),n}(),et=function(t){v(n,tt);var e=m(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 h(n)}(),nt=function(t){v(n,Q);var e=m(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 h(n)}(),rt=function(t){v(n,Q);var e=m(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 h(n)}(),it=new H({login:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(function(){return/^[+]?[\s./0-9]*[(]?[0-9]{1,4}[)]?[-\s./0-9]*$/g.test(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")}(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},r)).then(this.afterFetch.bind(this))},verifyCode:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("drivers/verify-code",n({identity:t,code:e},r)).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))},listOrganizations: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,"/list-organizations"),e,n).then(this.afterFetch.bind(this))},switchOrganization: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,"/switch-organization"),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)}}),ot=function(t){v(r,Q);var e=m(r);function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,r),e.call(this,t,i,"driver",n({actions:it},o))}return h(r,[{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)}},{key:"listOrganizations",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.listOrganizations(this.id,t,e)}},{key:"switchOrganization",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.switchOrganization(this.id,{next:t},e)}}]),r}(),st=function(t){v(n,Q);var e=m(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 h(n)}(),at=new H({current:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.adapter.get("".concat(this.namespace,"/current"),t,e)}}),ut=function(t){v(r,Q);var e=m(r);function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,r),e.call(this,t,i,"organization",n({actions:at},o))}return h(r)}(),ct=function(t){v(n,Q);var e=m(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 h(n)}(),ht=function(t){v(n,Q);var e=m(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 h(n)}(),lt=function(t){v(n,Q);var e=m(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 h(n)}(),vt=function(t){v(n,Q);var e=m(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 h(n)}(),ft=function(t){v(n,Q);var e=m(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}(),dt=h((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||{}})),pt=function(t){v(r,dt);var e=m(r);function r(t){var n;return u(this,r),(n=e.call(this,t)).setHeaders({Authorization:"Bearer ".concat(t.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;browser"}),n}return h(r,[{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,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",i=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:r,mode:o.mode||"cors",headers:new Headers(n(n({},e.headers||{}),o.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]:{},r=T(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)}}]),r}(),gt=function(e){v(i,dt);var r=m(i);function i(e){var n;return u(this,i),(n=r.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 h(i,[{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(O(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=T(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))}}]),i}(),yt=function(t){v(n,dt);var e=m(n);function n(){return u(this,n),e.apply(this,arguments)}return h(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=O(e)?e:[e],!O(e))return e instanceof H&&e.extend(t),t;var n,r=E(e);try{for(r.s();!(n=r.n()).done;){var i=n.value;t.extendActions(i)}}catch(t){r.e(t)}finally{r.f()}},$t=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};u(this,t),this.resource=e,this.adapter=n||B(),this.namespace=mt(e),this.storage=new N,this.options=r,this.extendActions(r.actions)}return h(t,[{key:"extendActions",value:function(){return jt(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:[])}},{key:"deposit",value:function(t){return t}},{key:"serialize",value:function(t){return Ot("resource",kt(this.resource),t,this.adapter)}},{key:"afterFetch",value:function(t){return function(t,e){if("function"==typeof t.options.onAfterFetch&&t.options.onAfterFetch(e),O(e)){var n,r=[],i=E(e);try{for(i.s();!(n=i.n()).done;){var o=n.value;r.push(t.afterFetch(o))}}catch(t){i.e(t)}finally{i.f()}return g(N,r)}var s=t.serialize(e);return t.deposit(s)}(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=a(r().mark((function i(o,s){var a;return r().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(s);case 2:a=r.sent,o(a);case 4:case"end":return r.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 o=a(r().mark((function o(s,a){var u;return r().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(a);case 2:u=r.sent,s(u);case 4:case"end":return r.stop()}}),o)})));return function(t,e){return o.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=a(r().mark((function i(o,s){var a;return r().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(s);case 2:a=r.sent,o(a);case 4:case"end":return r.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=a(r().mark((function n(i,o){var s;return r().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(o);case 2:s=n.sent,i(s);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=a(r().mark((function i(o,s){var a;return r().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(s);case 2:a=r.sent,o(a);case 4:case"end":return r.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=a(r().mark((function i(o,s){var a;return r().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(s);case 2:a=r.sent,o(a);case 4:case"end":return r.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=q(t)?t.getAttribute("id"):t;return new Promise(function(){var t=a(r().mark((function t(o,s){var a;return r().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(s);case 2:a=t.sent,o(a);case 4:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}())}}]),t}(),Rt=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||B(this.options),this.orders=new $t("order",this.adapter).extendActions(V),this.entities=new $t("entity",this.adapter),this.places=new $t("place",this.adapter),this.drivers=new $t("driver",this.adapter).extendActions(it),this.vehicles=new $t("vehicle",this.adapter),this.vendors=new $t("vendor",this.adapter),this.contacts=new $t("contact",this.adapter),this.organizations=new $t("organization",this.adapter).extendActions(at)}return h(t,[{key:"setAdapter",value:function(t){this.adapter=t}},{key:"getAdapter",value:function(){return this.adapter}}],[{key:"newInstance",value:function(){return g(t,Array.prototype.slice.call(arguments))}}]),t}();exports.Adapter=dt,exports.BrowserAdapter=pt,exports.Collection=N,exports.Contact=ct,exports.Driver=ot,exports.EmberJsAdapter=yt,exports.Entity=X,exports.GoogleAddress=U,exports.NodeAdapter=gt,exports.Order=Y,exports.Organization=ut,exports.Payload=Z,exports.Place=tt,exports.Point=J,exports.Resource=Q,exports.ServiceArea=lt,exports.ServiceQuote=ft,exports.ServiceRate=vt,exports.Store=$t,exports.StoreActions=H,exports.TrackingStatus=nt,exports.Vehicle=rt,exports.Vendor=st,exports.Waypoint=et,exports.Zone=ht,exports.camelize=function(){var t=["camelize"].concat(Array.prototype.slice.call(arguments));return bt.invoke.apply(bt,k(t))},exports.classify=kt,exports.dasherize=function(){var t=["dasherize"].concat(Array.prototype.slice.call(arguments));return bt.invoke.apply(bt,k(t))},exports.default=Rt,exports.extendStoreActions=jt,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=q,exports.pluralize=mt,exports.singularize=wt; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("axios");function e(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 n(t){for(var n=1;n=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:L(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function i(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function a(t,e,n,r,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,i)}function s(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){a(o,r,i,s,u,"next",t)}function u(t){a(o,r,i,s,u,"throw",t)}s(void 0)}))}}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}var O=Array.isArray,j="undefined"==typeof arguments?void 0:arguments,$=6e4,R=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(O(t))if(r.length<=$)t.splice.apply(t,[e,n].concat(k(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;return n<0&&(n+=i),z(t,r&&e!=e?function(t){return t!=t}:function(t){return t===e},n)},D=function(t,e,n){return R(t,e,0,[n]),n},N=function(t){v(n,y(Array));var e=m(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 P(this,0)}},{key:"last",get:function(){return P(this,this.length-1)}},{key:"replace",value:function(t,e){return R(this,t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:[]),this}},{key:"objectsAt",value:function(t){var e=this;return t.map((function(t){return P(e,t)}))}},{key:"objectAt",value:function(t){return P(this,t)}},{key:"indexOf",value:function(t,e){return F(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(P(this,r)===t)return r;return-1}},{key:"includes",value:function(t,e){return-1!==F(this,t,e,!0)}},{key:"findBy",value:function(){return t=this,e=L.apply(void 0,arguments),r=e.bind(n),-1===(i=z(t,r,0))?void 0:P(t,i);var t,e,n,r,i}},{key:"findIndexBy",value:function(){return z(this,L.apply(void 0,arguments))}},{key:"isEvery",value:function(){return t=this,e=L.apply(void 0,arguments),r=e.bind(n),-1===z(t,(function(t,e,n){return!r(t,e,n)}),0);var t,e,n,r}},{key:"isAny",value:function(){return t=this,e=L.apply(void 0,arguments),r=e.bind(n),-1!==z(t,r,0);var t,e,n,r}},{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]:S,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 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 R(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=P(this,t-1);return this.removeAt(t-1,1),e}},{key:"shiftObject",value:function(){if(0===this.length)return null;var t=P(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;){P(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}(),C=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},T=function(t){return C(t)||"string"==typeof t&&!1===/\S/.test(t)};function q(t){return t instanceof Q}var I=function(){var t,e,n;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===(e=e.name)||void 0===e?void 0:e.search(/node|io.js/))||"undefined"!=typeof window&&"ReactNative"!==(null===(n=window)||void 0===n||null===(n=n.navigator)||void 0===n?void 0:n.product))},B=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return I()?jt("adapter","NodeAdapter",t):jt("adapter","BrowserAdapter",t)},G=Array.isArray,U=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(){var t,e=E(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]);try{for(e.s();!(t=e.n()).done;){var n=t.value;if(G(n)){var r=n[0],i=n[1];if(this.has(r))return this.get(r,i)}else if(this.has(n))return this.get(n)}}catch(t){e.e(t)}finally{e.f()}return null}},{key:"has",value:function(t){return t in this.components}},{key:"get",value:function(t){var e=arguments.length>1&&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}(),J=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=w(e.coordinates,2),r=n[0];return new t(n[1],r)}}]),t}();"undefined"==typeof arguments||arguments;var W=function(t,e){var n=t();return Array.isArray(n)||"object"===o(n)?M(n,e):null},M=function t(e,n){var r,i=e,a=o(e),s="object"===a,u="function"===a,c=Array.isArray(e),h="string"===o(n)&&n.includes(".")?n.split("."):[n];if(c||s){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)||this.bind;if(!t)return this;if(null!=this&&this.actions&&"object"===o(this.actions))for(var e in this.actions){var n=this.actions[e];"function"==typeof n?K(t,e,n.bind(t)):K(t,e,n)}return this}}]),t}(),Q=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 Rt(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 C(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 K(this.attributes,t,n),K(this.dirtyAttributes,t,r),O(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=M(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(O(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 O(t)?this.hasAttribute(t)&&t.every((function(t){return!C(e.getAttribute(t))})):this.hasAttribute(t)&&!C(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(!O(t))throw new Error("No attribute properties provided!");var n,r=E(t);try{for(r.s();!(n=r.n()).done;){var i,a,s=n.value;if("string"==typeof s){var u=this.getAttribute(s);"object"!==o(null===(i=u)||void 0===i?void 0:i.attributes)||O(null===(a=u)||void 0===a?void 0:a.attributes)||(u=u.attributes),e[s]=u}}}catch(t){r.e(t)}finally{r.f()}return e}},{key:"serialize",value:function(){return this.getAttributes()}},{key:"mergeAttributes",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=null!==(t=null==this?void 0:this.attributes)&&void 0!==t?t:{};return this.attributes=n(n({},r),e),this.attributes}},{key:"syncAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.attributes=t}}]),t}(),V=new H({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 q(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 q(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 q(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))}}),Y=function(t){v(r,Q);var e=m(r);function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,r),e.call(this,t,i,"order",n({actions:V},o))}return h(r,[{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")}}]),r}(),Z=function(t){v(n,Q);var e=m(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}(),X=function(t){v(n,Q);var e=m(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 h(n)}(),tt=function(t){v(n,Q);var e=m(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 J))||void 0===t?void 0:t.coordinates[1]}},{key:"longitude",get:function(){var t;return null===(t=this.getAttribute("location",new J))||void 0===t?void 0:t.coordinates[0]}},{key:"coordinates",get:function(){return[this.latitude,this.longitude]}},{key:"setOwner",value:function(t){return q(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=w(t.getAttribute("coordinates"),2),o=i[0],a=i[1];return new n({name:null,address:t.getAttribute("address"),location:new J(o,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},e,r)}}]),n}(),et=function(t){v(n,tt);var e=m(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 h(n)}(),nt=function(t){v(n,Q);var e=m(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 h(n)}(),rt=function(t){v(n,Q);var e=m(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 h(n)}(),it=new H({current:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.adapter.get("".concat(this.namespace,"/current"),t,e)}}),ot=function(t){v(r,Q);var e=m(r);function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,r),e.call(this,t,i,"organization",n({actions:it},o))}return h(r)}(),at=function(t,e){return O(t)?t.map((function(t){return new ot(t,e)})):new ot(t,e)},st=new H({login:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(function(){return/^[+]?[\s./0-9]*[(]?[0-9]{1,4}[)]?[-\s./0-9]*$/g.test(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")}(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},r)).then(this.afterFetch.bind(this))},verifyCode:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("drivers/verify-code",n({identity:t,code:e},r)).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))},listOrganizations: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 this.adapter.get("drivers/".concat(t,"/organizations"),n,r).then((function(t){return at(t,e.adapter)}))},switchOrganization: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 this.adapter.post("drivers/".concat(t,"/switch-organization"),n,r).then((function(t){return at(t,e.adapter)}))},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)}}),ut=function(t){v(r,Q);var e=m(r);function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,r),e.call(this,t,i,"driver",n({actions:st},o))}return h(r,[{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)}},{key:"listOrganizations",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.listOrganizations(this.id,t,e)}},{key:"switchOrganization",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.switchOrganization(this.id,{next:t},e)}}]),r}(),ct=function(t){v(n,Q);var e=m(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 h(n)}(),ht=function(t){v(n,Q);var e=m(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 h(n)}(),lt=function(t){v(n,Q);var e=m(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 h(n)}(),vt=function(t){v(n,Q);var e=m(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 h(n)}(),ft=function(t){v(n,Q);var e=m(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 h(n)}(),dt=function(t){v(n,Q);var e=m(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}(),pt=h((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(r,pt);var e=m(r);function r(t){var n;return u(this,r),(n=e.call(this,t)).setHeaders({Authorization:"Bearer ".concat(t.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;browser"}),n}return h(r,[{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,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise((function(a,s){return fetch(o.url||"".concat(e.host,"/").concat(e.namespace,"/").concat(t),n({method:r,mode:o.mode||"cors",headers:new Headers(n(n({},e.headers||{}),o.headers||{}))},i)).then(e.parseJSON).then((function(t){return t.ok?a(t.json):s(new Error(t.json.errors?t.json.errors[0]:t.statusText))})).catch((function(t){s(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=T(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)}}]),r}(),yt=function(e){v(i,pt);var r=m(i);function i(e){var n;return u(this,i),(n=r.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 h(i,[{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(O(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=T(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))}}]),i}(),bt=function(t){v(n,pt);var e=m(n);function n(){return u(this,n),e.apply(this,arguments)}return h(n)}(),mt=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=O(e)?e:[e],!O(e))return e instanceof H&&e.extend(t),t;var n,r=E(e);try{for(r.s();!(n=r.n()).done;){var i=n.value;t.extendActions(i)}}catch(t){r.e(t)}finally{r.f()}},Rt=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};u(this,t),this.resource=e,this.adapter=n||B(),this.namespace=wt(e),this.storage=new N,this.options=r,this.extendActions(r.actions)}return h(t,[{key:"extendActions",value:function(){return $t(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:[])}},{key:"deposit",value:function(t){return t}},{key:"serialize",value:function(t){return jt("resource",At(this.resource),t,this.adapter)}},{key:"afterFetch",value:function(t){return function(t,e){if("function"==typeof t.options.onAfterFetch&&t.options.onAfterFetch(e),O(e)){var n,r=[],i=E(e);try{for(i.s();!(n=i.n()).done;){var o=n.value;r.push(t.afterFetch(o))}}catch(t){i.e(t)}finally{i.f()}return g(N,r)}var a=t.serialize(e);return t.deposit(a)}(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=s(r().mark((function i(o,a){var s;return r().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(a);case 2:s=r.sent,o(s);case 4:case"end":return r.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 o=s(r().mark((function o(a,s){var u;return r().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:u=r.sent,a(u);case 4:case"end":return r.stop()}}),o)})));return function(t,e){return o.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=s(r().mark((function i(o,a){var s;return r().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(a);case 2:s=r.sent,o(s);case 4:case"end":return r.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=s(r().mark((function n(i,o){var a;return r().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(o);case 2:a=n.sent,i(a);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=s(r().mark((function i(o,a){var s;return r().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(a);case 2:s=r.sent,o(s);case 4:case"end":return r.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=s(r().mark((function i(o,a){var s;return r().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(a);case 2:s=r.sent,o(s);case 4:case"end":return r.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=q(t)?t.getAttribute("id"):t;return new Promise(function(){var t=s(r().mark((function t(o,a){var s;return r().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(a);case 2:s=t.sent,o(s);case 4:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}())}}]),t}(),St=function(){function t(e){var n,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=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: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||B(this.options),this.orders=new Rt("order",this.adapter).extendActions(V),this.entities=new Rt("entity",this.adapter),this.places=new Rt("place",this.adapter),this.drivers=new Rt("driver",this.adapter).extendActions(st),this.vehicles=new Rt("vehicle",this.adapter),this.vendors=new Rt("vendor",this.adapter),this.contacts=new Rt("contact",this.adapter),this.organizations=new Rt("organization",this.adapter).extendActions(it)}return h(t,[{key:"setAdapter",value:function(t){this.adapter=t}},{key:"getAdapter",value:function(){return this.adapter}}],[{key:"newInstance",value:function(){return g(t,Array.prototype.slice.call(arguments))}}]),t}();exports.Adapter=pt,exports.BrowserAdapter=gt,exports.Collection=N,exports.Contact=ht,exports.Driver=ut,exports.EmberJsAdapter=bt,exports.Entity=X,exports.GoogleAddress=U,exports.NodeAdapter=yt,exports.Order=Y,exports.Organization=ot,exports.Payload=Z,exports.Place=tt,exports.Point=J,exports.Resource=Q,exports.ServiceArea=vt,exports.ServiceQuote=dt,exports.ServiceRate=ft,exports.Store=Rt,exports.StoreActions=H,exports.TrackingStatus=nt,exports.Vehicle=rt,exports.Vendor=ct,exports.Waypoint=et,exports.Zone=lt,exports.camelize=function(){var t=["camelize"].concat(Array.prototype.slice.call(arguments));return mt.invoke.apply(mt,k(t))},exports.classify=At,exports.dasherize=function(){var t=["dasherize"].concat(Array.prototype.slice.call(arguments));return mt.invoke.apply(mt,k(t))},exports.default=St,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=q,exports.pluralize=wt,exports.singularize=kt; //# sourceMappingURL=fleetbase.js.map diff --git a/dist/cjs/fleetbase.js.map b/dist/cjs/fleetbase.js.map index 6290137..61646c0 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/organization.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 { isArray };\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 (const element of sortKeys) {\n let key = element;\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","/**\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 (\n typeof process !== 'undefined' &&\n (typeof process?.env === 'object' || process.release?.name?.search(/node|io.js/) !== -1) &&\n (typeof window === 'undefined' || window?.navigator?.product === 'ReactNative')\n );\n};\n\nexport default isNodeEnvironment;\n","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;\n","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 (const element of keys) {\n const key = element;\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 const [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}\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 (const element of classes) {\n for (const property in element) {\n if (Object.prototype.hasOwnProperty.call(element, property)) {\n target[property] = element[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 // 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 (const element of properties) {\n const property = element;\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';\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 constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'payload', options);\n }\n\n /**\n * Attaches an entity to an existing payload and returns\n * the payload with the entity attached\n *\n * @param {[type]} Entity entity [description]\n * @return {[type]} [description]\n */\n attach(entity) {\n // perform op return payload\n }\n\n /**\n * Returns all of the entities attached to this payload\n *\n * @return {[type]} [description]\n */\n get entities() {}\n\n /**\n * Returns the dropoff for this payload\n *\n * @return {[type]} [description]\n */\n get dropoff() {}\n\n /**\n * Returns the pickup for this payload\n *\n * @return {[type]} [description]\n */\n get pickup() {}\n\n /**\n * Returns all the waypoints for this payload\n *\n * @return {[type]} [description]\n */\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 listOrganizations: function (id, params = {}, options = {}) {\n return this.adapter.post(`drivers/${id}/list-organizations`, params, options).then(this.afterFetch.bind(this));\n },\n\n switchOrganization: function (id, params = {}, options = {}) {\n return this.adapter.post(`drivers/${id}/switch-organization`, 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 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 listOrganizations(params = {}, options = {}) {\n return this.store.listOrganizations(this.id, params, options);\n }\n\n switchOrganization(organizationId, options = {}) {\n return this.store.switchOrganization(this.id, { next: organizationId }, 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';\nimport { StoreActions } from '../utils';\n\nconst organizationActions = new StoreActions({\n current: function (params = {}, options = {}) {\n return this.adapter.get(`${this.namespace}/current`, params, options);\n },\n});\n\nclass Organization extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'organization', { actions: organizationActions, ...options });\n }\n}\n\nexport default Organization;\nexport { organizationActions };\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 fromPayload() {}\n}\n\nexport default ServiceQuote;\n","class Adapter {\n /**\n * Creates a configured base adapter for Fleetbase.\n *\n * @param {Object} config Configuration options for adapter\n */\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) =>\n response\n .json()\n .then((json) =>\n resolve({\n statusText: response.statusText,\n status: response.status,\n ok: response.ok,\n json,\n })\n )\n .catch(() => {\n reject(new Error('Oops! Something went wrong when handling your request.'));\n })\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) =>\n 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 /**\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 { pluralize, singularize, humanize, underscore, camelize, capitalize, dasherize, normify, demodulize, tableize, classify, foreignKey };\n","import { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote, Organization } 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 Organization,\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 { Collection, StoreActions, detectAdapter, isResource } from './utils';\nimport { isArray } from './utils/array';\nimport { classify, pluralize } from './utils/string';\n\nconst extendStoreActions = (store, actions = []) => {\n store.actions = isArray(actions) ? actions : [actions];\n\n if (isArray(actions)) {\n for (const element of actions) {\n const action = element;\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 (const element of json) {\n serialized.push(store.afterFetch(element));\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 { afterFetch, extendStoreActions };\n","import Store from './store';\nimport Resource from './resource';\nimport { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote, Organization } 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';\nimport { organizationActions } from './resources/organization';\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 this.organizations = new Store('organization', this.adapter).extendActions(organizationActions);\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 Organization,\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","CHUNK_SIZE","replace","array","start","deleteCount","items","arguments","length","undefined","splice","apply","concat","_toConsumableArray","i","chunk","slice","isCollection","arr","identityFunction","item","mixed","Collection","objectAt","index","iter","key","value","Boolean","findIndex","predicate","startAt","len","indexOf","val","withNaNCheck","insertAt","_Array","_inherits","_wrapNativeSuper","_super","_createSuper","_len","_key","_classCallCheck","_possibleConstructorReturn","call","_createClass","get","this","indexes","_this2","map","idx","object","callback","bind","target","cb","methodName","_len2","args","_key2","ret","forEach","_item$methodName","push","filter","sortKeys","sort","a","b","_step","_iterator","_createForOfIteratorHelper","s","n","done","propA","propB","compareValue","compare","err","e","f","seen","Set","getter","has","add","uniqBy","includes","removeAt","obj","objects","toArray","reverse","clear","loc","removeObject","pushObject","_this3","addObject","isEmpty","none","size","objectType","_typeof","isBlank","test","isResource","record","Resource","isNodeEnvironment","_process","_process$release","_window","process","env","release","name","search","window","navigator","product","detectAdapter","options","lookup","GoogleAddress","place","geometry","components","parseComponents","attributes","parseProperties","_this$place","address_components","reduce","acc","data","types","type","_this$geometry","streetNumber","streetName","coordinates","location","Object","values","city","or","county","stateShort","stateLong","countryShort","country","countryLong","postalCode","address","join","pkey","short","short_name","long_name","_objectSpread","Point","latitude","longitude","coorindates","lat","lng","serialize","json","_json$coordinates","_slicedToArray","getResolved","func","path","resolved","current","isObject","isFunction","pathArray","split","newPath","set","iterations","StoreActions","actions","binding","action","fn","adapter","resource","dirtyAttributes","changes","isLoading","isSaving","isDestroying","isReloading","version","setAdapter","_this$options","store","Store","onAfterFetch","syncAttributes","getAttribute","_this","mergeAttributes","setFlags","create","then","response","update","id","destroy","_this4","findRecord","reset","flags","state","validFlags","flag","Error","attribues","getAttributes","onlyDirty","savedirty","dirtyAttributeKeys","keys","isAttributeFilled","Date","hasAttributes","isNew","isLoaded","_this$attributes","_this5","property","_this$dirtyAttributes","_this$attributes$prop","setAttributes","previousValue","changedAt","setAttribute","attribute","_this$attributes2","defaultValue","_this$attributes3","properties","attributeKeys","every","prop","hasAttribute","_this6","prototype","_value","_value2","_this$attributes4","modelAttributes","orderActions","getDistanceAndTime","params","namespace","getNextActivity","dispatch","post","afterFetch","updateActivity","setDestination","destinationId","captureQrCode","subjectId","captureSignature","complete","cancel","Order","_Resource","isStarted","isCanceled","isCompleted","Payload","entity","waypoints","Entity","Place","_this$getAttribute","_this$getAttribute2","owner","googleAddress","_googleAddress$getAtt2","street1","street2","province","postal_code","neighborhood","district","building","phone","security_access_code","Waypoint","_Place","TrackingStatus","Vehicle","driverActions","login","identity","password","isPhone","verifyCode","code","track","listOrganizations","switchOrganization","retrieve","syncDevice","Driver","organizationId","next","Vendor","organizationActions","Organization","Contact","Zone","ServiceArea","ServiceRate","ServiceQuote","Adapter","config","host","headers","BrowserAdapter","_Adapter","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","_defineProperty","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","_construct","extendStoreActions","extend","extendActions","storage","resourceInstance","_step2","serialized","_iterator2","element","deposit","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","wrap","_context","prev","sent","stop","_x","_x2","_ref2","_callee2","_context2","_x3","_x4","_ref3","_callee3","_context3","_x5","_x6","_ref4","_callee4","_context4","_x7","_x8","_ref5","_callee5","_context5","_x9","_x10","single","_ref6","_callee6","_context6","_x11","_x12","_this7","_ref7","_callee7","_context7","_x13","_x14","Fleetbase","_config$version","_config$host","_config$namespace","debug","startsWith","orders","entities","places","drivers","vehicles","vendors","contacts","organizations","coordinate","isFinite","Math","abs"],"mappings":"i0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ACtC/I,KAAKub,QAAU,IAAI5R,GAAM,SAAU3J,KAAK+I,SAAS2O,cAAc3H,IAC/D/P,KAAKwb,SAAW,IAAI7R,GAAM,UAAW3J,KAAK+I,SAC1C/I,KAAKyb,QAAU,IAAI9R,GAAM,SAAU3J,KAAK+I,SACxC/I,KAAK0b,SAAW,IAAI/R,GAAM,UAAW3J,KAAK+I,SAC1C/I,KAAK2b,cAAgB,IAAIhS,GAAM,eAAgB3J,KAAK+I,SAAS2O,cAAc3G,GAC/E,CAIC,OAJAjR,EAAAgb,EAAA,CAAA,CAAArc,IAAA,aAAAC,MAMD,SAAWqK,GACP/I,KAAK+I,QAAUA,CACnB,GAAC,CAAAtK,IAAA,aAAAC,MAED,WACI,OAAOsB,KAAK+I,OAChB,IAAC,CAAA,CAAAtK,IAAA,cAAAC,MAVD,WACI,OAAA6Y,EAAWuD,EAAS/d,MAAA+P,UAAA/O,MAAA8B,KAAIvC,WAC5B,KAACwd,CAAA,CAzCyB,ohBHsbb,WACb,IAAMhE,EAAI,CAAI,YAAUnZ,OAAAZ,MAAA+P,UAAA/O,MAAA8B,KAAKvC,YAE7B,OAAO0W,GAAOiD,OAAMvZ,MAAbsW,GAAMpW,EAAWkZ,GAC5B,wCAQkB,WACd,IAAMA,EAAI,CAAI,aAAWnZ,OAAAZ,MAAA+P,UAAA/O,MAAA8B,KAAKvC,YAE9B,OAAO0W,GAAOiD,OAAMvZ,MAAbsW,GAAMpW,EAAWkZ,GAC5B,sEIvee,SAAoB8E,GAC/B,OAAOC,SAASD,IAAeE,KAAKC,IAAIH,IAAe,EAC3D,sBCFe,SAAqBA,GAChC,OAAOC,SAASD,IAAeE,KAAKC,IAAIH,IAAe,KAAOE,KAAKC,IAAIH,IAAe,EAC1F"} \ 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/organization.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 { isArray };\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 (const element of sortKeys) {\n let key = element;\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","/**\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 (\n typeof process !== 'undefined' &&\n (typeof process?.env === 'object' || process.release?.name?.search(/node|io.js/) !== -1) &&\n (typeof window === 'undefined' || window?.navigator?.product === 'ReactNative')\n );\n};\n\nexport default isNodeEnvironment;\n","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;\n","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 (const element of keys) {\n const key = element;\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 const [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}\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 (const element of classes) {\n for (const property in element) {\n if (Object.prototype.hasOwnProperty.call(element, property)) {\n target[property] = element[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 // 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 (const element of properties) {\n const property = element;\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';\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 constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'payload', options);\n }\n\n /**\n * Attaches an entity to an existing payload and returns\n * the payload with the entity attached\n *\n * @param {[type]} Entity entity [description]\n * @return {[type]} [description]\n */\n attach(entity) {\n // perform op return payload\n }\n\n /**\n * Returns all of the entities attached to this payload\n *\n * @return {[type]} [description]\n */\n get entities() {}\n\n /**\n * Returns the dropoff for this payload\n *\n * @return {[type]} [description]\n */\n get dropoff() {}\n\n /**\n * Returns the pickup for this payload\n *\n * @return {[type]} [description]\n */\n get pickup() {}\n\n /**\n * Returns all the waypoints for this payload\n *\n * @return {[type]} [description]\n */\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 } from '../utils';\n\nconst organizationActions = new StoreActions({\n current: function (params = {}, options = {}) {\n return this.adapter.get(`${this.namespace}/current`, params, options);\n },\n});\n\nclass Organization extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'organization', { actions: organizationActions, ...options });\n }\n}\n\nexport default Organization;\nexport { organizationActions };\n","import Resource from '../resource';\nimport Organization from './organization';\nimport { StoreActions, isPhone, Collection } from '../utils';\nimport { isArray } from '../utils/array';\n\nconst serializeOrganizations = (response, adapter) => {\n if (isArray(response)) {\n return response.map((organizationJson) => {\n return new Organization(organizationJson, adapter);\n });\n }\n\n return new Organization(response, adapter);\n};\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 listOrganizations: function (id, params = {}, options = {}) {\n return this.adapter.get(`drivers/${id}/organizations`, params, options).then((response) => serializeOrganizations(response, this.adapter));\n },\n\n switchOrganization: function (id, params = {}, options = {}) {\n return this.adapter.post(`drivers/${id}/switch-organization`, params, options).then((response) => serializeOrganizations(response, this.adapter));\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 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 listOrganizations(params = {}, options = {}) {\n return this.store.listOrganizations(this.id, params, options);\n }\n\n switchOrganization(organizationId, options = {}) {\n return this.store.switchOrganization(this.id, { next: organizationId }, 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 fromPayload() {}\n}\n\nexport default ServiceQuote;\n","class Adapter {\n /**\n * Creates a configured base adapter for Fleetbase.\n *\n * @param {Object} config Configuration options for adapter\n */\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) =>\n response\n .json()\n .then((json) =>\n resolve({\n statusText: response.statusText,\n status: response.status,\n ok: response.ok,\n json,\n })\n )\n .catch(() => {\n reject(new Error('Oops! Something went wrong when handling your request.'));\n })\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) =>\n 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 /**\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 { pluralize, singularize, humanize, underscore, camelize, capitalize, dasherize, normify, demodulize, tableize, classify, foreignKey };\n","import { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote, Organization } 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 Organization,\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 { Collection, StoreActions, detectAdapter, isResource } from './utils';\nimport { isArray } from './utils/array';\nimport { classify, pluralize } from './utils/string';\n\nconst extendStoreActions = (store, actions = []) => {\n store.actions = isArray(actions) ? actions : [actions];\n\n if (isArray(actions)) {\n for (const element of actions) {\n const action = element;\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 (const element of json) {\n serialized.push(store.afterFetch(element));\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 { afterFetch, extendStoreActions };\n","import Store from './store';\nimport Resource from './resource';\nimport { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote, Organization } 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';\nimport { organizationActions } from './resources/organization';\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 this.organizations = new Store('organization', this.adapter).extendActions(organizationActions);\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 Organization,\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","CHUNK_SIZE","replace","array","start","deleteCount","items","arguments","length","undefined","splice","apply","concat","_toConsumableArray","i","chunk","slice","isCollection","arr","identityFunction","item","mixed","Collection","objectAt","index","iter","key","value","Boolean","findIndex","predicate","startAt","len","indexOf","val","withNaNCheck","insertAt","_Array","_inherits","_wrapNativeSuper","_super","_createSuper","_len","_key","_classCallCheck","_possibleConstructorReturn","call","_createClass","get","this","indexes","_this2","map","idx","object","callback","bind","target","cb","methodName","_len2","args","_key2","ret","forEach","_item$methodName","push","filter","sortKeys","sort","a","b","_step","_iterator","_createForOfIteratorHelper","s","n","done","propA","propB","compareValue","compare","err","e","f","seen","Set","getter","has","add","uniqBy","includes","removeAt","obj","objects","toArray","reverse","clear","loc","removeObject","pushObject","_this3","addObject","isEmpty","none","size","objectType","_typeof","isBlank","test","isResource","record","Resource","isNodeEnvironment","_process","_process$release","_window","process","env","release","name","search","window","navigator","product","detectAdapter","options","lookup","GoogleAddress","place","geometry","components","parseComponents","attributes","parseProperties","_this$place","address_components","reduce","acc","data","types","type","_this$geometry","streetNumber","streetName","coordinates","location","Object","values","city","or","county","stateShort","stateLong","countryShort","country","countryLong","postalCode","address","join","pkey","short","short_name","long_name","_objectSpread","Point","latitude","longitude","coorindates","lat","lng","serialize","json","_json$coordinates","_slicedToArray","getResolved","func","path","resolved","current","isObject","isFunction","pathArray","split","newPath","set","iterations","StoreActions","actions","binding","action","fn","adapter","resource","dirtyAttributes","changes","isLoading","isSaving","isDestroying","isReloading","version","setAdapter","_this$options","store","Store","onAfterFetch","syncAttributes","getAttribute","_this","mergeAttributes","setFlags","create","then","response","update","id","destroy","_this4","findRecord","reset","flags","state","validFlags","flag","Error","attribues","getAttributes","onlyDirty","savedirty","dirtyAttributeKeys","keys","isAttributeFilled","Date","hasAttributes","isNew","isLoaded","_this$attributes","_this5","property","_this$dirtyAttributes","_this$attributes$prop","setAttributes","previousValue","changedAt","setAttribute","attribute","_this$attributes2","defaultValue","_this$attributes3","properties","attributeKeys","every","prop","hasAttribute","_this6","prototype","_value","_value2","_this$attributes4","modelAttributes","orderActions","getDistanceAndTime","params","namespace","getNextActivity","dispatch","post","afterFetch","updateActivity","setDestination","destinationId","captureQrCode","subjectId","captureSignature","complete","cancel","Order","_Resource","isStarted","isCanceled","isCompleted","Payload","entity","waypoints","Entity","Place","_this$getAttribute","_this$getAttribute2","owner","googleAddress","_googleAddress$getAtt2","street1","street2","province","postal_code","neighborhood","district","building","phone","security_access_code","Waypoint","_Place","TrackingStatus","Vehicle","organizationActions","Organization","serializeOrganizations","organizationJson","driverActions","login","identity","password","isPhone","verifyCode","code","track","listOrganizations","switchOrganization","retrieve","syncDevice","Driver","organizationId","next","Vendor","Contact","Zone","ServiceArea","ServiceRate","ServiceQuote","Adapter","config","host","headers","BrowserAdapter","_Adapter","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","_defineProperty","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","_construct","extendStoreActions","extend","extendActions","storage","resourceInstance","_step2","serialized","_iterator2","element","deposit","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","wrap","_context","prev","sent","stop","_x","_x2","_ref2","_callee2","_context2","_x3","_x4","_ref3","_callee3","_context3","_x5","_x6","_ref4","_callee4","_context4","_x7","_x8","_ref5","_callee5","_context5","_x9","_x10","single","_ref6","_callee6","_context6","_x11","_x12","_this7","_ref7","_callee7","_context7","_x13","_x14","Fleetbase","_config$version","_config$host","_config$namespace","debug","startsWith","orders","entities","places","drivers","vehicles","vendors","contacts","organizations","coordinate","isFinite","Math","abs"],"mappings":"i0YAAA,IAAQA,EAAYC,MAAZD,yDCOFE,EAAa,IAIbC,EAAU,SAACC,EAAOC,EAAOC,GAA4B,IAAfC,EAAKC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,GAChD,GAAIR,EAAQI,GACR,GAAIG,EAAME,QAAUP,EAChBE,EAAMO,OAAMC,MAAZR,EAAaC,CAAAA,EAAOC,GAAWO,OAAAC,EAAKP,SACjC,CACHH,EAAMO,OAAON,EAAOC,GAEpB,IAAK,IAAIS,EAAI,EAAGA,EAAIR,EAAME,OAAQM,GAAKb,EAAY,CAC/C,IAAIc,EAAQT,EAAMU,MAAMF,EAAGA,EAAIb,GAC/BE,EAAMO,OAAMC,MAAZR,GAAaC,EAAQU,EAAG,GAACF,OAAAC,EAAKE,IAClC,CACJ,MACOE,EAAaC,MACpBf,EAAMD,QAAQE,EAAOC,EAAaC,EAE1C,EAEMa,EAAmB,SAACC,GAAI,OAAKA,CAAI,EAkBjCH,EAAe,SAACI,GAAK,OAAKA,aAAiBC,CAAU,EAErDC,EAAW,SAACpB,EAAOqB,GACrB,OAAIzB,EAAQI,GACDA,EAAMqB,GACNP,EAAad,GACbA,EAAMoB,SAASC,GAGnB,IACX,EAEMC,EAAO,SAACC,EAAKC,GAEf,OADyC,IAArB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,MAAA8B,KAAIvC,WAC5B,KAAC0d,CAAA,CAzCyB,ohBHsbb,WACb,IAAMhE,EAAI,CAAI,YAAUrZ,OAAAZ,MAAA+P,UAAA/O,MAAA8B,KAAKvC,YAE7B,OAAO4W,GAAOiD,OAAMzZ,MAAbwW,GAAMtW,EAAWoZ,GAC5B,wCAQkB,WACd,IAAMA,EAAI,CAAI,aAAWrZ,OAAAZ,MAAA+P,UAAA/O,MAAA8B,KAAKvC,YAE9B,OAAO4W,GAAOiD,OAAMzZ,MAAbwW,GAAMtW,EAAWoZ,GAC5B,sEIvee,SAAoB8E,GAC/B,OAAOC,SAASD,IAAeE,KAAKC,IAAIH,IAAe,EAC3D,sBCFe,SAAqBA,GAChC,OAAOC,SAASD,IAAeE,KAAKC,IAAIH,IAAe,KAAOE,KAAKC,IAAIH,IAAe,EAC1F"} \ No newline at end of file diff --git a/dist/esm/fleetbase.js b/dist/esm/fleetbase.js index fbc13c6..62582c6 100644 --- a/dist/esm/fleetbase.js +++ b/dist/esm/fleetbase.js @@ -1,2 +1,2 @@ -import t from"axios";function e(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 n(t){for(var n=1;n=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),S(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:L(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function i(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function a(t,e,n,r,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,i)}function s(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){a(o,r,i,s,u,"next",t)}function u(t){a(o,r,i,s,u,"throw",t)}s(void 0)}))}}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}var j=Array.isArray,O="undefined"==typeof arguments?void 0:arguments,$=6e4,R=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(j(t))if(r.length<=$)t.splice.apply(t,[e,n].concat(k(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;return n<0&&(n+=i),F(t,r&&e!=e?function(t){return t!=t}:function(t){return t===e},n)},D=function(t,e,n){return R(t,e,0,[n]),n},N=function(t){v(n,y(Array));var e=m(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 P(this,0)}},{key:"last",get:function(){return P(this,this.length-1)}},{key:"replace",value:function(t,e){return R(this,t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:[]),this}},{key:"objectsAt",value:function(t){var e=this;return t.map((function(t){return P(e,t)}))}},{key:"objectAt",value:function(t){return P(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 r=e;r>=0;r--)if(P(this,r)===t)return r;return-1}},{key:"includes",value:function(t,e){return-1!==z(this,t,e,!0)}},{key:"findBy",value:function(){return t=this,e=L.apply(void 0,arguments),r=e.bind(n),-1===(i=F(t,r,0))?void 0:P(t,i);var t,e,n,r,i}},{key:"findIndexBy",value:function(){return F(this,L.apply(void 0,arguments))}},{key:"isEvery",value:function(){return t=this,e=L.apply(void 0,arguments),r=e.bind(n),-1===F(t,(function(t,e,n){return!r(t,e,n)}),0);var t,e,n,r}},{key:"isAny",value:function(){return t=this,e=L.apply(void 0,arguments),r=e.bind(n),-1!==F(t,r,0);var t,e,n,r}},{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]:_,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 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 R(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=P(this,t-1);return this.removeAt(t-1,1),e}},{key:"shiftObject",value:function(){if(0===this.length)return null;var t=P(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;){P(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}(),C=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},T=function(t){return C(t)||"string"==typeof t&&!1===/\S/.test(t)};function q(t){return isFinite(t)&&Math.abs(t)<=90}function I(t){return isFinite(t)&&Math.abs(t)<=180&&Math.abs(t)>=90}function B(t){return t instanceof Y}var G=function(){var t,e,n;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===(e=e.name)||void 0===e?void 0:e.search(/node|io.js/))||"undefined"!=typeof window&&"ReactNative"!==(null===(n=window)||void 0===n||null===(n=n.navigator)||void 0===n?void 0:n.product))},U=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return G()?_t("adapter","NodeAdapter",t):_t("adapter","BrowserAdapter",t)},J=Array.isArray,W=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(){var t,e=E(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]);try{for(e.s();!(t=e.n()).done;){var n=t.value;if(J(n)){var r=n[0],i=n[1];if(this.has(r))return this.get(r,i)}else if(this.has(n))return this.get(n)}}catch(t){e.e(t)}finally{e.f()}return null}},{key:"has",value:function(t){return t in this.components}},{key:"get",value:function(t){var e=arguments.length>1&&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;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=w(e.coordinates,2),r=n[0];return new t(n[1],r)}}]),t}();"undefined"==typeof arguments||arguments;var M=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,a=o(e),s="object"===a,u="function"===a,c=Array.isArray(e),h="string"===o(n)&&n.includes(".")?n.split("."):[n];if(c||s){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)||this.bind;if(!t)return this;if(null!=this&&this.actions&&"object"===o(this.actions))for(var e in this.actions){var n=this.actions[e];"function"==typeof n?Q(t,e,n.bind(t)):Q(t,e,n)}return this}}]),t}(),Y=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 Pt(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 C(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),j(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(j(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 j(t)?this.hasAttribute(t)&&t.every((function(t){return!C(e.getAttribute(t))})):this.hasAttribute(t)&&!C(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(!j(t))throw new Error("No attribute properties provided!");var n,r=E(t);try{for(r.s();!(n=r.n()).done;){var i,a,s=n.value;if("string"==typeof s){var u=this.getAttribute(s);"object"!==o(null===(i=u)||void 0===i?void 0:i.attributes)||j(null===(a=u)||void 0===a?void 0:a.attributes)||(u=u.attributes),e[s]=u}}}catch(t){r.e(t)}finally{r.f()}return e}},{key:"serialize",value:function(){return this.getAttributes()}},{key:"mergeAttributes",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=null!==(t=null==this?void 0:this.attributes)&&void 0!==t?t:{};return this.attributes=n(n({},r),e),this.attributes}},{key:"syncAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.attributes=t}}]),t}(),Z=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(r,Y);var e=m(r);function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,r),e.call(this,t,i,"order",n({actions:Z},o))}return h(r,[{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")}}]),r}(),tt=function(t){v(n,Y);var e=m(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,Y);var e=m(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 h(n)}(),nt=function(t){v(n,Y);var e=m(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=w(t.getAttribute("coordinates"),2),o=i[0],a=i[1];return new n({name:null,address:t.getAttribute("address"),location:new K(o,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},e,r)}}]),n}(),rt=function(t){v(n,nt);var e=m(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 h(n)}(),it=function(t){v(n,Y);var e=m(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 h(n)}(),ot=function(t){v(n,Y);var e=m(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 h(n)}(),at=new V({login:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(function(){return/^[+]?[\s./0-9]*[(]?[0-9]{1,4}[)]?[-\s./0-9]*$/g.test(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")}(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},r)).then(this.afterFetch.bind(this))},verifyCode:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("drivers/verify-code",n({identity:t,code:e},r)).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))},listOrganizations: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,"/list-organizations"),e,n).then(this.afterFetch.bind(this))},switchOrganization: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,"/switch-organization"),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)}}),st=function(t){v(r,Y);var e=m(r);function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,r),e.call(this,t,i,"driver",n({actions:at},o))}return h(r,[{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)}},{key:"listOrganizations",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.listOrganizations(this.id,t,e)}},{key:"switchOrganization",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.switchOrganization(this.id,{next:t},e)}}]),r}(),ut=function(t){v(n,Y);var e=m(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 h(n)}(),ct=new V({current:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.adapter.get("".concat(this.namespace,"/current"),t,e)}}),ht=function(t){v(r,Y);var e=m(r);function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,r),e.call(this,t,i,"organization",n({actions:ct},o))}return h(r)}(),lt=function(t){v(n,Y);var e=m(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 h(n)}(),vt=function(t){v(n,Y);var e=m(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 h(n)}(),ft=function(t){v(n,Y);var e=m(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 h(n)}(),dt=function(t){v(n,Y);var e=m(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 h(n)}(),gt=function(t){v(n,Y);var e=m(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}(),pt=h((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||{}})),yt=function(t){v(r,pt);var e=m(r);function r(t){var n;return u(this,r),(n=e.call(this,t)).setHeaders({Authorization:"Bearer ".concat(t.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;browser"}),n}return h(r,[{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,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise((function(a,s){return fetch(o.url||"".concat(e.host,"/").concat(e.namespace,"/").concat(t),n({method:r,mode:o.mode||"cors",headers:new Headers(n(n({},e.headers||{}),o.headers||{}))},i)).then(e.parseJSON).then((function(t){return t.ok?a(t.json):s(new Error(t.json.errors?t.json.errors[0]:t.statusText))})).catch((function(t){s(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=T(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)}}]),r}(),bt=function(e){v(i,pt);var r=m(i);function i(e){var n;return u(this,i),(n=r.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 h(i,[{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(j(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=T(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))}}]),i}(),mt=function(t){v(n,pt);var e=m(n);function n(){return u(this,n),e.apply(this,arguments)}return h(n)}(),wt=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=j(e)?e:[e],!j(e))return e instanceof V&&e.extend(t),t;var n,r=E(e);try{for(r.s();!(n=r.n()).done;){var i=n.value;t.extendActions(i)}}catch(t){r.e(t)}finally{r.f()}},Pt=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};u(this,t),this.resource=e,this.adapter=n||U(),this.namespace=kt(e),this.storage=new N,this.options=r,this.extendActions(r.actions)}return h(t,[{key:"extendActions",value:function(){return St(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:[])}},{key:"deposit",value:function(t){return t}},{key:"serialize",value:function(t){return _t("resource",jt(this.resource),t,this.adapter)}},{key:"afterFetch",value:function(t){return function(t,e){if("function"==typeof t.options.onAfterFetch&&t.options.onAfterFetch(e),j(e)){var n,r=[],i=E(e);try{for(i.s();!(n=i.n()).done;){var o=n.value;r.push(t.afterFetch(o))}}catch(t){i.e(t)}finally{i.f()}return p(N,r)}var a=t.serialize(e);return t.deposit(a)}(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=s(r().mark((function i(o,a){var s;return r().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(a);case 2:s=r.sent,o(s);case 4:case"end":return r.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 o=s(r().mark((function o(a,s){var u;return r().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:u=r.sent,a(u);case 4:case"end":return r.stop()}}),o)})));return function(t,e){return o.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=s(r().mark((function i(o,a){var s;return r().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(a);case 2:s=r.sent,o(s);case 4:case"end":return r.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=s(r().mark((function n(i,o){var a;return r().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(o);case 2:a=n.sent,i(a);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=s(r().mark((function i(o,a){var s;return r().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(a);case 2:s=r.sent,o(s);case 4:case"end":return r.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=s(r().mark((function i(o,a){var s;return r().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(a);case 2:s=r.sent,o(s);case 4:case"end":return r.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=s(r().mark((function t(o,a){var s;return r().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(a);case 2:s=t.sent,o(s);case 4:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}())}}]),t}(),Lt=function(){function t(e){var n,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=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:a,publicKey:e},"string"!=typeof e||0===e.length)throw new Error("⚠️ Invalid public key given to Fleetbase SDK");if(!G()&&e.toLowerCase().startsWith("$"))throw new Error("Secret key provided. You must use a public key with Fleetbase Javascript SDK!");this.adapter=o.adapter||U(this.options),this.orders=new Pt("order",this.adapter).extendActions(Z),this.entities=new Pt("entity",this.adapter),this.places=new Pt("place",this.adapter),this.drivers=new Pt("driver",this.adapter).extendActions(at),this.vehicles=new Pt("vehicle",this.adapter),this.vendors=new Pt("vendor",this.adapter),this.contacts=new Pt("contact",this.adapter),this.organizations=new Pt("organization",this.adapter).extendActions(ct)}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}();export{pt as Adapter,yt as BrowserAdapter,N as Collection,lt as Contact,st as Driver,mt as EmberJsAdapter,et as Entity,W as GoogleAddress,bt as NodeAdapter,X as Order,ht as Organization,tt as Payload,nt as Place,K as Point,Y as Resource,ft as ServiceArea,gt as ServiceQuote,dt as ServiceRate,Pt as Store,V as StoreActions,it as TrackingStatus,ot as Vehicle,ut as Vendor,rt as Waypoint,vt as Zone,xt as camelize,jt as classify,Et as dasherize,Lt as default,St as extendStoreActions,q as isLatitude,I as isLongitude,G as isNodeEnvironment,B as isResource,kt as pluralize,At as singularize}; +import t from"axios";function e(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 n(t){for(var n=1;n=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),S(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:L(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function i(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function a(t,e,n,r,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,i)}function s(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){a(o,r,i,s,u,"next",t)}function u(t){a(o,r,i,s,u,"throw",t)}s(void 0)}))}}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}var j=Array.isArray,O="undefined"==typeof arguments?void 0:arguments,$=6e4,R=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(j(t))if(r.length<=$)t.splice.apply(t,[e,n].concat(k(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;return n<0&&(n+=i),z(t,r&&e!=e?function(t){return t!=t}:function(t){return t===e},n)},D=function(t,e,n){return R(t,e,0,[n]),n},N=function(t){v(n,y(Array));var e=m(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 P(this,0)}},{key:"last",get:function(){return P(this,this.length-1)}},{key:"replace",value:function(t,e){return R(this,t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:[]),this}},{key:"objectsAt",value:function(t){var e=this;return t.map((function(t){return P(e,t)}))}},{key:"objectAt",value:function(t){return P(this,t)}},{key:"indexOf",value:function(t,e){return F(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(P(this,r)===t)return r;return-1}},{key:"includes",value:function(t,e){return-1!==F(this,t,e,!0)}},{key:"findBy",value:function(){return t=this,e=L.apply(void 0,arguments),r=e.bind(n),-1===(i=z(t,r,0))?void 0:P(t,i);var t,e,n,r,i}},{key:"findIndexBy",value:function(){return z(this,L.apply(void 0,arguments))}},{key:"isEvery",value:function(){return t=this,e=L.apply(void 0,arguments),r=e.bind(n),-1===z(t,(function(t,e,n){return!r(t,e,n)}),0);var t,e,n,r}},{key:"isAny",value:function(){return t=this,e=L.apply(void 0,arguments),r=e.bind(n),-1!==z(t,r,0);var t,e,n,r}},{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]:_,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 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 R(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=P(this,t-1);return this.removeAt(t-1,1),e}},{key:"shiftObject",value:function(){if(0===this.length)return null;var t=P(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;){P(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}(),C=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},T=function(t){return C(t)||"string"==typeof t&&!1===/\S/.test(t)};function q(t){return isFinite(t)&&Math.abs(t)<=90}function I(t){return isFinite(t)&&Math.abs(t)<=180&&Math.abs(t)>=90}function B(t){return t instanceof Y}var G=function(){var t,e,n;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===(e=e.name)||void 0===e?void 0:e.search(/node|io.js/))||"undefined"!=typeof window&&"ReactNative"!==(null===(n=window)||void 0===n||null===(n=n.navigator)||void 0===n?void 0:n.product))},U=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return G()?St("adapter","NodeAdapter",t):St("adapter","BrowserAdapter",t)},J=Array.isArray,W=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(){var t,e=E(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]);try{for(e.s();!(t=e.n()).done;){var n=t.value;if(J(n)){var r=n[0],i=n[1];if(this.has(r))return this.get(r,i)}else if(this.has(n))return this.get(n)}}catch(t){e.e(t)}finally{e.f()}return null}},{key:"has",value:function(t){return t in this.components}},{key:"get",value:function(t){var e=arguments.length>1&&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;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=w(e.coordinates,2),r=n[0];return new t(n[1],r)}}]),t}();"undefined"==typeof arguments||arguments;var M=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,a=o(e),s="object"===a,u="function"===a,c=Array.isArray(e),h="string"===o(n)&&n.includes(".")?n.split("."):[n];if(c||s){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)||this.bind;if(!t)return this;if(null!=this&&this.actions&&"object"===o(this.actions))for(var e in this.actions){var n=this.actions[e];"function"==typeof n?Q(t,e,n.bind(t)):Q(t,e,n)}return this}}]),t}(),Y=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 Lt(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 C(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),j(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(j(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 j(t)?this.hasAttribute(t)&&t.every((function(t){return!C(e.getAttribute(t))})):this.hasAttribute(t)&&!C(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(!j(t))throw new Error("No attribute properties provided!");var n,r=E(t);try{for(r.s();!(n=r.n()).done;){var i,a,s=n.value;if("string"==typeof s){var u=this.getAttribute(s);"object"!==o(null===(i=u)||void 0===i?void 0:i.attributes)||j(null===(a=u)||void 0===a?void 0:a.attributes)||(u=u.attributes),e[s]=u}}}catch(t){r.e(t)}finally{r.f()}return e}},{key:"serialize",value:function(){return this.getAttributes()}},{key:"mergeAttributes",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=null!==(t=null==this?void 0:this.attributes)&&void 0!==t?t:{};return this.attributes=n(n({},r),e),this.attributes}},{key:"syncAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.attributes=t}}]),t}(),Z=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(r,Y);var e=m(r);function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,r),e.call(this,t,i,"order",n({actions:Z},o))}return h(r,[{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")}}]),r}(),tt=function(t){v(n,Y);var e=m(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,Y);var e=m(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 h(n)}(),nt=function(t){v(n,Y);var e=m(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=w(t.getAttribute("coordinates"),2),o=i[0],a=i[1];return new n({name:null,address:t.getAttribute("address"),location:new K(o,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},e,r)}}]),n}(),rt=function(t){v(n,nt);var e=m(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 h(n)}(),it=function(t){v(n,Y);var e=m(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 h(n)}(),ot=function(t){v(n,Y);var e=m(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 h(n)}(),at=new V({current:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.adapter.get("".concat(this.namespace,"/current"),t,e)}}),st=function(t){v(r,Y);var e=m(r);function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,r),e.call(this,t,i,"organization",n({actions:at},o))}return h(r)}(),ut=function(t,e){return j(t)?t.map((function(t){return new st(t,e)})):new st(t,e)},ct=new V({login:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(function(){return/^[+]?[\s./0-9]*[(]?[0-9]{1,4}[)]?[-\s./0-9]*$/g.test(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")}(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},r)).then(this.afterFetch.bind(this))},verifyCode:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.adapter.post("drivers/verify-code",n({identity:t,code:e},r)).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))},listOrganizations: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 this.adapter.get("drivers/".concat(t,"/organizations"),n,r).then((function(t){return ut(t,e.adapter)}))},switchOrganization: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 this.adapter.post("drivers/".concat(t,"/switch-organization"),n,r).then((function(t){return ut(t,e.adapter)}))},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)}}),ht=function(t){v(r,Y);var e=m(r);function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,r),e.call(this,t,i,"driver",n({actions:ct},o))}return h(r,[{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)}},{key:"listOrganizations",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.listOrganizations(this.id,t,e)}},{key:"switchOrganization",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.store.switchOrganization(this.id,{next:t},e)}}]),r}(),lt=function(t){v(n,Y);var e=m(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 h(n)}(),vt=function(t){v(n,Y);var e=m(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 h(n)}(),ft=function(t){v(n,Y);var e=m(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 h(n)}(),dt=function(t){v(n,Y);var e=m(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 h(n)}(),gt=function(t){v(n,Y);var e=m(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 h(n)}(),pt=function(t){v(n,Y);var e=m(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}(),yt=h((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||{}})),bt=function(t){v(r,yt);var e=m(r);function r(t){var n;return u(this,r),(n=e.call(this,t)).setHeaders({Authorization:"Bearer ".concat(t.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;browser"}),n}return h(r,[{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,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise((function(a,s){return fetch(o.url||"".concat(e.host,"/").concat(e.namespace,"/").concat(t),n({method:r,mode:o.mode||"cors",headers:new Headers(n(n({},e.headers||{}),o.headers||{}))},i)).then(e.parseJSON).then((function(t){return t.ok?a(t.json):s(new Error(t.json.errors?t.json.errors[0]:t.statusText))})).catch((function(t){s(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=T(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)}}]),r}(),mt=function(e){v(i,yt);var r=m(i);function i(e){var n;return u(this,i),(n=r.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 h(i,[{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(j(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=T(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))}}]),i}(),wt=function(t){v(n,yt);var e=m(n);function n(){return u(this,n),e.apply(this,arguments)}return h(n)}(),kt=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=j(e)?e:[e],!j(e))return e instanceof V&&e.extend(t),t;var n,r=E(e);try{for(r.s();!(n=r.n()).done;){var i=n.value;t.extendActions(i)}}catch(t){r.e(t)}finally{r.f()}},Lt=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};u(this,t),this.resource=e,this.adapter=n||U(),this.namespace=At(e),this.storage=new N,this.options=r,this.extendActions(r.actions)}return h(t,[{key:"extendActions",value:function(){return Pt(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:[])}},{key:"deposit",value:function(t){return t}},{key:"serialize",value:function(t){return St("resource",Ot(this.resource),t,this.adapter)}},{key:"afterFetch",value:function(t){return function(t,e){if("function"==typeof t.options.onAfterFetch&&t.options.onAfterFetch(e),j(e)){var n,r=[],i=E(e);try{for(i.s();!(n=i.n()).done;){var o=n.value;r.push(t.afterFetch(o))}}catch(t){i.e(t)}finally{i.f()}return p(N,r)}var a=t.serialize(e);return t.deposit(a)}(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=s(r().mark((function i(o,a){var s;return r().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(a);case 2:s=r.sent,o(s);case 4:case"end":return r.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 o=s(r().mark((function o(a,s){var u;return r().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:u=r.sent,a(u);case 4:case"end":return r.stop()}}),o)})));return function(t,e){return o.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=s(r().mark((function i(o,a){var s;return r().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(a);case 2:s=r.sent,o(s);case 4:case"end":return r.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=s(r().mark((function n(i,o){var a;return r().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(o);case 2:a=n.sent,i(a);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=s(r().mark((function i(o,a){var s;return r().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(a);case 2:s=r.sent,o(s);case 4:case"end":return r.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=s(r().mark((function i(o,a){var s;return r().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(a);case 2:s=r.sent,o(s);case 4:case"end":return r.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=s(r().mark((function t(o,a){var s;return r().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(a);case 2:s=t.sent,o(s);case 4:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}())}}]),t}(),zt=function(){function t(e){var n,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=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:a,publicKey:e},"string"!=typeof e||0===e.length)throw new Error("⚠️ Invalid public key given to Fleetbase SDK");if(!G()&&e.toLowerCase().startsWith("$"))throw new Error("Secret key provided. You must use a public key with Fleetbase Javascript SDK!");this.adapter=o.adapter||U(this.options),this.orders=new Lt("order",this.adapter).extendActions(Z),this.entities=new Lt("entity",this.adapter),this.places=new Lt("place",this.adapter),this.drivers=new Lt("driver",this.adapter).extendActions(ct),this.vehicles=new Lt("vehicle",this.adapter),this.vendors=new Lt("vendor",this.adapter),this.contacts=new Lt("contact",this.adapter),this.organizations=new Lt("organization",this.adapter).extendActions(at)}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}();export{yt as Adapter,bt as BrowserAdapter,N as Collection,vt as Contact,ht as Driver,wt as EmberJsAdapter,et as Entity,W as GoogleAddress,mt as NodeAdapter,X as Order,st as Organization,tt as Payload,nt as Place,K as Point,Y as Resource,dt as ServiceArea,pt as ServiceQuote,gt as ServiceRate,Lt as Store,V as StoreActions,it as TrackingStatus,ot as Vehicle,lt as Vendor,rt as Waypoint,ft as Zone,Et as camelize,Ot as classify,jt as dasherize,zt as default,Pt as extendStoreActions,q as isLatitude,I as isLongitude,G as isNodeEnvironment,B as isResource,At as pluralize,xt as singularize}; //# sourceMappingURL=fleetbase.js.map diff --git a/dist/esm/fleetbase.js.map b/dist/esm/fleetbase.js.map index 149dd81..8038c6d 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/organization.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 { isArray };\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 (const element of sortKeys) {\n let key = element;\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","/**\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 (\n typeof process !== 'undefined' &&\n (typeof process?.env === 'object' || process.release?.name?.search(/node|io.js/) !== -1) &&\n (typeof window === 'undefined' || window?.navigator?.product === 'ReactNative')\n );\n};\n\nexport default isNodeEnvironment;\n","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;\n","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 (const element of keys) {\n const key = element;\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 const [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}\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 (const element of classes) {\n for (const property in element) {\n if (Object.prototype.hasOwnProperty.call(element, property)) {\n target[property] = element[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 // 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 (const element of properties) {\n const property = element;\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';\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 constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'payload', options);\n }\n\n /**\n * Attaches an entity to an existing payload and returns\n * the payload with the entity attached\n *\n * @param {[type]} Entity entity [description]\n * @return {[type]} [description]\n */\n attach(entity) {\n // perform op return payload\n }\n\n /**\n * Returns all of the entities attached to this payload\n *\n * @return {[type]} [description]\n */\n get entities() {}\n\n /**\n * Returns the dropoff for this payload\n *\n * @return {[type]} [description]\n */\n get dropoff() {}\n\n /**\n * Returns the pickup for this payload\n *\n * @return {[type]} [description]\n */\n get pickup() {}\n\n /**\n * Returns all the waypoints for this payload\n *\n * @return {[type]} [description]\n */\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 listOrganizations: function (id, params = {}, options = {}) {\n return this.adapter.post(`drivers/${id}/list-organizations`, params, options).then(this.afterFetch.bind(this));\n },\n\n switchOrganization: function (id, params = {}, options = {}) {\n return this.adapter.post(`drivers/${id}/switch-organization`, 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 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 listOrganizations(params = {}, options = {}) {\n return this.store.listOrganizations(this.id, params, options);\n }\n\n switchOrganization(organizationId, options = {}) {\n return this.store.switchOrganization(this.id, { next: organizationId }, 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';\nimport { StoreActions } from '../utils';\n\nconst organizationActions = new StoreActions({\n current: function (params = {}, options = {}) {\n return this.adapter.get(`${this.namespace}/current`, params, options);\n },\n});\n\nclass Organization extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'organization', { actions: organizationActions, ...options });\n }\n}\n\nexport default Organization;\nexport { organizationActions };\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 fromPayload() {}\n}\n\nexport default ServiceQuote;\n","class Adapter {\n /**\n * Creates a configured base adapter for Fleetbase.\n *\n * @param {Object} config Configuration options for adapter\n */\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) =>\n response\n .json()\n .then((json) =>\n resolve({\n statusText: response.statusText,\n status: response.status,\n ok: response.ok,\n json,\n })\n )\n .catch(() => {\n reject(new Error('Oops! Something went wrong when handling your request.'));\n })\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) =>\n 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 /**\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 { pluralize, singularize, humanize, underscore, camelize, capitalize, dasherize, normify, demodulize, tableize, classify, foreignKey };\n","import { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote, Organization } 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 Organization,\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 { Collection, StoreActions, detectAdapter, isResource } from './utils';\nimport { isArray } from './utils/array';\nimport { classify, pluralize } from './utils/string';\n\nconst extendStoreActions = (store, actions = []) => {\n store.actions = isArray(actions) ? actions : [actions];\n\n if (isArray(actions)) {\n for (const element of actions) {\n const action = element;\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 (const element of json) {\n serialized.push(store.afterFetch(element));\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 { afterFetch, extendStoreActions };\n","import Store from './store';\nimport Resource from './resource';\nimport { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote, Organization } 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';\nimport { organizationActions } from './resources/organization';\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 this.organizations = new Store('organization', this.adapter).extendActions(organizationActions);\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 Organization,\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","arguments","length","undefined","splice","apply","concat","_toConsumableArray","i","chunk","slice","isCollection","arr","identityFunction","item","mixed","Collection","objectAt","index","iter","key","value","Boolean","findIndex","predicate","startAt","len","indexOf","val","withNaNCheck","insertAt","_Array","_inherits","_wrapNativeSuper","_super","_createSuper","_len","_key","_classCallCheck","_possibleConstructorReturn","call","_createClass","get","this","indexes","_this2","map","idx","object","callback","bind","target","cb","methodName","_len2","args","_key2","ret","forEach","_item$methodName","push","filter","sortKeys","sort","a","b","_step","_iterator","_createForOfIteratorHelper","s","n","done","propA","propB","compareValue","compare","err","e","f","seen","Set","getter","has","add","uniqBy","includes","removeAt","obj","objects","toArray","reverse","clear","loc","removeObject","pushObject","_this3","addObject","isEmpty","none","size","objectType","_typeof","isBlank","test","isLatitude","coordinate","isFinite","Math","abs","isLongitude","isResource","record","Resource","isNodeEnvironment","_process","_process$release","_window","process","env","release","name","search","window","navigator","product","detectAdapter","options","lookup","GoogleAddress","place","geometry","components","parseComponents","attributes","parseProperties","_this$place","address_components","reduce","acc","data","types","type","_this$geometry","streetNumber","streetName","coordinates","location","Object","values","city","or","county","stateShort","stateLong","countryShort","country","countryLong","postalCode","address","join","pkey","short","short_name","long_name","_objectSpread","Point","latitude","longitude","coorindates","lat","lng","serialize","json","_json$coordinates","_slicedToArray","getResolved","func","path","resolved","current","isObject","isFunction","pathArray","split","newPath","set","iterations","StoreActions","actions","binding","action","fn","adapter","resource","dirtyAttributes","changes","isLoading","isSaving","isDestroying","isReloading","version","setAdapter","_this$options","store","Store","onAfterFetch","syncAttributes","getAttribute","_this","mergeAttributes","setFlags","create","then","response","update","id","destroy","_this4","findRecord","reset","flags","state","validFlags","flag","Error","attribues","getAttributes","onlyDirty","savedirty","dirtyAttributeKeys","keys","isAttributeFilled","Date","hasAttributes","isNew","isLoaded","_this$attributes","_this5","property","_this$dirtyAttributes","_this$attributes$prop","setAttributes","previousValue","changedAt","setAttribute","attribute","_this$attributes2","defaultValue","_this$attributes3","properties","attributeKeys","every","prop","hasAttribute","_this6","prototype","_value","_value2","_this$attributes4","modelAttributes","orderActions","getDistanceAndTime","params","namespace","getNextActivity","dispatch","post","afterFetch","updateActivity","setDestination","destinationId","captureQrCode","subjectId","captureSignature","complete","cancel","Order","_Resource","isStarted","isCanceled","isCompleted","Payload","entity","waypoints","Entity","Place","_this$getAttribute","_this$getAttribute2","owner","googleAddress","_googleAddress$getAtt2","street1","street2","province","postal_code","neighborhood","district","building","phone","security_access_code","Waypoint","_Place","TrackingStatus","Vehicle","driverActions","login","identity","password","isPhone","verifyCode","code","track","listOrganizations","switchOrganization","retrieve","syncDevice","Driver","organizationId","next","Vendor","organizationActions","Organization","Contact","Zone","ServiceArea","ServiceRate","ServiceQuote","Adapter","config","host","headers","BrowserAdapter","_Adapter","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","_defineProperty","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","_construct","extendStoreActions","extend","extendActions","storage","resourceInstance","_step2","serialized","_iterator2","element","deposit","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","wrap","_context","prev","sent","stop","_x","_x2","_ref2","_callee2","_context2","_x3","_x4","_ref3","_callee3","_context3","_x5","_x6","_ref4","_callee4","_context4","_x7","_x8","_ref5","_callee5","_context5","_x9","_x10","single","_ref6","_callee6","_context6","_x11","_x12","_this7","_ref7","_callee7","_context7","_x13","_x14","Fleetbase","_config$version","_config$host","_config$namespace","debug","startsWith","orders","entities","places","drivers","vehicles","vendors","contacts","organizations"],"mappings":"2vYAAA,IAAQA,EAAYC,MAAZD,yDCOFE,EAAa,IAIbC,EAAU,SAACC,EAAOC,EAAOC,GA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,2BACrB3N,UAA2B4N,QAAlBA,EAAE3J,EAAOjE,iBAAS4N,IAAAA,EAAAA,EAAIxb,KAAK6J,QACpC4R,MAAAA,EACArJ,UAAAA,GAGqB,iBAAdA,GAA+C,IAArBA,EAAU7U,OAC3C,MAAM,IAAI8N,MAAM,gDAGpB,IAAK/G,KAAuB8N,EAAU2C,cAAc2G,WAAW,KAC3D,MAAM,IAAIrQ,MAAM,iFAGpBrL,KAAKqJ,QAAUwI,EAAOxI,SAAWnE,EAAclF,KAAKmF,SAEpDnF,KAAK2b,OAAS,IAAI1R,GAAM,QAASjK,KAAKqJ,SAAS4O,cAAcxK,GAC7DzN,KAAK4b,SAAW,IAAI3R,GAAM,SAAUjK,KAAKqJ,SACzCrJ,KAAK6b,OAAS,IAAI5R,GAAM,QAASjK,KAAKqJ,SACtCrJ,KAAK8b,QAAU,IAAI7R,GAAM,SAAUjK,KAAKqJ,SAAS4O,cAAc5H,IAC/DrQ,KAAK+b,SAAW,IAAI9R,GAAM,UAAWjK,KAAKqJ,SAC1CrJ,KAAKgc,QAAU,IAAI/R,GAAM,SAAUjK,KAAKqJ,SACxCrJ,KAAKic,SAAW,IAAIhS,GAAM,UAAWjK,KAAKqJ,SAC1CrJ,KAAKkc,cAAgB,IAAIjS,GAAM,eAAgBjK,KAAKqJ,SAAS4O,cAAc5G,GAC/E,CAIC,OAJAvR,EAAAub,EAAA,CAAA,CAAA5c,IAAA,aAAAC,MAMD,SAAW2K,GACPrJ,KAAKqJ,QAAUA,CACnB,GAAC,CAAA5K,IAAA,aAAAC,MAED,WACI,OAAOsB,KAAKqJ,OAChB,IAAC,CAAA,CAAA5K,IAAA,cAAAC,MAVD,WACI,OAAAoZ,EAAWuD,EAASte,MAAAqQ,UAAArP,MAAA8B,KAAIvC,WAC5B,KAAC+d,CAAA,CAzCyB"} \ 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/organization.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 { isArray };\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 (const element of sortKeys) {\n let key = element;\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","/**\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 (\n typeof process !== 'undefined' &&\n (typeof process?.env === 'object' || process.release?.name?.search(/node|io.js/) !== -1) &&\n (typeof window === 'undefined' || window?.navigator?.product === 'ReactNative')\n );\n};\n\nexport default isNodeEnvironment;\n","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;\n","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 (const element of keys) {\n const key = element;\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 const [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}\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 (const element of classes) {\n for (const property in element) {\n if (Object.prototype.hasOwnProperty.call(element, property)) {\n target[property] = element[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 // 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 (const element of properties) {\n const property = element;\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';\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 constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'payload', options);\n }\n\n /**\n * Attaches an entity to an existing payload and returns\n * the payload with the entity attached\n *\n * @param {[type]} Entity entity [description]\n * @return {[type]} [description]\n */\n attach(entity) {\n // perform op return payload\n }\n\n /**\n * Returns all of the entities attached to this payload\n *\n * @return {[type]} [description]\n */\n get entities() {}\n\n /**\n * Returns the dropoff for this payload\n *\n * @return {[type]} [description]\n */\n get dropoff() {}\n\n /**\n * Returns the pickup for this payload\n *\n * @return {[type]} [description]\n */\n get pickup() {}\n\n /**\n * Returns all the waypoints for this payload\n *\n * @return {[type]} [description]\n */\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 } from '../utils';\n\nconst organizationActions = new StoreActions({\n current: function (params = {}, options = {}) {\n return this.adapter.get(`${this.namespace}/current`, params, options);\n },\n});\n\nclass Organization extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'organization', { actions: organizationActions, ...options });\n }\n}\n\nexport default Organization;\nexport { organizationActions };\n","import Resource from '../resource';\nimport Organization from './organization';\nimport { StoreActions, isPhone, Collection } from '../utils';\nimport { isArray } from '../utils/array';\n\nconst serializeOrganizations = (response, adapter) => {\n if (isArray(response)) {\n return response.map((organizationJson) => {\n return new Organization(organizationJson, adapter);\n });\n }\n\n return new Organization(response, adapter);\n};\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 listOrganizations: function (id, params = {}, options = {}) {\n return this.adapter.get(`drivers/${id}/organizations`, params, options).then((response) => serializeOrganizations(response, this.adapter));\n },\n\n switchOrganization: function (id, params = {}, options = {}) {\n return this.adapter.post(`drivers/${id}/switch-organization`, params, options).then((response) => serializeOrganizations(response, this.adapter));\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 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 listOrganizations(params = {}, options = {}) {\n return this.store.listOrganizations(this.id, params, options);\n }\n\n switchOrganization(organizationId, options = {}) {\n return this.store.switchOrganization(this.id, { next: organizationId }, 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 fromPayload() {}\n}\n\nexport default ServiceQuote;\n","class Adapter {\n /**\n * Creates a configured base adapter for Fleetbase.\n *\n * @param {Object} config Configuration options for adapter\n */\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) =>\n response\n .json()\n .then((json) =>\n resolve({\n statusText: response.statusText,\n status: response.status,\n ok: response.ok,\n json,\n })\n )\n .catch(() => {\n reject(new Error('Oops! Something went wrong when handling your request.'));\n })\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) =>\n 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 /**\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 { pluralize, singularize, humanize, underscore, camelize, capitalize, dasherize, normify, demodulize, tableize, classify, foreignKey };\n","import { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote, Organization } 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 Organization,\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 { Collection, StoreActions, detectAdapter, isResource } from './utils';\nimport { isArray } from './utils/array';\nimport { classify, pluralize } from './utils/string';\n\nconst extendStoreActions = (store, actions = []) => {\n store.actions = isArray(actions) ? actions : [actions];\n\n if (isArray(actions)) {\n for (const element of actions) {\n const action = element;\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 (const element of json) {\n serialized.push(store.afterFetch(element));\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 { afterFetch, extendStoreActions };\n","import Store from './store';\nimport Resource from './resource';\nimport { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote, Organization } 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';\nimport { organizationActions } from './resources/organization';\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 this.organizations = new Store('organization', this.adapter).extendActions(organizationActions);\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 Organization,\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","arguments","length","undefined","splice","apply","concat","_toConsumableArray","i","chunk","slice","isCollection","arr","identityFunction","item","mixed","Collection","objectAt","index","iter","key","value","Boolean","findIndex","predicate","startAt","len","indexOf","val","withNaNCheck","insertAt","_Array","_inherits","_wrapNativeSuper","_super","_createSuper","_len","_key","_classCallCheck","_possibleConstructorReturn","call","_createClass","get","this","indexes","_this2","map","idx","object","callback","bind","target","cb","methodName","_len2","args","_key2","ret","forEach","_item$methodName","push","filter","sortKeys","sort","a","b","_step","_iterator","_createForOfIteratorHelper","s","n","done","propA","propB","compareValue","compare","err","e","f","seen","Set","getter","has","add","uniqBy","includes","removeAt","obj","objects","toArray","reverse","clear","loc","removeObject","pushObject","_this3","addObject","isEmpty","none","size","objectType","_typeof","isBlank","test","isLatitude","coordinate","isFinite","Math","abs","isLongitude","isResource","record","Resource","isNodeEnvironment","_process","_process$release","_window","process","env","release","name","search","window","navigator","product","detectAdapter","options","lookup","GoogleAddress","place","geometry","components","parseComponents","attributes","parseProperties","_this$place","address_components","reduce","acc","data","types","type","_this$geometry","streetNumber","streetName","coordinates","location","Object","values","city","or","county","stateShort","stateLong","countryShort","country","countryLong","postalCode","address","join","pkey","short","short_name","long_name","_objectSpread","Point","latitude","longitude","coorindates","lat","lng","serialize","json","_json$coordinates","_slicedToArray","getResolved","func","path","resolved","current","isObject","isFunction","pathArray","split","newPath","set","iterations","StoreActions","actions","binding","action","fn","adapter","resource","dirtyAttributes","changes","isLoading","isSaving","isDestroying","isReloading","version","setAdapter","_this$options","store","Store","onAfterFetch","syncAttributes","getAttribute","_this","mergeAttributes","setFlags","create","then","response","update","id","destroy","_this4","findRecord","reset","flags","state","validFlags","flag","Error","attribues","getAttributes","onlyDirty","savedirty","dirtyAttributeKeys","keys","isAttributeFilled","Date","hasAttributes","isNew","isLoaded","_this$attributes","_this5","property","_this$dirtyAttributes","_this$attributes$prop","setAttributes","previousValue","changedAt","setAttribute","attribute","_this$attributes2","defaultValue","_this$attributes3","properties","attributeKeys","every","prop","hasAttribute","_this6","prototype","_value","_value2","_this$attributes4","modelAttributes","orderActions","getDistanceAndTime","params","namespace","getNextActivity","dispatch","post","afterFetch","updateActivity","setDestination","destinationId","captureQrCode","subjectId","captureSignature","complete","cancel","Order","_Resource","isStarted","isCanceled","isCompleted","Payload","entity","waypoints","Entity","Place","_this$getAttribute","_this$getAttribute2","owner","googleAddress","_googleAddress$getAtt2","street1","street2","province","postal_code","neighborhood","district","building","phone","security_access_code","Waypoint","_Place","TrackingStatus","Vehicle","organizationActions","Organization","serializeOrganizations","organizationJson","driverActions","login","identity","password","isPhone","verifyCode","code","track","listOrganizations","switchOrganization","retrieve","syncDevice","Driver","organizationId","next","Vendor","Contact","Zone","ServiceArea","ServiceRate","ServiceQuote","Adapter","config","host","headers","BrowserAdapter","_Adapter","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","_defineProperty","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","_construct","extendStoreActions","extend","extendActions","storage","resourceInstance","_step2","serialized","_iterator2","element","deposit","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","wrap","_context","prev","sent","stop","_x","_x2","_ref2","_callee2","_context2","_x3","_x4","_ref3","_callee3","_context3","_x5","_x6","_ref4","_callee4","_context4","_x7","_x8","_ref5","_callee5","_context5","_x9","_x10","single","_ref6","_callee6","_context6","_x11","_x12","_this7","_ref7","_callee7","_context7","_x13","_x14","Fleetbase","_config$version","_config$host","_config$namespace","debug","startsWith","orders","entities","places","drivers","vehicles","vendors","contacts","organizations"],"mappings":"2vYAAA,IAAQA,EAAYC,MAAZD,yDCOFE,EAAa,IAIbC,EAAU,SAACC,EAAOC,EAAOC,GAA4B,IAAfC,EAAKC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,GAChD,GAAIR,EAAQI,GACR,GAAIG,EAAME,QAAUP,EAChBE,EAAMO,OAAMC,MAAZR,EAAaC,CAAAA,EAAOC,GAAWO,OAAAC,EAAKP,SACjC,CACHH,EAAMO,OAAON,EAAOC,GAEpB,IAAK,IAAIS,EAAI,EAAGA,EAAIR,EAAME,OAAQM,GAAKb,EAAY,CAC/C,IAAIc,EAAQT,EAAMU,MAAMF,EAAGA,EAAIb,GAC/BE,EAAMO,OAAMC,MAAZR,GAAaC,EAAQU,EAAG,GAACF,OAAAC,EAAKE,IAClC,CACJ,MACOE,EAAaC,MACpBf,EAAMD,QAAQE,EAAOC,EAAaC,EAE1C,EAEMa,EAAmB,SAACC,GAAI,OAAKA,CAAI,EAkBjCH,EAAe,SAACI,GAAK,OAAKA,aAAiBC,CAAU,EAErDC,EAAW,SAACpB,EAAOqB,GACrB,OAAIzB,EAAQI,GACDA,EAAMqB,GACNP,EAAad,GACbA,EA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zN,KAAK8b,SAAW,IAAI7R,GAAM,SAAUjK,KAAKqJ,SACzCrJ,KAAK+b,OAAS,IAAI9R,GAAM,QAASjK,KAAKqJ,SACtCrJ,KAAKgc,QAAU,IAAI/R,GAAM,SAAUjK,KAAKqJ,SAAS8O,cAAc1H,IAC/DzQ,KAAKic,SAAW,IAAIhS,GAAM,UAAWjK,KAAKqJ,SAC1CrJ,KAAKkc,QAAU,IAAIjS,GAAM,SAAUjK,KAAKqJ,SACxCrJ,KAAKmc,SAAW,IAAIlS,GAAM,UAAWjK,KAAKqJ,SAC1CrJ,KAAKoc,cAAgB,IAAInS,GAAM,eAAgBjK,KAAKqJ,SAAS8O,cAAc9H,GAC/E,CAIC,OAJAvQ,EAAAyb,EAAA,CAAA,CAAA9c,IAAA,aAAAC,MAMD,SAAW2K,GACPrJ,KAAKqJ,QAAUA,CACnB,GAAC,CAAA5K,IAAA,aAAAC,MAED,WACI,OAAOsB,KAAKqJ,OAChB,IAAC,CAAA,CAAA5K,IAAA,cAAAC,MAVD,WACI,OAAAsZ,EAAWuD,EAASxe,MAAAqQ,UAAArP,MAAA8B,KAAIvC,WAC5B,KAACie,CAAA,CAzCyB"} \ No newline at end of file diff --git a/package.json b/package.json index af0a461..8d9f48a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fleetbase/sdk", - "version": "1.2.7", + "version": "1.2.8", "description": "Fleetbase JS & Node SDK", "main": "dist/cjs/fleetbase.js", "module": "dist/esm/fleetbase.js", @@ -19,7 +19,10 @@ "dev": "rollup -c -w", "test": "mocha --require @babel/polyfill --require @babel/register --require source-map-support/register tests/*.test.js", "prepare": "husky install", - "format": "prettier . --write" + "format": "prettier . --write", + "publish-verdaccio": "npm publish --registry http://localhost:4873", + "unpublish-verdaccio": "npm unpublish --registry http://localhost:4873 --force", + "reset-verdaccio": "pnpm unpublish-verdaccio && pnpm publish-verdaccio" }, "author": "Ronald A. Richardson (https://ron.dev)", "license": "BSD-3-Clause", diff --git a/src/resources/driver.js b/src/resources/driver.js index a412e80..9ce9647 100644 --- a/src/resources/driver.js +++ b/src/resources/driver.js @@ -1,5 +1,17 @@ import Resource from '../resource'; -import { StoreActions, isPhone, isEmail } from '../utils'; +import Organization from './organization'; +import { StoreActions, isPhone, Collection } from '../utils'; +import { isArray } from '../utils/array'; + +const serializeOrganizations = (response, adapter) => { + if (isArray(response)) { + return response.map((organizationJson) => { + return new Organization(organizationJson, adapter); + }); + } + + return new Organization(response, adapter); +}; const driverActions = new StoreActions({ // const { error } = await fleetbase.drivers.login('+1 111-1111'); @@ -25,11 +37,11 @@ const driverActions = new StoreActions({ }, listOrganizations: function (id, params = {}, options = {}) { - return this.adapter.post(`drivers/${id}/list-organizations`, params, options).then(this.afterFetch.bind(this)); + return this.adapter.get(`drivers/${id}/organizations`, params, options).then((response) => serializeOrganizations(response, this.adapter)); }, switchOrganization: function (id, params = {}, options = {}) { - return this.adapter.post(`drivers/${id}/switch-organization`, params, options).then(this.afterFetch.bind(this)); + return this.adapter.post(`drivers/${id}/switch-organization`, params, options).then((response) => serializeOrganizations(response, this.adapter)); }, retrieve: function (id) {