feat(templates): add localized push templates and actions

Share template keys across email and push with independent editors and revisions. Render localized actions and preserve version-one delivery.

Ref: IT-1627
This commit is contained in:
2026-10-31 09:38:05 +02:00
parent d4ee8fc0c8
commit aba4173827
79 changed files with 3906 additions and 104 deletions
@@ -73,10 +73,26 @@
</div>
<div class="modal-body">
<p class="text-muted small">Tests the current form settings without saving. Blank credentials use the saved credentials only when the Firebase project is unchanged.</p>
<p class="text-muted small">Sends a neutral notification directly through Firebase. This tests the channel, not Invemory account binding, navigation or background handling. Use your own test device only.</p>
<label for="pushTestVersion" class="form-label fw-semibold">Test format</label>
<select id="pushTestVersion" class="form-select mb-2" aria-describedby="pushTestFormatHelp">
<option value="1">Legacy — simple notification</option>
<option value="2">Version 2 — notification with a button</option>
</select>
<p id="pushTestFormatHelp" class="text-muted small">Legacy sends the existing neutral notification. Version 2 tests the action payload and requires a client that supports buttons. Firebase acceptance alone does not confirm display or navigation. Use your own test device only.</p>
<label for="pushRecipientToken" class="form-label fw-semibold">Recipient token</label>
<textarea id="pushRecipientToken" class="form-control font-monospace" rows="3" maxlength="4096" autocomplete="off" spellcheck="false"></textarea>
<div class="form-text">Not saved as channel configuration. Cleared after the test or when this dialog closes.</div>
<fieldset id="pushButtonTestFields" class="mt-3" hidden>
<legend class="fs-6">Button test</legend>
<label for="pushTestBindingId" class="form-label">Current device binding ID</label>
<input id="pushTestBindingId" class="form-control mb-2" autocomplete="off" spellcheck="false" />
<div class="form-text mb-2">Use the actual binding of the recipient installation. An invented or outdated binding will be rejected by the app.</div>
<label for="pushTestActionKey" class="form-label">Section action key</label>
<input id="pushTestActionKey" class="form-control mb-2" maxlength="100" placeholder="Action supported by your app" spellcheck="false" />
<label for="pushTestButtonLabel" class="form-label">Button label</label>
<input id="pushTestButtonLabel" class="form-control" maxlength="100" value="Перейти в розділ" />
<div class="form-text">The button and notification tap use the same action. No object ID is needed for a section.</div>
</fieldset>
<div id="pushSendResult" class="alert d-none mt-3" role="status" aria-live="polite"></div>
</div>
<div class="modal-footer">
@@ -101,6 +117,8 @@
const authorizationButton = document.getElementById('pushAuthorizationBtn');
const sendButton = document.getElementById('pushSendBtn');
const modalButton = document.getElementById('pushTestModalBtn');
const version = document.getElementById('pushTestVersion');
const binding = document.getElementById('pushTestBindingId');
let busy = false;
function showResult(target, success, message) {
@@ -114,7 +132,11 @@
channelId: id === '00000000-0000-0000-0000-000000000000' ? null : id,
firebaseProjectId: form.querySelector('[name="FirebaseProjectId"]').value,
credentialsJson: form.querySelector('[name="CredentialsJson"]').value,
recipientToken: send ? token.value.trim() : null
recipientToken: send ? token.value.trim() : null,
version: Number(version.value),
bindingId: send && version.value === '2' ? binding.value.trim() || null : null,
actionKey: document.getElementById('pushTestActionKey').value,
buttonLabel: document.getElementById('pushTestButtonLabel').value
};
}
@@ -152,10 +174,14 @@
authorizationButton.addEventListener('click', () => runTest(false));
sendButton.addEventListener('click', () => runTest(true));
version.addEventListener('change', () => {
document.getElementById('pushButtonTestFields').hidden = version.value !== '2';
document.getElementById('pushSendResult').className = 'alert d-none';
});
modalButton.addEventListener('click', () => {
document.getElementById('pushSendResult').className = 'alert d-none';
bootstrap.Modal.getOrCreateInstance(modal).show();
});
modal.addEventListener('hidden.bs.modal', () => { token.value = ''; });
modal.addEventListener('hidden.bs.modal', () => { token.value = ''; binding.value = ''; });
});
</script>