merchi_sdk_js 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/address.js +109 -0
- package/dist/assignment.js +175 -0
- package/dist/automatic_payment_relationship.js +72 -0
- package/dist/backup.js +32 -0
- package/dist/bank.js +25 -0
- package/dist/cart.js +133 -0
- package/dist/cart_item.js +71 -0
- package/dist/cart_shipment_group.js +23 -0
- package/dist/cart_shipment_quote.js +26 -0
- package/dist/category.js +68 -0
- package/dist/company.js +248 -0
- package/dist/company_invitation.js +70 -0
- package/dist/component.js +107 -0
- package/dist/component_tag.js +60 -0
- package/dist/component_version.js +21 -0
- package/dist/country_tax.js +93 -0
- package/dist/dictionary.js +130 -0
- package/dist/discount.js +22 -0
- package/dist/discount_group.js +18 -0
- package/dist/domain.js +245 -0
- package/dist/domain_invitation.js +17 -0
- package/dist/domain_tag.js +87 -0
- package/dist/domain_types.js +22 -0
- package/dist/draft.js +97 -0
- package/dist/draft_comment.js +45 -0
- package/dist/draft_template.js +39 -0
- package/dist/email_address.js +34 -0
- package/dist/email_counter.js +47 -0
- package/dist/enrolled_domain.js +88 -0
- package/dist/exchange_rate.js +66 -0
- package/dist/field_types.js +19 -0
- package/dist/helpers.js +86 -0
- package/dist/internal_tag.js +98 -0
- package/dist/inventory.js +100 -0
- package/dist/inventory_unit_variation.js +19 -0
- package/dist/invoice.js +225 -0
- package/dist/invoice_types.js +11 -0
- package/dist/item.js +25 -0
- package/dist/job.js +536 -0
- package/dist/job_comment.js +45 -0
- package/dist/job_status.js +47 -0
- package/dist/matching_inventory.js +21 -0
- package/dist/md5.js +149 -0
- package/dist/menu.js +37 -0
- package/dist/menu_item.js +24 -0
- package/dist/merchi.js +1004 -0
- package/dist/merchi_file.js +165 -0
- package/dist/model.js +753 -0
- package/dist/notification.js +151 -0
- package/dist/notification_types.js +199 -0
- package/dist/output.cjs.js +31317 -0
- package/dist/output.esm.js +31312 -0
- package/dist/page.js +41 -0
- package/dist/payment.js +32 -0
- package/dist/payment_device.js +21 -0
- package/dist/payment_types.js +20 -0
- package/dist/phone_number.js +37 -0
- package/dist/product.js +288 -0
- package/dist/product_types.js +32 -0
- package/dist/production_comment.js +44 -0
- package/dist/quote.js +91 -0
- package/dist/quote_item.js +59 -0
- package/dist/roles.js +29 -0
- package/dist/seo_domain_page.js +42 -0
- package/dist/session.js +103 -0
- package/dist/set.js +29 -0
- package/dist/shipment.js +181 -0
- package/dist/shipment_item.js +17 -0
- package/dist/shipment_item_fulfillment.js +17 -0
- package/dist/shipment_method.js +81 -0
- package/dist/shipment_method_variation.js +38 -0
- package/dist/subscription_plan.js +75 -0
- package/dist/supply_domain.js +65 -0
- package/dist/system_role.js +12 -0
- package/dist/theme.js +180 -0
- package/dist/theme_css_setting.js +61 -0
- package/dist/theme_status.js +11 -0
- package/dist/user.js +409 -0
- package/dist/user_company.js +19 -0
- package/dist/user_types.js +23 -0
- package/dist/uuid.js +12 -0
- package/dist/variation.js +233 -0
- package/dist/variation_field.js +233 -0
- package/dist/variation_fields_option.js +41 -0
- package/dist/variation_option.js +62 -0
- package/dist/variations_group.js +43 -0
- package/dist/white_label_accessibilities.js +11 -0
- package/package.json +30 -0
- package/src/address.js +107 -0
- package/src/assignment.js +165 -0
- package/src/automatic_payment_relationship.js +65 -0
- package/src/backup.js +29 -0
- package/src/bank.js +21 -0
- package/src/cart.js +131 -0
- package/src/cart_item.js +71 -0
- package/src/cart_shipment_group.js +20 -0
- package/src/cart_shipment_quote.js +23 -0
- package/src/category.js +62 -0
- package/src/company.js +267 -0
- package/src/company_invitation.js +63 -0
- package/src/component.js +100 -0
- package/src/component_tag.js +53 -0
- package/src/component_version.js +17 -0
- package/src/country_tax.js +89 -0
- package/src/dictionary.js +135 -0
- package/src/discount.js +19 -0
- package/src/discount_group.js +15 -0
- package/src/domain.js +254 -0
- package/src/domain_invitation.js +13 -0
- package/src/domain_tag.js +79 -0
- package/src/domain_types.js +18 -0
- package/src/draft.js +92 -0
- package/src/draft_comment.js +41 -0
- package/src/draft_template.js +35 -0
- package/src/email_address.js +27 -0
- package/src/email_counter.js +42 -0
- package/src/enrolled_domain.js +79 -0
- package/src/exchange_rate.js +61 -0
- package/src/field_types.js +15 -0
- package/src/helpers.js +81 -0
- package/src/internal_tag.js +90 -0
- package/src/inventory.js +99 -0
- package/src/inventory_unit_variation.js +18 -0
- package/src/invoice.js +224 -0
- package/src/invoice_types.js +7 -0
- package/src/item.js +22 -0
- package/src/job.js +616 -0
- package/src/job_comment.js +41 -0
- package/src/job_status.js +51 -0
- package/src/matching_inventory.js +17 -0
- package/src/md5.js +162 -0
- package/src/menu.js +32 -0
- package/src/menu_item.js +22 -0
- package/src/merchi.js +1074 -0
- package/src/merchi_file.js +163 -0
- package/src/model.js +820 -0
- package/src/notification.js +153 -0
- package/src/notification_types.js +246 -0
- package/src/page.js +38 -0
- package/src/payment.js +32 -0
- package/src/payment_device.js +17 -0
- package/src/payment_types.js +18 -0
- package/src/phone_number.js +30 -0
- package/src/product.js +309 -0
- package/src/product_types.js +28 -0
- package/src/production_comment.js +40 -0
- package/src/quote.js +89 -0
- package/src/quote_item.js +51 -0
- package/src/roles.js +27 -0
- package/src/seo_domain_page.js +35 -0
- package/src/session.js +102 -0
- package/src/set.js +28 -0
- package/src/shipment.js +191 -0
- package/src/shipment_item.js +13 -0
- package/src/shipment_item_fulfillment.js +13 -0
- package/src/shipment_method.js +73 -0
- package/src/shipment_method_variation.js +34 -0
- package/src/subscription_plan.js +68 -0
- package/src/supply_domain.js +60 -0
- package/src/system_role.js +8 -0
- package/src/theme.js +188 -0
- package/src/theme_css_setting.js +54 -0
- package/src/theme_status.js +6 -0
- package/src/user.js +442 -0
- package/src/user_company.js +15 -0
- package/src/user_types.js +19 -0
- package/src/uuid.js +3 -0
- package/src/variation.js +257 -0
- package/src/variation_field.js +261 -0
- package/src/variation_fields_option.js +41 -0
- package/src/variation_option.js +59 -0
- package/src/variations_group.js +43 -0
- package/src/white_label_accessibilities.js +6 -0
@@ -0,0 +1,39 @@
|
|
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
|
+
}
|
@@ -0,0 +1,34 @@
|
|
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
|
+
}
|
@@ -0,0 +1,47 @@
|
|
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
|
+
}
|
@@ -0,0 +1,88 @@
|
|
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
|
+
}
|
@@ -0,0 +1,66 @@
|
|
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
|
+
}
|
@@ -0,0 +1,19 @@
|
|
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
ADDED
@@ -0,0 +1,86 @@
|
|
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
|
+
}
|
@@ -0,0 +1,98 @@
|
|
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
|
+
}
|
@@ -0,0 +1,100 @@
|
|
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
|
+
}
|
@@ -0,0 +1,19 @@
|
|
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
|
+
}
|