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,165 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.MerchiFile = MerchiFile;
7
- exports.MerchiFiles = MerchiFiles;
8
- var _uuid = require("./uuid.js");
9
- var _dictionary = require("./dictionary.js");
10
- var _model = require("./model.js");
11
- function MerchiFile() {
12
- this.resource = '/files';
13
- this.json = 'file';
14
- this.temporaryId = (0, _uuid.generateUUID)();
15
- (0, _model.addPropertyTo)(this, 'id');
16
- (0, _model.addPropertyTo)(this, 'name');
17
- (0, _model.addPropertyTo)(this, 'size');
18
- (0, _model.addPropertyTo)(this, 'mimetype');
19
- (0, _model.addPropertyTo)(this, 'viewUrl');
20
- (0, _model.addPropertyTo)(this, 'downloadUrl');
21
- (0, _model.addPropertyTo)(this, 'creationDate');
22
- this.get = function (success, error, embed) {
23
- var self = this;
24
- function handleResponse(result) {
25
- success((0, _model.fromJson)(self, result[self.json], {
26
- makesDirty: false
27
- }));
28
- }
29
- (0, _model.getOne)({
30
- resource: this.resource,
31
- id: this.id(),
32
- success: handleResponse,
33
- error: error,
34
- embed: embed
35
- });
36
- };
37
- this.create = function (success, error, embed, as_domain) {
38
- var data = (0, _model.serialise)(this),
39
- self = this;
40
- function handleResponse(result) {
41
- success((0, _model.fromJson)(self, result[self.json]));
42
- }
43
- (0, _model.create)({
44
- resource: this.resource,
45
- parameters: data[0],
46
- files: (0, _model.enumerateFiles)(data[1]),
47
- success: handleResponse,
48
- as_domain: as_domain,
49
- error: error,
50
- embed: embed
51
- });
52
- };
53
- this.destroy = function (success, error) {
54
- (0, _model.deleteOne)(this.resource + "/" + this.id(), success, error);
55
- };
56
- this.publicCreate = function (success, error) {
57
- var self = this,
58
- filesObject = (0, _model.serialise)(this),
59
- request = new _model.Request();
60
- request.resource('/public-upload-job-files/');
61
- request.method('POST');
62
- request.files((0, _model.enumerateFiles)(filesObject[1]));
63
- function handleResponse(status, data) {
64
- if (status === 201) {
65
- success((0, _model.fromJson)(self, data[self.json]));
66
- } else {
67
- error(data);
68
- }
69
- }
70
- function handleError(status, data) {
71
- error({
72
- message: 'could not connect to server'
73
- });
74
- }
75
- request.responseHandler(handleResponse).errorHandler(handleError);
76
- request.send();
77
- };
78
- this.fromString = function (name, mimetype, data) {
79
- this.name(name);
80
- this.mimetype(mimetype);
81
- this.size(data.length);
82
- this.fileData = new File([data], name, {
83
- type: mimetype
84
- });
85
- return this;
86
- };
87
- this.fromFormFile = function (file) {
88
- this.name(file.name);
89
- this.mimetype(file.type);
90
- this.size(file.size);
91
- this.fileData = file;
92
- return this;
93
- };
94
- this.isPdf = function () {
95
- return this.mimetype() === 'application/pdf' || this.mimetype() === 'application/x-pdf';
96
- };
97
- this.isImage = function () {
98
- var imageTypeString = this.mimetype() ? this.mimetype().split('/')[0] : null;
99
- return imageTypeString === 'image';
100
- };
101
- this.fetchFileContents = function () {
102
- var downloadUrl = this.downloadUrl();
103
- return fetch(downloadUrl).then(function (response) {
104
- return response.text();
105
- });
106
- };
107
- }
108
- function MerchiFiles() {
109
- this.resource = '/files';
110
- this.json = 'files';
111
- this.single = MerchiFile;
112
- this.get = function (success, error, parameters) {
113
- var self = this;
114
- function handleResponse(result) {
115
- success((0, _model.fromJsonList)(self, result, {
116
- makesDirty: false
117
- }));
118
- }
119
- (0, _model.getList)(this.resource, handleResponse, error, parameters);
120
- };
121
- this.getUserFiles = function (success, error, parameters) {
122
- var self = this,
123
- query = new _dictionary.Dictionary(),
124
- request = new _model.Request();
125
- if (parameters.limit) {
126
- query.add('limit', parameters.limit);
127
- }
128
- if (parameters.offset) {
129
- query.add('offset', parameters.offset);
130
- }
131
- if (parameters.order) {
132
- query.add('order', parameters.order);
133
- }
134
- if (parameters.q) {
135
- query.add('q', parameters.q);
136
- }
137
- if (parameters.sort) {
138
- query.add('sort', parameters.sort);
139
- }
140
- if (parameters.relatedUser) {
141
- query.add('related_user', parameters.relatedUser);
142
- }
143
- query.add('skip_rights', true);
144
- request.resource('/files/user/');
145
- request.method('GET');
146
- request.query().merge(query);
147
- function handleResponse(status, data) {
148
- if (status === 200) {
149
- success((0, _model.fromJsonList)(self, data));
150
- } else {
151
- error(data);
152
- }
153
- }
154
- function handleError(status, data) {
155
- var statusCode = status ? status : 400,
156
- errorObject = data ? data : {
157
- message: 'could not connect to server',
158
- errorCode: 0
159
- };
160
- error(statusCode, errorObject);
161
- }
162
- request.responseHandler(handleResponse).errorHandler(handleError);
163
- request.send();
164
- };
165
- }