@mapvx/website-component 0.5.3 → 0.6.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/README.md CHANGED
@@ -246,6 +246,7 @@ The web component accepts the following input properties to customize its behavi
246
246
  | `show-category-filters` | `boolean` | ❌ No | `true` | If `true`, shows category filters |
247
247
  | `show-city-filter` | `boolean` | ❌ No | `true` | If `true`, shows city filter |
248
248
  | `inherit-font-family` | `boolean` | ❌ No | `false` | If `true`, inherits font family from parent |
249
+ | `hide-deals` | `boolean` | ❌ No | `false` | If `true`, hides deals and promotional content |
249
250
 
250
251
  ### Input Usage Examples
251
252
 
@@ -264,6 +265,7 @@ The web component accepts the following input properties to customize its behavi
264
265
  default-to-map="true"
265
266
  show-category-filters="false"
266
267
  show-city-filter="true"
268
+ hide-deals="true"
267
269
  >
268
270
  </mapvx-website>
269
271
  ```
@@ -282,19 +284,64 @@ npm install @mapvx/website-component-helpers
282
284
 
283
285
  #### Next.js (App Router)
284
286
 
287
+ **1. Install dependencies:**
288
+
289
+ ```bash
290
+ npm install @mapvx/website-component @mapvx/website-component-helpers
291
+ ```
292
+
293
+ **2. Copy the bundle script to your `package.json`:**
294
+
295
+ ```json
296
+ {
297
+ "scripts": {
298
+ "copy-bundle": "node copy-bundle.mjs"
299
+ }
300
+ }
301
+ ```
302
+
303
+ **3. Create `copy-bundle.mjs` in your project root:**
304
+
305
+ ```javascript
306
+ #!/usr/bin/env node
307
+
308
+ import { existsSync, mkdirSync, copyFileSync } from 'fs'
309
+ import { join } from 'path'
310
+
311
+ const sourcePath = 'node_modules/@mapvx/website-component/dist/browser/main.js'
312
+ const targetDir = 'public/mapvx-website'
313
+ const targetPath = join(targetDir, 'bundle.js')
314
+
315
+ if (!existsSync(sourcePath)) {
316
+ console.error(`❌ Source file not found: ${sourcePath}`)
317
+ process.exit(1)
318
+ }
319
+
320
+ if (!existsSync(targetDir)) {
321
+ mkdirSync(targetDir, { recursive: true })
322
+ }
323
+
324
+ copyFileSync(sourcePath, targetPath)
325
+ console.log(`✅ Bundle copied successfully!`)
326
+ ```
327
+
328
+ **4. Create your page component:**
329
+
285
330
  ```typescript
286
331
  // app/page.tsx
287
332
  import { prepareInitialData } from '@mapvx/website-component-helpers';
333
+ import '@mapvx/website-component/dist/browser/styles.css';
334
+ import Script from 'next/script';
288
335
 
289
336
  export default async function HomePage() {
290
- // Execute on the server
291
- const initialData = await prepareInitialData(process.env.MAPVX_API_KEY!);
337
+ const initialData = await prepareInitialData(process.env.NEXT_PUBLIC_MAPVX_API_KEY || '');
292
338
 
293
339
  return (
294
340
  <div>
295
- <h1>My App</h1>
341
+ <Script src='/mapvx-website/bundle.js' />
296
342
  <mapvx-website
297
- api-key={process.env.MAPVX_API_KEY}
343
+ api-key={process.env.NEXT_PUBLIC_MAPVX_API_KEY}
344
+ institution-id={process.env.NEXT_PUBLIC_MAPVX_INSTITUTION_ID}
298
345
  initial-data={initialData}
299
346
  default-to-map="true"
300
347
  />
@@ -303,36 +350,18 @@ export default async function HomePage() {
303
350
  }
304
351
  ```
305
352
 
306
- #### Next.js (Pages Router)
307
-
308
- ```typescript
309
- // pages/index.tsx
310
- import { GetServerSideProps } from 'next';
311
- import { prepareInitialData } from '@mapvx/website-component-helpers';
353
+ **5. Set environment variables in `.env.local`:**
312
354
 
313
- export const getServerSideProps: GetServerSideProps = async () => {
314
- // Execute on the server
315
- const initialData = await prepareInitialData(process.env.MAPVX_API_KEY!);
355
+ ```bash
356
+ NEXT_PUBLIC_MAPVX_API_KEY=your-api-key-here
357
+ NEXT_PUBLIC_MAPVX_INSTITUTION_ID=your-institution-id
358
+ ```
316
359
 
317
- return {
318
- props: {
319
- initialData,
320
- },
321
- };
322
- };
360
+ **6. Run the copy script before building:**
323
361
 
324
- export default function HomePage({ initialData }: { initialData: string }) {
325
- return (
326
- <div>
327
- <h1>My App</h1>
328
- <mapvx-website
329
- api-key={process.env.MAPVX_API_KEY}
330
- initial-data={initialData}
331
- default-to-map="true"
332
- />
333
- </div>
334
- );
335
- }
362
+ ```bash
363
+ npm run copy-bundle
364
+ npm run build
336
365
  ```
337
366
 
338
367
  #### Nuxt.js