@inizioevoke/veeva-astroclm-core 1.4.5 → 1.4.7
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/dist/tasks/copy-files.js +1 -0
- package/dist/tasks/create-csv.js +11 -2
- package/dist/types/config.d.ts +1 -0
- package/dist/types/veeva.d.ts +2 -1
- package/package.json +1 -1
- package/src/tasks/copy-files.ts +1 -0
- package/src/tasks/create-csv.ts +17 -4
- package/src/types/config.d.ts +1 -0
- package/src/types/veeva.d.ts +2 -1
package/dist/tasks/copy-files.js
CHANGED
|
@@ -5,6 +5,7 @@ export default async function ({ config, rootDir, astroDistDir, deployDir }) {
|
|
|
5
5
|
logger.info(`Copying files to ${deployDir.replace(rootDir, '')}`);
|
|
6
6
|
const dirContent = await readdir(astroDistDir, { withFileTypes: true });
|
|
7
7
|
for (const c of dirContent) {
|
|
8
|
+
//@ts-ignore
|
|
8
9
|
if (c.isDirectory() && (c.name === 'shared' || config.presentation.slides.find(s => s.path === c.name))) {
|
|
9
10
|
await cp(join(c.parentPath, c.name), join(deployDir, c.name), { recursive: true });
|
|
10
11
|
if (c.name === 'shared') {
|
package/dist/tasks/create-csv.js
CHANGED
|
@@ -31,6 +31,15 @@ export default async function ({ config, deployDir, buildName, fieldsOnly = fals
|
|
|
31
31
|
headers.push(a.header);
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
+
if (config.replaceHeaders) {
|
|
35
|
+
const keys = Object.keys(config.replaceHeaders);
|
|
36
|
+
for (const key of keys) {
|
|
37
|
+
const i = headers.findIndex(h => h === key);
|
|
38
|
+
if (i > -1) {
|
|
39
|
+
headers[i] = config.replaceHeaders[key];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
34
43
|
const presentation = config.presentation;
|
|
35
44
|
for (const [key, header] of Object.entries(BINDER_PRES_HEADERS)) {
|
|
36
45
|
if (presentation[key]) {
|
|
@@ -44,11 +53,11 @@ export default async function ({ config, deployDir, buildName, fieldsOnly = fals
|
|
|
44
53
|
}
|
|
45
54
|
const rows = [headers];
|
|
46
55
|
rows.push(createPresentationRow(headers, config, additional?.presentation));
|
|
56
|
+
const shared = createSharedRow(headers, config, additional?.shared);
|
|
57
|
+
shared && rows.push(shared);
|
|
47
58
|
for (let i = 0; i < config.presentation.slides.length; i++) {
|
|
48
59
|
rows.push(createSlideRow(headers, config, config.presentation.slides[i], additional?.slides));
|
|
49
60
|
}
|
|
50
|
-
const shared = createSharedRow(headers, config, additional?.shared);
|
|
51
|
-
shared && rows.push(shared);
|
|
52
61
|
await writeFile(join(deployDir, `_${config.presentation.presentationId}_${buildName}.csv`), rows.map((r) => { return r.join(','); }).join('\n'), { encoding: 'utf8' });
|
|
53
62
|
}
|
|
54
63
|
function filterAdditionalFields(config, additionalFields) {
|
package/dist/types/config.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ export interface IVeevaConfig {
|
|
|
55
55
|
dimensions: { width: number, height: number };
|
|
56
56
|
slideSettings?: IVeevaClmSlideSettings; // legacy support
|
|
57
57
|
thumbnails?: IThumbnailSettings | IScreenshotSettings | IScreenshotSettings[];
|
|
58
|
+
replaceHeaders?: Record<string, string>;
|
|
58
59
|
|
|
59
60
|
presentation: IVeevaConfigPresentation & {
|
|
60
61
|
name: string;
|
package/dist/types/veeva.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export type MediaType = "HTML" | "Image" | "Video" | "PPTX" | "PDF";
|
|
|
2
2
|
export type iOSResolution = "Default For Device" | "Scale To 1024x768" | "Scale To Fit";
|
|
3
3
|
export type Actions = "Swipe" | "Pinch to Exit" | "Zoom" | "Rotation Lock" | "History Buttons" | "Navigation Bar" | "Reactions";
|
|
4
4
|
export type CrmTarget = 'Salesforce' | 'Vault';
|
|
5
|
+
export type DateStringYYYYMMDD = `${number}${number}${number}${number}-${number}${number}-${number}${number}`;
|
|
5
6
|
|
|
6
7
|
export interface VeevaIdField<T = string> {
|
|
7
8
|
id: T;
|
|
@@ -21,7 +22,7 @@ export interface IVeevaClmBinderFields {
|
|
|
21
22
|
crmContentGroup?: VeevaIdField<string | string[]>;
|
|
22
23
|
crmDetailGroup?: VeevaIdField;
|
|
23
24
|
detailGroup?: string;
|
|
24
|
-
expirationDate?:
|
|
25
|
+
expirationDate?: DateStringYYYYMMDD;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
|
package/package.json
CHANGED
package/src/tasks/copy-files.ts
CHANGED
|
@@ -18,6 +18,7 @@ export default async function({ config, rootDir, astroDistDir, deployDir }: Para
|
|
|
18
18
|
|
|
19
19
|
const dirContent = await readdir(astroDistDir, { withFileTypes: true });
|
|
20
20
|
for(const c of dirContent) {
|
|
21
|
+
//@ts-ignore
|
|
21
22
|
if (c.isDirectory() && (c.name === 'shared' || config.presentation.slides.find(s => s.path === c.name))) {
|
|
22
23
|
await cp(join(c.parentPath, c.name), join(deployDir, c.name), { recursive: true });
|
|
23
24
|
|
package/src/tasks/create-csv.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { join } from 'node:path';
|
|
|
3
3
|
import type { IVeevaConfig, IVeevaConfigSlide, Actions, IVeevaClmBinderFields } from '../types';
|
|
4
4
|
import logger from '../lib/logger.js';
|
|
5
5
|
import { pathToSlideZip } from '../lib/utils.js';
|
|
6
|
+
import console from 'node:console';
|
|
6
7
|
|
|
7
8
|
export interface AdditionalField {
|
|
8
9
|
header: string;
|
|
@@ -53,26 +54,38 @@ export default async function({ config, deployDir, buildName, fieldsOnly = false
|
|
|
53
54
|
headers.push(a.header);
|
|
54
55
|
}
|
|
55
56
|
});
|
|
57
|
+
|
|
58
|
+
if (config.replaceHeaders) {
|
|
59
|
+
const keys = Object.keys(config.replaceHeaders) as (keyof typeof config.replaceHeaders)[];
|
|
60
|
+
for (const key of keys) {
|
|
61
|
+
const i = headers.findIndex(h => h === key);
|
|
62
|
+
if (i > -1) {
|
|
63
|
+
headers[i] = config.replaceHeaders[key];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
56
67
|
const presentation = config.presentation;
|
|
57
68
|
|
|
58
69
|
for (const [key, header] of Object.entries(BINDER_PRES_HEADERS)) {
|
|
59
|
-
if (presentation
|
|
70
|
+
if ((presentation as any)[key]) {
|
|
60
71
|
headers.push(header);
|
|
61
72
|
}
|
|
62
73
|
}
|
|
63
74
|
for (const [key, header] of Object.entries(BINDER_SLIDE_HEADERS)) {
|
|
64
|
-
if (presentation.slideSettings?.[key
|
|
75
|
+
if ((presentation.slideSettings as any)?.[key] || (config.slideSettings as any)?.[key]) {
|
|
65
76
|
headers.push(header);
|
|
66
77
|
}
|
|
67
78
|
}
|
|
68
79
|
|
|
69
80
|
const rows: string[][] = [headers];
|
|
70
81
|
rows.push(createPresentationRow(headers, config, additional?.presentation));
|
|
82
|
+
|
|
83
|
+
const shared = createSharedRow(headers, config, additional?.shared);
|
|
84
|
+
shared && rows.push(shared);
|
|
85
|
+
|
|
71
86
|
for (let i=0; i<config.presentation.slides.length; i++) {
|
|
72
87
|
rows.push(createSlideRow(headers, config, config.presentation.slides[i], additional?.slides));
|
|
73
88
|
}
|
|
74
|
-
const shared = createSharedRow(headers, config, additional?.shared);
|
|
75
|
-
shared && rows.push(shared);
|
|
76
89
|
|
|
77
90
|
await writeFile(join(deployDir, `_${config.presentation.presentationId}_${buildName}.csv`), rows.map((r)=>{return r.join(',');}).join('\n'), { encoding: 'utf8' });
|
|
78
91
|
}
|
package/src/types/config.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ export interface IVeevaConfig {
|
|
|
55
55
|
dimensions: { width: number, height: number };
|
|
56
56
|
slideSettings?: IVeevaClmSlideSettings; // legacy support
|
|
57
57
|
thumbnails?: IThumbnailSettings | IScreenshotSettings | IScreenshotSettings[];
|
|
58
|
+
replaceHeaders?: Record<string, string>;
|
|
58
59
|
|
|
59
60
|
presentation: IVeevaConfigPresentation & {
|
|
60
61
|
name: string;
|
package/src/types/veeva.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export type MediaType = "HTML" | "Image" | "Video" | "PPTX" | "PDF";
|
|
|
2
2
|
export type iOSResolution = "Default For Device" | "Scale To 1024x768" | "Scale To Fit";
|
|
3
3
|
export type Actions = "Swipe" | "Pinch to Exit" | "Zoom" | "Rotation Lock" | "History Buttons" | "Navigation Bar" | "Reactions";
|
|
4
4
|
export type CrmTarget = 'Salesforce' | 'Vault';
|
|
5
|
+
export type DateStringYYYYMMDD = `${number}${number}${number}${number}-${number}${number}-${number}${number}`;
|
|
5
6
|
|
|
6
7
|
export interface VeevaIdField<T = string> {
|
|
7
8
|
id: T;
|
|
@@ -21,7 +22,7 @@ export interface IVeevaClmBinderFields {
|
|
|
21
22
|
crmContentGroup?: VeevaIdField<string | string[]>;
|
|
22
23
|
crmDetailGroup?: VeevaIdField;
|
|
23
24
|
detailGroup?: string;
|
|
24
|
-
expirationDate?:
|
|
25
|
+
expirationDate?: DateStringYYYYMMDD;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
|