@leaddreamer/inventorylogic 0.0.3-beta.79 → 0.0.3-beta.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -20
- package/business/Utilities/index.js +1 -0
- package/business/Utilities/other.js +1 -3
- package/business/Utilities/promise-queue/index.js +183 -150
- package/business/Utilities/promise-queue/new.js +231 -0
- package/dist/InventoryLogic.0ac93278.js +35 -0
- package/dist/InventoryLogic.0ac93278.js.map +1 -0
- package/dist/InventoryLogic.31f6d549.js +152 -0
- package/dist/InventoryLogic.31f6d549.js.map +1 -0
- package/dist/InventoryLogic.35827495.js +285 -0
- package/dist/InventoryLogic.35827495.js.map +1 -0
- package/dist/InventoryLogic.37dfff3e.js +72 -0
- package/dist/InventoryLogic.37dfff3e.js.map +1 -0
- package/dist/InventoryLogic.4206cb15.js +213 -0
- package/dist/InventoryLogic.4206cb15.js.map +1 -0
- package/dist/InventoryLogic.44193a77.js +35 -0
- package/dist/InventoryLogic.44193a77.js.map +1 -0
- package/dist/InventoryLogic.46ca6768.js +131 -0
- package/dist/InventoryLogic.46ca6768.js.map +1 -0
- package/dist/InventoryLogic.4d012935.js +151 -0
- package/dist/InventoryLogic.4d012935.js.map +1 -0
- package/dist/InventoryLogic.57f24f5f.js +155 -0
- package/dist/InventoryLogic.57f24f5f.js.map +1 -0
- package/dist/InventoryLogic.59be76a4.js +184 -0
- package/dist/InventoryLogic.59be76a4.js.map +1 -0
- package/dist/InventoryLogic.70925a32.js +375 -0
- package/dist/InventoryLogic.70925a32.js.map +1 -0
- package/dist/InventoryLogic.72fcf301.js +6 -0
- package/dist/InventoryLogic.72fcf301.js.map +1 -0
- package/dist/InventoryLogic.7741caec.js +375 -0
- package/dist/InventoryLogic.7741caec.js.map +1 -0
- package/dist/InventoryLogic.78480e5e.js +152 -0
- package/dist/InventoryLogic.78480e5e.js.map +1 -0
- package/dist/InventoryLogic.80d0e568.js +135 -0
- package/dist/InventoryLogic.80d0e568.js.map +1 -0
- package/dist/InventoryLogic.8a273d2e.js +110 -0
- package/dist/InventoryLogic.8a273d2e.js.map +1 -0
- package/dist/InventoryLogic.8addb055.js +202 -0
- package/dist/InventoryLogic.8addb055.js.map +1 -0
- package/dist/InventoryLogic.9dee46ea.js +6 -0
- package/dist/InventoryLogic.9dee46ea.js.map +1 -0
- package/dist/InventoryLogic.b90f66ea.js +124 -0
- package/dist/InventoryLogic.b90f66ea.js.map +1 -0
- package/dist/InventoryLogic.bb447b4c.js +39 -0
- package/dist/InventoryLogic.bb447b4c.js.map +1 -0
- package/dist/InventoryLogic.d27e84a7.js +75 -0
- package/dist/InventoryLogic.d27e84a7.js.map +1 -0
- package/dist/InventoryLogic.d69ad127.js +217 -0
- package/dist/InventoryLogic.d69ad127.js.map +1 -0
- package/dist/InventoryLogic.e03e6b07.js +245 -0
- package/dist/InventoryLogic.e03e6b07.js.map +1 -0
- package/dist/InventoryLogic.f276f76c.js +213 -0
- package/dist/InventoryLogic.f276f76c.js.map +1 -0
- package/dist/InventoryLogic.f4627c8a.js +160 -0
- package/dist/InventoryLogic.f4627c8a.js.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/index.js +1 -2
- package/package.json +8 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;AAAA;;;;CAIC;;;;;AAkBD,sEAAsE;AACtE,YAAY;AAEZ;;;;;;;;;;;;;;;CAeC,GAED;;;;;CAKC,GACD,MAAM,oCAAc;IAClB,IAAI;IACJ,SAAS;IACT,MAAM;IACN,OAAO;IACP,KAAK;IACL,aAAa;IACb,gBAAgB;IAChB,cAAc;AAChB;AAEA;;;;;CAKC,GACD,MAAM,iCAAW;IACf,IAAI,CAAC,WAAW,CAAC;IACjB,SAAS;IACT,MAAM,CAAC,eAAe,CAAC;IACvB,OAAO,CAAC,cAAc,CAAC;IACvB,KAAK,CAAC,YAAY,CAAC;IACnB,aAAa,CAAC,gBAAgB,CAAC;IAC/B,gBAAgB;IAChB,cAAc;AAChB;AAEA;;;;;CAKC,GACD,MAAM,wCAAkB;IACtB,MAAM;IACN,OAAO;IACP,KAAK;AACP;AAEA,CAAA,GAAA,YAAI,EAAE,IAAI,CAAC,GAAA,yCAAK,GAAG;AACnB,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,GAAA,yCAAK,GAAG;AACvB,CAAA,GAAA,YAAI,EAAE,WAAW,CAAC,GAAA,yCAAK,GAAG;AAC1B,CAAA,GAAA,YAAI,EAAE,IAAI,CAAC,GAAA,yCAAK,GAAG;AACnB,CAAA,GAAA,YAAI,EAAE,SAAS,CAAC,GAAA,yCAAK,GAAG;AACxB,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,GAAA,yCAAK,GAAG;AAQhB,eAAe,0CAAW,IAAI;IACnC,OAAO,CAAA,GAAA,mBAAW,EAAE,MAAM,CAAA,GAAA,wCAAG;AAC/B;AAOO,eAAe,0CAAe,IAAI;IACvC,IAAI,CAAC,MAAM,IAAI,OAAO,QAAQ,MAAM;IAEpC,OAAO,CAAA,GAAA,mBAAW,EAAE,MAAM,CAAA,GAAA,wCAAG;AAC/B;AAMO,MAAM,4CAAa,CAAC;IACzB,sEAAsE;IACtE,OAAO,CAAA,GAAA,kBAAU,EAAE,CAAA,GAAA,wCAAG,GAAG;AAC3B;AAYO,eAAe,0CAAiB,IAAI;IACzC,IAAI,UAAU,CAAA,GAAA,sBAAQ,EAAE,CAAA,GAAA,YAAI,EAAE,IAAI,CAAC,GAAA,0CAAM;IACzC,IAAI,KAAK,WAAW,EAClB,yBAAyB;IACzB,UAAU;QACR,GAAG,OAAO;QACV,IAAI,KAAK,GAAG;QACZ,aAAa;QACb,MAAM;IACR;SAEA,UAAU;QACR,GAAG,OAAO;QACV,IAAI,KAAK,GAAG;QACZ,aAAa;QACb,MAAM,MAAM;QACZ,OAAO,MAAM;QACb,KAAK,MAAM;IACb;IAEF,OAAO,0CAAW;AACpB;AAOO,eAAe,0CAAe,IAAI;IACvC,uCAAuC;IACvC,OAAO,CAAA,GAAA,gBAAQ,EAAE;QACf,GAAG,IAAI;QACP,SAAS,CAAC,CAAC,EAAE,CAAA,GAAA,wCAAG,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;IAChC;AACF;AAOO,eAAe,0CAAW,IAAI;IACnC,OAAO,CAAA,GAAA,gBAAQ,EAAE;QACf,GAAG,IAAI;QACP,SAAS,MAAM,WAAW,CAAC,CAAC,EAAE,GAAA,yCAAK,CAAC,EAAE,KAAK,EAAE,EAAE;IACjD;AACF;AAUO,eAAe,yCAAU,EAAE;IAChC,IAAI,SAAS;IACb,IAAI;QACF,MAAM,0CAAU;IAClB,EAAE,OAAO,KAAK;QACZ,SAAS;IACX;IACA,OAAO;AACT;AASO,eAAe;IACpB,OAAO,CAAA,GAAA,qBAAa,EAAE,CAAA,GAAA,wCAAG;AAC3B;AAoBO,eAAe,0CAAoB,QAAQ;IAChD,OAAO,IAAI,CAAA,GAAA,oBAAY,EACrB,CAAA,GAAA,wCAAG,GACH,MACA;QAAC;YAAE,UAAU;YAAc,QAAQ;QAAM;KAAE,EAC3C,MACA;AAEJ;AAOO,eAAe,0CAAwB,QAAQ;IACpD,OAAO,IAAI,CAAA,GAAA,oBAAY,EACrB,CAAA,GAAA,wCAAG,GACH;QAAC;YAAE,UAAU;YAAc,OAAO;YAAM,OAAO;QAAY;KAAE,EAC7D;QAAC;YAAE,UAAU,CAAA,GAAA,iBAAS;YAAG,QAAQ;QAAM;KAAE,EACzC,MACA;AAEJ;AAOO,eAAe,0CAAU,MAAM;IACpC,OAAO,CAAA,GAAA,kBAAU,EAAE,CAAA,GAAA,wCAAG,GAAG;AAC3B;AAOO,eAAe,yCAAc,MAAM;IACxC,MAAM,OAAO,MAAM,0CAAU;IAC7B,OAAO,0CAAc;AACvB;AAOO,eAAe,0CAAe,MAAM;IACzC,MAAM,OAAO,MAAM,0CAAU,0CAAW;IACxC,OAAO,KAAK,KAAK;AACnB;AAOO,eAAe,0CAAqB,MAAM;IAC/C,MAAM,UAAU,0CAAW;IAC3B,OAAO,aAAa;AACtB;AAOO,eAAe,0CAAiB,KAAK;IAC1C,IAAI,OAAO,MAAM,CAAA,GAAA,6BAAqB,EACpC,CAAA,GAAA,wCAAG,GACH;QAAC;YAAE,UAAU;YAAS,OAAO;YAAM,OAAO;QAAM;KAAE,EAClD,MACA;IAEF,sFAAsF;IACtF,oCAAoC;IACpC,OAAO;AACT;AASO,eAAe,0CAAc,cAAc;IAChD,IAAI,MAAM;IACV,MAAM,SAAS,eAAe,EAAE,GAAG,eAAe,EAAE,GAAG;IACvD,OAAO,MAAM,0CAAU;IAEvB,IAAI;QACF,UAAU,MAAM,aAAa;IAC/B,EAAE,OAAO,KAAK;QACZ,UAAU,MAAM,4CAA4C;IAC9D;IAEA,KAAK,OAAO,GAAG;IACf,OAAO;AACT;AASO,SAAS,0CAAc,IAAI;IAChC,OAAO,GAAG,MAAM,MAAM;AACxB;AAOO,eAAe,0CAAmB,KAAK;IAC5C,OAAO,CAAA,GAAA,0BAAkB,EAAE,OAAO,CAAA,GAAA,wCAAG;AACvC;AAOO,SAAS,0CAAW,MAAM;IAC/B,OAAO;QACL,IAAI;QACJ,SAAS,CAAC,CAAC,EAAE,GAAA,yCAAK,CAAC,EAAE,QAAQ;IAC/B;AACF;AAMO,SAAS,0CAAkB,KAAK;IACrC,OAAO,CAAA,GAAA,yCAAmB,EAAE,OAAO,CAAA,GAAA,wCAAG;AACxC","sources":["business/User/index.js"],"sourcesContent":["/**\n * Typedefs, constants, support functions and database operations related to individual\n * users\n * @module User\n */\nimport cloneDeep from \"lodash.clonedeep\";\nimport {\n documentId,\n writeRecord,\n writeBack,\n fetchRecord,\n collectRecords,\n collectRecordsByFilter,\n deleteRecord,\n PaginateFetch,\n typedFetchFromChild,\n} from \"@leaddreamer/firebase-wrapper\";\nimport { Forms } from \"@leaddreamer/staticforms\";\n\nimport { USER, USERS } from \"../boilerplate/index.js\";\nimport { typedRecordFromChild } from \"../Utilities/index.js\"\n\n//////////////////////////////////////////////////////////////////////\n// Constants\n\n/**\n * @typedef {object} UserObject\n * @property {?string} Id Id of document from storage\n * @property {?string} refPath if from database, full path to document\n * @property {!string} first_name could be \"Anonymous\"\n * @property {?string} last_name\n * @property {boolean} isAnonymous flag indicating auto-generated Anonymous user account\n * @property {url} image URL (possibly in app storage) of User image\n * @property {string} region User home region, from fixed list\n * @property {?url} [social_links] array of user social account links\n * @property {?string} bio user-maintained biography\n * @property {?url} website URL to user user website\n * @property {?string} payment_method summary string of user payment\n * method. Not secure, not source-of-truth\n * @property {?PaymentData} payment when \"full account\"\n */\n\n/**\n * @readonly\n * @constant\n * @type {UserObject}\n * @default\n */\nconst UserDefault = {\n Id: null,\n refPath: null,\n name: null,\n email: null,\n tel: null,\n isAnonymous: true,\n payment_method: null,\n admin_status: null,\n};\n\n/**\n * @readonly\n * @constant\n * @type {UserObject}\n * @default\n */\nconst UserData = {\n Id: `string.uuid`,\n refPath: null,\n name: `person.fullName`,\n email: `internet.email`,\n tel: `phone.number`,\n isAnonymous: `datatype.boolean`,\n payment_method: null,\n admin_status: null,\n};\n\n/**\n * @readonly\n * @constant\n * @type {UserObject}\n * @default\n */\nconst UserDefaultForm = {\n name: \"text\",\n email: \"email\",\n tel: \"tel\",\n};\n\nForms.Base[USER] = UserDefault;\nForms.BaseForm[USER] = UserDefaultForm;\nForms.AccountForm[USER] = UserDefaultForm;\nForms.Data[USER] = UserData;\nForms.Summarize[USER] = summarizeUser;\nForms.SearchBy[USER] = \"name\";\n\n//////////////////////////////////////////////////////////////////////\n// record operations\n/**\n * @param {UserObject} user\n * @returns {Promise<void>}\n */\nexport async function deleteUser(user) {\n return deleteRecord(user, USER);\n}\n\n/**\n * @param {UserObject} user minimal record of user account\n * @param {!string} user.Id record Id of account\n * @returns {Promise<void>}\n */\nexport async function deleteUserById(user) {\n if (!user?.Id) return Promise.reject;\n\n return deleteRecord(user, USER);\n}\n\n/**\n * @param {UserObject} user minimal record of user account\n * @returns {Promise.UserObject}\n */\nexport const createUser = (user) => {\n //need a \"no duplicate\" function - whatever that means in this context\n return writeRecord(USER, user);\n};\n\n/**\n * Builds a User record from the authentication \"user\" data\n * @param {User} user\n * @param {boolean} user.isAnonymous\n * @param {?string} user.displayName\n * @param {?string} user.photoURL\n * @param {?string} user.email\n * @param {?string} user.phoneNumber\n * @returns {Promise<void>}\n */\nexport async function buildUserRecords(user) {\n let newUser = cloneDeep(Forms.Base[USERS]);\n if (user.isAnonymous) {\n //signin anonymous worked\n newUser = {\n ...newUser,\n Id: user.uid,\n isAnonymous: true,\n name: \"Anonymous\",\n };\n } else {\n newUser = {\n ...newUser,\n Id: user.uid,\n isAnonymous: false,\n name: user?.displayName,\n email: user?.email,\n tel: user?.phoneNumber,\n };\n }\n return createUser(newUser);\n}\n\n/**\n * writes record back to database. Assumes only Id is valid\n * @param {UserObject} user a partially-populated user record for updates\n * @returns {promise.UserObject} a copy of the data written\n */\nexport async function updateUserByID(user) {\n // will update just the fields provided\n return writeBack({\n ...user,\n refPath: `/${USER}/${user.Id}`,\n });\n}\n\n/**\n * writes record back to database. Assumes only Id is valid\n * @param {UserObject} user a p[artially-populated user record for updates]\n * @returns {promise.UserObject} a copy of the data written\n */\nexport async function updateUser(user) {\n return writeBack({\n ...user,\n refPath: user?.refPath || `/${USER}/${user.Id}`,\n });\n}\n\n//////////////////////////////////////////////////////////////////////\n// fetches\n\n/**\n * Checks if this is a known UserObject Id\n * @param {!string} Id Id value to check\n * @returns {Promise.boolean} true is this Id is in database\n */\nexport async function knownUser(Id) {\n let exists = true;\n try {\n await fetchUser(Id);\n } catch (err) {\n exists = false;\n }\n return exists;\n}\n\n//////////////////////////////////////////////////////////////////////\n// fetches\n\n/**\n * Fetches ALL user records. Not very useful\n * @returns {Array.UserObject}\n */\nexport async function fetchUsers() {\n return collectRecords(USER);\n}\n\n/**\n * An object to allow for paginating a table read from Firestore. REQUIRES a sorting choice\n * @typedef {object} PaginatedFetch\n * @property {Query} Query that forms basis for the table read\n * @property {number} limit page size\n * @property {QuerySnapshot} snapshot last successful snapshot/page fetched\n * @property {enum} status status of pagination object\n * @property {method} PageForward pages the fetch forward\n * @property {method} PageBack pages the fetch backward\n\n */\n\n/**\n * Fetchs an object to fetch pages of user data, ascending by name, \"limit\" at a time\n * @param {number} limit\n * @returns {PaginatedFetch} object with pagination methods\n */\n\nexport async function fetchUsersPaginated(pageSize) {\n return new PaginateFetch(\n USER,\n null, //filter\n [{ fieldRef: \"first_name\", dirStr: \"asc\" }], //sort\n null, //ref\n pageSize,\n );\n}\n\n/**\n * Fetchs an object to fetch pages of anonymous user data, ascending by name, \"limit\" at a time\n * @param {number} limit\n * @returns {PaginatedFetch} object with pagination methods\n */\nexport async function fetchAnonymousPaginated(pageSize) {\n return new PaginateFetch(\n USER,\n [{ fieldRef: \"first_name\", opStr: \"==\", value: \"Anonymous\" }], //filter only anonymous users\n [{ fieldRef: documentId, dirStr: \"asc\" }], //sort by uid\n null, //ref\n pageSize,\n );\n}\n\n/**\n * Fetches a single UserObject record by Id\n * @param {!string} userId\n * @returns {Promise.UserObject}\n */\nexport async function fetchUser(userId) {\n return fetchRecord(USER, userId);\n}\n\n/**\n * Fetches and returns the summarized name from a UserObject record\n * @param {!string} userId\n * @returns {Promise.string} the summarized name from the record\n */\nexport async function fetchUserName(userId) {\n const user = await fetchUser(userId);\n return summarizeUser(user);\n}\n\n/**\n * Fetches and returns the email from a UserObject record\n * @param {!string} userId\n * @returns {Promise.string} the email from the record\n */\nexport async function fetchUserEmail(userId) {\n const user = await fetchUser(userFromId(userId));\n return user.email;\n}\n\n/**\n * Fetches the PaymentRecord for a user using just the ID\n * @param {!string} userId\n * @returns {Promise.PaymentData}\n */\nexport async function fetchUserPaymentById(userID) {\n const account = userFromId(userID);\n return fetchPayment(account);\n}\n\n/**\n * Fetch a User record by their email\n * @param {!string} email\n * @returns {Promise.UserObject}\n */\nexport async function fetchUserByEmail(email) {\n let them = await collectRecordsByFilter(\n USER,\n [{ fieldRef: \"email\", opStr: \"==\", value: email }], //filter only anonymous users\n null,\n null,\n );\n //Not at all efficient, but rarely called. If this ends up used for any bulk searches\n //de-normalize the database instead.\n return them;\n}\n\n/**\n * fetches a full user object (address, payment, private, etc) given EITHER\n * just the Id, OR a UserObject\n * @param {string|UserObject} userIdentifier\n * @param {?string} userIdentifier.Id\n * @returns {Promise.UserObject}\n */\nexport async function fetchFullUser(userIdentifier) {\n let user, payment;\n const userId = userIdentifier.Id ? userIdentifier.Id : userIdentifier;\n user = await fetchUser(userId);\n\n try {\n payment = await fetchPayment(user);\n } catch (err) {\n payment = null; //Just a flag - not really a failure as such\n }\n\n user.payment = payment;\n return user;\n}\n\n//////////////////////////////////////////////////////////////////////\n// utilities\n/**\n * Returns a standardized formatted name string\n * @param {UserObject}\n * @returns {string} formatted name string\n */\nexport function summarizeUser(user) {\n return `${user?.name}`;\n}\n\n/**\n * Fetches a UserObject from any child record in any branch\n * @param {RecordDocument} child\n * @returns {Promise.UserObject}\n */\nexport async function fetchUserFromChild(child) {\n return typedFetchFromChild(child, USER);\n}\n\n/**\n * builds a minimal UserObject from an Id\n * @param {!string} userId\n * @returns {UserObject}\n */\nexport function userFromId(userId) {\n return {\n Id: userId,\n refPath: `/${USER}/${userId}`,\n };\n}\n\n/**\n * @param {Record} child a record assumed to be a leaf/child\n * @returns {Record}\n */\nexport function makeUserFromChild(child) {\n return typedRecordFromChild(child, USER);\n}\n"],"names":[],"version":3,"file":"InventoryLogic.4206cb15.js.map"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {UNSUBSCRIBEKEYS as $fefa9c41cb73ae0b$export$7d0a9b0c57bf84fd, ADDRESSES as $fefa9c41cb73ae0b$export$6890d3564b1f252d, BUSINESS as $fefa9c41cb73ae0b$export$6f454e69bce3a691, BRANDS as $fefa9c41cb73ae0b$export$9547bc19be285f8c, MANAGEDBRANDS as $fefa9c41cb73ae0b$export$73f9b6e7973e6848, ORGANIZATIONS as $fefa9c41cb73ae0b$export$a338fcb90fb9aa37, MANAGEDORGANIZATIONS as $fefa9c41cb73ae0b$export$e72e4cc6cbc6ed26, PRIVATEDATA as $fefa9c41cb73ae0b$export$398ebe85ebcaa41f, BUSINESSDATA as $fefa9c41cb73ae0b$export$e651cf32bc3f78a4, LOGISTICS as $fefa9c41cb73ae0b$export$466d3e044dd15afb, COMMODITY as $fefa9c41cb73ae0b$export$eb747620ce9c5e16, COMMODITIES as $fefa9c41cb73ae0b$export$695940e05bf65de8, LINEITEM as $fefa9c41cb73ae0b$export$4843f9d856059ffd, LINEITEMS as $fefa9c41cb73ae0b$export$f079c6e3d7477fb7, LABORRATES as $fefa9c41cb73ae0b$export$32912c8ca0a712d8, MESSAGES as $fefa9c41cb73ae0b$export$af7faffe10421f14, PRODUCT as $fefa9c41cb73ae0b$export$e36553b0ff5db35a, PRODUCTS as $fefa9c41cb73ae0b$export$4f02bea739260915, PAYMENT as $fefa9c41cb73ae0b$export$eaa266db8852871e, PAYMENTS as $fefa9c41cb73ae0b$export$fadbf22af86be55a, CARDS as $fefa9c41cb73ae0b$export$5f768699f44cc740, TRANSFERS as $fefa9c41cb73ae0b$export$88e60f3c1cd6ae1f, FUNDAMENTALS as $fefa9c41cb73ae0b$export$1a96cd5ee36c0372, PAYOUTRATES as $fefa9c41cb73ae0b$export$e313271f328bdd7d, RATES as $fefa9c41cb73ae0b$export$6b29f6d6b64b8c84, MCC as $fefa9c41cb73ae0b$export$af5764009005aa8e, BUSINESS_TYPE as $fefa9c41cb73ae0b$export$1bd589465335bb9d, ACCESS as $fefa9c41cb73ae0b$export$5eb0c58c8af5c758, ACCESSTO as $fefa9c41cb73ae0b$export$d66f9cc3fc90ff67, STAGE as $fefa9c41cb73ae0b$export$f9865a0a7f208c15, STAGES as $fefa9c41cb73ae0b$export$47007d96f3617630, MATERIAL as $fefa9c41cb73ae0b$export$ca8f11448d1a1116, MATERIALS as $fefa9c41cb73ae0b$export$b7815f33793b967, RECEIPTS as $fefa9c41cb73ae0b$export$cfa5730cd5118215, UNITS as $fefa9c41cb73ae0b$export$a037d132965e1c9f, UNIT as $fefa9c41cb73ae0b$export$97361b7a0c542045, USER as $fefa9c41cb73ae0b$export$ff09b90989b21a8, USERS as $fefa9c41cb73ae0b$export$5a898dd3a28f57e9, MARKUPS as $fefa9c41cb73ae0b$export$1bfdae073fb20e6c, BASE as $fefa9c41cb73ae0b$export$9e15ff8aa6bc996f, HIGHVALUE as $fefa9c41cb73ae0b$export$d93f73eb990136ee, SERVICE as $fefa9c41cb73ae0b$export$3ccfc9db9b7bf43f, FABRICATION as $fefa9c41cb73ae0b$export$5d39addb0306dfd4, WHOLESALE as $fefa9c41cb73ae0b$export$75be49b93be74cb5, RETAIL as $fefa9c41cb73ae0b$export$4466b7859aa06ffd, PAYMENT_SUCCEEDED as $fefa9c41cb73ae0b$export$22e7de231b4ec209, CUSTOMER as $fefa9c41cb73ae0b$export$1d0cc9f143bfe9fc, CUSTOMERADDRESS as $fefa9c41cb73ae0b$export$f437a67b3be18bd2, fakerJSON as $fefa9c41cb73ae0b$export$fe909d0e7ec8aa88, COMPONENT_RANGE as $fefa9c41cb73ae0b$export$72581e25313abf48, COMPONENT_COUNT_RANGE as $fefa9c41cb73ae0b$export$d141374f02dd06d9, ISBN_LENGTH as $fefa9c41cb73ae0b$export$dbb3cd0a4caa6254} from "./InventoryLogic.d27e84a7.js";
|
|
2
|
+
import {AddressDefault as $5e875028eacae923$export$5b4eaa31e9936f4c, AddressForm as $5e875028eacae923$export$20ca2f03d61fd4de, AddressSelectForm as $5e875028eacae923$export$688a09815a2d76e, maplink as $5e875028eacae923$export$5003d738bf1e0422, deleteAddress as $5e875028eacae923$export$6f33ffc8bc2e0c30, deleteAddressByIdAndParent as $5e875028eacae923$export$2873378411ec704, formatAddress as $5e875028eacae923$export$9ab766ce7f4c1f3c, saveAddress as $5e875028eacae923$export$f4e55b204eefc919, fetchAddresses as $5e875028eacae923$export$c9b8cb1768a98d34} from "./InventoryLogic.37dfff3e.js";
|
|
3
|
+
import {fetchFullAccount as $852adca6ae24886c$export$aeea048b1874c987, fetchBusinessData as $852adca6ae24886c$export$a273004aea0035e0, accountPage as $852adca6ae24886c$export$f81f3e9fae10e6db, createBusinessData as $852adca6ae24886c$export$ca4306a1b5762f0e, saveBusinessData as $852adca6ae24886c$export$4bb3a8bbe6017432, deleteBusinessData as $852adca6ae24886c$export$b8447d25d283e6cc, businessDataPath as $852adca6ae24886c$export$8c755753b01b12f, profileComplete as $852adca6ae24886c$export$1e2f140c95101692, profileIncomplete as $852adca6ae24886c$export$f9e1390aa5941c3f, setOpenIssues as $852adca6ae24886c$export$89c9bbe01d357e36, clearOpenIssues as $852adca6ae24886c$export$45379be9a22c2a97} from "./InventoryLogic.57f24f5f.js";
|
|
4
|
+
import {updateCommodity as $21e76cc83a2e54db$export$1ec126d59f4db979, deleteCommodity as $21e76cc83a2e54db$export$9b6c8c0861c73078, deleteCommodityById as $21e76cc83a2e54db$export$51973e05c49d13bf, createCommodity as $21e76cc83a2e54db$export$8566c10d5b97fabb, updateCommodityByID as $21e76cc83a2e54db$export$8396fff7636b69e4, knownCommodity as $21e76cc83a2e54db$export$3171ba3c6caae841, fetchCommodity as $21e76cc83a2e54db$export$dad83ce325511ae2, fetchCommodities as $21e76cc83a2e54db$export$965ec48652f232c7, fetchCommoditiesPaginated as $21e76cc83a2e54db$export$7ad949526eb4312b, fetchCommodityName as $21e76cc83a2e54db$export$a621d0454ced7cc7} from "./InventoryLogic.46ca6768.js";
|
|
5
|
+
import {fetchFundamentals as $367d3ba5e1953c5d$export$f235c8eeea8b793b, fetchRates as $367d3ba5e1953c5d$export$1135a00cfd97f348, fetchPayoutRates as $367d3ba5e1953c5d$export$e545b306de1ff740, fetchMCCs as $367d3ba5e1953c5d$export$e12c451a9ec5cd7c, fetchBusinessTypes as $367d3ba5e1953c5d$export$b0ed4f3c6bb2aee1} from "./InventoryLogic.80d0e568.js";
|
|
6
|
+
import {deleteLineItem as $618035149cc2f269$export$42fb5c11b332038a, deleteLineItemById as $618035149cc2f269$export$9311bf4c650d8c56, createLineItem as $618035149cc2f269$export$9160586647000ce, knownLineItem as $618035149cc2f269$export$682c51c4d54f1588, fetchLineItem as $618035149cc2f269$export$7c918f386d58a9a2, fetchLineItems as $618035149cc2f269$export$93ad1b66295660db, fetchProductLineItems as $618035149cc2f269$export$d2c186a25126fe28, paginateProductLineItems as $618035149cc2f269$export$e6123a92ff8533fc, fetchLineItemName as $618035149cc2f269$export$218cbdd54a707ec7} from "./InventoryLogic.8addb055.js";
|
|
7
|
+
import {MaterialChoices as $082cf3de7799191e$export$ede25c0a3a34c1c7, StageChoices as $082cf3de7799191e$export$eeb76fa3f6b878ea} from "./InventoryLogic.4d012935.js";
|
|
8
|
+
import {logMessageEvent as $b08abff958f5c1f9$export$1d949c62ce6e9407, messageStatus as $b08abff958f5c1f9$export$fb609933e410a9ca, messageEvents as $b08abff958f5c1f9$export$404463f191aa95a1} from "./InventoryLogic.bb447b4c.js";
|
|
9
|
+
import {ERROR_TYPES as $f9cb07fd17b476cd$export$63d334e60537ba01, PaymentDefault as $f9cb07fd17b476cd$export$25824cbb4751202b, paymentDescriptor as $f9cb07fd17b476cd$export$1dc3fa0a524d39c3, receiptDefault as $f9cb07fd17b476cd$export$a5734ae35e42ad51, createPaymentRecord as $f9cb07fd17b476cd$export$e7759a8c3eb8b251, savePaymentData as $f9cb07fd17b476cd$export$f034950df5cadf57, fetchPayment as $f9cb07fd17b476cd$export$81ed014c52470b45, fetchPaymentByUser as $f9cb07fd17b476cd$export$bf9a06d1f6c31bf4, addPaymentDescriptor as $f9cb07fd17b476cd$export$e5cc111dc11d988, savePaymentDescriptor as $f9cb07fd17b476cd$export$218f64344bb0d5b1, removePaymentDescriptor as $f9cb07fd17b476cd$export$2edf51a087d55c34, fetchPDByFingerprint as $f9cb07fd17b476cd$export$719d384deb9d4a1d, fetchPaymentDescriptors as $f9cb07fd17b476cd$export$e67def8f84ea0ce8, listPDSummaries as $f9cb07fd17b476cd$export$afe4f672b985ac26, fetchLatestPDSummary as $f9cb07fd17b476cd$export$46296a85983d5325, fetchPDByOwnerType as $f9cb07fd17b476cd$export$c10d531939e9952c, replaceDefaultPDSummary as $f9cb07fd17b476cd$export$6495802cd4961871, saveReceiptRecord as $f9cb07fd17b476cd$export$4c730f12f97432c2, updateReceipt as $f9cb07fd17b476cd$export$9d597d6207d02073, saveReceiptRecordByOwnerType as $f9cb07fd17b476cd$export$16e7bde1d3e4806e, anyReceiptsByMonthStamp as $f9cb07fd17b476cd$export$be8e05196fbdd05c, fetchReceiptsFiltered as $f9cb07fd17b476cd$export$4eb0e1031e4cb663, saveReceiptRecordByChild as $f9cb07fd17b476cd$export$9612333da9eb2b55, fetchProblemReceipts as $f9cb07fd17b476cd$export$f9dd3c42a9fe0ec7, fetchPledgeTicketReceipt as $f9cb07fd17b476cd$export$912a34b09f6646f6, markReceiptFromPledgeTicket as $f9cb07fd17b476cd$export$cc5e46e81267707d, markReceipt as $f9cb07fd17b476cd$export$b31aae8a995874b9} from "./InventoryLogic.d69ad127.js";
|
|
10
|
+
import {fetchPrivateData as $61cd1791d5265689$export$c3bebe1b4bbebe25, createPrivateData as $61cd1791d5265689$export$9cc830020e353c38, savePrivateData as $61cd1791d5265689$export$fd09f53e2b56e2af, deletePrivateData as $61cd1791d5265689$export$4d99519ebd12d7e2, privateDataPath as $61cd1791d5265689$export$9319c406c799955a} from "./InventoryLogic.8a273d2e.js";
|
|
11
|
+
import {createProduct as $e615241e8e7f6b5a$export$9c734a715e6666d0, makeProductFromChild as $e615241e8e7f6b5a$export$d4a471daa895146b, GoogleAPIProductMap as $e409a6a48e9bf1c0$export$4059922dac929494, JSONProductFeedToItemMapping as $63eb266a363bf697$export$8f68ab01093b41d6, squarespaceFeedTest as $63eb266a363bf697$export$c736243f342fb27b} from "./InventoryLogic.7741caec.js";
|
|
12
|
+
import {summarizeUser as $aeb56590b68e5483$export$7822bd6f88cc1494, deleteUser as $aeb56590b68e5483$export$7d0f10f273c0438a, deleteUserById as $aeb56590b68e5483$export$1eb857e02349d4c8, createUser as $aeb56590b68e5483$export$3493b8991d49f558, buildUserRecords as $aeb56590b68e5483$export$2cccdc7105e5f652, updateUserByID as $aeb56590b68e5483$export$3c10411f5368919b, updateUser as $aeb56590b68e5483$export$e3ac7a5d19605772, knownUser as $aeb56590b68e5483$export$e1980ceaf83ba89, fetchUser as $aeb56590b68e5483$export$6cf10d295bf9320e, fetchUsers as $aeb56590b68e5483$export$2bb8333a9210be15, fetchUsersPaginated as $aeb56590b68e5483$export$db873fddb7c8685b, fetchAnonymousPaginated as $aeb56590b68e5483$export$8cc74b74b196db4a, fetchUserName as $aeb56590b68e5483$export$32d6fa31f0d8a28, fetchUserEmail as $aeb56590b68e5483$export$53755dbf7eaa9f86, userFromId as $aeb56590b68e5483$export$e1ca85ff667d230a, fetchUserPaymentById as $aeb56590b68e5483$export$85df9b940b8f75fd, fetchUserByEmail as $aeb56590b68e5483$export$747404941cf39e5f, fetchFullUser as $aeb56590b68e5483$export$3f848cf621800fba, fetchUserFromChild as $aeb56590b68e5483$export$127de379ac0a4e64, makeUserFromChild as $aeb56590b68e5483$export$a081e2667846200b} from "./InventoryLogic.4206cb15.js";
|
|
13
|
+
import * as $d403d40112d3687c$exports from "./InventoryLogic.78480e5e.js";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A collection of Business logic and database functions. Shared between ReactJS
|
|
17
|
+
* frontEnd and NodeJS BackEnd
|
|
18
|
+
* @module InventoryLogic
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export {$fefa9c41cb73ae0b$export$7d0a9b0c57bf84fd as UNSUBSCRIBEKEYS, $fefa9c41cb73ae0b$export$6890d3564b1f252d as ADDRESSES, $fefa9c41cb73ae0b$export$6f454e69bce3a691 as BUSINESS, $fefa9c41cb73ae0b$export$9547bc19be285f8c as BRANDS, $fefa9c41cb73ae0b$export$73f9b6e7973e6848 as MANAGEDBRANDS, $fefa9c41cb73ae0b$export$a338fcb90fb9aa37 as ORGANIZATIONS, $fefa9c41cb73ae0b$export$e72e4cc6cbc6ed26 as MANAGEDORGANIZATIONS, $fefa9c41cb73ae0b$export$398ebe85ebcaa41f as PRIVATEDATA, $fefa9c41cb73ae0b$export$e651cf32bc3f78a4 as BUSINESSDATA, $fefa9c41cb73ae0b$export$466d3e044dd15afb as LOGISTICS, $fefa9c41cb73ae0b$export$eb747620ce9c5e16 as COMMODITY, $fefa9c41cb73ae0b$export$695940e05bf65de8 as COMMODITIES, $fefa9c41cb73ae0b$export$4843f9d856059ffd as LINEITEM, $fefa9c41cb73ae0b$export$f079c6e3d7477fb7 as LINEITEMS, $fefa9c41cb73ae0b$export$32912c8ca0a712d8 as LABORRATES, $fefa9c41cb73ae0b$export$af7faffe10421f14 as MESSAGES, $fefa9c41cb73ae0b$export$e36553b0ff5db35a as PRODUCT, $fefa9c41cb73ae0b$export$4f02bea739260915 as PRODUCTS, $fefa9c41cb73ae0b$export$eaa266db8852871e as PAYMENT, $fefa9c41cb73ae0b$export$fadbf22af86be55a as PAYMENTS, $fefa9c41cb73ae0b$export$5f768699f44cc740 as CARDS, $fefa9c41cb73ae0b$export$88e60f3c1cd6ae1f as TRANSFERS, $fefa9c41cb73ae0b$export$1a96cd5ee36c0372 as FUNDAMENTALS, $fefa9c41cb73ae0b$export$e313271f328bdd7d as PAYOUTRATES, $fefa9c41cb73ae0b$export$6b29f6d6b64b8c84 as RATES, $fefa9c41cb73ae0b$export$af5764009005aa8e as MCC, $fefa9c41cb73ae0b$export$1bd589465335bb9d as BUSINESS_TYPE, $fefa9c41cb73ae0b$export$5eb0c58c8af5c758 as ACCESS, $fefa9c41cb73ae0b$export$d66f9cc3fc90ff67 as ACCESSTO, $fefa9c41cb73ae0b$export$f9865a0a7f208c15 as STAGE, $fefa9c41cb73ae0b$export$47007d96f3617630 as STAGES, $fefa9c41cb73ae0b$export$ca8f11448d1a1116 as MATERIAL, $fefa9c41cb73ae0b$export$b7815f33793b967 as MATERIALS, $fefa9c41cb73ae0b$export$cfa5730cd5118215 as RECEIPTS, $fefa9c41cb73ae0b$export$a037d132965e1c9f as UNITS, $fefa9c41cb73ae0b$export$97361b7a0c542045 as UNIT, $fefa9c41cb73ae0b$export$ff09b90989b21a8 as USER, $fefa9c41cb73ae0b$export$5a898dd3a28f57e9 as USERS, $fefa9c41cb73ae0b$export$1bfdae073fb20e6c as MARKUPS, $fefa9c41cb73ae0b$export$9e15ff8aa6bc996f as BASE, $fefa9c41cb73ae0b$export$d93f73eb990136ee as HIGHVALUE, $fefa9c41cb73ae0b$export$3ccfc9db9b7bf43f as SERVICE, $fefa9c41cb73ae0b$export$5d39addb0306dfd4 as FABRICATION, $fefa9c41cb73ae0b$export$75be49b93be74cb5 as WHOLESALE, $fefa9c41cb73ae0b$export$4466b7859aa06ffd as RETAIL, $fefa9c41cb73ae0b$export$22e7de231b4ec209 as PAYMENT_SUCCEEDED, $fefa9c41cb73ae0b$export$1d0cc9f143bfe9fc as CUSTOMER, $fefa9c41cb73ae0b$export$f437a67b3be18bd2 as CUSTOMERADDRESS, $fefa9c41cb73ae0b$export$fe909d0e7ec8aa88 as fakerJSON, $fefa9c41cb73ae0b$export$72581e25313abf48 as COMPONENT_RANGE, $fefa9c41cb73ae0b$export$d141374f02dd06d9 as COMPONENT_COUNT_RANGE, $fefa9c41cb73ae0b$export$dbb3cd0a4caa6254 as ISBN_LENGTH, $5e875028eacae923$export$5b4eaa31e9936f4c as AddressDefault, $5e875028eacae923$export$20ca2f03d61fd4de as AddressForm, $5e875028eacae923$export$688a09815a2d76e as AddressSelectForm, $5e875028eacae923$export$5003d738bf1e0422 as maplink, $5e875028eacae923$export$6f33ffc8bc2e0c30 as deleteAddress, $5e875028eacae923$export$2873378411ec704 as deleteAddressByIdAndParent, $5e875028eacae923$export$9ab766ce7f4c1f3c as formatAddress, $5e875028eacae923$export$f4e55b204eefc919 as saveAddress, $5e875028eacae923$export$c9b8cb1768a98d34 as fetchAddresses, $852adca6ae24886c$export$aeea048b1874c987 as fetchFullAccount, $852adca6ae24886c$export$a273004aea0035e0 as fetchBusinessData, $852adca6ae24886c$export$f81f3e9fae10e6db as accountPage, $852adca6ae24886c$export$ca4306a1b5762f0e as createBusinessData, $852adca6ae24886c$export$4bb3a8bbe6017432 as saveBusinessData, $852adca6ae24886c$export$b8447d25d283e6cc as deleteBusinessData, $852adca6ae24886c$export$8c755753b01b12f as businessDataPath, $852adca6ae24886c$export$1e2f140c95101692 as profileComplete, $852adca6ae24886c$export$f9e1390aa5941c3f as profileIncomplete, $852adca6ae24886c$export$89c9bbe01d357e36 as setOpenIssues, $852adca6ae24886c$export$45379be9a22c2a97 as clearOpenIssues, $21e76cc83a2e54db$export$1ec126d59f4db979 as updateCommodity, $21e76cc83a2e54db$export$9b6c8c0861c73078 as deleteCommodity, $21e76cc83a2e54db$export$51973e05c49d13bf as deleteCommodityById, $21e76cc83a2e54db$export$8566c10d5b97fabb as createCommodity, $21e76cc83a2e54db$export$8396fff7636b69e4 as updateCommodityByID, $21e76cc83a2e54db$export$3171ba3c6caae841 as knownCommodity, $21e76cc83a2e54db$export$dad83ce325511ae2 as fetchCommodity, $21e76cc83a2e54db$export$965ec48652f232c7 as fetchCommodities, $21e76cc83a2e54db$export$7ad949526eb4312b as fetchCommoditiesPaginated, $21e76cc83a2e54db$export$a621d0454ced7cc7 as fetchCommodityName, $367d3ba5e1953c5d$export$f235c8eeea8b793b as fetchFundamentals, $367d3ba5e1953c5d$export$1135a00cfd97f348 as fetchRates, $367d3ba5e1953c5d$export$e545b306de1ff740 as fetchPayoutRates, $367d3ba5e1953c5d$export$e12c451a9ec5cd7c as fetchMCCs, $367d3ba5e1953c5d$export$b0ed4f3c6bb2aee1 as fetchBusinessTypes, $618035149cc2f269$export$42fb5c11b332038a as deleteLineItem, $618035149cc2f269$export$9311bf4c650d8c56 as deleteLineItemById, $618035149cc2f269$export$9160586647000ce as createLineItem, $618035149cc2f269$export$682c51c4d54f1588 as knownLineItem, $618035149cc2f269$export$7c918f386d58a9a2 as fetchLineItem, $618035149cc2f269$export$93ad1b66295660db as fetchLineItems, $618035149cc2f269$export$d2c186a25126fe28 as fetchProductLineItems, $618035149cc2f269$export$e6123a92ff8533fc as paginateProductLineItems, $618035149cc2f269$export$218cbdd54a707ec7 as fetchLineItemName, $082cf3de7799191e$export$ede25c0a3a34c1c7 as MaterialChoices, $082cf3de7799191e$export$eeb76fa3f6b878ea as StageChoices, $b08abff958f5c1f9$export$1d949c62ce6e9407 as logMessageEvent, $b08abff958f5c1f9$export$fb609933e410a9ca as messageStatus, $b08abff958f5c1f9$export$404463f191aa95a1 as messageEvents, $f9cb07fd17b476cd$export$63d334e60537ba01 as ERROR_TYPES, $f9cb07fd17b476cd$export$25824cbb4751202b as PaymentDefault, $f9cb07fd17b476cd$export$1dc3fa0a524d39c3 as paymentDescriptor, $f9cb07fd17b476cd$export$a5734ae35e42ad51 as receiptDefault, $f9cb07fd17b476cd$export$e7759a8c3eb8b251 as createPaymentRecord, $f9cb07fd17b476cd$export$f034950df5cadf57 as savePaymentData, $f9cb07fd17b476cd$export$81ed014c52470b45 as fetchPayment, $f9cb07fd17b476cd$export$bf9a06d1f6c31bf4 as fetchPaymentByUser, $f9cb07fd17b476cd$export$e5cc111dc11d988 as addPaymentDescriptor, $f9cb07fd17b476cd$export$218f64344bb0d5b1 as savePaymentDescriptor, $f9cb07fd17b476cd$export$2edf51a087d55c34 as removePaymentDescriptor, $f9cb07fd17b476cd$export$719d384deb9d4a1d as fetchPDByFingerprint, $f9cb07fd17b476cd$export$e67def8f84ea0ce8 as fetchPaymentDescriptors, $f9cb07fd17b476cd$export$afe4f672b985ac26 as listPDSummaries, $f9cb07fd17b476cd$export$46296a85983d5325 as fetchLatestPDSummary, $f9cb07fd17b476cd$export$c10d531939e9952c as fetchPDByOwnerType, $f9cb07fd17b476cd$export$6495802cd4961871 as replaceDefaultPDSummary, $f9cb07fd17b476cd$export$4c730f12f97432c2 as saveReceiptRecord, $f9cb07fd17b476cd$export$9d597d6207d02073 as updateReceipt, $f9cb07fd17b476cd$export$16e7bde1d3e4806e as saveReceiptRecordByOwnerType, $f9cb07fd17b476cd$export$be8e05196fbdd05c as anyReceiptsByMonthStamp, $f9cb07fd17b476cd$export$4eb0e1031e4cb663 as fetchReceiptsFiltered, $f9cb07fd17b476cd$export$9612333da9eb2b55 as saveReceiptRecordByChild, $f9cb07fd17b476cd$export$f9dd3c42a9fe0ec7 as fetchProblemReceipts, $f9cb07fd17b476cd$export$912a34b09f6646f6 as fetchPledgeTicketReceipt, $f9cb07fd17b476cd$export$cc5e46e81267707d as markReceiptFromPledgeTicket, $f9cb07fd17b476cd$export$b31aae8a995874b9 as markReceipt, $61cd1791d5265689$export$c3bebe1b4bbebe25 as fetchPrivateData, $61cd1791d5265689$export$9cc830020e353c38 as createPrivateData, $61cd1791d5265689$export$fd09f53e2b56e2af as savePrivateData, $61cd1791d5265689$export$4d99519ebd12d7e2 as deletePrivateData, $61cd1791d5265689$export$9319c406c799955a as privateDataPath, $e615241e8e7f6b5a$export$9c734a715e6666d0 as createProduct, $e615241e8e7f6b5a$export$d4a471daa895146b as makeProductFromChild, $e409a6a48e9bf1c0$export$4059922dac929494 as GoogleAPIProductMap, $63eb266a363bf697$export$8f68ab01093b41d6 as JSONProductFeedToItemMapping, $63eb266a363bf697$export$c736243f342fb27b as squarespaceFeedTest, $aeb56590b68e5483$export$7822bd6f88cc1494 as summarizeUser, $aeb56590b68e5483$export$7d0f10f273c0438a as deleteUser, $aeb56590b68e5483$export$1eb857e02349d4c8 as deleteUserById, $aeb56590b68e5483$export$3493b8991d49f558 as createUser, $aeb56590b68e5483$export$2cccdc7105e5f652 as buildUserRecords, $aeb56590b68e5483$export$3c10411f5368919b as updateUserByID, $aeb56590b68e5483$export$e3ac7a5d19605772 as updateUser, $aeb56590b68e5483$export$e1980ceaf83ba89 as knownUser, $aeb56590b68e5483$export$6cf10d295bf9320e as fetchUser, $aeb56590b68e5483$export$2bb8333a9210be15 as fetchUsers, $aeb56590b68e5483$export$db873fddb7c8685b as fetchUsersPaginated, $aeb56590b68e5483$export$8cc74b74b196db4a as fetchAnonymousPaginated, $aeb56590b68e5483$export$32d6fa31f0d8a28 as fetchUserName, $aeb56590b68e5483$export$53755dbf7eaa9f86 as fetchUserEmail, $aeb56590b68e5483$export$e1ca85ff667d230a as userFromId, $aeb56590b68e5483$export$85df9b940b8f75fd as fetchUserPaymentById, $aeb56590b68e5483$export$747404941cf39e5f as fetchUserByEmail, $aeb56590b68e5483$export$3f848cf621800fba as fetchFullUser, $aeb56590b68e5483$export$127de379ac0a4e64 as fetchUserFromChild, $aeb56590b68e5483$export$a081e2667846200b as makeUserFromChild, $9ab66828811feaa2$export$c89b632375228111 as fetchLinkedItem, $9ab66828811feaa2$export$5a3279b4c9648f0f as fetchSubItem, $9ab66828811feaa2$export$d39fdbaf795265a7 as fetchType, $9ab66828811feaa2$export$abd398b6018f8436 as searchType, $9ab66828811feaa2$export$921842c360078a33 as recordByIdAndType, $9ab66828811feaa2$export$9536a88c96a1be48 as typedRecordFromChild, $9ab66828811feaa2$export$c093435923294c4e as typedSortArray, $9ab66828811feaa2$export$19e2e60a6b9b3b01 as processItemType, $9ab66828811feaa2$export$d2db84ed358b7054 as formatLinkedItem, $9ab66828811feaa2$export$da804150202b2b8d as summarizeItem, $9ab66828811feaa2$export$31dbe01f37b7732f as baseItem, $9ab66828811feaa2$export$3ee853080fb51bea as baseForm, $9ab66828811feaa2$export$5af4610fbe1137fd as dataForm, $9ab66828811feaa2$export$f681a8129d2e9d28 as createForm, $9ab66828811feaa2$export$c050911d30958522 as accountForm, $9ab66828811feaa2$export$55369601a4bc1cda as saveForm, $9ab66828811feaa2$export$24178ee8231de835 as updateChangeForm, $9ab66828811feaa2$export$b9a757ca31a5f892 as choicesForm, $9baf0c6b8de436d9$export$cc9d030424d53c6d as saveHost, $9baf0c6b8de436d9$export$f5d1cbac23428e02 as simpleObjectCompare, $9baf0c6b8de436d9$export$62f58f44692b37a8 as formatItem, $9baf0c6b8de436d9$export$398604a469f7de9a as compare, $9baf0c6b8de436d9$export$3145210430358e7 as anyInAny, $9baf0c6b8de436d9$export$15b0b9b385c1f78e as lesserOf, $9baf0c6b8de436d9$export$e375dfe918aae343 as largerOf, $9baf0c6b8de436d9$export$f7bac52274eacccb as archiveRecord, $9baf0c6b8de436d9$export$b6b6e72408f809e2 as refPathToBaseRecord, $9baf0c6b8de436d9$export$adf7c0fe6059d774 as bound, $9baf0c6b8de436d9$export$884089555def93f8 as blindPush, $9baf0c6b8de436d9$export$7fecbbe7deb1a058 as addToArrayObject, $9baf0c6b8de436d9$export$36538c15a30486a1 as makeHexAsNeeded, $d403d40112d3687c$exports as default};
|
|
35
|
+
//# sourceMappingURL=InventoryLogic.44193a77.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;AAAA;;;;CAIC","sources":["business/index.js"],"sourcesContent":["/**\n * A collection of Business logic and database functions. Shared between ReactJS\n * frontEnd and NodeJS BackEnd\n * @module InventoryLogic\n */\nexport * from \"./boilerplate/index.js\";\nexport * from \"./Addresses/index.js\";\nexport * from \"./BusinessData/index.js\";\nexport * from \"./Commodities/index.js\";\nexport * from \"./Fundamentals/index.js\";\nexport * from \"./LineItem/index.js\";\nexport * from \"./Markups/index.js\";\nexport * from \"./Messages/index.js\";\nexport * from \"./Payment/index.js\";\nexport * from \"./PrivateData/index.js\";\nexport * from \"./Product/index.js\";\nexport * from \"./User/index.js\";\nexport * from \"./Utilities/index.js\";\n"],"names":[],"version":3,"file":"InventoryLogic.44193a77.js.map"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import {COMMODITIES as $fefa9c41cb73ae0b$export$695940e05bf65de8, COMMODITY as $fefa9c41cb73ae0b$export$eb747620ce9c5e16, COMPONENT_RANGE as $fefa9c41cb73ae0b$export$72581e25313abf48, MATERIAL as $fefa9c41cb73ae0b$export$ca8f11448d1a1116, UNITS as $fefa9c41cb73ae0b$export$a037d132965e1c9f} from "./InventoryLogic.d27e84a7.js";
|
|
2
|
+
import {deleteRecord as $iBx1N$deleteRecord, writeRecord as $iBx1N$writeRecord, writeBack as $iBx1N$writeBack, updateRecord as $iBx1N$updateRecord, collectRecords as $iBx1N$collectRecords, PaginateFetch as $iBx1N$PaginateFetch, fetchRecord as $iBx1N$fetchRecord} from "@leaddreamer/firebase-wrapper";
|
|
3
|
+
import {Forms as $iBx1N$Forms, fillForm as $iBx1N$fillForm} from "@leaddreamer/staticforms";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Typedefs, constants, support functions and database operations related to Commodity Matrials
|
|
7
|
+
* users
|
|
8
|
+
* @module Commodities
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
//////////////////////////////////////////////////////////////////////
|
|
13
|
+
// Constants
|
|
14
|
+
/**
|
|
15
|
+
* a record
|
|
16
|
+
* @typedef {object} Commodity
|
|
17
|
+
* @property {?string} Id Id of document (redundant for convenience)
|
|
18
|
+
* @property {?string} refPath if from database, full path to document
|
|
19
|
+
* @property {!string} description description, e.g. "Wire, Silver, Sterling, 20ga"
|
|
20
|
+
* @property {!string} unit usage/measurement unit (for unit conversion)
|
|
21
|
+
* @property {!number} rate the per unit cost of this commodity
|
|
22
|
+
* @property {string} MATERIAL "base", "highValue" or other value tp be defined
|
|
23
|
+
* @property {?url} image a reference image for the commodity
|
|
24
|
+
*/ /**
|
|
25
|
+
* @readonly
|
|
26
|
+
* @constant
|
|
27
|
+
* @type {Commodity}
|
|
28
|
+
* @default
|
|
29
|
+
*/ const $21e76cc83a2e54db$var$CommodityDefault = {
|
|
30
|
+
Id: null,
|
|
31
|
+
refPath: null,
|
|
32
|
+
description: null,
|
|
33
|
+
unit: null,
|
|
34
|
+
rate: 0,
|
|
35
|
+
[(0, $fefa9c41cb73ae0b$export$ca8f11448d1a1116)]: null,
|
|
36
|
+
image: null
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* @readonly
|
|
40
|
+
* @constant
|
|
41
|
+
* @type {Commodity}
|
|
42
|
+
* @default
|
|
43
|
+
*/ const $21e76cc83a2e54db$var$CommodityData = {
|
|
44
|
+
Id: `string.uuid`,
|
|
45
|
+
refPath: null,
|
|
46
|
+
description: `commerce.productDescription`,
|
|
47
|
+
unit: `lookup:${(0, $fefa9c41cb73ae0b$export$a037d132965e1c9f)}`,
|
|
48
|
+
rate: `commerce.price:${(0, $fefa9c41cb73ae0b$export$72581e25313abf48)}`,
|
|
49
|
+
[(0, $fefa9c41cb73ae0b$export$ca8f11448d1a1116)]: `lookup:${(0, $fefa9c41cb73ae0b$export$ca8f11448d1a1116)}`,
|
|
50
|
+
image: null
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* @readonly
|
|
54
|
+
* @constant
|
|
55
|
+
* @type {Commodity}
|
|
56
|
+
* @default
|
|
57
|
+
*/ const $21e76cc83a2e54db$var$CommodityDefaultForm = {
|
|
58
|
+
description: "text",
|
|
59
|
+
unit: `lookup:${(0, $fefa9c41cb73ae0b$export$a037d132965e1c9f)}`,
|
|
60
|
+
rate: "number",
|
|
61
|
+
[(0, $fefa9c41cb73ae0b$export$ca8f11448d1a1116)]: `lookup:${(0, $fefa9c41cb73ae0b$export$ca8f11448d1a1116)}`,
|
|
62
|
+
image: "url"
|
|
63
|
+
};
|
|
64
|
+
(0, $iBx1N$Forms).Base[0, $fefa9c41cb73ae0b$export$695940e05bf65de8] = $21e76cc83a2e54db$var$CommodityDefault;
|
|
65
|
+
(0, $iBx1N$Forms).BaseForm[0, $fefa9c41cb73ae0b$export$695940e05bf65de8] = $21e76cc83a2e54db$var$CommodityDefaultForm;
|
|
66
|
+
(0, $iBx1N$Forms).CreateForm[0, $fefa9c41cb73ae0b$export$695940e05bf65de8] = $21e76cc83a2e54db$var$CommodityDefaultForm;
|
|
67
|
+
(0, $iBx1N$Forms).Data[0, $fefa9c41cb73ae0b$export$695940e05bf65de8] = $21e76cc83a2e54db$var$CommodityData;
|
|
68
|
+
(0, $iBx1N$Forms).Summarize[0, $fefa9c41cb73ae0b$export$695940e05bf65de8] = $21e76cc83a2e54db$var$summarizeCommodity;
|
|
69
|
+
(0, $iBx1N$Forms).Save[0, $fefa9c41cb73ae0b$export$695940e05bf65de8] = $21e76cc83a2e54db$export$1ec126d59f4db979;
|
|
70
|
+
(0, $iBx1N$Forms).SearchBy[0, $fefa9c41cb73ae0b$export$695940e05bf65de8] = "description";
|
|
71
|
+
async function $21e76cc83a2e54db$export$9b6c8c0861c73078(commodity, user = null) {
|
|
72
|
+
return (0, $iBx1N$deleteRecord)(commodity, (0, $fefa9c41cb73ae0b$export$eb747620ce9c5e16), user?.refPath);
|
|
73
|
+
}
|
|
74
|
+
async function $21e76cc83a2e54db$export$51973e05c49d13bf(commodity, user = null) {
|
|
75
|
+
if (!commodity?.Id) return;
|
|
76
|
+
return (0, $iBx1N$deleteRecord)(commodity, (0, $fefa9c41cb73ae0b$export$eb747620ce9c5e16), user?.refPath);
|
|
77
|
+
}
|
|
78
|
+
const $21e76cc83a2e54db$export$8566c10d5b97fabb = (commodity, user = null)=>{
|
|
79
|
+
//need a "no duplicate" function - whatever that means in this context
|
|
80
|
+
return (0, $iBx1N$writeRecord)((0, $fefa9c41cb73ae0b$export$eb747620ce9c5e16), commodity, user?.refPath);
|
|
81
|
+
};
|
|
82
|
+
async function $21e76cc83a2e54db$export$8396fff7636b69e4(commodity, parent = null) {
|
|
83
|
+
// will update just the fields provided
|
|
84
|
+
return (0, $iBx1N$writeBack)({
|
|
85
|
+
...commodity,
|
|
86
|
+
refPath: `${parent?.refPath}/${(0, $fefa9c41cb73ae0b$export$eb747620ce9c5e16)}/${commodity.Id}`
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
async function $21e76cc83a2e54db$export$1ec126d59f4db979(commodity, user = null) {
|
|
90
|
+
return (0, $iBx1N$updateRecord)((0, $iBx1N$fillForm)(commodity, (0, $fefa9c41cb73ae0b$export$eb747620ce9c5e16)), user, (0, $fefa9c41cb73ae0b$export$eb747620ce9c5e16));
|
|
91
|
+
}
|
|
92
|
+
async function $21e76cc83a2e54db$export$3171ba3c6caae841(Id, user = null) {
|
|
93
|
+
let exists = true;
|
|
94
|
+
try {
|
|
95
|
+
await $21e76cc83a2e54db$export$dad83ce325511ae2(Id);
|
|
96
|
+
} catch (err) {
|
|
97
|
+
exists = false;
|
|
98
|
+
}
|
|
99
|
+
return exists;
|
|
100
|
+
}
|
|
101
|
+
async function $21e76cc83a2e54db$export$965ec48652f232c7(user = null) {
|
|
102
|
+
return (0, $iBx1N$collectRecords)((0, $fefa9c41cb73ae0b$export$eb747620ce9c5e16), user?.refPath);
|
|
103
|
+
}
|
|
104
|
+
async function $21e76cc83a2e54db$export$7ad949526eb4312b(limit, user = null) {
|
|
105
|
+
return new (0, $iBx1N$PaginateFetch)((0, $fefa9c41cb73ae0b$export$eb747620ce9c5e16), null, [
|
|
106
|
+
{
|
|
107
|
+
fieldRef: "description",
|
|
108
|
+
dirStr: "asc"
|
|
109
|
+
}
|
|
110
|
+
], user?.refPath, limit);
|
|
111
|
+
}
|
|
112
|
+
async function $21e76cc83a2e54db$export$dad83ce325511ae2(commodityId, user = null) {
|
|
113
|
+
return (0, $iBx1N$fetchRecord)((0, $fefa9c41cb73ae0b$export$eb747620ce9c5e16), commodityId, user?.refPath);
|
|
114
|
+
}
|
|
115
|
+
async function $21e76cc83a2e54db$export$a621d0454ced7cc7(commodityId, user = null) {
|
|
116
|
+
const commodity = await $21e76cc83a2e54db$export$dad83ce325511ae2(commodityId, user);
|
|
117
|
+
return $21e76cc83a2e54db$var$summarizeCommodity(commodity);
|
|
118
|
+
}
|
|
119
|
+
//////////////////////////////////////////////////////////////////////
|
|
120
|
+
// utilities
|
|
121
|
+
/**
|
|
122
|
+
* Returns a standardized formatted name string
|
|
123
|
+
* @param {Commodity}
|
|
124
|
+
* @returns {string} formatted name string
|
|
125
|
+
*/ function $21e76cc83a2e54db$var$summarizeCommodity(commodity) {
|
|
126
|
+
return `${commodity?.description}`;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
export {$21e76cc83a2e54db$export$1ec126d59f4db979 as updateCommodity, $21e76cc83a2e54db$export$9b6c8c0861c73078 as deleteCommodity, $21e76cc83a2e54db$export$51973e05c49d13bf as deleteCommodityById, $21e76cc83a2e54db$export$8566c10d5b97fabb as createCommodity, $21e76cc83a2e54db$export$8396fff7636b69e4 as updateCommodityByID, $21e76cc83a2e54db$export$3171ba3c6caae841 as knownCommodity, $21e76cc83a2e54db$export$dad83ce325511ae2 as fetchCommodity, $21e76cc83a2e54db$export$965ec48652f232c7 as fetchCommodities, $21e76cc83a2e54db$export$7ad949526eb4312b as fetchCommoditiesPaginated, $21e76cc83a2e54db$export$a621d0454ced7cc7 as fetchCommodityName};
|
|
131
|
+
//# sourceMappingURL=InventoryLogic.46ca6768.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"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","sources":["business/Commodities/index.js"],"sourcesContent":["/**\n * Typedefs, constants, support functions and database operations related to Commodity Matrials\n * users\n * @module Commodities\n */\nimport {\n writeRecord,\n writeBack,\n updateRecord,\n fetchRecord,\n collectRecords,\n deleteRecord,\n PaginateFetch,\n} from \"@leaddreamer/firebase-wrapper\";\nimport { Forms, fillForm } from \"@leaddreamer/staticforms\";\n\nimport { UNITS, MATERIAL, COMMODITIES, COMMODITY, COMPONENT_RANGE } from \"../boilerplate/index.js\";\n\n//////////////////////////////////////////////////////////////////////\n// Constants\n\n/**\n * a record\n * @typedef {object} Commodity\n * @property {?string} Id Id of document (redundant for convenience)\n * @property {?string} refPath if from database, full path to document\n * @property {!string} description description, e.g. \"Wire, Silver, Sterling, 20ga\"\n * @property {!string} unit usage/measurement unit (for unit conversion)\n * @property {!number} rate the per unit cost of this commodity\n * @property {string} MATERIAL \"base\", \"highValue\" or other value tp be defined\n * @property {?url} image a reference image for the commodity\n */\n\n/**\n * @readonly\n * @constant\n * @type {Commodity}\n * @default\n */\nconst CommodityDefault = {\n Id: null,\n refPath: null,\n description: null,\n unit: null,\n rate: 0,\n [MATERIAL]: null,\n image: null,\n};\n\n/**\n * @readonly\n * @constant\n * @type {Commodity}\n * @default\n */\nconst CommodityData = {\n Id: `string.uuid`,\n refPath: null,\n description: `commerce.productDescription`,\n unit: `lookup:${UNITS}`,\n rate: `commerce.price:${COMPONENT_RANGE}`,\n [MATERIAL]: `lookup:${MATERIAL}`,\n image: null,\n};\n\n/**\n * @readonly\n * @constant\n * @type {Commodity}\n * @default\n */\nconst CommodityDefaultForm = {\n description: \"text\",\n unit: `lookup:${UNITS}`,\n rate: \"number\",\n [MATERIAL]:`lookup:${MATERIAL}`,\n image: \"url\",\n};\n\nForms.Base[COMMODITIES] = CommodityDefault;\nForms.BaseForm[COMMODITIES] = CommodityDefaultForm;\nForms.CreateForm[COMMODITIES] = CommodityDefaultForm;\nForms.Data[COMMODITIES] = CommodityData;\nForms.Summarize[COMMODITIES] = summarizeCommodity;\nForms.Save[COMMODITIES] = updateCommodity;\nForms.SearchBy[COMMODITIES] = \"description\";\n\n//////////////////////////////////////////////////////////////////////\n// record operations\n/**\n * @param {CommodityDefault} commodity\n * @param {UserObject} user minimal record of user this commodity belongs to (if any)\n * @returns {Promise<void>}\n */\nexport async function deleteCommodity(commodity, user = null) {\n return deleteRecord(commodity, COMMODITY, user?.refPath);\n}\n\n/**\n * @param {CommodityDefault} commodity minimal record of user account\n * @param {!string} commodity.Id record Id of account\n * @param {UserObject} user minimal record of user this commodity belongs to (if any)\n * @returns {Promise<void>}\n */\nexport async function deleteCommodityById(commodity, user = null) {\n if (!commodity?.Id) return;\n\n return deleteRecord(commodity, COMMODITY, user?.refPath);\n}\n\n/**\n * @param {Commodity} commodity minimal record of user account\n * @param {UserObject} user minimal record of user this commodity belongs to (if any)\n * @returns {Promise.Commodity}\n */\nexport const createCommodity = (commodity, user = null) => {\n //need a \"no duplicate\" function - whatever that means in this context\n return writeRecord(COMMODITY, commodity, user?.refPath);\n};\n\n/**\n * writes record back to database. Assumes only Id is valid\n * @param {Commodity} commodity a partially-populated commodity record for updates\n * @param {UserObject} user minimal record of user this commodity belongs to (if any)\n * @returns {promise.Commodity} a copy of the data written\n */\nexport async function updateCommodityByID(commodity, parent = null) {\n // will update just the fields provided\n return writeBack({\n ...commodity,\n refPath: `${parent?.refPath}/${COMMODITY}/${commodity.Id}`,\n });\n}\n\n/**\n * writes record back to database. Assumes only Id is valid\n * @param {Commodity} commodity a partially-populated commodity record for updates\n * @param {UserObject} user minimal record of user this commodity belongs to (if any)\n * @returns {promise.Commodity} a copy of the data written\n */\nexport async function updateCommodity(commodity, user = null) {\n \n return updateRecord(\n fillForm(commodity, COMMODITY), //saves only APPROPRIATE fields -does NOT populate missing fields\n user,\n COMMODITY\n );\n}\n\n//////////////////////////////////////////////////////////////////////\n// fetches\n\n/**\n * Checks if this is a known Commodity Id\n * @param {!string} Id Id value to check\n * @param {UserObject} user minimal record of user this commodity belongs to (if any)\n * @returns {Promise.boolean} true is this Id is in database\n */\nexport async function knownCommodity(Id, user = null) {\n let exists = true;\n try {\n await fetchCommodity(Id);\n } catch (err) {\n exists = false;\n }\n return exists;\n}\n\n//////////////////////////////////////////////////////////////////////\n// fetches\n\n/**\n * Fetches ALL Commodity records. Not very useful\n * @param {UserObject} user minimal record of user this commodity belongs to (if any)\n * @returns {Array.Commodity}\n */\nexport async function fetchCommodities(user = null) {\n return collectRecords(COMMODITY, user?.refPath);\n}\n\n/**\n * An object to allow for paginating a table read from Firestore. REQUIRES a sorting choice\n * @typedef {object} PaginatedFetch\n * @property {Query} Query that forms basis for the table read\n * @property {number} limit page size\n * @property {QuerySnapshot} snapshot last successful snapshot/page fetched\n * @property {enum} status status of pagination object\n * @property {method} PageForward pages the fetch forward\n * @property {method} PageBack pages the fetch backward\n\n */\n\n/**\n * Fetchs an object to fetch pages of commodity data, ascending by name, \"limit\" at a time\n * @param {number} limit\n * @param {UserObject} user minimal record of user this commodity belongs to (if any)\n * @returns {PaginatedFetch} object with pagination methods\n */\n\nexport async function fetchCommoditiesPaginated(limit, user = null) {\n return new PaginateFetch(\n COMMODITY,\n null, //filter\n [{ fieldRef: \"description\", dirStr: \"asc\" }], //sort\n user?.refPath, //ref\n limit,\n );\n}\n\n/**\n * Fetches a single Commodity record by Id\n * @param {!string} commodityId\n * @param {UserObject} user minimal record of user this commodity belongs to (if any)\n * @returns {Promise.Commodity}\n */\nexport async function fetchCommodity(commodityId, user = null) {\n return fetchRecord(COMMODITY, commodityId, user?.refPath);\n}\n\n/**\n * Fetches and returns the summarized name from a Commodity record\n * @param {!string} commodityId\n * @param {UserObject} user minimal record of user this commodity belongs to (if any)\n * @returns {Promise.string} the summarized name from the record\n */\nexport async function fetchCommodityName(commodityId, user = null) {\n const commodity = await fetchCommodity(commodityId, user);\n return summarizeCommodity(commodity);\n}\n\n//////////////////////////////////////////////////////////////////////\n// utilities\n/**\n * Returns a standardized formatted name string\n * @param {Commodity}\n * @returns {string} formatted name string\n */\nfunction summarizeCommodity(commodity) {\n return `${commodity?.description}`;\n}\n"],"names":[],"version":3,"file":"InventoryLogic.46ca6768.js.map"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import {BASE as $fefa9c41cb73ae0b$export$9e15ff8aa6bc996f, FABRICATION as $fefa9c41cb73ae0b$export$5d39addb0306dfd4, HIGHVALUE as $fefa9c41cb73ae0b$export$d93f73eb990136ee, MARKUPS as $fefa9c41cb73ae0b$export$1bfdae073fb20e6c, MATERIAL as $fefa9c41cb73ae0b$export$ca8f11448d1a1116, RETAIL as $fefa9c41cb73ae0b$export$4466b7859aa06ffd, SERVICE as $fefa9c41cb73ae0b$export$3ccfc9db9b7bf43f, STAGE as $fefa9c41cb73ae0b$export$f9865a0a7f208c15, WHOLESALE as $fefa9c41cb73ae0b$export$75be49b93be74cb5} from "./InventoryLogic.d27e84a7.js";
|
|
2
|
+
import {updateRecord as $cSgVL$updateRecord} from "@leaddreamer/firebase-wrapper";
|
|
3
|
+
import {Forms as $cSgVL$Forms, fillForm as $cSgVL$fillForm} from "@leaddreamer/staticforms";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Typedefs, constants, support functions and database operations related to product creation stages
|
|
7
|
+
* users
|
|
8
|
+
* @module Markups
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
//////////////////////////////////////////////////////////////////////
|
|
13
|
+
// Constants
|
|
14
|
+
/**
|
|
15
|
+
* Database Structure
|
|
16
|
+
* Product or User or Fundamentals (document)
|
|
17
|
+
* \-> Markups (collection)
|
|
18
|
+
* \-> [ParentId] (sole document)
|
|
19
|
+
* \-> [Stage Name(s)] (field, object)
|
|
20
|
+
* \-> [Material Name(s)] (field, value [Markup])
|
|
21
|
+
*/ /**
|
|
22
|
+
* @typedef {number} Markup
|
|
23
|
+
* @typedef {"base"|"highValue"|"service"} MaterialLevels
|
|
24
|
+
* @typedef {"fabrication"|"wholesale"|"retail"} StageLevels
|
|
25
|
+
* @typedef {Object.<MaterialLevels, Markup>} Material
|
|
26
|
+
* @typedef {Object.<StageLevels, Material>} Markups
|
|
27
|
+
*/ /**
|
|
28
|
+
* @readonly
|
|
29
|
+
* @constant
|
|
30
|
+
* @type {Material}
|
|
31
|
+
* @default
|
|
32
|
+
*/ const $082cf3de7799191e$var$MaterialDefault = {
|
|
33
|
+
[(0, $fefa9c41cb73ae0b$export$9e15ff8aa6bc996f)]: 1.0,
|
|
34
|
+
[(0, $fefa9c41cb73ae0b$export$d93f73eb990136ee)]: 1.0,
|
|
35
|
+
[(0, $fefa9c41cb73ae0b$export$3ccfc9db9b7bf43f)]: 1.0
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* @readonly
|
|
39
|
+
* @constant
|
|
40
|
+
* @type {Markups}
|
|
41
|
+
* @default
|
|
42
|
+
*/ const $082cf3de7799191e$var$MarkupsDefault = {
|
|
43
|
+
[(0, $fefa9c41cb73ae0b$export$5d39addb0306dfd4)]: {
|
|
44
|
+
[(0, $fefa9c41cb73ae0b$export$9e15ff8aa6bc996f)]: 1.0,
|
|
45
|
+
[(0, $fefa9c41cb73ae0b$export$d93f73eb990136ee)]: 1.0,
|
|
46
|
+
[(0, $fefa9c41cb73ae0b$export$3ccfc9db9b7bf43f)]: 1.0
|
|
47
|
+
},
|
|
48
|
+
[(0, $fefa9c41cb73ae0b$export$75be49b93be74cb5)]: {
|
|
49
|
+
[(0, $fefa9c41cb73ae0b$export$9e15ff8aa6bc996f)]: 1.0,
|
|
50
|
+
[(0, $fefa9c41cb73ae0b$export$d93f73eb990136ee)]: 1.0,
|
|
51
|
+
[(0, $fefa9c41cb73ae0b$export$3ccfc9db9b7bf43f)]: 1.0
|
|
52
|
+
},
|
|
53
|
+
[(0, $fefa9c41cb73ae0b$export$4466b7859aa06ffd)]: {
|
|
54
|
+
[(0, $fefa9c41cb73ae0b$export$9e15ff8aa6bc996f)]: 1.0,
|
|
55
|
+
[(0, $fefa9c41cb73ae0b$export$d93f73eb990136ee)]: 1.0,
|
|
56
|
+
[(0, $fefa9c41cb73ae0b$export$3ccfc9db9b7bf43f)]: 1.0
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* @readonly
|
|
61
|
+
* @constant
|
|
62
|
+
* @type {Material}
|
|
63
|
+
* @default
|
|
64
|
+
*/ const $082cf3de7799191e$var$MaterialDefaultForm = {
|
|
65
|
+
[(0, $fefa9c41cb73ae0b$export$9e15ff8aa6bc996f)]: "number",
|
|
66
|
+
[(0, $fefa9c41cb73ae0b$export$d93f73eb990136ee)]: "number",
|
|
67
|
+
[(0, $fefa9c41cb73ae0b$export$3ccfc9db9b7bf43f)]: "number"
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* @readonly
|
|
71
|
+
* @constant
|
|
72
|
+
* @type {Stage}
|
|
73
|
+
* @default
|
|
74
|
+
*/ const $082cf3de7799191e$var$MarkupsDefaultForm = {
|
|
75
|
+
[(0, $fefa9c41cb73ae0b$export$5d39addb0306dfd4)]: `subrecord:${(0, $fefa9c41cb73ae0b$export$ca8f11448d1a1116)}`,
|
|
76
|
+
[(0, $fefa9c41cb73ae0b$export$75be49b93be74cb5)]: `subrecord:${(0, $fefa9c41cb73ae0b$export$ca8f11448d1a1116)}`,
|
|
77
|
+
[(0, $fefa9c41cb73ae0b$export$4466b7859aa06ffd)]: `subrecord:${(0, $fefa9c41cb73ae0b$export$ca8f11448d1a1116)}`
|
|
78
|
+
};
|
|
79
|
+
(0, $cSgVL$Forms).Base[0, $fefa9c41cb73ae0b$export$ca8f11448d1a1116] = $082cf3de7799191e$var$MaterialDefaultForm;
|
|
80
|
+
(0, $cSgVL$Forms).BaseForm[0, $fefa9c41cb73ae0b$export$ca8f11448d1a1116] = $082cf3de7799191e$var$MaterialDefaultForm;
|
|
81
|
+
(0, $cSgVL$Forms).CreateForm[0, $fefa9c41cb73ae0b$export$ca8f11448d1a1116] = $082cf3de7799191e$var$MaterialDefaultForm;
|
|
82
|
+
//Forms.Save[MATERIAL] = updateMaterial;
|
|
83
|
+
(0, $cSgVL$Forms).SearchBy[0, $fefa9c41cb73ae0b$export$ca8f11448d1a1116] = (0, $fefa9c41cb73ae0b$export$ca8f11448d1a1116);
|
|
84
|
+
(0, $cSgVL$Forms).Base[0, $fefa9c41cb73ae0b$export$1bfdae073fb20e6c] = $082cf3de7799191e$var$MarkupsDefault;
|
|
85
|
+
(0, $cSgVL$Forms).BaseForm[0, $fefa9c41cb73ae0b$export$1bfdae073fb20e6c] = $082cf3de7799191e$var$MarkupsDefaultForm;
|
|
86
|
+
(0, $cSgVL$Forms).CreateForm[0, $fefa9c41cb73ae0b$export$1bfdae073fb20e6c] = $082cf3de7799191e$var$MarkupsDefaultForm;
|
|
87
|
+
(0, $cSgVL$Forms).Save[0, $fefa9c41cb73ae0b$export$1bfdae073fb20e6c] = $082cf3de7799191e$var$updateMarkups;
|
|
88
|
+
const $082cf3de7799191e$export$ede25c0a3a34c1c7 = {
|
|
89
|
+
[(0, $fefa9c41cb73ae0b$export$9e15ff8aa6bc996f)]: {
|
|
90
|
+
Id: (0, $fefa9c41cb73ae0b$export$9e15ff8aa6bc996f),
|
|
91
|
+
label: (0, $fefa9c41cb73ae0b$export$9e15ff8aa6bc996f),
|
|
92
|
+
description: "Base",
|
|
93
|
+
order: 1
|
|
94
|
+
},
|
|
95
|
+
[(0, $fefa9c41cb73ae0b$export$d93f73eb990136ee)]: {
|
|
96
|
+
Id: (0, $fefa9c41cb73ae0b$export$d93f73eb990136ee),
|
|
97
|
+
label: (0, $fefa9c41cb73ae0b$export$d93f73eb990136ee),
|
|
98
|
+
description: "High Value",
|
|
99
|
+
order: 2
|
|
100
|
+
},
|
|
101
|
+
[(0, $fefa9c41cb73ae0b$export$3ccfc9db9b7bf43f)]: {
|
|
102
|
+
Id: (0, $fefa9c41cb73ae0b$export$3ccfc9db9b7bf43f),
|
|
103
|
+
label: (0, $fefa9c41cb73ae0b$export$3ccfc9db9b7bf43f),
|
|
104
|
+
description: "Service",
|
|
105
|
+
order: 3
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const $082cf3de7799191e$export$eeb76fa3f6b878ea = {
|
|
109
|
+
[(0, $fefa9c41cb73ae0b$export$5d39addb0306dfd4)]: {
|
|
110
|
+
Id: (0, $fefa9c41cb73ae0b$export$5d39addb0306dfd4),
|
|
111
|
+
label: (0, $fefa9c41cb73ae0b$export$5d39addb0306dfd4),
|
|
112
|
+
description: "Fabrication Stage",
|
|
113
|
+
order: 1
|
|
114
|
+
},
|
|
115
|
+
[(0, $fefa9c41cb73ae0b$export$75be49b93be74cb5)]: {
|
|
116
|
+
Id: (0, $fefa9c41cb73ae0b$export$75be49b93be74cb5),
|
|
117
|
+
label: (0, $fefa9c41cb73ae0b$export$75be49b93be74cb5),
|
|
118
|
+
description: "Wholesale Stage",
|
|
119
|
+
order: 2
|
|
120
|
+
},
|
|
121
|
+
[(0, $fefa9c41cb73ae0b$export$4466b7859aa06ffd)]: {
|
|
122
|
+
Id: (0, $fefa9c41cb73ae0b$export$4466b7859aa06ffd),
|
|
123
|
+
label: (0, $fefa9c41cb73ae0b$export$4466b7859aa06ffd),
|
|
124
|
+
description: "Retail Stage",
|
|
125
|
+
order: 3
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* @readonly
|
|
130
|
+
* @constant
|
|
131
|
+
* @default
|
|
132
|
+
*/ (0, $cSgVL$Forms).Choices[0, $fefa9c41cb73ae0b$export$f9865a0a7f208c15] = $082cf3de7799191e$export$eeb76fa3f6b878ea;
|
|
133
|
+
/**
|
|
134
|
+
* @readonly
|
|
135
|
+
* @constant
|
|
136
|
+
* @default
|
|
137
|
+
*/ (0, $cSgVL$Forms).Choices[0, $fefa9c41cb73ae0b$export$ca8f11448d1a1116] = $082cf3de7799191e$export$ede25c0a3a34c1c7;
|
|
138
|
+
//////////////////////////////////////////////////////////////////////
|
|
139
|
+
// record operations
|
|
140
|
+
/**
|
|
141
|
+
* writes record back to database. Assumes only Id is valid
|
|
142
|
+
* @param {Markups} markups a partially-populated product record for updates
|
|
143
|
+
* @param {Record} parent minimal record of product, user (or none) this stage belongs to
|
|
144
|
+
* @returns {promise.LineItem} a copy of the data written
|
|
145
|
+
*/ async function $082cf3de7799191e$var$updateMarkups(markups, parent = null) {
|
|
146
|
+
return (0, $cSgVL$updateRecord)((0, $cSgVL$fillForm)(markups, (0, $fefa9c41cb73ae0b$export$1bfdae073fb20e6c)), parent, (0, $fefa9c41cb73ae0b$export$1bfdae073fb20e6c));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
export {$082cf3de7799191e$export$ede25c0a3a34c1c7 as MaterialChoices, $082cf3de7799191e$export$eeb76fa3f6b878ea as StageChoices};
|
|
151
|
+
//# sourceMappingURL=InventoryLogic.4d012935.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"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","sources":["business/Markups/index.js"],"sourcesContent":["/**\n * Typedefs, constants, support functions and database operations related to product creation stages\n * users\n * @module Markups\n */\nimport { updateRecord } from \"@leaddreamer/firebase-wrapper\"; \nimport { Forms, fillForm } from \"@leaddreamer/staticforms\";\n\nimport { MARKUPS, STAGE, FABRICATION, WHOLESALE, RETAIL, BASE, HIGHVALUE, SERVICE, MATERIAL } from \"../boilerplate/index.js\";\n\n//////////////////////////////////////////////////////////////////////\n// Constants\n/**\n * Database Structure\n * Product or User or Fundamentals (document)\n * \\-> Markups (collection)\n * \\-> [ParentId] (sole document)\n * \\-> [Stage Name(s)] (field, object)\n * \\-> [Material Name(s)] (field, value [Markup])\n */\n/**\n * @typedef {number} Markup\n * @typedef {\"base\"|\"highValue\"|\"service\"} MaterialLevels\n * @typedef {\"fabrication\"|\"wholesale\"|\"retail\"} StageLevels\n * @typedef {Object.<MaterialLevels, Markup>} Material\n * @typedef {Object.<StageLevels, Material>} Markups\n */\n\n/**\n * @readonly\n * @constant\n * @type {Material}\n * @default\n */\nconst MaterialDefault = {\n [BASE]: 1.0,\n [HIGHVALUE]: 1.0,\n [SERVICE]: 1.0,\n};\n\n/**\n * @readonly\n * @constant\n * @type {Markups}\n * @default\n */\nconst MarkupsDefault = {\n [FABRICATION]: {\n [BASE]: 1.0,\n [HIGHVALUE]: 1.0,\n [SERVICE]: 1.0,\n },\n [WHOLESALE]: {\n [BASE]: 1.0,\n [HIGHVALUE]: 1.0,\n [SERVICE]: 1.0,\n },\n [RETAIL]: {\n [BASE]: 1.0,\n [HIGHVALUE]: 1.0,\n [SERVICE]: 1.0,\n },\n};\n\n/**\n * @readonly\n * @constant\n * @type {Material}\n * @default\n */\nconst MaterialDefaultForm = {\n [BASE]: \"number\",\n [HIGHVALUE]: \"number\",\n [SERVICE]: \"number\",\n};\n\n/**\n * @readonly\n * @constant\n * @type {Stage}\n * @default\n */\nconst MarkupsDefaultForm = {\n [FABRICATION]: `subrecord:${MATERIAL}`,\n [WHOLESALE]: `subrecord:${MATERIAL}`,\n [RETAIL]: `subrecord:${MATERIAL}`,\n};\n\nForms.Base[MATERIAL] = MaterialDefaultForm;\nForms.BaseForm[MATERIAL] = MaterialDefaultForm;\nForms.CreateForm[MATERIAL] = MaterialDefaultForm;\n//Forms.Save[MATERIAL] = updateMaterial;\nForms.SearchBy[MATERIAL] = MATERIAL;\n\nForms.Base[MARKUPS] = MarkupsDefault;\nForms.BaseForm[MARKUPS] = MarkupsDefaultForm;\nForms.CreateForm[MARKUPS] = MarkupsDefaultForm;\nForms.Save[MARKUPS] = updateMarkups;\n\n/**\n * @readonly\n * @constant\n * @default\n * \n */\nexport const MaterialChoices = {\n [BASE]: {\n Id: BASE,\n label: BASE,\n description: \"Base\",\n order: 1,\n },\n [HIGHVALUE]: {\n Id: HIGHVALUE,\n label: HIGHVALUE,\n description: \"High Value\",\n order: 2,\n },\n [SERVICE]: {\n Id: SERVICE,\n label: SERVICE,\n description: \"Service\",\n order: 3,\n },\n};\n\n/**\n * @readonly\n * @constant\n * @default\n */\nexport const StageChoices = {\n [FABRICATION]: {\n Id: FABRICATION,\n label: FABRICATION,\n description: \"Fabrication Stage\",\n order: 1,\n },\n [WHOLESALE]: {\n Id: WHOLESALE,\n label: WHOLESALE,\n description: \"Wholesale Stage\",\n order: 2,\n },\n [RETAIL]: {\n Id: RETAIL,\n label: RETAIL,\n description: \"Retail Stage\",\n order: 3,\n },\n};\n\n/**\n * @readonly\n * @constant\n * @default\n */\nForms.Choices[STAGE] = StageChoices;\n\n/**\n * @readonly\n * @constant\n * @default\n */\nForms.Choices[MATERIAL] = MaterialChoices\n\n//////////////////////////////////////////////////////////////////////\n// record operations\n/**\n * writes record back to database. Assumes only Id is valid\n * @param {Markups} markups a partially-populated product record for updates\n * @param {Record} parent minimal record of product, user (or none) this stage belongs to\n * @returns {promise.LineItem} a copy of the data written\n */\nasync function updateMarkups(markups, parent = null) {\n return updateRecord(\n fillForm(markups, MARKUPS), //saves only APPROPRIATE fields -does NOT populate missing fields\n parent,\n MARKUPS\n );\n}\n\n\n"],"names":[],"version":3,"file":"InventoryLogic.4d012935.js.map"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import {ADDRESSES as $fefa9c41cb73ae0b$export$6890d3564b1f252d, BUSINESS as $fefa9c41cb73ae0b$export$6f454e69bce3a691, BUSINESS_TYPE as $fefa9c41cb73ae0b$export$1bd589465335bb9d, BUSINESSDATA as $fefa9c41cb73ae0b$export$e651cf32bc3f78a4, MCC as $fefa9c41cb73ae0b$export$af5764009005aa8e, USER as $fefa9c41cb73ae0b$export$ff09b90989b21a8} from "./InventoryLogic.d27e84a7.js";
|
|
2
|
+
import {fetchAddresses as $5e875028eacae923$export$c9b8cb1768a98d34} from "./InventoryLogic.37dfff3e.js";
|
|
3
|
+
import {fetchRecord as $lNnOJ$fetchRecord, typedWrite as $lNnOJ$typedWrite, writeBack as $lNnOJ$writeBack, deleteRecordByRefPath as $lNnOJ$deleteRecordByRefPath, writeRecord as $lNnOJ$writeRecord} from "@leaddreamer/firebase-wrapper";
|
|
4
|
+
import {Forms as $lNnOJ$Forms, fillForm as $lNnOJ$fillForm} from "@leaddreamer/staticforms";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Functions for managing (potentially)private data for an organization.
|
|
8
|
+
* Unified structure as a sub-record of organization, or CityManager accounts
|
|
9
|
+
* @module BusinessData
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
//////////////////////////////////////////////////////////////////////
|
|
15
|
+
// definitions
|
|
16
|
+
/**
|
|
17
|
+
* @external AddressType
|
|
18
|
+
*/ /**
|
|
19
|
+
* @typedef {object} contact
|
|
20
|
+
* @property {?string} contact.Id
|
|
21
|
+
* @property {!string} contact.first_name
|
|
22
|
+
* @property {!string} contact.last_name
|
|
23
|
+
* @property {!string} contact.tel
|
|
24
|
+
* @property {?string} contact.email - must be filled in to make profile public
|
|
25
|
+
*/ /**
|
|
26
|
+
* @typedef {object} BusinessData
|
|
27
|
+
* @property {?string} email - must be filled in to make profile public
|
|
28
|
+
* @property {contact} contact
|
|
29
|
+
* @property {!string} tel
|
|
30
|
+
* @property {string} business_type
|
|
31
|
+
* @property {AddressType} business_address
|
|
32
|
+
* @property {AddressType} mailing_address
|
|
33
|
+
* @property {AddressType} billing_address
|
|
34
|
+
*/ /**
|
|
35
|
+
* @constant
|
|
36
|
+
* @type {BusinessData}
|
|
37
|
+
* @default
|
|
38
|
+
*/ const $852adca6ae24886c$var$BusinessDefault = {
|
|
39
|
+
Id: null,
|
|
40
|
+
email: null,
|
|
41
|
+
business_type: null,
|
|
42
|
+
contact: null,
|
|
43
|
+
business_address: null,
|
|
44
|
+
mailing_address: null,
|
|
45
|
+
billing_address: null,
|
|
46
|
+
tel: null,
|
|
47
|
+
mcc: null,
|
|
48
|
+
tax_rate: null,
|
|
49
|
+
//tax_id: null,
|
|
50
|
+
openIssues: false
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* @constant
|
|
54
|
+
* @type {BusinessData}
|
|
55
|
+
* @default
|
|
56
|
+
*/ const $852adca6ae24886c$var$BusinessAccountForm = {
|
|
57
|
+
refPath: "hidden:text",
|
|
58
|
+
email: "email",
|
|
59
|
+
business_type: `lookup:${(0, $fefa9c41cb73ae0b$export$1bd589465335bb9d)}`,
|
|
60
|
+
contact: `object:${(0, $fefa9c41cb73ae0b$export$ff09b90989b21a8)}`,
|
|
61
|
+
business_address: `lookupLink:${(0, $fefa9c41cb73ae0b$export$6890d3564b1f252d)}`,
|
|
62
|
+
mailing_address: `lookupLink:${(0, $fefa9c41cb73ae0b$export$6890d3564b1f252d)}`,
|
|
63
|
+
billing_address: `lookupLink:${(0, $fefa9c41cb73ae0b$export$6890d3564b1f252d)}`,
|
|
64
|
+
tel: "tel",
|
|
65
|
+
mcc: `lookup:${(0, $fefa9c41cb73ae0b$export$af5764009005aa8e)}`
|
|
66
|
+
};
|
|
67
|
+
(0, $lNnOJ$Forms).Base[0, $fefa9c41cb73ae0b$export$e651cf32bc3f78a4] = $852adca6ae24886c$var$BusinessDefault;
|
|
68
|
+
(0, $lNnOJ$Forms).BaseForm[0, $fefa9c41cb73ae0b$export$e651cf32bc3f78a4] = $852adca6ae24886c$var$BusinessAccountForm;
|
|
69
|
+
(0, $lNnOJ$Forms).AccountForm[0, $fefa9c41cb73ae0b$export$e651cf32bc3f78a4] = $852adca6ae24886c$var$BusinessAccountForm;
|
|
70
|
+
async function $852adca6ae24886c$export$aeea048b1874c987(account) {
|
|
71
|
+
const BusinessData = await $852adca6ae24886c$export$a273004aea0035e0(account);
|
|
72
|
+
account.business = BusinessData;
|
|
73
|
+
return account;
|
|
74
|
+
}
|
|
75
|
+
async function $852adca6ae24886c$export$a273004aea0035e0(account) {
|
|
76
|
+
let addresses = [];
|
|
77
|
+
try {
|
|
78
|
+
addresses = await (0, $5e875028eacae923$export$c9b8cb1768a98d34)(account);
|
|
79
|
+
} catch (err) {}
|
|
80
|
+
const addressMap = new Map();
|
|
81
|
+
if (addresses.length) addresses.forEach((address)=>{
|
|
82
|
+
addressMap.set(address.Id, address);
|
|
83
|
+
});
|
|
84
|
+
const BusinessData = await (0, $lNnOJ$fetchRecord)((0, $fefa9c41cb73ae0b$export$e651cf32bc3f78a4), account.Id, account.refPath);
|
|
85
|
+
let addressEntries = {};
|
|
86
|
+
[
|
|
87
|
+
"business_address",
|
|
88
|
+
"billing_address",
|
|
89
|
+
"mailing_address"
|
|
90
|
+
].forEach((entry)=>{
|
|
91
|
+
const isLink = entry && BusinessData[entry] && !BusinessData[entry]?.address_line_1;
|
|
92
|
+
if (isLink) addressEntries[entry] = {
|
|
93
|
+
...addressMap.get(BusinessData[entry])
|
|
94
|
+
};
|
|
95
|
+
}); //hacky way to repeat same effort
|
|
96
|
+
return {
|
|
97
|
+
...BusinessData,
|
|
98
|
+
...addressEntries
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function $852adca6ae24886c$export$f81f3e9fae10e6db(account, origin) {
|
|
102
|
+
return `${origin}/${0, $fefa9c41cb73ae0b$export$6f454e69bce3a691}/Account`; //Leads to LOGGED IN organization account page
|
|
103
|
+
}
|
|
104
|
+
async function $852adca6ae24886c$export$ca4306a1b5762f0e(account, batch = null) {
|
|
105
|
+
return (0, $lNnOJ$typedWrite)({
|
|
106
|
+
...(0, $lNnOJ$Forms).Base[0, $fefa9c41cb73ae0b$export$e651cf32bc3f78a4],
|
|
107
|
+
...(0, $lNnOJ$fillForm)(account, (0, $fefa9c41cb73ae0b$export$e651cf32bc3f78a4))
|
|
108
|
+
}, account, (0, $fefa9c41cb73ae0b$export$e651cf32bc3f78a4), batch);
|
|
109
|
+
}
|
|
110
|
+
async function $852adca6ae24886c$export$4bb3a8bbe6017432(businessData, batch = null) {
|
|
111
|
+
return (0, $lNnOJ$writeBack)(businessData, batch);
|
|
112
|
+
}
|
|
113
|
+
async function $852adca6ae24886c$export$b8447d25d283e6cc(businessData, batch = null) {
|
|
114
|
+
return (0, $lNnOJ$deleteRecordByRefPath)(businessData.refPath, batch);
|
|
115
|
+
}
|
|
116
|
+
function $852adca6ae24886c$export$8c755753b01b12f(account) {
|
|
117
|
+
return `${account.refPath}/${0, $fefa9c41cb73ae0b$export$e651cf32bc3f78a4}/${account.Id}`;
|
|
118
|
+
}
|
|
119
|
+
function $852adca6ae24886c$export$1e2f140c95101692(account, businessData) {
|
|
120
|
+
if (!businessData?.business_address) return false;
|
|
121
|
+
if (!businessData?.billing_address) return false;
|
|
122
|
+
if (!businessData?.mailing_address) return false;
|
|
123
|
+
if (!businessData?.email) return false;
|
|
124
|
+
if (!businessData?.tel) return false;
|
|
125
|
+
if (!account?.website) return false;
|
|
126
|
+
if (!(account?.name || account?.corporate)) return false;
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
function $852adca6ae24886c$export$f9e1390aa5941c3f(account, businessData) {
|
|
130
|
+
let problem_string = "";
|
|
131
|
+
if (!businessData?.business_address) problem_string = problem_string.concat(`=> Business Address Missing\n`);
|
|
132
|
+
if (!businessData?.billing_address) problem_string = problem_string.concat(`=> Billing Address Missing\n`);
|
|
133
|
+
if (!businessData?.mailing_address) problem_string = problem_string.concat(`=> Mailing Address Missing\n`);
|
|
134
|
+
if (!businessData?.email) problem_string = problem_string.concat(`=> Business Email Missing\n`);
|
|
135
|
+
if (!businessData?.tel) problem_string = problem_string.concat(`=> Business Telephone Missing\n`);
|
|
136
|
+
if (!account?.website) problem_string = problem_string.concat(`=> Business Website Missing\n`);
|
|
137
|
+
if (!(account?.name || account?.corporate)) problem_string = problem_string.concat(`=> Business and/or Corporate Name Missing\n`);
|
|
138
|
+
return problem_string.length ? problem_string : null;
|
|
139
|
+
}
|
|
140
|
+
async function $852adca6ae24886c$export$89c9bbe01d357e36(businessData) {
|
|
141
|
+
return (0, $lNnOJ$writeRecord)((0, $fefa9c41cb73ae0b$export$e651cf32bc3f78a4), {
|
|
142
|
+
...businessData,
|
|
143
|
+
openIssues: true
|
|
144
|
+
}, businessData.refPath, null, true);
|
|
145
|
+
}
|
|
146
|
+
async function $852adca6ae24886c$export$45379be9a22c2a97(businessData) {
|
|
147
|
+
return (0, $lNnOJ$writeRecord)((0, $fefa9c41cb73ae0b$export$e651cf32bc3f78a4), {
|
|
148
|
+
...businessData,
|
|
149
|
+
openIssues: false
|
|
150
|
+
}, businessData.refPath, null, true);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
export {$852adca6ae24886c$export$aeea048b1874c987 as fetchFullAccount, $852adca6ae24886c$export$a273004aea0035e0 as fetchBusinessData, $852adca6ae24886c$export$f81f3e9fae10e6db as accountPage, $852adca6ae24886c$export$ca4306a1b5762f0e as createBusinessData, $852adca6ae24886c$export$4bb3a8bbe6017432 as saveBusinessData, $852adca6ae24886c$export$b8447d25d283e6cc as deleteBusinessData, $852adca6ae24886c$export$8c755753b01b12f as businessDataPath, $852adca6ae24886c$export$1e2f140c95101692 as profileComplete, $852adca6ae24886c$export$f9e1390aa5941c3f as profileIncomplete, $852adca6ae24886c$export$89c9bbe01d357e36 as setOpenIssues, $852adca6ae24886c$export$45379be9a22c2a97 as clearOpenIssues};
|
|
155
|
+
//# sourceMappingURL=InventoryLogic.57f24f5f.js.map
|