DueLoad — Relay audit 0.5.5

=== English ===

What the extension does
- Works only on relay.amazon.com and only after you press the collect button or Autofill.
- Downloads from your account for the last year, or, if your DueLoad account already has data, only what is new since the last upload plus one week before it (or a period you choose under More):
    - invoices from Payments;
    - your dispute history: which trips and loads you disputed, the amounts requested and Amazon's decision (without your own dispute comments);
    - the Trips export from History;
    - the cancellation time of each cancelled load;
    - trip notes (Comments): entries by Relay support, Relay Assistant and you — phones and e-mails are replaced.
- Before collecting, checks the latest invoice (Payment Summary sheet: Carrier and SCAC) to make sure Relay is signed in to your company's account.
- Works slowly, one request every few seconds, about the pace of you paging through the weeks yourself. A full run takes about half an hour; the start screen shows a closer estimate.
- Removes phone numbers and e-mails from trip notes. Driver names and truck numbers stay: your DueLoad account uses them for driver statements.
- Saves everything as one archive on your computer. You decide whom to send it to.
- When you press Autofill, it fills the dispute form you sent from your account: opens the invoice, selects the lines, enters the total amounts and notes — and stops. First it checks the invoice and the original amounts against Relay; if anything differs, it fills nothing.

What the extension does not do (blocked in code)
- Does not book loads and does not open the Load Board.
- Does not open Upcoming, In Transit, Payment Info (bank details) or Site Users.
- Does not file disputes: only you press Submit dispute. No changes to trips, drivers, times or locations.
- Does not see or store your password, 2FA codes or cookies.
- Sends data only to your DueLoad account (app.dueload.com) and only when you press “Send to DueLoad”. Nothing goes anywhere else.
- Does not run in the background or on a schedule.

How to run it
1. Unzip the extension archive you received into any folder.
2. In Chrome, open chrome://extensions, turn on Developer mode (top right), click Load unpacked and select that folder.
3. Sign in to relay.amazon.com, into your company's account, as a user with access to Payments. The extension opens Trips → History itself.
4. Click the extension icon: a side panel opens next to Relay. Connect your account (company and SCAC fill in by themselves) or type them in under More (SCAC: Company Profile → Company Info → Carrier Identifier) and press “Load a year of data” (or “Update data” if your account already has data). Keep the Relay tab and the panel open while it runs.
5. When you see Done, click Save archive and send the file to us.
6. Delete the collected data in the extension. You can remove the extension itself at chrome://extensions.

Permissions
- permissions: ["sidePanel"] — sidePanel: to open the extension as a side panel next to Relay. Chrome shows no warning for it.
- host_permissions: https://relay.amazon.com/*, https://app.dueload.com/* — relay.amazon.com: to find your Trips → History tab and talk to it; app.dueload.com: to send the archive to your DueLoad account when you press “Send to DueLoad”. No other sites.
- externally_connectable: only app.dueload.com may send the extension a one-time connection code.
- The extension code runs on https://relay.amazon.com/tours/history* only.
- No access to cookies, downloads, browsing history, other tabs or other websites.

=== Русский ===

Что делает расширение
- Работает только на relay.amazon.com и только после того, как вы нажали кнопку сбора или Autofill.
- Скачивает из вашего аккаунта за последний год, а если данные уже есть в кабинете DueLoad — только новое с прошлой выгрузки и ещё одну неделю до него (или за выбранный период в «Дополнительно»):
    - invoices из Payments;
    - историю ваших disputes: по каким trips и loads вы подавали, сколько просили и что ответил Amazon (без ваших комментариев к disputes);
    - выгрузку Trips из History;
    - время отмены каждого отменённого load;
    - заметки trips (Comments): записи поддержки Relay, Relay Assistant и ваши — телефоны и e-mail заменяются.
- Перед сбором проверяет по последнему invoice (лист Payment Summary: Carrier и SCAC), что в Relay открыт аккаунт вашей компании.
- Работает медленно, один запрос раз в несколько секунд — примерно как если бы вы сами листали недели. Весь сбор занимает около получаса, точнее — в оценке на старте.
- Удаляет телефоны и e-mail из заметок trips. Имена водителей и номера trucks остаются: по ним кабинет DueLoad строит выписки водителям.
- Сохраняет всё одним архивом на ваш компьютер. Кому его отправить, решаете вы.
- По кнопке Autofill заполняет форму dispute, которую вы отправили из кабинета: открывает invoice, отмечает строки, вписывает итоговые суммы и заметки — и останавливается. Перед этим сверяет invoice и исходные суммы с Relay; не сошлось — ничего не заполняет.

Чего расширение не делает (запрещено в коде)
- Не бронирует loads и не открывает Load Board.
- Не открывает Upcoming и In Transit, Payment Info (банковские данные) и Site Users.
- Не подаёт disputes: Submit dispute нажимаете только вы. Не меняет trips, водителей, время и геолокацию.
- Не видит и не хранит пароль, коды 2FA и cookie.
- Отправляет данные только в ваш кабинет DueLoad (app.dueload.com) и только по кнопке «Отправить в DueLoad». Больше никуда.
- Не работает в фоне и по расписанию.

Инструкция
1. Распакуйте присланный архив с расширением в любую папку.
2. В Chrome откройте chrome://extensions, включите Developer mode (справа вверху), нажмите Load unpacked и выберите эту папку.
3. Войдите в relay.amazon.com пользователем, у которого есть доступ к Payments, в аккаунт своей компании. Trips → History расширение откроет само.
4. Нажмите на иконку расширения — рядом с Relay откроется боковая панель. Подключите кабинет (компания и SCAC подставятся сами) или введите их в «Дополнительно» (SCAC: Company Profile → Company Info → Carrier Identifier) и нажмите «Загрузить данные за год» (или «Обновить данные», если данные уже в кабинете). Вкладку Relay и панель не закрывайте, пока идёт сбор.
5. Когда появится «Готово», нажмите «Сохранить архив» и отправьте файл нам.
6. Удалите собранные данные в расширении. Само расширение можно удалить на странице chrome://extensions.

Разрешения
- permissions: ["sidePanel"] — sidePanel: открывать расширение боковой панелью рядом с Relay. Chrome не показывает о нём предупреждения.
- host_permissions: https://relay.amazon.com/*, https://app.dueload.com/* — relay.amazon.com: найти вкладку Trips → History и обмениваться с ней; app.dueload.com: отправить архив в ваш кабинет DueLoad по кнопке «Отправить в DueLoad». Других сайтов нет.
- externally_connectable: только app.dueload.com может передать расширению одноразовый код подключения.
- Код расширения работает только на https://relay.amazon.com/tours/history*.
- Нет доступа к cookie, загрузкам, истории браузера, другим вкладкам и другим сайтам.
