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ID,EAAI,IAAMC,IAC1DhJ,GAAQ+I,EAAI,IAAMC,GAAGjO,QAAQ,MAAO,KAAOhD,EAAKiR,EACvD,CAEA,OAAOhJ,CAAM,EAGf,QCNA,MAAMkJ,EAAe,IAAIxO,IAAAA,KAAc,CAAC,GAExC,OAAgB7D,EAAOkD,KAGrB,OAFAlD,EAAQA,GAASqS,EAETnP,EAAO3C,MACb,IAAK,uBACL,IAAK,mBACH,IAAK,MAAMiF,KAAOtC,EAAO1C,QAAQ8R,SAAU,CACzC,MAAM/K,EAAQrE,EAAO1C,QAAQ8R,SAAS9M,GAEtCxF,EAAQA,EAAMsH,IAAI9B,EAAK+B,EACzB,CAEA,OAAOvH,EACT,IAAK,yBAA0B,CAC7B,MAAMuS,EAAerP,EAAO1C,QAAQX,SAASwR,SAASX,MAAMxP,GAAuB,aAAdA,EAAKX,OAAqBmC,WACzF8P,EAAoBC,EAAkBF,GAE5CG,IAAAA,SAAsB,CACpBC,SAAUJ,EAAaI,SACvBC,OAAQ,CACNC,UAAW,EACXC,QAASP,EAAaI,SAASG,QAC/BC,SAAUR,EAAaI,SAASI,WAIpC,IAAK,MAAMvN,KAAOgN,EAAmB,CACnC,MAAMjL,EAAQiL,EAAkBhN,GAEhCxF,EAAQA,EAAMsH,IAAI9B,EAAK+B,EACzB,CAEA,OAAOvH,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'\nimport { captureException } from '@sentry/browser'\n\nconst instance = axios.create()\n\nconst serialize = (params) => {\n return qs.stringify(params, {\n arrayFormat: 'brackets',\n encodeValuesOnly: true\n })\n}\n\nconst handleSuccesfulResponse = (response) => {\n const headers = response.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 response\n}\n\nconst handleUnauthorizedResponse = () => {\n window.skipUnsavedChangesCheck = true\n window.location.reload()\n}\n\nconst handleServiceUnavailableResponse = (error) => {\n window.store?.dispatch({\n type: 'SERVICE_UNAVAILABLE_ERROR',\n payload: { error: error.response.data }\n })\n}\n\nconst handle500Errors = (error) => {\n captureException(error)\n}\n\nconst handleFailureResponse = (error) => {\n const status = error?.response?.status\n\n if (status === 401) handleUnauthorizedResponse()\n\n if (status >= 500) handle500Errors(error)\n\n if (status === 503) handleServiceUnavailableResponse(error)\n\n return Promise.reject(error)\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\ninstance.interceptors.response.use(\n handleSuccesfulResponse,\n handleFailureResponse\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 _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 return axios({\n method,\n url,\n data,\n params,\n format: 'json'\n })\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","response","store","booqableStore","state","getState","token","clientVersion","readOnlyMode","session","dispatch","type","payload","client_version","read_only_mode","error","status","skipUnsavedChangesCheck","location","reload","captureException","handle500Errors","data","handleServiceUnavailableResponse","Promise","reject","API","static","_request","method","path","options","url","apiVersion","format","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","resolve","then","_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":""}