merchi_sdk_js 0.0.1

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.
Files changed (173) hide show
  1. package/dist/address.js +109 -0
  2. package/dist/assignment.js +175 -0
  3. package/dist/automatic_payment_relationship.js +72 -0
  4. package/dist/backup.js +32 -0
  5. package/dist/bank.js +25 -0
  6. package/dist/cart.js +133 -0
  7. package/dist/cart_item.js +71 -0
  8. package/dist/cart_shipment_group.js +23 -0
  9. package/dist/cart_shipment_quote.js +26 -0
  10. package/dist/category.js +68 -0
  11. package/dist/company.js +248 -0
  12. package/dist/company_invitation.js +70 -0
  13. package/dist/component.js +107 -0
  14. package/dist/component_tag.js +60 -0
  15. package/dist/component_version.js +21 -0
  16. package/dist/country_tax.js +93 -0
  17. package/dist/dictionary.js +130 -0
  18. package/dist/discount.js +22 -0
  19. package/dist/discount_group.js +18 -0
  20. package/dist/domain.js +245 -0
  21. package/dist/domain_invitation.js +17 -0
  22. package/dist/domain_tag.js +87 -0
  23. package/dist/domain_types.js +22 -0
  24. package/dist/draft.js +97 -0
  25. package/dist/draft_comment.js +45 -0
  26. package/dist/draft_template.js +39 -0
  27. package/dist/email_address.js +34 -0
  28. package/dist/email_counter.js +47 -0
  29. package/dist/enrolled_domain.js +88 -0
  30. package/dist/exchange_rate.js +66 -0
  31. package/dist/field_types.js +19 -0
  32. package/dist/helpers.js +86 -0
  33. package/dist/internal_tag.js +98 -0
  34. package/dist/inventory.js +100 -0
  35. package/dist/inventory_unit_variation.js +19 -0
  36. package/dist/invoice.js +225 -0
  37. package/dist/invoice_types.js +11 -0
  38. package/dist/item.js +25 -0
  39. package/dist/job.js +536 -0
  40. package/dist/job_comment.js +45 -0
  41. package/dist/job_status.js +47 -0
  42. package/dist/matching_inventory.js +21 -0
  43. package/dist/md5.js +149 -0
  44. package/dist/menu.js +37 -0
  45. package/dist/menu_item.js +24 -0
  46. package/dist/merchi.js +1004 -0
  47. package/dist/merchi_file.js +165 -0
  48. package/dist/model.js +753 -0
  49. package/dist/notification.js +151 -0
  50. package/dist/notification_types.js +199 -0
  51. package/dist/output.cjs.js +31317 -0
  52. package/dist/output.esm.js +31312 -0
  53. package/dist/page.js +41 -0
  54. package/dist/payment.js +32 -0
  55. package/dist/payment_device.js +21 -0
  56. package/dist/payment_types.js +20 -0
  57. package/dist/phone_number.js +37 -0
  58. package/dist/product.js +288 -0
  59. package/dist/product_types.js +32 -0
  60. package/dist/production_comment.js +44 -0
  61. package/dist/quote.js +91 -0
  62. package/dist/quote_item.js +59 -0
  63. package/dist/roles.js +29 -0
  64. package/dist/seo_domain_page.js +42 -0
  65. package/dist/session.js +103 -0
  66. package/dist/set.js +29 -0
  67. package/dist/shipment.js +181 -0
  68. package/dist/shipment_item.js +17 -0
  69. package/dist/shipment_item_fulfillment.js +17 -0
  70. package/dist/shipment_method.js +81 -0
  71. package/dist/shipment_method_variation.js +38 -0
  72. package/dist/subscription_plan.js +75 -0
  73. package/dist/supply_domain.js +65 -0
  74. package/dist/system_role.js +12 -0
  75. package/dist/theme.js +180 -0
  76. package/dist/theme_css_setting.js +61 -0
  77. package/dist/theme_status.js +11 -0
  78. package/dist/user.js +409 -0
  79. package/dist/user_company.js +19 -0
  80. package/dist/user_types.js +23 -0
  81. package/dist/uuid.js +12 -0
  82. package/dist/variation.js +233 -0
  83. package/dist/variation_field.js +233 -0
  84. package/dist/variation_fields_option.js +41 -0
  85. package/dist/variation_option.js +62 -0
  86. package/dist/variations_group.js +43 -0
  87. package/dist/white_label_accessibilities.js +11 -0
  88. package/package.json +30 -0
  89. package/src/address.js +107 -0
  90. package/src/assignment.js +165 -0
  91. package/src/automatic_payment_relationship.js +65 -0
  92. package/src/backup.js +29 -0
  93. package/src/bank.js +21 -0
  94. package/src/cart.js +131 -0
  95. package/src/cart_item.js +71 -0
  96. package/src/cart_shipment_group.js +20 -0
  97. package/src/cart_shipment_quote.js +23 -0
  98. package/src/category.js +62 -0
  99. package/src/company.js +267 -0
  100. package/src/company_invitation.js +63 -0
  101. package/src/component.js +100 -0
  102. package/src/component_tag.js +53 -0
  103. package/src/component_version.js +17 -0
  104. package/src/country_tax.js +89 -0
  105. package/src/dictionary.js +135 -0
  106. package/src/discount.js +19 -0
  107. package/src/discount_group.js +15 -0
  108. package/src/domain.js +254 -0
  109. package/src/domain_invitation.js +13 -0
  110. package/src/domain_tag.js +79 -0
  111. package/src/domain_types.js +18 -0
  112. package/src/draft.js +92 -0
  113. package/src/draft_comment.js +41 -0
  114. package/src/draft_template.js +35 -0
  115. package/src/email_address.js +27 -0
  116. package/src/email_counter.js +42 -0
  117. package/src/enrolled_domain.js +79 -0
  118. package/src/exchange_rate.js +61 -0
  119. package/src/field_types.js +15 -0
  120. package/src/helpers.js +81 -0
  121. package/src/internal_tag.js +90 -0
  122. package/src/inventory.js +99 -0
  123. package/src/inventory_unit_variation.js +18 -0
  124. package/src/invoice.js +224 -0
  125. package/src/invoice_types.js +7 -0
  126. package/src/item.js +22 -0
  127. package/src/job.js +616 -0
  128. package/src/job_comment.js +41 -0
  129. package/src/job_status.js +51 -0
  130. package/src/matching_inventory.js +17 -0
  131. package/src/md5.js +162 -0
  132. package/src/menu.js +32 -0
  133. package/src/menu_item.js +22 -0
  134. package/src/merchi.js +1074 -0
  135. package/src/merchi_file.js +163 -0
  136. package/src/model.js +820 -0
  137. package/src/notification.js +153 -0
  138. package/src/notification_types.js +246 -0
  139. package/src/page.js +38 -0
  140. package/src/payment.js +32 -0
  141. package/src/payment_device.js +17 -0
  142. package/src/payment_types.js +18 -0
  143. package/src/phone_number.js +30 -0
  144. package/src/product.js +309 -0
  145. package/src/product_types.js +28 -0
  146. package/src/production_comment.js +40 -0
  147. package/src/quote.js +89 -0
  148. package/src/quote_item.js +51 -0
  149. package/src/roles.js +27 -0
  150. package/src/seo_domain_page.js +35 -0
  151. package/src/session.js +102 -0
  152. package/src/set.js +28 -0
  153. package/src/shipment.js +191 -0
  154. package/src/shipment_item.js +13 -0
  155. package/src/shipment_item_fulfillment.js +13 -0
  156. package/src/shipment_method.js +73 -0
  157. package/src/shipment_method_variation.js +34 -0
  158. package/src/subscription_plan.js +68 -0
  159. package/src/supply_domain.js +60 -0
  160. package/src/system_role.js +8 -0
  161. package/src/theme.js +188 -0
  162. package/src/theme_css_setting.js +54 -0
  163. package/src/theme_status.js +6 -0
  164. package/src/user.js +442 -0
  165. package/src/user_company.js +15 -0
  166. package/src/user_types.js +19 -0
  167. package/src/uuid.js +3 -0
  168. package/src/variation.js +257 -0
  169. package/src/variation_field.js +261 -0
  170. package/src/variation_fields_option.js +41 -0
  171. package/src/variation_option.js +59 -0
  172. package/src/variations_group.js +43 -0
  173. package/src/white_label_accessibilities.js +6 -0
package/src/merchi.js ADDED
@@ -0,0 +1,1074 @@
1
+ import { isBrowser } from 'browser-or-node';
2
+ import { generateUUID } from './uuid.js';
3
+ import { isNull, isUndefined, isUndefinedOrNull, id,
4
+ notEmptyArray, isArray, removeObjectFromArrayWithIntegerValue,
5
+ sortArrayByObjectKey, getGlobal } from './helpers.js';
6
+ import { addPropertyTo, serialise, fromJsonList, forEachProperty,
7
+ fromJson, Request, create } from './model.js';
8
+ import { jobStatusProduction, jobPriority } from './job_status.js';
9
+ import { roles, systemRoles } from './roles.js';
10
+ import { domainTypes } from './domain_types.js';
11
+ import { productTypes, productTypesInts } from './product_types.js';
12
+ import { paymentTypes, paymentTypeIds } from './payment_types.js';
13
+ import { Dictionary } from './dictionary.js';
14
+ import { fieldTypes } from './field_types.js';
15
+ import { notificationTypes, notificationSectionCodes, notificationSection,
16
+ notificationSectionKey, notificationSectionClass,
17
+ notificationSectionIconClass } from './notification_types.js';
18
+ import { Address, Addresses } from './address.js';
19
+ import { Assignment, Assignments } from './assignment.js';
20
+ import {
21
+ AutomaticPaymentRelationship,
22
+ AutomaticPaymentRelationships,
23
+ } from './automatic_payment_relationship.js';
24
+ import { Backup, Backups } from './backup.js';
25
+ import { Bank } from './bank.js';
26
+ import { Category, Categories } from './category.js';
27
+ import { Cart } from './cart.js';
28
+ import { CartItem } from './cart_item.js';
29
+ import { CountryTax, CountryTaxes, NoTaxEntity } from './country_tax.js';
30
+ import { Company, Companies } from './company.js';
31
+ import { CompanyInvitation, CompanyInvitations } from './company_invitation.js';
32
+ import { Component, Components } from './component.js';
33
+ import { ComponentTag, ComponentTags } from './component_tag.js';
34
+ import { Discount } from './discount.js';
35
+ import { DiscountGroup } from './discount_group.js';
36
+ import { Domain, Domains } from './domain.js';
37
+ import { DomainTag, DomainTags } from './domain_tag.js';
38
+ import { DomainInvitation } from './domain_invitation.js';
39
+ import { Draft, Drafts } from './draft.js';
40
+ import { DraftTemplate } from './draft_template.js';
41
+ import { DraftComment } from './draft_comment.js';
42
+ import { EnrolledDomain, EnrolledDomains } from './enrolled_domain.js';
43
+ import { EmailAddress, EmailAddresses } from './email_address.js';
44
+ import { EmailCounter, EmailCounters } from './email_counter.js';
45
+ import { ExchangeRate, ExchangeRates } from './exchange_rate.js';
46
+ import { Item } from './item.js';
47
+ import { Inventory, Inventories } from './inventory.js';
48
+ import { InventoryUnitVariation } from './inventory_unit_variation.js';
49
+ import { MatchingInventory } from './matching_inventory.js';
50
+ import { Notification, Notifications } from './notification.js';
51
+ import { Invoice, Invoices } from './invoice.js';
52
+ import { Job, Jobs } from './job.js';
53
+ import { JobComment } from './job_comment.js';
54
+ import { MerchiFile, MerchiFiles } from './merchi_file.js';
55
+ import { Menu } from './menu.js';
56
+ import { MenuItem } from './menu_item.js';
57
+ import { Page } from './page.js';
58
+ import { Payment } from './payment.js';
59
+ import { Product, Products } from './product.js';
60
+ import { ProductionComment } from './production_comment.js';
61
+ import { PhoneNumber, PhoneNumbers } from './phone_number.js';
62
+ import { Session, Sessions } from './session.js';
63
+ import { Shipment, Shipments } from './shipment.js';
64
+ import { ShipmentMethod, ShipmentMethods } from './shipment_method.js';
65
+ import { ShipmentMethodVariation, ShipmentMethodVariations } from
66
+ './shipment_method_variation.js';
67
+ import { SubscriptionPlan, SubscriptionPlans } from './subscription_plan.js';
68
+ import { SupplyDomain, SupplyDomains } from './supply_domain.js';
69
+ import { SystemRole } from './system_role.js';
70
+ import { Theme, Themes } from './theme.js';
71
+ import { User, Users } from './user.js';
72
+ import { userTypes } from './user_types.js';
73
+ import { UserCompany } from './user_company.js';
74
+ import { Variation } from './variation.js';
75
+ import { VariationField } from './variation_field.js';
76
+ import { VariationFieldsOption } from './variation_fields_option.js';
77
+ import { VariationsGroup } from './variations_group.js';
78
+ import { QuoteItem, QuoteItems } from './quote_item.js';
79
+ import { Quotes, Quote } from './quote.js';
80
+ import { InternalTag, InternalTags } from './internal_tag.js';
81
+
82
+ export function merchi(backendUri, websocketUri) {
83
+ getGlobal().merchiJsonpHandlers = {};
84
+ getGlobal().merchiBackendUri = backendUri;
85
+ getGlobal().merchiSubscriptionManager = new SubscriptionManager();
86
+
87
+ function isJSON(x) {
88
+ return typeof x === 'object' && x !== null &&
89
+ !(x instanceof Array) && !(x instanceof Date);
90
+ }
91
+
92
+ function isFunction(x) {
93
+ return typeof x === 'function';
94
+ }
95
+
96
+ function indexOfEntityInArrayByAttribute(attributeName, array, entity) {
97
+ return array.findIndex(function(ent) {
98
+ return entity[attributeName]() === ent[attributeName]();
99
+ });
100
+ }
101
+
102
+ function indexOfEntityInArrayById(array, entity) {
103
+ return indexOfEntityInArrayByAttribute('id', array, entity);
104
+ }
105
+
106
+ function indexOfEntityInArrayByName(array, entity) {
107
+ return indexOfEntityInArrayByAttribute('name', array, entity);
108
+ }
109
+
110
+ function displayMoney(amount) {
111
+ return parseFloat(amount).toFixed(2);
112
+ }
113
+
114
+ function SubscriptionManager() {
115
+
116
+ var socket = null,
117
+ subscriptions = new Dictionary();
118
+
119
+ function handleUpdate(data) {
120
+ var handler = subscriptions.get(data.subscriptionToken, null);
121
+ if (handler !== null) {
122
+ handler(data.statusCode, data.data);
123
+ }
124
+ }
125
+
126
+ function getSocket() {
127
+ if (socket === null) {
128
+ socket = io.connect(websocketUri);
129
+ socket.on('update', handleUpdate);
130
+ }
131
+ return socket;
132
+ }
133
+
134
+ function emit(name, data) {
135
+ getSocket().emit(name, data);
136
+ }
137
+
138
+ this.subscribe = function (eventTypes, uri, method, onUpdate) {
139
+ var subscriptionToken = generateUUID();
140
+ subscriptions.add(subscriptionToken, onUpdate);
141
+ emit('subscribe', {eventTypes: eventTypes,
142
+ method: method,
143
+ subscriptionToken: subscriptionToken,
144
+ uri: uri});
145
+ return subscriptionToken;
146
+ };
147
+
148
+ this.unsubscribe = function (subscriptionToken) {
149
+ subscriptions.remove(subscriptionToken);
150
+ emit('unsubscribe', {subscriptionToken: subscriptionToken});
151
+ };
152
+ }
153
+
154
+ /** Closures and file scope vars **/
155
+ var roleStrings = new Dictionary(),
156
+ roleCssClass = new Dictionary(),
157
+ rights = new Dictionary(),
158
+ eventTypes = new Dictionary(),
159
+ itemTypes = new Dictionary(),
160
+ priorityLevels = new Dictionary(),
161
+ priorityLevelsOptions = new Dictionary(),
162
+ shipmentCompanies = new Dictionary(),
163
+ productTypesSeller = new Dictionary(),
164
+ notificationAvatar = new Dictionary(),
165
+ inventoryStatuses = new Dictionary(),
166
+ themeFoundation = new Dictionary(),
167
+ inputTypes = new Dictionary(),
168
+ fieldTypesString = new Dictionary(),
169
+ menuType = new Dictionary(),
170
+ menuTypeCodes = new Dictionary(),
171
+ menuItemType = new Dictionary(),
172
+ menuItemTypeCodes = new Dictionary(),
173
+ currentUserEmbed = {'emailAddresses': {},
174
+ 'profilePicture': {},
175
+ 'userCompanies': {"company": {}},
176
+ 'enrolledDomains': {'domain': {}}},
177
+ platformName = 'Merchi',
178
+ platformCopyright = 2023,
179
+ platformSellerDomain = 'merchi.co',
180
+ platformSellerDomainPlus = 'merchi.co',
181
+ backendImgUri = backendUri + 'static/img/',
182
+ platformIcon = backendImgUri + 'merchi-monster-blue.png',
183
+ platformLogo = backendImgUri + 'merchi-master-colour-with-monster.png',
184
+ defaultUserAvatar = backendImgUri + 'default-user-32px.jpg',
185
+ STATUS = {
186
+ PROD: ['Init', 'Rejected', 'Quoteding', 'Waiting Quote',
187
+ 'Close Deadline', 'Assigned', 'Questioning', 'Commenced',
188
+ 'Finish', 'Shipped'],
189
+ DESIGN: ['not start', 'started', 'changes request',
190
+ 'waiting for check', 'approved'],
191
+ PAYMENT: ['Not Paid', 'Partially Paid', 'Fully Paid']
192
+ },
193
+ GSTrate = 0.1,
194
+ DEFAULT_RIGHTS = [];
195
+
196
+ roles.each(function (key, value) {
197
+ roleStrings.add(value, key);
198
+ });
199
+
200
+ roleCssClass.add(roles.get('public'), 'default');
201
+ roleCssClass.add(roles.get('admin'), 'inverse');
202
+ roleCssClass.add(roles.get('sales'), 'success');
203
+ roleCssClass.add(roles.get('designer'), 'success');
204
+ roleCssClass.add(roles.get('supplier'), 'warning');
205
+ roleCssClass.add(roles.get('client'), 'danger');
206
+ roleCssClass.add(roles.get('manager'), 'primary');
207
+ roleCssClass.add(roles.get('accountant'), 'info');
208
+
209
+ inputTypes.add(1, "text");
210
+ inputTypes.add(2, "select");
211
+ inputTypes.add(3, "file");
212
+ inputTypes.add(4, "textarea");
213
+ inputTypes.add(5, "number");
214
+ inputTypes.add(6, "checkbox");
215
+ inputTypes.add(7, "radio");
216
+ inputTypes.add(8, "instructions");
217
+ inputTypes.add(9, "image select");
218
+ inputTypes.add(10, "colour picker");
219
+ inputTypes.add(11, "colour select");
220
+
221
+ fieldTypesString.add(1, "TEXT_INPUT");
222
+ fieldTypesString.add(2, "SELECT");
223
+
224
+ themeFoundation.add("NO_FOUNDATION", 0);
225
+ themeFoundation.add("BOOTSTRAP_3", 1);
226
+ themeFoundation.add("BOOTSTRAP_4", 2);
227
+ themeFoundation.add("BOOTSTRAP_5", 3);
228
+
229
+ shipmentCompanies.add(0, 'DHL');
230
+ shipmentCompanies.add(1, 'UPS');
231
+ shipmentCompanies.add(2, 'EMS');
232
+ shipmentCompanies.add(3, 'FedEx');
233
+ shipmentCompanies.add(4, 'Australia Post');
234
+ shipmentCompanies.add(5, 'StarTrack');
235
+ shipmentCompanies.add(6, 'Toll');
236
+ shipmentCompanies.add(7, 'TNT');
237
+ shipmentCompanies.add(8, 'Custom Track Link');
238
+ shipmentCompanies.add(9, 'Aramex');
239
+ shipmentCompanies.add(10, 'realtime express');
240
+ shipmentCompanies.add(11, 'Uber');
241
+ shipmentCompanies.add(12, 'Civic Transport Couriers');
242
+
243
+ inventoryStatuses.add("DEDUCTED", 0)
244
+ inventoryStatuses.add("CAN_DEDUCT", 1)
245
+ inventoryStatuses.add("NOT_SUFFICIENT", 2)
246
+ inventoryStatuses.add("NO_MATCHING_INVENTORY", 3)
247
+
248
+ productTypesSeller.add(2, 'seller');
249
+ productTypesSeller.add(3, 'seller (made on demand)');
250
+
251
+ priorityLevels.add("URGENT_JOB_PRIORITY", 1);
252
+ priorityLevels.add("HIGH_JOB_PRIORITY", 2);
253
+ priorityLevels.add("MEDIUM_JOB_PRIORITY", 3);
254
+ priorityLevels.add("LOW_JOB_PRIORITY", 4);
255
+
256
+ priorityLevelsOptions.add(1, 'Urgent');
257
+ priorityLevelsOptions.add(2, 'High');
258
+ priorityLevelsOptions.add(3, 'Medium');
259
+ priorityLevelsOptions.add(4, 'Low');
260
+
261
+ rights.add('canAccess', 1);
262
+ rights.add('canEdit', 2);
263
+ rights.add('canDelete', 3);
264
+
265
+ eventTypes.add('POST', 0);
266
+ eventTypes.add('PATCH', 1);
267
+ eventTypes.add('DELETE', 2);
268
+
269
+ itemTypes.add('custom', 0);
270
+ itemTypes.add('shipping', 1);
271
+ itemTypes.add('tax', 2);
272
+
273
+ menuType.add(0, 'Main menu');
274
+ menuType.add(1, 'Footer menu');
275
+ menuType.add(2, 'Other menu');
276
+
277
+ menuType.each(function (key, value) {
278
+ menuTypeCodes.add(value, parseInt(key, 10));
279
+ });
280
+
281
+ menuItemType.add(0, 'Redirect');
282
+ menuItemType.add(1, 'Internal');
283
+
284
+ menuItemType.each(function (key, value) {
285
+ menuItemTypeCodes.add(value, parseInt(key, 10));
286
+ });
287
+
288
+ DEFAULT_RIGHTS = [rights.get("canAccess"),
289
+ rights.get("canEdit"),
290
+ rights.get("canDelete")];
291
+
292
+ function toJsonList(objs) {
293
+ var result = [],
294
+ i,
295
+ obj,
296
+ obj_dict;
297
+
298
+ for (i = 0; i < objs.length; i++) {
299
+ obj = objs[i];
300
+ obj_dict = toJson(obj);
301
+ result.push(obj_dict);
302
+ }
303
+ return result;
304
+ }
305
+
306
+ function toJson(model) {
307
+ var json = {}, value, dict;
308
+ forEachProperty(model, function (propName, Type) {
309
+
310
+ var propNameCamel =
311
+ propName.replace(/_([a-z])/g,
312
+ function (g) { return g[1].toUpperCase(); });
313
+ try {
314
+ value = model[propName]();
315
+ if (value !== null && (!Type || typeof value === 'number')) {
316
+ // if the value is default value skip from to json
317
+ // Prop is untyped or only id received
318
+ json[propNameCamel] = value;
319
+ } else if (!isUndefinedOrNull(value)) {
320
+ // Prop is typed and other thing rather than
321
+ // single id received
322
+ if (value instanceof Array) {
323
+ if (value.length > 0) {
324
+ if (value[0] instanceof Object) {
325
+ // value is a array of objs
326
+ dict = toJsonList(value);
327
+ } else {
328
+ // value is a array of id
329
+ dict = value;
330
+ }
331
+ json[propNameCamel] = dict;
332
+ } else {
333
+ json[propNameCamel] = [];
334
+ }
335
+ } else {
336
+ // Embed Object received
337
+ dict = toJson(value);
338
+ json[propNameCamel] = dict;
339
+ }
340
+ }
341
+ } catch (ignore) {
342
+ }
343
+ });
344
+ json.rights = model.rights;
345
+ return json;
346
+ }
347
+
348
+ function entAsBlank(obj) {
349
+ /* Return a copy of obj with only obj.id() set */
350
+ var newEnt = Object.create(Object.getPrototypeOf(obj));
351
+ Object.assign(newEnt, obj);
352
+ function copyProp(propertyName, propertyType) {
353
+ addPropertyTo(newEnt, propertyName, propertyType);
354
+ if (propertyName === 'id') {
355
+ newEnt[propertyName](obj.id());
356
+ } else {
357
+ newEnt["_" + propertyName] = undefined;
358
+ }
359
+ }
360
+ forEachProperty(obj, copyProp);
361
+ return newEnt;
362
+ }
363
+
364
+ function cleanEntities(entityArray) {
365
+ var newArray = [];
366
+ entityArray.map(function (entity) {
367
+ newArray.push(entAsBlank(entity));
368
+ });
369
+ return newArray;
370
+ };
371
+
372
+ function copyEnt(obj) {
373
+ var newEnt = Object.create(Object.getPrototypeOf(obj));
374
+ Object.assign(newEnt, obj);
375
+ function copyProp(propertyName, propertyType) {
376
+ var propertyValue = obj[propertyName](),
377
+ newValue;
378
+ addPropertyTo(newEnt, propertyName, propertyType);
379
+ if (!!propertyType) {
380
+ if (!!propertyValue) {
381
+ if (propertyValue instanceof Array) {
382
+ newValue = propertyValue.map(copyEnt);
383
+ } else {
384
+ newValue = copyEnt(propertyValue);
385
+ }
386
+ }
387
+ } else {
388
+ newValue = propertyValue;
389
+ }
390
+ newEnt[propertyName](newValue);
391
+ }
392
+ forEachProperty(obj, copyProp);
393
+ return newEnt;
394
+ }
395
+
396
+ function copyEntIfNotNullOrUndefined(obj) {
397
+ const entCopy = obj ? copyEnt(obj) : null;
398
+ if (entCopy) {
399
+ entCopy.id(null);
400
+ }
401
+ return entCopy;
402
+ }
403
+
404
+ function updateEntNonEmbeddableAttrbibutes(ent, newEnt) {
405
+ function notArrayOrEmbeddableAttr(attrVal) {
406
+ return attrVal && !Array.isArray(attrVal) && !attrVal.json;
407
+ }
408
+ function copyProp(propertyName, propertyType) {
409
+ var entAttr = ent[propertyName](),
410
+ newEntAttr = newEnt[propertyName]();
411
+ if (notArrayOrEmbeddableAttr(entAttr) &&
412
+ notArrayOrEmbeddableAttr(newEntAttr)) {
413
+ ent[propertyName](newEntAttr);
414
+ }
415
+ }
416
+ forEachProperty(newEnt, copyProp);
417
+ return ent;
418
+ }
419
+
420
+ function updateEntAttributes(ent, newEnt, attrs) {
421
+ var updatedEnt = updateEntNonEmbeddableAttrbibutes(ent, newEnt),
422
+ i;
423
+ for (i = 0; i < attrs.length; i++) {
424
+ var attributeName = attrs[i];
425
+ updatedEnt[attributeName](newEnt[attributeName]());
426
+ }
427
+ return updatedEnt;
428
+ }
429
+
430
+ function ignoreAttributesUpdateEnt(ent, newEnt, ignoredAttrs) {
431
+ /* Update an entity with new values from an updated entity
432
+ but ignore specified attributes
433
+ */
434
+ var updatedEnt = newEnt,
435
+ i;
436
+ for (i = 0; i < ignoredAttrs.length; i++) {
437
+ var attributeName = ignoredAttrs[i];
438
+ updatedEnt[attributeName](ent[attributeName]());
439
+ }
440
+ return updatedEnt;
441
+ }
442
+
443
+ function getCookie(name, defaultValue) {
444
+ var searchPrefix = name + '=',
445
+ cookies = document.cookie.split(';'),
446
+ i,
447
+ cookie;
448
+ for (i = 0; i < cookies.length; ++i) {
449
+ cookie = cookies[i];
450
+ cookie = cookie.replace(/^\s*/, '');
451
+ if (cookie.indexOf(searchPrefix) === 0) {
452
+ return cookie.substring(searchPrefix.length, cookie.length);
453
+ }
454
+ }
455
+ if (isUndefined(defaultValue)) {
456
+ throw 'no such cookie present';
457
+ } else {
458
+ return defaultValue;
459
+ }
460
+ }
461
+
462
+ function getCartCookie(storeId) {
463
+ var idAndToken = getCookie('cart-' + String(storeId), null);
464
+ return idAndToken ? idAndToken.split(',') : null;
465
+ }
466
+
467
+ function setSessionCookie(name, value, domain) {
468
+ var cookie = name + '=' + value;
469
+ if (!!domain) {
470
+ // remove port, if it exists
471
+ var n = domain.indexOf(':');
472
+ domain = domain.substring(0, n != -1 ? n : domain.length);
473
+ // remove trailing slash and path, if they exists
474
+ n = domain.indexOf('/');
475
+ domain = domain.substring(0, n != -1 ? n : domain.length);
476
+ cookie += '; Domain=' + domain;
477
+ } else {
478
+ cookie += '; Domain=' + '.' + location.hostname;
479
+ }
480
+ cookie += '; path=/';
481
+ document.cookie = cookie;
482
+ }
483
+
484
+ function setCartCookie(storeId, cart, domain) {
485
+ var cookieValue = cart ? cart.id() + ',' + cart.token() : '';
486
+ setSessionCookie('cart-' + String(storeId), cookieValue, domain);
487
+ }
488
+
489
+ function logout() {
490
+ if (Boolean(getGlobal().currentSession)) {
491
+ getGlobal().currentSession.remove(id, id);
492
+ getGlobal().loggedInUser = null;
493
+ getGlobal().currentSession = null;
494
+ }
495
+ }
496
+
497
+ function removeUnstoredFiles(files, removeAll) {
498
+ var count = 1, i;
499
+
500
+ if (Boolean(removeAll)) {
501
+ count = files.filter(function (file) {
502
+ return isUndefinedOrNull(file.id());
503
+ }).length;
504
+ }
505
+
506
+ for (i = 0; i < count; i++) {
507
+ files.splice(files.findIndex(function (obj) {
508
+ return obj.id() === null;
509
+ }), 1);
510
+ }
511
+ return files;
512
+ }
513
+
514
+ function toUnix(date) {
515
+ return Math.floor(date.getTime() / 1000);
516
+ }
517
+
518
+ function forquoteEdit(rights) {
519
+ var forbitEdit = false;
520
+ if (rights.indexOf(rights.get("canEdit")) === -1) {
521
+ forbitEdit = true;
522
+ }
523
+ return forbitEdit;
524
+ }
525
+
526
+ function forquoteDelete(rights) {
527
+ var forbitDelete = false;
528
+ if (rights.indexOf(rights.get("canDelete")) === -1) {
529
+ forbitDelete = true;
530
+ }
531
+ return forbitDelete;
532
+ }
533
+
534
+ function getRights(data) {
535
+ var return_rights;
536
+ if (data.rights !== undefined && data.rights !== null) {
537
+ return_rights = data.rights;
538
+ } else {
539
+ return_rights = DEFAULT_RIGHTS;
540
+ }
541
+ return return_rights;
542
+ }
543
+
544
+ function canEditAttributes(rights) {
545
+ var canEdit = false;
546
+ if (rights.indexOf(rights.get("canEdit")) !== -1) {
547
+ canEdit = true;
548
+ }
549
+ return canEdit;
550
+ }
551
+
552
+ function editAttributes(rights) {
553
+ var disableCommand = '';
554
+ if (!canEditAttributes(rights)) {
555
+ disableCommand += " disabled=disabled ";
556
+ }
557
+ return disableCommand;
558
+ }
559
+
560
+ function getQuote(productId, quantity, success, error) {
561
+ var request = new Request(),
562
+ data = new Dictionary();
563
+ request.resource('/estimate/');
564
+ request.method('POST');
565
+ data.add('product', productId);
566
+ data.add('quantity', quantity);
567
+ request.query().add('skip_rights', true);
568
+ request.data().merge(data);
569
+ function handleResponse(status, data) {
570
+ if (status === 200) {
571
+ success(data);
572
+ } else {
573
+ error(data);
574
+ }
575
+ }
576
+ function handleError() {
577
+ error({message: 'could not connect to server',
578
+ errorCode: 0});
579
+ }
580
+ request.responseHandler(handleResponse).errorHandler(handleError);
581
+ request.send();
582
+ }
583
+
584
+ function getJobQuote(job, success, error) {
585
+ var slimProduct = new Product().id(job.product().id()),
586
+ slimJob = job.domain(new Domain()).product(slimProduct),
587
+ request = new Request(),
588
+ data = serialise(slimJob)[0];
589
+ request.resource('/specialised-order-estimate/');
590
+ request.method('POST');
591
+ request.data().merge(data);
592
+ request.query().add('skip_rights', true);
593
+ // add this to helping backend to know what the product id is
594
+ request.query().add('product_id', job.product().id());
595
+ function handleResponse(status, data) {
596
+ if (status === 201) {
597
+ success(data);
598
+ } else {
599
+ error(data);
600
+ }
601
+ }
602
+ function handleError() {
603
+ error({message: 'could not connect to server',
604
+ errorCode: 0});
605
+ }
606
+ request.responseHandler(handleResponse).errorHandler(handleError);
607
+ request.send();
608
+ }
609
+
610
+ function initSessionByToken(tokenStringForUser, success, error, embed) {
611
+ if (!getGlobal().currentSession) {
612
+ getGlobal().currentSession = new Session();
613
+ }
614
+ if (!embed) {
615
+ embed = {};
616
+ }
617
+
618
+ getGlobal().currentSession.token(tokenStringForUser).
619
+ get(success, error, {'user': embed});
620
+ }
621
+
622
+ function getCurrentUser(success, error, embed) {
623
+ var tokenStringForUser;
624
+ if (!!getGlobal().loggedInUser && !embed) {
625
+ success(getGlobal().loggedInUser);
626
+ return;
627
+ }
628
+ function haveToken(token) {
629
+ getGlobal().loggedInUser = token.user();
630
+ success(getGlobal().loggedInUser);
631
+ }
632
+ try {
633
+ tokenStringForUser = getCookie('session_token');
634
+ } catch (e) {
635
+ error(e);
636
+ }
637
+ if (Boolean(tokenStringForUser)) {
638
+ initSessionByToken(tokenStringForUser, haveToken, error, embed);
639
+ }
640
+ }
641
+
642
+
643
+ function checkUserInfo(args) {
644
+ var request = new Request(),
645
+ data = new Dictionary();
646
+
647
+ function handleResponse(status, data) {
648
+ if (status === 200) {
649
+ args.success(data);
650
+ } else {
651
+ args.error(data);
652
+ }
653
+ }
654
+ function handleError() {
655
+ args.error({message: 'could not connect to server',
656
+ errorCode: 0});
657
+ }
658
+
659
+ if (isNaN(args.user_id)) {
660
+ args.error({message: 'User id is not a number.'});
661
+ } else {
662
+ data.add('subdomain', args.subdomain);
663
+ data.add('name', args.user_name);
664
+ data.add('email_address', args.user_email);
665
+ request.data().merge(data);
666
+ request.resource('/user-check/' + args.user_id + '/');
667
+ request.method('POST');
668
+ request.responseHandler(handleResponse).errorHandler(handleError);
669
+ request.send();
670
+ }
671
+ }
672
+
673
+ function getUpdateNotifications(optionsDict) {
674
+ var request = new Request(),
675
+ data = new Dictionary();
676
+
677
+ function checkDictKey(optionsDict, key, checker, alerter) {
678
+ var checkObject =
679
+ Object.prototype.hasOwnProperty.call(optionsDict, key) ?
680
+ optionsDict[key] : [];
681
+ if (checker(checkObject)) {
682
+ return checkObject;
683
+ }
684
+ alerter();
685
+ return null;
686
+ }
687
+
688
+ function checkDictKeyForArray(optionsDict, key) {
689
+ return checkDictKey(optionsDict, key, isArray, function () {
690
+ alert(key + " is not an array.");
691
+ });
692
+ }
693
+
694
+ function checkDictKeyForDict(optionsDict, key) {
695
+ return checkDictKey(optionsDict, key, isJSON, function () {
696
+ alert(key + " is not a dictionary.");
697
+ });
698
+ }
699
+
700
+ function checkDictKeyForFunction(optionsDict, key) {
701
+ return checkDictKey(optionsDict, key, isFunction, function () {
702
+ alert(key + " is not a function.");
703
+ });
704
+ }
705
+
706
+ function serlialiseEntitiesArray(optionsDict, key) {
707
+ var entitiesArray = checkDictKeyForArray(optionsDict, key),
708
+ arrayWithObjects = [],
709
+ entityObject,
710
+ i;
711
+ for (i = 0; i < entitiesArray.length; i++) {
712
+ entityObject = entitiesArray[i];
713
+ if (Boolean(entityObject)) {
714
+ arrayWithObjects.push({type: entityObject.json,
715
+ id: entityObject.id()});
716
+ }
717
+ }
718
+ return arrayWithObjects;
719
+ }
720
+
721
+ request.resource('/notifications-check-update/');
722
+ request.method('POST');
723
+ data.add('sections',
724
+ JSON.stringify(checkDictKeyForArray(optionsDict, 'sections')));
725
+ data.add('entities',
726
+ JSON.stringify(serlialiseEntitiesArray(optionsDict,
727
+ 'entities')));
728
+ data.add('notificationTypes',
729
+ JSON.stringify(checkDictKeyForDict(optionsDict,
730
+ 'notificationTypes')));
731
+ request.data().merge(data);
732
+ request.query().add('skip_rights', 'y');
733
+ function handleResponse(status, data) {
734
+ if (status === 200) {
735
+ checkDictKeyForFunction(optionsDict, 'success')(data);
736
+ } else {
737
+ checkDictKeyForFunction(optionsDict, 'error')(data);
738
+ }
739
+ }
740
+ function handleError() {
741
+ alert('could not connect to server');
742
+ }
743
+ request.responseHandler(handleResponse).errorHandler(handleError);
744
+ request.send();
745
+ }
746
+
747
+ function checkAndUpdateNotifications(related_object_id, section,
748
+ senderId, success, error) {
749
+ var request = new Request(),
750
+ data = new Dictionary();
751
+ request.resource('/notifications-toast/');
752
+ request.method('POST');
753
+ data.add('related_object_id', related_object_id);
754
+ data.add('section', section);
755
+ data.add('sender_id', senderId);
756
+ request.query().add('skip_rights', 'y');
757
+ request.data().merge(data);
758
+ function handleResponse(status, data) {
759
+ if (status === 200) {
760
+ success(data);
761
+ } else {
762
+ error(data);
763
+ }
764
+ }
765
+ function handleError() {
766
+ error({message: 'could not connect to server',
767
+ errorCode: 0});
768
+ }
769
+ request.responseHandler(handleResponse).errorHandler(handleError);
770
+ request.send();
771
+
772
+ getGlobal().merchiSubscriptionManager.subscribe(
773
+ [eventTypes.get('POST')], request.path(), "POST", handleResponse);
774
+ }
775
+
776
+ function escapeHtml(dangerousString) {
777
+ var entityMap = {
778
+ "&": "&amp;",
779
+ "<": "&lt;",
780
+ ">": "&gt;",
781
+ '"': '&quot;',
782
+ "'": '&#39;',
783
+ "/": '&#x2F;'
784
+ };
785
+ return String(dangerousString).replace(/[&<>"'/]/g, function (s) {
786
+ return entityMap[s];
787
+ });
788
+ }
789
+
790
+ function getQueryStringValue(name) {
791
+ if (isBrowser) {
792
+ var query = window.location.search.substring(1),
793
+ vars = query.split("&"),
794
+ pair,
795
+ i;
796
+ for (i = 0; i < vars.length; i++) {
797
+ pair = vars[i].split("=");
798
+ if (pair[0] === name) {
799
+ return decodeURIComponent(pair[1]);
800
+ }
801
+ }
802
+ }
803
+ return undefined;
804
+ }
805
+
806
+ function getUserIdByEmail(emailAddress, success, error) {
807
+ var request = new Request(),
808
+ data = new Dictionary();
809
+ request.resource('/user-check-email/');
810
+ request.method('POST');
811
+ data.add('email_address', emailAddress);
812
+ request.data().merge(data);
813
+ function handleResponse(status, data) {
814
+ if (status === 200) {
815
+ success(data);
816
+ } else {
817
+ error(status, data);
818
+ }
819
+ }
820
+ request.responseHandler(handleResponse).errorHandler(error);
821
+ request.send();
822
+ }
823
+
824
+ function placeOrder(clientId, quantity, product, address, variations,
825
+ success, error) {
826
+ var request = new Request(),
827
+ productId = product.id(),
828
+ data = new Dictionary();
829
+ data.add('client_id', clientId);
830
+ data.add('quantity', quantity);
831
+ data.add('product_id', productId);
832
+ data.add('variation_notes', variations);
833
+ if (address !== null) {
834
+ data = serialise(address, data)[0];
835
+ }
836
+ request.resource('/public-order/');
837
+ request.method('POST');
838
+ request.data().merge(data);
839
+ function handleResponse(status, data) {
840
+ if (status === 200) {
841
+ success(data);
842
+ } else {
843
+ error(data);
844
+ }
845
+ }
846
+ function handleError() {
847
+ error({message: 'could not connect to server',
848
+ errorCode: 0});
849
+ }
850
+ request.responseHandler(handleResponse).errorHandler(handleError);
851
+ request.send();
852
+ }
853
+
854
+ function getProductShipmentOptions(
855
+ productId, quantity, address, success, error) {
856
+ var request = new Request(),
857
+ data = new Dictionary();
858
+ data.add('quantity', quantity);
859
+ data = serialise(address, data, 'address')[0];
860
+ request.resource(`/products/${productId}/shipment_options/`);
861
+ request.method('POST');
862
+ request.data().merge(data);
863
+ function handleResponse(status, data) {
864
+ if (status === 200) {
865
+ success(data);
866
+ } else {
867
+ error(data);
868
+ }
869
+ }
870
+ function handleError() {
871
+ error({message: 'could not connect to server',
872
+ errorCode: 0});
873
+ }
874
+ request.responseHandler(handleResponse).errorHandler(handleError);
875
+ request.send();
876
+ }
877
+
878
+ if (!getGlobal().currentUser) getCurrentUser(id, id, currentUserEmbed);
879
+
880
+ return {'roles': roles,
881
+ 'roleStrings': roleStrings,
882
+ 'systemRoles': systemRoles,
883
+ 'roleCssClass': roleCssClass,
884
+ 'eventTypes': eventTypes,
885
+ 'getGlobal': getGlobal,
886
+ 'logout': logout,
887
+ 'canEditAttributes': canEditAttributes,
888
+ 'editAttributes': editAttributes,
889
+ 'forquoteEdit': forquoteEdit,
890
+ 'getRights': getRights,
891
+ 'forquoteDelete': forquoteDelete,
892
+ 'DEFAULT_RIGHTS': DEFAULT_RIGHTS,
893
+ 'priorityLevels': priorityLevels,
894
+ 'URGENT_JOB_PRIORITY': priorityLevels.get('URGENT_JOB_PRIORITY'),
895
+ 'HIGH_JOB_PRIORITY': priorityLevels.get('HIGH_JOB_PRIORITY'),
896
+ 'MEDIUM_JOB_PRIORITY': priorityLevels.get('MEDIUM_JOB_PRIORITY'),
897
+ 'LOW_JOB_PRIORITY': priorityLevels.get('LOW_JOB_PRIORITY'),
898
+ 'priorityLevelsOptions': priorityLevelsOptions,
899
+ 'PhoneNumber': PhoneNumber,
900
+ 'Dictionary': Dictionary,
901
+ 'phoneNumbers': new PhoneNumbers(),
902
+ 'EmailAddress': EmailAddress,
903
+ 'emailAddresses': new EmailAddresses(),
904
+ 'EmailCounter': EmailCounter,
905
+ 'emailCounters': new EmailCounters(),
906
+ 'Address': Address,
907
+ 'addresses': new Addresses(),
908
+ 'User': User,
909
+ 'users': new Users(),
910
+ 'Domain': Domain,
911
+ 'domains': new Domains(),
912
+ 'DomainInvitation': DomainInvitation,
913
+ 'Draft': Draft,
914
+ 'drafts': new Drafts(),
915
+ 'DraftComment': DraftComment,
916
+ 'DraftTemplate': DraftTemplate,
917
+ 'ExchangeRate': ExchangeRate,
918
+ 'exchangeRates': new ExchangeRates(),
919
+ 'Theme': Theme,
920
+ 'themes': new Themes(),
921
+ 'EnrolledDomain': EnrolledDomain,
922
+ 'enrolledDomains': new EnrolledDomains(),
923
+ 'AutomaticPaymentRelationship': AutomaticPaymentRelationship,
924
+ 'automaticPaymentRelationships': new AutomaticPaymentRelationships(),
925
+ 'Company': Company,
926
+ 'companies': new Companies(),
927
+ 'CompanyInvitation': CompanyInvitation,
928
+ 'companyInvitations': new CompanyInvitations(),
929
+ 'UserCompany': UserCompany,
930
+ 'Category': Category,
931
+ 'categories': new Categories(),
932
+ 'Component': Component,
933
+ 'components': new Components(),
934
+ 'ComponentTag': ComponentTag,
935
+ 'componentTags': new ComponentTags(),
936
+ 'DomainTag': DomainTag,
937
+ 'domainTags': new DomainTags(),
938
+ 'Product': Product,
939
+ 'products': new Products(),
940
+ 'ProductionComment': ProductionComment,
941
+ 'Inventory': Inventory,
942
+ 'inventories': new Inventories(),
943
+ 'InventoryUnitVariation': InventoryUnitVariation,
944
+ 'matchiingInventory': MatchingInventory,
945
+ 'InternalTag': InternalTag,
946
+ 'internalTags': new InternalTags(),
947
+ 'Invoice': Invoice,
948
+ 'invoices': new Invoices(),
949
+ 'Job': Job,
950
+ 'jobs': new Jobs(),
951
+ 'JobComment': JobComment,
952
+ 'Cart': Cart,
953
+ 'CartItem': CartItem,
954
+ 'Bank': Bank,
955
+ 'QuoteItem': QuoteItem,
956
+ 'QuoteItems': new QuoteItems(),
957
+ 'Quote': Quote,
958
+ 'Quotes': new Quotes(),
959
+ 'Assignment': Assignment,
960
+ 'Assignments': new Assignments(),
961
+ 'File': MerchiFile,
962
+ 'files': new MerchiFiles(),
963
+ 'Backup': Backup,
964
+ 'backups': new Backups(),
965
+ 'removeUnstoredFiles': removeUnstoredFiles,
966
+ 'Shipment': Shipment,
967
+ 'shipments': new Shipments(),
968
+ 'ShipmentMethod': ShipmentMethod,
969
+ 'shipmentMethods': new ShipmentMethods(),
970
+ 'ShipmentMethodVariation': ShipmentMethodVariation,
971
+ 'shipmentMethodVariations': new ShipmentMethodVariations(),
972
+ 'CountryTax': CountryTax,
973
+ 'countryTaxes': new CountryTaxes(),
974
+ 'Discount': Discount,
975
+ 'DiscountGroups': DiscountGroup,
976
+ 'SupplyDomain': SupplyDomain,
977
+ 'SupplyDomains': new SupplyDomains(),
978
+ 'initSessionByToken': initSessionByToken,
979
+ 'getCurrentUser': getCurrentUser,
980
+ 'Payment': Payment,
981
+ 'Item': Item,
982
+ 'Session': Session,
983
+ 'sessions': new Sessions(),
984
+ 'serialise': serialise,
985
+ 'SystemRole': SystemRole,
986
+ 'toJson': toJson,
987
+ 'toJsonList': toJsonList,
988
+ 'rights': rights,
989
+ 'itemTypes': itemTypes,
990
+ 'Request': Request,
991
+ 'STATUS': STATUS,
992
+ 'GSTrate': GSTrate,
993
+ 'Notification': Notification,
994
+ 'notifications': new Notifications(),
995
+ 'SubscriptionPlan': SubscriptionPlan,
996
+ 'subscriptionPlans': new SubscriptionPlans(),
997
+ 'VariationField': VariationField,
998
+ 'Variation': Variation,
999
+ 'VariationsGroup': VariationsGroup,
1000
+ 'VariationFieldsOption': VariationFieldsOption,
1001
+ 'Menu': Menu,
1002
+ 'MenuItem': MenuItem,
1003
+ 'notificationTypes': notificationTypes,
1004
+ 'paymentTypes': paymentTypes,
1005
+ 'paymentTypeIds': paymentTypeIds,
1006
+ 'Page': Page,
1007
+ 'toUnix': toUnix,
1008
+ 'id': id,
1009
+ 'isUndefined': isUndefined,
1010
+ 'isNull': isNull,
1011
+ 'isUndefinedOrNull': isUndefinedOrNull,
1012
+ 'indexOfEntityInArrayById': indexOfEntityInArrayById,
1013
+ 'indexOfEntityInArrayByName': indexOfEntityInArrayByName,
1014
+ 'jobStatusProduction': jobStatusProduction,
1015
+ 'jobPriority': jobPriority,
1016
+ 'notEmptyArray': notEmptyArray,
1017
+ 'displayMoney': displayMoney,
1018
+ 'sortArrayByObjectKey': sortArrayByObjectKey,
1019
+ 'fromJson': fromJson,
1020
+ 'fromJsonList': fromJsonList,
1021
+ 'setSessionCookie': setSessionCookie,
1022
+ 'setCartCookie': setCartCookie,
1023
+ 'getQuote': getQuote,
1024
+ 'checkAndUpdateNotifications': checkAndUpdateNotifications,
1025
+ 'escapeHtml': escapeHtml,
1026
+ 'getQueryStringValue': getQueryStringValue,
1027
+ 'NoTaxEntity': NoTaxEntity,
1028
+ 'notificationSectionCodes': notificationSectionCodes,
1029
+ 'notificationSectionClass': notificationSectionClass,
1030
+ 'notificationSectionIconClass': notificationSectionIconClass,
1031
+ 'notificationSection': notificationSection,
1032
+ 'notificationSectionKey': notificationSectionKey,
1033
+ 'notificationAvatar': notificationAvatar,
1034
+ 'fieldTypes': fieldTypes,
1035
+ 'fieldTypesString': fieldTypesString,
1036
+ 'inputTypes': inputTypes,
1037
+ 'domainTypes': domainTypes,
1038
+ 'getCookie': getCookie,
1039
+ 'getCartCookie': getCartCookie,
1040
+ 'getUserIdByEmail': getUserIdByEmail,
1041
+ 'placeOrder': placeOrder,
1042
+ 'platformName': platformName,
1043
+ 'platformSellerDomain': platformSellerDomain,
1044
+ 'platformSellerDomainPlus': platformSellerDomainPlus,
1045
+ 'platformCopyright': platformCopyright,
1046
+ 'platformIcon': platformIcon,
1047
+ 'defaultUserAvatar': defaultUserAvatar,
1048
+ 'platformLogo': platformLogo,
1049
+ 'menuItemType': menuItemType,
1050
+ 'menuItemTypeCodes': menuItemTypeCodes,
1051
+ 'menuType': menuType,
1052
+ 'menuTypeCodes': menuTypeCodes,
1053
+ 'checkUserInfo': checkUserInfo,
1054
+ 'getJobQuote': getJobQuote,
1055
+ 'removeObjectFromArrayWithIntegerValue': removeObjectFromArrayWithIntegerValue,
1056
+ 'shipmentCompanies': shipmentCompanies,
1057
+ 'generateUUID': generateUUID,
1058
+ 'getUpdateNotifications': getUpdateNotifications,
1059
+ 'currentUserEmbed': currentUserEmbed,
1060
+ 'create': create,
1061
+ 'copyEnt': copyEnt,
1062
+ 'copyEntIfNotNullOrUndefined': copyEntIfNotNullOrUndefined,
1063
+ 'entAsBlank': entAsBlank,
1064
+ 'cleanEntities': cleanEntities,
1065
+ 'userTypes': userTypes,
1066
+ 'updateEntNonEmbeddableAttrbibutes': updateEntNonEmbeddableAttrbibutes,
1067
+ 'updateEntAttributes': updateEntAttributes,
1068
+ 'ignoreAttributesUpdateEnt': ignoreAttributesUpdateEnt,
1069
+ 'inventoryStatuses': inventoryStatuses,
1070
+ 'productTypes': productTypes,
1071
+ 'productTypesInts': productTypesInts,
1072
+ 'productTypesSeller': productTypesSeller,
1073
+ 'getProductShipmentOptions': getProductShipmentOptions};
1074
+ }