@strands.gg/accui 0.2.3 → 0.2.5

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.
Files changed (30) hide show
  1. package/dist/nuxt/module.cjs.js +1 -1
  2. package/dist/nuxt/module.cjs.js.map +1 -1
  3. package/dist/nuxt/module.d.ts +1 -1
  4. package/dist/nuxt/module.d.ts.map +1 -1
  5. package/dist/nuxt/module.es.js +15 -15
  6. package/dist/nuxt/module.es.js.map +1 -1
  7. package/dist/nuxt/runtime/plugin.client.cjs.js +1 -1
  8. package/dist/nuxt/runtime/plugin.client.cjs.js.map +1 -1
  9. package/dist/nuxt/runtime/plugin.client.d.ts.map +1 -1
  10. package/dist/nuxt/runtime/plugin.client.es.js +23 -10
  11. package/dist/nuxt/runtime/plugin.client.es.js.map +1 -1
  12. package/dist/nuxt-v4/module.cjs.js +4 -4
  13. package/dist/nuxt-v4/module.cjs.js.map +1 -1
  14. package/dist/nuxt-v4/module.d.ts +1 -1
  15. package/dist/nuxt-v4/module.d.ts.map +1 -1
  16. package/dist/nuxt-v4/module.es.js +8 -8
  17. package/dist/nuxt-v4/module.es.js.map +1 -1
  18. package/dist/nuxt-v4/runtime/plugin.client.cjs.js +1 -1
  19. package/dist/nuxt-v4/runtime/plugin.client.cjs.js.map +1 -1
  20. package/dist/nuxt-v4/runtime/plugin.client.d.ts.map +1 -1
  21. package/dist/nuxt-v4/runtime/plugin.client.es.js +30 -35
  22. package/dist/nuxt-v4/runtime/plugin.client.es.js.map +1 -1
  23. package/dist/strands-auth-ui.cjs.js +1 -1
  24. package/dist/strands-auth-ui.es.js +2 -2
  25. package/dist/useStrandsConfig-CPWn6FBj.cjs +2 -0
  26. package/dist/{useStrandsConfig-DamqmMUO.cjs.map → useStrandsConfig-CPWn6FBj.cjs.map} +1 -1
  27. package/dist/{useStrandsConfig-CtzCmeS1.js → useStrandsConfig-Ds4Yslxo.js} +24 -24
  28. package/dist/{useStrandsConfig-CtzCmeS1.js.map → useStrandsConfig-Ds4Yslxo.js.map} +1 -1
  29. package/package.json +1 -1
  30. package/dist/useStrandsConfig-DamqmMUO.cjs +0 -2
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as X, computed as W, createElementBlock as l, openBlock as i, normalizeClass as j, createElementVNode as s, createCommentVNode as a, toDisplayString as x, renderSlot as Z, createTextVNode as S, useSlots as ye, ref as U, createBlock as O, resolveDynamicComponent as ve, mergeProps as we, withCtx as w, onMounted as se, nextTick as ue, toRefs as he, watch as te, Fragment as T, renderList as le, normalizeStyle as qe, reactive as H, createVNode as m, Transition as R, withModifiers as re, resolveComponent as Ve, withDirectives as _, vModelText as $, createStaticVNode as ce, h as z } from "vue";
2
- import { useStrandsConfig as G, provideStrandsConfig as pe } from "./useStrandsConfig-CtzCmeS1.js";
3
- import { setStrandsConfig as Nn } from "./useStrandsConfig-CtzCmeS1.js";
2
+ import { u as G, p as pe } from "./useStrandsConfig-Ds4Yslxo.js";
3
+ import { s as Nn } from "./useStrandsConfig-Ds4Yslxo.js";
4
4
  import { u as me } from "./useStrandsAuth-DiD32KI7.js";
5
5
  const xe = /* @__PURE__ */ X({
6
6
  __name: "UiAlert",
@@ -0,0 +1,2 @@
1
+ "use strict";const r=require("vue"),s={signIn:"/api/v1/auth/sign-in",signUp:"/api/v1/auth/sign-up",signOut:"/api/v1/auth/sign-out",refresh:"/api/v1/auth/refresh",passwordReset:"/api/v1/auth/password-reset",passwordResetConfirm:"/api/v1/auth/password-reset/confirm",profile:"/api/v1/user/profile",verifyEmail:"/api/v1/auth/verify-email",oauthProviders:"/api/v1/oauth/providers",oauthProvider:"/api/v1/oauth/providers/{provider_id}"},f=Symbol("strands-config"),l=r.ref(null);function p(i){l.value=i,r.provide(f,i)}function v(i){const d=r.inject(f,null);let e=null;try{if(typeof window<"u"){if(window.__STRANDS_CONFIG__)e=window.__STRANDS_CONFIG__,console.log("[useStrandsConfig] Found config from window.__STRANDS_CONFIG__:",e);else if(window.__NUXT__){const n=window.__NUXT__;console.log("[useStrandsConfig] window.__NUXT__ contents:",n),e=n?.config?.public?.strandsAuth||n?.public?.strandsAuth||n?.strandsAuth||n?.data?.[0]?.strandsAuth,console.log("[useStrandsConfig] Found nuxtConfig from window.__NUXT__:",e)}}try{if(typeof window<"u"&&window.$nuxt){const n=window.$nuxt;n?.$config?.public?.strandsAuth&&(e=n.$config.public.strandsAuth,console.log("[useStrandsConfig] Found config from $nuxt.$config:",e))}}catch{console.log("[useStrandsConfig] Could not access $nuxt instance")}}catch(n){console.log("[useStrandsConfig] Error accessing runtime config:",n)}const a=r.computed(()=>{let n=d||l.value;if(console.log("[useStrandsConfig] Debug info:",{injectedConfig:d,globalConfig:l.value,nuxtConfig:e,fallbackConfig:i,currentConfig:n}),!n&&e&&e.baseUrl&&(n={baseUrl:e.baseUrl,endpoints:e.endpoints||{},supportEmail:e.supportEmail},console.log("[useStrandsConfig] Using Nuxt config fallback:",n)),!n&&i&&i.baseUrl&&(n=i,console.log("[useStrandsConfig] Using provided fallback config:",n)),!n||!n.baseUrl)if(process.env.NODE_ENV==="development"||typeof window<"u"&&window.location.hostname==="localhost")n={baseUrl:"http://localhost:8000",endpoints:{}},console.warn("[useStrandsConfig] Using emergency development fallback config:",n);else throw console.error("[useStrandsConfig] No valid config found:",{config:n,hasBaseUrl:n?.baseUrl,windowNuxt:typeof window<"u"?window.__NUXT__:"undefined"}),new Error("StrandsAuth configuration is required. Please provide a baseUrl using provideStrandsConfig() or pass it as a prop.");return console.log("[useStrandsConfig] Using final config:",n),n}),u=r.computed(()=>{const o=a.value.endpoints||{};return{signIn:o.signIn||s.signIn,signUp:o.signUp||s.signUp,signOut:o.signOut||s.signOut,refresh:o.refresh||s.refresh,passwordReset:o.passwordReset||s.passwordReset,passwordResetConfirm:o.passwordResetConfirm||s.passwordResetConfirm,profile:o.profile||s.profile,verifyEmail:o.verifyEmail||s.verifyEmail,oauthProviders:o.oauthProviders||s.oauthProviders,oauthProvider:o.oauthProvider||s.oauthProvider}});return{config:a,endpoints:u,getUrl:n=>{const o=a.value;if(!o.baseUrl)throw new Error("Base URL is required in configuration");let t;typeof n=="string"&&n in u.value?t=u.value[n]:typeof n=="string"?t=n:t=u.value[n];const g=o.baseUrl.replace(/\/$/,""),c=t.startsWith("/")?t:`/${t}`;return`${g}${c}`},getSupportEmail:()=>a.value.supportEmail||null}}function w(i){l.value=i}exports.provideStrandsConfig=p;exports.setStrandsConfig=w;exports.useStrandsConfig=v;
2
+ //# sourceMappingURL=useStrandsConfig-CPWn6FBj.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useStrandsConfig-DamqmMUO.cjs","sources":["../../../apps/accounts-ui/src/vue/composables/useStrandsConfig.ts"],"sourcesContent":["import { ref, computed, inject, provide } from 'vue'\n\nexport interface StrandsAuthConfig {\n baseUrl: string\n supportEmail?: string\n endpoints?: {\n signIn?: string\n signUp?: string\n signOut?: string\n refresh?: string\n passwordReset?: string\n passwordResetConfirm?: string\n profile?: string\n verifyEmail?: string\n oauthProviders?: string\n oauthProvider?: string\n }\n}\n\nexport interface StrandsAuthEndpoints {\n signIn: string\n signUp: string\n signOut: string\n refresh: string\n passwordReset: string\n passwordResetConfirm: string\n profile: string\n verifyEmail: string\n oauthProviders: string\n oauthProvider: string\n}\n\nconst DEFAULT_ENDPOINTS: StrandsAuthEndpoints = {\n signIn: '/api/v1/auth/sign-in',\n signUp: '/api/v1/auth/sign-up',\n signOut: '/api/v1/auth/sign-out',\n refresh: '/api/v1/auth/refresh',\n passwordReset: '/api/v1/auth/password-reset',\n passwordResetConfirm: '/api/v1/auth/password-reset/confirm',\n profile: '/api/v1/user/profile',\n verifyEmail: '/api/v1/auth/verify-email',\n oauthProviders: '/api/v1/oauth/providers',\n oauthProvider: '/api/v1/oauth/providers/{provider_id}'\n}\n\nconst STRANDS_CONFIG_KEY = Symbol('strands-config')\n\n// Global configuration state\nconst globalConfig = ref<StrandsAuthConfig | null>(null)\n\nexport function provideStrandsConfig(config: StrandsAuthConfig) {\n globalConfig.value = config\n provide(STRANDS_CONFIG_KEY, config)\n}\n\nexport function useStrandsConfig(fallbackConfig?: Partial<StrandsAuthConfig>) {\n // Try to get config from provide/inject first\n const injectedConfig = inject<StrandsAuthConfig | null>(STRANDS_CONFIG_KEY, null)\n \n // Try to get Nuxt runtime config as additional fallback\n let nuxtConfig = null\n try {\n // First check if we have access to useRuntimeConfig (in Nuxt context)\n if (typeof window !== 'undefined') {\n // First try our custom window global set by the plugin\n if ((window as any).__STRANDS_CONFIG__) {\n nuxtConfig = (window as any).__STRANDS_CONFIG__\n console.log('[useStrandsConfig] Found config from window.__STRANDS_CONFIG__:', nuxtConfig)\n }\n // Fallback to checking __NUXT__ if our custom global isn't set\n else if ((window as any).__NUXT__) {\n const nuxtData = (window as any).__NUXT__\n console.log('[useStrandsConfig] window.__NUXT__ contents:', nuxtData)\n \n // Try multiple possible paths for the config\n nuxtConfig = nuxtData?.config?.public?.strandsAuth ||\n nuxtData?.public?.strandsAuth ||\n nuxtData?.strandsAuth ||\n nuxtData?.data?.[0]?.strandsAuth // Sometimes it's nested in data array\n \n console.log('[useStrandsConfig] Found nuxtConfig from window.__NUXT__:', nuxtConfig)\n }\n }\n \n // Also try to access Nuxt's useRuntimeConfig if available\n try {\n // Check if we're in a Nuxt environment with access to $nuxt\n if (typeof window !== 'undefined' && (window as any).$nuxt) {\n const nuxtInstance = (window as any).$nuxt\n if (nuxtInstance?.$config?.public?.strandsAuth) {\n nuxtConfig = nuxtInstance.$config.public.strandsAuth\n console.log('[useStrandsConfig] Found config from $nuxt.$config:', nuxtConfig)\n }\n }\n } catch (e) {\n // Not in Nuxt context, continue with other fallbacks\n console.log('[useStrandsConfig] Could not access $nuxt instance')\n }\n \n } catch (e) {\n console.log('[useStrandsConfig] Error accessing runtime config:', e)\n }\n \n // Use injected config, then global config, then nuxt config, then fallback\n const activeConfig = computed(() => {\n let config = injectedConfig || globalConfig.value\n \n console.log('[useStrandsConfig] Debug info:', {\n injectedConfig: injectedConfig,\n globalConfig: globalConfig.value,\n nuxtConfig: nuxtConfig,\n fallbackConfig: fallbackConfig,\n currentConfig: config\n })\n \n // If no config yet and we have Nuxt config, use that\n if (!config && nuxtConfig && nuxtConfig.baseUrl) {\n config = {\n baseUrl: nuxtConfig.baseUrl,\n endpoints: nuxtConfig.endpoints || {},\n supportEmail: nuxtConfig.supportEmail\n }\n console.log('[useStrandsConfig] Using Nuxt config fallback:', config)\n }\n \n // Final fallback to provided fallback config\n if (!config && fallbackConfig && fallbackConfig.baseUrl) {\n config = fallbackConfig as StrandsAuthConfig\n console.log('[useStrandsConfig] Using provided fallback config:', config)\n }\n\n // Emergency fallback - check if this is development mode and use localhost\n if (!config || !config.baseUrl) {\n // Check if we're in development and can use a default baseUrl\n const isDevelopment = process.env['NODE_ENV'] === 'development' || \n (typeof window !== 'undefined' && window.location.hostname === 'localhost')\n \n if (isDevelopment) {\n config = {\n baseUrl: 'http://localhost:8000',\n endpoints: {}\n }\n console.warn('[useStrandsConfig] Using emergency development fallback config:', config)\n } else {\n console.error('[useStrandsConfig] No valid config found:', {\n config: config,\n hasBaseUrl: config?.baseUrl,\n windowNuxt: typeof window !== 'undefined' ? (window as any).__NUXT__ : 'undefined'\n })\n throw new Error(\n 'StrandsAuth configuration is required. Please provide a baseUrl using provideStrandsConfig() or pass it as a prop.'\n )\n }\n }\n \n console.log('[useStrandsConfig] Using final config:', config)\n return config\n })\n\n const endpoints = computed<StrandsAuthEndpoints>(() => {\n const config = activeConfig.value\n const customEndpoints = config.endpoints || {}\n \n return {\n signIn: customEndpoints.signIn || DEFAULT_ENDPOINTS.signIn,\n signUp: customEndpoints.signUp || DEFAULT_ENDPOINTS.signUp,\n signOut: customEndpoints.signOut || DEFAULT_ENDPOINTS.signOut,\n refresh: customEndpoints.refresh || DEFAULT_ENDPOINTS.refresh,\n passwordReset: customEndpoints.passwordReset || DEFAULT_ENDPOINTS.passwordReset,\n passwordResetConfirm: customEndpoints.passwordResetConfirm || DEFAULT_ENDPOINTS.passwordResetConfirm,\n profile: customEndpoints.profile || DEFAULT_ENDPOINTS.profile,\n verifyEmail: customEndpoints.verifyEmail || DEFAULT_ENDPOINTS.verifyEmail,\n oauthProviders: customEndpoints.oauthProviders || DEFAULT_ENDPOINTS.oauthProviders,\n oauthProvider: customEndpoints.oauthProvider || DEFAULT_ENDPOINTS.oauthProvider\n }\n })\n\n const getUrl = (endpoint: keyof StrandsAuthEndpoints | string) => {\n const config = activeConfig.value\n if (!config.baseUrl) {\n throw new Error('Base URL is required in configuration')\n }\n \n // If endpoint is a string key, try to find it in endpoints first\n let endpointPath: string\n if (typeof endpoint === 'string' && endpoint in endpoints.value) {\n endpointPath = endpoints.value[endpoint as keyof StrandsAuthEndpoints]\n } else if (typeof endpoint === 'string') {\n // If it's a string but not a key, treat it as a literal path\n endpointPath = endpoint\n } else {\n // It's a keyof StrandsAuthEndpoints\n endpointPath = endpoints.value[endpoint]\n }\n \n // Ensure proper URL construction with slash separation\n const baseUrl = config.baseUrl.replace(/\\/$/, '')\n const path = endpointPath.startsWith('/') ? endpointPath : `/${endpointPath}`\n \n return `${baseUrl}${path}`\n }\n\n const getSupportEmail = () => {\n const config = activeConfig.value\n return config.supportEmail || null\n }\n\n return {\n config: activeConfig,\n endpoints,\n getUrl,\n getSupportEmail\n }\n}\n\n// Convenience function to set global config\nexport function setStrandsConfig(config: StrandsAuthConfig) {\n globalConfig.value = config\n}\n"],"names":["DEFAULT_ENDPOINTS","STRANDS_CONFIG_KEY","globalConfig","ref","provideStrandsConfig","config","provide","useStrandsConfig","fallbackConfig","injectedConfig","inject","nuxtConfig","nuxtData","nuxtInstance","e","activeConfig","computed","endpoints","customEndpoints","endpoint","endpointPath","baseUrl","path","setStrandsConfig"],"mappings":"uGAgCMA,EAA0C,CAC9C,OAAQ,uBACR,OAAQ,uBACR,QAAS,wBACT,QAAS,uBACT,cAAe,8BACf,qBAAsB,sCACtB,QAAS,uBACT,YAAa,4BACb,eAAgB,0BAChB,cAAe,uCACjB,E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,CAAQ,EAIzC,MAAME,EAAUhB,EAAO,QAAQ,QAAQ,MAAO,EAAE,EAC1CiB,EAAOF,EAAa,WAAW,GAAG,EAAIA,EAAe,IAAIA,CAAY,GAE3E,MAAO,GAAGC,CAAO,GAAGC,CAAI,EAC1B,EAWE,gBATsB,IACPP,EAAa,MACd,cAAgB,IAO9B,CAEJ,CAGO,SAASQ,EAAiBlB,EAA2B,CAC1DH,EAAa,MAAQG,CACvB"}
1
+ {"version":3,"file":"useStrandsConfig-CPWn6FBj.cjs","sources":["../../../apps/accounts-ui/src/vue/composables/useStrandsConfig.ts"],"sourcesContent":["import { ref, computed, inject, provide } from 'vue'\n\nexport interface StrandsAuthConfig {\n baseUrl: string\n supportEmail?: string\n endpoints?: {\n signIn?: string\n signUp?: string\n signOut?: string\n refresh?: string\n passwordReset?: string\n passwordResetConfirm?: string\n profile?: string\n verifyEmail?: string\n oauthProviders?: string\n oauthProvider?: string\n }\n}\n\nexport interface StrandsAuthEndpoints {\n signIn: string\n signUp: string\n signOut: string\n refresh: string\n passwordReset: string\n passwordResetConfirm: string\n profile: string\n verifyEmail: string\n oauthProviders: string\n oauthProvider: string\n}\n\nconst DEFAULT_ENDPOINTS: StrandsAuthEndpoints = {\n signIn: '/api/v1/auth/sign-in',\n signUp: '/api/v1/auth/sign-up',\n signOut: '/api/v1/auth/sign-out',\n refresh: '/api/v1/auth/refresh',\n passwordReset: '/api/v1/auth/password-reset',\n passwordResetConfirm: '/api/v1/auth/password-reset/confirm',\n profile: '/api/v1/user/profile',\n verifyEmail: '/api/v1/auth/verify-email',\n oauthProviders: '/api/v1/oauth/providers',\n oauthProvider: '/api/v1/oauth/providers/{provider_id}'\n}\n\nconst STRANDS_CONFIG_KEY = Symbol('strands-config')\n\n// Global configuration state\nconst globalConfig = ref<StrandsAuthConfig | null>(null)\n\nexport function provideStrandsConfig(config: StrandsAuthConfig) {\n globalConfig.value = config\n provide(STRANDS_CONFIG_KEY, config)\n}\n\nexport function useStrandsConfig(fallbackConfig?: Partial<StrandsAuthConfig>) {\n // Try to get config from provide/inject first\n const injectedConfig = inject<StrandsAuthConfig | null>(STRANDS_CONFIG_KEY, null)\n \n // Try to get Nuxt runtime config as additional fallback\n let nuxtConfig = null\n try {\n // First check if we have access to useRuntimeConfig (in Nuxt context)\n if (typeof window !== 'undefined') {\n // First try our custom window global set by the plugin\n if ((window as any).__STRANDS_CONFIG__) {\n nuxtConfig = (window as any).__STRANDS_CONFIG__\n console.log('[useStrandsConfig] Found config from window.__STRANDS_CONFIG__:', nuxtConfig)\n }\n // Fallback to checking __NUXT__ if our custom global isn't set\n else if ((window as any).__NUXT__) {\n const nuxtData = (window as any).__NUXT__\n console.log('[useStrandsConfig] window.__NUXT__ contents:', nuxtData)\n \n // Try multiple possible paths for the config\n nuxtConfig = nuxtData?.config?.public?.strandsAuth ||\n nuxtData?.public?.strandsAuth ||\n nuxtData?.strandsAuth ||\n nuxtData?.data?.[0]?.strandsAuth // Sometimes it's nested in data array\n \n console.log('[useStrandsConfig] Found nuxtConfig from window.__NUXT__:', nuxtConfig)\n }\n }\n \n // Also try to access Nuxt's useRuntimeConfig if available\n try {\n // Check if we're in a Nuxt environment with access to $nuxt\n if (typeof window !== 'undefined' && (window as any).$nuxt) {\n const nuxtInstance = (window as any).$nuxt\n if (nuxtInstance?.$config?.public?.strandsAuth) {\n nuxtConfig = nuxtInstance.$config.public.strandsAuth\n console.log('[useStrandsConfig] Found config from $nuxt.$config:', nuxtConfig)\n }\n }\n } catch (e) {\n // Not in Nuxt context, continue with other fallbacks\n console.log('[useStrandsConfig] Could not access $nuxt instance')\n }\n \n } catch (e) {\n console.log('[useStrandsConfig] Error accessing runtime config:', e)\n }\n \n // Use injected config, then global config, then nuxt config, then fallback\n const activeConfig = computed(() => {\n let config = injectedConfig || globalConfig.value\n \n console.log('[useStrandsConfig] Debug info:', {\n injectedConfig: injectedConfig,\n globalConfig: globalConfig.value,\n nuxtConfig: nuxtConfig,\n fallbackConfig: fallbackConfig,\n currentConfig: config\n })\n \n // If no config yet and we have Nuxt config, use that\n if (!config && nuxtConfig && nuxtConfig.baseUrl) {\n config = {\n baseUrl: nuxtConfig.baseUrl,\n endpoints: nuxtConfig.endpoints || {},\n supportEmail: nuxtConfig.supportEmail\n }\n console.log('[useStrandsConfig] Using Nuxt config fallback:', config)\n }\n \n // Final fallback to provided fallback config\n if (!config && fallbackConfig && fallbackConfig.baseUrl) {\n config = fallbackConfig as StrandsAuthConfig\n console.log('[useStrandsConfig] Using provided fallback config:', config)\n }\n\n // Emergency fallback - check if this is development mode and use localhost\n if (!config || !config.baseUrl) {\n // Check if we're in development and can use a default baseUrl\n const isDevelopment = process.env['NODE_ENV'] === 'development' || \n (typeof window !== 'undefined' && window.location.hostname === 'localhost')\n \n if (isDevelopment) {\n config = {\n baseUrl: 'http://localhost:8000',\n endpoints: {}\n }\n console.warn('[useStrandsConfig] Using emergency development fallback config:', config)\n } else {\n console.error('[useStrandsConfig] No valid config found:', {\n config: config,\n hasBaseUrl: config?.baseUrl,\n windowNuxt: typeof window !== 'undefined' ? (window as any).__NUXT__ : 'undefined'\n })\n throw new Error(\n 'StrandsAuth configuration is required. Please provide a baseUrl using provideStrandsConfig() or pass it as a prop.'\n )\n }\n }\n \n console.log('[useStrandsConfig] Using final config:', config)\n return config\n })\n\n const endpoints = computed<StrandsAuthEndpoints>(() => {\n const config = activeConfig.value\n const customEndpoints = config.endpoints || {}\n \n return {\n signIn: customEndpoints.signIn || DEFAULT_ENDPOINTS.signIn,\n signUp: customEndpoints.signUp || DEFAULT_ENDPOINTS.signUp,\n signOut: customEndpoints.signOut || DEFAULT_ENDPOINTS.signOut,\n refresh: customEndpoints.refresh || DEFAULT_ENDPOINTS.refresh,\n passwordReset: customEndpoints.passwordReset || DEFAULT_ENDPOINTS.passwordReset,\n passwordResetConfirm: customEndpoints.passwordResetConfirm || DEFAULT_ENDPOINTS.passwordResetConfirm,\n profile: customEndpoints.profile || DEFAULT_ENDPOINTS.profile,\n verifyEmail: customEndpoints.verifyEmail || DEFAULT_ENDPOINTS.verifyEmail,\n oauthProviders: customEndpoints.oauthProviders || DEFAULT_ENDPOINTS.oauthProviders,\n oauthProvider: customEndpoints.oauthProvider || DEFAULT_ENDPOINTS.oauthProvider\n }\n })\n\n const getUrl = (endpoint: keyof StrandsAuthEndpoints | string) => {\n const config = activeConfig.value\n if (!config.baseUrl) {\n throw new Error('Base URL is required in configuration')\n }\n \n // If endpoint is a string key, try to find it in endpoints first\n let endpointPath: string\n if (typeof endpoint === 'string' && endpoint in endpoints.value) {\n endpointPath = endpoints.value[endpoint as keyof StrandsAuthEndpoints]\n } else if (typeof endpoint === 'string') {\n // If it's a string but not a key, treat it as a literal path\n endpointPath = endpoint\n } else {\n // It's a keyof StrandsAuthEndpoints\n endpointPath = endpoints.value[endpoint]\n }\n \n // Ensure proper URL construction with slash separation\n const baseUrl = config.baseUrl.replace(/\\/$/, '')\n const path = endpointPath.startsWith('/') ? endpointPath : `/${endpointPath}`\n \n return `${baseUrl}${path}`\n }\n\n const getSupportEmail = () => {\n const config = activeConfig.value\n return config.supportEmail || null\n }\n\n return {\n config: activeConfig,\n endpoints,\n getUrl,\n getSupportEmail\n }\n}\n\n// Convenience function to set global config\nexport function setStrandsConfig(config: StrandsAuthConfig) {\n globalConfig.value = config\n}\n"],"names":["DEFAULT_ENDPOINTS","STRANDS_CONFIG_KEY","globalConfig","ref","provideStrandsConfig","config","provide","useStrandsConfig","fallbackConfig","injectedConfig","inject","nuxtConfig","nuxtData","nuxtInstance","e","activeConfig","computed","endpoints","customEndpoints","endpoint","endpointPath","baseUrl","path","setStrandsConfig"],"mappings":"oCAgCMA,EAA0C,CAC9C,OAAQ,uBACR,OAAQ,uBACR,QAAS,wBACT,QAAS,uBACT,cAAe,8BACf,qBAAsB,sCACtB,QAAS,uBACT,YAAa,4BACb,eAAgB,0BAChB,cAAe,uCACjB,EAEMC,EAAqB,OAAO,gBAAgB,EAG5CC,EAAeC,EAAAA,IAA8B,IAAI,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AC1CiB,EAAOF,EAAa,WAAW,GAAG,EAAIA,EAAe,IAAIA,CAAY,GAE3E,MAAO,GAAGC,CAAO,GAAGC,CAAI,EAC1B,EAWE,gBATsB,IACPP,EAAa,MACd,cAAgB,IAO9B,CAEJ,CAGO,SAASQ,EAAiBlB,EAA2B,CAC1DH,EAAa,MAAQG,CACvB"}
@@ -1,5 +1,5 @@
1
1
  import { ref as p, provide as v, inject as w, computed as f } from "vue";
2
- const s = {
2
+ const e = {
3
3
  signIn: "/api/v1/auth/sign-in",
4
4
  signUp: "/api/v1/auth/sign-up",
5
5
  signOut: "/api/v1/auth/sign-out",
@@ -16,20 +16,20 @@ function C(i) {
16
16
  }
17
17
  function S(i) {
18
18
  const l = w(d, null);
19
- let e = null;
19
+ let s = null;
20
20
  try {
21
21
  if (typeof window < "u") {
22
22
  if (window.__STRANDS_CONFIG__)
23
- e = window.__STRANDS_CONFIG__, console.log("[useStrandsConfig] Found config from window.__STRANDS_CONFIG__:", e);
23
+ s = window.__STRANDS_CONFIG__, console.log("[useStrandsConfig] Found config from window.__STRANDS_CONFIG__:", s);
24
24
  else if (window.__NUXT__) {
25
25
  const o = window.__NUXT__;
26
- console.log("[useStrandsConfig] window.__NUXT__ contents:", o), e = o?.config?.public?.strandsAuth || o?.public?.strandsAuth || o?.strandsAuth || o?.data?.[0]?.strandsAuth, console.log("[useStrandsConfig] Found nuxtConfig from window.__NUXT__:", e);
26
+ console.log("[useStrandsConfig] window.__NUXT__ contents:", o), s = o?.config?.public?.strandsAuth || o?.public?.strandsAuth || o?.strandsAuth || o?.data?.[0]?.strandsAuth, console.log("[useStrandsConfig] Found nuxtConfig from window.__NUXT__:", s);
27
27
  }
28
28
  }
29
29
  try {
30
30
  if (typeof window < "u" && window.$nuxt) {
31
31
  const o = window.$nuxt;
32
- o?.$config?.public?.strandsAuth && (e = o.$config.public.strandsAuth, console.log("[useStrandsConfig] Found config from $nuxt.$config:", e));
32
+ o?.$config?.public?.strandsAuth && (s = o.$config.public.strandsAuth, console.log("[useStrandsConfig] Found config from $nuxt.$config:", s));
33
33
  }
34
34
  } catch {
35
35
  console.log("[useStrandsConfig] Could not access $nuxt instance");
@@ -42,13 +42,13 @@ function S(i) {
42
42
  if (console.log("[useStrandsConfig] Debug info:", {
43
43
  injectedConfig: l,
44
44
  globalConfig: u.value,
45
- nuxtConfig: e,
45
+ nuxtConfig: s,
46
46
  fallbackConfig: i,
47
47
  currentConfig: o
48
- }), !o && e && e.baseUrl && (o = {
49
- baseUrl: e.baseUrl,
50
- endpoints: e.endpoints || {},
51
- supportEmail: e.supportEmail
48
+ }), !o && s && s.baseUrl && (o = {
49
+ baseUrl: s.baseUrl,
50
+ endpoints: s.endpoints || {},
51
+ supportEmail: s.supportEmail
52
52
  }, console.log("[useStrandsConfig] Using Nuxt config fallback:", o)), !o && i && i.baseUrl && (o = i, console.log("[useStrandsConfig] Using provided fallback config:", o)), !o || !o.baseUrl)
53
53
  if (process.env.NODE_ENV === "development" || typeof window < "u" && window.location.hostname === "localhost")
54
54
  o = {
@@ -67,16 +67,16 @@ function S(i) {
67
67
  }), a = f(() => {
68
68
  const n = r.value.endpoints || {};
69
69
  return {
70
- signIn: n.signIn || s.signIn,
71
- signUp: n.signUp || s.signUp,
72
- signOut: n.signOut || s.signOut,
73
- refresh: n.refresh || s.refresh,
74
- passwordReset: n.passwordReset || s.passwordReset,
75
- passwordResetConfirm: n.passwordResetConfirm || s.passwordResetConfirm,
76
- profile: n.profile || s.profile,
77
- verifyEmail: n.verifyEmail || s.verifyEmail,
78
- oauthProviders: n.oauthProviders || s.oauthProviders,
79
- oauthProvider: n.oauthProvider || s.oauthProvider
70
+ signIn: n.signIn || e.signIn,
71
+ signUp: n.signUp || e.signUp,
72
+ signOut: n.signOut || e.signOut,
73
+ refresh: n.refresh || e.refresh,
74
+ passwordReset: n.passwordReset || e.passwordReset,
75
+ passwordResetConfirm: n.passwordResetConfirm || e.passwordResetConfirm,
76
+ profile: n.profile || e.profile,
77
+ verifyEmail: n.verifyEmail || e.verifyEmail,
78
+ oauthProviders: n.oauthProviders || e.oauthProviders,
79
+ oauthProvider: n.oauthProvider || e.oauthProvider
80
80
  };
81
81
  });
82
82
  return {
@@ -98,8 +98,8 @@ function U(i) {
98
98
  u.value = i;
99
99
  }
100
100
  export {
101
- C as provideStrandsConfig,
102
- U as setStrandsConfig,
103
- S as useStrandsConfig
101
+ C as p,
102
+ U as s,
103
+ S as u
104
104
  };
105
- //# sourceMappingURL=useStrandsConfig-CtzCmeS1.js.map
105
+ //# sourceMappingURL=useStrandsConfig-Ds4Yslxo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useStrandsConfig-CtzCmeS1.js","sources":["../../../apps/accounts-ui/src/vue/composables/useStrandsConfig.ts"],"sourcesContent":["import { ref, computed, inject, provide } from 'vue'\n\nexport interface StrandsAuthConfig {\n baseUrl: string\n supportEmail?: string\n endpoints?: {\n signIn?: string\n signUp?: string\n signOut?: string\n refresh?: string\n passwordReset?: string\n passwordResetConfirm?: string\n profile?: string\n verifyEmail?: string\n oauthProviders?: string\n oauthProvider?: string\n }\n}\n\nexport interface StrandsAuthEndpoints {\n signIn: string\n signUp: string\n signOut: string\n refresh: string\n passwordReset: string\n passwordResetConfirm: string\n profile: string\n verifyEmail: string\n oauthProviders: string\n oauthProvider: string\n}\n\nconst DEFAULT_ENDPOINTS: StrandsAuthEndpoints = {\n signIn: '/api/v1/auth/sign-in',\n signUp: '/api/v1/auth/sign-up',\n signOut: '/api/v1/auth/sign-out',\n refresh: '/api/v1/auth/refresh',\n passwordReset: '/api/v1/auth/password-reset',\n passwordResetConfirm: '/api/v1/auth/password-reset/confirm',\n profile: '/api/v1/user/profile',\n verifyEmail: '/api/v1/auth/verify-email',\n oauthProviders: '/api/v1/oauth/providers',\n oauthProvider: '/api/v1/oauth/providers/{provider_id}'\n}\n\nconst STRANDS_CONFIG_KEY = Symbol('strands-config')\n\n// Global configuration state\nconst globalConfig = ref<StrandsAuthConfig | null>(null)\n\nexport function provideStrandsConfig(config: StrandsAuthConfig) {\n globalConfig.value = config\n provide(STRANDS_CONFIG_KEY, config)\n}\n\nexport function useStrandsConfig(fallbackConfig?: Partial<StrandsAuthConfig>) {\n // Try to get config from provide/inject first\n const injectedConfig = inject<StrandsAuthConfig | null>(STRANDS_CONFIG_KEY, null)\n \n // Try to get Nuxt runtime config as additional fallback\n let nuxtConfig = null\n try {\n // First check if we have access to useRuntimeConfig (in Nuxt context)\n if (typeof window !== 'undefined') {\n // First try our custom window global set by the plugin\n if ((window as any).__STRANDS_CONFIG__) {\n nuxtConfig = (window as any).__STRANDS_CONFIG__\n console.log('[useStrandsConfig] Found config from window.__STRANDS_CONFIG__:', nuxtConfig)\n }\n // Fallback to checking __NUXT__ if our custom global isn't set\n else if ((window as any).__NUXT__) {\n const nuxtData = (window as any).__NUXT__\n console.log('[useStrandsConfig] window.__NUXT__ contents:', nuxtData)\n \n // Try multiple possible paths for the config\n nuxtConfig = nuxtData?.config?.public?.strandsAuth ||\n nuxtData?.public?.strandsAuth ||\n nuxtData?.strandsAuth ||\n nuxtData?.data?.[0]?.strandsAuth // Sometimes it's nested in data array\n \n console.log('[useStrandsConfig] Found nuxtConfig from window.__NUXT__:', nuxtConfig)\n }\n }\n \n // Also try to access Nuxt's useRuntimeConfig if available\n try {\n // Check if we're in a Nuxt environment with access to $nuxt\n if (typeof window !== 'undefined' && (window as any).$nuxt) {\n const nuxtInstance = (window as any).$nuxt\n if (nuxtInstance?.$config?.public?.strandsAuth) {\n nuxtConfig = nuxtInstance.$config.public.strandsAuth\n console.log('[useStrandsConfig] Found config from $nuxt.$config:', nuxtConfig)\n }\n }\n } catch (e) {\n // Not in Nuxt context, continue with other fallbacks\n console.log('[useStrandsConfig] Could not access $nuxt instance')\n }\n \n } catch (e) {\n console.log('[useStrandsConfig] Error accessing runtime config:', e)\n }\n \n // Use injected config, then global config, then nuxt config, then fallback\n const activeConfig = computed(() => {\n let config = injectedConfig || globalConfig.value\n \n console.log('[useStrandsConfig] Debug info:', {\n injectedConfig: injectedConfig,\n globalConfig: globalConfig.value,\n nuxtConfig: nuxtConfig,\n fallbackConfig: fallbackConfig,\n currentConfig: config\n })\n \n // If no config yet and we have Nuxt config, use that\n if (!config && nuxtConfig && nuxtConfig.baseUrl) {\n config = {\n baseUrl: nuxtConfig.baseUrl,\n endpoints: nuxtConfig.endpoints || {},\n supportEmail: nuxtConfig.supportEmail\n }\n console.log('[useStrandsConfig] Using Nuxt config fallback:', config)\n }\n \n // Final fallback to provided fallback config\n if (!config && fallbackConfig && fallbackConfig.baseUrl) {\n config = fallbackConfig as StrandsAuthConfig\n console.log('[useStrandsConfig] Using provided fallback config:', config)\n }\n\n // Emergency fallback - check if this is development mode and use localhost\n if (!config || !config.baseUrl) {\n // Check if we're in development and can use a default baseUrl\n const isDevelopment = process.env['NODE_ENV'] === 'development' || \n (typeof window !== 'undefined' && window.location.hostname === 'localhost')\n \n if (isDevelopment) {\n config = {\n baseUrl: 'http://localhost:8000',\n endpoints: {}\n }\n console.warn('[useStrandsConfig] Using emergency development fallback config:', config)\n } else {\n console.error('[useStrandsConfig] No valid config found:', {\n config: config,\n hasBaseUrl: config?.baseUrl,\n windowNuxt: typeof window !== 'undefined' ? (window as any).__NUXT__ : 'undefined'\n })\n throw new Error(\n 'StrandsAuth configuration is required. Please provide a baseUrl using provideStrandsConfig() or pass it as a prop.'\n )\n }\n }\n \n console.log('[useStrandsConfig] Using final config:', config)\n return config\n })\n\n const endpoints = computed<StrandsAuthEndpoints>(() => {\n const config = activeConfig.value\n const customEndpoints = config.endpoints || {}\n \n return {\n signIn: customEndpoints.signIn || DEFAULT_ENDPOINTS.signIn,\n signUp: customEndpoints.signUp || DEFAULT_ENDPOINTS.signUp,\n signOut: customEndpoints.signOut || DEFAULT_ENDPOINTS.signOut,\n refresh: customEndpoints.refresh || DEFAULT_ENDPOINTS.refresh,\n passwordReset: customEndpoints.passwordReset || DEFAULT_ENDPOINTS.passwordReset,\n passwordResetConfirm: customEndpoints.passwordResetConfirm || DEFAULT_ENDPOINTS.passwordResetConfirm,\n profile: customEndpoints.profile || DEFAULT_ENDPOINTS.profile,\n verifyEmail: customEndpoints.verifyEmail || DEFAULT_ENDPOINTS.verifyEmail,\n oauthProviders: customEndpoints.oauthProviders || DEFAULT_ENDPOINTS.oauthProviders,\n oauthProvider: customEndpoints.oauthProvider || DEFAULT_ENDPOINTS.oauthProvider\n }\n })\n\n const getUrl = (endpoint: keyof StrandsAuthEndpoints | string) => {\n const config = activeConfig.value\n if (!config.baseUrl) {\n throw new Error('Base URL is required in configuration')\n }\n \n // If endpoint is a string key, try to find it in endpoints first\n let endpointPath: string\n if (typeof endpoint === 'string' && endpoint in endpoints.value) {\n endpointPath = endpoints.value[endpoint as keyof StrandsAuthEndpoints]\n } else if (typeof endpoint === 'string') {\n // If it's a string but not a key, treat it as a literal path\n endpointPath = endpoint\n } else {\n // It's a keyof StrandsAuthEndpoints\n endpointPath = endpoints.value[endpoint]\n }\n \n // Ensure proper URL construction with slash separation\n const baseUrl = config.baseUrl.replace(/\\/$/, '')\n const path = endpointPath.startsWith('/') ? endpointPath : `/${endpointPath}`\n \n return `${baseUrl}${path}`\n }\n\n const getSupportEmail = () => {\n const config = activeConfig.value\n return config.supportEmail || null\n }\n\n return {\n config: activeConfig,\n endpoints,\n getUrl,\n getSupportEmail\n }\n}\n\n// Convenience function to set global config\nexport function setStrandsConfig(config: StrandsAuthConfig) {\n globalConfig.value = config\n}\n"],"names":["DEFAULT_ENDPOINTS","STRANDS_CONFIG_KEY","globalConfig","ref","provideStrandsConfig","config","provide","useStrandsConfig","fallbackConfig","injectedConfig","inject","nuxtConfig","nuxtData","nuxtInstance","e","activeConfig","computed","endpoints","customEndpoints","endpoint","endpointPath","baseUrl","path","setStrandsConfig"],"mappings":";AAgCA,MAAMA,IAA0C;AAAA,EAC9C,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,eAAe;AAAA,EACf,sB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,EAAkB;AAAA,IAAA;AAAA,EAEtE,CAAC;AAgCD,SAAO;AAAA,IACL,QAAQe;AAAA,IACR,WAAAE;AAAA,IACA,QAjCa,CAACE,MAAkD;AAChE,YAAMd,IAASU,EAAa;AAC5B,UAAI,CAACV,EAAO;AACV,cAAM,IAAI,MAAM,uCAAuC;AAIzD,UAAIe;AACJ,MAAI,OAAOD,KAAa,YAAYA,KAAYF,EAAU,QACxDG,IAAeH,EAAU,MAAME,CAAsC,IAC5D,OAAOA,KAAa,WAE7BC,IAAeD,IAGfC,IAAeH,EAAU,MAAME,CAAQ;AAIzC,YAAME,IAAUhB,EAAO,QAAQ,QAAQ,OAAO,EAAE,GAC1CiB,IAAOF,EAAa,WAAW,GAAG,IAAIA,IAAe,IAAIA,CAAY;AAE3E,aAAO,GAAGC,CAAO,GAAGC,CAAI;AAAA,IAC1B;AAAA,IAWE,iBATsB,MACPP,EAAa,MACd,gBAAgB;AAAA,EAO9B;AAEJ;AAGO,SAASQ,EAAiBlB,GAA2B;AAC1D,EAAAH,EAAa,QAAQG;AACvB;"}
1
+ {"version":3,"file":"useStrandsConfig-Ds4Yslxo.js","sources":["../../../apps/accounts-ui/src/vue/composables/useStrandsConfig.ts"],"sourcesContent":["import { ref, computed, inject, provide } from 'vue'\n\nexport interface StrandsAuthConfig {\n baseUrl: string\n supportEmail?: string\n endpoints?: {\n signIn?: string\n signUp?: string\n signOut?: string\n refresh?: string\n passwordReset?: string\n passwordResetConfirm?: string\n profile?: string\n verifyEmail?: string\n oauthProviders?: string\n oauthProvider?: string\n }\n}\n\nexport interface StrandsAuthEndpoints {\n signIn: string\n signUp: string\n signOut: string\n refresh: string\n passwordReset: string\n passwordResetConfirm: string\n profile: string\n verifyEmail: string\n oauthProviders: string\n oauthProvider: string\n}\n\nconst DEFAULT_ENDPOINTS: StrandsAuthEndpoints = {\n signIn: '/api/v1/auth/sign-in',\n signUp: '/api/v1/auth/sign-up',\n signOut: '/api/v1/auth/sign-out',\n refresh: '/api/v1/auth/refresh',\n passwordReset: '/api/v1/auth/password-reset',\n passwordResetConfirm: '/api/v1/auth/password-reset/confirm',\n profile: '/api/v1/user/profile',\n verifyEmail: '/api/v1/auth/verify-email',\n oauthProviders: '/api/v1/oauth/providers',\n oauthProvider: '/api/v1/oauth/providers/{provider_id}'\n}\n\nconst STRANDS_CONFIG_KEY = Symbol('strands-config')\n\n// Global configuration state\nconst globalConfig = ref<StrandsAuthConfig | null>(null)\n\nexport function provideStrandsConfig(config: StrandsAuthConfig) {\n globalConfig.value = config\n provide(STRANDS_CONFIG_KEY, config)\n}\n\nexport function useStrandsConfig(fallbackConfig?: Partial<StrandsAuthConfig>) {\n // Try to get config from provide/inject first\n const injectedConfig = inject<StrandsAuthConfig | null>(STRANDS_CONFIG_KEY, null)\n \n // Try to get Nuxt runtime config as additional fallback\n let nuxtConfig = null\n try {\n // First check if we have access to useRuntimeConfig (in Nuxt context)\n if (typeof window !== 'undefined') {\n // First try our custom window global set by the plugin\n if ((window as any).__STRANDS_CONFIG__) {\n nuxtConfig = (window as any).__STRANDS_CONFIG__\n console.log('[useStrandsConfig] Found config from window.__STRANDS_CONFIG__:', nuxtConfig)\n }\n // Fallback to checking __NUXT__ if our custom global isn't set\n else if ((window as any).__NUXT__) {\n const nuxtData = (window as any).__NUXT__\n console.log('[useStrandsConfig] window.__NUXT__ contents:', nuxtData)\n \n // Try multiple possible paths for the config\n nuxtConfig = nuxtData?.config?.public?.strandsAuth ||\n nuxtData?.public?.strandsAuth ||\n nuxtData?.strandsAuth ||\n nuxtData?.data?.[0]?.strandsAuth // Sometimes it's nested in data array\n \n console.log('[useStrandsConfig] Found nuxtConfig from window.__NUXT__:', nuxtConfig)\n }\n }\n \n // Also try to access Nuxt's useRuntimeConfig if available\n try {\n // Check if we're in a Nuxt environment with access to $nuxt\n if (typeof window !== 'undefined' && (window as any).$nuxt) {\n const nuxtInstance = (window as any).$nuxt\n if (nuxtInstance?.$config?.public?.strandsAuth) {\n nuxtConfig = nuxtInstance.$config.public.strandsAuth\n console.log('[useStrandsConfig] Found config from $nuxt.$config:', nuxtConfig)\n }\n }\n } catch (e) {\n // Not in Nuxt context, continue with other fallbacks\n console.log('[useStrandsConfig] Could not access $nuxt instance')\n }\n \n } catch (e) {\n console.log('[useStrandsConfig] Error accessing runtime config:', e)\n }\n \n // Use injected config, then global config, then nuxt config, then fallback\n const activeConfig = computed(() => {\n let config = injectedConfig || globalConfig.value\n \n console.log('[useStrandsConfig] Debug info:', {\n injectedConfig: injectedConfig,\n globalConfig: globalConfig.value,\n nuxtConfig: nuxtConfig,\n fallbackConfig: fallbackConfig,\n currentConfig: config\n })\n \n // If no config yet and we have Nuxt config, use that\n if (!config && nuxtConfig && nuxtConfig.baseUrl) {\n config = {\n baseUrl: nuxtConfig.baseUrl,\n endpoints: nuxtConfig.endpoints || {},\n supportEmail: nuxtConfig.supportEmail\n }\n console.log('[useStrandsConfig] Using Nuxt config fallback:', config)\n }\n \n // Final fallback to provided fallback config\n if (!config && fallbackConfig && fallbackConfig.baseUrl) {\n config = fallbackConfig as StrandsAuthConfig\n console.log('[useStrandsConfig] Using provided fallback config:', config)\n }\n\n // Emergency fallback - check if this is development mode and use localhost\n if (!config || !config.baseUrl) {\n // Check if we're in development and can use a default baseUrl\n const isDevelopment = process.env['NODE_ENV'] === 'development' || \n (typeof window !== 'undefined' && window.location.hostname === 'localhost')\n \n if (isDevelopment) {\n config = {\n baseUrl: 'http://localhost:8000',\n endpoints: {}\n }\n console.warn('[useStrandsConfig] Using emergency development fallback config:', config)\n } else {\n console.error('[useStrandsConfig] No valid config found:', {\n config: config,\n hasBaseUrl: config?.baseUrl,\n windowNuxt: typeof window !== 'undefined' ? (window as any).__NUXT__ : 'undefined'\n })\n throw new Error(\n 'StrandsAuth configuration is required. Please provide a baseUrl using provideStrandsConfig() or pass it as a prop.'\n )\n }\n }\n \n console.log('[useStrandsConfig] Using final config:', config)\n return config\n })\n\n const endpoints = computed<StrandsAuthEndpoints>(() => {\n const config = activeConfig.value\n const customEndpoints = config.endpoints || {}\n \n return {\n signIn: customEndpoints.signIn || DEFAULT_ENDPOINTS.signIn,\n signUp: customEndpoints.signUp || DEFAULT_ENDPOINTS.signUp,\n signOut: customEndpoints.signOut || DEFAULT_ENDPOINTS.signOut,\n refresh: customEndpoints.refresh || DEFAULT_ENDPOINTS.refresh,\n passwordReset: customEndpoints.passwordReset || DEFAULT_ENDPOINTS.passwordReset,\n passwordResetConfirm: customEndpoints.passwordResetConfirm || DEFAULT_ENDPOINTS.passwordResetConfirm,\n profile: customEndpoints.profile || DEFAULT_ENDPOINTS.profile,\n verifyEmail: customEndpoints.verifyEmail || DEFAULT_ENDPOINTS.verifyEmail,\n oauthProviders: customEndpoints.oauthProviders || DEFAULT_ENDPOINTS.oauthProviders,\n oauthProvider: customEndpoints.oauthProvider || DEFAULT_ENDPOINTS.oauthProvider\n }\n })\n\n const getUrl = (endpoint: keyof StrandsAuthEndpoints | string) => {\n const config = activeConfig.value\n if (!config.baseUrl) {\n throw new Error('Base URL is required in configuration')\n }\n \n // If endpoint is a string key, try to find it in endpoints first\n let endpointPath: string\n if (typeof endpoint === 'string' && endpoint in endpoints.value) {\n endpointPath = endpoints.value[endpoint as keyof StrandsAuthEndpoints]\n } else if (typeof endpoint === 'string') {\n // If it's a string but not a key, treat it as a literal path\n endpointPath = endpoint\n } else {\n // It's a keyof StrandsAuthEndpoints\n endpointPath = endpoints.value[endpoint]\n }\n \n // Ensure proper URL construction with slash separation\n const baseUrl = config.baseUrl.replace(/\\/$/, '')\n const path = endpointPath.startsWith('/') ? endpointPath : `/${endpointPath}`\n \n return `${baseUrl}${path}`\n }\n\n const getSupportEmail = () => {\n const config = activeConfig.value\n return config.supportEmail || null\n }\n\n return {\n config: activeConfig,\n endpoints,\n getUrl,\n getSupportEmail\n }\n}\n\n// Convenience function to set global config\nexport function setStrandsConfig(config: StrandsAuthConfig) {\n globalConfig.value = config\n}\n"],"names":["DEFAULT_ENDPOINTS","STRANDS_CONFIG_KEY","globalConfig","ref","provideStrandsConfig","config","provide","useStrandsConfig","fallbackConfig","injectedConfig","inject","nuxtConfig","nuxtData","nuxtInstance","e","activeConfig","computed","endpoints","customEndpoints","endpoint","endpointPath","baseUrl","path","setStrandsConfig"],"mappings":";AAgCA,MAAMA,IAA0C;AAAA,EAC9C,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,eAAe;AAAA,EACf,sBAAsB;AAAA,EACtB,SAAS;AAAA,EACT,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,eAAe;AACjB,GAEMC,IAAqB,OAAO,gBAAgB,GAG5CC,IAAeC,EAA8B,IAAI;AAEhD,SAASC,EAAqBC,GAA2B;AAC9D,EAAAH,EAAa,QAAQG,GACrBC,EAAQL,GAAoBI,CAAM;AACpC;AAEO,SAASE,EAAiBC,GAA6C;AAE5E,QAAMC,IAAiBC,EAAiCT,GAAoB,IAAI;AAGhF,MAAIU,IAAa;AACjB,MAAI;AAEF,QAAI,OAAO,SAAW;AAEpB,UAAK,OAAe;AAClB,QAAAA,IAAc,OAAe,oBAC7B,QAAQ,IAAI,mEAAmEA,CAAU;AAAA,eAGjF,OAAe,UAAU;AACjC,cAAMC,IAAY,OAAe;AACjC,gBAAQ,IAAI,gDAAgDA,CAAQ,GAGpED,IAAaC,GAAU,QAAQ,QAAQ,eAC1BA,GAAU,QAAQ,eAClBA,GAAU,eACVA,GAAU,OAAO,CAAC,GAAG,aAElC,QAAQ,IAAI,6DAA6DD,CAAU;AAAA,MACrF;AAAA;AAIF,QAAI;AAEF,UAAI,OAAO,SAAW,OAAgB,OAAe,OAAO;AAC1D,cAAME,IAAgB,OAAe;AACrC,QAAIA,GAAc,SAAS,QAAQ,gBACjCF,IAAaE,EAAa,QAAQ,OAAO,aACzC,QAAQ,IAAI,uDAAuDF,CAAU;AAAA,MAEjF;AAAA,IACF,QAAY;AAEV,cAAQ,IAAI,oDAAoD;AAAA,IAClE;AAAA,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kB,EAAgB,WAAWlB,EAAkB;AAAA,MACtD,eAAekB,EAAgB,iBAAiBlB,EAAkB;AAAA,MAClE,sBAAsBkB,EAAgB,wBAAwBlB,EAAkB;AAAA,MAChF,SAASkB,EAAgB,WAAWlB,EAAkB;AAAA,MACtD,aAAakB,EAAgB,eAAelB,EAAkB;AAAA,MAC9D,gBAAgBkB,EAAgB,kBAAkBlB,EAAkB;AAAA,MACpE,eAAekB,EAAgB,iBAAiBlB,EAAkB;AAAA,IAAA;AAAA,EAEtE,CAAC;AAgCD,SAAO;AAAA,IACL,QAAQe;AAAA,IACR,WAAAE;AAAA,IACA,QAjCa,CAACE,MAAkD;AAChE,YAAMd,IAASU,EAAa;AAC5B,UAAI,CAACV,EAAO;AACV,cAAM,IAAI,MAAM,uCAAuC;AAIzD,UAAIe;AACJ,MAAI,OAAOD,KAAa,YAAYA,KAAYF,EAAU,QACxDG,IAAeH,EAAU,MAAME,CAAsC,IAC5D,OAAOA,KAAa,WAE7BC,IAAeD,IAGfC,IAAeH,EAAU,MAAME,CAAQ;AAIzC,YAAME,IAAUhB,EAAO,QAAQ,QAAQ,OAAO,EAAE,GAC1CiB,IAAOF,EAAa,WAAW,GAAG,IAAIA,IAAe,IAAIA,CAAY;AAE3E,aAAO,GAAGC,CAAO,GAAGC,CAAI;AAAA,IAC1B;AAAA,IAWE,iBATsB,MACPP,EAAa,MACd,gBAAgB;AAAA,EAO9B;AAEJ;AAGO,SAASQ,EAAiBlB,GAA2B;AAC1D,EAAAH,EAAa,QAAQG;AACvB;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strands.gg/accui",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Strands Authentication UI Components",
5
5
  "type": "module",
6
6
  "main": "./dist/strands-auth-ui.cjs.js",
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("vue"),s={signIn:"/api/v1/auth/sign-in",signUp:"/api/v1/auth/sign-up",signOut:"/api/v1/auth/sign-out",refresh:"/api/v1/auth/refresh",passwordReset:"/api/v1/auth/password-reset",passwordResetConfirm:"/api/v1/auth/password-reset/confirm",profile:"/api/v1/user/profile",verifyEmail:"/api/v1/auth/verify-email",oauthProviders:"/api/v1/oauth/providers",oauthProvider:"/api/v1/oauth/providers/{provider_id}"},f=Symbol("strands-config"),l=r.ref(null);function p(i){l.value=i,r.provide(f,i)}function v(i){const d=r.inject(f,null);let e=null;try{if(typeof window<"u"){if(window.__STRANDS_CONFIG__)e=window.__STRANDS_CONFIG__,console.log("[useStrandsConfig] Found config from window.__STRANDS_CONFIG__:",e);else if(window.__NUXT__){const n=window.__NUXT__;console.log("[useStrandsConfig] window.__NUXT__ contents:",n),e=n?.config?.public?.strandsAuth||n?.public?.strandsAuth||n?.strandsAuth||n?.data?.[0]?.strandsAuth,console.log("[useStrandsConfig] Found nuxtConfig from window.__NUXT__:",e)}}try{if(typeof window<"u"&&window.$nuxt){const n=window.$nuxt;n?.$config?.public?.strandsAuth&&(e=n.$config.public.strandsAuth,console.log("[useStrandsConfig] Found config from $nuxt.$config:",e))}}catch{console.log("[useStrandsConfig] Could not access $nuxt instance")}}catch(n){console.log("[useStrandsConfig] Error accessing runtime config:",n)}const a=r.computed(()=>{let n=d||l.value;if(console.log("[useStrandsConfig] Debug info:",{injectedConfig:d,globalConfig:l.value,nuxtConfig:e,fallbackConfig:i,currentConfig:n}),!n&&e&&e.baseUrl&&(n={baseUrl:e.baseUrl,endpoints:e.endpoints||{},supportEmail:e.supportEmail},console.log("[useStrandsConfig] Using Nuxt config fallback:",n)),!n&&i&&i.baseUrl&&(n=i,console.log("[useStrandsConfig] Using provided fallback config:",n)),!n||!n.baseUrl)if(process.env.NODE_ENV==="development"||typeof window<"u"&&window.location.hostname==="localhost")n={baseUrl:"http://localhost:8000",endpoints:{}},console.warn("[useStrandsConfig] Using emergency development fallback config:",n);else throw console.error("[useStrandsConfig] No valid config found:",{config:n,hasBaseUrl:n?.baseUrl,windowNuxt:typeof window<"u"?window.__NUXT__:"undefined"}),new Error("StrandsAuth configuration is required. Please provide a baseUrl using provideStrandsConfig() or pass it as a prop.");return console.log("[useStrandsConfig] Using final config:",n),n}),u=r.computed(()=>{const o=a.value.endpoints||{};return{signIn:o.signIn||s.signIn,signUp:o.signUp||s.signUp,signOut:o.signOut||s.signOut,refresh:o.refresh||s.refresh,passwordReset:o.passwordReset||s.passwordReset,passwordResetConfirm:o.passwordResetConfirm||s.passwordResetConfirm,profile:o.profile||s.profile,verifyEmail:o.verifyEmail||s.verifyEmail,oauthProviders:o.oauthProviders||s.oauthProviders,oauthProvider:o.oauthProvider||s.oauthProvider}});return{config:a,endpoints:u,getUrl:n=>{const o=a.value;if(!o.baseUrl)throw new Error("Base URL is required in configuration");let t;typeof n=="string"&&n in u.value?t=u.value[n]:typeof n=="string"?t=n:t=u.value[n];const g=o.baseUrl.replace(/\/$/,""),c=t.startsWith("/")?t:`/${t}`;return`${g}${c}`},getSupportEmail:()=>a.value.supportEmail||null}}function w(i){l.value=i}exports.provideStrandsConfig=p;exports.setStrandsConfig=w;exports.useStrandsConfig=v;
2
- //# sourceMappingURL=useStrandsConfig-DamqmMUO.cjs.map