Merge branch 'gifting-periphery-improvements' into build-improvement

This commit is contained in:
Matthew Raymer
2025-07-04 08:26:03 +00:00
7 changed files with 432 additions and 224 deletions

View File

@@ -3,7 +3,7 @@
<div class="dialog">
<!-- Step 1: Entity Selection -->
<EntitySelectionStep
v-show="currentStep === 1"
v-show="firstStep"
:step-type="stepType"
:giver-entity-type="giverEntityType"
:recipient-entity-type="recipientEntityType"
@@ -24,7 +24,7 @@
<!-- Step 2: Gift Details -->
<GiftDetailsStep
v-show="currentStep === 2"
v-show="!firstStep"
:giver="giver"
:receiver="receiver"
:giver-entity-type="giverEntityType"
@@ -52,6 +52,7 @@
<script lang="ts">
import { Vue, Component, Prop, Watch } from "vue-facing-decorator";
import { Vue, Component, Prop, Watch } from "vue-facing-decorator";
import { NotificationIface } from "../constants/app";
import {
@@ -59,6 +60,7 @@ import {
didInfo,
serverMessageForUser,
getHeaders,
getHeaders,
} from "../libs/endorserServer";
import * as libsUtil from "../libs/util";
import { db, retrieveSettingsForActiveAccount } from "../db/index";
@@ -99,6 +101,23 @@ export default class GiftedDialog extends Vue {
this.updateEntityTypes();
}
@Watch("toProjectId")
onToProjectIdChange() {
this.updateEntityTypes();
}
@Prop({ default: false }) showProjects = false;
@Prop() isFromProjectView = false;
@Watch("showProjects")
onShowProjectsChange() {
this.updateEntityTypes();
}
@Watch("fromProjectId")
onFromProjectIdChange() {
this.updateEntityTypes();
}
@Watch("toProjectId")
onToProjectIdChange() {
this.updateEntityTypes();
@@ -113,14 +132,14 @@ export default class GiftedDialog extends Vue {
callbackOnSuccess?: (amount: number) => void = () => {};
customTitle?: string;
description = "";
firstStep = true; // true = Step 1 (giver/recipient selection), false = Step 2 (amount/description)
giver?: libsUtil.GiverReceiverInputInfo; // undefined means no identified giver agent
offerId = "";
prompt = "";
receiver?: libsUtil.GiverReceiverInputInfo;
unitCode = "HUR";
visible = false;
currentStep = 1;
libsUtil = libsUtil;
projects: PlanData[] = [];
@@ -222,12 +241,15 @@ export default class GiftedDialog extends Vue {
this.amountInput = "0";
this.callbackOnSuccess = callbackOnSuccess;
this.offerId = offerId || "";
this.currentStep = giver ? 2 : 1;
this.firstStep = !giver;
this.stepType = "giver";
// Update entity types based on current props
this.updateEntityTypes();
// Update entity types based on current props
this.updateEntityTypes();
try {
let settings = await databaseUtil.retrieveSettingsForActiveAccount();
this.apiServer = settings.apiServer || "";
@@ -313,7 +335,7 @@ export default class GiftedDialog extends Vue {
this.amountInput = "0";
this.prompt = "";
this.unitCode = "HUR";
this.currentStep = 1;
this.firstStep = true;
}
async confirm() {
@@ -355,6 +377,20 @@ export default class GiftedDialog extends Vue {
);
return;
}
// Check for person conflict
if (this.hasPersonConflict) {
this.$notify(
{
group: "alert",
type: "danger",
title: "Error",
text: "You cannot select the same person as both giver and recipient.",
},
3000,
);
return;
}
// Check for person conflict
if (this.hasPersonConflict) {
@@ -446,14 +482,18 @@ export default class GiftedDialog extends Vue {
this.activeDid,
fromDid,
toDid,
fromDid,
toDid,
description,
amount,
unitCode,
fulfillsProjectHandleId,
fulfillsProjectHandleId,
this.offerId,
false,
undefined,
providerPlanHandleId,
providerPlanHandleId,
);
if (!result.success) {
@@ -540,12 +580,12 @@ export default class GiftedDialog extends Vue {
name: "Unnamed",
};
}
this.currentStep = 2;
this.firstStep = false;
}
goBackToStep1(step: string) {
this.stepType = step;
this.currentStep = 1;
this.firstStep = true;
}
async loadProjects() {
@@ -588,7 +628,7 @@ export default class GiftedDialog extends Vue {
did: this.activeDid,
name: "You",
};
this.currentStep = 2;
this.firstStep = false;
}
selectRecipient(contact?: Contact) {
@@ -603,7 +643,7 @@ export default class GiftedDialog extends Vue {
name: "Unnamed",
};
}
this.currentStep = 2;
this.firstStep = false;
}
selectRecipientProject(project: PlanData) {
@@ -613,7 +653,7 @@ export default class GiftedDialog extends Vue {
image: project.image,
handleId: project.handleId,
};
this.currentStep = 2;
this.firstStep = false;
}
// Computed property for the query parameters