-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into dependabot/npm_and_yarn/axios-1.7.4
- Loading branch information
Showing
14 changed files
with
198 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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 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
Empty file.
This file contains 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,10 @@ | ||
INSERT INTO users | ||
(id, email, email_verified, email_verified_at, encrypted_password, created_at, updated_at, given_name, family_name, | ||
phone_number, job) | ||
VALUES | ||
(1, '[email protected]', true, CURRENT_TIMESTAMP, '$2a$10$kzY3LINL6..50Fy9shWCcuNlRfYq0ft5lS.KCcJ5PzrhlWfKK4NIO', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Jean', 'Nouveau', '0123456789', 'Sbire'); | ||
|
||
INSERT INTO organizations | ||
(id, siret, created_at, updated_at) | ||
VALUES | ||
(1, '66204244933106', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); |
This file contains 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,34 @@ | ||
// | ||
|
||
// | ||
|
||
describe("join and moderation", () => { | ||
before(() => { | ||
cy.mailslurp().then((mailslurp) => | ||
mailslurp.inboxController.deleteAllInboxEmails({ | ||
inboxId: "86983334-028f-48b5-881d-8b05d738bec5", | ||
}), | ||
); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.login( | ||
"[email protected]", | ||
"password123", | ||
); | ||
}); | ||
|
||
it("will be moderated", function () { | ||
cy.visit(`/`); | ||
cy.get('[name="siret"]').type("66204244933106"); | ||
cy.get('[type="submit"]').click(); | ||
|
||
cy.contains("Rattachement en cours"); | ||
cy.contains( | ||
"⏱️ Notre équipe étudie votre demande de rattachement à l’organisation Bnp paribas - Bnp pariba", | ||
); | ||
cy.contains( | ||
"avec l’adresse email [email protected].", | ||
); | ||
}); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 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 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,88 @@ | ||
// | ||
|
||
import { fetch_crisp, type Config } from "@numerique-gouv/crisp"; | ||
import { | ||
CreateConversationRoute, | ||
SendMessageInAConversationRoute, | ||
UpdateConversationMetaRoute, | ||
UpdateConversationStateRoute, | ||
} from "@numerique-gouv/crisp/router/conversation"; | ||
import { | ||
CRISP_BASE_URL, | ||
CRISP_IDENTIFIER, | ||
CRISP_KEY, | ||
CRISP_PLUGIN_URN, | ||
CRISP_USER_NICKNAME, | ||
CRISP_WEBSITE_ID, | ||
} from "../config/env"; | ||
|
||
// | ||
|
||
const config: Config = { | ||
base_url: CRISP_BASE_URL, | ||
identifier: CRISP_IDENTIFIER || "", | ||
key: CRISP_KEY || "", | ||
plugin_urn: CRISP_PLUGIN_URN || "", | ||
user_nickname: CRISP_USER_NICKNAME, | ||
website_id: CRISP_WEBSITE_ID || "", | ||
debug: true, | ||
}; | ||
// | ||
|
||
export async function startCripsConversation({ | ||
content, | ||
email, | ||
nickname, | ||
subject, | ||
}: { | ||
content: string; | ||
email: string; | ||
nickname: string; | ||
subject: string; | ||
}) { | ||
const { session_id } = await fetch_crisp<CreateConversationRoute>(config, { | ||
endpoint: `/v1/website/${config.website_id}/conversation`, | ||
method: "POST", | ||
searchParams: {}, | ||
}); | ||
|
||
await fetch_crisp<UpdateConversationMetaRoute>(config, { | ||
endpoint: `/v1/website/${config.website_id}/conversation/${session_id}/meta`, | ||
method: "PATCH", | ||
searchParams: {}, | ||
body: { | ||
email, | ||
nickname, | ||
segments: ["email", "moderation"], | ||
subject, | ||
}, | ||
}); | ||
|
||
await fetch_crisp<SendMessageInAConversationRoute>(config, { | ||
endpoint: `/v1/website/${config.website_id}/conversation/${session_id}/message`, | ||
method: "POST", | ||
searchParams: {}, | ||
body: { | ||
type: "text", | ||
origin: `urn:${config.website_id}`, | ||
from: "operator", | ||
content, | ||
user: { | ||
nickname: config.user_nickname, | ||
}, | ||
}, | ||
}); | ||
|
||
// HACK(douglasduteil): Wait for the message to be sent | ||
// Crisp seems to have a delay between the message being sent and the state being updated | ||
await new Promise((resolve) => setTimeout(resolve, 500)); | ||
|
||
await fetch_crisp<UpdateConversationStateRoute>(config, { | ||
endpoint: `/v1/website/${config.website_id}/conversation/${session_id}/state`, | ||
method: "PATCH", | ||
searchParams: {}, | ||
body: { state: "resolved" }, | ||
}); | ||
|
||
return session_id; | ||
} |
This file contains 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 was deleted.
Oops, something went wrong.
This file contains 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,24 @@ | ||
// | ||
|
||
import { MONCOMPTEPRO_HOST } from "../../config/env"; | ||
|
||
// | ||
|
||
export function unableToAutoJoinOrganizationMd({ | ||
libelle, | ||
}: { | ||
libelle: string; | ||
}) { | ||
return ` | ||
![MonComptePro](${MONCOMPTEPRO_HOST}/dist/mail-banner.png) | ||
Bonjour, | ||
⏱️ Notre équipe est en train de vous rattacher à l’organisation **${libelle}**. | ||
Vous recevrez un email pour accéder à votre démarche dès que nous aurons terminé. | ||
(délai moyen : 1 jour ouvré) | ||
Cordialement, | ||
L’équipe MonComptePro | ||
`.trim(); | ||
} |