chore:little fixes and formating and linting and patches

This commit is contained in:
2026-03-31 15:50:54 +02:00
parent a1ce71ffb6
commit 9b197abcfa
815 changed files with 22960 additions and 8982 deletions

View File

@@ -9,10 +9,10 @@ import { NodeIcon } from './icons/node-icon';
import { ReactIcon } from './icons/react-icon';
import { RemixIcon } from './icons/remix-icon';
import { RestIcon } from './icons/rest-icon';
import { RubyIcon } from './icons/ruby-icon';
import { RustIcon } from './icons/rust-icon';
import { SwiftIcon } from './icons/swift-icon';
import { VueIcon } from './icons/vue-icon';
import { RustIcon } from './icons/rust-icon';
import { RubyIcon } from './icons/ruby-icon';
export type Framework = {
key: string;

View File

@@ -3,12 +3,12 @@ import type { IconProps } from './types';
export function AstroIcon({ className }: IconProps) {
return (
<svg
width="407"
className={className}
fill="none"
height="512"
viewBox="0 0 407 512"
width="407"
xmlns="http://www.w3.org/2000/svg"
fill="none"
className={className}
>
<path
d="M132.014 436.092C108.884 414.948 102.132 370.522 111.769 338.336C128.478 358.629 151.631 365.057 175.612 368.686C212.633 374.285 248.992 372.191 283.384 355.269C287.318 353.332 290.954 350.756 295.253 348.147C298.48 357.509 299.32 366.961 298.192 376.58C295.452 400.009 283.793 418.106 265.249 431.825C257.833 437.312 249.987 442.217 242.328 447.391C218.8 463.294 212.435 481.94 221.276 509.061C221.486 509.726 221.674 510.387 222.149 511.999C210.136 506.621 201.361 498.792 194.675 488.5C187.613 477.639 184.254 465.623 184.077 452.621C183.989 446.294 183.989 439.91 183.138 433.672C181.06 418.464 173.921 411.655 160.471 411.263C146.669 410.861 135.75 419.394 132.855 432.832C132.634 433.863 132.313 434.882 131.992 436.08L132.014 436.092Z"

View File

@@ -3,24 +3,24 @@ import type { IconProps } from './types';
export function ExpressIcon({ className }: IconProps) {
return (
<svg
width="512"
className={className}
fill="none"
height="512"
viewBox="0 0 512 512"
width="512"
xmlns="http://www.w3.org/2000/svg"
fill="none"
className={className}
>
<g clipPath="url(#clip0_367_145)">
<path
fillRule="evenodd"
clipRule="evenodd"
d="M59.072 260.272C59.712 293.312 63.68 323.984 70.992 352.272C78.288 380.544 89.552 405.184 104.832 426.16C120.08 447.12 139.792 463.648 163.936 475.728C188.096 487.808 217.648 493.84 252.576 493.84C304.096 493.84 346.816 480.336 380.832 453.328C414.832 426.288 435.968 385.808 444.224 331.776H463.296C456.304 388.976 433.744 433.296 395.616 464.768C357.472 496.224 310.432 511.968 254.496 511.968C216.368 512.608 183.776 506.56 156.784 493.84C129.744 481.136 107.664 463.168 90.512 439.968C73.344 416.768 60.64 389.44 52.384 357.984C44.128 326.528 40 292.704 40 256.448C40 215.776 46.032 179.552 58.112 147.776C70.192 116 86.08 89.12 105.792 67.2C125.44 45.28 148.32 28.64 174.4 17.184C200.48 5.728 227.168 0 254.496 0C292.624 0 325.536 7.312 353.168 21.92C380.816 36.544 403.376 55.936 420.848 80.08C438.336 104.24 451.04 131.888 458.992 163.024C466.928 194.144 470.272 226.544 468.992 260.256H59.088L59.072 260.272ZM449.952 241.2C449.952 211.328 445.792 182.88 437.552 155.872C429.296 128.864 417.072 105.184 400.848 84.832C384.64 64.512 364.464 48.464 340.304 36.704C316.144 24.944 288.176 19.072 256.4 19.072C229.68 19.072 204.752 24.144 181.552 34.32C158.352 44.496 138.032 59.28 120.544 78.64C103.072 98.032 88.928 121.392 78.112 148.72C67.312 176.048 60.96 206.88 59.072 241.2H449.952Z"
fill="currentColor"
fillRule="evenodd"
/>
</g>
<defs>
<clipPath id="clip0_367_145">
<rect width="512" height="512" fill="white" />
<rect fill="white" height="512" width="512" />
</clipPath>
</defs>
</svg>

View File

@@ -3,12 +3,12 @@ import type { IconProps } from './types';
export function FlutterIcon({ className }: IconProps) {
return (
<svg
width="512"
className={className}
fill="none"
height="512"
viewBox="0 0 512 512"
width="512"
xmlns="http://www.w3.org/2000/svg"
fill="none"
className={className}
>
<path
d="M302.543 237.44L173.167 366.56L302.527 495.92H449.951L320.783 366.592L449.951 237.424H302.559L302.543 237.44ZM302.271 16.064L62.0635 256L136.047 329.984L449.631 16.336H302.527L302.271 16.064Z"

View File

@@ -3,18 +3,18 @@ import type { IconProps } from './types';
export function HtmlIcon({ className }: IconProps) {
return (
<svg
width="512"
className={className}
fill="none"
height="512"
viewBox="0 0 512 512"
width="512"
xmlns="http://www.w3.org/2000/svg"
fill="none"
className={className}
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M395.14 153.6H394.957H174.388L179.663 204.8H389.891C386.81 249.651 377.488 344.674 374.067 387.913L255.988 421.15V421.25L255.727 421.375L137.57 379.8L129.475 281.6H187.392L191.492 334.413L255.832 358.4H255.988L320.224 335.363L326.831 256H126.89C125.924 245.734 113.495 112.435 111.328 102.4H400.31C398.691 119.296 397.046 136.653 395.14 153.6ZM25.6016 0L67.5376 464.588L255.727 512L444.413 463.638L486.402 0H25.6016Z"
fill="currentColor"
fillRule="evenodd"
/>
</svg>
);

View File

@@ -3,12 +3,12 @@ import type { IconProps } from './types';
export function KotlinIcon({ className }: IconProps) {
return (
<svg
width="512"
className={className}
fill="none"
height="512"
viewBox="0 0 512 512"
fill="none"
width="512"
xmlns="http://www.w3.org/2000/svg"
className={className}
>
<g clipPath="url(#clip0_367_180)">
<path
@@ -18,7 +18,7 @@ export function KotlinIcon({ className }: IconProps) {
</g>
<defs>
<clipPath id="clip0_367_180">
<rect width="512" height="512" fill="white" />
<rect fill="white" height="512" width="512" />
</clipPath>
</defs>
</svg>

View File

@@ -3,12 +3,12 @@ import type { IconProps } from './types';
export function LaravelIcon({ className }: IconProps) {
return (
<svg
width="512"
className={className}
fill="none"
height="512"
viewBox="0 0 512 512"
fill="none"
width="512"
xmlns="http://www.w3.org/2000/svg"
className={className}
>
<path
d="M210.288 377.36L377.648 281.84L301.616 238.064L134.368 334.368L210.288 377.36ZM385.344 181.984L309.232 138.208V224.88L385.36 268.672L385.344 181.984ZM392.944 81.2479L316.848 125.024L392.944 168.8L469.024 125.008L392.944 81.2479ZM158.576 302.848L202.736 277.424V86.4799L126.608 130.288V321.232L158.576 302.848ZM118.992 29.5359L42.8963 73.3279L118.992 117.12L195.04 73.3279L118.992 29.5359ZM35.2643 86.4959V381.728L202.688 478.08V390.544L115.136 341.008C114.848 340.8 114.624 340.576 114.32 340.384C114.096 340.176 113.84 340.016 113.616 339.84L113.6 339.792C113.36 339.552 113.152 339.296 112.976 339.008L112.96 338.992C112.736 338.784 112.56 338.544 112.4 338.272L112.384 338.256H112.336C112.208 338.016 112.08 337.696 111.952 337.376L111.936 337.312C111.824 337.072 111.696 336.8 111.584 336.496L111.568 336.448C111.504 336.128 111.44 335.728 111.408 335.328V335.296C111.36 335.056 111.312 334.768 111.28 334.48V334.464V130.32L67.1683 104.88L35.2643 86.4959ZM385.36 381.712V294.96L217.936 390.544V478.064L385.36 381.712ZM476.624 224.88V138.208L400.528 182V268.672L476.624 224.88ZM491.6 123.04C491.776 123.648 491.888 124.336 491.888 125.056V229.264C491.888 232.08 490.368 234.528 488.096 235.84L488.064 235.856L400.576 286.24V386.096C400.576 388.896 399.056 391.344 396.8 392.672L396.768 392.688L214.112 497.808C213.728 498.016 213.28 498.208 212.816 498.336L212.768 498.352L212.288 498.56C211.712 498.736 211.04 498.832 210.352 498.832C209.664 498.832 208.992 498.736 208.352 498.544L208.4 498.56C208.16 498.496 207.968 498.416 207.776 498.304L207.792 498.32C207.296 498.144 206.88 497.984 206.48 497.792L206.544 497.824L23.9363 392.704C21.6323 391.36 20.1123 388.912 20.1123 386.112V73.3439C20.1123 72.6399 20.2243 71.9519 20.4163 71.3119L20.4003 71.3599C20.4643 71.1199 20.6083 70.9599 20.6883 70.7199C20.8323 70.2559 20.9923 69.8719 21.1683 69.5039L21.1523 69.5519C21.2803 69.2959 21.4403 69.0719 21.6163 68.8799L22.2883 67.9679L23.0403 67.4239C23.3283 67.1839 23.5843 66.9439 23.8723 66.7359H23.8883L115.216 14.1759C116.304 13.5359 117.616 13.1519 119.008 13.1519C120.4 13.1519 121.712 13.5359 122.832 14.1919L122.8 14.1759L214.16 66.7359C214.464 66.9439 214.72 67.1679 214.976 67.4079L215.744 67.9519C216 68.2399 216.144 68.5599 216.416 68.8639C216.608 69.0559 216.768 69.2799 216.912 69.5199L216.928 69.5359C217.088 69.8559 217.248 70.2399 217.392 70.6399L217.408 70.7039L217.664 71.3439C217.84 71.9039 217.952 72.5599 217.952 73.2319C217.952 73.2639 217.952 73.2959 217.952 73.3279V268.656L294.048 224.864V125.008C294.048 124.992 294.048 124.976 294.048 124.976C294.048 124.288 294.144 123.616 294.32 122.976L294.304 123.024C294.368 122.816 294.512 122.624 294.56 122.384C294.72 121.904 294.88 121.52 295.072 121.136L295.04 121.2C295.184 120.96 295.408 120.8 295.552 120.528C295.792 120.224 295.984 119.92 296.224 119.664C296.448 119.456 296.688 119.264 296.944 119.104L296.96 119.088C297.248 118.88 297.488 118.624 297.792 118.448H297.808L389.136 65.8719C390.224 65.2319 391.536 64.8479 392.928 64.8479C394.32 64.8479 395.632 65.2319 396.752 65.8879L396.72 65.8719L488.048 118.448C488.368 118.656 488.592 118.88 488.896 119.072C489.136 119.28 489.408 119.44 489.632 119.632C489.888 119.92 490.08 120.24 490.32 120.528C490.496 120.72 490.656 120.944 490.8 121.168L490.816 121.184C491.008 121.536 491.168 121.936 491.296 122.352L491.312 122.4C491.44 122.592 491.536 122.8 491.616 123.024L491.6 123.04Z"

View File

@@ -3,12 +3,12 @@ import type { IconProps } from './types';
export function NextjsIcon({ className }: IconProps) {
return (
<svg
width="512"
className={className}
fill="none"
height="512"
viewBox="0 0 512 512"
fill="none"
width="512"
xmlns="http://www.w3.org/2000/svg"
className={className}
>
<g clipPath="url(#clip0_367_158)">
<path
@@ -18,7 +18,7 @@ export function NextjsIcon({ className }: IconProps) {
</g>
<defs>
<clipPath id="clip0_367_158">
<rect width="512" height="512" fill="white" />
<rect fill="white" height="512" width="512" />
</clipPath>
</defs>
</svg>

View File

@@ -3,12 +3,12 @@ import type { IconProps } from './types';
export function NodeIcon({ className }: IconProps) {
return (
<svg
width="512"
className={className}
fill="none"
height="512"
viewBox="0 0 512 512"
fill="none"
width="512"
xmlns="http://www.w3.org/2000/svg"
className={className}
>
<path
d="M482.584 147.869V363.982C482.584 378.007 475.038 391.066 462.912 398.125L275.664 506.241C269.675 509.715 262.882 511.5 255.945 511.5C249.107 511.5 242.296 509.715 236.306 506.241L173.785 469.251C164.459 464.044 169.01 462.192 172.093 461.123C184.547 456.801 187.066 455.805 200.361 448.26C201.748 447.467 203.577 447.777 205.008 448.603L253.039 477.122C254.78 478.103 257.239 478.103 258.84 477.122L446.103 369.036C447.847 368.04 448.965 366.053 448.965 363.983V147.869C448.965 145.752 447.847 143.775 446.059 142.706L258.873 34.7158C257.147 33.7058 254.843 33.7058 253.105 34.7158L65.9611 142.736C64.1431 143.776 62.9961 145.815 62.9961 147.869V363.982C62.9961 366.051 64.1421 367.991 65.9501 368.972L117.249 398.626C145.078 412.529 162.124 396.141 162.124 379.67V166.309C162.124 163.292 164.547 160.913 167.563 160.913H191.31C194.279 160.913 196.739 163.291 196.739 166.309V379.671C196.739 416.817 176.503 438.125 141.287 438.125C130.471 438.125 121.94 438.125 98.1491 426.412L49.0511 398.125C36.9181 391.13 29.4131 378.008 29.4131 363.982V147.869C29.4131 133.826 36.9181 120.719 49.0511 113.734L236.307 5.52575C248.157 -1.17525 263.915 -1.17525 275.664 5.52575L462.912 113.734C475.038 120.748 482.584 133.826 482.584 147.869ZM321.17 343.367C265.29 343.367 252.995 329.319 248.876 301.531C248.399 298.565 245.858 296.356 242.813 296.356H215.507C212.125 296.356 209.411 299.059 209.411 302.46C209.411 338.02 228.765 380.431 321.17 380.431C388.076 380.431 426.439 354.092 426.439 308.088C426.439 262.465 395.612 250.328 330.73 241.738C265.151 233.06 258.487 228.591 258.487 213.23C258.487 200.569 264.13 183.649 312.703 183.649C356.077 183.649 372.068 192.998 378.643 222.225C379.222 224.98 381.726 226.99 384.566 226.99H411.975C413.675 226.99 415.29 226.26 416.445 225.047C417.603 223.767 418.218 222.1 418.056 220.352C413.815 169.975 380.343 146.508 312.702 146.508C252.493 146.508 216.584 171.922 216.584 214.51C216.584 260.727 252.313 273.51 310.084 279.212C379.222 285.994 384.588 296.095 384.588 309.7C384.588 333.299 365.654 343.367 321.17 343.367Z"

View File

@@ -3,24 +3,24 @@ import type { IconProps } from './types';
export function PythonIcon({ className }: IconProps) {
return (
<svg
width="512"
className={className}
fill="none"
height="512"
viewBox="0 0 512 512"
fill="none"
width="512"
xmlns="http://www.w3.org/2000/svg"
className={className}
>
<g clipPath="url(#clip0_367_173)">
<path
fillRule="evenodd"
clipRule="evenodd"
d="M326.246 472.525C313.907 472.525 303.923 462.491 303.923 450.088C303.923 437.684 313.907 427.675 326.246 427.675C338.585 427.675 348.57 437.684 348.57 450.088C348.57 462.491 338.585 472.525 326.246 472.525ZM257.843 512C387.84 512 379.725 455.338 379.725 455.338L379.571 396.638H255.539V379.013H428.826C428.826 379.013 512 388.509 512 256.675C512 124.841 439.424 129.488 439.424 129.488H396.083V190.688C396.083 190.688 398.413 263.638 324.659 263.638H201.626C201.626 263.638 132.505 262.541 132.505 330.813V443.675C132.505 443.675 122.009 512 257.843 512ZM185.779 39.475C198.118 39.475 208.077 49.5088 208.077 61.9125C208.077 74.3162 198.118 84.325 185.779 84.325C173.44 84.325 163.456 74.3162 163.456 61.9125C163.456 49.5088 173.44 39.475 185.779 39.475ZM254.157 0C124.186 0 132.301 56.6625 132.301 56.6625L132.455 115.363H256.487V132.988H83.1742C83.1742 132.988 0 123.491 0 255.325C0 387.159 72.6016 382.513 72.6016 382.513H115.917V321.313C115.917 321.313 113.587 248.363 187.366 248.363H310.374C310.374 248.363 379.495 249.459 379.495 181.188V68.325C379.495 68.325 389.991 0 254.157 0Z"
fill="currentColor"
fillRule="evenodd"
/>
</g>
<defs>
<clipPath id="clip0_367_173">
<rect width="512" height="512" fill="white" />
<rect fill="white" height="512" width="512" />
</clipPath>
</defs>
</svg>

File diff suppressed because one or more lines are too long

View File

@@ -3,19 +3,19 @@ import type { IconProps } from './types';
export function RemixIcon({ className }: IconProps) {
return (
<svg
width="445"
className={className}
fill="none"
height="512"
viewBox="0 0 445 512"
fill="none"
width="445"
xmlns="http://www.w3.org/2000/svg"
className={className}
>
<g clipPath="url(#clip0_367_139)">
<path
fillRule="evenodd"
clipRule="evenodd"
d="M425.345 394.844C429.951 454 429.951 481.73 429.951 512H293.08C293.08 505.407 293.198 499.375 293.318 493.26C293.688 474.247 294.074 454.421 290.994 414.383C286.922 355.766 261.681 342.741 215.268 342.741H174.148H0V236.093H221.783C280.408 236.093 309.722 218.258 309.722 171.039C309.722 129.52 280.408 104.359 221.783 104.359H0V0H246.21C378.933 0 444.888 62.6867 444.888 162.822C444.888 237.721 398.476 286.567 335.778 294.709C388.704 305.292 419.646 335.414 425.345 394.844Z"
fill="currentColor"
fillRule="evenodd"
/>
<path
d="M0 512V432.497H144.721C168.894 432.497 174.143 450.426 174.143 461.118V512H0Z"
@@ -24,7 +24,7 @@ export function RemixIcon({ className }: IconProps) {
</g>
<defs>
<clipPath id="clip0_367_139">
<rect width="444.888" height="512" fill="white" />
<rect fill="white" height="512" width="444.888" />
</clipPath>
</defs>
</svg>

View File

@@ -3,12 +3,12 @@ import type { IconProps } from './types';
export function RestIcon({ className }: IconProps) {
return (
<svg
width="512"
className={className}
fill="none"
height="513"
viewBox="0 0 512 513"
fill="none"
width="512"
xmlns="http://www.w3.org/2000/svg"
className={className}
>
<path
d="M346.706 381.093H140.062C134.263 381.093 129.513 376.342 129.513 370.544V164.459C129.513 160.616 126.369 157.473 122.527 157.473C118.685 157.473 115.541 160.616 115.541 164.459V370.544C115.541 384.097 126.509 395.065 140.062 395.065H346.706C350.548 395.065 353.692 391.921 353.692 388.079C353.692 384.236 350.618 381.093 346.706 381.093Z"

View File

@@ -3,16 +3,14 @@ import type { IconProps } from './types';
export function RubyIcon({ className }: IconProps) {
return (
<svg
className={className}
fill="#000000"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 512 512"
className={className}
xmlns="http://www.w3.org/2000/svg"
>
<g id="5151e0c8492e5103c096af88a51e4c6f">
<path
fill="currentColor"
display="inline"
d="M365.281,386.936l108.635,96.416l-213.754-16.794c41.878-25.3,76.426-55.513,102.294-79.567
c0.426,0.083,0.879,0.129,1.332,0.129C364.283,387.119,364.782,387.06,365.281,386.936z M485.518,444.55l20.008-262.045
c-9.898,25.284-25.557,54.73-45.857,86.172L485.518,444.55z M372.547,380.983l108.384,96.196l-28.936-196.865
@@ -39,6 +37,8 @@ export function RubyIcon({ className }: IconProps) {
c14.234,18.62,33.252,26.935,61.528,26.935c2.848,0,5.806-0.078,8.978-0.233l-4.995-12.412
C78.996,467.845,48.152,391.248,34.284,361.407z M506.144,60.604c-2.056-6.289-4.68-12.096-7.811-17.306
c-12.632-21.015-34.452-34.461-64.871-39.976l-67.961,37.531L506.144,60.604z"
display="inline"
fill="currentColor"
/>
</g>
</svg>

File diff suppressed because one or more lines are too long

View File

@@ -3,18 +3,18 @@ import type { IconProps } from './types';
export function SwiftIcon({ className }: IconProps) {
return (
<svg
width="512"
className={className}
fill="none"
height="512"
viewBox="0 0 512 512"
fill="none"
width="512"
xmlns="http://www.w3.org/2000/svg"
className={className}
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M315.443 25.6001C540.493 179.828 467.712 349.888 467.712 349.888C467.712 349.888 531.712 422.712 505.83 486.4C505.83 486.4 479.437 441.8 435.174 441.8C392.499 441.8 367.437 486.4 281.574 486.4C90.3934 486.4 0 325.438 0 325.438C172.237 439.632 289.843 358.763 289.843 358.763C212.249 313.364 47.1805 96.2501 47.1805 96.2501C190.924 219.576 253.056 252.1 253.056 252.1C215.987 221.198 111.974 70.2001 111.974 70.2001C195.174 155.117 360.499 273.588 360.499 273.588C407.45 142.472 315.443 25.6001 315.443 25.6001Z"
fill="currentColor"
fillRule="evenodd"
/>
</svg>
);

View File

@@ -3,12 +3,12 @@ import type { IconProps } from './types';
export function VueIcon({ className }: IconProps) {
return (
<svg
width="512"
className={className}
fill="none"
height="512"
viewBox="0 0 512 512"
fill="none"
width="512"
xmlns="http://www.w3.org/2000/svg"
className={className}
>
<path
d="M407.772 42.6665H320L256 147.2L201.143 42.6665H0L256 490.667L512 42.6665H407.772ZM64 79.9998H126.172L256 311.467L385.828 79.9998H448L256 416L64 79.9998Z"

View File

@@ -24,7 +24,7 @@ export function screenView(properties?: TrackProperties): void;
export function screenView(path: string, properties?: TrackProperties): void;
export function screenView(
pathOrProperties?: string | TrackProperties,
propertiesOrUndefined?: TrackProperties,
propertiesOrUndefined?: TrackProperties
) {
window.op?.('screenView', pathOrProperties, propertiesOrUndefined);
}

View File

@@ -1,6 +1,6 @@
---
import type { IdentifyPayload } from '@openpanel/web';
import { filterProps } from './asto-utils';
interface Props extends IdentifyPayload {}
const props = Astro.props as Props;

View File

@@ -11,7 +11,8 @@ type Props = Omit<OpenPanelOptions, 'filter'> & {
globalProperties?: Record<string, unknown>;
};
const { profileId, cdnUrl, scriptUrl, globalProperties, ...options } = Astro.props;
const { profileId, cdnUrl, scriptUrl, globalProperties, ...options } =
Astro.props;
const CDN_URL = 'https://openpanel.dev/op1.js';

View File

@@ -1,6 +1,4 @@
---
import { filterProps } from './asto-utils';
type Props = Record<string, unknown>;
const props = Astro.props as Props;

View File

@@ -2,6 +2,6 @@ const BLACKLISTED_PROPS = ['class'];
export function filterProps(props: Record<string, unknown>) {
return Object.fromEntries(
Object.entries(props).filter(([key]) => !BLACKLISTED_PROPS.includes(key)),
Object.entries(props).filter(([key]) => !BLACKLISTED_PROPS.includes(key))
);
}

View File

@@ -1,8 +1,7 @@
import { getClientIpFromHeaders } from '@openpanel/common/server/get-client-ip';
import type { NextFunction, Request, Response } from 'express';
import type { OpenPanelOptions } from '@openpanel/sdk';
import { OpenPanel } from '@openpanel/sdk';
import type { NextFunction, Request, Response } from 'express';
export * from '@openpanel/sdk';

View File

@@ -21,7 +21,7 @@ function getClientHeaders(req: Request): Headers {
headers.set('Content-Type', 'application/json');
headers.set(
'openpanel-client-id',
req.headers.get('openpanel-client-id') ?? '',
req.headers.get('openpanel-client-id') ?? ''
);
// Construct origin: browsers send Origin header for POST requests and cross-origin requests,
@@ -45,7 +45,7 @@ function getClientHeaders(req: Request): Headers {
async function handleApiRoute(
req: Request,
apiUrl: string,
apiPath: string,
apiPath: string
): Promise<NextResponse> {
const headers = getClientHeaders(req);
@@ -67,7 +67,7 @@ async function handleApiRoute(
error: 'Failed to proxy request',
message: e instanceof Error ? e.message : String(e),
},
{ status: 500 },
{ status: 500 }
);
}
}
@@ -87,8 +87,8 @@ async function handleScriptProxyRoute(req: Request): Promise<NextResponse> {
try {
const res = await fetch(scriptUrl, {
// @ts-ignore
next: { revalidate: 86400 },
// @ts-expect-error
next: { revalidate: 86_400 },
});
const text = await res.text();
const etag = `"${createHash('md5')
@@ -108,7 +108,7 @@ async function handleScriptProxyRoute(req: Request): Promise<NextResponse> {
error: 'Failed to fetch script',
message: e instanceof Error ? e.message : String(e),
},
{ status: 500 },
{ status: 500 }
);
}
}

View File

@@ -1,11 +1,11 @@
import {
type EventHandlerRequest,
type H3Event,
createError,
defineEventHandler,
type EventHandlerRequest,
getHeader,
getRequestIP,
getRequestURL,
type H3Event,
readBody,
setResponseStatus,
} from 'h3';
@@ -24,7 +24,7 @@ function getClientHeaders(event: H3Event<EventHandlerRequest>): Headers {
headers.set('Content-Type', 'application/json');
headers.set(
'openpanel-client-id',
getHeader(event, 'openpanel-client-id') || '',
getHeader(event, 'openpanel-client-id') || ''
);
// Construct origin: browsers send Origin header for POST requests and cross-origin requests,
@@ -47,7 +47,7 @@ function getClientHeaders(event: H3Event<EventHandlerRequest>): Headers {
async function handleApiRoute(
event: H3Event<EventHandlerRequest>,
apiPath: string,
apiPath: string
) {
try {
const res = await fetch(`${API_URL}${apiPath}`, {

View File

@@ -4,14 +4,9 @@
"incremental": false,
"outDir": "dist",
"paths": {
"#app": [
"./node_modules/nuxt/dist/app/index"
]
"#app": ["./node_modules/nuxt/dist/app/index"]
},
"types": [
"@types/node",
"@nuxt/types"
],
"types": ["@types/node", "@nuxt/types"],
"strictNullChecks": true
},
"exclude": ["dist"]

View File

@@ -44,7 +44,7 @@ export class Api {
url: string,
data: ReqBody,
options: FetchOptions,
attempt: number,
attempt: number
): Promise<ResBody | null> {
try {
const response = await fetch(url, {
@@ -55,7 +55,9 @@ export class Api {
...options,
});
if (response.status === 401) return null;
if (response.status === 401) {
return null;
}
if (response.status !== 200 && response.status !== 202) {
throw new Error(`HTTP error! status: ${response.status}`);
@@ -77,7 +79,7 @@ export class Api {
async fetch<ReqBody, ResBody>(
path: string,
data: ReqBody,
options: FetchOptions = {},
options: FetchOptions = {}
): Promise<ResBody | null> {
const url = `${this.baseUrl}${path}`;
return this.post<ReqBody, ResBody>(url, data, options, 0);

View File

@@ -1,3 +1,3 @@
export * from './src/index';
export * from './src/types.d';
export { getInitSnippet } from './src/init-snippet';
export * from './src/types.d';

View File

@@ -1,2 +1,2 @@
export { startReplayRecorder, stopReplayRecorder } from './recorder';
export type { ReplayChunkPayload, ReplayRecorderConfig } from './recorder';
export { startReplayRecorder, stopReplayRecorder } from './recorder';

View File

@@ -26,7 +26,7 @@ let stopRecording: (() => void) | null = null;
export function startReplayRecorder(
config: ReplayRecorderConfig,
sendChunk: (payload: ReplayChunkPayload) => void,
sendChunk: (payload: ReplayChunkPayload) => void
): void {
if (typeof document === 'undefined' || typeof window === 'undefined') {
return;
@@ -46,7 +46,9 @@ export function startReplayRecorder(
let flushTimer: ReturnType<typeof setInterval> | null = null;
function flush(isFullSnapshot: boolean): void {
if (buffer.length === 0) return;
if (buffer.length === 0) {
return;
}
const payloadJson = JSON.stringify(buffer);
const payloadBytes = new TextEncoder().encode(payloadJson).length;
@@ -111,12 +113,15 @@ export function startReplayRecorder(
checkoutEveryNms: flushIntervalMs,
maskAllInputs: config.maskAllInputs ?? true,
maskTextSelector: maskAllText ? '*' : '[data-openpanel-replay-mask]',
maskTextFn: maskAllText && unmaskTextSelector
? (text, element) => {
if (element?.closest(unmaskTextSelector)) return text;
return text.replace(/\S/g, '*');
}
: undefined,
maskTextFn:
maskAllText && unmaskTextSelector
? (text, element) => {
if (element?.closest(unmaskTextSelector)) {
return text;
}
return text.replace(/\S/g, '*');
}
: undefined,
blockSelector: config.blockSelector ?? '[data-openpanel-replay-block]',
blockClass: config.blockClass,
ignoreSelector: config.ignoreSelector,

View File

@@ -38,7 +38,7 @@ import { OpenPanel } from './index';
// Otherwise return the property from op (for things like options, etc.)
return value;
},
},
}
);
window.op = opCallable;