Socket
Socket
Sign inDemoInstall

dispatch-node-sdk

Package Overview
Dependencies
1
Maintainers
24
Versions
148
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.13.0 to 3.13.1-0

.eslintrc.json

287

dist/lib/analytics.js

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,113 +6,200 @@ Object.defineProperty(exports, "__esModule", {

});
exports["default"] = void 0;
var Analytics = {
Event: {
// Appointments
ADD_APPOINTMENT: 'appointment_created', // 'Appointment created',
APPOINTMENT_CANCELED: 'appointment_canceled', // Appointment started
APPOINTMENT_COMPLETED: 'appointment_completed', // Appointment completed
APPOINTMENT_ENROUTE: 'appointment_enroute', // en route to appointment
APPOINTMENT_SCHEDULED: 'appointment_scheduled', // Appointment scheduled
APPOINTMENT_STARTED: 'appointment_started', // Appointment started
RESCHEDULE_APPOINTMENT: 'appointment_rescheduled', // 'Appointment rescheduled'
SUGGESTED_TIME_SELECTED: 'suggested_time_selected', // Suggested time was selected to schedule an appointment
UNABLE_TO_ADD_TECH: 'add_tech_error', // 'Unable to add tech'
ADD_APPOINTMENT: 'appointment_created',
// 'Appointment created',
APPOINTMENT_CANCELED: 'appointment_canceled',
// Appointment started
APPOINTMENT_COMPLETED: 'appointment_completed',
// Appointment completed
APPOINTMENT_ENROUTE: 'appointment_enroute',
// en route to appointment
APPOINTMENT_SCHEDULED: 'appointment_scheduled',
// Appointment scheduled
APPOINTMENT_STARTED: 'appointment_started',
// Appointment started
RESCHEDULE_APPOINTMENT: 'appointment_rescheduled',
// 'Appointment rescheduled'
SUGGESTED_TIME_SELECTED: 'suggested_time_selected',
// Suggested time was selected to schedule an appointment
UNABLE_TO_ADD_TECH: 'add_tech_error',
// 'Unable to add tech'
// Jobs
ACCEPT_OFFER: 'offer_accepted', // 'Tapped accept offer button',
ACCEPT_OFFER_WITH_SUGGESTED_TIME: 'offer_accepted_with_suggested_time', // Accept an offer with a selected suggested time
ADD_FILTER: 'filter_added', // 'Applied job filter',
ADD_LABEL: 'label_added', // Added a label
ADD_NOTE: 'note_added', // 'Added a note'
ADD_PHOTO: 'photo_added', // 'Added a photo'
CALL_CUSTOMER: 'call_customer_initiated', // 'Tapped call customer button',
CANCEL_JOB: 'job_canceled', // 'Tapped cancel job button',
CANNOT_CALL_CUSTOMER: 'call_customer_failed', // 'Tapped Cannot Contact Customer Button'
CHANGE_DIAL_CODE: 'country_dial_changed', // Changed country dial code
COMPOSER_ATTACHMENT: 'composer_attachment_clicked', // Clicked Attachment in Composer
ACCEPT_OFFER: 'offer_accepted',
// 'Tapped accept offer button',
ACCEPT_OFFER_WITH_SUGGESTED_TIME: 'offer_accepted_with_suggested_time',
// Accept an offer with a selected suggested time
ADD_FILTER: 'filter_added',
// 'Applied job filter',
ADD_LABEL: 'label_added',
// Added a label
ADD_NOTE: 'note_added',
// 'Added a note'
ADD_PHOTO: 'photo_added',
// 'Added a photo'
CALL_CUSTOMER: 'call_customer_initiated',
// 'Tapped call customer button',
CANCEL_JOB: 'job_canceled',
// 'Tapped cancel job button',
CANNOT_CALL_CUSTOMER: 'call_customer_failed',
// 'Tapped Cannot Contact Customer Button'
CHANGE_DIAL_CODE: 'country_dial_changed',
// Changed country dial code
COMPOSER_ATTACHMENT: 'composer_attachment_clicked',
// Clicked Attachment in Composer
COMPOSER_NOTE: 'composer_notes_clicked',
COMPOSER_STATUS: 'composer_status_clicked', // Clicked Status Tab of Composer
CONTACT_CUSTOMER: 'contact_customer_', // Tapped contact customer button
DECLINE_OFFER: 'offer_declined', // Tapped decline offer button
ERROR_LOGGING_IN: 'logging_in_error', // Error logging in
FLOATING_ACTION_BUTTON: 'floating_action_clicked', // Tapped floating action button
JOB_COMPLETED: 'job_completed', // Job completed
JOB_CREATED: 'job_created', // Job created
REMOVE_LABEL: 'label_removed', // Removed a label
TEXT_CUSTOMER: 'text_customer_clicked', // 'Tapped text customer button'
VIEW_JOB_DETAILS_ACTIONS: 'view_job_details_actions_clicked', // 'Tapped Job Actions Button'
VIEW_MAP: 'view_map_clicked', // 'Tapped map button'
VIEW_PHOTO: 'view_photo_clicked', // 'Opened photo in gallery'
COMPOSER_STATUS: 'composer_status_clicked',
// Clicked Status Tab of Composer
CONTACT_CUSTOMER: 'contact_customer_',
// Tapped contact customer button
DECLINE_OFFER: 'offer_declined',
// Tapped decline offer button
ERROR_LOGGING_IN: 'logging_in_error',
// Error logging in
FLOATING_ACTION_BUTTON: 'floating_action_clicked',
// Tapped floating action button
JOB_COMPLETED: 'job_completed',
// Job completed
JOB_CREATED: 'job_created',
// Job created
REMOVE_LABEL: 'label_removed',
// Removed a label
TEXT_CUSTOMER: 'text_customer_clicked',
// 'Tapped text customer button'
VIEW_JOB_DETAILS_ACTIONS: 'view_job_details_actions_clicked',
// 'Tapped Job Actions Button'
VIEW_MAP: 'view_map_clicked',
// 'Tapped map button'
VIEW_PHOTO: 'view_photo_clicked',
// 'Opened photo in gallery'
// General App
INTERCOM_LINK_CLICKED: 'intercom_chat_link_clicked', // Tapped Intercom chat link
INVALID_PHONE: 'invalid_phone_number_entered', // Invalid phone number entered
INVALID_USER_UPDATE: 'user_update_invalid', // Unable to perform user update
JUMP_TO_TODAY: 'jump_to_today', // Tapped jump to today
OPENED: 'application_opened', // 'Opened application'
REGISTRATION_CODE_INVALID: 'registration_code_invalid', // 'Invalid registration code'
REGISTRATION_CODE_VALID: 'registration_code_valid', // 'Valid registration code'
USER_RECONNECTED: 'user_reconnected', // 'User has reconnected after being offline'
VERIFICATION_CODE_INVALID: 'verification_code_invalid', // 'Invalid verification code'
VERIFICATION_CODE_VALID: 'verification_code_valid', // 'Valid verification code'
INTERCOM_LINK_CLICKED: 'intercom_chat_link_clicked',
// Tapped Intercom chat link
INVALID_PHONE: 'invalid_phone_number_entered',
// Invalid phone number entered
INVALID_USER_UPDATE: 'user_update_invalid',
// Unable to perform user update
JUMP_TO_TODAY: 'jump_to_today',
// Tapped jump to today
OPENED: 'application_opened',
// 'Opened application'
REGISTRATION_CODE_INVALID: 'registration_code_invalid',
// 'Invalid registration code'
REGISTRATION_CODE_VALID: 'registration_code_valid',
// 'Valid registration code'
USER_RECONNECTED: 'user_reconnected',
// 'User has reconnected after being offline'
VERIFICATION_CODE_INVALID: 'verification_code_invalid',
// 'Invalid verification code'
VERIFICATION_CODE_VALID: 'verification_code_valid',
// 'Valid verification code'
// Billing Events
ADDED_BILLING_ITEM: 'billing_item_added', // 'Added billing item'
ADDED_DISCOUNT: 'discount_added', // 'Added discount'
ADDED_LINE_ITEM_TO_ESTIMATE: 'estimate_line_item_added', // 'Added line item to estimate'
ADDED_LINE_ITEM_TO_INVOICE: 'invoice_line_item_added', // 'Added line item to invoice'
ADDED_NOTE_TO_BILLING_DOCUMENT: 'billing_document_note_added', // 'Added note to billing document'
COLLAPSED_HAMBURGER_MENU: 'hamburger_menu_collapse_clicked', // 'Collapsed hamburger menu'
CREATED_ESTIMATE: 'estimate_created', // 'Created estimate'
CREATED_INVOICE: 'invoice_created', // 'Created invoice'
CUSTOMER_APPROVED_INVOICE: 'invoice_approved_by_customer', // 'Customer approved invoice'
DELETED_BILLING_DOCUMENT: 'billing_document_deleted', // 'Deleted billing document'
DELETED_BILLING_ITEM: 'billing_item_deleted', // 'Deleted billing item'
DOWNLOADED_BILLING_DOCUMENT: 'billing_document_downloaded', // 'Downloaded billing document'
EXPANDED_HAMBURGER_MENU: 'hamburger_menu_expand_clicked', // 'Expanded hamburger menu'
FILTERED_BILLING_DOCUMENTS: 'billing_documents_filtered', // 'Filtered billing documents'
LOST_ESTIMATE: 'estimate_lost', // 'Lost estimate'
PAYMENT_FAILED: 'payment_failed', // 'Payment failed'
PAYMENT_RECEIVED: 'paymnet_received', // 'Payment received'
PRINTED_BILLING_DOCUMENT: 'billing_documents_printed', // 'Printed billing document'
REMOVED_LINE_ITEM_FROM_ESTIMATE: 'estimate_line_item_removed', // 'Removed line item from estimate'
REMOVED_LINE_ITEM_FROM_INVOICE: 'invoice_line_item_removed', // 'Removed line item from invoice'
SENT_BILLING_DOCUMENT: 'billing_document_sent', // 'Sent billing document'
UPDATED_BILLING_DOCUMENT: 'billing_document_updated', // 'Updated billing document'
UPDATED_BILLING_ITEM: 'billing_item_updated', // 'Updated billing item'
UPDATED_DISCOUNT: 'discount_updated', // 'Updated discount'
WON_ESTIMATE: 'estimate_won', // 'Won estimate'
ADDED_BILLING_ITEM: 'billing_item_added',
// 'Added billing item'
ADDED_DISCOUNT: 'discount_added',
// 'Added discount'
ADDED_LINE_ITEM_TO_ESTIMATE: 'estimate_line_item_added',
// 'Added line item to estimate'
ADDED_LINE_ITEM_TO_INVOICE: 'invoice_line_item_added',
// 'Added line item to invoice'
ADDED_NOTE_TO_BILLING_DOCUMENT: 'billing_document_note_added',
// 'Added note to billing document'
COLLAPSED_HAMBURGER_MENU: 'hamburger_menu_collapse_clicked',
// 'Collapsed hamburger menu'
CREATED_ESTIMATE: 'estimate_created',
// 'Created estimate'
CREATED_INVOICE: 'invoice_created',
// 'Created invoice'
CUSTOMER_APPROVED_INVOICE: 'invoice_approved_by_customer',
// 'Customer approved invoice'
DELETED_BILLING_DOCUMENT: 'billing_document_deleted',
// 'Deleted billing document'
DELETED_BILLING_ITEM: 'billing_item_deleted',
// 'Deleted billing item'
DOWNLOADED_BILLING_DOCUMENT: 'billing_document_downloaded',
// 'Downloaded billing document'
EXPANDED_HAMBURGER_MENU: 'hamburger_menu_expand_clicked',
// 'Expanded hamburger menu'
FILTERED_BILLING_DOCUMENTS: 'billing_documents_filtered',
// 'Filtered billing documents'
LOST_ESTIMATE: 'estimate_lost',
// 'Lost estimate'
PAYMENT_FAILED: 'payment_failed',
// 'Payment failed'
PAYMENT_RECEIVED: 'paymnet_received',
// 'Payment received'
PRINTED_BILLING_DOCUMENT: 'billing_documents_printed',
// 'Printed billing document'
REMOVED_LINE_ITEM_FROM_ESTIMATE: 'estimate_line_item_removed',
// 'Removed line item from estimate'
REMOVED_LINE_ITEM_FROM_INVOICE: 'invoice_line_item_removed',
// 'Removed line item from invoice'
SENT_BILLING_DOCUMENT: 'billing_document_sent',
// 'Sent billing document'
UPDATED_BILLING_DOCUMENT: 'billing_document_updated',
// 'Updated billing document'
UPDATED_BILLING_ITEM: 'billing_item_updated',
// 'Updated billing item'
UPDATED_DISCOUNT: 'discount_updated',
// 'Updated discount'
WON_ESTIMATE: 'estimate_won',
// 'Won estimate'
// Payment Events
ADDED_PAYMENT_METHOD: 'payment_method_added', // 'Added payment method'
ERROR_TAKING_PAYMENT: 'taking_payment_error', // Error taking payment
QBO_LEARN_MORE: 'qbo_learn_more_clicked', // 'Clicked Tell Me More QBO button'
QBO_SYNC_FROM_PREVIEW: 'qbo_sync_action_bar_clicked', // 'Clicked QBO Sync in action bar'
REMOVED_PAYMENT_METHOD: 'payment_method_removed', // 'Removed payment method'
TOGGLED_CREDIT_CARD_PAYMENT_METHOD: 'credit_card_method_toggled', // 'Tapped credit card toggle in payment settings'
ADDED_PAYMENT_METHOD: 'payment_method_added',
// 'Added payment method'
ERROR_TAKING_PAYMENT: 'taking_payment_error',
// Error taking payment
QBO_LEARN_MORE: 'qbo_learn_more_clicked',
// 'Clicked Tell Me More QBO button'
QBO_SYNC_FROM_PREVIEW: 'qbo_sync_action_bar_clicked',
// 'Clicked QBO Sync in action bar'
REMOVED_PAYMENT_METHOD: 'payment_method_removed',
// 'Removed payment method'
TOGGLED_CREDIT_CARD_PAYMENT_METHOD: 'credit_card_method_toggled',
// 'Tapped credit card toggle in payment settings'
// Settings Events
ORG_ADDRESS_UPDATED: 'organization_address_updated', // 'Updated organization address'
ORG_EMAIL_UPDATED: 'organization_email_updated', // 'Updated organization email'
ORG_HOURS_UPDATED: 'organization_hours_updated', // 'Updated organization work hours'
ORG_NAME_UPDATED: 'organization_name_updated', // 'Updated organization name'
ORG_PHONE_NUMBER_UPDATED: 'organization_phone_number_updated', // 'Updated organization phone number'
ORG_SERVICE_TYPES_UPDATED: 'organization_service_type_updated', // 'Updated service types to org'
ORG_URL_UPDATED: 'organization_url_updated', // 'Updated organization URL'
USER_ADDRESS_UPDATED: 'user_address_updated', // 'Updated user address'
USER_DEACTIVATED: 'user_deactivated', // 'Deactivated user'
USER_EMAIL_UPDATED: 'user_email_updated', // 'Updated user email'
USER_HOURS_UPDATED: 'user_hours_updated', // 'Updated user work hours'
USER_NAME_UPDATED: 'user_name_updated', // 'Updated user full name'
USER_OCCUPATION_UPDATED: 'user_occupation_updated', // 'Updated user occupation'
USER_PHONE_NUMBER_UPDATED: 'user_phone_number_updated', // 'Updated user phone number'
USER_REACTIVATED: 'user_reactivated', // 'Reactivated user'
USER_SERVICE_TYPES_UPDATED: 'user_service_type_updated', // 'Updated service types to user'
ORG_ADDRESS_UPDATED: 'organization_address_updated',
// 'Updated organization address'
ORG_EMAIL_UPDATED: 'organization_email_updated',
// 'Updated organization email'
ORG_HOURS_UPDATED: 'organization_hours_updated',
// 'Updated organization work hours'
ORG_NAME_UPDATED: 'organization_name_updated',
// 'Updated organization name'
ORG_PHONE_NUMBER_UPDATED: 'organization_phone_number_updated',
// 'Updated organization phone number'
ORG_SERVICE_TYPES_UPDATED: 'organization_service_type_updated',
// 'Updated service types to org'
ORG_URL_UPDATED: 'organization_url_updated',
// 'Updated organization URL'
USER_ADDRESS_UPDATED: 'user_address_updated',
// 'Updated user address'
USER_DEACTIVATED: 'user_deactivated',
// 'Deactivated user'
USER_EMAIL_UPDATED: 'user_email_updated',
// 'Updated user email'
USER_HOURS_UPDATED: 'user_hours_updated',
// 'Updated user work hours'
USER_NAME_UPDATED: 'user_name_updated',
// 'Updated user full name'
USER_OCCUPATION_UPDATED: 'user_occupation_updated',
// 'Updated user occupation'
USER_PHONE_NUMBER_UPDATED: 'user_phone_number_updated',
// 'Updated user phone number'
USER_REACTIVATED: 'user_reactivated',
// 'Reactivated user'
USER_SERVICE_TYPES_UPDATED: 'user_service_type_updated',
// 'Updated service types to user'
// Lite Analytics Events
LITE_LOGIN_MODAL_OPENED: 'login_modal_opened_lite', // 'Login modal opened on lite page'
LITE_SKIP_SCHEDULE: 'schedule_date/time_skipped_lite', // 'Schedule date/time skipped on lite page'
LITE_LOGIN_MODAL_OPENED: 'login_modal_opened_lite',
// 'Login modal opened on lite page'
LITE_SKIP_SCHEDULE: 'schedule_date/time_skipped_lite',
// 'Schedule date/time skipped on lite page'
RESET_TO_SCHEDULED: 'reset_to_scheduled_clicked_lite' // 'Tapped reset to scheduled button'
}
};
exports.default = Analytics;
var _default = Analytics;
exports["default"] = _default;

@@ -1,3 +0,5 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -9,8 +11,4 @@ value: true

var _moment = require('moment');
var _moment = _interopRequireDefault(require("moment"));
var _moment2 = _interopRequireDefault(_moment);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**

@@ -23,5 +21,4 @@ * Calculate duration based on a start and end time, returns Number in seconds.

function getDuration(startTime, endTime) {
return (0, _moment2.default)(endTime).diff((0, _moment2.default)(startTime), 'seconds');
return (0, _moment["default"])(endTime).diff((0, _moment["default"])(startTime), 'seconds');
}
/**

@@ -33,2 +30,4 @@ * Calculate end time based on a start time and duration, return Date as ISOString.

*/
function getEndTime(startTime, duration) {

@@ -35,0 +34,0 @@ var endTime = new Date(startTime);

@@ -1,17 +0,20 @@

'use strict';
"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = bookingServiceMethods;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
exports.default = bookingServiceMethods;
var endpoints = _interopRequireWildcard(require("./endpoints"));
var _endpoints = require('./endpoints');
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
var endpoints = _interopRequireWildcard(_endpoints);
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function bookingServiceMethods(client) {

@@ -24,9 +27,10 @@ return {

var headers = _extends({}, options.headers, {
var headers = _objectSpread({}, options.headers, {
'X-Account-ID': accountId
});
options.headers = headers;
return client.doAuthenticatedRequest('POST', endpoints.BOOKING + '/new_offer', data, options);
return client.doAuthenticatedRequest('POST', "".concat(endpoints.BOOKING, "/new_offer"), data, options);
}
};
}

@@ -1,12 +0,15 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _queryString = require('./queryString');
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _queryString = require("./queryString");

@@ -17,9 +20,9 @@ /**

*/
var Configuration = function () {
var Configuration =
/*#__PURE__*/
function () {
function Configuration(client) {
_classCallCheck(this, Configuration);
(0, _classCallCheck2["default"])(this, Configuration);
this.client = client;
}
/**

@@ -36,12 +39,13 @@ * Get the app configuration for a certain entity.

_createClass(Configuration, [{
key: 'getForEntity',
(0, _createClass2["default"])(Configuration, [{
key: "getForEntity",
value: function getForEntity(entityType, entityID, options) {
var queryString = '';
if (options) {
queryString = '?' + (0, _queryString.stringify)(options);
queryString = "?".concat((0, _queryString.stringify)(options));
}
return this.client.doAuthenticatedRequest('GET', '/config/' + entityType + '/' + entityID + queryString);
return this.client.doAuthenticatedRequest('GET', "/config/".concat(entityType, "/").concat(entityID).concat(queryString));
}
/**

@@ -59,7 +63,6 @@ * Set the configuration for an entity

}, {
key: 'setForEntity',
key: "setForEntity",
value: function setForEntity(entityType, entityID, config) {
var overwrite = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
return this.client.doAuthenticatedRequest('POST', '/config/' + entityType + '/' + entityID, {
return this.client.doAuthenticatedRequest('POST', "/config/".concat(entityType, "/").concat(entityID), {
config: config,

@@ -69,3 +72,2 @@ overwrite: overwrite

}
/**

@@ -78,7 +80,6 @@ * Get the default configuration

}, {
key: 'getDefault',
key: "getDefault",
value: function getDefault() {
return this.client.doAuthenticatedRequest('GET', '/config/default');
}
/**

@@ -93,3 +94,3 @@ * Set the default app or notifications configuration

}, {
key: 'setDefaultForPrefix',
key: "setDefaultForPrefix",
value: function setDefaultForPrefix(prefix, config) {

@@ -101,3 +102,2 @@ return this.client.doAuthenticatedRequest('POST', '/config/default', {

}
/**

@@ -110,7 +110,6 @@ * Gets the current full configuration schema

}, {
key: 'schema',
key: "schema",
value: function schema() {
return this.client.doAuthenticatedRequest('GET', '/config/schema');
}
/**

@@ -123,7 +122,6 @@ * Gets the current full notifications events list

}, {
key: 'eventsList',
key: "eventsList",
value: function eventsList() {
return this.client.doAuthenticatedRequest('GET', '/config/events_list');
}
/**

@@ -136,11 +134,10 @@ * Gets a report of all the levels at which each configuration setting is defined

}, {
key: 'report',
key: "report",
value: function report(type) {
return this.client.doAuthenticatedRequest('GET', '/config/report/' + type);
return this.client.doAuthenticatedRequest('GET', "/config/report/".concat(type));
}
}]);
return Configuration;
}();
exports.default = Configuration;
exports["default"] = Configuration;

@@ -1,129 +0,80 @@

'use strict';
"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _map = require('lodash/map');
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _map2 = _interopRequireDefault(_map);
var _map = _interopRequireDefault(require("lodash/map"));
var _entries = require('lodash/entries');
var _entries = _interopRequireDefault(require("lodash/entries"));
var _entries2 = _interopRequireDefault(_entries);
var _uniq = _interopRequireDefault(require("lodash/uniq"));
var _uniq = require('lodash/uniq');
var _includes = _interopRequireDefault(require("lodash/includes"));
var _uniq2 = _interopRequireDefault(_uniq);
var _omit = _interopRequireDefault(require("lodash/omit"));
var _includes = require('lodash/includes');
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
var _includes2 = _interopRequireDefault(_includes);
var endpoints = _interopRequireWildcard(require("./endpoints"));
var _omit = require('lodash/omit');
var queryString = _interopRequireWildcard(require("./queryString"));
var _omit2 = _interopRequireDefault(_omit);
var _appointment = _interopRequireDefault(require("./entities/appointment"));
var _isEmpty = require('lodash/isEmpty');
var _attachment = _interopRequireDefault(require("./entities/attachment"));
var _isEmpty2 = _interopRequireDefault(_isEmpty);
var _billingDocument = _interopRequireDefault(require("./entities/billingDocument"));
var _endpoints = require('./endpoints');
var _bookingService = _interopRequireDefault(require("./bookingService"));
var endpoints = _interopRequireWildcard(_endpoints);
var _Collection = _interopRequireDefault(require("./entities/Collection"));
var _queryString = require('./queryString');
var _configuration = _interopRequireDefault(require("./configuration"));
var queryString = _interopRequireWildcard(_queryString);
var _conversation = _interopRequireDefault(require("./entities/conversation"));
var _appointment = require('./entities/appointment');
var _customer = _interopRequireDefault(require("./entities/customer"));
var _appointment2 = _interopRequireDefault(_appointment);
var _formData = _interopRequireDefault(require("form-data"));
var _attachment = require('./entities/attachment');
var _generateUUID = _interopRequireDefault(require("./generateUUID"));
var _attachment2 = _interopRequireDefault(_attachment);
var _invoice = _interopRequireDefault(require("./entities/invoice"));
var _billingDocument = require('./entities/billingDocument');
var _job = _interopRequireDefault(require("./entities/job"));
var _billingDocument2 = _interopRequireDefault(_billingDocument);
var _layerIdentityToken = _interopRequireDefault(require("./entities/layerIdentityToken"));
var _bookingService = require('./bookingService');
var _organization = _interopRequireDefault(require("./entities/organization"));
var _bookingService2 = _interopRequireDefault(_bookingService);
var _products = _interopRequireDefault(require("./products"));
var _Collection = require('./entities/Collection');
var _rawClient = _interopRequireWildcard(require("./rawClient"));
var _Collection2 = _interopRequireDefault(_Collection);
var _request = _interopRequireDefault(require("./request"));
var _configuration = require('./configuration');
var _survey = _interopRequireDefault(require("./entities/survey"));
var _configuration2 = _interopRequireDefault(_configuration);
var _user = _interopRequireDefault(require("./entities/user"));
var _conversation = require('./entities/conversation');
var _fileHelpers = require("./fileHelpers");
var _conversation2 = _interopRequireDefault(_conversation);
var _errors = require("./errors");
var _customer = require('./entities/customer');
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
var _customer2 = _interopRequireDefault(_customer);
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
var _formData = require('form-data');
var _formData2 = _interopRequireDefault(_formData);
var _generateUUID = require('./generateUUID');
var _generateUUID2 = _interopRequireDefault(_generateUUID);
var _invoice = require('./entities/invoice');
var _invoice2 = _interopRequireDefault(_invoice);
var _job = require('./entities/job');
var _job2 = _interopRequireDefault(_job);
var _layerIdentityToken = require('./entities/layerIdentityToken');
var _layerIdentityToken2 = _interopRequireDefault(_layerIdentityToken);
var _organization = require('./entities/organization');
var _organization2 = _interopRequireDefault(_organization);
var _products = require('./products');
var _products2 = _interopRequireDefault(_products);
var _rawClient = require('./rawClient');
var _rawClient2 = _interopRequireDefault(_rawClient);
var _request = require('./request');
var _request2 = _interopRequireDefault(_request);
var _survey = require('./entities/survey');
var _survey2 = _interopRequireDefault(_survey);
var _user = require('./entities/user');
var _user2 = _interopRequireDefault(_user);
var _fileHelpers = require('./fileHelpers');
var _errors = require('./errors');
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**

@@ -139,8 +90,8 @@ * Class Dispatch is the high-level abstracted client for *front-end use only*.

*/
var Dispatch = function () {
var Dispatch =
/*#__PURE__*/
function () {
function Dispatch(clientID, clientSecret) {
var host = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'https://api.dispatch.me';
_classCallCheck(this, Dispatch);
(0, _classCallCheck2["default"])(this, Dispatch);
this.clientID = clientID;

@@ -150,49 +101,44 @@ this.clientSecret = clientSecret;

this.onBearerTokenHooks = [];
this.session = null;
this.entities = {
accountOrganizations: new _Collection2.default(this, endpoints.ACCOUNT_ORGANIZATIONS),
accounts: new _Collection2.default(this, endpoints.ACCOUNTS),
accountUsers: new _Collection2.default(this, endpoints.ACCOUNT_USERS),
applications: new _Collection2.default(this, endpoints.APPLICATIONS),
appointment: (0, _appointment2.default)(this),
appointments: new _Collection2.default(this, endpoints.APPOINTMENTS),
appointmentSeries: new _Collection2.default(this, endpoints.APPOINTMENT_SERIES),
appointmentFunctions: new _Collection2.default(this, endpoints.APPOINTMENT_FUNCTIONS),
attachment: (0, _attachment2.default)(this),
attachments: new _Collection2.default(this, endpoints.ATTACHMENTS),
billingContracts: new _Collection2.default(this, endpoints.BILLING_CONTRACTS),
billingDocument: (0, _billingDocument2.default)(this),
billingDocuments: new _Collection2.default(this, endpoints.BILLING_DOCUMENTS),
billingItems: new _Collection2.default(this, endpoints.BILLING_ITEMS),
bookingService: (0, _bookingService2.default)(this),
brands: new _Collection2.default(this, endpoints.BRANDS),
calendarEvents: new _Collection2.default(this, endpoints.CALENDAR_EVENTS),
conversation: (0, _conversation2.default)(this),
customer: (0, _customer2.default)(this),
customers: new _Collection2.default(this, endpoints.CUSTOMERS),
customerUsers: new _Collection2.default(this, endpoints.CUSTOMER_USERS),
groups: new _Collection2.default(this, endpoints.GROUPS),
invoice: (0, _invoice2.default)(this),
job: (0, _job2.default)(this),
jobOffers: new _Collection2.default(this, endpoints.JOB_OFFERS),
jobAttributions: new _Collection2.default(this, endpoints.JOB_ATTRIBUTIONS),
jobs: new _Collection2.default(this, endpoints.JOBS),
labels: new _Collection2.default(this, endpoints.LABELS),
layer: (0, _layerIdentityToken2.default)(this),
organization: (0, _organization2.default)(this),
organizations: new _Collection2.default(this, endpoints.ORGANIZATIONS),
survey: (0, _survey2.default)(this),
taxRates: new _Collection2.default(this, endpoints.TAX_RATES),
user: (0, _user2.default)(this),
users: new _Collection2.default(this, endpoints.USERS)
accountOrganizations: new _Collection["default"](this, endpoints.ACCOUNT_ORGANIZATIONS),
accounts: new _Collection["default"](this, endpoints.ACCOUNTS),
accountUsers: new _Collection["default"](this, endpoints.ACCOUNT_USERS),
applications: new _Collection["default"](this, endpoints.APPLICATIONS),
appointment: (0, _appointment["default"])(this),
appointments: new _Collection["default"](this, endpoints.APPOINTMENTS),
appointmentSeries: new _Collection["default"](this, endpoints.APPOINTMENT_SERIES),
appointmentFunctions: new _Collection["default"](this, endpoints.APPOINTMENT_FUNCTIONS),
attachment: (0, _attachment["default"])(this),
attachments: new _Collection["default"](this, endpoints.ATTACHMENTS),
billingContracts: new _Collection["default"](this, endpoints.BILLING_CONTRACTS),
billingDocument: (0, _billingDocument["default"])(this),
billingDocuments: new _Collection["default"](this, endpoints.BILLING_DOCUMENTS),
billingItems: new _Collection["default"](this, endpoints.BILLING_ITEMS),
bookingService: (0, _bookingService["default"])(this),
brands: new _Collection["default"](this, endpoints.BRANDS),
calendarEvents: new _Collection["default"](this, endpoints.CALENDAR_EVENTS),
conversation: (0, _conversation["default"])(this),
customer: (0, _customer["default"])(this),
customers: new _Collection["default"](this, endpoints.CUSTOMERS),
customerUsers: new _Collection["default"](this, endpoints.CUSTOMER_USERS),
groups: new _Collection["default"](this, endpoints.GROUPS),
invoice: (0, _invoice["default"])(this),
job: (0, _job["default"])(this),
jobOffers: new _Collection["default"](this, endpoints.JOB_OFFERS),
jobAttributions: new _Collection["default"](this, endpoints.JOB_ATTRIBUTIONS),
jobs: new _Collection["default"](this, endpoints.JOBS),
labels: new _Collection["default"](this, endpoints.LABELS),
layer: (0, _layerIdentityToken["default"])(this),
organization: (0, _organization["default"])(this),
organizations: new _Collection["default"](this, endpoints.ORGANIZATIONS),
survey: (0, _survey["default"])(this),
taxRates: new _Collection["default"](this, endpoints.TAX_RATES),
user: (0, _user["default"])(this),
users: new _Collection["default"](this, endpoints.USERS)
};
this.auxiliaryClients = {};
this.configuration = new _configuration2.default(this);
this.products = new _products2.default(this);
this.configuration = new _configuration["default"](this);
this.products = new _products["default"](this);
}
/**

@@ -205,8 +151,7 @@ * Adds a callback function to every api request

_createClass(Dispatch, [{
key: 'setAuditAction',
(0, _createClass2["default"])(Dispatch, [{
key: "setAuditAction",
value: function setAuditAction(action) {
this.auditAction = action;
}
/**

@@ -219,3 +164,3 @@ * Adds a callback to run when bearer token changes

}, {
key: 'onBearerToken',
key: "onBearerToken",
value: function onBearerToken(callback) {

@@ -228,3 +173,2 @@ if (typeof callback === 'function') {

}
/**

@@ -237,6 +181,6 @@ * Lazy load an unauthenticated client. For use with logging in

}, {
key: 'getNoAuthClient',
key: "getNoAuthClient",
value: function getNoAuthClient() {
if (!this.noAuthClient) {
this.noAuthClient = new _rawClient2.default({
this.noAuthClient = new _rawClient["default"]({
auditAction: this.auditAction,

@@ -250,3 +194,2 @@ authMode: _rawClient.AUTH_MODE_NONE,

}
/**

@@ -259,6 +202,6 @@ * Lazy load an authenticated client using the dispatch client's bearer token

}, {
key: 'getAuthClient',
key: "getAuthClient",
value: function getAuthClient() {
if (!this.authClient) {
this.authClient = new _rawClient2.default({
this.authClient = new _rawClient["default"]({
auditAction: this.auditAction,

@@ -268,3 +211,2 @@ authMode: _rawClient.AUTH_MODE_BEARER,

host: this.host
});

@@ -275,3 +217,2 @@ }

}
/**

@@ -285,12 +226,14 @@ * Determine the host of a service using our naming convention

}, {
key: 'determineAuxiliaryAPIHost',
key: "determineAuxiliaryAPIHost",
value: function determineAuxiliaryAPIHost(serviceName) {
switch (serviceName) {
case 'ids': // insights-dashboard-service
case 'config':
case 'files-api':
{
if (this.host.includes('-dev.')) return 'https://' + serviceName + '-dev.dispatch.me';else if (this.host.includes('-stg.') || this.host.includes('-staging.')) return 'https://' + serviceName + '-staging.dispatch.me';else if (this.host.includes('-sandbox.')) return 'https://' + serviceName + '-sandbox.dispatch.me';
return 'https://' + serviceName + '.dispatch.me';
if (this.host.includes('-dev.')) return "https://".concat(serviceName, "-dev.dispatch.me");else if (this.host.includes('-stg.') || this.host.includes('-staging.')) return "https://".concat(serviceName, "-staging.dispatch.me");else if (this.host.includes('-sandbox.')) return "https://".concat(serviceName, "-sandbox.dispatch.me");
return "https://".concat(serviceName, ".dispatch.me");
}
default:

@@ -304,3 +247,2 @@ {

}
/**

@@ -315,6 +257,6 @@ * Lazy load a client for an auxiliary service that uses bearer-token authentication.

}, {
key: 'getAuxiliaryClient',
key: "getAuxiliaryClient",
value: function getAuxiliaryClient(serviceName) {
if (!this.auxiliaryClients[serviceName]) {
this.auxiliaryClients[serviceName] = new _rawClient2.default({
this.auxiliaryClients[serviceName] = new _rawClient["default"]({
auditAction: this.auditAction,

@@ -329,3 +271,2 @@ authMode: _rawClient.AUTH_MODE_BEARER,

}
/**

@@ -340,3 +281,3 @@ * Load and authenticate a client using the application's credentials. This is used

}, {
key: 'getAppClient',
key: "getAppClient",
value: function getAppClient() {

@@ -351,3 +292,3 @@ var _this = this;

}).then(function (response) {
_this.appClient = new _rawClient2.default({
_this.appClient = new _rawClient["default"]({
auditAction: _this.auditAction,

@@ -361,5 +302,5 @@ authMode: _rawClient.AUTH_MODE_BEARER,

}
return Promise.resolve(this.appClient);
}
/**

@@ -375,3 +316,3 @@ * Save a retrieved bearer token/refresh token combo and reset all existing authenticated

}, {
key: 'handleBearerToken',
key: "handleBearerToken",
value: function handleBearerToken(bearerToken, refreshToken) {

@@ -381,18 +322,13 @@ var _this2 = this;

this.bearerToken = bearerToken;
this.refreshToken = refreshToken;
// Reset the authenticated client so it'll be refreshed with the new bearer token
this.refreshToken = refreshToken; // Reset the authenticated client so it'll be refreshed with the new bearer token
// the first time it is lazy loaded
this.authClient = null;
// Reset all aux clients for the same reason
this.authClient = null; // Reset all aux clients for the same reason
this.auxiliaryClients = {};
this.onBearerTokenHooks.forEach(function (hook) {
hook(_this2);
});
return this.bearerToken;
}
/**

@@ -406,7 +342,6 @@ * Set the bearer token on the SDK. For now this just is an alias for handleBearerToken

}, {
key: 'setBearerToken',
key: "setBearerToken",
value: function setBearerToken(bearerToken, refreshToken) {
return this.handleBearerToken(bearerToken, refreshToken);
}
/**

@@ -421,3 +356,3 @@ * Log the user in with their email and password

}, {
key: 'loginEmailPassword',
key: "loginEmailPassword",
value: function loginEmailPassword(email, password) {

@@ -436,3 +371,2 @@ var _this3 = this;

}
/**

@@ -446,11 +380,10 @@ * Log in with a limited-use auth token retrieved via /v1/auth_tokens

}, {
key: 'loginAuthToken',
key: "loginAuthToken",
value: function loginAuthToken(authToken) {
var _this4 = this;
return this.getNoAuthClient().post('/v1/auth_tokens/' + authToken + '/exchange').then(function (response) {
return this.getNoAuthClient().post("/v1/auth_tokens/".concat(authToken, "/exchange")).then(function (response) {
return _this4.handleBearerToken(response.access_token, response.refresh_token);
});
}
/**

@@ -464,10 +397,9 @@ * Request a verification code to be sent to the given phone number

}, {
key: 'requestVerificationCode',
key: "requestVerificationCode",
value: function requestVerificationCode(phoneNumber) {
// This request needs an app-specific bearer token.
return this.getAppClient().then(function (client) {
return client.post('/v1/phone_numbers/' + phoneNumber + '/verification_codes');
return client.post("/v1/phone_numbers/".concat(phoneNumber, "/verification_codes"));
});
}
/**

@@ -482,3 +414,3 @@ * Request a instructions for resetting a password to the email address provided, as long as the

}, {
key: 'requestPasswordReset',
key: "requestPasswordReset",
value: function requestPasswordReset(email) {

@@ -491,3 +423,2 @@ return this.getAppClient().then(function (client) {

}
/**

@@ -503,6 +434,6 @@ * Resets the specified user password based on the temporary token included in the password reset

}, {
key: 'setNewPassword',
key: "setNewPassword",
value: function setNewPassword(authToken, newPassword) {
return this.getAppClient().then(function (client) {
return client.put('/v1/password_resets/' + authToken, {
return client.put("/v1/password_resets/".concat(authToken), {
password: newPassword

@@ -512,3 +443,2 @@ });

}
/**

@@ -524,3 +454,3 @@ * Creates a new user and organization using the signup endpoint.

}, {
key: 'signUp',
key: "signUp",
value: function signUp(userInfo, organizationInfo) {

@@ -534,3 +464,2 @@ return this.getAppClient().then(function (client) {

}
/**

@@ -545,3 +474,3 @@ * Log the user in with their phone number and verification code

}, {
key: 'loginPhoneNumber',
key: "loginPhoneNumber",
value: function loginPhoneNumber(phoneNumber, verificationCode) {

@@ -551,3 +480,3 @@ var _this5 = this;

return this.getAppClient().then(function (client) {
return client.get('/v1/phone_numbers/' + phoneNumber + '/verification_codes/' + verificationCode);
return client.get("/v1/phone_numbers/".concat(phoneNumber, "/verification_codes/").concat(verificationCode));
}).then(function (response) {

@@ -557,3 +486,2 @@ return _this5.handleBearerToken(response.access_token, response.refresh_token);

}
/**

@@ -566,3 +494,3 @@ * Get the user info based on the bearer token retrieved via log in

}, {
key: 'identifyUser',
key: "identifyUser",
value: function identifyUser() {

@@ -573,3 +501,2 @@ return this.doAuthenticatedRequest('GET', '/v1/me').then(function (response) {

}
/**

@@ -582,3 +509,3 @@ * Exchange a refresh token for another bearer token

}, {
key: 'exchangeToken',
key: "exchangeToken",
value: function exchangeToken() {

@@ -588,3 +515,2 @@ var _this6 = this;

var refreshToken = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
return this.getNoAuthClient().post('/oauth/token', {

@@ -599,3 +525,2 @@ grant_type: 'refresh_token',

}
/**

@@ -610,7 +535,6 @@ * Retrieve a collection from the API at the given endpoint.

}, {
key: 'getCollection',
key: "getCollection",
value: function getCollection(endpoint) {
var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var fullPath = endpoint;

@@ -620,4 +544,5 @@

var queryParams = queryString.stringify(filter, opts.encode === true);
fullPath = fullPath + '?' + queryParams;
fullPath = "".concat(fullPath, "?").concat(queryParams);
}
return this.doAuthenticatedRequest('GET', fullPath).then(function (response) {

@@ -627,2 +552,3 @@ if (opts.raw === true) {

}
var data = response[Object.keys(response)[0]];

@@ -632,3 +558,2 @@ return data;

}
/**

@@ -643,7 +568,8 @@ * Retrieve a collection from the API at the given endpoint with meta data.

}, {
key: 'getCollectionWithMeta',
key: "getCollectionWithMeta",
value: function getCollectionWithMeta(endpoint) {
var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
return this.getCollection(endpoint, filter, { raw: true }).then(function (response) {
return this.getCollection(endpoint, filter, {
raw: true
}).then(function (response) {
var meta = {};

@@ -660,6 +586,8 @@ var data = Object.keys(response).length > 2 ? {} : [];

});
return { meta: meta, data: data };
return {
meta: meta,
data: data
};
});
}
/**

@@ -672,12 +600,10 @@ * Append analyitcs tags and a transaction ID to the headers.

}, {
key: 'appendAnalyticsHeaders',
key: "appendAnalyticsHeaders",
value: function appendAnalyticsHeaders() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var analytics = Object.assign({}, this.session, options.analytics);
var analyticsTags = (0, _map2.default)((0, _entries2.default)(analytics), function (param) {
var analyticsTags = (0, _map["default"])((0, _entries["default"])(analytics), function (param) {
return param.join(':');
}).join(',');
var transactionId = options.transactionID || (0, _generateUUID2.default)();
var transactionId = options.transactionID || (0, _generateUUID["default"])();
var headers = Object.assign({}, options.headers, {

@@ -687,6 +613,6 @@ 'X-Analytics-Tags': analyticsTags,

});
return Object.assign({}, options, { headers: headers });
return Object.assign({}, options, {
headers: headers
});
}
/**

@@ -705,3 +631,3 @@ * Perform a request on the authenticated raw client, with support

}, {
key: 'doAuthenticatedRequest',
key: "doAuthenticatedRequest",
value: function doAuthenticatedRequest(method, endpoint) {

@@ -712,6 +638,5 @@ var _this7 = this;

var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var req = new _request["default"](method, endpoint, body, this.appendAnalyticsHeaders(options));
var client;
var req = new _request2.default(method, endpoint, body, this.appendAnalyticsHeaders(options));
var client = void 0;
if (options.client) {

@@ -724,8 +649,8 @@ client = this.getAuxiliaryClient(options.client);

return new Promise(function (resolve, reject) {
req.do(client).then(resolve).catch(function (err) {
req["do"](client).then(resolve)["catch"](function (err) {
if (err instanceof _errors.UnauthorizedError) {
if (_this7.refreshToken) {
_this7.exchangeToken().then(function () {
return req.do(_this7.getAuthClient());
}).then(resolve).catch(reject);
return req["do"](_this7.getAuthClient());
}).then(resolve)["catch"](reject);
} else {

@@ -740,3 +665,2 @@ reject(err);

}
/**

@@ -751,13 +675,14 @@ * Retrieve a single entity by ID. Promise resolves with the raw data

}, {
key: 'getModel',
key: "getModel",
value: function getModel(endpoint, id) {
return this.doAuthenticatedRequest('GET', endpoint + '?filter[id_eq]=' + id).then(function (response) {
return this.doAuthenticatedRequest('GET', "".concat(endpoint, "?filter[id_eq]=").concat(id)).then(function (response) {
var model = response[Object.keys(response)[0]][0];
if (!model) {
throw new Error('Document with ID ' + id + ' not found on ' + endpoint);
throw new Error("Document with ID ".concat(id, " not found on ").concat(endpoint));
}
return model;
});
}
/**

@@ -771,12 +696,10 @@ * Upload a file to the files API

}, {
key: 'uploadFile',
key: "uploadFile",
value: function uploadFile(file, name) {
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'square_photo';
var options = arguments[3];
var formData = new _formData2.default();
var options = arguments.length > 3 ? arguments[3] : undefined;
var formData = new _formData["default"]();
formData.append('file', (0, _fileHelpers.dataURItoBlob)(file), name);
formData.append('filename', name);
formData.append('type', type);
return this.doAuthenticatedRequest('POST', '/v1/datafiles', formData, Object.assign({

@@ -786,3 +709,2 @@ client: 'files-api'

}
/**

@@ -795,9 +717,7 @@ * This adds query parameters to every request out to the API so it

}, {
key: 'setSession',
key: "setSession",
value: function setSession() {
var sessionVars = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
this.session = sessionVars;
}
/**

@@ -813,3 +733,3 @@ * Search an organization's entities.

}, {
key: 'search',
key: "search",
value: function search(_ref) {

@@ -822,7 +742,6 @@ var _this8 = this;

maxResultsPerModel = _ref.maxResultsPerModel;
var customers;
var host;
var jobs;
var customers = void 0;
var host = void 0;
var jobs = void 0;
function getNextAppointmentTime(appointment) {

@@ -834,3 +753,2 @@ return appointment.window_start_time ? appointment.window_start_time[0] : appointment.time;

var result = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var matches = result._highlightResult || {}; // eslint-disable-line no-underscore-dangle

@@ -846,3 +764,3 @@

}, []);
list[field] = (0, _uniq2.default)(list[field]);
list[field] = (0, _uniq["default"])(list[field]);
} else {

@@ -854,3 +772,2 @@ list[field] = matches[field].matchedWords || [];

}
/**

@@ -866,7 +783,8 @@ * Loops through an object and changes any array values to a

*/
function arraysToStrings(obj) {
var skipProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
Object.getOwnPropertyNames(obj || {}).forEach(function (prop) {
if (Array.isArray(obj[prop]) && !(0, _includes2.default)(skipProps, prop)) {
if (Array.isArray(obj[prop]) && !(0, _includes["default"])(skipProps, prop)) {
obj[prop] = obj[prop].join('; ');

@@ -877,31 +795,25 @@ }

var filterQuery = filter ? '&models=' + filter.join(',') : '';
var limitQuery = maxResultsPerModel ? '&limit=' + maxResultsPerModel : '';
var filterQuery = filter ? "&models=".concat(filter.join(',')) : '';
var limitQuery = maxResultsPerModel ? "&limit=".concat(maxResultsPerModel) : '';
return this.getAuthClient().get("".concat(endpoints.SEARCH, "?organization_id=").concat(organizationID, "&q=").concat(query).concat(limitQuery).concat(filterQuery)).then(function (response) {
host = _this8.determineAuxiliaryAPIHost('files-api'); // Build customers object for returning.
return this.getAuthClient().get(endpoints.SEARCH + '?organization_id=' + organizationID + '&q=' + query + limitQuery + filterQuery).then(function (response) {
host = _this8.determineAuxiliaryAPIHost('files-api');
// Build customers object for returning.
customers = response.customer && response.customer.hits || [];
customers = customers.map(function (customer) {
var adjustedCustomer = (0, _omit2.default)(customer, '_highlightResult');
var adjustedCustomer = (0, _omit["default"])(customer, '_highlightResult');
arraysToStrings(adjustedCustomer, ['external_ids', 'phone_numbers']);
return _extends({}, adjustedCustomer, {
return _objectSpread({}, adjustedCustomer, {
_matchedWords: getMatchedWords(customer)
});
});
}); // Build jobs object for returning.
// Build jobs object for returning.
jobs = response.job && response.job.hits || [];
jobs = jobs.map(function (job) {
var appointment = job.next_scheduled_appointment && !(0, _isEmpty2.default)(job.next_scheduled_appointment) && getNextAppointmentTime(job.next_scheduled_appointment);
var adjustedJob = (0, _omit2.default)(job, '_highlightResult', 'next_scheduled_appointment');
var appointment = job.next_scheduled_appointment && !(0, _isEmpty["default"])(job.next_scheduled_appointment) && getNextAppointmentTime(job.next_scheduled_appointment);
var adjustedJob = (0, _omit["default"])(job, '_highlightResult', 'next_scheduled_appointment');
arraysToStrings(adjustedJob, ['labels']);
return _extends({}, adjustedJob, {
return _objectSpread({}, adjustedJob, {
account_logo_token: job.logo_token,
appointment: appointment,
brand_logo: job.logo_token && host + '/v1/datafiles/' + job.logo_token,
brand_logo: job.logo_token && "".concat(host, "/v1/datafiles/").concat(job.logo_token),
user_id: job.next_scheduled_appointment && job.next_scheduled_appointment.user_id,

@@ -911,6 +823,4 @@ _matchedWords: getMatchedWords(job)

});
var totalCustomers = response.customer && response.customer.nbHits || 0;
var totalJobs = response.job && response.job.nbHits || 0;
return {

@@ -924,3 +834,2 @@ customers: customers,

}
/**

@@ -948,3 +857,3 @@ * This function creates a customer, job, and an optional appointment, which together make

}, {
key: 'createAndScheduleJob',
key: "createAndScheduleJob",
value: function createAndScheduleJob(jobInfo, customerInfo) {

@@ -954,3 +863,2 @@ var _this9 = this;

var appointmentInfo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var returnData = {

@@ -961,3 +869,2 @@ job: null,

};
var errorData = {

@@ -972,3 +879,2 @@ job: null,

var resolveCustomer = function resolveCustomer(resolve, customer) {

@@ -983,20 +889,20 @@ returnData.customer = customer;

reject(err);
};
}; // Update the customer if an id is provided
// Update the customer if an id is provided
if (id) {
return new Promise(function (resolve, reject) {
_this9.entities.customers.update(id, (0, _omit2.default)(customerInfo, 'id')).then(function (customer) {
_this9.entities.customers.update(id, (0, _omit["default"])(customerInfo, 'id')).then(function (customer) {
resolveCustomer(resolve, customer);
}).catch(function (err) {
})["catch"](function (err) {
rejectCustomer(reject, err);
});
});
}
} // Create a customer if no id is provided
// Create a customer if no id is provided
return new Promise(function (resolve, reject) {
_this9.entities.customers.create(customerInfo).then(function (customer) {
resolveCustomer(resolve, customer);
}).catch(function (err) {
})["catch"](function (err) {
rejectCustomer(reject, err);

@@ -1011,7 +917,9 @@ });

returnData.job = job;
if (appointmentInfo) {
appointmentInfo.job_id = job.id;
}
resolve();
}).catch(function (err) {
})["catch"](function (err) {
errorData.job = err;

@@ -1033,3 +941,3 @@ reject(err);

resolve();
}).catch(function (err) {
})["catch"](function (err) {
errorData.appointmentSeries = err;

@@ -1045,3 +953,3 @@ reject(err);

resolve();
}).catch(function (err) {
})["catch"](function (err) {
errorData.appointment = err;

@@ -1060,3 +968,3 @@ reject(err);

resolve(returnData);
}).catch(function () {
})["catch"](function () {
reject(new _errors.MultiActionError('Job creation failed', errorData));

@@ -1067,6 +975,5 @@ });

}]);
return Dispatch;
}();
exports.default = Dispatch;
exports["default"] = Dispatch;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,32 +6,64 @@ Object.defineProperty(exports, "__esModule", {

});
var ACCOUNT_ORGANIZATIONS = exports.ACCOUNT_ORGANIZATIONS = '/v1/account_organizations';
var ACCOUNTS = exports.ACCOUNTS = '/v1/accounts';
var ACCOUNT_USERS = exports.ACCOUNT_USERS = '/v1/users/accounts';
var APPLICATIONS = exports.APPLICATIONS = '/v1/applications';
var APPOINTMENTS = exports.APPOINTMENTS = '/v1/appointments';
var APPOINTMENT_SERIES = exports.APPOINTMENT_SERIES = '/v1/appointment_series';
var APPOINTMENT_FUNCTIONS = exports.APPOINTMENT_FUNCTIONS = '/v1/appointment_functions';
var ATTACHMENTS = exports.ATTACHMENTS = '/v1/attachments';
var BILLING_CONTRACTS = exports.BILLING_CONTRACTS = '/v2/billing_contracts';
var BILLING_DOCUMENTS = exports.BILLING_DOCUMENTS = '/v2/billing_documents';
var BILLING_ITEMS = exports.BILLING_ITEMS = '/v2/billing_items';
var BOOKING = exports.BOOKING = '/booking';
var BRANDS = exports.BRANDS = '/v1/brands';
var CALENDAR_EVENTS = exports.CALENDAR_EVENTS = '/calendar_events/events';
var CONVERSATIONS = exports.CONVERSATIONS = '/v1/conversations';
var CUSTOMER_USERS = exports.CUSTOMER_USERS = '/v1/users/customers';
var CUSTOMERS = exports.CUSTOMERS = '/v1/customers';
var GROUPS = exports.GROUPS = '/groups';
var JOB_OFFERS = exports.JOB_OFFERS = '/v1/job_offers';
var JOBS = exports.JOBS = '/v3/jobs';
var JOB_ATTRIBUTIONS = exports.JOB_ATTRIBUTIONS = '/v1/job_attributions';
var LABELS = exports.LABELS = '/v2/labels';
var LAYER_IDENTITY_TOKENS = exports.LAYER_IDENTITY_TOKENS = '/v1/layer/identity_tokens';
var ORGANIZATIONS = exports.ORGANIZATIONS = '/v1/organizations';
var PAYMENTS = exports.PAYMENTS = '/v1/payments';
var PUBLIC_SURVEY_RESPONSES = exports.PUBLIC_SURVEY_RESPONSES = '/v1/public/survey_responses';
var SEARCH = exports.SEARCH = '/v2/search';
var SURVEY_RESPONSES = exports.SURVEY_RESPONSES = '/v1/survey_responses';
var TAX_RATES = exports.TAX_RATES = '/v2/tax_rates';
var USERS = exports.USERS = '/v1/users';
var WORK_ORDER_GOVERNANCE_SERVICE = exports.WORK_ORDER_GOVERNANCE_SERVICE = '/v1/workordergovernance';
exports.WORK_ORDER_GOVERNANCE_SERVICE = exports.USERS = exports.TAX_RATES = exports.SURVEY_RESPONSES = exports.SEARCH = exports.PUBLIC_SURVEY_RESPONSES = exports.PAYMENTS = exports.ORGANIZATIONS = exports.LAYER_IDENTITY_TOKENS = exports.LABELS = exports.JOB_ATTRIBUTIONS = exports.JOBS = exports.JOB_OFFERS = exports.GROUPS = exports.CUSTOMERS = exports.CUSTOMER_USERS = exports.CONVERSATIONS = exports.CALENDAR_EVENTS = exports.BRANDS = exports.BOOKING = exports.BILLING_ITEMS = exports.BILLING_DOCUMENTS = exports.BILLING_CONTRACTS = exports.ATTACHMENTS = exports.APPOINTMENT_FUNCTIONS = exports.APPOINTMENT_SERIES = exports.APPOINTMENTS = exports.APPLICATIONS = exports.ACCOUNT_USERS = exports.ACCOUNTS = exports.ACCOUNT_ORGANIZATIONS = void 0;
var ACCOUNT_ORGANIZATIONS = '/v1/account_organizations';
exports.ACCOUNT_ORGANIZATIONS = ACCOUNT_ORGANIZATIONS;
var ACCOUNTS = '/v1/accounts';
exports.ACCOUNTS = ACCOUNTS;
var ACCOUNT_USERS = '/v1/users/accounts';
exports.ACCOUNT_USERS = ACCOUNT_USERS;
var APPLICATIONS = '/v1/applications';
exports.APPLICATIONS = APPLICATIONS;
var APPOINTMENTS = '/v1/appointments';
exports.APPOINTMENTS = APPOINTMENTS;
var APPOINTMENT_SERIES = '/v1/appointment_series';
exports.APPOINTMENT_SERIES = APPOINTMENT_SERIES;
var APPOINTMENT_FUNCTIONS = '/v1/appointment_functions';
exports.APPOINTMENT_FUNCTIONS = APPOINTMENT_FUNCTIONS;
var ATTACHMENTS = '/v1/attachments';
exports.ATTACHMENTS = ATTACHMENTS;
var BILLING_CONTRACTS = '/v2/billing_contracts';
exports.BILLING_CONTRACTS = BILLING_CONTRACTS;
var BILLING_DOCUMENTS = '/v2/billing_documents';
exports.BILLING_DOCUMENTS = BILLING_DOCUMENTS;
var BILLING_ITEMS = '/v2/billing_items';
exports.BILLING_ITEMS = BILLING_ITEMS;
var BOOKING = '/booking';
exports.BOOKING = BOOKING;
var BRANDS = '/v1/brands';
exports.BRANDS = BRANDS;
var CALENDAR_EVENTS = '/calendar_events/events';
exports.CALENDAR_EVENTS = CALENDAR_EVENTS;
var CONVERSATIONS = '/v1/conversations';
exports.CONVERSATIONS = CONVERSATIONS;
var CUSTOMER_USERS = '/v1/users/customers';
exports.CUSTOMER_USERS = CUSTOMER_USERS;
var CUSTOMERS = '/v1/customers';
exports.CUSTOMERS = CUSTOMERS;
var GROUPS = '/groups';
exports.GROUPS = GROUPS;
var JOB_OFFERS = '/v1/job_offers';
exports.JOB_OFFERS = JOB_OFFERS;
var JOBS = '/v3/jobs';
exports.JOBS = JOBS;
var JOB_ATTRIBUTIONS = '/v1/job_attributions';
exports.JOB_ATTRIBUTIONS = JOB_ATTRIBUTIONS;
var LABELS = '/v2/labels';
exports.LABELS = LABELS;
var LAYER_IDENTITY_TOKENS = '/v1/layer/identity_tokens';
exports.LAYER_IDENTITY_TOKENS = LAYER_IDENTITY_TOKENS;
var ORGANIZATIONS = '/v1/organizations';
exports.ORGANIZATIONS = ORGANIZATIONS;
var PAYMENTS = '/v1/payments';
exports.PAYMENTS = PAYMENTS;
var PUBLIC_SURVEY_RESPONSES = '/v1/public/survey_responses';
exports.PUBLIC_SURVEY_RESPONSES = PUBLIC_SURVEY_RESPONSES;
var SEARCH = '/v2/search';
exports.SEARCH = SEARCH;
var SURVEY_RESPONSES = '/v1/survey_responses';
exports.SURVEY_RESPONSES = SURVEY_RESPONSES;
var TAX_RATES = '/v2/tax_rates';
exports.TAX_RATES = TAX_RATES;
var USERS = '/v1/users';
exports.USERS = USERS;
var WORK_ORDER_GOVERNANCE_SERVICE = '/v1/workordergovernance';
exports.WORK_ORDER_GOVERNANCE_SERVICE = WORK_ORDER_GOVERNANCE_SERVICE;

@@ -1,14 +0,12 @@

'use strict';
"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = appointmentMethods;
exports["default"] = appointmentMethods;
var _endpoints = require('../endpoints');
var endpoints = _interopRequireWildcard(require("../endpoints"));
var endpoints = _interopRequireWildcard(_endpoints);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function appointmentMethods(client) {

@@ -19,10 +17,7 @@ return function (id) {

var headerOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return client.doAuthenticatedRequest('PATCH', endpoints.APPOINTMENTS + '/' + id + '/notify', appointmentProperties, headerOptions);
return client.doAuthenticatedRequest('PATCH', "".concat(endpoints.APPOINTMENTS, "/").concat(id, "/notify"), appointmentProperties, headerOptions);
},
selectSuggestedTime: function selectSuggestedTime(appointmentProperties) {
var uuid = appointmentProperties.uuid;
return client.doAuthenticatedRequest('PATCH', endpoints.APPOINTMENTS + '/' + id + '/suggested_times/' + uuid);
return client.doAuthenticatedRequest('PATCH', "".concat(endpoints.APPOINTMENTS, "/").concat(id, "/suggested_times/").concat(uuid));
}

@@ -29,0 +24,0 @@ };

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,5 +6,5 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = attachmentMethods;
exports["default"] = attachmentMethods;
var _endpoints = require('../endpoints');
var _endpoints = require("../endpoints");

@@ -15,3 +15,3 @@ function attachmentMethods(client) {

update: function update(text, options) {
return client.doAuthenticatedRequest('PATCH', _endpoints.ATTACHMENTS + '/' + id, {
return client.doAuthenticatedRequest('PATCH', "".concat(_endpoints.ATTACHMENTS, "/").concat(id), {
description: text

@@ -22,5 +22,4 @@ }, options).then(function (response) {

},
delete: function _delete(options) {
return client.doAuthenticatedRequest('DELETE', _endpoints.ATTACHMENTS + '/' + id, null, options).then(function () {
"delete": function _delete(options) {
return client.doAuthenticatedRequest('DELETE', "".concat(_endpoints.ATTACHMENTS, "/").concat(id), null, options).then(function () {
// endpoint returns no content on successful request

@@ -27,0 +26,0 @@ // return id of successfully deleted item b/c its useful for resolve callbacks

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,5 +6,5 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = billingDocumentMethods;
exports["default"] = billingDocumentMethods;
var _endpoints = require('../endpoints');
var _endpoints = require("../endpoints");

@@ -21,8 +21,10 @@ function billingDocumentMethods(client) {

file_token: fileToken,
private: privateBool
"private": privateBool
};
return client.doAuthenticatedRequest('POST', _endpoints.ATTACHMENTS, body, options).then(function (response) {
return response.attachment;
});
},
approve: function approve() {
return client.doAuthenticatedRequest('POST', "".concat(_endpoints.BILLING_DOCUMENTS, "/").concat(id, "/approve"));
}

@@ -29,0 +31,0 @@ };

@@ -1,13 +0,20 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
/**

@@ -19,6 +26,7 @@ * Helper class so we can do things like client.entities.jobs.get(query)

*/
var Collection = function () {
var Collection =
/*#__PURE__*/
function () {
function Collection(client, endpoint) {
_classCallCheck(this, Collection);
(0, _classCallCheck2["default"])(this, Collection);
this.client = client;

@@ -28,19 +36,21 @@ this.endpoint = endpoint;

_createClass(Collection, [{
key: 'get',
(0, _createClass2["default"])(Collection, [{
key: "get",
value: function get() {
var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return this.client.getCollection(this.endpoint, _extends({ no_total: true }, query), opts);
return this.client.getCollection(this.endpoint, _objectSpread({
no_total: true
}, query), opts);
}
}, {
key: 'getWithMeta',
key: "getWithMeta",
value: function getWithMeta() {
var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return this.client.getCollectionWithMeta(this.endpoint, _extends({ no_total: true }, query));
return this.client.getCollectionWithMeta(this.endpoint, _objectSpread({
no_total: true
}, query));
}
}, {
key: 'getOne',
key: "getOne",
value: function getOne(id) {

@@ -50,6 +60,5 @@ return this.client.getModel(this.endpoint, id);

}, {
key: 'create',
key: "create",
value: function create(data) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return this.client.doAuthenticatedRequest('POST', this.endpoint, data, options).then(function (response) {

@@ -59,2 +68,3 @@ if (options.raw === true) {

}
return response[Object.keys(response)[0]];

@@ -64,11 +74,10 @@ });

}, {
key: 'getSingleEndpoint',
key: "getSingleEndpoint",
value: function getSingleEndpoint(id) {
return this.endpoint + '/' + id;
return "".concat(this.endpoint, "/").concat(id);
}
}, {
key: 'update',
key: "update",
value: function update(id, data) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
return this.client.doAuthenticatedRequest('PATCH', this.getSingleEndpoint(id), data, options).then(function (response) {

@@ -78,2 +87,3 @@ if (options.raw === true) {

}
return response[Object.keys(response)[0]];

@@ -83,3 +93,3 @@ });

}, {
key: 'delete',
key: "delete",
value: function _delete(id, data, options) {

@@ -89,12 +99,11 @@ return this.client.doAuthenticatedRequest('DELETE', this.getSingleEndpoint(id), data, options);

}, {
key: 'archive',
key: "archive",
value: function archive(id, options) {
return this.client.doAuthenticatedRequest('POST', this.endpoint + '/' + id + '/archive', null, options);
return this.client.doAuthenticatedRequest('POST', "".concat(this.endpoint, "/").concat(id, "/archive"), null, options);
}
}, {
key: 'restore',
key: "restore",
value: function restore(id, options) {
return this.client.doAuthenticatedRequest('POST', this.endpoint + '/' + id + '/restore', null, options);
return this.client.doAuthenticatedRequest('POST', "".concat(this.endpoint, "/").concat(id, "/restore"), null, options);
}
/**

@@ -107,12 +116,12 @@ * Returns the count of total records for the given query

}, {
key: 'getTotalRecords',
key: "getTotalRecords",
value: function getTotalRecords(query) {
return this.getWithMeta(_extends({}, query, { limit: 0 })).then(function (_ref) {
return this.getWithMeta(_objectSpread({}, query, {
limit: 0
})).then(function (_ref) {
var _ref$meta = _ref.meta,
meta = _ref$meta === undefined ? {} : _ref$meta;
meta = _ref$meta === void 0 ? {} : _ref$meta;
return meta.total;
});
}
/**

@@ -127,3 +136,3 @@ * Returns an array of ALL records for the given query.

}, {
key: 'getAllRecords',
key: "getAllRecords",
value: function getAllRecords(query, records) {

@@ -136,3 +145,2 @@ var _this = this;

query.offset = query.offset || 0;
return this.get(query).then(function (results) {

@@ -142,3 +150,5 @@ var newRecords = (records || []).concat(results || []);

if ((results || []).length === query.limit) {
return _this.getAllRecords(_extends({}, query, { offset: query.offset + query.limit }), newRecords);
return _this.getAllRecords(_objectSpread({}, query, {
offset: query.offset + query.limit
}), newRecords);
}

@@ -150,6 +160,5 @@

}]);
return Collection;
}();
exports.default = Collection;
exports["default"] = Collection;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,5 +6,5 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = conversationMethods;
exports["default"] = conversationMethods;
var _endpoints = require('../endpoints');
var _endpoints = require("../endpoints");

@@ -21,4 +21,3 @@ function conversationMethods(client) {

var endpoint = _endpoints.CONVERSATIONS + '?filter[organization_id]=' + organizationID + '&filter[customer_user_id]=' + customerUserID;
var endpoint = "".concat(_endpoints.CONVERSATIONS, "?filter[organization_id]=").concat(organizationID, "&filter[customer_user_id]=").concat(customerUserID);
return client.doAuthenticatedRequest('GET', endpoint).then(function (response) {

@@ -25,0 +24,0 @@ return response.conversations[0];

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,5 +6,5 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = customerMethods;
exports["default"] = customerMethods;
var _endpoints = require('../endpoints');
var _endpoints = require("../endpoints");

@@ -15,6 +15,7 @@ function customerMethods(client) {

update: function update(customerProperties) {
return client.doAuthenticatedRequest('PATCH', _endpoints.CUSTOMERS + '/' + id, customerProperties).then(function (response) {
return client.doAuthenticatedRequest('PATCH', "".concat(_endpoints.CUSTOMERS, "/").concat(id), customerProperties).then(function (response) {
return response.customer;
});
},
/**

@@ -34,2 +35,3 @@ * Returns photos for a customer

},
/**

@@ -49,2 +51,3 @@ * Returns notes for a customer

},
/**

@@ -51,0 +54,0 @@ * Returns all attachments for a customer

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,4 +6,5 @@ Object.defineProperty(exports, "__esModule", {

});
exports["default"] = void 0;
var _endpoints = require('../endpoints');
var _endpoints = require("../endpoints");

@@ -34,4 +35,3 @@ var invoiceMethods = function invoiceMethods(client) {

};
var paymentEndpoint = '/v1/invoices/' + id + '/payments';
var paymentEndpoint = "/v1/invoices/".concat(id, "/payments");
return client.doAuthenticatedRequest('POST', paymentEndpoint, formData);

@@ -43,2 +43,3 @@ }

exports.default = invoiceMethods;
var _default = invoiceMethods;
exports["default"] = _default;

@@ -1,23 +0,22 @@

'use strict';
"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = jobMethods;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
exports.default = jobMethods;
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
var _isEmpty = require('lodash/isEmpty');
var endpoints = _interopRequireWildcard(require("../endpoints"));
var _isEmpty2 = _interopRequireDefault(_isEmpty);
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
var _endpoints = require('../endpoints');
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
var endpoints = _interopRequireWildcard(_endpoints);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**

@@ -38,3 +37,2 @@ * Get the billing documents by doc type for a specific job.

}
/**

@@ -47,2 +45,4 @@ * Add a billing document with a doc type to a specific job.

*/
function addBillingDocument(client, id, docType) {

@@ -52,6 +52,5 @@ return client.entities.jobs.getOne(id).then(function (_ref) {

_ref$customer = _ref.customer,
customer = _ref$customer === undefined ? {} : _ref$customer;
customer = _ref$customer === void 0 ? {} : _ref$customer;
return client.entities.billingDocuments.create({
customer: _extends({}, customer, {
customer: _objectSpread({}, customer, {
customer_id: customer.id

@@ -65,3 +64,2 @@ }),

}
/**

@@ -76,2 +74,4 @@ * Accept of reject a job offer.

*/
function actOnOffer(client, id, action) {

@@ -82,5 +82,7 @@ var body = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};

if (action === 'accept') {
if ((0, _isEmpty2.default)(body)) {
return client.doAuthenticatedRequest('POST', endpoints.WORK_ORDER_GOVERNANCE_SERVICE + '/' + id + '/accept', {}, options).then(function (response) {
return { status: response.new_job_status };
if ((0, _isEmpty["default"])(body)) {
return client.doAuthenticatedRequest('POST', "".concat(endpoints.WORK_ORDER_GOVERNANCE_SERVICE, "/").concat(id, "/accept"), {}, options).then(function (response) {
return {
status: response.new_job_status
};
});

@@ -95,5 +97,8 @@ }

};
return client.doAuthenticatedRequest('POST', endpoints.WORK_ORDER_GOVERNANCE_SERVICE + '/' + id + '/accept', { appointment: appointmentBody }, options).then(function (response) {
return { status: response.new_job_status };
return client.doAuthenticatedRequest('POST', "".concat(endpoints.WORK_ORDER_GOVERNANCE_SERVICE, "/").concat(id, "/accept"), {
appointment: appointmentBody
}, options).then(function (response) {
return {
status: response.new_job_status
};
});

@@ -103,8 +108,10 @@ }

if (action === 'reject') {
return client.doAuthenticatedRequest('POST', endpoints.WORK_ORDER_GOVERNANCE_SERVICE + '/' + id + '/reject', body, options).then(function (response) {
return { status: response.new_job_status };
return client.doAuthenticatedRequest('POST', "".concat(endpoints.WORK_ORDER_GOVERNANCE_SERVICE, "/").concat(id, "/reject"), body, options).then(function (response) {
return {
status: response.new_job_status
};
});
}
return Promise.reject(new Error(action + ' is not an accepted action for a job offer.'));
return Promise.reject(new Error("".concat(action, " is not an accepted action for a job offer.")));
}

@@ -125,3 +132,2 @@

},
getPhotos: function getPhotos() {

@@ -137,19 +143,14 @@ var query = {

},
addEstimate: function addEstimate() {
return addBillingDocument(client, id, 'Estimate');
},
getEstimates: function getEstimates() {
return getBillingDocuments(client, id, 'Estimate');
},
addInvoice: function addInvoice() {
return addBillingDocument(client, id, 'Invoice');
},
getInvoices: function getInvoices() {
return getBillingDocuments(client, id, 'Invoice');
},
addNote: function addNote(text, options) {

@@ -161,3 +162,2 @@ var body = {

};
return client.doAuthenticatedRequest('POST', endpoints.ATTACHMENTS, body, options).then(function (response) {

@@ -167,3 +167,2 @@ return response.attachment;

},
addPhoto: function addPhoto(fileToken, name, description, privateBool, options) {

@@ -176,5 +175,4 @@ var body = {

file_token: fileToken,
private: privateBool
"private": privateBool
};
return client.doAuthenticatedRequest('POST', endpoints.ATTACHMENTS, body, options).then(function (response) {

@@ -184,9 +182,8 @@ return response.attachment;

},
createAppointment: function createAppointment() {
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var options = arguments[1];
var body = Object.assign({}, data, { job_id: id });
var options = arguments.length > 1 ? arguments[1] : undefined;
var body = Object.assign({}, data, {
job_id: id
});
return client.doAuthenticatedRequest('POST', endpoints.APPOINTMENTS, body, options).then(function (response) {

@@ -196,3 +193,2 @@ return response.appointment;

},
getAppointments: function getAppointments() {

@@ -210,5 +206,5 @@ var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

}
return client.getCollection(endpoints.APPOINTMENTS, query);
},
getScheduledAppointment: function getScheduledAppointment() {

@@ -225,9 +221,8 @@ return client.entities.job(id).getAppointments({

}
return null;
});
},
getSurveys: function getSurveys() {
var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var DEFAULT_QUERY = {

@@ -245,11 +240,8 @@ job_id_eq: id

},
update: function update(jobProperties) {
var headerOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return client.doAuthenticatedRequest('PATCH', endpoints.JOBS + '/' + id, jobProperties, headerOptions).then(function (response) {
return client.doAuthenticatedRequest('PATCH', "".concat(endpoints.JOBS, "/").concat(id), jobProperties, headerOptions).then(function (response) {
return response.job;
});
},
accept: function accept(timeslot, body, options) {

@@ -259,3 +251,5 @@ return actOnOffer(client, id, 'accept', body, options);

reject: function reject(rejectReason, options) {
return actOnOffer(client, id, 'reject', { status_message: rejectReason }, options);
return actOnOffer(client, id, 'reject', {
status_message: rejectReason
}, options);
}

@@ -262,0 +256,0 @@ };

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,5 +6,5 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = layerMethods;
exports["default"] = layerMethods;
var _endpoints = require('../endpoints');
var _endpoints = require("../endpoints");

@@ -14,3 +14,5 @@ function layerMethods(client) {

getIdentityToken: function getIdentityToken(nonce) {
return client.doAuthenticatedRequest('POST', _endpoints.LAYER_IDENTITY_TOKENS, { nonce: nonce }).then(function (response) {
return client.doAuthenticatedRequest('POST', _endpoints.LAYER_IDENTITY_TOKENS, {
nonce: nonce
}).then(function (response) {
return response.layer_identity_token;

@@ -17,0 +19,0 @@ });

@@ -1,15 +0,16 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = organizationMethods;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
exports.default = organizationMethods;
var _endpoints = require("../endpoints");
var _endpoints = require('../endpoints');
var _workHours = require("../workHours");
var _workHours = require('../workHours');
function organizationMethods(client) {

@@ -20,3 +21,5 @@ return function (id) {

if (!id || !customer) throw new Error('Usage: organization(id).addCustomer(customer)');
return client.doAuthenticatedRequest('POST', '' + _endpoints.CUSTOMERS, Object.assign({}, { organization_id: id }, customer)).then(function (response) {
return client.doAuthenticatedRequest('POST', "".concat(_endpoints.CUSTOMERS), Object.assign({}, {
organization_id: id
}, customer)).then(function (response) {
return response.customer;

@@ -28,7 +31,8 @@ });

return client.entities.organizations.getOne(id).then(function (organization) {
if (organization.working_hours && _typeof(organization.working_hours) === 'object' && Object.keys(organization.working_hours).length > 0 && organization.timezone) {
if (organization.working_hours && (0, _typeof2["default"])(organization.working_hours) === 'object' && Object.keys(organization.working_hours).length > 0 && organization.timezone) {
return (0, _workHours.inWorkHours)(organization.working_hours, organization.timezone, date);
}
return false;
}).catch(function () {
})["catch"](function () {
throw new Error('Could not find organization when querying for work hours!');

@@ -42,4 +46,3 @@ });

var endpoint = _endpoints.CONVERSATIONS + '?filter[organization_id]=' + id;
var endpoint = "".concat(_endpoints.CONVERSATIONS, "?filter[organization_id]=").concat(id);
return client.doAuthenticatedRequest('GET', endpoint).then(function (response) {

@@ -46,0 +49,0 @@ return response.conversations;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,5 +6,5 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = surveyMethods;
exports["default"] = surveyMethods;
var _endpoints = require('../endpoints');
var _endpoints = require("../endpoints");

@@ -21,6 +21,6 @@ /**

update: function update(surveyProperties) {
return client.doAuthenticatedRequest('PATCH', _endpoints.PUBLIC_SURVEY_RESPONSES + '/' + uid, surveyProperties).then(function (response) {
return client.doAuthenticatedRequest('PATCH', "".concat(_endpoints.PUBLIC_SURVEY_RESPONSES, "/").concat(uid), surveyProperties).then(function (response) {
return response.survey_response;
}).catch(function (reason) {
return new Error('Update survey failed: ' + reason);
})["catch"](function (reason) {
return new Error("Update survey failed: ".concat(reason));
});

@@ -27,0 +27,0 @@ }

@@ -1,13 +0,14 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = userMethods;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
exports.default = userMethods;
var _workHours = require("../workHours");
var _workHours = require('../workHours');
function userMethods(client) {

@@ -20,3 +21,3 @@ return function (id) {

// If they have working hours, use those. Otherwise use the ones from their organization.
if (user.working_hours && _typeof(user.working_hours) === 'object' && Object.keys(user.working_hours).length > 0) {
if (user.working_hours && (0, _typeof2["default"])(user.working_hours) === 'object' && Object.keys(user.working_hours).length > 0) {
if (!user.timezone) {

@@ -42,6 +43,4 @@ // Try getting the timezone from the org

},
phoneNumbers: function phoneNumbers() {
var endpoint = '/v1/users/' + id + '/phone_numbers';
var endpoint = "/v1/users/".concat(id, "/phone_numbers");
return client.doAuthenticatedRequest('GET', endpoint).then(function (response) {

@@ -48,0 +47,0 @@ return response.phone_number;

@@ -1,8 +0,11 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.MultiActionError = exports.APIError = exports.NotFoundError = exports.UnprocessableEntityError = exports.ForbiddenError = exports.UnauthorizedError = void 0;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

@@ -13,5 +16,4 @@ function makeError(klass) {

var UnauthorizedError = exports.UnauthorizedError = function UnauthorizedError(message) {
_classCallCheck(this, UnauthorizedError);
var UnauthorizedError = function UnauthorizedError(message) {
(0, _classCallCheck2["default"])(this, UnauthorizedError);
this.name = 'UnauthorizedError';

@@ -22,7 +24,7 @@ this.message = message;

exports.UnauthorizedError = UnauthorizedError;
makeError(UnauthorizedError);
var ForbiddenError = exports.ForbiddenError = function ForbiddenError() {
_classCallCheck(this, ForbiddenError);
var ForbiddenError = function ForbiddenError() {
(0, _classCallCheck2["default"])(this, ForbiddenError);
this.name = 'ForbiddenError';

@@ -33,7 +35,7 @@ this.message = 'Forbidden';

exports.ForbiddenError = ForbiddenError;
makeError(ForbiddenError);
var UnprocessableEntityError = exports.UnprocessableEntityError = function UnprocessableEntityError(response) {
_classCallCheck(this, UnprocessableEntityError);
var UnprocessableEntityError = function UnprocessableEntityError(response) {
(0, _classCallCheck2["default"])(this, UnprocessableEntityError);
this.name = 'UnprocessableEntityError';

@@ -45,7 +47,7 @@ this.message = 'Validation failed';

exports.UnprocessableEntityError = UnprocessableEntityError;
makeError(UnprocessableEntityError);
var NotFoundError = exports.NotFoundError = function NotFoundError() {
_classCallCheck(this, NotFoundError);
var NotFoundError = function NotFoundError() {
(0, _classCallCheck2["default"])(this, NotFoundError);
this.name = 'NotFoundError';

@@ -56,7 +58,7 @@ this.message = 'Not found';

exports.NotFoundError = NotFoundError;
makeError(NotFoundError);
var APIError = exports.APIError = function APIError(text, code) {
_classCallCheck(this, APIError);
var APIError = function APIError(text, code) {
(0, _classCallCheck2["default"])(this, APIError);
this.name = 'APIError';

@@ -69,7 +71,7 @@ this.message = 'Unknown error';

exports.APIError = APIError;
makeError(APIError);
var MultiActionError = exports.MultiActionError = function MultiActionError(message, data) {
_classCallCheck(this, MultiActionError);
var MultiActionError = function MultiActionError(message, data) {
(0, _classCallCheck2["default"])(this, MultiActionError);
this.name = 'MultiActionError';

@@ -81,2 +83,3 @@ this.message = message;

exports.MultiActionError = MultiActionError;
makeError(MultiActionError);

@@ -1,6 +0,12 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.dataURItoBlob = dataURItoBlob;
var _atob = _interopRequireDefault(require("atob"));
/**

@@ -13,14 +19,15 @@ * convert base64/URLEncoded data component to raw binary data held

function dataURItoBlob(dataURI) {
var byteString = void 0;
var byteString;
if (dataURI.split(',')[0].indexOf('base64') >= 0) {
byteString = atob(dataURI.split(',')[1]);
byteString = (0, _atob["default"])(dataURI.split(',')[1]);
} else {
byteString = unescape(dataURI.split(',')[1]);
}
} // separate out the mime component
// separate out the mime component
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
// write the bytes of the string to a typed array
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]; // write the bytes of the string to a typed array
var ia = new Uint8Array(byteString.length);
for (var i = 0; i < byteString.length; i++) {

@@ -30,5 +37,5 @@ ia[i] = byteString.charCodeAt(i);

return new Blob([ia], { type: mimeString });
}
exports.dataURItoBlob = dataURItoBlob;
return new Blob([ia], {
type: mimeString
});
}

@@ -1,15 +0,14 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = _default;
exports.default = function () {
return (0, _v2.default)();
};
var _v = _interopRequireDefault(require("uuid/v4"));
var _v = require('uuid/v4');
var _v2 = _interopRequireDefault(_v);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return (0, _v["default"])();
}

@@ -1,3 +0,5 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -7,28 +9,17 @@ value: true

exports.generateSignature = generateSignature;
exports.default = getAuthHeaders;
exports["default"] = getAuthHeaders;
var _hmacSha = require('crypto-js/hmac-sha1');
var _hmacSha = _interopRequireDefault(require("crypto-js/hmac-sha1"));
var _hmacSha2 = _interopRequireDefault(_hmacSha);
var _encBase = _interopRequireDefault(require("crypto-js/enc-base64"));
var _encBase = require('crypto-js/enc-base64');
var _md = _interopRequireDefault(require("crypto-js/md5"));
var _encBase2 = _interopRequireDefault(_encBase);
var _moment = _interopRequireDefault(require("moment"));
var _md = require('crypto-js/md5');
var _md2 = _interopRequireDefault(_md);
var _moment = require('moment');
var _moment2 = _interopRequireDefault(_moment);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function generateSignature(path, contentMD5, requestTime, secret) {
var components = ['application/json', contentMD5, path, requestTime];
var signature = (0, _hmacSha2.default)(components.join(','), secret);
return signature.toString(_encBase2.default);
var signature = (0, _hmacSha["default"])(components.join(','), secret);
return signature.toString(_encBase["default"]);
}
/**

@@ -45,2 +36,4 @@ * Calculate the request headers for HMAC signature authentication

*/
function getAuthHeaders(_ref) {

@@ -52,13 +45,10 @@ var path = _ref.path,

secret = _ref.secret;
// Date must be formatted like this:
// Thu, 01 Oct 2015 19:30:40 GMT
var requestTime = _moment2.default.utc().format('ddd, DD MMM YYYY HH:mm:ss ') + 'GMT';
// NOTE: For now, this is an arbitrary "nonce" type of operation. So we just
var requestTime = "".concat(_moment["default"].utc().format('ddd, DD MMM YYYY HH:mm:ss '), "GMT"); // NOTE: For now, this is an arbitrary "nonce" type of operation. So we just
// generate an md5 string from the body + the requestTime, and set it as
// Content-MD5. Eventually we might add MD5 content verification to the API.
var md5 = (0, _md2.default)(JSON.stringify(body) || '');
var md5Value = md5.toString(_encBase2.default);
var md5 = (0, _md["default"])(JSON.stringify(body) || '');
var md5Value = md5.toString(_encBase["default"]);
return {

@@ -68,4 +58,4 @@ 'Content-Type': 'application/json',

Date: requestTime,
Authorization: 'APIAuth ' + userType + '-' + userID + ':' + generateSignature(path, md5Value, requestTime, secret)
Authorization: "APIAuth ".concat(userType, "-").concat(userID, ":").concat(generateSignature(path, md5Value, requestTime, secret))
};
}

@@ -1,58 +0,118 @@

'use strict';
"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.endpoints = exports.UnprocessableEntityError = exports.UnauthorizedError = exports.timezoneMap = exports.RawClient = exports.NotFoundError = exports.inWorkHours = exports.getCurrentTimeInTimezone = exports.generateUUID = exports.ForbiddenError = exports.AUTH_MODE_NONE = exports.AUTH_MODE_HMAC = exports.AUTH_MODE_BEARER = exports.AppointmentHelpers = exports.APIError = exports.Analytics = undefined;
Object.defineProperty(exports, "Analytics", {
enumerable: true,
get: function get() {
return _analytics["default"];
}
});
Object.defineProperty(exports, "generateUUID", {
enumerable: true,
get: function get() {
return _generateUUID["default"];
}
});
Object.defineProperty(exports, "RawClient", {
enumerable: true,
get: function get() {
return _rawClient["default"];
}
});
Object.defineProperty(exports, "AUTH_MODE_BEARER", {
enumerable: true,
get: function get() {
return _rawClient.AUTH_MODE_BEARER;
}
});
Object.defineProperty(exports, "AUTH_MODE_HMAC", {
enumerable: true,
get: function get() {
return _rawClient.AUTH_MODE_HMAC;
}
});
Object.defineProperty(exports, "AUTH_MODE_NONE", {
enumerable: true,
get: function get() {
return _rawClient.AUTH_MODE_NONE;
}
});
Object.defineProperty(exports, "getCurrentTimeInTimezone", {
enumerable: true,
get: function get() {
return _timezones.getCurrentTimeInTimezone;
}
});
Object.defineProperty(exports, "timezoneMap", {
enumerable: true,
get: function get() {
return _timezones.timezoneMap;
}
});
Object.defineProperty(exports, "APIError", {
enumerable: true,
get: function get() {
return _errors.APIError;
}
});
Object.defineProperty(exports, "ForbiddenError", {
enumerable: true,
get: function get() {
return _errors.ForbiddenError;
}
});
Object.defineProperty(exports, "NotFoundError", {
enumerable: true,
get: function get() {
return _errors.NotFoundError;
}
});
Object.defineProperty(exports, "UnauthorizedError", {
enumerable: true,
get: function get() {
return _errors.UnauthorizedError;
}
});
Object.defineProperty(exports, "UnprocessableEntityError", {
enumerable: true,
get: function get() {
return _errors.UnprocessableEntityError;
}
});
Object.defineProperty(exports, "inWorkHours", {
enumerable: true,
get: function get() {
return _workHours.inWorkHours;
}
});
exports.endpoints = exports.AppointmentHelpers = exports["default"] = void 0;
var _analytics = require('./analytics');
var _analytics = _interopRequireDefault(require("./analytics"));
var _analytics2 = _interopRequireDefault(_analytics);
var _dispatch = _interopRequireDefault(require("./dispatch"));
var _dispatch = require('./dispatch');
var _generateUUID = _interopRequireDefault(require("./generateUUID"));
var _dispatch2 = _interopRequireDefault(_dispatch);
var _rawClient = _interopRequireWildcard(require("./rawClient"));
var _generateUUID = require('./generateUUID');
var _timezones = require("./timezones");
var _generateUUID2 = _interopRequireDefault(_generateUUID);
var AppointmentHelpers = _interopRequireWildcard(require("./appointmentHelpers"));
var _rawClient = require('./rawClient');
exports.AppointmentHelpers = AppointmentHelpers;
var _rawClient2 = _interopRequireDefault(_rawClient);
var _errors = require("./errors");
var _timezones = require('./timezones');
var _workHours = require("./workHours");
var _appointmentHelpers = require('./appointmentHelpers');
var endpoints = _interopRequireWildcard(require("./endpoints"));
var AppointmentHelpers = _interopRequireWildcard(_appointmentHelpers);
var _errors = require('./errors');
var _workHours = require('./workHours');
var _endpoints = require('./endpoints');
var endpoints = _interopRequireWildcard(_endpoints);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _dispatch2.default;
exports.Analytics = _analytics2.default;
exports.APIError = _errors.APIError;
exports.AppointmentHelpers = AppointmentHelpers;
exports.AUTH_MODE_BEARER = _rawClient.AUTH_MODE_BEARER;
exports.AUTH_MODE_HMAC = _rawClient.AUTH_MODE_HMAC;
exports.AUTH_MODE_NONE = _rawClient.AUTH_MODE_NONE;
exports.ForbiddenError = _errors.ForbiddenError;
exports.generateUUID = _generateUUID2.default;
exports.getCurrentTimeInTimezone = _timezones.getCurrentTimeInTimezone;
exports.inWorkHours = _workHours.inWorkHours;
exports.NotFoundError = _errors.NotFoundError;
exports.RawClient = _rawClient2.default;
exports.timezoneMap = _timezones.timezoneMap;
exports.UnauthorizedError = _errors.UnauthorizedError;
exports.UnprocessableEntityError = _errors.UnprocessableEntityError;
exports.endpoints = endpoints;
exports.endpoints = endpoints;
var _default = _dispatch["default"];
exports["default"] = _default;

@@ -1,22 +0,29 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _queryString = require('./queryString');
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _queryString = require("./queryString");
var Products = function () {
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
var Products =
/*#__PURE__*/
function () {
function Products(client) {
_classCallCheck(this, Products);
(0, _classCallCheck2["default"])(this, Products);
this.client = client;
}
/**

@@ -32,12 +39,13 @@ * Get the premium products for a certain entity.

_createClass(Products, [{
key: 'getForEntity',
(0, _createClass2["default"])(Products, [{
key: "getForEntity",
value: function getForEntity(entityType, entityID, options) {
var queryString = '';
if (options) {
queryString = '?' + (0, _queryString.stringify)(options);
queryString = "?".concat((0, _queryString.stringify)(options));
}
return this.client.doAuthenticatedRequest('GET', '/products/' + entityType + '/' + entityID + queryString);
return this.client.doAuthenticatedRequest('GET', "/products/".concat(entityType, "/").concat(entityID).concat(queryString));
}
/**

@@ -55,12 +63,12 @@ * Add a premium product for a certain entity. Optionally specify some config for it.

}, {
key: 'addForEntity',
key: "addForEntity",
value: function addForEntity(entityType, entityID, name) {
var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var body = _extends({
var body = _objectSpread({
name: name
}, config);
return this.client.doAuthenticatedRequest('POST', '/products/' + entityType + '/' + entityID, body);
return this.client.doAuthenticatedRequest('POST', "/products/".concat(entityType, "/").concat(entityID), body);
}
/**

@@ -76,11 +84,10 @@ * Remove a premium product for a certain entity.

}, {
key: 'removeForEntity',
key: "removeForEntity",
value: function removeForEntity(entityType, entityID, name) {
return this.client.doAuthenticatedRequest('DELETE', '/products/' + entityType + '/' + entityID + '/' + name);
return this.client.doAuthenticatedRequest('DELETE', "/products/".concat(entityType, "/").concat(entityID, "/").concat(name));
}
}]);
return Products;
}();
exports.default = Products;
exports["default"] = Products;

@@ -1,19 +0,20 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.stringify = stringify;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
exports.stringify = stringify;
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function getNodesList(obj) {
var nodes = [];
Object.getOwnPropertyNames(obj).forEach(function (prop) {
var val = obj[prop];
if ((typeof val === 'undefined' ? 'undefined' : _typeof(val)) === 'object') {
if ((0, _typeof2["default"])(val) === 'object') {
if (Array.isArray(val)) {

@@ -26,3 +27,3 @@ val.forEach(function (v) {

nestedNodes.forEach(function (v) {
nodes.push([prop].concat(_toConsumableArray(v)));
nodes.push([prop].concat((0, _toConsumableArray2["default"])(v)));
});

@@ -34,3 +35,2 @@ }

});
return nodes;

@@ -44,5 +44,5 @@ }

key += node.map(function (v) {
return '[' + v + ']';
return "[".concat(v, "]");
}).join('');
return key + '=' + (encode === true ? encodeURIComponent(val) : val);
return "".concat(key, "=").concat(encode === true ? encodeURIComponent(val) : val);
});

@@ -49,0 +49,0 @@ }

@@ -1,34 +0,29 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.AUTH_MODE_NONE = exports.AUTH_MODE_BEARER = exports.AUTH_MODE_HMAC = undefined;
exports["default"] = exports.AUTH_MODE_NONE = exports.AUTH_MODE_BEARER = exports.AUTH_MODE_HMAC = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _includes = require('lodash/includes');
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _includes2 = _interopRequireDefault(_includes);
var _includes = _interopRequireDefault(require("lodash/includes"));
var _getAuthHeaders = require('./getAuthHeaders');
var _getAuthHeaders = _interopRequireDefault(require("./getAuthHeaders"));
var _getAuthHeaders2 = _interopRequireDefault(_getAuthHeaders);
var _isomorphicFetch = _interopRequireDefault(require("isomorphic-fetch"));
var _isomorphicFetch = require('isomorphic-fetch');
var _errors = require("./errors");
var _isomorphicFetch2 = _interopRequireDefault(_isomorphicFetch);
var _errors = require('./errors');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var AUTH_MODE_HMAC = exports.AUTH_MODE_HMAC = 'dispatch/AUTH_MODE_HMAC';
var AUTH_MODE_BEARER = exports.AUTH_MODE_BEARER = 'dispatch/AUTH_MODE_BEARER';
var AUTH_MODE_NONE = exports.AUTH_MODE_NONE = 'dispatch/AUTH_MODE_NONE';
var AUTH_MODE_HMAC = 'dispatch/AUTH_MODE_HMAC';
exports.AUTH_MODE_HMAC = AUTH_MODE_HMAC;
var AUTH_MODE_BEARER = 'dispatch/AUTH_MODE_BEARER';
exports.AUTH_MODE_BEARER = AUTH_MODE_BEARER;
var AUTH_MODE_NONE = 'dispatch/AUTH_MODE_NONE';
exports.AUTH_MODE_NONE = AUTH_MODE_NONE;
var validAuthModes = [AUTH_MODE_BEARER, AUTH_MODE_HMAC, AUTH_MODE_NONE];
/**

@@ -47,10 +42,11 @@ * Low-level client for interacting with the API.

var RawClient = function () {
var RawClient =
/*#__PURE__*/
function () {
function RawClient(options) {
_classCallCheck(this, RawClient);
(0, _classCallCheck2["default"])(this, RawClient);
var authMode = options.authMode || AUTH_MODE_BEARER;
if (!(0, _includes2.default)(validAuthModes, authMode)) {
throw new Error('Invalid auth mode `' + authMode + '`, expected one of ' + validAuthModes.join(', '));
if (!(0, _includes["default"])(validAuthModes, authMode)) {
throw new Error("Invalid auth mode `".concat(authMode, "`, expected one of ").concat(validAuthModes.join(', ')));
}

@@ -70,2 +66,3 @@

break;
case AUTH_MODE_HMAC:

@@ -78,2 +75,3 @@ if (!options.hmacCredentials) {

break;
default:

@@ -84,8 +82,7 @@ break;

this.auditAction = options.auditAction;
this.host = options.host || 'https://api.dispatch.me';
}
_createClass(RawClient, [{
key: 'setBearerToken',
(0, _createClass2["default"])(RawClient, [{
key: "setBearerToken",
value: function setBearerToken(bearerToken) {

@@ -95,3 +92,3 @@ this.bearerToken = bearerToken;

}, {
key: 'setHMACCredentials',
key: "setHMACCredentials",
value: function setHMACCredentials(creds) {

@@ -101,46 +98,40 @@ this.hmacCredentials = creds;

}, {
key: 'get',
key: "get",
value: function get(endpoint) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return this.doRequest('GET', endpoint, null, options);
}
}, {
key: 'post',
key: "post",
value: function post(endpoint, body) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
return this.doRequest('POST', endpoint, body, options);
}
}, {
key: 'put',
key: "put",
value: function put(endpoint, body) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
return this.doRequest('PUT', endpoint, body, options);
}
}, {
key: 'patch',
key: "patch",
value: function patch(endpoint, body) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
return this.doRequest('PATCH', endpoint, body, options);
}
}, {
key: 'delete',
key: "delete",
value: function _delete(endpoint) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return this.doRequest('DELETE', endpoint, null, options);
}
}, {
key: 'doRequest',
key: "doRequest",
value: function doRequest(method, endpoint) {
var body = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var url = this.host + endpoint; // XXX - FormData is not available on the server so we must do a try catch.
var url = this.host + endpoint;
var appendHeaders = true;
// XXX - FormData is not available on the server so we must do a try catch.
var appendHeaders = true;
try {

@@ -150,7 +141,7 @@ appendHeaders = !(body instanceof FormData);

appendHeaders = true;
}
// Unless the body is an instance of form data
} // Unless the body is an instance of form data
// include content-type and accpet in the headers.
// The form data will add its own headers for this.
var headers = appendHeaders ? Object.assign({

@@ -163,6 +154,7 @@ 'Content-Type': 'application/json',

case AUTH_MODE_BEARER:
headers.Authorization = 'Bearer ' + this.bearerToken;
headers.Authorization = "Bearer ".concat(this.bearerToken);
break;
case AUTH_MODE_HMAC:
Object.assign(headers, (0, _getAuthHeaders2.default)({
Object.assign(headers, (0, _getAuthHeaders["default"])({
path: endpoint,

@@ -175,2 +167,3 @@ body: body,

break;
default:

@@ -194,5 +187,10 @@ break;

if (typeof this.auditAction === 'function') {
this.auditAction({ method: method, url: url, body: body });
this.auditAction({
method: method,
url: url,
body: body
});
}
return (0, _isomorphicFetch2.default)(url, params).then(function (response) {
return (0, _isomorphicFetch["default"])(url, params).then(function (response) {
// 204 returns no content. short circuit to prevent parse errors.

@@ -208,8 +206,9 @@ if (response.status === 204) {

});
}
} // Emit a different error with different data based on the status code
// Emit a different error with different data based on the status code
switch (response.status) {
case 401:
return Promise.reject(new _errors.UnauthorizedError());
case 422:

@@ -221,6 +220,9 @@ // The API is pretty descriptive of the validation errors so we can process

});
case 404:
return Promise.reject(new _errors.NotFoundError());
case 403:
return Promise.reject(new _errors.ForbiddenError());
default:

@@ -234,6 +236,5 @@ return response.text().then(function (text) {

}]);
return RawClient;
}();
exports.default = RawClient;
exports["default"] = RawClient;
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var Request = function () {
var Request =
/*#__PURE__*/
function () {
function Request(method, endpoint) {
var body = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
_classCallCheck(this, Request);
(0, _classCallCheck2["default"])(this, Request);
this.method = method;

@@ -25,3 +28,3 @@ this.endpoint = endpoint;

_createClass(Request, [{
(0, _createClass2["default"])(Request, [{
key: "do",

@@ -33,6 +36,5 @@ value: function _do(client) {

}]);
return Request;
}();
exports.default = Request;
exports["default"] = Request;

@@ -1,15 +0,16 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.timezoneMap = exports.getCurrentTimeInTimezone = exports.convertTime = undefined;
exports.convertTime = convertTime;
exports.getCurrentTimeInTimezone = getCurrentTimeInTimezone;
exports.timezoneMap = void 0;
var _momentTimezone = require('moment-timezone');
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
var _momentTimezone2 = _interopRequireDefault(_momentTimezone);
/* eslint-disable quote-props */
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* eslint-disable quote-props */
/**

@@ -167,2 +168,3 @@ * This is a map of the API's organization timezones

};
exports.timezoneMap = timezoneMap;

@@ -172,7 +174,8 @@ function getCurrentTimeInTimezone(timezone) {

var momentTz = timezoneMap[timezone];
if (!momentTz) {
throw new Error('Failed to translate timezone "' + timezone + '" to a moment timezone (unrecognized)');
throw new Error("Failed to translate timezone \"".concat(timezone, "\" to a moment timezone (unrecognized)"));
}
return convertTime((0, _momentTimezone2.default)().tz(momentTz));
return convertTime((0, _momentTimezone["default"])().tz(momentTz));
}

@@ -187,6 +190,2 @@

};
}
exports.convertTime = convertTime;
exports.getCurrentTimeInTimezone = getCurrentTimeInTimezone;
exports.timezoneMap = timezoneMap;
}

@@ -1,16 +0,15 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.translateWorkHourBlock = exports.inWorkHours = undefined;
exports.inWorkHours = inWorkHours;
exports.translateWorkHourBlock = translateWorkHourBlock;
var _timezones = require('./timezones');
var _timezones = require("./timezones");
var _moment = require('moment');
var _moment = _interopRequireDefault(require("moment"));
var _moment2 = _interopRequireDefault(_moment);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**

@@ -23,5 +22,4 @@ * @param {Object} workHours - org.work_hours or user.work_hours object

function inWorkHours(workHours, timezone, compareDate) {
var currentTime = compareDate ? (0, _timezones.convertTime)((0, _moment2.default)(compareDate)) : (0, _timezones.getCurrentTimeInTimezone)(timezone);
var currentTime = compareDate ? (0, _timezones.convertTime)((0, _moment["default"])(compareDate)) : (0, _timezones.getCurrentTimeInTimezone)(timezone); // Blocks for today?
// Blocks for today?
var todayBlocks = workHours[currentTime.day];

@@ -37,3 +35,2 @@ if (!todayBlocks || !todayBlocks.length) return false;

}
/**

@@ -43,6 +40,7 @@ * @param {String} hour - A single start or end time string plucked from work_hours object

*/
function translateWorkHour(hour) {
var spl = hour.split(':');
if (spl.length !== 3) throw new Error('Badly formatted work hour block!');
hour = parseFloat(spl[0]);

@@ -52,3 +50,2 @@ var minute = parseFloat(spl[1]) / 60;

}
/**

@@ -58,4 +55,7 @@ * @param {String} block - A single START-END time string plucked from work_hours object

*/
function translateWorkHourBlock(block) {
var spl = block.replace(/\s/g, '').split('-');
if (spl.length !== 2) {

@@ -69,5 +69,2 @@ throw new Error('Badly formatted work hour range! (expected 2 elements)');

};
}
exports.inWorkHours = inWorkHours;
exports.translateWorkHourBlock = translateWorkHourBlock;
}

@@ -640,4 +640,4 @@ import nock from 'nock';

describe('uploadFile', () => {
it('should upload to correct URL, but blob on server is BS');
/**
// need to fix error: Blob is not defined
it.skip('should upload to correct URL, but blob on server is BS', (done) => {
const client = new Dispatch(testClientID, testClientSecret);

@@ -651,7 +651,7 @@ nock('https://files-api.dispatch.me').post('/v1/datafiles').reply(201, {

client.setBearerToken(testBearerToken);
client.uploadFile('data:image/jpeg;base64,/9j/4AAQSkZJRgABAAEAYABgAADACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKAP/2Q==', 'photo.jpg').then(response => {
return client.uploadFile('data:image/jpeg;base64,/9j/4AAQSkZJRgABAAEAYABgAADACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKAP/2Q==', 'photo.jpg').then(response => {
console.log(response);
done();
}).catch(done);
* */
});
});

@@ -658,0 +658,0 @@

@@ -1,2 +0,2 @@

import { ATTACHMENTS } from '../endpoints';
import { ATTACHMENTS, BILLING_DOCUMENTS } from '../endpoints';

@@ -15,5 +15,13 @@ export default function billingDocumentMethods(client) {

return client.doAuthenticatedRequest('POST', ATTACHMENTS, body, options).then(response => response.attachment);
return client
.doAuthenticatedRequest('POST', ATTACHMENTS, body, options)
.then(response => response.attachment);
},
approve: () => {
return client.doAuthenticatedRequest(
'POST',
`${BILLING_DOCUMENTS}/${id}/approve`
);
},
});
}

@@ -29,6 +29,20 @@ import expect from 'expect';

.reply(201);
client.entities.billingDocument(123).addPhoto('12345', 'test name', 'test description');
client.entities
.billingDocument(123)
.addPhoto('12345', 'test name', 'test description');
expect(scope.isDone()).toEqual(true);
});
});
describe('approve', () => {
it('should call endpoint with correct id', () => {
const client = new Dispatch(testClientID, testClientSecret);
client.setBearerToken(testBearerToken, testRefreshToken);
const scope = nock('https://api.dispatch.me')
.post(`${endpoints.BILLING_DOCUMENTS}/123/approve`)
.reply(200);
client.entities.billingDocument(123).approve();
expect(scope.isDone()).toEqual(true);
});
});
});

@@ -22,3 +22,5 @@ import expect from 'expect';

const scope = nock('https://api.dispatch.me')
.get(`${endpoints.ATTACHMENTS}?filter[file_token_null]=1&filter[entity_type]=Job&filter[entity_id]=123`)
.get(
`${endpoints.ATTACHMENTS}?filter[file_token_null]=1&filter[entity_type]=Job&filter[entity_id]=123`
)
.reply(200);

@@ -29,20 +31,28 @@ client.entities.job(123).getNotes();

it('should parse response correctly', (done) => {
it('should parse response correctly', done => {
const client = new Dispatch(testClientID, testClientSecret);
client.setBearerToken(testBearerToken, testRefreshToken);
const scope = nock('https://api.dispatch.me')
.get(`${endpoints.ATTACHMENTS}?filter[file_token_null]=1&filter[entity_type]=Job&filter[entity_id]=123`)
.get(
`${endpoints.ATTACHMENTS}?filter[file_token_null]=1&filter[entity_type]=Job&filter[entity_id]=123`
)
.reply(200, {
attachments: [{
id: 1,
file_token: null,
entity_type: 'Job',
entity_id: 123,
}],
attachments: [
{
id: 1,
file_token: null,
entity_type: 'Job',
entity_id: 123,
},
],
});
client.entities.job(123).getNotes().then((notes) => {
expect(notes.length).toEqual(1);
expect(scope.isDone()).toEqual(true);
done();
}).catch(done);
client.entities
.job(123)
.getNotes()
.then(notes => {
expect(notes.length).toEqual(1);
expect(scope.isDone()).toEqual(true);
done();
})
.catch(done);
});

@@ -73,3 +83,5 @@ });

const scope = nock('https://api.dispatch.me')
.get(`${endpoints.ATTACHMENTS}?filter[file_token_not_eq]=null&filter[entity_type]=Job&filter[entity_id]=123`)
.get(
`${endpoints.ATTACHMENTS}?filter[file_token_not_eq]=null&filter[entity_type]=Job&filter[entity_id]=123`
)
.reply(200);

@@ -80,20 +92,28 @@ client.entities.job(123).getPhotos();

it('should parse response correctly', (done) => {
it('should parse response correctly', done => {
const client = new Dispatch(testClientID, testClientSecret);
client.setBearerToken(testBearerToken, testRefreshToken);
const scope = nock('https://api.dispatch.me')
.get(`${endpoints.ATTACHMENTS}?filter[file_token_not_eq]=null&filter[entity_type]=Job&filter[entity_id]=123`)
.get(
`${endpoints.ATTACHMENTS}?filter[file_token_not_eq]=null&filter[entity_type]=Job&filter[entity_id]=123`
)
.reply(200, {
attachments: [{
id: 1,
file_token: 'asdf-1234',
entity_type: 'Job',
entity_id: 123,
}],
attachments: [
{
id: 1,
file_token: 'asdf-1234',
entity_type: 'Job',
entity_id: 123,
},
],
});
client.entities.job(123).getPhotos().then((notes) => {
expect(notes.length).toEqual(1);
expect(scope.isDone()).toEqual(true);
done();
}).catch(done);
client.entities
.job(123)
.getPhotos()
.then(notes => {
expect(notes.length).toEqual(1);
expect(scope.isDone()).toEqual(true);
done();
})
.catch(done);
});

@@ -107,3 +127,5 @@ });

const scope = nock('https://api.dispatch.me')
.get(`${endpoints.BILLING_DOCUMENTS}?filter[doc_type]=Estimate&filter[job_id]=123`)
.get(
`${endpoints.BILLING_DOCUMENTS}?filter[doc_type]=Estimate&filter[job_id]=123`
)
.reply(200);

@@ -148,6 +170,9 @@ client.entities.job(123).getEstimates();

client.entities.job(123).addEstimate().then(() => {
expect(jobRequest.isDone()).toEqual(true);
expect(estimateRequest.isDone()).toEqual(true);
});
return client.entities
.job(123)
.addEstimate()
.then(() => {
expect(jobRequest.isDone()).toEqual(true);
expect(estimateRequest.isDone()).toEqual(true);
});
});

@@ -161,3 +186,5 @@ });

const scope = nock('https://api.dispatch.me')
.get(`${endpoints.BILLING_DOCUMENTS}?filter[doc_type]=Invoice&filter[job_id]=123`)
.get(
`${endpoints.BILLING_DOCUMENTS}?filter[doc_type]=Invoice&filter[job_id]=123`
)
.reply(200);

@@ -202,6 +229,9 @@ client.entities.job(123).getInvoices();

client.entities.job(123).addInvoice().then(() => {
expect(jobRequest.isDone()).toEqual(true);
expect(estimateRequest.isDone()).toEqual(true);
});
return client.entities
.job(123)
.addInvoice()
.then(() => {
expect(jobRequest.isDone()).toEqual(true);
expect(estimateRequest.isDone()).toEqual(true);
});
});

@@ -232,3 +262,5 @@ });

const scope = nock('https://api.dispatch.me')
.get(`${endpoints.APPOINTMENTS}?filter[status_eq]=scheduled&filter[job_id_eq]=123`)
.get(
`${endpoints.APPOINTMENTS}?filter[status_eq]=scheduled&filter[job_id_eq]=123`
)
.reply(200);

@@ -249,3 +281,5 @@ client.entities.job(123).getAppointments({

const scope = nock('https://api.dispatch.me')
.get(`${endpoints.APPOINTMENTS}?filter[status_eq]=scheduled&filter[job_id_eq]=123&limit=1&sort=time+desc`)
.get(
`${endpoints.APPOINTMENTS}?filter[status_eq]=scheduled&filter[job_id_eq]=123&limit=1&sort=time+desc`
)
.reply(200);

@@ -270,3 +304,5 @@ client.entities.job(123).getScheduledAppointment();

.reply(201);
client.entities.job(123).addPhoto('12345', 'test name', 'test description');
client.entities
.job(123)
.addPhoto('12345', 'test name', 'test description');
expect(scope.isDone()).toEqual(true);

@@ -292,3 +328,5 @@ });

const scope = nock('https://api.dispatch.me')
.get(`${endpoints.SURVEY_RESPONSES}?filter[is_submitted_eq]=false&filter[job_id_eq]=123`)
.get(
`${endpoints.SURVEY_RESPONSES}?filter[is_submitted_eq]=false&filter[job_id_eq]=123`
)
.reply(200);

@@ -327,4 +365,6 @@

client.entities.job(123).update(invalidJobProperties)
.catch((reason) => {
return client.entities
.job(123)
.update(invalidJobProperties)
.catch(reason => {
expect(reason.name).toEqual('UnprocessableEntityError');

@@ -334,6 +374,7 @@ });

it('should append a transaction ID to the headers of an authenticated request', (done) => {
it('should append a transaction ID to the headers of an authenticated request', done => {
const transactionID = '12345';
const scope = nock(dispatchUrl)
.patch(`${endpoints.JOBS}/123`).times(1)
.patch(`${endpoints.JOBS}/123`)
.times(1)
.reply(function reply() {

@@ -356,27 +397,38 @@ expect(this.req.headers['x-transaction-id']).toEqual(transactionID);

describe('accepting', () => {
it('should post job to the work-order-governance-servive', () => {
it('should post job to the work-order-governance-servive', async () => {
const postJobRequest = nock('https://api.dispatch.me')
.post(`${endpoints.WORK_ORDER_GOVERNANCE_SERVICE}/123/accept`, {})
.reply(200, { status: 'unscheduled' });
.reply(200, { new_job_status: 'unscheduled' });
client.entities.job(123).accept().then((response) => {
expect(postJobRequest.isDone()).toEqual(true);
expect(response.status).toEqual('unscheduled');
});
return client.entities
.job(123)
.accept()
.then(response => {
expect(postJobRequest.isDone()).toEqual(true);
expect(response.status).toEqual('unscheduled');
});
});
it('should assemble appointment body if included in the request body', () => {
const body = {
it('should assemble appointment body if included in the request body', async () => {
const appointment = {
appointment_duration: 7200,
appointment_time: 'someiso',
appointment_duration: 7200,
};
const jobRequestWithAppointment = nock('https://api.dispatch.me')
.post(`${endpoints.WORK_ORDER_GOVERNANCE_SERVICE}/123/accept}`, body)
.reply(201, { id: 555, status: 'scheduled' });
.post(
`${endpoints.WORK_ORDER_GOVERNANCE_SERVICE}/123/accept`,
body =>
body.appointment.appointment_duration === 7200 &&
body.appointment.appointment_time === 'someiso'
)
.reply(201, { id: 555, new_job_status: 'scheduled' });
client.entities.job(123).accept(null, body).then((response) => {
expect(jobRequestWithAppointment.isDone()).toEqual(true);
expect(response.status).toEqual('scheduled');
});
return client.entities
.job(123)
.accept(null, appointment)
.then(response => {
expect(jobRequestWithAppointment.isDone()).toEqual(true);
expect(response.status).toEqual('scheduled');
});
});

@@ -386,11 +438,16 @@ });

describe('rejecting', () => {
it('should call work-order-governance-servive to reject job', () => {
it('should call work-order-governance-servive to reject job', async () => {
const rejectJobRequest = nock('https://api.dispatch.me')
.patch(`${endpoints.WORK_ORDER_GOVERNANCE_SERVICE}/123/prehect`, {})
.reply(200, { status: 'rejected' });
.post(`${endpoints.WORK_ORDER_GOVERNANCE_SERVICE}/123/reject`, {
status_message: 'uhh',
})
.reply(200, { new_job_status: 'rejected' });
client.entities.job(123).reject('uhh').then((response) => {
expect(rejectJobRequest.isDone()).toEqual(true);
expect(response.status).toEqual('scheduled');
});
return client.entities
.job(123)
.reject('uhh')
.then(response => {
expect(rejectJobRequest.isDone()).toEqual(true);
expect(response.status).toEqual('rejected');
});
});

@@ -397,0 +454,0 @@ });

@@ -0,1 +1,3 @@

import atob from 'atob';
/**

@@ -16,3 +18,6 @@ * convert base64/URLEncoded data component to raw binary data held

// separate out the mime component
const mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
const mimeString = dataURI
.split(',')[0]
.split(':')[1]
.split(';')[0];

@@ -19,0 +24,0 @@ // write the bytes of the string to a typed array

@@ -16,8 +16,10 @@ import expect from 'expect';

expect(headers['Content-Type']).toEqual('application/json');
expect(headers['Content-MD5']).toExist; // eslint-disable-line no-unused-expressions
expect(headers['Content-MD5']).toExist();
// Mon, 05 Oct 2015 21:18:36 GMT
expect(headers.Date).toMatch(/^[A-Za-z]{3}, \d\d [A-Za-z]{3} \d\d\d\d \d\d:\d\d:\d\d GMT$/);
expect(headers.Authorization).toExist; // eslint-disable-line no-unused-expressions
expect(headers.Date).toMatch(
/^[A-Za-z]{3}, \d\d [A-Za-z]{3} \d\d\d\d \d\d:\d\d:\d\d GMT$/
);
expect(headers.Authorization).toExist();
});
});

@@ -18,3 +18,2 @@ import includes from 'lodash/includes';

/**

@@ -37,3 +36,7 @@ * Low-level client for interacting with the API.

if (!includes(validAuthModes, authMode)) {
throw new Error(`Invalid auth mode \`${authMode}\`, expected one of ${validAuthModes.join(', ')}`);
throw new Error(
`Invalid auth mode \`${authMode}\`, expected one of ${validAuthModes.join(
', '
)}`
);
}

@@ -48,3 +51,5 @@

// and getting the bearer token later
console.warn('Warning: instantiated Dispatch client in "Bearer" auth mode without a bearer token');
console.warn(
'Warning: instantiated Dispatch client in "Bearer" auth mode without a bearer token'
);
}

@@ -56,3 +61,5 @@

if (!options.hmacCredentials) {
console.warn('Warning: instantiated Dispatch client in "HMAC" auth mode without HMAC credentials');
console.warn(
'Warning: instantiated Dispatch client in "HMAC" auth mode without HMAC credentials'
);
}

@@ -113,6 +120,11 @@

// The form data will add its own headers for this.
const headers = appendHeaders ? Object.assign({
'Content-Type': 'application/json',
Accept: 'application/json',
}, options.headers) : options.headers;
const headers = appendHeaders
? Object.assign(
{
'Content-Type': 'application/json',
Accept: 'application/json',
},
options.headers
)
: options.headers;

@@ -124,9 +136,12 @@ switch (this.authMode) {

case AUTH_MODE_HMAC:
Object.assign(headers, getAuthHeaders({
path: endpoint,
body,
userID: this.hmacCredentials.userID,
userType: this.hmacCredentials.userType,
secret: this.hmacCredentials.secret,
}));
Object.assign(
headers,
getAuthHeaders({
path: endpoint,
body,
userID: this.hmacCredentials.userID,
userType: this.hmacCredentials.userType,
secret: this.hmacCredentials.secret,
})
);
break;

@@ -153,34 +168,36 @@ default:

}
return fetch(url, params)
.then((response) => {
return fetch(url, params).then(response => {
// 204 returns no content. short circuit to prevent parse errors.
if (response.status === 204) {
return {};
}
if (response.status === 204) {
return {};
}
if (response.status >= 200 && response.status < 300) {
return response.json()
.then((json) => {
if (options.transform) return options.transform(json);
return json;
});
}
if (response.status >= 200 && response.status < 300) {
return response.json().then(json => {
if (options.transform) return options.transform(json);
return json;
});
}
// Emit a different error with different data based on the status code
switch (response.status) {
case 401:
return Promise.reject(new UnauthorizedError());
case 422:
// Emit a different error with different data based on the status code
switch (response.status) {
case 401:
return Promise.reject(new UnauthorizedError());
case 422:
// The API is pretty descriptive of the validation errors so we can process
// the response in the error constructor
return response.json().then(json => Promise.reject(new UnprocessableEntityError(json)));
case 404:
return Promise.reject(new NotFoundError());
case 403:
return Promise.reject(new ForbiddenError());
default:
return response.text().then(text => Promise.reject(new APIError(text, response.status)));
}
});
return response
.json()
.then(json => Promise.reject(new UnprocessableEntityError(json)));
case 404:
return Promise.reject(new NotFoundError());
case 403:
return Promise.reject(new ForbiddenError());
default:
return response
.text()
.then(text => Promise.reject(new APIError(text, response.status)));
}
});
}
}
{
"name": "dispatch-node-sdk",
"version": "3.13.0",
"version": "3.13.1-0",
"description": "High- and low-level libraries for interacting with the Dispatch API",

@@ -10,6 +10,6 @@ "main": "dist/lib/index.js",

"lint:fix": "npm run lint -- --fix || true",
"mocha": "mocha --require babel-core/register --recursive 'lib/**/*.tests.js'",
"mocha": "mocha --require @babel/register --recursive 'lib/**/*.tests.js'",
"prepublishOnly": "npm run test && npm run build",
"test": "npm run lint && npm run mocha",
"test:cover": "nyc mocha --require babel-core/register --recursive 'lib/**/*.tests.js'",
"test:cover": "nyc mocha --require @babel/register --recursive 'lib/**/*.tests.js'",
"test:watch": "npm run mocha -- --watch"

@@ -19,20 +19,45 @@ },

"license": "MIT",
"repository": {
"type": "git",
"url": "git@github.com:DispatchMe/dispatch-node-sdk.git"
},
"devDependencies": {
"babel-cli": "6.26.0",
"babel-core": "6.26.3",
"babel-eslint": "8.2.3",
"babel-loader": "7.1.4",
"babel-preset-env": "1.7.0",
"babel-preset-stage-0": "6.24.1",
"babel-register": "6.26.0",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/plugin-proposal-do-expressions": "^7.0.0",
"@babel/plugin-proposal-export-default-from": "^7.0.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-proposal-function-bind": "^7.0.0",
"@babel/plugin-proposal-function-sent": "^7.0.0",
"@babel/plugin-proposal-json-strings": "^7.0.0",
"@babel/plugin-proposal-logical-assignment-operators": "^7.0.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0",
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
"@babel/plugin-proposal-optional-chaining": "^7.0.0",
"@babel/plugin-proposal-pipeline-operator": "^7.0.0",
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-syntax-import-meta": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.6.2",
"@babel/preset-env": "^7.0.0",
"@babel/register": "^7.6.2",
"@dispatch/eslint-config": "^1.9.0",
"@dispatch/prettier-config": "^1.3.0",
"babel-eslint": "^10.0.0",
"babel-loader": "^8.0.0",
"crypto-js": "^3.1.9-1",
"eslint": "4.19.1",
"eslint-config-airbnb": "16.1.0",
"eslint-plugin-import": "2.11.0",
"eslint-plugin-jsx-a11y": "6.0.3",
"eslint-plugin-react": "7.7.0",
"eslint": "^6.5.1",
"eslint-config-prettier": "^6.4.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^22.19.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-react": "^7.14.3",
"expect": "1.20.2",
"form-data": "2.3.2",
"isomorphic-fetch": "2.2.1",
"lodash": "4.17.10",
"lodash": "^4.17.15",
"mocha": "5.1.1",

@@ -42,5 +67,7 @@ "moment": "2.22.1",

"nock": "9.2.5",
"nyc": "^11.7.3",
"nyc": "^14.1.1",
"prettier": "^1.18.2",
"timekeeper": "2.1.1",
"uuid": "3.2.1"
"uuid": "3.2.1",
"webpack": "^4.41.2"
},

@@ -51,7 +78,10 @@ "peerDependencies": {

"isomorphic-fetch": ">= 2.2.1",
"lodash": ">= 4.17.10",
"lodash": ">= 4.17.15",
"moment": ">= 2.22.1",
"moment-timezone": ">= 0.5.16",
"uuid": ">= 3.2.1"
},
"dependencies": {
"atob": "^2.1.2"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc