Run

privo.ageGate.run(data)

interface CheckAgeData {
  userIdentifier?: string;
  birthDateYYYYMMDD?: string;
  birthDateYYYYMM?: string;
  birthDateYYYY?: string;
  age?: number;
  countryCode?: string;
}

The method runs the Age Gate check: if the birth date is passed or filled in by a user, the method will return the status "Undefined", "Blocked", "MultiUserBlocked", "AgeEstimationBlock", "Allowed", "Сanceled", "Pending", "ConsentRequired", "ConsentApproved", "ConsentDenied, " AgeVerificationRequired", "AgeVerified", "AgeBlocked", "IdentityVerificationRequired", "IdentityVerified", depending on the user’s age and set by a partner configuration parameters.

If the birth date is not passed, a user will be navigated to a corresponding entry window and forced to fill in the birthDate field. The new entry window has two display modes: Redirect and Popup. Display Mode Details

CheckAgeData entry parameters:

userIdentifier - optional field, external user identifier

birthDateYYYYMMDD - optional field, external user birth date in "yyyy-MM-dd" format
birthDateYYYYMM - optional field, external user birth date in "yyyy-MM" format
birthDateYYYY - optional field, external user birth date in "yyyy" format. Derived birthDate will be calculated with Dec 31 by default
age - optional field, external user age format. Derived birthDate will be calculated with current day and month by default

countryCode - optional field, two-letter country code (ISO 3166-1 alpha-2 Wiki).

Result of invocation privo.ageGate.run(data) will be provided in onStatusChange callback function.

privo.ageGate.onStatusChange(event => {}) should be set before privo.ageGate.run is invoked to get results. doc

Please check the Age Gate Status Description here

Sample SDK Usage Example:

ageGate.init({
    serviceIdentifier,
    displayMode: "redirect",
});

ageGate.onStatusChange((event) => {
    setEvents((prev) => [...prev, event.status]);
});

// ...

ageGate.getStatus(state.userIdentifier).then((event) => {
    setEvents((prev) => [...prev, event.status]);
});

// ...

ageGate.run({
    userIdentifier,
    countryCode,
    birthDateYYYYMMDD,
});

// ...

ageGate.recheck({
    userIdentifier,
    countryCode,
});