@quikturn/logos-react 1.1.1 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -45,6 +45,16 @@ function fireBeacon(token) {
45
45
  const img = new Image();
46
46
  img.src = `${logos.BASE_URL}/_beacon?token=${token}&page=${encodeURIComponent(location.href)}`;
47
47
  }
48
+
49
+ // src/validate-href.ts
50
+ function isValidHref(href) {
51
+ try {
52
+ const url = new URL(href, "https://placeholder.invalid");
53
+ return url.protocol === "https:" || url.protocol === "http:";
54
+ } catch {
55
+ return false;
56
+ }
57
+ }
48
58
  function QuikturnLogo({
49
59
  domain,
50
60
  token,
@@ -88,7 +98,7 @@ function QuikturnLogo({
88
98
  onLoad
89
99
  }
90
100
  );
91
- if (href) {
101
+ if (href && isValidHref(href)) {
92
102
  return /* @__PURE__ */ jsxRuntime.jsx(
93
103
  "a",
94
104
  {
@@ -316,7 +326,7 @@ function DefaultLogoItem({
316
326
  style: imgStyle
317
327
  }
318
328
  );
319
- if (logo.href) {
329
+ if (logo.href && isValidHref(logo.href)) {
320
330
  return /* @__PURE__ */ jsxRuntime.jsx(
321
331
  "a",
322
332
  {
@@ -626,7 +636,7 @@ function QuikturnLogoGrid({
626
636
  alignItems: "center",
627
637
  justifyContent: "center"
628
638
  },
629
- children: logo.href ? /* @__PURE__ */ jsxRuntime.jsx(
639
+ children: logo.href && isValidHref(logo.href) ? /* @__PURE__ */ jsxRuntime.jsx(
630
640
  "a",
631
641
  {
632
642
  href: logo.href,
@@ -673,3 +683,4 @@ exports.QuikturnLogoCarousel = QuikturnLogoCarousel;
673
683
  exports.QuikturnLogoGrid = QuikturnLogoGrid;
674
684
  exports.QuikturnProvider = QuikturnProvider;
675
685
  exports.useLogoUrl = useLogoUrl;
686
+ exports.useQuikturnContext = useQuikturnContext;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { SupportedOutputFormat, FormatShorthand, ThemeOption } from '@quikturn/logos';
3
+ export { FormatShorthand, SupportedOutputFormat, ThemeOption } from '@quikturn/logos';
3
4
  import React$1 from 'react';
4
5
 
5
6
  /** Options that control logo image generation. */
@@ -84,6 +85,11 @@ interface QuikturnProviderProps {
84
85
  children: React.ReactNode;
85
86
  }
86
87
 
88
+ interface QuikturnContextValue {
89
+ token: string;
90
+ baseUrl?: string;
91
+ }
92
+ declare function useQuikturnContext(): QuikturnContextValue | null;
87
93
  declare function QuikturnProvider({ token, baseUrl, children, }: QuikturnProviderProps): react_jsx_runtime.JSX.Element;
88
94
 
89
95
  declare function useLogoUrl(domain: string, options?: LogoOptions & {
@@ -97,4 +103,4 @@ declare const QuikturnLogoCarousel: React$1.NamedExoticComponent<QuikturnLogoCar
97
103
 
98
104
  declare function QuikturnLogoGrid({ domains, logos, token, baseUrl, columns, gap, logoSize, logoFormat, logoGreyscale, logoTheme, renderItem, className, style, ariaLabel, }: QuikturnLogoGridProps): react_jsx_runtime.JSX.Element;
99
105
 
100
- export { type LogoConfig, type LogoOptions, QuikturnLogo, QuikturnLogoCarousel, type QuikturnLogoCarouselProps, QuikturnLogoGrid, type QuikturnLogoGridProps, type QuikturnLogoProps, QuikturnProvider, type QuikturnProviderProps, type ResolvedLogo, useLogoUrl };
106
+ export { type LogoConfig, type LogoOptions, QuikturnLogo, QuikturnLogoCarousel, type QuikturnLogoCarouselProps, QuikturnLogoGrid, type QuikturnLogoGridProps, type QuikturnLogoProps, QuikturnProvider, type QuikturnProviderProps, type ResolvedLogo, useLogoUrl, useQuikturnContext };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { SupportedOutputFormat, FormatShorthand, ThemeOption } from '@quikturn/logos';
3
+ export { FormatShorthand, SupportedOutputFormat, ThemeOption } from '@quikturn/logos';
3
4
  import React$1 from 'react';
4
5
 
5
6
  /** Options that control logo image generation. */
@@ -84,6 +85,11 @@ interface QuikturnProviderProps {
84
85
  children: React.ReactNode;
85
86
  }
86
87
 
88
+ interface QuikturnContextValue {
89
+ token: string;
90
+ baseUrl?: string;
91
+ }
92
+ declare function useQuikturnContext(): QuikturnContextValue | null;
87
93
  declare function QuikturnProvider({ token, baseUrl, children, }: QuikturnProviderProps): react_jsx_runtime.JSX.Element;
88
94
 
89
95
  declare function useLogoUrl(domain: string, options?: LogoOptions & {
@@ -97,4 +103,4 @@ declare const QuikturnLogoCarousel: React$1.NamedExoticComponent<QuikturnLogoCar
97
103
 
98
104
  declare function QuikturnLogoGrid({ domains, logos, token, baseUrl, columns, gap, logoSize, logoFormat, logoGreyscale, logoTheme, renderItem, className, style, ariaLabel, }: QuikturnLogoGridProps): react_jsx_runtime.JSX.Element;
99
105
 
100
- export { type LogoConfig, type LogoOptions, QuikturnLogo, QuikturnLogoCarousel, type QuikturnLogoCarouselProps, QuikturnLogoGrid, type QuikturnLogoGridProps, type QuikturnLogoProps, QuikturnProvider, type QuikturnProviderProps, type ResolvedLogo, useLogoUrl };
106
+ export { type LogoConfig, type LogoOptions, QuikturnLogo, QuikturnLogoCarousel, type QuikturnLogoCarouselProps, QuikturnLogoGrid, type QuikturnLogoGridProps, type QuikturnLogoProps, QuikturnProvider, type QuikturnProviderProps, type ResolvedLogo, useLogoUrl, useQuikturnContext };
package/dist/index.mjs CHANGED
@@ -39,6 +39,16 @@ function fireBeacon(token) {
39
39
  const img = new Image();
40
40
  img.src = `${BASE_URL}/_beacon?token=${token}&page=${encodeURIComponent(location.href)}`;
41
41
  }
42
+
43
+ // src/validate-href.ts
44
+ function isValidHref(href) {
45
+ try {
46
+ const url = new URL(href, "https://placeholder.invalid");
47
+ return url.protocol === "https:" || url.protocol === "http:";
48
+ } catch {
49
+ return false;
50
+ }
51
+ }
42
52
  function QuikturnLogo({
43
53
  domain,
44
54
  token,
@@ -82,7 +92,7 @@ function QuikturnLogo({
82
92
  onLoad
83
93
  }
84
94
  );
85
- if (href) {
95
+ if (href && isValidHref(href)) {
86
96
  return /* @__PURE__ */ jsx(
87
97
  "a",
88
98
  {
@@ -310,7 +320,7 @@ function DefaultLogoItem({
310
320
  style: imgStyle
311
321
  }
312
322
  );
313
- if (logo.href) {
323
+ if (logo.href && isValidHref(logo.href)) {
314
324
  return /* @__PURE__ */ jsx(
315
325
  "a",
316
326
  {
@@ -620,7 +630,7 @@ function QuikturnLogoGrid({
620
630
  alignItems: "center",
621
631
  justifyContent: "center"
622
632
  },
623
- children: logo.href ? /* @__PURE__ */ jsx(
633
+ children: logo.href && isValidHref(logo.href) ? /* @__PURE__ */ jsx(
624
634
  "a",
625
635
  {
626
636
  href: logo.href,
@@ -662,4 +672,4 @@ function QuikturnLogoGrid({
662
672
  );
663
673
  }
664
674
 
665
- export { QuikturnLogo, QuikturnLogoCarousel, QuikturnLogoGrid, QuikturnProvider, useLogoUrl };
675
+ export { QuikturnLogo, QuikturnLogoCarousel, QuikturnLogoGrid, QuikturnProvider, useLogoUrl, useQuikturnContext };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quikturn/logos-react",
3
- "version": "1.1.1",
3
+ "version": "1.2.1",
4
4
  "description": "React components for the Quikturn Logos API — QuikturnLogo, LogoCarousel, LogoGrid",
5
5
  "license": "MIT",
6
6
  "author": "Quikturn",
@@ -22,23 +22,45 @@
22
22
  "publishConfig": {
23
23
  "access": "public"
24
24
  },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://github.com/Quikturn-PowerPoint-Add-In/Logo-SDK.git",
28
+ "directory": "packages/react"
29
+ },
30
+ "bugs": {
31
+ "url": "https://github.com/Quikturn-PowerPoint-Add-In/Logo-SDK/issues"
32
+ },
33
+ "homepage": "https://github.com/Quikturn-PowerPoint-Add-In/Logo-SDK/tree/main/packages/react#readme",
34
+ "keywords": [
35
+ "quikturn",
36
+ "logos",
37
+ "react",
38
+ "company-logos",
39
+ "brand-assets"
40
+ ],
41
+ "engines": {
42
+ "node": ">=20"
43
+ },
25
44
  "files": [
26
45
  "dist",
27
- "package.json"
46
+ "LICENSE",
47
+ "README.md"
28
48
  ],
29
49
  "scripts": {
30
50
  "build": "tsup",
31
51
  "test": "vitest run",
32
52
  "test:watch": "vitest",
33
- "typecheck": "tsc --noEmit"
53
+ "typecheck": "tsc --noEmit",
54
+ "lint": "eslint src/ tests/"
55
+ },
56
+ "dependencies": {
57
+ "@quikturn/logos": "workspace:^"
34
58
  },
35
59
  "peerDependencies": {
36
- "@quikturn/logos": ">=0.1.0",
37
60
  "react": ">=18",
38
61
  "react-dom": ">=18"
39
62
  },
40
63
  "devDependencies": {
41
- "@quikturn/logos": "workspace:*",
42
64
  "@semantic-release/changelog": "^6.0.3",
43
65
  "@semantic-release/git": "^10.0.1",
44
66
  "@testing-library/jest-dom": "^6.6.3",