-
Notifications
You must be signed in to change notification settings - Fork 4
chore: [IOBP-2296] CdC messages markdown #565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
652c9ff
feat: Cdc markdown messages
soixdev91 a2cdec8
Merge branch 'master' into IOBP-2296-CdC-messages-markdown
soixdev91 7a0d384
fix: remove non-localized en ctas
soixdev91 abda6fb
chore: standard messages format
soixdev91 040657b
chore: rename fiscalCode to fiscal_code
soixdev91 90a00ba
chore: removed optional chaining
soixdev91 0ccdbfd
Merge branch 'master' into IOBP-2296-CdC-messages-markdown
soixdev91 ba24862
Merge branch 'master' into IOBP-2296-CdC-messages-markdown
LeleDallas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import { IoDevServerConfig } from "../../../types/config"; | ||
| import { CreatedMessageWithContentAndAttachments } from "../../../../generated/definitions/backend/CreatedMessageWithContentAndAttachments"; | ||
| import { nextMessageIdAndCreationDate } from "../../messages/utils"; | ||
| import { validatePayload } from "../../../utils/validator"; | ||
| import { cdcServiceId } from "../../services/persistence/services/special/cdc-service"; | ||
| import { CreatedMessageWithContent } from "../../../../generated/definitions/backend/CreatedMessageWithContent"; | ||
|
|
||
| const createCdcMessageTemplates = [ | ||
| { | ||
| content: { | ||
| subject: "La tua Carta della Cultura è pronta!", | ||
| markdown: | ||
| '---\nit:\n cta_2:\n text: "Dove puoi usarla"\n action: "iohandledlink://https://www.cartadellacultura.it/cartaculturaEsercente/#/doveUsareBuoni"\n cta_1:\n text: "Vai alla Carta della Cultura"\n action: "ioit://main/wallet"\n---\nCiao!\nIl tuo **nucleo familiare** ha ottenuto la Carta della Cultura per il:\n* **202Y**\n* **202Z**\n\nÈ disponibile ora nella sezione Portafoglio.\n\nPuoi usarla per acquistare libri, sia cartacei che digitali, generando uno o più buoni in base al credito disponibile.\n\nVuoi avere più informazioni su come usare i buoni? [Leggi come fare](https://pagopa.zendesk.com/auth/v2/login/signin?auth_origin=30056501290385%2Ctrue%2Ctrue&brand_id=30056501290385&locale=22&return_to=https%3A%2F%2Fassistenza.ioapp.it%2Fhc&role=agent&theme=hc)\n' | ||
| } | ||
| }, | ||
| { | ||
| content: { | ||
| subject: "Non è stato possibile assegnarti la Carta della Cultura", | ||
| markdown: | ||
| "Ciao!\nPurtroppo non è stato possibile assegnarti la Carta della Cultura.\n\nLa richiesta non è stata accolta, ecco perché:\n* **202X** : <ISEE non presente>\n* **202V** : <ISEE non conforme>\n* **202K** : <non rientri in graduatoria per fondi insufficienti.>\n\nGrazie per aver partecipato all’iniziativa." | ||
| } | ||
| }, | ||
| { | ||
| content: { | ||
| subject: "Carta della Cultura: abbiamo aggiornamenti sulla tua richiesta", | ||
| markdown: | ||
| '---\nit:\n cta_2:\n text: "Dove puoi usarla"\n action: "iohandledlink://https://www.cartadellacultura.it/cartaculturaEsercente/#/doveUsareBuoni"\n cta_1:\n text: "Vai alla Carta della Cultura"\n action: "ioit://main/wallet"\n---\nCiao!\nEcco l’esito delle tue richieste per l’ottenimento della Carta della Cultura.\n\nIl tuo **nucleo familiare** ha ottenuto la Carta della Cultura per il:\n* **202Y**\n* **202Z**\n\nPer gli altri anni, invece, la richiesta non è stata accolta:\n* **202X** : <ISEE non presente>\n* **202V** : <ISEE non conforme>\n* **202K** : <non rientri in graduatoria per fondi insufficienti.>\n\nPuoi trovare la tua Carta nella sezione Portafoglio e usarla per acquistare libri, generando uno o più buoni in base al credito disponibile.' | ||
| } | ||
| } | ||
| ]; | ||
|
|
||
| export const createCDCMessages = ( | ||
| customConfig: IoDevServerConfig | ||
| ): CreatedMessageWithContentAndAttachments[] => { | ||
| // feature flag guard | ||
| if (!customConfig.features.bonus.cdc.enabled) { | ||
| return []; | ||
| } | ||
|
|
||
| const fiscal_code = customConfig.profile.attrs.fiscal_code; | ||
|
|
||
| return createCdcMessageTemplates.map(template => { | ||
| const { id, created_at } = nextMessageIdAndCreationDate(); | ||
|
|
||
| return validatePayload(CreatedMessageWithContent, { | ||
| content: template.content, | ||
| created_at, | ||
| fiscal_code, | ||
| id, | ||
| message_title: template.content.subject ?? "This message has no title", | ||
| sender_service_id: cdcServiceId, | ||
| service_name: "Ministero della Cultura" | ||
| }); | ||
| }); | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.