@inizioevoke/veeva-astroclm 1.1.4 → 1.1.6

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.
@@ -194,7 +194,7 @@ import { Modal, ModalTrigger } from '@inizioevoke/astro-core';
194
194
 
195
195
  **Modal props:** `id` (required), `closeButton` (`'default'|'minimal'|'none'|false`), `closeButtonAtts`
196
196
  **ModalTrigger props:** `modal` (id, required), `animation?`
197
- Slots: default (inside wrapper), `close` (close button label), `outer` (full-bleed outside wrapper)
197
+ Slots: default (inside wrapper), `close` (close button label), `outer` (full-bleed outside wrapper), `inner-before`/`inner-after` (inside wrapper, before/after default slot)
198
198
 
199
199
  **Client-side JS**:
200
200
  ```ts
package/README.md CHANGED
@@ -34,28 +34,34 @@ Valid values: `standard`, `left-nav`, `top-nav`, `empty`.
34
34
 
35
35
  ```
36
36
  .
37
- ├── astro.config.ts Astro config + env schema + pruneBuild integration
38
- ├── veeva-config.ts Presentation metadata, slides, binder fields (created via veeva-config)
39
- ├── veeva-metadata.js Browser-console script that bulk-updates Veeva PromoMats fields
40
- ├── .env.development LOG_LEVEL, WEB_ENV, WEB_SCALING for `astro dev`
41
- ├── .env.veeva-client BUILD_TARGET for client builds/deploys
42
- ├── .env.veeva-client-training BUILD_TARGET + VEEVA_TRAINING for training builds
43
- ├── .env.veeva-evoke BUILD_TARGET + VEEVA_ENV="evoke" for internal builds
44
- ├── bin/create.js Scaffolder entry point
37
+ ├── deploy/ Generated Veeva CLM packages, one subfolder per `.env.veeva-*` target
38
+ ├── public/shared/ Static assets served under /shared/
39
+ ├── src/
40
+ │ ├── components/
41
+ │ │ ├── content/ Shared popups, charts, CTAs, etc. specific to this presentation
42
+ │ │ ├── isi/ Important Safety Information content blocks
43
+ │ │ ├── nav/ Navigation (NavList + presentation-specific nav components)
44
+ │ │ ├── svg/ Inline <svg> components
45
+ │ │ └── ui/ Generic, reusable building blocks (Link, Image, Button, ...)
46
+ │ ├── contents/ Per-slide content modules imported by pages
47
+ │ ├── layouts/ GlobalLayout, LeftNavLayout, TopNavLayout, ...
48
+ │ ├── lib/{client,server}/ Shared client + server helpers (IVA config lives here)
49
+ │ ├── pages/ Astro route entries (one file per slide)
50
+ │ ├── scss/ Shared SCSS (_mixins, _variables, ipads.scss)
51
+ │ ├── shared/img/ Shared image assets
52
+ │ └── data/pages.tsx Page registry / nav data
45
53
  ├── tasks/
46
- │ ├── page-manager.ts Interactive page scaffolder
47
- │ ├── veeva-config.ts Interactive veeva-config.ts generator/updater
48
- │ └── veeva-deploy.ts Deploys built output to Veeva
49
- ├── public/shared/ Static assets served under /shared/
50
- └── src/
51
- ├── pages/ Astro route entries (one file per slide)
52
- ├── contents/ Per-slide content modules imported by pages
53
- ├── layouts/ GlobalLayout, LeftNavLayout, TopNavLayout, ...
54
- ├── components/ Project components (content, isi, nav, ui)
55
- ├── data/pages.tsx Page registry / nav data
56
- ├── lib/{client,server}/ Shared client + server helpers (IVA config lives here)
57
- ├── scss/ Shared SCSS (_mixins, _variables, ipads.scss)
58
- └── shared/img/ Shared image assets
54
+ │ ├── page-manager.ts Interactive page scaffolder
55
+ │ ├── veeva-config.ts Interactive veeva-config.ts generator/updater
56
+ │ └── veeva-deploy.ts Deploys built output to Veeva
57
+ ├── .env.development LOG_LEVEL, WEB_ENV, WEB_SCALING for `astro dev`
58
+ ├── .env.veeva-client BUILD_TARGET for client builds/deploys
59
+ ├── .env.veeva-client-training BUILD_TARGET + VEEVA_TRAINING for training builds
60
+ ├── .env.veeva-evoke BUILD_TARGET + VEEVA_ENV="evoke" for internal builds
61
+ ├── astro.config.ts Astro config + env schema + pruneBuild integration
62
+ ├── bin/create.js Scaffolder entry point
63
+ ├── veeva-config.ts Presentation metadata, slides, binder fields (created via veeva-config)
64
+ └── veeva-metadata.js Browser-console script that bulk-updates Veeva PromoMats fields
59
65
  ```
60
66
 
61
67
  ### Pages and contents
@@ -67,6 +73,18 @@ Each slide is split in two:
67
73
 
68
74
  A page at `src/pages/about-moa.astro` typically imports from `src/contents/about/moa.astro`. The `page-manager` task (below) wires this up automatically.
69
75
 
76
+ ### Component organization
77
+
78
+ [src/components/](src/components/) is split by purpose, aliased as `@components/*`:
79
+
80
+ - **[content/](src/components/content/)** — shared pieces that are specific to this presentation (not generic enough for `ui/`) but reused across multiple slides: popups, charts, CTAs, etc.
81
+ - **[isi/](src/components/isi/)** — Important Safety Information content. [ISIContent.tsx](src/components/isi/ISIContent.tsx) ships with placeholder sections (`Indication`, `BoxedWarning`, `Contraindications`, `WarningsPrecautions`, `AdverseReactions`, `DrugInteractions`, `PleaseSee`) meant to be replaced with the real content, each toggleable via `header`/`items` props. Pair with [astro-core](https://www.npmjs.com/package/@inizioevoke/astro-core)'s `RightISI` component to render it in a persistent panel.
82
+ - **[nav/](src/components/nav/)** — navigation building blocks. [NavList.tsx](src/components/nav/NavList.tsx) renders a `<ul>` tree from a `NavData[]` array (handling `data-gotoslide` vs. web `href`, and `aria-current`), independent of any particular presentation's structure. [nav/MainNav/](src/components/nav/MainNav/) is the presentation-specific nav itself — `MainNav.astro` is the default (build it directly with `NavLink`s pulled from [src/data/pages.tsx](src/data/pages.tsx)); fall back to `MainNav.tsx` + `NavList` only if the nav's structure is too dynamic to express declaratively in Astro.
83
+ - **[svg/](src/components/svg/)** — inline `<svg>` components, kept out of `ui/` so icon markup doesn't clutter it.
84
+ - **[ui/](src/components/ui/)** — generic, presentation-agnostic building blocks: `Link`, `NavLink`, `VeevaLink`, `Image`, `Button`. Anything reusable across any Veeva CLM project belongs here. Components with more than one file (styles, scripts) get their own subfolder, e.g. [ui/IvaConsole/](src/components/ui/IvaConsole/) and [ui/VeevaControls/](src/components/ui/VeevaControls/).
85
+
86
+ When adding a new shared component, ask whether it's generic enough to belong in `ui/` or specific to this presentation's content — the latter goes in `content/` (or `nav/`/`isi/` if it's one of those concerns).
87
+
70
88
  ---
71
89
 
72
90
  ## Development
@@ -281,7 +299,12 @@ npm run deploy-client-training # client training
281
299
  npm run deploy-evoke # evoke internal
282
300
  ```
283
301
 
284
- Each runs [tasks/veeva-deploy.ts](tasks/veeva-deploy.ts), which reads the matching `.env.*` and uploads the build output to Veeva.
302
+ Each runs [tasks/veeva-deploy.ts](tasks/veeva-deploy.ts), which reads the matching `.env.*` and uploads the build output to Veeva. Before uploading, it assembles the Veeva CLM package — zipped per-slide HTML, thumbnails, shared assets, and the CSV manifest — in `deploy/<mode>/`, where `<mode>` matches the `.env.veeva-*` file used (e.g. `deploy/veeva-client/`). This directory is gitignored and cleared/regenerated on every deploy, so you can inspect exactly what gets pushed.
303
+
304
+ By default it loads `veeva-config.ts` from the project root. Pass `--config <name>` to use a different config file instead (resolved relative to the project root, extension optional) — useful if you keep separate configs for different presentations or environments:
305
+ ```
306
+ npm run deploy-client -- --config veeva-config.other
307
+ ```
285
308
 
286
309
  Combined build + deploy shortcuts:
287
310
  ```
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@inizioevoke/veeva-astroclm",
3
3
  "type": "module",
4
- "version": "1.1.4",
4
+ "version": "1.1.6",
5
5
  "bin": "./bin/create.js",
6
6
  "scripts": {
7
7
  "start": "astro dev",
@@ -25,18 +25,19 @@
25
25
  "page-manager": "npx tsx ./tasks/page-manager.ts"
26
26
  },
27
27
  "dependencies": {
28
- "@astrojs/preact": "^6.0.6",
29
- "@inizioevoke/astro-core": "^3.3.1",
30
- "@inizioevoke/veeva-astroclm-core": "^1.4.4",
28
+ "@astrojs/preact": "^6.1.1",
29
+ "@inizioevoke/astro-core": "^3.3.3",
30
+ "@inizioevoke/veeva-astroclm-core": "^1.4.8",
31
31
  "@inizioevoke/veeva-clmjs": "^1.0.1",
32
- "@inizioevoke/veeva-iva": "^1.3.2",
33
- "astro": "^7.3.8",
34
- "preact": "^10.29.8",
35
- "sass": "^1.105.1"
32
+ "@inizioevoke/veeva-iva": "^1.4.1",
33
+ "astro": "^7.4.2",
34
+ "preact": "^11.1.0",
35
+ "sass": "^1.106.1"
36
36
  },
37
37
  "devDependencies": {
38
- "@types/node": "^26.1.1",
39
- "tsx": "^4.23.1"
38
+ "@astrojs/check": "^0.9.12",
39
+ "@types/node": "^26.6.5",
40
+ "tsx": "^4.23.15"
40
41
  },
41
42
  "allowScripts": {
42
43
  "@inizioevoke/astro-core": true,
@@ -1 +1 @@
1
- Place any shared popup, charts, etc. here, not in `ui`
1
+ Place any shared popups, charts, CTAs, etc. here, not in `ui`
@@ -1,20 +1,23 @@
1
1
  ---
2
2
  import NavLink from "@components/ui/NavLink.astro";
3
+ import { getPageComponent } from '@/data/pages';
3
4
 
4
- // function hasCurrent(currentPath: string, href: string) {
5
- // return currentPath.startsWith('hello');
6
- // }
7
- // <NavLink href="/about/" class="about" hasCurrent={/some-regexp/}>About</NavLink>
8
- // <NavLink href="/about/" class="about" hasCurrent={hasCurrent}>About</NavLink>
5
+ // Declare the pages in your nav
6
+ // const home = getPageComponent('/home/');
7
+ // const page1 = getPageComponent('/page-1/');
8
+ // const page2 = getPageComponent('/page-2/');
9
9
  ---
10
10
  <nav id="main-nav">
11
- <ul>
12
- <li><NavLink href="/home/" class="home">Home</NavLink></li>
11
+ <ul><!-- Build the nav
12
+ <li><NavLink href={home.href}><home.title /></NavLink></li>
13
13
  <li>
14
- <NavLink href="/about/" class="about">About</NavLink>
14
+ <NavLink href={page1.href} class="page-1"><page1.title /></NavLink>
15
15
  <ul>
16
- <li><NavLink href="/about-moa/" class="moa">MOA</NavLink></li>
16
+ <li><NavLink href={page2.href} class="page-2"><page2.title /></NavLink></li>
17
17
  </ul>
18
18
  </li>
19
- </ul>
20
- </nav>
19
+ --></ul>
20
+ </nav>
21
+
22
+ <!-- Render the NavLink [data-current] attribute conditionally if needed using a RegExp or callback -->
23
+ <!-- <NavLink href={page1.href} hasCurrent={/some-regexp/}><page1.title /></NavLink> -->
@@ -5,22 +5,32 @@
5
5
  */
6
6
  import type { FunctionComponent } from 'preact';
7
7
  import NavList, { type NavData } from '../NavList';
8
+ import { PageElements } from '@/data/pages'
8
9
 
9
- const data: NavData[] = [{
10
- href: '/home',
11
- content: <>Home</>,
12
- }, {
13
- href: '/about',
14
- content: <>About</>,
15
- attrs: {
16
- class: 'about',
17
- 'data-hello': 'world'
18
- },
19
- children: [{
20
- href: '/about/moa',
21
- content: <>MOA</>
22
- }]
23
- }];
10
+ const data: NavData[] = PageElements.map(({ title, href }) => ({
11
+ href,
12
+ content: title,
13
+ }));
14
+
15
+ // NavData entries can also carry attrs and nested children, e.g. nesting
16
+ // the "required" page under "about" while still pulling href/content from pages data:
17
+ // const required = PageElements.find(({ href }) => href === '/required/');
18
+ // const data: NavData[] = PageElements
19
+ // .filter(({ href }) => href !== '/required/')
20
+ // .map(({ title, href }) => {
21
+ // const item: NavData = { href, content: title };
22
+ // if (href === '/about/' && required) {
23
+ // item.attrs = {
24
+ // class: 'about',
25
+ // 'data-hello': 'world'
26
+ // };
27
+ // item.children = [{
28
+ // href: required.href,
29
+ // content: required.title
30
+ // }];
31
+ // }
32
+ // return item;
33
+ // });
24
34
 
25
35
  interface MainNavProps {
26
36
  url: URL;
@@ -2,9 +2,10 @@ import { BUILD_TARGET } from 'astro:env/client';
2
2
  import type { JSX } from "astro/jsx-runtime";
3
3
  import type { FunctionComponent } from 'preact';
4
4
  import { flattenPath, pathToSlideZip } from '@inizioevoke/veeva-astroclm-core/lib';
5
+ import type { PageHref } from '@data/pages';
5
6
 
6
7
  export interface NavData {
7
- href: string;
8
+ href: PageHref | (string & {});
8
9
  content: JSX.Element;
9
10
  gotoslide?: string;
10
11
  attrs?: Record<string, string>;
@@ -0,0 +1 @@
1
+ Place `<svg>` components here
@@ -5,7 +5,7 @@ import { flattenPath, pathToSlideZip, dataEvotrkToString } from "@inizioevoke/ve
5
5
  import type { PageHref } from '@data/pages';
6
6
 
7
7
  export interface Props extends HTMLAttributes<'a'> {
8
- href: PageHref | (string & {});
8
+ href: PageHref;
9
9
  'data-evotrk'?: DataEvotrk;
10
10
  }
11
11
 
@@ -1,34 +1,38 @@
1
- import type { ComponentProps } from 'preact';
1
+ import type { ComponentProps, FunctionComponent } from 'preact';
2
2
  import { BUILD_TARGET } from 'astro:env/client';
3
3
  import { flattenPath, pathToSlideZip, dataEvotrkToString } from '@inizioevoke/veeva-astroclm-core/lib';
4
4
  import type { PageHref } from '@data/pages';
5
5
 
6
- interface LinkProps extends ComponentProps<'a'> {
7
- href: PageHref | (string & {});
6
+ type LinkProps = ComponentProps<'a'> & {
7
+ href: PageHref;
8
8
  'data-evotrk'?: DataEvotrk;
9
9
  currentPath?: string;
10
- }
10
+ };
11
11
 
12
- const Link = ({ href, 'data-evotrk': dataEvotrk, currentPath, children, ...rest }: LinkProps) => {
13
- const attrs: ComponentProps<'a'> & { 'data-gotoslide'?: string; 'data-evotrk'?: string } = { ...rest };
12
+ const Link: FunctionComponent<LinkProps> = ({ href, 'data-evotrk': dataEvotrk, currentPath, children, ...rest }) => {
13
+ let linkHref: string = href;
14
+ let gotoslide: string | undefined;
15
+ let isCurrent = false;
14
16
 
15
- if (/^(?:https?:\/\/|(?:\.*\/)*shared\/)/i.test(href)) {
16
- attrs.href = href;
17
- } else {
18
- attrs['data-gotoslide'] = pathToSlideZip(href);
17
+ if (!/^(?:https?:\/\/|(?:\.*\/)*shared\/)/i.test(href)) {
18
+ gotoslide = pathToSlideZip(href);
19
19
 
20
20
  const linkPath = flattenPath(href);
21
21
 
22
- attrs.href = BUILD_TARGET === 'web' ? linkPath : '#';
22
+ linkHref = BUILD_TARGET === 'web' ? linkPath : '#';
23
23
 
24
24
  if (currentPath && linkPath === currentPath) {
25
- attrs['aria-current'] = 'true';
25
+ isCurrent = true;
26
26
  }
27
27
  }
28
28
 
29
- if (dataEvotrk) {
30
- attrs['data-evotrk'] = dataEvotrkToString(dataEvotrk);
31
- }
29
+ const attrs: ComponentProps<'a'> & { 'data-gotoslide'?: string; 'data-evotrk'?: string } = {
30
+ ...rest,
31
+ href: linkHref,
32
+ ...(gotoslide ? { 'data-gotoslide': gotoslide } : {}),
33
+ ...(isCurrent ? { 'aria-current': 'true' } : {}),
34
+ ...(dataEvotrk ? { 'data-evotrk': dataEvotrkToString(dataEvotrk) } : {}),
35
+ };
32
36
 
33
37
  return <a {...attrs}>{children}</a>;
34
38
  };
@@ -1,40 +1,40 @@
1
- import type { ComponentProps } from 'preact';
1
+ import type { ComponentProps, FunctionComponent } from 'preact';
2
2
  import { flattenPath } from '@inizioevoke/veeva-astroclm-core/lib';
3
3
  import Link from './Link';
4
- import type { PageHref } from '@data/pages';
5
4
 
6
5
  type HasCurrentCallback = (pathname: string, href: string) => boolean;
7
6
 
8
7
  interface NavLinkProps extends ComponentProps<typeof Link> {
9
- href: PageHref | (string & {});
10
8
  hasCurrent?: string | RegExp | HasCurrentCallback;
11
9
  }
12
10
 
13
- const NavLink = ({ hasCurrent, href, currentPath, children, ...rest }: NavLinkProps) => {
14
- const attrs: Omit<ComponentProps<typeof Link>, 'href'> & { 'data-current'?: string } = { ...rest };
11
+ const NavLink: FunctionComponent<NavLinkProps> = ({ hasCurrent, href, currentPath, children, ...rest }) => {
12
+ let isCurrent = false;
13
+ let hasCurrentMatch = false;
15
14
 
16
15
  if (!/^(?:https?:\/\/|(?:\.*\/)*shared\/)/i.test(href)) {
17
16
  const linkPath = flattenPath(href);
18
17
 
19
- let current = false;
20
18
  if (currentPath && linkPath === currentPath) {
21
- current = true;
22
- attrs['aria-current'] = 'true';
19
+ isCurrent = true;
20
+ hasCurrentMatch = true;
23
21
  } else if (hasCurrent && currentPath) {
24
22
  if (typeof hasCurrent === 'string') {
25
- current = currentPath.startsWith(hasCurrent);
23
+ hasCurrentMatch = currentPath.startsWith(hasCurrent);
26
24
  } else if (typeof hasCurrent === 'function') {
27
- current = hasCurrent(currentPath, href);
25
+ hasCurrentMatch = hasCurrent(currentPath, href);
28
26
  } else if (hasCurrent instanceof RegExp) {
29
- current = hasCurrent.test(currentPath);
27
+ hasCurrentMatch = hasCurrent.test(currentPath);
30
28
  }
31
29
  }
32
-
33
- if (current) {
34
- attrs['data-current'] = 'true';
35
- }
36
30
  }
37
31
 
32
+ const attrs: Omit<ComponentProps<typeof Link>, 'href'> & { 'data-current'?: string } = {
33
+ ...rest,
34
+ ...(isCurrent ? { 'aria-current': 'true' } : {}),
35
+ ...(hasCurrentMatch ? { 'data-current': 'true' } : {}),
36
+ };
37
+
38
38
  return <Link href={href} currentPath={currentPath} {...attrs}>{children}</Link>;
39
39
  };
40
40
 
@@ -1,17 +1,29 @@
1
1
  import type { FunctionComponent } from "preact";
2
2
  import type { JSX } from "preact/jsx-runtime";
3
- import { flattenPath } from '@inizioevoke/veeva-astroclm-core/lib';
3
+ import { flattenPath, pathToSlideZip } from '@inizioevoke/veeva-astroclm-core/lib';
4
+ import { type NavigateParams } from '@inizioevoke/veeva-iva';
4
5
 
5
6
  interface Page {
6
7
  title: JSX.Element;
7
- href: string;
8
+ href: `/${string}/`;
8
9
  }
9
10
 
10
11
  const Pages = [] as const satisfies Page[];
11
12
 
13
+ // const Pages = [{
14
+ // title: <>Home</>,
15
+ // href: '/home/'
16
+ // }, {
17
+ // title: <>Page 1</>,
18
+ // href: '/page-1/'
19
+ // }, {
20
+ // title: <>Page 2</>,
21
+ // href: '/page-2/'
22
+ // }] as const satisfies Page[];
23
+
12
24
  // ----------------------------------------------------------------------------------------------------
13
25
 
14
- export type PageHref = (typeof Pages)[number]["href"] extends `/${infer S}/` ? S : never;
26
+ export type PageHref = (typeof Pages)[number]["href"];
15
27
 
16
28
  export interface PageElement {
17
29
  title: JSX.Element,
@@ -20,7 +32,7 @@ export interface PageElement {
20
32
 
21
33
  export interface PageComponent {
22
34
  title: FunctionComponent;
23
- href: string;
35
+ href: PageHref;
24
36
  }
25
37
 
26
38
  export function toPageComponent(page: PageElement): PageComponent {
@@ -41,10 +53,21 @@ export const PageComponents: PageComponent[] = PageElements.map((p) => {
41
53
  return toPageComponent(p);
42
54
  });
43
55
 
44
- export function getPageElement<T = PageElement | undefined>(href: PageHref | (string & {})): T {
45
- return PageElements.find(p => p.href == flattenPath(href)) as T;
56
+ export const PageUrls: NavigateParams[] = Pages.map((p) => {
57
+ return {
58
+ href: (p as Page).href,
59
+ slide: pathToSlideZip((p as Page).href)
60
+ }
61
+ });
62
+
63
+ export function getPageElement(href: PageHref): PageElement {
64
+ const pageElement = PageElements.find(p => p.href == flattenPath(href));
65
+ if (!pageElement) throw new Error(`PageElement ${href} not found`);
66
+ return pageElement;
46
67
  }
47
68
 
48
- export function getPageComponent<T = PageComponent | undefined>(href: PageHref | (string & {})): T {
49
- return PageComponents.find(p => p.href == flattenPath(href)) as T;
69
+ export function getPageComponent(href: PageHref): PageComponent {
70
+ const pageComponent = PageComponents.find(p => p.href == flattenPath(href));
71
+ if (!pageComponent) throw new Error(`PageComponent ${href} not found`);
72
+ return pageComponent;
50
73
  }
@@ -48,11 +48,11 @@ const pathname = Astro.url.pathname;
48
48
  <div class="body-wrapper scaling-wrapper">
49
49
  <ResizeScript width={SCREEN_WIDTH} height={SCREEN_HEIGHT} />
50
50
  <slot />
51
- { BUILD_TARGET === 'web' && WEB_ENV !== "production" && <VeevaControls reactions={false} /> }
52
51
  <ModalOverlay />
53
52
  </div>
54
53
  </div>
55
-
54
+
55
+ { BUILD_TARGET === 'web' && WEB_ENV !== "production" && <VeevaControls reactions={false} /> }
56
56
  <IvaConsole />
57
57
 
58
58
  <script>
@@ -2,11 +2,11 @@ import { BUILD_TARGET, VEEVA_ENV, WEB_SCALING } from 'astro:env/client';
2
2
  import * as IVA from '@inizioevoke/veeva-iva';
3
3
  import { logError, logDebug } from '@components/ui/IvaConsole/IvaConsole';
4
4
  // import swipeNav, { type SwipeNavLink, type SwipeType } from './swipe-nav';
5
+ // import { PageUrls } from '@/data/pages';
5
6
 
6
7
  IVA.init({
7
8
  isWebEnv: BUILD_TARGET === 'web',
8
9
  isSandboxEnv: VEEVA_ENV === 'evoke',
9
-
10
10
  preTrack: async ({ data, event }: IVA.PreTrackHandlerParams) => {
11
11
  data.name = `${data.type}_${data.name}`;
12
12
  if (BUILD_TARGET === 'web') {
@@ -24,29 +24,18 @@ IVA.init({
24
24
  * If using the custom swipe, figure out which page to go to when swiping.
25
25
  * This is only example. Create something different for your IVA.
26
26
  */
27
- // const swipeOrder = [
28
- // ['/home/', 'home.zip'],
29
- // ['/about/', 'about.zip'],
30
- // ['/about-moa/', 'about-moa.zip']
31
- // ];
32
27
  // swipeNav({
33
28
  // threshold: '1/4',
34
29
  // handler: (type) => {
35
30
  // let link: SwipeNavLink | undefined = undefined;
36
- // const i = swipeOrder.findIndex(o => o[0] === location.pathname);
31
+ // const i = PageUrls.findIndex(p => p.href === location.pathname);
37
32
  // if (i !== -1) {
38
33
  // if (type === 'previous') {
39
34
  // if (i > 0) {
40
- // link = {
41
- // href: swipeOrder[i-1][0],
42
- // slide: swipeOrder[i-1][1]
43
- // };
35
+ // link = PageUrls[i-1];
44
36
  // }
45
- // } else if (i < swipeOrder.length - 1) {
46
- // link = {
47
- // href: swipeOrder[i+1][0],
48
- // slide: swipeOrder[i+1][1]
49
- // };
37
+ // } else if (i < PageUrls.length - 1) {
38
+ // link = PageUrls[i+1];
50
39
  // }
51
40
  // }
52
41
  // return link;
@@ -1,13 +1,11 @@
1
1
  import { navigate, track, getSlideData, type AnalyticsEventData } from "@inizioevoke/veeva-iva";
2
2
  import { logDebug } from '@components/ui/IvaConsole/IvaConsole';
3
3
  import { createSwipeListener, type SwipeThreshold } from '@inizioevoke/astro-core/lib/gestures/swipe';
4
+ import { type NavigateParams } from '@inizioevoke/veeva-iva';
4
5
 
5
6
  export type SwipeType = 'previous' | 'next';
6
7
 
7
- export interface SwipeNavLink {
8
- href: string;
9
- slide: string;
10
- presentation?: string;
8
+ export interface SwipeNavLink extends NavigateParams {
11
9
  analytics?: AnalyticsEventData;
12
10
  }
13
11
 
@@ -26,7 +24,7 @@ export default function({ handler, threshold = '1/3', debug }: SwipeNavProps) {
26
24
  if (debug) {
27
25
  logDebug('SwipeNav: navigate', link);
28
26
  } else {
29
- navigate(link);
27
+ navigate({ href: link.href, slide: link.slide, presentation: link.presentation });
30
28
  }
31
29
  } else {
32
30
  logDebug('SwipeNav: no link');
@@ -1,21 +1,35 @@
1
+ import { resolve } from 'node:path';
2
+ import { pathToFileURL } from 'node:url';
1
3
  import { loadEnv, parseArgv } from '@inizioevoke/veeva-astroclm-core/lib/server';
2
4
  import { deploy } from '@inizioevoke/veeva-astroclm-core/tasks';
5
+ import type { IVeevaConfig, VeevaEnv } from '@inizioevoke/veeva-astroclm-core/types'
3
6
  import { root } from './util';
4
- import VeevaConfig from '../veeva-config';
7
+
8
+ type VeevaConfigFactory = (args?: { veevaEnv?: VeevaEnv; isTraining?: boolean }) => IVeevaConfig;
5
9
 
6
10
  const argv = parseArgv({
7
11
  mode: 'string',
8
- csvOnly: 'boolean'
12
+ csvOnly: 'boolean',
13
+ config: 'string'
9
14
  });
10
15
 
16
+ const configPath = resolve(root, argv.config ?? 'veeva-config');
17
+
18
+ let VeevaConfig: VeevaConfigFactory;
19
+ try {
20
+ ({ default: VeevaConfig } = await import(pathToFileURL(configPath).href));
21
+ } catch (err) {
22
+ throw new Error(`Could not load Veeva config at "${configPath}"`, { cause: err });
23
+ }
24
+
11
25
  const { VEEVA_ENV, VEEVA_TRAINING } = await loadEnv(argv.mode);
12
26
 
13
27
  await deploy({
14
28
  root,
15
- config: VeevaConfig({
29
+ config: VeevaConfig({
16
30
  veevaEnv: VEEVA_ENV,
17
31
  isTraining: VEEVA_TRAINING
18
32
  }),
19
33
  env: VEEVA_ENV,
20
34
  csvOnly: argv.csvOnly === true
21
- });
35
+ });