merchi_sdk_js 0.11.0 → 0.13.0
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.
- package/package.json +1 -1
- package/src/domain.js +134 -18
- package/src/merchi.js +0 -41
- package/src/model.js +0 -11
- package/src/product.js +0 -4
- package/src/theme.js +0 -85
- package/src/component.js +0 -100
- package/src/component_tag.js +0 -53
- package/src/component_version.js +0 -17
- package/src/menu.js +0 -32
- package/src/menu_item.js +0 -22
- package/src/page.js +0 -38
- package/src/seo_domain_page.js +0 -35
package/package.json
CHANGED
package/src/domain.js
CHANGED
|
@@ -9,9 +9,7 @@ import { DomainTag } from './domain_tag.js';
|
|
|
9
9
|
import { DomainInvitation } from './domain_invitation.js';
|
|
10
10
|
import { Theme } from './theme.js';
|
|
11
11
|
import { MerchiFile } from './merchi_file.js';
|
|
12
|
-
import { Menu } from './menu.js';
|
|
13
12
|
import { SupplyDomain } from './supply_domain.js';
|
|
14
|
-
import { SeoDomainPage } from './seo_domain_page.js';
|
|
15
13
|
import { DomainChatSettings } from './domain_chat_settings.js';
|
|
16
14
|
import { User, Users } from './user.js';
|
|
17
15
|
import { InternalTag } from './internal_tag.js';
|
|
@@ -53,7 +51,6 @@ export function Domain() {
|
|
|
53
51
|
addPropertyTo(this, 'accessibleClientCompanies', Company);
|
|
54
52
|
addPropertyTo(this, 'unltdAiApiOrganizationId');
|
|
55
53
|
addPropertyTo(this, 'unltdAiApiSecretKey');
|
|
56
|
-
addPropertyTo(this, 'menus', Menu);
|
|
57
54
|
|
|
58
55
|
addPropertyTo(this, 'socialBitchute');
|
|
59
56
|
addPropertyTo(this, 'socialDiscord');
|
|
@@ -78,7 +75,6 @@ export function Domain() {
|
|
|
78
75
|
addPropertyTo(this, 'merchiAgentUser', User);
|
|
79
76
|
addPropertyTo(this, 'enableEmailNotifications');
|
|
80
77
|
addPropertyTo(this, 'enableSmsNotifications');
|
|
81
|
-
addPropertyTo(this, 'seoDomainPages', SeoDomainPage);
|
|
82
78
|
addPropertyTo(this, 'domainChatSettings', DomainChatSettings);
|
|
83
79
|
addPropertyTo(this, 'themes', Theme);
|
|
84
80
|
addPropertyTo(this, 'supplyProducts', SupplyDomain);
|
|
@@ -211,20 +207,6 @@ export function Domain() {
|
|
|
211
207
|
undefined, {excludeOld: true})[0], embed);
|
|
212
208
|
};
|
|
213
209
|
|
|
214
|
-
this.mainMenu = function () {
|
|
215
|
-
var menus = this.menus(),
|
|
216
|
-
i = 0;
|
|
217
|
-
if (menus === undefined) {
|
|
218
|
-
return null;
|
|
219
|
-
}
|
|
220
|
-
for (i = 0; i < menus.length; ++i) {
|
|
221
|
-
if (menus[i].menuType() === 0) {
|
|
222
|
-
return menus[i];
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
return null;
|
|
226
|
-
};
|
|
227
|
-
|
|
228
210
|
this.domainLogoUrl = function () {
|
|
229
211
|
var logo = this.logo();
|
|
230
212
|
return logo && logo.viewUrl() ? logo.viewUrl() : null;
|
|
@@ -271,6 +253,15 @@ export function Domain() {
|
|
|
271
253
|
* @property {string} [updatedAt]
|
|
272
254
|
*/
|
|
273
255
|
|
|
256
|
+
/**
|
|
257
|
+
* @typedef {Object} StorefrontGoogleIntegrations
|
|
258
|
+
* @property {string} [ga4MeasurementId]
|
|
259
|
+
* @property {string} [ga4PropertyId]
|
|
260
|
+
* @property {string} [googleAdsId]
|
|
261
|
+
* @property {string} [googleAdsConversionLabel]
|
|
262
|
+
* @property {string} [googleAdsQuoteConversionLabel]
|
|
263
|
+
*/
|
|
264
|
+
|
|
274
265
|
/**
|
|
275
266
|
* @typedef {Object} StorefrontV2Config
|
|
276
267
|
* @property {number} [id]
|
|
@@ -287,6 +278,7 @@ export function Domain() {
|
|
|
287
278
|
* @property {string|null} [repoName]
|
|
288
279
|
* @property {string|null} [vercelProjectId]
|
|
289
280
|
* @property {string|null} [lastSuccessfulCommitSha]
|
|
281
|
+
* @property {StorefrontGoogleIntegrations|null} [googleIntegrations]
|
|
290
282
|
* @property {Array<string>} [approvedStarterTemplates]
|
|
291
283
|
* @property {string} [providerMode]
|
|
292
284
|
*/
|
|
@@ -602,6 +594,130 @@ export function Domain() {
|
|
|
602
594
|
);
|
|
603
595
|
};
|
|
604
596
|
|
|
597
|
+
this.getStorefrontV2GoogleIntegrations = function (success, error) {
|
|
598
|
+
sendStorefrontRequest(
|
|
599
|
+
'/domains/' + this.id() + '/storefront_v2/google_integrations/',
|
|
600
|
+
'GET',
|
|
601
|
+
null,
|
|
602
|
+
success,
|
|
603
|
+
error
|
|
604
|
+
);
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* @param {{googleIntegrations?: StorefrontGoogleIntegrations}|StorefrontGoogleIntegrations|Function} payload
|
|
609
|
+
* @param {Function} [success]
|
|
610
|
+
* @param {Function} [error]
|
|
611
|
+
*/
|
|
612
|
+
this.saveStorefrontV2GoogleIntegrations = function (payload, success, error) {
|
|
613
|
+
var args = parsePayloadAndCallbacks(payload, success, error);
|
|
614
|
+
var body = args.payload || {};
|
|
615
|
+
if (!body.googleIntegrations && !body.google_integrations) {
|
|
616
|
+
body = {googleIntegrations: body};
|
|
617
|
+
}
|
|
618
|
+
sendStorefrontRequest(
|
|
619
|
+
'/domains/' + this.id() + '/storefront_v2/google_integrations/',
|
|
620
|
+
'POST',
|
|
621
|
+
body,
|
|
622
|
+
args.success,
|
|
623
|
+
args.error
|
|
624
|
+
);
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
this.getStorefrontV2GaStatus = function (success, error) {
|
|
628
|
+
sendStorefrontRequest(
|
|
629
|
+
'/domains/' + this.id() + '/storefront_v2/ga/status/',
|
|
630
|
+
'GET',
|
|
631
|
+
null,
|
|
632
|
+
success,
|
|
633
|
+
error
|
|
634
|
+
);
|
|
635
|
+
};
|
|
636
|
+
|
|
637
|
+
this.verifyStorefrontV2GaInstallation = function (success, error) {
|
|
638
|
+
sendStorefrontRequest(
|
|
639
|
+
'/domains/' + this.id() + '/storefront_v2/ga/verify/',
|
|
640
|
+
'POST',
|
|
641
|
+
null,
|
|
642
|
+
success,
|
|
643
|
+
error
|
|
644
|
+
);
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* @param {{days?: number}|Function} payload
|
|
649
|
+
* @param {Function} [success]
|
|
650
|
+
* @param {Function} [error]
|
|
651
|
+
*/
|
|
652
|
+
this.analyzeStorefrontV2Ga = function (payload, success, error) {
|
|
653
|
+
var args = parsePayloadAndCallbacks(payload, success, error);
|
|
654
|
+
sendStorefrontRequest(
|
|
655
|
+
'/domains/' + this.id() + '/storefront_v2/ga/analyze/',
|
|
656
|
+
'POST',
|
|
657
|
+
args.payload,
|
|
658
|
+
args.success,
|
|
659
|
+
args.error
|
|
660
|
+
);
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* @param {{recommendationIds: Array<string>, recommendations?: Array<Object>, narrative?: string, days?: number, startNewBranch?: boolean, branchName?: string}|Function} payload
|
|
665
|
+
* @param {Function} [success]
|
|
666
|
+
* @param {Function} [error]
|
|
667
|
+
*/
|
|
668
|
+
this.applyStorefrontV2GaRecommendations = function (payload, success, error) {
|
|
669
|
+
var args = parsePayloadAndCallbacks(payload, success, error);
|
|
670
|
+
sendStorefrontRequest(
|
|
671
|
+
'/domains/' + this.id() + '/storefront_v2/ga/apply/',
|
|
672
|
+
'POST',
|
|
673
|
+
args.payload,
|
|
674
|
+
args.success,
|
|
675
|
+
args.error
|
|
676
|
+
);
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
this.getStorefrontV2GscStatus = function (success, error) {
|
|
680
|
+
sendStorefrontRequest(
|
|
681
|
+
'/domains/' + this.id() + '/storefront_v2/gsc/status/',
|
|
682
|
+
'GET',
|
|
683
|
+
null,
|
|
684
|
+
success,
|
|
685
|
+
error
|
|
686
|
+
);
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* @param {{days?: number}|Function} payload
|
|
691
|
+
* @param {Function} [success]
|
|
692
|
+
* @param {Function} [error]
|
|
693
|
+
*/
|
|
694
|
+
this.analyzeStorefrontV2Gsc = function (payload, success, error) {
|
|
695
|
+
var args = parsePayloadAndCallbacks(payload, success, error);
|
|
696
|
+
sendStorefrontRequest(
|
|
697
|
+
'/domains/' + this.id() + '/storefront_v2/gsc/analyze/',
|
|
698
|
+
'POST',
|
|
699
|
+
args.payload,
|
|
700
|
+
args.success,
|
|
701
|
+
args.error
|
|
702
|
+
);
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* @param {{recommendationIds: Array<string>, recommendations?: Array<Object>, narrative?: string, days?: number, startNewBranch?: boolean, branchName?: string}|Function} payload
|
|
707
|
+
* @param {Function} [success]
|
|
708
|
+
* @param {Function} [error]
|
|
709
|
+
*/
|
|
710
|
+
this.applyStorefrontV2GscRecommendations = function (payload, success, error) {
|
|
711
|
+
var args = parsePayloadAndCallbacks(payload, success, error);
|
|
712
|
+
sendStorefrontRequest(
|
|
713
|
+
'/domains/' + this.id() + '/storefront_v2/gsc/apply/',
|
|
714
|
+
'POST',
|
|
715
|
+
args.payload,
|
|
716
|
+
args.success,
|
|
717
|
+
args.error
|
|
718
|
+
);
|
|
719
|
+
};
|
|
720
|
+
|
|
605
721
|
this.getStorefrontChangeRequest = function (requestId, success, error) {
|
|
606
722
|
sendStorefrontRequest(
|
|
607
723
|
'/storefront_change_requests/' + requestId + '/',
|
package/src/merchi.js
CHANGED
|
@@ -29,8 +29,6 @@ import { CartItem } from './cart_item.js';
|
|
|
29
29
|
import { CountryTax, CountryTaxes, NoTaxEntity } from './country_tax.js';
|
|
30
30
|
import { Company, Companies } from './company.js';
|
|
31
31
|
import { CompanyInvitation, CompanyInvitations } from './company_invitation.js';
|
|
32
|
-
import { Component, Components } from './component.js';
|
|
33
|
-
import { ComponentTag, ComponentTags } from './component_tag.js';
|
|
34
32
|
import { Discount } from './discount.js';
|
|
35
33
|
import { DiscountGroup } from './discount_group.js';
|
|
36
34
|
import { Domain, Domains } from './domain.js';
|
|
@@ -56,9 +54,6 @@ import { JobComment } from './job_comment.js';
|
|
|
56
54
|
import { JobNote } from './job_note.js';
|
|
57
55
|
import { JobOperationLog, JobOperationLogs } from './job_operation_log.js';
|
|
58
56
|
import { MerchiFile, MerchiFiles } from './merchi_file.js';
|
|
59
|
-
import { Menu } from './menu.js';
|
|
60
|
-
import { MenuItem } from './menu_item.js';
|
|
61
|
-
import { Page } from './page.js';
|
|
62
57
|
import { Payment } from './payment.js';
|
|
63
58
|
import { Product, Products } from './product.js';
|
|
64
59
|
import { ProductionComment } from './production_comment.js';
|
|
@@ -192,13 +187,8 @@ export function merchi(backendUri, websocketUri) {
|
|
|
192
187
|
productTypesSeller = new Dictionary(),
|
|
193
188
|
notificationAvatar = new Dictionary(),
|
|
194
189
|
inventoryStatuses = new Dictionary(),
|
|
195
|
-
themeFoundation = new Dictionary(),
|
|
196
190
|
inputTypes = new Dictionary(),
|
|
197
191
|
fieldTypesString = new Dictionary(),
|
|
198
|
-
menuType = new Dictionary(),
|
|
199
|
-
menuTypeCodes = new Dictionary(),
|
|
200
|
-
menuItemType = new Dictionary(),
|
|
201
|
-
menuItemTypeCodes = new Dictionary(),
|
|
202
192
|
currentUserEmbed = {'emailAddresses': {},
|
|
203
193
|
'profilePicture': {},
|
|
204
194
|
'userCompanies': {"company": {}},
|
|
@@ -250,11 +240,6 @@ export function merchi(backendUri, websocketUri) {
|
|
|
250
240
|
fieldTypesString.add(1, "TEXT_INPUT");
|
|
251
241
|
fieldTypesString.add(2, "SELECT");
|
|
252
242
|
|
|
253
|
-
themeFoundation.add("NO_FOUNDATION", 0);
|
|
254
|
-
themeFoundation.add("BOOTSTRAP_3", 1);
|
|
255
|
-
themeFoundation.add("BOOTSTRAP_4", 2);
|
|
256
|
-
themeFoundation.add("BOOTSTRAP_5", 3);
|
|
257
|
-
|
|
258
243
|
shipmentCompanies.add(0, 'DHL');
|
|
259
244
|
shipmentCompanies.add(1, 'UPS');
|
|
260
245
|
shipmentCompanies.add(2, 'EMS');
|
|
@@ -303,21 +288,6 @@ export function merchi(backendUri, websocketUri) {
|
|
|
303
288
|
itemTypes.add('shipping', 1);
|
|
304
289
|
itemTypes.add('tax', 2);
|
|
305
290
|
|
|
306
|
-
menuType.add(0, 'Main menu');
|
|
307
|
-
menuType.add(1, 'Footer menu');
|
|
308
|
-
menuType.add(2, 'Other menu');
|
|
309
|
-
|
|
310
|
-
menuType.each(function (key, value) {
|
|
311
|
-
menuTypeCodes.add(value, parseInt(key, 10));
|
|
312
|
-
});
|
|
313
|
-
|
|
314
|
-
menuItemType.add(0, 'Redirect');
|
|
315
|
-
menuItemType.add(1, 'Internal');
|
|
316
|
-
|
|
317
|
-
menuItemType.each(function (key, value) {
|
|
318
|
-
menuItemTypeCodes.add(value, parseInt(key, 10));
|
|
319
|
-
});
|
|
320
|
-
|
|
321
291
|
DEFAULT_RIGHTS = [rights.get("canAccess"),
|
|
322
292
|
rights.get("canEdit"),
|
|
323
293
|
rights.get("canDelete")];
|
|
@@ -1054,10 +1024,6 @@ export function merchi(backendUri, websocketUri) {
|
|
|
1054
1024
|
'UserCompany': UserCompany,
|
|
1055
1025
|
'Category': Category,
|
|
1056
1026
|
'categories': new Categories(),
|
|
1057
|
-
'Component': Component,
|
|
1058
|
-
'components': new Components(),
|
|
1059
|
-
'ComponentTag': ComponentTag,
|
|
1060
|
-
'componentTags': new ComponentTags(),
|
|
1061
1027
|
'DomainTag': DomainTag,
|
|
1062
1028
|
'domainTags': new DomainTags(),
|
|
1063
1029
|
'Product': Product,
|
|
@@ -1148,12 +1114,9 @@ export function merchi(backendUri, websocketUri) {
|
|
|
1148
1114
|
'Variation': Variation,
|
|
1149
1115
|
'VariationsGroup': VariationsGroup,
|
|
1150
1116
|
'VariationFieldsOption': VariationFieldsOption,
|
|
1151
|
-
'Menu': Menu,
|
|
1152
|
-
'MenuItem': MenuItem,
|
|
1153
1117
|
'notificationTypes': notificationTypes,
|
|
1154
1118
|
'paymentTypes': paymentTypes,
|
|
1155
1119
|
'paymentTypeIds': paymentTypeIds,
|
|
1156
|
-
'Page': Page,
|
|
1157
1120
|
'toUnix': toUnix,
|
|
1158
1121
|
'id': id,
|
|
1159
1122
|
'isUndefined': isUndefined,
|
|
@@ -1196,10 +1159,6 @@ export function merchi(backendUri, websocketUri) {
|
|
|
1196
1159
|
'platformIcon': platformIcon,
|
|
1197
1160
|
'defaultUserAvatar': defaultUserAvatar,
|
|
1198
1161
|
'platformLogo': platformLogo,
|
|
1199
|
-
'menuItemType': menuItemType,
|
|
1200
|
-
'menuItemTypeCodes': menuItemTypeCodes,
|
|
1201
|
-
'menuType': menuType,
|
|
1202
|
-
'menuTypeCodes': menuTypeCodes,
|
|
1203
1162
|
'checkUserInfo': checkUserInfo,
|
|
1204
1163
|
'getJobQuote': getJobQuote,
|
|
1205
1164
|
'removeObjectFromArrayWithIntegerValue': removeObjectFromArrayWithIntegerValue,
|
package/src/model.js
CHANGED
|
@@ -496,9 +496,6 @@ export function getList(resource, success, error, parameters, withUpdates) {
|
|
|
496
496
|
request.query().add('company_supplier_id',
|
|
497
497
|
parameters.companySupplierId);
|
|
498
498
|
}
|
|
499
|
-
if (notEmpty(parameters.componentId)) {
|
|
500
|
-
request.query().add('component_id', parameters.componentId);
|
|
501
|
-
}
|
|
502
499
|
if (notEmpty(parameters.section)) {
|
|
503
500
|
request.query().add('section', parameters.section);
|
|
504
501
|
}
|
|
@@ -538,10 +535,6 @@ export function getList(resource, success, error, parameters, withUpdates) {
|
|
|
538
535
|
if (notEmpty(parameters.exclude)) {
|
|
539
536
|
request.query().add('exclude', parameters.exclude);
|
|
540
537
|
}
|
|
541
|
-
if (notEmpty(parameters.excludeComponents)) {
|
|
542
|
-
request.query().add(
|
|
543
|
-
'exclude_components', parameters.excludeComponents);
|
|
544
|
-
}
|
|
545
538
|
if (notEmpty(parameters.excludeDomains)) {
|
|
546
539
|
request.query().add(
|
|
547
540
|
'exclude_domains', parameters.excludeDomains);
|
|
@@ -560,10 +553,6 @@ export function getList(resource, success, error, parameters, withUpdates) {
|
|
|
560
553
|
request.query().add('shopify_only',
|
|
561
554
|
parameters.shopifyOnly);
|
|
562
555
|
}
|
|
563
|
-
if (notEmpty(parameters.relatedComponent)) {
|
|
564
|
-
request.query().add('related_component',
|
|
565
|
-
parameters.relatedComponent);
|
|
566
|
-
}
|
|
567
556
|
if (notEmpty(parameters.originalOf)) {
|
|
568
557
|
request.query().add('original_of',
|
|
569
558
|
parameters.originalOf);
|
package/src/product.js
CHANGED
|
@@ -5,7 +5,6 @@ import { addPropertyTo, getList, fromJsonList, deleteOne, patchOne, fromJson,
|
|
|
5
5
|
serialise, getOne, create, enumerateFiles, Request } from './model.js';
|
|
6
6
|
import { productTypesInts } from './product_types.js';
|
|
7
7
|
import { Category } from './category.js';
|
|
8
|
-
import { Component } from './component.js';
|
|
9
8
|
import { Company } from './company.js';
|
|
10
9
|
import { CountryTax } from './country_tax.js';
|
|
11
10
|
import { DraftTemplate } from './draft_template.js';
|
|
@@ -21,7 +20,6 @@ import { MerchiFile } from './merchi_file.js';
|
|
|
21
20
|
import { SupplyDomain } from './supply_domain.js';
|
|
22
21
|
import { User } from './user.js';
|
|
23
22
|
import { Job } from './job.js';
|
|
24
|
-
import { SeoDomainPage } from './seo_domain_page.js';
|
|
25
23
|
import { InternalTag } from './internal_tag.js';
|
|
26
24
|
import { DraftPreview } from './draft_preview.js';
|
|
27
25
|
import { Reminder } from './reminder.js';
|
|
@@ -78,7 +76,6 @@ export function Product() {
|
|
|
78
76
|
addPropertyTo(this, 'chainedSellerProducts', Product);
|
|
79
77
|
addPropertyTo(this, 'chainedInventorySupplierProduct', Product);
|
|
80
78
|
addPropertyTo(this, 'chainedInventorySellerProducts', Product);
|
|
81
|
-
addPropertyTo(this, 'component', Component);
|
|
82
79
|
addPropertyTo(this, 'domain', Domain);
|
|
83
80
|
addPropertyTo(this, 'suppliedByDomains', SupplyDomain);
|
|
84
81
|
addPropertyTo(this, 'autoAssignProductionOnAction');
|
|
@@ -118,7 +115,6 @@ export function Product() {
|
|
|
118
115
|
addPropertyTo(this, 'draftPreviews', DraftPreview);
|
|
119
116
|
addPropertyTo(this, 'draftTemplates', DraftTemplate);
|
|
120
117
|
addPropertyTo(this, 'shipmentMethods', ShipmentMethod);
|
|
121
|
-
addPropertyTo(this, 'seoDomainPages', SeoDomainPage);
|
|
122
118
|
addPropertyTo(this, 'aiContext');
|
|
123
119
|
addPropertyTo(this, 'aiContextDrafting');
|
|
124
120
|
addPropertyTo(this, 'internalUseNotes');
|
package/src/theme.js
CHANGED
|
@@ -2,12 +2,8 @@ import { generateUUID } from './uuid.js';
|
|
|
2
2
|
import { addPropertyTo, serialise, create, fromJson, enumerateFiles, getOne,
|
|
3
3
|
patchOne, fromJsonList, getList } from './model.js';
|
|
4
4
|
import { themeStatus } from './theme_status.js';
|
|
5
|
-
import { MerchiFile } from './merchi_file.js';
|
|
6
|
-
import { Component } from './component.js';
|
|
7
5
|
import { Domain } from './domain.js';
|
|
8
|
-
import { Page } from './page.js';
|
|
9
6
|
import { User } from './user.js';
|
|
10
|
-
import { InternalTag } from './internal_tag.js';
|
|
11
7
|
|
|
12
8
|
export function Theme() {
|
|
13
9
|
this.resource = '/themes';
|
|
@@ -15,66 +11,8 @@ export function Theme() {
|
|
|
15
11
|
this.temporaryId = generateUUID();
|
|
16
12
|
|
|
17
13
|
addPropertyTo(this, 'id');
|
|
18
|
-
addPropertyTo(this, 'aiContext');
|
|
19
|
-
addPropertyTo(this, 'jsBundle');
|
|
20
|
-
addPropertyTo(this, 'name');
|
|
21
|
-
addPropertyTo(this, 'description');
|
|
22
|
-
addPropertyTo(this, 'foundation');
|
|
23
|
-
addPropertyTo(this, 'public');
|
|
24
14
|
addPropertyTo(this, 'lastUpdated');
|
|
25
15
|
|
|
26
|
-
addPropertyTo(this, 'components', Component);
|
|
27
|
-
addPropertyTo(this, 'contextComponents', Component);
|
|
28
|
-
addPropertyTo(this, 'featureImage', MerchiFile);
|
|
29
|
-
addPropertyTo(this, 'images', MerchiFile);
|
|
30
|
-
addPropertyTo(this, 'cssImageFiles', MerchiFile);
|
|
31
|
-
addPropertyTo(this, 'pages', Page);
|
|
32
|
-
|
|
33
|
-
addPropertyTo(this, 'headerTemplate');
|
|
34
|
-
addPropertyTo(this, 'headerHtml');
|
|
35
|
-
addPropertyTo(this, 'footerTemplate');
|
|
36
|
-
addPropertyTo(this, 'footerHtml');
|
|
37
|
-
addPropertyTo(this, 'indexPageTemplate');
|
|
38
|
-
addPropertyTo(this, 'indexHtml');
|
|
39
|
-
addPropertyTo(this, 'domainInvitePageTemplate');
|
|
40
|
-
addPropertyTo(this, 'domainInviteHtml');
|
|
41
|
-
addPropertyTo(this, 'resetPasswordPageTemplate');
|
|
42
|
-
addPropertyTo(this, 'passwordResetHtml');
|
|
43
|
-
addPropertyTo(this, 'passwordChangePageTemplate');
|
|
44
|
-
addPropertyTo(this, 'passwordChangeHtml');
|
|
45
|
-
addPropertyTo(this, 'jobDraftingPageTemplate');
|
|
46
|
-
addPropertyTo(this, 'jobDraftingHtml');
|
|
47
|
-
addPropertyTo(this, 'jobQuoteRequestedPageTemplate');
|
|
48
|
-
addPropertyTo(this, 'jobQuoteRequestedHtml');
|
|
49
|
-
addPropertyTo(this, 'draftPreviewPageTemplate');
|
|
50
|
-
addPropertyTo(this, 'draftPreviewHtml');
|
|
51
|
-
addPropertyTo(this, 'invoicePageTemplate');
|
|
52
|
-
addPropertyTo(this, 'invoiceHtml');
|
|
53
|
-
addPropertyTo(this, 'productPageTemplate');
|
|
54
|
-
addPropertyTo(this, 'productHtml');
|
|
55
|
-
addPropertyTo(this, 'invoicePaidPageTemplate');
|
|
56
|
-
addPropertyTo(this, 'invoicePaidHtml');
|
|
57
|
-
addPropertyTo(this, 'loginPageTemplate');
|
|
58
|
-
addPropertyTo(this, 'loginPageHtml');
|
|
59
|
-
addPropertyTo(this, 'errorPageTemplate');
|
|
60
|
-
addPropertyTo(this, 'errorPageHtml');
|
|
61
|
-
|
|
62
|
-
addPropertyTo(this, 'footerError');
|
|
63
|
-
addPropertyTo(this, 'headerError');
|
|
64
|
-
addPropertyTo(this, 'indexPageError');
|
|
65
|
-
addPropertyTo(this, 'productsPageError');
|
|
66
|
-
addPropertyTo(this, 'domainInvitePageError');
|
|
67
|
-
addPropertyTo(this, 'resetPasswordPageError');
|
|
68
|
-
addPropertyTo(this, 'passwordChangePageError');
|
|
69
|
-
addPropertyTo(this, 'jobDraftingPageError');
|
|
70
|
-
addPropertyTo(this, 'jobQuoteRequestedPageError');
|
|
71
|
-
addPropertyTo(this, 'invoicePageError');
|
|
72
|
-
|
|
73
|
-
addPropertyTo(this, 'productPageError');
|
|
74
|
-
addPropertyTo(this, 'invoicePaidPageError');
|
|
75
|
-
addPropertyTo(this, 'loginPageError');
|
|
76
|
-
addPropertyTo(this, 'errorPageError');
|
|
77
|
-
|
|
78
16
|
addPropertyTo(this, 'mainCssErrorMessage');
|
|
79
17
|
addPropertyTo(this, 'mainCssStatus');
|
|
80
18
|
addPropertyTo(this, 'mainCss');
|
|
@@ -89,8 +27,6 @@ export function Theme() {
|
|
|
89
27
|
|
|
90
28
|
addPropertyTo(this, 'author', User);
|
|
91
29
|
addPropertyTo(this, 'domain', Domain);
|
|
92
|
-
addPropertyTo(this, 'defaultForDomainType');
|
|
93
|
-
addPropertyTo(this, 'internalTags', InternalTag);
|
|
94
30
|
|
|
95
31
|
this.create = function (success, error, embed, as_domain) {
|
|
96
32
|
var self = this,
|
|
@@ -148,27 +84,6 @@ export function Theme() {
|
|
|
148
84
|
return domain && domain.id() === parseInt(domainId, 10) &&
|
|
149
85
|
domain.activeThemeId() === this.id();
|
|
150
86
|
};
|
|
151
|
-
|
|
152
|
-
this.getPageBySlug = function (slug) {
|
|
153
|
-
var pages = this.pages() ? this.pages() : [],
|
|
154
|
-
i;
|
|
155
|
-
for (i = 0; i < pages.length; i++) {
|
|
156
|
-
var page = pages[i];
|
|
157
|
-
if (page.slug() === slug) {
|
|
158
|
-
return page;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return null;
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
this.updateTemplateByName = function (name, text) {
|
|
165
|
-
var page = this.getPageBySlug(name);
|
|
166
|
-
if (page) {
|
|
167
|
-
page.template(text);
|
|
168
|
-
} else {
|
|
169
|
-
this[name](text);
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
87
|
}
|
|
173
88
|
|
|
174
89
|
export function Themes() {
|
package/src/component.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { generateUUID } from './uuid.js';
|
|
2
|
-
import { addPropertyTo, fromJson, getOne, serialise, enumerateFiles, patchOne,
|
|
3
|
-
fromJsonList, getList, create } from './model.js';
|
|
4
|
-
import { MerchiFile } from './merchi_file.js';
|
|
5
|
-
import { ComponentTag } from './component_tag.js';
|
|
6
|
-
import { User } from './user.js';
|
|
7
|
-
|
|
8
|
-
export function Component() {
|
|
9
|
-
this.resource = '/components';
|
|
10
|
-
this.json = 'component';
|
|
11
|
-
this.temporaryId = generateUUID();
|
|
12
|
-
|
|
13
|
-
addPropertyTo(this, 'id');
|
|
14
|
-
addPropertyTo(this, 'archived');
|
|
15
|
-
addPropertyTo(this, 'componentImports', Component);
|
|
16
|
-
addPropertyTo(this, 'componentExport', Component);
|
|
17
|
-
addPropertyTo(this, 'componentExports', Component);
|
|
18
|
-
addPropertyTo(this, 'created');
|
|
19
|
-
addPropertyTo(this, 'updated');
|
|
20
|
-
addPropertyTo(this, 'name');
|
|
21
|
-
addPropertyTo(this, 'needsUpdate');
|
|
22
|
-
addPropertyTo(this, 'outOfSyncWithOriginal');
|
|
23
|
-
addPropertyTo(this, 'hasImports');
|
|
24
|
-
addPropertyTo(this, 'isClone');
|
|
25
|
-
addPropertyTo(this, 'warnings');
|
|
26
|
-
addPropertyTo(this, 'body');
|
|
27
|
-
addPropertyTo(this, 'description');
|
|
28
|
-
addPropertyTo(this, 'compiled');
|
|
29
|
-
addPropertyTo(this, 'originalComponent', Component);
|
|
30
|
-
addPropertyTo(this, 'createdBy', User);
|
|
31
|
-
addPropertyTo(this, 'updatedBy', User);
|
|
32
|
-
addPropertyTo(this, 'featureImage', MerchiFile);
|
|
33
|
-
addPropertyTo(this, 'images', MerchiFile);
|
|
34
|
-
addPropertyTo(this, 'tags', ComponentTag);
|
|
35
|
-
|
|
36
|
-
this.get = function (success, error, embed) {
|
|
37
|
-
var self = this;
|
|
38
|
-
function handleResponse(result) {
|
|
39
|
-
success(fromJson(self, result[self.json],
|
|
40
|
-
{makesDirty: false}));
|
|
41
|
-
}
|
|
42
|
-
getOne({resource: this.resource,
|
|
43
|
-
id: this.id(),
|
|
44
|
-
success: handleResponse,
|
|
45
|
-
error: error,
|
|
46
|
-
embed: embed});
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
this.create = function (success, error, embed, domainId) {
|
|
50
|
-
var data = serialise(this),
|
|
51
|
-
self = this;
|
|
52
|
-
function handleResponse(result) {
|
|
53
|
-
success(fromJson(self, result[self.json]));
|
|
54
|
-
}
|
|
55
|
-
create({resource: this.resource,
|
|
56
|
-
parameters: data[0],
|
|
57
|
-
files: enumerateFiles(data[1]),
|
|
58
|
-
success: handleResponse,
|
|
59
|
-
error: error,
|
|
60
|
-
embed: embed,
|
|
61
|
-
as_domain: domainId});
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
this.patch = function (success, error, embed) {
|
|
65
|
-
var self = this,
|
|
66
|
-
data = serialise(this)[0];
|
|
67
|
-
function handleResponse(result) {
|
|
68
|
-
success(fromJson(self, result[self.json],
|
|
69
|
-
{makesDirty: false}));
|
|
70
|
-
}
|
|
71
|
-
patchOne({resource: this.resource,
|
|
72
|
-
id: this.id(),
|
|
73
|
-
success: handleResponse,
|
|
74
|
-
error: error,
|
|
75
|
-
data: data,
|
|
76
|
-
embed: embed});
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
this.toReact = function (context) {
|
|
80
|
-
const componentCode = 'with (this) { ' + this.compiled() + ' return ' +
|
|
81
|
-
this.name() + ';}';
|
|
82
|
-
const proxy = new Proxy(context, {});
|
|
83
|
-
const callable = new Function(componentCode);
|
|
84
|
-
return callable.call(proxy);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export function Components() {
|
|
89
|
-
this.resource = '/components';
|
|
90
|
-
this.json = 'components';
|
|
91
|
-
this.single = Component;
|
|
92
|
-
|
|
93
|
-
this.get = function (success, error, parameters) {
|
|
94
|
-
var self = this;
|
|
95
|
-
function handleResponse(result) {
|
|
96
|
-
success(fromJsonList(self, result, {makesDirty: false}));
|
|
97
|
-
}
|
|
98
|
-
getList(this.resource, handleResponse, error, parameters);
|
|
99
|
-
};
|
|
100
|
-
}
|
package/src/component_tag.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { generateUUID } from './uuid.js';
|
|
2
|
-
import { addPropertyTo, fromJson, getOne, serialise, create, enumerateFiles,
|
|
3
|
-
fromJsonList, getList } from './model.js';
|
|
4
|
-
|
|
5
|
-
export function ComponentTag() {
|
|
6
|
-
this.resource = '/component_tags';
|
|
7
|
-
this.json = 'componentTag';
|
|
8
|
-
this.temporaryId = generateUUID();
|
|
9
|
-
|
|
10
|
-
addPropertyTo(this, 'id');
|
|
11
|
-
addPropertyTo(this, 'name');
|
|
12
|
-
|
|
13
|
-
this.get = function (success, error) {
|
|
14
|
-
var self = this;
|
|
15
|
-
function handleResponse(result) {
|
|
16
|
-
success(fromJson(self, result[self.json],
|
|
17
|
-
{makesDirty: false}));
|
|
18
|
-
}
|
|
19
|
-
getOne({resource: this.resource,
|
|
20
|
-
id: this.id(),
|
|
21
|
-
success: handleResponse,
|
|
22
|
-
error: error});
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
this.create = function (success, error, embed, domainId) {
|
|
26
|
-
var data = serialise(this),
|
|
27
|
-
self = this;
|
|
28
|
-
function handleResponse(result) {
|
|
29
|
-
success(fromJson(self, result[self.json]));
|
|
30
|
-
}
|
|
31
|
-
create({resource: this.resource,
|
|
32
|
-
parameters: data[0],
|
|
33
|
-
files: enumerateFiles(data[1]),
|
|
34
|
-
success: handleResponse,
|
|
35
|
-
error: error,
|
|
36
|
-
embed: embed,
|
|
37
|
-
as_domain: domainId});
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function ComponentTags() {
|
|
42
|
-
this.resource = '/component_tags';
|
|
43
|
-
this.json = 'componentTags';
|
|
44
|
-
this.single = ComponentTag;
|
|
45
|
-
|
|
46
|
-
this.get = function (success, error, parameters) {
|
|
47
|
-
var self = this;
|
|
48
|
-
function handleResponse(result) {
|
|
49
|
-
success(fromJsonList(self, result, {makesDirty: false}));
|
|
50
|
-
}
|
|
51
|
-
getList(this.resource, handleResponse, error, parameters);
|
|
52
|
-
};
|
|
53
|
-
}
|
package/src/component_version.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { generateUUID } from './uuid.js';
|
|
2
|
-
import { addPropertyTo } from './model.js';
|
|
3
|
-
import { Component } from './component.js';
|
|
4
|
-
|
|
5
|
-
export function ComponentVersion() {
|
|
6
|
-
this.json = 'componentVersion';
|
|
7
|
-
this.temporaryId = generateUUID();
|
|
8
|
-
|
|
9
|
-
addPropertyTo(this, 'id');
|
|
10
|
-
addPropertyTo(this, 'archived');
|
|
11
|
-
addPropertyTo(this, 'component', Component);
|
|
12
|
-
addPropertyTo(this, 'created');
|
|
13
|
-
addPropertyTo(this, 'isClassBased');
|
|
14
|
-
addPropertyTo(this, 'description');
|
|
15
|
-
addPropertyTo(this, 'name');
|
|
16
|
-
addPropertyTo(this, 'body');
|
|
17
|
-
}
|
package/src/menu.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
}
|
package/src/menu_item.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
}
|
package/src/page.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { addPropertyTo, serialise, enumerateFiles, fromJson,
|
|
2
|
-
create } from './model.js';
|
|
3
|
-
import { isUndefinedOrNull } from './helpers.js';
|
|
4
|
-
import { Theme } from './theme.js';
|
|
5
|
-
|
|
6
|
-
export function Page() {
|
|
7
|
-
this.resource = '/pages';
|
|
8
|
-
this.json = 'page';
|
|
9
|
-
|
|
10
|
-
addPropertyTo(this, 'id');
|
|
11
|
-
addPropertyTo(this, 'name');
|
|
12
|
-
addPropertyTo(this, 'slug');
|
|
13
|
-
addPropertyTo(this, 'template');
|
|
14
|
-
addPropertyTo(this, 'theme', Theme);
|
|
15
|
-
|
|
16
|
-
this.text = function (text) {
|
|
17
|
-
if (!isUndefinedOrNull(text)) {
|
|
18
|
-
this.template(text);
|
|
19
|
-
} else {
|
|
20
|
-
return this.template();
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
this.create = function (success, error, embed, domainId) {
|
|
25
|
-
var data = serialise(this),
|
|
26
|
-
self = this;
|
|
27
|
-
function handleResponse(result) {
|
|
28
|
-
success(fromJson(self, result[self.json]));
|
|
29
|
-
}
|
|
30
|
-
create({resource: this.resource,
|
|
31
|
-
parameters: data[0],
|
|
32
|
-
files: enumerateFiles(data[1]),
|
|
33
|
-
success: handleResponse,
|
|
34
|
-
error: error,
|
|
35
|
-
embed: embed,
|
|
36
|
-
as_domain: domainId});
|
|
37
|
-
};
|
|
38
|
-
}
|
package/src/seo_domain_page.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { generateUUID } from './uuid.js';
|
|
2
|
-
import { addPropertyTo, getList, fromJsonList } from './model.js';
|
|
3
|
-
import { Domain } from './domain.js';
|
|
4
|
-
import { Product } from './product.js';
|
|
5
|
-
|
|
6
|
-
export function SeoDomainPage() {
|
|
7
|
-
this.resource = '/seo_domain_pages';
|
|
8
|
-
this.json = 'seoDomainPage';
|
|
9
|
-
this.temporaryId = generateUUID();
|
|
10
|
-
|
|
11
|
-
addPropertyTo(this, 'archived');
|
|
12
|
-
addPropertyTo(this, 'id');
|
|
13
|
-
addPropertyTo(this, 'metaDescription');
|
|
14
|
-
addPropertyTo(this, 'metaRobots');
|
|
15
|
-
addPropertyTo(this, 'metaTitle');
|
|
16
|
-
addPropertyTo(this, 'pageKey');
|
|
17
|
-
addPropertyTo(this, 'domain', Domain);
|
|
18
|
-
addPropertyTo(this, 'product', Product);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function SeoDomainPages() {
|
|
22
|
-
this.resource = '/seo_domain_pages';
|
|
23
|
-
this.json = 'seoDomainPage';
|
|
24
|
-
this.single = SeoDomainPage;
|
|
25
|
-
|
|
26
|
-
this.get = function (success, error, offset, limit, q) {
|
|
27
|
-
var self = this;
|
|
28
|
-
function handleResponse(result) {
|
|
29
|
-
success(fromJsonList(self, result,
|
|
30
|
-
{makesDirty: false}));
|
|
31
|
-
}
|
|
32
|
-
getList(this.resource, handleResponse, error,
|
|
33
|
-
{offset: offset, limit: limit, q: q});
|
|
34
|
-
};
|
|
35
|
-
}
|