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
package/dist/category.js
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Categories = Categories;
|
7
|
+
exports.Category = Category;
|
8
|
+
var _uuid = require("./uuid.js");
|
9
|
+
var _model = require("./model.js");
|
10
|
+
var _domain = require("./domain.js");
|
11
|
+
function Category() {
|
12
|
+
this.resource = '/categories';
|
13
|
+
this.json = 'category';
|
14
|
+
this.temporaryId = (0, _uuid.generateUUID)();
|
15
|
+
(0, _model.addPropertyTo)(this, 'id');
|
16
|
+
(0, _model.addPropertyTo)(this, 'name');
|
17
|
+
(0, _model.addPropertyTo)(this, 'showDashboard');
|
18
|
+
(0, _model.addPropertyTo)(this, 'showPublic');
|
19
|
+
(0, _model.addPropertyTo)(this, 'showPublicSupplierResell');
|
20
|
+
(0, _model.addPropertyTo)(this, 'domain', _domain.Domain);
|
21
|
+
this.create = function (success, error, embed, domainId) {
|
22
|
+
var data = (0, _model.serialise)(this),
|
23
|
+
self = this;
|
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
|
+
files: (0, _model.enumerateFiles)(data[1]),
|
31
|
+
success: handleResponse,
|
32
|
+
error: error,
|
33
|
+
embed: embed,
|
34
|
+
as_domain: domainId
|
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.destroy = function (success, error) {
|
52
|
+
(0, _model.deleteOne)(this.resource + "/" + this.id(), success, error);
|
53
|
+
};
|
54
|
+
}
|
55
|
+
function Categories() {
|
56
|
+
this.resource = '/categories';
|
57
|
+
this.json = 'categories';
|
58
|
+
this.single = Category;
|
59
|
+
this.get = function (success, error, parameters) {
|
60
|
+
var self = this;
|
61
|
+
function handleResponse(result) {
|
62
|
+
success((0, _model.fromJsonList)(self, result, {
|
63
|
+
makesDirty: false
|
64
|
+
}));
|
65
|
+
}
|
66
|
+
(0, _model.getList)(this.resource, handleResponse, error, parameters);
|
67
|
+
};
|
68
|
+
}
|
package/dist/company.js
ADDED
@@ -0,0 +1,248 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Companies = Companies;
|
7
|
+
exports.Company = Company;
|
8
|
+
var _model = require("./model.js");
|
9
|
+
var _dictionary = require("./dictionary.js");
|
10
|
+
var _automatic_payment_relationship = require("./automatic_payment_relationship.js");
|
11
|
+
var _address = require("./address.js");
|
12
|
+
var _bank = require("./bank.js");
|
13
|
+
var _country_tax = require("./country_tax.js");
|
14
|
+
var _company_invitation = require("./company_invitation.js");
|
15
|
+
var _domain = require("./domain.js");
|
16
|
+
var _email_address = require("./email_address.js");
|
17
|
+
var _merchi_file = require("./merchi_file.js");
|
18
|
+
var _phone_number = require("./phone_number.js");
|
19
|
+
var _product = require("./product.js");
|
20
|
+
var _shipment_method = require("./shipment_method.js");
|
21
|
+
var _user = require("./user.js");
|
22
|
+
var _user_company = require("./user_company.js");
|
23
|
+
var _payment_device = require("./payment_device.js");
|
24
|
+
var _internal_tag = require("./internal_tag.js");
|
25
|
+
function Company() {
|
26
|
+
this.resource = '/companies';
|
27
|
+
this.json = 'company';
|
28
|
+
(0, _model.addPropertyTo)(this, 'id');
|
29
|
+
(0, _model.addPropertyTo)(this, 'name');
|
30
|
+
(0, _model.addPropertyTo)(this, 'website');
|
31
|
+
(0, _model.addPropertyTo)(this, 'country');
|
32
|
+
(0, _model.addPropertyTo)(this, 'stripeAccountId');
|
33
|
+
(0, _model.addPropertyTo)(this, 'isStripeAccountEnabled');
|
34
|
+
(0, _model.addPropertyTo)(this, 'logo', _merchi_file.MerchiFile);
|
35
|
+
(0, _model.addPropertyTo)(this, 'defaultCurrency');
|
36
|
+
(0, _model.addPropertyTo)(this, 'taxNumber');
|
37
|
+
(0, _model.addPropertyTo)(this, 'taxNumberType');
|
38
|
+
(0, _model.addPropertyTo)(this, 'defaultTaxType', _country_tax.CountryTax);
|
39
|
+
(0, _model.addPropertyTo)(this, 'taxTypes', _country_tax.CountryTax);
|
40
|
+
(0, _model.addPropertyTo)(this, 'paypalAccount');
|
41
|
+
(0, _model.addPropertyTo)(this, 'paypalPassword');
|
42
|
+
(0, _model.addPropertyTo)(this, 'paypalSignature');
|
43
|
+
(0, _model.addPropertyTo)(this, 'isPaypalValid');
|
44
|
+
(0, _model.addPropertyTo)(this, 'utrustApiKey');
|
45
|
+
(0, _model.addPropertyTo)(this, 'utrustWebhookKey');
|
46
|
+
(0, _model.addPropertyTo)(this, 'acceptUtrust');
|
47
|
+
(0, _model.addPropertyTo)(this, 'isPayingCompany');
|
48
|
+
(0, _model.addPropertyTo)(this, 'isUtrustValid');
|
49
|
+
(0, _model.addPropertyTo)(this, 'isTesting');
|
50
|
+
(0, _model.addPropertyTo)(this, 'isBlocked');
|
51
|
+
(0, _model.addPropertyTo)(this, 'trialEndDate');
|
52
|
+
(0, _model.addPropertyTo)(this, 'trialEndDateUpdated');
|
53
|
+
(0, _model.addPropertyTo)(this, 'trialEndDateSetBy', _user.User);
|
54
|
+
(0, _model.addPropertyTo)(this, 'sendleActive');
|
55
|
+
(0, _model.addPropertyTo)(this, 'sendleApiKey');
|
56
|
+
(0, _model.addPropertyTo)(this, 'sendleId');
|
57
|
+
(0, _model.addPropertyTo)(this, 'squareAccessToken');
|
58
|
+
(0, _model.addPropertyTo)(this, 'squareRefreshToken');
|
59
|
+
(0, _model.addPropertyTo)(this, 'squareExpiresAt');
|
60
|
+
(0, _model.addPropertyTo)(this, 'squareIsValid');
|
61
|
+
(0, _model.addPropertyTo)(this, 'squareMerchantId');
|
62
|
+
(0, _model.addPropertyTo)(this, 'squareWebLocationId');
|
63
|
+
(0, _model.addPropertyTo)(this, 'stripePublishableKey');
|
64
|
+
(0, _model.addPropertyTo)(this, 'stripeApiKey');
|
65
|
+
(0, _model.addPropertyTo)(this, 'stripePublishableTestKey');
|
66
|
+
(0, _model.addPropertyTo)(this, 'stripeApiTestKey');
|
67
|
+
(0, _model.addPropertyTo)(this, 'stripeConnectDisabled');
|
68
|
+
(0, _model.addPropertyTo)(this, 'unltdAiApiOrganizationId');
|
69
|
+
(0, _model.addPropertyTo)(this, 'unltdAiApiSecretKey');
|
70
|
+
(0, _model.addPropertyTo)(this, 'isStripeValid');
|
71
|
+
(0, _model.addPropertyTo)(this, 'acceptSquare');
|
72
|
+
(0, _model.addPropertyTo)(this, 'acceptStripe');
|
73
|
+
(0, _model.addPropertyTo)(this, 'acceptPaypal');
|
74
|
+
(0, _model.addPropertyTo)(this, 'acceptBankTransfer');
|
75
|
+
(0, _model.addPropertyTo)(this, 'acceptPhonePayment');
|
76
|
+
(0, _model.addPropertyTo)(this, 'ownershipUnconfirmed');
|
77
|
+
(0, _model.addPropertyTo)(this, 'userCompanies', _user_company.UserCompany);
|
78
|
+
(0, _model.addPropertyTo)(this, 'phoneNumbers', _phone_number.PhoneNumber);
|
79
|
+
(0, _model.addPropertyTo)(this, 'paymentPhoneNumbers', _phone_number.PhoneNumber);
|
80
|
+
(0, _model.addPropertyTo)(this, 'emailAddresses', _email_address.EmailAddress);
|
81
|
+
(0, _model.addPropertyTo)(this, 'addresses', _address.Address);
|
82
|
+
(0, _model.addPropertyTo)(this, 'banks', _bank.Bank);
|
83
|
+
/* products that a company has saved for future reference */
|
84
|
+
(0, _model.addPropertyTo)(this, 'savedProducts', _product.Product);
|
85
|
+
(0, _model.addPropertyTo)(this, 'companyInvitations', _company_invitation.CompanyInvitation);
|
86
|
+
(0, _model.addPropertyTo)(this, 'shipmentMethods', _shipment_method.ShipmentMethod);
|
87
|
+
(0, _model.addPropertyTo)(this, 'automaticPaymentRelationships', _automatic_payment_relationship.AutomaticPaymentRelationship);
|
88
|
+
(0, _model.addPropertyTo)(this, 'accessibleDomainsAsClientCompany', _domain.Domain);
|
89
|
+
(0, _model.addPropertyTo)(this, 'paymentDevices', _payment_device.PaymentDevice);
|
90
|
+
(0, _model.addPropertyTo)(this, 'aiContext');
|
91
|
+
(0, _model.addPropertyTo)(this, 'internalUseNotes');
|
92
|
+
(0, _model.addPropertyTo)(this, 'internalUseAiContext');
|
93
|
+
(0, _model.addPropertyTo)(this, 'internalTags', _internal_tag.InternalTag);
|
94
|
+
this.create = function (success, error, embed, as_domain) {
|
95
|
+
var data = (0, _model.serialise)(this),
|
96
|
+
self = this;
|
97
|
+
function handleResponse(result) {
|
98
|
+
success((0, _model.fromJson)(self, result[self.json]));
|
99
|
+
}
|
100
|
+
(0, _model.create)({
|
101
|
+
resource: this.resource,
|
102
|
+
parameters: data[0],
|
103
|
+
as_domain: as_domain,
|
104
|
+
files: (0, _model.enumerateFiles)(data[1]),
|
105
|
+
success: handleResponse,
|
106
|
+
error: error,
|
107
|
+
embed: embed
|
108
|
+
});
|
109
|
+
};
|
110
|
+
this.get = function (success, error, embed) {
|
111
|
+
var self = this;
|
112
|
+
function handleResponse(result) {
|
113
|
+
success((0, _model.fromJson)(self, result[self.json], {
|
114
|
+
makesDirty: false
|
115
|
+
}));
|
116
|
+
}
|
117
|
+
(0, _model.getOne)({
|
118
|
+
resource: this.resource,
|
119
|
+
id: this.id(),
|
120
|
+
success: handleResponse,
|
121
|
+
error: error,
|
122
|
+
embed: embed
|
123
|
+
});
|
124
|
+
};
|
125
|
+
this.patch = function (success, error, embed) {
|
126
|
+
var self = this,
|
127
|
+
data = (0, _model.serialise)(this, undefined, undefined, undefined, {
|
128
|
+
exlcudeOld: true
|
129
|
+
})[0];
|
130
|
+
function handleResponse(result) {
|
131
|
+
success((0, _model.fromJson)(self, result[self.json], {
|
132
|
+
makesDirty: false
|
133
|
+
}));
|
134
|
+
}
|
135
|
+
(0, _model.patchOne)({
|
136
|
+
resource: this.resource,
|
137
|
+
id: self.id(),
|
138
|
+
success: handleResponse,
|
139
|
+
error: error,
|
140
|
+
data: data,
|
141
|
+
embed: embed
|
142
|
+
});
|
143
|
+
};
|
144
|
+
this.invite = function (companyMemberData, success, error, embed) {
|
145
|
+
var request = new _model.Request(),
|
146
|
+
data = new _dictionary.Dictionary(),
|
147
|
+
self = this,
|
148
|
+
_id = self.id();
|
149
|
+
function handleResponse(status, data) {
|
150
|
+
var newInvitation = new _company_invitation.CompanyInvitation(),
|
151
|
+
invitation = data,
|
152
|
+
invitations = self.companyInvitations() ? self.companyInvitations() : [];
|
153
|
+
newInvitation.id(invitation.id);
|
154
|
+
newInvitation.userEmail(invitation.userEmail);
|
155
|
+
newInvitation.userName(invitation.userName);
|
156
|
+
newInvitation.inviteAsAdmin(invitation.inviteAsAdmin);
|
157
|
+
invitations.push(newInvitation);
|
158
|
+
self.companyInvitations(invitations);
|
159
|
+
success(self);
|
160
|
+
}
|
161
|
+
data = new _dictionary.Dictionary();
|
162
|
+
data.add("inviteUserEmail", companyMemberData.emailAddress);
|
163
|
+
data.add("inviteUserName", companyMemberData.name);
|
164
|
+
data.add("company-id", _id);
|
165
|
+
data.add("asAdmin", companyMemberData.isAdmin);
|
166
|
+
request.resource('/company_invite/').method('POST');
|
167
|
+
request.data().merge(data);
|
168
|
+
request.responseHandler(handleResponse);
|
169
|
+
request.errorHandler(error);
|
170
|
+
request.send();
|
171
|
+
};
|
172
|
+
this.primaryEmailAddressEntity = function () {
|
173
|
+
var emails = this.emailAddresses();
|
174
|
+
return emails && emails[0] ? emails[0] : null;
|
175
|
+
};
|
176
|
+
this.primaryEmailAddress = function () {
|
177
|
+
var email = this.primaryEmailAddressEntity();
|
178
|
+
return email ? email.emailAddress() : null;
|
179
|
+
};
|
180
|
+
this.primaryPhoneNumberEntity = function () {
|
181
|
+
var numbers = this.phoneNumbers();
|
182
|
+
return numbers && numbers[0] ? numbers[0] : null;
|
183
|
+
};
|
184
|
+
this.primaryPhoneNumber = function () {
|
185
|
+
var primary = this.primaryPhoneNumberEntity();
|
186
|
+
return primary ? primary.internationalFormatNumber() : null;
|
187
|
+
};
|
188
|
+
this.primaryAddress = function () {
|
189
|
+
if (Boolean(this.addresses()) && Boolean(this.addresses()[0])) {
|
190
|
+
return this.addresses()[0];
|
191
|
+
}
|
192
|
+
return null;
|
193
|
+
};
|
194
|
+
this.stateAndCountryString = function () {
|
195
|
+
var self = this;
|
196
|
+
if (Boolean(self.primaryAddress())) {
|
197
|
+
return self.primaryAddress().stateAndCountryString();
|
198
|
+
}
|
199
|
+
return 'Address not shared.';
|
200
|
+
};
|
201
|
+
this.primaryAddressString = function () {
|
202
|
+
var self = this;
|
203
|
+
if (Boolean(self.primaryAddress())) {
|
204
|
+
return self.primaryAddress().fullAddressString();
|
205
|
+
}
|
206
|
+
return 'Address not shared.';
|
207
|
+
};
|
208
|
+
this.taxOptions = function () {
|
209
|
+
var defaultOptions = this.defaultTaxType(),
|
210
|
+
options = [];
|
211
|
+
options.push((0, _country_tax.NoTaxEntity)());
|
212
|
+
if (defaultOptions) {
|
213
|
+
options.push(defaultOptions);
|
214
|
+
}
|
215
|
+
return options;
|
216
|
+
};
|
217
|
+
this.destroy = function (success, error) {
|
218
|
+
(0, _model.deleteOne)(this.resource + "/" + this.id(), success, error);
|
219
|
+
};
|
220
|
+
this.paymentMethodIsValid = function (methodAttribute) {
|
221
|
+
var method = this[methodAttribute]();
|
222
|
+
return Array.isArray(method) && method.length > 0 && method[0].id();
|
223
|
+
};
|
224
|
+
this.arePhonePaymentsValid = function () {
|
225
|
+
return this.paymentMethodIsValid('paymentPhoneNumbers');
|
226
|
+
};
|
227
|
+
this.areBankPaymentsValid = function () {
|
228
|
+
return this.paymentMethodIsValid('banks');
|
229
|
+
};
|
230
|
+
this.logoUrl = function () {
|
231
|
+
var logo = this.logo();
|
232
|
+
return logo && logo.viewUrl() ? logo.viewUrl() : null;
|
233
|
+
};
|
234
|
+
}
|
235
|
+
function Companies() {
|
236
|
+
this.resource = '/companies';
|
237
|
+
this.json = 'companies';
|
238
|
+
this.single = Company;
|
239
|
+
this.get = function (success, error, parameters) {
|
240
|
+
var self = this;
|
241
|
+
function handleResponse(result) {
|
242
|
+
success((0, _model.fromJsonList)(self, result, {
|
243
|
+
makesDirty: false
|
244
|
+
}));
|
245
|
+
}
|
246
|
+
(0, _model.getList)(this.resource, handleResponse, error, parameters);
|
247
|
+
};
|
248
|
+
}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.CompanyInvitation = CompanyInvitation;
|
7
|
+
exports.CompanyInvitations = CompanyInvitations;
|
8
|
+
var _uuid = require("./uuid.js");
|
9
|
+
var _model = require("./model.js");
|
10
|
+
function CompanyInvitation() {
|
11
|
+
this.resource = '/company_invitations';
|
12
|
+
this.json = 'companyInvitation';
|
13
|
+
this.temporaryId = (0, _uuid.generateUUID)();
|
14
|
+
(0, _model.addPropertyTo)(this, 'id');
|
15
|
+
(0, _model.addPropertyTo)(this, 'userName');
|
16
|
+
(0, _model.addPropertyTo)(this, 'userEmail');
|
17
|
+
(0, _model.addPropertyTo)(this, 'token');
|
18
|
+
(0, _model.addPropertyTo)(this, 'inviteAsAdmin');
|
19
|
+
this.create = function (success, error, embed, as_domain) {
|
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
|
+
as_domain: as_domain,
|
29
|
+
files: (0, _model.enumerateFiles)(data[1]),
|
30
|
+
success: handleResponse,
|
31
|
+
data: error,
|
32
|
+
embed: embed
|
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 CompanyInvitations() {
|
54
|
+
this.resource = '/company_invitations';
|
55
|
+
this.json = 'companyInvitations';
|
56
|
+
this.single = CompanyInvitation;
|
57
|
+
this.get = function (success, error, offset, limit, q) {
|
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, {
|
65
|
+
offset: offset,
|
66
|
+
limit: limit,
|
67
|
+
q: q
|
68
|
+
});
|
69
|
+
};
|
70
|
+
}
|
@@ -0,0 +1,107 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Component = Component;
|
7
|
+
exports.Components = Components;
|
8
|
+
var _uuid = require("./uuid.js");
|
9
|
+
var _model = require("./model.js");
|
10
|
+
var _merchi_file = require("./merchi_file.js");
|
11
|
+
var _component_tag = require("./component_tag.js");
|
12
|
+
var _user = require("./user.js");
|
13
|
+
function Component() {
|
14
|
+
this.resource = '/components';
|
15
|
+
this.json = 'component';
|
16
|
+
this.temporaryId = (0, _uuid.generateUUID)();
|
17
|
+
(0, _model.addPropertyTo)(this, 'id');
|
18
|
+
(0, _model.addPropertyTo)(this, 'archived');
|
19
|
+
(0, _model.addPropertyTo)(this, 'componentImports', Component);
|
20
|
+
(0, _model.addPropertyTo)(this, 'componentExport', Component);
|
21
|
+
(0, _model.addPropertyTo)(this, 'componentExports', Component);
|
22
|
+
(0, _model.addPropertyTo)(this, 'created');
|
23
|
+
(0, _model.addPropertyTo)(this, 'updated');
|
24
|
+
(0, _model.addPropertyTo)(this, 'name');
|
25
|
+
(0, _model.addPropertyTo)(this, 'needsUpdate');
|
26
|
+
(0, _model.addPropertyTo)(this, 'outOfSyncWithOriginal');
|
27
|
+
(0, _model.addPropertyTo)(this, 'hasImports');
|
28
|
+
(0, _model.addPropertyTo)(this, 'isClone');
|
29
|
+
(0, _model.addPropertyTo)(this, 'warnings');
|
30
|
+
(0, _model.addPropertyTo)(this, 'body');
|
31
|
+
(0, _model.addPropertyTo)(this, 'description');
|
32
|
+
(0, _model.addPropertyTo)(this, 'compiled');
|
33
|
+
(0, _model.addPropertyTo)(this, 'originalComponent', Component);
|
34
|
+
(0, _model.addPropertyTo)(this, 'createdBy', _user.User);
|
35
|
+
(0, _model.addPropertyTo)(this, 'updatedBy', _user.User);
|
36
|
+
(0, _model.addPropertyTo)(this, 'featureImage', _merchi_file.MerchiFile);
|
37
|
+
(0, _model.addPropertyTo)(this, 'images', _merchi_file.MerchiFile);
|
38
|
+
(0, _model.addPropertyTo)(this, 'tags', _component_tag.ComponentTag);
|
39
|
+
this.get = function (success, error, embed) {
|
40
|
+
var self = this;
|
41
|
+
function handleResponse(result) {
|
42
|
+
success((0, _model.fromJson)(self, result[self.json], {
|
43
|
+
makesDirty: false
|
44
|
+
}));
|
45
|
+
}
|
46
|
+
(0, _model.getOne)({
|
47
|
+
resource: this.resource,
|
48
|
+
id: this.id(),
|
49
|
+
success: handleResponse,
|
50
|
+
error: error,
|
51
|
+
embed: embed
|
52
|
+
});
|
53
|
+
};
|
54
|
+
this.create = function (success, error, embed, domainId) {
|
55
|
+
var data = (0, _model.serialise)(this),
|
56
|
+
self = this;
|
57
|
+
function handleResponse(result) {
|
58
|
+
success((0, _model.fromJson)(self, result[self.json]));
|
59
|
+
}
|
60
|
+
(0, _model.create)({
|
61
|
+
resource: this.resource,
|
62
|
+
parameters: data[0],
|
63
|
+
files: (0, _model.enumerateFiles)(data[1]),
|
64
|
+
success: handleResponse,
|
65
|
+
error: error,
|
66
|
+
embed: embed,
|
67
|
+
as_domain: domainId
|
68
|
+
});
|
69
|
+
};
|
70
|
+
this.patch = function (success, error, embed) {
|
71
|
+
var self = this,
|
72
|
+
data = (0, _model.serialise)(this)[0];
|
73
|
+
function handleResponse(result) {
|
74
|
+
success((0, _model.fromJson)(self, result[self.json], {
|
75
|
+
makesDirty: false
|
76
|
+
}));
|
77
|
+
}
|
78
|
+
(0, _model.patchOne)({
|
79
|
+
resource: this.resource,
|
80
|
+
id: this.id(),
|
81
|
+
success: handleResponse,
|
82
|
+
error: error,
|
83
|
+
data: data,
|
84
|
+
embed: embed
|
85
|
+
});
|
86
|
+
};
|
87
|
+
this.toReact = function (context) {
|
88
|
+
var componentCode = 'with (this) { ' + this.compiled() + ' return ' + this.name() + ';}';
|
89
|
+
var proxy = new Proxy(context, {});
|
90
|
+
var callable = new Function(componentCode);
|
91
|
+
return callable.call(proxy);
|
92
|
+
};
|
93
|
+
}
|
94
|
+
function Components() {
|
95
|
+
this.resource = '/components';
|
96
|
+
this.json = 'components';
|
97
|
+
this.single = Component;
|
98
|
+
this.get = function (success, error, parameters) {
|
99
|
+
var self = this;
|
100
|
+
function handleResponse(result) {
|
101
|
+
success((0, _model.fromJsonList)(self, result, {
|
102
|
+
makesDirty: false
|
103
|
+
}));
|
104
|
+
}
|
105
|
+
(0, _model.getList)(this.resource, handleResponse, error, parameters);
|
106
|
+
};
|
107
|
+
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.ComponentTag = ComponentTag;
|
7
|
+
exports.ComponentTags = ComponentTags;
|
8
|
+
var _uuid = require("./uuid.js");
|
9
|
+
var _model = require("./model.js");
|
10
|
+
function ComponentTag() {
|
11
|
+
this.resource = '/component_tags';
|
12
|
+
this.json = 'componentTag';
|
13
|
+
this.temporaryId = (0, _uuid.generateUUID)();
|
14
|
+
(0, _model.addPropertyTo)(this, 'id');
|
15
|
+
(0, _model.addPropertyTo)(this, 'name');
|
16
|
+
this.get = function (success, error) {
|
17
|
+
var self = this;
|
18
|
+
function handleResponse(result) {
|
19
|
+
success((0, _model.fromJson)(self, result[self.json], {
|
20
|
+
makesDirty: false
|
21
|
+
}));
|
22
|
+
}
|
23
|
+
(0, _model.getOne)({
|
24
|
+
resource: this.resource,
|
25
|
+
id: this.id(),
|
26
|
+
success: handleResponse,
|
27
|
+
error: error
|
28
|
+
});
|
29
|
+
};
|
30
|
+
this.create = function (success, error, embed, domainId) {
|
31
|
+
var data = (0, _model.serialise)(this),
|
32
|
+
self = this;
|
33
|
+
function handleResponse(result) {
|
34
|
+
success((0, _model.fromJson)(self, result[self.json]));
|
35
|
+
}
|
36
|
+
(0, _model.create)({
|
37
|
+
resource: this.resource,
|
38
|
+
parameters: data[0],
|
39
|
+
files: (0, _model.enumerateFiles)(data[1]),
|
40
|
+
success: handleResponse,
|
41
|
+
error: error,
|
42
|
+
embed: embed,
|
43
|
+
as_domain: domainId
|
44
|
+
});
|
45
|
+
};
|
46
|
+
}
|
47
|
+
function ComponentTags() {
|
48
|
+
this.resource = '/component_tags';
|
49
|
+
this.json = 'componentTags';
|
50
|
+
this.single = ComponentTag;
|
51
|
+
this.get = function (success, error, parameters) {
|
52
|
+
var self = this;
|
53
|
+
function handleResponse(result) {
|
54
|
+
success((0, _model.fromJsonList)(self, result, {
|
55
|
+
makesDirty: false
|
56
|
+
}));
|
57
|
+
}
|
58
|
+
(0, _model.getList)(this.resource, handleResponse, error, parameters);
|
59
|
+
};
|
60
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.ComponentVersion = ComponentVersion;
|
7
|
+
var _uuid = require("./uuid.js");
|
8
|
+
var _model = require("./model.js");
|
9
|
+
var _component = require("./component.js");
|
10
|
+
function ComponentVersion() {
|
11
|
+
this.json = 'componentVersion';
|
12
|
+
this.temporaryId = (0, _uuid.generateUUID)();
|
13
|
+
(0, _model.addPropertyTo)(this, 'id');
|
14
|
+
(0, _model.addPropertyTo)(this, 'archived');
|
15
|
+
(0, _model.addPropertyTo)(this, 'component', _component.Component);
|
16
|
+
(0, _model.addPropertyTo)(this, 'created');
|
17
|
+
(0, _model.addPropertyTo)(this, 'isClassBased');
|
18
|
+
(0, _model.addPropertyTo)(this, 'description');
|
19
|
+
(0, _model.addPropertyTo)(this, 'name');
|
20
|
+
(0, _model.addPropertyTo)(this, 'body');
|
21
|
+
}
|
@@ -0,0 +1,93 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.CountryTax = CountryTax;
|
7
|
+
exports.CountryTaxes = CountryTaxes;
|
8
|
+
exports.NoTaxEntity = NoTaxEntity;
|
9
|
+
var _model = require("./model.js");
|
10
|
+
function CountryTax() {
|
11
|
+
this.resource = '/country_taxes';
|
12
|
+
this.json = 'countryTax';
|
13
|
+
(0, _model.addPropertyTo)(this, 'id');
|
14
|
+
(0, _model.addPropertyTo)(this, 'country');
|
15
|
+
(0, _model.addPropertyTo)(this, 'taxName');
|
16
|
+
(0, _model.addPropertyTo)(this, 'taxPercent');
|
17
|
+
this.create = function (success, error, embed, as_domain) {
|
18
|
+
var data = (0, _model.serialise)(this),
|
19
|
+
self = this;
|
20
|
+
function handleResponse(result) {
|
21
|
+
success((0, _model.fromJson)(self, result[self.json]));
|
22
|
+
}
|
23
|
+
(0, _model.create)({
|
24
|
+
resource: this.resource,
|
25
|
+
parameters: data[0],
|
26
|
+
as_domain: as_domain,
|
27
|
+
files: (0, _model.enumerateFiles)(data[1]),
|
28
|
+
success: handleResponse,
|
29
|
+
error: error,
|
30
|
+
embed: embed
|
31
|
+
});
|
32
|
+
};
|
33
|
+
this.get = function (success, error) {
|
34
|
+
var self = this;
|
35
|
+
function handleResponse(result) {
|
36
|
+
success((0, _model.fromJson)(self, result[self.json], {
|
37
|
+
makesDirty: false
|
38
|
+
}));
|
39
|
+
}
|
40
|
+
(0, _model.getOne)({
|
41
|
+
resource: this.resource,
|
42
|
+
id: this.id(),
|
43
|
+
success: handleResponse,
|
44
|
+
error: error
|
45
|
+
});
|
46
|
+
};
|
47
|
+
this.destroy = function (success, error) {
|
48
|
+
(0, _model.deleteOne)(this.resource + "/" + this.id(), success, error);
|
49
|
+
};
|
50
|
+
this.wrapedRepresentation = function () {
|
51
|
+
var representation = this.taxName();
|
52
|
+
if (this.country()) {
|
53
|
+
representation += " (" + this.country() + ")";
|
54
|
+
}
|
55
|
+
return representation;
|
56
|
+
};
|
57
|
+
}
|
58
|
+
function CountryTaxes() {
|
59
|
+
this.resource = '/country_taxes';
|
60
|
+
this.json = 'countryTaxes';
|
61
|
+
this.single = CountryTax;
|
62
|
+
this.get = function (success, error, parameters) {
|
63
|
+
var self = this;
|
64
|
+
function handleResponse(result) {
|
65
|
+
success((0, _model.fromJsonList)(self, result, {
|
66
|
+
makesDirty: false
|
67
|
+
}));
|
68
|
+
}
|
69
|
+
(0, _model.getList)(this.resource, handleResponse, error, parameters);
|
70
|
+
};
|
71
|
+
this.jsonsForOptions = function (taxes, selectedTaxId) {
|
72
|
+
var result = [],
|
73
|
+
i;
|
74
|
+
for (i = 0; i < taxes.length; i++) {
|
75
|
+
result.push({
|
76
|
+
name: taxes[i].wrapedRepresentation(),
|
77
|
+
selected: selectedTaxId && taxes[i].id() === selectedTaxId || !selectedTaxId && taxes[i].id() === window.taxType,
|
78
|
+
id: taxes[i].id()
|
79
|
+
});
|
80
|
+
}
|
81
|
+
return result;
|
82
|
+
};
|
83
|
+
}
|
84
|
+
function NoTaxEntity() {
|
85
|
+
var tax = new CountryTax();
|
86
|
+
return (0, _model.fromJson)(tax, {
|
87
|
+
id: null,
|
88
|
+
taxName: 'No tax',
|
89
|
+
taxPercent: 0
|
90
|
+
}, {
|
91
|
+
makesDirty: false
|
92
|
+
});
|
93
|
+
}
|