@leaddreamer/inventorylogic 0.0.3-beta.39 → 0.0.3-beta.4
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 +9 -852
- package/business/Commodities/index.js +1 -1
- package/business/LineItem/index.js +2 -2
- package/business/Markups/index.js +2 -2
- package/business/Payment/index.js +1 -1
- package/business/Product/index.js +17 -160
- package/business/User/index.js +2 -2
- package/business/Utilities/index.js +1 -1
- package/business/boilerplate/index.js +3 -26
- package/business/index.js +9 -12
- package/business/units/index.js +1 -1
- package/index.js +1 -1
- package/package.json +8 -25
- package/business/Addresses/index.js +0 -181
- package/business/BusinessData/index.js +0 -300
- package/business/Fundamentals/index.js +0 -184
- package/business/PrivateData/index.js +0 -176
- package/dist/InventoryLogic.09daaeaa.js +0 -2
- package/dist/InventoryLogic.0ba84fa7.js +0 -2
- package/dist/InventoryLogic.0d599c03.js +0 -2
- package/dist/InventoryLogic.137e5482.js +0 -2
- package/dist/InventoryLogic.14a7860a.js +0 -2
- package/dist/InventoryLogic.14b7f292.js +0 -2
- package/dist/InventoryLogic.188504b1.js +0 -2
- package/dist/InventoryLogic.196261df.js +0 -2
- package/dist/InventoryLogic.1aa3d0be.js +0 -2
- package/dist/InventoryLogic.205007e9.js +0 -2
- package/dist/InventoryLogic.22a36cc8.js +0 -2
- package/dist/InventoryLogic.2642cf62.js +0 -2
- package/dist/InventoryLogic.2e2dcd29.js +0 -2
- package/dist/InventoryLogic.34455124.js +0 -2
- package/dist/InventoryLogic.3675b133.js +0 -2
- package/dist/InventoryLogic.3b10ccc5.js +0 -2
- package/dist/InventoryLogic.3ccd3412.js +0 -2
- package/dist/InventoryLogic.3cd7da47.js +0 -2
- package/dist/InventoryLogic.415ac613.js +0 -2
- package/dist/InventoryLogic.421e1e7c.js +0 -9
- package/dist/InventoryLogic.457956a7.js +0 -2
- package/dist/InventoryLogic.48cfeaff.js +0 -2
- package/dist/InventoryLogic.4e7559ed.js +0 -2
- package/dist/InventoryLogic.50cb471b.js +0 -2
- package/dist/InventoryLogic.53279d78.js +0 -2
- package/dist/InventoryLogic.58dceea1.js +0 -2
- package/dist/InventoryLogic.5baab4fe.js +0 -2
- package/dist/InventoryLogic.5c08e39a.js +0 -2
- package/dist/InventoryLogic.5c885f7a.js +0 -2
- package/dist/InventoryLogic.648c0930.js +0 -2
- package/dist/InventoryLogic.67c1b155.js +0 -2
- package/dist/InventoryLogic.6f8b7ae0.js +0 -2
- package/dist/InventoryLogic.724cdb7a.js +0 -2
- package/dist/InventoryLogic.7407f5ab.js +0 -2
- package/dist/InventoryLogic.7559452d.js +0 -2
- package/dist/InventoryLogic.81d4c177.js +0 -2
- package/dist/InventoryLogic.86caed3d.js +0 -2
- package/dist/InventoryLogic.89bc98ac.js +0 -2
- package/dist/InventoryLogic.95d27be0.js +0 -2
- package/dist/InventoryLogic.9899e841.js +0 -2
- package/dist/InventoryLogic.9a4b1e67.js +0 -2
- package/dist/InventoryLogic.9f07806b.js +0 -2
- package/dist/InventoryLogic.a08adebe.js +0 -2
- package/dist/InventoryLogic.a4e13ed0.js +0 -2
- package/dist/InventoryLogic.ac0345c3.js +0 -9
- package/dist/InventoryLogic.b6a32e7a.js +0 -2
- package/dist/InventoryLogic.bf7b624e.js +0 -2
- package/dist/InventoryLogic.c44fa152.js +0 -2
- package/dist/InventoryLogic.c5bdd6e0.js +0 -2
- package/dist/InventoryLogic.c72232ce.js +0 -2
- package/dist/InventoryLogic.c903d27c.js +0 -2
- package/dist/InventoryLogic.caf3c5cd.js +0 -2
- package/dist/InventoryLogic.ce72ae5e.js +0 -2
- package/dist/InventoryLogic.d14897a2.js +0 -2
- package/dist/InventoryLogic.d678c3ae.js +0 -2
- package/dist/InventoryLogic.d76d5857.js +0 -2
- package/dist/InventoryLogic.dda8477e.js +0 -2
- package/dist/InventoryLogic.df1596da.js +0 -2
- package/dist/InventoryLogic.e02cbd0d.js +0 -2
- package/dist/InventoryLogic.e1a6db03.js +0 -2
- package/dist/InventoryLogic.e7e04396.js +0 -2
- package/dist/InventoryLogic.e92db878.js +0 -2
- package/dist/InventoryLogic.eaecbd8b.js +0 -2
- package/dist/InventoryLogic.eed8150d.js +0 -2
- package/dist/InventoryLogic.f27b4a7e.js +0 -2
- package/dist/InventoryLogic.f27e2dc7.js +0 -2
- package/dist/InventoryLogic.f29bd369.js +0 -2
- package/dist/InventoryLogic.f3361cdd.js +0 -2
- package/dist/InventoryLogic.fb851384.js +0 -2
- package/dist/InventoryLogic.fcbfca1e.js +0 -2
- package/dist/InventoryLogic.ff65d86c.js +0 -2
- package/dist/index.js +0 -2
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Functions for managing (potentially)private data for an organization.
|
|
3
|
-
* Unified structure as a sub-record of organization, or CityManager accounts
|
|
4
|
-
* @module BusinessData
|
|
5
|
-
*/
|
|
6
|
-
import {
|
|
7
|
-
fetchRecord,
|
|
8
|
-
writeRecord,
|
|
9
|
-
typedWrite,
|
|
10
|
-
writeBack,
|
|
11
|
-
deleteRecordByRefPath,
|
|
12
|
-
} from "@leaddreamer/firebase-wrapper";
|
|
13
|
-
import {
|
|
14
|
-
BUSINESS,
|
|
15
|
-
BUSINESSDATA,
|
|
16
|
-
BUSINESS_TYPE,
|
|
17
|
-
ADDRESSES,
|
|
18
|
-
USER,
|
|
19
|
-
MCC,
|
|
20
|
-
} from "../boilerplate/index.js";
|
|
21
|
-
import { fetchAddresses } from "../Addresses/index.js";
|
|
22
|
-
|
|
23
|
-
//////////////////////////////////////////////////////////////////////
|
|
24
|
-
// definitions
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @external AddressType
|
|
28
|
-
*/
|
|
29
|
-
/**
|
|
30
|
-
* @typedef {object} contact
|
|
31
|
-
* @property {?string} contact.Id
|
|
32
|
-
* @property {!string} contact.first_name
|
|
33
|
-
* @property {!string} contact.last_name
|
|
34
|
-
* @property {!string} contact.tel
|
|
35
|
-
* @property {?string} contact.email - must be filled in to make profile public
|
|
36
|
-
*/
|
|
37
|
-
/**
|
|
38
|
-
* @typedef {object} BusinessData
|
|
39
|
-
* @property {?string} email - must be filled in to make profile public
|
|
40
|
-
* @property {contact} contact
|
|
41
|
-
* @property {!string} tel
|
|
42
|
-
* @property {string} business_type
|
|
43
|
-
* @property {AddressType} business_address
|
|
44
|
-
* @property {AddressType} mailing_address
|
|
45
|
-
* @property {AddressType} billing_address
|
|
46
|
-
*/
|
|
47
|
-
/**
|
|
48
|
-
* @constant
|
|
49
|
-
* @type {BusinessData}
|
|
50
|
-
* @default
|
|
51
|
-
*/
|
|
52
|
-
const BusinessDefault = {
|
|
53
|
-
Id: null,
|
|
54
|
-
email: null,
|
|
55
|
-
business_type: null,
|
|
56
|
-
contact: null,
|
|
57
|
-
business_address: null,
|
|
58
|
-
mailing_address: null,
|
|
59
|
-
billing_address: null,
|
|
60
|
-
tel: null,
|
|
61
|
-
mcc: null,
|
|
62
|
-
tax_rate: null,
|
|
63
|
-
//tax_id: null,
|
|
64
|
-
openIssues: false,
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* @constant
|
|
69
|
-
* @type {BusinessData}
|
|
70
|
-
* @default
|
|
71
|
-
*/
|
|
72
|
-
const BusinessAccountForm = {
|
|
73
|
-
refPath: "hidden:text",
|
|
74
|
-
email: "email",
|
|
75
|
-
business_type: `lookup:${BUSINESS_TYPE}`,
|
|
76
|
-
contact: `object:${USER}`,
|
|
77
|
-
business_address: `lookupLink:${ADDRESSES}`,
|
|
78
|
-
mailing_address: `lookupLink:${ADDRESSES}`,
|
|
79
|
-
billing_address: `lookupLink:${ADDRESSES}`,
|
|
80
|
-
tel: "tel",
|
|
81
|
-
mcc: `lookup:${MCC}`,
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
Forms.Base[BUSINESSDATA] = BusinessDefault;
|
|
85
|
-
Forms.BaseForm[BUSINESSDATA] = BusinessAccountForm;
|
|
86
|
-
Forms.AccountForm[BUSINESSDATA] = BusinessAccountForm;
|
|
87
|
-
|
|
88
|
-
//////////////////////////////////////////////////////////////////////
|
|
89
|
-
// Utilities
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Fetches a fulll object representation of an account, including BusinessData
|
|
93
|
-
* @param {AccountType} account
|
|
94
|
-
* @returns {Promise.AccountType}
|
|
95
|
-
*/
|
|
96
|
-
export async function fetchFullAccount(account) {
|
|
97
|
-
const BusinessData = await fetchBusinessData(account);
|
|
98
|
-
|
|
99
|
-
account.business = BusinessData;
|
|
100
|
-
|
|
101
|
-
return account;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Fetches the BusinessData (corporate, addresses, etc) for an account
|
|
106
|
-
* @param {AccountType} account
|
|
107
|
-
* @returns {Promise.BusinessData}
|
|
108
|
-
*/
|
|
109
|
-
export async function fetchBusinessData(account) {
|
|
110
|
-
let addresses = [];
|
|
111
|
-
try {
|
|
112
|
-
addresses = await fetchAddresses(account);
|
|
113
|
-
} catch (err) {}
|
|
114
|
-
const addressMap = new Map();
|
|
115
|
-
if (addresses.length) {
|
|
116
|
-
addresses.forEach((address) => {
|
|
117
|
-
addressMap.set(address.Id, address);
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const BusinessData = await fetchRecord(
|
|
122
|
-
BUSINESSDATA,
|
|
123
|
-
account.Id,
|
|
124
|
-
account.refPath,
|
|
125
|
-
);
|
|
126
|
-
|
|
127
|
-
let addressEntries = {};
|
|
128
|
-
["business_address", "billing_address", "mailing_address"].forEach(
|
|
129
|
-
(entry) => {
|
|
130
|
-
const isLink =
|
|
131
|
-
entry && BusinessData[entry] && !BusinessData[entry]?.address_line_1;
|
|
132
|
-
if (isLink) {
|
|
133
|
-
addressEntries[entry] = {
|
|
134
|
-
...addressMap.get(BusinessData[entry]),
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
); //hacky way to repeat same effort
|
|
139
|
-
|
|
140
|
-
return {
|
|
141
|
-
...BusinessData,
|
|
142
|
-
...addressEntries,
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Composes a URL for an "account page" from the account, and passed base URL
|
|
148
|
-
* @param {!AccountType} account
|
|
149
|
-
* @param {!string} origin base URL for the application
|
|
150
|
-
* @returns {string} full URL for business accouont
|
|
151
|
-
*/
|
|
152
|
-
export function accountPage(account, origin) {
|
|
153
|
-
return `${origin}/${BUSINESS}/Account`; //Leads to LOGGED IN organization account page
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* @external WriteBatch
|
|
158
|
-
* @typedef {WriteBatch|Transaction|void} ChainType
|
|
159
|
-
*/
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* @async
|
|
163
|
-
* @function
|
|
164
|
-
* @static
|
|
165
|
-
* Creates the Business information document
|
|
166
|
-
* @param {AccountType} account
|
|
167
|
-
* @param {?ChainType} batch - batching object. Transaction will be added to the batch
|
|
168
|
-
* @returns {Promise<ChainType>} WriteBatch, Transaction or Void
|
|
169
|
-
*/
|
|
170
|
-
export async function createBusinessData(account, batch = null) {
|
|
171
|
-
return typedWrite(
|
|
172
|
-
{
|
|
173
|
-
...Forms.Base[BUSINESSDATA], //base fields with defaults
|
|
174
|
-
...fillForm(account, BUSINESSDATA), //sanitize passed data
|
|
175
|
-
}, //data
|
|
176
|
-
account, //parent
|
|
177
|
-
BUSINESSDATA, //type
|
|
178
|
-
batch,
|
|
179
|
-
);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Writes the "Business" data to the database
|
|
184
|
-
* @param {BusinessData} businessData
|
|
185
|
-
* @returns {Promise<BusinessData>}
|
|
186
|
-
*/
|
|
187
|
-
export async function saveBusinessData(businessData, batch = null) {
|
|
188
|
-
return writeBack(businessData, batch);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Deletes a BusinessData record (rarely used if ever)
|
|
193
|
-
* @param {BusinessData} businessData
|
|
194
|
-
* @param {!string} businessData.refPath
|
|
195
|
-
* @returns {Promise<void>}
|
|
196
|
-
*/
|
|
197
|
-
export async function deleteBusinessData(businessData, batch = null) {
|
|
198
|
-
return deleteRecordByRefPath(businessData.refPath, batch);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* creates the "base path" (refPath) to store addresses based on an account (refPath)
|
|
203
|
-
* @param {Record} account
|
|
204
|
-
* @param {!string} account.refPath
|
|
205
|
-
* @returns {string}
|
|
206
|
-
*/
|
|
207
|
-
export function businessDataPath(account) {
|
|
208
|
-
return `${account.refPath}/${BUSINESSDATA}/${account.Id}`;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* verifies that all needed information has been filled in
|
|
213
|
-
* @param {AccountType} account
|
|
214
|
-
* @param {BusinessData} businessData record
|
|
215
|
-
* @returns {Boolean}
|
|
216
|
-
*/
|
|
217
|
-
export function profileComplete(account, businessData) {
|
|
218
|
-
if (!businessData?.business_address) return false;
|
|
219
|
-
if (!businessData?.billing_address) return false;
|
|
220
|
-
if (!businessData?.mailing_address) return false;
|
|
221
|
-
if (!businessData?.email) return false;
|
|
222
|
-
if (!businessData?.tel) return false;
|
|
223
|
-
if (!account?.website) return false;
|
|
224
|
-
if (!(account?.name || account?.corporate)) return false;
|
|
225
|
-
return true;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* verifies that all needed information has been filled in
|
|
230
|
-
* @param {AccountType} account
|
|
231
|
-
* @param {BusinessData} businessData record
|
|
232
|
-
* @returns {string|null}
|
|
233
|
-
*/
|
|
234
|
-
export function profileIncomplete(account, businessData) {
|
|
235
|
-
let problem_string = "";
|
|
236
|
-
if (!businessData?.business_address) {
|
|
237
|
-
problem_string = problem_string.concat(`=> Business Address Missing\n`);
|
|
238
|
-
}
|
|
239
|
-
if (!businessData?.billing_address) {
|
|
240
|
-
problem_string = problem_string.concat(`=> Billing Address Missing\n`);
|
|
241
|
-
}
|
|
242
|
-
if (!businessData?.mailing_address) {
|
|
243
|
-
problem_string = problem_string.concat(`=> Mailing Address Missing\n`);
|
|
244
|
-
}
|
|
245
|
-
if (!businessData?.email) {
|
|
246
|
-
problem_string = problem_string.concat(`=> Business Email Missing\n`);
|
|
247
|
-
}
|
|
248
|
-
if (!businessData?.tel) {
|
|
249
|
-
problem_string = problem_string.concat(`=> Business Telephone Missing\n`);
|
|
250
|
-
}
|
|
251
|
-
if (!account?.website) {
|
|
252
|
-
problem_string = problem_string.concat(`=> Business Website Missing\n`);
|
|
253
|
-
}
|
|
254
|
-
if (!(account?.name || account?.corporate)) {
|
|
255
|
-
problem_string = problem_string.concat(
|
|
256
|
-
`=> Business and/or Corporate Name Missing\n`,
|
|
257
|
-
);
|
|
258
|
-
}
|
|
259
|
-
return problem_string.length ? problem_string : null;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Sets the "openIssues" flag in an account's BUSINESSDATA record
|
|
264
|
-
* The account's refPath is attached to the Payment system's record, and
|
|
265
|
-
* used here to find the Payment Account
|
|
266
|
-
* @param {BusinessData} businessData
|
|
267
|
-
* @returns {Promise.boolean}
|
|
268
|
-
*/
|
|
269
|
-
export async function setOpenIssues(businessData) {
|
|
270
|
-
return writeRecord(
|
|
271
|
-
BUSINESSDATA,
|
|
272
|
-
{
|
|
273
|
-
...businessData,
|
|
274
|
-
openIssues: true,
|
|
275
|
-
},
|
|
276
|
-
businessData.refPath,
|
|
277
|
-
null,
|
|
278
|
-
true,
|
|
279
|
-
);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Clears the "openIssues" flag in an account's BUSINESSDATA record
|
|
284
|
-
* The account's refPath is attached to the Payment system's record, and
|
|
285
|
-
* used here to find the Payment Account
|
|
286
|
-
* @param {BusinessData} businessData
|
|
287
|
-
* @returns {Promise.boolean}
|
|
288
|
-
*/
|
|
289
|
-
export async function clearOpenIssues(businessData) {
|
|
290
|
-
return writeRecord(
|
|
291
|
-
BUSINESSDATA,
|
|
292
|
-
{
|
|
293
|
-
...businessData,
|
|
294
|
-
openIssues: false,
|
|
295
|
-
},
|
|
296
|
-
businessData.refPath,
|
|
297
|
-
null,
|
|
298
|
-
true,
|
|
299
|
-
);
|
|
300
|
-
}
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typedefs, constants, support functions and database operations related to Fundamental
|
|
3
|
-
* setting from the Database *
|
|
4
|
-
* @module Fundamentals
|
|
5
|
-
*/
|
|
6
|
-
import { collectRecords } from "@leaddreamer/firebase-wrapper";
|
|
7
|
-
import { Forms, fillForm } from "@leaddreamer/staticforms";
|
|
8
|
-
import {
|
|
9
|
-
FUNDAMENTALS,
|
|
10
|
-
RATES,
|
|
11
|
-
PAYOUTRATES,
|
|
12
|
-
MCC,
|
|
13
|
-
BUSINESS_TYPE,
|
|
14
|
-
} from "../boilerplate/index.js";
|
|
15
|
-
|
|
16
|
-
//////////////////////////////////////////////////////////////////////
|
|
17
|
-
// constants
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @typedef {object} OrganizationFundamentals
|
|
21
|
-
* @property {Array.string} Types Allowed organization types
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @typedef {object} Rates
|
|
26
|
-
* @property {string} Id
|
|
27
|
-
* @property {object} service_charge
|
|
28
|
-
* @property {number} service_charge.minimum
|
|
29
|
-
* @property {number} service_charge.rate - percentage
|
|
30
|
-
* @property {number} service_charge.rounding_factor
|
|
31
|
-
*/
|
|
32
|
-
/**
|
|
33
|
-
* @constant
|
|
34
|
-
* @type {Rates}
|
|
35
|
-
* @default
|
|
36
|
-
*/
|
|
37
|
-
const Rates = {
|
|
38
|
-
Id: null,
|
|
39
|
-
service_charge: {
|
|
40
|
-
minimum: 0,
|
|
41
|
-
rate: 0,
|
|
42
|
-
rounding_factor: 4,
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @typedef {object} PaymentProcessor
|
|
48
|
-
* @property {number} connected_active allowed active connections
|
|
49
|
-
* @property {number} processing_concurrency
|
|
50
|
-
* @property {number} processing_rate
|
|
51
|
-
* @property {number} processing_time_window
|
|
52
|
-
* @property {number} per_payout
|
|
53
|
-
* @property {number} rate_payout
|
|
54
|
-
* @property {number} rate_payout_scale
|
|
55
|
-
*/
|
|
56
|
-
//For Stripe, all below are in "CENTS"
|
|
57
|
-
/**
|
|
58
|
-
* @constant
|
|
59
|
-
* @type {PaymentProcessor}
|
|
60
|
-
* @default
|
|
61
|
-
*/
|
|
62
|
-
const paymentProcessor = {
|
|
63
|
-
connected_active: 200,
|
|
64
|
-
processing_concurrency: 10,
|
|
65
|
-
processing_rate: 25,
|
|
66
|
-
processing_time_window: 1000,
|
|
67
|
-
per_payout: 25,
|
|
68
|
-
rate_payout: 25,
|
|
69
|
-
rate_payout_scale: 10000,
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* @typedef {object} MCCType
|
|
74
|
-
* @property {string} Id
|
|
75
|
-
* @property {string} MCC - Merchant Class Code
|
|
76
|
-
* @property {string} name - Merchant Class Code
|
|
77
|
-
* @property {string} description - description of Merchant Class Code
|
|
78
|
-
* @property {string} long - long description of Merchant Class Code
|
|
79
|
-
* @property {string} type - Applicable business model - "Artists", "Venues" or "Brands"
|
|
80
|
-
*/
|
|
81
|
-
/**
|
|
82
|
-
* @constant
|
|
83
|
-
* @type {MCCType}
|
|
84
|
-
* @default
|
|
85
|
-
*/
|
|
86
|
-
const MCCDefault = {
|
|
87
|
-
Id: null,
|
|
88
|
-
MCC: null,
|
|
89
|
-
name: null,
|
|
90
|
-
description: null,
|
|
91
|
-
long: null,
|
|
92
|
-
type: null,
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* @typedef {object} BusinessType
|
|
97
|
-
* @property {string} Id
|
|
98
|
-
* @property {string} business_type - allowed business type value
|
|
99
|
-
* @property {string} name -business type value
|
|
100
|
-
* @property {string} description - description ofbusiness type value
|
|
101
|
-
*/
|
|
102
|
-
/**
|
|
103
|
-
* @constant
|
|
104
|
-
* @type {BusinessType}
|
|
105
|
-
* @default
|
|
106
|
-
*/
|
|
107
|
-
const BusinessTypeDefault = {
|
|
108
|
-
Id: null,
|
|
109
|
-
business_type: null,
|
|
110
|
-
name: null,
|
|
111
|
-
description: null,
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* @typedef {object} Fundamentals
|
|
116
|
-
* @property {Rates} Rates
|
|
117
|
-
* @property {PaymentProcessor} PaymentProcessor
|
|
118
|
-
* @property {object} Defaults
|
|
119
|
-
* @property {MCCType} Defaults.MCC
|
|
120
|
-
* @property {OrganizationFundamentals} Organizations
|
|
121
|
-
* @property {Array.string} Organizations.Types Allowed organization types
|
|
122
|
-
*/
|
|
123
|
-
|
|
124
|
-
Forms.Base[RATES] = Rates;
|
|
125
|
-
Forms.Base[PAYOUTRATES] = paymentProcessor;
|
|
126
|
-
Forms.Base[MCC] = MCCDefault;
|
|
127
|
-
Forms.Base[BUSINESS_TYPE] = BusinessTypeDefault;
|
|
128
|
-
|
|
129
|
-
//////////////////////////////////////////////////////////
|
|
130
|
-
// fetches
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* returns a Promise which resolves with an
|
|
134
|
-
* array of all Fundamentals Objects (or err)
|
|
135
|
-
* @returns {Promise<Fundamentals>}
|
|
136
|
-
*/
|
|
137
|
-
export async function fetchFundamentals() {
|
|
138
|
-
const fundamentals = await collectRecords(FUNDAMENTALS);
|
|
139
|
-
const fundamental_records = fundamentals.reduce((output, record) => {
|
|
140
|
-
const recordName = record.Id;
|
|
141
|
-
return record
|
|
142
|
-
? {
|
|
143
|
-
...output,
|
|
144
|
-
[recordName]: record,
|
|
145
|
-
}
|
|
146
|
-
: output;
|
|
147
|
-
}, {});
|
|
148
|
-
return fundamental_records;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* returns a Promise that resolves with the Rates record from the database
|
|
153
|
-
* @returns {Promise<Rates>}
|
|
154
|
-
*/
|
|
155
|
-
export async function fetchRates() {
|
|
156
|
-
const fundamentals = await fetchFundamentals();
|
|
157
|
-
return fundamentals[RATES];
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* returns a Promise that resolves with the Rates record from the database
|
|
162
|
-
* @returns {Promise<PaymentProcessor>}
|
|
163
|
-
*/
|
|
164
|
-
export async function fetchPayoutRates() {
|
|
165
|
-
const fundamental_records = await fetchFundamentals();
|
|
166
|
-
|
|
167
|
-
return fundamental_records[PAYOUTRATES];
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* returns an array of all MCC (Merchant Commerce Code) available
|
|
172
|
-
* @returns {Promise<Array.MCCType>}
|
|
173
|
-
*/
|
|
174
|
-
export async function fetchMCCs() {
|
|
175
|
-
return collectRecords(MCC, `${FUNDAMENTALS}/Defaults`);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* returns an array of all MCC (Merchant Commerce Code) available
|
|
180
|
-
* @returns {Promise<Array.BusinessType>}
|
|
181
|
-
*/
|
|
182
|
-
export async function fetchBusinessTypes() {
|
|
183
|
-
return collectRecords(BUSINESS_TYPE, `${FUNDAMENTALS}/Defaults`);
|
|
184
|
-
}
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Functions for managing (potentially)private data for a user or organization.
|
|
3
|
-
* Unified structure as a sub-record of fan, organization, or CityManager accounts
|
|
4
|
-
* @module PrivateData
|
|
5
|
-
*/
|
|
6
|
-
import {
|
|
7
|
-
fetchRecord,
|
|
8
|
-
typedWrite,
|
|
9
|
-
writeBack,
|
|
10
|
-
deleteRecordByRefPath,
|
|
11
|
-
} from "@leaddreamer/firebase-wrapper";
|
|
12
|
-
import { Forms, fillForm } from "@leaddreamer/staticforms";
|
|
13
|
-
import { PRIVATEDATA, ADDRESSES, USER, MCC } from "../boilerplate/index.js";
|
|
14
|
-
import { fetchAddresses } from "../Addresses/index.js";
|
|
15
|
-
|
|
16
|
-
//////////////////////////////////////////////////////////////////////
|
|
17
|
-
// definitions
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @external AddressType
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* @typedef {object} contact
|
|
24
|
-
* @property {?string} contact.Id
|
|
25
|
-
* @property {!string} contact.first_name
|
|
26
|
-
* @property {!string} contact.last_name
|
|
27
|
-
* @property {!string} contact.tel
|
|
28
|
-
* @property {?string} contact.email - must be filled in to make profile public
|
|
29
|
-
*/
|
|
30
|
-
/**
|
|
31
|
-
* @typedef {object} PrivateData
|
|
32
|
-
* @property {?string} email - must be filled in to make profile public
|
|
33
|
-
* @property {contact} contact
|
|
34
|
-
* @property {!string} tel
|
|
35
|
-
* @property {AddressType} business_address
|
|
36
|
-
* @property {AddressType} mailing_address
|
|
37
|
-
* @property {AddressType} billing_address
|
|
38
|
-
*/
|
|
39
|
-
/**
|
|
40
|
-
* @constant
|
|
41
|
-
* @type {PrivateData}
|
|
42
|
-
* @default
|
|
43
|
-
*/
|
|
44
|
-
const PrivateDefault = {
|
|
45
|
-
Id: null,
|
|
46
|
-
email: null,
|
|
47
|
-
contact: null,
|
|
48
|
-
business_address: null,
|
|
49
|
-
mailing_address: null,
|
|
50
|
-
billing_address: null,
|
|
51
|
-
tel: null,
|
|
52
|
-
tax_rate: null,
|
|
53
|
-
//tax_id: null,
|
|
54
|
-
openIssues: false,
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* @constant
|
|
59
|
-
* @type {PrivateData}
|
|
60
|
-
* @default
|
|
61
|
-
*/
|
|
62
|
-
const PrivateAccountForm = {
|
|
63
|
-
refPath: "hidden:text",
|
|
64
|
-
email: "email",
|
|
65
|
-
contact: `object:${USER}`,
|
|
66
|
-
business_address: `lookupLink:${ADDRESSES}`,
|
|
67
|
-
mailing_address: `lookupLink:${ADDRESSES}`,
|
|
68
|
-
billing_address: `lookupLink:${ADDRESSES}`,
|
|
69
|
-
tel: "tel",
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
Forms.Base[PRIVATEDATA] = PrivateDefault;
|
|
73
|
-
Forms.BaseForm[PRIVATEDATA] = PrivateAccountForm;
|
|
74
|
-
Forms.AccountForm[PRIVATEDATA] = PrivateAccountForm;
|
|
75
|
-
|
|
76
|
-
//////////////////////////////////////////////////////////////////////
|
|
77
|
-
// Utilities
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Fecthes the PrivateData (email, tel, addresses, etc) for a Fan account
|
|
81
|
-
* @param {AccountType} account
|
|
82
|
-
* @returns {Promise.PrivateData}
|
|
83
|
-
*/
|
|
84
|
-
export async function fetchPrivateData(account) {
|
|
85
|
-
let addresses = [];
|
|
86
|
-
try {
|
|
87
|
-
addresses = await fetchAddresses(account);
|
|
88
|
-
} catch (err) {}
|
|
89
|
-
const addressMap = new Map();
|
|
90
|
-
if (addresses.length) {
|
|
91
|
-
addresses.forEach((address) => {
|
|
92
|
-
addressMap.set(address.Id, address);
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
let privateData = await fetchRecord(
|
|
97
|
-
PRIVATEDATA,
|
|
98
|
-
account.Id,
|
|
99
|
-
account.refPath,
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
let addressEntries = {};
|
|
103
|
-
["business_address", "billing_address", "mailing_address"].forEach(
|
|
104
|
-
(entry) => {
|
|
105
|
-
const isLink =
|
|
106
|
-
entry && privateData[entry] && !privateData[entry]?.address_line_1;
|
|
107
|
-
if (isLink) {
|
|
108
|
-
addressEntries[entry] = {
|
|
109
|
-
...addressMap.get(privateData[entry]),
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
); //hacky way to repeat same effort
|
|
114
|
-
|
|
115
|
-
privateData = {
|
|
116
|
-
...privateData,
|
|
117
|
-
...addressEntries
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
return privateData;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* @external WriteBatch
|
|
125
|
-
* @typedef {WriteBatch|Transaction|void} ChainType
|
|
126
|
-
*/
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* @async
|
|
130
|
-
* @function
|
|
131
|
-
* @static
|
|
132
|
-
* Creates the Business information document
|
|
133
|
-
* @param {AccountType} account
|
|
134
|
-
* @param {?ChainType} batch - batching object. Transaction will be added to the batch
|
|
135
|
-
* @returns {Promise<ChainType>} WriteBatch, Transaction or Void
|
|
136
|
-
*/
|
|
137
|
-
export async function createPrivateData(account, batch = null) {
|
|
138
|
-
return typedWrite(
|
|
139
|
-
{
|
|
140
|
-
...Forms.Base[PRIVATEDATA],
|
|
141
|
-
...fillForm(account, PRIVATEDATA), //sanitize
|
|
142
|
-
}, //data
|
|
143
|
-
account, //parent
|
|
144
|
-
PRIVATEDATA, //type
|
|
145
|
-
batch,
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Writes the "private" data to the database
|
|
151
|
-
* @param {PrivateData} privateData
|
|
152
|
-
* @returns {Promise<PrivateData>}
|
|
153
|
-
*/
|
|
154
|
-
export async function savePrivateData(privateData, batch = null) {
|
|
155
|
-
return writeBack(privateData, batch);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Deletes a PrivateData record (rarely used if ever)
|
|
160
|
-
* @param {PrivateData} privateData
|
|
161
|
-
* @param {!string} privateData.refPath
|
|
162
|
-
* @returns {Promise<void>}
|
|
163
|
-
*/
|
|
164
|
-
export async function deletePrivateData(privateData, batch = null) {
|
|
165
|
-
return deleteRecordByRefPath(privateData.refPath, batch);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* creates the "base path" (refPath) to store addresses based on an account (refPath)
|
|
170
|
-
* @param {Record} account
|
|
171
|
-
* @param {!string} account.refPath
|
|
172
|
-
* @returns {string}
|
|
173
|
-
*/
|
|
174
|
-
export function privateDataPath(account) {
|
|
175
|
-
return `${account.refPath}/${PRIVATEDATA}/${account.Id}`;
|
|
176
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
require("./InventoryLogic.fcbfca1e.js");var $bKryG$leaddreamerfirebasewrapper=require("@leaddreamer/firebase-wrapper"),$bKryG$leaddreamerstaticforms=require("@leaddreamer/staticforms");function $parcel$export(e,r,c,$){Object.defineProperty(e,r,{get:c,set:$,enumerable:!0,configurable:!0})}var $parcel$global=globalThis,$parcel$modules={},$parcel$inits={},parcelRequire=$parcel$global.parcelRequire3c55;null==parcelRequire&&((parcelRequire=function(e){if(e in $parcel$modules)return $parcel$modules[e].exports;if(e in $parcel$inits){var r=$parcel$inits[e];delete $parcel$inits[e];var c={id:e,exports:{}};return $parcel$modules[e]=c,r.call(c.exports,c,c.exports),c.exports}var $=Error("Cannot find module '"+e+"'");throw $.code="MODULE_NOT_FOUND",$}).register=function(e,r){$parcel$inits[e]=r},$parcel$global.parcelRequire3c55=parcelRequire);var parcelRegister=parcelRequire.register;$parcel$export(module.exports,"ERROR_TYPES",()=>$72c4f8f57d854ccf$export$63d334e60537ba01),$parcel$export(module.exports,"PaymentDefault",()=>$72c4f8f57d854ccf$export$25824cbb4751202b),$parcel$export(module.exports,"paymentDescriptor",()=>$72c4f8f57d854ccf$export$1dc3fa0a524d39c3),$parcel$export(module.exports,"receiptDefault",()=>$72c4f8f57d854ccf$export$a5734ae35e42ad51),$parcel$export(module.exports,"createPaymentRecord",()=>$72c4f8f57d854ccf$export$e7759a8c3eb8b251),$parcel$export(module.exports,"savePaymentData",()=>$72c4f8f57d854ccf$export$f034950df5cadf57),$parcel$export(module.exports,"fetchPayment",()=>$72c4f8f57d854ccf$export$81ed014c52470b45),$parcel$export(module.exports,"fetchPaymentByUser",()=>$72c4f8f57d854ccf$export$bf9a06d1f6c31bf4),$parcel$export(module.exports,"addPaymentDescriptor",()=>$72c4f8f57d854ccf$export$e5cc111dc11d988),$parcel$export(module.exports,"savePaymentDescriptor",()=>$72c4f8f57d854ccf$export$218f64344bb0d5b1),$parcel$export(module.exports,"removePaymentDescriptor",()=>$72c4f8f57d854ccf$export$2edf51a087d55c34),$parcel$export(module.exports,"fetchPDByFingerprint",()=>$72c4f8f57d854ccf$export$719d384deb9d4a1d),$parcel$export(module.exports,"fetchPaymentDescriptors",()=>$72c4f8f57d854ccf$export$e67def8f84ea0ce8),$parcel$export(module.exports,"listPDSummaries",()=>$72c4f8f57d854ccf$export$afe4f672b985ac26),$parcel$export(module.exports,"fetchLatestPDSummary",()=>$72c4f8f57d854ccf$export$46296a85983d5325),$parcel$export(module.exports,"fetchPDByOwnerType",()=>$72c4f8f57d854ccf$export$c10d531939e9952c),$parcel$export(module.exports,"replaceDefaultPDSummary",()=>$72c4f8f57d854ccf$export$6495802cd4961871),$parcel$export(module.exports,"saveReceiptRecord",()=>$72c4f8f57d854ccf$export$4c730f12f97432c2),$parcel$export(module.exports,"updateReceipt",()=>$72c4f8f57d854ccf$export$9d597d6207d02073),$parcel$export(module.exports,"saveReceiptRecordByOwnerType",()=>$72c4f8f57d854ccf$export$16e7bde1d3e4806e),$parcel$export(module.exports,"anyReceiptsByMonthStamp",()=>$72c4f8f57d854ccf$export$be8e05196fbdd05c),$parcel$export(module.exports,"fetchReceiptsFiltered",()=>$72c4f8f57d854ccf$export$4eb0e1031e4cb663),$parcel$export(module.exports,"saveReceiptRecordByChild",()=>$72c4f8f57d854ccf$export$9612333da9eb2b55),$parcel$export(module.exports,"fetchProblemReceipts",()=>$72c4f8f57d854ccf$export$f9dd3c42a9fe0ec7),$parcel$export(module.exports,"fetchPledgeTicketReceipt",()=>$72c4f8f57d854ccf$export$912a34b09f6646f6),$parcel$export(module.exports,"markReceiptFromPledgeTicket",()=>$72c4f8f57d854ccf$export$cc5e46e81267707d),$parcel$export(module.exports,"markReceipt",()=>$72c4f8f57d854ccf$export$b31aae8a995874b9);var $fjZig=parcelRequire("fjZig");const $72c4f8f57d854ccf$export$63d334e60537ba01={CARD_ERROR:"card_error",VALIDATION_ERROR:"validation_error"},$72c4f8f57d854ccf$export$25824cbb4751202b={Id:null,payment_gateway:null,status:null},$72c4f8f57d854ccf$export$1dc3fa0a524d39c3={Id:null,paymentMethod:null,fingerprint:null,label:null,nickname:null},$72c4f8f57d854ccf$export$a5734ae35e42ad51={Id:null,amount:0,payment:{link:null,paidQ:null},description:null};async function $72c4f8f57d854ccf$export$e7759a8c3eb8b251(e,r=null){return(0,$bKryG$leaddreamerfirebasewrapper.typedWrite)((0,$bKryG$leaddreamerstaticforms.cleanType)(e,$fjZig.PAYMENT),e,$fjZig.PAYMENT,r)}async function $72c4f8f57d854ccf$export$f034950df5cadf57(e){return(0,$bKryG$leaddreamerfirebasewrapper.writeBack)({...e})}async function $72c4f8f57d854ccf$export$81ed014c52470b45(e){let r=null;try{r=await (0,$bKryG$leaddreamerfirebasewrapper.fetchRecord)($fjZig.PAYMENT,e.Id,e.refPath)}catch(e){}return r}async function $72c4f8f57d854ccf$export$bf9a06d1f6c31bf4(e){return $72c4f8f57d854ccf$export$81ed014c52470b45({Id:e,refPath:`${USER}/${e}`})}async function $72c4f8f57d854ccf$export$e5cc111dc11d988(e,r,c=null){return(0,$bKryG$leaddreamerfirebasewrapper.typedWrite)({...r,timestamp:$bKryG$leaddreamerfirebasewrapper.serverTimestampFieldValue},{refPath:`${e.refPath}/${$fjZig.PAYMENT}/${e.Id}`},$fjZig.CARDS,c)}async function $72c4f8f57d854ccf$export$218f64344bb0d5b1(e){return(0,$bKryG$leaddreamerfirebasewrapper.writeBack)({...e,timestamp:$bKryG$leaddreamerfirebasewrapper.serverTimestampFieldValue})}async function $72c4f8f57d854ccf$export$2edf51a087d55c34(e,r){return(await $72c4f8f57d854ccf$export$719d384deb9d4a1d(e,r.fingerprint)).paymentMethod===r.paymentMethod?(0,$bKryG$leaddreamerfirebasewrapper.deleteRecord)(r,$fjZig.CARDS,`/${e.refPath}/${$fjZig.PAYMENT}/${e.Id}`):Promise.resolve(null)}async function $72c4f8f57d854ccf$export$e67def8f84ea0ce8(e){return(0,$bKryG$leaddreamerfirebasewrapper.collectRecords)($fjZig.CARDS,`${e.refPath}/${$fjZig.PAYMENT}/${e.Id}`)}async function $72c4f8f57d854ccf$export$afe4f672b985ac26(e){return(await $72c4f8f57d854ccf$export$e67def8f84ea0ce8(e)).map(e=>({Id:e.Id,label:e.label,nickname:e.nickname}))}async function $72c4f8f57d854ccf$export$46296a85983d5325(e){let r=await (0,$bKryG$leaddreamerfirebasewrapper.collectRecordsByFilter)($fjZig.CARDS,`/${e.refPath}/${$fjZig.PAYMENT}/${e.Id}`,null,[{fieldRef:"timestamp",dirStr:"desc"}],1),c=r?.[0];return{Id:c?.Id,label:c?.label}}async function $72c4f8f57d854ccf$export$719d384deb9d4a1d(e,r){return(0,$bKryG$leaddreamerfirebasewrapper.fetchRecord)($fjZig.CARDS,r,`/${e.refPath}/${$fjZig.PAYMENT}/${e.Id}`)}async function $72c4f8f57d854ccf$export$c10d531939e9952c(e,r,c){return(0,$bKryG$leaddreamerfirebasewrapper.fetchRecord)($fjZig.CARDS,c,`/${r}/${e}/${$fjZig.PAYMENT}/${e}`)}async function $72c4f8f57d854ccf$export$6495802cd4961871(e,r=null){let c=await (r?Promise.resolve(r):$72c4f8f57d854ccf$export$46296a85983d5325(e));return(0,$bKryG$leaddreamerfirebasewrapper.writeBack)({...e,payment_method:c})}async function $72c4f8f57d854ccf$export$4c730f12f97432c2(e,r,c=null){return(0,$bKryG$leaddreamerfirebasewrapper.typedWrite)(r,e,$fjZig.RECEIPTS,c)}async function $72c4f8f57d854ccf$export$9d597d6207d02073(e){return(0,$bKryG$leaddreamerfirebasewrapper.writeBack)(e)}async function $72c4f8f57d854ccf$export$16e7bde1d3e4806e(e,r,c,$=null){return $72c4f8f57d854ccf$export$4c730f12f97432c2((0,$bKryG$leaddreamerfirebasewrapper.ownerByOwnerType)(e,r),c,$)}async function $72c4f8f57d854ccf$export$be8e05196fbdd05c(e,r){try{return!!(await $72c4f8f57d854ccf$export$4eb0e1031e4cb663(e,[{fieldRef:"monthStamp",opStr:"==",value:r}])).length}catch(e){return!1}}async function $72c4f8f57d854ccf$export$9612333da9eb2b55(e,r,c=null){return $72c4f8f57d854ccf$export$4c730f12f97432c2((0,$bKryG$leaddreamerfirebasewrapper.ownerByChild)(e),r,c)}async function $72c4f8f57d854ccf$export$4eb0e1031e4cb663(e,r=null,c=null,$=null){return(0,$bKryG$leaddreamerfirebasewrapper.collectRecordsByFilter)($fjZig.RECEIPTS,e.refPath,r,c,$)}async function $72c4f8f57d854ccf$var$fetchReceipt(e,r){return(0,$bKryG$leaddreamerfirebasewrapper.fetchRecord)($fjZig.RECEIPTS,r,e.refPath)}async function $72c4f8f57d854ccf$export$f9dd3c42a9fe0ec7(e){return $72c4f8f57d854ccf$export$4eb0e1031e4cb663(e,[{fieldRef:"payment.paidQ",opStr:"not-in",value:["succeeded","none"]}],null,null)}async function $72c4f8f57d854ccf$export$912a34b09f6646f6(e){return $72c4f8f57d854ccf$var$fetchReceipt({Id:e.fan.Id,refPath:`/${USER}/${e.fan.Id}`},e.Id)}async function $72c4f8f57d854ccf$export$cc5e46e81267707d(e,r){return $72c4f8f57d854ccf$export$b31aae8a995874b9(await $72c4f8f57d854ccf$export$912a34b09f6646f6(e),r)}async function $72c4f8f57d854ccf$export$b31aae8a995874b9(e,r){return $72c4f8f57d854ccf$export$9d597d6207d02073({...e,payment:{...e.payment,paidQ:r}})}$bKryG$leaddreamerstaticforms.Forms.Base[$fjZig.PAYMENT]=$72c4f8f57d854ccf$export$25824cbb4751202b;
|
|
2
|
-
//# sourceMappingURL=InventoryLogic.09daaeaa.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
require("./InventoryLogic.4e7559ed.js");var $9MgJg$leaddreamerfirebasewrapper=require("@leaddreamer/firebase-wrapper"),$9MgJg$leaddreamerstaticforms=require("@leaddreamer/staticforms");function $parcel$export(e,r,a,$){Object.defineProperty(e,r,{get:a,set:$,enumerable:!0,configurable:!0})}var $parcel$global=globalThis,$parcel$modules={},$parcel$inits={},parcelRequire=$parcel$global.parcelRequire3c55;null==parcelRequire&&((parcelRequire=function(e){if(e in $parcel$modules)return $parcel$modules[e].exports;if(e in $parcel$inits){var r=$parcel$inits[e];delete $parcel$inits[e];var a={id:e,exports:{}};return $parcel$modules[e]=a,r.call(a.exports,a,a.exports),a.exports}var $=Error("Cannot find module '"+e+"'");throw $.code="MODULE_NOT_FOUND",$}).register=function(e,r){$parcel$inits[e]=r},$parcel$global.parcelRequire3c55=parcelRequire);var parcelRegister=parcelRequire.register;$parcel$export(module.exports,"saveUnit",()=>$21a1b285de41e049$export$6322d3908ccefadc);var $fjZig=parcelRequire("fjZig");const $21a1b285de41e049$var$UnitDefault={Id:null,refPath:null,unit:null,ratio:1,otherUnit:null,system:null},$21a1b285de41e049$var$UnitForm={unit:"text",ratio:"number",otherUnit:`lookup:${$fjZig.UNITS}`,system:"string"},$21a1b285de41e049$var$UnitData={unit:"science.unit",otherUnit:"science.unit",ratio:1};async function $21a1b285de41e049$export$6322d3908ccefadc(e){return(0,$9MgJg$leaddreamerfirebasewrapper.writeRecord)($fjZig.UNITS,e)}function $21a1b285de41e049$var$summarizeUnit(e){return`${e?.name||e?.Id}`}$9MgJg$leaddreamerstaticforms.Forms.Base[$fjZig.UNITS]=$21a1b285de41e049$var$UnitDefault,$9MgJg$leaddreamerstaticforms.Forms.BaseForm[$fjZig.UNITS]=$21a1b285de41e049$var$UnitForm,$9MgJg$leaddreamerstaticforms.Forms.CreateForm[$fjZig.UNITS]=$21a1b285de41e049$var$UnitForm,$9MgJg$leaddreamerstaticforms.Forms.Data[$fjZig.UNITS]=$21a1b285de41e049$var$UnitData,$9MgJg$leaddreamerstaticforms.Forms.Summarize[$fjZig.UNITS]=$21a1b285de41e049$var$summarizeUnit,$9MgJg$leaddreamerstaticforms.Forms.Save[$fjZig.UNITS]=$21a1b285de41e049$export$6322d3908ccefadc,$9MgJg$leaddreamerstaticforms.Forms.SearchBy[$fjZig.UNITS]="name";
|
|
2
|
-
//# sourceMappingURL=InventoryLogic.0ba84fa7.js.map
|