merchi_sdk_js 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. package/dist/address.js +109 -0
  2. package/dist/assignment.js +175 -0
  3. package/dist/automatic_payment_relationship.js +72 -0
  4. package/dist/backup.js +32 -0
  5. package/dist/bank.js +25 -0
  6. package/dist/cart.js +133 -0
  7. package/dist/cart_item.js +71 -0
  8. package/dist/cart_shipment_group.js +23 -0
  9. package/dist/cart_shipment_quote.js +26 -0
  10. package/dist/category.js +68 -0
  11. package/dist/company.js +248 -0
  12. package/dist/company_invitation.js +70 -0
  13. package/dist/component.js +107 -0
  14. package/dist/component_tag.js +60 -0
  15. package/dist/component_version.js +21 -0
  16. package/dist/country_tax.js +93 -0
  17. package/dist/dictionary.js +130 -0
  18. package/dist/discount.js +22 -0
  19. package/dist/discount_group.js +18 -0
  20. package/dist/domain.js +245 -0
  21. package/dist/domain_invitation.js +17 -0
  22. package/dist/domain_tag.js +87 -0
  23. package/dist/domain_types.js +22 -0
  24. package/dist/draft.js +97 -0
  25. package/dist/draft_comment.js +45 -0
  26. package/dist/draft_template.js +39 -0
  27. package/dist/email_address.js +34 -0
  28. package/dist/email_counter.js +47 -0
  29. package/dist/enrolled_domain.js +88 -0
  30. package/dist/exchange_rate.js +66 -0
  31. package/dist/field_types.js +19 -0
  32. package/dist/helpers.js +86 -0
  33. package/dist/internal_tag.js +98 -0
  34. package/dist/inventory.js +100 -0
  35. package/dist/inventory_unit_variation.js +19 -0
  36. package/dist/invoice.js +225 -0
  37. package/dist/invoice_types.js +11 -0
  38. package/dist/item.js +25 -0
  39. package/dist/job.js +536 -0
  40. package/dist/job_comment.js +45 -0
  41. package/dist/job_status.js +47 -0
  42. package/dist/matching_inventory.js +21 -0
  43. package/dist/md5.js +149 -0
  44. package/dist/menu.js +37 -0
  45. package/dist/menu_item.js +24 -0
  46. package/dist/merchi.js +1004 -0
  47. package/dist/merchi_file.js +165 -0
  48. package/dist/model.js +753 -0
  49. package/dist/notification.js +151 -0
  50. package/dist/notification_types.js +199 -0
  51. package/dist/output.cjs.js +31317 -0
  52. package/dist/output.esm.js +31312 -0
  53. package/dist/page.js +41 -0
  54. package/dist/payment.js +32 -0
  55. package/dist/payment_device.js +21 -0
  56. package/dist/payment_types.js +20 -0
  57. package/dist/phone_number.js +37 -0
  58. package/dist/product.js +288 -0
  59. package/dist/product_types.js +32 -0
  60. package/dist/production_comment.js +44 -0
  61. package/dist/quote.js +91 -0
  62. package/dist/quote_item.js +59 -0
  63. package/dist/roles.js +29 -0
  64. package/dist/seo_domain_page.js +42 -0
  65. package/dist/session.js +103 -0
  66. package/dist/set.js +29 -0
  67. package/dist/shipment.js +181 -0
  68. package/dist/shipment_item.js +17 -0
  69. package/dist/shipment_item_fulfillment.js +17 -0
  70. package/dist/shipment_method.js +81 -0
  71. package/dist/shipment_method_variation.js +38 -0
  72. package/dist/subscription_plan.js +75 -0
  73. package/dist/supply_domain.js +65 -0
  74. package/dist/system_role.js +12 -0
  75. package/dist/theme.js +180 -0
  76. package/dist/theme_css_setting.js +61 -0
  77. package/dist/theme_status.js +11 -0
  78. package/dist/user.js +409 -0
  79. package/dist/user_company.js +19 -0
  80. package/dist/user_types.js +23 -0
  81. package/dist/uuid.js +12 -0
  82. package/dist/variation.js +233 -0
  83. package/dist/variation_field.js +233 -0
  84. package/dist/variation_fields_option.js +41 -0
  85. package/dist/variation_option.js +62 -0
  86. package/dist/variations_group.js +43 -0
  87. package/dist/white_label_accessibilities.js +11 -0
  88. package/package.json +30 -0
  89. package/src/address.js +107 -0
  90. package/src/assignment.js +165 -0
  91. package/src/automatic_payment_relationship.js +65 -0
  92. package/src/backup.js +29 -0
  93. package/src/bank.js +21 -0
  94. package/src/cart.js +131 -0
  95. package/src/cart_item.js +71 -0
  96. package/src/cart_shipment_group.js +20 -0
  97. package/src/cart_shipment_quote.js +23 -0
  98. package/src/category.js +62 -0
  99. package/src/company.js +267 -0
  100. package/src/company_invitation.js +63 -0
  101. package/src/component.js +100 -0
  102. package/src/component_tag.js +53 -0
  103. package/src/component_version.js +17 -0
  104. package/src/country_tax.js +89 -0
  105. package/src/dictionary.js +135 -0
  106. package/src/discount.js +19 -0
  107. package/src/discount_group.js +15 -0
  108. package/src/domain.js +254 -0
  109. package/src/domain_invitation.js +13 -0
  110. package/src/domain_tag.js +79 -0
  111. package/src/domain_types.js +18 -0
  112. package/src/draft.js +92 -0
  113. package/src/draft_comment.js +41 -0
  114. package/src/draft_template.js +35 -0
  115. package/src/email_address.js +27 -0
  116. package/src/email_counter.js +42 -0
  117. package/src/enrolled_domain.js +79 -0
  118. package/src/exchange_rate.js +61 -0
  119. package/src/field_types.js +15 -0
  120. package/src/helpers.js +81 -0
  121. package/src/internal_tag.js +90 -0
  122. package/src/inventory.js +99 -0
  123. package/src/inventory_unit_variation.js +18 -0
  124. package/src/invoice.js +224 -0
  125. package/src/invoice_types.js +7 -0
  126. package/src/item.js +22 -0
  127. package/src/job.js +616 -0
  128. package/src/job_comment.js +41 -0
  129. package/src/job_status.js +51 -0
  130. package/src/matching_inventory.js +17 -0
  131. package/src/md5.js +162 -0
  132. package/src/menu.js +32 -0
  133. package/src/menu_item.js +22 -0
  134. package/src/merchi.js +1074 -0
  135. package/src/merchi_file.js +163 -0
  136. package/src/model.js +820 -0
  137. package/src/notification.js +153 -0
  138. package/src/notification_types.js +246 -0
  139. package/src/page.js +38 -0
  140. package/src/payment.js +32 -0
  141. package/src/payment_device.js +17 -0
  142. package/src/payment_types.js +18 -0
  143. package/src/phone_number.js +30 -0
  144. package/src/product.js +309 -0
  145. package/src/product_types.js +28 -0
  146. package/src/production_comment.js +40 -0
  147. package/src/quote.js +89 -0
  148. package/src/quote_item.js +51 -0
  149. package/src/roles.js +27 -0
  150. package/src/seo_domain_page.js +35 -0
  151. package/src/session.js +102 -0
  152. package/src/set.js +28 -0
  153. package/src/shipment.js +191 -0
  154. package/src/shipment_item.js +13 -0
  155. package/src/shipment_item_fulfillment.js +13 -0
  156. package/src/shipment_method.js +73 -0
  157. package/src/shipment_method_variation.js +34 -0
  158. package/src/subscription_plan.js +68 -0
  159. package/src/supply_domain.js +60 -0
  160. package/src/system_role.js +8 -0
  161. package/src/theme.js +188 -0
  162. package/src/theme_css_setting.js +54 -0
  163. package/src/theme_status.js +6 -0
  164. package/src/user.js +442 -0
  165. package/src/user_company.js +15 -0
  166. package/src/user_types.js +19 -0
  167. package/src/uuid.js +3 -0
  168. package/src/variation.js +257 -0
  169. package/src/variation_field.js +261 -0
  170. package/src/variation_fields_option.js +41 -0
  171. package/src/variation_option.js +59 -0
  172. package/src/variations_group.js +43 -0
  173. package/src/white_label_accessibilities.js +6 -0
@@ -0,0 +1,51 @@
1
+ import { Dictionary } from './dictionary.js';
2
+
3
+ export const jobStatusPayment = new Dictionary();
4
+
5
+ jobStatusPayment.add("INIT", 0);
6
+ jobStatusPayment.add("ISSUED", 1);
7
+ jobStatusPayment.add("OVERDUE", 2);
8
+ jobStatusPayment.add("PARTIAL_PAID", 3);
9
+ jobStatusPayment.add("FULLY_PAID", 4);
10
+
11
+ export const jobStatusDrafting = new Dictionary();
12
+
13
+ jobStatusDrafting.add("INIT", 0);
14
+ jobStatusDrafting.add("WAIT_DRAFTING", 1);
15
+ jobStatusDrafting.add("CHANGES_REQUESTED", 2);
16
+ jobStatusDrafting.add("DRAFTING_UPLOADED", 3);
17
+ jobStatusDrafting.add("DRAFTING_APPROVED", 4);
18
+
19
+ export const jobStatusProduction = new Dictionary();
20
+
21
+ jobStatusProduction.add("INIT", 0);
22
+ jobStatusProduction.add("REJECTED", 1);
23
+ jobStatusProduction.add("QUOTING", 2);
24
+ jobStatusProduction.add("ASSIGN_SENT", 3);
25
+ jobStatusProduction.add("ASSIGN_DEADLINE_REACHED", 4);
26
+ jobStatusProduction.add("ASSIGN_COMPLETE", 5);
27
+ jobStatusProduction.add("QUESTIONING", 6);
28
+ jobStatusProduction.add("COMMENCED", 7);
29
+ jobStatusProduction.add("FINISHED", 8);
30
+ jobStatusProduction.add("SHIPPED", 9);
31
+ jobStatusProduction.add("COMPLETED", 10);
32
+
33
+ export const jobStatusShipment = new Dictionary();
34
+
35
+ jobStatusShipment.add("NOT_ASSIGNED", 0);
36
+ jobStatusShipment.add("ASSIGNED", 1);
37
+ jobStatusShipment.add("DISPATCH_SET", 2);
38
+ jobStatusShipment.add("DISPATCH_WARNING", 3);
39
+ jobStatusShipment.add("DISPATCH_LATE", 4);
40
+ jobStatusShipment.add("DISPATCHED", 5);
41
+ jobStatusShipment.add("EXPECTED_RECEIVE_DATE_WARNING", 6);
42
+ jobStatusShipment.add("EXPECTED_RECEIVE_DATE_PAST", 7);
43
+ jobStatusShipment.add("RECEIVED", 8);
44
+ jobStatusShipment.add("PICKED_UP", 9);
45
+
46
+ export const jobPriority = new Dictionary();
47
+
48
+ jobPriority.add('urgent', 1);
49
+ jobPriority.add('high', 2);
50
+ jobPriority.add('medium', 3);
51
+ jobPriority.add('low', 4);
@@ -0,0 +1,17 @@
1
+ import { generateUUID } from './uuid.js';
2
+ import { addPropertyTo } from './model.js';
3
+ import { Inventory } from './inventory.js';
4
+ import { Job } from './job.js';
5
+ import { VariationsGroup } from './variations_group.js';
6
+
7
+ export function MatchingInventory() {
8
+ this.resource = '/matching_inventories';
9
+ this.json = 'matching_inventory';
10
+ this.temporaryId = generateUUID();
11
+
12
+ addPropertyTo(this, 'deductionDate');
13
+ addPropertyTo(this, 'canDeduct');
14
+ addPropertyTo(this, 'inventory', Inventory);
15
+ addPropertyTo(this, 'job', Job);
16
+ addPropertyTo(this, 'group', VariationsGroup);
17
+ }
package/src/md5.js ADDED
@@ -0,0 +1,162 @@
1
+ export function md5(s) {
2
+ function add32(a, b) {
3
+ return a + b & 0xFFFFFFFF;
4
+ }
5
+
6
+ function md5cycle(x, k) {
7
+ let a = x[0]; let b = x[1]; let c = x[2]; let d = x[3];
8
+
9
+ function cmn(q, a, b, x, s, t) {
10
+ a = add32(add32(a, q), add32(x, t)); // eslint-disable-line
11
+ return add32(a << s | a >>> 32 - s, b);
12
+ }
13
+
14
+ function ff(a, b, c, d, x, s, t) {
15
+ return cmn(b & c | ~b & d, a, b, x, s, t);
16
+ }
17
+
18
+ function gg(a, b, c, d, x, s, t) {
19
+ return cmn(b & d | c & ~d, a, b, x, s, t);
20
+ }
21
+
22
+ function hh(a, b, c, d, x, s, t) {
23
+ return cmn(b ^ c ^ d, a, b, x, s, t);
24
+ }
25
+
26
+ function ii(a, b, c, d, x, s, t) {
27
+ return cmn(c ^ (b | ~d), a, b, x, s, t);
28
+ }
29
+
30
+ a = ff(a, b, c, d, k[0], 7, -680876936);
31
+ d = ff(d, a, b, c, k[1], 12, -389564586);
32
+ c = ff(c, d, a, b, k[2], 17, 606105819);
33
+ b = ff(b, c, d, a, k[3], 22, -1044525330);
34
+ a = ff(a, b, c, d, k[4], 7, -176418897);
35
+ d = ff(d, a, b, c, k[5], 12, 1200080426);
36
+ c = ff(c, d, a, b, k[6], 17, -1473231341);
37
+ b = ff(b, c, d, a, k[7], 22, -45705983);
38
+ a = ff(a, b, c, d, k[8], 7, 1770035416);
39
+ d = ff(d, a, b, c, k[9], 12, -1958414417);
40
+ c = ff(c, d, a, b, k[10], 17, -42063);
41
+ b = ff(b, c, d, a, k[11], 22, -1990404162);
42
+ a = ff(a, b, c, d, k[12], 7, 1804603682);
43
+ d = ff(d, a, b, c, k[13], 12, -40341101);
44
+ c = ff(c, d, a, b, k[14], 17, -1502002290);
45
+ b = ff(b, c, d, a, k[15], 22, 1236535329);
46
+
47
+ a = gg(a, b, c, d, k[1], 5, -165796510);
48
+ d = gg(d, a, b, c, k[6], 9, -1069501632);
49
+ c = gg(c, d, a, b, k[11], 14, 643717713);
50
+ b = gg(b, c, d, a, k[0], 20, -373897302);
51
+ a = gg(a, b, c, d, k[5], 5, -701558691);
52
+ d = gg(d, a, b, c, k[10], 9, 38016083);
53
+ c = gg(c, d, a, b, k[15], 14, -660478335);
54
+ b = gg(b, c, d, a, k[4], 20, -405537848);
55
+ a = gg(a, b, c, d, k[9], 5, 568446438);
56
+ d = gg(d, a, b, c, k[14], 9, -1019803690);
57
+ c = gg(c, d, a, b, k[3], 14, -187363961);
58
+ b = gg(b, c, d, a, k[8], 20, 1163531501);
59
+ a = gg(a, b, c, d, k[13], 5, -1444681467);
60
+ d = gg(d, a, b, c, k[2], 9, -51403784);
61
+ c = gg(c, d, a, b, k[7], 14, 1735328473);
62
+ b = gg(b, c, d, a, k[12], 20, -1926607734);
63
+
64
+ a = hh(a, b, c, d, k[5], 4, -378558);
65
+ d = hh(d, a, b, c, k[8], 11, -2022574463);
66
+ c = hh(c, d, a, b, k[11], 16, 1839030562);
67
+ b = hh(b, c, d, a, k[14], 23, -35309556);
68
+ a = hh(a, b, c, d, k[1], 4, -1530992060);
69
+ d = hh(d, a, b, c, k[4], 11, 1272893353);
70
+ c = hh(c, d, a, b, k[7], 16, -155497632);
71
+ b = hh(b, c, d, a, k[10], 23, -1094730640);
72
+ a = hh(a, b, c, d, k[13], 4, 681279174);
73
+ d = hh(d, a, b, c, k[0], 11, -358537222);
74
+ c = hh(c, d, a, b, k[3], 16, -722521979);
75
+ b = hh(b, c, d, a, k[6], 23, 76029189);
76
+ a = hh(a, b, c, d, k[9], 4, -640364487);
77
+ d = hh(d, a, b, c, k[12], 11, -421815835);
78
+ c = hh(c, d, a, b, k[15], 16, 530742520);
79
+ b = hh(b, c, d, a, k[2], 23, -995338651);
80
+
81
+ a = ii(a, b, c, d, k[0], 6, -198630844);
82
+ d = ii(d, a, b, c, k[7], 10, 1126891415);
83
+ c = ii(c, d, a, b, k[14], 15, -1416354905);
84
+ b = ii(b, c, d, a, k[5], 21, -57434055);
85
+ a = ii(a, b, c, d, k[12], 6, 1700485571);
86
+ d = ii(d, a, b, c, k[3], 10, -1894986606);
87
+ c = ii(c, d, a, b, k[10], 15, -1051523);
88
+ b = ii(b, c, d, a, k[1], 21, -2054922799);
89
+ a = ii(a, b, c, d, k[8], 6, 1873313359);
90
+ d = ii(d, a, b, c, k[15], 10, -30611744);
91
+ c = ii(c, d, a, b, k[6], 15, -1560198380);
92
+ b = ii(b, c, d, a, k[13], 21, 1309151649);
93
+ a = ii(a, b, c, d, k[4], 6, -145523070);
94
+ d = ii(d, a, b, c, k[11], 10, -1120210379);
95
+ c = ii(c, d, a, b, k[2], 15, 718787259);
96
+ b = ii(b, c, d, a, k[9], 21, -343485551);
97
+
98
+ x[0] = add32(a, x[0]);
99
+ x[1] = add32(b, x[1]);
100
+ x[2] = add32(c, x[2]);
101
+ x[3] = add32(d, x[3]);
102
+ }
103
+
104
+ function md5blk(s) {
105
+ let md5blks = []; let i;
106
+ for (i = 0; i < 64; i += 4) {
107
+ md5blks[i >> 2] = s.charCodeAt(i)
108
+ + (s.charCodeAt(i + 1) << 8)
109
+ + (s.charCodeAt(i + 2) << 16)
110
+ + (s.charCodeAt(i + 3) << 24);
111
+ }
112
+ return md5blks;
113
+ }
114
+
115
+ function md51(s) {
116
+ let n = s.length;
117
+ let tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
118
+ let state = [1732584193, -271733879, -1732584194, 271733878];
119
+ let i;
120
+ for (i = 64; i <= s.length; i += 64) {
121
+ md5cycle(state, md5blk(s.substring(i - 64, i)));
122
+ }
123
+ s = s.substring(i - 64); // eslint-disable-line
124
+ for (i = 0; i < s.length; i++) {
125
+ tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3);
126
+ }
127
+ tail[i >> 2] |= 0x80 << (i % 4 << 3);
128
+ if (i > 55) {
129
+ md5cycle(state, tail);
130
+ for (i = 0; i < 16; i++) {
131
+ tail[i] = 0;
132
+ }
133
+ }
134
+
135
+ tail[14] = n * 8;
136
+ md5cycle(state, tail);
137
+ return state;
138
+ }
139
+
140
+ let hexChr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b',
141
+ 'c', 'd', 'e', 'f'];
142
+
143
+ function rhex(n) {
144
+ let ss = '';
145
+ let j;
146
+ for (j = 0; j < 4; j++) {
147
+ ss += hexChr[n >> j * 8 + 4 & 0x0F]
148
+ + hexChr[n >> j * 8 & 0x0F];
149
+ }
150
+ return ss;
151
+ }
152
+
153
+ function hex(x) {
154
+ let i;
155
+ for (i = 0; i < x.length; i++) {
156
+ x[i] = rhex(x[i]);
157
+ }
158
+ return x.join('');
159
+ }
160
+
161
+ return hex(md51(s));
162
+ }
package/src/menu.js ADDED
@@ -0,0 +1,32 @@
1
+ import { generateUUID } from './uuid.js';
2
+ import { addPropertyTo, fromJson, getOne, deleteOne } from './model.js';
3
+ import { MenuItem } from './menu_item.js';
4
+
5
+ export function Menu() {
6
+ this.resource = '/menus';
7
+ this.json = 'menu';
8
+ this.temporaryId = generateUUID();
9
+
10
+ addPropertyTo(this, 'id');
11
+ addPropertyTo(this, 'name');
12
+ addPropertyTo(this, 'menuHandle');
13
+ addPropertyTo(this, 'menuType');
14
+ addPropertyTo(this, 'menuItems', MenuItem);
15
+
16
+ this.get = function (success, error, embed) {
17
+ var self = this;
18
+ function handleResponse(result) {
19
+ success(fromJson(self, result[self.json],
20
+ {makesDirty: false}));
21
+ }
22
+ getOne({resource: this.resource,
23
+ id: this.id(),
24
+ success: handleResponse,
25
+ error: error,
26
+ embed: embed});
27
+ };
28
+
29
+ this.destroy = function (success, error) {
30
+ deleteOne(this.resource + "/" + this.id(), success, error);
31
+ };
32
+ }
@@ -0,0 +1,22 @@
1
+ import { generateUUID } from './uuid.js';
2
+ import { addPropertyTo } from './model.js';
3
+
4
+ export function MenuItem() {
5
+ this.resource = '/menu_items';
6
+ this.json = 'menuItem';
7
+ this.temporaryId = generateUUID();
8
+
9
+ addPropertyTo(this, 'id');
10
+ addPropertyTo(this, 'name');
11
+ addPropertyTo(this, 'linkType');
12
+ addPropertyTo(this, 'linkUri');
13
+ addPropertyTo(this, 'position');
14
+
15
+ this.url = function (domain) {
16
+ if (domain && this.linkType() === 1) {
17
+ return 'http://' + domain.subDomain() + '.' + window.server +
18
+ '/' + this.linkUri();
19
+ }
20
+ return this.linkUri();
21
+ };
22
+ }