@strivacity/sdk-nuxt 1.0.1 → 2.0.0-beta.2
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/.nuxt/app-component.mjs +1 -1
- package/.nuxt/component-names.mjs +1 -1
- package/.nuxt/components.d.ts +110 -92
- package/.nuxt/error-component.mjs +1 -1
- package/.nuxt/global-polyfills.mjs +4 -0
- package/.nuxt/imports.d.ts +7 -6
- package/.nuxt/imports.mjs +7 -6
- package/.nuxt/layouts.mjs +1 -0
- package/.nuxt/manifest/meta/ba93f89b-30bd-4721-919e-d2c0fdc150d7.json +1 -0
- package/.nuxt/middleware.mjs +1 -1
- package/.nuxt/nuxt.d.ts +1 -2
- package/.nuxt/plugins.client.mjs +18 -0
- package/.nuxt/plugins.server.mjs +10 -0
- package/.nuxt/root-component.mjs +1 -1
- package/.nuxt/router.options.mjs +2 -0
- package/.nuxt/strivacity-sdk-storage.d.ts +3 -3
- package/.nuxt/strivacity-sdk-storage.mjs +1 -1
- package/.nuxt/test-component-wrapper.mjs +1 -1
- package/.nuxt/types/app-defaults.d.ts +1 -1
- package/.nuxt/types/builder-env.d.ts +1 -0
- package/.nuxt/types/nitro-config.d.ts +2 -2
- package/.nuxt/types/nitro-imports.d.ts +13 -3
- package/.nuxt/types/nitro-nuxt.d.ts +5 -0
- package/.nuxt/types/nitro-routes.d.ts +6 -3
- package/.nuxt/types/plugins.d.ts +10 -11
- package/.nuxt/unhead-options.mjs +6 -0
- package/CHANGELOG.md +24 -0
- package/README.md +432 -22
- package/dist/module.d.mts +68 -15
- package/dist/module.json +3 -3
- package/dist/module.mjs +10 -4
- package/dist/module.mjs.map +1 -1
- package/dist/runtime/composables.d.ts +3 -3
- package/dist/runtime/composables.js +11 -1
- package/dist/runtime/login-renderer.vue +163 -0
- package/dist/runtime/login-renderer.vue.d.ts +32 -0
- package/dist/types.d.mts +15 -1
- package/package.json +5 -6
- package/.nuxt/plugins/client.mjs +0 -18
- package/.nuxt/plugins/server.mjs +0 -10
- package/.nuxt/unhead-plugins.mjs +0 -2
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -128
- package/dist/types.d.ts +0 -1
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addTemplate, addTypeTemplate, addImports } from '@nuxt/kit';
|
|
1
|
+
import { defineNuxtModule, createResolver, addTemplate, addTypeTemplate, addComponent, addImports } from '@nuxt/kit';
|
|
2
|
+
export { HttpClient } from '@strivacity/sdk-core/utils/HttpClient';
|
|
2
3
|
import { LocalStorage } from '@strivacity/sdk-core/storages/LocalStorage';
|
|
3
4
|
export { LocalStorage } from '@strivacity/sdk-core/storages/LocalStorage';
|
|
4
5
|
export { SessionStorage } from '@strivacity/sdk-core/storages/SessionStorage';
|
|
6
|
+
export * from '@strivacity/sdk-core';
|
|
5
7
|
|
|
6
8
|
const module = defineNuxtModule({
|
|
7
9
|
meta: {
|
|
@@ -22,13 +24,17 @@ const module = defineNuxtModule({
|
|
|
22
24
|
import type { SDKStorage } from '@strivacity/sdk-core';
|
|
23
25
|
|
|
24
26
|
declare class CustomStorage implements SDKStorage {
|
|
25
|
-
get(key: string): string | null
|
|
26
|
-
delete(key: string): void
|
|
27
|
-
set(key: string, value: string): void
|
|
27
|
+
get(key: string): Promise<string | null>;
|
|
28
|
+
delete(key: string): Promise<void>;
|
|
29
|
+
set(key: string, value: string): Promise<void>;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
export default CustomStorage`
|
|
31
33
|
});
|
|
34
|
+
addComponent({
|
|
35
|
+
name: "StyLoginRenderer",
|
|
36
|
+
filePath: resolver.resolve("./runtime/login-renderer.vue")
|
|
37
|
+
});
|
|
32
38
|
addImports({ name: "useStrivacity", as: "useStrivacity", from: resolver.resolve("./runtime/composables") });
|
|
33
39
|
}
|
|
34
40
|
});
|
package/dist/module.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.mjs","sources":["../src/module.ts"],"sourcesContent":["import type { SDKOptions
|
|
1
|
+
{"version":3,"file":"module.mjs","sources":["../src/module.ts"],"sourcesContent":["import type { SDKOptions } from '@strivacity/sdk-core';\nimport { defineNuxtModule, createResolver, addTemplate, addTypeTemplate, addImports, addComponent } from '@nuxt/kit';\nimport type { PopupFlow } from '@strivacity/sdk-core/flows/PopupFlow';\nimport type { RedirectFlow } from '@strivacity/sdk-core/flows/RedirectFlow';\nimport type { NativeFlow } from '@strivacity/sdk-core/flows/NativeFlow';\nimport { HttpClient } from '@strivacity/sdk-core/utils/HttpClient';\nimport { LocalStorage } from '@strivacity/sdk-core/storages/LocalStorage';\nimport { SessionStorage } from '@strivacity/sdk-core/storages/SessionStorage';\n\ndeclare module '@nuxt/schema' {\n\tinterface PublicRuntimeConfig {\n\t\tstrivacity: SDKOptions;\n\t}\n}\n\nexport type ModuleOptions = SDKOptions;\n\nexport * from '@strivacity/sdk-core';\nexport type * from './types';\nexport type { PopupFlow, RedirectFlow, NativeFlow };\nexport { HttpClient, LocalStorage, SessionStorage };\n\nexport default defineNuxtModule<ModuleOptions>({\n\tmeta: {\n\t\tname: '@strivacity/sdk-nuxt',\n\t\tconfigKey: 'strivacity',\n\t},\n\tdefaults: {} as SDKOptions,\n\tsetup(options, nuxt) {\n\t\tconst resolver = createResolver(import.meta.url);\n\n\t\tnuxt.options.runtimeConfig.public.strivacity = options;\n\n\t\taddTemplate({\n\t\t\tfilename: 'strivacity-sdk-storage.mjs',\n\t\t\tgetContents: () => `export default ${options.storage ? options.storage.toString() : LocalStorage.toString()}`,\n\t\t});\n\t\taddTypeTemplate({\n\t\t\tfilename: 'strivacity-sdk-storage.d.ts',\n\t\t\tgetContents: () => `\nimport type { SDKStorage } from '@strivacity/sdk-core';\n\ndeclare class CustomStorage implements SDKStorage {\n\tget(key: string): Promise<string | null>;\n\tdelete(key: string): Promise<void>;\n\tset(key: string, value: string): Promise<void>;\n}\n\nexport default CustomStorage`,\n\t\t});\n\t\taddComponent({\n\t\t\tname: 'StyLoginRenderer',\n\t\t\tfilePath: resolver.resolve('./runtime/login-renderer.vue'),\n\t\t});\n\t\taddImports({ name: 'useStrivacity', as: 'useStrivacity', from: resolver.resolve('./runtime/composables') });\n\t},\n});\n"],"names":[],"mappings":";;;;;;;AAsBA,eAAe,gBAAA,CAAgC;AAAA,EAC9C,IAAA,EAAM;AAAA,IACL,IAAA,EAAM,sBAAA;AAAA,IACN,SAAA,EAAW;AAAA,GACZ;AAAA,EACA,UAAU,EAAC;AAAA,EACX,KAAA,CAAM,SAAS,IAAA,EAAM;AACpB,IAAA,MAAM,QAAA,GAAW,cAAA,CAAe,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA;AAE/C,IAAA,IAAA,CAAK,OAAA,CAAQ,aAAA,CAAc,MAAA,CAAO,UAAA,GAAa,OAAA;AAE/C,IAAA,WAAA,CAAY;AAAA,MACX,QAAA,EAAU,4BAAA;AAAA,MACV,WAAA,EAAa,MAAM,CAAA,eAAA,EAAkB,OAAA,CAAQ,OAAA,GAAU,OAAA,CAAQ,OAAA,CAAQ,QAAA,EAAS,GAAI,YAAA,CAAa,QAAA,EAAU,CAAA;AAAA,KAC3G,CAAA;AACD,IAAA,eAAA,CAAgB;AAAA,MACf,QAAA,EAAU,6BAAA;AAAA,MACV,aAAa,MAAM;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA,4BAAA;AAAA,KAUnB,CAAA;AACD,IAAA,YAAA,CAAa;AAAA,MACZ,IAAA,EAAM,kBAAA;AAAA,MACN,QAAA,EAAU,QAAA,CAAS,OAAA,CAAQ,8BAA8B;AAAA,KACzD,CAAA;AACD,IAAA,UAAA,CAAW,EAAE,IAAA,EAAM,eAAA,EAAiB,EAAA,EAAI,eAAA,EAAiB,MAAM,QAAA,CAAS,OAAA,CAAQ,uBAAuB,CAAA,EAAG,CAAA;AAAA;AAE5G,CAAC,CAAA;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PopupContext, RedirectContext } from '../types.js';
|
|
1
|
+
import type { PopupContext, RedirectContext, NativeContext } from '../types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Retrieves the Strivacity SDK context for Popup or Redirect flows.
|
|
4
4
|
*
|
|
@@ -6,6 +6,6 @@ import type { PopupContext, RedirectContext } from '../types.js';
|
|
|
6
6
|
*
|
|
7
7
|
* @throws {Error} If the Strivacity SDK context is not found.
|
|
8
8
|
*
|
|
9
|
-
* @returns {T} The Strivacity SDK context, typed as either PopupContext or RedirectContext.
|
|
9
|
+
* @returns {T} The Strivacity SDK context, typed as either PopupContext or RedirectContext or NativeContext.
|
|
10
10
|
*/
|
|
11
|
-
export declare const useStrivacity:
|
|
11
|
+
export declare const useStrivacity: () => PopupContext | RedirectContext | NativeContext;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import StorageClass from "#build/strivacity-sdk-storage";
|
|
2
2
|
import { ref, useRuntimeConfig } from "#imports";
|
|
3
3
|
import { initFlow } from "@strivacity/sdk-core";
|
|
4
|
-
const loadingRef = ref(
|
|
4
|
+
const loadingRef = ref(true);
|
|
5
|
+
const optionsRef = ref({});
|
|
5
6
|
const isAuthenticatedRef = ref(false);
|
|
6
7
|
const idTokenClaimsRef = ref(null);
|
|
7
8
|
const accessTokenRef = ref(null);
|
|
@@ -23,6 +24,7 @@ const updateSession = async () => {
|
|
|
23
24
|
export const useStrivacity = () => {
|
|
24
25
|
if (!sdk) {
|
|
25
26
|
sdk = initFlow({ ...useRuntimeConfig().public.strivacity, storage: StorageClass });
|
|
27
|
+
optionsRef.value = sdk.options;
|
|
26
28
|
sdk.subscribeToEvent("init", updateSession);
|
|
27
29
|
sdk.subscribeToEvent("loggedIn", updateSession);
|
|
28
30
|
sdk.subscribeToEvent("sessionLoaded", updateSession);
|
|
@@ -33,7 +35,9 @@ export const useStrivacity = () => {
|
|
|
33
35
|
sdk.subscribeToEvent("tokenRevokeFailed", updateSession);
|
|
34
36
|
}
|
|
35
37
|
return {
|
|
38
|
+
sdk,
|
|
36
39
|
loading: loadingRef,
|
|
40
|
+
options: optionsRef,
|
|
37
41
|
isAuthenticated: isAuthenticatedRef,
|
|
38
42
|
idTokenClaims: idTokenClaimsRef,
|
|
39
43
|
accessToken: accessTokenRef,
|
|
@@ -41,10 +45,16 @@ export const useStrivacity = () => {
|
|
|
41
45
|
accessTokenExpired: accessTokenExpiredRef,
|
|
42
46
|
accessTokenExpirationDate: accessTokenExpirationDateRef,
|
|
43
47
|
login: async (options) => {
|
|
48
|
+
if (sdk.options.mode === "native") {
|
|
49
|
+
return sdk.login(options);
|
|
50
|
+
}
|
|
44
51
|
await sdk.login(options);
|
|
45
52
|
await updateSession();
|
|
46
53
|
},
|
|
47
54
|
register: async (options) => {
|
|
55
|
+
if (sdk.options.mode === "native") {
|
|
56
|
+
return sdk.register(options);
|
|
57
|
+
}
|
|
48
58
|
await sdk.register(options);
|
|
49
59
|
await updateSession();
|
|
50
60
|
},
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { defineComponent, provide, ref, h, onMounted } from "vue";
|
|
3
|
+
import { FallbackError } from "@strivacity/sdk-core";
|
|
4
|
+
import { unflattenObject } from "@strivacity/sdk-core/utils/object";
|
|
5
|
+
import { useStrivacity } from "./composables";
|
|
6
|
+
const { sdk } = useStrivacity();
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
params: { type: Object, required: false, default: () => ({}) },
|
|
9
|
+
widgets: { type: null, required: false, default: () => ({}) },
|
|
10
|
+
sessionId: { type: [String, null], required: false, default: null }
|
|
11
|
+
});
|
|
12
|
+
const emit = defineEmits(["login", "fallback", "error", "globalMessage", "blockReady"]);
|
|
13
|
+
const WidgetRenderer = defineComponent({
|
|
14
|
+
props: {
|
|
15
|
+
items: {
|
|
16
|
+
type: Array,
|
|
17
|
+
default: () => []
|
|
18
|
+
},
|
|
19
|
+
widgets: {
|
|
20
|
+
type: Object,
|
|
21
|
+
default: () => ({})
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
setup: (props2) => () => props2.items.map((item) => {
|
|
25
|
+
if (item.type === "widget") {
|
|
26
|
+
const form = state.value?.forms?.find((form2) => form2.id === item.formId);
|
|
27
|
+
const widget = form?.widgets.find((widget2) => widget2.id === item.widgetId);
|
|
28
|
+
if (!form || !widget) {
|
|
29
|
+
triggerFallback();
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const component = props2.widgets[widget.type];
|
|
33
|
+
if (!component) {
|
|
34
|
+
triggerFallback();
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return h(component, { key: `${form.id}.${widget.id}`, formId: form.id, config: widget });
|
|
38
|
+
} else if (item.type === "vertical" || item.type === "horizontal") {
|
|
39
|
+
if (!props2.widgets.layout) {
|
|
40
|
+
triggerFallback();
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return h(
|
|
44
|
+
props2.widgets.layout,
|
|
45
|
+
{ formId: item.items[0].formId, type: item.type },
|
|
46
|
+
() => h(WidgetRenderer, { items: item.items, widgets: props2.widgets })
|
|
47
|
+
);
|
|
48
|
+
} else {
|
|
49
|
+
triggerFallback();
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
const loginHandler = sdk.login(props.params);
|
|
55
|
+
const loading = ref(false);
|
|
56
|
+
const forms = ref({});
|
|
57
|
+
const messages = ref({});
|
|
58
|
+
const state = ref({});
|
|
59
|
+
provide("nativeFlowContext", {
|
|
60
|
+
loading,
|
|
61
|
+
forms,
|
|
62
|
+
messages,
|
|
63
|
+
state,
|
|
64
|
+
submitForm,
|
|
65
|
+
triggerFallback,
|
|
66
|
+
setFormValue,
|
|
67
|
+
setMessage
|
|
68
|
+
});
|
|
69
|
+
onMounted(async () => {
|
|
70
|
+
try {
|
|
71
|
+
const data = await loginHandler.startSession(props.sessionId);
|
|
72
|
+
if (data) {
|
|
73
|
+
await handleResponse(data);
|
|
74
|
+
}
|
|
75
|
+
} catch (error) {
|
|
76
|
+
if (error instanceof FallbackError) {
|
|
77
|
+
emit("fallback", error);
|
|
78
|
+
} else {
|
|
79
|
+
emit("error", error);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
function triggerFallback(hostedUrl) {
|
|
84
|
+
const url = hostedUrl || state.value.hostedUrl;
|
|
85
|
+
if (!url) {
|
|
86
|
+
throw new Error("No hosted URL provided");
|
|
87
|
+
}
|
|
88
|
+
emit("fallback", new FallbackError(new URL(url)));
|
|
89
|
+
}
|
|
90
|
+
function setFormValue(formId, widgetId, value) {
|
|
91
|
+
if (value === "") {
|
|
92
|
+
value = null;
|
|
93
|
+
}
|
|
94
|
+
if (forms.value[formId] === void 0) {
|
|
95
|
+
forms.value[formId] = {};
|
|
96
|
+
}
|
|
97
|
+
forms.value[formId][widgetId] = value;
|
|
98
|
+
}
|
|
99
|
+
function setMessage(formId, widgetId, value) {
|
|
100
|
+
if (messages.value[formId] === void 0) {
|
|
101
|
+
messages.value[formId] = {};
|
|
102
|
+
}
|
|
103
|
+
messages.value[formId][widgetId] = value;
|
|
104
|
+
}
|
|
105
|
+
async function submitForm(formId) {
|
|
106
|
+
try {
|
|
107
|
+
loading.value = true;
|
|
108
|
+
const data = await loginHandler.submitForm(formId, unflattenObject(forms.value[formId]));
|
|
109
|
+
await handleResponse(data);
|
|
110
|
+
loading.value = false;
|
|
111
|
+
} catch (error) {
|
|
112
|
+
if (error instanceof FallbackError) {
|
|
113
|
+
emit("fallback", error);
|
|
114
|
+
} else {
|
|
115
|
+
emit("error", error);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
async function handleResponse(data) {
|
|
120
|
+
if (await sdk.isAuthenticated) {
|
|
121
|
+
emit("login", sdk.idTokenClaims);
|
|
122
|
+
} else {
|
|
123
|
+
const previousState = JSON.parse(JSON.stringify(state.value));
|
|
124
|
+
const newState = {
|
|
125
|
+
hostedUrl: data?.hostedUrl ?? state.value.hostedUrl,
|
|
126
|
+
finalizeUrl: data?.finalizeUrl ?? state.value.finalizeUrl,
|
|
127
|
+
screen: data?.screen ?? state.value.screen,
|
|
128
|
+
forms: data?.forms ?? state.value.forms,
|
|
129
|
+
layout: data?.layout ?? state.value.layout,
|
|
130
|
+
messages: data?.messages ?? state.value.messages,
|
|
131
|
+
branding: data?.branding ?? state.value.branding
|
|
132
|
+
};
|
|
133
|
+
if (newState.screen != state.value.screen) {
|
|
134
|
+
forms.value = {};
|
|
135
|
+
messages.value = {};
|
|
136
|
+
for (const form of newState.forms ?? []) {
|
|
137
|
+
forms.value[form.id] = {};
|
|
138
|
+
messages.value[form.id] = {};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
Object.keys(newState.messages ?? {}).forEach((formId) => {
|
|
142
|
+
if (formId === "global") {
|
|
143
|
+
emit("globalMessage", newState.messages?.global?.text ?? "");
|
|
144
|
+
} else {
|
|
145
|
+
messages.value[formId] = newState.messages[formId];
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
state.value = newState;
|
|
149
|
+
setTimeout(() => {
|
|
150
|
+
emit("blockReady", { previousState, state: JSON.parse(JSON.stringify(state.value)) });
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
</script>
|
|
155
|
+
|
|
156
|
+
<template>
|
|
157
|
+
<div class="login-renderer">
|
|
158
|
+
<component :is="widgets.layout" v-if="state.screen" :formId="(state.layout?.items[0]).formId" :type="state.layout?.type" tag="form">
|
|
159
|
+
<WidgetRenderer :items="state.layout?.items" :widgets="widgets" />
|
|
160
|
+
</component>
|
|
161
|
+
<component :is="widgets.loading" v-else />
|
|
162
|
+
</div>
|
|
163
|
+
</template>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Component } from 'vue';
|
|
2
|
+
import type { PartialRecord, NativeParams, WidgetType, LoginFlowState, IdTokenClaims } from '@strivacity/sdk-core';
|
|
3
|
+
import { FallbackError } from '@strivacity/sdk-core';
|
|
4
|
+
type __VLS_Props = {
|
|
5
|
+
params?: NativeParams;
|
|
6
|
+
widgets?: PartialRecord<WidgetType, Component>;
|
|
7
|
+
sessionId?: string | null;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
login: (args_0: IdTokenClaims | null | undefined) => any;
|
|
11
|
+
fallback: (args_0: FallbackError) => any;
|
|
12
|
+
error: (args_0: any) => any;
|
|
13
|
+
globalMessage: (args_0: string) => any;
|
|
14
|
+
blockReady: (args_0: {
|
|
15
|
+
previousState: LoginFlowState;
|
|
16
|
+
state: LoginFlowState;
|
|
17
|
+
}) => any;
|
|
18
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
19
|
+
onLogin?: ((args_0: IdTokenClaims | null | undefined) => any) | undefined;
|
|
20
|
+
onFallback?: ((args_0: FallbackError) => any) | undefined;
|
|
21
|
+
onError?: ((args_0: any) => any) | undefined;
|
|
22
|
+
onGlobalMessage?: ((args_0: string) => any) | undefined;
|
|
23
|
+
onBlockReady?: ((args_0: {
|
|
24
|
+
previousState: LoginFlowState;
|
|
25
|
+
state: LoginFlowState;
|
|
26
|
+
}) => any) | undefined;
|
|
27
|
+
}>, {
|
|
28
|
+
params: NativeParams;
|
|
29
|
+
widgets: PartialRecord<WidgetType, Component>;
|
|
30
|
+
sessionId: string | null;
|
|
31
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
32
|
+
export default _default;
|
package/dist/types.d.mts
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
export { type
|
|
1
|
+
export { type PopupFlow } from '@strivacity/sdk-core/flows/PopupFlow'
|
|
2
|
+
|
|
3
|
+
export { type RedirectFlow } from '@strivacity/sdk-core/flows/RedirectFlow'
|
|
4
|
+
|
|
5
|
+
export { type NativeFlow } from '@strivacity/sdk-core/flows/NativeFlow'
|
|
6
|
+
|
|
7
|
+
export { type HttpClient } from '@strivacity/sdk-core/utils/HttpClient'
|
|
8
|
+
|
|
9
|
+
export { type LocalStorage } from '@strivacity/sdk-core/storages/LocalStorage'
|
|
10
|
+
|
|
11
|
+
export { type SessionStorage } from '@strivacity/sdk-core/storages/SessionStorage'
|
|
12
|
+
|
|
13
|
+
export { type ModuleOptions, type NativeContext, type NativeFlowContextValue, type NativeSDK, type PopupContext, type PopupSDK, type RedirectContext, type RedirectSDK, type Session, default } from './module.mjs'
|
|
14
|
+
|
|
15
|
+
export * from '@strivacity/sdk-core'
|
package/package.json
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strivacity/sdk-nuxt",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Strivacity Nuxt SDK client",
|
|
7
7
|
"author": "strivacity <info@strivacity.com>",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@strivacity/sdk-core": "
|
|
9
|
+
"@strivacity/sdk-core": "2.0.0-beta.2"
|
|
10
10
|
},
|
|
11
|
-
"main": "./dist/module.
|
|
12
|
-
"types": "./dist/types.d.
|
|
11
|
+
"main": "./dist/module.mjs",
|
|
12
|
+
"types": "./dist/types.d.mts",
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
|
-
"types": "./dist/types.d.
|
|
15
|
+
"types": "./dist/types.d.mts",
|
|
16
16
|
"import": "./dist/module.mjs",
|
|
17
|
-
"require": "./dist/module.cjs",
|
|
18
17
|
"default": "./dist/module.mjs"
|
|
19
18
|
}
|
|
20
19
|
}
|
package/.nuxt/plugins/client.mjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import revive_payload_client_MPcvDN94d2 from "/home/runner/work/sdk-js/sdk-js/node_modules/.pnpm/nuxt@3.13.2_@parcel+watcher@2.4.1_@types+node@20.14.14_encoding@0.1.13_eslint@8.57.0_ioredis@_75nr233rh375h7xk6r7jtwnphe/node_modules/nuxt/dist/app/plugins/revive-payload.client.js";
|
|
2
|
-
import unhead_Rj8e3arFst from "/home/runner/work/sdk-js/sdk-js/node_modules/.pnpm/nuxt@3.13.2_@parcel+watcher@2.4.1_@types+node@20.14.14_encoding@0.1.13_eslint@8.57.0_ioredis@_75nr233rh375h7xk6r7jtwnphe/node_modules/nuxt/dist/head/runtime/plugins/unhead.js";
|
|
3
|
-
import router_dciEroc59B from "/home/runner/work/sdk-js/sdk-js/node_modules/.pnpm/nuxt@3.13.2_@parcel+watcher@2.4.1_@types+node@20.14.14_encoding@0.1.13_eslint@8.57.0_ioredis@_75nr233rh375h7xk6r7jtwnphe/node_modules/nuxt/dist/app/plugins/router.js";
|
|
4
|
-
import payload_client_pyZDIqthKi from "/home/runner/work/sdk-js/sdk-js/node_modules/.pnpm/nuxt@3.13.2_@parcel+watcher@2.4.1_@types+node@20.14.14_encoding@0.1.13_eslint@8.57.0_ioredis@_75nr233rh375h7xk6r7jtwnphe/node_modules/nuxt/dist/app/plugins/payload.client.js";
|
|
5
|
-
import navigation_repaint_client_4DKTXvjm9h from "/home/runner/work/sdk-js/sdk-js/node_modules/.pnpm/nuxt@3.13.2_@parcel+watcher@2.4.1_@types+node@20.14.14_encoding@0.1.13_eslint@8.57.0_ioredis@_75nr233rh375h7xk6r7jtwnphe/node_modules/nuxt/dist/app/plugins/navigation-repaint.client.js";
|
|
6
|
-
import check_outdated_build_client_Tuhud57UuP from "/home/runner/work/sdk-js/sdk-js/node_modules/.pnpm/nuxt@3.13.2_@parcel+watcher@2.4.1_@types+node@20.14.14_encoding@0.1.13_eslint@8.57.0_ioredis@_75nr233rh375h7xk6r7jtwnphe/node_modules/nuxt/dist/app/plugins/check-outdated-build.client.js";
|
|
7
|
-
import chunk_reload_client_TU0ySojJkd from "/home/runner/work/sdk-js/sdk-js/node_modules/.pnpm/nuxt@3.13.2_@parcel+watcher@2.4.1_@types+node@20.14.14_encoding@0.1.13_eslint@8.57.0_ioredis@_75nr233rh375h7xk6r7jtwnphe/node_modules/nuxt/dist/app/plugins/chunk-reload.client.js";
|
|
8
|
-
import components_plugin_KR1HBZs4kY from "/home/runner/work/sdk-js/sdk-js/packages/sdk-nuxt/.nuxt/components.plugin.mjs";
|
|
9
|
-
export default [
|
|
10
|
-
revive_payload_client_MPcvDN94d2,
|
|
11
|
-
unhead_Rj8e3arFst,
|
|
12
|
-
router_dciEroc59B,
|
|
13
|
-
payload_client_pyZDIqthKi,
|
|
14
|
-
navigation_repaint_client_4DKTXvjm9h,
|
|
15
|
-
check_outdated_build_client_Tuhud57UuP,
|
|
16
|
-
chunk_reload_client_TU0ySojJkd,
|
|
17
|
-
components_plugin_KR1HBZs4kY
|
|
18
|
-
]
|
package/.nuxt/plugins/server.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import unhead_Rj8e3arFst from "/home/runner/work/sdk-js/sdk-js/node_modules/.pnpm/nuxt@3.13.2_@parcel+watcher@2.4.1_@types+node@20.14.14_encoding@0.1.13_eslint@8.57.0_ioredis@_75nr233rh375h7xk6r7jtwnphe/node_modules/nuxt/dist/head/runtime/plugins/unhead.js";
|
|
2
|
-
import router_dciEroc59B from "/home/runner/work/sdk-js/sdk-js/node_modules/.pnpm/nuxt@3.13.2_@parcel+watcher@2.4.1_@types+node@20.14.14_encoding@0.1.13_eslint@8.57.0_ioredis@_75nr233rh375h7xk6r7jtwnphe/node_modules/nuxt/dist/app/plugins/router.js";
|
|
3
|
-
import revive_payload_server_EduDJw0JCy from "/home/runner/work/sdk-js/sdk-js/node_modules/.pnpm/nuxt@3.13.2_@parcel+watcher@2.4.1_@types+node@20.14.14_encoding@0.1.13_eslint@8.57.0_ioredis@_75nr233rh375h7xk6r7jtwnphe/node_modules/nuxt/dist/app/plugins/revive-payload.server.js";
|
|
4
|
-
import components_plugin_KR1HBZs4kY from "/home/runner/work/sdk-js/sdk-js/packages/sdk-nuxt/.nuxt/components.plugin.mjs";
|
|
5
|
-
export default [
|
|
6
|
-
unhead_Rj8e3arFst,
|
|
7
|
-
router_dciEroc59B,
|
|
8
|
-
revive_payload_server_EduDJw0JCy,
|
|
9
|
-
components_plugin_KR1HBZs4kY
|
|
10
|
-
]
|
package/.nuxt/unhead-plugins.mjs
DELETED
package/dist/module.cjs
DELETED
package/dist/module.d.ts
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import { IdTokenClaims, SDKOptions } from '@strivacity/sdk-core';
|
|
3
|
-
export { IdTokenClaims, SDKOptions, SDKStorage } from '@strivacity/sdk-core';
|
|
4
|
-
import { PopupFlow } from '@strivacity/sdk-core/flows/PopupFlow';
|
|
5
|
-
export { PopupFlow } from '@strivacity/sdk-core/flows/PopupFlow';
|
|
6
|
-
import { RedirectFlow } from '@strivacity/sdk-core/flows/RedirectFlow';
|
|
7
|
-
export { RedirectFlow } from '@strivacity/sdk-core/flows/RedirectFlow';
|
|
8
|
-
export { LocalStorage } from '@strivacity/sdk-core/storages/LocalStorage';
|
|
9
|
-
export { SessionStorage } from '@strivacity/sdk-core/storages/SessionStorage';
|
|
10
|
-
import { Ref } from 'vue';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Represents the session state, including authentication details and token information.
|
|
14
|
-
*/
|
|
15
|
-
type Session = {
|
|
16
|
-
/**
|
|
17
|
-
* Reactive reference to the loading state of the session.
|
|
18
|
-
* `true` when the session is initializing, otherwise `false`.
|
|
19
|
-
*/
|
|
20
|
-
loading: Ref<boolean>;
|
|
21
|
-
/**
|
|
22
|
-
* Reactive reference to the user's authentication status.
|
|
23
|
-
* `true` if the user is authenticated, otherwise `false`.
|
|
24
|
-
*/
|
|
25
|
-
isAuthenticated: Ref<boolean>;
|
|
26
|
-
/**
|
|
27
|
-
* Reactive reference to the claims contained in the ID token.
|
|
28
|
-
* Contains user identity and other information, or `null` if not authenticated.
|
|
29
|
-
*/
|
|
30
|
-
idTokenClaims: Ref<IdTokenClaims | null>;
|
|
31
|
-
/**
|
|
32
|
-
* Reactive reference to the current access token for API authorization.
|
|
33
|
-
* `null` if the user is not authenticated or the token is unavailable.
|
|
34
|
-
*/
|
|
35
|
-
accessToken: Ref<string | null>;
|
|
36
|
-
/**
|
|
37
|
-
* Reactive reference to the refresh token, used to refresh the access token.
|
|
38
|
-
* `null` if the user is not authenticated or the refresh token is unavailable.
|
|
39
|
-
*/
|
|
40
|
-
refreshToken: Ref<string | null>;
|
|
41
|
-
/**
|
|
42
|
-
* Reactive reference indicating if the access token has expired.
|
|
43
|
-
* `true` if expired, otherwise `false`.
|
|
44
|
-
*/
|
|
45
|
-
accessTokenExpired: Ref<boolean>;
|
|
46
|
-
/**
|
|
47
|
-
* Reactive reference to the expiration date of the access token in Unix time (milliseconds).
|
|
48
|
-
* `null` if no token is available or the session is not authenticated.
|
|
49
|
-
*/
|
|
50
|
-
accessTokenExpirationDate: Ref<number | null>;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Represents the available authentication flows and operations for Popup-based interactions.
|
|
54
|
-
*/
|
|
55
|
-
type PopupSDK = {
|
|
56
|
-
/**
|
|
57
|
-
* Initiates the login process using a popup window.
|
|
58
|
-
*/
|
|
59
|
-
login: InstanceType<typeof PopupFlow>['login'];
|
|
60
|
-
/**
|
|
61
|
-
* Registers a new user using a popup flow.
|
|
62
|
-
*/
|
|
63
|
-
register: InstanceType<typeof PopupFlow>['register'];
|
|
64
|
-
/**
|
|
65
|
-
* Refreshes the user's session using a popup.
|
|
66
|
-
*/
|
|
67
|
-
refresh: InstanceType<typeof PopupFlow>['refresh'];
|
|
68
|
-
/**
|
|
69
|
-
* Revokes the current session tokens using a popup flow.
|
|
70
|
-
*/
|
|
71
|
-
revoke: InstanceType<typeof PopupFlow>['revoke'];
|
|
72
|
-
/**
|
|
73
|
-
* Logs out the user using a popup window.
|
|
74
|
-
*/
|
|
75
|
-
logout: InstanceType<typeof PopupFlow>['logout'];
|
|
76
|
-
/**
|
|
77
|
-
* Handles the callback after a popup-based authentication or token exchange.
|
|
78
|
-
*/
|
|
79
|
-
handleCallback: InstanceType<typeof PopupFlow>['handleCallback'];
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* Represents the available authentication flows and operations for Redirect-based interactions.
|
|
83
|
-
*/
|
|
84
|
-
type RedirectSDK = {
|
|
85
|
-
/**
|
|
86
|
-
* Initiates the login process by redirecting the user to the identity provider.
|
|
87
|
-
*/
|
|
88
|
-
login: InstanceType<typeof RedirectFlow>['login'];
|
|
89
|
-
/**
|
|
90
|
-
* Registers a new user using a redirect flow.
|
|
91
|
-
*/
|
|
92
|
-
register: InstanceType<typeof RedirectFlow>['register'];
|
|
93
|
-
/**
|
|
94
|
-
* Refreshes the user's session using a redirect flow.
|
|
95
|
-
*/
|
|
96
|
-
refresh: InstanceType<typeof RedirectFlow>['refresh'];
|
|
97
|
-
/**
|
|
98
|
-
* Revokes the current session tokens using a redirect flow.
|
|
99
|
-
*/
|
|
100
|
-
revoke: InstanceType<typeof RedirectFlow>['revoke'];
|
|
101
|
-
/**
|
|
102
|
-
* Logs out the user by redirecting to the logout page.
|
|
103
|
-
*/
|
|
104
|
-
logout: InstanceType<typeof RedirectFlow>['logout'];
|
|
105
|
-
/**
|
|
106
|
-
* Handles the callback after a redirect-based authentication or token exchange.
|
|
107
|
-
*/
|
|
108
|
-
handleCallback: InstanceType<typeof RedirectFlow>['handleCallback'];
|
|
109
|
-
};
|
|
110
|
-
/**
|
|
111
|
-
* Represents a combined context for Popup-based flows, containing both the Popup SDK and the session state.
|
|
112
|
-
*/
|
|
113
|
-
type PopupContext = PopupSDK & Session;
|
|
114
|
-
/**
|
|
115
|
-
* Represents a combined context for Redirect-based flows, containing both the Redirect SDK and the session state.
|
|
116
|
-
*/
|
|
117
|
-
type RedirectContext = RedirectSDK & Session;
|
|
118
|
-
|
|
119
|
-
declare module '@nuxt/schema' {
|
|
120
|
-
interface PublicRuntimeConfig {
|
|
121
|
-
strivacity: SDKOptions;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
type ModuleOptions = SDKOptions;
|
|
125
|
-
|
|
126
|
-
declare const _default: _nuxt_schema.NuxtModule<SDKOptions, SDKOptions, false>;
|
|
127
|
-
|
|
128
|
-
export { type ModuleOptions, type PopupContext, type PopupSDK, type RedirectContext, type RedirectSDK, type Session, _default as default };
|
package/dist/types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { type IdTokenClaims, type SDKOptions, type SDKStorage } from './module'
|