merchi_sdk_js 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
package/dist/roles.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.systemRoles = exports.roles = exports.allRoles = exports.SUPPLIER = exports.SELLER_PLUS = exports.SELLER = exports.RESTRICTED_SUPPLIER = exports.COMPONENT_BUILDER = void 0;
|
|
7
|
+
var _dictionary = require("./dictionary.js");
|
|
8
|
+
var _set = require("./set.js");
|
|
9
|
+
var roles = exports.roles = new _dictionary.Dictionary();
|
|
10
|
+
roles.add('public', 0);
|
|
11
|
+
roles.add('admin', 1);
|
|
12
|
+
roles.add('sales', 2);
|
|
13
|
+
roles.add('designer', 3);
|
|
14
|
+
roles.add('supplier', 4);
|
|
15
|
+
roles.add('client', 5);
|
|
16
|
+
roles.add('manager', 6);
|
|
17
|
+
roles.add('accountant', 7);
|
|
18
|
+
roles.add('theme editor', 8);
|
|
19
|
+
var systemRoles = exports.systemRoles = new _dictionary.Dictionary();
|
|
20
|
+
systemRoles.add("Component builder", 1);
|
|
21
|
+
var allRoles = exports.allRoles = new _set.Set();
|
|
22
|
+
roles.each(function (key, value) {
|
|
23
|
+
allRoles.add(value);
|
|
24
|
+
});
|
|
25
|
+
var COMPONENT_BUILDER = exports.COMPONENT_BUILDER = 'Component builder';
|
|
26
|
+
var SELLER = exports.SELLER = 'Seller';
|
|
27
|
+
var SELLER_PLUS = exports.SELLER_PLUS = 'Seller plus';
|
|
28
|
+
var SUPPLIER = exports.SUPPLIER = 'Supplier';
|
|
29
|
+
var RESTRICTED_SUPPLIER = exports.RESTRICTED_SUPPLIER = 'Restricted supplier';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SeoDomainPage = SeoDomainPage;
|
|
7
|
+
exports.SeoDomainPages = SeoDomainPages;
|
|
8
|
+
var _uuid = require("./uuid.js");
|
|
9
|
+
var _model = require("./model.js");
|
|
10
|
+
var _domain = require("./domain.js");
|
|
11
|
+
var _product = require("./product.js");
|
|
12
|
+
function SeoDomainPage() {
|
|
13
|
+
this.resource = '/seo_domain_pages';
|
|
14
|
+
this.json = 'seoDomainPage';
|
|
15
|
+
this.temporaryId = (0, _uuid.generateUUID)();
|
|
16
|
+
(0, _model.addPropertyTo)(this, 'archived');
|
|
17
|
+
(0, _model.addPropertyTo)(this, 'id');
|
|
18
|
+
(0, _model.addPropertyTo)(this, 'metaDescription');
|
|
19
|
+
(0, _model.addPropertyTo)(this, 'metaRobots');
|
|
20
|
+
(0, _model.addPropertyTo)(this, 'metaTitle');
|
|
21
|
+
(0, _model.addPropertyTo)(this, 'pageKey');
|
|
22
|
+
(0, _model.addPropertyTo)(this, 'domain', _domain.Domain);
|
|
23
|
+
(0, _model.addPropertyTo)(this, 'product', _product.Product);
|
|
24
|
+
}
|
|
25
|
+
function SeoDomainPages() {
|
|
26
|
+
this.resource = '/seo_domain_pages';
|
|
27
|
+
this.json = 'seoDomainPage';
|
|
28
|
+
this.single = SeoDomainPage;
|
|
29
|
+
this.get = function (success, error, offset, limit, q) {
|
|
30
|
+
var self = this;
|
|
31
|
+
function handleResponse(result) {
|
|
32
|
+
success((0, _model.fromJsonList)(self, result, {
|
|
33
|
+
makesDirty: false
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
(0, _model.getList)(this.resource, handleResponse, error, {
|
|
37
|
+
offset: offset,
|
|
38
|
+
limit: limit,
|
|
39
|
+
q: q
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
}
|
package/dist/session.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Session = Session;
|
|
7
|
+
exports.Sessions = Sessions;
|
|
8
|
+
var _dictionary = require("./dictionary.js");
|
|
9
|
+
var _model = require("./model.js");
|
|
10
|
+
var _user = require("./user.js");
|
|
11
|
+
var _domain = require("./domain.js");
|
|
12
|
+
function Session() {
|
|
13
|
+
this.resource = '/sessions';
|
|
14
|
+
this.json = 'session';
|
|
15
|
+
(0, _model.addPropertyTo)(this, 'ip');
|
|
16
|
+
(0, _model.addPropertyTo)(this, 'user', _user.User);
|
|
17
|
+
(0, _model.addPropertyTo)(this, 'domain', _domain.Domain);
|
|
18
|
+
(0, _model.addPropertyTo)(this, 'token');
|
|
19
|
+
(0, _model.addPropertyTo)(this, 'remember');
|
|
20
|
+
this.create = function (success, error, embed, username, password) {
|
|
21
|
+
var 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
|
+
success: handleResponse,
|
|
28
|
+
error: error,
|
|
29
|
+
embed: embed,
|
|
30
|
+
username: username,
|
|
31
|
+
password: password
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
this.get = function (success, error, embed) {
|
|
35
|
+
var self = this;
|
|
36
|
+
function handleResponse(result) {
|
|
37
|
+
success((0, _model.fromJson)(self, result[self.json], {
|
|
38
|
+
makesDirty: false
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
(0, _model.getOne)({
|
|
42
|
+
resource: this.resource,
|
|
43
|
+
id: this.token(),
|
|
44
|
+
success: handleResponse,
|
|
45
|
+
error: error,
|
|
46
|
+
embed: embed
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
this.remove = function (success, error) {
|
|
50
|
+
(0, _model.deleteOne)(this.resource, success, error);
|
|
51
|
+
};
|
|
52
|
+
this.storeCreate = function (success, error, parameters) {
|
|
53
|
+
var request = new _model.Request(),
|
|
54
|
+
query = new _dictionary.Dictionary(),
|
|
55
|
+
password = parameters.password,
|
|
56
|
+
remember = parameters.remember,
|
|
57
|
+
storeName = parameters.storeName,
|
|
58
|
+
username = parameters.email;
|
|
59
|
+
self = this;
|
|
60
|
+
if (password) {
|
|
61
|
+
request.password(password);
|
|
62
|
+
}
|
|
63
|
+
if (remember) {
|
|
64
|
+
query.add('remember', remember);
|
|
65
|
+
}
|
|
66
|
+
if (storeName) {
|
|
67
|
+
query.add('storeName', storeName);
|
|
68
|
+
}
|
|
69
|
+
if (username) {
|
|
70
|
+
request.username(username);
|
|
71
|
+
}
|
|
72
|
+
request.resource('/store-session/');
|
|
73
|
+
request.method('POST');
|
|
74
|
+
request.query().merge(query);
|
|
75
|
+
function handleResponse(status, data) {
|
|
76
|
+
success((0, _model.fromJson)(self, data[self.json]));
|
|
77
|
+
}
|
|
78
|
+
function handleError(status, data) {
|
|
79
|
+
var statusCode = status ? status : 400,
|
|
80
|
+
errorObject = data ? data : {
|
|
81
|
+
message: 'could not connect to server',
|
|
82
|
+
errorCode: 0
|
|
83
|
+
};
|
|
84
|
+
error(statusCode, errorObject);
|
|
85
|
+
}
|
|
86
|
+
request.responseHandler(handleResponse).errorHandler(handleError);
|
|
87
|
+
request.send();
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function Sessions() {
|
|
91
|
+
this.resource = '/sessions';
|
|
92
|
+
this.json = 'sessions';
|
|
93
|
+
this.single = Session;
|
|
94
|
+
this.get = function (success, error, parameters) {
|
|
95
|
+
var self = this;
|
|
96
|
+
function handleResponse(result) {
|
|
97
|
+
success((0, _model.fromJsonList)(self, result, {
|
|
98
|
+
makesDirty: false
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
(0, _model.getList)(this.resource, handleResponse, error, parameters);
|
|
102
|
+
};
|
|
103
|
+
}
|
package/dist/set.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Set = Set;
|
|
7
|
+
var _dictionary = require("./dictionary.js");
|
|
8
|
+
function Set() {
|
|
9
|
+
var store = new _dictionary.Dictionary();
|
|
10
|
+
this.add = function (value) {
|
|
11
|
+
store.add(value, value);
|
|
12
|
+
};
|
|
13
|
+
this.has = function (value) {
|
|
14
|
+
return store.has(value);
|
|
15
|
+
};
|
|
16
|
+
this.each = function (procedure) {
|
|
17
|
+
store.each(function (name, value) {
|
|
18
|
+
procedure(value);
|
|
19
|
+
});
|
|
20
|
+
return this;
|
|
21
|
+
};
|
|
22
|
+
this.values = function () {
|
|
23
|
+
return store.values();
|
|
24
|
+
};
|
|
25
|
+
this.remove = function (value) {
|
|
26
|
+
store.remove(value);
|
|
27
|
+
return this;
|
|
28
|
+
};
|
|
29
|
+
}
|
package/dist/shipment.js
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Shipment = Shipment;
|
|
7
|
+
exports.Shipments = Shipments;
|
|
8
|
+
var _uuid = require("./uuid.js");
|
|
9
|
+
var _model = require("./model.js");
|
|
10
|
+
var _helpers = require("./helpers.js");
|
|
11
|
+
var _address = require("./address.js");
|
|
12
|
+
var _assignment = require("./assignment.js");
|
|
13
|
+
var _country_tax = require("./country_tax.js");
|
|
14
|
+
var _domain_tag = require("./domain_tag.js");
|
|
15
|
+
var _user = require("./user.js");
|
|
16
|
+
var _company = require("./company.js");
|
|
17
|
+
var _invoice = require("./invoice.js");
|
|
18
|
+
var _job = require("./job.js");
|
|
19
|
+
var _merchi_file = require("./merchi_file.js");
|
|
20
|
+
var _shipment_item = require("./shipment_item.js");
|
|
21
|
+
var _shipment_method = require("./shipment_method.js");
|
|
22
|
+
var _internal_tag = require("./internal_tag.js");
|
|
23
|
+
function Shipment() {
|
|
24
|
+
this.resource = '/shipments';
|
|
25
|
+
this.json = 'shipment';
|
|
26
|
+
this.temporaryId = (0, _uuid.generateUUID)();
|
|
27
|
+
(0, _model.addPropertyTo)(this, 'id');
|
|
28
|
+
(0, _model.addPropertyTo)(this, 'name');
|
|
29
|
+
(0, _model.addPropertyTo)(this, 'pickUp');
|
|
30
|
+
(0, _model.addPropertyTo)(this, 'shipmentServiceBookingInfo');
|
|
31
|
+
(0, _model.addPropertyTo)(this, 'shipmentServiceQuote');
|
|
32
|
+
(0, _model.addPropertyTo)(this, 'shipmentLabel', _merchi_file.MerchiFile);
|
|
33
|
+
(0, _model.addPropertyTo)(this, 'creationDate');
|
|
34
|
+
(0, _model.addPropertyTo)(this, 'dispatchDate');
|
|
35
|
+
(0, _model.addPropertyTo)(this, 'dispatchedDate');
|
|
36
|
+
(0, _model.addPropertyTo)(this, 'expectedReceiveDate');
|
|
37
|
+
(0, _model.addPropertyTo)(this, 'receivedDate');
|
|
38
|
+
(0, _model.addPropertyTo)(this, 'sender', _user.User);
|
|
39
|
+
(0, _model.addPropertyTo)(this, 'senderCompany', _company.Company);
|
|
40
|
+
(0, _model.addPropertyTo)(this, 'senderAddress', _address.Address);
|
|
41
|
+
(0, _model.addPropertyTo)(this, 'senderNotes');
|
|
42
|
+
(0, _model.addPropertyTo)(this, 'blindShipTo');
|
|
43
|
+
(0, _model.addPropertyTo)(this, 'receiver', _user.User);
|
|
44
|
+
(0, _model.addPropertyTo)(this, 'receiverCompany', _company.Company);
|
|
45
|
+
(0, _model.addPropertyTo)(this, 'receiverAddress', _address.Address);
|
|
46
|
+
(0, _model.addPropertyTo)(this, 'receiverNotes');
|
|
47
|
+
(0, _model.addPropertyTo)(this, 'invoices', _invoice.Invoice);
|
|
48
|
+
(0, _model.addPropertyTo)(this, 'jobs', _job.Job);
|
|
49
|
+
(0, _model.addPropertyTo)(this, 'assignments', _assignment.Assignment);
|
|
50
|
+
(0, _model.addPropertyTo)(this, 'trackingNumber');
|
|
51
|
+
(0, _model.addPropertyTo)(this, 'transportCompany');
|
|
52
|
+
(0, _model.addPropertyTo)(this, 'transportCompanyName');
|
|
53
|
+
(0, _model.addPropertyTo)(this, 'sendSms');
|
|
54
|
+
(0, _model.addPropertyTo)(this, 'sendEmail');
|
|
55
|
+
(0, _model.addPropertyTo)(this, 'cost');
|
|
56
|
+
(0, _model.addPropertyTo)(this, 'taxAmount');
|
|
57
|
+
(0, _model.addPropertyTo)(this, 'maxWeight');
|
|
58
|
+
(0, _model.addPropertyTo)(this, 'maxVolume');
|
|
59
|
+
(0, _model.addPropertyTo)(this, 'taxType', _country_tax.CountryTax);
|
|
60
|
+
(0, _model.addPropertyTo)(this, 'senderResponsible');
|
|
61
|
+
(0, _model.addPropertyTo)(this, 'tags', _domain_tag.DomainTag);
|
|
62
|
+
(0, _model.addPropertyTo)(this, 'shipmentItems', _shipment_item.ShipmentItem);
|
|
63
|
+
(0, _model.addPropertyTo)(this, 'shipmentMethod', _shipment_method.ShipmentMethod);
|
|
64
|
+
(0, _model.addPropertyTo)(this, 'internalTags', _internal_tag.InternalTag);
|
|
65
|
+
this.get = function (success, error, embed) {
|
|
66
|
+
var self = this;
|
|
67
|
+
function handleResponse(result) {
|
|
68
|
+
success((0, _model.fromJson)(self, result[self.json], {
|
|
69
|
+
makesDirty: false
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
(0, _model.getOne)({
|
|
73
|
+
resource: this.resource,
|
|
74
|
+
id: this.id(),
|
|
75
|
+
success: handleResponse,
|
|
76
|
+
error: error,
|
|
77
|
+
embed: embed
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
this.create = function (options) {
|
|
81
|
+
var data = (0, _model.serialise)(this),
|
|
82
|
+
self = this;
|
|
83
|
+
function handleResponse(result) {
|
|
84
|
+
options.success((0, _model.fromJson)(self, result[self.json]));
|
|
85
|
+
}
|
|
86
|
+
(0, _model.create)({
|
|
87
|
+
resource: this.resource,
|
|
88
|
+
parameters: data[0],
|
|
89
|
+
files: (0, _model.enumerateFiles)(data[1]),
|
|
90
|
+
success: handleResponse,
|
|
91
|
+
error: options.error,
|
|
92
|
+
embed: options.embed
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
this.patch = function (success, error, data, embed) {
|
|
96
|
+
var self = this;
|
|
97
|
+
function handleResponse(result) {
|
|
98
|
+
success((0, _model.fromJson)(self, result[self.json], {
|
|
99
|
+
makesDirty: false
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
(0, _model.patchOne)({
|
|
103
|
+
resource: this.resource,
|
|
104
|
+
id: this.id(),
|
|
105
|
+
success: handleResponse,
|
|
106
|
+
error: error,
|
|
107
|
+
data: data,
|
|
108
|
+
embed: embed
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
this.update = function (options) {
|
|
112
|
+
var self = this;
|
|
113
|
+
this.patch(options.success, options.error, (0, _model.serialise)(self, undefined, undefined, undefined, {
|
|
114
|
+
excludeOld: true
|
|
115
|
+
})[0], options.embed);
|
|
116
|
+
};
|
|
117
|
+
this.destroy = function (success, error) {
|
|
118
|
+
(0, _model.deleteOne)(this.resource + "/" + this.id(), success, error);
|
|
119
|
+
};
|
|
120
|
+
this.hasJobs = function () {
|
|
121
|
+
return Boolean(this.jobs()) && this.jobs().length > 0;
|
|
122
|
+
};
|
|
123
|
+
this.hasJob = function (job) {
|
|
124
|
+
var jobIndex = this.jobs().findIndex(function (shipmentJob) {
|
|
125
|
+
return shipmentJob.id() === job.id();
|
|
126
|
+
});
|
|
127
|
+
return jobIndex >= 0;
|
|
128
|
+
};
|
|
129
|
+
this.hasAssignments = function () {
|
|
130
|
+
return Boolean(this.assignments()) && this.assignments().length > 0;
|
|
131
|
+
};
|
|
132
|
+
this.hasAssignment = function (assignment) {
|
|
133
|
+
var assignments = this.assignments(),
|
|
134
|
+
assignmentIndex;
|
|
135
|
+
if (Boolean(assignments)) {
|
|
136
|
+
assignmentIndex = assignments.findIndex(function (shipmentAssignment) {
|
|
137
|
+
return shipmentAssignment.id() === assignment.id();
|
|
138
|
+
});
|
|
139
|
+
return assignmentIndex >= 0;
|
|
140
|
+
}
|
|
141
|
+
return false;
|
|
142
|
+
};
|
|
143
|
+
this.removeAssignment = function (assignmentId) {
|
|
144
|
+
var self = this;
|
|
145
|
+
if (Boolean(assignmentId) && assignmentId !== '') {
|
|
146
|
+
(0, _helpers.removeObjectFromArrayWithIntegerValue)(self.assignments(), 'id', assignmentId);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
this.removeJob = function (jobId) {
|
|
150
|
+
var self = this;
|
|
151
|
+
if (Boolean(jobId) && jobId !== '') {
|
|
152
|
+
(0, _helpers.removeObjectFromArrayWithIntegerValue)(self.jobs(), 'id', jobId);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
this.readyForDispatchedNotification = function () {
|
|
156
|
+
var self = this;
|
|
157
|
+
return Boolean(self.id() && self.trackingNumber() && self.transportCompany() && self.dispatchedDate());
|
|
158
|
+
};
|
|
159
|
+
this.userIsResponsible = function (user) {
|
|
160
|
+
var senderResponsible = this.senderResponsible(),
|
|
161
|
+
shipmentUser = senderResponsible ? this.sender() : this.receiver();
|
|
162
|
+
return shipmentUser && shipmentUser.id() === user.id();
|
|
163
|
+
};
|
|
164
|
+
this.responsibleCompany = function () {
|
|
165
|
+
return this.senderResponsible() ? this.senderCompany() : this.receiverCompany();
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function Shipments() {
|
|
169
|
+
this.resource = '/shipments';
|
|
170
|
+
this.json = 'shipments';
|
|
171
|
+
this.single = Shipment;
|
|
172
|
+
this.get = function (success, error, parameters) {
|
|
173
|
+
var self = this;
|
|
174
|
+
function handleResponse(result) {
|
|
175
|
+
success((0, _model.fromJsonList)(self, result, {
|
|
176
|
+
makesDirty: false
|
|
177
|
+
}));
|
|
178
|
+
}
|
|
179
|
+
(0, _model.getList)(this.resource, handleResponse, error, parameters);
|
|
180
|
+
};
|
|
181
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ShipmentItem = ShipmentItem;
|
|
7
|
+
var _uuid = require("./uuid.js");
|
|
8
|
+
var _model = require("./model.js");
|
|
9
|
+
var _shipment_item_fulfillment = require("./shipment_item_fulfillment.js");
|
|
10
|
+
var _job = require("./job.js");
|
|
11
|
+
function ShipmentItem() {
|
|
12
|
+
this.resource = '/shipment_items';
|
|
13
|
+
this.json = 'shipmentItem';
|
|
14
|
+
this.temporaryId = (0, _uuid.generateUUID)();
|
|
15
|
+
(0, _model.addPropertyTo)(this, 'job', _job.Job);
|
|
16
|
+
(0, _model.addPropertyTo)(this, 'fulfillments', _shipment_item_fulfillment.ShipmentItemFulfillment);
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ShipmentItemFulfillment = ShipmentItemFulfillment;
|
|
7
|
+
var _uuid = require("./uuid.js");
|
|
8
|
+
var _model = require("./model.js");
|
|
9
|
+
var _assignment = require("./assignment.js");
|
|
10
|
+
var _job = require("./job.js");
|
|
11
|
+
function ShipmentItemFulfillment() {
|
|
12
|
+
this.resource = '/shipment_item_fulfillments';
|
|
13
|
+
this.json = 'shipmentItemFulfillment';
|
|
14
|
+
this.temporaryId = (0, _uuid.generateUUID)();
|
|
15
|
+
(0, _model.addPropertyTo)(this, 'assignment', _assignment.Assignment);
|
|
16
|
+
(0, _model.addPropertyTo)(this, 'job', _job.Job);
|
|
17
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ShipmentMethod = ShipmentMethod;
|
|
7
|
+
exports.ShipmentMethods = ShipmentMethods;
|
|
8
|
+
var _uuid = require("./uuid.js");
|
|
9
|
+
var _model = require("./model.js");
|
|
10
|
+
var _address = require("./address.js");
|
|
11
|
+
var _country_tax = require("./country_tax.js");
|
|
12
|
+
var _company = require("./company.js");
|
|
13
|
+
var _shipment_method_variation = require("./shipment_method_variation.js");
|
|
14
|
+
function ShipmentMethod() {
|
|
15
|
+
this.resource = '/shipment_methods';
|
|
16
|
+
this.json = 'shipmentMethod';
|
|
17
|
+
this.temporaryId = (0, _uuid.generateUUID)();
|
|
18
|
+
(0, _model.addPropertyTo)(this, 'id');
|
|
19
|
+
(0, _model.addPropertyTo)(this, 'name');
|
|
20
|
+
(0, _model.addPropertyTo)(this, 'shipmentService');
|
|
21
|
+
(0, _model.addPropertyTo)(this, 'pickUp');
|
|
22
|
+
(0, _model.addPropertyTo)(this, 'originAddress', _address.Address);
|
|
23
|
+
(0, _model.addPropertyTo)(this, 'company', _company.Company);
|
|
24
|
+
(0, _model.addPropertyTo)(this, 'companyDefault');
|
|
25
|
+
(0, _model.addPropertyTo)(this, 'defaultCost');
|
|
26
|
+
(0, _model.addPropertyTo)(this, 'maxCost');
|
|
27
|
+
(0, _model.addPropertyTo)(this, 'currency');
|
|
28
|
+
(0, _model.addPropertyTo)(this, 'transportCompany');
|
|
29
|
+
(0, _model.addPropertyTo)(this, 'transportCompanyName');
|
|
30
|
+
(0, _model.addPropertyTo)(this, 'variations', _shipment_method_variation.ShipmentMethodVariation);
|
|
31
|
+
(0, _model.addPropertyTo)(this, 'taxType', _country_tax.CountryTax);
|
|
32
|
+
this.create = function (success, error, embed, domainId) {
|
|
33
|
+
var data = (0, _model.serialise)(this),
|
|
34
|
+
self = this;
|
|
35
|
+
function handleResponse(result) {
|
|
36
|
+
success((0, _model.fromJson)(self, result[self.json]));
|
|
37
|
+
}
|
|
38
|
+
(0, _model.create)({
|
|
39
|
+
resource: this.resource,
|
|
40
|
+
parameters: data[0],
|
|
41
|
+
files: (0, _model.enumerateFiles)(data[1]),
|
|
42
|
+
success: handleResponse,
|
|
43
|
+
error: error,
|
|
44
|
+
embed: embed,
|
|
45
|
+
as_domain: domainId
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
this.patch = function (success, error, embed) {
|
|
49
|
+
var self = this,
|
|
50
|
+
data = (0, _model.serialise)(this, undefined, undefined, undefined, {
|
|
51
|
+
excludeOld: true
|
|
52
|
+
})[0];
|
|
53
|
+
function handleResponse(result) {
|
|
54
|
+
success((0, _model.fromJson)(self, result[self.json], {
|
|
55
|
+
makesDirty: false
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
(0, _model.patchOne)({
|
|
59
|
+
resource: this.resource,
|
|
60
|
+
id: this.id(),
|
|
61
|
+
success: handleResponse,
|
|
62
|
+
error: error,
|
|
63
|
+
data: data,
|
|
64
|
+
embed: embed
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function ShipmentMethods() {
|
|
69
|
+
this.resource = '/shipment_methods';
|
|
70
|
+
this.json = 'shipmentMethods';
|
|
71
|
+
this.single = ShipmentMethod;
|
|
72
|
+
this.get = function (success, error, parameters) {
|
|
73
|
+
var self = this;
|
|
74
|
+
function handleResponse(result) {
|
|
75
|
+
success((0, _model.fromJsonList)(self, result, {
|
|
76
|
+
makesDirty: false
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
(0, _model.getList)(this.resource, handleResponse, error, parameters);
|
|
80
|
+
};
|
|
81
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ShipmentMethodVariation = ShipmentMethodVariation;
|
|
7
|
+
exports.ShipmentMethodVariations = ShipmentMethodVariations;
|
|
8
|
+
var _uuid = require("./uuid.js");
|
|
9
|
+
var _model = require("./model.js");
|
|
10
|
+
var _country_tax = require("./country_tax.js");
|
|
11
|
+
var _shipment_method = require("./shipment_method.js");
|
|
12
|
+
function ShipmentMethodVariation() {
|
|
13
|
+
this.resource = '/shipment_method_variations';
|
|
14
|
+
this.json = 'shipmentMethodVariation';
|
|
15
|
+
this.temporaryId = (0, _uuid.generateUUID)();
|
|
16
|
+
(0, _model.addPropertyTo)(this, 'id');
|
|
17
|
+
(0, _model.addPropertyTo)(this, 'destinationCountry');
|
|
18
|
+
(0, _model.addPropertyTo)(this, 'destinationState');
|
|
19
|
+
(0, _model.addPropertyTo)(this, 'cost');
|
|
20
|
+
(0, _model.addPropertyTo)(this, 'currency');
|
|
21
|
+
(0, _model.addPropertyTo)(this, 'maxWeight');
|
|
22
|
+
(0, _model.addPropertyTo)(this, 'shipmentMethod', _shipment_method.ShipmentMethod);
|
|
23
|
+
(0, _model.addPropertyTo)(this, 'taxType', _country_tax.CountryTax);
|
|
24
|
+
}
|
|
25
|
+
function ShipmentMethodVariations() {
|
|
26
|
+
this.resource = '/shipment_method_variations';
|
|
27
|
+
this.json = 'shipmentMethodVariations';
|
|
28
|
+
this.single = ShipmentMethodVariation;
|
|
29
|
+
this.get = function (success, error, parameters) {
|
|
30
|
+
var self = this;
|
|
31
|
+
function handleResponse(result) {
|
|
32
|
+
success((0, _model.fromJsonList)(self, result, {
|
|
33
|
+
makesDirty: false
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
(0, _model.getList)(this.resource, handleResponse, error, parameters);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SubscriptionPlan = SubscriptionPlan;
|
|
7
|
+
exports.SubscriptionPlans = SubscriptionPlans;
|
|
8
|
+
var _model = require("./model.js");
|
|
9
|
+
var _user = require("./user.js");
|
|
10
|
+
var _country_tax = require("./country_tax.js");
|
|
11
|
+
function SubscriptionPlan() {
|
|
12
|
+
this.resource = '/subscription_plans';
|
|
13
|
+
this.json = 'subscriptionPlan';
|
|
14
|
+
(0, _model.addPropertyTo)(this, 'id');
|
|
15
|
+
(0, _model.addPropertyTo)(this, 'created');
|
|
16
|
+
(0, _model.addPropertyTo)(this, 'updated');
|
|
17
|
+
(0, _model.addPropertyTo)(this, 'createdBy', _user.User);
|
|
18
|
+
(0, _model.addPropertyTo)(this, 'updatedBy', _user.User);
|
|
19
|
+
(0, _model.addPropertyTo)(this, 'name');
|
|
20
|
+
(0, _model.addPropertyTo)(this, 'currency');
|
|
21
|
+
(0, _model.addPropertyTo)(this, 'tax', _country_tax.CountryTax);
|
|
22
|
+
(0, _model.addPropertyTo)(this, 'baseCost');
|
|
23
|
+
(0, _model.addPropertyTo)(this, 'whiteLabelDomainCost');
|
|
24
|
+
(0, _model.addPropertyTo)(this, 'perSmsCost');
|
|
25
|
+
(0, _model.addPropertyTo)(this, 'perUserCost');
|
|
26
|
+
(0, _model.addPropertyTo)(this, 'perDomainCost');
|
|
27
|
+
(0, _model.addPropertyTo)(this, 'baseUserCount');
|
|
28
|
+
(0, _model.addPropertyTo)(this, 'baseDomainCount');
|
|
29
|
+
(0, _model.addPropertyTo)(this, 'billingCycleDays');
|
|
30
|
+
(0, _model.addPropertyTo)(this, 'isPrivate');
|
|
31
|
+
this.create = function (success, error, embed, as_domain) {
|
|
32
|
+
var data = (0, _model.serialise)(this),
|
|
33
|
+
self = this;
|
|
34
|
+
function handleResponse(result) {
|
|
35
|
+
success((0, _model.fromJson)(self, result[self.json]));
|
|
36
|
+
}
|
|
37
|
+
(0, _model.create)({
|
|
38
|
+
resource: this.resource,
|
|
39
|
+
parameters: data[0],
|
|
40
|
+
as_domain: as_domain,
|
|
41
|
+
files: (0, _model.enumerateFiles)(data[1]),
|
|
42
|
+
success: handleResponse,
|
|
43
|
+
error: error,
|
|
44
|
+
embed: embed
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
this.get = function (success, error) {
|
|
48
|
+
var self = this;
|
|
49
|
+
function handleResponse(result) {
|
|
50
|
+
success((0, _model.fromJson)(self, result[self.json], {
|
|
51
|
+
makesDirty: false
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
(0, _model.getOne)({
|
|
55
|
+
resource: this.resource,
|
|
56
|
+
id: this.id(),
|
|
57
|
+
success: handleResponse,
|
|
58
|
+
error: error
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function SubscriptionPlans() {
|
|
63
|
+
this.resource = '/subscription_plans';
|
|
64
|
+
this.json = 'subscriptionPlans';
|
|
65
|
+
this.single = SubscriptionPlan;
|
|
66
|
+
this.get = function (success, error, parameters) {
|
|
67
|
+
var self = this;
|
|
68
|
+
function handleResponse(result) {
|
|
69
|
+
success((0, _model.fromJsonList)(self, result, {
|
|
70
|
+
makesDirty: false
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
(0, _model.getList)(this.resource, handleResponse, error, parameters);
|
|
74
|
+
};
|
|
75
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SupplyDomain = SupplyDomain;
|
|
7
|
+
exports.SupplyDomains = SupplyDomains;
|
|
8
|
+
var _uuid = require("./uuid.js");
|
|
9
|
+
var _model = require("./model.js");
|
|
10
|
+
var _product = require("./product.js");
|
|
11
|
+
var _domain = require("./domain.js");
|
|
12
|
+
function SupplyDomain() {
|
|
13
|
+
this.resource = '/supply_domains';
|
|
14
|
+
this.json = 'supplyDomain';
|
|
15
|
+
this.temporaryId = (0, _uuid.generateUUID)();
|
|
16
|
+
(0, _model.addPropertyTo)(this, 'id');
|
|
17
|
+
(0, _model.addPropertyTo)(this, 'needsDrafting');
|
|
18
|
+
(0, _model.addPropertyTo)(this, 'product', _product.Product);
|
|
19
|
+
(0, _model.addPropertyTo)(this, 'supplyProduct', _product.Product);
|
|
20
|
+
(0, _model.addPropertyTo)(this, 'domain', _domain.Domain);
|
|
21
|
+
this.get = function (success, error) {
|
|
22
|
+
var self = this;
|
|
23
|
+
function handleResponse(result) {
|
|
24
|
+
success((0, _model.fromJson)(self, result[self.json], {
|
|
25
|
+
makesDirty: false
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
(0, _model.getOne)({
|
|
29
|
+
resource: this.resource,
|
|
30
|
+
id: this.id(),
|
|
31
|
+
success: handleResponse,
|
|
32
|
+
error: error
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
this.create = function (success, error, embed, as_domain) {
|
|
36
|
+
var data = (0, _model.serialise)(this),
|
|
37
|
+
self = this;
|
|
38
|
+
function handleResponse(result) {
|
|
39
|
+
success((0, _model.fromJson)(self, result[self.json]));
|
|
40
|
+
}
|
|
41
|
+
(0, _model.create)({
|
|
42
|
+
resource: this.resource,
|
|
43
|
+
parameters: data[0],
|
|
44
|
+
as_domain: as_domain,
|
|
45
|
+
files: (0, _model.enumerateFiles)(data[1]),
|
|
46
|
+
success: handleResponse,
|
|
47
|
+
data: error,
|
|
48
|
+
embed: embed
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function SupplyDomains() {
|
|
53
|
+
this.resource = '/supply_domains';
|
|
54
|
+
this.json = 'supplyDomain';
|
|
55
|
+
this.single = SupplyDomain;
|
|
56
|
+
this.get = function (success, error, parameters) {
|
|
57
|
+
var self = this;
|
|
58
|
+
function handleResponse(result) {
|
|
59
|
+
success((0, _model.fromJsonList)(self, result, {
|
|
60
|
+
makesDirty: false
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
(0, _model.getList)(this.resource, handleResponse, error, parameters);
|
|
64
|
+
};
|
|
65
|
+
}
|