Skip to content

Commit

Permalink
Project doorperson.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zemnmez committed Jan 9, 2025
1 parent 9f72d13 commit b637f17
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions ts/pulumi/zemn.me/doorperson/doorperson.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { ComponentResource, ComponentResourceOptions, Input } from "@pulumi/pulumi";

import { ContactFlow } from "#root/ts/pulumi/lib/contact_flow.js";
import { compileContactFlow, ContactFlowAction } from "#root/ts/pulumi/lib/contact_flow_composer.js";
import { tagTrue } from "#root/ts/pulumi/lib/tags.js";


export interface Args {
zoneId: Input<string>;
domain: Input<string>
tags?: Input<Record<string, Input<string>>>;
}

export class Component extends ComponentResource {
constructor(
name: string,
args: Args,
opts?: ComponentResourceOptions
) {
super('ts:pulumi:zemn.me:doorperson', name, args, opts);
const tag = name;
const tags = mergeTags(args.tags, tagTrue(tag));

function begin(): ContactFlowAction {
return {
Type: "GetParticipantInput",
Parameters: {
Text: "Enter a code now, or hold to contact the occupier.",
},
Transitions: {
CustomValidation: {
MaxLength: "5"
},
InputTimeSeconds: "10",
Errors: [
{
ErrorType: 'InputTimeLimitExceeded',
NextAction: contactTheOccupier(),
},
{
// always true if there is input since I have not
// specified any conditions.
ErrorType: 'NoMatchingCondition',
NextAction: userInputAccessCode()
}
]
}
}
}


const flow = new ContactFlow(`${name}_contactFlow`, {
content: compileContactFlow(
begin
)
}, {parent: this})

}
}

0 comments on commit b637f17

Please sign in to comment.