@zean-chat/react-native 0.1.1 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,3 @@
1
- /** Returns a token the Company's server signed for the signed-in person, or null when there is none. */
2
- export type ZeanTokenSource = () => Promise<string | null>;
3
1
  export type ZeanAttributeValue = string | number | boolean;
4
2
  /** What the app knows about the person, shown on the Contact's profile: `{ city: 'Douala', orders: 12 }`. */
5
3
  export type ZeanAttributes = Record<string, ZeanAttributeValue>;
@@ -9,24 +7,35 @@ export interface ZeanStorage {
9
7
  setItem: (key: string, value: string) => void | Promise<void>;
10
8
  }
11
9
  export type ZeanLocale = 'fr' | 'en';
10
+ /** The person signed in to your app. Only `id` is needed; the rest shows on their Contact. */
11
+ export interface ZeanUser {
12
+ /** Your own id for them: text or a number. The same id on the web and in your mobile app is one person. */
13
+ id: string | number;
14
+ name?: string;
15
+ email?: string;
16
+ phone?: string;
17
+ /** Their language, any one, as a tag such as `pt` or `pt-BR`. Leave it out: the phone's is kept. */
18
+ language?: string;
19
+ }
12
20
  export type ZeanColorScheme = 'light' | 'dark';
13
21
  export interface ZeanChatProps {
14
22
  /** The App's public key, from the install code. */
15
23
  appKey: string;
16
24
  /** Read once, when the chat starts. */
17
25
  storage: ZeanStorage;
18
- /**
19
- * While a person is signed in: returns a token your server signed. Leave it out when no one is; to switch people,
20
- * leave it out once in between.
21
- */
22
- getToken?: ZeanTokenSource;
26
+ /** The person signed in to your app: `{ id, name, email }`. Leave it out when no one is: the chat signs out. */
27
+ user?: ZeanUser;
23
28
  /** What the app knows about the person, shown on the Contact's profile. */
24
29
  attributes?: ZeanAttributes;
25
30
  /** The chat's language. Leave it out: the phone's, when the chat speaks it, else the App's default. */
26
31
  locale?: ZeanLocale;
27
32
  /** Leave it out: the phone's. */
28
33
  colorScheme?: ZeanColorScheme;
29
- /** Where the chat's backend is. Leave it out: the default is Zean's own. */
34
+ /**
35
+ * Where the chat's backend is. Leave it out: the App key says which of Zean's own. For local development only, so
36
+ * left out of the documentation.
37
+ * @internal
38
+ */
30
39
  backendUrl?: string;
31
40
  }
32
41
  /** The chat's methods, and the count of replies the Contact has not seen. */
@@ -34,8 +43,11 @@ export interface ZeanControls {
34
43
  open: () => void;
35
44
  close: () => void;
36
45
  toggle: () => void;
37
- /** The person signed in: `getToken` is called now and whenever the token expires. */
38
- identify: (getToken: ZeanTokenSource) => void;
46
+ /**
47
+ * The person signed in. The first device to bring their id joins their Conversation at once; another device asks
48
+ * them for a code emailed to them first.
49
+ */
50
+ identify: (user: ZeanUser) => void;
39
51
  /** The person signed out: the chat starts over, anonymous. */
40
52
  signOut: () => void;
41
53
  /** Joined to what was set before. Values the chat cannot keep are refused, and the console says why. */
@@ -114,6 +114,11 @@ export interface TypingBubbleProps {
114
114
  app: ChatApp;
115
115
  sender: ChatSender | null;
116
116
  }
117
+ export interface ContactCodeCardProps {
118
+ /** The masked saved email, and whether the code went. */
119
+ code: NonNullable<ChatState['contactCode']>;
120
+ onDismiss: () => void;
121
+ }
117
122
  export interface EmailFormProps {
118
123
  onSubmit: (email: string) => Promise<ChatResult>;
119
124
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zean-chat/react-native",
3
- "version": "0.1.1",
3
+ "version": "0.1.4",
4
4
  "description": "In-app support chat for React Native and Expo, iOS and Android. Pure JS, no native module. A free Intercom, Crisp and Zendesk mobile SDK alternative.",
5
5
  "keywords": [
6
6
  "react-native",