@drmhse/authos-vue 0.2.1 → 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.
- package/README.md +2 -0
- package/dist/{chokidar-KYB2GOYG.mjs → chokidar-B7NTEAA6.mjs} +1 -1
- package/dist/{chunk-C2J6NSID.mjs → chunk-CD2MZG7D.mjs} +1 -1
- package/dist/{chunk-VCTSSS2F.mjs → chunk-EI6D7ZL6.mjs} +2 -2
- package/dist/{chunk-F6BPUSH3.mjs → chunk-EO7XHAPG.mjs} +2 -2
- package/dist/{chunk-Z2UOP6GF.mjs → chunk-EX36KPG5.mjs} +2 -2
- package/dist/{chunk-SW2YRXFK.mjs → chunk-F4XRLJHQ.mjs} +2 -2
- package/dist/{chunk-XLWXQZHO.mjs → chunk-HVM6PT6I.mjs} +5 -5
- package/dist/{chunk-JLL4L3HM.mjs → chunk-N667TIER.mjs} +1 -1
- package/dist/{chunk-QGSFJDIC.mjs → chunk-XP4GDQVV.mjs} +3 -3
- package/dist/{chunk-T2K7EIWY.mjs → chunk-ZHH4WLMR.mjs} +2 -2
- package/dist/{dist-CX347IU5.mjs → dist-C3JS2B76.mjs} +14 -14
- package/dist/dist-N5W7B4HY.mjs +3 -0
- package/dist/index.d.mts +39 -5
- package/dist/index.d.ts +39 -5
- package/dist/index.js +231 -131
- package/dist/index.mjs +231 -131
- package/dist/{json5-WAUASGCX.mjs → json5-JAQYEGVI.mjs} +2 -2
- package/dist/jsonc-UUIPUC5H.mjs +3 -0
- package/dist/{multipart-parser-ZINPIK62.mjs → multipart-parser-SFUPTK6X.mjs} +5 -5
- package/dist/nuxt.js +122 -122
- package/dist/nuxt.mjs +113 -113
- package/dist/toml-VZVKMGHP.mjs +3 -0
- package/dist/{utils-ITGQWSRY.mjs → utils-YSWQHENC.mjs} +3 -3
- package/dist/yaml-G5PP6BGH.mjs +3 -0
- package/package.json +2 -2
- package/dist/dist-KTGFCHLE.mjs +0 -3
- package/dist/jsonc-BXVTKCPI.mjs +0 -3
- package/dist/toml-EIVFNDS7.mjs +0 -3
- package/dist/yaml-NCROZBG5.mjs +0 -3
- /package/dist/{prompt-LQK3IVQK.mjs → prompt-WWTBWNTY.mjs} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -89,23 +89,38 @@ var AUTHOS_STYLES = `
|
|
|
89
89
|
Base Form Styles
|
|
90
90
|
========================================================================== */
|
|
91
91
|
|
|
92
|
+
/* ==========================================================================
|
|
93
|
+
Base Form Styles (Card Layout)
|
|
94
|
+
========================================================================== */
|
|
95
|
+
|
|
92
96
|
[data-authos-signin],
|
|
93
97
|
[data-authos-signup],
|
|
94
|
-
[data-authos-
|
|
98
|
+
[data-authos-magic-link],
|
|
95
99
|
[data-authos-passkey] {
|
|
96
100
|
font-family: var(--authos-font-family);
|
|
97
101
|
font-size: var(--authos-font-size-sm);
|
|
98
102
|
color: var(--authos-color-foreground);
|
|
103
|
+
|
|
104
|
+
/* Card Styling */
|
|
105
|
+
background-color: var(--authos-color-surface);
|
|
106
|
+
border: 1px solid var(--authos-color-border);
|
|
107
|
+
border-radius: var(--authos-border-radius-lg);
|
|
108
|
+
box-shadow: var(--authos-shadow);
|
|
109
|
+
padding: 2rem;
|
|
99
110
|
width: 100%;
|
|
111
|
+
max-width: 25rem; /* 400px */
|
|
112
|
+
margin: 0 auto; /* Center horizontally */
|
|
100
113
|
}
|
|
101
114
|
|
|
115
|
+
/* Ensure forms inside take full width */
|
|
102
116
|
[data-authos-signin] form,
|
|
103
117
|
[data-authos-signup] form,
|
|
104
|
-
[data-authos-
|
|
118
|
+
[data-authos-magic-link] form,
|
|
105
119
|
[data-authos-passkey] form {
|
|
106
120
|
display: flex;
|
|
107
121
|
flex-direction: column;
|
|
108
122
|
gap: var(--authos-spacing-md);
|
|
123
|
+
width: 100%;
|
|
109
124
|
}
|
|
110
125
|
|
|
111
126
|
/* ==========================================================================
|
|
@@ -483,6 +498,16 @@ function createAuthOS(options) {
|
|
|
483
498
|
if (options.appearance?.variables) {
|
|
484
499
|
applyVariables(options.appearance.variables);
|
|
485
500
|
}
|
|
501
|
+
if (options.org && !options.service) {
|
|
502
|
+
console.warn(
|
|
503
|
+
'[AuthOS] You provided "org" but not "service". OAuth flows may not work correctly.'
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
|
+
if (!options.org && options.service) {
|
|
507
|
+
console.warn(
|
|
508
|
+
'[AuthOS] You provided "service" but not "org". OAuth flows may not work correctly.'
|
|
509
|
+
);
|
|
510
|
+
}
|
|
486
511
|
nextTick(() => {
|
|
487
512
|
setInitialToken();
|
|
488
513
|
});
|
|
@@ -828,6 +853,133 @@ var SignIn = defineComponent({
|
|
|
828
853
|
};
|
|
829
854
|
}
|
|
830
855
|
});
|
|
856
|
+
var PROVIDER_NAMES = {
|
|
857
|
+
github: "GitHub",
|
|
858
|
+
google: "Google",
|
|
859
|
+
microsoft: "Microsoft"
|
|
860
|
+
};
|
|
861
|
+
function getProviderIcon(provider) {
|
|
862
|
+
switch (provider) {
|
|
863
|
+
case "github":
|
|
864
|
+
return h("svg", {
|
|
865
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
866
|
+
viewBox: "0 0 24 24",
|
|
867
|
+
fill: "currentColor",
|
|
868
|
+
"aria-hidden": "true"
|
|
869
|
+
}, [
|
|
870
|
+
h("path", {
|
|
871
|
+
d: "M12 0C5.374 0 0 5.373 0 12c0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23A11.509 11.509 0 0112 5.803c1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576C20.566 21.797 24 17.3 24 12c0-6.627-5.373-12-12-12z"
|
|
872
|
+
})
|
|
873
|
+
]);
|
|
874
|
+
case "google":
|
|
875
|
+
return h("svg", {
|
|
876
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
877
|
+
viewBox: "0 0 24 24",
|
|
878
|
+
"aria-hidden": "true"
|
|
879
|
+
}, [
|
|
880
|
+
h("path", {
|
|
881
|
+
fill: "#4285F4",
|
|
882
|
+
d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
|
|
883
|
+
}),
|
|
884
|
+
h("path", {
|
|
885
|
+
fill: "#34A853",
|
|
886
|
+
d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
|
|
887
|
+
}),
|
|
888
|
+
h("path", {
|
|
889
|
+
fill: "#FBBC05",
|
|
890
|
+
d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
|
|
891
|
+
}),
|
|
892
|
+
h("path", {
|
|
893
|
+
fill: "#EA4335",
|
|
894
|
+
d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
|
|
895
|
+
})
|
|
896
|
+
]);
|
|
897
|
+
case "microsoft":
|
|
898
|
+
return h("svg", {
|
|
899
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
900
|
+
viewBox: "0 0 23 23",
|
|
901
|
+
"aria-hidden": "true"
|
|
902
|
+
}, [
|
|
903
|
+
h("path", { fill: "#f35325", d: "M1 1h10v10H1z" }),
|
|
904
|
+
h("path", { fill: "#81bc06", d: "M12 1h10v10H12z" }),
|
|
905
|
+
h("path", { fill: "#05a6f0", d: "M1 12h10v10H1z" }),
|
|
906
|
+
h("path", { fill: "#ffba08", d: "M12 12h10v10H12z" })
|
|
907
|
+
]);
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
var OAuthButton = defineComponent({
|
|
911
|
+
name: "OAuthButton",
|
|
912
|
+
props: {
|
|
913
|
+
provider: {
|
|
914
|
+
type: String,
|
|
915
|
+
required: true
|
|
916
|
+
},
|
|
917
|
+
disabled: {
|
|
918
|
+
type: Boolean,
|
|
919
|
+
default: false
|
|
920
|
+
}
|
|
921
|
+
},
|
|
922
|
+
emits: ["redirect"],
|
|
923
|
+
setup(props, { slots, emit }) {
|
|
924
|
+
const { client, options } = useAuthOS();
|
|
925
|
+
const isConfigured = computed(() => !!(options.org && options.service));
|
|
926
|
+
const providerName = computed(() => PROVIDER_NAMES[props.provider]);
|
|
927
|
+
function handleClick() {
|
|
928
|
+
if (!options.org || !options.service) {
|
|
929
|
+
console.error(
|
|
930
|
+
`[AuthOS] OAuth login requires "org" and "service" in createAuthOS options.
|
|
931
|
+
Current options: { org: ${options.org ? `"${options.org}"` : "undefined"}, service: ${options.service ? `"${options.service}"` : "undefined"} }
|
|
932
|
+
|
|
933
|
+
Example:
|
|
934
|
+
app.use(createAuthOS({
|
|
935
|
+
baseURL: "${options.baseURL}",
|
|
936
|
+
org: "your-org-slug",
|
|
937
|
+
service: "your-service-slug",
|
|
938
|
+
}));
|
|
939
|
+
|
|
940
|
+
See: https://docs.authos.dev/vue/oauth-setup`
|
|
941
|
+
);
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
const redirectUri = options.redirectUri ?? (typeof window !== "undefined" ? window.location.origin + "/callback" : void 0);
|
|
945
|
+
const url = client.auth.getLoginUrl(props.provider, {
|
|
946
|
+
org: options.org,
|
|
947
|
+
service: options.service,
|
|
948
|
+
redirect_uri: redirectUri
|
|
949
|
+
});
|
|
950
|
+
emit("redirect");
|
|
951
|
+
window.location.href = url;
|
|
952
|
+
}
|
|
953
|
+
return () => {
|
|
954
|
+
const slotProps = {
|
|
955
|
+
provider: props.provider,
|
|
956
|
+
providerName: providerName.value,
|
|
957
|
+
isConfigured: isConfigured.value,
|
|
958
|
+
disabled: props.disabled,
|
|
959
|
+
handleClick
|
|
960
|
+
};
|
|
961
|
+
if (slots.default) {
|
|
962
|
+
return slots.default(slotProps);
|
|
963
|
+
}
|
|
964
|
+
return h(
|
|
965
|
+
"button",
|
|
966
|
+
{
|
|
967
|
+
type: "button",
|
|
968
|
+
onClick: handleClick,
|
|
969
|
+
disabled: props.disabled || !isConfigured.value,
|
|
970
|
+
"data-authos-oauth": "",
|
|
971
|
+
"data-provider": props.provider
|
|
972
|
+
},
|
|
973
|
+
[
|
|
974
|
+
getProviderIcon(props.provider),
|
|
975
|
+
h("span", `Continue with ${providerName.value}`)
|
|
976
|
+
]
|
|
977
|
+
);
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
});
|
|
981
|
+
|
|
982
|
+
// src/components/SignUp.ts
|
|
831
983
|
var SignUp = defineComponent({
|
|
832
984
|
name: "SignUp",
|
|
833
985
|
props: {
|
|
@@ -848,25 +1000,53 @@ var SignUp = defineComponent({
|
|
|
848
1000
|
serviceSlug: {
|
|
849
1001
|
type: String,
|
|
850
1002
|
default: void 0
|
|
1003
|
+
},
|
|
1004
|
+
/** List of OAuth providers to display buttons for */
|
|
1005
|
+
providers: {
|
|
1006
|
+
type: [Array, Boolean],
|
|
1007
|
+
default: false
|
|
1008
|
+
},
|
|
1009
|
+
/** Show divider between OAuth and email form */
|
|
1010
|
+
showDivider: {
|
|
1011
|
+
type: Boolean,
|
|
1012
|
+
default: true
|
|
1013
|
+
},
|
|
1014
|
+
/** Show sign in link */
|
|
1015
|
+
showSignIn: {
|
|
1016
|
+
type: Boolean,
|
|
1017
|
+
default: true
|
|
851
1018
|
}
|
|
852
1019
|
},
|
|
853
1020
|
emits: ["success", "error"],
|
|
854
1021
|
setup(props, { slots, emit }) {
|
|
855
|
-
const { client } = useAuthOS();
|
|
1022
|
+
const { client, options } = useAuthOS();
|
|
856
1023
|
const email = ref("");
|
|
857
1024
|
const password = ref("");
|
|
1025
|
+
const confirmPassword = ref("");
|
|
858
1026
|
const error = ref(null);
|
|
859
1027
|
const isSubmitting = ref(false);
|
|
1028
|
+
const isSuccess = ref(false);
|
|
1029
|
+
const hasOAuthConfig = !!(options.org && options.service);
|
|
1030
|
+
const oauthProviders = Array.isArray(props.providers) ? props.providers : [];
|
|
860
1031
|
async function submit() {
|
|
861
1032
|
error.value = null;
|
|
1033
|
+
if (password.value !== confirmPassword.value) {
|
|
1034
|
+
error.value = "Passwords do not match";
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
if (password.value.length < 8) {
|
|
1038
|
+
error.value = "Password must be at least 8 characters";
|
|
1039
|
+
return;
|
|
1040
|
+
}
|
|
862
1041
|
isSubmitting.value = true;
|
|
863
1042
|
try {
|
|
864
1043
|
await client.auth.register({
|
|
865
1044
|
email: email.value,
|
|
866
1045
|
password: password.value,
|
|
867
|
-
org_slug: props.orgSlug,
|
|
868
|
-
service_slug: props.serviceSlug
|
|
1046
|
+
org_slug: props.orgSlug ?? options.org,
|
|
1047
|
+
service_slug: props.serviceSlug ?? options.service
|
|
869
1048
|
});
|
|
1049
|
+
isSuccess.value = true;
|
|
870
1050
|
emit("success");
|
|
871
1051
|
props.onSuccess?.();
|
|
872
1052
|
} catch (err) {
|
|
@@ -892,7 +1072,33 @@ var SignUp = defineComponent({
|
|
|
892
1072
|
if (slots.default) {
|
|
893
1073
|
return slots.default(slotProps);
|
|
894
1074
|
}
|
|
1075
|
+
if (isSuccess.value) {
|
|
1076
|
+
return h("div", { "data-authos-signup": "", "data-state": "success" }, [
|
|
1077
|
+
h("div", { "data-authos-success": "" }, [
|
|
1078
|
+
h("h2", "Check your email"),
|
|
1079
|
+
h("p", `We've sent a verification link to ${email.value}. Please click the link to verify your account.`)
|
|
1080
|
+
])
|
|
1081
|
+
]);
|
|
1082
|
+
}
|
|
895
1083
|
return h("div", { "data-authos-signup": "", "data-state": "credentials" }, [
|
|
1084
|
+
// OAuth Section
|
|
1085
|
+
oauthProviders.length > 0 && h("div", { "data-authos-oauth-section": "" }, [
|
|
1086
|
+
oauthProviders.map(
|
|
1087
|
+
(provider) => h(OAuthButton, {
|
|
1088
|
+
key: provider,
|
|
1089
|
+
provider,
|
|
1090
|
+
disabled: isSubmitting.value || !hasOAuthConfig
|
|
1091
|
+
})
|
|
1092
|
+
),
|
|
1093
|
+
!hasOAuthConfig && h("p", {
|
|
1094
|
+
"data-authos-oauth-warning": "",
|
|
1095
|
+
style: { color: "orange", fontSize: "0.875rem" }
|
|
1096
|
+
}, "OAuth requires org and service in plugin options")
|
|
1097
|
+
]),
|
|
1098
|
+
// Divider
|
|
1099
|
+
oauthProviders.length > 0 && props.showDivider && h("div", { "data-authos-divider": "" }, [
|
|
1100
|
+
h("span", "or")
|
|
1101
|
+
]),
|
|
896
1102
|
h("form", { onSubmit: (e) => {
|
|
897
1103
|
e.preventDefault();
|
|
898
1104
|
submit();
|
|
@@ -923,12 +1129,31 @@ var SignUp = defineComponent({
|
|
|
923
1129
|
onInput: (e) => password.value = e.target.value
|
|
924
1130
|
})
|
|
925
1131
|
]),
|
|
1132
|
+
// Confirm Password
|
|
1133
|
+
h("div", { "data-authos-field": "confirm-password" }, [
|
|
1134
|
+
h("label", { for: "authos-signup-confirm" }, "Confirm Password"),
|
|
1135
|
+
h("input", {
|
|
1136
|
+
id: "authos-signup-confirm",
|
|
1137
|
+
type: "password",
|
|
1138
|
+
autocomplete: "new-password",
|
|
1139
|
+
value: confirmPassword.value,
|
|
1140
|
+
placeholder: "Confirm your password",
|
|
1141
|
+
required: true,
|
|
1142
|
+
disabled: isSubmitting.value,
|
|
1143
|
+
onInput: (e) => confirmPassword.value = e.target.value
|
|
1144
|
+
})
|
|
1145
|
+
]),
|
|
926
1146
|
error.value && h("div", { "data-authos-error": "" }, error.value),
|
|
927
1147
|
h("button", {
|
|
928
1148
|
type: "submit",
|
|
929
1149
|
disabled: isSubmitting.value,
|
|
930
1150
|
"data-authos-submit": ""
|
|
931
|
-
}, isSubmitting.value ? "Creating account..." : "Sign Up")
|
|
1151
|
+
}, isSubmitting.value ? "Creating account..." : "Sign Up"),
|
|
1152
|
+
// Sign In Link
|
|
1153
|
+
props.showSignIn && h("div", { "data-authos-signin-prompt": "" }, [
|
|
1154
|
+
"Already have an account? ",
|
|
1155
|
+
h("a", { href: "/signin", "data-authos-link": "signin" }, "Sign in")
|
|
1156
|
+
])
|
|
932
1157
|
])
|
|
933
1158
|
]);
|
|
934
1159
|
};
|
|
@@ -1096,131 +1321,6 @@ var Protect = defineComponent({
|
|
|
1096
1321
|
};
|
|
1097
1322
|
}
|
|
1098
1323
|
});
|
|
1099
|
-
var PROVIDER_NAMES = {
|
|
1100
|
-
github: "GitHub",
|
|
1101
|
-
google: "Google",
|
|
1102
|
-
microsoft: "Microsoft"
|
|
1103
|
-
};
|
|
1104
|
-
function getProviderIcon(provider) {
|
|
1105
|
-
switch (provider) {
|
|
1106
|
-
case "github":
|
|
1107
|
-
return h("svg", {
|
|
1108
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1109
|
-
viewBox: "0 0 24 24",
|
|
1110
|
-
fill: "currentColor",
|
|
1111
|
-
"aria-hidden": "true"
|
|
1112
|
-
}, [
|
|
1113
|
-
h("path", {
|
|
1114
|
-
d: "M12 0C5.374 0 0 5.373 0 12c0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23A11.509 11.509 0 0112 5.803c1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576C20.566 21.797 24 17.3 24 12c0-6.627-5.373-12-12-12z"
|
|
1115
|
-
})
|
|
1116
|
-
]);
|
|
1117
|
-
case "google":
|
|
1118
|
-
return h("svg", {
|
|
1119
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1120
|
-
viewBox: "0 0 24 24",
|
|
1121
|
-
"aria-hidden": "true"
|
|
1122
|
-
}, [
|
|
1123
|
-
h("path", {
|
|
1124
|
-
fill: "#4285F4",
|
|
1125
|
-
d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
|
|
1126
|
-
}),
|
|
1127
|
-
h("path", {
|
|
1128
|
-
fill: "#34A853",
|
|
1129
|
-
d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
|
|
1130
|
-
}),
|
|
1131
|
-
h("path", {
|
|
1132
|
-
fill: "#FBBC05",
|
|
1133
|
-
d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
|
|
1134
|
-
}),
|
|
1135
|
-
h("path", {
|
|
1136
|
-
fill: "#EA4335",
|
|
1137
|
-
d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
|
|
1138
|
-
})
|
|
1139
|
-
]);
|
|
1140
|
-
case "microsoft":
|
|
1141
|
-
return h("svg", {
|
|
1142
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1143
|
-
viewBox: "0 0 23 23",
|
|
1144
|
-
"aria-hidden": "true"
|
|
1145
|
-
}, [
|
|
1146
|
-
h("path", { fill: "#f35325", d: "M1 1h10v10H1z" }),
|
|
1147
|
-
h("path", { fill: "#81bc06", d: "M12 1h10v10H12z" }),
|
|
1148
|
-
h("path", { fill: "#05a6f0", d: "M1 12h10v10H1z" }),
|
|
1149
|
-
h("path", { fill: "#ffba08", d: "M12 12h10v10H12z" })
|
|
1150
|
-
]);
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
var OAuthButton = defineComponent({
|
|
1154
|
-
name: "OAuthButton",
|
|
1155
|
-
props: {
|
|
1156
|
-
provider: {
|
|
1157
|
-
type: String,
|
|
1158
|
-
required: true
|
|
1159
|
-
},
|
|
1160
|
-
disabled: {
|
|
1161
|
-
type: Boolean,
|
|
1162
|
-
default: false
|
|
1163
|
-
}
|
|
1164
|
-
},
|
|
1165
|
-
emits: ["redirect"],
|
|
1166
|
-
setup(props, { slots, emit }) {
|
|
1167
|
-
const { client, options } = useAuthOS();
|
|
1168
|
-
const isConfigured = computed(() => !!(options.org && options.service));
|
|
1169
|
-
const providerName = computed(() => PROVIDER_NAMES[props.provider]);
|
|
1170
|
-
function handleClick() {
|
|
1171
|
-
if (!options.org || !options.service) {
|
|
1172
|
-
console.error(
|
|
1173
|
-
`[AuthOS] OAuth login requires "org" and "service" in createAuthOS options.
|
|
1174
|
-
Current options: { org: ${options.org ? `"${options.org}"` : "undefined"}, service: ${options.service ? `"${options.service}"` : "undefined"} }
|
|
1175
|
-
|
|
1176
|
-
Example:
|
|
1177
|
-
app.use(createAuthOS({
|
|
1178
|
-
baseURL: "${options.baseURL}",
|
|
1179
|
-
org: "your-org-slug",
|
|
1180
|
-
service: "your-service-slug",
|
|
1181
|
-
}));
|
|
1182
|
-
|
|
1183
|
-
See: https://docs.authos.dev/vue/oauth-setup`
|
|
1184
|
-
);
|
|
1185
|
-
return;
|
|
1186
|
-
}
|
|
1187
|
-
const redirectUri = options.redirectUri ?? (typeof window !== "undefined" ? window.location.origin + "/callback" : void 0);
|
|
1188
|
-
const url = client.auth.getLoginUrl(props.provider, {
|
|
1189
|
-
org: options.org,
|
|
1190
|
-
service: options.service,
|
|
1191
|
-
redirect_uri: redirectUri
|
|
1192
|
-
});
|
|
1193
|
-
emit("redirect");
|
|
1194
|
-
window.location.href = url;
|
|
1195
|
-
}
|
|
1196
|
-
return () => {
|
|
1197
|
-
const slotProps = {
|
|
1198
|
-
provider: props.provider,
|
|
1199
|
-
providerName: providerName.value,
|
|
1200
|
-
isConfigured: isConfigured.value,
|
|
1201
|
-
disabled: props.disabled,
|
|
1202
|
-
handleClick
|
|
1203
|
-
};
|
|
1204
|
-
if (slots.default) {
|
|
1205
|
-
return slots.default(slotProps);
|
|
1206
|
-
}
|
|
1207
|
-
return h(
|
|
1208
|
-
"button",
|
|
1209
|
-
{
|
|
1210
|
-
type: "button",
|
|
1211
|
-
onClick: handleClick,
|
|
1212
|
-
disabled: props.disabled || !isConfigured.value,
|
|
1213
|
-
"data-authos-oauth": "",
|
|
1214
|
-
"data-provider": props.provider
|
|
1215
|
-
},
|
|
1216
|
-
[
|
|
1217
|
-
getProviderIcon(props.provider),
|
|
1218
|
-
h("span", `Continue with ${providerName.value}`)
|
|
1219
|
-
]
|
|
1220
|
-
);
|
|
1221
|
-
};
|
|
1222
|
-
}
|
|
1223
|
-
});
|
|
1224
1324
|
var SignedIn = defineComponent({
|
|
1225
1325
|
name: "SignedIn",
|
|
1226
1326
|
setup(_, { slots }) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { Cu as parseJSON5, Au as stringifyJSON5 } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { Cu as parseJSON5, Au as stringifyJSON5 } from './chunk-EI6D7ZL6.mjs';
|
|
2
|
+
import './chunk-N667TIER.mjs';
|
|
3
3
|
import './chunk-6DZX6EAA.mjs';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { require_node, require_node_fetch_native_DhEqb06g } from './chunk-
|
|
1
|
+
import { require_node, require_node_fetch_native_DhEqb06g } from './chunk-HVM6PT6I.mjs';
|
|
2
2
|
import { __commonJS, __require } from './chunk-6DZX6EAA.mjs';
|
|
3
3
|
|
|
4
|
-
// node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs
|
|
4
|
+
// ../../node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs
|
|
5
5
|
var require_multipart_parser = __commonJS({
|
|
6
|
-
"node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs"(exports$1) {
|
|
6
|
+
"../../node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs"(exports$1) {
|
|
7
7
|
var y = Object.defineProperty;
|
|
8
8
|
var c = (R, o) => y(R, "name", { value: o, configurable: true });
|
|
9
9
|
var node = require_node();
|
|
@@ -168,6 +168,6 @@ var require_multipart_parser = __commonJS({
|
|
|
168
168
|
c(toFormData, "toFormData"), exports$1.toFormData = toFormData;
|
|
169
169
|
}
|
|
170
170
|
});
|
|
171
|
-
var
|
|
171
|
+
var multipartParserSFUPTK6X = require_multipart_parser();
|
|
172
172
|
|
|
173
|
-
export {
|
|
173
|
+
export { multipartParserSFUPTK6X as default };
|