@codebards/ik-embeddable-form 1.0.44 → 1.0.46
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 +20 -4
- package/dist/embed.js +974 -5
- package/dist/img/company-logos-grid.png +0 -0
- package/dist/img/flags.png +0 -0
- package/dist/img/flags@2x.png +0 -0
- package/dist/img/india-flag.png +0 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -303,25 +303,41 @@ npm run build:production # Builds with .env.production (minified)
|
|
|
303
303
|
|
|
304
304
|
```
|
|
305
305
|
dist/
|
|
306
|
-
├── embed.js #
|
|
307
|
-
|
|
306
|
+
├── embed.js # IIFE bundle (reference in <script>)
|
|
307
|
+
├── embed.js.map # Source map (only in staging/local builds)
|
|
308
|
+
└── img/ # Runtime bitmaps — must ship alongside embed.js
|
|
309
|
+
├── flags.png
|
|
310
|
+
├── flags@2x.png
|
|
311
|
+
├── company-logos-grid.png
|
|
312
|
+
└── india-flag.png
|
|
308
313
|
```
|
|
309
314
|
|
|
315
|
+
`img/` is **not optional**. The widget resolves those files at runtime against the URL
|
|
316
|
+
`embed.js` itself was served from, so they have to sit in an `img/` directory next to it —
|
|
317
|
+
upload the whole `dist/` tree, not just `embed.js`. Deploying `embed.js` alone leaves the
|
|
318
|
+
phone-input country flags and the promo panel's logo grid as broken images. They are
|
|
319
|
+
requested lazily, so nothing 404s until a form actually renders the element that needs one.
|
|
320
|
+
|
|
310
321
|
### Deployment Checklist
|
|
311
322
|
|
|
312
323
|
1. Run `npm run build:production`
|
|
313
|
-
2. Upload `dist/embed.js` to your CDN
|
|
324
|
+
2. Upload `dist/embed.js` **and `dist/img/`** to your CDN under a versioned path:
|
|
314
325
|
```
|
|
315
326
|
https://cdn.example.com/forms/v1.0.0/embed.js
|
|
327
|
+
https://cdn.example.com/forms/v1.0.0/img/…
|
|
316
328
|
```
|
|
317
329
|
3. Set cache headers:
|
|
318
330
|
- `embed.js` → `Cache-Control: public, max-age=31536000, immutable` (versioned path)
|
|
331
|
+
- `img/*` → `Cache-Control: public, max-age=31536000, immutable` (URLs are version-stamped
|
|
332
|
+
with a `?v=` query, so a release changes them)
|
|
319
333
|
- Use a `latest` alias for convenience: `cdn.example.com/forms/latest/embed.js` with shorter TTL
|
|
320
334
|
|
|
321
335
|
4. Reference on the host page:
|
|
322
336
|
```html
|
|
323
|
-
<script src="https://cdn.example.com/forms/v1.0.0/embed.js"
|
|
337
|
+
<script src="https://cdn.example.com/forms/v1.0.0/embed.js" defer></script>
|
|
324
338
|
```
|
|
339
|
+
`defer` (or `async`) matters: the bundle is large enough that a plain parser-blocking
|
|
340
|
+
`<script>` measurably delays first paint on mobile.
|
|
325
341
|
|
|
326
342
|
---
|
|
327
343
|
|