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ZpR,EAAKoR,GAElEhL,OAAOiL,OAAOlJ,EAAQ+I,EAAQlR,EAAKoR,GAAID,EAAI,IAAMC,IAC1DjJ,GAAQgJ,EAAI,IAAMC,GAAGlO,QAAQ,MAAO,KAAOlD,EAAKoR,EACvD,CAEA,OAAOjJ,CAAM,EAGf,QCNA,MAAMmJ,EAAe,IAAIzO,IAAAA,KAAc,CAAC,GAExC,OAAgB5D,EAAOiD,KAGrB,OAFAjD,EAAQA,GAASqS,EAETpP,EAAO1C,MACb,IAAK,uBACL,IAAK,mBACH,IAAK,MAAMgF,KAAOtC,EAAOzC,QAAQ8R,SAAU,CACzC,MAAMhL,EAAQrE,EAAOzC,QAAQ8R,SAAS/M,GAEtCvF,EAAQA,EAAMqH,IAAI9B,EAAK+B,EACzB,CAEA,OAAOtH,EACT,IAAK,yBAA0B,CAC7B,MAAMuS,EAAetP,EAAOzC,QAAQc,SAAS+P,SAASX,MAAM3P,GAAuB,aAAdA,EAAKR,OAAqBkC,WACzF+P,EAAoBC,EAAkBF,GAE5CG,IAAAA,SAAsB,CACpBC,SAAUJ,EAAaI,SACvBC,OAAQ,CACNC,UAAW,EACXC,QAASP,EAAaI,SAASG,QAC/BC,SAAUR,EAAaI,SAASI,WAIpC,IAAK,MAAMxN,KAAOiN,EAAmB,CACnC,MAAMlL,EAAQkL,EAAkBjN,GAEhCvF,EAAQA,EAAMqH,IAAI9B,EAAK+B,EACzB,CAEA,OAAOtH,CACT,CACA,QACE,OAAOA,EAEZ,C","sources":["webpack://booqable/./webpack/shared/lib/axios.js","webpack://booqable/./webpack/shared/lib/api.js","webpack://booqable/./webpack/shared/lib/orm/orm.js","webpack://booqable/./webpack/shared/lib/orm/associations/base.js","webpack://booqable/./webpack/shared/lib/orm/associations/belongs_to.js","webpack://booqable/./webpack/shared/lib/orm/associations/has_many.js","webpack://booqable/./webpack/shared/lib/orm/associations/has_one.js","webpack://booqable/./webpack/shared/lib/orm/model.js","webpack://booqable/./webpack/shared/lib/orm/strategies/fetchAll.js","webpack://booqable/./webpack/shared/lib/orm/strategies/fetch.js","webpack://booqable/./webpack/shared/lib/orm/strategies/create.js","webpack://booqable/./webpack/shared/lib/orm/strategies/update.js","webpack://booqable/./webpack/shared/lib/orm/strategies/updatePositions.js","webpack://booqable/./webpack/shared/lib/orm/strategies/delete.js","webpack://booqable/./webpack/shared/lib/orm/strategies/refresh.js","webpack://booqable/./webpack/shared/lib/orm/strategies/index.js","webpack://booqable/./webpack/shared/lib/orm/reduxModel.js","webpack://booqable/./webpack/shared/utils/flattenObjectKeys.js","webpack://booqable/./webpack/shared/redux/reducers/settings.js"],"sourcesContent":["import axios from 'axios'\nimport cuid from 'cuid'\nimport qs from 'qs'\n\nconst instance = axios.create()\n\nfunction serialize (params) {\n return qs.stringify(params, {\n arrayFormat: 'brackets',\n encodeValuesOnly: true\n })\n}\n\n// Format nested params correctly\ninstance.interceptors.request.use((config) => {\n config.paramsSerializer = { serialize }\n\n return config\n})\n\n// This header allows pusher/orm.js\n// to ignore events triggered by the current browser window\ninstance.interceptors.request.use((config) => {\n window.booqablePusherSessionId ||= cuid()\n config.headers.common['X-Booqable-Pusher-Session-Id'] = window.booqablePusherSessionId\n\n return config\n})\n\n// Inject the storefront token\ninstance.interceptors.request.use((config) => {\n if (window.fingerprint) {\n config.headers.common['X-Booqable-Storefront-Token'] = window.fingerprint\n }\n\n return config\n})\n\nexport default instance\n","import axios from 'shared/lib/axios'\n\n// API Utils.\nclass API {\n static prefix = '/api'\n\n static defaultVersion = 'boomerang'\n\n static _processResponseHeaders = (headers) => {\n const store = window.store || window.booqableStore\n const state = store.getState()\n\n const token = headers['Session-Expiry-Token'] || headers['session-expiry-token']\n const clientVersion = headers['Client-Version'] || headers['client-version']\n const readOnlyMode = (headers['X-Read-Only-Mode'] || headers['x-read-only-mode']) === 'true'\n\n if (state.session?.token !== token) {\n store.dispatch({ type: 'SET_TOKEN', payload: { token } })\n }\n\n if (state.session?.clientVersion !== clientVersion) {\n store.dispatch({ type: 'SET_CLIENT_VERSION', payload: { client_version: clientVersion } })\n }\n\n if (state.session?.readOnlyMode !== readOnlyMode) {\n store.dispatch({ type: 'SET_READ_ONLY_MODE', payload: { read_only_mode: readOnlyMode } })\n }\n\n return headers\n }\n\n static _request = (method, path, options = {}) => {\n let data, params\n if (method === 'get') {\n params = options\n } else {\n data = options\n }\n\n const url = API.path(path, options)\n\n delete options.apiVersion\n\n const promise = axios({\n method,\n url,\n data,\n params,\n format: 'json'\n }).catch((e) => {\n switch (e?.response?.status) {\n case 401:\n // No longer logged in, redirect to the login screen\n window.skipUnsavedChangesCheck = true\n window.location.reload()\n break\n case 503:\n (window.store || window.booqableStore).dispatch({\n type: 'SERVICE_UNAVAILABLE_ERROR',\n payload: { error: e.response.data }\n })\n throw e\n default:\n throw e\n }\n })\n\n promise.then((data) => {\n API._processResponseHeaders(data.headers)\n })\n\n return promise\n }\n\n // Execute GET request against the API.\n static get = (path, options = {}) => {\n return API._request('get', path, options)\n }\n\n // Execute POST request against the API.\n static post = (path, options = {}) => {\n return API._request('post', path, options)\n }\n\n // Execute PATCH request against the API.\n static patch = (path, options = {}) => {\n return API._request('patch', path, options)\n }\n\n // Execute PUT request against the API.\n static put = (path, options = {}) => {\n return API._request('put', path, options)\n }\n\n // Execute DELETE request against the API.\n static delete = (path, options = {}) => {\n return API._request('delete', path, options)\n }\n\n // Gets collection.\n static getCollection = (name, options = {}) => {\n return API.get(name, options)\n }\n\n // Gets resource.\n static getResource = (name, id, options = {}) => {\n if (id) {\n return API.get(`${name}/${id}`, options)\n } else {\n return API.get(`${name}`, options)\n }\n }\n\n // Creates resource.\n static createResource = (name, options = {}) => {\n const apiVersion = options.apiVersion ?? API.defaultVersion\n\n if (apiVersion === 3 || apiVersion === 'boomerang') {\n const { attributes, ...otherParams } = options\n const data = { type: name, attributes }\n const params = { ...otherParams, data }\n\n return API.post(name, params)\n } else {\n return API.post(name, options)\n }\n }\n\n // Updates resource.\n static updateResource = (name, id, options = {}) => {\n const apiVersion = options.apiVersion ?? API.defaultVersion\n if (apiVersion === 3 || apiVersion === 'boomerang') {\n const { attributes, ...otherParams } = options\n const data = { type: name, id, attributes }\n const params = { ...otherParams, data }\n\n return API.patch(`${name}/${id}`, params)\n } else {\n return API.put(`${name}/${id}`, options)\n }\n }\n\n // Deletes resource.\n static deleteResource = (name, id, options = {}) => {\n return API.delete(`${name}/${id}`, options)\n }\n\n // Append path to api prefix and version.\n static path = (append, options = {}) => {\n const apiVersion = options.apiVersion ?? API.defaultVersion\n const path = `${API.prefix}/${apiVersion}`\n\n if (append && append.length > 0) {\n return `${path}/${append}`\n } else {\n return path\n }\n }\n}\n\nexport default API\n","import { combineReducers } from 'redux'\nimport { tableize } from 'inflected'\nimport Immutable from 'immutable'\nimport { forEach } from 'lodash'\n\nimport { EventTracker } from 'back_office/v2/utils/utils'\n\nclass ORM {\n static models = {}\n\n static __modelCache = {}\n\n static reducer (state = {}, action, globalState) {\n const reducers = {}\n\n forEach(this.models, (model, name) => {\n reducers[tableize(name)] = model.getReducer()\n })\n\n reducers.pendingRequests = (requests = Immutable.List(), action) => {\n let index, type\n\n EventTracker.trackDispatch(globalState, action)\n\n if (action.type.endsWith('_START')) {\n type = action.type.replace('_START', '')\n requests = requests.push(type)\n }\n\n if (action.type.endsWith('_ERROR')) {\n type = action.type.replace('_ERROR', '')\n index = requests.indexOf(type)\n requests = requests.delete(index)\n }\n\n if (action.type.endsWith('_SUCCESS')) {\n type = action.type.replace('_SUCCESS', '')\n index = requests.indexOf(type)\n requests = requests.delete(index)\n }\n\n return requests\n }\n\n return combineReducers(reducers)(state, action)\n }\n}\n\n// For debugging purposes, expose the ORM instance on the window.\n// Uncomment the line below to enable this.\n// window.ORM = ORM\n\nexport default ORM\n","import { classify, camelize, singularize } from 'inflected'\n\nexport default class Base {\n constructor (model, name, options = {}) {\n this.model = model\n this.name = name\n\n this.primaryKey = options.primaryKey || 'id'\n this.namespace = options.namespace || window\n this.modelName = options.model || classify(singularize(name))\n\n this.__register()\n this.__bind()\n }\n\n getAssociation (model, name) {\n return model.prototype._associations[name]\n }\n\n associatedModel () {\n return this.namespace[this.modelName]\n }\n\n __register () {\n this.model.prototype._associations ||= {}\n this.model.prototype._associations[this.name] = this\n }\n\n __bind () {\n const association = this\n\n this.model.prototype[`get${camelize(this.name)}`] = function () {\n return association.getResult(this)\n }\n }\n}\n","import Base from './base'\n\nexport default class BelongsTo extends Base {\n constructor (model, name, options = {}) {\n super(model, name, options)\n\n this.key = options.key || `${this.name}_${this.primaryKey}`\n }\n\n getResult (record) {\n return this.associatedModel().collection.getById(record.get(this.key))\n }\n}\n","import { memoize } from 'lodash'\n\nimport Base from './base'\n\nexport default class HasMany extends Base {\n constructor (model, name, options = {}) {\n super(model, name, options)\n\n this.foreignKey = options.foreignKey\n this.through = options.through ?? null\n }\n\n // Gets records from collection matching matchAttributes.\n // Memoizes the function.\n //\n getRecords (record, collection, matchAttributes) {\n // Function to retrieve records\n const selector = (_record, collection, matchAttributes) => collection.getAll(matchAttributes)\n\n // Memoize using a custom resolver for resolving the cache key\n this.recordsSelector ||= memoize(selector, (record, collection) => {\n return [record.id, record.hashCode(), collection.hashCode()].join('-')\n })\n\n return this.recordsSelector(record, collection, matchAttributes)\n }\n\n getResult (record) {\n const attributes = {}\n\n if (this.through) {\n const throughAssociation = this.getAssociation(this.model, this.through)\n const sourceAssociation = this.getAssociation(throughAssociation.associatedModel(), this.name)\n const sourceModel = sourceAssociation.associatedModel()\n\n // Fetch ids from association to go through\n const ids = throughAssociation.getResult(record).map((o) => o.id).toArray()\n attributes[sourceAssociation.foreignKey] = ids\n\n return this.getRecords(record, sourceModel.collection(), attributes)\n } else {\n attributes[this.foreignKey] = record.id\n\n return this.getRecords(record, this.associatedModel().collection(), attributes)\n }\n }\n}\n","import HasMany from './has_many'\n\nexport default class HasOne extends HasMany {\n getResult (record) {\n return super.getResult(record).first()\n }\n}\n","import { merge, isEqual, forOwn } from 'lodash'\nimport Immutable from 'immutable'\nimport invariant from 'invariant'\n\n// Model\nimport Collection from './collection'\nimport { HasMany, HasOne, BelongsTo } from './associations'\n\nconst setProps = (prototype, names) => {\n try {\n names.forEach((name) => setProp(prototype, name))\n } catch {\n // Handle error\n }\n}\n\nconst setProp = (prototype, name) => {\n Object.defineProperty(prototype, name, {\n get () {\n return this.get(name)\n },\n set (value) {\n invariant(this.__ownerID, 'Cannot set on an immutable record')\n this.set(name, value)\n }\n })\n}\n\nexport default class Model extends Immutable.Record({}) {\n constructor (values) {\n super()\n\n values ||= {}\n\n const defaultValues = merge({}, this.constructor.prototype._defaultValues)\n\n // Add keys of value as default values, but as undefined\n // This fixes @hashCode() always being the same\n forOwn(values, (_value, key) => {\n defaultValues[key] = undefined\n })\n\n const keys = Object.keys(defaultValues)\n\n setProps(this.constructor.prototype, keys)\n\n this.constructor.prototype.size = keys.length\n this.constructor.prototype._name = name\n this.constructor.prototype._keys = keys\n this.constructor.prototype._defaultValues = defaultValues\n\n // Make any key in the values accessible as a property\n setProps(this, Object.keys(values))\n\n this._map = Immutable.Map(values)\n }\n\n static defaultValues (defaults = {}) {\n this.prototype._defaultValues ||= {}\n\n forOwn(defaults, (value, key) => {\n this.prototype._defaultValues[key] = value\n })\n\n return this.prototype._defaultValues\n }\n\n static collection () {\n return this._collection || new Collection(this)\n }\n\n static hasMany (name, options = {}) {\n return new HasMany(this, name, options)\n }\n\n static hasOne (name, options = {}) {\n return new HasOne(this, name, options)\n }\n\n static belongsTo (name, options = {}) {\n return new BelongsTo(this, name, options)\n }\n\n has () {\n return true\n }\n\n toJSON () {\n return this._map.toJS()\n }\n\n toJS () {\n return this._map.toJS()\n }\n\n hydrate (data) {\n // Reject outdated data. This prevents the record from being updated\n // with old data when there is a race condition between requests.\n if (new Date(data.updated_at) < new Date(this.updated_at)) return this\n\n // Update each value that is different from the oldValue.\n //\n // We do this attribute-by-attribute instead of with one global isEqual(),\n // so that we can preserve object-identity of attributes which are objects,\n // like `order.status_counts` or `line.price_rule_values`.\n //\n const result = this.withMutations((object) => {\n forOwn(data, (newValue, attr) => {\n const oldValue = this.get(attr)\n if (!isEqual(newValue, oldValue)) {\n object.set(attr, newValue)\n }\n })\n })\n\n setProps(result, Object.keys(result.toJS()))\n\n return result\n }\n}\n","import API from 'shared/lib/api'\n\nexport default {\n\n // Fetches resources from the API.\n //\n // @example\n // SomeModel.actions.fetchAll({ page: 2 });\n //\n actionMethod: (model, options = {}) => {\n options.apiVersion = options.apiVersion ?? model.options.apiVersion\n\n if (!options.stats) {\n options.stats = { total: 'count' }\n } else {\n options.stats.total = 'count'\n }\n\n return API.getCollection(model.pluralName, options)\n },\n\n // Updates flags on collection.\n //\n reduceMethod: (model, collection, action) => {\n switch (action.type) {\n case model.actionTypes.FETCH_ALL_START:\n return collection.set('isLoadingCollection', true)\n\n case model.actionTypes.FETCH_ALL_ERROR:\n return collection.set('isLoadingCollection', false)\n\n case model.actionTypes.FETCH_ALL_SUCCESS:\n return collection.set('isLoadingCollection', false)\n }\n }\n}\n","import API from 'shared/lib/api'\n\nexport default {\n\n // Fetches resource from the API.\n //\n // @example\n // SomeModel.actions.fetch({ id: 1 })\n //\n actionMethod: (model, options = {}) => {\n const { id, ...optionsWithoutId } = options\n optionsWithoutId.apiVersion = optionsWithoutId.apiVersion ?? model.options.apiVersion\n\n return API.getResource(model.pluralName, id, optionsWithoutId)\n },\n\n // Updates flags on collection.\n //\n reduceMethod: (model, collection, action) => {\n switch (action.type) {\n case model.actionTypes.FETCH_START:\n return collection.set('isLoadingResource', true)\n\n case model.actionTypes.FETCH_ERROR:\n return collection.set('isLoadingResource', false)\n\n case model.actionTypes.FETCH_SUCCESS:\n return collection.set('isLoadingResource', false)\n }\n }\n}\n","import { merge, extend } from 'lodash'\n\nimport API from 'shared/lib/api'\n\nexport default {\n\n // Create resource on the API.\n //\n // @example\n // SomeModel.actions.create({ id: Date.now(), attributes: { name: 'some name' } })\n //\n actionMethod: (model, options = {}) => {\n options = merge({}, options)\n options[model.singularName] = options.attributes\n options.apiVersion = options.apiVersion ?? model.options.apiVersion\n\n return API.createResource(model.pluralName, options)\n },\n\n // Updates record (optimistically) in the collection.\n //\n reduceMethod: (model, collection, action) => {\n const options = action?.payload?.options || {}\n const id = options.id\n\n switch (action.type) {\n case model.actionTypes.CREATE_START:\n if (options.id) {\n // Set create flags\n const attributes = { id: options.id, isBusy: true, pendingCreate: true }\n\n // Create temporary record with attributes\n if (options.attributes) {\n extend(attributes, options.attributes)\n }\n\n // Add it\n collection = collection.add(options.id, attributes, { temporary: true })\n }\n\n return collection\n\n case model.actionTypes.CREATE_ERROR:\n if (options.id) {\n const attributes = { isBusy: false, pendingCreate: true, hasError: true, errorData: action?.payload?.error }\n\n // Set error flag\n collection = collection.update(options.id, attributes)\n }\n\n return collection\n\n case model.actionTypes.CREATE_SUCCESS:\n if (options.id) {\n // Store tempID on record\n if (action?.payload?.records) {\n const recordID = Object.keys(action.payload.records)[0]\n collection = collection.update(recordID, { tempID: id })\n }\n\n // Delete temporary object\n collection = collection.delete(options.id)\n }\n\n return collection\n }\n }\n}\n","import API from 'shared/lib/api'\n\nimport { extend, merge } from 'lodash'\n\nexport default {\n // Update resource on the API.\n //\n // @example\n // SomeModel.actions.update({id: 1, attributes: { name: 'some name' }, optimistic: true})\n //\n actionMethod (model, options = {}) {\n options = merge({}, options)\n options[model.singularName] = options.attributes\n options.apiVersion = options.apiVersion ?? model.options.apiVersion\n\n return API.updateResource(model.pluralName, options.id, options)\n },\n\n // Updates record (optimistically) in the collection.\n //\n reduceMethod (model, collection, action) {\n const options = action?.payload?.options || {}\n const id = options.id\n\n switch (action.type) {\n case 'ORM_RESET_RECORD': {\n // Resets record state by resetting the async state values\n const record = action?.payload?.record\n\n if (record && model === record.constructor) {\n collection = collection.update(record.id, model._asyncDefaultValues)\n }\n\n return collection\n }\n\n case model.actionTypes.UPDATE_START:\n if (id) {\n // Set update flags\n const attributes = { isBusy: true, pendingUpdate: true }\n\n // Optimistic update record with new attributes\n if (options.optimistic && options.attributes) {\n extend(attributes, options.attributes)\n }\n\n collection = collection.update(id, attributes)\n }\n\n return collection\n\n case model.actionTypes.UPDATE_ERROR:\n if (id) {\n // Set error flag\n collection = collection.update(id, {\n isBusy: false,\n pendingUpdate: true,\n hasError: true,\n errorData: action?.payload?.error\n })\n\n if (options.optimistic) {\n // TODO: Optimistic update failed\n console.log('Record was updated optimistically but the action failed, what to do now?')\n }\n }\n\n return collection\n\n case model.actionTypes.UPDATE_SUCCESS:\n if (id) {\n // Remove update flags\n collection = collection.update(options.id, { isBusy: false, pendingUpdate: false })\n }\n\n return collection\n }\n }\n}\n","import get from 'lodash/get'\nimport API from 'shared/lib/api'\n\nexport default {\n\n // Create resource on the API.\n //\n // @example\n // SomeModel.actions.updatePositions({ ids: [1,2,3,4,5] })\n //\n // @example\n // SomeModel.actions.updatePositions({ id: 1, ids: [1,2,3,4,5] })\n //\n actionMethod: (model, options = {}) => {\n options.apiVersion = options.apiVersion || model.options.apiVersion\n\n if (options.apiVersion === 3) {\n const data = options.ids.map((id) => {\n return {\n type: model.pluralName,\n id\n }\n })\n\n return API.patch(`${model.pluralName}/positions`, {\n apiVersion: 3,\n data\n })\n } else {\n return API.post(`${model.pluralName}/update_positions`, options)\n }\n },\n\n // When a user reorders a list of models using drag-and-drop,\n // we optimistically update the positions of the models in the\n // client-side ORM, under the assumption that the API will succeed.\n //\n // When the API would fail, the client-side data is incorrect.\n // But ordering is a relatively low-risk feature, so we can\n // live with the risk of having it fail in rare situations.\n //\n // This optimism is mainly needed to support reordering of lines\n // of very big orders, where the user conceivably could drag\n // lines faster than the API can keep up.\n //\n reduceMethod: (model, collection, action) => {\n const options = get(action, 'payload.options', {})\n\n switch (action.type) {\n // v1/2/3 [Model].update_positions\n case model.actionTypes.UPDATE_POSITIONS_START: {\n const ids = get(options, 'ids', [])\n const newPositions = ids.map((id, index) => ({ id, position: index + 1 }))\n\n return collection.hydrate(newPositions)\n }\n // v4 SortingActions.create\n case 'SORTINGS_CREATE_START': {\n const modelName = get(options, 'attributes.type')\n if (modelName !== model.pluralName) {\n return null\n }\n\n const ids = get(options, 'attributes.ids', [])\n\n // Build a new array of objects with the new positions.\n // We make sure to only update the models that have changed,\n // to avoid unnecessary re-renders of other instances.\n const newPositions = []\n\n // Products have sorting_weight as sorting attribute\n if (modelName === 'products') {\n ids.forEach((id, index) => {\n const model = collection.getById(id)\n if (model.sorting_weight !== index + 1) {\n newPositions.push({ id, sorting_weight: index + 1 })\n }\n })\n } else {\n // ...all other models have position as sorting attribute\n ids.forEach((id, index) => {\n const model = collection.getById(id)\n if (model.position !== index + 1) {\n newPositions.push({ id, position: index + 1 })\n }\n })\n }\n\n return collection.hydrate(newPositions)\n }\n }\n }\n}\n","import API from 'shared/lib/api'\n\nexport default {\n\n // Delete resource from the API.\n //\n // @example\n // SomeModel.actions.delete(id: 1, optimistic: true)\n //\n actionMethod: (model, options = {}) => {\n options.apiVersion = options.apiVersion ?? model.options.apiVersion\n\n return API.deleteResource(model.pluralName, options.id, options)\n },\n\n // Updates record (optimistically) in the collection.\n //\n reduceMethod: (model, collection, action) => {\n const options = action?.payload?.options || {}\n const id = options.id\n\n switch (action?.type) {\n case model.actionTypes.DELETE_START:\n if (id) {\n // Set delete flags\n collection = collection.update(id, { isBusy: true, pendingDelete: true })\n\n // Optimistic delete record from collection\n if (options.optimistic) {\n collection = collection.delete(id)\n }\n }\n\n return collection\n\n case model.actionTypes.UPDATE_ERROR:\n if (id) {\n // Set error flag\n collection = collection.update(id, {\n isBusy: false,\n pendingDelete: true,\n hasError: true,\n errorData: action?.payload?.error\n })\n\n if (options.optimistic) {\n // TODO: Optimistic delete failed\n console.log('Record was deleted optimistically but the action failed, what to do now?')\n }\n }\n\n return collection\n\n case model.actionTypes.DELETE_SUCCESS:\n // Because of pusher, it is possible to have two DELETE_SUCCESS events, but only one DELETE_START\n // To ensure idempotency we must double check that is present in the collection, before attempting\n // to update its `pendingDelete` state\n if (id && collection.getById(id)) {\n // Remove delete flags\n collection = collection.update(id, { isBusy: false, pendingDelete: false })\n }\n\n // Delete record\n return collection.delete(id)\n }\n }\n}\n","import API from 'shared/lib/api'\n\nexport default {\n\n // Fetches resources from the API.\n // On success it removes previous values from the collection and sets the new ones.\n // Logic for this is in `reduxModel.js` `getReducer()` function.\n //\n // @example\n // SomeModel.actions.refresh({ page: 2 });\n //\n actionMethod: (model, options = {}) => {\n options.apiVersion = options.apiVersion ?? model.options.apiVersion\n\n if (!options.stats) {\n options.stats = { total: 'count' }\n } else {\n options.stats.total = 'count'\n }\n\n return API.getCollection(model.pluralName, options)\n },\n\n // Updates flags on collection.\n //\n reduceMethod: (model, collection, action) => {\n switch (action.type) {\n case model.actionTypes.FETCH_ALL_START:\n return collection.set('isLoadingCollection', true)\n\n case model.actionTypes.FETCH_ALL_ERROR:\n return collection.set('isLoadingCollection', false)\n\n case model.actionTypes.FETCH_ALL_SUCCESS:\n return collection.set('isLoadingCollection', false)\n }\n }\n}\n","import fetchAllStategy from './fetchAll'\nimport fetchStategy from './fetch'\nimport createStategy from './create'\nimport updateStategy from './update'\nimport updatePositionsStategy from './updatePositions'\nimport deleteStategy from './delete'\nimport refreshStrategy from './refresh'\n\nexport {\n fetchAllStategy as fetchAll,\n fetchStategy as fetch,\n createStategy as create,\n updateStategy as update,\n updatePositionsStategy as updatePositions,\n deleteStategy as delete,\n refreshStrategy as refresh\n}\n\nexport default {\n fetchAll: fetchAllStategy,\n fetch: fetchStategy,\n create: createStategy,\n update: updateStategy,\n updatePositions: updatePositionsStategy,\n delete: deleteStategy,\n refresh: refreshStrategy\n}\n","import { isEmpty, trim, merge, find, forEach } from 'lodash'\nimport { normalize, arrayOf, Schema } from 'normalizr'\nimport { camelize, singularize, tableize, underscore } from 'inflected'\n\nimport API from 'shared/lib/api'\nimport ORM from './orm'\nimport Model from './model'\nimport strategies from './strategies'\n\nexport default (modelName, options = {}) => {\n if (options.apiVersion === API.defaultVersion) {\n throw 'Only specify apiVersion when different from the default.'\n }\n\n const singularName = options.singularName || underscore(modelName)\n const pluralName = options.pluralName || tableize(modelName)\n const standardStates = ['START', 'SUCCESS', 'ERROR']\n\n options.normalizeSingularKey ||= singularName\n\n class ReduxModel extends Model {\n // Returns the Redux store.\n //\n static store () {\n return window.store || window.booqableStore\n }\n\n // Returns actions wrapped in a dispatch function for use with bindActionCreators.\n //\n // @example\n // bindActionCreators(SomeModel.actionsForBind(), dispatch)\n //\n static actionsForBind () {\n if (this.boundActions) return this.boundActions\n\n this.boundActions ||= {}\n\n forEach(this.actions, (func, name) => {\n this.boundActions[name] = (...args) => (dispatch) => func(...args, dispatch)\n })\n\n return this.boundActions\n }\n\n // Hydrates model with given data (if any). This dispatches an event.\n //\n static hydrate (data, options = {}) {\n const hasData = !isEmpty(trim(data))\n\n if (hasData) {\n const normalizedResponse = this._normalizeResponse({ data })\n const payload = {\n response: data,\n normalizedResponse,\n options,\n records: normalizedResponse.entities[pluralName]\n }\n\n return ReduxModel.store().dispatch({ type: this.actionTypes.FETCH_ALL_SUCCESS, payload })\n }\n }\n\n // Create a strategy containing the action and how the collection will be reduced.\n //\n // @example\n // actionMethod = (model, options) ->\n // API.updateResource model.pluralName, options.id, someModel: options.attributes\n //\n // reducerMethod = (model, collection, action) ->\n // switch action.type\n // when model.actionTypes.UPDATE_START\n // collection = collection.update(options.id, attributes)\n //\n // SomeModel.createStrategy 'update', actionMethod, reducerMethod\n //\n static createStrategy (name, actionMethod, reducerMethod) {\n this.strategies ||= {}\n\n if (typeof actionMethod === 'object') {\n const _options = actionMethod\n actionMethod = _options.action\n reducerMethod = _options.reducer\n }\n\n const type = underscore(name).toUpperCase()\n\n if (actionMethod) {\n this.createAction(type, (...args) => actionMethod(this, ...args))\n }\n\n if (reducerMethod) {\n this.createReducer(reducerMethod)\n } else {\n this.createReducer((model, collection, action) => {\n const _options = action?.payload?.options || {}\n\n if (_options.id && collection.getById(_options.id)) {\n const flagName = (flag) => camelize(`${flag}_${name}`, false)\n\n switch (action.type) {\n case model.actionTypes[`${type}_START`]: {\n const data = {\n isBusy: true,\n [flagName('pending')]: true,\n [flagName('succss')]: false\n }\n\n // Set pending flag\n collection.update(_options.id, data)\n break\n }\n case model.actionTypes[`${type}_ERROR`]: {\n const data = {\n isBusy: false,\n hasError: true,\n errorData: action?.payload?.error,\n [flagName('pending')]: false,\n [flagName('success')]: false,\n [flagName('error')]: true,\n [flagName('errorData')]: action?.payload?.error\n }\n\n // Set error flag\n collection.update(_options.id, data)\n break\n }\n case model.actionTypes[`${type}_SUCCESS`]: {\n const data = {\n isBusy: false,\n hasError: false,\n errorData: undefined,\n [flagName('pending')]: false,\n [flagName('success')]: true,\n [flagName('error')]: false,\n [flagName('errorData')]: undefined\n }\n\n // Remove pending flag\n collection.update(_options.id, data)\n break\n }\n }\n }\n })\n }\n }\n\n // Create a mini-reducer that will be used for reducing the collection.\n //\n // @example\n // SomeModel.createReducer (method) ->\n // // Do something with collection here\n //\n static createReducer (method) {\n this.reducers ||= []\n this.reducers.push(method)\n }\n\n // Creates an action, automatically handles START/SUCCESS/ERROR.\n //\n static createAction (type, func) {\n this.actions ||= {}\n\n this._createActionTypes(type)\n this._createActionCreators(type, 'records')\n\n const methodName = camelize(underscore(type), false)\n this.actions[methodName] = (options, dispatch) => {\n dispatch ||= ReduxModel.store().dispatch\n // Dispatch start\n dispatch(this.actionCreators[`${methodName}Start`]({ options }))\n\n return new Promise((resolve, reject) => {\n const onResolve = (response) => {\n let payload\n const hasData = !isEmpty(trim(response.data))\n\n if (hasData) {\n const normalizedResponse = this._normalizeResponse(response, options)\n payload = {\n response: response.data,\n normalizedResponse,\n options,\n records: normalizedResponse.entities[pluralName]\n }\n } else {\n payload = {\n response: response.data,\n options\n }\n }\n\n // Manually dispatch a delete action for associated models\n this._deleteNestedRelations(options?.attributes, dispatch)\n\n // Dispatch success\n resolve(dispatch(this.actionCreators[`${methodName}Success`](payload)))\n }\n\n const onReject = (error) => {\n const normalizedResponse = this._normalizeResponse(error.response, options)\n const payload = {\n error: error.response.data,\n normalizedResponse,\n options\n }\n\n // Dispatch error\n dispatch(this.actionCreators[`${methodName}Error`](payload))\n\n // Reject promise\n reject(error.response.data.errors || error.response.data.error)\n }\n\n return func(options).then(onResolve, onReject)\n })\n }\n }\n\n // Schema to normalize responses with.\n // If no schema is given it will create one from the associations.\n //\n static schema () {\n if (this._schema) return this._schema\n\n if (options.schema) {\n this._schema = options.schema\n } else {\n this._schema = new Schema(pluralName)\n\n forEach(options.belongsTo, (_options, _name) => {\n const name = underscore(_name)\n const model = ORM.models[name]\n if (model) this._schema.define({ [name]: model.schema() })\n })\n\n forEach(options.hasOne, (_options, _name) => {\n const name = underscore(_name)\n const model = ORM.models[name]\n if (model) this._schema.define({ [name]: model.schema() })\n })\n\n forEach(options.hasMany, (_options, _key) => {\n const _name = _options.modelName || _key\n const name = underscore(_name)\n const key = underscore(_key)\n\n const model = ORM.models[singularize(name)]\n if (model) this._schema.define({ [key]: arrayOf(model.schema()) })\n })\n }\n\n return this._schema\n }\n\n // Reducer for used in the Redux state.\n //\n static getReducer () {\n return (collection, action) => {\n collection ||= this.collection()\n\n if (action.type === 'ORM_INVALIDATE_CACHE') {\n const skip = action.payload?.skip || []\n\n if (skip.indexOf(pluralName) === -1) {\n collection = collection.invalidateCache({ name: pluralName })\n }\n }\n\n // This logic is specific for the refresh strategy.\n // It clears the cache of the ORM before setting the new data.\n if (action.type === this._actionType('refresh', 'success')) {\n collection = collection.clearCache()\n }\n\n const data = action?.payload?.normalizedResponse?.entities[pluralName]\n if (data) {\n // Data is already normalized\n collection = collection.hydrate(data)\n } else {\n const response = action?.payload?.response\n if (response) {\n // If no normalized data is found for `pluralName` then check if we can\n // normalize the response in case collection data is given.\n // This is a pretty aggressive approach to collect any type of collection data.\n let hasPluralData, hasSingularData\n\n if (response?.data) {\n // Response is a JSON API response\n hasPluralData = true\n } else {\n hasSingularData = response?.[singularName] && !isEmpty(trim(response?.[singularName]))\n hasPluralData = response?.[pluralName] && !isEmpty(trim(response?.[pluralName]))\n }\n\n if (hasPluralData || hasSingularData) {\n const normalizedResponse = this._normalizeResponse({ data: response }, action?.payload?.options)\n const data = normalizedResponse?.entities[pluralName]\n\n if (data) {\n collection = collection.hydrate(data)\n }\n }\n }\n }\n\n // Call mini-reducers for each registered reducer\n forEach(this.reducers, (reducer) => {\n const _collection = reducer(this, collection, action)\n if (_collection) {\n collection = _collection\n }\n })\n\n return collection\n }\n }\n\n static _actionType (type, status = 'SUCCESS') {\n return [pluralName, type, status].join('_').toUpperCase()\n }\n\n static _actionTypes (...types) {\n const actions = {}\n\n types.forEach((type) => {\n standardStates.map((status) => this._actionType(type, status)).forEach((type) => {\n const name = type.replace(`${pluralName}_`.toLocaleUpperCase(), '')\n actions[name] = type\n })\n })\n\n return actions\n }\n\n static _createActionTypes (...types) {\n this.actionTypes ||= {}\n\n forEach(this._actionTypes(...types), (value, key) => {\n this.actionTypes[key] = value\n })\n\n return this.actionTypes\n }\n\n static _createActionCreator (name, type, _args) {\n this.actionCreators ||= {}\n\n const funcName = camelize(underscore(name), false)\n\n this.actionCreators[funcName] = (payload = {}) => ({ type, payload })\n }\n\n static _normalizeResponse (response, options = {}) {\n const json = response?.data || {}\n\n if (json.data) {\n return this._normalizeJsonApiResponse(json, options)\n } else {\n return this._normalizeLegacyResponse(json)\n }\n }\n\n static _normalizeJsonApiResponse (json, options = {}) {\n const data = {}\n\n const findModelByKey = (key) => {\n key = key.toLowerCase()\n\n if (ORM.__modelCache[key]) return ORM.__modelCache[key]\n\n const result = find(ORM.models, (_model, _name) => {\n return [_model.pluralName, _model.singularName, _model.options.normalizeSingularKey].indexOf(key) >= 0\n })\n\n ORM.__modelCache[key] = result\n\n return result\n }\n\n const addRecord = (data, record, type, stateKey) => {\n const model = findModelByKey(type || record.type)\n\n if (!model) return\n\n type = stateKey || model.stateKey || model.pluralName\n\n data[type] ||= {}\n data[type][record.id] = merge({ id: record.id }, record.attributes)\n\n // Set ids of the relations just like normalizr\n forEach(record.relationships, (relationData, relation) => {\n let relatedIds\n\n if (Array.isArray(relationData.data)) {\n relatedIds = relationData.data.map((data) => data.id)\n } else if (relationData.data) {\n relatedIds = relationData.data.id\n }\n\n if (relatedIds) {\n data[type][record.id][relation] = relatedIds\n data[type][record.id][`${relation}_ids`] = relatedIds\n }\n })\n }\n\n if (Array.isArray(json.data)) {\n // Data for the collection itself\n forEach(json.data, (record) => {\n addRecord(data, record, null, options?.stateKey)\n })\n } else {\n // Data for a single record\n addRecord(data, json.data, null, options?.stateKey)\n\n if (json.data?.attributes?.type?.includes('::')) {\n addRecord(data, json.data, json.data.attributes.type.split('::')[0])\n }\n }\n\n if (json.included) {\n // Data for the associations\n forEach(json.included, (record) => {\n addRecord(data, record)\n })\n\n const includeNamePerId = {}\n\n forEach([json.data].flat(), (jsonData) => {\n // Find original include name so we can use that as the state key\n forEach(jsonData.relationships, (relationData, relation) => {\n let relatedIds\n\n relation = tableize(relation)\n\n if (Array.isArray(relationData.data)) {\n relatedIds = relationData.data.map((data) => data.id)\n } else if (relationData.data) {\n relatedIds = [relationData.data.id]\n }\n\n forEach(relatedIds, (id) => {\n includeNamePerId[id] = relation\n })\n })\n })\n\n // Data for the associations\n forEach(json.included, (record) => {\n const stateKey = includeNamePerId[record.id]\n addRecord(data, record, null, stateKey)\n })\n }\n\n return { entities: data }\n }\n\n static _normalizeLegacyResponse (json) {\n const schema = {}\n\n forEach(ORM.models, (_model, _name) => {\n if (_model && (json[_model.pluralName] || json[_model.options.normalizeSingularKey])) {\n // Response contains data for model, include it in the normalization\n schema[_model.pluralName] = arrayOf(_model.schema())\n schema[_model.options.normalizeSingularKey] = _model.schema()\n }\n })\n\n return normalize(json, schema)\n }\n\n static _createActionCreators (type) {\n this._createActionCreator(`${type}_START`, this.actionTypes[`${type}_START`])\n this._createActionCreator(`${type}_SUCCESS`, this.actionTypes[`${type}_SUCCESS`])\n this._createActionCreator(`${type}_ERROR`, this.actionTypes[`${type}_ERROR`])\n }\n\n static _deleteNestedRelations (attributes, dispatch) {\n if (!options.hasMany) return\n\n const relations = []\n\n forEach(options.hasMany, (_, attribute) => {\n relations.push(attribute)\n })\n\n const toBeDeleted = []\n\n if (attributes) {\n forEach(relations, (relation) => {\n if (attributes[`${relation}_attributes`]) {\n forEach(attributes[`${relation}_attributes`], (attribute) => {\n if (attribute._destroy) {\n toBeDeleted.push({ model: relation.toUpperCase(), id: attribute.id })\n }\n })\n }\n })\n }\n\n forEach(toBeDeleted, (item) => {\n dispatch({\n type: `${item.model}_DELETE_START`,\n payload: {\n options: {\n id: item.id,\n optimistic: true\n }\n }\n })\n })\n }\n }\n\n forEach(strategies, (obj, name) => {\n ReduxModel.createStrategy(name, obj.actionMethod, obj.reduceMethod)\n })\n\n forEach(options.belongsTo, (_options, _name) => {\n ReduxModel.belongsTo(_name, _options)\n })\n\n forEach(options.hasMany, (_options, _name) => {\n ReduxModel.hasMany(_name, _options)\n })\n\n forEach(options.hasOne, (_options, _name) => {\n ReduxModel.hasOne(_name, _options)\n })\n\n ReduxModel.singularName = singularName\n ReduxModel.pluralName = pluralName\n ReduxModel.options = options\n\n ReduxModel._asyncDefaultValues = {\n isBusy: false,\n hasError: false,\n errorData: undefined,\n pendingUpdate: false,\n pendingCreate: false,\n pendingDelete: false\n }\n\n ReduxModel.defaultValues(ReduxModel._asyncDefaultValues)\n\n if (options.defaultValues) {\n ReduxModel.defaultValues(options.defaultValues)\n }\n\n ORM.models[singularName] = ReduxModel\n\n return ReduxModel\n}\n","const flatten = (data, c = '') => {\n const result = {}\n\n for (const i in data) {\n const isObject = typeof data[i] === 'object' && !Array.isArray(data[i]) && data[i] !== null\n\n if (isObject) Object.assign(result, flatten(data[i], c + '.' + i))\n else result[(c + '.' + i).replace(/^\\./, '')] = data[i]\n }\n\n return result\n}\n\nexport default flatten\n","// Libraries\nimport Immutable from 'immutable'\nimport accounting from 'accounting'\n\n// Shared\nimport flattenObjectKeys from 'shared/utils/flattenObjectKeys'\n\nconst initialState = new Immutable.Map({})\n\nexport default (state, action) => {\n state = state || initialState\n\n switch (action.type) {\n case 'SETTINGS_INITIALIZED':\n case 'SETTINGS_CHANGED':\n for (const key in action.payload.settings) {\n const value = action.payload.settings[key]\n\n state = state.set(key, value)\n }\n\n return state\n case 'SESSIONS_FETCH_SUCCESS': {\n const settingsData = action.payload.response.included.find((data) => data.type === 'settings').attributes\n const flattenedSettings = flattenObjectKeys(settingsData)\n\n accounting.settings = {\n currency: settingsData.currency,\n number: {\n precision: 0,\n decimal: settingsData.currency.decimal,\n thousand: settingsData.currency.thousand\n }\n }\n\n for (const key in flattenedSettings) {\n const value = flattenedSettings[key]\n\n state = state.set(key, value)\n }\n\n return state\n }\n default:\n return state\n }\n}\n"],"names":["instance","axios","serialize","params","qs","arrayFormat","encodeValuesOnly","interceptors","request","use","config","paramsSerializer","window","booqablePusherSessionId","cuid","headers","common","fingerprint","API","static","store","booqableStore","state","getState","token","clientVersion","readOnlyMode","session","dispatch","type","payload","client_version","read_only_mode","_request","method","path","options","data","url","apiVersion","promise","format","catch","e","response","status","skipUnsavedChangesCheck","location","reload","error","then","_processResponseHeaders","get","post","patch","put","delete","getCollection","name","getResource","id","createResource","defaultVersion","attributes","otherParams","updateResource","deleteResource","append","prefix","length","reducer","action","globalState","reducers","forEach","this","models","model","tableize","getReducer","pendingRequests","requests","Immutable","index","EventTracker","trackDispatch","endsWith","replace","push","indexOf","combineReducers","Base","constructor","primaryKey","namespace","modelName","classify","singularize","__register","__bind","getAssociation","prototype","_associations","associatedModel","association","camelize","getResult","BelongsTo","super","key","record","collection","getById","HasMany","foreignKey","through","getRecords","matchAttributes","recordsSelector","memoize","selector","_record","getAll","hashCode","join","throughAssociation","sourceAssociation","sourceModel","ids","map","o","toArray","HasOne","first","setProps","names","setProp","Object","defineProperty","set","value","invariant","__ownerID","Model","values","defaultValues","merge","_defaultValues","forOwn","_value","undefined","keys","size","_name","_keys","_map","defaults","_collection","Collection","hasMany","hasOne","belongsTo","has","toJSON","toJS","hydrate","Date","updated_at","result","withMutations","object","newValue","attr","oldValue","isEqual","actionMethod","stats","total","pluralName","reduceMethod","actionTypes","FETCH_ALL_START","FETCH_ALL_ERROR","FETCH_ALL_SUCCESS","optionsWithoutId","FETCH_START","FETCH_ERROR","FETCH_SUCCESS","singularName","CREATE_START","isBusy","pendingCreate","extend","add","temporary","CREATE_ERROR","hasError","errorData","update","CREATE_SUCCESS","records","recordID","tempID","_asyncDefaultValues","UPDATE_START","pendingUpdate","optimistic","UPDATE_ERROR","console","log","UPDATE_SUCCESS","UPDATE_POSITIONS_START","newPositions","position","sorting_weight","DELETE_START","pendingDelete","DELETE_SUCCESS","fetchAll","fetchAllStategy","fetch","fetchStategy","create","createStategy","updateStategy","updatePositions","updatePositionsStategy","deleteStategy","refresh","refreshStrategy","underscore","standardStates","normalizeSingularKey","ReduxModel","actionsForBind","boundActions","actions","func","args","isEmpty","trim","normalizedResponse","_normalizeResponse","entities","createStrategy","reducerMethod","strategies","_options","toUpperCase","createAction","createReducer","flagName","flag","_createActionTypes","_createActionCreators","methodName","actionCreators","Promise","resolve","reject","_deleteNestedRelations","errors","schema","_schema","Schema","ORM","define","_key","arrayOf","skip","invalidateCache","_actionType","clearCache","hasPluralData","hasSingularData","_actionTypes","types","toLocaleUpperCase","_createActionCreator","_args","funcName","json","_normalizeJsonApiResponse","_normalizeLegacyResponse","addRecord","stateKey","toLowerCase","__modelCache","find","_model","findModelByKey","relationships","relationData","relation","relatedIds","Array","isArray","includes","split","included","includeNamePerId","flat","jsonData","normalize","relations","_","attribute","toBeDeleted","_destroy","item","obj","flatten","c","i","assign","initialState","settings","settingsData","flattenedSettings","flattenObjectKeys","accounting","currency","number","precision","decimal","thousand"],"sourceRoot":""}