Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Twipla app analytics added #14780

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/app-store/apps.browser.generated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ export const EventTypeAddonMap = {
"event-type-app-card": dynamic(() =>
import("./templates/event-type-app-card/components/EventTypeAppCardInterface")
),
twipla: dynamic(() => import("./twipla/components/EventTypeAppCardInterface")),
};
2 changes: 2 additions & 0 deletions packages/app-store/apps.keys-schemas.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { appKeysSchema as stripepayment_zod_ts } from "./stripepayment/zod";
import { appKeysSchema as tandemvideo_zod_ts } from "./tandemvideo/zod";
import { appKeysSchema as booking_pages_tag_zod_ts } from "./templates/booking-pages-tag/zod";
import { appKeysSchema as event_type_app_card_zod_ts } from "./templates/event-type-app-card/zod";
import { appKeysSchema as twipla_zod_ts } from "./twipla/zod";
import { appKeysSchema as vital_zod_ts } from "./vital/zod";
import { appKeysSchema as webex_zod_ts } from "./webex/zod";
import { appKeysSchema as wordpress_zod_ts } from "./wordpress/zod";
Expand Down Expand Up @@ -76,6 +77,7 @@ export const appKeysSchemas = {
tandemvideo: tandemvideo_zod_ts,
"booking-pages-tag": booking_pages_tag_zod_ts,
"event-type-app-card": event_type_app_card_zod_ts,
twipla: twipla_zod_ts,
vital: vital_zod_ts,
webex: webex_zod_ts,
wordpress: wordpress_zod_ts,
Expand Down
2 changes: 2 additions & 0 deletions packages/app-store/apps.metadata.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import event_type_app_card_config_json from "./templates/event-type-app-card/con
import event_type_location_video_static_config_json from "./templates/event-type-location-video-static/config.json";
import general_app_settings_config_json from "./templates/general-app-settings/config.json";
import link_as_an_app_config_json from "./templates/link-as-an-app/config.json";
import twipla_config_json from "./twipla/config.json";
import typeform_config_json from "./typeform/config.json";
import vimcal_config_json from "./vimcal/config.json";
import { metadata as vital__metadata_ts } from "./vital/_metadata";
Expand Down Expand Up @@ -162,6 +163,7 @@ export const appStoreMetadata = {
"event-type-location-video-static": event_type_location_video_static_config_json,
"general-app-settings": general_app_settings_config_json,
"link-as-an-app": link_as_an_app_config_json,
twipla: twipla_config_json,
typeform: typeform_config_json,
vimcal: vimcal_config_json,
vital: vital__metadata_ts,
Expand Down
2 changes: 2 additions & 0 deletions packages/app-store/apps.schemas.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { appDataSchema as stripepayment_zod_ts } from "./stripepayment/zod";
import { appDataSchema as tandemvideo_zod_ts } from "./tandemvideo/zod";
import { appDataSchema as booking_pages_tag_zod_ts } from "./templates/booking-pages-tag/zod";
import { appDataSchema as event_type_app_card_zod_ts } from "./templates/event-type-app-card/zod";
import { appDataSchema as twipla_zod_ts } from "./twipla/zod";
import { appDataSchema as vital_zod_ts } from "./vital/zod";
import { appDataSchema as webex_zod_ts } from "./webex/zod";
import { appDataSchema as wordpress_zod_ts } from "./wordpress/zod";
Expand Down Expand Up @@ -76,6 +77,7 @@ export const appDataSchemas = {
tandemvideo: tandemvideo_zod_ts,
"booking-pages-tag": booking_pages_tag_zod_ts,
"event-type-app-card": event_type_app_card_zod_ts,
twipla: twipla_zod_ts,
vital: vital_zod_ts,
webex: webex_zod_ts,
wordpress: wordpress_zod_ts,
Expand Down
1 change: 1 addition & 0 deletions packages/app-store/apps.server.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export const apiHandlers = {
"event-type-location-video-static": import("./templates/event-type-location-video-static/api"),
"general-app-settings": import("./templates/general-app-settings/api"),
"link-as-an-app": import("./templates/link-as-an-app/api"),
twipla: import("./twipla/api"),
typeform: import("./typeform/api"),
vimcal: import("./vimcal/api"),
vital: import("./vital/api"),
Expand Down
2 changes: 2 additions & 0 deletions packages/app-store/bookerApps.metadata.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { metadata as tandemvideo__metadata_ts } from "./tandemvideo/_metadata";
import telegram_config_json from "./telegram/config.json";
import booking_pages_tag_config_json from "./templates/booking-pages-tag/config.json";
import event_type_location_video_static_config_json from "./templates/event-type-location-video-static/config.json";
import twipla_config_json from "./twipla/config.json";
import webex_config_json from "./webex/config.json";
import whatsapp_config_json from "./whatsapp/config.json";
import whereby_config_json from "./whereby/config.json";
Expand Down Expand Up @@ -74,6 +75,7 @@ export const appStoreMetadata = {
telegram: telegram_config_json,
"booking-pages-tag": booking_pages_tag_config_json,
"event-type-location-video-static": event_type_location_video_static_config_json,
twipla: twipla_config_json,
webex: webex_config_json,
whatsapp: whatsapp_config_json,
whereby: whereby_config_json,
Expand Down
6 changes: 6 additions & 0 deletions packages/app-store/twipla/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
items:
- 1.png
---

{DESCRIPTION}
16 changes: 16 additions & 0 deletions packages/app-store/twipla/api/add.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { createDefaultInstallation } from "@calcom/app-store/_utils/installation";
import type { AppDeclarativeHandler } from "@calcom/types/AppHandler";

import appConfig from "../config.json";

const handler: AppDeclarativeHandler = {
appType: appConfig.type,
variant: appConfig.variant,
slug: appConfig.slug,
supportsMultipleInstalls: false,
handlerType: "add",
createCredential: ({ appType, user, slug, teamId }) =>
createDefaultInstallation({ appType, user: user, slug, key: {}, teamId }),
};

export default handler;
1 change: 1 addition & 0 deletions packages/app-store/twipla/api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as add } from "./add";
35 changes: 35 additions & 0 deletions packages/app-store/twipla/components/EventTypeAppCardInterface.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { useAppContextWithSchema } from "@calcom/app-store/EventTypeAppContext";
import AppCard from "@calcom/app-store/_components/AppCard";
import useIsAppEnabled from "@calcom/app-store/_utils/useIsAppEnabled";
import type { EventTypeAppCardComponent } from "@calcom/app-store/types";
import { TextField } from "@calcom/ui";

import type { appDataSchema } from "../zod";

const EventTypeAppCard: EventTypeAppCardComponent = function EventTypeAppCard({ app, eventType }) {
const { getAppData, setAppData, disabled } = useAppContextWithSchema<typeof appDataSchema>();
const siteId = getAppData("SITE_ID");
const { enabled, updateEnabled } = useIsAppEnabled(app);

return (
<AppCard
app={app}
switchOnClick={(e) => {
updateEnabled(e);
}}
switchChecked={enabled}
teamId={eventType.team?.id || undefined}>
<TextField
disabled={disabled}
name="Site ID"
value={siteId}
placeholder="Enter your Site ID"
onChange={(e) => {
setAppData("SITE_ID", e.target.value);
}}
/>
</AppCard>
);
};

export default EventTypeAppCard;
25 changes: 25 additions & 0 deletions packages/app-store/twipla/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "Twipla",
"slug": "twipla",
"type": "twipla_analytics",
"logo": "icon.svg",
"url": "https://cal.com/",
"variant": "analytics",
"categories": ["analytics"],
"publisher": "Cal.com, Inc.",
"email": "help@cal.com",
"description": "Twipla.com, formerly known as Visitor Analytics, is a website intelligence platform that helps you understand how visitors interact with your website.",
"extendsFeature": "EventType",
"appData": {
"tag": {
"scripts": [
{
"content": "(function(v, i, s, a, t) {\n v[t] = v[t] || function() {\n (v[t].v = v[t].v || []).push(arguments);\n };\n if (!v._visaSettings) {\n v._visaSettings = {};\n }\n v._visaSettings[a] = {\n v: '1.0',\n s: a,\n a: '1',\n t: t\n };\n var b = i.getElementsByTagName('body')[0];\n var p = i.createElement('script');\n p.defer = 1;\n p.async = 1;\n p.src = s + '?s=' + a;\n b.appendChild(p);\n})(window, document, '//app-worker.visitor-analytics.io/main.js', '{SITE_ID}', 'va');"
}
]
}
},
"isTemplate": false,
"__createdUsingCli": true,
"__template": "booking-pages-tag"
}
1 change: 1 addition & 0 deletions packages/app-store/twipla/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * as api from "./api";
14 changes: 14 additions & 0 deletions packages/app-store/twipla/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://json.schemastore.org/package.json",
"private": true,
"name": "@calcom/twipla",
"version": "0.0.0",
"main": "./index.ts",
"dependencies": {
"@calcom/lib": "*"
},
"devDependencies": {
"@calcom/types": "*"
},
"description": "Twipla.com, formerly known as Visitor Analytics, is a website intelligence platform that helps you understand how visitors interact with your website."
}
Binary file added packages/app-store/twipla/static/1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions packages/app-store/twipla/static/icon.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions packages/app-store/twipla/zod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { z } from "zod";

import { eventTypeAppCardZod } from "@calcom/app-store/eventTypeAppCardZod";

export const appDataSchema = eventTypeAppCardZod.merge(
z.object({
SITE_ID: z.string().optional(),
})
);

export const appKeysSchema = z.object({});