@calcom/embed-snippet
Advanced tools
Comparing version 1.0.0 to 1.0.1-beta.1
@@ -1,1 +0,4 @@ | ||
(function(t,i){typeof exports=="object"&&typeof module!="undefined"?module.exports=i():typeof define=="function"&&define.amd?define(i):(t=typeof globalThis!="undefined"?globalThis:t||self,t.snippet=i())})(this,function(){"use strict";function t(i="https://cal.com/embed.js"){/*! Copy the code below and paste it in script tag of your website */(function(d,p,c){let s=function(e,n){e.q.push(n)},u=d.document;d.Cal=d.Cal||function(){let e=d.Cal,n=arguments;if(e.loaded||(e.ns={},e.q=e.q||[],u.head.appendChild(u.createElement("script")).src=p,e.loaded=!0),n[0]===c){const o=function(){s(o,arguments)},f=n[1];o.q=o.q||[],typeof f=="string"?(e.ns[f]=o)&&s(o,n):s(e,n);return}s(e,n)}})(window,i,"init");/*! Copying ends here. */return window.Cal}return t}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).snippet=n()}(this,(function(){"use strict";return function(e="https://cal.com/embed.js"){ | ||
/*! Copying ends here. */ | ||
/*! Copy the code below and paste it in script tag of your website */ | ||
return function(e,n,t){let o=function(e,n){e.q.push(n)},i=e.document;e.Cal=e.Cal||function(){let d=e.Cal,f=arguments;if(d.loaded||(d.ns={},d.q=d.q||[],i.head.appendChild(i.createElement("script")).src=n,d.loaded=!0),f[0]===t){const e=function(){o(e,arguments)},n=f[1];return e.q=e.q||[],void("string"==typeof n?(d.ns[n]=e)&&o(e,f):o(d,f))}o(d,f)}}(window,e,"init"),window.Cal}})); |
{ | ||
"name": "@calcom/embed-snippet", | ||
"version": "1.0.0", | ||
"version": "1.0.1-beta.1", | ||
"main": "src/index.ts", | ||
@@ -12,4 +12,7 @@ "description": "Vanilla JS embed snippet that is responsible to fetch @calcom/embed-core and thus show Cal Link as an embed on a page.", | ||
"devDependencies": { | ||
"eslint": "^8.10.0" | ||
"eslint": "^8.15.0" | ||
}, | ||
"dependencies": { | ||
"@calcom/embed-core": "^1.0.0" | ||
} | ||
} |
# embed-snippet | ||
This is the code snippet that is to be installed by the user on his website. | ||
Vanilla JS embed snippet that is responsible to fetch @calcom/embed-core and thus show Cal Link as an embed on a page. | ||
@@ -5,0 +5,0 @@ ## Development |
@@ -0,1 +1,3 @@ | ||
/* eslint-disable @typescript-eslint/ban-ts-comment,prefer-rest-params,prefer-const */ | ||
/** | ||
@@ -5,4 +7,9 @@ * As we want to keep control on the size of this snippet but we want some portion of it to be still readable. | ||
*/ | ||
import { Cal as CalClass, Instruction, InstructionQueue } from "@calcom/embed-core/src/embed"; | ||
import type { Cal as CalClass, InstructionQueue } from "@calcom/embed-core/src/embed"; | ||
const WEBAPP_URL = | ||
import.meta.env.NEXT_PUBLIC_WEBAPP_URL || `https://${import.meta.env.NEXT_PUBLIC_VERCEL_URL}`; | ||
const EMBED_LIB_URL = import.meta.env.NEXT_PUBLIC_EMBED_LIB_URL || `${WEBAPP_URL}/embed/embed.js`; | ||
export interface GlobalCal { | ||
@@ -17,2 +24,5 @@ (methodName: string, arg?: any): void; | ||
instance?: CalClass; | ||
__css?: string; | ||
fingerprint?: string; | ||
__logQueue?: any[]; | ||
} | ||
@@ -24,4 +34,3 @@ | ||
export default function EmbedSnippet(url = "https://cal.com/embed.js") { | ||
/*! Copy the code below and paste it in script tag of your website */ | ||
export default function EmbedSnippet(url = EMBED_LIB_URL) { | ||
(function (C: CalWindow, A, L) { | ||
@@ -40,2 +49,3 @@ let p = function (a: any, ar: any) { | ||
cal.q = cal.q || []; | ||
//@ts-ignore | ||
d.head.appendChild(d.createElement("script")).src = A; | ||
@@ -66,1 +76,3 @@ cal.loaded = true; | ||
} | ||
export const EmbedSnippetString = EmbedSnippet.toString(); |
@@ -0,6 +1,11 @@ | ||
require("dotenv").config({ path: "../../../.env" }); | ||
const path = require("path"); | ||
const { defineConfig } = require("vite"); | ||
process.env.NEXT_PUBLIC_VERCEL_URL = process.env.VERCEL_URL; | ||
module.exports = defineConfig({ | ||
build: { | ||
envPrefix: "NEXT_PUBLIC_", | ||
lib: { | ||
@@ -11,3 +16,7 @@ entry: path.resolve(__dirname, "src", "index.ts"), | ||
}, | ||
minify: "terser", | ||
terserOptions: { | ||
compress: true, | ||
}, | ||
}, | ||
}); |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
5689
130
1
2
3
+ Added@calcom/embed-core@^1.0.0
+ Added@calcom/embed-core@1.5.2(transitive)