merchi_sdk_js 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/package.json +4 -4
  2. package/src/helpers.js +1 -1
  3. package/dist/address.js +0 -109
  4. package/dist/assignment.js +0 -175
  5. package/dist/automatic_payment_relationship.js +0 -72
  6. package/dist/backup.js +0 -32
  7. package/dist/bank.js +0 -25
  8. package/dist/cart.js +0 -133
  9. package/dist/cart_item.js +0 -71
  10. package/dist/cart_shipment_group.js +0 -23
  11. package/dist/cart_shipment_quote.js +0 -26
  12. package/dist/category.js +0 -68
  13. package/dist/company.js +0 -248
  14. package/dist/company_invitation.js +0 -70
  15. package/dist/component.js +0 -107
  16. package/dist/component_tag.js +0 -60
  17. package/dist/component_version.js +0 -21
  18. package/dist/country_tax.js +0 -93
  19. package/dist/dictionary.js +0 -130
  20. package/dist/discount.js +0 -22
  21. package/dist/discount_group.js +0 -18
  22. package/dist/domain.js +0 -245
  23. package/dist/domain_invitation.js +0 -17
  24. package/dist/domain_tag.js +0 -87
  25. package/dist/domain_types.js +0 -22
  26. package/dist/draft.js +0 -97
  27. package/dist/draft_comment.js +0 -45
  28. package/dist/draft_template.js +0 -39
  29. package/dist/email_address.js +0 -34
  30. package/dist/email_counter.js +0 -47
  31. package/dist/enrolled_domain.js +0 -88
  32. package/dist/exchange_rate.js +0 -66
  33. package/dist/field_types.js +0 -19
  34. package/dist/helpers.js +0 -86
  35. package/dist/internal_tag.js +0 -98
  36. package/dist/inventory.js +0 -100
  37. package/dist/inventory_unit_variation.js +0 -19
  38. package/dist/invoice.js +0 -225
  39. package/dist/invoice_types.js +0 -11
  40. package/dist/item.js +0 -25
  41. package/dist/job.js +0 -536
  42. package/dist/job_comment.js +0 -45
  43. package/dist/job_status.js +0 -47
  44. package/dist/matching_inventory.js +0 -21
  45. package/dist/md5.js +0 -149
  46. package/dist/menu.js +0 -37
  47. package/dist/menu_item.js +0 -24
  48. package/dist/merchi.js +0 -1004
  49. package/dist/merchi_file.js +0 -165
  50. package/dist/model.js +0 -753
  51. package/dist/notification.js +0 -151
  52. package/dist/notification_types.js +0 -199
  53. package/dist/output.cjs.js +0 -31317
  54. package/dist/output.esm.js +0 -31312
  55. package/dist/page.js +0 -41
  56. package/dist/payment.js +0 -32
  57. package/dist/payment_device.js +0 -21
  58. package/dist/payment_types.js +0 -20
  59. package/dist/phone_number.js +0 -37
  60. package/dist/product.js +0 -288
  61. package/dist/product_types.js +0 -32
  62. package/dist/production_comment.js +0 -44
  63. package/dist/quote.js +0 -91
  64. package/dist/quote_item.js +0 -59
  65. package/dist/roles.js +0 -29
  66. package/dist/seo_domain_page.js +0 -42
  67. package/dist/session.js +0 -103
  68. package/dist/set.js +0 -29
  69. package/dist/shipment.js +0 -181
  70. package/dist/shipment_item.js +0 -17
  71. package/dist/shipment_item_fulfillment.js +0 -17
  72. package/dist/shipment_method.js +0 -81
  73. package/dist/shipment_method_variation.js +0 -38
  74. package/dist/subscription_plan.js +0 -75
  75. package/dist/supply_domain.js +0 -65
  76. package/dist/system_role.js +0 -12
  77. package/dist/theme.js +0 -180
  78. package/dist/theme_css_setting.js +0 -61
  79. package/dist/theme_status.js +0 -11
  80. package/dist/user.js +0 -409
  81. package/dist/user_company.js +0 -19
  82. package/dist/user_types.js +0 -23
  83. package/dist/uuid.js +0 -12
  84. package/dist/variation.js +0 -233
  85. package/dist/variation_field.js +0 -233
  86. package/dist/variation_fields_option.js +0 -41
  87. package/dist/variation_option.js +0 -62
  88. package/dist/variations_group.js +0 -43
  89. package/dist/white_label_accessibilities.js +0 -11
@@ -1,26 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.CartShipmentQuote = CartShipmentQuote;
7
- var _uuid = require("./uuid.js");
8
- var _model = require("./model.js");
9
- var _shipment_method = require("./shipment_method.js");
10
- function CartShipmentQuote() {
11
- this.resource = '/cart_shipment_quotes';
12
- this.json = 'cartShipmentQuote';
13
- this.temporaryId = (0, _uuid.generateUUID)();
14
- (0, _model.addPropertyTo)(this, 'id');
15
- (0, _model.addPropertyTo)(this, 'name');
16
- (0, _model.addPropertyTo)(this, 'subtotalCost');
17
- (0, _model.addPropertyTo)(this, 'taxAmount');
18
- (0, _model.addPropertyTo)(this, 'totalCost');
19
- (0, _model.addPropertyTo)(this, 'shipmentMethod', _shipment_method.ShipmentMethod);
20
- (0, _model.addPropertyTo)(this, 'shipmentServiceQuote');
21
- (0, _model.addPropertyTo)(this, 'shipmentService');
22
- this.name = function () {
23
- var shipmentMethod = this.shipmentMethod();
24
- return shipmentMethod ? shipmentMethod.name() : null;
25
- };
26
- }
package/dist/category.js DELETED
@@ -1,68 +0,0 @@
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 DELETED
@@ -1,248 +0,0 @@
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
- }
@@ -1,70 +0,0 @@
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
- }
package/dist/component.js DELETED
@@ -1,107 +0,0 @@
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
- }
@@ -1,60 +0,0 @@
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
- }
@@ -1,21 +0,0 @@
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
- }
@@ -1,93 +0,0 @@
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
- }