merchi_sdk_js 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/address.js +109 -0
- package/dist/assignment.js +175 -0
- package/dist/automatic_payment_relationship.js +72 -0
- package/dist/backup.js +32 -0
- package/dist/bank.js +25 -0
- package/dist/cart.js +133 -0
- package/dist/cart_item.js +71 -0
- package/dist/cart_shipment_group.js +23 -0
- package/dist/cart_shipment_quote.js +26 -0
- package/dist/category.js +68 -0
- package/dist/company.js +248 -0
- package/dist/company_invitation.js +70 -0
- package/dist/component.js +107 -0
- package/dist/component_tag.js +60 -0
- package/dist/component_version.js +21 -0
- package/dist/country_tax.js +93 -0
- package/dist/dictionary.js +130 -0
- package/dist/discount.js +22 -0
- package/dist/discount_group.js +18 -0
- package/dist/domain.js +245 -0
- package/dist/domain_invitation.js +17 -0
- package/dist/domain_tag.js +87 -0
- package/dist/domain_types.js +22 -0
- package/dist/draft.js +97 -0
- package/dist/draft_comment.js +45 -0
- package/dist/draft_template.js +39 -0
- package/dist/email_address.js +34 -0
- package/dist/email_counter.js +47 -0
- package/dist/enrolled_domain.js +88 -0
- package/dist/exchange_rate.js +66 -0
- package/dist/field_types.js +19 -0
- package/dist/helpers.js +86 -0
- package/dist/internal_tag.js +98 -0
- package/dist/inventory.js +100 -0
- package/dist/inventory_unit_variation.js +19 -0
- package/dist/invoice.js +225 -0
- package/dist/invoice_types.js +11 -0
- package/dist/item.js +25 -0
- package/dist/job.js +536 -0
- package/dist/job_comment.js +45 -0
- package/dist/job_status.js +47 -0
- package/dist/matching_inventory.js +21 -0
- package/dist/md5.js +149 -0
- package/dist/menu.js +37 -0
- package/dist/menu_item.js +24 -0
- package/dist/merchi.js +1004 -0
- package/dist/merchi_file.js +165 -0
- package/dist/model.js +753 -0
- package/dist/notification.js +151 -0
- package/dist/notification_types.js +199 -0
- package/dist/output.cjs.js +31317 -0
- package/dist/output.esm.js +31312 -0
- package/dist/page.js +41 -0
- package/dist/payment.js +32 -0
- package/dist/payment_device.js +21 -0
- package/dist/payment_types.js +20 -0
- package/dist/phone_number.js +37 -0
- package/dist/product.js +288 -0
- package/dist/product_types.js +32 -0
- package/dist/production_comment.js +44 -0
- package/dist/quote.js +91 -0
- package/dist/quote_item.js +59 -0
- package/dist/roles.js +29 -0
- package/dist/seo_domain_page.js +42 -0
- package/dist/session.js +103 -0
- package/dist/set.js +29 -0
- package/dist/shipment.js +181 -0
- package/dist/shipment_item.js +17 -0
- package/dist/shipment_item_fulfillment.js +17 -0
- package/dist/shipment_method.js +81 -0
- package/dist/shipment_method_variation.js +38 -0
- package/dist/subscription_plan.js +75 -0
- package/dist/supply_domain.js +65 -0
- package/dist/system_role.js +12 -0
- package/dist/theme.js +180 -0
- package/dist/theme_css_setting.js +61 -0
- package/dist/theme_status.js +11 -0
- package/dist/user.js +409 -0
- package/dist/user_company.js +19 -0
- package/dist/user_types.js +23 -0
- package/dist/uuid.js +12 -0
- package/dist/variation.js +233 -0
- package/dist/variation_field.js +233 -0
- package/dist/variation_fields_option.js +41 -0
- package/dist/variation_option.js +62 -0
- package/dist/variations_group.js +43 -0
- package/dist/white_label_accessibilities.js +11 -0
- package/package.json +30 -0
- package/src/address.js +107 -0
- package/src/assignment.js +165 -0
- package/src/automatic_payment_relationship.js +65 -0
- package/src/backup.js +29 -0
- package/src/bank.js +21 -0
- package/src/cart.js +131 -0
- package/src/cart_item.js +71 -0
- package/src/cart_shipment_group.js +20 -0
- package/src/cart_shipment_quote.js +23 -0
- package/src/category.js +62 -0
- package/src/company.js +267 -0
- package/src/company_invitation.js +63 -0
- package/src/component.js +100 -0
- package/src/component_tag.js +53 -0
- package/src/component_version.js +17 -0
- package/src/country_tax.js +89 -0
- package/src/dictionary.js +135 -0
- package/src/discount.js +19 -0
- package/src/discount_group.js +15 -0
- package/src/domain.js +254 -0
- package/src/domain_invitation.js +13 -0
- package/src/domain_tag.js +79 -0
- package/src/domain_types.js +18 -0
- package/src/draft.js +92 -0
- package/src/draft_comment.js +41 -0
- package/src/draft_template.js +35 -0
- package/src/email_address.js +27 -0
- package/src/email_counter.js +42 -0
- package/src/enrolled_domain.js +79 -0
- package/src/exchange_rate.js +61 -0
- package/src/field_types.js +15 -0
- package/src/helpers.js +81 -0
- package/src/internal_tag.js +90 -0
- package/src/inventory.js +99 -0
- package/src/inventory_unit_variation.js +18 -0
- package/src/invoice.js +224 -0
- package/src/invoice_types.js +7 -0
- package/src/item.js +22 -0
- package/src/job.js +616 -0
- package/src/job_comment.js +41 -0
- package/src/job_status.js +51 -0
- package/src/matching_inventory.js +17 -0
- package/src/md5.js +162 -0
- package/src/menu.js +32 -0
- package/src/menu_item.js +22 -0
- package/src/merchi.js +1074 -0
- package/src/merchi_file.js +163 -0
- package/src/model.js +820 -0
- package/src/notification.js +153 -0
- package/src/notification_types.js +246 -0
- package/src/page.js +38 -0
- package/src/payment.js +32 -0
- package/src/payment_device.js +17 -0
- package/src/payment_types.js +18 -0
- package/src/phone_number.js +30 -0
- package/src/product.js +309 -0
- package/src/product_types.js +28 -0
- package/src/production_comment.js +40 -0
- package/src/quote.js +89 -0
- package/src/quote_item.js +51 -0
- package/src/roles.js +27 -0
- package/src/seo_domain_page.js +35 -0
- package/src/session.js +102 -0
- package/src/set.js +28 -0
- package/src/shipment.js +191 -0
- package/src/shipment_item.js +13 -0
- package/src/shipment_item_fulfillment.js +13 -0
- package/src/shipment_method.js +73 -0
- package/src/shipment_method_variation.js +34 -0
- package/src/subscription_plan.js +68 -0
- package/src/supply_domain.js +60 -0
- package/src/system_role.js +8 -0
- package/src/theme.js +188 -0
- package/src/theme_css_setting.js +54 -0
- package/src/theme_status.js +6 -0
- package/src/user.js +442 -0
- package/src/user_company.js +15 -0
- package/src/user_types.js +19 -0
- package/src/uuid.js +3 -0
- package/src/variation.js +257 -0
- package/src/variation_field.js +261 -0
- package/src/variation_fields_option.js +41 -0
- package/src/variation_option.js +59 -0
- package/src/variations_group.js +43 -0
- package/src/white_label_accessibilities.js +6 -0
@@ -0,0 +1,130 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Dictionary = Dictionary;
|
7
|
+
var _formData = _interopRequireDefault(require("form-data"));
|
8
|
+
var _browserOrNode = require("browser-or-node");
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
10
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
11
|
+
function Dictionary() {
|
12
|
+
var store = {},
|
13
|
+
count = 0;
|
14
|
+
function noSuchKey(name) {
|
15
|
+
throw 'No such key "' + String(name) + '" in dictionary';
|
16
|
+
}
|
17
|
+
this.clone = function () {
|
18
|
+
return new Dictionary(store, count);
|
19
|
+
};
|
20
|
+
this.add = function (name, value) {
|
21
|
+
if (!this.has(name)) {
|
22
|
+
++count;
|
23
|
+
}
|
24
|
+
store[name] = value;
|
25
|
+
return this;
|
26
|
+
};
|
27
|
+
this.getArray = function (names) {
|
28
|
+
/** passing a array of keys return the values array
|
29
|
+
* corresponding to the keys **/
|
30
|
+
var i,
|
31
|
+
returnArray = [];
|
32
|
+
for (i = 0; i < names.length; i++) {
|
33
|
+
if (this.has(names[i])) {
|
34
|
+
returnArray.push(store[names[i]]);
|
35
|
+
} else {
|
36
|
+
noSuchKey(names[i]);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
return returnArray;
|
40
|
+
};
|
41
|
+
this.get = function (name, default_) {
|
42
|
+
if (this.has(name)) {
|
43
|
+
return store[name];
|
44
|
+
}
|
45
|
+
if (default_ !== undefined) {
|
46
|
+
return default_;
|
47
|
+
}
|
48
|
+
return noSuchKey(name);
|
49
|
+
};
|
50
|
+
this.has = function (name) {
|
51
|
+
return Object.prototype.hasOwnProperty.call(store, name) && Object.prototype.propertyIsEnumerable.call(store, name);
|
52
|
+
};
|
53
|
+
this.remove = function (name) {
|
54
|
+
if (this.has(name)) {
|
55
|
+
delete store[name];
|
56
|
+
--count;
|
57
|
+
return this;
|
58
|
+
}
|
59
|
+
return noSuchKey(name);
|
60
|
+
};
|
61
|
+
this.merge = function (other) {
|
62
|
+
var _this = this;
|
63
|
+
if (other.__proto__.constructor === Dictionary) {
|
64
|
+
other.each(function (name, value) {
|
65
|
+
_this.add(name, value);
|
66
|
+
});
|
67
|
+
} else {
|
68
|
+
for (var property in other) {
|
69
|
+
if (other.hasOwnProperty(property)) {
|
70
|
+
_this.add(property, other[property]);
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
return this;
|
75
|
+
};
|
76
|
+
this.each = function (procedure) {
|
77
|
+
var name;
|
78
|
+
for (name in store) {
|
79
|
+
if (Object.prototype.hasOwnProperty.call(store, name)) {
|
80
|
+
procedure(name, store[name]);
|
81
|
+
}
|
82
|
+
}
|
83
|
+
return this;
|
84
|
+
};
|
85
|
+
this.keys = function () {
|
86
|
+
var result = [];
|
87
|
+
this.each(function (name) {
|
88
|
+
result.push(name);
|
89
|
+
});
|
90
|
+
return result;
|
91
|
+
};
|
92
|
+
this.values = function () {
|
93
|
+
var result = [];
|
94
|
+
this.each(function (ignore, value) {
|
95
|
+
result.push(value);
|
96
|
+
});
|
97
|
+
return result;
|
98
|
+
};
|
99
|
+
this.count = function () {
|
100
|
+
return count;
|
101
|
+
};
|
102
|
+
this.toFormData = function () {
|
103
|
+
var result;
|
104
|
+
if (_browserOrNode.isJsDom || _browserOrNode.isBrowser) {
|
105
|
+
result = new FormData();
|
106
|
+
} else {
|
107
|
+
result = new _formData["default"]();
|
108
|
+
}
|
109
|
+
this.each(function (key, value) {
|
110
|
+
result.append(key, value);
|
111
|
+
});
|
112
|
+
return result;
|
113
|
+
};
|
114
|
+
this.toUriEncoding = function () {
|
115
|
+
var result = '';
|
116
|
+
this.each(function (key, value) {
|
117
|
+
if (_typeof(key) === "object") {
|
118
|
+
throw "cannot URI encode object key";
|
119
|
+
}
|
120
|
+
if (_typeof(value) === "object") {
|
121
|
+
throw "cannot URI encode object name";
|
122
|
+
}
|
123
|
+
result += encodeURIComponent(key);
|
124
|
+
result += '=';
|
125
|
+
result += encodeURIComponent(value);
|
126
|
+
result += '&';
|
127
|
+
});
|
128
|
+
return result.slice(0, -1);
|
129
|
+
};
|
130
|
+
}
|
package/dist/discount.js
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Discount = Discount;
|
7
|
+
var _uuid = require("./uuid.js");
|
8
|
+
var _model = require("./model.js");
|
9
|
+
function Discount() {
|
10
|
+
this.resource = '/discounts';
|
11
|
+
this.json = 'discount';
|
12
|
+
this.temporaryId = (0, _uuid.generateUUID)();
|
13
|
+
(0, _model.addPropertyTo)(this, 'id');
|
14
|
+
(0, _model.addPropertyTo)(this, 'lowerLimit');
|
15
|
+
(0, _model.addPropertyTo)(this, 'amount');
|
16
|
+
this.discountedUnitCost = function (unitPrice) {
|
17
|
+
var unitCost = unitPrice ? unitPrice : 0,
|
18
|
+
amount = this.amount() ? this.amount() : 0,
|
19
|
+
discount = 100 - amount;
|
20
|
+
return parseFloat(unitCost / 100 * discount).toFixed(3);
|
21
|
+
};
|
22
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.DiscountGroup = DiscountGroup;
|
7
|
+
var _uuid = require("./uuid.js");
|
8
|
+
var _model = require("./model.js");
|
9
|
+
function DiscountGroup() {
|
10
|
+
this.resource = '/discountGroups';
|
11
|
+
this.json = 'discountGroup';
|
12
|
+
this.temporaryId = (0, _uuid.generateUUID)();
|
13
|
+
(0, _model.addPropertyTo)(this, 'id');
|
14
|
+
(0, _model.addPropertyTo)(this, 'discountType');
|
15
|
+
(0, _model.addPropertyTo)(this, 'discounts');
|
16
|
+
(0, _model.addPropertyTo)(this, 'name');
|
17
|
+
(0, _model.addPropertyTo)(this, 'product');
|
18
|
+
}
|
package/dist/domain.js
ADDED
@@ -0,0 +1,245 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Domain = Domain;
|
7
|
+
exports.Domains = Domains;
|
8
|
+
var _uuid = require("./uuid.js");
|
9
|
+
var _dictionary = require("./dictionary.js");
|
10
|
+
var _model = require("./model.js");
|
11
|
+
var _roles = require("./roles.js");
|
12
|
+
var _domain_types = require("./domain_types.js");
|
13
|
+
var _company = require("./company.js");
|
14
|
+
var _domain_tag = require("./domain_tag.js");
|
15
|
+
var _domain_invitation = require("./domain_invitation.js");
|
16
|
+
var _theme = require("./theme.js");
|
17
|
+
var _merchi_file = require("./merchi_file.js");
|
18
|
+
var _menu = require("./menu.js");
|
19
|
+
var _supply_domain = require("./supply_domain.js");
|
20
|
+
var _seo_domain_page = require("./seo_domain_page.js");
|
21
|
+
var _user = require("./user.js");
|
22
|
+
var _internal_tag = require("./internal_tag.js");
|
23
|
+
function Domain() {
|
24
|
+
this.resource = '/domains';
|
25
|
+
this.json = 'domain';
|
26
|
+
this.temporaryId = (0, _uuid.generateUUID)();
|
27
|
+
(0, _model.addPropertyTo)(this, 'id');
|
28
|
+
(0, _model.addPropertyTo)(this, 'aiContext');
|
29
|
+
(0, _model.addPropertyTo)(this, 'apiSecret');
|
30
|
+
(0, _model.addPropertyTo)(this, 'webflowApiKey');
|
31
|
+
(0, _model.addPropertyTo)(this, 'shopifyShopUrl');
|
32
|
+
(0, _model.addPropertyTo)(this, 'shopifyIsActive');
|
33
|
+
(0, _model.addPropertyTo)(this, 'country');
|
34
|
+
(0, _model.addPropertyTo)(this, 'currency');
|
35
|
+
(0, _model.addPropertyTo)(this, 'domain');
|
36
|
+
(0, _model.addPropertyTo)(this, 'domainType');
|
37
|
+
(0, _model.addPropertyTo)(this, 'activeThemeId');
|
38
|
+
(0, _model.addPropertyTo)(this, 'activeTheme', _theme.Theme);
|
39
|
+
(0, _model.addPropertyTo)(this, 'subDomain');
|
40
|
+
(0, _model.addPropertyTo)(this, 'theme');
|
41
|
+
(0, _model.addPropertyTo)(this, 'logoUrl');
|
42
|
+
(0, _model.addPropertyTo)(this, 'smsName');
|
43
|
+
(0, _model.addPropertyTo)(this, 'emailDomain');
|
44
|
+
(0, _model.addPropertyTo)(this, 'trackingCodeGoogleConversion');
|
45
|
+
(0, _model.addPropertyTo)(this, 'trackingCodeGoogleGlobal');
|
46
|
+
(0, _model.addPropertyTo)(this, 'qrShopQrCode');
|
47
|
+
(0, _model.addPropertyTo)(this, 'logo', _merchi_file.MerchiFile);
|
48
|
+
(0, _model.addPropertyTo)(this, 'favicon', _merchi_file.MerchiFile);
|
49
|
+
(0, _model.addPropertyTo)(this, 'company', _company.Company);
|
50
|
+
(0, _model.addPropertyTo)(this, 'ownedBy', _company.Company);
|
51
|
+
(0, _model.addPropertyTo)(this, 'accessibleClients', _user.User);
|
52
|
+
(0, _model.addPropertyTo)(this, 'accessibleClientCompanies', _company.Company);
|
53
|
+
(0, _model.addPropertyTo)(this, 'unltdAiApiOrganizationId');
|
54
|
+
(0, _model.addPropertyTo)(this, 'unltdAiApiSecretKey');
|
55
|
+
(0, _model.addPropertyTo)(this, 'menus', _menu.Menu);
|
56
|
+
(0, _model.addPropertyTo)(this, 'socialBitchute');
|
57
|
+
(0, _model.addPropertyTo)(this, 'socialDiscord');
|
58
|
+
(0, _model.addPropertyTo)(this, 'socialFacebook');
|
59
|
+
(0, _model.addPropertyTo)(this, 'socialGoogle');
|
60
|
+
(0, _model.addPropertyTo)(this, 'socialInstagram');
|
61
|
+
(0, _model.addPropertyTo)(this, 'socialLinkedin');
|
62
|
+
(0, _model.addPropertyTo)(this, 'socialRumble');
|
63
|
+
(0, _model.addPropertyTo)(this, 'socialTelegram');
|
64
|
+
(0, _model.addPropertyTo)(this, 'socialTiktok');
|
65
|
+
(0, _model.addPropertyTo)(this, 'socialX');
|
66
|
+
(0, _model.addPropertyTo)(this, 'socialYoutube');
|
67
|
+
(0, _model.addPropertyTo)(this, 'internalUseNotes');
|
68
|
+
(0, _model.addPropertyTo)(this, 'internalUseAiContext');
|
69
|
+
(0, _model.addPropertyTo)(this, 'showDomainPublicly');
|
70
|
+
(0, _model.addPropertyTo)(this, 'publicAccessRestricted');
|
71
|
+
(0, _model.addPropertyTo)(this, 'showDomainToAccessibleEntitiesOnly');
|
72
|
+
(0, _model.addPropertyTo)(this, 'enableNotifications');
|
73
|
+
(0, _model.addPropertyTo)(this, 'enableEmailNotifications');
|
74
|
+
(0, _model.addPropertyTo)(this, 'enableSmsNotifications');
|
75
|
+
(0, _model.addPropertyTo)(this, 'seoDomainPages', _seo_domain_page.SeoDomainPage);
|
76
|
+
(0, _model.addPropertyTo)(this, 'themes', _theme.Theme);
|
77
|
+
(0, _model.addPropertyTo)(this, 'supplyProducts', _supply_domain.SupplyDomain);
|
78
|
+
(0, _model.addPropertyTo)(this, 'domainInvitations', _domain_invitation.DomainInvitation);
|
79
|
+
(0, _model.addPropertyTo)(this, 'jobsAssignees', _user.User);
|
80
|
+
(0, _model.addPropertyTo)(this, 'tags', _domain_tag.DomainTag);
|
81
|
+
(0, _model.addPropertyTo)(this, 'internalTags', _internal_tag.InternalTag);
|
82
|
+
this.create = function (success, error, embed, as_domain) {
|
83
|
+
var data = (0, _model.serialise)(this),
|
84
|
+
self = this;
|
85
|
+
function handleResponse(result) {
|
86
|
+
success((0, _model.fromJson)(self, result[self.json]));
|
87
|
+
}
|
88
|
+
(0, _model.create)({
|
89
|
+
resource: this.resource,
|
90
|
+
parameters: data[0],
|
91
|
+
files: (0, _model.enumerateFiles)(data[1]),
|
92
|
+
as_domain: as_domain,
|
93
|
+
success: handleResponse,
|
94
|
+
error: error,
|
95
|
+
embed: embed
|
96
|
+
});
|
97
|
+
};
|
98
|
+
this.get = function (success, error, embed, withRights) {
|
99
|
+
var self = this;
|
100
|
+
function handleResponse(result) {
|
101
|
+
success((0, _model.fromJson)(self, result[self.json], {
|
102
|
+
makesDirty: false
|
103
|
+
}));
|
104
|
+
}
|
105
|
+
(0, _model.getOne)({
|
106
|
+
resource: this.resource,
|
107
|
+
id: this.id(),
|
108
|
+
success: handleResponse,
|
109
|
+
error: error,
|
110
|
+
embed: embed,
|
111
|
+
withRights: withRights
|
112
|
+
});
|
113
|
+
};
|
114
|
+
this.invite = function (invitationData, success, error, embed) {
|
115
|
+
var request = new _model.Request(),
|
116
|
+
data = new _dictionary.Dictionary(),
|
117
|
+
self = this,
|
118
|
+
_id = self.id();
|
119
|
+
function handleResponse(status, data) {
|
120
|
+
var newInvitation = new _domain_invitation.DomainInvitation(),
|
121
|
+
invitation = data,
|
122
|
+
invitations = self.domainInvitations() ? self.domainInvitations() : [];
|
123
|
+
newInvitation.id(invitation.id);
|
124
|
+
newInvitation.userEmail(invitation.userEmail);
|
125
|
+
newInvitation.userName(invitation.userName);
|
126
|
+
newInvitation.role(invitation.role);
|
127
|
+
invitations.push(newInvitation);
|
128
|
+
self.domainInvitations(invitations);
|
129
|
+
success(self);
|
130
|
+
}
|
131
|
+
data.add("inviteUserEmail", invitationData.emailAddress);
|
132
|
+
data.add("inviteUserName", invitationData.userName);
|
133
|
+
data.add("domainId", _id);
|
134
|
+
data.add("domainRole", invitationData.role);
|
135
|
+
request.resource('/domain_invite/').method('POST');
|
136
|
+
request.data().merge(data);
|
137
|
+
request.responseHandler(handleResponse);
|
138
|
+
request.errorHandler(error);
|
139
|
+
request.send();
|
140
|
+
};
|
141
|
+
this.getUsers = function (success, error, offset, limit, q, embed, tab) {
|
142
|
+
var self = this,
|
143
|
+
users = new _user.Users();
|
144
|
+
function handleResponse(result) {
|
145
|
+
success((0, _model.fromJsonList)(users, result));
|
146
|
+
}
|
147
|
+
(0, _model.getList)(users.resource, handleResponse, error, {
|
148
|
+
inDomain: self.id(),
|
149
|
+
tab: tab,
|
150
|
+
offset: offset,
|
151
|
+
limit: limit,
|
152
|
+
q: q,
|
153
|
+
embed: embed
|
154
|
+
});
|
155
|
+
};
|
156
|
+
this.getManagers = function (success, error, offset, limit, embed) {
|
157
|
+
var self = this;
|
158
|
+
self.getUsers(success, error, offset, limit, null, embed, "manager");
|
159
|
+
};
|
160
|
+
this.getUsersWithRoles = function (success, error, roles, offset, limit, embed) {
|
161
|
+
var self = this,
|
162
|
+
users = new _user.Users();
|
163
|
+
function handleResponse(result) {
|
164
|
+
success((0, _model.fromJsonList)(users, result));
|
165
|
+
}
|
166
|
+
(0, _model.getList)(users.resource, handleResponse, error, {
|
167
|
+
inDomain: self.id(),
|
168
|
+
inDomainRoles: roles,
|
169
|
+
offset: offset,
|
170
|
+
limit: limit,
|
171
|
+
embed: embed
|
172
|
+
});
|
173
|
+
};
|
174
|
+
this.patch = function (success, error, embed, as_domain) {
|
175
|
+
var data = data = (0, _model.serialise)(this)[0],
|
176
|
+
self = this;
|
177
|
+
function handleResponse(result) {
|
178
|
+
success((0, _model.fromJson)(self, result[self.json]));
|
179
|
+
}
|
180
|
+
(0, _model.patchOne)({
|
181
|
+
resource: this.resource,
|
182
|
+
id: this.id(),
|
183
|
+
success: handleResponse,
|
184
|
+
as_domain: as_domain,
|
185
|
+
error: error,
|
186
|
+
data: data,
|
187
|
+
embed: embed
|
188
|
+
});
|
189
|
+
};
|
190
|
+
this.update = function (success, error, embed) {
|
191
|
+
this.patch(success, error, (0, _model.serialise)(this, undefined, undefined, undefined, {
|
192
|
+
excludeOld: true
|
193
|
+
})[0], embed);
|
194
|
+
};
|
195
|
+
this.mainMenu = function () {
|
196
|
+
var menus = this.menus(),
|
197
|
+
i = 0;
|
198
|
+
if (menus === undefined) {
|
199
|
+
return null;
|
200
|
+
}
|
201
|
+
for (i = 0; i < menus.length; ++i) {
|
202
|
+
if (menus[i].menuType() === 0) {
|
203
|
+
return menus[i];
|
204
|
+
}
|
205
|
+
}
|
206
|
+
return null;
|
207
|
+
};
|
208
|
+
this.domainLogoUrl = function () {
|
209
|
+
var logo = this.logo();
|
210
|
+
return logo && logo.viewUrl() ? logo.viewUrl() : null;
|
211
|
+
};
|
212
|
+
this.faviconLogoUrl = function () {
|
213
|
+
var favicon = this.favicon();
|
214
|
+
return favicon && favicon.viewUrl() ? favicon.viewUrl() : null;
|
215
|
+
};
|
216
|
+
this.isDomainType = function (typeName) {
|
217
|
+
return this.domainType() === _domain_types.domainTypesInts.get(typeName);
|
218
|
+
};
|
219
|
+
this.isSellerDomain = function () {
|
220
|
+
return this.isDomainType(_roles.SELLER);
|
221
|
+
};
|
222
|
+
this.isSellerOrSellerPlusDomain = function () {
|
223
|
+
return this.isSellerDomain() || this.isDomainType(_roles.SELLER_PLUS);
|
224
|
+
};
|
225
|
+
this.isSupplierOrRestrictedSupplierDomain = function () {
|
226
|
+
return this.isDomainType(_roles.SUPPLIER) || this.isDomainType(_roles.RESTRICTED_SUPPLIER);
|
227
|
+
};
|
228
|
+
this.isUnrestricted = function () {
|
229
|
+
return this.domainType() === _domain_types.domainTypesInts.get('Unrestricted');
|
230
|
+
};
|
231
|
+
}
|
232
|
+
function Domains() {
|
233
|
+
this.resource = '/domains';
|
234
|
+
this.json = 'domains';
|
235
|
+
this.single = Domain;
|
236
|
+
this.get = function (success, error, parameters) {
|
237
|
+
var self = this;
|
238
|
+
function handleResponse(result) {
|
239
|
+
success((0, _model.fromJsonList)(self, result, {
|
240
|
+
makesDirty: false
|
241
|
+
}));
|
242
|
+
}
|
243
|
+
(0, _model.getList)(this.resource, handleResponse, error, parameters);
|
244
|
+
};
|
245
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.DomainInvitation = DomainInvitation;
|
7
|
+
var _uuid = require("./uuid.js");
|
8
|
+
var _model = require("./model.js");
|
9
|
+
function DomainInvitation() {
|
10
|
+
this.resource = '/domain_invitations';
|
11
|
+
this.json = 'domainInvitation';
|
12
|
+
this.temporaryId = (0, _uuid.generateUUID)();
|
13
|
+
(0, _model.addPropertyTo)(this, 'id');
|
14
|
+
(0, _model.addPropertyTo)(this, 'userName');
|
15
|
+
(0, _model.addPropertyTo)(this, 'userEmail');
|
16
|
+
(0, _model.addPropertyTo)(this, 'role');
|
17
|
+
}
|
@@ -0,0 +1,87 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.DomainTag = DomainTag;
|
7
|
+
exports.DomainTags = DomainTags;
|
8
|
+
var _uuid = require("./uuid.js");
|
9
|
+
var _model = require("./model.js");
|
10
|
+
var _domain = require("./domain.js");
|
11
|
+
var _product = require("./product.js");
|
12
|
+
function DomainTag() {
|
13
|
+
this.resource = '/domain_tags';
|
14
|
+
this.json = 'domainTag';
|
15
|
+
this.temporaryId = (0, _uuid.generateUUID)();
|
16
|
+
(0, _model.addPropertyTo)(this, 'id');
|
17
|
+
(0, _model.addPropertyTo)(this, 'name');
|
18
|
+
(0, _model.addPropertyTo)(this, 'description');
|
19
|
+
(0, _model.addPropertyTo)(this, 'colour');
|
20
|
+
(0, _model.addPropertyTo)(this, 'showPublic');
|
21
|
+
(0, _model.addPropertyTo)(this, 'domain', _domain.Domain);
|
22
|
+
(0, _model.addPropertyTo)(this, 'products', _product.Product);
|
23
|
+
this.create = function (success, error, embed, domainId) {
|
24
|
+
var data = (0, _model.serialise)(this),
|
25
|
+
self = this;
|
26
|
+
function handleResponse(result) {
|
27
|
+
success((0, _model.fromJson)(self, result[self.json]));
|
28
|
+
}
|
29
|
+
(0, _model.create)({
|
30
|
+
resource: this.resource,
|
31
|
+
parameters: data[0],
|
32
|
+
files: (0, _model.enumerateFiles)(data[1]),
|
33
|
+
success: handleResponse,
|
34
|
+
error: error,
|
35
|
+
embed: embed,
|
36
|
+
as_domain: domainId
|
37
|
+
});
|
38
|
+
};
|
39
|
+
this.get = function (success, error) {
|
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
|
+
});
|
52
|
+
};
|
53
|
+
this.patch = function (success, error, embed) {
|
54
|
+
var self = this,
|
55
|
+
data = (0, _model.serialise)(this)[0];
|
56
|
+
function handleResponse(result) {
|
57
|
+
success((0, _model.fromJson)(self, result[self.json], {
|
58
|
+
makesDirty: false
|
59
|
+
}));
|
60
|
+
}
|
61
|
+
(0, _model.patchOne)({
|
62
|
+
resource: this.resource,
|
63
|
+
id: this.id(),
|
64
|
+
success: handleResponse,
|
65
|
+
error: error,
|
66
|
+
data: data,
|
67
|
+
embed: embed
|
68
|
+
});
|
69
|
+
};
|
70
|
+
this.destroy = function (success, error) {
|
71
|
+
(0, _model.deleteOne)(this.resource + "/" + this.id(), success, error);
|
72
|
+
};
|
73
|
+
}
|
74
|
+
function DomainTags() {
|
75
|
+
this.resource = '/domain_tags';
|
76
|
+
this.json = 'domainTags';
|
77
|
+
this.single = DomainTag;
|
78
|
+
this.get = function (success, error, parameters) {
|
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, parameters);
|
86
|
+
};
|
87
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.domainTypesInts = exports.domainTypes = void 0;
|
7
|
+
var _dictionary = require("./dictionary.js");
|
8
|
+
var domainTypes = exports.domainTypes = new _dictionary.Dictionary();
|
9
|
+
domainTypes.add(0, 'Unrestricted');
|
10
|
+
domainTypes.add(1, 'Seller');
|
11
|
+
domainTypes.add(2, 'Seller plus');
|
12
|
+
domainTypes.add(3, 'Supplier');
|
13
|
+
domainTypes.add(4, 'Restricted supplier');
|
14
|
+
domainTypes.add(5, 'Domain supplier');
|
15
|
+
domainTypes.add(6, 'Domain client catalogue');
|
16
|
+
domainTypes.add(7, 'Domain shopify seller');
|
17
|
+
domainTypes.add(8, 'Unrestricted shopify app');
|
18
|
+
domainTypes.add(9, 'Reserved');
|
19
|
+
var domainTypesInts = exports.domainTypesInts = new _dictionary.Dictionary();
|
20
|
+
domainTypes.each(function (key, value) {
|
21
|
+
domainTypesInts.add(value, parseInt(key, 10));
|
22
|
+
});
|
package/dist/draft.js
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Draft = Draft;
|
7
|
+
exports.Drafts = Drafts;
|
8
|
+
var _model = require("./model.js");
|
9
|
+
var _helpers = require("./helpers.js");
|
10
|
+
var _job = require("./job.js");
|
11
|
+
var _user = require("./user.js");
|
12
|
+
var _draft_comment = require("./draft_comment.js");
|
13
|
+
var _merchi_file = require("./merchi_file.js");
|
14
|
+
function Draft() {
|
15
|
+
this.resource = '/drafts';
|
16
|
+
this.json = 'draft';
|
17
|
+
(0, _model.addPropertyTo)(this, 'id');
|
18
|
+
(0, _model.addPropertyTo)(this, 'job', _job.Job);
|
19
|
+
(0, _model.addPropertyTo)(this, 'sharedWithJob', _job.Job);
|
20
|
+
(0, _model.addPropertyTo)(this, 'designer', _user.User);
|
21
|
+
(0, _model.addPropertyTo)(this, 'file', _merchi_file.MerchiFile);
|
22
|
+
(0, _model.addPropertyTo)(this, 'date');
|
23
|
+
(0, _model.addPropertyTo)(this, 'accepted');
|
24
|
+
(0, _model.addPropertyTo)(this, 'changesRequested');
|
25
|
+
(0, _model.addPropertyTo)(this, 'resendDate');
|
26
|
+
(0, _model.addPropertyTo)(this, 'viewed');
|
27
|
+
(0, _model.addPropertyTo)(this, 'justViewed');
|
28
|
+
(0, _model.addPropertyTo)(this, 'comments', _draft_comment.DraftComment);
|
29
|
+
(0, _model.addPropertyTo)(this, 'commentsCount');
|
30
|
+
(0, _model.addPropertyTo)(this, 'sendSms');
|
31
|
+
(0, _model.addPropertyTo)(this, 'sendEmail');
|
32
|
+
this.get = function (success, error, embed, include_archived) {
|
33
|
+
var self = this;
|
34
|
+
function handleResponse(result) {
|
35
|
+
success((0, _model.fromJson)(self, result[self.json], {
|
36
|
+
makesDirty: false
|
37
|
+
}));
|
38
|
+
}
|
39
|
+
(0, _model.getOne)({
|
40
|
+
resource: this.resource,
|
41
|
+
id: this.id(),
|
42
|
+
success: handleResponse,
|
43
|
+
error: error,
|
44
|
+
embed: embed,
|
45
|
+
includeArchived: include_archived
|
46
|
+
});
|
47
|
+
};
|
48
|
+
this.patch = function (options) {
|
49
|
+
var self = this,
|
50
|
+
data = (0, _model.serialise)(this, undefined, undefined, undefined, {
|
51
|
+
excludeOld: true
|
52
|
+
})[0],
|
53
|
+
job = this.job(),
|
54
|
+
domain = job && job.domain() ? job.domain().id() : null,
|
55
|
+
asDomain = options.asDomain,
|
56
|
+
domainId = (0, _helpers.isUndefined)(asDomain) ? domain : asDomain;
|
57
|
+
function handleResponse(result) {
|
58
|
+
options.success((0, _model.fromJson)(self, result[self.json]));
|
59
|
+
}
|
60
|
+
(0, _model.patchOne)({
|
61
|
+
resource: this.resource,
|
62
|
+
id: this.id(),
|
63
|
+
success: handleResponse,
|
64
|
+
error: options.error,
|
65
|
+
as_domain: domainId,
|
66
|
+
data: data,
|
67
|
+
embed: options.embed
|
68
|
+
});
|
69
|
+
};
|
70
|
+
this.changesRequested = function () {
|
71
|
+
var comments = this.comments() ? this.comments() : [],
|
72
|
+
i;
|
73
|
+
for (i = 0; i < comments.length; i++) {
|
74
|
+
if (comments[i].changeRequest()) {
|
75
|
+
return true;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
return false;
|
79
|
+
};
|
80
|
+
this.commentsYoungestToEldest = function () {
|
81
|
+
return (0, _helpers.sortArrayByObjectKeyDescending)(this.comments(), 'id');
|
82
|
+
};
|
83
|
+
}
|
84
|
+
function Drafts() {
|
85
|
+
this.resource = '/drafts';
|
86
|
+
this.json = 'drafts';
|
87
|
+
this.single = Draft;
|
88
|
+
this.get = function (success, error, parameters) {
|
89
|
+
var self = this;
|
90
|
+
function handleResponse(result) {
|
91
|
+
success((0, _model.fromJsonList)(self, result, {
|
92
|
+
makesDirty: false
|
93
|
+
}));
|
94
|
+
}
|
95
|
+
(0, _model.getList)(this.resource, handleResponse, error, parameters);
|
96
|
+
};
|
97
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.DraftComment = DraftComment;
|
7
|
+
var _model = require("./model.js");
|
8
|
+
var _draft = require("./draft.js");
|
9
|
+
var _job = require("./job.js");
|
10
|
+
var _user = require("./user.js");
|
11
|
+
var _notification = require("./notification.js");
|
12
|
+
var _merchi_file = require("./merchi_file.js");
|
13
|
+
function DraftComment() {
|
14
|
+
this.resource = '/draft_comments';
|
15
|
+
this.json = 'draftComment';
|
16
|
+
(0, _model.addPropertyTo)(this, 'id');
|
17
|
+
(0, _model.addPropertyTo)(this, 'draft', _draft.Draft);
|
18
|
+
(0, _model.addPropertyTo)(this, 'user', _user.User);
|
19
|
+
(0, _model.addPropertyTo)(this, 'file', _merchi_file.MerchiFile);
|
20
|
+
(0, _model.addPropertyTo)(this, 'notifications', _notification.Notification);
|
21
|
+
(0, _model.addPropertyTo)(this, 'job', _job.Job);
|
22
|
+
(0, _model.addPropertyTo)(this, 'date');
|
23
|
+
(0, _model.addPropertyTo)(this, 'text');
|
24
|
+
(0, _model.addPropertyTo)(this, 'urgency');
|
25
|
+
(0, _model.addPropertyTo)(this, 'subject');
|
26
|
+
(0, _model.addPropertyTo)(this, 'sendSms');
|
27
|
+
(0, _model.addPropertyTo)(this, 'sendEmail');
|
28
|
+
(0, _model.addPropertyTo)(this, 'changeRequest');
|
29
|
+
this.create = function (options) {
|
30
|
+
var data = (0, _model.serialise)(this),
|
31
|
+
self = this;
|
32
|
+
function handleResponse(result) {
|
33
|
+
options.success((0, _model.fromJson)(self, result[self.json]));
|
34
|
+
}
|
35
|
+
(0, _model.create)({
|
36
|
+
resource: this.resource,
|
37
|
+
parameters: data[0],
|
38
|
+
files: (0, _model.enumerateFiles)(data[1]),
|
39
|
+
success: handleResponse,
|
40
|
+
as_domain: options.as_domain,
|
41
|
+
error: options.error,
|
42
|
+
embed: options.embed
|
43
|
+
});
|
44
|
+
};
|
45
|
+
}
|