@blimu/react 1.1.0 → 1.1.1
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/dist/_virtual/index.cjs +5 -1
- package/dist/_virtual/index.cjs.map +1 -1
- package/dist/_virtual/index.js +3 -3
- package/dist/_virtual/index2.cjs +4 -1
- package/dist/_virtual/index2.cjs.map +1 -1
- package/dist/_virtual/index2.js +2 -2
- package/dist/_virtual/use-sync-external-store-shim.development.cjs +4 -1
- package/dist/_virtual/use-sync-external-store-shim.development.cjs.map +1 -1
- package/dist/_virtual/use-sync-external-store-shim.development.js +2 -2
- package/dist/_virtual/use-sync-external-store-shim.production.cjs +4 -1
- package/dist/_virtual/use-sync-external-store-shim.production.cjs.map +1 -1
- package/dist/_virtual/use-sync-external-store-shim.production.js +2 -2
- package/dist/client/auth.service.cjs +249 -1
- package/dist/client/auth.service.cjs.map +1 -1
- package/dist/client/auth.service.js +194 -96
- package/dist/client/auth.service.js.map +1 -1
- package/dist/client/external-store.cjs +26 -1
- package/dist/client/external-store.cjs.map +1 -1
- package/dist/client/external-store.js +22 -8
- package/dist/client/external-store.js.map +1 -1
- package/dist/client/runtime-client.cjs +136 -1
- package/dist/client/runtime-client.cjs.map +1 -1
- package/dist/client/runtime-client.js +85 -51
- package/dist/client/runtime-client.js.map +1 -1
- package/dist/components/index.cjs +13 -0
- package/dist/components/index.cjs.map +1 -0
- package/dist/components/index.js +13 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/members-list.cjs +132 -1
- package/dist/components/members-list.cjs.map +1 -1
- package/dist/components/members-list.js +69 -64
- package/dist/components/members-list.js.map +1 -1
- package/dist/components/redirect-to-sign-in.cjs +34 -1
- package/dist/components/redirect-to-sign-in.cjs.map +1 -1
- package/dist/components/redirect-to-sign-in.js +28 -20
- package/dist/components/redirect-to-sign-in.js.map +1 -1
- package/dist/components/sign-in-button.cjs +36 -1
- package/dist/components/sign-in-button.cjs.map +1 -1
- package/dist/components/sign-in-button.js +25 -21
- package/dist/components/sign-in-button.js.map +1 -1
- package/dist/components/ui/avatar.cjs +42 -1
- package/dist/components/ui/avatar.cjs.map +1 -1
- package/dist/components/ui/avatar.js +23 -23
- package/dist/components/ui/avatar.js.map +1 -1
- package/dist/components/ui/dropdown-menu.cjs +148 -1
- package/dist/components/ui/dropdown-menu.cjs.map +1 -1
- package/dist/components/ui/dropdown-menu.js +83 -81
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/user-avatar.cjs +22 -1
- package/dist/components/user-avatar.cjs.map +1 -1
- package/dist/components/user-avatar.js +16 -16
- package/dist/components/user-avatar.js.map +1 -1
- package/dist/components/user-button/styles.cjs +39 -1
- package/dist/components/user-button/styles.cjs.map +1 -1
- package/dist/components/user-button/styles.js +6 -5
- package/dist/components/user-button/styles.js.map +1 -1
- package/dist/components/user-button/user-button.cjs +98 -1
- package/dist/components/user-button/user-button.cjs.map +1 -1
- package/dist/components/user-button/user-button.js +64 -58
- package/dist/components/user-button/user-button.js.map +1 -1
- package/dist/hooks/index.cjs +14 -0
- package/dist/hooks/index.cjs.map +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +14 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/use-auth.cjs +44 -1
- package/dist/hooks/use-auth.cjs.map +1 -1
- package/dist/hooks/use-auth.d.ts +13 -15
- package/dist/hooks/use-auth.d.ts.map +1 -1
- package/dist/hooks/use-auth.js +30 -26
- package/dist/hooks/use-auth.js.map +1 -1
- package/dist/hooks/use-client.cjs +9 -1
- package/dist/hooks/use-client.cjs.map +1 -1
- package/dist/hooks/use-client.d.ts +1 -1
- package/dist/hooks/use-client.d.ts.map +1 -1
- package/dist/hooks/use-client.js +6 -5
- package/dist/hooks/use-client.js.map +1 -1
- package/dist/hooks/use-members.cjs +60 -1
- package/dist/hooks/use-members.cjs.map +1 -1
- package/dist/hooks/use-members.js +53 -41
- package/dist/hooks/use-members.js.map +1 -1
- package/dist/hooks/use-store.cjs +17 -1
- package/dist/hooks/use-store.cjs.map +1 -1
- package/dist/hooks/use-store.js +7 -7
- package/dist/hooks/use-store.js.map +1 -1
- package/dist/index.cjs +37 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -35
- package/dist/lib/utils.cjs +8 -1
- package/dist/lib/utils.cjs.map +1 -1
- package/dist/lib/utils.js +5 -5
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/variants.cjs +46 -1
- package/dist/lib/variants.cjs.map +1 -1
- package/dist/lib/variants.js +6 -5
- package/dist/lib/variants.js.map +1 -1
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.cjs +721 -1
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.cjs.map +1 -1
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +571 -377
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js.map +1 -1
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.cjs +625 -1
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.cjs.map +1 -1
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +539 -316
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js.map +1 -1
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs +313 -1
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.map +1 -1
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +261 -172
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js.map +1 -1
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.cjs +154 -1
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.cjs.map +1 -1
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.cjs +173 -1
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.cjs.map +1 -1
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +144 -107
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js.map +1 -1
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +111 -87
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js.map +1 -1
- package/dist/node_modules/@radix-ui/primitive/dist/index.cjs +11 -1
- package/dist/node_modules/@radix-ui/primitive/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +7 -5
- package/dist/node_modules/@radix-ui/primitive/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.cjs +42 -1
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +17 -16
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-avatar/dist/index.cjs +140 -1
- package/dist/node_modules/@radix-ui/react-avatar/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-avatar/dist/index.js +105 -57
- package/dist/node_modules/@radix-ui/react-avatar/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-context/dist/index.cjs +80 -1
- package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-context/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-context/dist/index.js +49 -41
- package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-context/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-primitive/dist/index.cjs +56 -1
- package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-primitive/dist/index.js +17 -10
- package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-primitive/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-slot/dist/index.cjs +119 -1
- package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-slot/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-slot/dist/index.js +86 -42
- package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-slot/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-collection/dist/index.cjs +70 -1
- package/dist/node_modules/@radix-ui/react-collection/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-collection/dist/index.js +57 -37
- package/dist/node_modules/@radix-ui/react-collection/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +56 -1
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +29 -19
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-context/dist/index.cjs +79 -1
- package/dist/node_modules/@radix-ui/react-context/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +48 -39
- package/dist/node_modules/@radix-ui/react-context/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-direction/dist/index.cjs +27 -1
- package/dist/node_modules/@radix-ui/react-direction/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-direction/dist/index.js +6 -6
- package/dist/node_modules/@radix-ui/react-direction/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs +229 -1
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +182 -97
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.cjs +296 -1
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +232 -167
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.cjs +46 -1
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +23 -11
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.cjs +224 -1
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +169 -98
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-id/dist/index.cjs +31 -1
- package/dist/node_modules/@radix-ui/react-id/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +11 -10
- package/dist/node_modules/@radix-ui/react-id/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-menu/dist/index.cjs +845 -1
- package/dist/node_modules/@radix-ui/react-menu/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-menu/dist/index.js +662 -442
- package/dist/node_modules/@radix-ui/react-menu/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-popper/dist/index.cjs +308 -1
- package/dist/node_modules/@radix-ui/react-popper/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-popper/dist/index.js +209 -137
- package/dist/node_modules/@radix-ui/react-popper/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-portal/dist/index.cjs +34 -1
- package/dist/node_modules/@radix-ui/react-portal/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +14 -12
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-presence/dist/index.cjs +145 -1
- package/dist/node_modules/@radix-ui/react-presence/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +103 -45
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.cjs +61 -1
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +21 -14
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.cjs +244 -1
- package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +179 -135
- package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs +105 -1
- package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +74 -35
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs +28 -1
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +8 -7
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs +86 -1
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +57 -40
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.cjs +34 -1
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +13 -10
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.cjs +15 -1
- package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +8 -8
- package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs +23 -1
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +3 -3
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-use-size/dist/index.cjs +56 -1
- package/dist/node_modules/@radix-ui/react-use-size/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +34 -22
- package/dist/node_modules/@radix-ui/react-use-size/dist/index.js.map +1 -1
- package/dist/node_modules/aria-hidden/dist/es2015/index.cjs +122 -1
- package/dist/node_modules/aria-hidden/dist/es2015/index.cjs.map +1 -1
- package/dist/node_modules/aria-hidden/dist/es2015/index.js +111 -41
- package/dist/node_modules/aria-hidden/dist/es2015/index.js.map +1 -1
- package/dist/node_modules/class-variance-authority/dist/index.cjs +45 -1
- package/dist/node_modules/class-variance-authority/dist/index.cjs.map +1 -1
- package/dist/node_modules/class-variance-authority/dist/index.js +40 -30
- package/dist/node_modules/class-variance-authority/dist/index.js.map +1 -1
- package/dist/node_modules/clsx/dist/clsx.cjs +17 -1
- package/dist/node_modules/clsx/dist/clsx.cjs.map +1 -1
- package/dist/node_modules/clsx/dist/clsx.js +13 -13
- package/dist/node_modules/clsx/dist/clsx.js.map +1 -1
- package/dist/node_modules/get-nonce/dist/es2015/index.cjs +9 -1
- package/dist/node_modules/get-nonce/dist/es2015/index.cjs.map +1 -1
- package/dist/node_modules/get-nonce/dist/es2015/index.js +5 -3
- package/dist/node_modules/get-nonce/dist/es2015/index.js.map +1 -1
- package/dist/node_modules/js-cookie/dist/js.cookie.cjs +98 -1
- package/dist/node_modules/js-cookie/dist/js.cookie.cjs.map +1 -1
- package/dist/node_modules/js-cookie/dist/js.cookie.js +69 -43
- package/dist/node_modules/js-cookie/dist/js.cookie.js.map +1 -1
- package/dist/node_modules/jwt-decode/build/esm/index.cjs +58 -1
- package/dist/node_modules/jwt-decode/build/esm/index.cjs.map +1 -1
- package/dist/node_modules/jwt-decode/build/esm/index.js +36 -30
- package/dist/node_modules/jwt-decode/build/esm/index.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/Icon.cjs +34 -1
- package/dist/node_modules/lucide-react/dist/esm/Icon.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/Icon.js +25 -25
- package/dist/node_modules/lucide-react/dist/esm/Icon.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.cjs +21 -1
- package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.js +16 -15
- package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.cjs +13 -1
- package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.js +2 -2
- package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/check.cjs +7 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/check.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/check.js +5 -4
- package/dist/node_modules/lucide-react/dist/esm/icons/check.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-right.cjs +7 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-right.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-right.js +5 -4
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-right.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/circle.cjs +7 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/circle.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/circle.js +5 -4
- package/dist/node_modules/lucide-react/dist/esm/icons/circle.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/log-out.cjs +11 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/log-out.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/log-out.js +6 -5
- package/dist/node_modules/lucide-react/dist/esm/icons/log-out.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.cjs +26 -1
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.js +22 -14
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.js.map +1 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.cjs +27 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.cjs.map +1 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +8 -8
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js.map +1 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.cjs +197 -4
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.cjs.map +1 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +163 -98
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js.map +1 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.cjs +55 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.cjs.map +1 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +31 -24
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js.map +1 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.cjs +19 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.cjs.map +1 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +12 -9
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js.map +1 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.cjs +102 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.cjs.map +1 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +85 -51
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js.map +1 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.cjs +5 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.cjs.map +1 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +3 -3
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js.map +1 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.cjs +6 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.cjs.map +1 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +5 -5
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js.map +1 -1
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.cjs +62 -36
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.cjs.map +1 -1
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +41 -65
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js.map +1 -1
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.cjs +10 -1
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.cjs.map +1 -1
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +8 -5
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js.map +1 -1
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.cjs +37 -1
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.cjs.map +1 -1
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +28 -16
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js.map +1 -1
- package/dist/node_modules/react-style-singleton/dist/es2015/component.cjs +13 -1
- package/dist/node_modules/react-style-singleton/dist/es2015/component.cjs.map +1 -1
- package/dist/node_modules/react-style-singleton/dist/es2015/component.js +9 -7
- package/dist/node_modules/react-style-singleton/dist/es2015/component.js.map +1 -1
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.cjs +33 -1
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.cjs.map +1 -1
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +11 -10
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.js.map +1 -1
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.cjs +48 -1
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.cjs.map +1 -1
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +35 -17
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js.map +1 -1
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.cjs +3014 -1
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.cjs.map +1 -1
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +804 -555
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -1
- package/dist/node_modules/tailwindcss/dist/plugin.cjs +12 -1
- package/dist/node_modules/tailwindcss/dist/plugin.cjs.map +1 -1
- package/dist/node_modules/tailwindcss/dist/plugin.js +8 -8
- package/dist/node_modules/tailwindcss/dist/plugin.js.map +1 -1
- package/dist/node_modules/tslib/tslib.es6.cjs +38 -1
- package/dist/node_modules/tslib/tslib.es6.cjs.map +1 -1
- package/dist/node_modules/tslib/tslib.es6.js +33 -21
- package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.cjs +11 -1
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.cjs.map +1 -1
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +8 -3
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js.map +1 -1
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.cjs +52 -1
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.cjs.map +1 -1
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +28 -19
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js.map +1 -1
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.cjs +29 -1
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.cjs.map +1 -1
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +15 -11
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js.map +1 -1
- package/dist/node_modules/use-sidecar/dist/es2015/exports.cjs +38 -1
- package/dist/node_modules/use-sidecar/dist/es2015/exports.cjs.map +1 -1
- package/dist/node_modules/use-sidecar/dist/es2015/exports.js +15 -12
- package/dist/node_modules/use-sidecar/dist/es2015/exports.js.map +1 -1
- package/dist/node_modules/use-sidecar/dist/es2015/medium.cjs +88 -1
- package/dist/node_modules/use-sidecar/dist/es2015/medium.cjs.map +1 -1
- package/dist/node_modules/use-sidecar/dist/es2015/medium.js +64 -43
- package/dist/node_modules/use-sidecar/dist/es2015/medium.js.map +1 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs +68 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs.map +1 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +49 -39
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.cjs +53 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.cjs.map +1 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +39 -32
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js.map +1 -1
- package/dist/node_modules/use-sync-external-store/shim/index.cjs +17 -1
- package/dist/node_modules/use-sync-external-store/shim/index.cjs.map +1 -1
- package/dist/node_modules/use-sync-external-store/shim/index.js +14 -7
- package/dist/node_modules/use-sync-external-store/shim/index.js.map +1 -1
- package/dist/providers/auth/auth.context.cjs +5 -1
- package/dist/providers/auth/auth.context.cjs.map +1 -1
- package/dist/providers/auth/auth.context.js +3 -3
- package/dist/providers/auth/auth.context.js.map +1 -1
- package/dist/providers/auth/auth.hook.cjs +12 -1
- package/dist/providers/auth/auth.hook.cjs.map +1 -1
- package/dist/providers/auth/auth.hook.js +8 -7
- package/dist/providers/auth/auth.hook.js.map +1 -1
- package/dist/providers/auth/auth.provider.cjs +37 -1
- package/dist/providers/auth/auth.provider.cjs.map +1 -1
- package/dist/providers/auth/auth.provider.js +31 -22
- package/dist/providers/auth/auth.provider.js.map +1 -1
- package/dist/providers/blimu/blimu.context.cjs +5 -1
- package/dist/providers/blimu/blimu.context.cjs.map +1 -1
- package/dist/providers/blimu/blimu.context.js +3 -3
- package/dist/providers/blimu/blimu.context.js.map +1 -1
- package/dist/providers/blimu/blimu.hook.cjs +12 -1
- package/dist/providers/blimu/blimu.hook.cjs.map +1 -1
- package/dist/providers/blimu/blimu.hook.js +8 -7
- package/dist/providers/blimu/blimu.hook.js.map +1 -1
- package/dist/providers/blimu/blimu.provider.cjs +71 -1
- package/dist/providers/blimu/blimu.provider.cjs.map +1 -1
- package/dist/providers/blimu/blimu.provider.js +32 -27
- package/dist/providers/blimu/blimu.provider.js.map +1 -1
- package/dist/providers/index.cjs +13 -0
- package/dist/providers/index.cjs.map +1 -0
- package/dist/providers/index.js +13 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/theme/theme.context.cjs +5 -1
- package/dist/providers/theme/theme.context.cjs.map +1 -1
- package/dist/providers/theme/theme.context.js +3 -3
- package/dist/providers/theme/theme.context.js.map +1 -1
- package/dist/providers/theme/theme.hook.cjs +12 -1
- package/dist/providers/theme/theme.hook.cjs.map +1 -1
- package/dist/providers/theme/theme.hook.js +8 -7
- package/dist/providers/theme/theme.hook.js.map +1 -1
- package/dist/providers/theme/theme.provider.cjs +104 -1
- package/dist/providers/theme/theme.provider.cjs.map +1 -1
- package/dist/providers/theme/theme.provider.js +85 -48
- package/dist/providers/theme/theme.provider.js.map +1 -1
- package/dist/tailwind.cjs +200 -0
- package/dist/tailwind.cjs.map +1 -0
- package/dist/{tailwind.plugin.js → tailwind.js} +6 -6
- package/dist/tailwind.js.map +1 -0
- package/dist/types/index.cjs +11 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.js +8 -8
- package/dist/types/index.js.map +1 -1
- package/dist/utils/publishable-key.cjs +62 -1
- package/dist/utils/publishable-key.cjs.map +1 -1
- package/dist/utils/publishable-key.js +52 -27
- package/dist/utils/publishable-key.js.map +1 -1
- package/package.json +41 -42
- package/dist/components.cjs +0 -2
- package/dist/components.cjs.map +0 -1
- package/dist/components.js +0 -13
- package/dist/components.js.map +0 -1
- package/dist/hooks.cjs +0 -2
- package/dist/hooks.cjs.map +0 -1
- package/dist/hooks.js +0 -14
- package/dist/hooks.js.map +0 -1
- package/dist/providers.cjs +0 -2
- package/dist/providers.cjs.map +0 -1
- package/dist/providers.js +0 -13
- package/dist/providers.js.map +0 -1
- package/dist/tailwind.plugin.cjs +0 -2
- package/dist/tailwind.plugin.cjs.map +0 -1
- package/dist/tailwind.plugin.js.map +0 -1
|
@@ -1,2 +1,137 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const client = require("@blimu/client");
|
|
4
|
+
const publishableKey = require("../utils/publishable-key.cjs");
|
|
5
|
+
const auth_service = require("./auth.service.cjs");
|
|
6
|
+
const externalStore = require("./external-store.cjs");
|
|
7
|
+
class BlimuRuntimeClientWrapper {
|
|
8
|
+
constructor(config) {
|
|
9
|
+
this.authDomain = null;
|
|
10
|
+
this.initialized = false;
|
|
11
|
+
this.initializePromise = null;
|
|
12
|
+
this.initializeAbortController = null;
|
|
13
|
+
this.redirectToAuth = (returnUrl) => {
|
|
14
|
+
const redirectUrl = returnUrl || window.location.href;
|
|
15
|
+
const authUrl = new URL(`${this.authDomain}/login`);
|
|
16
|
+
authUrl.searchParams.set("redirect_url", encodeURIComponent(redirectUrl));
|
|
17
|
+
window.location.href = authUrl.toString();
|
|
18
|
+
};
|
|
19
|
+
this.logout = async () => {
|
|
20
|
+
try {
|
|
21
|
+
const sessionToken = this.session.getSessionToken();
|
|
22
|
+
if (sessionToken) {
|
|
23
|
+
await this.client.auth.logout({
|
|
24
|
+
headers: {
|
|
25
|
+
"x-blimu-publishable-key": this.config.publishableKey,
|
|
26
|
+
Authorization: `Bearer ${sessionToken}`
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error("Logout error:", error);
|
|
32
|
+
} finally {
|
|
33
|
+
this.store.setState({
|
|
34
|
+
user: null,
|
|
35
|
+
error: null,
|
|
36
|
+
status: "unauthenticated"
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
this.getAccessToken = async (_options) => {
|
|
41
|
+
return await this.session.getSessionToken() ?? null;
|
|
42
|
+
};
|
|
43
|
+
this.config = config;
|
|
44
|
+
this.store = new externalStore.ExternalStore({
|
|
45
|
+
user: null,
|
|
46
|
+
error: null,
|
|
47
|
+
status: "idle"
|
|
48
|
+
});
|
|
49
|
+
this.isLive = config.publishableKey.includes("live");
|
|
50
|
+
this.authDomain = publishableKey.getAuthDomainFromPublishableKey(config.publishableKey);
|
|
51
|
+
if (!this.authDomain) {
|
|
52
|
+
throw new Error("Failed to determine auth domain from publishable key");
|
|
53
|
+
}
|
|
54
|
+
const authApiUrl = publishableKey.getAuthApiUrl(config.publishableKey);
|
|
55
|
+
if (!authApiUrl) {
|
|
56
|
+
throw new Error("Failed to determine auth API URL from publishable key");
|
|
57
|
+
}
|
|
58
|
+
this.client = new client.Blimu({
|
|
59
|
+
baseURL: authApiUrl,
|
|
60
|
+
bearer: () => this.session.getSessionToken(),
|
|
61
|
+
headers: { "x-blimu-publishable-key": config.publishableKey }
|
|
62
|
+
});
|
|
63
|
+
this.session = new auth_service.AuthSessionService(
|
|
64
|
+
this.isLive,
|
|
65
|
+
this.client,
|
|
66
|
+
this.store,
|
|
67
|
+
authApiUrl,
|
|
68
|
+
config.publishableKey
|
|
69
|
+
);
|
|
70
|
+
this.initialize = this.initialize.bind(this);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Initialize authentication by checking for existing session
|
|
74
|
+
* Reads session token from cookie and validates it
|
|
75
|
+
* This method is idempotent - if initialization is already in progress, it will wait for that to complete
|
|
76
|
+
*/
|
|
77
|
+
initialize() {
|
|
78
|
+
if (this.initialized) return;
|
|
79
|
+
if (this.initializePromise) return;
|
|
80
|
+
this.initializeAbortController = new AbortController();
|
|
81
|
+
this.initializePromise = this.session.initialize({
|
|
82
|
+
signal: this.initializeAbortController.signal
|
|
83
|
+
}).then((result) => {
|
|
84
|
+
if (result.error) {
|
|
85
|
+
this.store.setState({
|
|
86
|
+
user: null,
|
|
87
|
+
error: result.error,
|
|
88
|
+
status: "error"
|
|
89
|
+
});
|
|
90
|
+
} else if (result.user) {
|
|
91
|
+
this.store.setState({
|
|
92
|
+
user: result.user,
|
|
93
|
+
error: null,
|
|
94
|
+
status: "authenticated"
|
|
95
|
+
});
|
|
96
|
+
} else {
|
|
97
|
+
this.store.setState({
|
|
98
|
+
user: null,
|
|
99
|
+
error: null,
|
|
100
|
+
status: "unauthenticated"
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}).catch((error) => {
|
|
104
|
+
console.error("Initialize error:", error);
|
|
105
|
+
this.store.setState({
|
|
106
|
+
user: null,
|
|
107
|
+
error: error instanceof Error ? error.message : "Initialization failed",
|
|
108
|
+
status: "error"
|
|
109
|
+
});
|
|
110
|
+
}).finally(() => {
|
|
111
|
+
this.initialized = true;
|
|
112
|
+
this.initializePromise = null;
|
|
113
|
+
});
|
|
114
|
+
return () => {
|
|
115
|
+
console.log("aborting initialize");
|
|
116
|
+
this.initializeAbortController?.abort("unmounting");
|
|
117
|
+
this.initializePromise = null;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Refresh session token using the client token from httpOnly cookie
|
|
122
|
+
* The client token is stored in an httpOnly cookie and sent automatically
|
|
123
|
+
* Note: The auth worker should extract the __bli_client cookie and include it in the request body
|
|
124
|
+
* This method is idempotent - if a refresh is already in progress, it will wait for that refresh to complete
|
|
125
|
+
*/
|
|
126
|
+
scheduleRefresh() {
|
|
127
|
+
return this.session.scheduleRefresh();
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Get the runtime client for direct API calls
|
|
131
|
+
*/
|
|
132
|
+
getClient() {
|
|
133
|
+
return this.client;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
exports.BlimuRuntimeClientWrapper = BlimuRuntimeClientWrapper;
|
|
2
137
|
//# sourceMappingURL=runtime-client.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-client.cjs","sources":["../../src/client/runtime-client.ts"],"sourcesContent":["import { Blimu } from '@blimu/client';\n\nimport type { AuthState, BlimuConfig, User } from '../types';\nimport { getAuthApiUrl, getAuthDomainFromPublishableKey } from '../utils/publishable-key';\nimport { AuthSessionService, LOCALHOST_JWT_URL_PARAM_NAME } from './auth.service';\nimport { ExternalStore } from './external-store';\n\nexport class BlimuRuntimeClientWrapper {\n private client: Blimu;\n private authDomain: string | null = null;\n private initialized: boolean = false;\n private readonly session: AuthSessionService;\n\n public config: BlimuConfig;\n public isLive: boolean;\n private initializePromise: Promise<void> | null = null;\n private initializeAbortController: AbortController | null = null;\n\n public readonly store: ExternalStore<AuthState>;\n\n constructor(config: BlimuConfig) {\n this.config = config;\n this.store = new ExternalStore<AuthState>({\n user: null,\n error: null,\n status: 'idle',\n });\n this.isLive = config.publishableKey.includes('live');\n\n // Get auth UI domain from publishable key\n this.authDomain = getAuthDomainFromPublishableKey(config.publishableKey);\n if (!this.authDomain) {\n throw new Error('Failed to determine auth domain from publishable key');\n }\n\n // Get auth API URL from publishable key\n const authApiUrl = getAuthApiUrl(config.publishableKey);\n\n if (!authApiUrl) {\n throw new Error('Failed to determine auth API URL from publishable key');\n }\n\n this.client = new Blimu({\n baseURL: authApiUrl,\n bearer: () => this.session.getSessionToken(),\n headers: { 'x-blimu-publishable-key': config.publishableKey },\n });\n\n this.session = new AuthSessionService(\n this.isLive,\n this.client,\n this.store,\n authApiUrl,\n config.publishableKey,\n );\n\n this.initialize = this.initialize.bind(this);\n }\n\n /**\n * Initialize authentication by checking for existing session\n * Reads session token from cookie and validates it\n * This method is idempotent - if initialization is already in progress, it will wait for that to complete\n */\n initialize(): (() => void) | void {\n // If already initialized, return early\n if (this.initialized) return;\n\n // If initialization is in progress, return early (prevents concurrent calls)\n if (this.initializePromise) return;\n\n this.initializeAbortController = new AbortController();\n\n this.initializePromise = this.session\n .initialize({\n signal: this.initializeAbortController.signal,\n })\n .then((result) => {\n if (result.error) {\n this.store.setState({\n user: null,\n error: result.error,\n status: 'error',\n });\n } else if (result.user) {\n this.store.setState({\n user: result.user,\n error: null,\n status: 'authenticated',\n });\n } else {\n this.store.setState({\n user: null,\n error: null,\n status: 'unauthenticated',\n });\n }\n })\n .catch((error) => {\n console.error('Initialize error:', error);\n this.store.setState({\n user: null,\n error: error instanceof Error ? error.message : 'Initialization failed',\n status: 'error',\n });\n })\n .finally(() => {\n // Mark as initialized after completion (success or failure)\n // This prevents infinite loops from re-renders\n this.initialized = true;\n this.initializePromise = null;\n });\n\n return () => {\n console.log('aborting initialize');\n this.initializeAbortController?.abort('unmounting');\n this.initializePromise = null;\n // Don't reset initialized flag here - let the promise handle it\n };\n }\n\n /**\n * Refresh session token using the client token from httpOnly cookie\n * The client token is stored in an httpOnly cookie and sent automatically\n * Note: The auth worker should extract the __bli_client cookie and include it in the request body\n * This method is idempotent - if a refresh is already in progress, it will wait for that refresh to complete\n */\n public scheduleRefresh() {\n return this.session.scheduleRefresh();\n }\n\n /**\n * Redirect user to auth domain for authentication\n * Uses the auth domain derived from the publishable key\n */\n public redirectToAuth = (returnUrl?: string): void => {\n const redirectUrl = returnUrl || window.location.href;\n\n // Build auth URL on the auth domain\n const authUrl = new URL(`${this.authDomain}/login`);\n authUrl.searchParams.set('redirect_url', encodeURIComponent(redirectUrl));\n\n // Redirect to auth domain\n window.location.href = authUrl.toString();\n };\n\n /**\n * Logout user\n * Calls the logout endpoint on the API domain using this.client\n */\n public logout = async (): Promise<void> => {\n try {\n const sessionToken = this.session.getSessionToken();\n\n if (sessionToken) {\n await this.client.auth.logout({\n headers: {\n 'x-blimu-publishable-key': this.config.publishableKey,\n Authorization: `Bearer ${sessionToken}`,\n },\n });\n }\n } catch (error) {\n console.error('Logout error:', error);\n } finally {\n this.store.setState({\n user: null,\n error: null,\n status: 'unauthenticated',\n });\n }\n };\n\n /**\n * Get the current session token\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getAccessToken = async (_options: { template: 'web' }): Promise<string | null> => {\n return (await this.session.getSessionToken()) ?? null;\n };\n\n /**\n * Get the runtime client for direct API calls\n */\n getClient(): Blimu {\n return this.client;\n }\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"runtime-client.cjs","sources":["../../src/client/runtime-client.ts"],"sourcesContent":["import { Blimu } from '@blimu/client';\n\nimport type { AuthState, BlimuConfig, User } from '../types';\nimport { getAuthApiUrl, getAuthDomainFromPublishableKey } from '../utils/publishable-key';\nimport { AuthSessionService, LOCALHOST_JWT_URL_PARAM_NAME } from './auth.service';\nimport { ExternalStore } from './external-store';\n\nexport class BlimuRuntimeClientWrapper {\n private client: Blimu;\n private authDomain: string | null = null;\n private initialized: boolean = false;\n private readonly session: AuthSessionService;\n\n public config: BlimuConfig;\n public isLive: boolean;\n private initializePromise: Promise<void> | null = null;\n private initializeAbortController: AbortController | null = null;\n\n public readonly store: ExternalStore<AuthState>;\n\n constructor(config: BlimuConfig) {\n this.config = config;\n this.store = new ExternalStore<AuthState>({\n user: null,\n error: null,\n status: 'idle',\n });\n this.isLive = config.publishableKey.includes('live');\n\n // Get auth UI domain from publishable key\n this.authDomain = getAuthDomainFromPublishableKey(config.publishableKey);\n if (!this.authDomain) {\n throw new Error('Failed to determine auth domain from publishable key');\n }\n\n // Get auth API URL from publishable key\n const authApiUrl = getAuthApiUrl(config.publishableKey);\n\n if (!authApiUrl) {\n throw new Error('Failed to determine auth API URL from publishable key');\n }\n\n this.client = new Blimu({\n baseURL: authApiUrl,\n bearer: () => this.session.getSessionToken(),\n headers: { 'x-blimu-publishable-key': config.publishableKey },\n });\n\n this.session = new AuthSessionService(\n this.isLive,\n this.client,\n this.store,\n authApiUrl,\n config.publishableKey,\n );\n\n this.initialize = this.initialize.bind(this);\n }\n\n /**\n * Initialize authentication by checking for existing session\n * Reads session token from cookie and validates it\n * This method is idempotent - if initialization is already in progress, it will wait for that to complete\n */\n initialize(): (() => void) | void {\n // If already initialized, return early\n if (this.initialized) return;\n\n // If initialization is in progress, return early (prevents concurrent calls)\n if (this.initializePromise) return;\n\n this.initializeAbortController = new AbortController();\n\n this.initializePromise = this.session\n .initialize({\n signal: this.initializeAbortController.signal,\n })\n .then((result) => {\n if (result.error) {\n this.store.setState({\n user: null,\n error: result.error,\n status: 'error',\n });\n } else if (result.user) {\n this.store.setState({\n user: result.user,\n error: null,\n status: 'authenticated',\n });\n } else {\n this.store.setState({\n user: null,\n error: null,\n status: 'unauthenticated',\n });\n }\n })\n .catch((error) => {\n console.error('Initialize error:', error);\n this.store.setState({\n user: null,\n error: error instanceof Error ? error.message : 'Initialization failed',\n status: 'error',\n });\n })\n .finally(() => {\n // Mark as initialized after completion (success or failure)\n // This prevents infinite loops from re-renders\n this.initialized = true;\n this.initializePromise = null;\n });\n\n return () => {\n console.log('aborting initialize');\n this.initializeAbortController?.abort('unmounting');\n this.initializePromise = null;\n // Don't reset initialized flag here - let the promise handle it\n };\n }\n\n /**\n * Refresh session token using the client token from httpOnly cookie\n * The client token is stored in an httpOnly cookie and sent automatically\n * Note: The auth worker should extract the __bli_client cookie and include it in the request body\n * This method is idempotent - if a refresh is already in progress, it will wait for that refresh to complete\n */\n public scheduleRefresh() {\n return this.session.scheduleRefresh();\n }\n\n /**\n * Redirect user to auth domain for authentication\n * Uses the auth domain derived from the publishable key\n */\n public redirectToAuth = (returnUrl?: string): void => {\n const redirectUrl = returnUrl || window.location.href;\n\n // Build auth URL on the auth domain\n const authUrl = new URL(`${this.authDomain}/login`);\n authUrl.searchParams.set('redirect_url', encodeURIComponent(redirectUrl));\n\n // Redirect to auth domain\n window.location.href = authUrl.toString();\n };\n\n /**\n * Logout user\n * Calls the logout endpoint on the API domain using this.client\n */\n public logout = async (): Promise<void> => {\n try {\n const sessionToken = this.session.getSessionToken();\n\n if (sessionToken) {\n await this.client.auth.logout({\n headers: {\n 'x-blimu-publishable-key': this.config.publishableKey,\n Authorization: `Bearer ${sessionToken}`,\n },\n });\n }\n } catch (error) {\n console.error('Logout error:', error);\n } finally {\n this.store.setState({\n user: null,\n error: null,\n status: 'unauthenticated',\n });\n }\n };\n\n /**\n * Get the current session token\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getAccessToken = async (_options: { template: 'web' }): Promise<string | null> => {\n return (await this.session.getSessionToken()) ?? null;\n };\n\n /**\n * Get the runtime client for direct API calls\n */\n getClient(): Blimu {\n return this.client;\n }\n}\n"],"names":["ExternalStore","getAuthDomainFromPublishableKey","getAuthApiUrl","Blimu","AuthSessionService"],"mappings":";;;;;;AAOO,MAAM,0BAA0B;AAAA,EAarC,YAAY,QAAqB;AAXjC,SAAQ,aAA4B;AACpC,SAAQ,cAAuB;AAK/B,SAAQ,oBAA0C;AAClD,SAAQ,4BAAoD;AAuH5D,SAAO,iBAAiB,CAAC,cAA6B;AACpD,YAAM,cAAc,aAAa,OAAO,SAAS;AAGjD,YAAM,UAAU,IAAI,IAAI,GAAG,KAAK,UAAU,QAAQ;AAClD,cAAQ,aAAa,IAAI,gBAAgB,mBAAmB,WAAW,CAAC;AAGxE,aAAO,SAAS,OAAO,QAAQ,SAAA;AAAA,IACjC;AAMA,SAAO,SAAS,YAA2B;AACzC,UAAI;AACF,cAAM,eAAe,KAAK,QAAQ,gBAAA;AAElC,YAAI,cAAc;AAChB,gBAAM,KAAK,OAAO,KAAK,OAAO;AAAA,YAC5B,SAAS;AAAA,cACP,2BAA2B,KAAK,OAAO;AAAA,cACvC,eAAe,UAAU,YAAY;AAAA,YAAA;AAAA,UACvC,CACD;AAAA,QACH;AAAA,MACF,SAAS,OAAO;AACd,gBAAQ,MAAM,iBAAiB,KAAK;AAAA,MACtC,UAAA;AACE,aAAK,MAAM,SAAS;AAAA,UAClB,MAAM;AAAA,UACN,OAAO;AAAA,UACP,QAAQ;AAAA,QAAA,CACT;AAAA,MACH;AAAA,IACF;AAMA,SAAA,iBAAiB,OAAO,aAA0D;AAChF,aAAQ,MAAM,KAAK,QAAQ,gBAAA,KAAsB;AAAA,IACnD;AA9JE,SAAK,SAAS;AACd,SAAK,QAAQ,IAAIA,4BAAyB;AAAA,MACxC,MAAM;AAAA,MACN,OAAO;AAAA,MACP,QAAQ;AAAA,IAAA,CACT;AACD,SAAK,SAAS,OAAO,eAAe,SAAS,MAAM;AAGnD,SAAK,aAAaC,+CAAgC,OAAO,cAAc;AACvE,QAAI,CAAC,KAAK,YAAY;AACpB,YAAM,IAAI,MAAM,sDAAsD;AAAA,IACxE;AAGA,UAAM,aAAaC,eAAAA,cAAc,OAAO,cAAc;AAEtD,QAAI,CAAC,YAAY;AACf,YAAM,IAAI,MAAM,uDAAuD;AAAA,IACzE;AAEA,SAAK,SAAS,IAAIC,aAAM;AAAA,MACtB,SAAS;AAAA,MACT,QAAQ,MAAM,KAAK,QAAQ,gBAAA;AAAA,MAC3B,SAAS,EAAE,2BAA2B,OAAO,eAAA;AAAA,IAAe,CAC7D;AAED,SAAK,UAAU,IAAIC,aAAAA;AAAAA,MACjB,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL;AAAA,MACA,OAAO;AAAA,IAAA;AAGT,SAAK,aAAa,KAAK,WAAW,KAAK,IAAI;AAAA,EAC7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,aAAkC;AAEhC,QAAI,KAAK,YAAa;AAGtB,QAAI,KAAK,kBAAmB;AAE5B,SAAK,4BAA4B,IAAI,gBAAA;AAErC,SAAK,oBAAoB,KAAK,QAC3B,WAAW;AAAA,MACV,QAAQ,KAAK,0BAA0B;AAAA,IAAA,CACxC,EACA,KAAK,CAAC,WAAW;AAChB,UAAI,OAAO,OAAO;AAChB,aAAK,MAAM,SAAS;AAAA,UAClB,MAAM;AAAA,UACN,OAAO,OAAO;AAAA,UACd,QAAQ;AAAA,QAAA,CACT;AAAA,MACH,WAAW,OAAO,MAAM;AACtB,aAAK,MAAM,SAAS;AAAA,UAClB,MAAM,OAAO;AAAA,UACb,OAAO;AAAA,UACP,QAAQ;AAAA,QAAA,CACT;AAAA,MACH,OAAO;AACL,aAAK,MAAM,SAAS;AAAA,UAClB,MAAM;AAAA,UACN,OAAO;AAAA,UACP,QAAQ;AAAA,QAAA,CACT;AAAA,MACH;AAAA,IACF,CAAC,EACA,MAAM,CAAC,UAAU;AAChB,cAAQ,MAAM,qBAAqB,KAAK;AACxC,WAAK,MAAM,SAAS;AAAA,QAClB,MAAM;AAAA,QACN,OAAO,iBAAiB,QAAQ,MAAM,UAAU;AAAA,QAChD,QAAQ;AAAA,MAAA,CACT;AAAA,IACH,CAAC,EACA,QAAQ,MAAM;AAGb,WAAK,cAAc;AACnB,WAAK,oBAAoB;AAAA,IAC3B,CAAC;AAEH,WAAO,MAAM;AACX,cAAQ,IAAI,qBAAqB;AACjC,WAAK,2BAA2B,MAAM,YAAY;AAClD,WAAK,oBAAoB;AAAA,IAE3B;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,kBAAkB;AACvB,WAAO,KAAK,QAAQ,gBAAA;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA,EAuDA,YAAmB;AACjB,WAAO,KAAK;AAAA,EACd;AACF;;"}
|
|
@@ -1,23 +1,32 @@
|
|
|
1
|
-
import { Blimu
|
|
2
|
-
import { getAuthDomainFromPublishableKey
|
|
3
|
-
import { AuthSessionService
|
|
4
|
-
import { ExternalStore
|
|
5
|
-
class
|
|
6
|
-
constructor(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { Blimu } from "@blimu/client";
|
|
2
|
+
import { getAuthDomainFromPublishableKey, getAuthApiUrl } from "../utils/publishable-key.js";
|
|
3
|
+
import { AuthSessionService } from "./auth.service.js";
|
|
4
|
+
import { ExternalStore } from "./external-store.js";
|
|
5
|
+
class BlimuRuntimeClientWrapper {
|
|
6
|
+
constructor(config) {
|
|
7
|
+
this.authDomain = null;
|
|
8
|
+
this.initialized = false;
|
|
9
|
+
this.initializePromise = null;
|
|
10
|
+
this.initializeAbortController = null;
|
|
11
|
+
this.redirectToAuth = (returnUrl) => {
|
|
12
|
+
const redirectUrl = returnUrl || window.location.href;
|
|
13
|
+
const authUrl = new URL(`${this.authDomain}/login`);
|
|
14
|
+
authUrl.searchParams.set("redirect_url", encodeURIComponent(redirectUrl));
|
|
15
|
+
window.location.href = authUrl.toString();
|
|
16
|
+
};
|
|
17
|
+
this.logout = async () => {
|
|
11
18
|
try {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const sessionToken = this.session.getSessionToken();
|
|
20
|
+
if (sessionToken) {
|
|
21
|
+
await this.client.auth.logout({
|
|
22
|
+
headers: {
|
|
23
|
+
"x-blimu-publishable-key": this.config.publishableKey,
|
|
24
|
+
Authorization: `Bearer ${sessionToken}`
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
} catch (error) {
|
|
29
|
+
console.error("Logout error:", error);
|
|
21
30
|
} finally {
|
|
22
31
|
this.store.setState({
|
|
23
32
|
user: null,
|
|
@@ -25,26 +34,38 @@ class p {
|
|
|
25
34
|
status: "unauthenticated"
|
|
26
35
|
});
|
|
27
36
|
}
|
|
28
|
-
}
|
|
37
|
+
};
|
|
38
|
+
this.getAccessToken = async (_options) => {
|
|
39
|
+
return await this.session.getSessionToken() ?? null;
|
|
40
|
+
};
|
|
41
|
+
this.config = config;
|
|
42
|
+
this.store = new ExternalStore({
|
|
29
43
|
user: null,
|
|
30
44
|
error: null,
|
|
31
45
|
status: "idle"
|
|
32
|
-
})
|
|
46
|
+
});
|
|
47
|
+
this.isLive = config.publishableKey.includes("live");
|
|
48
|
+
this.authDomain = getAuthDomainFromPublishableKey(config.publishableKey);
|
|
49
|
+
if (!this.authDomain) {
|
|
33
50
|
throw new Error("Failed to determine auth domain from publishable key");
|
|
34
|
-
|
|
35
|
-
|
|
51
|
+
}
|
|
52
|
+
const authApiUrl = getAuthApiUrl(config.publishableKey);
|
|
53
|
+
if (!authApiUrl) {
|
|
36
54
|
throw new Error("Failed to determine auth API URL from publishable key");
|
|
37
|
-
|
|
38
|
-
|
|
55
|
+
}
|
|
56
|
+
this.client = new Blimu({
|
|
57
|
+
baseURL: authApiUrl,
|
|
39
58
|
bearer: () => this.session.getSessionToken(),
|
|
40
|
-
headers: { "x-blimu-publishable-key":
|
|
41
|
-
})
|
|
59
|
+
headers: { "x-blimu-publishable-key": config.publishableKey }
|
|
60
|
+
});
|
|
61
|
+
this.session = new AuthSessionService(
|
|
42
62
|
this.isLive,
|
|
43
63
|
this.client,
|
|
44
64
|
this.store,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
)
|
|
65
|
+
authApiUrl,
|
|
66
|
+
config.publishableKey
|
|
67
|
+
);
|
|
68
|
+
this.initialize = this.initialize.bind(this);
|
|
48
69
|
}
|
|
49
70
|
/**
|
|
50
71
|
* Initialize authentication by checking for existing session
|
|
@@ -52,34 +73,47 @@ class p {
|
|
|
52
73
|
* This method is idempotent - if initialization is already in progress, it will wait for that to complete
|
|
53
74
|
*/
|
|
54
75
|
initialize() {
|
|
55
|
-
if (
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
76
|
+
if (this.initialized) return;
|
|
77
|
+
if (this.initializePromise) return;
|
|
78
|
+
this.initializeAbortController = new AbortController();
|
|
79
|
+
this.initializePromise = this.session.initialize({
|
|
80
|
+
signal: this.initializeAbortController.signal
|
|
81
|
+
}).then((result) => {
|
|
82
|
+
if (result.error) {
|
|
83
|
+
this.store.setState({
|
|
60
84
|
user: null,
|
|
61
|
-
error:
|
|
85
|
+
error: result.error,
|
|
62
86
|
status: "error"
|
|
63
|
-
})
|
|
64
|
-
|
|
87
|
+
});
|
|
88
|
+
} else if (result.user) {
|
|
89
|
+
this.store.setState({
|
|
90
|
+
user: result.user,
|
|
65
91
|
error: null,
|
|
66
92
|
status: "authenticated"
|
|
67
|
-
})
|
|
93
|
+
});
|
|
94
|
+
} else {
|
|
95
|
+
this.store.setState({
|
|
68
96
|
user: null,
|
|
69
97
|
error: null,
|
|
70
98
|
status: "unauthenticated"
|
|
71
99
|
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
100
|
+
}
|
|
101
|
+
}).catch((error) => {
|
|
102
|
+
console.error("Initialize error:", error);
|
|
103
|
+
this.store.setState({
|
|
104
|
+
user: null,
|
|
105
|
+
error: error instanceof Error ? error.message : "Initialization failed",
|
|
106
|
+
status: "error"
|
|
107
|
+
});
|
|
108
|
+
}).finally(() => {
|
|
109
|
+
this.initialized = true;
|
|
110
|
+
this.initializePromise = null;
|
|
111
|
+
});
|
|
112
|
+
return () => {
|
|
113
|
+
console.log("aborting initialize");
|
|
114
|
+
this.initializeAbortController?.abort("unmounting");
|
|
115
|
+
this.initializePromise = null;
|
|
116
|
+
};
|
|
83
117
|
}
|
|
84
118
|
/**
|
|
85
119
|
* Refresh session token using the client token from httpOnly cookie
|
|
@@ -98,6 +132,6 @@ class p {
|
|
|
98
132
|
}
|
|
99
133
|
}
|
|
100
134
|
export {
|
|
101
|
-
|
|
135
|
+
BlimuRuntimeClientWrapper
|
|
102
136
|
};
|
|
103
137
|
//# sourceMappingURL=runtime-client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-client.js","sources":["../../src/client/runtime-client.ts"],"sourcesContent":["import { Blimu } from '@blimu/client';\n\nimport type { AuthState, BlimuConfig, User } from '../types';\nimport { getAuthApiUrl, getAuthDomainFromPublishableKey } from '../utils/publishable-key';\nimport { AuthSessionService, LOCALHOST_JWT_URL_PARAM_NAME } from './auth.service';\nimport { ExternalStore } from './external-store';\n\nexport class BlimuRuntimeClientWrapper {\n private client: Blimu;\n private authDomain: string | null = null;\n private initialized: boolean = false;\n private readonly session: AuthSessionService;\n\n public config: BlimuConfig;\n public isLive: boolean;\n private initializePromise: Promise<void> | null = null;\n private initializeAbortController: AbortController | null = null;\n\n public readonly store: ExternalStore<AuthState>;\n\n constructor(config: BlimuConfig) {\n this.config = config;\n this.store = new ExternalStore<AuthState>({\n user: null,\n error: null,\n status: 'idle',\n });\n this.isLive = config.publishableKey.includes('live');\n\n // Get auth UI domain from publishable key\n this.authDomain = getAuthDomainFromPublishableKey(config.publishableKey);\n if (!this.authDomain) {\n throw new Error('Failed to determine auth domain from publishable key');\n }\n\n // Get auth API URL from publishable key\n const authApiUrl = getAuthApiUrl(config.publishableKey);\n\n if (!authApiUrl) {\n throw new Error('Failed to determine auth API URL from publishable key');\n }\n\n this.client = new Blimu({\n baseURL: authApiUrl,\n bearer: () => this.session.getSessionToken(),\n headers: { 'x-blimu-publishable-key': config.publishableKey },\n });\n\n this.session = new AuthSessionService(\n this.isLive,\n this.client,\n this.store,\n authApiUrl,\n config.publishableKey,\n );\n\n this.initialize = this.initialize.bind(this);\n }\n\n /**\n * Initialize authentication by checking for existing session\n * Reads session token from cookie and validates it\n * This method is idempotent - if initialization is already in progress, it will wait for that to complete\n */\n initialize(): (() => void) | void {\n // If already initialized, return early\n if (this.initialized) return;\n\n // If initialization is in progress, return early (prevents concurrent calls)\n if (this.initializePromise) return;\n\n this.initializeAbortController = new AbortController();\n\n this.initializePromise = this.session\n .initialize({\n signal: this.initializeAbortController.signal,\n })\n .then((result) => {\n if (result.error) {\n this.store.setState({\n user: null,\n error: result.error,\n status: 'error',\n });\n } else if (result.user) {\n this.store.setState({\n user: result.user,\n error: null,\n status: 'authenticated',\n });\n } else {\n this.store.setState({\n user: null,\n error: null,\n status: 'unauthenticated',\n });\n }\n })\n .catch((error) => {\n console.error('Initialize error:', error);\n this.store.setState({\n user: null,\n error: error instanceof Error ? error.message : 'Initialization failed',\n status: 'error',\n });\n })\n .finally(() => {\n // Mark as initialized after completion (success or failure)\n // This prevents infinite loops from re-renders\n this.initialized = true;\n this.initializePromise = null;\n });\n\n return () => {\n console.log('aborting initialize');\n this.initializeAbortController?.abort('unmounting');\n this.initializePromise = null;\n // Don't reset initialized flag here - let the promise handle it\n };\n }\n\n /**\n * Refresh session token using the client token from httpOnly cookie\n * The client token is stored in an httpOnly cookie and sent automatically\n * Note: The auth worker should extract the __bli_client cookie and include it in the request body\n * This method is idempotent - if a refresh is already in progress, it will wait for that refresh to complete\n */\n public scheduleRefresh() {\n return this.session.scheduleRefresh();\n }\n\n /**\n * Redirect user to auth domain for authentication\n * Uses the auth domain derived from the publishable key\n */\n public redirectToAuth = (returnUrl?: string): void => {\n const redirectUrl = returnUrl || window.location.href;\n\n // Build auth URL on the auth domain\n const authUrl = new URL(`${this.authDomain}/login`);\n authUrl.searchParams.set('redirect_url', encodeURIComponent(redirectUrl));\n\n // Redirect to auth domain\n window.location.href = authUrl.toString();\n };\n\n /**\n * Logout user\n * Calls the logout endpoint on the API domain using this.client\n */\n public logout = async (): Promise<void> => {\n try {\n const sessionToken = this.session.getSessionToken();\n\n if (sessionToken) {\n await this.client.auth.logout({\n headers: {\n 'x-blimu-publishable-key': this.config.publishableKey,\n Authorization: `Bearer ${sessionToken}`,\n },\n });\n }\n } catch (error) {\n console.error('Logout error:', error);\n } finally {\n this.store.setState({\n user: null,\n error: null,\n status: 'unauthenticated',\n });\n }\n };\n\n /**\n * Get the current session token\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getAccessToken = async (_options: { template: 'web' }): Promise<string | null> => {\n return (await this.session.getSessionToken()) ?? null;\n };\n\n /**\n * Get the runtime client for direct API calls\n */\n getClient(): Blimu {\n return this.client;\n }\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"runtime-client.js","sources":["../../src/client/runtime-client.ts"],"sourcesContent":["import { Blimu } from '@blimu/client';\n\nimport type { AuthState, BlimuConfig, User } from '../types';\nimport { getAuthApiUrl, getAuthDomainFromPublishableKey } from '../utils/publishable-key';\nimport { AuthSessionService, LOCALHOST_JWT_URL_PARAM_NAME } from './auth.service';\nimport { ExternalStore } from './external-store';\n\nexport class BlimuRuntimeClientWrapper {\n private client: Blimu;\n private authDomain: string | null = null;\n private initialized: boolean = false;\n private readonly session: AuthSessionService;\n\n public config: BlimuConfig;\n public isLive: boolean;\n private initializePromise: Promise<void> | null = null;\n private initializeAbortController: AbortController | null = null;\n\n public readonly store: ExternalStore<AuthState>;\n\n constructor(config: BlimuConfig) {\n this.config = config;\n this.store = new ExternalStore<AuthState>({\n user: null,\n error: null,\n status: 'idle',\n });\n this.isLive = config.publishableKey.includes('live');\n\n // Get auth UI domain from publishable key\n this.authDomain = getAuthDomainFromPublishableKey(config.publishableKey);\n if (!this.authDomain) {\n throw new Error('Failed to determine auth domain from publishable key');\n }\n\n // Get auth API URL from publishable key\n const authApiUrl = getAuthApiUrl(config.publishableKey);\n\n if (!authApiUrl) {\n throw new Error('Failed to determine auth API URL from publishable key');\n }\n\n this.client = new Blimu({\n baseURL: authApiUrl,\n bearer: () => this.session.getSessionToken(),\n headers: { 'x-blimu-publishable-key': config.publishableKey },\n });\n\n this.session = new AuthSessionService(\n this.isLive,\n this.client,\n this.store,\n authApiUrl,\n config.publishableKey,\n );\n\n this.initialize = this.initialize.bind(this);\n }\n\n /**\n * Initialize authentication by checking for existing session\n * Reads session token from cookie and validates it\n * This method is idempotent - if initialization is already in progress, it will wait for that to complete\n */\n initialize(): (() => void) | void {\n // If already initialized, return early\n if (this.initialized) return;\n\n // If initialization is in progress, return early (prevents concurrent calls)\n if (this.initializePromise) return;\n\n this.initializeAbortController = new AbortController();\n\n this.initializePromise = this.session\n .initialize({\n signal: this.initializeAbortController.signal,\n })\n .then((result) => {\n if (result.error) {\n this.store.setState({\n user: null,\n error: result.error,\n status: 'error',\n });\n } else if (result.user) {\n this.store.setState({\n user: result.user,\n error: null,\n status: 'authenticated',\n });\n } else {\n this.store.setState({\n user: null,\n error: null,\n status: 'unauthenticated',\n });\n }\n })\n .catch((error) => {\n console.error('Initialize error:', error);\n this.store.setState({\n user: null,\n error: error instanceof Error ? error.message : 'Initialization failed',\n status: 'error',\n });\n })\n .finally(() => {\n // Mark as initialized after completion (success or failure)\n // This prevents infinite loops from re-renders\n this.initialized = true;\n this.initializePromise = null;\n });\n\n return () => {\n console.log('aborting initialize');\n this.initializeAbortController?.abort('unmounting');\n this.initializePromise = null;\n // Don't reset initialized flag here - let the promise handle it\n };\n }\n\n /**\n * Refresh session token using the client token from httpOnly cookie\n * The client token is stored in an httpOnly cookie and sent automatically\n * Note: The auth worker should extract the __bli_client cookie and include it in the request body\n * This method is idempotent - if a refresh is already in progress, it will wait for that refresh to complete\n */\n public scheduleRefresh() {\n return this.session.scheduleRefresh();\n }\n\n /**\n * Redirect user to auth domain for authentication\n * Uses the auth domain derived from the publishable key\n */\n public redirectToAuth = (returnUrl?: string): void => {\n const redirectUrl = returnUrl || window.location.href;\n\n // Build auth URL on the auth domain\n const authUrl = new URL(`${this.authDomain}/login`);\n authUrl.searchParams.set('redirect_url', encodeURIComponent(redirectUrl));\n\n // Redirect to auth domain\n window.location.href = authUrl.toString();\n };\n\n /**\n * Logout user\n * Calls the logout endpoint on the API domain using this.client\n */\n public logout = async (): Promise<void> => {\n try {\n const sessionToken = this.session.getSessionToken();\n\n if (sessionToken) {\n await this.client.auth.logout({\n headers: {\n 'x-blimu-publishable-key': this.config.publishableKey,\n Authorization: `Bearer ${sessionToken}`,\n },\n });\n }\n } catch (error) {\n console.error('Logout error:', error);\n } finally {\n this.store.setState({\n user: null,\n error: null,\n status: 'unauthenticated',\n });\n }\n };\n\n /**\n * Get the current session token\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getAccessToken = async (_options: { template: 'web' }): Promise<string | null> => {\n return (await this.session.getSessionToken()) ?? null;\n };\n\n /**\n * Get the runtime client for direct API calls\n */\n getClient(): Blimu {\n return this.client;\n }\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const redirectToSignIn = require("./redirect-to-sign-in.cjs");
|
|
4
|
+
const userButton = require("./user-button/user-button.cjs");
|
|
5
|
+
const userAvatar = require("./user-avatar.cjs");
|
|
6
|
+
const signInButton = require("./sign-in-button.cjs");
|
|
7
|
+
const membersList = require("./members-list.cjs");
|
|
8
|
+
exports.RedirectToSignIn = redirectToSignIn.RedirectToSignIn;
|
|
9
|
+
exports.UserButton = userButton.UserButton;
|
|
10
|
+
exports.UserAvatar = userAvatar.UserAvatar;
|
|
11
|
+
exports.SignInButton = signInButton.SignInButton;
|
|
12
|
+
exports.MembersList = membersList.MembersList;
|
|
13
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RedirectToSignIn } from "./redirect-to-sign-in.js";
|
|
2
|
+
import { UserButton } from "./user-button/user-button.js";
|
|
3
|
+
import { UserAvatar } from "./user-avatar.js";
|
|
4
|
+
import { SignInButton } from "./sign-in-button.js";
|
|
5
|
+
import { MembersList } from "./members-list.js";
|
|
6
|
+
export {
|
|
7
|
+
MembersList,
|
|
8
|
+
RedirectToSignIn,
|
|
9
|
+
SignInButton,
|
|
10
|
+
UserAvatar,
|
|
11
|
+
UserButton
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -1,2 +1,133 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const userAvatar = require("./user-avatar.cjs");
|
|
6
|
+
const utils = require("../lib/utils.cjs");
|
|
7
|
+
const useMembers = require("../hooks/use-members.cjs");
|
|
8
|
+
function _interopNamespaceDefault(e) {
|
|
9
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
10
|
+
if (e) {
|
|
11
|
+
for (const k in e) {
|
|
12
|
+
if (k !== "default") {
|
|
13
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: () => e[k]
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
n.default = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
25
|
+
function MembersList({
|
|
26
|
+
resourceType,
|
|
27
|
+
resourceId,
|
|
28
|
+
initialPage = 1,
|
|
29
|
+
pageSize = 20,
|
|
30
|
+
search,
|
|
31
|
+
renderMember,
|
|
32
|
+
className,
|
|
33
|
+
showPagination = true
|
|
34
|
+
}) {
|
|
35
|
+
const [page, setPage] = React__namespace.useState(initialPage);
|
|
36
|
+
const { members, total, isLoading, error, hasNextPage, hasPreviousPage, refetch } = useMembers.useMembers({
|
|
37
|
+
resourceType,
|
|
38
|
+
resourceId,
|
|
39
|
+
page,
|
|
40
|
+
limit: pageSize,
|
|
41
|
+
search
|
|
42
|
+
});
|
|
43
|
+
const defaultRenderMember = (member) => {
|
|
44
|
+
const displayName = member.user.firstName && member.user.lastName ? `${member.user.firstName} ${member.user.lastName}` : member.user.firstName || member.user.email?.split("@")[0] || "User";
|
|
45
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between p-3 rounded-blimu hover:bg-blimu-accent transition-colors", children: [
|
|
46
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
47
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
48
|
+
userAvatar.UserAvatar,
|
|
49
|
+
{
|
|
50
|
+
src: member.user.avatarUrl || void 0,
|
|
51
|
+
alt: member.user.email,
|
|
52
|
+
fallback: displayName,
|
|
53
|
+
size: "default"
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
57
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-blimu-foreground", children: displayName }),
|
|
58
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-blimu-muted-foreground", children: member.user.email })
|
|
59
|
+
] })
|
|
60
|
+
] }),
|
|
61
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
62
|
+
member.inherited && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-blimu-muted-foreground", children: "(inherited)" }),
|
|
63
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-blimu-foreground bg-blimu-muted px-2 py-1 rounded-blimu-sm", children: member.role })
|
|
64
|
+
] })
|
|
65
|
+
] });
|
|
66
|
+
};
|
|
67
|
+
if (error) {
|
|
68
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: utils.cn("p-4 text-center", className), children: [
|
|
69
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-blimu-destructive", children: [
|
|
70
|
+
"Error loading members: ",
|
|
71
|
+
error.message
|
|
72
|
+
] }),
|
|
73
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
74
|
+
"button",
|
|
75
|
+
{
|
|
76
|
+
onClick: () => refetch(),
|
|
77
|
+
className: "mt-2 text-sm text-blimu-primary hover:underline",
|
|
78
|
+
children: "Retry"
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
] });
|
|
82
|
+
}
|
|
83
|
+
if (isLoading && members.length === 0) {
|
|
84
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: utils.cn("p-4 text-center", className), children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-blimu-muted-foreground", children: "Loading members..." }) });
|
|
85
|
+
}
|
|
86
|
+
if (members.length === 0) {
|
|
87
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: utils.cn("p-4 text-center", className), children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-blimu-muted-foreground", children: "No members found" }) });
|
|
88
|
+
}
|
|
89
|
+
const totalPages = Math.ceil(total / pageSize);
|
|
90
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: utils.cn("flex flex-col", className), children: [
|
|
91
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col divide-y divide-blimu-border", children: members.map((member) => /* @__PURE__ */ jsxRuntime.jsx("div", { children: renderMember ? renderMember(member) : defaultRenderMember(member) }, member.userId)) }),
|
|
92
|
+
showPagination && totalPages > 1 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between mt-4 pt-4 border-t border-blimu-border", children: [
|
|
93
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm text-blimu-muted-foreground", children: [
|
|
94
|
+
"Showing ",
|
|
95
|
+
(page - 1) * pageSize + 1,
|
|
96
|
+
" to ",
|
|
97
|
+
Math.min(page * pageSize, total),
|
|
98
|
+
" of ",
|
|
99
|
+
total,
|
|
100
|
+
" ",
|
|
101
|
+
"members"
|
|
102
|
+
] }),
|
|
103
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
104
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
105
|
+
"button",
|
|
106
|
+
{
|
|
107
|
+
onClick: () => setPage((p) => Math.max(1, p - 1)),
|
|
108
|
+
disabled: !hasPreviousPage || isLoading,
|
|
109
|
+
className: "px-3 py-1 text-sm rounded-blimu border border-blimu-input bg-blimu-background hover:bg-blimu-accent disabled:opacity-50 disabled:cursor-not-allowed",
|
|
110
|
+
children: "Previous"
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm text-blimu-foreground", children: [
|
|
114
|
+
"Page ",
|
|
115
|
+
page,
|
|
116
|
+
" of ",
|
|
117
|
+
totalPages
|
|
118
|
+
] }),
|
|
119
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
120
|
+
"button",
|
|
121
|
+
{
|
|
122
|
+
onClick: () => setPage((p) => Math.min(totalPages, p + 1)),
|
|
123
|
+
disabled: !hasNextPage || isLoading,
|
|
124
|
+
className: "px-3 py-1 text-sm rounded-blimu border border-blimu-input bg-blimu-background hover:bg-blimu-accent disabled:opacity-50 disabled:cursor-not-allowed",
|
|
125
|
+
children: "Next"
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
] })
|
|
129
|
+
] })
|
|
130
|
+
] });
|
|
131
|
+
}
|
|
132
|
+
exports.MembersList = MembersList;
|
|
2
133
|
//# sourceMappingURL=members-list.cjs.map
|