@messenger-box/platform-mobile 10.0.3-alpha.10 → 10.0.3-alpha.101

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.
Files changed (92) hide show
  1. package/CHANGELOG.md +160 -0
  2. package/lib/compute.js +2 -3
  3. package/lib/compute.js.map +1 -1
  4. package/lib/index.js.map +1 -1
  5. package/lib/module.js.map +1 -1
  6. package/lib/queries/inboxQueries.js +65 -0
  7. package/lib/queries/inboxQueries.js.map +1 -0
  8. package/lib/routes.json +2 -3
  9. package/lib/screens/inbox/DialogMessages.js.map +1 -1
  10. package/lib/screens/inbox/DialogThreadMessages.js +3 -7
  11. package/lib/screens/inbox/DialogThreadMessages.js.map +1 -1
  12. package/lib/screens/inbox/DialogThreads.js +57 -18
  13. package/lib/screens/inbox/DialogThreads.js.map +1 -1
  14. package/lib/screens/inbox/Inbox.js.map +1 -1
  15. package/lib/screens/inbox/components/CachedImage/consts.js +1 -1
  16. package/lib/screens/inbox/components/CachedImage/consts.js.map +1 -1
  17. package/lib/screens/inbox/components/CachedImage/index.js +168 -46
  18. package/lib/screens/inbox/components/CachedImage/index.js.map +1 -1
  19. package/lib/screens/inbox/components/DialogItem.js +169 -0
  20. package/lib/screens/inbox/components/DialogItem.js.map +1 -0
  21. package/lib/screens/inbox/components/GiftedChatInboxComponent.js +313 -0
  22. package/lib/screens/inbox/components/GiftedChatInboxComponent.js.map +1 -0
  23. package/lib/screens/inbox/components/SlackMessageContainer/ImageViewerModal.js.map +1 -1
  24. package/lib/screens/inbox/components/SlackMessageContainer/SlackBubble.js +147 -31
  25. package/lib/screens/inbox/components/SlackMessageContainer/SlackBubble.js.map +1 -1
  26. package/lib/screens/inbox/components/SlackMessageContainer/SlackMessage.js +5 -0
  27. package/lib/screens/inbox/components/SlackMessageContainer/SlackMessage.js.map +1 -1
  28. package/lib/screens/inbox/components/SubscriptionHandler.js +24 -0
  29. package/lib/screens/inbox/components/SubscriptionHandler.js.map +1 -0
  30. package/lib/screens/inbox/components/ThreadsViewItem.js +66 -44
  31. package/lib/screens/inbox/components/ThreadsViewItem.js.map +1 -1
  32. package/lib/screens/inbox/config/config.js +2 -2
  33. package/lib/screens/inbox/config/config.js.map +1 -1
  34. package/lib/screens/inbox/containers/ConversationView.js +1105 -428
  35. package/lib/screens/inbox/containers/ConversationView.js.map +1 -1
  36. package/lib/screens/inbox/containers/Dialogs.js +193 -80
  37. package/lib/screens/inbox/containers/Dialogs.js.map +1 -1
  38. package/lib/screens/inbox/containers/ThreadConversationView.js +724 -207
  39. package/lib/screens/inbox/containers/ThreadConversationView.js.map +1 -1
  40. package/lib/screens/inbox/containers/ThreadsView.js +83 -50
  41. package/lib/screens/inbox/containers/ThreadsView.js.map +1 -1
  42. package/lib/screens/inbox/hooks/useInboxMessages.js +31 -0
  43. package/lib/screens/inbox/hooks/useInboxMessages.js.map +1 -0
  44. package/lib/screens/inbox/hooks/useSafeDialogThreadsMachine.js +108 -0
  45. package/lib/screens/inbox/hooks/useSafeDialogThreadsMachine.js.map +1 -0
  46. package/lib/screens/inbox/workflow/dialog-threads-xstate.js +151 -0
  47. package/lib/screens/inbox/workflow/dialog-threads-xstate.js.map +1 -0
  48. package/package.json +4 -4
  49. package/src/index.ts +2 -0
  50. package/src/queries/inboxQueries.ts +299 -0
  51. package/src/queries/index.d.ts +2 -0
  52. package/src/queries/index.ts +1 -0
  53. package/src/screens/inbox/DialogThreadMessages.tsx +3 -11
  54. package/src/screens/inbox/DialogThreads.tsx +53 -60
  55. package/src/screens/inbox/components/Actionsheet.tsx +30 -0
  56. package/src/screens/inbox/components/CachedImage/consts.ts +4 -3
  57. package/src/screens/inbox/components/CachedImage/index.tsx +232 -61
  58. package/src/screens/inbox/components/DialogItem.tsx +306 -0
  59. package/src/screens/inbox/components/DialogsListItem.tsx +257 -176
  60. package/src/screens/inbox/components/ExpandableInput.tsx +460 -0
  61. package/src/screens/inbox/components/ExpandableInputActionSheet.tsx +518 -0
  62. package/src/screens/inbox/components/GiftedChatInboxComponent.tsx +411 -0
  63. package/src/screens/inbox/components/ServiceDialogsListItem.tsx +334 -172
  64. package/src/screens/inbox/components/SlackInput.tsx +23 -0
  65. package/src/screens/inbox/components/SlackMessageContainer/SlackBubble.tsx +233 -23
  66. package/src/screens/inbox/components/SmartLoader.tsx +61 -0
  67. package/src/screens/inbox/components/SubscriptionHandler.tsx +41 -0
  68. package/src/screens/inbox/components/SupportServiceDialogsListItem.tsx +41 -24
  69. package/src/screens/inbox/components/ThreadsViewItem.tsx +177 -265
  70. package/src/screens/inbox/components/workflow/dialogs-list-item-xstate.ts +145 -0
  71. package/src/screens/inbox/components/workflow/service-dialogs-list-item-xstate.ts +159 -0
  72. package/src/screens/inbox/config/config.ts +2 -2
  73. package/src/screens/inbox/containers/ConversationView.tsx +1843 -702
  74. package/src/screens/inbox/containers/ConversationView.tsx.bk +1467 -0
  75. package/src/screens/inbox/containers/Dialogs.tsx +400 -197
  76. package/src/screens/inbox/containers/SupportServiceDialogs.tsx +2 -2
  77. package/src/screens/inbox/containers/ThreadConversationView.tsx +1337 -301
  78. package/src/screens/inbox/containers/ThreadsView.tsx +105 -186
  79. package/src/screens/inbox/containers/workflow/apollo/handleResult.ts +20 -0
  80. package/src/screens/inbox/containers/workflow/conversation-xstate.ts +313 -0
  81. package/src/screens/inbox/containers/workflow/dialogs-xstate.ts +196 -0
  82. package/src/screens/inbox/containers/workflow/thread-conversation-xstate.ts +401 -0
  83. package/src/screens/inbox/hooks/useInboxMessages.ts +34 -0
  84. package/src/screens/inbox/hooks/useSafeDialogThreadsMachine.ts +136 -0
  85. package/src/screens/inbox/index.ts +37 -0
  86. package/src/screens/inbox/machines/threadsMachine.ts +147 -0
  87. package/src/screens/inbox/workflow/dialog-threads-xstate.ts +163 -0
  88. package/tsconfig.json +11 -54
  89. package/lib/screens/inbox/components/DialogsListItem.js +0 -159
  90. package/lib/screens/inbox/components/DialogsListItem.js.map +0 -1
  91. package/lib/screens/inbox/components/ServiceDialogsListItem.js +0 -159
  92. package/lib/screens/inbox/components/ServiceDialogsListItem.js.map +0 -1
@@ -0,0 +1,159 @@
1
+ import { assign, setup } from 'xstate';
2
+ import { merge } from 'lodash-es';
3
+
4
+ export const enum Actions {
5
+ INITIAL_CONTEXT = 'INITIAL_CONTEXT',
6
+ ERROR_HANDLED = 'ERROR_HANDLED',
7
+ FETCH_THREAD_MESSAGES = 'FETCH_THREAD_MESSAGES',
8
+ UPDATE_THREAD_MESSAGES = 'UPDATE_THREAD_MESSAGES',
9
+ SUBSCRIBE_TO_THREAD_MESSAGES = 'SUBSCRIBE_TO_THREAD_MESSAGES',
10
+ SET_TITLE = 'SET_TITLE',
11
+ START_LOADING = 'START_LOADING',
12
+ STOP_LOADING = 'STOP_LOADING',
13
+ SET_SERVICE_POST_PARENT_ID = 'SET_SERVICE_POST_PARENT_ID',
14
+ }
15
+
16
+ export const enum BaseState {
17
+ Idle = 'idle',
18
+ Error = 'error',
19
+ FetchingThreadMessages = 'fetchingThreadMessages',
20
+ }
21
+
22
+ export const serviceDialogsListItemXstate = setup({
23
+ types: {
24
+ context: {} as {
25
+ channelId: string | null;
26
+ currentUser: any;
27
+ threadMessages: any[];
28
+ loading: boolean;
29
+ error: string | null;
30
+ title: string;
31
+ role: string;
32
+ servicePostParentId: string | null;
33
+ lastMessage: any;
34
+ },
35
+ },
36
+ actions: {
37
+ errorState: assign(({ context, event }) => {
38
+ return {
39
+ ...context,
40
+ error: event.data?.message || 'An error occurred',
41
+ loading: false,
42
+ };
43
+ }),
44
+ setInitialContext: assign(({ context, event }) => {
45
+ return merge({
46
+ ...context,
47
+ channelId: event.data?.channelId || null,
48
+ currentUser: event.data?.currentUser || null,
49
+ role: event.data?.role || null,
50
+ loading: true,
51
+ });
52
+ }),
53
+ setThreadMessages: assign(({ context, event }) => {
54
+ return {
55
+ ...context,
56
+ threadMessages: event.data?.threadMessages || [],
57
+ loading: false,
58
+ };
59
+ }),
60
+ updateThreadMessages: assign(({ context, event }) => {
61
+ const newThreadMessage = event.data?.message;
62
+ if (!newThreadMessage) return context;
63
+
64
+ return {
65
+ ...context,
66
+ threadMessages: [...context.threadMessages, newThreadMessage],
67
+ };
68
+ }),
69
+ setTitle: assign(({ context, event }) => {
70
+ return {
71
+ ...context,
72
+ title: event.data?.title || '',
73
+ };
74
+ }),
75
+ setServicePostParentId: assign(({ context, event }) => {
76
+ return {
77
+ ...context,
78
+ servicePostParentId: event.data?.servicePostParentId || null,
79
+ };
80
+ }),
81
+ startLoading: assign(({ context }) => {
82
+ return {
83
+ ...context,
84
+ loading: true,
85
+ };
86
+ }),
87
+ stopLoading: assign(({ context }) => {
88
+ return {
89
+ ...context,
90
+ loading: false,
91
+ };
92
+ }),
93
+ },
94
+ }).createMachine({
95
+ id: 'service-dialogs-list-item',
96
+ initial: BaseState.Idle,
97
+ context: {
98
+ channelId: null,
99
+ currentUser: null,
100
+ threadMessages: [],
101
+ loading: false,
102
+ error: null,
103
+ title: '',
104
+ role: '',
105
+ servicePostParentId: null,
106
+ lastMessage: null,
107
+ },
108
+ states: {
109
+ [BaseState.Idle]: {
110
+ on: {
111
+ [Actions.INITIAL_CONTEXT]: {
112
+ target: BaseState.FetchingThreadMessages,
113
+ actions: ['setInitialContext'],
114
+ },
115
+ [Actions.UPDATE_THREAD_MESSAGES]: {
116
+ target: BaseState.Idle,
117
+ actions: ['updateThreadMessages'],
118
+ },
119
+ [Actions.SET_TITLE]: {
120
+ target: BaseState.Idle,
121
+ actions: ['setTitle'],
122
+ },
123
+ [Actions.SET_SERVICE_POST_PARENT_ID]: {
124
+ target: BaseState.Idle,
125
+ actions: ['setServicePostParentId'],
126
+ },
127
+ [Actions.START_LOADING]: {
128
+ target: BaseState.Idle,
129
+ actions: ['startLoading'],
130
+ },
131
+ [Actions.STOP_LOADING]: {
132
+ target: BaseState.Idle,
133
+ actions: ['stopLoading'],
134
+ },
135
+ },
136
+ },
137
+ [BaseState.Error]: {
138
+ entry: ['errorState'],
139
+ on: {
140
+ [Actions.ERROR_HANDLED]: {
141
+ target: BaseState.Idle,
142
+ },
143
+ },
144
+ },
145
+ [BaseState.FetchingThreadMessages]: {
146
+ invoke: {
147
+ src: 'fetchThreadMessages',
148
+ input: ({ context, event }) => ({ context, event }),
149
+ onDone: {
150
+ target: BaseState.Idle,
151
+ actions: ['setThreadMessages'],
152
+ },
153
+ onError: {
154
+ target: BaseState.Error,
155
+ },
156
+ },
157
+ },
158
+ },
159
+ } as any);
@@ -10,6 +10,6 @@ export const config = cleanEnv(process['APP_ENV'] || process.env, {
10
10
  THREADS_PATH: str({ default: 'MainStack.Thread' }),
11
11
  CALL_TO_ACTION_PATH: str({ default: 'MainStack.GuestReservationRequestDetail' }),
12
12
  CALL_TO_ACTION_BOX_BGCOLOR: str({ default: '#0084ff' }),
13
- CALL_TO_ACTION_BUTTON_BORDERCOLOR: str({ default: '#fff' }),
14
- CALL_TO_ACTION_TEXT_COLOR: str({ default: '#fff' }),
13
+ CALL_TO_ACTION_BUTTON_BORDERCOLOR: str({ default: '#000' }),
14
+ CALL_TO_ACTION_TEXT_COLOR: str({ default: '#000' }),
15
15
  });