Skip to content

Commit 90288ea

Browse files
committed
V14: Integrations (HubSpot/Forms)
- Update form field dto - Change some css - Re generate api
1 parent fa82592 commit 90288ea

File tree

4 files changed

+37
-88
lines changed

4 files changed

+37
-88
lines changed

src/Umbraco.Forms.Integrations.Crm.Hubspot/Api/Management/Controllers/Forms/GetFormFieldsController.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
using System.Linq;
66
using System.Text;
77
using System.Threading.Tasks;
8-
using Umbraco.Forms.Core.Models;
98
using Umbraco.Forms.Core.Services;
9+
using Umbraco.Forms.Integrations.Crm.Hubspot.Models.Dtos;
1010

1111
namespace Umbraco.Forms.Integrations.Crm.Hubspot.Api.Management.Controllers.Forms
1212
{
@@ -17,14 +17,14 @@ public GetFormFieldsController(IFormService formService) : base(formService)
1717
}
1818

1919
[HttpGet("fields")]
20-
[ProducesResponseType(typeof(List<Field>), StatusCodes.Status200OK)]
20+
[ProducesResponseType(typeof(List<HubspotWorkflowFormFieldDto>), StatusCodes.Status200OK)]
2121
public IActionResult GetFormFields(string formId)
2222
{
23-
List<Field> formFields = new List<Field>();
23+
List<HubspotWorkflowFormFieldDto> formFields = new List<HubspotWorkflowFormFieldDto>();
2424
var result = FormService.Get(new Guid(formId));
2525
if (result != null)
2626
{
27-
formFields = result.AllFields;
27+
formFields = result.AllFields.Select(s => new HubspotWorkflowFormFieldDto{ Caption = s.Caption, Id = s.Id }).ToList();
2828
}
2929
return Ok(formFields);
3030
}

src/Umbraco.Forms.Integrations.Crm.Hubspot/Client/generated/types.gen.ts

Lines changed: 3 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

3-
export type AllowedUploadType = {
4-
type: string;
5-
name: string;
6-
checked: string;
7-
};
8-
93
export type AuthorizationRequest = {
104
code: string;
115
};
@@ -23,80 +17,9 @@ export enum EventMessageTypeModel {
2317
WARNING = 'Warning'
2418
}
2519

26-
export type Field = {
20+
export type HubspotWorkflowFormFieldDto = {
2721
caption: string;
28-
tooltip?: string | null;
29-
/**
30-
* @deprecated
31-
*/
32-
placeholder?: string | null;
33-
cssClass?: string | null;
34-
alias: string;
35-
id: string;
36-
fieldTypeId: string;
37-
prevalueSourceId: string;
38-
dataSourceFieldKey?: string | null;
39-
containsSensitiveData: boolean;
40-
mandatory: boolean;
41-
regex?: string | null;
42-
requiredErrorMessage?: string | null;
43-
invalidErrorMessage?: string | null;
44-
condition?: FieldCondition | null;
45-
settings: {
46-
[key: string]: (string);
47-
};
48-
preValues: Array<(FieldPrevalue)>;
49-
allowedUploadTypes?: Array<(AllowedUploadType)> | null;
50-
allowMultipleFileUploads: boolean;
51-
};
52-
53-
export type FieldCondition = {
54-
id: string;
55-
enabled: boolean;
56-
actionType: FieldConditionActionType;
57-
logicType: FieldConditionLogicType;
58-
rules: Array<(FieldConditionRule)>;
59-
};
60-
61-
export enum FieldConditionActionType {
62-
SHOW = 'Show',
63-
HIDE = 'Hide'
64-
}
65-
66-
export enum FieldConditionLogicType {
67-
ALL = 'All',
68-
ANY = 'Any'
69-
}
70-
71-
export type FieldConditionRule = {
7222
id: string;
73-
field: string;
74-
operator: FieldConditionRuleOperator;
75-
value: string;
76-
};
77-
78-
export enum FieldConditionRuleOperator {
79-
IS = 'Is',
80-
IS_NOT = 'IsNot',
81-
GREATER_THEN = 'GreaterThen',
82-
LESS_THEN = 'LessThen',
83-
CONTAINS = 'Contains',
84-
CONTAINS_IGNORE_CASE = 'ContainsIgnoreCase',
85-
STARTS_WITH = 'StartsWith',
86-
STARTS_WITH_IGNORE_CASE = 'StartsWithIgnoreCase',
87-
ENDS_WITH = 'EndsWith',
88-
ENDS_WITH_IGNORE_CASE = 'EndsWithIgnoreCase',
89-
NOT_CONTAINS = 'NotContains',
90-
NOT_CONTAINS_IGNORE_CASE = 'NotContainsIgnoreCase',
91-
NOT_STARTS_WITH = 'NotStartsWith',
92-
NOT_STARTS_WITH_IGNORE_CASE = 'NotStartsWithIgnoreCase',
93-
NOT_ENDS_WITH = 'NotEndsWith',
94-
NOT_ENDS_WITH_IGNORE_CASE = 'NotEndsWithIgnoreCase'
95-
}
96-
97-
export type FieldPrevalue = {
98-
value: string;
99-
caption?: string | null;
10023
};
10124

10225
export type NotificationHeaderModel = {
@@ -129,7 +52,7 @@ export type GetFormFieldsData = {
12952
formId?: string;
13053
};
13154

132-
export type GetFormFieldsResponse = Array<(Field)>;
55+
export type GetFormFieldsResponse = Array<(HubspotWorkflowFormFieldDto)>;
13356

13457
export type $OpenApiTs = {
13558
'/umbraco/hubspot/management/api/v1/contacts/auth/configured': {
@@ -190,7 +113,7 @@ export type $OpenApiTs = {
190113
/**
191114
* OK
192115
*/
193-
200: Array<(Field)>;
116+
200: Array<(HubspotWorkflowFormFieldDto)>;
194117
};
195118
};
196119
};

src/Umbraco.Forms.Integrations.Crm.Hubspot/Client/src/property-editor/hubspot-mapping.property-editor.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { html, customElement, property, css, when, state, map } from '@umbraco-c
22
import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry';
33
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
44
import { HUBSPOT_CONTEXT_TOKEN } from '@umbraco-integrations/hubspot/context';
5-
import { Field, Property } from '@umbraco-integrations/hubspot/generated';
5+
import { HubspotWorkflowFormFieldDto, Property } from '@umbraco-integrations/hubspot/generated';
66
import { UUIInputEvent, UUISelectEvent } from '@umbraco-cms/backoffice/external/uui';
77
import { HubspotMappingValue } from '../models/hubspot.model';
88
import { UMB_NOTIFICATION_CONTEXT, UmbNotificationColor } from '@umbraco-cms/backoffice/notification';
@@ -30,7 +30,7 @@ export class HubspotMappingPropertyUiElement extends UmbLitElement implements Um
3030
private hubspotFields: Array<Property> | undefined = [];
3131

3232
@state()
33-
private formdFields: Array<Field> | undefined = [];
33+
private formdFields: Array<HubspotWorkflowFormFieldDto> | undefined = [];
3434

3535
@state()
3636
private authorizationCode: string = "";
@@ -222,8 +222,9 @@ export class HubspotMappingPropertyUiElement extends UmbLitElement implements Um
222222
</div>
223223
`
224224
: html`
225-
<div class="umb-forms-settings-note ng-scope">
226-
Umbraco Forms is configured with a HubSpot CRM account using: <b>${this.authorizationStatus}</b></p>
225+
<div class="hubspot-wf-status">
226+
<span>Umbraco Forms is configured with a HubSpot CRM account using: </span>
227+
<b>${this.authorizationStatus}</b></p>
227228
</div>
228229
229230
<div class="hubspot-wf-button">
@@ -302,6 +303,13 @@ export class HubspotMappingPropertyUiElement extends UmbLitElement implements Um
302303

303304
static styles = [
304305
css`
306+
.hubspot-wf-status{
307+
margin-top: 10px;
308+
padding: 10px;
309+
background-color: #202454;
310+
color: #ffffff;
311+
}
312+
305313
.hubspot-wf-auth-link{
306314
cursor: pointer;
307315
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Runtime.Serialization;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace Umbraco.Forms.Integrations.Crm.Hubspot.Models.Dtos
9+
{
10+
public class HubspotWorkflowFormFieldDto
11+
{
12+
[DataMember(Name = "caption")]
13+
public string Caption { get; set; } = string.Empty;
14+
15+
[DataMember(Name = "id")]
16+
public Guid Id { get; set; }
17+
}
18+
}

0 commit comments

Comments
 (0)