@contrail/document-generation 2.1.21 → 2.1.23
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/lib/frames/frame-generator.js +1 -1
- package/lib/util/document-dynamic-text-element-util.d.ts +1 -1
- package/lib/util/document-dynamic-text-element-util.js +3 -3
- package/lib/util/document-text-element-util.d.ts +1 -0
- package/lib/util/document-text-element-util.js +20 -2
- package/package.json +1 -1
- package/lib/mocks/test-type-data.d.ts +0 -142
- package/lib/mocks/test-type-data.js +0 -149
- package/lib/scripts/test-board.d.ts +0 -1
- package/lib/scripts/test-board.js +0 -230
- package/lib/scripts/test-showcase.d.ts +0 -1
- package/lib/scripts/test-showcase.js +0 -257
- package/lib/test-data.d.ts +0 -72
- package/lib/test-data.js +0 -187
|
@@ -132,7 +132,7 @@ class FrameGenerator {
|
|
|
132
132
|
documentElement.text = documentElement.text.replace('{{dataGroup.name}}', dataGroup.name);
|
|
133
133
|
}
|
|
134
134
|
if (document_dynamic_text_element_util_1.DocumentDynamicTextElementUtil.isDynamicText(documentElement)) {
|
|
135
|
-
document_dynamic_text_element_util_1.DocumentDynamicTextElementUtil.handleDynamicText(documentElement, dataGroup, frameTitle);
|
|
135
|
+
document_dynamic_text_element_util_1.DocumentDynamicTextElementUtil.handleDynamicText(documentElement, dataGroup, frameTitle, element);
|
|
136
136
|
}
|
|
137
137
|
if (documentElement.elementIds) {
|
|
138
138
|
documentElement.elementIds = [elementMapping[documentElement.elementIds[0]]];
|
|
@@ -4,6 +4,6 @@ export declare class DocumentDynamicTextElementUtil {
|
|
|
4
4
|
static typeMap: any;
|
|
5
5
|
static propertyMapByType: any;
|
|
6
6
|
static isDynamicText(element: any): any;
|
|
7
|
-
static handleDynamicText(element: DocumentElement, dataGroup: DataGroup, frameTitle
|
|
7
|
+
static handleDynamicText(element: DocumentElement, dataGroup: DataGroup, frameTitle: any, templateElement: DocumentElement): void;
|
|
8
8
|
static setTypeMap(typeMap: any): void;
|
|
9
9
|
}
|
|
@@ -8,7 +8,7 @@ class DocumentDynamicTextElementUtil {
|
|
|
8
8
|
static isDynamicText(element) {
|
|
9
9
|
return element.type === 'text' && element.propertyBindings && element.propertyBindingsMetaData;
|
|
10
10
|
}
|
|
11
|
-
static handleDynamicText(element, dataGroup, frameTitle = null) {
|
|
11
|
+
static handleDynamicText(element, dataGroup, frameTitle = null, templateElement) {
|
|
12
12
|
var _a, _b, _c;
|
|
13
13
|
const propertyBindingsText = element.propertyBindings.text;
|
|
14
14
|
let propertyLevel = (_a = element.propertyBindingsMetaData) === null || _a === void 0 ? void 0 : _a.propertyLevel;
|
|
@@ -41,8 +41,8 @@ class DocumentDynamicTextElementUtil {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
let text = documents_1.DynamicTextUtil.getDynamicTextValue(element, property, propertyLevel, frame, componentModels);
|
|
44
|
-
if (((_c =
|
|
45
|
-
const styleDefinition = document_text_element_util_1.DocumentTextElementUtil.extractStyleFromInline(
|
|
44
|
+
if (((_c = templateElement.text) === null || _c === void 0 ? void 0 : _c.toString().indexOf('</')) > -1) {
|
|
45
|
+
const styleDefinition = document_text_element_util_1.DocumentTextElementUtil.extractStyleFromInline(templateElement.text);
|
|
46
46
|
text = document_text_element_util_1.DocumentTextElementUtil.applyInLineStyling(text, styleDefinition);
|
|
47
47
|
}
|
|
48
48
|
element.text = text;
|
|
@@ -9,4 +9,5 @@ export declare class DocumentTextElementUtil {
|
|
|
9
9
|
static extractFontFromHTML(text: any): any;
|
|
10
10
|
static extractTextStyleItalicFromHTML(text: any): string;
|
|
11
11
|
static extractTextStyleStrikethroughFromHTML(text: any): string;
|
|
12
|
+
static extractTextAlignFromHTML(text: any): string;
|
|
12
13
|
}
|
|
@@ -36,7 +36,7 @@ class DocumentTextElementUtil {
|
|
|
36
36
|
return element;
|
|
37
37
|
}
|
|
38
38
|
static applyInLineStyling(text, style) {
|
|
39
|
-
var _a, _b, _c, _d, _e;
|
|
39
|
+
var _a, _b, _c, _d, _e, _f;
|
|
40
40
|
let formattedText = text;
|
|
41
41
|
if ((style === null || style === void 0 ? void 0 : style.font.weight) === 'bold') {
|
|
42
42
|
formattedText = `<strong>${formattedText}</strong>`;
|
|
@@ -63,7 +63,12 @@ class DocumentTextElementUtil {
|
|
|
63
63
|
if ((_e = style === null || style === void 0 ? void 0 : style.font) === null || _e === void 0 ? void 0 : _e.italic) {
|
|
64
64
|
formattedText = `<em>${formattedText}</em>`;
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
if ((_f = style === null || style === void 0 ? void 0 : style.text) === null || _f === void 0 ? void 0 : _f.align) {
|
|
67
|
+
formattedText = `<p style="text-align: ${style.text.align};">${formattedText}</p>`;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
formattedText = `<p>${formattedText}</p>`;
|
|
71
|
+
}
|
|
67
72
|
return formattedText;
|
|
68
73
|
}
|
|
69
74
|
static extractStyleFromInline(text) {
|
|
@@ -98,6 +103,10 @@ class DocumentTextElementUtil {
|
|
|
98
103
|
if (font) {
|
|
99
104
|
style.font.family = font;
|
|
100
105
|
}
|
|
106
|
+
const textAlign = this.extractTextAlignFromHTML(text);
|
|
107
|
+
if (textAlign && ['left', 'right', 'center'].includes(textAlign)) {
|
|
108
|
+
style.text.align = textAlign;
|
|
109
|
+
}
|
|
101
110
|
return style;
|
|
102
111
|
}
|
|
103
112
|
static extractFontSizeFromHTML(text) {
|
|
@@ -144,5 +153,14 @@ class DocumentTextElementUtil {
|
|
|
144
153
|
return 'strikethrough';
|
|
145
154
|
}
|
|
146
155
|
}
|
|
156
|
+
static extractTextAlignFromHTML(text) {
|
|
157
|
+
let regex = /text-align:\s*(.*?);/;
|
|
158
|
+
let match = text.match(regex);
|
|
159
|
+
if (match === null || match === void 0 ? void 0 : match.length) {
|
|
160
|
+
let textAlign = match[1];
|
|
161
|
+
textAlign = textAlign.replace(/['"]+/g, '');
|
|
162
|
+
return textAlign;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
147
165
|
}
|
|
148
166
|
exports.DocumentTextElementUtil = DocumentTextElementUtil;
|
package/package.json
CHANGED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
export declare const typeMap: {
|
|
2
|
-
item: {
|
|
3
|
-
pk: number;
|
|
4
|
-
id: string;
|
|
5
|
-
createdOn: string;
|
|
6
|
-
updatedOn: string;
|
|
7
|
-
createdById: string;
|
|
8
|
-
updatedById: string;
|
|
9
|
-
isArchived: boolean;
|
|
10
|
-
orgId: string;
|
|
11
|
-
slug: string;
|
|
12
|
-
label: string;
|
|
13
|
-
typePath: string;
|
|
14
|
-
typeRootId: string;
|
|
15
|
-
parentId: any;
|
|
16
|
-
typePolicyIds: any[];
|
|
17
|
-
typePolicies: any[];
|
|
18
|
-
typeProperties: {
|
|
19
|
-
pk: number;
|
|
20
|
-
id: string;
|
|
21
|
-
createdOn: string;
|
|
22
|
-
updatedOn: string;
|
|
23
|
-
createdById: string;
|
|
24
|
-
updatedById: string;
|
|
25
|
-
isArchived: boolean;
|
|
26
|
-
orgId: string;
|
|
27
|
-
propertyType: string;
|
|
28
|
-
slug: string;
|
|
29
|
-
label: string;
|
|
30
|
-
editable: boolean;
|
|
31
|
-
core: boolean;
|
|
32
|
-
typePropertyOptionSetId: any;
|
|
33
|
-
typePropertyUserListId: any;
|
|
34
|
-
carryOverBehavior: any;
|
|
35
|
-
carryOverDefault: any;
|
|
36
|
-
copyBehavior: any;
|
|
37
|
-
copyDefault: any;
|
|
38
|
-
formula: any;
|
|
39
|
-
numberFormat: {
|
|
40
|
-
format: any;
|
|
41
|
-
currency: string;
|
|
42
|
-
};
|
|
43
|
-
referencedTypeRootSlug: any;
|
|
44
|
-
referencedTypeRole: any;
|
|
45
|
-
referencedTypeFilterProperties: any;
|
|
46
|
-
referencedTypeId: any;
|
|
47
|
-
referencedTypePath: any;
|
|
48
|
-
defaultValue: any;
|
|
49
|
-
propertyLevel: string;
|
|
50
|
-
formulaFunction: any;
|
|
51
|
-
validationFunction: string;
|
|
52
|
-
description: any;
|
|
53
|
-
apiDetails: any;
|
|
54
|
-
notes: any;
|
|
55
|
-
searchable: boolean;
|
|
56
|
-
isFederationProperty: boolean;
|
|
57
|
-
isUniqueProperty: boolean;
|
|
58
|
-
isUniquePropertyInFamily: boolean;
|
|
59
|
-
required: boolean;
|
|
60
|
-
sequenceSeedValue: any;
|
|
61
|
-
optionsSet: any;
|
|
62
|
-
inherited: boolean;
|
|
63
|
-
used: boolean;
|
|
64
|
-
overriddenPropertySlugs: any[];
|
|
65
|
-
typePropertyPolicyIds: any[];
|
|
66
|
-
canRead: boolean;
|
|
67
|
-
canUpdate: boolean;
|
|
68
|
-
canDelete: boolean;
|
|
69
|
-
canCreate: boolean;
|
|
70
|
-
}[];
|
|
71
|
-
};
|
|
72
|
-
projectItem: {
|
|
73
|
-
pk: number;
|
|
74
|
-
id: string;
|
|
75
|
-
createdOn: string;
|
|
76
|
-
updatedOn: string;
|
|
77
|
-
createdById: string;
|
|
78
|
-
updatedById: string;
|
|
79
|
-
isArchived: boolean;
|
|
80
|
-
orgId: string;
|
|
81
|
-
slug: string;
|
|
82
|
-
label: string;
|
|
83
|
-
typePath: string;
|
|
84
|
-
typeRootId: string;
|
|
85
|
-
parentId: any;
|
|
86
|
-
typePolicyIds: any[];
|
|
87
|
-
typePolicies: any[];
|
|
88
|
-
typeProperties: {
|
|
89
|
-
id: string;
|
|
90
|
-
createdOn: string;
|
|
91
|
-
updatedOn: string;
|
|
92
|
-
createdById: string;
|
|
93
|
-
updatedById: string;
|
|
94
|
-
isArchived: boolean;
|
|
95
|
-
orgId: string;
|
|
96
|
-
propertyType: string;
|
|
97
|
-
slug: string;
|
|
98
|
-
label: string;
|
|
99
|
-
editable: boolean;
|
|
100
|
-
core: boolean;
|
|
101
|
-
typePropertyOptionSetId: any;
|
|
102
|
-
typePropertyUserListId: any;
|
|
103
|
-
carryOverBehavior: any;
|
|
104
|
-
carryOverDefault: any;
|
|
105
|
-
copyBehavior: any;
|
|
106
|
-
copyDefault: any;
|
|
107
|
-
formula: any;
|
|
108
|
-
numberFormat: {
|
|
109
|
-
format: string;
|
|
110
|
-
currency: string;
|
|
111
|
-
precision: number;
|
|
112
|
-
};
|
|
113
|
-
referencedTypeRootSlug: any;
|
|
114
|
-
referencedTypeRole: any;
|
|
115
|
-
referencedTypeFilterProperties: any;
|
|
116
|
-
referencedTypeId: any;
|
|
117
|
-
referencedTypePath: any;
|
|
118
|
-
defaultValue: any;
|
|
119
|
-
propertyLevel: string;
|
|
120
|
-
formulaFunction: any;
|
|
121
|
-
validationFunction: string;
|
|
122
|
-
description: any;
|
|
123
|
-
apiDetails: any;
|
|
124
|
-
notes: any;
|
|
125
|
-
searchable: boolean;
|
|
126
|
-
isFederationProperty: boolean;
|
|
127
|
-
isUniqueProperty: boolean;
|
|
128
|
-
isUniquePropertyInFamily: boolean;
|
|
129
|
-
required: boolean;
|
|
130
|
-
sequenceSeedValue: any;
|
|
131
|
-
optionsSet: any;
|
|
132
|
-
inherited: boolean;
|
|
133
|
-
used: boolean;
|
|
134
|
-
overriddenPropertySlugs: any[];
|
|
135
|
-
typePropertyPolicyIds: string[];
|
|
136
|
-
canRead: boolean;
|
|
137
|
-
canUpdate: boolean;
|
|
138
|
-
canDelete: boolean;
|
|
139
|
-
canCreate: boolean;
|
|
140
|
-
}[];
|
|
141
|
-
};
|
|
142
|
-
};
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.typeMap = void 0;
|
|
4
|
-
exports.typeMap = {
|
|
5
|
-
item: {
|
|
6
|
-
pk: 731,
|
|
7
|
-
id: 'ivE7yP0zkKHIkfU-',
|
|
8
|
-
createdOn: '2021-07-09T14:01:49.217Z',
|
|
9
|
-
updatedOn: '2021-07-09T14:01:49.217Z',
|
|
10
|
-
createdById: 'G5YQopiRBlfmnDn3',
|
|
11
|
-
updatedById: 'G5YQopiRBlfmnDn3',
|
|
12
|
-
isArchived: false,
|
|
13
|
-
orgId: 'Z5KDga-mUfxIXk21',
|
|
14
|
-
slug: 'item',
|
|
15
|
-
label: 'Item',
|
|
16
|
-
typePath: 'item',
|
|
17
|
-
typeRootId: '3735b33f-52c4-4ff5-a52c-95c0f97f16c3',
|
|
18
|
-
parentId: null,
|
|
19
|
-
typePolicyIds: [],
|
|
20
|
-
typePolicies: [],
|
|
21
|
-
typeProperties: [
|
|
22
|
-
{
|
|
23
|
-
pk: 2370,
|
|
24
|
-
id: '4hL2d44GPxAzmr1S',
|
|
25
|
-
createdOn: '2022-05-26T18:30:35.057Z',
|
|
26
|
-
updatedOn: '2023-05-05T21:17:06.810Z',
|
|
27
|
-
createdById: 'G5YQopiRBlfmnDn3',
|
|
28
|
-
updatedById: 'G5YQopiRBlfmnDn3',
|
|
29
|
-
isArchived: false,
|
|
30
|
-
orgId: 'Z5KDga-mUfxIXk21',
|
|
31
|
-
propertyType: 'string',
|
|
32
|
-
slug: 'overridableProp',
|
|
33
|
-
label: 'Overridable Prop',
|
|
34
|
-
editable: true,
|
|
35
|
-
core: false,
|
|
36
|
-
typePropertyOptionSetId: null,
|
|
37
|
-
typePropertyUserListId: null,
|
|
38
|
-
carryOverBehavior: null,
|
|
39
|
-
carryOverDefault: null,
|
|
40
|
-
copyBehavior: null,
|
|
41
|
-
copyDefault: null,
|
|
42
|
-
formula: null,
|
|
43
|
-
numberFormat: {
|
|
44
|
-
format: null,
|
|
45
|
-
currency: 'USD',
|
|
46
|
-
},
|
|
47
|
-
referencedTypeRootSlug: null,
|
|
48
|
-
referencedTypeRole: null,
|
|
49
|
-
referencedTypeFilterProperties: null,
|
|
50
|
-
referencedTypeId: null,
|
|
51
|
-
referencedTypePath: null,
|
|
52
|
-
defaultValue: null,
|
|
53
|
-
propertyLevel: 'overridable',
|
|
54
|
-
formulaFunction: null,
|
|
55
|
-
validationFunction: '',
|
|
56
|
-
description: null,
|
|
57
|
-
apiDetails: null,
|
|
58
|
-
notes: null,
|
|
59
|
-
searchable: false,
|
|
60
|
-
isFederationProperty: false,
|
|
61
|
-
isUniqueProperty: false,
|
|
62
|
-
isUniquePropertyInFamily: false,
|
|
63
|
-
required: false,
|
|
64
|
-
sequenceSeedValue: null,
|
|
65
|
-
optionsSet: null,
|
|
66
|
-
inherited: false,
|
|
67
|
-
used: true,
|
|
68
|
-
overriddenPropertySlugs: [],
|
|
69
|
-
typePropertyPolicyIds: [],
|
|
70
|
-
canRead: true,
|
|
71
|
-
canUpdate: true,
|
|
72
|
-
canDelete: true,
|
|
73
|
-
canCreate: true,
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
},
|
|
77
|
-
projectItem: {
|
|
78
|
-
pk: 1291,
|
|
79
|
-
id: 'ina_V3kyFcasfKXE',
|
|
80
|
-
createdOn: '2022-07-08T18:48:05.530Z',
|
|
81
|
-
updatedOn: '2022-07-08T18:48:05.530Z',
|
|
82
|
-
createdById: 'G5YQopiRBlfmnDn3',
|
|
83
|
-
updatedById: 'G5YQopiRBlfmnDn3',
|
|
84
|
-
isArchived: false,
|
|
85
|
-
orgId: 'Z5KDga-mUfxIXk21',
|
|
86
|
-
slug: 'project-item',
|
|
87
|
-
label: 'ProjectItem',
|
|
88
|
-
typePath: 'project-item',
|
|
89
|
-
typeRootId: 'AX-F0PADgcRGENr3',
|
|
90
|
-
parentId: null,
|
|
91
|
-
typePolicyIds: [],
|
|
92
|
-
typePolicies: [],
|
|
93
|
-
typeProperties: [
|
|
94
|
-
{
|
|
95
|
-
id: 'mkO5HfQAELNJ__Yt',
|
|
96
|
-
createdOn: '2022-07-16T15:49:03.102Z',
|
|
97
|
-
updatedOn: '2025-07-28T04:09:25.706Z',
|
|
98
|
-
createdById: 'G5YQopiRBlfmnDn3',
|
|
99
|
-
updatedById: 'G5YQopiRBlfmnDn3',
|
|
100
|
-
isArchived: false,
|
|
101
|
-
orgId: 'Z5KDga-mUfxIXk21',
|
|
102
|
-
propertyType: 'currency',
|
|
103
|
-
slug: 'outletPrice',
|
|
104
|
-
label: 'Outlet Price',
|
|
105
|
-
editable: true,
|
|
106
|
-
core: false,
|
|
107
|
-
typePropertyOptionSetId: null,
|
|
108
|
-
typePropertyUserListId: null,
|
|
109
|
-
carryOverBehavior: null,
|
|
110
|
-
carryOverDefault: null,
|
|
111
|
-
copyBehavior: null,
|
|
112
|
-
copyDefault: null,
|
|
113
|
-
formula: null,
|
|
114
|
-
numberFormat: {
|
|
115
|
-
format: 'currency',
|
|
116
|
-
currency: 'USD',
|
|
117
|
-
precision: 2,
|
|
118
|
-
},
|
|
119
|
-
referencedTypeRootSlug: null,
|
|
120
|
-
referencedTypeRole: null,
|
|
121
|
-
referencedTypeFilterProperties: null,
|
|
122
|
-
referencedTypeId: null,
|
|
123
|
-
referencedTypePath: null,
|
|
124
|
-
defaultValue: null,
|
|
125
|
-
propertyLevel: 'option',
|
|
126
|
-
formulaFunction: null,
|
|
127
|
-
validationFunction: '',
|
|
128
|
-
description: null,
|
|
129
|
-
apiDetails: null,
|
|
130
|
-
notes: null,
|
|
131
|
-
searchable: false,
|
|
132
|
-
isFederationProperty: false,
|
|
133
|
-
isUniqueProperty: false,
|
|
134
|
-
isUniquePropertyInFamily: false,
|
|
135
|
-
required: false,
|
|
136
|
-
sequenceSeedValue: null,
|
|
137
|
-
optionsSet: null,
|
|
138
|
-
inherited: false,
|
|
139
|
-
used: true,
|
|
140
|
-
overriddenPropertySlugs: [],
|
|
141
|
-
typePropertyPolicyIds: ['daLwIOoOfKEaAm9F'],
|
|
142
|
-
canRead: true,
|
|
143
|
-
canUpdate: true,
|
|
144
|
-
canDelete: false,
|
|
145
|
-
canCreate: false,
|
|
146
|
-
},
|
|
147
|
-
],
|
|
148
|
-
},
|
|
149
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const document_generator_1 = require("../document-generator");
|
|
13
|
-
const interfaces_1 = require("../interfaces");
|
|
14
|
-
const sdk_1 = require("@contrail/sdk");
|
|
15
|
-
const fs = require('fs');
|
|
16
|
-
const nanoid_1 = require("nanoid");
|
|
17
|
-
const data_grouping_1 = require("@contrail/data-grouping");
|
|
18
|
-
function run() {
|
|
19
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const orgSlug = 'nb-legacy-prod';
|
|
21
|
-
yield loginSDK(orgSlug);
|
|
22
|
-
const assortmentId = 'ejNEwWTgDPAtPoSY';
|
|
23
|
-
const itemType = yield new sdk_1.Types().getType({ path: 'item' });
|
|
24
|
-
const projectItemType = yield new sdk_1.Types().getType({ path: 'project-item' });
|
|
25
|
-
const assortmentItemType = yield new sdk_1.Types().getType({ path: 'assortment-item' });
|
|
26
|
-
const PROPERTY_COMPONENT_TEMPLATE = {
|
|
27
|
-
imageDimension: { width: 600 },
|
|
28
|
-
imageLocation: 'top',
|
|
29
|
-
textHorizontalAlignment: 'center',
|
|
30
|
-
properties: [
|
|
31
|
-
{
|
|
32
|
-
propertyDefinition: itemType.typeProperties.find((p) => p.slug === 'name'),
|
|
33
|
-
typeRootSlug: 'item',
|
|
34
|
-
slug: 'name',
|
|
35
|
-
style: {
|
|
36
|
-
font: {
|
|
37
|
-
size: 14,
|
|
38
|
-
weight: 'bold',
|
|
39
|
-
},
|
|
40
|
-
color: 'rgba(0,0,0,.5)',
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
propertyDefinition: itemType.typeProperties.find((p) => p.slug === 'optionName'),
|
|
45
|
-
typeRootSlug: 'item',
|
|
46
|
-
slug: 'optionName',
|
|
47
|
-
style: {
|
|
48
|
-
font: {
|
|
49
|
-
size: 10,
|
|
50
|
-
weight: 'bold',
|
|
51
|
-
},
|
|
52
|
-
color: 'green',
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
propertyDefinition: assortmentItemType.typeProperties.find((p) => p.slug === 'targetVolume'),
|
|
57
|
-
slug: 'targetVolume',
|
|
58
|
-
typeRootSlug: 'assortment-item',
|
|
59
|
-
includeLabel: true,
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
};
|
|
63
|
-
const PANEL_PROPERTY_TEMPLATE = {
|
|
64
|
-
properties: [
|
|
65
|
-
{
|
|
66
|
-
propertyDefinition: itemType.typeProperties.find((p) => p.slug === 'name'),
|
|
67
|
-
typeRootSlug: 'item',
|
|
68
|
-
slug: 'name',
|
|
69
|
-
includeLabel: false,
|
|
70
|
-
style: {
|
|
71
|
-
font: {
|
|
72
|
-
size: 25,
|
|
73
|
-
weight: 'bold',
|
|
74
|
-
},
|
|
75
|
-
color: 'white',
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
};
|
|
80
|
-
const documentTemplateDefinition = {
|
|
81
|
-
frameOrientation: interfaces_1.Orientation.HORIZONTAL,
|
|
82
|
-
frameSize: { width: 1200, height: 675 },
|
|
83
|
-
framePadding: 30,
|
|
84
|
-
frameGroupHeaderTemplate: {
|
|
85
|
-
style: {
|
|
86
|
-
color: '#ffffff',
|
|
87
|
-
font: {
|
|
88
|
-
size: 20,
|
|
89
|
-
},
|
|
90
|
-
backgroundColor: 'rgba(0, 0, 0, 0.8)',
|
|
91
|
-
},
|
|
92
|
-
size: {
|
|
93
|
-
height: 60,
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
frameInfoPanelTemplate: {
|
|
97
|
-
panelDocumentTemplate: {
|
|
98
|
-
style: {
|
|
99
|
-
color: '#ffffff',
|
|
100
|
-
font: {
|
|
101
|
-
size: 20,
|
|
102
|
-
},
|
|
103
|
-
backgroundColor: 'rgba(0, 0, 0, 0.8)',
|
|
104
|
-
border: {
|
|
105
|
-
radius: 4,
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
size: {
|
|
109
|
-
width: 250,
|
|
110
|
-
height: 400,
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
propertyTemplate: PANEL_PROPERTY_TEMPLATE,
|
|
114
|
-
},
|
|
115
|
-
componentGridTemplate: {
|
|
116
|
-
gridDimensions: { cols: 3, rows: 1 },
|
|
117
|
-
componentPadding: 5,
|
|
118
|
-
componentTemplate: {
|
|
119
|
-
propertyTemplate: PROPERTY_COMPONENT_TEMPLATE,
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
const groupingProperties = [
|
|
124
|
-
{
|
|
125
|
-
propertyDefinition: itemType.typeProperties.find((p) => p.slug === 'category'),
|
|
126
|
-
typeRootSlug: 'item',
|
|
127
|
-
sort: sdk_1.SortOrderOptions.ASC,
|
|
128
|
-
values: null,
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
propertyDefinition: itemType.typeProperties.find((p) => p.slug === 'name'),
|
|
132
|
-
typeRootSlug: 'item',
|
|
133
|
-
sort: sdk_1.SortOrderOptions.ASC,
|
|
134
|
-
values: null,
|
|
135
|
-
},
|
|
136
|
-
];
|
|
137
|
-
documentTemplateDefinition.componentGridTemplate.componentTemplate.propertyTemplate = PROPERTY_COMPONENT_TEMPLATE;
|
|
138
|
-
const dataGroup = yield getDataGroupStructure(assortmentId, groupingProperties, documentTemplateDefinition);
|
|
139
|
-
const params = {
|
|
140
|
-
startingCoordinates: { x: 500, y: 500 },
|
|
141
|
-
data: {
|
|
142
|
-
dataGroup,
|
|
143
|
-
},
|
|
144
|
-
documentTemplateDefinition,
|
|
145
|
-
};
|
|
146
|
-
const elements = document_generator_1.DocumentGenerator.generateDocumentElements(params, {});
|
|
147
|
-
const documentId = (0, nanoid_1.nanoid)(16);
|
|
148
|
-
elements.forEach((el) => {
|
|
149
|
-
el.id = (0, nanoid_1.nanoid)(16);
|
|
150
|
-
});
|
|
151
|
-
const document = {
|
|
152
|
-
size: { width: 1600, height: 900 },
|
|
153
|
-
elements,
|
|
154
|
-
id: documentId,
|
|
155
|
-
};
|
|
156
|
-
yield uploadAndOpen(orgSlug, document);
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
function loginSDK(orgSlug) {
|
|
160
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
-
const config = {
|
|
162
|
-
email: 'brian@vibeiq.com',
|
|
163
|
-
password: process.env.CONTRAIL_PW,
|
|
164
|
-
orgSlug: orgSlug,
|
|
165
|
-
};
|
|
166
|
-
yield (0, sdk_1.login)(config);
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
function getAssortmentItems(assortmentId) {
|
|
170
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
171
|
-
const assortment = yield new sdk_1.Entities().get({
|
|
172
|
-
entityName: 'assortment',
|
|
173
|
-
id: assortmentId,
|
|
174
|
-
relations: ['assortmentItems', 'assortmentItems.item', 'assortmentItems.projectItem'],
|
|
175
|
-
});
|
|
176
|
-
let assortmentItems = assortment.assortmentItems;
|
|
177
|
-
if (assortment.itemsDownloadURL) {
|
|
178
|
-
const response = yield fetch(assortment.itemsDownloadURL);
|
|
179
|
-
assortmentItems = yield response.json();
|
|
180
|
-
}
|
|
181
|
-
return assortmentItems;
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
function getDataGroupStructure(assortmentId, groupingProperties, template) {
|
|
185
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
186
|
-
const assortmentItems = yield getAssortmentItems(assortmentId);
|
|
187
|
-
const data = fromAssortmentModelToItemModel(assortmentItems);
|
|
188
|
-
const leafNodeDataCount = template.componentGridTemplate.gridDimensions.cols * template.componentGridTemplate.gridDimensions.rows;
|
|
189
|
-
return data_grouping_1.DataGroupGenerator.buildDataGroupStructure(data, groupingProperties, leafNodeDataCount);
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
function fromAssortmentModelToItemModel(data) {
|
|
193
|
-
const results = [];
|
|
194
|
-
data.forEach((ai) => {
|
|
195
|
-
results.push({
|
|
196
|
-
item: ai.item,
|
|
197
|
-
projectItem: ai.projectItem,
|
|
198
|
-
viewable: ai.item,
|
|
199
|
-
assortmentItem: ai,
|
|
200
|
-
assortment: { id: ai.assortmentId },
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
return results;
|
|
204
|
-
}
|
|
205
|
-
function uploadAndOpen(orgSlug, document) {
|
|
206
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
207
|
-
let config = (0, sdk_1.getConfig)();
|
|
208
|
-
var writeStream = fs.createWriteStream('testdocument.json');
|
|
209
|
-
writeStream.write(JSON.stringify(document));
|
|
210
|
-
writeStream.end();
|
|
211
|
-
const file = fs.createReadStream('testdocument.json');
|
|
212
|
-
const fileEntity = yield new sdk_1.Files().createAndUploadFileFromBuffer(file, 'application/json', 'testdocument.json', null, 300);
|
|
213
|
-
const domain = 'http://preview.vibeiq.com';
|
|
214
|
-
const authToken = config.apiUserToken;
|
|
215
|
-
const documentType = 'board';
|
|
216
|
-
let url = domain +
|
|
217
|
-
'?url=' +
|
|
218
|
-
encodeURIComponent(fileEntity.downloadUrl) +
|
|
219
|
-
'&orgSlug=' +
|
|
220
|
-
encodeURIComponent(orgSlug) +
|
|
221
|
-
'&apiToken=' +
|
|
222
|
-
encodeURIComponent(authToken) +
|
|
223
|
-
'&documentType=' +
|
|
224
|
-
encodeURIComponent(documentType);
|
|
225
|
-
var start = process.platform == 'darwin' ? 'open' : process.platform == 'win32' ? 'start' : 'xdg-open';
|
|
226
|
-
const encodedUrl = url.replace(/&/g, '^&');
|
|
227
|
-
require('child_process').exec(start + ' ' + encodedUrl);
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
run();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const interfaces_1 = require("../interfaces");
|
|
13
|
-
const sdk_1 = require("@contrail/sdk");
|
|
14
|
-
const fs = require('fs');
|
|
15
|
-
const data_grouping_1 = require("@contrail/data-grouping");
|
|
16
|
-
const showcase_frame_generator_1 = require("../showcase-frame-generator");
|
|
17
|
-
function run() {
|
|
18
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
const orgSlug = 'converse-prod';
|
|
20
|
-
yield loginSDK(orgSlug);
|
|
21
|
-
const assortmentId = 'Z7nTOauGtuuiU9UC';
|
|
22
|
-
const itemType = yield new sdk_1.Types().getType({ path: 'item' });
|
|
23
|
-
const projectItemType = yield new sdk_1.Types().getType({ path: 'project-item' });
|
|
24
|
-
const PROPERTY_COMPONENT_TEMPLATE = {
|
|
25
|
-
imageDimension: { width: 600 },
|
|
26
|
-
imageLocation: 'top',
|
|
27
|
-
textHorizontalAlignment: 'center',
|
|
28
|
-
properties: [
|
|
29
|
-
{
|
|
30
|
-
propertyDefinition: itemType.typeProperties.find((p) => p.slug === 'name'),
|
|
31
|
-
typeRootSlug: 'item',
|
|
32
|
-
slug: 'name',
|
|
33
|
-
style: {
|
|
34
|
-
font: {
|
|
35
|
-
size: 14,
|
|
36
|
-
weight: 'bold',
|
|
37
|
-
},
|
|
38
|
-
color: 'rgba(0,0,0,.5)',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
propertyDefinition: itemType.typeProperties.find((p) => p.slug === 'optionName'),
|
|
43
|
-
typeRootSlug: 'item',
|
|
44
|
-
slug: 'optionName',
|
|
45
|
-
style: {
|
|
46
|
-
font: {
|
|
47
|
-
size: 10,
|
|
48
|
-
weight: 'bold',
|
|
49
|
-
},
|
|
50
|
-
color: 'green',
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
propertyDefinition: itemType.typeProperties.find((p) => p.slug === 'category'),
|
|
55
|
-
typeRootSlug: 'item',
|
|
56
|
-
slug: 'category',
|
|
57
|
-
includeLabel: true,
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
propertyDefinition: itemType.typeProperties.find((p) => p.slug === 'designTheme'),
|
|
61
|
-
typeRootSlug: 'item',
|
|
62
|
-
slug: 'designTheme',
|
|
63
|
-
includeLabel: true,
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
propertyDefinition: itemType.typeProperties.find((p) => p.slug === 'baseStyleNumber'),
|
|
67
|
-
typeRootSlug: 'item',
|
|
68
|
-
slug: 'baseStyleNumber',
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
propertyDefinition: projectItemType.typeProperties.find((p) => p.slug === 'colorwayStatus'),
|
|
72
|
-
slug: 'colorwayStatus',
|
|
73
|
-
typeRootSlug: 'project-item',
|
|
74
|
-
includeLabel: true,
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
};
|
|
78
|
-
const PANEL_PROPERTY_TEMPLATE = {
|
|
79
|
-
properties: [
|
|
80
|
-
{
|
|
81
|
-
propertyDefinition: itemType.typeProperties.find((p) => p.slug === 'name'),
|
|
82
|
-
typeRootSlug: 'item',
|
|
83
|
-
slug: 'name',
|
|
84
|
-
includeLabel: false,
|
|
85
|
-
style: {
|
|
86
|
-
font: {
|
|
87
|
-
size: 25,
|
|
88
|
-
weight: 'bold',
|
|
89
|
-
},
|
|
90
|
-
color: 'white',
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
propertyDefinition: itemType.typeProperties.find((p) => p.slug === 'segment'),
|
|
95
|
-
typeRootSlug: 'item',
|
|
96
|
-
slug: 'segment',
|
|
97
|
-
includeLabel: true,
|
|
98
|
-
style: {
|
|
99
|
-
font: {
|
|
100
|
-
size: 14,
|
|
101
|
-
},
|
|
102
|
-
color: 'white',
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
propertyDefinition: itemType.typeProperties.find((p) => p.slug === 'familyName'),
|
|
107
|
-
typeRootSlug: 'item',
|
|
108
|
-
slug: 'familyName',
|
|
109
|
-
includeLabel: true,
|
|
110
|
-
style: {
|
|
111
|
-
font: {
|
|
112
|
-
size: 14,
|
|
113
|
-
},
|
|
114
|
-
color: 'white',
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
propertyDefinition: itemType.typeProperties.find((p) => p.slug === 'ageGroup'),
|
|
119
|
-
typeRootSlug: 'item',
|
|
120
|
-
slug: 'ageGroup',
|
|
121
|
-
includeLabel: true,
|
|
122
|
-
style: {
|
|
123
|
-
font: {
|
|
124
|
-
size: 14,
|
|
125
|
-
},
|
|
126
|
-
color: 'white',
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
propertyDefinition: itemType.typeProperties.find((p) => p.slug === 'planningLevel1'),
|
|
131
|
-
typeRootSlug: 'item',
|
|
132
|
-
slug: 'planningLevel1',
|
|
133
|
-
includeLabel: true,
|
|
134
|
-
style: {
|
|
135
|
-
font: {
|
|
136
|
-
size: 14,
|
|
137
|
-
},
|
|
138
|
-
color: 'white',
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
};
|
|
143
|
-
const documentTemplateDefinition = {
|
|
144
|
-
frameOrientation: interfaces_1.Orientation.HORIZONTAL,
|
|
145
|
-
frameSize: { width: 1200, height: 675 },
|
|
146
|
-
framePadding: 30,
|
|
147
|
-
frameGroupHeaderTemplate: {
|
|
148
|
-
style: {
|
|
149
|
-
color: '#ffffff',
|
|
150
|
-
font: {
|
|
151
|
-
size: 20,
|
|
152
|
-
},
|
|
153
|
-
backgroundColor: 'rgba(0, 0, 0, 0.8)',
|
|
154
|
-
},
|
|
155
|
-
size: {
|
|
156
|
-
height: 60,
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
frameInfoPanelTemplate: {
|
|
160
|
-
panelDocumentTemplate: {
|
|
161
|
-
style: {
|
|
162
|
-
color: '#ffffff',
|
|
163
|
-
font: {
|
|
164
|
-
size: 20,
|
|
165
|
-
},
|
|
166
|
-
backgroundColor: 'rgba(0, 0, 0, 0.8)',
|
|
167
|
-
border: {
|
|
168
|
-
radius: 4,
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
size: {
|
|
172
|
-
width: 250,
|
|
173
|
-
height: 400,
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
propertyTemplate: PANEL_PROPERTY_TEMPLATE,
|
|
177
|
-
},
|
|
178
|
-
componentGridTemplate: {
|
|
179
|
-
gridDimensions: { cols: 3, rows: 1 },
|
|
180
|
-
componentPadding: 5,
|
|
181
|
-
componentTemplate: {
|
|
182
|
-
propertyTemplate: PROPERTY_COMPONENT_TEMPLATE,
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
};
|
|
186
|
-
const groupingProperties = [
|
|
187
|
-
{
|
|
188
|
-
propertyDefinition: itemType.typeProperties.find((p) => p.slug === 'category'),
|
|
189
|
-
typeRootSlug: 'item',
|
|
190
|
-
sort: sdk_1.SortOrderOptions.ASC,
|
|
191
|
-
values: null,
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
propertyDefinition: itemType.typeProperties.find((p) => p.slug === 'name'),
|
|
195
|
-
typeRootSlug: 'item',
|
|
196
|
-
sort: sdk_1.SortOrderOptions.ASC,
|
|
197
|
-
values: null,
|
|
198
|
-
},
|
|
199
|
-
];
|
|
200
|
-
documentTemplateDefinition.componentGridTemplate.componentTemplate.propertyTemplate = PROPERTY_COMPONENT_TEMPLATE;
|
|
201
|
-
const dataGroup = yield getDataGroupStructure(assortmentId, groupingProperties, documentTemplateDefinition);
|
|
202
|
-
const params = {
|
|
203
|
-
startingCoordinates: { x: 500, y: 500 },
|
|
204
|
-
data: {
|
|
205
|
-
dataGroup,
|
|
206
|
-
},
|
|
207
|
-
documentTemplateDefinition,
|
|
208
|
-
};
|
|
209
|
-
const frames = showcase_frame_generator_1.ShowcaseFrameGenerator.generateFrames(params);
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
function loginSDK(orgSlug) {
|
|
213
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
214
|
-
const config = {
|
|
215
|
-
email: 'brian@vibeiq.com',
|
|
216
|
-
password: process.env.CONTRAIL_PW,
|
|
217
|
-
orgSlug: orgSlug,
|
|
218
|
-
};
|
|
219
|
-
yield (0, sdk_1.login)(config);
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
function getAssortmentItems(assortmentId) {
|
|
223
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
224
|
-
const assortment = yield new sdk_1.Entities().get({
|
|
225
|
-
entityName: 'assortment',
|
|
226
|
-
id: assortmentId,
|
|
227
|
-
relations: ['assortmentItems', 'assortmentItems.item', 'assortmentItems.projectItem'],
|
|
228
|
-
});
|
|
229
|
-
let assortmentItems = assortment.assortmentItems;
|
|
230
|
-
if (assortment.itemsDownloadURL) {
|
|
231
|
-
const response = yield fetch(assortment.itemsDownloadURL);
|
|
232
|
-
assortmentItems = yield response.json();
|
|
233
|
-
}
|
|
234
|
-
return assortmentItems;
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
function getDataGroupStructure(assortmentId, groupingProperties, template) {
|
|
238
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
239
|
-
const assortmentItems = yield getAssortmentItems(assortmentId);
|
|
240
|
-
const data = fromAssortmentModelToItemModel(assortmentItems);
|
|
241
|
-
const leafNodeDataCount = template.componentGridTemplate.gridDimensions.cols * template.componentGridTemplate.gridDimensions.rows;
|
|
242
|
-
return data_grouping_1.DataGroupGenerator.buildDataGroupStructure(data, groupingProperties, leafNodeDataCount);
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
function fromAssortmentModelToItemModel(data) {
|
|
246
|
-
const results = [];
|
|
247
|
-
data.forEach((ai) => {
|
|
248
|
-
results.push({
|
|
249
|
-
item: ai.item,
|
|
250
|
-
projectItem: ai.projectItem,
|
|
251
|
-
viewable: ai.item,
|
|
252
|
-
assortmentItem: ai,
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
|
-
return results;
|
|
256
|
-
}
|
|
257
|
-
run();
|
package/lib/test-data.d.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { DataGroupStructure } from '@contrail/data-grouping';
|
|
2
|
-
import { ComponentGridTemplate, DocumentTemplate } from './interfaces';
|
|
3
|
-
export declare const TEST_ITEM_MODEL: {
|
|
4
|
-
item: {
|
|
5
|
-
id: string;
|
|
6
|
-
name: string;
|
|
7
|
-
optionName: string;
|
|
8
|
-
gender: string;
|
|
9
|
-
mediumViewableDownloadUrl: string;
|
|
10
|
-
};
|
|
11
|
-
projectItem: {
|
|
12
|
-
id: string;
|
|
13
|
-
retailPrice: number;
|
|
14
|
-
};
|
|
15
|
-
assortmentItem: {
|
|
16
|
-
id: string;
|
|
17
|
-
targetVolume: number;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export declare const TEST_GROUP: {
|
|
21
|
-
name: string;
|
|
22
|
-
data: {
|
|
23
|
-
item: {
|
|
24
|
-
id: string;
|
|
25
|
-
name: string;
|
|
26
|
-
optionName: string;
|
|
27
|
-
gender: string;
|
|
28
|
-
mediumViewableDownloadUrl: string;
|
|
29
|
-
};
|
|
30
|
-
projectItem: {
|
|
31
|
-
id: string;
|
|
32
|
-
retailPrice: number;
|
|
33
|
-
};
|
|
34
|
-
assortmentItem: {
|
|
35
|
-
id: string;
|
|
36
|
-
targetVolume: number;
|
|
37
|
-
};
|
|
38
|
-
}[];
|
|
39
|
-
propertyValues: {
|
|
40
|
-
gender: string;
|
|
41
|
-
};
|
|
42
|
-
subGroups: any[];
|
|
43
|
-
};
|
|
44
|
-
export declare const TEST_GROUP_2: {
|
|
45
|
-
name: string;
|
|
46
|
-
data: {
|
|
47
|
-
item: {
|
|
48
|
-
id: string;
|
|
49
|
-
name: string;
|
|
50
|
-
optionName: string;
|
|
51
|
-
gender: string;
|
|
52
|
-
mediumViewableDownloadUrl: string;
|
|
53
|
-
};
|
|
54
|
-
projectItem: {
|
|
55
|
-
id: string;
|
|
56
|
-
retailPrice: number;
|
|
57
|
-
};
|
|
58
|
-
assortmentItem: {
|
|
59
|
-
id: string;
|
|
60
|
-
targetVolume: number;
|
|
61
|
-
};
|
|
62
|
-
}[];
|
|
63
|
-
propertyValues: {
|
|
64
|
-
gender: string;
|
|
65
|
-
};
|
|
66
|
-
subGroups: any[];
|
|
67
|
-
};
|
|
68
|
-
export declare const TEST_ROOT_GROUP: DataGroupStructure;
|
|
69
|
-
export declare const TEST_TWO_LEVEL_ROOT_GROUP: DataGroupStructure;
|
|
70
|
-
export declare const COMPONENT_GRID_TEMPLATE: ComponentGridTemplate;
|
|
71
|
-
export declare const HORIZONTAL_DOCUMENT_TEMPLATE: DocumentTemplate;
|
|
72
|
-
export declare const VERTICAL_DOCUMENT_TEMPLATE: DocumentTemplate;
|
package/lib/test-data.js
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VERTICAL_DOCUMENT_TEMPLATE = exports.HORIZONTAL_DOCUMENT_TEMPLATE = exports.COMPONENT_GRID_TEMPLATE = exports.TEST_TWO_LEVEL_ROOT_GROUP = exports.TEST_ROOT_GROUP = exports.TEST_GROUP_2 = exports.TEST_GROUP = exports.TEST_ITEM_MODEL = void 0;
|
|
4
|
-
const types_1 = require("@contrail/types");
|
|
5
|
-
const interfaces_1 = require("./interfaces");
|
|
6
|
-
const sdk_1 = require("@contrail/sdk");
|
|
7
|
-
exports.TEST_ITEM_MODEL = {
|
|
8
|
-
item: {
|
|
9
|
-
id: 'item-1001',
|
|
10
|
-
name: 'Shirt 1',
|
|
11
|
-
optionName: 'Red',
|
|
12
|
-
gender: 'mens',
|
|
13
|
-
mediumViewableDownloadUrl: 'https://api.dev.vibeiq.com/dev/api/files/downloadUrl/-VMrLJrt3clDKPi0%2Fcontent:m3Bd4u-QLci1XiOl%2F2b72d48a-6b19-4ba8-9d54-813745fb8dd4.png',
|
|
14
|
-
},
|
|
15
|
-
projectItem: {
|
|
16
|
-
id: 'projectItem-1001',
|
|
17
|
-
retailPrice: 45.0,
|
|
18
|
-
},
|
|
19
|
-
assortmentItem: {
|
|
20
|
-
id: 'assortmentItem-1001',
|
|
21
|
-
targetVolume: 1000,
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
exports.TEST_GROUP = {
|
|
25
|
-
name: 'Mens',
|
|
26
|
-
data: [
|
|
27
|
-
exports.TEST_ITEM_MODEL,
|
|
28
|
-
exports.TEST_ITEM_MODEL,
|
|
29
|
-
exports.TEST_ITEM_MODEL,
|
|
30
|
-
exports.TEST_ITEM_MODEL,
|
|
31
|
-
exports.TEST_ITEM_MODEL,
|
|
32
|
-
exports.TEST_ITEM_MODEL,
|
|
33
|
-
exports.TEST_ITEM_MODEL,
|
|
34
|
-
exports.TEST_ITEM_MODEL,
|
|
35
|
-
exports.TEST_ITEM_MODEL,
|
|
36
|
-
exports.TEST_ITEM_MODEL,
|
|
37
|
-
],
|
|
38
|
-
propertyValues: {
|
|
39
|
-
gender: 'mens',
|
|
40
|
-
},
|
|
41
|
-
subGroups: [],
|
|
42
|
-
};
|
|
43
|
-
exports.TEST_GROUP_2 = {
|
|
44
|
-
name: 'Womens',
|
|
45
|
-
data: [
|
|
46
|
-
exports.TEST_ITEM_MODEL,
|
|
47
|
-
exports.TEST_ITEM_MODEL,
|
|
48
|
-
exports.TEST_ITEM_MODEL,
|
|
49
|
-
exports.TEST_ITEM_MODEL,
|
|
50
|
-
exports.TEST_ITEM_MODEL,
|
|
51
|
-
exports.TEST_ITEM_MODEL,
|
|
52
|
-
exports.TEST_ITEM_MODEL,
|
|
53
|
-
],
|
|
54
|
-
propertyValues: {
|
|
55
|
-
gender: 'womens',
|
|
56
|
-
},
|
|
57
|
-
subGroups: [],
|
|
58
|
-
};
|
|
59
|
-
exports.TEST_ROOT_GROUP = {
|
|
60
|
-
depth: 1,
|
|
61
|
-
groupingProperties: [
|
|
62
|
-
{
|
|
63
|
-
propertyDefinition: {
|
|
64
|
-
slug: 'gender',
|
|
65
|
-
propertyType: types_1.PropertyType.SingleSelect,
|
|
66
|
-
label: 'Gender',
|
|
67
|
-
},
|
|
68
|
-
sort: sdk_1.SortOrderOptions.ASC,
|
|
69
|
-
typeRootSlug: 'item',
|
|
70
|
-
values: null,
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
rootGroup: {
|
|
74
|
-
data: [],
|
|
75
|
-
subGroups: [exports.TEST_GROUP, exports.TEST_GROUP, exports.TEST_GROUP],
|
|
76
|
-
name: 'Root',
|
|
77
|
-
propertyValues: {},
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
exports.TEST_TWO_LEVEL_ROOT_GROUP = {
|
|
81
|
-
depth: 2,
|
|
82
|
-
groupingProperties: [
|
|
83
|
-
{
|
|
84
|
-
propertyDefinition: {
|
|
85
|
-
slug: 'gender',
|
|
86
|
-
propertyType: types_1.PropertyType.SingleSelect,
|
|
87
|
-
label: 'Gender',
|
|
88
|
-
},
|
|
89
|
-
sort: sdk_1.SortOrderOptions.ASC,
|
|
90
|
-
typeRootSlug: 'item',
|
|
91
|
-
values: null,
|
|
92
|
-
},
|
|
93
|
-
],
|
|
94
|
-
rootGroup: {
|
|
95
|
-
data: [],
|
|
96
|
-
subGroups: [
|
|
97
|
-
{
|
|
98
|
-
name: 'Mens',
|
|
99
|
-
subGroups: [exports.TEST_GROUP, exports.TEST_GROUP],
|
|
100
|
-
propertyValues: {
|
|
101
|
-
gender: 'mens',
|
|
102
|
-
},
|
|
103
|
-
data: [],
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
name: 'Womens',
|
|
107
|
-
subGroups: [exports.TEST_GROUP_2, exports.TEST_GROUP_2, exports.TEST_GROUP_2, exports.TEST_GROUP_2],
|
|
108
|
-
propertyValues: {
|
|
109
|
-
gender: 'mens',
|
|
110
|
-
},
|
|
111
|
-
data: [],
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
name: 'Root',
|
|
115
|
-
propertyValues: {},
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
exports.COMPONENT_GRID_TEMPLATE = {
|
|
119
|
-
gridDimensions: { cols: 7, rows: 3 },
|
|
120
|
-
componentTemplate: {
|
|
121
|
-
propertyTemplate: {
|
|
122
|
-
properties: [],
|
|
123
|
-
imageLocation: 'top',
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
componentPadding: 20,
|
|
127
|
-
};
|
|
128
|
-
exports.HORIZONTAL_DOCUMENT_TEMPLATE = {
|
|
129
|
-
frameOrientation: interfaces_1.Orientation.HORIZONTAL,
|
|
130
|
-
frameSize: { width: 1200, height: 675 },
|
|
131
|
-
framePadding: 30,
|
|
132
|
-
frameHeaderTemplate: {
|
|
133
|
-
style: {
|
|
134
|
-
color: '#000000',
|
|
135
|
-
font: {
|
|
136
|
-
size: 20,
|
|
137
|
-
},
|
|
138
|
-
backgroundColor: '#FFFFFF',
|
|
139
|
-
},
|
|
140
|
-
size: {
|
|
141
|
-
height: 60,
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
frameGroupHeaderTemplate: {
|
|
145
|
-
style: {
|
|
146
|
-
color: '#ffffff',
|
|
147
|
-
font: {
|
|
148
|
-
size: 20,
|
|
149
|
-
},
|
|
150
|
-
backgroundColor: 'black',
|
|
151
|
-
},
|
|
152
|
-
size: {
|
|
153
|
-
height: 60,
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
componentGridTemplate: exports.COMPONENT_GRID_TEMPLATE,
|
|
157
|
-
};
|
|
158
|
-
exports.VERTICAL_DOCUMENT_TEMPLATE = {
|
|
159
|
-
frameOrientation: interfaces_1.Orientation.VERTICAL,
|
|
160
|
-
frameSize: { width: 1200, height: 675 },
|
|
161
|
-
framePadding: 30,
|
|
162
|
-
frameHeaderTemplate: {
|
|
163
|
-
style: {
|
|
164
|
-
color: '#000000',
|
|
165
|
-
font: {
|
|
166
|
-
size: 20,
|
|
167
|
-
},
|
|
168
|
-
backgroundColor: '#FFFFFF',
|
|
169
|
-
},
|
|
170
|
-
size: {
|
|
171
|
-
height: 60,
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
frameGroupHeaderTemplate: {
|
|
175
|
-
style: {
|
|
176
|
-
color: '#ffffff',
|
|
177
|
-
font: {
|
|
178
|
-
size: 20,
|
|
179
|
-
},
|
|
180
|
-
backgroundColor: 'black',
|
|
181
|
-
},
|
|
182
|
-
size: {
|
|
183
|
-
height: 60,
|
|
184
|
-
},
|
|
185
|
-
},
|
|
186
|
-
componentGridTemplate: exports.COMPONENT_GRID_TEMPLATE,
|
|
187
|
-
};
|