@namiml/web-sdk 3.4.6 → 3.4.7-dev.202607230324

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.
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Feature-detected polyfill loading for the legacy-support entry.
3
+ *
4
+ * The consumer's `isLegacyBrowser()` gate is coarse: a browser needing core-js
5
+ * language polyfills often still has native Custom Elements, Shadow DOM, fetch,
6
+ * URL, and AbortController. We detect what is genuinely missing and load only
7
+ * that — capable browsers skip them, most importantly the ~135KB Web Components
8
+ * bundle.
9
+ *
10
+ * Invariant (NAM-2271): native present -> skip; native absent -> load exactly
11
+ * the polyfill shipped before this change. No browser loses capability.
12
+ */
13
+ export type PolyfillKind = "webcomponents" | "es5adapter" | "fetch" | "url" | "abortcontroller";
14
+ /**
15
+ * Returns the polyfills a browser genuinely needs. Ordering within the returned
16
+ * list is not significant (it is enforced in `applyPolyfills`). Pure and
17
+ * side-effect free so the no-regression invariant is unit-testable without a
18
+ * device.
19
+ */
20
+ export declare function detectMissingPolyfills(g?: typeof globalThis): PolyfillKind[];
21
+ type Importer = () => Promise<unknown>;
22
+ /**
23
+ * Default dynamic importers. Each is a separate `import()` so a capable browser
24
+ * never fetches the chunk. `url` points at the *minified* build; `core-js` and
25
+ * `whatwg-fetch` stay external (customer-provided).
26
+ */
27
+ export declare const polyfillImporters: Record<PolyfillKind, Importer>;
28
+ /**
29
+ * Loads the given polyfills. The Web Components pair is ordered (the bundle must
30
+ * apply before the ES5 adapter patches `customElements.define`); the rest are
31
+ * independent and run concurrently. Resolves only after every needed polyfill
32
+ * has applied, so a top-level `await` in legacy-support blocks the consumer's
33
+ * `await import(...)` until the environment is ready.
34
+ */
35
+ export declare function applyPolyfills(kinds: PolyfillKind[], importers?: Record<PolyfillKind, Importer>): Promise<void>;
36
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@namiml/web-sdk",
3
3
  "type": "module",
4
- "version": "3.4.6",
4
+ "version": "3.4.7-dev.202607230324",
5
5
  "source": "src/nami-web.ts",
6
6
  "description": "Subscription monetization infrastructure — drop-in SDK with no-code paywalls, onboarding flows, A/B testing for web",
7
7
  "scripts": {
@@ -105,7 +105,7 @@
105
105
  "dependencies": {
106
106
  "@lit-labs/ssr-dom-shim": "^1.2.1",
107
107
  "@lit/context": "^1.1.3",
108
- "@namiml/sdk-core": "3.4.6",
108
+ "@namiml/sdk-core": "3.4.7-dev.202607230324",
109
109
  "bowser": "^2.11.0",
110
110
  "hls.js": "^1.5.18",
111
111
  "lit": "^3.3.1",