@molecule/app-auth-modal-solid 0.0.0-stage → 1.1.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.
@@ -0,0 +1,53 @@
1
+ /**
2
+ * `@molecule/app-auth-modal-solid` — the shared in-app login / signup /
3
+ * upgrade flow. Mount {@link AuthModalMount} ONCE inside the app's
4
+ * providers (where the `@molecule/app-solid` auth primitives work) and every
5
+ * in-app `/login` / `/signup` link opens the {@link AuthModal} instead of
6
+ * navigating, while `/pricing` / `/billing` links open the upgrade flow in
7
+ * a new tab (session auto-refreshes when the user returns) — no
8
+ * navigation, no reload, no lost work. OAuth runs in a popup
9
+ * (`loginViaPopup`), so social login never navigates the host either.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * import { render } from 'solid-js/web'
14
+ * import { AuthModalMount } from '@molecule/app-auth-modal-solid'
15
+ * import { oauthConfig } from './config.jsx'
16
+ *
17
+ * // Once, inside the app's providers (e.g. in App.tsx):
18
+ * <AuthModalMount oauthConfig={oauthConfig} onAuthenticated={() => claimGuestWork()} />
19
+ * // Every plain <a href="/login">, <a href="/signup">, <a href="/pricing">
20
+ * // anywhere in the app is now intercepted — no other wiring needed.
21
+ * ```
22
+ *
23
+ * @remarks
24
+ * Interception is capture-phase on `document` and matches plain
25
+ * left-clicks on `<a href>` whose resolved pathname is in `authPaths`
26
+ * (default `/login`, `/signup`) or `upgradePaths` (default `/pricing`,
27
+ * `/billing`) — modifier/middle clicks still navigate normally, and
28
+ * non-anchor buttons that call `navigate()` are NOT intercepted. Hosts
29
+ * that render pricing in-place pass `onUpgradeIntercept` and own that UI
30
+ * + the post-upgrade session refresh. `AuthModalMount` must render inside
31
+ * the app's auth/HTTP providers (it calls `useAuth`), and the standalone
32
+ * `/login` & `/signup` pages should stay routed — they are the fallback
33
+ * for modifier clicks and deep links. App-specific extras (stash a guest
34
+ * id, claim guest work, invalidate usage) go in `onBeforeAuth` /
35
+ * `onAuthenticated`. The modal's `auth.modal.*` strings are homed in the
36
+ * `@molecule/app-locales-common` bond (79 languages), alongside the
37
+ * `auth.login.*` / `auth.signup.*` keys the modal also renders.
38
+ *
39
+ * If the signup API requires a human-verification challenge (Turnstile /
40
+ * hCaptcha), pass BOTH `captchaSlot` (the widget, rendered in the signup
41
+ * form) and `captchaSolved` (which gates the submit). Rendering the widget
42
+ * on the standalone `/signup` page alone is NOT enough: this modal is what
43
+ * a `/signup` link actually opens, so the in-app signup would POST with no
44
+ * token and the API would answer "complete the verification challenge"
45
+ * while no challenge is on screen. Login is not gated, so the slot is
46
+ * unmounted in login mode.
47
+ *
48
+ * @module
49
+ */
50
+ export * from './AuthModal.jsx';
51
+ export * from './AuthModalMount.jsx';
52
+ export * from './cta-intercept.js';
53
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,53 @@
1
+ /**
2
+ * `@molecule/app-auth-modal-solid` — the shared in-app login / signup /
3
+ * upgrade flow. Mount {@link AuthModalMount} ONCE inside the app's
4
+ * providers (where the `@molecule/app-solid` auth primitives work) and every
5
+ * in-app `/login` / `/signup` link opens the {@link AuthModal} instead of
6
+ * navigating, while `/pricing` / `/billing` links open the upgrade flow in
7
+ * a new tab (session auto-refreshes when the user returns) — no
8
+ * navigation, no reload, no lost work. OAuth runs in a popup
9
+ * (`loginViaPopup`), so social login never navigates the host either.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * import { render } from 'solid-js/web'
14
+ * import { AuthModalMount } from '@molecule/app-auth-modal-solid'
15
+ * import { oauthConfig } from './config.jsx'
16
+ *
17
+ * // Once, inside the app's providers (e.g. in App.tsx):
18
+ * <AuthModalMount oauthConfig={oauthConfig} onAuthenticated={() => claimGuestWork()} />
19
+ * // Every plain <a href="/login">, <a href="/signup">, <a href="/pricing">
20
+ * // anywhere in the app is now intercepted — no other wiring needed.
21
+ * ```
22
+ *
23
+ * @remarks
24
+ * Interception is capture-phase on `document` and matches plain
25
+ * left-clicks on `<a href>` whose resolved pathname is in `authPaths`
26
+ * (default `/login`, `/signup`) or `upgradePaths` (default `/pricing`,
27
+ * `/billing`) — modifier/middle clicks still navigate normally, and
28
+ * non-anchor buttons that call `navigate()` are NOT intercepted. Hosts
29
+ * that render pricing in-place pass `onUpgradeIntercept` and own that UI
30
+ * + the post-upgrade session refresh. `AuthModalMount` must render inside
31
+ * the app's auth/HTTP providers (it calls `useAuth`), and the standalone
32
+ * `/login` & `/signup` pages should stay routed — they are the fallback
33
+ * for modifier clicks and deep links. App-specific extras (stash a guest
34
+ * id, claim guest work, invalidate usage) go in `onBeforeAuth` /
35
+ * `onAuthenticated`. The modal's `auth.modal.*` strings are homed in the
36
+ * `@molecule/app-locales-common` bond (79 languages), alongside the
37
+ * `auth.login.*` / `auth.signup.*` keys the modal also renders.
38
+ *
39
+ * If the signup API requires a human-verification challenge (Turnstile /
40
+ * hCaptcha), pass BOTH `captchaSlot` (the widget, rendered in the signup
41
+ * form) and `captchaSolved` (which gates the submit). Rendering the widget
42
+ * on the standalone `/signup` page alone is NOT enough: this modal is what
43
+ * a `/signup` link actually opens, so the in-app signup would POST with no
44
+ * token and the API would answer "complete the verification challenge"
45
+ * while no challenge is on screen. Login is not gated, so the slot is
46
+ * unmounted in login mode.
47
+ *
48
+ * @module
49
+ */
50
+ export * from './AuthModal.jsx';
51
+ export * from './AuthModalMount.jsx';
52
+ export * from './cta-intercept.js';
53
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,73 @@
1
1
  {
2
2
  "name": "@molecule/app-auth-modal-solid",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.1.0",
4
+ "description": "In-app login / signup modal + click-interceptor + popup OAuth — authenticate and upgrade without ever navigating away or losing work",
5
+ "homepage": "https://www.molecule.dev/packages/app-auth-modal-solid",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "dev": "tsc --watch",
22
+ "test": "vitest run",
23
+ "test:watch": "vitest"
24
+ },
25
+ "keywords": [
26
+ "molecule",
27
+ "auth",
28
+ "login",
29
+ "signup",
30
+ "modal",
31
+ "oauth",
32
+ "solid"
33
+ ],
34
+ "author": "Molecule Dev, Inc. (https://molecule.dev)",
35
+ "license": "Apache-2.0",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/molecule-dev/molecule.git",
39
+ "directory": "packages/app/features/auth-modal-solid"
40
+ },
41
+ "engines": {
42
+ "node": ">=20"
43
+ },
44
+ "bugs": "https://github.com/molecule-dev/molecule/issues",
45
+ "publishConfig": {
46
+ "access": "public"
47
+ },
48
+ "peerDependencies": {
49
+ "@molecule/app-auth-shell-solid": "^1.0.0",
50
+ "@molecule/app-i18n": "^1.0.1",
51
+ "@molecule/app-oauth-buttons-solid": "^1.0.0",
52
+ "@molecule/app-solid": "^3.5.0",
53
+ "@molecule/app-ui": "^1.0.1",
54
+ "@molecule/app-ui-solid": "^1.1.0",
55
+ "solid-js": "^1.8.0"
56
+ },
57
+ "devDependencies": {
58
+ "@molecule/app-auth-shell-solid": "1.1.0",
59
+ "@molecule/app-framework-conformance": "0.0.0",
60
+ "@molecule/app-i18n": "1.2.2",
61
+ "@molecule/app-icons": "1.0.4",
62
+ "@molecule/app-oauth-buttons-solid": "1.2.0",
63
+ "@molecule/app-solid": "3.9.0",
64
+ "@molecule/app-ui": "1.5.0",
65
+ "@molecule/app-ui-solid": "1.2.1",
66
+ "@types/node": "26.6.5",
67
+ "jsdom": "30.1.3",
68
+ "solid-js": "1.9.17",
69
+ "typescript": "6.0.3",
70
+ "vite-plugin-solid": "2.11.15",
71
+ "vitest": "4.1.12"
72
+ }
73
+ }