-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroute.gs
77 lines (75 loc) · 2.66 KB
/
route.gs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
function back(req) {
const outputs = req.queryResult.outputContexts
const childnameFW = outputs.find(output => output.name.includes("childname-followup"))
const parameters = (childnameFW && "parameters" in childnameFW) ? childnameFW.parameters : {}
let action
if ("other" in parameters && parameters["other"] != ""
&& parameters["other.original"] != "") {
parameters["other"] = ""
parameters["other.original"] = ""
action = "SUBSCRIBE"
} else if ("Reply" in parameters && parameters["Reply"] != ""
&& parameters["Reply.original"] != "") {
parameters["Reply"] = ""
parameters["Reply.original"] = ""
action = "MAIL"
} else if ("mail" in parameters && parameters["mail"] != ""
&& parameters["mail.original"] != "") {
parameters["mail"] = ""
parameters["mail.original"] = ""
action = "TEL"
} else if ("tel" in parameters && parameters["tel"] != ""
&& parameters["tel.original"] != "") {
parameters["tel"] = ""
parameters["tel.original"] = ""
action = "ADDRESS"
} else if ("address" in parameters && parameters["address"] != ""
&& parameters["address.original"] != "") {
parameters["address"] = ""
parameters["address.original"] = ""
action = "PARENTFURIGANA"
} else if ("parentfurigana" in parameters && parameters["parentfurigana"] != ""
&& parameters["parentfurigana.original"] != "") {
parameters["parentfurigana"] = ""
parameters["parentfurigana.original"] = ""
action = "PARENTNAME"
} else if ("parentname" in parameters && parameters["parentname"] != ""
&& parameters["parentname.original"] != "") {
parameters["parentname"] = ""
parameters["parentname.original"] = ""
action = "AGE"
} else if ("age" in parameters && parameters["age"] != ""
&& parameters["age.original"] != "") {
parameters["age"] = ""
parameters["age.original"] = ""
action = "CHILDFURIGANA"
} else if ("childfurigana" in parameters && parameters["childfurigana"] != ""
&& parameters["childfurigana.original"] != "") {
parameters["childfurigana"] = ""
parameters["childfurigana.original"] = ""
action = "CHILDNAME"
} else if ("childname" in parameters && parameters["childname"] != ""
&& parameters["childname.original"] != "") {
parameters["childname"] = ""
parameters["childname.original"] = ""
action = "RESERVATION"
} else {
return {
"followupEventInput": {
"name": "FALLBACK",
}
}
}
return {
"outputContexts": [
{
"name": req.session + "/contexts/childname-followup",
"lifespanCount": 30,
parameters
}],
"followupEventInput": {
"name": action,
parameters
}
}
}