merchi_sdk_js 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
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
package/dist/page.js DELETED
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Page = Page;
7
- var _model = require("./model.js");
8
- var _helpers = require("./helpers.js");
9
- var _theme = require("./theme.js");
10
- function Page() {
11
- this.resource = '/pages';
12
- this.json = 'page';
13
- (0, _model.addPropertyTo)(this, 'id');
14
- (0, _model.addPropertyTo)(this, 'name');
15
- (0, _model.addPropertyTo)(this, 'slug');
16
- (0, _model.addPropertyTo)(this, 'template');
17
- (0, _model.addPropertyTo)(this, 'theme', _theme.Theme);
18
- this.text = function (text) {
19
- if (!(0, _helpers.isUndefinedOrNull)(text)) {
20
- this.template(text);
21
- } else {
22
- return this.template();
23
- }
24
- };
25
- this.create = function (success, error, embed, domainId) {
26
- var data = (0, _model.serialise)(this),
27
- self = this;
28
- function handleResponse(result) {
29
- success((0, _model.fromJson)(self, result[self.json]));
30
- }
31
- (0, _model.create)({
32
- resource: this.resource,
33
- parameters: data[0],
34
- files: (0, _model.enumerateFiles)(data[1]),
35
- success: handleResponse,
36
- error: error,
37
- embed: embed,
38
- as_domain: domainId
39
- });
40
- };
41
- }
package/dist/payment.js DELETED
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Payment = Payment;
7
- var _uuid = require("./uuid.js");
8
- var _model = require("./model.js");
9
- var _payment_types = require("./payment_types.js");
10
- var _automatic_payment_relationship = require("./automatic_payment_relationship.js");
11
- var _user = require("./user.js");
12
- function Payment() {
13
- this.resource = '/payments';
14
- this.json = 'payments';
15
- this.temporaryId = (0, _uuid.generateUUID)();
16
- (0, _model.addPropertyTo)(this, 'id');
17
- (0, _model.addPropertyTo)(this, 'note');
18
- (0, _model.addPropertyTo)(this, 'paymentType');
19
- (0, _model.addPropertyTo)(this, 'payDate');
20
- (0, _model.addPropertyTo)(this, 'amount');
21
- (0, _model.addPropertyTo)(this, 'sendSms');
22
- (0, _model.addPropertyTo)(this, 'sendEmail');
23
- (0, _model.addPropertyTo)(this, 'autoRefundable');
24
- (0, _model.addPropertyTo)(this, 'refunded');
25
- (0, _model.addPropertyTo)(this, 'refundIssuer', _user.User);
26
- (0, _model.addPropertyTo)(this, 'paymentRecorder', _user.User);
27
- (0, _model.addPropertyTo)(this, 'chargedByPaymentRelationship', _automatic_payment_relationship.AutomaticPaymentRelationship);
28
- this.paymentTypeText = function () {
29
- var paymentType = this.paymentType();
30
- return paymentType ? _payment_types.paymentTypes.get(paymentType) : 'Unknown';
31
- };
32
- }
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.PaymentDevice = PaymentDevice;
7
- var _uuid = require("./uuid.js");
8
- var _model = require("./model.js");
9
- var _company = require("./company.js");
10
- function PaymentDevice() {
11
- this.resource = '/payment_devices';
12
- this.json = 'paymentDevices';
13
- this.temporaryId = (0, _uuid.generateUUID)();
14
- (0, _model.addPropertyTo)(this, 'id');
15
- (0, _model.addPropertyTo)(this, 'code');
16
- (0, _model.addPropertyTo)(this, 'deviceId');
17
- (0, _model.addPropertyTo)(this, 'squareId');
18
- (0, _model.addPropertyTo)(this, 'deviceData');
19
- (0, _model.addPropertyTo)(this, 'company', _company.Company);
20
- (0, _model.addPropertyTo)(this, 'description');
21
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.paymentTypes = exports.paymentTypeIds = void 0;
7
- var _dictionary = require("./dictionary.js");
8
- var paymentTypes = exports.paymentTypes = new _dictionary.Dictionary();
9
- paymentTypes.add(1, 'Online');
10
- paymentTypes.add(2, 'PayPal');
11
- paymentTypes.add(3, 'Bank Transfer');
12
- paymentTypes.add(4, 'Cash');
13
- paymentTypes.add(5, 'Cheque');
14
- paymentTypes.add(6, 'Phone');
15
- paymentTypes.add(7, 'Credit Card');
16
- paymentTypes.add(8, 'Utrust');
17
- var paymentTypeIds = exports.paymentTypeIds = new _dictionary.Dictionary();
18
- paymentTypes.each(function (key, value) {
19
- paymentTypeIds.add(value, parseInt(key, 10));
20
- });
@@ -1,37 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.PhoneNumber = PhoneNumber;
7
- exports.PhoneNumbers = PhoneNumbers;
8
- var _uuid = require("./uuid.js");
9
- var _model = require("./model.js");
10
- function PhoneNumber() {
11
- this.resource = '/phone_numbers';
12
- this.json = 'phoneNumber';
13
- this.temporaryId = (0, _uuid.generateUUID)();
14
- (0, _model.addPropertyTo)(this, 'id');
15
- (0, _model.addPropertyTo)(this, 'number');
16
- (0, _model.addPropertyTo)(this, 'code');
17
- (0, _model.addPropertyTo)(this, 'localFormatNumber');
18
- (0, _model.addPropertyTo)(this, 'internationalFormatNumber');
19
- }
20
- function PhoneNumbers() {
21
- this.resource = '/phone_numbers';
22
- this.json = 'phoneNumbers';
23
- this.single = PhoneNumber;
24
- this.get = function (success, error, offset, limit, q) {
25
- var self = this;
26
- function handleResponse(result) {
27
- success((0, _model.fromJsonList)(self, result, {
28
- makesDirty: false
29
- }));
30
- }
31
- (0, _model.getList)(this.resource, handleResponse, error, {
32
- offset: offset,
33
- limit: limit,
34
- q: q
35
- });
36
- };
37
- }
package/dist/product.js DELETED
@@ -1,288 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Product = Product;
7
- exports.Products = Products;
8
- var _uuid = require("./uuid.js");
9
- var _helpers = require("./helpers.js");
10
- var _model = require("./model.js");
11
- var _product_types = require("./product_types.js");
12
- var _category = require("./category.js");
13
- var _component = require("./component.js");
14
- var _company = require("./company.js");
15
- var _country_tax = require("./country_tax.js");
16
- var _draft_template = require("./draft_template.js");
17
- var _domain_tag = require("./domain_tag.js");
18
- var _discount_group = require("./discount_group.js");
19
- var _domain = require("./domain.js");
20
- var _inventory = require("./inventory.js");
21
- var _shipment_method = require("./shipment_method.js");
22
- var _variation_field = require("./variation_field.js");
23
- var _variations_group = require("./variations_group.js");
24
- var _merchi_file = require("./merchi_file.js");
25
- var _supply_domain = require("./supply_domain.js");
26
- var _user = require("./user.js");
27
- var _job = require("./job.js");
28
- var _seo_domain_page = require("./seo_domain_page.js");
29
- var _internal_tag = require("./internal_tag.js");
30
- function Product() {
31
- this.resource = '/products';
32
- this.json = 'product';
33
- this.temporaryId = (0, _uuid.generateUUID)();
34
- (0, _model.addPropertyTo)(this, 'id');
35
- (0, _model.addPropertyTo)(this, 'name');
36
- (0, _model.addPropertyTo)(this, 'created');
37
- (0, _model.addPropertyTo)(this, 'updated');
38
- (0, _model.addPropertyTo)(this, 'country');
39
- (0, _model.addPropertyTo)(this, 'currency');
40
- (0, _model.addPropertyTo)(this, 'createdBy', _user.User);
41
- (0, _model.addPropertyTo)(this, 'updatedBy', _user.User);
42
- (0, _model.addPropertyTo)(this, 'independent');
43
- (0, _model.addPropertyTo)(this, 'productType');
44
- (0, _model.addPropertyTo)(this, 'description');
45
- (0, _model.addPropertyTo)(this, 'notes');
46
- (0, _model.addPropertyTo)(this, 'shopifyProductId');
47
- (0, _model.addPropertyTo)(this, 'minimum');
48
- (0, _model.addPropertyTo)(this, 'minimumPerGroup');
49
- (0, _model.addPropertyTo)(this, 'deliveryDaysNormal');
50
- (0, _model.addPropertyTo)(this, 'unitPrice');
51
- (0, _model.addPropertyTo)(this, 'unitPriceDiscountGroup', _discount_group.DiscountGroup);
52
- (0, _model.addPropertyTo)(this, 'bestPrice');
53
- (0, _model.addPropertyTo)(this, 'unitWeight');
54
- (0, _model.addPropertyTo)(this, 'unitHeight');
55
- (0, _model.addPropertyTo)(this, 'unitWidth');
56
- (0, _model.addPropertyTo)(this, 'unitDepth');
57
- (0, _model.addPropertyTo)(this, 'unitVolume');
58
- (0, _model.addPropertyTo)(this, 'showGroupBuyStatus');
59
- (0, _model.addPropertyTo)(this, 'groupBuyStatus');
60
- (0, _model.addPropertyTo)(this, 'needsDrafting');
61
- (0, _model.addPropertyTo)(this, 'needsProduction');
62
- (0, _model.addPropertyTo)(this, 'needsShipping');
63
- (0, _model.addPropertyTo)(this, 'needsInvoicing');
64
- (0, _model.addPropertyTo)(this, 'needsInventory');
65
- (0, _model.addPropertyTo)(this, 'showFeatureDeadline');
66
- (0, _model.addPropertyTo)(this, 'featureDeadline');
67
- (0, _model.addPropertyTo)(this, 'suppliers', _user.User);
68
- (0, _model.addPropertyTo)(this, 'groupVariationFields', _variation_field.VariationField);
69
- (0, _model.addPropertyTo)(this, 'independentVariationFields', _variation_field.VariationField);
70
- (0, _model.addPropertyTo)(this, 'originalProduct', Product);
71
- (0, _model.addPropertyTo)(this, 'clonedFromProduct', Product);
72
- (0, _model.addPropertyTo)(this, 'chainedSupplierProduct', Product);
73
- (0, _model.addPropertyTo)(this, 'chainedSellerProducts', Product);
74
- (0, _model.addPropertyTo)(this, 'chainedInventorySupplierProduct', Product);
75
- (0, _model.addPropertyTo)(this, 'chainedInventorySellerProducts', Product);
76
- (0, _model.addPropertyTo)(this, 'component', _component.Component);
77
- (0, _model.addPropertyTo)(this, 'domain', _domain.Domain);
78
- (0, _model.addPropertyTo)(this, 'suppliedByDomains', _supply_domain.SupplyDomain);
79
- (0, _model.addPropertyTo)(this, 'autoAssignProductionOnAction');
80
- (0, _model.addPropertyTo)(this, 'supplyDomains', _supply_domain.SupplyDomain);
81
- (0, _model.addPropertyTo)(this, 'images', _merchi_file.MerchiFile);
82
- (0, _model.addPropertyTo)(this, 'featureImage', _merchi_file.MerchiFile);
83
- (0, _model.addPropertyTo)(this, 'publicFiles', _merchi_file.MerchiFile);
84
- (0, _model.addPropertyTo)(this, 'productionFiles', _merchi_file.MerchiFile);
85
- (0, _model.addPropertyTo)(this, 'showPublic');
86
- (0, _model.addPropertyTo)(this, 'acceptSquare');
87
- (0, _model.addPropertyTo)(this, 'acceptStripe');
88
- (0, _model.addPropertyTo)(this, 'acceptPaypal');
89
- (0, _model.addPropertyTo)(this, 'acceptUtrust');
90
- (0, _model.addPropertyTo)(this, 'acceptBankTransfer');
91
- (0, _model.addPropertyTo)(this, 'acceptPhonePayment');
92
- (0, _model.addPropertyTo)(this, 'supplyChainDisabled');
93
- (0, _model.addPropertyTo)(this, 'allowAutomaticPaymentSupply');
94
- (0, _model.addPropertyTo)(this, 'allowGroupBuy');
95
- (0, _model.addPropertyTo)(this, 'allowPaymentUpfront');
96
- (0, _model.addPropertyTo)(this, 'allowQuotation');
97
- (0, _model.addPropertyTo)(this, 'allowChainedInventoryCreation');
98
- (0, _model.addPropertyTo)(this, 'allowClientDraftContribution');
99
- (0, _model.addPropertyTo)(this, 'chainedInventoryHandlingUnitPrice');
100
- (0, _model.addPropertyTo)(this, 'savedByUsers', _user.User);
101
- (0, _model.addPropertyTo)(this, 'savedByCompanies', _company.Company);
102
- (0, _model.addPropertyTo)(this, 'tags', _domain_tag.DomainTag);
103
- (0, _model.addPropertyTo)(this, 'inventories', _inventory.Inventory);
104
- (0, _model.addPropertyTo)(this, 'inventoriesOpen');
105
- (0, _model.addPropertyTo)(this, 'discountGroups', _discount_group.DiscountGroup);
106
- (0, _model.addPropertyTo)(this, 'categories', _category.Category);
107
- (0, _model.addPropertyTo)(this, 'taxType', _country_tax.CountryTax);
108
- (0, _model.addPropertyTo)(this, 'defaultJob', _job.Job);
109
- (0, _model.addPropertyTo)(this, 'supplyChainRequestJobs', _job.Job);
110
- (0, _model.addPropertyTo)(this, 'draftTemplates', _draft_template.DraftTemplate);
111
- (0, _model.addPropertyTo)(this, 'shipmentMethods', _shipment_method.ShipmentMethod);
112
- (0, _model.addPropertyTo)(this, 'seoDomainPages', _seo_domain_page.SeoDomainPage);
113
- (0, _model.addPropertyTo)(this, 'aiContext');
114
- (0, _model.addPropertyTo)(this, 'internalUseNotes');
115
- (0, _model.addPropertyTo)(this, 'internalUseAiContext');
116
- (0, _model.addPropertyTo)(this, 'internalTags', _internal_tag.InternalTag);
117
- this.create = function (success, error, embed, asDomain) {
118
- var data = (0, _model.serialise)(this),
119
- self = this,
120
- domain = self.domain() ? self.domain().id() : null,
121
- domainId = (0, _helpers.isUndefinedOrNull)(asDomain) ? domain : asDomain;
122
- function handleResponse(result) {
123
- success((0, _model.fromJson)(self, result[self.json]));
124
- }
125
- (0, _model.create)({
126
- resource: this.resource,
127
- parameters: data[0],
128
- as_domain: domainId,
129
- files: (0, _model.enumerateFiles)(data[1]),
130
- success: handleResponse,
131
- error: error,
132
- embed: embed
133
- });
134
- };
135
- this.get = function (success, error, embed) {
136
- var self = this;
137
- function handleResponse(result) {
138
- success((0, _model.fromJson)(self, result[self.json], {
139
- makesDirty: false
140
- }));
141
- }
142
- (0, _model.getOne)({
143
- resource: this.resource,
144
- id: this.id(),
145
- success: handleResponse,
146
- error: error,
147
- embed: embed
148
- });
149
- };
150
- this.patch = function (success, error, embed) {
151
- var self = this,
152
- data = (0, _model.serialise)(this, undefined, undefined, undefined, {
153
- excludeOld: true
154
- })[0];
155
- function handleResponse(result) {
156
- success((0, _model.fromJson)(self, result[self.json], {
157
- makesDirty: false
158
- }));
159
- }
160
- (0, _model.patchOne)({
161
- resource: this.resource,
162
- id: this.id(),
163
- success: handleResponse,
164
- error: error,
165
- data: data,
166
- embed: embed
167
- });
168
- };
169
- this.destroy = function (success, error) {
170
- (0, _model.deleteOne)(this.resource + '/' + this.id(), success, error);
171
- };
172
- this.duplicate = function (success, error) {
173
- var self = this,
174
- request = new _model.Request();
175
- request.resource('/products/' + self.id() + '/copy/');
176
- request.method('POST');
177
- function handleResponse(status, data) {
178
- if (status === 201) {
179
- success((0, _model.fromJson)(self, data[self.json]));
180
- } else {
181
- error(null, data);
182
- }
183
- }
184
- request.responseHandler(handleResponse).errorHandler(error);
185
- request.send();
186
- };
187
- this.company = function () {
188
- return this.domain() ? this.domain().company() : null;
189
- };
190
- this.variationFields = function () {
191
- var variationFields = [];
192
- if ((0, _helpers.notEmptyArray)(this.groupVariationFields())) {
193
- variationFields = variationFields.concat(this.groupVariationFields());
194
- }
195
- if ((0, _helpers.notEmptyArray)(this.independentVariationFields())) {
196
- variationFields = variationFields.concat(this.independentVariationFields());
197
- }
198
- return variationFields;
199
- };
200
- this.removeVariation = function (variation) {
201
- var variations = !variation.independent() ? this.groupVariationFields() : this.independentVariationFields();
202
- return (0, _helpers.removeObjectFromArrayWithIntegerValue)(variations, 'id', variation.id());
203
- };
204
- this.primaryImage = function () {
205
- var feature = this.featureImage(),
206
- images = this.images(),
207
- firstImage = images && images[0] ? images[0] : null;
208
- return feature ? feature : firstImage;
209
- };
210
- this.productPrimaryImage = function () {
211
- return this.primaryImage() ? this.primaryImage().viewUrl() : null;
212
- };
213
- this.productCurrency = function () {
214
- var domain = this.domain();
215
- return domain && domain.company() ? domain.company().defaultCurrency() : null;
216
- };
217
- this.hasGroupVariationFields = function () {
218
- return (0, _helpers.notEmptyArray)(this.groupVariationFields());
219
- };
220
- this.hasIndependentVariationFields = function () {
221
- return (0, _helpers.notEmptyArray)(this.independentVariationFields());
222
- };
223
- this.buildEmptyVariationGroup = function () {
224
- var variationsGroupBuilt = new _variations_group.VariationsGroup(),
225
- groupVariationFields = this.groupVariationFields(),
226
- emptyGroupCost = 0,
227
- variations = [],
228
- i,
229
- emptyVariation;
230
- variationsGroupBuilt.quantity('0');
231
- for (i = 0; i < groupVariationFields.length; i++) {
232
- emptyVariation = groupVariationFields[i].buildEmptyVariation();
233
- variations.push(emptyVariation);
234
- emptyGroupCost += parseFloat(emptyVariation.cost(), 10);
235
- }
236
- variationsGroupBuilt.groupCost(emptyGroupCost.toString());
237
- variationsGroupBuilt.variations(variations);
238
- return variationsGroupBuilt;
239
- };
240
- this.buildEmptyVariations = function () {
241
- var emptyVariations = [],
242
- emptyVariation,
243
- independentVariationFields = this.independentVariationFields(),
244
- i;
245
- for (i = 0; i < independentVariationFields.length; i++) {
246
- emptyVariation = independentVariationFields[i].buildEmptyVariation();
247
- emptyVariations.push(emptyVariation);
248
- }
249
- return emptyVariations;
250
- };
251
- this.tax = function () {
252
- return this.taxType();
253
- };
254
- this.previewImages = function (maxImages) {
255
- var files = this.images();
256
- if (Boolean(files)) {
257
- return files.slice(0, maxImages);
258
- }
259
- return [];
260
- };
261
- this.stripePublishableKey = function () {
262
- return this.domain().company() ? this.domain().company().stripePublishableKey() : null;
263
- };
264
- this.stripeIsValidAndActive = function () {
265
- var company = this.domain().company();
266
- return this.stripePublishableKey() && company && company.acceptStripe();
267
- };
268
- this.isSupplierMOD = function () {
269
- return this.productType() === _product_types.productTypesInts.get('Supplier MOD (made on demand)');
270
- };
271
- this.isResell = function () {
272
- return this.isSupplierMOD();
273
- };
274
- }
275
- function Products() {
276
- this.resource = '/products';
277
- this.json = 'products';
278
- this.single = Product;
279
- this.get = function (success, error, parameters) {
280
- var self = this;
281
- function handleResponse(result) {
282
- success((0, _model.fromJsonList)(self, result, {
283
- makesDirty: false
284
- }));
285
- }
286
- (0, _model.getList)(this.resource, handleResponse, error, parameters);
287
- };
288
- }
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.productTypesInts = exports.productTypes = void 0;
7
- var _dictionary = require("./dictionary.js");
8
- var productTypes = exports.productTypes = new _dictionary.Dictionary();
9
- productTypes.add(0, 'supplier MOD (made on demand)');
10
- productTypes.add(1, 'supplier');
11
- productTypes.add(2, 'seller');
12
- productTypes.add(3, 'seller MOD (made on demand)');
13
- productTypes.add(4, 'cloned MOD (made on demand)');
14
- productTypes.add(5, 'seller cloned MOD (made on demand)');
15
- productTypes.add(6, 'production MOD (made on demand)');
16
- productTypes.add(7, 'cloned supplier');
17
- productTypes.add(8, 'seller inventory');
18
- productTypes.add(9, 'supplir inventory');
19
- productTypes.add(10, 'seller group buy');
20
- productTypes.add(11, 'supplier resell MOD (made on demand)');
21
- productTypes.add(12, 'supplier resell');
22
- productTypes.add(14, 'supplier group buy inventory');
23
- productTypes.add(14, 'seller inventory cloned');
24
- productTypes.add(15, 'seller group buy inventory cloned');
25
- productTypes.add(16, 'supply seller MOD(made on demand) cloned');
26
- productTypes.add(17, 'supplier to supplier resell MOD(made on demand)');
27
- productTypes.add(18, 'supplier resell cloned');
28
- productTypes.add(19, 'supply domain reference');
29
- var productTypesInts = exports.productTypesInts = new _dictionary.Dictionary();
30
- productTypes.each(function (key, value) {
31
- productTypesInts.add(value, parseInt(key, 10));
32
- });
@@ -1,44 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ProductionComment = ProductionComment;
7
- var _model = require("./model.js");
8
- var _assignment = require("./assignment.js");
9
- var _user = require("./user.js");
10
- var _merchi_file = require("./merchi_file.js");
11
- var _notification = require("./notification.js");
12
- function ProductionComment() {
13
- this.resource = '/production_comments';
14
- this.json = 'productionComment';
15
- (0, _model.addPropertyTo)(this, 'id');
16
- (0, _model.addPropertyTo)(this, 'user', _user.User);
17
- (0, _model.addPropertyTo)(this, 'file', _merchi_file.MerchiFile);
18
- (0, _model.addPropertyTo)(this, 'notifications', _notification.Notification);
19
- (0, _model.addPropertyTo)(this, 'assignment', _assignment.Assignment);
20
- (0, _model.addPropertyTo)(this, 'date');
21
- (0, _model.addPropertyTo)(this, 'text');
22
- (0, _model.addPropertyTo)(this, 'urgency');
23
- (0, _model.addPropertyTo)(this, 'subject');
24
- (0, _model.addPropertyTo)(this, 'sendSms');
25
- (0, _model.addPropertyTo)(this, 'sendEmail');
26
- (0, _model.addPropertyTo)(this, 'isUrgentQuestion');
27
- this.create = function (options) {
28
- var data = (0, _model.serialise)(this),
29
- self = this,
30
- embed = options.embed ? options.embed : {};
31
- function handleResponse(result) {
32
- options.success((0, _model.fromJson)(self, result[self.json]));
33
- }
34
- (0, _model.create)({
35
- resource: this.resource,
36
- parameters: data[0],
37
- files: (0, _model.enumerateFiles)(data[1]),
38
- success: handleResponse,
39
- as_domain: options.asDomain,
40
- error: options.error,
41
- embed: embed
42
- });
43
- };
44
- }
package/dist/quote.js DELETED
@@ -1,91 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Quote = Quote;
7
- exports.Quotes = Quotes;
8
- var _uuid = require("./uuid.js");
9
- var _model = require("./model.js");
10
- var _quote_item = require("./quote_item.js");
11
- var _assignment = require("./assignment.js");
12
- var _invoice = require("./invoice.js");
13
- function Quote() {
14
- this.resource = '/quotes';
15
- this.json = 'quote';
16
- this.temporaryId = (0, _uuid.generateUUID)();
17
- (0, _model.addPropertyTo)(this, 'id');
18
- (0, _model.addPropertyTo)(this, 'agreedDeadline');
19
- (0, _model.addPropertyTo)(this, 'quoteItems', _quote_item.QuoteItem);
20
- (0, _model.addPropertyTo)(this, 'assignments', _assignment.Assignment);
21
- (0, _model.addPropertyTo)(this, 'currency');
22
- (0, _model.addPropertyTo)(this, 'invoice', _invoice.Invoice);
23
- this.get = function (success, error) {
24
- var self = this;
25
- function handleResponse(result) {
26
- success((0, _model.fromJson)(self, result[self.json], {
27
- makesDirty: false
28
- }));
29
- }
30
- (0, _model.getOne)({
31
- resource: this.resource,
32
- id: this.id(),
33
- success: handleResponse,
34
- error: error
35
- });
36
- };
37
- this.quoteTotal = function () {
38
- var self = this,
39
- items = Boolean(self.quoteItems()) ? self.quoteItems() : [],
40
- total = parseFloat(0.000),
41
- i;
42
- for (i = 0; i < items.length; i++) {
43
- total += parseFloat(items[i].total());
44
- }
45
- return total;
46
- };
47
- this.deadlineTimeDifference = function () {
48
- var self = this,
49
- proposedDeadline = Boolean(self.agreedDeadline()) ? self.agreedDeadline() : null,
50
- assignments = Boolean(self.assignments()) ? self.assignments() : null,
51
- assignment = Boolean(assignments) && assignments.length > 0 ? assignments[0] : null,
52
- productionDeadline = Boolean(assignment) ? assignment.productionDeadline() : null;
53
- if (Boolean(proposedDeadline) && Boolean(productionDeadline)) {
54
- return productionDeadline - proposedDeadline;
55
- }
56
- return null;
57
- };
58
- this.findQuoteItemIndex = function (quoteItemId) {
59
- var self = this,
60
- quoteItems = Boolean(self.quoteItems()) ? self.quoteItems() : [];
61
- return quoteItems.findIndex(function (arrayElement) {
62
- return String(arrayElement.id()) === String(quoteItemId);
63
- });
64
- };
65
- this.removeQuoteItem = function (quoteItem) {
66
- var self = this,
67
- itemIndex = self.findQuoteItemIndex(quoteItem.id()),
68
- quoteItems = self.quoteItems();
69
- if (Boolean(quoteItems) && itemIndex >= 0) {
70
- quoteItems.splice(itemIndex, 1);
71
- }
72
- };
73
- }
74
- function Quotes() {
75
- this.resource = '/quotes';
76
- this.json = 'quotes';
77
- this.single = Quote;
78
- this.get = function (success, error, offset, limit, q) {
79
- var self = this;
80
- function handleResponse(result) {
81
- success((0, _model.fromJsonList)(self, result, {
82
- makesDirty: false
83
- }));
84
- }
85
- (0, _model.getList)(this.resource, handleResponse, error, {
86
- offset: offset,
87
- limit: limit,
88
- q: q
89
- });
90
- };
91
- }
@@ -1,59 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.QuoteItem = QuoteItem;
7
- exports.QuoteItems = QuoteItems;
8
- var _uuid = require("./uuid.js");
9
- var _model = require("./model.js");
10
- function QuoteItem() {
11
- this.resource = '/quote_items';
12
- this.json = 'quoteItem';
13
- this.temporaryId = (0, _uuid.generateUUID)();
14
- (0, _model.addPropertyTo)(this, 'id');
15
- (0, _model.addPropertyTo)(this, 'type');
16
- (0, _model.addPropertyTo)(this, 'quantity');
17
- (0, _model.addPropertyTo)(this, 'description');
18
- (0, _model.addPropertyTo)(this, 'unitPrice');
19
- this.get = function (success, error) {
20
- var self = this;
21
- function handleResponse(result) {
22
- success((0, _model.fromJson)(self, result[self.json], {
23
- makesDirty: false
24
- }));
25
- }
26
- (0, _model.getOne)({
27
- resource: this.resource,
28
- id: this.id(),
29
- success: handleResponse,
30
- error: error
31
- });
32
- };
33
- this.total = function () {
34
- var self = this,
35
- quantity = Boolean(self.quantity()) ? self.quantity() : 0,
36
- unitPrice = Boolean(self.unitPrice()) ? self.unitPrice() : 0,
37
- total;
38
- total = quantity * unitPrice;
39
- return total.toFixed(3);
40
- };
41
- }
42
- function QuoteItems() {
43
- this.resource = '/quote_items';
44
- this.json = 'quoteItems';
45
- this.single = QuoteItem;
46
- this.get = function (success, error, offset, limit, q) {
47
- var self = this;
48
- function handleResponse(result) {
49
- success((0, _model.fromJsonList)(self, result, {
50
- makesDirty: false
51
- }));
52
- }
53
- (0, _model.getList)(this.resource, handleResponse, error, {
54
- offset: offset,
55
- limit: limit,
56
- q: q
57
- });
58
- };
59
- }