merchi_cart 0.0.4-c → 0.0.4-e

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 (196) hide show
  1. package/lib/Cart.js +20 -25
  2. package/lib/CartAlert.js +14 -12
  3. package/lib/CartHeader.js +9 -9
  4. package/lib/CartProvider.js +157 -226
  5. package/lib/CartTotals.js +44 -44
  6. package/lib/MerchiSDK/constants/auto_assign_production_on_actions.js +1 -1
  7. package/lib/MerchiSDK/constants/call_to_actions.js +1 -1
  8. package/lib/MerchiSDK/constants/discount_types.js +1 -1
  9. package/lib/MerchiSDK/constants/domain_types.js +1 -1
  10. package/lib/MerchiSDK/constants/errors.js +1 -1
  11. package/lib/MerchiSDK/constants/event_types.js +1 -1
  12. package/lib/MerchiSDK/constants/field_types.js +1 -1
  13. package/lib/MerchiSDK/constants/input_types.js +1 -1
  14. package/lib/MerchiSDK/constants/inventory_statuses.js +1 -1
  15. package/lib/MerchiSDK/constants/invoice_types.js +1 -1
  16. package/lib/MerchiSDK/constants/item_types.js +1 -1
  17. package/lib/MerchiSDK/constants/job/drafting_status.js +1 -1
  18. package/lib/MerchiSDK/constants/job/payment_status.js +1 -1
  19. package/lib/MerchiSDK/constants/job/production_status.js +1 -1
  20. package/lib/MerchiSDK/constants/job/shipment_status.js +1 -1
  21. package/lib/MerchiSDK/constants/job/supply_chain_request_status.js +1 -1
  22. package/lib/MerchiSDK/constants/job_priorities.js +1 -1
  23. package/lib/MerchiSDK/constants/job_status.js +5 -5
  24. package/lib/MerchiSDK/constants/job_types.js +1 -1
  25. package/lib/MerchiSDK/constants/notification_sections.js +1 -1
  26. package/lib/MerchiSDK/constants/notification_types.js +1 -1
  27. package/lib/MerchiSDK/constants/notification_urgencies.js +1 -1
  28. package/lib/MerchiSDK/constants/payment_types.js +1 -1
  29. package/lib/MerchiSDK/constants/platform.js +5 -5
  30. package/lib/MerchiSDK/constants/product_types.js +1 -1
  31. package/lib/MerchiSDK/constants/rights.js +1 -1
  32. package/lib/MerchiSDK/constants/robots_meta_directives.js +1 -1
  33. package/lib/MerchiSDK/constants/roles.js +8 -14
  34. package/lib/MerchiSDK/constants/shipment_companies.js +1 -1
  35. package/lib/MerchiSDK/constants/shipment_services.js +1 -1
  36. package/lib/MerchiSDK/constants/system_roles.js +1 -1
  37. package/lib/MerchiSDK/constants/theme_foundations.js +1 -1
  38. package/lib/MerchiSDK/constants/theme_status.js +1 -1
  39. package/lib/MerchiSDK/constants/user_types.js +1 -1
  40. package/lib/MerchiSDK/constants/white_label_accessibilities.js +1 -1
  41. package/lib/MerchiSDK/cookie.js +3 -3
  42. package/lib/MerchiSDK/entities/address.js +22 -43
  43. package/lib/MerchiSDK/entities/assignment.js +28 -49
  44. package/lib/MerchiSDK/entities/automatic_payment_relationship.js +11 -32
  45. package/lib/MerchiSDK/entities/backup.js +6 -27
  46. package/lib/MerchiSDK/entities/bank.js +17 -38
  47. package/lib/MerchiSDK/entities/cart.js +31 -64
  48. package/lib/MerchiSDK/entities/cart_item.js +30 -51
  49. package/lib/MerchiSDK/entities/cart_shipment_group.js +9 -30
  50. package/lib/MerchiSDK/entities/cart_shipment_quote.js +13 -34
  51. package/lib/MerchiSDK/entities/category.js +14 -35
  52. package/lib/MerchiSDK/entities/company.js +88 -109
  53. package/lib/MerchiSDK/entities/company_invitation.js +13 -34
  54. package/lib/MerchiSDK/entities/component.js +33 -54
  55. package/lib/MerchiSDK/entities/component_tag.js +7 -28
  56. package/lib/MerchiSDK/entities/component_version.js +12 -33
  57. package/lib/MerchiSDK/entities/country_tax.js +21 -45
  58. package/lib/MerchiSDK/entities/discount.js +13 -34
  59. package/lib/MerchiSDK/entities/discount_group.js +11 -32
  60. package/lib/MerchiSDK/entities/domain.js +80 -101
  61. package/lib/MerchiSDK/entities/domain_invitation.js +14 -35
  62. package/lib/MerchiSDK/entities/domain_tag.js +15 -36
  63. package/lib/MerchiSDK/entities/draft.js +32 -65
  64. package/lib/MerchiSDK/entities/draft_comment.js +19 -40
  65. package/lib/MerchiSDK/entities/draft_template.js +15 -36
  66. package/lib/MerchiSDK/entities/email_address.js +10 -31
  67. package/lib/MerchiSDK/entities/email_counter.js +8 -29
  68. package/lib/MerchiSDK/entities/enrolled_domain.js +20 -44
  69. package/lib/MerchiSDK/entities/exchange_rate.js +9 -30
  70. package/lib/MerchiSDK/entities/file.js +59 -80
  71. package/lib/MerchiSDK/entities/internal_tag.js +17 -38
  72. package/lib/MerchiSDK/entities/inventory.js +19 -42
  73. package/lib/MerchiSDK/entities/inventory_unit_variation.js +12 -33
  74. package/lib/MerchiSDK/entities/invoice.js +57 -78
  75. package/lib/MerchiSDK/entities/item.js +18 -39
  76. package/lib/MerchiSDK/entities/job.js +117 -140
  77. package/lib/MerchiSDK/entities/job_comment.js +18 -39
  78. package/lib/MerchiSDK/entities/matching_inventory.js +11 -32
  79. package/lib/MerchiSDK/entities/menu.js +12 -33
  80. package/lib/MerchiSDK/entities/menu_item.js +12 -33
  81. package/lib/MerchiSDK/entities/notification.js +32 -53
  82. package/lib/MerchiSDK/entities/page.js +13 -34
  83. package/lib/MerchiSDK/entities/payment.js +25 -46
  84. package/lib/MerchiSDK/entities/payment_device.js +12 -33
  85. package/lib/MerchiSDK/entities/phone_number.js +14 -35
  86. package/lib/MerchiSDK/entities/product.js +153 -188
  87. package/lib/MerchiSDK/entities/production_comment.js +18 -39
  88. package/lib/MerchiSDK/entities/quote.js +70 -106
  89. package/lib/MerchiSDK/entities/quote_item.js +28 -49
  90. package/lib/MerchiSDK/entities/seo_domain_page.js +13 -34
  91. package/lib/MerchiSDK/entities/session.js +11 -32
  92. package/lib/MerchiSDK/entities/shipment.js +62 -83
  93. package/lib/MerchiSDK/entities/shipment_item.js +7 -28
  94. package/lib/MerchiSDK/entities/shipment_item_fulfillment.js +7 -28
  95. package/lib/MerchiSDK/entities/shipment_method.js +21 -42
  96. package/lib/MerchiSDK/entities/shipment_method_variation.js +15 -36
  97. package/lib/MerchiSDK/entities/short_url.js +14 -35
  98. package/lib/MerchiSDK/entities/subscription_plan.js +26 -47
  99. package/lib/MerchiSDK/entities/supply_domain.js +11 -32
  100. package/lib/MerchiSDK/entities/system_role.js +7 -28
  101. package/lib/MerchiSDK/entities/theme.js +89 -110
  102. package/lib/MerchiSDK/entities/theme_css_setting.js +10 -31
  103. package/lib/MerchiSDK/entities/user.js +151 -213
  104. package/lib/MerchiSDK/entities/user_company.js +11 -32
  105. package/lib/MerchiSDK/entities/variation.js +21 -42
  106. package/lib/MerchiSDK/entities/variation_field.js +61 -94
  107. package/lib/MerchiSDK/entities/variation_fields_option.js +40 -61
  108. package/lib/MerchiSDK/entities/variation_option.js +20 -41
  109. package/lib/MerchiSDK/entities/variations_group.js +15 -36
  110. package/lib/MerchiSDK/entity.js +534 -624
  111. package/lib/MerchiSDK/merchi.js +42 -53
  112. package/lib/MerchiSDK/request.js +47 -75
  113. package/lib/MerchiSDK/test_util.js +6 -10
  114. package/lib/MerchiSDK/toasts.js +12 -13
  115. package/lib/MerchiSDK/util/float.js +7 -19
  116. package/lib/MerchiSDK/util/query_string.js +4 -4
  117. package/lib/MerchiSDK/util/validation.js +2 -3
  118. package/lib/MerchiSDK/uuid.js +2 -2
  119. package/lib/buttons/Button.js +15 -15
  120. package/lib/buttons/ButtonBack.js +22 -25
  121. package/lib/buttons/ButtonClearCart.js +8 -9
  122. package/lib/buttons/ButtonInvoiceDownload.js +26 -61
  123. package/lib/buttons/ButtonNext.js +20 -25
  124. package/lib/buttons/ButtonNextDynamic.js +16 -18
  125. package/lib/buttons/ButtonPay.js +17 -13
  126. package/lib/buttons/ButtonShipmentTabNext.js +12 -13
  127. package/lib/buttons/index.js +13 -13
  128. package/lib/components/Alert.js +14 -12
  129. package/lib/components/CartBody.js +10 -8
  130. package/lib/components/CartClient.js +22 -17
  131. package/lib/components/CartFooter.js +9 -7
  132. package/lib/components/CartItemRow.js +58 -48
  133. package/lib/components/CartPaymentSettingsInvalid.js +3 -4
  134. package/lib/components/CartShipment.js +18 -13
  135. package/lib/components/CartTabContent.js +9 -7
  136. package/lib/components/CartTabPanel.js +15 -13
  137. package/lib/components/CartTableContainer.js +9 -7
  138. package/lib/components/Collapse.js +14 -22
  139. package/lib/components/LoadingTemplate.js +10 -7
  140. package/lib/components/NoCartItems.js +9 -9
  141. package/lib/components/ShipmentGroupCard.js +69 -52
  142. package/lib/components/Table.js +7 -4
  143. package/lib/components/Title.js +11 -9
  144. package/lib/components/containers.js +12 -11
  145. package/lib/components/index.js +30 -31
  146. package/lib/forms/FormNewCustomer.js +48 -76
  147. package/lib/forms/FormReturningCustomer.js +38 -58
  148. package/lib/forms/FormShipmentAddressAndNotes.js +42 -47
  149. package/lib/forms/FormSquarePayment.js +8 -9
  150. package/lib/forms/FormStripePayment.js +8 -9
  151. package/lib/forms/InputAcceptUserTermsAndConditions.js +12 -11
  152. package/lib/forms/InputError.js +11 -9
  153. package/lib/forms/InputSelect.js +34 -36
  154. package/lib/forms/InputText.js +38 -42
  155. package/lib/forms/InputsAddress.js +59 -69
  156. package/lib/index.js +6 -6
  157. package/lib/panels/PanelCartItems.js +14 -17
  158. package/lib/panels/PanelCartShipment.js +10 -13
  159. package/lib/panels/PanelClearCart.js +8 -7
  160. package/lib/panels/PanelClientCheckout.js +18 -17
  161. package/lib/panels/PanelEditCartItem.js +17 -22
  162. package/lib/panels/PanelPaymentSuccess.js +18 -16
  163. package/lib/panels/index.js +13 -13
  164. package/lib/slices/sliceCart.js +53 -56
  165. package/lib/slices/sliceCartAlert.js +11 -15
  166. package/lib/slices/sliceCartItem.js +11 -10
  167. package/lib/slices/sliceCartPayment.js +15 -16
  168. package/lib/slices/sliceCartShipment.js +23 -26
  169. package/lib/slices/sliceFormReturningCustomer.js +7 -7
  170. package/lib/slices/sliceNewCustomerForm.js +6 -6
  171. package/lib/square/SquareCard.js +16 -18
  172. package/lib/square/actions.js +24 -46
  173. package/lib/square/slices/reducersSquare.js +6 -6
  174. package/lib/square/slices/sliceSquareAlerts.js +10 -16
  175. package/lib/square/slices/sliceSquareForm.js +10 -9
  176. package/lib/store.js +359 -565
  177. package/lib/stripe/StripeCardFields.js +43 -44
  178. package/lib/stripe/StripeCardForm.js +51 -109
  179. package/lib/stripe/StripePaymentButtons.js +35 -46
  180. package/lib/stripe/actions.js +75 -196
  181. package/lib/stripe/slices/sliceStripeAlerts.js +10 -16
  182. package/lib/stripe/slices/sliceStripeCardForm.js +6 -6
  183. package/lib/stripe/slices/sliceStripeForm.js +18 -17
  184. package/lib/stripe/utils.js +1 -1
  185. package/lib/tabs/CartNav.js +15 -24
  186. package/lib/tabs/NavTab.js +20 -19
  187. package/lib/utilities/address.js +32 -30
  188. package/lib/utilities/cart.js +33 -50
  189. package/lib/utilities/cookie.js +46 -129
  190. package/lib/utilities/currency.js +29 -25
  191. package/lib/utilities/helpers.js +41 -60
  192. package/lib/utilities/invoice.js +45 -114
  193. package/lib/utilities/product.js +5 -3
  194. package/lib/utilities/user.js +24 -62
  195. package/lib/utilities/variations.js +16 -14
  196. package/package.json +1 -1
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -11,27 +10,12 @@ var _country_tax = require("./country_tax");
11
10
  var _entity = require("../entity");
12
11
  var _file = require("./file");
13
12
  var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _dec19, _dec20, _dec21, _dec22, _dec23, _dec24, _dec25, _dec26, _dec27, _dec28, _dec29, _dec30, _dec31, _dec32, _dec33, _dec34, _dec35, _dec36, _dec37, _dec38, _dec39, _dec40, _dec41, _dec42, _dec43, _dec44, _dec45, _dec46, _dec47, _dec48, _dec49, _dec50, _dec51, _dec52, _dec53, _dec54, _dec55, _dec56, _dec57, _dec58, _dec59, _dec60, _dec61, _dec62, _dec63, _dec64, _dec65, _dec66, _dec67, _dec68, _dec69, _dec70, _dec71, _dec72, _dec73, _dec74, _dec75, _dec76, _dec77, _dec78, _dec79, _dec80, _dec81, _dec82, _dec83, _dec84, _dec85, _dec86, _dec87, _dec88, _dec89, _dec90, _dec91, _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14, _descriptor15, _descriptor16, _descriptor17, _descriptor18, _descriptor19, _descriptor20, _descriptor21, _descriptor22, _descriptor23, _descriptor24, _descriptor25, _descriptor26, _descriptor27, _descriptor28, _descriptor29, _descriptor30, _descriptor31, _descriptor32, _descriptor33, _descriptor34, _descriptor35, _descriptor36, _descriptor37, _descriptor38, _descriptor39, _descriptor40, _descriptor41, _descriptor42, _descriptor43, _descriptor44, _descriptor45, _descriptor46, _descriptor47, _descriptor48, _descriptor49, _descriptor50, _descriptor51, _descriptor52, _descriptor53, _descriptor54, _descriptor55, _descriptor56, _descriptor57, _descriptor58, _descriptor59, _descriptor60, _descriptor61, _descriptor62, _descriptor63, _descriptor64, _descriptor65, _descriptor66, _descriptor67, _descriptor68, _descriptor69, _descriptor70, _descriptor71, _descriptor72, _descriptor73, _descriptor74, _descriptor75, _descriptor76, _descriptor77, _descriptor78, _descriptor79, _descriptor80, _descriptor81, _descriptor82, _descriptor83, _descriptor84, _descriptor85, _descriptor86, _descriptor87, _descriptor88, _descriptor89, _descriptor90, _descriptor91, _class2;
14
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
15
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
16
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
17
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
18
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
13
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
14
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
19
15
  function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
20
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
21
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
22
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
23
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
24
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
26
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
27
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
28
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
29
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
30
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
31
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
32
16
  function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
33
17
  function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
34
- var Product = exports.Product = (_dec = Product.property({
18
+ let Product = exports.Product = (_dec = Product.property({
35
19
  type: Date
36
20
  }), _dec2 = Product.property(), _dec3 = _component.Component.property({
37
21
  type: Date
@@ -137,214 +121,197 @@ var Product = exports.Product = (_dec = Product.property({
137
121
  arrayType: 'User'
138
122
  }), _dec91 = Product.property({
139
123
  arrayType: 'DraftTemplate'
140
- }), (_class = (_class2 = /*#__PURE__*/function (_Entity) {
141
- _inherits(Product, _Entity);
142
- function Product() {
143
- var _this;
144
- _classCallCheck(this, Product);
145
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
146
- args[_key] = arguments[_key];
147
- }
148
- _this = _callSuper(this, Product, [].concat(args));
149
- _initializerDefineProperty(_this, "archived", _descriptor, _assertThisInitialized(_this));
150
- _initializerDefineProperty(_this, "id", _descriptor2, _assertThisInitialized(_this));
151
- _initializerDefineProperty(_this, "created", _descriptor3, _assertThisInitialized(_this));
152
- _initializerDefineProperty(_this, "updated", _descriptor4, _assertThisInitialized(_this));
153
- _initializerDefineProperty(_this, "createdBy", _descriptor5, _assertThisInitialized(_this));
154
- _initializerDefineProperty(_this, "updatedBy", _descriptor6, _assertThisInitialized(_this));
155
- _initializerDefineProperty(_this, "productType", _descriptor7, _assertThisInitialized(_this));
156
- _initializerDefineProperty(_this, "minimum", _descriptor8, _assertThisInitialized(_this));
157
- _initializerDefineProperty(_this, "minimumPerGroup", _descriptor9, _assertThisInitialized(_this));
158
- _initializerDefineProperty(_this, "deliveryDaysNormal", _descriptor10, _assertThisInitialized(_this));
159
- _initializerDefineProperty(_this, "unitPrice", _descriptor11, _assertThisInitialized(_this));
160
- _initializerDefineProperty(_this, "buyUnitPrice", _descriptor12, _assertThisInitialized(_this));
161
- _initializerDefineProperty(_this, "unitPriceDiscountGroup", _descriptor13, _assertThisInitialized(_this));
162
- _initializerDefineProperty(_this, "shipmentMethods", _descriptor14, _assertThisInitialized(_this));
163
- _initializerDefineProperty(_this, "margin", _descriptor15, _assertThisInitialized(_this));
164
- _initializerDefineProperty(_this, "unitWeight", _descriptor16, _assertThisInitialized(_this));
165
- _initializerDefineProperty(_this, "unitHeight", _descriptor17, _assertThisInitialized(_this));
166
- _initializerDefineProperty(_this, "unitWidth", _descriptor18, _assertThisInitialized(_this));
167
- _initializerDefineProperty(_this, "unitDepth", _descriptor19, _assertThisInitialized(_this));
168
- _initializerDefineProperty(_this, "name", _descriptor20, _assertThisInitialized(_this));
169
- _initializerDefineProperty(_this, "country", _descriptor21, _assertThisInitialized(_this));
170
- _initializerDefineProperty(_this, "currency", _descriptor22, _assertThisInitialized(_this));
171
- _initializerDefineProperty(_this, "description", _descriptor23, _assertThisInitialized(_this));
172
- _initializerDefineProperty(_this, "notes", _descriptor24, _assertThisInitialized(_this));
173
- _initializerDefineProperty(_this, "internalUseNotes", _descriptor25, _assertThisInitialized(_this));
174
- _initializerDefineProperty(_this, "internalUseAiContext", _descriptor26, _assertThisInitialized(_this));
175
- _initializerDefineProperty(_this, "aiContext", _descriptor27, _assertThisInitialized(_this));
176
- _initializerDefineProperty(_this, "shopifyProductId", _descriptor28, _assertThisInitialized(_this));
177
- _initializerDefineProperty(_this, "useCompanyShipmentMethods", _descriptor29, _assertThisInitialized(_this));
178
- _initializerDefineProperty(_this, "dropShipment", _descriptor30, _assertThisInitialized(_this));
179
- _initializerDefineProperty(_this, "needsDrafting", _descriptor31, _assertThisInitialized(_this));
180
- _initializerDefineProperty(_this, "needsProduction", _descriptor32, _assertThisInitialized(_this));
181
- _initializerDefineProperty(_this, "needsShipping", _descriptor33, _assertThisInitialized(_this));
182
- _initializerDefineProperty(_this, "needsInvoicing", _descriptor34, _assertThisInitialized(_this));
183
- _initializerDefineProperty(_this, "needsInventory", _descriptor35, _assertThisInitialized(_this));
184
- _initializerDefineProperty(_this, "featureDeadline", _descriptor36, _assertThisInitialized(_this));
185
- _initializerDefineProperty(_this, "showFeatureDeadline", _descriptor37, _assertThisInitialized(_this));
186
- _initializerDefineProperty(_this, "showPublic", _descriptor38, _assertThisInitialized(_this));
187
- _initializerDefineProperty(_this, "showGroupBuyStatus", _descriptor39, _assertThisInitialized(_this));
188
- _initializerDefineProperty(_this, "groupBuyStatus", _descriptor40, _assertThisInitialized(_this));
189
- _initializerDefineProperty(_this, "acceptSquare", _descriptor41, _assertThisInitialized(_this));
190
- _initializerDefineProperty(_this, "acceptStripe", _descriptor42, _assertThisInitialized(_this));
191
- _initializerDefineProperty(_this, "acceptPaypal", _descriptor43, _assertThisInitialized(_this));
192
- _initializerDefineProperty(_this, "acceptUtrust", _descriptor44, _assertThisInitialized(_this));
193
- _initializerDefineProperty(_this, "acceptBankTransfer", _descriptor45, _assertThisInitialized(_this));
194
- _initializerDefineProperty(_this, "acceptPhonePayment", _descriptor46, _assertThisInitialized(_this));
195
- _initializerDefineProperty(_this, "allowAutomaticPaymentSupply", _descriptor47, _assertThisInitialized(_this));
196
- _initializerDefineProperty(_this, "allowGroupBuy", _descriptor48, _assertThisInitialized(_this));
197
- _initializerDefineProperty(_this, "allowPaymentUpfront", _descriptor49, _assertThisInitialized(_this));
198
- _initializerDefineProperty(_this, "allowQuotation", _descriptor50, _assertThisInitialized(_this));
199
- _initializerDefineProperty(_this, "allowChainedInventoryCreation", _descriptor51, _assertThisInitialized(_this));
200
- _initializerDefineProperty(_this, "allowClientDraftContribution", _descriptor52, _assertThisInitialized(_this));
201
- _initializerDefineProperty(_this, "chainedInventoryHandlingUnitPrice", _descriptor53, _assertThisInitialized(_this));
202
- _initializerDefineProperty(_this, "bestPrice", _descriptor54, _assertThisInitialized(_this));
203
- _initializerDefineProperty(_this, "unitVolume", _descriptor55, _assertThisInitialized(_this));
204
- _initializerDefineProperty(_this, "categories", _descriptor56, _assertThisInitialized(_this));
205
- _initializerDefineProperty(_this, "platformCategories", _descriptor57, _assertThisInitialized(_this));
206
- _initializerDefineProperty(_this, "discountGroups", _descriptor58, _assertThisInitialized(_this));
207
- _initializerDefineProperty(_this, "domain", _descriptor59, _assertThisInitialized(_this));
208
- _initializerDefineProperty(_this, "taxType", _descriptor60, _assertThisInitialized(_this));
209
- _initializerDefineProperty(_this, "originalProduct", _descriptor61, _assertThisInitialized(_this));
210
- _initializerDefineProperty(_this, "clonedFromProduct", _descriptor62, _assertThisInitialized(_this));
211
- _initializerDefineProperty(_this, "chainedSupplierProduct", _descriptor63, _assertThisInitialized(_this));
212
- _initializerDefineProperty(_this, "chainedSellerProducts", _descriptor64, _assertThisInitialized(_this));
213
- _initializerDefineProperty(_this, "chainedInventorySupplierProduct", _descriptor65, _assertThisInitialized(_this));
214
- _initializerDefineProperty(_this, "chainedInventorySellerProducts", _descriptor66, _assertThisInitialized(_this));
215
- _initializerDefineProperty(_this, "component", _descriptor67, _assertThisInitialized(_this));
216
- _initializerDefineProperty(_this, "images", _descriptor68, _assertThisInitialized(_this));
217
- _initializerDefineProperty(_this, "publicFiles", _descriptor69, _assertThisInitialized(_this));
218
- _initializerDefineProperty(_this, "productionFiles", _descriptor70, _assertThisInitialized(_this));
219
- _initializerDefineProperty(_this, "groupVariationFields", _descriptor71, _assertThisInitialized(_this));
220
- _initializerDefineProperty(_this, "independentVariationFields", _descriptor72, _assertThisInitialized(_this));
221
- _initializerDefineProperty(_this, "tags", _descriptor73, _assertThisInitialized(_this));
222
- _initializerDefineProperty(_this, "internalTags", _descriptor74, _assertThisInitialized(_this));
223
- _initializerDefineProperty(_this, "seoDomainPages", _descriptor75, _assertThisInitialized(_this));
224
- _initializerDefineProperty(_this, "featureImage", _descriptor76, _assertThisInitialized(_this));
225
- _initializerDefineProperty(_this, "createdByJob", _descriptor77, _assertThisInitialized(_this));
226
- _initializerDefineProperty(_this, "defaultJob", _descriptor78, _assertThisInitialized(_this));
227
- _initializerDefineProperty(_this, "savedByCompanies", _descriptor79, _assertThisInitialized(_this));
228
- _initializerDefineProperty(_this, "suppliedByDomains", _descriptor80, _assertThisInitialized(_this));
229
- _initializerDefineProperty(_this, "autoAssignProductionOnAction", _descriptor81, _assertThisInitialized(_this));
230
- _initializerDefineProperty(_this, "supplyDomains", _descriptor82, _assertThisInitialized(_this));
231
- _initializerDefineProperty(_this, "inventoriesOpen", _descriptor83, _assertThisInitialized(_this));
232
- _initializerDefineProperty(_this, "supplyChainDisabled", _descriptor84, _assertThisInitialized(_this));
233
- _initializerDefineProperty(_this, "inventories", _descriptor85, _assertThisInitialized(_this));
234
- _initializerDefineProperty(_this, "cartItems", _descriptor86, _assertThisInitialized(_this));
235
- _initializerDefineProperty(_this, "jobs", _descriptor87, _assertThisInitialized(_this));
236
- _initializerDefineProperty(_this, "supplyChainRequestJobs", _descriptor88, _assertThisInitialized(_this));
237
- _initializerDefineProperty(_this, "savedByUsers", _descriptor89, _assertThisInitialized(_this));
238
- _initializerDefineProperty(_this, "suppliers", _descriptor90, _assertThisInitialized(_this));
239
- _initializerDefineProperty(_this, "draftTemplates", _descriptor91, _assertThisInitialized(_this));
240
- _this.duplicate = function () {
124
+ }), (_class = (_class2 = class Product extends _entity.Entity {
125
+ constructor() {
126
+ super(...arguments);
127
+ _initializerDefineProperty(this, "archived", _descriptor, this);
128
+ _initializerDefineProperty(this, "id", _descriptor2, this);
129
+ _initializerDefineProperty(this, "created", _descriptor3, this);
130
+ _initializerDefineProperty(this, "updated", _descriptor4, this);
131
+ _initializerDefineProperty(this, "createdBy", _descriptor5, this);
132
+ _initializerDefineProperty(this, "updatedBy", _descriptor6, this);
133
+ _initializerDefineProperty(this, "productType", _descriptor7, this);
134
+ _initializerDefineProperty(this, "minimum", _descriptor8, this);
135
+ _initializerDefineProperty(this, "minimumPerGroup", _descriptor9, this);
136
+ _initializerDefineProperty(this, "deliveryDaysNormal", _descriptor10, this);
137
+ _initializerDefineProperty(this, "unitPrice", _descriptor11, this);
138
+ _initializerDefineProperty(this, "buyUnitPrice", _descriptor12, this);
139
+ _initializerDefineProperty(this, "unitPriceDiscountGroup", _descriptor13, this);
140
+ _initializerDefineProperty(this, "shipmentMethods", _descriptor14, this);
141
+ _initializerDefineProperty(this, "margin", _descriptor15, this);
142
+ _initializerDefineProperty(this, "unitWeight", _descriptor16, this);
143
+ _initializerDefineProperty(this, "unitHeight", _descriptor17, this);
144
+ _initializerDefineProperty(this, "unitWidth", _descriptor18, this);
145
+ _initializerDefineProperty(this, "unitDepth", _descriptor19, this);
146
+ _initializerDefineProperty(this, "name", _descriptor20, this);
147
+ _initializerDefineProperty(this, "country", _descriptor21, this);
148
+ _initializerDefineProperty(this, "currency", _descriptor22, this);
149
+ _initializerDefineProperty(this, "description", _descriptor23, this);
150
+ _initializerDefineProperty(this, "notes", _descriptor24, this);
151
+ _initializerDefineProperty(this, "internalUseNotes", _descriptor25, this);
152
+ _initializerDefineProperty(this, "internalUseAiContext", _descriptor26, this);
153
+ _initializerDefineProperty(this, "aiContext", _descriptor27, this);
154
+ _initializerDefineProperty(this, "shopifyProductId", _descriptor28, this);
155
+ _initializerDefineProperty(this, "useCompanyShipmentMethods", _descriptor29, this);
156
+ _initializerDefineProperty(this, "dropShipment", _descriptor30, this);
157
+ _initializerDefineProperty(this, "needsDrafting", _descriptor31, this);
158
+ _initializerDefineProperty(this, "needsProduction", _descriptor32, this);
159
+ _initializerDefineProperty(this, "needsShipping", _descriptor33, this);
160
+ _initializerDefineProperty(this, "needsInvoicing", _descriptor34, this);
161
+ _initializerDefineProperty(this, "needsInventory", _descriptor35, this);
162
+ _initializerDefineProperty(this, "featureDeadline", _descriptor36, this);
163
+ _initializerDefineProperty(this, "showFeatureDeadline", _descriptor37, this);
164
+ _initializerDefineProperty(this, "showPublic", _descriptor38, this);
165
+ _initializerDefineProperty(this, "showGroupBuyStatus", _descriptor39, this);
166
+ _initializerDefineProperty(this, "groupBuyStatus", _descriptor40, this);
167
+ _initializerDefineProperty(this, "acceptSquare", _descriptor41, this);
168
+ _initializerDefineProperty(this, "acceptStripe", _descriptor42, this);
169
+ _initializerDefineProperty(this, "acceptPaypal", _descriptor43, this);
170
+ _initializerDefineProperty(this, "acceptUtrust", _descriptor44, this);
171
+ _initializerDefineProperty(this, "acceptBankTransfer", _descriptor45, this);
172
+ _initializerDefineProperty(this, "acceptPhonePayment", _descriptor46, this);
173
+ _initializerDefineProperty(this, "allowAutomaticPaymentSupply", _descriptor47, this);
174
+ _initializerDefineProperty(this, "allowGroupBuy", _descriptor48, this);
175
+ _initializerDefineProperty(this, "allowPaymentUpfront", _descriptor49, this);
176
+ _initializerDefineProperty(this, "allowQuotation", _descriptor50, this);
177
+ _initializerDefineProperty(this, "allowChainedInventoryCreation", _descriptor51, this);
178
+ _initializerDefineProperty(this, "allowClientDraftContribution", _descriptor52, this);
179
+ _initializerDefineProperty(this, "chainedInventoryHandlingUnitPrice", _descriptor53, this);
180
+ _initializerDefineProperty(this, "bestPrice", _descriptor54, this);
181
+ _initializerDefineProperty(this, "unitVolume", _descriptor55, this);
182
+ _initializerDefineProperty(this, "categories", _descriptor56, this);
183
+ _initializerDefineProperty(this, "platformCategories", _descriptor57, this);
184
+ _initializerDefineProperty(this, "discountGroups", _descriptor58, this);
185
+ _initializerDefineProperty(this, "domain", _descriptor59, this);
186
+ _initializerDefineProperty(this, "taxType", _descriptor60, this);
187
+ _initializerDefineProperty(this, "originalProduct", _descriptor61, this);
188
+ _initializerDefineProperty(this, "clonedFromProduct", _descriptor62, this);
189
+ _initializerDefineProperty(this, "chainedSupplierProduct", _descriptor63, this);
190
+ _initializerDefineProperty(this, "chainedSellerProducts", _descriptor64, this);
191
+ _initializerDefineProperty(this, "chainedInventorySupplierProduct", _descriptor65, this);
192
+ _initializerDefineProperty(this, "chainedInventorySellerProducts", _descriptor66, this);
193
+ _initializerDefineProperty(this, "component", _descriptor67, this);
194
+ _initializerDefineProperty(this, "images", _descriptor68, this);
195
+ _initializerDefineProperty(this, "publicFiles", _descriptor69, this);
196
+ _initializerDefineProperty(this, "productionFiles", _descriptor70, this);
197
+ _initializerDefineProperty(this, "groupVariationFields", _descriptor71, this);
198
+ _initializerDefineProperty(this, "independentVariationFields", _descriptor72, this);
199
+ _initializerDefineProperty(this, "tags", _descriptor73, this);
200
+ _initializerDefineProperty(this, "internalTags", _descriptor74, this);
201
+ _initializerDefineProperty(this, "seoDomainPages", _descriptor75, this);
202
+ _initializerDefineProperty(this, "featureImage", _descriptor76, this);
203
+ _initializerDefineProperty(this, "createdByJob", _descriptor77, this);
204
+ _initializerDefineProperty(this, "defaultJob", _descriptor78, this);
205
+ _initializerDefineProperty(this, "savedByCompanies", _descriptor79, this);
206
+ _initializerDefineProperty(this, "suppliedByDomains", _descriptor80, this);
207
+ _initializerDefineProperty(this, "autoAssignProductionOnAction", _descriptor81, this);
208
+ _initializerDefineProperty(this, "supplyDomains", _descriptor82, this);
209
+ _initializerDefineProperty(this, "inventoriesOpen", _descriptor83, this);
210
+ _initializerDefineProperty(this, "supplyChainDisabled", _descriptor84, this);
211
+ _initializerDefineProperty(this, "inventories", _descriptor85, this);
212
+ _initializerDefineProperty(this, "cartItems", _descriptor86, this);
213
+ _initializerDefineProperty(this, "jobs", _descriptor87, this);
214
+ _initializerDefineProperty(this, "supplyChainRequestJobs", _descriptor88, this);
215
+ _initializerDefineProperty(this, "savedByUsers", _descriptor89, this);
216
+ _initializerDefineProperty(this, "suppliers", _descriptor90, this);
217
+ _initializerDefineProperty(this, "draftTemplates", _descriptor91, this);
218
+ this.duplicate = () => {
241
219
  /* create a clone of this product on the backend, returning it. */
242
- var constructor = _this.constructor;
243
- var resourceName = constructor.resourceName;
244
- var singularName = constructor.singularName;
245
- var resource = "/".concat(resourceName, "/").concat(String(_this.id), "/copy/");
246
- var fetchOptions = {
220
+ const constructor = this.constructor;
221
+ const resourceName = constructor.resourceName;
222
+ const singularName = constructor.singularName;
223
+ const resource = `/${resourceName}/${String(this.id)}/copy/`;
224
+ const fetchOptions = {
247
225
  method: 'POST'
248
226
  };
249
- return _this.merchi.authenticatedFetch(resource, fetchOptions).then(function (data) {
250
- var product = new _this.merchi.Product();
227
+ return this.merchi.authenticatedFetch(resource, fetchOptions).then(data => {
228
+ const product = new this.merchi.Product();
251
229
  product.fromJson(data[singularName]);
252
230
  return product;
253
231
  });
254
232
  };
255
- _this.primaryImage = function () {
256
- if (_this.featureImage === undefined) {
233
+ this.primaryImage = () => {
234
+ if (this.featureImage === undefined) {
257
235
  throw new Error('featureImage is undefined, did you forget to embed it?');
258
236
  }
259
- if (_this.images === undefined) {
237
+ if (this.images === undefined) {
260
238
  throw new Error('images is undefined, did you forget to embed it?');
261
239
  }
262
- if (_this.featureImage !== null) {
263
- return _this.featureImage;
240
+ if (this.featureImage !== null) {
241
+ return this.featureImage;
264
242
  }
265
- if (_this.images.length > 0) {
266
- return _this.images[0];
243
+ if (this.images.length > 0) {
244
+ return this.images[0];
267
245
  }
268
246
  return null;
269
247
  };
270
- _this.hasGroupVariationFields = function () {
271
- if (_this.groupVariationFields === undefined) {
272
- var err = 'groupVariationFields is undefined, did you forget to embed' + ' it?';
248
+ this.hasGroupVariationFields = () => {
249
+ if (this.groupVariationFields === undefined) {
250
+ const err = 'groupVariationFields is undefined, did you forget to embed' + ' it?';
273
251
  throw new Error(err);
274
252
  }
275
- return _this.groupVariationFields.length > 0;
253
+ return this.groupVariationFields.length > 0;
276
254
  };
277
- _this.hasIndependentVariationFields = function () {
278
- if (_this.independentVariationFields === undefined) {
279
- var err = 'independentVariationFields is undefined, did you forget to' + ' embed it?';
255
+ this.hasIndependentVariationFields = () => {
256
+ if (this.independentVariationFields === undefined) {
257
+ const err = 'independentVariationFields is undefined, did you forget to' + ' embed it?';
280
258
  throw new Error(err);
281
259
  }
282
- return _this.independentVariationFields.length > 0;
260
+ return this.independentVariationFields.length > 0;
283
261
  };
284
- _this.allVariationFields = function () {
285
- if (_this.groupVariationFields === undefined) {
286
- var err = 'groupVariationFields is undefined, did you forget to embed' + ' it?';
262
+ this.allVariationFields = () => {
263
+ if (this.groupVariationFields === undefined) {
264
+ const err = 'groupVariationFields is undefined, did you forget to embed' + ' it?';
287
265
  throw new Error(err);
288
266
  }
289
- if (_this.independentVariationFields === undefined) {
290
- var _err = 'independentVariationFields is undefined, did you forget to' + ' embed it?';
291
- throw new Error(_err);
267
+ if (this.independentVariationFields === undefined) {
268
+ const err = 'independentVariationFields is undefined, did you forget to' + ' embed it?';
269
+ throw new Error(err);
292
270
  }
293
- var result = [];
294
- return result.concat(_this.groupVariationFields, _this.independentVariationFields);
271
+ const result = [];
272
+ return result.concat(this.groupVariationFields, this.independentVariationFields);
295
273
  };
296
- _this.buildEmptyVariations = function () {
297
- if (_this.independentVariationFields === undefined) {
298
- var err = 'independentVariationFields is undefined, did you forget to' + ' embed it?';
274
+ this.buildEmptyVariations = () => {
275
+ if (this.independentVariationFields === undefined) {
276
+ const err = 'independentVariationFields is undefined, did you forget to' + ' embed it?';
299
277
  throw new Error(err);
300
278
  }
301
- var iVF = _.orderBy(_this.independentVariationFields, ['position'], ['asc']);
302
- return iVF.map(function (field) {
303
- return field.buildEmptyVariation();
304
- });
279
+ const iVF = _.orderBy(this.independentVariationFields, ['position'], ['asc']);
280
+ return iVF.map(field => field.buildEmptyVariation());
305
281
  };
306
- _this.buildEmptyVariationGroup = function () {
307
- if (_this.groupVariationFields === undefined) {
308
- var err = 'groupVariationFields is undefined, did you forget to embed' + ' it?';
282
+ this.buildEmptyVariationGroup = () => {
283
+ if (this.groupVariationFields === undefined) {
284
+ const err = 'groupVariationFields is undefined, did you forget to embed' + ' it?';
309
285
  throw new Error(err);
310
286
  }
311
- var result = new _this.merchi.VariationsGroup();
312
- var variations = [];
313
- var cost = 0;
314
- var sortedFields = _.orderBy(_this.groupVariationFields, ['position'], ['asc']);
287
+ const result = new this.merchi.VariationsGroup();
288
+ const variations = [];
289
+ let cost = 0;
290
+ const sortedFields = _.orderBy(this.groupVariationFields, ['position'], ['asc']);
315
291
  result.quantity = 0;
316
- var _iterator = _createForOfIteratorHelper(sortedFields),
317
- _step;
318
- try {
319
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
320
- var variationField = _step.value;
321
- var empty = variationField.buildEmptyVariation();
322
- variations.push(empty);
323
- cost += empty.cost;
324
- }
325
- } catch (err) {
326
- _iterator.e(err);
327
- } finally {
328
- _iterator.f();
292
+ for (const variationField of sortedFields) {
293
+ const empty = variationField.buildEmptyVariation();
294
+ variations.push(empty);
295
+ cost += empty.cost;
329
296
  }
330
297
  result.groupCost = cost;
331
298
  result.variations = variations;
332
299
  return result;
333
300
  };
334
- _this.removeVariationField = function (variationField) {
301
+ this.removeVariationField = variationField => {
335
302
  if (variationField.independent === undefined) {
336
303
  throw new Error('variation.independent is undefined, did you ' + 'forget to embed it?');
337
304
  }
338
- if (_this.independentVariationFields === undefined) {
339
- var err = 'independentVariationFields is undefined, did you forget to' + ' embed it?';
305
+ if (this.independentVariationFields === undefined) {
306
+ const err = 'independentVariationFields is undefined, did you forget to' + ' embed it?';
340
307
  throw new Error(err);
341
308
  }
342
- if (_this.groupVariationFields === undefined) {
343
- var _err2 = 'groupVariationFields is undefined, did you forget to embed' + ' it?';
344
- throw new Error(_err2);
309
+ if (this.groupVariationFields === undefined) {
310
+ const err = 'groupVariationFields is undefined, did you forget to embed' + ' it?';
311
+ throw new Error(err);
345
312
  }
346
- var variationFields = variationField.independent ? _this.independentVariationFields : _this.groupVariationFields;
347
- var index = variationFields.findIndex(function (v) {
313
+ const variationFields = variationField.independent ? this.independentVariationFields : this.groupVariationFields;
314
+ const index = variationFields.findIndex(v => {
348
315
  if (v.id === undefined) {
349
316
  throw new Error('variation id is undefined, did you forget to ' + 'embed it?');
350
317
  }
@@ -352,10 +319,8 @@ var Product = exports.Product = (_dec = Product.property({
352
319
  });
353
320
  return variationFields.splice(index, 1);
354
321
  };
355
- return _this;
356
322
  }
357
- return _createClass(Product);
358
- }(_entity.Entity), _class2.resourceName = 'products', _class2.singularName = 'product', _class2.pluralName = 'products', _class2), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "archived", [_dec], {
323
+ }, _class2.resourceName = 'products', _class2.singularName = 'product', _class2.pluralName = 'products', _class2), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "archived", [_dec], {
359
324
  configurable: true,
360
325
  enumerable: true,
361
326
  writable: true,
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -8,21 +7,9 @@ exports.ProductionComment = void 0;
8
7
  var _entity = require("../entity");
9
8
  var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _class2;
10
9
  function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
11
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
12
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
14
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
15
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
17
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
18
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
19
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
20
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
21
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
22
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
23
10
  function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
24
11
  function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
25
- var ProductionComment = exports.ProductionComment = (_dec = ProductionComment.property({
12
+ let ProductionComment = exports.ProductionComment = (_dec = ProductionComment.property({
26
13
  type: Date
27
14
  }), _dec2 = ProductionComment.property(), _dec3 = ProductionComment.property({
28
15
  type: Date
@@ -32,32 +19,24 @@ var ProductionComment = exports.ProductionComment = (_dec = ProductionComment.pr
32
19
  arrayType: 'User'
33
20
  }), _dec12 = ProductionComment.property({
34
21
  arrayType: 'Notification'
35
- }), _dec13 = ProductionComment.property(), (_class = (_class2 = /*#__PURE__*/function (_Entity) {
36
- _inherits(ProductionComment, _Entity);
37
- function ProductionComment() {
38
- var _this;
39
- _classCallCheck(this, ProductionComment);
40
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
41
- args[_key] = arguments[_key];
42
- }
43
- _this = _callSuper(this, ProductionComment, [].concat(args));
44
- _initializerDefineProperty(_this, "archived", _descriptor, _assertThisInitialized(_this));
45
- _initializerDefineProperty(_this, "id", _descriptor2, _assertThisInitialized(_this));
46
- _initializerDefineProperty(_this, "date", _descriptor3, _assertThisInitialized(_this));
47
- _initializerDefineProperty(_this, "urgency", _descriptor4, _assertThisInitialized(_this));
48
- _initializerDefineProperty(_this, "text", _descriptor5, _assertThisInitialized(_this));
49
- _initializerDefineProperty(_this, "isUrgentQuestion", _descriptor6, _assertThisInitialized(_this));
50
- _initializerDefineProperty(_this, "sendSms", _descriptor7, _assertThisInitialized(_this));
51
- _initializerDefineProperty(_this, "sendEmail", _descriptor8, _assertThisInitialized(_this));
52
- _initializerDefineProperty(_this, "files", _descriptor9, _assertThisInitialized(_this));
53
- _initializerDefineProperty(_this, "user", _descriptor10, _assertThisInitialized(_this));
54
- _initializerDefineProperty(_this, "forwards", _descriptor11, _assertThisInitialized(_this));
55
- _initializerDefineProperty(_this, "notifications", _descriptor12, _assertThisInitialized(_this));
56
- _initializerDefineProperty(_this, "assignment", _descriptor13, _assertThisInitialized(_this));
57
- return _this;
22
+ }), _dec13 = ProductionComment.property(), (_class = (_class2 = class ProductionComment extends _entity.Entity {
23
+ constructor() {
24
+ super(...arguments);
25
+ _initializerDefineProperty(this, "archived", _descriptor, this);
26
+ _initializerDefineProperty(this, "id", _descriptor2, this);
27
+ _initializerDefineProperty(this, "date", _descriptor3, this);
28
+ _initializerDefineProperty(this, "urgency", _descriptor4, this);
29
+ _initializerDefineProperty(this, "text", _descriptor5, this);
30
+ _initializerDefineProperty(this, "isUrgentQuestion", _descriptor6, this);
31
+ _initializerDefineProperty(this, "sendSms", _descriptor7, this);
32
+ _initializerDefineProperty(this, "sendEmail", _descriptor8, this);
33
+ _initializerDefineProperty(this, "files", _descriptor9, this);
34
+ _initializerDefineProperty(this, "user", _descriptor10, this);
35
+ _initializerDefineProperty(this, "forwards", _descriptor11, this);
36
+ _initializerDefineProperty(this, "notifications", _descriptor12, this);
37
+ _initializerDefineProperty(this, "assignment", _descriptor13, this);
58
38
  }
59
- return _createClass(ProductionComment);
60
- }(_entity.Entity), _class2.resourceName = 'production_comments', _class2.singularName = 'productionComment', _class2.pluralName = 'productionComments', _class2), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "archived", [_dec], {
39
+ }, _class2.resourceName = 'production_comments', _class2.singularName = 'productionComment', _class2.pluralName = 'productionComments', _class2), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "archived", [_dec], {
61
40
  configurable: true,
62
41
  enumerable: true,
63
42
  writable: true,