merchi_sdk_js 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. package/package.json +4 -4
  2. package/dist/address.js +0 -109
  3. package/dist/assignment.js +0 -175
  4. package/dist/automatic_payment_relationship.js +0 -72
  5. package/dist/backup.js +0 -32
  6. package/dist/bank.js +0 -25
  7. package/dist/cart.js +0 -133
  8. package/dist/cart_item.js +0 -71
  9. package/dist/cart_shipment_group.js +0 -23
  10. package/dist/cart_shipment_quote.js +0 -26
  11. package/dist/category.js +0 -68
  12. package/dist/company.js +0 -248
  13. package/dist/company_invitation.js +0 -70
  14. package/dist/component.js +0 -107
  15. package/dist/component_tag.js +0 -60
  16. package/dist/component_version.js +0 -21
  17. package/dist/country_tax.js +0 -93
  18. package/dist/dictionary.js +0 -130
  19. package/dist/discount.js +0 -22
  20. package/dist/discount_group.js +0 -18
  21. package/dist/domain.js +0 -245
  22. package/dist/domain_invitation.js +0 -17
  23. package/dist/domain_tag.js +0 -87
  24. package/dist/domain_types.js +0 -22
  25. package/dist/draft.js +0 -97
  26. package/dist/draft_comment.js +0 -45
  27. package/dist/draft_template.js +0 -39
  28. package/dist/email_address.js +0 -34
  29. package/dist/email_counter.js +0 -47
  30. package/dist/enrolled_domain.js +0 -88
  31. package/dist/exchange_rate.js +0 -66
  32. package/dist/field_types.js +0 -19
  33. package/dist/helpers.js +0 -86
  34. package/dist/internal_tag.js +0 -98
  35. package/dist/inventory.js +0 -100
  36. package/dist/inventory_unit_variation.js +0 -19
  37. package/dist/invoice.js +0 -225
  38. package/dist/invoice_types.js +0 -11
  39. package/dist/item.js +0 -25
  40. package/dist/job.js +0 -536
  41. package/dist/job_comment.js +0 -45
  42. package/dist/job_status.js +0 -47
  43. package/dist/matching_inventory.js +0 -21
  44. package/dist/md5.js +0 -149
  45. package/dist/menu.js +0 -37
  46. package/dist/menu_item.js +0 -24
  47. package/dist/merchi.js +0 -1004
  48. package/dist/merchi_file.js +0 -165
  49. package/dist/model.js +0 -753
  50. package/dist/notification.js +0 -151
  51. package/dist/notification_types.js +0 -199
  52. package/dist/output.cjs.js +0 -31317
  53. package/dist/output.esm.js +0 -31312
  54. package/dist/page.js +0 -41
  55. package/dist/payment.js +0 -32
  56. package/dist/payment_device.js +0 -21
  57. package/dist/payment_types.js +0 -20
  58. package/dist/phone_number.js +0 -37
  59. package/dist/product.js +0 -288
  60. package/dist/product_types.js +0 -32
  61. package/dist/production_comment.js +0 -44
  62. package/dist/quote.js +0 -91
  63. package/dist/quote_item.js +0 -59
  64. package/dist/roles.js +0 -29
  65. package/dist/seo_domain_page.js +0 -42
  66. package/dist/session.js +0 -103
  67. package/dist/set.js +0 -29
  68. package/dist/shipment.js +0 -181
  69. package/dist/shipment_item.js +0 -17
  70. package/dist/shipment_item_fulfillment.js +0 -17
  71. package/dist/shipment_method.js +0 -81
  72. package/dist/shipment_method_variation.js +0 -38
  73. package/dist/subscription_plan.js +0 -75
  74. package/dist/supply_domain.js +0 -65
  75. package/dist/system_role.js +0 -12
  76. package/dist/theme.js +0 -180
  77. package/dist/theme_css_setting.js +0 -61
  78. package/dist/theme_status.js +0 -11
  79. package/dist/user.js +0 -409
  80. package/dist/user_company.js +0 -19
  81. package/dist/user_types.js +0 -23
  82. package/dist/uuid.js +0 -12
  83. package/dist/variation.js +0 -233
  84. package/dist/variation_field.js +0 -233
  85. package/dist/variation_fields_option.js +0 -41
  86. package/dist/variation_option.js +0 -62
  87. package/dist/variations_group.js +0 -43
  88. package/dist/white_label_accessibilities.js +0 -11
@@ -1,39 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.DraftTemplate = DraftTemplate;
7
- var _model = require("./model.js");
8
- var _job = require("./job.js");
9
- var _product = require("./product.js");
10
- var _merchi_file = require("./merchi_file.js");
11
- function DraftTemplate() {
12
- this.resource = '/draft_comments';
13
- this.json = 'draftComment';
14
- (0, _model.addPropertyTo)(this, 'id');
15
- (0, _model.addPropertyTo)(this, 'product', _product.Product);
16
- (0, _model.addPropertyTo)(this, 'file', _merchi_file.MerchiFile);
17
- (0, _model.addPropertyTo)(this, 'job', _job.Job);
18
- (0, _model.addPropertyTo)(this, 'date');
19
- (0, _model.addPropertyTo)(this, 'name');
20
- (0, _model.addPropertyTo)(this, 'description');
21
- (0, _model.addPropertyTo)(this, 'height');
22
- (0, _model.addPropertyTo)(this, 'width');
23
- this.create = function (options) {
24
- var data = (0, _model.serialise)(this),
25
- self = this;
26
- function handleResponse(result) {
27
- options.success((0, _model.fromJson)(self, result[self.json]));
28
- }
29
- (0, _model.create)({
30
- resource: this.resource,
31
- parameters: data[0],
32
- files: (0, _model.enumerateFiles)(data[1]),
33
- success: handleResponse,
34
- as_domain: options.as_domain,
35
- error: options.error,
36
- embed: options.embed
37
- });
38
- };
39
- }
@@ -1,34 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.EmailAddress = EmailAddress;
7
- exports.EmailAddresses = EmailAddresses;
8
- var _uuid = require("./uuid.js");
9
- var _model = require("./model.js");
10
- function EmailAddress() {
11
- this.resource = '/email_addresses';
12
- this.json = 'emailAddress';
13
- this.temporaryId = (0, _uuid.generateUUID)();
14
- (0, _model.addPropertyTo)(this, 'id');
15
- (0, _model.addPropertyTo)(this, 'emailAddress');
16
- }
17
- function EmailAddresses() {
18
- this.resource = '/email_addresses';
19
- this.json = 'emailAddresses';
20
- this.single = EmailAddress;
21
- this.get = function (success, error, offset, limit, q) {
22
- var self = this;
23
- function handleResponse(result) {
24
- success((0, _model.fromJsonList)(self, result, {
25
- makesDirty: false
26
- }));
27
- }
28
- (0, _model.getList)(this.resource, handleResponse, error, {
29
- offset: offset,
30
- limit: limit,
31
- q: q
32
- });
33
- };
34
- }
@@ -1,47 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.EmailCounter = EmailCounter;
7
- exports.EmailCounters = EmailCounters;
8
- var _model = require("./model.js");
9
- function EmailCounter() {
10
- this.resource = '/email_counters';
11
- this.json = 'emailCounter';
12
- (0, _model.addPropertyTo)(this, 'emailAddress');
13
- (0, _model.addPropertyTo)(this, 'unsubscribed');
14
- (0, _model.addPropertyTo)(this, 'silenced');
15
- (0, _model.addPropertyTo)(this, 'tokens');
16
- this.patch = function (success, error, embed) {
17
- var self = this,
18
- data = (0, _model.serialise)(this, undefined, undefined, undefined, {
19
- excludeOld: true
20
- })[0];
21
- function handleResponse(result) {
22
- success((0, _model.fromJson)(self, result[self.json]));
23
- }
24
- (0, _model.patchOne)({
25
- resource: this.resource,
26
- id: this.emailAddress(),
27
- success: handleResponse,
28
- error: error,
29
- data: data,
30
- embed: embed
31
- });
32
- };
33
- }
34
- function EmailCounters() {
35
- this.resource = '/email_counters';
36
- this.json = 'emailCounters';
37
- this.single = EmailCounter;
38
- this.get = function (success, error, parameters) {
39
- var self = this;
40
- function handleResponse(result) {
41
- success((0, _model.fromJsonList)(self, result, {
42
- makesDirty: false
43
- }));
44
- }
45
- (0, _model.getList)(this.resource, handleResponse, error, parameters);
46
- };
47
- }
@@ -1,88 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.EnrolledDomain = EnrolledDomain;
7
- exports.EnrolledDomains = EnrolledDomains;
8
- var _uuid = require("./uuid.js");
9
- var _model = require("./model.js");
10
- var _domain = require("./domain.js");
11
- var _user = require("./user.js");
12
- function EnrolledDomain() {
13
- this.resource = '/enrolled_domains';
14
- this.json = 'enrolledDomain';
15
- this.temporaryId = (0, _uuid.generateUUID)();
16
- (0, _model.addPropertyTo)(this, 'id');
17
- (0, _model.addPropertyTo)(this, 'role');
18
- (0, _model.addPropertyTo)(this, 'user', _user.User);
19
- (0, _model.addPropertyTo)(this, 'domain', _domain.Domain);
20
- (0, _model.addPropertyTo)(this, 'isJobsAssignee');
21
- this.create = function (success, error, embed, as_domain) {
22
- var self = this,
23
- data = (0, _model.serialise)(self);
24
- function handleResponse(result) {
25
- success((0, _model.fromJson)(self, result[self.json]));
26
- }
27
- (0, _model.create)({
28
- resource: this.resource,
29
- parameters: data[0],
30
- as_domain: as_domain,
31
- files: (0, _model.enumerateFiles)(data[1]),
32
- success: handleResponse,
33
- error: error,
34
- embed: embed
35
- });
36
- };
37
- this.get = function (success, error) {
38
- var self = this;
39
- function handleResponse(result) {
40
- success((0, _model.fromJson)(self, result[self.json], {
41
- makesDirty: false
42
- }));
43
- }
44
- (0, _model.getOne)({
45
- resource: this.resource,
46
- id: this.id(),
47
- success: handleResponse,
48
- error: error
49
- });
50
- };
51
- this.patch = function (success, error, embed, asDomain) {
52
- var self = this,
53
- data = (0, _model.serialise)(self, undefined, undefined, undefined, {
54
- excludeOld: true
55
- })[0];
56
- function handleResponse(result) {
57
- success((0, _model.fromJson)(self, result[self.json], {
58
- makesDirty: false
59
- }));
60
- }
61
- (0, _model.patchOne)({
62
- resource: this.resource,
63
- id: this.id(),
64
- as_domain: asDomain,
65
- success: handleResponse,
66
- error: error,
67
- data: data,
68
- embed: embed
69
- });
70
- };
71
- this.destroy = function (success, error) {
72
- (0, _model.deleteOne)(this.resource + "/" + this.id(), success, error);
73
- };
74
- }
75
- function EnrolledDomains() {
76
- this.resource = '/enrolled_domains';
77
- this.json = 'enrolledDomains';
78
- this.single = EnrolledDomain;
79
- this.get = function (success, error, parameters) {
80
- var self = this;
81
- function handleResponse(result) {
82
- success((0, _model.fromJsonList)(self, result, {
83
- makesDirty: false
84
- }));
85
- }
86
- (0, _model.getList)(this.resource, handleResponse, error, parameters);
87
- };
88
- }
@@ -1,66 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ExchangeRate = ExchangeRate;
7
- exports.ExchangeRates = ExchangeRates;
8
- var _uuid = require("./uuid.js");
9
- var _model = require("./model.js");
10
- function ExchangeRate() {
11
- this.resource = '/exchange_rates';
12
- this.json = 'exchangeRate';
13
- this.temporaryId = (0, _uuid.generateUUID)();
14
- (0, _model.addPropertyTo)(this, 'id');
15
- (0, _model.addPropertyTo)(this, 'fromCurrency');
16
- (0, _model.addPropertyTo)(this, 'toCurrency');
17
- (0, _model.addPropertyTo)(this, 'rate');
18
- (0, _model.addPropertyTo)(this, 'lastUpdated');
19
- this.create = function (success, error, embed, domainId) {
20
- var data = (0, _model.serialise)(this),
21
- self = this;
22
- function handleResponse(result) {
23
- success((0, _model.fromJson)(self, result[self.json]));
24
- }
25
- (0, _model.create)({
26
- resource: this.resource,
27
- parameters: data[0],
28
- files: (0, _model.enumerateFiles)(data[1]),
29
- success: handleResponse,
30
- error: error,
31
- embed: embed,
32
- as_domain: domainId
33
- });
34
- };
35
- this.get = function (success, error) {
36
- var self = this;
37
- function handleResponse(result) {
38
- success((0, _model.fromJson)(self, result[self.json], {
39
- makesDirty: false
40
- }));
41
- }
42
- (0, _model.getOne)({
43
- resource: this.resource,
44
- id: this.id(),
45
- success: handleResponse,
46
- error: error
47
- });
48
- };
49
- this.destroy = function (success, error) {
50
- (0, _model.deleteOne)(this.resource + "/" + this.id(), success, error);
51
- };
52
- }
53
- function ExchangeRates() {
54
- this.resource = '/exchange_rates';
55
- this.json = 'exchangeRates';
56
- this.single = ExchangeRate;
57
- this.get = function (success, error, parameters) {
58
- var self = this;
59
- function handleResponse(result) {
60
- success((0, _model.fromJsonList)(self, result, {
61
- makesDirty: false
62
- }));
63
- }
64
- (0, _model.getList)(this.resource, handleResponse, error, parameters);
65
- };
66
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.fieldTypes = void 0;
7
- var _dictionary = require("./dictionary.js");
8
- var fieldTypes = exports.fieldTypes = new _dictionary.Dictionary();
9
- fieldTypes.add("TEXT_INPUT", 1);
10
- fieldTypes.add("SELECT", 2);
11
- fieldTypes.add("FILE_UPLOAD", 3);
12
- fieldTypes.add("TEXT_AREA", 4);
13
- fieldTypes.add("NUMBER_INPUT", 5);
14
- fieldTypes.add("CHECKBOX", 6);
15
- fieldTypes.add("RADIO", 7);
16
- fieldTypes.add("FIELD_INSTRUCTIONS", 8);
17
- fieldTypes.add("IMAGE_SELECT", 9);
18
- fieldTypes.add("COLOUR_PICKER", 10);
19
- fieldTypes.add("COLOUR_SELECT", 11);
package/dist/helpers.js DELETED
@@ -1,86 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.any = any;
7
- exports.clone = clone;
8
- exports.getGlobal = getGlobal;
9
- exports.id = id;
10
- exports.isArray = isArray;
11
- exports.isNull = isNull;
12
- exports.isUndefined = isUndefined;
13
- exports.isUndefinedOrNull = isUndefinedOrNull;
14
- exports.notEmpty = notEmpty;
15
- exports.notEmptyArray = notEmptyArray;
16
- exports.removeObjectFromArrayBasedOnCondition = removeObjectFromArrayBasedOnCondition;
17
- exports.removeObjectFromArrayWithIntegerValue = removeObjectFromArrayWithIntegerValue;
18
- exports.sortArray = sortArray;
19
- exports.sortArrayByObjectKey = sortArrayByObjectKey;
20
- exports.sortArrayByObjectKeyDescending = sortArrayByObjectKeyDescending;
21
- var _browserOrNode = require("browser-or-node");
22
- function id(x) {
23
- return x;
24
- }
25
- function isUndefined(x) {
26
- return x === undefined;
27
- }
28
- function notEmpty(value) {
29
- return !(isUndefined(value) || value === null || value === "");
30
- }
31
- function isNull(x) {
32
- return x === null;
33
- }
34
- function isUndefinedOrNull(x) {
35
- return isUndefined(x) || isNull(x);
36
- }
37
- function getGlobal() {
38
- if (_browserOrNode.isBrowser || _browserOrNode.isJsDom) {
39
- return window;
40
- }
41
- return global;
42
- }
43
- function isArray(x) {
44
- return Array.isArray(x);
45
- }
46
- function notEmptyArray(array) {
47
- return isArray(array) && array.length > 0;
48
- }
49
- function removeObjectFromArrayBasedOnCondition(array, condition) {
50
- array.splice(array.findIndex(condition), 1);
51
- }
52
- function removeObjectFromArrayWithIntegerValue(array, objectKey, value) {
53
- var key = !objectKey ? objectKey : 'id',
54
- intValue = parseInt(value, 10);
55
- removeObjectFromArrayBasedOnCondition(array, function (obj) {
56
- return obj[key]() === intValue;
57
- });
58
- }
59
- function clone(oldObject) {
60
- return Object.assign(oldObject, {});
61
- }
62
- function any(iterable, condition) {
63
- for (var index = 0; index < iterable.length; ++index) {
64
- if (!isUndefined(condition) && condition(iterable[index])) {
65
- return true;
66
- } else if (iterable[index]) {
67
- return true;
68
- }
69
- }
70
- return false;
71
- }
72
- function sortArray(array, objectKey, desc) {
73
- return array ? array.sort(function (a, b) {
74
- if (desc) {
75
- return b[objectKey]() - a[objectKey]();
76
- } else {
77
- return a[objectKey]() - b[objectKey]();
78
- }
79
- }) : [];
80
- }
81
- function sortArrayByObjectKey(array, objectKey) {
82
- return sortArray(array, objectKey);
83
- }
84
- function sortArrayByObjectKeyDescending(array, objectKey) {
85
- return sortArray(array, objectKey, true);
86
- }
@@ -1,98 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.InternalTag = InternalTag;
7
- exports.InternalTags = InternalTags;
8
- var _uuid = require("./uuid.js");
9
- var _model = require("./model.js");
10
- var _company = require("./company.js");
11
- var _domain = require("./domain.js");
12
- var _invoice = require("./invoice.js");
13
- var _job = require("./job.js");
14
- var _product = require("./product.js");
15
- var _shipment = require("./shipment.js");
16
- var _theme = require("./theme.js");
17
- var _user = require("./user.js");
18
- function InternalTag() {
19
- this.resource = '/internal_tags';
20
- this.json = 'internalTag';
21
- this.temporaryId = (0, _uuid.generateUUID)();
22
- (0, _model.addPropertyTo)(this, 'id');
23
- (0, _model.addPropertyTo)(this, 'name');
24
- (0, _model.addPropertyTo)(this, 'description');
25
- (0, _model.addPropertyTo)(this, 'colour');
26
- (0, _model.addPropertyTo)(this, 'companies', _company.Company);
27
- (0, _model.addPropertyTo)(this, 'domains', _domain.Domain);
28
- (0, _model.addPropertyTo)(this, 'invoices', _invoice.Invoice);
29
- (0, _model.addPropertyTo)(this, 'jobs', _job.Job);
30
- (0, _model.addPropertyTo)(this, 'products', _product.Product);
31
- (0, _model.addPropertyTo)(this, 'shipments', _shipment.Shipment);
32
- (0, _model.addPropertyTo)(this, 'themes', _theme.Theme);
33
- (0, _model.addPropertyTo)(this, 'users', _user.User);
34
- this.create = function (success, error, embed, domainId) {
35
- var data = (0, _model.serialise)(this),
36
- self = this;
37
- function handleResponse(result) {
38
- success((0, _model.fromJson)(self, result[self.json]));
39
- }
40
- (0, _model.create)({
41
- resource: this.resource,
42
- parameters: data[0],
43
- files: (0, _model.enumerateFiles)(data[1]),
44
- success: handleResponse,
45
- error: error,
46
- embed: embed,
47
- as_domain: domainId
48
- });
49
- };
50
- this.get = function (success, error) {
51
- var self = this;
52
- function handleResponse(result) {
53
- success((0, _model.fromJson)(self, result[self.json], {
54
- makesDirty: false
55
- }));
56
- }
57
- (0, _model.getOne)({
58
- resource: this.resource,
59
- id: this.id(),
60
- success: handleResponse,
61
- error: error
62
- });
63
- };
64
- this.patch = function (success, error, embed) {
65
- var self = this,
66
- data = (0, _model.serialise)(this)[0];
67
- function handleResponse(result) {
68
- success((0, _model.fromJson)(self, result[self.json], {
69
- makesDirty: false
70
- }));
71
- }
72
- (0, _model.patchOne)({
73
- resource: this.resource,
74
- id: this.id(),
75
- success: handleResponse,
76
- error: error,
77
- data: data,
78
- embed: embed
79
- });
80
- };
81
- this.destroy = function (success, error) {
82
- (0, _model.deleteOne)(this.resource + "/" + this.id(), success, error);
83
- };
84
- }
85
- function InternalTags() {
86
- this.resource = '/internal_tags';
87
- this.json = 'internalTags';
88
- this.single = InternalTag;
89
- this.get = function (success, error, parameters) {
90
- var self = this;
91
- function handleResponse(result) {
92
- success((0, _model.fromJsonList)(self, result, {
93
- makesDirty: false
94
- }));
95
- }
96
- (0, _model.getList)(this.resource, handleResponse, error, parameters);
97
- };
98
- }
package/dist/inventory.js DELETED
@@ -1,100 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Inventories = Inventories;
7
- exports.Inventory = Inventory;
8
- var _uuid = require("./uuid.js");
9
- var _model = require("./model.js");
10
- var _address = require("./address.js");
11
- var _inventory_unit_variation = require("./inventory_unit_variation.js");
12
- var _product = require("./product.js");
13
- function Inventory() {
14
- this.resource = '/inventories';
15
- this.json = 'inventory';
16
- this.temporaryId = (0, _uuid.generateUUID)();
17
- (0, _model.addPropertyTo)(this, 'id');
18
- (0, _model.addPropertyTo)(this, 'name');
19
- (0, _model.addPropertyTo)(this, 'notes');
20
- (0, _model.addPropertyTo)(this, 'quantity');
21
- (0, _model.addPropertyTo)(this, 'product', _product.Product);
22
- (0, _model.addPropertyTo)(this, 'address', _address.Address);
23
- (0, _model.addPropertyTo)(this, 'inventoryUnitVariations', _inventory_unit_variation.InventoryUnitVariation);
24
- this.create = function (success, error, embed, domainId) {
25
- var data = (0, _model.serialise)(this),
26
- self = this;
27
- function handleResponse(result) {
28
- success((0, _model.fromJson)(self, result[self.json]));
29
- }
30
- (0, _model.create)({
31
- resource: this.resource,
32
- parameters: data[0],
33
- files: (0, _model.enumerateFiles)(data[1]),
34
- success: handleResponse,
35
- error: error,
36
- embed: embed,
37
- as_domain: domainId
38
- });
39
- };
40
- this.get = function (success, error) {
41
- var self = this;
42
- function handleResponse(result) {
43
- success((0, _model.fromJson)(self, result[self.json], {
44
- makesDirty: false
45
- }));
46
- }
47
- (0, _model.getOne)({
48
- resource: this.resource,
49
- id: this.id(),
50
- success: handleResponse,
51
- error: error
52
- });
53
- };
54
- this.destroy = function (success, error) {
55
- (0, _model.deleteOne)(this.resource + "/" + this.id(), success, error);
56
- };
57
- this.patch = function (success, error, embed) {
58
- var self = this,
59
- data = (0, _model.serialise)(this)[0];
60
- function handleResponse(result) {
61
- success((0, _model.fromJson)(self, result[self.json]));
62
- }
63
- (0, _model.patchOne)({
64
- resource: this.resource,
65
- id: this.id(),
66
- success: handleResponse,
67
- error: error,
68
- data: data,
69
- embed: embed
70
- });
71
- };
72
- this.update = function (success, error, embed) {
73
- this.patch(success, error, (0, _model.serialise)(this, undefined, undefined, undefined, {
74
- excludeOld: true
75
- })[0], embed);
76
- };
77
- this.isVariationFieldOptionSelected = function (option) {
78
- var selectedVariations = this.inventoryUnitVariations() ? this.inventoryUnitVariations() : [];
79
- for (var i = 0; i < selectedVariations.length; i++) {
80
- if (selectedVariations[i].optionId() === option.id()) {
81
- return true;
82
- }
83
- }
84
- return false;
85
- };
86
- }
87
- function Inventories() {
88
- this.resource = '/inventories';
89
- this.json = 'inventories';
90
- this.single = Inventory;
91
- this.get = function (success, error, parameters) {
92
- var self = this;
93
- function handleResponse(result) {
94
- success((0, _model.fromJsonList)(self, result, {
95
- makesDirty: false
96
- }));
97
- }
98
- (0, _model.getList)(this.resource, handleResponse, error, parameters);
99
- };
100
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.InventoryUnitVariation = InventoryUnitVariation;
7
- var _model = require("./model.js");
8
- var _inventory = require("./inventory.js");
9
- var _variation_fields_option = require("./variation_fields_option.js");
10
- function InventoryUnitVariation() {
11
- this.resource = '/inventory_unit_variations';
12
- this.json = 'inventoryUnitVariation';
13
- (0, _model.addPropertyTo)(this, 'id');
14
- (0, _model.addPropertyTo)(this, 'inventory', _inventory.Inventory);
15
- (0, _model.addPropertyTo)(this, 'variationFieldsOption', _variation_fields_option.VariationFieldsOption);
16
- this.optionId = function () {
17
- return this.variationFieldsOption().id();
18
- };
19
- }