@strands.gg/accui 0.2.2 → 0.2.3

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 (68) hide show
  1. package/dist/accui.css +1 -1
  2. package/dist/nuxt/runtime/composables/useStrandsAuth.cjs.js +1 -1
  3. package/dist/nuxt/runtime/composables/useStrandsAuth.cjs.js.map +1 -1
  4. package/dist/nuxt/runtime/composables/useStrandsAuth.d.ts +15 -21
  5. package/dist/nuxt/runtime/composables/useStrandsAuth.d.ts.map +1 -1
  6. package/dist/nuxt/runtime/composables/useStrandsAuth.es.js +2 -2
  7. package/dist/nuxt/runtime/composables/useStrandsAuth.es.js.map +1 -1
  8. package/dist/nuxt/runtime/plugin.client.cjs.js +1 -1
  9. package/dist/nuxt/runtime/plugin.client.es.js +1 -1
  10. package/dist/nuxt-v4/module.cjs.js +7 -1
  11. package/dist/nuxt-v4/module.cjs.js.map +1 -1
  12. package/dist/nuxt-v4/module.d.ts +5 -0
  13. package/dist/nuxt-v4/module.d.ts.map +1 -1
  14. package/dist/nuxt-v4/module.es.js +27 -18
  15. package/dist/nuxt-v4/module.es.js.map +1 -1
  16. package/dist/nuxt-v4/runtime/composables/useStrandsAuth.cjs.js +1 -1
  17. package/dist/nuxt-v4/runtime/composables/useStrandsAuth.cjs.js.map +1 -1
  18. package/dist/nuxt-v4/runtime/composables/useStrandsAuth.d.ts +21 -59
  19. package/dist/nuxt-v4/runtime/composables/useStrandsAuth.d.ts.map +1 -1
  20. package/dist/nuxt-v4/runtime/composables/useStrandsAuth.es.js +45 -36
  21. package/dist/nuxt-v4/runtime/composables/useStrandsAuth.es.js.map +1 -1
  22. package/dist/nuxt-v4/runtime/plugin.client.cjs.js +1 -1
  23. package/dist/nuxt-v4/runtime/plugin.client.cjs.js.map +1 -1
  24. package/dist/nuxt-v4/runtime/plugin.client.d.ts.map +1 -1
  25. package/dist/nuxt-v4/runtime/plugin.client.es.js +23 -12
  26. package/dist/nuxt-v4/runtime/plugin.client.es.js.map +1 -1
  27. package/dist/nuxt-v4/types.d.ts +2 -2
  28. package/dist/nuxt-v4/types.d.ts.map +1 -1
  29. package/dist/nuxt-v4.d.ts +1 -0
  30. package/dist/nuxt-v4.d.ts.map +1 -1
  31. package/dist/strands-auth-ui.cjs.js +1 -1
  32. package/dist/strands-auth-ui.cjs.js.map +1 -1
  33. package/dist/strands-auth-ui.es.js +1468 -1315
  34. package/dist/strands-auth-ui.es.js.map +1 -1
  35. package/dist/types/index.d.ts +5 -0
  36. package/dist/types/index.d.ts.map +1 -1
  37. package/dist/useStrandsAuth-BGunGG2x.cjs +2 -0
  38. package/dist/useStrandsAuth-BGunGG2x.cjs.map +1 -0
  39. package/dist/useStrandsAuth-DiD32KI7.js +91 -0
  40. package/dist/useStrandsAuth-DiD32KI7.js.map +1 -0
  41. package/dist/useStrandsConfig-CtzCmeS1.js +105 -0
  42. package/dist/useStrandsConfig-CtzCmeS1.js.map +1 -0
  43. package/dist/useStrandsConfig-DamqmMUO.cjs +2 -0
  44. package/dist/useStrandsConfig-DamqmMUO.cjs.map +1 -0
  45. package/dist/vue/components/StrandsAuth.vue.d.ts.map +1 -1
  46. package/dist/vue/components/StrandsCompleteSignUp.vue.d.ts.map +1 -1
  47. package/dist/vue/components/StrandsPasswordReset.vue.d.ts +7 -3
  48. package/dist/vue/components/StrandsPasswordReset.vue.d.ts.map +1 -1
  49. package/dist/vue/components/StrandsSecuredFooter.vue.d.ts +5 -1
  50. package/dist/vue/components/StrandsSecuredFooter.vue.d.ts.map +1 -1
  51. package/dist/vue/components/StrandsSignIn.vue.d.ts.map +1 -1
  52. package/dist/vue/components/StrandsSignUp.vue.d.ts.map +1 -1
  53. package/dist/vue/components/StrandsUserProfile.vue.d.ts +2 -0
  54. package/dist/vue/components/StrandsUserProfile.vue.d.ts.map +1 -1
  55. package/dist/vue/composables/useStrandsAuth.d.ts +2 -1
  56. package/dist/vue/composables/useStrandsAuth.d.ts.map +1 -1
  57. package/dist/vue/composables/useStrandsConfig.d.ts +2 -0
  58. package/dist/vue/composables/useStrandsConfig.d.ts.map +1 -1
  59. package/dist/vue/ui/UiInput.vue.d.ts.map +1 -1
  60. package/package.json +1 -1
  61. package/dist/useStrandsAuth-Bh7evftS.js +0 -66
  62. package/dist/useStrandsAuth-Bh7evftS.js.map +0 -1
  63. package/dist/useStrandsAuth-sAfTQeGC.cjs +0 -2
  64. package/dist/useStrandsAuth-sAfTQeGC.cjs.map +0 -1
  65. package/dist/useStrandsConfig-BYwF65Ph.js +0 -89
  66. package/dist/useStrandsConfig-BYwF65Ph.js.map +0 -1
  67. package/dist/useStrandsConfig-Bhbfl0PJ.cjs +0 -2
  68. package/dist/useStrandsConfig-Bhbfl0PJ.cjs.map +0 -1
@@ -1,89 +0,0 @@
1
- import { ref as p, provide as v, inject as _, computed as d } from "vue";
2
- const s = {
3
- signIn: "/api/v1/auth/sign-in",
4
- signUp: "/api/v1/auth/sign-up",
5
- signOut: "/api/v1/auth/sign-out",
6
- refresh: "/api/v1/auth/refresh",
7
- passwordReset: "/api/v1/auth/password-reset",
8
- passwordResetConfirm: "/api/v1/auth/password-reset/confirm",
9
- profile: "/api/v1/user/profile",
10
- verifyEmail: "/api/v1/auth/verify-email",
11
- oauthProviders: "/api/v1/oauth/providers",
12
- oauthProvider: "/api/v1/oauth/providers/{provider_id}"
13
- }, l = Symbol("strands-config"), a = p(null);
14
- function C(e) {
15
- a.value = e, v(l, e);
16
- }
17
- function U(e) {
18
- const f = _(l, null);
19
- let i = null;
20
- try {
21
- if (typeof window < "u") {
22
- if (window.__STRANDS_CONFIG__)
23
- i = window.__STRANDS_CONFIG__, console.log("[useStrandsConfig] Found config from window.__STRANDS_CONFIG__:", i);
24
- else if (window.__NUXT__) {
25
- const o = window.__NUXT__;
26
- console.log("[useStrandsConfig] window.__NUXT__ contents:", o), i = o?.config?.public?.strandsAuth || o?.public?.strandsAuth || o?.strandsAuth, console.log("[useStrandsConfig] Found nuxtConfig from window.__NUXT__:", i);
27
- }
28
- }
29
- } catch (o) {
30
- console.log("[useStrandsConfig] Error accessing window globals:", o);
31
- }
32
- const u = d(() => {
33
- let o = f || a.value;
34
- if (console.log("[useStrandsConfig] Debug info:", {
35
- injectedConfig: f,
36
- globalConfig: a.value,
37
- nuxtConfig: i,
38
- fallbackConfig: e,
39
- currentConfig: o
40
- }), !o && i && i.baseUrl && (o = {
41
- baseUrl: i.baseUrl,
42
- endpoints: i.endpoints || {}
43
- }, console.log("[useStrandsConfig] Using Nuxt config fallback:", o)), !o && e && (o = e, console.log("[useStrandsConfig] Using provided fallback config:", o)), !o || !o.baseUrl)
44
- throw console.error("[useStrandsConfig] No valid config found:", {
45
- config: o,
46
- hasBaseUrl: o?.baseUrl,
47
- windowNuxt: typeof window < "u" ? window.__NUXT__ : "undefined"
48
- }), new Error(
49
- "StrandsAuth configuration is required. Please provide a baseUrl using provideStrandsConfig() or pass it as a prop."
50
- );
51
- return console.log("[useStrandsConfig] Using final config:", o), o;
52
- }), t = d(() => {
53
- const n = u.value.endpoints || {};
54
- return {
55
- signIn: n.signIn || s.signIn,
56
- signUp: n.signUp || s.signUp,
57
- signOut: n.signOut || s.signOut,
58
- refresh: n.refresh || s.refresh,
59
- passwordReset: n.passwordReset || s.passwordReset,
60
- passwordResetConfirm: n.passwordResetConfirm || s.passwordResetConfirm,
61
- profile: n.profile || s.profile,
62
- verifyEmail: n.verifyEmail || s.verifyEmail,
63
- oauthProviders: n.oauthProviders || s.oauthProviders,
64
- oauthProvider: n.oauthProvider || s.oauthProvider
65
- };
66
- });
67
- return {
68
- config: u,
69
- endpoints: t,
70
- getUrl: (o) => {
71
- const n = u.value;
72
- if (!n.baseUrl)
73
- throw new Error("Base URL is required in configuration");
74
- let r;
75
- typeof o == "string" && o in t.value ? r = t.value[o] : typeof o == "string" ? r = o : r = t.value[o];
76
- const g = n.baseUrl.replace(/\/$/, ""), c = r.startsWith("/") ? r : `/${r}`;
77
- return `${g}${c}`;
78
- }
79
- };
80
- }
81
- function S(e) {
82
- a.value = e;
83
- }
84
- export {
85
- C as provideStrandsConfig,
86
- S as setStrandsConfig,
87
- U as useStrandsConfig
88
- };
89
- //# sourceMappingURL=useStrandsConfig-BYwF65Ph.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useStrandsConfig-BYwF65Ph.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 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 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 \n console.log('[useStrandsConfig] Found nuxtConfig from window.__NUXT__:', nuxtConfig)\n }\n }\n } catch (e) {\n console.log('[useStrandsConfig] Error accessing window globals:', 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 }\n console.log('[useStrandsConfig] Using Nuxt config fallback:', config)\n }\n \n // Final fallback to provided fallback config\n if (!config && fallbackConfig) {\n config = fallbackConfig as StrandsAuthConfig\n console.log('[useStrandsConfig] Using provided fallback config:', config)\n }\n \n if (!config || !config.baseUrl) {\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 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 return {\n config: activeConfig,\n endpoints,\n getUrl\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","e","activeConfig","computed","endpoints","customEndpoints","endpoint","endpointPath","baseUrl","path","setStrandsConfig"],"mappings":";AA+BA,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;AACF,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,aAEvB,QAAQ,IAAI,6DAA6DD,CAAU;AAAA,MACrF;AAAA;AAAA,EAEJ,SAASE,GAAG;AACV,YAAQ,IAAI,sDAAsDA,CAAC;AAAA,EACrE;AAGA,QAAMC,IAAeC,EAAS,MAAM;AAClC,QAAIV,IAASI,KAAkBP,EAAa;AAyB5C,QAvBA,QAAQ,IAAI,kCAAkC;AAAA,MAC5C,gBAAAO;AAAA,MACA,cAAcP,EAAa;AAAA,MAC3B,YAAAS;AAAA,MACA,gBAAAH;AAAA,MACA,eAAeH;AAAA,IAAA,CAChB,GAGG,CAACA,KAAUM,KAAcA,EAAW,YACtC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G,IAAeH,EAAU,MAAME,CAAsC,IAC5D,OAAOA,KAAa,WAE7BC,IAAeD,IAGfC,IAAeH,EAAU,MAAME,CAAQ;AAIzC,YAAME,IAAUf,EAAO,QAAQ,QAAQ,OAAO,EAAE,GAC1CgB,IAAOF,EAAa,WAAW,GAAG,IAAIA,IAAe,IAAIA,CAAY;AAE3E,aAAO,GAAGC,CAAO,GAAGC,CAAI;AAAA,IAC1B;AAAA,EAKE;AAEJ;AAGO,SAASC,EAAiBjB,GAA2B;AAC1D,EAAAH,EAAa,QAAQG;AACvB;"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),e={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}"},l=Symbol("strands-config"),u=t.ref(null);function p(i){u.value=i,t.provide(l,i)}function v(i){const f=t.inject(l,null);let s=null;try{if(typeof window<"u"){if(window.__STRANDS_CONFIG__)s=window.__STRANDS_CONFIG__,console.log("[useStrandsConfig] Found config from window.__STRANDS_CONFIG__:",s);else if(window.__NUXT__){const o=window.__NUXT__;console.log("[useStrandsConfig] window.__NUXT__ contents:",o),s=o?.config?.public?.strandsAuth||o?.public?.strandsAuth||o?.strandsAuth,console.log("[useStrandsConfig] Found nuxtConfig from window.__NUXT__:",s)}}}catch(o){console.log("[useStrandsConfig] Error accessing window globals:",o)}const d=t.computed(()=>{let o=f||u.value;if(console.log("[useStrandsConfig] Debug info:",{injectedConfig:f,globalConfig:u.value,nuxtConfig:s,fallbackConfig:i,currentConfig:o}),!o&&s&&s.baseUrl&&(o={baseUrl:s.baseUrl,endpoints:s.endpoints||{}},console.log("[useStrandsConfig] Using Nuxt config fallback:",o)),!o&&i&&(o=i,console.log("[useStrandsConfig] Using provided fallback config:",o)),!o||!o.baseUrl)throw console.error("[useStrandsConfig] No valid config found:",{config:o,hasBaseUrl:o?.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:",o),o}),a=t.computed(()=>{const n=d.value.endpoints||{};return{signIn:n.signIn||e.signIn,signUp:n.signUp||e.signUp,signOut:n.signOut||e.signOut,refresh:n.refresh||e.refresh,passwordReset:n.passwordReset||e.passwordReset,passwordResetConfirm:n.passwordResetConfirm||e.passwordResetConfirm,profile:n.profile||e.profile,verifyEmail:n.verifyEmail||e.verifyEmail,oauthProviders:n.oauthProviders||e.oauthProviders,oauthProvider:n.oauthProvider||e.oauthProvider}});return{config:d,endpoints:a,getUrl:o=>{const n=d.value;if(!n.baseUrl)throw new Error("Base URL is required in configuration");let r;typeof o=="string"&&o in a.value?r=a.value[o]:typeof o=="string"?r=o:r=a.value[o];const g=n.baseUrl.replace(/\/$/,""),c=r.startsWith("/")?r:`/${r}`;return`${g}${c}`}}}function _(i){u.value=i}exports.provideStrandsConfig=p;exports.setStrandsConfig=_;exports.useStrandsConfig=v;
2
- //# sourceMappingURL=useStrandsConfig-Bhbfl0PJ.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useStrandsConfig-Bhbfl0PJ.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 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 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 \n console.log('[useStrandsConfig] Found nuxtConfig from window.__NUXT__:', nuxtConfig)\n }\n }\n } catch (e) {\n console.log('[useStrandsConfig] Error accessing window globals:', 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 }\n console.log('[useStrandsConfig] Using Nuxt config fallback:', config)\n }\n \n // Final fallback to provided fallback config\n if (!config && fallbackConfig) {\n config = fallbackConfig as StrandsAuthConfig\n console.log('[useStrandsConfig] Using provided fallback config:', config)\n }\n \n if (!config || !config.baseUrl) {\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 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 return {\n config: activeConfig,\n endpoints,\n getUrl\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","e","activeConfig","computed","endpoints","customEndpoints","endpoint","endpointPath","baseUrl","path","setStrandsConfig"],"mappings":"uGA+BMA,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,EAEhD,SAASC,EAAqBC,EAA2B,CAC9DH,EAAa,MAAQG,EACrBC,EAAAA,QAAQL,EAAoBI,CAAM,CACpC,CAEO,SAASE,EAAiBC,EAA6C,CAE5E,MAAMC,EAAiBC,EAAAA,OAA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