From 5bd41256f1817e183ce0f78199439cc819964d18 Mon Sep 17 00:00:00 2001 From: Lucas ONeil Date: Tue, 24 Oct 2023 17:40:22 -0700 Subject: [PATCH] Accept OOB invite Signed-off-by: Lucas ONeil --- .../acceptInvitation/AcceptInviteForm.vue | 41 +++++++++++++++++-- .../AcceptInviteSubmission.vue | 19 +++++---- .../frontend/src/plugins/i18n/locales/en.json | 1 + .../frontend/src/plugins/i18n/locales/fr.json | 1 + .../frontend/src/plugins/i18n/locales/ja.json | 1 + .../frontend/src/store/connectionStore.ts | 11 ++++- 6 files changed, 62 insertions(+), 12 deletions(-) diff --git a/services/tenant-ui/frontend/src/components/connections/acceptInvitation/AcceptInviteForm.vue b/services/tenant-ui/frontend/src/components/connections/acceptInvitation/AcceptInviteForm.vue index 230463d63..600b07d74 100644 --- a/services/tenant-ui/frontend/src/components/connections/acceptInvitation/AcceptInviteForm.vue +++ b/services/tenant-ui/frontend/src/components/connections/acceptInvitation/AcceptInviteForm.vue @@ -1,5 +1,32 @@ @@ -57,6 +90,7 @@ import { reactive, ref } from 'vue'; // PrimeVue / Validation import Button from 'primevue/button'; import InputText from 'primevue/inputtext'; +import RadioButton from 'primevue/radiobutton'; import { required, url } from '@vuelidate/validators'; import { useVuelidate } from '@vuelidate/core'; import { useToast } from 'vue-toastification'; @@ -70,6 +104,7 @@ defineEmits(['closed']); const urlEntryStep = ref(true); const invitationString = ref('{}'); +const isOob = ref(false); // Skip URL enter const skipUrl = () => { @@ -97,7 +132,7 @@ const handleSubmit = async (isFormValid: boolean) => { try { const inviteParam = paramFromUrlString( formFields.inviteUrl, - 'c_i' + isOob.value ? 'oob' : 'c_i' ) as string; if (!inviteParam) { throw Error('Invalid format for invitation URL'); diff --git a/services/tenant-ui/frontend/src/components/connections/acceptInvitation/AcceptInviteSubmission.vue b/services/tenant-ui/frontend/src/components/connections/acceptInvitation/AcceptInviteSubmission.vue index f3c4ff16f..cd0dfa105 100644 --- a/services/tenant-ui/frontend/src/components/connections/acceptInvitation/AcceptInviteSubmission.vue +++ b/services/tenant-ui/frontend/src/components/connections/acceptInvitation/AcceptInviteSubmission.vue @@ -77,12 +77,16 @@ const { loading } = storeToRefs(useConnectionStore()); const emit = defineEmits(['closed', 'success']); -const props = defineProps({ - invitationString: { - type: String, - default: '{}', - }, -}); +const props = withDefaults( + defineProps<{ + invitationString?: string; + isOob?: boolean; + }>(), + { + invitationString: '{}', + isOob: false, + } +); // Validation const formFields = reactive({ @@ -111,7 +115,8 @@ const handleSubmit = async (isFormValid: boolean) => { try { await connectionStore.receiveInvitation( formFields.invitationJson, - formFields.alias + formFields.alias, + props.isOob ); emit('success'); // close up on success diff --git a/services/tenant-ui/frontend/src/plugins/i18n/locales/en.json b/services/tenant-ui/frontend/src/plugins/i18n/locales/en.json index b0b34534f..80363f980 100644 --- a/services/tenant-ui/frontend/src/plugins/i18n/locales/en.json +++ b/services/tenant-ui/frontend/src/plugins/i18n/locales/en.json @@ -161,6 +161,7 @@ "skipUrl": "Skip URL and use JSON", "submit": "Accept", "supportedUrl": "Supported URL format is", + "supportedUrlEx": "http://?{0}=", "url": "Invitation URL" }, "connections": { diff --git a/services/tenant-ui/frontend/src/plugins/i18n/locales/fr.json b/services/tenant-ui/frontend/src/plugins/i18n/locales/fr.json index dab2ec1da..f849db4c8 100644 --- a/services/tenant-ui/frontend/src/plugins/i18n/locales/fr.json +++ b/services/tenant-ui/frontend/src/plugins/i18n/locales/fr.json @@ -160,6 +160,7 @@ "skipUrl": "Skip URL and use JSON ", "submit": "Accept ", "supportedUrl": "Supported URL format is ", + "supportedUrlEx": "http://?{0}=", "url": "Invitation URL " }, "connections": { diff --git a/services/tenant-ui/frontend/src/plugins/i18n/locales/ja.json b/services/tenant-ui/frontend/src/plugins/i18n/locales/ja.json index 188139316..27cffc01d 100644 --- a/services/tenant-ui/frontend/src/plugins/i18n/locales/ja.json +++ b/services/tenant-ui/frontend/src/plugins/i18n/locales/ja.json @@ -160,6 +160,7 @@ "skipUrl": "Skip URL and use JSON ", "submit": "Accept ", "supportedUrl": "Supported URL format is ", + "supportedUrlEx": "http://?{0}=", "url": "Invitation URL " }, "connections": { diff --git a/services/tenant-ui/frontend/src/store/connectionStore.ts b/services/tenant-ui/frontend/src/store/connectionStore.ts index 6275138db..ce5e50a88 100644 --- a/services/tenant-ui/frontend/src/store/connectionStore.ts +++ b/services/tenant-ui/frontend/src/store/connectionStore.ts @@ -133,7 +133,11 @@ export const useConnectionStore = defineStore('connection', () => { return invitationData; } - async function receiveInvitation(invite: string, alias: string) { + async function receiveInvitation( + invite: string, + alias: string, + oob: boolean + ) { console.log('> connectionStore.receiveInvitation'); error.value = null; loading.value = true; @@ -141,8 +145,11 @@ export const useConnectionStore = defineStore('connection', () => { let acceptedData = null; const payload = JSON.parse(invite); + const url = oob + ? API_PATH.OUT_OF_BAND_RECIEVE + : API_PATH.CONNECTIONS_RECEIVE_INVITATION; await acapyApi - .postHttp(API_PATH.CONNECTIONS_RECEIVE_INVITATION, payload, { + .postHttp(url, payload, { params: { alias, auto_accept: true }, }) .then((res) => {