-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(fix test): fix test for usetransport
- Loading branch information
1 parent
e410769
commit 728461e
Showing
27 changed files
with
259 additions
and
215 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
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
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,16 @@ | ||
module.exports = { | ||
sourceType: "unambiguous", | ||
plugins: [ | ||
"@babel/transform-runtime", | ||
"transform-inline-environment-variables", | ||
"transform-class-properties", | ||
process.env.NODE_ENV !== "test" && [ | ||
"babel-plugin-root-import", | ||
{ | ||
rootPathSuffix: "./src", | ||
rootPathPrefix: "~/", | ||
}, | ||
], | ||
].filter(Boolean), | ||
presets: ["@babel/preset-typescript", "@babel/preset-env"], | ||
}; |
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,5 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const jestConfigBase = require("../../jest.config.base"); | ||
const babelConfig = require("./babel.config.js"); | ||
|
||
module.exports = jestConfigBase(babelConfig); |
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,23 @@ | ||
{ | ||
"name": "@trycourier/core", | ||
"version": "6.0.0", | ||
"description": "", | ||
"main": "dist/index.js", | ||
"types": "typings/index.d.ts", | ||
"scripts": { | ||
"babel": "babel src -d dist --extensions \".ts\" --ignore \"src/**/__tests__/**\"", | ||
"build:watch": "yarn babel --watch", | ||
"build": "rimraf dist && yarn babel", | ||
"clean": "rimraf dist && rimraf typings", | ||
"type-check": "tsc --noEmit", | ||
"types": "tsc --emitDeclarationOnly" | ||
}, | ||
"license": "ISC", | ||
"dependencies": { | ||
"rimraf": "^3.0.2" | ||
}, | ||
"files": [ | ||
"dist/", | ||
"typings/" | ||
] | ||
} |
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,2 @@ | ||
export * from "./types"; | ||
export * from "./lib"; |
File renamed without changes.
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,146 @@ | ||
export interface ICourierEventMessage { | ||
event: "read" | "unread" | "archive" | "mark-all-read" | "opened" | "unpin"; | ||
type: "event"; | ||
messageId?: string; | ||
error?: string; | ||
} | ||
|
||
export interface ITextElemental { | ||
type: "text"; | ||
content: string; | ||
} | ||
|
||
export interface IActionElemental { | ||
background_color?: string; | ||
type: "action"; | ||
content: string; | ||
href: string; | ||
data?: Record<string, any>; | ||
} | ||
|
||
export interface IInboxMessagePreview { | ||
type: "message"; | ||
archived?: string; | ||
created: string; | ||
messageId: string; | ||
pinned?: { | ||
slotId?: string; | ||
}; | ||
actions?: Array<IActionElemental>; | ||
preview?: string; | ||
icon?: string; | ||
opened?: string; | ||
data?: Record<string, any>; | ||
/** ISO 8601 date the message was read */ | ||
read?: string; | ||
tags?: string[]; | ||
title?: string; | ||
trackingIds?: { | ||
openTrackingId?: string; | ||
archiveTrackingId?: string; | ||
clickTrackingId?: string; | ||
deliverTrackingId?: string; | ||
readTrackingId?: string; | ||
unreadTrackingId?: string; | ||
}; | ||
} | ||
|
||
export interface ICourierEvent { | ||
type?: "message" | "event"; | ||
data?: IInboxMessagePreview | ICourierEventMessage; | ||
} | ||
|
||
export type ICourierEventCallback = (event: ICourierEvent) => void; | ||
|
||
export type Interceptor = ( | ||
message?: ICourierEventMessage | IInboxMessagePreview | ||
) => IInboxMessagePreview | ICourierEventMessage | undefined; | ||
|
||
import { ErrorEvent } from "reconnecting-websocket"; | ||
export type ErrorEventHandler = (event: ErrorEvent) => void; | ||
|
||
export type PreferenceStatus = "OPTED_IN" | "OPTED_OUT" | "REQUIRED"; | ||
|
||
export type RepeatOn = { | ||
sunday?: boolean; | ||
monday?: boolean; | ||
tuesday?: boolean; | ||
wednesday?: boolean; | ||
thursday?: boolean; | ||
friday?: boolean; | ||
saturday?: boolean; | ||
}; | ||
|
||
export interface DigestSchedule { | ||
period: string; | ||
repetition: string; | ||
scheduleId: string; | ||
default?: boolean; | ||
start: string; | ||
recurrence: string; | ||
repeat?: { | ||
frequency: number; | ||
interval: "day" | "week" | "month" | "year"; | ||
on?: string | RepeatOn; | ||
}; | ||
end?: number | string; | ||
} | ||
|
||
export interface IPreferenceTemplate { | ||
templateName: string; | ||
templateId: string; | ||
defaultStatus: PreferenceStatus; | ||
digestSchedules?: DigestSchedule[]; | ||
} | ||
|
||
export type WSOptions = { | ||
url?: string; | ||
onError?: ErrorEventHandler; | ||
onClose?: () => void; | ||
onReconnect?: () => void; | ||
connectionTimeout?: number; | ||
}; | ||
|
||
export interface PinDetails { | ||
id: string; | ||
label: { | ||
value: string; | ||
color: string; | ||
}; | ||
icon: { | ||
value: string; | ||
color: string; | ||
}; | ||
} | ||
export interface Brand { | ||
inapp?: { | ||
disableCourierFooter?: boolean; | ||
borderRadius?: string; | ||
disableMessageIcon?: boolean; | ||
placement?: "top" | "bottom" | "left" | "right"; | ||
emptyState?: { | ||
textColor?: string; | ||
text?: string; | ||
}; | ||
widgetBackground?: { | ||
topColor?: string; | ||
bottomColor?: string; | ||
}; | ||
icons?: { | ||
bell?: string; | ||
message?: string; | ||
}; | ||
slots?: Array<PinDetails>; | ||
toast?: { | ||
borderRadius?: string; | ||
timerAutoClose?: number; | ||
}; | ||
renderActionsAsButtons?: boolean; | ||
}; | ||
preferenceTemplates?: Array<IPreferenceTemplate>; | ||
colors?: { | ||
primary?: string; | ||
secondary?: string; | ||
tertiary?: string; | ||
}; | ||
} |
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,12 @@ | ||
{ | ||
"extends": "../../tsconfig-base.json", | ||
"compilerOptions": { | ||
"rootDir": "./src", | ||
"outDir": "./dist", | ||
"declarationDir": "./typings", | ||
"paths": { | ||
"~/*": ["./src/*"] | ||
} | ||
}, | ||
"include": ["../types/@types/*/index.d.ts", "./src/**/*.ts"] | ||
} |
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
6 changes: 5 additions & 1 deletion
6
packages/transport/src/use-transport.ts → packages/react-hooks/src/use-transport.ts
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
Oops, something went wrong.