Sleamhnú go príomh-ábhar

Ionchorprú Sínitheoir Legalesign i do Láithreán Gréasáin

Cumas do do fhoireann

Tá ghné an Sínitheora daonna ag teastáil. Déan teagmháil leis an tacaíocht chun é a chumasú do do fhoireann.

Leagan reatha: v1.1.9 — log athruithe

Is comhpháirt gréasáin neodrach ó thaobh hardáin de é an Sínitheoir Legalesign a sholáthraíonn taithí sínithe doiciméad iomlán agus réidh ón taobh istigh den aip féin. Oibríonn sé le HTML amh, React, Vue, Angular, nó aon fhráma gréasáin.

Cuimhnigh an chomhpháirt seo áit ar bith a bhfuil gá ag do úsáideoirí le doiciméid a shíniú — laistigh de CRM, tairseach chustaiméara, nó aon aip inmheánach a dhéanann HTML a léiriú.

Suiteáil​

Lódáil go díreach ón CDN (ní gá suiteáil):

<script type="module" src="https://cdn.legalesign.io/signer/latest/ls-signer.esm.js"></script>

Suiteáil React​

Suiteáil trí bhainisteoir pacáiste:

npm install legalesign-signer
# or
pnpm add legalesign-signer

Comhtháthú Bunúsach​

HTML & JavaScript​

<ls-signer
recipient-id="abc123"
private-key="key"
session-id="session"
></ls-signer>

<script>
const signer = document.querySelector('ls-signer');
signer.addEventListener('signingSuccess', (e) => console.log('Signed:', e.detail.eventType, e.detail.documentId));
signer.addEventListener('signingFail', (e) => console.error('Failed:', e.detail.failureReason, e.detail.error));
signer.addEventListener('fieldChange', (e) => console.log('Field event:', e.detail.eventType));
</script>

React​

import { useEffect, useState } from 'react';
import { LsSigner } from 'legalesign-signer/react';
import 'legalesign-signer/react.css';

function SigningPage() {
const [signerData, setSignerData] = useState(null);

useEffect(() => {
fetch('/your-backend/to-get-token')
.then(res => res.json())
.then(setSignerData);
}, []);

if (!signerData) return <p>Loading...</p>;

return (
<LsSigner
recipientId={signerData.recipientId}
privateKey={signerData.token}
sessionId={signerData.sessionId}
onSuccess={({ eventType, documentId }) => console.log(eventType, documentId)}
onFail={({ eventType, failureReason, error }) => console.error(eventType, failureReason, error)}
onChange={({ eventType, uuid, saved, field, document }) => console.log('Event:', eventType)}
/>
);
}

Éilíonn React react agus react-dom (v18 nó v19) mar shpleácha comhtháite.

Vue​

<template>
<ls-signer
ref="signer"
:recipient-id="recipientId"
:private-key="privateKey"
:session-id="sessionId"
/>
</template>

<script setup>
import { ref, onMounted, onBeforeUnmount } from 'vue';

const signer = ref(null);

function handleSuccess(e) {
console.log('Signed:', e.detail);
}
function handleFail(e) {
console.error('Failed:', e.detail);
}

onMounted(() => {
signer.value.addEventListener('signingSuccess', handleSuccess);
signer.value.addEventListener('signingFail', handleFail);
});

onBeforeUnmount(() => {
signer.value?.removeEventListener('signingSuccess', handleSuccess);
signer.value?.removeEventListener('signingFail', handleFail);
});
</script>
leide

Má úsáidtear Vue le Vite, cuir isCustomElement: (tag) => tag.startsWith('ls-') le do chumraíocht breiseáin Vue chun foláirimh faoi eilimintí anaithnid a sheachaint.

rabhadh

I Vue 3, íoslaghdaítear ainmneacha imeachtaí ar eilimintí saincheaptha, mar sin ní oibreoidh @signingSuccess. Bain úsáid as addEventListener ar an gcruthúnas eilimint mar a léirítear thuas.

Nuxt 3

Croch <ls-signer> i <ClientOnly> chun earráidí SSR a sheachaint. Cuir an chumraíocht eilimint shaincheaptha i nuxt.config.ts:

export default defineNuxtConfig({
vue: {
compilerOptions: {
isCustomElement: (tag) => tag.startsWith('ls-'),
},
},
});

Fíordheimhniú​

Teastaíonn ticéad gearrshaoil ón taobh thall den fhreastalaí don chomhpháirt sínitheora. Tá dhá rogha ann:

  1. GraphQL generateComponentToken — Glaoigh leis le component: LS_SIGNER agus nó recipientId nó sessionId sa scóip sínitheora (soláthraigh ceann amháin, ní beirt).
  2. REST API — Glaoigh GET /signer/{signerId}/component-token/ le do eochair API.

Tugann an beirt seo an token agus sessionId atá ag teastáil ón gcomhpháirt. Féach ar Údarú Widget don sreabhadh iomlán ticéad ar an taobh freastalaí.

Rogha 1: GraphQL (Node.js)​

Agus ag baint úsáide as recipientId (an ceann is coitianta — úsáid nuair atá a fhios agat cé hé an faighteoir ach nach bhfuil aon seisiún agat fós):

const response = await fetch('https://graphql.uk.legalesign.com/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${process.env.LEGALESIGN_API_KEY}`,
},
body: JSON.stringify({
query: `mutation MintSignerToken($input: GenerateComponentTokenInput!) {
generateComponentToken(input: $input) {
token
tokenType
sessionId
expiresIn
expiresAt
}
}`,
variables: {
input: {
component: 'LS_SIGNER',
signer: { recipientId: '<recipient-id>' }
}
}
})
});

const { data } = await response.json();
const { token, sessionId } = data.generateComponentToken;

Ar an lámh eile, má tá sessionId agat cheana ó ghlao roimhe seo:

variables: {
input: {
component: 'LS_SIGNER',
signer: { sessionId: '<session-id>' }
}
}

Rogha 2: REST API​

const response = await fetch(
`https://eu-api.legalesign.com/api/v1/signer/${signerId}/component-token/`,
{
headers: {
Authorization: `Bearer ${process.env.LEGALESIGN_API_KEY}`,
},
}
);

const { token, sessionId } = await response.json();

Pasáil token mar private-key agus sessionId mar session-id chuig an gcomhpháirt.

Tréithe Riachtanacha​

TréithCineálCur Síos
recipient-idstringAitheantóir faighteora (base64, tosaíocht rec, nó UUID)
private-keystringTicéad ar ais ón generateComponentToken
session-idstringAitheantóir seisiúin ar ais ón generateComponentToken

Tréithe Roghnach​

TréithCineálRéamhshocraitheCur Síos
colourstringblueAinm dath téama (féach Téamáil)
stylestring``Athruithe stíle (féach CSS Custaiméara)
brandingbooleantrueLéirigh mbranda Legalesign. Socraigh mar false chun é a bhaint.
languagestring—Dírigh a bhaint as teanga ar leith agus cuir cosc ar an lasc teanga (féach Idirnáisiúnú)

Imeachtaí​

Airí ReactImeacht comhpháirt gréasáineventTypeCathain
onSuccesssigningSuccess"success"Doiciméad sínithe go rathúil
onFailsigningFail"failure"Teip ar shíniú an doiciméid, diúltaíodh dó, éagtha, cealaithe, scriosta, bainte, nó críochnaithe cheana i gcineál eile
onChangefieldChange"ready"Doiciméad agus íomhánna leathanach luchtaithe go hiomlán
onChangefieldChange"save"Luach réimse sábháilte
onChangefieldChange"select"Roghnaíodh nó díríodh réimse

onSuccess / signingSuccess​

Scaoiltear nuair a shíneann an faighteoir an doiciméad go rathúil.

{
eventType: 'success';
documentId: string; // UUID of the signed document
recipientId: string; // UUID of the recipient
}

React:

<LsSigner
onSuccess={({ eventType, documentId, recipientId }) => {
console.log(eventType); // "success"
console.log(documentId);
console.log(recipientId);
}}
/>

Comhpháirt Gréasáin:

signer.addEventListener('signingSuccess', (e) => {
console.log(e.detail.eventType); // "success"
console.log(e.detail.documentId);
console.log(e.detail.recipientId);
});

onFail / signingFail​

Scaoiltear nuair a theipeann ar an síniú — mar gheall ar dhiúltaigh doiciméad nó earráid i rith an tsíniú (m.sh. earráid líonra, seisiún éagtha, coinbhleacht staid doiciméid).

{
eventType: 'failure';
failureReason: FailureReason;
error: string; // Human-readable error message
documentId?: string; // UUID of the document (if available)
recipientId: string; // UUID of the recipient
}
failureReasonCúis
documentExpiredStádas doiciméid "expired" nó dáta expires san am atá caite
sessionExpiredRinne API freagra 401 nó 403 nuair a bhí an doiciméad á luchtú
cancelledStádas doiciméid "cancelled"
deletedBrat is_deleted an doiciméid ina lánmhír
rejectedDíoltar an doiciméad ag an bhfaighteoir (is_rejected ina fíor)
removedFuair API 404 — níl an doiciméad ann níos mó
documentCompletedD'fhill an API sínithe le completed — bhí an doiciméad sínithe cheana, is dóichí i mbrabhsálaí nó gléas eile. Taispeánann an comhpháirt teachtaireacht faisnéise don fhaighteoir seachas earráid.
signingErrorAon earráid eile le linn luchtaithe nó sínithe

React:

<LsSigner
onFail={({ eventType, failureReason, error, documentId, recipientId }) => {
console.log(eventType); // "failure"
console.log(failureReason); // e.g. "documentExpired"
console.log(error);
}}
/>

Comhpháirt Gréasáin:

signer.addEventListener('signingFail', (e) => {
console.log(e.detail.eventType); // "failure"
console.log(e.detail.failureReason); // e.g. "documentExpired"
console.log(e.detail.error);
});

onChange / fieldChange​

Roinnt gach de na luachanna eventType an t-imeacht céanna. Bain úsáid as eventType chun idirdhealú a dhéanamh.

eventType: "ready"​

Scaoiltear uair amháin nuair atá an doiciméad agus gach íomhá leathanach luchtaithe go hiomlán agus tá an comhéadan sínithe réidh le húsáid.

{
eventType: 'ready';
document: {
documentId: string; // UUID of the document
name: string; // Document name
state: string; // Document state (e.g. "signing")
recipientId: string; // UUID of the recipient
recipientRole?: string; // Role of the recipient (e.g. "witness")
pageCount: number; // Number of pages
expires?: string; // Expiry date (ISO string, if set)
isApprover: boolean; // Whether the recipient is an approver
isWitness: boolean; // Whether the recipient is a witness
canReassign: boolean; // Whether the recipient can reassign
doOfferReject: boolean; // Whether the reject option is shown
};
}

React:

<LsSigner
onChange={({ eventType, document }) => {
if (eventType === 'ready') {
console.log('Ready to sign:', document.documentId, document.name);
console.log('Pages:', document.pageCount);
console.log('Expires:', document.expires);
}
}}
/>

Comhpháirt Gréasáin:

signer.addEventListener('fieldChange', (e) => {
if (e.detail.eventType === 'ready') {
console.log('Ready to sign:', e.detail.document.documentId, e.detail.document.name);
}
});

eventType: "save"​

Scaoiltear tar éis luach réimse a shábháil ar an bhfreastalaí.

{
eventType: 'save';
uuid: string; // UUID of the field
saved: boolean; // Whether the save was successful
field: Record<string, any>; // Full field object (see Field Properties below)
}

React:

<LsSigner
onChange={({ eventType, uuid, saved, field }) => {
if (eventType === 'save') {
console.log(uuid, saved, field.value);
}
}}
/>

Comhpháirt Gréasáin:

signer.addEventListener('fieldChange', (e) => {
if (e.detail.eventType === 'save') {
console.log(e.detail.uuid, e.detail.saved, e.detail.field.value);
}
});

eventType: "select"​

Scaoiltear nuair a roghnaítear nó a dhírítear ar réimse — spreagtha ag cliceáil úsáideora, nascleanúint méarchláir, aiséascadh uathoibríoch, nó idirghníomhú taobhraon.

{
eventType: 'select';
uuid: string; // UUID of the selected field
field: Record<string, any>; // Full field object (see Field Properties below)
}

React:

<LsSigner
onChange={({ eventType, uuid, field }) => {
if (eventType === 'select') {
console.log('selected', uuid, field.fieldtype);
}
}}
/>

Comhpháirt Gréasáin:

signer.addEventListener('fieldChange', (e) => {
if (e.detail.eventType === 'select') {
console.log('selected', e.detail.uuid, e.detail.field.fieldtype);
}
});

Airíonna Réimse​

Cuimsíonn an réad field san imeachtaí save agus select na hairíonna seo a leanas:

AiríCineálCur Síos
uuidstringAitheantóir réimse uathúil
fieldtypestringCineál réimse (m.sh. "text", "signature", "date", "checkbox")
valuestringLuach reatha an réimse
statebooleanAn bhfuil an réimse sábháilte go rathúil
optionalbooleanAn bhfuil an réimse roghnach
pagenumberUimhir an leathanaigh ina bhfuil an réimse
labelstringLipéad an réimse (más socraithe)
validationnumberCód cineál bailíochtaithe
logicactionstringCineál gnímh loighic ("1" = raidió, "2" = suim, "3" = coinníollach)
logicgroupstringAitheantóir grúpa loighic
maptostringGrúpa sprioc do loighic (réimsí rialaithe)
autobooleanAn bhfuil an réimse líonta go huathoibríoch
dirtybooleanAn bhfuil athruithe áitiúla neamhshábháilte ar an réimse

Airí React​

Úsáideann an comhpháirt React airí camelCase agus airí glaonna ar ais in áit imeachtaí DOM:

AiríCineálRiachtanachCur Síos
recipientIdstring✅Aitheantóir faighteora
privateKeystring✅Eochair phríobháideach ón míniúchán generateComponentToken
sessionIdstring✅Aitheantóir seisiúin
colourLsSignerColour❌Dath téama
brandingboolean❌Léirigh mbranda Legalesign. Réamhshocraithe ar true.
languagestring❌Dírigh ar theanga ar leith (féach Idirnáisiúnú)
onSuccess(data: { eventType: 'success'; documentId: string; recipientId: string }) => void❌Glaoitear ar shíniú rathúil
onFail(data: { eventType: 'failure'; failureReason: FailureReason; error: string; documentId?: string; recipientId: string }) => void❌Glaoitear ar theip ar shíniú
onChange(data: { eventType: 'ready' | 'save' | 'select'; document?: DocumentSummary; uuid?: string; saved?: boolean; field?: Record<string, any> }) => void❌Glaoitear ar imeachtaí réimse agus doiciméad réidh

Láimhseálaí catch-all (le haghaidh dífhabhtaithe & protótipíochta)​

Ós rud é go bhfuil eventType ag gach imeacht, is féidir feidhm amháin a nascadh le gach imeacht:

React:

const handleSignerEvent = (e) => {
switch (e.eventType) {
case 'success': console.log('Signed:', e.documentId); break;
case 'failure': console.log('Failed:', e.failureReason, e.error); break;
case 'ready': console.log('Ready:', e.document?.name); break;
case 'save': console.log('Saved field:', e.uuid, e.saved); break;
case 'select': console.log('Selected field:', e.uuid); break;
}
};

<LsSigner
onSuccess={handleSignerEvent}
onFail={handleSignerEvent}
onChange={handleSignerEvent}
/>

Comhpháirt Gréasáin:

const handleSignerEvent = (e) => {
switch (e.detail.eventType) {
case 'success': console.log('Signed:', e.detail.documentId); break;
case 'failure': console.log('Failed:', e.detail.failureReason, e.detail.error); break;
case 'ready': console.log('Ready:', e.detail.document?.name); break;
case 'save': console.log('Saved field:', e.detail.uuid, e.detail.saved); break;
case 'select': console.log('Selected field:', e.detail.uuid); break;
}
};

signer.addEventListener('signingSuccess', handleSignerEvent);
signer.addEventListener('signingFail', handleSignerEvent);
signer.addEventListener('fieldChange', handleSignerEvent);

Téamáil​

Socraigh téama dath leis an airí colour. Déantar gach toin a dhíorthaítear go huathoibríoch.

Dathanna Ar Fáil​

pink · blue · purple · indigo · teal · green · lightblue · burnt · aubergine · red · yellow · cyan · lime · trueGreen

Fág an airí gan a shonrú chun an gorm réamhshocraithe a fháil.

<ls-signer colour="pink" ...></ls-signer>
<LsSigner colour="pink" ... />

Cuireann an airí colour tréith data-ls-theme ar bhunús na comhpháirte. Sainmhíníonn sainairíonna saincheaptha CSS scála toin 10–100 do gach dath:

ToíneachÚsáid
10Cúlraí éadroma, líonta mín
20Scáileanna mín
30Fáinní fócasacha
60Dath príomhúil (cnaipeanna, naisc, stáit gníomhacha)
70Staid léimneach
80Béim dhorcha/láidir

CSS Custaiméara​

Cuireann an comhpháirt sainairíonna saincheaptha CSS ar fáil a bhféadfar iad a shárú chun cuma a shaincheapadh thar ceann an téama dath. Tá an tacar seo d’airíonna teoranta faoi láthair, déan teagmháil linn más mian leat níos mó sonraí.

<ls-signer
style="--ls-font-family: 'Inter', sans-serif; --ls-color-primary-60: #e91e63;"
recipient-id="abc123"
private-key="key"
session-id="session"
></ls-signer>

Airíonna Ar Fáil​

AiríRéamhshocraitheCur Síos
--ls-font-family'IBM Plex Sans', sans-serifPríomhtheaghlach cló
--ls-color-primary-10 go --ls-color-primary-100—Scála dath príomhúil iomlán (ag sárú téama)
--ls-color-error#f64a44Dath stáit earráide
--ls-color-error-light#fff0f0Cúlra earráide
--ls-color-success#46dbaaDath stáit rath
--ls-color-success-light#effff9Cúlra rath
--ls-color-warning#fad232Dath stáit rabhaidh
--ls-color-warning-light#fffcefCúlra rabhaidh
--ls-color-border#d8d9dcDath scáile réamhshocraithe
--ls-color-border-subtle#e0e2e5Dath scáile mín
--ls-color-bg-subtle#f7f8faDath cúlra mín

Nóta: Chun insliú lánchuspóireach CSS (ag díriú ar eilimintí inmheánacha go díreach, ag sárú méideanna cló, raon scáileáin, spásáil, srl.), tá gné beartaithe sa todhchaí. Déan teagmháil linn má tá suim agat (déan teagmháil).

Idirnáisiúnú​

Tacaíonn an comhpháirt le 17 teanga le haistriúcháin uilechuimsitheacha san fhoinse. Braitear teanga go huathoibríoch ón mbrabhsálaí. Cuireann lasc teanga ionsuite sa UI sínithe cead don fhaighteoir an teanga a athrú aon uair is mian leis.

Socraigh an tréith language chun teanga ar leith a fhorsú. Nuair a sholáthraítear é seo, cuirtear an lasc teanga ionsuite i bhfolach agus seachnaítear braiteacht bhrabhsálaí.

<ls-signer language="fr" recipient-id="abc123" private-key="key" session-id="session"></ls-signer>
<LsSigner language="fr" recipientId="abc123" privateKey="key" sessionId="session" />

Ord tosaíochta: airí language → teanga an bhrabhsálaí → Béarla mar shocrú ar fhillteán.

CódTeangaCódTeanga
enBéarlanlOllainnis
frFraincisfiFionlainnis
bgBulgáirisitIodáilis
esSpáinnisheEabhrais
deGearmáinissvSualainnis
gsGàidhlig na h-AlbacyBhreatnais
arAraibisisÍoslainnis
elGréigisiwEabhrais (dána)
ptPortaingéilis
roRómáinis

Leaganú CDN​

Tacaíonn URL an CDN le leathanaigh nuashonraithe agus leaganacha sgrommuillithe araon:

<!-- Always get the most recent version (recommended) -->
<script type="module" src="https://cdn.legalesign.io/signer/latest/ls-signer.esm.js"></script>

<!-- Pin to a specific version -->
<script type="module" src="https://cdn.legalesign.io/signer/v1.1.9/ls-signer.esm.js"></script>

Molaimid úsáid a bhaint as latest — cinntíonn sé seo go bhfaigheann do chomhtháthú deisiúcháin fabhtanna, paistí slándála, agus gnéithe nua go huathoibríoch. Úsáid leagan sgrommuillithe má tá sé riachtanach greamaigh leagan a bhfuil cloí iomlán leis le linn fuarú QA nó scaoileadh rialaithe. Féach ar an stair iomlán leaganacha ar npm do na leaganacha atá ar fáil.

Sampla Iomlán​

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document Signing</title>
<script type="module" src="https://cdn.legalesign.io/signer/latest/ls-signer.esm.js"></script>
</head>
<body>
<ls-signer
recipient-id="abc123"
private-key="key"
session-id="session"
colour="teal"
></ls-signer>

<script>
const signer = document.querySelector('ls-signer');

signer.addEventListener('signingSuccess', (event) => {
console.log('Document signed:', event.detail.documentId);
window.location.href = '/thank-you';
});

signer.addEventListener('signingFail', (event) => {
console.error('Signing failed:', event.detail.failureReason, event.detail.error);
});

signer.addEventListener('fieldChange', (event) => {
if (event.detail.eventType === 'ready') {
console.log('Ready to sign:', event.detail.document.name);
}
});
</script>
</body>
</html>

Tacaíocht Brabhsálaí​

  • Chrome/Edge (leagan is déanaí)
  • Firefox (leagan is déanaí)
  • Safari (leagan is déanaí)
  • Brabhsálaithe soghluaiste (iOS Safari, Chrome Mobile)

Log Athruithe​

LeaganDátaAchoimre
v1.1.93 Samh 2026Feabhsuithe ar láimhseáil earráide agus bailíochtú isteach nuair a shábhálann faighteoir sonraí fianaise
v1.1.82 Samh 2026Nuashonruithe aistriúcháin do na 17 theanga tacaíochta go léir
v1.1.720 Deireadh Fómhair 2026Cúis theip documentCompleted; feabhsuithe sábhála réimse; ceartúcháin suímh; feabhsuithe ghabháil imeachtaí teipe
v1.1.022 Iúil 2026Imeacht onChange / fieldChange; airí language; réimsí coinníollacha; léim uathoibríoch; QES
v1.0.1220 Iúil 2026Imeacht onChange / fieldChange le ready, save, select; luachanna failureReason; bailíochtú astuairisce
v1.0.1115 Iúil 2026Airí language; réimsí coinníollacha, titim síos, bosca seiceála; ionchur gutháin; ordú réimsí
v1.0.69 Meitheamh 2026Airí branding curtha leis
v1.0.315 Bealtaine 2026Airí colour; sainairíonna saincheaptha CSS; deisiúcháin fabhtanna
v1.0.011 Bealtaine 2026Scaoileadh cobhsaí tosaigh

Acmhainní​

Físeán: Ag Aistriú ó iframe go dtí an Comhpháirt Sínitheora​