mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 15:25:20 +00:00
Added personalization messages and schemas
This commit is contained in:
@@ -8,7 +8,7 @@ const errors: MessageGroup = {
|
|||||||
CP_NO_CERTS: "Cannot initialize the pass creation: no valid certificates were passed.",
|
CP_NO_CERTS: "Cannot initialize the pass creation: no valid certificates were passed.",
|
||||||
PASSFILE_VALIDATION_FAILED: "Validation of pass type failed. Pass file is not a valid buffer or (more probably) does not respect the schema.\nRefer to https://apple.co/2Nvshvn to build a correct pass.",
|
PASSFILE_VALIDATION_FAILED: "Validation of pass type failed. Pass file is not a valid buffer or (more probably) does not respect the schema.\nRefer to https://apple.co/2Nvshvn to build a correct pass.",
|
||||||
REQUIR_VALID_FAILED: "The options passed to Pass constructor does not meet the requirements.\nRefer to the documentation to compile them correctly.",
|
REQUIR_VALID_FAILED: "The options passed to Pass constructor does not meet the requirements.\nRefer to the documentation to compile them correctly.",
|
||||||
MODEL_UNINITIALIZED: "Provided model ( %s ) matched but unitialized or may not contain icon.\nRefer to https://apple.co/2IhJr0Q, https://apple.co/2Nvshvn and documentation to fill the model correctly.",
|
MODEL_UNINITIALIZED: "Provided model ( %s ) matched but unitialized or may not contain icon or a valid pass.json.\nRefer to https://apple.co/2IhJr0Q, https://apple.co/2Nvshvn and documentation to fill the model correctly.",
|
||||||
MODEL_NOT_VALID: "A model must be provided in form of path (string) or object { 'fileName': Buffer } in order to continue.",
|
MODEL_NOT_VALID: "A model must be provided in form of path (string) or object { 'fileName': Buffer } in order to continue.",
|
||||||
MODELF_NOT_FOUND: "Model %s not found. Provide a valid one to continue.",
|
MODELF_NOT_FOUND: "Model %s not found. Provide a valid one to continue.",
|
||||||
MODELF_FILE_NOT_FOUND: "File %s not found.",
|
MODELF_FILE_NOT_FOUND: "File %s not found.",
|
||||||
@@ -27,7 +27,9 @@ const debugMessages: MessageGroup = {
|
|||||||
BRC_BW_FORMAT_UNSUPPORTED: "This format is not supported (by Apple) for backward support. Please choose another one.",
|
BRC_BW_FORMAT_UNSUPPORTED: "This format is not supported (by Apple) for backward support. Please choose another one.",
|
||||||
BRC_NO_POOL: "Cannot set barcode: no barcodes found. Please set barcodes first. Barcode is for retrocompatibility only.",
|
BRC_NO_POOL: "Cannot set barcode: no barcodes found. Please set barcodes first. Barcode is for retrocompatibility only.",
|
||||||
DATE_FORMAT_UNMATCH: "%s was not set due to incorrect date format.",
|
DATE_FORMAT_UNMATCH: "%s was not set due to incorrect date format.",
|
||||||
NFC_INVALID: "Unable to set NFC properties: data not compliant with schema."
|
NFC_INVALID: "Unable to set NFC properties: data not compliant with schema.",
|
||||||
|
PRS_INVALID: "Unable to parse Personalization.json. File is not a valid JSON. Error: %s",
|
||||||
|
PRS_REMOVED: "Personalization has been removed as it requires an NFC-enabled pass to work."
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -418,6 +418,26 @@ const nfcDict = Joi.object().keys({
|
|||||||
encryptionPublicKey: Joi.string()
|
encryptionPublicKey: Joi.string()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ************************************* //
|
||||||
|
// *** Personalizable Passes Schemas *** //
|
||||||
|
// ************************************* //
|
||||||
|
|
||||||
|
export interface Personalization {
|
||||||
|
requiredPersonalizationFields: PRSField[];
|
||||||
|
description: string;
|
||||||
|
termsAndConditions?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
type PRSField = "PKPassPersonalizationFieldName" | "PKPassPersonalizationFieldPostalCode" | "PKPassPersonalizationFieldEmailAddress" | "PKPassPersonalizationFieldPhoneNumber";
|
||||||
|
|
||||||
|
const personalizationDict = Joi.object().keys({
|
||||||
|
requiredPersonalizationFields: Joi.array()
|
||||||
|
.items("PKPassPersonalizationFieldName", "PKPassPersonalizationFieldPostalCode", "PKPassPersonalizationFieldEmailAddress", "PKPassPersonalizationFieldPhoneNumber")
|
||||||
|
.required(),
|
||||||
|
description: Joi.string().required(),
|
||||||
|
termsAndConditions: Joi.string(),
|
||||||
|
});
|
||||||
|
|
||||||
// --------- UTILITIES ---------- //
|
// --------- UTILITIES ---------- //
|
||||||
|
|
||||||
type Schemas = {
|
type Schemas = {
|
||||||
@@ -433,7 +453,8 @@ const schemas: Schemas = {
|
|||||||
locationsDict,
|
locationsDict,
|
||||||
transitType,
|
transitType,
|
||||||
nfcDict,
|
nfcDict,
|
||||||
supportedOptions
|
supportedOptions,
|
||||||
|
personalizationDict
|
||||||
};
|
};
|
||||||
|
|
||||||
function resolveSchemaName(name: keyof Schemas) {
|
function resolveSchemaName(name: keyof Schemas) {
|
||||||
|
|||||||
Reference in New Issue
Block a user