@yrpri/api 9.0.79 → 9.0.81
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/active-citizen/engine/notifications/emails_utils.cjs +3 -0
- package/agents/assistants/modes/tools/agentTools.js +2 -2
- package/agents/assistants/modes/tools/models/subscriptions.js +1 -0
- package/agents/assistants/modes/tools/subscriptionTools.js +32 -4
- package/agents/managers/notificationAgentQueueManager.js +3 -2
- package/agents/models/testData/createEvolyAgentProduct.js +59 -4
- package/agents/models/testData/updateAgentWorkflowConfiguration.js +158 -31
- package/app.js +10 -4
- package/package.json +1 -1
|
@@ -104,6 +104,9 @@ const renderTemplateWithLocals = (templatePath, locals, done) => {
|
|
|
104
104
|
});
|
|
105
105
|
};
|
|
106
106
|
const translateSubject = function (subjectHash) {
|
|
107
|
+
if (typeof subjectHash === 'string') {
|
|
108
|
+
return i18n.t(subjectHash);
|
|
109
|
+
}
|
|
107
110
|
var subject = i18n.t(subjectHash.translateToken);
|
|
108
111
|
if (subjectHash.contentName) {
|
|
109
112
|
subject += ": " + subjectHash.contentName;
|
|
@@ -315,7 +315,7 @@ export class AgentTools extends BaseAssistantTools {
|
|
|
315
315
|
get showConfigurationWidget() {
|
|
316
316
|
return {
|
|
317
317
|
name: "show_configuration_widget_if_needed_or_user_asks_to_show_it",
|
|
318
|
-
description: "Show the configuration widget for the current agent
|
|
318
|
+
description: "Show the configuration widget for the current agent. The user needs to fill out the configuration before running the agent workflow to make sure to offer it to the user.",
|
|
319
319
|
type: "function",
|
|
320
320
|
parameters: {
|
|
321
321
|
type: "object",
|
|
@@ -386,7 +386,7 @@ export class AgentTools extends BaseAssistantTools {
|
|
|
386
386
|
success: true,
|
|
387
387
|
clientEvents: [clientEvent],
|
|
388
388
|
data: {
|
|
389
|
-
message: "Submitted configuration for the current agent successfully",
|
|
389
|
+
message: "Submitted configuration for the current agent successfully now offer the user to start the agent workflow run",
|
|
390
390
|
},
|
|
391
391
|
};
|
|
392
392
|
}
|
|
@@ -45,6 +45,7 @@ export class SubscriptionModels {
|
|
|
45
45
|
return {
|
|
46
46
|
availablePlans: availablePlans.map((plan) => ({
|
|
47
47
|
subscriptionPlanId: plan.id,
|
|
48
|
+
type: plan.configuration?.type || "coming_soon",
|
|
48
49
|
name: plan.AgentProduct?.configuration?.displayName || "No name available",
|
|
49
50
|
description: plan.AgentProduct?.description || "No description available",
|
|
50
51
|
imageUrl: plan.configuration?.imageUrl || "",
|
|
@@ -30,6 +30,7 @@ export class SubscriptionTools extends BaseAssistantTools {
|
|
|
30
30
|
for (const subscription of status.availableSubscriptions) {
|
|
31
31
|
agentChips += `<div class="agent-chips"><yp-agent-chip-for-purchase
|
|
32
32
|
isSubscribed="${true}"
|
|
33
|
+
type="${subscription.Plan?.configuration.type}"
|
|
33
34
|
agentProductId="${subscription.Plan?.AgentProduct?.id}"
|
|
34
35
|
subscriptionPlanId="${subscription.Plan?.id}"
|
|
35
36
|
agentName="${subscription.Plan?.AgentProduct?.name}"
|
|
@@ -87,10 +88,37 @@ export class SubscriptionTools extends BaseAssistantTools {
|
|
|
87
88
|
console.log(`list_all_agents_available_for_purchase: ${JSON.stringify(status, null, 2)}`);
|
|
88
89
|
}
|
|
89
90
|
let agentChips = "";
|
|
90
|
-
|
|
91
|
+
function planTypePriority(type) {
|
|
92
|
+
switch (type) {
|
|
93
|
+
case "coming_soon":
|
|
94
|
+
return 0;
|
|
95
|
+
case "paid":
|
|
96
|
+
return 1;
|
|
97
|
+
case "free_trial":
|
|
98
|
+
return 2;
|
|
99
|
+
default:
|
|
100
|
+
return 999;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// 2) Custom sort function
|
|
104
|
+
const sortedPlans = [...status.availablePlans].sort((a, b) => {
|
|
105
|
+
// Compare by type priority first
|
|
106
|
+
const typeComparison = planTypePriority(a.type) - planTypePriority(b.type);
|
|
107
|
+
if (typeComparison !== 0) {
|
|
108
|
+
// If types differ, that decides the order
|
|
109
|
+
return typeComparison;
|
|
110
|
+
}
|
|
111
|
+
// If both are the same type and it's "paid", sort by price descending
|
|
112
|
+
if (a.type === "paid" && b.type === "paid") {
|
|
113
|
+
return b.price - a.price;
|
|
114
|
+
}
|
|
115
|
+
// Otherwise keep them in the same order if they're not "paid"
|
|
116
|
+
return 0;
|
|
117
|
+
});
|
|
91
118
|
for (const agent of sortedPlans) {
|
|
92
119
|
agentChips += `<yp-agent-chip-for-purchase
|
|
93
120
|
subscriptionPlanId="${agent.subscriptionPlanId}"
|
|
121
|
+
type="${agent.type}"
|
|
94
122
|
agentName="${agent.name}"
|
|
95
123
|
agentDescription="${agent.description}"
|
|
96
124
|
agentImageUrl="${agent.imageUrl}"
|
|
@@ -122,7 +150,7 @@ export class SubscriptionTools extends BaseAssistantTools {
|
|
|
122
150
|
get subscribeToCurrentAgentPlan() {
|
|
123
151
|
return {
|
|
124
152
|
name: "subscribe_to_current_agent_plan",
|
|
125
|
-
description: "Subscribe to the current agent plan. User must confirm subscription with the agent name before proceeding. The user needs to subscribe to the agent before it can be used.",
|
|
153
|
+
description: "Subscribe to the current agent plan. User must confirm subscription with the agent name before proceeding. The user needs to subscribe to the agent before it can be used so make sure to offer it to the user.",
|
|
126
154
|
type: "function",
|
|
127
155
|
parameters: {
|
|
128
156
|
type: "object",
|
|
@@ -182,12 +210,12 @@ export class SubscriptionTools extends BaseAssistantTools {
|
|
|
182
210
|
maxRunsPerCycle="${result.plan.configuration.max_runs_per_cycle}"
|
|
183
211
|
></yp-agent-chip-for-purchase></div>`;
|
|
184
212
|
}
|
|
185
|
-
this.assistant.emit("update-ai-model-session", "Successfully subscribed to agent plan, now offer to
|
|
213
|
+
this.assistant.emit("update-ai-model-session", "Successfully subscribed to agent plan, now offer to show the configuration input tool/widget to configure the agent");
|
|
186
214
|
return {
|
|
187
215
|
success: true,
|
|
188
216
|
html,
|
|
189
217
|
data: {
|
|
190
|
-
message: "Successfully subscribed to agent plan, now the
|
|
218
|
+
message: "Successfully subscribed to agent plan, now offer to show the configuration input tool/widget to configure the agent",
|
|
191
219
|
subscription: result.subscription,
|
|
192
220
|
subscriptionPlan: result.plan,
|
|
193
221
|
},
|
|
@@ -69,7 +69,8 @@ export class NotificationAgentQueueManager extends AgentQueueManager {
|
|
|
69
69
|
${link ? `<p><a href="${link}">${link}</a></p>` : ""}
|
|
70
70
|
</div>
|
|
71
71
|
`;
|
|
72
|
-
|
|
72
|
+
const MAX_ADMIN_EMAILS = 25;
|
|
73
|
+
for (let u = 0; u < Math.min(admins.length, MAX_ADMIN_EMAILS); u++) {
|
|
73
74
|
queue.add("send-one-email", {
|
|
74
75
|
subject: subject,
|
|
75
76
|
template: "general_user_notification",
|
|
@@ -267,7 +268,7 @@ export class NotificationAgentQueueManager extends AgentQueueManager {
|
|
|
267
268
|
console.error(`NotificationAgentQueueManager: Agent run ID ${agentRunId} not found.`);
|
|
268
269
|
}
|
|
269
270
|
if (agent) {
|
|
270
|
-
// Send
|
|
271
|
+
// Send notification
|
|
271
272
|
await this.sendNotification(agent, agentRun, type, wsClientId, agentRun.status, returnvalue, agentRunId, updatedWorkflow);
|
|
272
273
|
}
|
|
273
274
|
else {
|
|
@@ -88,13 +88,68 @@ async function createAgentProductsAndPlans() {
|
|
|
88
88
|
},
|
|
89
89
|
],
|
|
90
90
|
};
|
|
91
|
+
const fundingAgentWorkflow = {
|
|
92
|
+
currentStepIndex: 0,
|
|
93
|
+
steps: [
|
|
94
|
+
{
|
|
95
|
+
name: "Funding Agent Wide Search",
|
|
96
|
+
shortName: "Wide Search",
|
|
97
|
+
description: "Wide search for investors and funding opportunities.",
|
|
98
|
+
shortDescription: "Wide search for investors and funding opportunities.",
|
|
99
|
+
agentClassUuid: "a1b2c3d4-e5f6-c7c8-a9c0-c1225354f516",
|
|
100
|
+
type: "agentOps",
|
|
101
|
+
stepBackgroundColor: "#ffdc2f",
|
|
102
|
+
stepTextColor: "#211e1c"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "Funding Agent Human Prioritization",
|
|
106
|
+
shortName: "Human Prioritization",
|
|
107
|
+
description: "Human prioritization of the wide search results.",
|
|
108
|
+
shortDescription: "Human prioritization of the wide search results.",
|
|
109
|
+
agentClassUuid: "a1b2c3d4-e5f6-c7c8-a9c0-c1225354f516",
|
|
110
|
+
type: "engagmentFromOutputConnector",
|
|
111
|
+
stepBackgroundColor: "#e74c3c",
|
|
112
|
+
stepTextColor: "#ffffff",
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "Funding Agent Detailed Search",
|
|
116
|
+
shortName: "Detailed Search",
|
|
117
|
+
description: "Detailed search for investors and funding opportunities.",
|
|
118
|
+
shortDescription: "Detailed search for investors and funding opportunities.",
|
|
119
|
+
agentClassUuid: "b36ffca6-7363-44be-bd55-40661210cf24",
|
|
120
|
+
type: "agentOps",
|
|
121
|
+
stepBackgroundColor: "#1e90ff",
|
|
122
|
+
stepTextColor: "#ffffff",
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "Funding Agent Detailed Search Human Prioritization",
|
|
126
|
+
shortName: "Detailed Search Human Prioritization",
|
|
127
|
+
description: "Human prioritization of the detailed search results.",
|
|
128
|
+
shortDescription: "Human prioritization of the detailed search results.",
|
|
129
|
+
agentClassUuid: "b36ffca6-7363-44be-bd55-40661210cf24",
|
|
130
|
+
type: "engagmentFromOutputConnector",
|
|
131
|
+
stepBackgroundColor: "#2ecc71",
|
|
132
|
+
stepTextColor: "#ffffff",
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: "Funding Agent Report",
|
|
136
|
+
shortName: "Funding Agent Report",
|
|
137
|
+
description: "Report on investors and funding opportunities.",
|
|
138
|
+
shortDescription: "Report on investors and funding opportunities.",
|
|
139
|
+
agentClassUuid: "1bbf8f86-0ffc-4356-aaa1-9cea04b78ec4",
|
|
140
|
+
type: "agentOps",
|
|
141
|
+
stepBackgroundColor: "#d486da",
|
|
142
|
+
stepTextColor: "#ffffff",
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
};
|
|
91
146
|
const agentProductsData = [
|
|
92
147
|
{
|
|
93
148
|
name: "Competitor Agent Free Trial",
|
|
94
149
|
description: "Analyzes competitor strategies and market positions.",
|
|
95
150
|
configuration: {
|
|
96
151
|
workflow: competitionAgentWorkflow,
|
|
97
|
-
templateWorkflowCommunityId:
|
|
152
|
+
templateWorkflowCommunityId: 63,
|
|
98
153
|
},
|
|
99
154
|
status: {
|
|
100
155
|
currentStatus: "active",
|
|
@@ -186,7 +241,7 @@ async function createAgentProductsAndPlans() {
|
|
|
186
241
|
groupId: 11,
|
|
187
242
|
configuration: {
|
|
188
243
|
workflow: competitionAgentWorkflow,
|
|
189
|
-
templateWorkflowCommunityId:
|
|
244
|
+
templateWorkflowCommunityId: 63,
|
|
190
245
|
},
|
|
191
246
|
status: {
|
|
192
247
|
currentStatus: "active",
|
|
@@ -330,8 +385,8 @@ async function createAgentProductsAndPlans() {
|
|
|
330
385
|
description: "Identifies and analyzes funding opportunities and investment strategies.",
|
|
331
386
|
groupId: 33814,
|
|
332
387
|
configuration: {
|
|
333
|
-
workflow:
|
|
334
|
-
templateWorkflowCommunityId:
|
|
388
|
+
workflow: fundingAgentWorkflow,
|
|
389
|
+
templateWorkflowCommunityId: 10175,
|
|
335
390
|
},
|
|
336
391
|
status: {},
|
|
337
392
|
subscriptionPlan: {
|
|
@@ -1,68 +1,195 @@
|
|
|
1
1
|
import { YpAgentProduct } from "../agentProduct.js";
|
|
2
|
+
import { YpSubscriptionPlan } from "../subscriptionPlan.js";
|
|
2
3
|
async function setupAgentProductsConfiguration() {
|
|
4
|
+
const competitionAgentWorkflow = {
|
|
5
|
+
currentStepIndex: 0,
|
|
6
|
+
steps: [
|
|
7
|
+
{
|
|
8
|
+
name: "Competitor Analysis Wide Search",
|
|
9
|
+
shortName: "Wide search",
|
|
10
|
+
description: "Wide search for competitor strategies and market positions.",
|
|
11
|
+
shortDescription: "Wide search for competitor strategies and market positions.",
|
|
12
|
+
agentClassUuid: "a1b2c3d4-e5f6-c7c8-a9c0-c1225354f516",
|
|
13
|
+
type: "agentOps",
|
|
14
|
+
stepBackgroundColor: "#ffdc2f",
|
|
15
|
+
stepTextColor: "#211e1c",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "Competitor Analysis People Review",
|
|
19
|
+
shortName: "Vetting competitors",
|
|
20
|
+
description: "People Review to vet key competitors",
|
|
21
|
+
shortDescription: "People Review to vet key competitors",
|
|
22
|
+
agentClassUuid: "a1b2c3d4-e5f6-c7c8-a9c0-c1225354f516",
|
|
23
|
+
type: "engagmentFromOutputConnector",
|
|
24
|
+
stepBackgroundColor: "#e74c3c",
|
|
25
|
+
stepTextColor: "#ffffff",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "Competitor Analysis Detailed Search",
|
|
29
|
+
shortName: "Detailed search",
|
|
30
|
+
description: "Detailed search for competitor strategies and market positions.",
|
|
31
|
+
shortDescription: "Detailed search for competitor strategies and market positions.",
|
|
32
|
+
agentClassUuid: "c6e99ac4-e5f6-c7c1-a1c0-c1ab53c4ff16",
|
|
33
|
+
type: "agentOps",
|
|
34
|
+
stepBackgroundColor: "#1e90ff",
|
|
35
|
+
stepTextColor: "#ffffff",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "Competitor Analysis Detailed Search People Review",
|
|
39
|
+
shortName: "Key competitors",
|
|
40
|
+
description: "People review of key competitors",
|
|
41
|
+
shortDescription: "People review of key competitors",
|
|
42
|
+
agentClassUuid: "c6e99ac4-e5f6-c7c1-a1c0-c1ab53c4ff16",
|
|
43
|
+
type: "engagmentFromOutputConnector",
|
|
44
|
+
stepBackgroundColor: "#2ecc71",
|
|
45
|
+
stepTextColor: "#ffffff",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "Competitors Report",
|
|
49
|
+
shortName: "Competitor report",
|
|
50
|
+
description: "Report on the state of the market based on the competitors analysis.",
|
|
51
|
+
shortDescription: "Report on the state of the market based on the competitors analysis.",
|
|
52
|
+
agentClassUuid: "1cf3af64-a5f6-a7c1-91c1-51fb13c72f1a",
|
|
53
|
+
type: "agentOps",
|
|
54
|
+
stepBackgroundColor: "#d486da",
|
|
55
|
+
stepTextColor: "#ffffff",
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
};
|
|
3
59
|
const competitorAgentFreeTrial = await YpAgentProduct.findByPk(1);
|
|
4
60
|
if (competitorAgentFreeTrial) {
|
|
5
|
-
|
|
61
|
+
competitorAgentFreeTrial.set("configuration.workflow", competitionAgentWorkflow);
|
|
62
|
+
competitorAgentFreeTrial.changed("configuration", true);
|
|
63
|
+
await competitorAgentFreeTrial.save();
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
console.log("CompetitorAgentFreeTrial not found");
|
|
67
|
+
}
|
|
68
|
+
const competitorAgentPaid = await YpAgentProduct.findByPk(2);
|
|
69
|
+
if (competitorAgentPaid) {
|
|
70
|
+
competitorAgentPaid.set("configuration.workflow", competitionAgentWorkflow);
|
|
71
|
+
competitorAgentPaid.changed("configuration", true);
|
|
72
|
+
await competitorAgentPaid.save();
|
|
73
|
+
}
|
|
74
|
+
const fundingAgent = await YpAgentProduct.findByPk(6);
|
|
75
|
+
if (fundingAgent) {
|
|
76
|
+
const fundingAgentWorkflow = {
|
|
6
77
|
currentStepIndex: 0,
|
|
7
78
|
steps: [
|
|
8
79
|
{
|
|
9
|
-
name: "
|
|
10
|
-
shortName: "Wide
|
|
11
|
-
description: "Wide search for
|
|
12
|
-
shortDescription: "Wide search for
|
|
13
|
-
agentClassUuid: "
|
|
80
|
+
name: "Funding Agent Wide Search",
|
|
81
|
+
shortName: "Wide Search",
|
|
82
|
+
description: "Wide search for investors and funding opportunities.",
|
|
83
|
+
shortDescription: "Wide search for investors and funding opportunities.",
|
|
84
|
+
agentClassUuid: "956e7f74-6fc6-4e01-81b4-098c193e6450",
|
|
14
85
|
type: "agentOps",
|
|
15
86
|
stepBackgroundColor: "#ffdc2f",
|
|
16
|
-
stepTextColor: "#211e1c"
|
|
87
|
+
stepTextColor: "#211e1c"
|
|
17
88
|
},
|
|
18
89
|
{
|
|
19
|
-
name: "
|
|
20
|
-
shortName: "Vetting
|
|
21
|
-
description: "People
|
|
22
|
-
shortDescription: "People
|
|
23
|
-
agentClassUuid: "
|
|
90
|
+
name: "Funding Agent People Prioritization",
|
|
91
|
+
shortName: "Vetting investors",
|
|
92
|
+
description: "People prioritization of the wide search results.",
|
|
93
|
+
shortDescription: "People prioritization of the wide search results.",
|
|
94
|
+
agentClassUuid: "956e7f74-6fc6-4e01-81b4-098c193e6450",
|
|
24
95
|
type: "engagmentFromOutputConnector",
|
|
25
96
|
stepBackgroundColor: "#e74c3c",
|
|
26
97
|
stepTextColor: "#ffffff",
|
|
27
98
|
},
|
|
28
99
|
{
|
|
29
|
-
name: "
|
|
30
|
-
shortName: "Detailed
|
|
31
|
-
description: "Detailed search for
|
|
32
|
-
shortDescription: "Detailed search for
|
|
33
|
-
agentClassUuid: "
|
|
100
|
+
name: "Funding Agent Detailed Search",
|
|
101
|
+
shortName: "Detailed Search",
|
|
102
|
+
description: "Detailed search for investors and funding opportunities.",
|
|
103
|
+
shortDescription: "Detailed search for investors and funding opportunities.",
|
|
104
|
+
agentClassUuid: "b36ffca6-7363-44be-bd55-40661210cf24",
|
|
34
105
|
type: "agentOps",
|
|
35
106
|
stepBackgroundColor: "#1e90ff",
|
|
36
107
|
stepTextColor: "#ffffff",
|
|
37
108
|
},
|
|
38
109
|
{
|
|
39
|
-
name: "
|
|
40
|
-
shortName: "Key
|
|
41
|
-
description: "People
|
|
42
|
-
shortDescription: "People
|
|
43
|
-
agentClassUuid: "
|
|
110
|
+
name: "Funding Agent Detailed Search People Prioritization",
|
|
111
|
+
shortName: "Key investors",
|
|
112
|
+
description: "People prioritization of the detailed search results.",
|
|
113
|
+
shortDescription: "People prioritization of the detailed search results.",
|
|
114
|
+
agentClassUuid: "b36ffca6-7363-44be-bd55-40661210cf24",
|
|
44
115
|
type: "engagmentFromOutputConnector",
|
|
45
116
|
stepBackgroundColor: "#2ecc71",
|
|
46
117
|
stepTextColor: "#ffffff",
|
|
47
118
|
},
|
|
48
119
|
{
|
|
49
|
-
name: "
|
|
50
|
-
shortName: "
|
|
51
|
-
description: "Report on
|
|
52
|
-
shortDescription: "Report on
|
|
53
|
-
agentClassUuid: "
|
|
120
|
+
name: "Funding Agent Report",
|
|
121
|
+
shortName: "Funding report",
|
|
122
|
+
description: "Report on investors and funding opportunities.",
|
|
123
|
+
shortDescription: "Report on investors and funding opportunities.",
|
|
124
|
+
agentClassUuid: "1bbf8f86-0ffc-4356-aaa1-9cea04b78ec4",
|
|
54
125
|
type: "agentOps",
|
|
55
126
|
stepBackgroundColor: "#d486da",
|
|
56
127
|
stepTextColor: "#ffffff",
|
|
57
128
|
},
|
|
58
129
|
],
|
|
59
130
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
await
|
|
131
|
+
fundingAgent.set("configuration.workflow", fundingAgentWorkflow);
|
|
132
|
+
fundingAgent.changed("configuration", true);
|
|
133
|
+
await fundingAgent.save();
|
|
134
|
+
}
|
|
135
|
+
const fundingSubscriptionPlan = await YpSubscriptionPlan.findByPk(6);
|
|
136
|
+
if (fundingSubscriptionPlan) {
|
|
137
|
+
fundingSubscriptionPlan.set("configuration.structuredAnswersOverride", []);
|
|
138
|
+
fundingSubscriptionPlan.set("configuration.requiredStructuredQuestions", [
|
|
139
|
+
{
|
|
140
|
+
uniqueId: "businessDescription",
|
|
141
|
+
type: "textArea",
|
|
142
|
+
description: "Detailed description of the business, this is critical for the agent to understand the business and provide accurate results.",
|
|
143
|
+
value: "",
|
|
144
|
+
maxLength: 7500,
|
|
145
|
+
required: true,
|
|
146
|
+
rows: 5,
|
|
147
|
+
charCounter: true,
|
|
148
|
+
text: "Business Description",
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
uniqueId: "investorGeographicFocus",
|
|
152
|
+
type: "textFieldLong",
|
|
153
|
+
description: "Geographic focus of the investors",
|
|
154
|
+
value: "",
|
|
155
|
+
maxLength: 250,
|
|
156
|
+
required: false,
|
|
157
|
+
rows: 1,
|
|
158
|
+
charCounter: true,
|
|
159
|
+
text: "Investor Geographic Focus",
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
uniqueId: "investorIndustryFocus",
|
|
163
|
+
type: "textFieldLong",
|
|
164
|
+
description: "Industry focus of the investors",
|
|
165
|
+
value: "",
|
|
166
|
+
maxLength: 250,
|
|
167
|
+
required: false,
|
|
168
|
+
rows: 1,
|
|
169
|
+
charCounter: true,
|
|
170
|
+
text: "Investor Industry Focus",
|
|
171
|
+
}
|
|
172
|
+
]);
|
|
173
|
+
fundingSubscriptionPlan.changed("configuration", true);
|
|
174
|
+
await fundingSubscriptionPlan.save();
|
|
63
175
|
}
|
|
64
176
|
else {
|
|
65
|
-
console.log("
|
|
177
|
+
console.log("FundingSubscriptionPlan not found");
|
|
178
|
+
}
|
|
179
|
+
// Update subscription plans 2-5 to coming_soon
|
|
180
|
+
for (let planId = 2; planId <= 5; planId++) {
|
|
181
|
+
const subscriptionPlan = await YpSubscriptionPlan.findByPk(planId);
|
|
182
|
+
if (subscriptionPlan) {
|
|
183
|
+
subscriptionPlan.set("configuration.type", "coming_soon");
|
|
184
|
+
if (planId == 2) {
|
|
185
|
+
subscriptionPlan.set("configuration.type", "paid");
|
|
186
|
+
}
|
|
187
|
+
subscriptionPlan.changed("configuration", true);
|
|
188
|
+
await subscriptionPlan.save();
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
console.log(`SubscriptionPlan ${planId} not found`);
|
|
192
|
+
}
|
|
66
193
|
}
|
|
67
194
|
}
|
|
68
195
|
setupAgentProductsConfiguration();
|
package/app.js
CHANGED
|
@@ -298,7 +298,7 @@ export class YourPrioritiesApi {
|
|
|
298
298
|
}
|
|
299
299
|
addInviteAsAnonMiddleWare() {
|
|
300
300
|
this.app.use(async (req, res, next) => {
|
|
301
|
-
if (
|
|
301
|
+
if (req.query.anonInvite && req.query.token) {
|
|
302
302
|
const token = req.query.token;
|
|
303
303
|
try {
|
|
304
304
|
//TODO: Fix this "as any" in all places
|
|
@@ -317,9 +317,15 @@ export class YourPrioritiesApi {
|
|
|
317
317
|
});
|
|
318
318
|
if (invite) {
|
|
319
319
|
const anonEmail = req.sessionID + "_v3anonymous@citizens.is";
|
|
320
|
-
let user
|
|
321
|
-
|
|
322
|
-
|
|
320
|
+
let user;
|
|
321
|
+
if (req.user) {
|
|
322
|
+
user = req.user;
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
user = await models.User.findOne({
|
|
326
|
+
where: { email: anonEmail },
|
|
327
|
+
});
|
|
328
|
+
}
|
|
323
329
|
if (!user) {
|
|
324
330
|
user = await models.User.create({
|
|
325
331
|
email: anonEmail,
|