Skip to content

Commit 3c846cf

Browse files
authored
Adds some basic requirements for make.com (#122)
* wip * revert updates * wip * remove loaders * wip * use vite 4.5 * wip * wip * wip * update vue * wip * wip * fix vite config * improve exception handler for make * style links in classic form * add correct make link and fix tailwind config for ui * add form to form submission response * add make label to integrations * add new badge to update item * change back to vite 4.5.0 * update package.json * change again * fix test for getting form submissions
1 parent e001e6e commit 3c846cf

16 files changed

+853
-1413
lines changed

app/Exceptions/Handler.php

+16
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace App\Exceptions;
44

55
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
6+
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
67
use Throwable;
78

89
class Handler extends ExceptionHandler
@@ -34,6 +35,21 @@ class Handler extends ExceptionHandler
3435
*/
3536
public function register()
3637
{
38+
$this->renderable(function (NotFoundHttpException $e, $request) {
39+
if ($request->is('api/forms/*')) {
40+
try {
41+
$search = explode('\\', $e->getPrevious()->getModel());
42+
$model = end($search);
43+
} catch (\Exception $e) {
44+
$model = 'Record';
45+
}
46+
47+
return response()->json([
48+
'message' => $model.' not found.',
49+
], 404);
50+
}
51+
});
52+
3753
$this->reportable(function (Throwable $e) {
3854
//
3955
});

app/Http/Controllers/Api/FormSubmissionsController.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Illuminate\Http\Request;
88
use Knuckles\Scribe\Attributes\Authenticated;
99
use Knuckles\Scribe\Attributes\Group;
10+
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
1011

1112
class FormSubmissionsController extends Controller
1213
{
@@ -25,7 +26,7 @@ public function __invoke(Request $request, string $uuid)
2526
->withUuid($uuid)
2627
->firstOrFail();
2728
} catch (\Exception $e) {
28-
abort(401);
29+
throw new NotFoundHttpException('Form not found.', $e);
2930
}
3031

3132
$resource = FormSessionResource::collection(

app/Http/Resources/FormSessionResource.php

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public function toArray($request)
1919
return [
2020
'id' => $this->id,
2121
'uid' => $this->token,
22+
'form' => $this->form->uuid,
2223
'started_at' => $this->created_at->toDateTimeString(),
2324
'completed_at' => (string) $this->getRawOriginal('is_completed'),
2425
'params' => $this->params,

package-lock.json

+629-1,376
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+16-16
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,18 @@
1111
"vue-tsc": "vue-tsc --noEmit -p tsconfig.build.json",
1212
"tw-config": "tailwind-config-viewer -o",
1313
"dev": "vite",
14-
"build-app": "vite build -c vite.prod-app.config.js",
15-
"build-classic": "vite build -c vite.prod-classic.config.js",
14+
"build-app": "vite build -c vite.prod-app.config.mjs",
15+
"build-classic": "vite build -c vite.prod-classic.config.mjs",
1616
"build": "npm run lint && npm run vue-tsc && npm run build-app && npm run build-classic",
1717
"test": "vitest",
1818
"coverage": "vitest run --coverage"
1919
},
2020
"devDependencies": {
2121
"@pinia/testing": "^0.1.3",
2222
"@vitest/coverage-c8": "^0.33.0",
23-
"@vitest/coverage-v8": "^0.34.6",
2423
"@vue/test-utils": "^2.4.2",
2524
"browser-sync": "^2.29.3",
26-
"jsdom": "^22.1.0",
25+
"jsdom": "^23.0.0",
2726
"prettier": "^3.1.0",
2827
"prettier-eslint": "^16.1.2",
2928
"prettier-plugin-tailwindcss": "^0.5.7",
@@ -33,7 +32,7 @@
3332
"vitest": "^0.34.6"
3433
},
3534
"dependencies": {
36-
"@deck9/ui": "^0.13.1",
35+
"@deck9/ui": "^0.13.3",
3736
"@headlessui/vue": "^1.7.16",
3837
"@highlightjs/vue-plugin": "^2.1.0",
3938
"@inertiajs/inertia": "^0.11.1",
@@ -45,31 +44,32 @@
4544
"@tiptap/extension-link": "^2.0.0-beta.36",
4645
"@tiptap/starter-kit": "^2.0.0-beta.181",
4746
"@tiptap/vue-3": "^2.0.0-beta.90",
48-
"@types/lodash": "^4.14.201",
49-
"@types/node": "^20.9.0",
50-
"@typescript-eslint/eslint-plugin": "^6.11.0",
51-
"@typescript-eslint/parser": "^6.11.0",
52-
"@vitejs/plugin-vue": "^4.4.1",
53-
"@vue/compiler-sfc": "^3.2.47",
54-
"@vueuse/core": "^10.1.2",
47+
"@types/lodash": "^4.14.202",
48+
"@types/node": "^20.10.0",
49+
"@types/ziggy-js": "^1.8.0",
50+
"@typescript-eslint/eslint-plugin": "^6.12.0",
51+
"@typescript-eslint/parser": "^6.12.0",
52+
"@vitejs/plugin-vue": "^4.5.0",
53+
"@vitest/coverage-v8": "^0.34.6",
54+
"@vueuse/core": "^10.6.1",
5555
"autoprefixer": "^10.4.16",
5656
"axios": "^1.6.2",
5757
"copy-text-to-clipboard": "^3.2.0",
58-
"eslint": "^8.53.0",
58+
"eslint": "^8.54.0",
5959
"eslint-plugin-vue": "^9.18.1",
6060
"floating-vue": "^2.0.0-beta.20",
6161
"highlight.js": "^11.9.0",
6262
"laravel-vite-plugin": "^0.8.1",
6363
"lodash": "^4.17.19",
6464
"pinia": "^2.1.7",
65-
"postcss": "^8.4.24",
65+
"postcss": "^8.4.31",
6666
"postcss-import": "^15.1.0",
6767
"striptags": "^3.2.0",
6868
"tailwindcss": "^3.3.5",
6969
"typescript": "^5.1.3",
7070
"vite-plugin-css-injected-by-js": "^3.3.0",
71-
"vue": "^3.3.8",
72-
"vue-i18n": "^9.7.0",
71+
"vue": "^3.3.9",
72+
"vue-i18n": "^9.7.1",
7373
"vue-tsc": "^1.8.22",
7474
"vue3-smooth-dnd": "^0.0.6",
7575
"yup": "^1.3.2",

resources/js/Pages/Dashboard.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const props = withDefaults(
7171
}>(),
7272
{
7373
initialForms: () => [],
74-
}
74+
},
7575
);
7676
7777
const isLoading = ref(false);

resources/js/components/Dashboard/UpdatePost.vue

+28-2
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,31 @@
11
<template>
2-
<div target="_blank" class="block rounded-lg bg-white px-6 py-8 shadow-sm">
2+
<div class="block rounded-lg bg-white px-6 py-8 shadow-sm">
33
<h2 class="text-lg font-medium">{{ post.Title }}</h2>
44
<span class="text-xs text-grey-500">{{ formattedDate }}</span>
55
<p class="mt-2 text-sm leading-6">{{ post.Excerpt }}</p>
6-
<a v-if="link" :href="link" target="_blank">
6+
<a
7+
class="relative"
8+
v-if="link"
9+
@click="trackRead"
10+
:href="link"
11+
target="_blank"
12+
>
713
<D9Button class="mt-2" label="Read more" color="light" />
14+
<span
15+
v-if="!isRead"
16+
class="bg-blue-300 rounded px-2 py-px bg-gradient-to-bl from-purple-600 via-teal-400 to-blue-400 font-bold text-white uppercase text-xs top-0 absolute right-100 -mt-2 -ml-2"
17+
>New</span
18+
>
819
</a>
920
</div>
1021
</template>
1122

1223
<script setup lang="ts">
1324
import { computed } from "vue";
1425
import { D9Button } from "@deck9/ui";
26+
import { useStorage } from "@vueuse/core";
27+
28+
const state = useStorage<Array<string>>("readPosts", []);
1529
1630
const props = defineProps({
1731
post: {
@@ -28,6 +42,18 @@ const link = computed<string | null>(() => {
2842
return `https://getinput.co/changelog/${props.post.Slug}`;
2943
});
3044
45+
const isRead = computed(() => {
46+
return state.value.includes(props.post.Slug);
47+
});
48+
49+
const trackRead = () => {
50+
if (isRead.value) {
51+
return;
52+
}
53+
54+
state.value.push(props.post.Slug);
55+
};
56+
3157
const formattedDate = computed(() => {
3258
if (!props.post.PublishedDate) {
3359
return;

resources/js/components/Factory/Integrations/IntegrationItem.vue

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
<Label class="flex-shrink-0" color="grey">{{
1515
webhook.webhook_method
1616
}}</Label>
17+
<Label
18+
v-if="webhook.has_provider && webhook.provider === 'make'"
19+
class="ml-1 flex-shrink-0"
20+
color="black"
21+
>Managed by Make</Label
22+
>
1723
<p class="ml-1">
1824
{{ webhook.webhook_url }}
1925
</p>

resources/js/components/Factory/Integrations/Integrations.vue

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
<div class="mt-4">
2424
<D9Button type="button" label="Add Integration" @click="addIntegration" />
25+
<MakeButton class="ml-2" />
2526
</div>
2627

2728
<IntegrationEdit
@@ -40,6 +41,7 @@ import { callGetformWebhooks } from "@/api/webhooks.js";
4041
import EmptyState from "@/components/EmptyState.vue";
4142
import IntegrationItem from "@/components/Factory/Integrations/IntegrationItem.vue";
4243
import IntegrationEdit from "@/components/Factory/Integrations/IntegrationEdit.vue";
44+
import MakeButton from "@/components/Factory/Integrations/MakeButton.vue";
4345
4446
const store = useForm();
4547
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
<template>
2+
<button
3+
class="relative inline-flex items-center focus:outline-none focus:ring active:ring transition duration-150 ease-in-out text-purple-800 bg-white border-transparent hover:bg-grey-100 hover:text-purple-700 active:bg-grey-100 ring-blue-300 ring-offset-2 dark:ring-offset-grey-900 px-5 py-2 text-sm leading-4 font-medium rounded-lg"
4+
@click="useMakeApp"
5+
>
6+
<span class="mr-1">Automate with</span>
7+
<div class="inset-0 inline-flex items-center justify-center">
8+
<svg
9+
class="h-3"
10+
id="Vrstva_1"
11+
xmlns="http://www.w3.org/2000/svg"
12+
xmlns:xlink="http://www.w3.org/1999/xlink"
13+
viewBox="0 0 882.62 182.13"
14+
>
15+
<defs>
16+
<clipPath id="clippath">
17+
<path
18+
class="cls-2"
19+
d="m156.04,44.34h33.88c2.58,0,4.68,2.1,4.68,4.68v125.07c0,2.58-2.1,4.68-4.68,4.68h-33.88c-2.58,0-4.68-2.1-4.68-4.68V49.02c0-2.58,2.1-4.68,4.68-4.68Z"
20+
/>
21+
</clipPath>
22+
<clipPath id="clippath-1">
23+
<path
24+
class="cls-2"
25+
d="m56.66,45.99L.5,157.74c-1.16,2.31-.23,5.12,2.08,6.28l30.27,15.21c2.31,1.16,5.12.23,6.28-2.08l56.16-111.75c1.16-2.31.23-5.12-2.08-6.28l-30.27-15.21c-.68-.34-1.39-.5-2.1-.5-1.71,0-3.36.94-4.18,2.58"
26+
/>
27+
</clipPath>
28+
<clipPath id="clippath-2">
29+
<path
30+
class="cls-2"
31+
d="m103.9,46.39l-24.03,121.81c-.5,2.53,1.14,4.98,3.67,5.49l33.21,6.7c2.54.51,5.02-1.14,5.52-3.68l24.03-121.81c.5-2.53-1.14-4.98-3.67-5.49l-33.21-6.7c-.31-.06-.62-.09-.93-.09-2.19,0-4.15,1.54-4.59,3.77"
32+
/>
33+
</clipPath>
34+
</defs>
35+
<path
36+
class="cls-2"
37+
d="m302.28,94.98v79.5c0,2.58-2.1,4.68-4.68,4.68h-34.35c-2.59,0-4.68-2.1-4.68-4.68V48.94c0-2.58,2.1-4.68,4.68-4.68h34.35c2.58,0,4.68,2.1,4.68,4.68v9.89c8.63-10.79,20.77-17.54,37.77-17.54,15.92,0,29.68,6.48,38.04,18.62,10.25-12.14,24.82-18.62,42.63-18.62,30.22,0,50.99,17.81,50.99,51.8v81.39c0,2.58-2.1,4.68-4.68,4.68h-34.35c-2.59,0-4.68-2.1-4.68-4.68v-72.21c0-14.84-8.36-22.12-19.7-22.12-9.44,0-17,5.94-21.32,14.84v79.5c0,2.58-2.1,4.68-4.68,4.68h-34.35c-2.59,0-4.68-2.1-4.68-4.68v-72.21c0-14.84-8.36-22.12-19.7-22.12-9.71,0-17,5.94-21.32,14.84"
38+
/>
39+
<path
40+
class="cls-2"
41+
d="m529.16,181.86c-25.36,0-46.68-16.73-46.68-42.63,0-23.74,15.65-34.81,44.79-42.36l37.24-9.71c-1.08-8.9-8.1-13.22-19.43-13.22-10.04,0-17.26,3.84-20.59,11.52-.93,2.14-3.16,3.4-5.44,2.86l-29.51-7.02c-2.72-.65-4.31-3.55-3.34-6.17,8.47-22.92,32.01-34.93,60.49-34.93,38.31,0,60.44,18.08,60.44,49.91v84.36c0,2.59-2.1,4.68-4.68,4.68h-32.57c-2.54,0-4.62-2.03-4.68-4.57l-.16-7.03-.27.27c-11.06,9.44-21.85,14.03-35.62,14.03m11.06-33.73c5.67,0,9.98-1.62,16.46-5.4l7.55-4.59.27-21.86-19.43,5.4c-13.22,3.78-19.16,7.02-19.16,14.57,0,8.36,7.28,11.87,14.3,11.87"
42+
/>
43+
<path
44+
class="cls-2"
45+
d="m676.92,115.49l-13.22,12.14v46.85c0,2.59-2.1,4.68-4.68,4.68h-33.54c-2.59,0-4.68-2.1-4.68-4.68V4.68c0-2.58,2.1-4.68,4.68-4.68h33.54c2.58,0,4.68,2.1,4.68,4.68v76.81l39.13-36c.86-.79,2-1.24,3.17-1.24h41.41c4.28,0,6.31,5.26,3.16,8.14l-40.18,36.65,45.82,83.18c1.72,3.12-.54,6.94-4.1,6.94h-39.15c-1.74,0-3.35-.97-4.15-2.52l-31.88-61.16Z"
46+
/>
47+
<path
48+
class="cls-2"
49+
d="m819.25,182.13c-37.5,0-71.77-23.47-71.77-70.96,0-44.79,32.92-70.69,69.07-70.69s64.76,26.17,65.83,67.45c.12,4.36.19,7.4.23,9.56.04,2.62-2.07,4.74-4.68,4.74h-87.28c1.35,16.19,14.3,26.44,30.76,26.44,11.71,0,21.31-4.87,28.04-13.67,1.49-1.95,4.24-2.4,6.28-1.03l21.8,14.6c2.18,1.46,2.72,4.42,1.25,6.59-11.68,17.19-30.94,26.97-59.52,26.97m-27.79-86.34h47.22c-.27-15.38-11.6-22.12-23.47-22.12-11.06,0-22.39,6.48-23.74,22.12"
50+
/>
51+
<g>
52+
<path
53+
class="cls-2"
54+
d="m156.04,44.34h33.88c2.58,0,4.68,2.1,4.68,4.68v125.07c0,2.58-2.1,4.68-4.68,4.68h-33.88c-2.58,0-4.68-2.1-4.68-4.68V49.02c0-2.58,2.1-4.68,4.68-4.68Z"
55+
/>
56+
<g class="cls-1">
57+
<rect
58+
class="cls-2"
59+
x="129.45"
60+
y="41.01"
61+
width="87.08"
62+
height="141.09"
63+
transform="translate(-27.91 66.73) rotate(-20.24)"
64+
/>
65+
</g>
66+
</g>
67+
<g>
68+
<path
69+
class="cls-2"
70+
d="m56.66,45.99L.5,157.74c-1.16,2.31-.23,5.12,2.08,6.28l30.27,15.21c2.31,1.16,5.12.23,6.28-2.08l56.16-111.75c1.16-2.31.23-5.12-2.08-6.28l-30.27-15.21c-.68-.34-1.39-.5-2.1-.5-1.71,0-3.36.94-4.18,2.58"
71+
/>
72+
<g class="cls-3">
73+
<rect
74+
class="cls-2"
75+
x="-23.86"
76+
y="29.77"
77+
width="143.51"
78+
height="164.28"
79+
transform="translate(-40.48 28.2) rotate(-23.38)"
80+
/>
81+
</g>
82+
</g>
83+
<g>
84+
<path
85+
class="cls-2"
86+
d="m103.9,46.39l-24.03,121.81c-.5,2.53,1.14,4.98,3.67,5.49l33.21,6.7c2.54.51,5.02-1.14,5.52-3.68l24.03-121.81c.5-2.53-1.14-4.98-3.67-5.49l-33.21-6.7c-.31-.06-.62-.09-.93-.09-2.19,0-4.15,1.54-4.59,3.77"
87+
/>
88+
<g class="cls-4">
89+
<rect
90+
class="cls-2"
91+
x="57.56"
92+
y="35.23"
93+
width="111.05"
94+
height="153.08"
95+
transform="translate(-31.65 45.95) rotate(-20.21)"
96+
/>
97+
</g>
98+
</g>
99+
</svg>
100+
</div>
101+
</button>
102+
</template>
103+
104+
<script lang="ts" setup>
105+
// TODO: This is harcoded for now, until we are an official app on make.com
106+
const useMakeApp = () => {
107+
window.open(
108+
"https://www.make.com/en/hq/app-invitation/ab079bcecb9e0c5545389a8ea96b3079",
109+
"_blank",
110+
);
111+
};
112+
</script>
113+
114+
<style>
115+
.cls-1 {
116+
clip-path: url(#clippath);
117+
}
118+
.cls-2 {
119+
fill: #1d1d1b;
120+
}
121+
.cls-3 {
122+
clip-path: url(#clippath-1);
123+
}
124+
.cls-4 {
125+
clip-path: url(#clippath-2);
126+
}
127+
</style>

resources/js/forms/classic/ClassicForm.vue

+10-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ await store.initForm(
8888
"hideNavigation",
8989
"focusOnMount",
9090
"alignLeft",
91-
])
91+
]),
9292
);
9393
9494
const { locale } = useI18n({ useScope: "global" });
@@ -105,7 +105,7 @@ onMounted(() => {
105105
const primaryColor = useThemableColor(store.form?.brand_color ?? "#1f2937");
106106
const contrastColor = useThemableColor(store.form?.contrast_color ?? "#f9fafb");
107107
const backgroundColor = useThemableColor(
108-
store.form?.background_color ?? "#ffffff"
108+
store.form?.background_color ?? "#ffffff",
109109
);
110110
const textColor = useThemableColor(store.form?.text_color ?? "#000000");
111111
</script>
@@ -117,4 +117,12 @@ const textColor = useThemableColor(store.form?.text_color ?? "#000000");
117117
--color-background: v-bind(backgroundColor);
118118
--color-content: v-bind(textColor);
119119
}
120+
121+
.text-content {
122+
@apply text-base;
123+
}
124+
125+
.text-content a {
126+
@apply text-primary underline;
127+
}
120128
</style>

0 commit comments

Comments
 (0)