Run
for CDN version:
privo.lgs.run(data)
for NPM version:
import { getInstance } from "privo-lgs-sdk";
getInstance().run(data)
export interface LGSData {
consent?: LGSConsentRequest;
}
The user will be navigated to a corresponding entry window and forced to pass Age Estimation Flow.
LGSData entry parameters:
export interface LGSConsentRequest {
features?: string[] | undefined;
locale?: string | undefined;
granter: {
relation_type?: ConsentGranterRelationType | undefined;
attributes?: {
value?: string[] | undefined;
attribute_identifier: string;
}[] | undefined;
email?: string | undefined;
external_account_identifier?: string | undefined;
notifications?: {
notification_type: GranterNotification;
is_on: boolean;
}[] | undefined;
phone_number?: string | undefined;
sid?: string | undefined;
};
principal: {
attributes?: {
value?: string[] | undefined;
attribute_identifier: string;
}[] | undefined;
email?: string | undefined;
external_account_identifier?: string | undefined;
notifications?: {
notification_type: PrincipalNotification;
is_on: boolean;
}[] | undefined;
phone_number?: string | undefined;
sid?: string | undefined;
age_gate_identifier?: string | undefined;
gender?: string | null | undefined;
given_name?: string | undefined;
jurisdiction?: string | undefined;
birthdate?: string;
birthdate_precision?: BirthdatePrecision;
};
}
export enum BirthdatePrecision {
YYYYMMDD = "yyyymmdd",
YYYYMM = "yyyymm",
YYYY = "yyyy",
AGE = "age"
}
export enum ConsentGranterRelationType {
Mom = "mom",
Dad = "dad",
LegalGuardian = "legal_guardian",
Teacher = "teacher",
Unknown = "unknown"
}
export enum GranterNotification {
ConsentRequestEmail = "consent_request_email",
ConsentRequestSMS = "consent_request_sms",
ConsentApproveEmail = "consent_approved_email",
ConsentDeclineEmail = "consent_declined_email",
}
export enum PrincipalNotification {
ConsentApproveEmail = "consent_approved_email",
ConsentDeclineEmail = "consent_declined_email",
}
LGSConsentRequest explanation:
Result of invocation
privo.lgs.run(data)
will be provided in onStatusChange callback function.
privo.lgs.onStatusChange should be set before privo.lgs.run is invoked to get results. doc
Sample SDK Usage Example:
CDN:
privo.lgs.init({
serviceIdentifier
});
privo.lgs.onStatusChange((event) => {
// ...
});
// ...
privo.lgs.run({
// ...
});
NPM:
import { init, getInstance } from "privo-lgs-sdk";
const instance = await init({
serviceIdentifier,
}, "prod");
getInstance().onStatusChange((event) => {
// ...
});
// ...
getInstance().run({
// ...
});