Skip to content

refactor(use new urls): use new pretty urls #545

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

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions packages/client-api/__tests__/inbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe("getMessages", () => {

await inboxApi.getMessages();
expect(fetchMock.mock.calls[0]).toEqual([
"https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com/production/inbox?",
"https://inbox.courier.com/inbox?",
{
headers: {
"x-courier-client-key": "CLIENT_KEY",
Expand All @@ -42,7 +42,7 @@ describe("getMessages", () => {
status: "read",
});
expect(fetchMock.mock.calls[0]).toEqual([
"https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com/production/inbox?next=abc123&status=read&tags=foo%2Cbar",
"https://inbox.courier.com/inbox?next=abc123&status=read&tags=foo%2Cbar",
{
headers: {
"x-courier-client-key": "CLIENT_KEY",
Expand All @@ -68,7 +68,7 @@ describe("getMessageCount", () => {

await inboxApi.getMessageCount();
expect(fetchMock.mock.calls[0]).toEqual([
"https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com/production/inbox/count?",
"https://inbox.courier.com/inbox/count?",
{
headers: {
"x-courier-client-key": "CLIENT_KEY",
Expand All @@ -91,7 +91,7 @@ describe("getMessageCount", () => {
status: "read",
});
expect(fetchMock.mock.calls[0]).toEqual([
"https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com/production/inbox/count?status=read&tags=foo%2Cbar",
"https://inbox.courier.com/inbox/count?status=read&tags=foo%2Cbar",
{
headers: {
"x-courier-client-key": "CLIENT_KEY",
Expand All @@ -117,7 +117,7 @@ describe("getMessage", () => {

await inboxApi.getMessage("mockMessageId");
expect(fetchMock.mock.calls[0]).toEqual([
"https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com/production/inbox/mockMessageId",
"https://inbox.courier.com/inbox/mockMessageId",
{
headers: {
"x-courier-client-key": "CLIENT_KEY",
Expand All @@ -143,7 +143,7 @@ describe("trackEvent", () => {

await inboxApi.markRead("mockMessageId");
expect(fetchMock.mock.calls[0]).toEqual([
"https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com/production/inbox/mockMessageId/event/read",
"https://inbox.courier.com/inbox/mockMessageId/event/read",
{
headers: {
"x-courier-client-key": "CLIENT_KEY",
Expand All @@ -164,7 +164,7 @@ describe("trackEvent", () => {

await inboxApi.markUnread("mockMessageId");
expect(fetchMock.mock.calls[0]).toEqual([
"https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com/production/inbox/mockMessageId/event/unread",
"https://inbox.courier.com/inbox/mockMessageId/event/unread",
{
headers: {
"x-courier-client-key": "CLIENT_KEY",
Expand All @@ -185,7 +185,7 @@ describe("trackEvent", () => {

await inboxApi.markArchived("mockMessageId");
expect(fetchMock.mock.calls[0]).toEqual([
"https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com/production/inbox/mockMessageId/event/archive",
"https://inbox.courier.com/inbox/mockMessageId/event/archive",
{
headers: {
"x-courier-client-key": "CLIENT_KEY",
Expand All @@ -207,7 +207,7 @@ describe("trackEvent", () => {

await inboxApi.markAllRead();
expect(fetchMock.mock.calls[0]).toEqual([
"https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com/production/inbox/mark-all-read",
"https://inbox.courier.com/inbox/mark-all-read",
{
headers: {
"x-courier-client-key": "CLIENT_KEY",
Expand Down
3 changes: 1 addition & 2 deletions packages/client-api/src/inbox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ interface IGetMessageCountParams {
status?: "read" | "unread";
}

const prodApiUrl =
"https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com/production";
const prodApiUrl = "https://inbox.courier.com";

const Inbox = (params: ICourierClientBasicParams | ICourierClientJWTParams) => {
const headers = getHttpHeaders(params);
Expand Down
4 changes: 2 additions & 2 deletions packages/client-graphql/src/inbox/__tests__/count.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("getInboxCount", () => {
await inboxApi.getInboxCount();
expect(fetchMock.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com/production/q",
"https://inbox.courier.com/q",
Object {
"body": "{\\"query\\":\\"query GetInboxCount($params: FilterParamsInput) {\\\\n count(params: $params)\\\\n}\\\\n\\",\\"operationName\\":\\"GetInboxCount\\",\\"variables\\":{\\"params\\":{}}}",
"headers": Object {
Expand Down Expand Up @@ -49,7 +49,7 @@ describe("getInboxCount", () => {

expect(fetchMock.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com/production/q",
"https://inbox.courier.com/q",
Object {
"body": "{\\"query\\":\\"query GetInboxCount($params: FilterParamsInput) {\\\\n count(params: $params)\\\\n}\\\\n\\",\\"operationName\\":\\"GetInboxCount\\",\\"variables\\":{\\"params\\":{\\"status\\":\\"read\\",\\"tags\\":[\\"abc\\",\\"123\\"]}}}",
"headers": Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe("trackEvent", () => {
await inboxApi.markAllRead();
expect(fetchMock.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com/production/q",
"https://inbox.courier.com/q",
Object {
"body": "{\\"query\\":\\"mutation TrackEvent {\\\\n markAllRead\\\\n}\\\\n\\",\\"operationName\\":\\"TrackEvent\\",\\"variables\\":{}}",
"headers": Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("getMessage", () => {
await inboxApi.getMessage("mockMessageId");
expect(fetchMock.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com/production/q",
"https://inbox.courier.com/q",
Object {
"body": "{\\"query\\":\\"query GetInboxMessage($messageId: String!) {\\\\n message(messageId: $messageId) {\\\\n created\\\\n messageId\\\\n read\\\\n content {\\\\n html\\\\n actions {\\\\n background_color\\\\n content\\\\n href\\\\n style\\\\n __typename\\\\n }\\\\n elemental {\\\\n ... on TextElement {\\\\n type\\\\n content\\\\n __typename\\\\n }\\\\n ... on ActionElement {\\\\n type\\\\n content\\\\n href\\\\n __typename\\\\n }\\\\n __typename\\\\n }\\\\n __typename\\\\n }\\\\n __typename\\\\n }\\\\n}\\\\n\\",\\"operationName\\":\\"GetInboxMessage\\",\\"variables\\":{\\"messageId\\":\\"mockMessageId\\"}}",
"headers": Object {
Expand Down
4 changes: 2 additions & 2 deletions packages/client-graphql/src/inbox/__tests__/messages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("getMessages", () => {
await inboxApi.getMessages();
expect(fetchMock.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com/production/q",
"https://inbox.courier.com/q",
Object {
"body": "{\\"query\\":\\"query GetInboxMessages($params: FilterParamsInput, $pinnedParams: FilterParamsInput, $limit: Int = 10, $after: String) {\\\\n pinned: messages(params: $pinnedParams, limit: $limit, after: $after) {\\\\n totalCount\\\\n pageInfo {\\\\n startCursor\\\\n hasNextPage\\\\n __typename\\\\n }\\\\n nodes {\\\\n actions(version: 2) {\\\\n background_color\\\\n data\\\\n content\\\\n href\\\\n style\\\\n __typename\\\\n }\\\\n archived\\\\n created\\\\n data\\\\n icon\\\\n messageId\\\\n opened\\\\n pinned {\\\\n slotId\\\\n __typename\\\\n }\\\\n preview\\\\n read\\\\n icon\\\\n tags\\\\n title\\\\n trackingIds {\\\\n openTrackingId\\\\n archiveTrackingId\\\\n clickTrackingId\\\\n deliverTrackingId\\\\n readTrackingId\\\\n unreadTrackingId\\\\n __typename\\\\n }\\\\n __typename\\\\n }\\\\n __typename\\\\n }\\\\n messages(params: $params, limit: $limit, after: $after) {\\\\n totalCount\\\\n pageInfo {\\\\n startCursor\\\\n hasNextPage\\\\n __typename\\\\n }\\\\n nodes {\\\\n actions(version: 2) {\\\\n background_color\\\\n data\\\\n content\\\\n href\\\\n style\\\\n __typename\\\\n }\\\\n archived\\\\n created\\\\n data\\\\n icon\\\\n messageId\\\\n opened\\\\n pinned {\\\\n slotId\\\\n __typename\\\\n }\\\\n preview\\\\n read\\\\n icon\\\\n tags\\\\n title\\\\n trackingIds {\\\\n openTrackingId\\\\n archiveTrackingId\\\\n clickTrackingId\\\\n deliverTrackingId\\\\n readTrackingId\\\\n unreadTrackingId\\\\n __typename\\\\n }\\\\n __typename\\\\n }\\\\n __typename\\\\n }\\\\n}\\\\n\\",\\"operationName\\":\\"GetInboxMessages\\",\\"variables\\":{\\"params\\":{\\"pinned\\":false},\\"pinnedParams\\":{\\"pinned\\":true}}}",
"headers": Object {
Expand Down Expand Up @@ -49,7 +49,7 @@ describe("getMessages", () => {

expect(fetchMock.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com/production/q",
"https://inbox.courier.com/q",
Object {
"body": "{\\"query\\":\\"query GetInboxMessages($params: FilterParamsInput, $pinnedParams: FilterParamsInput, $limit: Int = 10, $after: String) {\\\\n pinned: messages(params: $pinnedParams, limit: $limit, after: $after) {\\\\n totalCount\\\\n pageInfo {\\\\n startCursor\\\\n hasNextPage\\\\n __typename\\\\n }\\\\n nodes {\\\\n actions(version: 2) {\\\\n background_color\\\\n data\\\\n content\\\\n href\\\\n style\\\\n __typename\\\\n }\\\\n archived\\\\n created\\\\n data\\\\n icon\\\\n messageId\\\\n opened\\\\n pinned {\\\\n slotId\\\\n __typename\\\\n }\\\\n preview\\\\n read\\\\n icon\\\\n tags\\\\n title\\\\n trackingIds {\\\\n openTrackingId\\\\n archiveTrackingId\\\\n clickTrackingId\\\\n deliverTrackingId\\\\n readTrackingId\\\\n unreadTrackingId\\\\n __typename\\\\n }\\\\n __typename\\\\n }\\\\n __typename\\\\n }\\\\n messages(params: $params, limit: $limit, after: $after) {\\\\n totalCount\\\\n pageInfo {\\\\n startCursor\\\\n hasNextPage\\\\n __typename\\\\n }\\\\n nodes {\\\\n actions(version: 2) {\\\\n background_color\\\\n data\\\\n content\\\\n href\\\\n style\\\\n __typename\\\\n }\\\\n archived\\\\n created\\\\n data\\\\n icon\\\\n messageId\\\\n opened\\\\n pinned {\\\\n slotId\\\\n __typename\\\\n }\\\\n preview\\\\n read\\\\n icon\\\\n tags\\\\n title\\\\n trackingIds {\\\\n openTrackingId\\\\n archiveTrackingId\\\\n clickTrackingId\\\\n deliverTrackingId\\\\n readTrackingId\\\\n unreadTrackingId\\\\n __typename\\\\n }\\\\n __typename\\\\n }\\\\n __typename\\\\n }\\\\n}\\\\n\\",\\"operationName\\":\\"GetInboxMessages\\",\\"variables\\":{\\"params\\":{\\"status\\":\\"read\\",\\"tags\\":[\\"abc\\",\\"123\\"],\\"pinned\\":false},\\"pinnedParams\\":{\\"status\\":\\"read\\",\\"tags\\":[\\"abc\\",\\"123\\"],\\"pinned\\":true}}}",
"headers": Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe("trackEvent", () => {
await inboxApi.markRead("mockMessageId");
expect(fetchMock.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com/production/q",
"https://inbox.courier.com/q",
Object {
"body": "{\\"query\\":\\"mutation TrackEvent($messageId: String!) {\\\\n read(messageId: $messageId)\\\\n}\\\\n\\",\\"operationName\\":\\"TrackEvent\\",\\"variables\\":{\\"messageId\\":\\"mockMessageId\\"}}",
"headers": Object {
Expand All @@ -42,7 +42,7 @@ describe("trackEvent", () => {
await inboxApi.markUnread("mockMessageId");
expect(fetchMock.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com/production/q",
"https://inbox.courier.com/q",
Object {
"body": "{\\"query\\":\\"mutation TrackEvent($messageId: String!) {\\\\n unread(messageId: $messageId)\\\\n}\\\\n\\",\\"operationName\\":\\"TrackEvent\\",\\"variables\\":{\\"messageId\\":\\"mockMessageId\\"}}",
"headers": Object {
Expand All @@ -64,7 +64,7 @@ describe("trackEvent", () => {
await inboxApi.markArchive("mockMessageId");
expect(fetchMock.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com/production/q",
"https://inbox.courier.com/q",
Object {
"body": "{\\"query\\":\\"mutation TrackEvent($messageId: String!) {\\\\n archive(messageId: $messageId)\\\\n}\\\\n\\",\\"operationName\\":\\"TrackEvent\\",\\"variables\\":{\\"messageId\\":\\"mockMessageId\\"}}",
"headers": Object {
Expand Down
3 changes: 1 addition & 2 deletions packages/client-graphql/src/inbox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ export default (
unpinMessage: TrackEvent;
} => {
const client = createCourierClient(params, {
apiUrl:
"https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com/production/q",
apiUrl: "https://inbox.courier.com/q",
});

return {
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@
</head>
<body>
<courier-inbox></courier-inbox>
<courier-preference-page></courier-preference-page>
<courier-toast></courier-toast>
<div id="root">
<div id="test">hello world</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ const useElementalInboxActions = (): IInboxActions => {

const courierClient = createCourierClient({
authorization,
apiUrl:
apiUrl ??
"https://fxw3r7gdm9.execute-api.us-east-1.amazonaws.com/production/q",
apiUrl: apiUrl ?? "https://inbox.courier.com/q",
clientKey,
clientSourceId,
userId,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-provider/src/ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class WS {
this.url =
options?.url ||
process.env.COURIER_WS_URL ||
"wss://1x60p1o3h8.execute-api.us-east-1.amazonaws.com/production";
"wss://realtime.courier.com";
this.clientSourceId = clientSourceId;
this.clientKey = clientKey;
this.userSignature = userSignature;
Expand Down