merchi_sdk_js 0.0.2 → 0.0.4

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 (88) hide show
  1. package/package.json +4 -3
  2. package/dist/address.js +0 -109
  3. package/dist/assignment.js +0 -175
  4. package/dist/automatic_payment_relationship.js +0 -72
  5. package/dist/backup.js +0 -32
  6. package/dist/bank.js +0 -25
  7. package/dist/cart.js +0 -133
  8. package/dist/cart_item.js +0 -71
  9. package/dist/cart_shipment_group.js +0 -23
  10. package/dist/cart_shipment_quote.js +0 -26
  11. package/dist/category.js +0 -68
  12. package/dist/company.js +0 -248
  13. package/dist/company_invitation.js +0 -70
  14. package/dist/component.js +0 -107
  15. package/dist/component_tag.js +0 -60
  16. package/dist/component_version.js +0 -21
  17. package/dist/country_tax.js +0 -93
  18. package/dist/dictionary.js +0 -130
  19. package/dist/discount.js +0 -22
  20. package/dist/discount_group.js +0 -18
  21. package/dist/domain.js +0 -245
  22. package/dist/domain_invitation.js +0 -17
  23. package/dist/domain_tag.js +0 -87
  24. package/dist/domain_types.js +0 -22
  25. package/dist/draft.js +0 -97
  26. package/dist/draft_comment.js +0 -45
  27. package/dist/draft_template.js +0 -39
  28. package/dist/email_address.js +0 -34
  29. package/dist/email_counter.js +0 -47
  30. package/dist/enrolled_domain.js +0 -88
  31. package/dist/exchange_rate.js +0 -66
  32. package/dist/field_types.js +0 -19
  33. package/dist/helpers.js +0 -86
  34. package/dist/internal_tag.js +0 -98
  35. package/dist/inventory.js +0 -100
  36. package/dist/inventory_unit_variation.js +0 -19
  37. package/dist/invoice.js +0 -225
  38. package/dist/invoice_types.js +0 -11
  39. package/dist/item.js +0 -25
  40. package/dist/job.js +0 -536
  41. package/dist/job_comment.js +0 -45
  42. package/dist/job_status.js +0 -47
  43. package/dist/matching_inventory.js +0 -21
  44. package/dist/md5.js +0 -149
  45. package/dist/menu.js +0 -37
  46. package/dist/menu_item.js +0 -24
  47. package/dist/merchi.js +0 -1004
  48. package/dist/merchi_file.js +0 -165
  49. package/dist/model.js +0 -753
  50. package/dist/notification.js +0 -151
  51. package/dist/notification_types.js +0 -199
  52. package/dist/output.cjs.js +0 -31317
  53. package/dist/output.esm.js +0 -31312
  54. package/dist/page.js +0 -41
  55. package/dist/payment.js +0 -32
  56. package/dist/payment_device.js +0 -21
  57. package/dist/payment_types.js +0 -20
  58. package/dist/phone_number.js +0 -37
  59. package/dist/product.js +0 -288
  60. package/dist/product_types.js +0 -32
  61. package/dist/production_comment.js +0 -44
  62. package/dist/quote.js +0 -91
  63. package/dist/quote_item.js +0 -59
  64. package/dist/roles.js +0 -29
  65. package/dist/seo_domain_page.js +0 -42
  66. package/dist/session.js +0 -103
  67. package/dist/set.js +0 -29
  68. package/dist/shipment.js +0 -181
  69. package/dist/shipment_item.js +0 -17
  70. package/dist/shipment_item_fulfillment.js +0 -17
  71. package/dist/shipment_method.js +0 -81
  72. package/dist/shipment_method_variation.js +0 -38
  73. package/dist/subscription_plan.js +0 -75
  74. package/dist/supply_domain.js +0 -65
  75. package/dist/system_role.js +0 -12
  76. package/dist/theme.js +0 -180
  77. package/dist/theme_css_setting.js +0 -61
  78. package/dist/theme_status.js +0 -11
  79. package/dist/user.js +0 -409
  80. package/dist/user_company.js +0 -19
  81. package/dist/user_types.js +0 -23
  82. package/dist/uuid.js +0 -12
  83. package/dist/variation.js +0 -233
  84. package/dist/variation_field.js +0 -233
  85. package/dist/variation_fields_option.js +0 -41
  86. package/dist/variation_option.js +0 -62
  87. package/dist/variations_group.js +0 -43
  88. package/dist/white_label_accessibilities.js +0 -11
package/dist/invoice.js DELETED
@@ -1,225 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Invoice = Invoice;
7
- exports.Invoices = Invoices;
8
- var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
9
- var _uuid = require("./uuid.js");
10
- var _model = require("./model.js");
11
- var _helpers = require("./helpers.js");
12
- var _address = require("./address.js");
13
- var _email_address = require("./email_address.js");
14
- var _domain = require("./domain.js");
15
- var _domain_tag = require("./domain_tag.js");
16
- var _item = require("./item.js");
17
- var _company = require("./company.js");
18
- var _phone_number = require("./phone_number.js");
19
- var _user = require("./user.js");
20
- var _shipment = require("./shipment.js");
21
- var _merchi_file = require("./merchi_file.js");
22
- var _quote = require("./quote.js");
23
- var _payment = require("./payment.js");
24
- var _job = require("./job.js");
25
- var _internal_tag = require("./internal_tag.js");
26
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
27
- function Invoice() {
28
- this.resource = '/invoices';
29
- this.json = 'invoice';
30
- this.temporaryId = (0, _uuid.generateUUID)();
31
- (0, _model.addPropertyTo)(this, 'id');
32
- (0, _model.addPropertyTo)(this, 'note');
33
- (0, _model.addPropertyTo)(this, 'creationDate');
34
- (0, _model.addPropertyTo)(this, 'paymentDeadline');
35
- (0, _model.addPropertyTo)(this, 'sendSms');
36
- (0, _model.addPropertyTo)(this, 'sendEmail');
37
- (0, _model.addPropertyTo)(this, 'unpaid');
38
- (0, _model.addPropertyTo)(this, 'totalCost');
39
- (0, _model.addPropertyTo)(this, 'subtotalCost');
40
- (0, _model.addPropertyTo)(this, 'taxAmount');
41
- (0, _model.addPropertyTo)(this, 'invoiceToken');
42
- (0, _model.addPropertyTo)(this, 'canAutoPay');
43
- (0, _model.addPropertyTo)(this, 'responsibleManager', _user.User);
44
- (0, _model.addPropertyTo)(this, 'creator', _user.User);
45
- (0, _model.addPropertyTo)(this, 'client', _user.User);
46
- (0, _model.addPropertyTo)(this, 'clientEmail', _email_address.EmailAddress);
47
- (0, _model.addPropertyTo)(this, 'clientPhone', _phone_number.PhoneNumber);
48
- (0, _model.addPropertyTo)(this, 'clientCompany', _company.Company);
49
- (0, _model.addPropertyTo)(this, 'clientCompanyEmail', _email_address.EmailAddress);
50
- (0, _model.addPropertyTo)(this, 'clientCompanyPhone', _phone_number.PhoneNumber);
51
- (0, _model.addPropertyTo)(this, 'jobs', _job.Job);
52
- (0, _model.addPropertyTo)(this, 'quotes', _quote.Quote);
53
- (0, _model.addPropertyTo)(this, 'items', _item.Item);
54
- (0, _model.addPropertyTo)(this, 'shipping', _address.Address);
55
- (0, _model.addPropertyTo)(this, 'domain', _domain.Domain);
56
- (0, _model.addPropertyTo)(this, 'pdf', _merchi_file.MerchiFile);
57
- (0, _model.addPropertyTo)(this, 'receipt', _merchi_file.MerchiFile);
58
- (0, _model.addPropertyTo)(this, 'payments', _payment.Payment);
59
- (0, _model.addPropertyTo)(this, 'currency');
60
- (0, _model.addPropertyTo)(this, 'acceptSquare');
61
- (0, _model.addPropertyTo)(this, 'acceptStripe');
62
- (0, _model.addPropertyTo)(this, 'acceptPaypal');
63
- (0, _model.addPropertyTo)(this, 'acceptUtrust');
64
- (0, _model.addPropertyTo)(this, 'acceptBankTransfer');
65
- (0, _model.addPropertyTo)(this, 'acceptPhonePayment');
66
- (0, _model.addPropertyTo)(this, 'tags', _domain_tag.DomainTag);
67
- (0, _model.addPropertyTo)(this, 'reminderMessage');
68
- (0, _model.addPropertyTo)(this, 'reminded');
69
- (0, _model.addPropertyTo)(this, 'isRemindable');
70
- (0, _model.addPropertyTo)(this, 'forceReminders');
71
- (0, _model.addPropertyTo)(this, 'owedMoney');
72
- (0, _model.addPropertyTo)(this, 'paidMoney');
73
- (0, _model.addPropertyTo)(this, 'isCompletelyPaid');
74
- (0, _model.addPropertyTo)(this, 'shipments', _shipment.Shipment);
75
- (0, _model.addPropertyTo)(this, 'shopifyOrderId');
76
- (0, _model.addPropertyTo)(this, 'internalTags', _internal_tag.InternalTag);
77
- this.create = function (success, error, embed, asDomain) {
78
- var data = (0, _model.serialise)(this),
79
- self = this,
80
- domain = self.domain() ? self.domain().id() : null,
81
- domainId = (0, _helpers.isUndefinedOrNull)(asDomain) ? domain : asDomain;
82
- function handleResponse(result) {
83
- success((0, _model.fromJson)(self, result[self.json]));
84
- }
85
- (0, _model.create)({
86
- resource: this.resource,
87
- parameters: data[0],
88
- as_domain: domainId,
89
- files: (0, _model.enumerateFiles)(data[1]),
90
- success: handleResponse,
91
- error: error,
92
- embed: embed
93
- });
94
- };
95
- this.patch = function (success, error, embed, asDomain) {
96
- var self = this,
97
- data = (0, _model.serialise)(this, undefined, undefined, undefined, {
98
- excludeOld: true
99
- })[0],
100
- domain = self.domain() ? self.domain().id() : null,
101
- domainId = (0, _helpers.isUndefinedOrNull)(asDomain) ? domain : asDomain;
102
- function handleResponse(result) {
103
- success((0, _model.fromJson)(self, result[self.json], {
104
- makesDirty: false
105
- }));
106
- }
107
- (0, _model.patchOne)({
108
- resource: this.resource,
109
- id: this.id(),
110
- success: handleResponse,
111
- error: error,
112
- as_domain: domainId,
113
- data: data,
114
- embed: embed
115
- });
116
- };
117
- this.publicCreate = function (success, error) {
118
- var data = (0, _model.serialise)(this),
119
- self = this,
120
- request = new _model.Request();
121
- request.data().merge(data[0]);
122
- request.resource('/public-invoice-create/');
123
- request.method('POST');
124
- function handleResponse(status, data) {
125
- if (status === 201) {
126
- success((0, _model.fromJson)(self, data[self.json]));
127
- } else {
128
- error(status, data);
129
- }
130
- }
131
- function handleError(status, data) {
132
- error(status, data);
133
- }
134
- request.responseHandler(handleResponse).errorHandler(handleError);
135
- request.send();
136
- };
137
- this.get = function (success, error, embed) {
138
- var self = this;
139
- function handleResponse(result) {
140
- success((0, _model.fromJson)(self, result[self.json], {
141
- makesDirty: false
142
- }));
143
- }
144
- (0, _model.getOne)({
145
- resource: this.resource,
146
- id: this.id(),
147
- success: handleResponse,
148
- error: error,
149
- embed: embed
150
- });
151
- };
152
- this.destroy = function (success, error) {
153
- (0, _model.deleteOne)(this.resource + "/" + this.id(), success, error);
154
- };
155
- this.company = function () {
156
- return this.domain() ? this.domain().company() : null;
157
- };
158
- this.paymentPhoneNumbers = function () {
159
- return this.company() ? this.company().paymentPhoneNumbers() : null;
160
- };
161
- this.paymentBanks = function () {
162
- return this.company() ? this.company().banks() : null;
163
- };
164
- this.stripePublishableKey = function () {
165
- return this.company() ? this.company().stripePublishableKey() : null;
166
- };
167
- this.calculate = function (success, error, embed) {
168
- var self = this,
169
- request = new _model.Request(),
170
- data = (0, _model.serialise)(this)[0];
171
- request.resource('/invoice-cost-estimate/');
172
- request.method('POST');
173
- request.query().add("as_domain", self.domain().id());
174
- request.query().add('skip_rights', true);
175
- request.data().merge(data);
176
- function handleResponse(status, data) {
177
- if (status === 201) {
178
- success((0, _model.fromJson)(self, data));
179
- } else {
180
- error(data);
181
- }
182
- }
183
- function handleError() {
184
- error({
185
- message: 'could not connect to server',
186
- errorCode: 0
187
- });
188
- }
189
- request.responseHandler(handleResponse).errorHandler(handleError);
190
- request.send();
191
- };
192
- this.amountPaid = function () {
193
- var payments = this.payments() ? this.payments() : [],
194
- total = 0,
195
- i;
196
- for (i = 0; i < payments.length; i++) {
197
- var amount = payments[i].amount();
198
- total += amount ? amount : 0;
199
- }
200
- return total;
201
- };
202
- this.amountOwed = function () {
203
- var total = this.totalCost();
204
- return total - this.amountPaid();
205
- };
206
- this.isOverdue = function () {
207
- var unpaid = this.unpaid(),
208
- now = (0, _momentTimezone["default"])().unix();
209
- return unpaid && now > this.paymentDeadline();
210
- };
211
- }
212
- function Invoices() {
213
- this.resource = '/invoices';
214
- this.json = 'invoices';
215
- this.single = Invoice;
216
- this.get = function (success, error, parameters) {
217
- var self = this;
218
- function handleResponse(result) {
219
- success((0, _model.fromJsonList)(self, result, {
220
- makesDirty: false
221
- }));
222
- }
223
- (0, _model.getList)(this.resource, handleResponse, error, parameters);
224
- };
225
- }
@@ -1,11 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.invoiceTypes = void 0;
7
- var _dictionary = require("./dictionary.js");
8
- var invoiceTypes = exports.invoiceTypes = new _dictionary.Dictionary();
9
- invoiceTypes.add("ORDER", 1);
10
- invoiceTypes.add("SUBSCRIPTION_BILL", 2);
11
- invoiceTypes.add("AUTO_SUPPLY_BILL", 3);
package/dist/item.js DELETED
@@ -1,25 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Item = Item;
7
- var _uuid = require("./uuid.js");
8
- var _model = require("./model.js");
9
- var _country_tax = require("./country_tax.js");
10
- function Item() {
11
- this.resource = '/items';
12
- this.json = 'items';
13
- this.temporaryId = (0, _uuid.generateUUID)();
14
- (0, _model.addPropertyTo)(this, 'id');
15
- (0, _model.addPropertyTo)(this, 'quantity');
16
- (0, _model.addPropertyTo)(this, 'taxType', _country_tax.CountryTax);
17
- (0, _model.addPropertyTo)(this, 'taxAmount');
18
- (0, _model.addPropertyTo)(this, 'cost');
19
- (0, _model.addPropertyTo)(this, 'description');
20
- this.totalCost = function () {
21
- var quantity = this.quantity() ? this.quantity() : 0,
22
- cost = this.cost() ? this.cost() : 0;
23
- return quantity * cost;
24
- };
25
- }