Socket
Book a DemoInstallSign in
Socket

@typeface-ai/typeface-embed-react

Package Overview
Dependencies
Maintainers
2
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@typeface-ai/typeface-embed-react - npm Package Compare versions

Comparing version

to
0.9.4

10

lib/esm/model.d.ts

@@ -43,3 +43,3 @@ import { CelebrationsOutputStyle, GenerativeRefineContentType } from "./definitions";

description: string;
contentType: "List" | "Text";
contentType: "List" | "Text" | "ListDetailed";
default: string | string[];

@@ -200,2 +200,10 @@ }

export type TypefaceEmbedParameters = TemplateParameters | JobPostParameters | ImageParameters | AIChatParameters | FeedBlendParameters | CoPilotParamaters | AssetEditParameters | RefineParameters | Record<string, any>;
export interface ExternalRaiCheckOutput {
continue: boolean;
errorMessage?: string;
}
export interface ExternalRaiCheck {
promptCheck?: (prompt: string) => Promise<ExternalRaiCheckOutput>;
imageCheck?: (imageStr: string) => Promise<ExternalRaiCheckOutput>;
}
export {};

5

lib/esm/plugin-iframe.d.ts
import "./plugin-iframe.css";
import { TypefaceEmbedIDP, TypefaceEmbedOutputFormat, TypefaceEmbedParameters, TypefaceEmbedUseCase } from "./model";
import { ExternalRaiCheck, TypefaceEmbedIDP, TypefaceEmbedOutputFormat, TypefaceEmbedParameters, TypefaceEmbedUseCase } from "./model";
import React from "react";

@@ -23,3 +23,4 @@ import { OnEventMessage, TypefaceStyles } from "./definitions";

}
export declare const TypefacePluginIFrame: ({ idp, signOnUrl, typefaceOrigin, sourceApp, useCase, parameters, applyButtonName, onEvent, onApply, cancelButtonName, onCancel, styles, outputFormat, authenticate, hideHeader, language }: TypefacePluginIFrameProps) => React.JSX.Element;
type CombinedTypefacePluginIFrameProps = TypefacePluginIFrameProps & ExternalRaiCheck;
export declare const TypefacePluginIFrame: ({ idp, signOnUrl, typefaceOrigin, sourceApp, useCase, parameters, applyButtonName, onEvent, onApply, cancelButtonName, onCancel, styles, outputFormat, authenticate, hideHeader, language, promptCheck, imageCheck }: CombinedTypefacePluginIFrameProps) => React.JSX.Element;
interface TypefacePluginSpecificProps extends Omit<TypefacePluginIFrameProps, "signOnUrl" | "onEvent"> {

@@ -26,0 +27,0 @@ }

@@ -19,5 +19,5 @@ var __assign = (this && this.__assign) || function () {

export var TypefacePluginIFrame = function (_a) {
var idp = _a.idp, signOnUrl = _a.signOnUrl, typefaceOrigin = _a.typefaceOrigin, sourceApp = _a.sourceApp, useCase = _a.useCase, _b = _a.parameters, parameters = _b === void 0 ? {} : _b, applyButtonName = _a.applyButtonName, onEvent = _a.onEvent, onApply = _a.onApply, cancelButtonName = _a.cancelButtonName, onCancel = _a.onCancel, _c = _a.styles, styles = _c === void 0 ? {} : _c, outputFormat = _a.outputFormat, authenticate = _a.authenticate, _d = _a.hideHeader, hideHeader = _d === void 0 ? false : _d, language = _a.language;
var idp = _a.idp, signOnUrl = _a.signOnUrl, typefaceOrigin = _a.typefaceOrigin, sourceApp = _a.sourceApp, useCase = _a.useCase, _b = _a.parameters, parameters = _b === void 0 ? {} : _b, applyButtonName = _a.applyButtonName, onEvent = _a.onEvent, onApply = _a.onApply, cancelButtonName = _a.cancelButtonName, onCancel = _a.onCancel, _c = _a.styles, styles = _c === void 0 ? {} : _c, outputFormat = _a.outputFormat, authenticate = _a.authenticate, _d = _a.hideHeader, hideHeader = _d === void 0 ? false : _d, language = _a.language, promptCheck = _a.promptCheck, imageCheck = _a.imageCheck;
useEffect(function () {
var eventListener = registerMessageListener(onApply, onCancel, authenticate, undefined, onEvent, parameters);
var eventListener = registerMessageListener(onApply, onCancel, authenticate, undefined, onEvent, parameters, promptCheck, imageCheck);
return function () {

@@ -24,0 +24,0 @@ window.removeEventListener("message", eventListener);

import { TypefaceStyles, PreRenderContentRequest, RenderContentResponse, OnEventMessage } from "./definitions";
import { TypefaceEmbedIDP, TypefaceEmbedOutputFormat, TypefaceEmbedParameters, TypefaceEmbedUseCase } from "./model";
import { ExternalRaiCheckOutput, TypefaceEmbedIDP, TypefaceEmbedOutputFormat, TypefaceEmbedParameters, TypefaceEmbedUseCase } from "./model";
export declare const getEmbedUrl: (embedIdp: TypefaceEmbedIDP, useCase: TypefaceEmbedUseCase, signOnUrl: string | undefined, typefaceOrigin: string | undefined, sourceApp: string, applyButtonName: string | undefined, cancelButtonName: string | undefined, parameter: TypefaceEmbedParameters | undefined, outputFormat: TypefaceEmbedOutputFormat | undefined, authProvider: boolean, hideHeader: boolean, styles: TypefaceStyles | undefined, language: string | undefined) => string;
export declare const registerMessageListener: (onApply: (data: string) => void, onCancel: () => void, authenticate?: () => Promise<string>, preRender?: ((data: PreRenderContentRequest) => Promise<RenderContentResponse>) | undefined, onEvent?: ((event: OnEventMessage) => void) | undefined, parameters?: TypefaceEmbedParameters) => (e: MessageEvent) => void;
export declare const registerMessageListener: (onApply: (data: string) => void, onCancel: () => void, authenticate?: () => Promise<string>, preRender?: ((data: PreRenderContentRequest) => Promise<RenderContentResponse>) | undefined, onEvent?: ((event: OnEventMessage) => void) | undefined, parameters?: TypefaceEmbedParameters, promptCheck?: ((prompt: string) => Promise<ExternalRaiCheckOutput>) | undefined, imageCheck?: ((imageStr: string) => Promise<ExternalRaiCheckOutput>) | undefined) => (e: MessageEvent) => void;
export declare const shouldUsePopUpWindow: () => boolean;

@@ -127,5 +127,9 @@ import { BASE_URL, TemplateType, TypefaceEmbedIDP, TypefaceEmbedOutputFormat, TypefaceEmbedUseCase, } from "./model";

};
export var registerMessageListener = function (onApply, onCancel, authenticate, preRender, onEvent, parameters) {
export var registerMessageListener = function (onApply, onCancel, authenticate, preRender, onEvent, parameters, promptCheck, imageCheck) {
var handleMessage = function (e) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
var sendMessageBackToParent = function (messageObj) {
var _a;
(_a = e.source) === null || _a === void 0 ? void 0 : _a.postMessage(messageObj, { targetOrigin: e.origin });
};
if ([

@@ -154,11 +158,50 @@ "http://localhost:3000",

authenticate().then(function (token) {
var _a;
(_a = e.source) === null || _a === void 0 ? void 0 : _a.postMessage({ token: token }, { targetOrigin: e.origin });
sendMessageBackToParent({ token: token });
});
}
}
if (((_e = e.data) === null || _e === void 0 ? void 0 : _e.type) === "tf-pre-render") {
if (((_e = e.data) === null || _e === void 0 ? void 0 : _e.type) === "tf-embed-rai-prompt-check") {
if (promptCheck) {
promptCheck(e.data.data || "")
.then(function (val) {
sendMessageBackToParent(val);
})
.catch(function (err) {
sendMessageBackToParent({
continue: false,
errorMessage: err.message,
});
});
}
else {
sendMessageBackToParent({
continue: true,
errorMessage: "No promptCheck function found"
});
}
}
if (((_f = e.data) === null || _f === void 0 ? void 0 : _f.type) === "tf-embed-rai-image-check") {
if (imageCheck) {
imageCheck(e.data.data || "")
.then(function (val) {
sendMessageBackToParent(val);
})
.catch(function (err) {
sendMessageBackToParent({
continue: false,
errorMessage: err.message,
});
});
}
else {
sendMessageBackToParent({
continue: true,
errorMessage: "No imageCheck function found"
});
}
}
if (((_g = e.data) === null || _g === void 0 ? void 0 : _g.type) === "tf-pre-render") {
if (preRender) {
console.log("pre-rendering", (_f = e.data.data) === null || _f === void 0 ? void 0 : _f.block);
preRender((_g = e.data.data) === null || _g === void 0 ? void 0 : _g.block).then(function (block) {
console.log("pre-rendering", (_h = e.data.data) === null || _h === void 0 ? void 0 : _h.block);
preRender((_j = e.data.data) === null || _j === void 0 ? void 0 : _j.block).then(function (block) {
var _a;

@@ -170,7 +213,7 @@ (_a = e.source) === null || _a === void 0 ? void 0 : _a.postMessage({ block: block }, { targetOrigin: e.origin });

// Not configured.. Send back same message without formatting.
(_h = e.source) === null || _h === void 0 ? void 0 : _h.postMessage(e.data, { targetOrigin: e.origin });
(_k = e.source) === null || _k === void 0 ? void 0 : _k.postMessage(e.data, { targetOrigin: e.origin });
}
}
if (((_j = e.data) === null || _j === void 0 ? void 0 : _j.type) === "tf-embed-parameters") {
(_k = e.source) === null || _k === void 0 ? void 0 : _k.postMessage({ parameters: parameters, type: "tf-embed-parameters" }, { targetOrigin: e.origin });
if (((_l = e.data) === null || _l === void 0 ? void 0 : _l.type) === "tf-embed-parameters") {
(_m = e.source) === null || _m === void 0 ? void 0 : _m.postMessage({ parameters: parameters, type: "tf-embed-parameters" }, { targetOrigin: e.origin });
}

@@ -177,0 +220,0 @@ }

{
"name": "@typeface-ai/typeface-embed-react",
"version": "0.9.2",
"version": "0.9.4",
"description": "React SDK for Typeface Embed Integration",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -164,2 +164,8 @@ # React SDK for Typeface Embed

{
contentType: "ListDetailed",
description: "A list of responsibilities given the job family and level.",
name: "responsibilities",
title: "Responsibilities"
},
{
contentType: "List",

@@ -697,2 +703,4 @@ description: "Write good reasons to join us, about company's mission and culture.",

outputFormat: TypefaceEmbedOutputFormat.FEED_ITEMS,
promptCheck: (prompt: string) : Promise<{ continue: boolean, errorMessage: string }> => {},
imageCheck: (imageStr: string) : Promise<{ continue: boolean, errorMessage: string }> => {}
}

@@ -713,2 +721,4 @@ ```

outputFormat: TypefaceEmbedOutputFormat.FEED_ITEMS,
promptCheck: (prompt: string) : Promise<{ continue: boolean, errorMessage: string }> => {},
imageCheck: (imageStr: string) : Promise<{ continue: boolean, errorMessage: string }> => {}
}

@@ -715,0 +725,0 @@ ```

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.