favesalon-embed 1.0.1 → 1.0.3

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 (160) hide show
  1. package/dist/custom-elements/index.d.ts +24 -0
  2. package/dist/{cjs/_commonjsHelpers-5cfcba41.js → favesalon-embed/_commonjsHelpers-9bc404fc.js} +14 -6
  3. package/dist/{esm/_commonjsHelpers-098d5b27.js → favesalon-embed/_commonjsHelpers-a4f66ccd.js} +14 -2
  4. package/dist/{cjs/global-9073d10e.js → favesalon-embed/app-globals-437cc3f3.js} +15 -8
  5. package/dist/{esm/global-e1089ffd.js → favesalon-embed/app-globals-60769a2c.js} +16 -7
  6. package/dist/favesalon-embed/chat-box.entry.js +54 -0
  7. package/dist/favesalon-embed/chat-button.entry.js +51 -0
  8. package/dist/favesalon-embed/chat-form.entry.js +39 -0
  9. package/dist/favesalon-embed/chat-messages.entry.js +53 -0
  10. package/dist/favesalon-embed/chat-rooms.entry.js +17279 -0
  11. package/dist/favesalon-embed/css-shim-b7d3d95f.js +4 -0
  12. package/dist/favesalon-embed/dom-64053c71.js +73 -0
  13. package/dist/favesalon-embed/favesalon-embed.css +2433 -4
  14. package/dist/favesalon-embed/favesalon-embed.esm.js +148 -1
  15. package/dist/{collection/components/google-map/index.js → favesalon-embed/google-map.entry.js} +12 -54
  16. package/dist/{esm/index-80523fec.js → favesalon-embed/index-00b83e1c.js} +425 -15
  17. package/dist/favesalon-embed/index-04c09911.js +3371 -0
  18. package/dist/favesalon-embed/index-888e99e3.js +3371 -0
  19. package/dist/{cjs/index-7f190886.js → favesalon-embed/index-ac52896a.js} +454 -47
  20. package/dist/favesalon-embed/index.esm.js +1 -0
  21. package/dist/favesalon-embed/isObject-13b86c17.js +203 -0
  22. package/dist/favesalon-embed/relativeTime-15477f02.js +7 -0
  23. package/dist/favesalon-embed/relativeTime-268e64b0.js +7 -0
  24. package/dist/{esm → favesalon-embed}/salon-booking-modal.entry.js +1 -1
  25. package/dist/{esm → favesalon-embed}/salon-booking.entry.js +3 -3
  26. package/dist/{esm → favesalon-embed}/salon-gift-card-modal.entry.js +1 -1
  27. package/dist/{esm → favesalon-embed}/salon-gift-card.entry.js +3 -3
  28. package/dist/favesalon-embed/salon-info.entry.js +29 -0
  29. package/dist/{esm → favesalon-embed}/salon-latest-reviews.entry.js +4 -4
  30. package/dist/{collection/components/salon-latest-styles/index.js → favesalon-embed/salon-latest-styles.entry.js} +14 -99
  31. package/dist/{collection/components/salon-locations/index.js → favesalon-embed/salon-locations.entry.js} +15 -95
  32. package/dist/{esm → favesalon-embed}/salon-lookbook.entry.js +3 -3
  33. package/dist/{esm → favesalon-embed}/salon-ranking.entry.js +1 -1
  34. package/dist/{esm → favesalon-embed}/salon-reviews.entry.js +3 -3
  35. package/dist/{collection/components/salon-schedules/index.js → favesalon-embed/salon-schedules.entry.js} +14 -95
  36. package/dist/{esm → favesalon-embed}/salon-services.entry.js +3 -3
  37. package/dist/{esm → favesalon-embed}/salon-stylists.entry.js +3 -3
  38. package/dist/{custom-elements/index.js → favesalon-embed/services-55a87166.js} +2465 -7150
  39. package/dist/{cjs/services-125c82d8.js → favesalon-embed/services-7c46a2fd.js} +2465 -103
  40. package/dist/{esm/services-40a3e622.js → favesalon-embed/services-7cb8f2a6.js} +2469 -100
  41. package/dist/favesalon-embed/shadow-css-98135883.js +387 -0
  42. package/dist/{esm → favesalon-embed}/style-detail.entry.js +4 -4
  43. package/dist/{esm → favesalon-embed}/user-avatar.entry.js +13 -4
  44. package/dist/{esm/utils-e97485e0.js → favesalon-embed/utils-2c19db45.js} +6 -0
  45. package/dist/types/components/chat-box/index.d.ts +12 -0
  46. package/dist/types/components/chat-button/index.d.ts +0 -8
  47. package/dist/types/components/chat-form/index.d.ts +6 -0
  48. package/dist/types/components/chat-messages/index.d.ts +14 -0
  49. package/dist/types/components/chat-rooms/index.d.ts +12 -0
  50. package/dist/types/components/user-avatar/index.d.ts +2 -1
  51. package/dist/types/components.d.ts +84 -1
  52. package/dist/types/utils/utils.d.ts +1 -0
  53. package/package.json +1 -1
  54. package/dist/cjs/chat-button.cjs.entry.js +0 -118
  55. package/dist/cjs/colors-38421769.js +0 -69
  56. package/dist/cjs/favesalon-embed.cjs.js +0 -24
  57. package/dist/cjs/google-map_5.cjs.entry.js +0 -310
  58. package/dist/cjs/index-47c2a5f6.js +0 -1533
  59. package/dist/cjs/index.cjs.js +0 -2
  60. package/dist/cjs/loader.cjs.js +0 -23
  61. package/dist/cjs/relativeTime-3721080d.js +0 -9
  62. package/dist/cjs/salon-booking-modal.cjs.entry.js +0 -30
  63. package/dist/cjs/salon-booking.cjs.entry.js +0 -51
  64. package/dist/cjs/salon-gift-card-modal.cjs.entry.js +0 -29
  65. package/dist/cjs/salon-gift-card.cjs.entry.js +0 -51
  66. package/dist/cjs/salon-latest-reviews.cjs.entry.js +0 -97
  67. package/dist/cjs/salon-lookbook.cjs.entry.js +0 -222
  68. package/dist/cjs/salon-ranking.cjs.entry.js +0 -60
  69. package/dist/cjs/salon-reviews.cjs.entry.js +0 -193
  70. package/dist/cjs/salon-services.cjs.entry.js +0 -81
  71. package/dist/cjs/salon-stylists.cjs.entry.js +0 -118
  72. package/dist/cjs/style-detail.cjs.entry.js +0 -312
  73. package/dist/cjs/user-avatar.cjs.entry.js +0 -45
  74. package/dist/cjs/utils-c5a33b3c.js +0 -23
  75. package/dist/collection/collection-manifest.json +0 -29
  76. package/dist/collection/components/chat-button/index.css +0 -122
  77. package/dist/collection/components/chat-button/index.js +0 -218
  78. package/dist/collection/components/chat-conversation/index.js +0 -103
  79. package/dist/collection/components/google-map/assets/map--placeholder.jpeg +0 -0
  80. package/dist/collection/components/google-map/index.css +0 -5
  81. package/dist/collection/components/salon-booking/index.css +0 -30
  82. package/dist/collection/components/salon-booking/index.js +0 -126
  83. package/dist/collection/components/salon-booking/salon-booking-modal.js +0 -92
  84. package/dist/collection/components/salon-gift-card/index.css +0 -30
  85. package/dist/collection/components/salon-gift-card/index.js +0 -126
  86. package/dist/collection/components/salon-gift-card/salon-gift-card-modal.js +0 -73
  87. package/dist/collection/components/salon-info/index.css +0 -1
  88. package/dist/collection/components/salon-info/index.js +0 -77
  89. package/dist/collection/components/salon-latest-reviews/index.css +0 -11
  90. package/dist/collection/components/salon-latest-reviews/index.js +0 -163
  91. package/dist/collection/components/salon-latest-styles/index.css +0 -12
  92. package/dist/collection/components/salon-locations/index.css +0 -24
  93. package/dist/collection/components/salon-lookbook/index.css +0 -15
  94. package/dist/collection/components/salon-lookbook/index.js +0 -368
  95. package/dist/collection/components/salon-ranking/index.css +0 -3
  96. package/dist/collection/components/salon-ranking/index.js +0 -117
  97. package/dist/collection/components/salon-reviews/index.css +0 -18
  98. package/dist/collection/components/salon-reviews/index.js +0 -249
  99. package/dist/collection/components/salon-schedules/index.css +0 -18
  100. package/dist/collection/components/salon-services/index.css +0 -1
  101. package/dist/collection/components/salon-services/index.js +0 -146
  102. package/dist/collection/components/salon-stylists/index.css +0 -43
  103. package/dist/collection/components/salon-stylists/index.js +0 -184
  104. package/dist/collection/components/style-detail/index.css +0 -76
  105. package/dist/collection/components/style-detail/index.js +0 -386
  106. package/dist/collection/components/user-avatar/index.css +0 -0
  107. package/dist/collection/components/user-avatar/index.js +0 -134
  108. package/dist/collection/constants/colors.js +0 -65
  109. package/dist/collection/global/global.js +0 -8
  110. package/dist/collection/index.js +0 -1
  111. package/dist/collection/mocks/users.js +0 -10
  112. package/dist/collection/services/services.js +0 -295
  113. package/dist/collection/types/chat.js +0 -23
  114. package/dist/collection/types/common.js +0 -11
  115. package/dist/collection/types/review.js +0 -39
  116. package/dist/collection/types/salon.js +0 -58
  117. package/dist/collection/types/service.js +0 -24
  118. package/dist/collection/types/style.js +0 -128
  119. package/dist/collection/types/stylist.js +0 -30
  120. package/dist/collection/types/user.js +0 -10
  121. package/dist/collection/utils/utils.js +0 -20
  122. package/dist/esm/chat-button.entry.js +0 -114
  123. package/dist/esm/favesalon-embed.js +0 -19
  124. package/dist/esm/google-map_5.entry.js +0 -302
  125. package/dist/esm/index-3fae868e.js +0 -1506
  126. package/dist/esm/index.js +0 -1
  127. package/dist/esm/loader.js +0 -19
  128. package/dist/esm/polyfills/core-js.js +0 -11
  129. package/dist/esm/polyfills/css-shim.js +0 -1
  130. package/dist/esm/polyfills/dom.js +0 -79
  131. package/dist/esm/polyfills/es5-html-element.js +0 -1
  132. package/dist/esm/polyfills/index.js +0 -34
  133. package/dist/esm/polyfills/system.js +0 -6
  134. package/dist/esm/relativeTime-cd452e6d.js +0 -7
  135. package/dist/favesalon-embed/p-019c5ccd.entry.js +0 -1
  136. package/dist/favesalon-embed/p-083a8821.entry.js +0 -1
  137. package/dist/favesalon-embed/p-0d0ed9ea.entry.js +0 -1
  138. package/dist/favesalon-embed/p-119db8de.entry.js +0 -1
  139. package/dist/favesalon-embed/p-1432c51b.entry.js +0 -1
  140. package/dist/favesalon-embed/p-22093506.entry.js +0 -1
  141. package/dist/favesalon-embed/p-32b314e9.js +0 -2
  142. package/dist/favesalon-embed/p-47e646f8.js +0 -1
  143. package/dist/favesalon-embed/p-4a5eca9a.js +0 -6
  144. package/dist/favesalon-embed/p-58d2e9be.js +0 -1
  145. package/dist/favesalon-embed/p-71404b6a.entry.js +0 -1
  146. package/dist/favesalon-embed/p-857c3a61.entry.js +0 -1
  147. package/dist/favesalon-embed/p-99ec77f7.entry.js +0 -1
  148. package/dist/favesalon-embed/p-a33331cc.js +0 -1
  149. package/dist/favesalon-embed/p-b0c3673a.entry.js +0 -1
  150. package/dist/favesalon-embed/p-b287b1ea.entry.js +0 -1
  151. package/dist/favesalon-embed/p-b3af7842.entry.js +0 -1
  152. package/dist/favesalon-embed/p-b630ae68.js +0 -1580
  153. package/dist/favesalon-embed/p-ce2c1c9a.entry.js +0 -1
  154. package/dist/favesalon-embed/p-d6083940.js +0 -1
  155. package/dist/favesalon-embed/p-d9b7ad58.entry.js +0 -1
  156. package/dist/favesalon-embed/p-fc9a5551.js +0 -6
  157. package/dist/index.cjs.js +0 -1
  158. package/dist/index.js +0 -1
  159. package/dist/types/components/chat-conversation/index.d.ts +0 -0
  160. /package/dist/{esm → favesalon-embed}/colors-ea36347a.js +0 -0
@@ -5,7 +5,15 @@
5
5
  * It contains typing information for all components that exist in this project.
6
6
  */
7
7
  import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
8
+ import { User } from "./types/user";
9
+ import { ChatMessage, ChatRoom } from "./types/chat";
8
10
  export namespace Components {
11
+ interface ChatBox {
12
+ "accessToken": string;
13
+ "fetchData": () => Promise<void>;
14
+ "primaryColor": string;
15
+ "senderId": string;
16
+ }
9
17
  interface ChatButton {
10
18
  "accessToken": string;
11
19
  "fetchData": () => Promise<void>;
@@ -13,6 +21,22 @@ export namespace Components {
13
21
  "receiverId": string;
14
22
  "senderId": string;
15
23
  }
24
+ interface ChatForm {
25
+ "chatRoomId": string;
26
+ "senderId": number;
27
+ }
28
+ interface ChatMessages {
29
+ "chatRoomId": string;
30
+ "messages": ChatMessage[];
31
+ "receiver": User;
32
+ "sender": User;
33
+ }
34
+ interface ChatRooms {
35
+ "activeRoom": ChatRoom;
36
+ "chatRooms": ChatRoom[];
37
+ "onClickRoom": (chatRoom: ChatRoom) => void;
38
+ "senderId": number;
39
+ }
16
40
  interface GoogleMap {
17
41
  "locationAddress"?: string;
18
42
  "locationName"?: string;
@@ -100,19 +124,44 @@ export namespace Components {
100
124
  }
101
125
  interface UserAvatar {
102
126
  "avatar": string;
103
- "name": string;
127
+ "description"?: string;
128
+ "name"?: string;
104
129
  "nameStyle"?: object;
105
130
  "shortName": string;
106
131
  "size": number;
107
132
  }
108
133
  }
109
134
  declare global {
135
+ interface HTMLChatBoxElement extends Components.ChatBox, HTMLStencilElement {
136
+ }
137
+ var HTMLChatBoxElement: {
138
+ prototype: HTMLChatBoxElement;
139
+ new (): HTMLChatBoxElement;
140
+ };
110
141
  interface HTMLChatButtonElement extends Components.ChatButton, HTMLStencilElement {
111
142
  }
112
143
  var HTMLChatButtonElement: {
113
144
  prototype: HTMLChatButtonElement;
114
145
  new (): HTMLChatButtonElement;
115
146
  };
147
+ interface HTMLChatFormElement extends Components.ChatForm, HTMLStencilElement {
148
+ }
149
+ var HTMLChatFormElement: {
150
+ prototype: HTMLChatFormElement;
151
+ new (): HTMLChatFormElement;
152
+ };
153
+ interface HTMLChatMessagesElement extends Components.ChatMessages, HTMLStencilElement {
154
+ }
155
+ var HTMLChatMessagesElement: {
156
+ prototype: HTMLChatMessagesElement;
157
+ new (): HTMLChatMessagesElement;
158
+ };
159
+ interface HTMLChatRoomsElement extends Components.ChatRooms, HTMLStencilElement {
160
+ }
161
+ var HTMLChatRoomsElement: {
162
+ prototype: HTMLChatRoomsElement;
163
+ new (): HTMLChatRoomsElement;
164
+ };
116
165
  interface HTMLGoogleMapElement extends Components.GoogleMap, HTMLStencilElement {
117
166
  }
118
167
  var HTMLGoogleMapElement: {
@@ -216,7 +265,11 @@ declare global {
216
265
  new (): HTMLUserAvatarElement;
217
266
  };
218
267
  interface HTMLElementTagNameMap {
268
+ "chat-box": HTMLChatBoxElement;
219
269
  "chat-button": HTMLChatButtonElement;
270
+ "chat-form": HTMLChatFormElement;
271
+ "chat-messages": HTMLChatMessagesElement;
272
+ "chat-rooms": HTMLChatRoomsElement;
220
273
  "google-map": HTMLGoogleMapElement;
221
274
  "salon-booking": HTMLSalonBookingElement;
222
275
  "salon-booking-modal": HTMLSalonBookingModalElement;
@@ -237,12 +290,33 @@ declare global {
237
290
  }
238
291
  }
239
292
  declare namespace LocalJSX {
293
+ interface ChatBox {
294
+ "accessToken"?: string;
295
+ "primaryColor"?: string;
296
+ "senderId"?: string;
297
+ }
240
298
  interface ChatButton {
241
299
  "accessToken"?: string;
242
300
  "primaryColor"?: string;
243
301
  "receiverId"?: string;
244
302
  "senderId"?: string;
245
303
  }
304
+ interface ChatForm {
305
+ "chatRoomId"?: string;
306
+ "senderId"?: number;
307
+ }
308
+ interface ChatMessages {
309
+ "chatRoomId"?: string;
310
+ "messages"?: ChatMessage[];
311
+ "receiver"?: User;
312
+ "sender"?: User;
313
+ }
314
+ interface ChatRooms {
315
+ "activeRoom"?: ChatRoom;
316
+ "chatRooms"?: ChatRoom[];
317
+ "onClickRoom"?: (chatRoom: ChatRoom) => void;
318
+ "senderId"?: number;
319
+ }
246
320
  interface GoogleMap {
247
321
  "locationAddress"?: string;
248
322
  "locationName"?: string;
@@ -317,13 +391,18 @@ declare namespace LocalJSX {
317
391
  }
318
392
  interface UserAvatar {
319
393
  "avatar"?: string;
394
+ "description"?: string;
320
395
  "name"?: string;
321
396
  "nameStyle"?: object;
322
397
  "shortName"?: string;
323
398
  "size"?: number;
324
399
  }
325
400
  interface IntrinsicElements {
401
+ "chat-box": ChatBox;
326
402
  "chat-button": ChatButton;
403
+ "chat-form": ChatForm;
404
+ "chat-messages": ChatMessages;
405
+ "chat-rooms": ChatRooms;
327
406
  "google-map": GoogleMap;
328
407
  "salon-booking": SalonBooking;
329
408
  "salon-booking-modal": SalonBookingModal;
@@ -347,7 +426,11 @@ export { LocalJSX as JSX };
347
426
  declare module "@stencil/core" {
348
427
  export namespace JSX {
349
428
  interface IntrinsicElements {
429
+ "chat-box": LocalJSX.ChatBox & JSXBase.HTMLAttributes<HTMLChatBoxElement>;
350
430
  "chat-button": LocalJSX.ChatButton & JSXBase.HTMLAttributes<HTMLChatButtonElement>;
431
+ "chat-form": LocalJSX.ChatForm & JSXBase.HTMLAttributes<HTMLChatFormElement>;
432
+ "chat-messages": LocalJSX.ChatMessages & JSXBase.HTMLAttributes<HTMLChatMessagesElement>;
433
+ "chat-rooms": LocalJSX.ChatRooms & JSXBase.HTMLAttributes<HTMLChatRoomsElement>;
351
434
  "google-map": LocalJSX.GoogleMap & JSXBase.HTMLAttributes<HTMLGoogleMapElement>;
352
435
  "salon-booking": LocalJSX.SalonBooking & JSXBase.HTMLAttributes<HTMLSalonBookingElement>;
353
436
  "salon-booking-modal": LocalJSX.SalonBookingModal & JSXBase.HTMLAttributes<HTMLSalonBookingModalElement>;
@@ -1,4 +1,5 @@
1
1
  import { Salon } from "../types/salon";
2
+ export declare function wait(time?: number): Promise<unknown>;
2
3
  export declare function format(first: string, middle: string, last: string): string;
3
4
  export declare function formatWebsiteUrl(website: string): string;
4
5
  export declare function formatFullAddress(salon: Salon): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "favesalon-embed",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Favesalon Embed",
5
5
  "author": "Trung Luu <trung@favesalon.com> (https://favesalon.com)",
6
6
  "main": "dist/index.cjs.js",
@@ -1,118 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-47c2a5f6.js');
6
- const services = require('./services-125c82d8.js');
7
- const relativeTime = require('./relativeTime-3721080d.js');
8
- require('./_commonjsHelpers-5cfcba41.js');
9
- require('./colors-38421769.js');
10
-
11
- const indexCss = "chat-button{display:inline-block;position:relative}.chat-button--indicator{cursor:pointer;position:absolute;inset:0}.chat-button--counter{background-color:rgb(240, 90, 97);border:1px solid rgb(255, 255, 255);position:absolute;right:-6px;bottom:12px;height:8px;width:8px;-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px}.chat-box{background-color:#fff;display:flex;flex-direction:column;position:fixed;inset:0px;z-index:20000}.chat-box--header{display:flex;justify-content:space-between;padding:16px;position:relative}.chat-box--header-title{color:#fff;font-size:20px;font-weight:600;line-height:1;display:flex;align-items:center;justify-content:space-between;margin:0}.chat-message{overflow:hidden;clear:both;min-width:240px}.chat-message--meta{display:flex}.chat-message--message{background-color:#F1F1F1;padding:8px 12px;position:relative;float:left;margin-top:6px;-moz-border-radius:0 10px 10px 10px;-webkit-border-radius:0 10px 10px 10px;border-radius:0 10px 10px 10px}.chat-conversation--time{clear:both;color:#999;font-size:75%;padding-top:2px}.chat-message.is-owner .chat-message--content{margin-left:12px}.chat-message.is-guest .chat-message--meta{flex-direction:row-reverse}.chat-message.is-guest .chat-message--message{background-color:#EFF7FF;float:right;margin-right:12px;text-align:right;-moz-border-radius:10px 0 10px 10px;-webkit-border-radius:10px 0 10px 10px;border-radius:10px 0 10px 10px}@media (min-width: 768px){.chat-box{border:1px solid #fff;left:unset;top:unset;right:1px;bottom:0px;height:420px;max-height:90vh;width:600px;-moz-border-radius:8px 8px 0px 0px;-webkit-border-radius:8px 8px 0px 0px;border-radius:8px 8px 0px 0px;-moz-box-shadow:rgba(0, 0, 0, 0.1) 0px 0px 24px;-webkit-box-shadow:rgba(0, 0, 0, 0.1) 0px 0px 24px;box-shadow:rgba(0, 0, 0, 0.1) 0px 0px 24px}.chat-box--header{-moz-border-radius:8px 8px 0px 0px;-webkit-border-radius:8px 8px 0px 0px;border-radius:8px 8px 0px 0px}}";
12
-
13
- services.dayjs_min.extend(relativeTime.relativeTime);
14
- const ChatButton = class {
15
- constructor(hostRef) {
16
- index.registerInstance(this, hostRef);
17
- this.onSubmitMessage = async () => {
18
- try {
19
- const elNewMessage = document.getElementById('chat-form--input');
20
- await services.HttpService().sendChatMessage({
21
- message: elNewMessage.value,
22
- senderId: this.senderInfo.id,
23
- chatRoomId: this.chatRoom.uid,
24
- });
25
- elNewMessage.value = '';
26
- }
27
- catch (error) { }
28
- };
29
- this.markMessagesAsRead = async () => {
30
- try {
31
- const unreadMessages = (this.chatMessages || []).filter(message => {
32
- return Boolean(message.unRead) && message.senderId !== this.senderInfo.id;
33
- });
34
- if (unreadMessages.length > 0) {
35
- await services.HttpService().markMessagesAsRead(this.chatRoom.uid, unreadMessages);
36
- }
37
- }
38
- catch (e) { }
39
- };
40
- this.scrollToLastMessage = () => {
41
- const targetElement = document.getElementById('chat--last-message');
42
- targetElement && targetElement.scrollIntoView();
43
- };
44
- this.renderMessage = (chatMessage) => {
45
- const { message, senderId, timestamp } = chatMessage;
46
- const isOwner = this.senderInfo.id === senderId;
47
- return (index.h("div", { class: `chat-message ${isOwner ? 'is-owner' : 'is-guest'}` }, index.h("div", { class: "chat-message--meta" }, index.h("user-avatar", { size: 40, shortName: String(((isOwner ? this.senderInfo : this.receiverInfo) || {}).fullName || '').charAt(0), avatar: ((isOwner ? this.senderInfo : this.receiverInfo) || {}).avatar }), index.h("div", { class: "chat-message--content" }, index.h("div", { class: "chat-message--message" }, message), timestamp && (index.h("div", { class: "chat-conversation--time" }, services.dayjs_min(timestamp).format('HH:mm')))))));
48
- };
49
- this.renderMessages = () => {
50
- const isEmpty = (this.chatMessages || []).length === 0;
51
- return (index.h("div", { class: "chat-messages" }, !isEmpty && this.chatMessages.map(this.renderMessage), isEmpty && (index.h("div", { style: { paddingTop: '48px', textAlign: 'center' } }, index.h("i", { class: "ri-bubble-chart-line", style: { fontSize: '48px' } }), index.h("div", { style: { color: 'rgba(0, 0, 0, 0.45)', marginTop: '8px' } }, "Enter a message on below to get starting"))), index.h("div", { id: "chat--last-message" })));
52
- };
53
- this.primaryColor = undefined;
54
- this.accessToken = undefined;
55
- this.senderId = undefined;
56
- this.receiverId = undefined;
57
- this.senderInfo = {};
58
- this.receiverInfo = {};
59
- this.chatRoom = undefined;
60
- this.chatMessages = undefined;
61
- this.isChatExpanded = undefined;
62
- }
63
- componentWillLoad() {
64
- this.fetchData();
65
- }
66
- componentDidLoad() {
67
- this.scrollToLastMessage();
68
- this.markMessagesAsRead();
69
- }
70
- componentWillUpdate() {
71
- this.scrollToLastMessage();
72
- }
73
- async fetchData() {
74
- try {
75
- this.chatRoom = await services.HttpService().createChatRoom(this.receiverId, this.accessToken);
76
- if (this.chatRoom) {
77
- services.HttpService().fetchChatMessages(this.chatRoom.uid, (messages) => this.chatMessages = messages);
78
- this.senderInfo = this.chatRoom.members.find(user => user.id === Number(this.senderId));
79
- this.receiverInfo = this.chatRoom.members.find(user => user.id === Number(this.receiverId));
80
- }
81
- }
82
- catch (e) { }
83
- }
84
- renderForm() {
85
- return (index.h("div", { style: { display: 'flex', height: '100%' } }, index.h("input", { id: "chat-form--input", type: "text", class: "form-control", placeholder: "Enter a message...", style: { border: 'none' }, onKeyPress: (evt) => {
86
- if (evt.key === 'Enter') {
87
- evt.preventDefault();
88
- this.onSubmitMessage();
89
- }
90
- } }), index.h("button", { type: "button", class: "btn btn-link", style: {
91
- textDecoration: 'none',
92
- display: 'flex',
93
- height: '100%',
94
- alignItems: 'center',
95
- }, onClick: () => this.onSubmitMessage() }, index.h("i", { class: "ri-send-plane-2-line", style: { color: '#111', fontSize: '24px', lineHeight: '1' } }))));
96
- }
97
- render() {
98
- const unreadMessages = (this.chatMessages || []).filter(message => {
99
- return Boolean(message.unRead) && message.senderId !== this.senderInfo.id;
100
- });
101
- return (index.h("div", null, index.h("div", { class: "chat-button--indicator", onClick: () => this.isChatExpanded = true }, unreadMessages.length > 0 && index.h("span", { class: "chat-button--counter" })), index.h("div", { class: "chat-box", style: this.isChatExpanded ? {} : { display: 'none' } }, index.h("div", { class: "chat-box--header", style: {
102
- backgroundColor: this.primaryColor || '#f05a61',
103
- } }, index.h("h3", { class: "chat-box--header-title" }, "Chat"), index.h("div", { class: "salon-modal--close", onClick: () => this.isChatExpanded = false, style: { position: 'static' } })), index.h("div", { style: {
104
- flexShrink: '1',
105
- flexGrow: '1',
106
- overflowY: 'auto',
107
- padding: '16px',
108
- } }, this.renderMessages()), index.h("div", { style: {
109
- height: '50px',
110
- minHeight: '50px',
111
- paddingTop: '1',
112
- borderTop: '1px solid rgb(245, 245, 245)',
113
- } }, this.renderForm()))));
114
- }
115
- };
116
- ChatButton.style = indexCss;
117
-
118
- exports.chat_button = ChatButton;
@@ -1,69 +0,0 @@
1
- 'use strict';
2
-
3
- const Colors = {
4
- TextColor: '#141414',
5
- Black: '#000000',
6
- White: '#ffffff',
7
- Primary: '#F05A61',
8
- Secondary: '#001529',
9
- Black01: '#262626',
10
- Black02: '#1f1f1f',
11
- Black03: '#141414',
12
- Gray01: '#F5F5F5',
13
- Gray02: '#EFEFEF',
14
- Gray03: '#DBDBDB',
15
- Gray04: '#999999',
16
- Gray05: '#666666',
17
- Red01: '#FEEFEF',
18
- Red02: '#F9BDC0',
19
- Red03: '#F05A61',
20
- Red04: '#C0484E',
21
- Red05: '#90363A',
22
- Orange01: '#FFF4F0',
23
- Orange02: '#FFD1C3',
24
- Orange03: '#FF8D69',
25
- Orange04: '#CC7154',
26
- Orange05: '#99553F',
27
- Yellow01: '#FDFBF4',
28
- Yellow02: '#F8EDD3',
29
- Yellow03: '#EED291',
30
- Yellow04: '#BEA874',
31
- Yellow05: '#8F7E57',
32
- Lilac01: '#F3F0F4',
33
- Lilac02: '#CFC1D4',
34
- Lilac03: '#886594',
35
- Lilac04: '#6D5176',
36
- Lilac05: '#523D59',
37
- Blue01: '#EAECEE',
38
- Blue02: '#AAB1BD',
39
- Blue03: '#2B3C59',
40
- Blue04: '#223047',
41
- Blue05: '#1A2435',
42
- Green01: '#ECF7ED',
43
- Green02: '#B2E1B9',
44
- Green03: '#3FB34F',
45
- Green04: '#328F3F',
46
- Green05: '#266B2F',
47
- Success01: '#EEF9E8',
48
- Success02: '#BAE7A3',
49
- Success03: '#52C41A',
50
- Success04: '#429D15',
51
- Success05: '#317610',
52
- Error01: '#FFEDED',
53
- Error02: '#FFB8B9',
54
- Error03: '#FF4D4F',
55
- Error04: '#CC3E3F',
56
- Error05: '#992E2F',
57
- Warning01: '#FFF7E8',
58
- Warning02: '#FDDEA1',
59
- Warning03: '#FAAD14',
60
- Warning04: '#C88A10',
61
- Warning05: '#96680C',
62
- Info01: '#E8F4FF',
63
- Info02: '#A3D3FF',
64
- Info03: '#1890FF',
65
- Info04: '#1373CC',
66
- Info05: '#0E5699',
67
- };
68
-
69
- exports.Colors = Colors;
@@ -1,24 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-47c2a5f6.js');
6
- require('./global-9073d10e.js');
7
-
8
- /*
9
- Stencil Client Patch Browser v2.22.3 | MIT Licensed | https://stenciljs.com
10
- */
11
- const patchBrowser = () => {
12
- const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('favesalon-embed.cjs.js', document.baseURI).href));
13
- const opts = {};
14
- if (importMeta !== '') {
15
- opts.resourcesUrl = new URL('.', importMeta).href;
16
- }
17
- return index.promiseResolve(opts);
18
- };
19
-
20
- patchBrowser().then(options => {
21
- return index.bootstrapLazy([["chat-button.cjs",[[0,"chat-button",{"primaryColor":[1,"primary-color"],"accessToken":[1,"access-token"],"senderId":[1,"sender-id"],"receiverId":[1,"receiver-id"],"senderInfo":[32],"receiverInfo":[32],"chatRoom":[32],"chatMessages":[32],"isChatExpanded":[32],"fetchData":[64]}]]],["salon-latest-reviews.cjs",[[0,"salon-latest-reviews",{"salonId":[2,"salon-id"],"primaryColor":[1,"primary-color"],"salonReviews":[32],"isLoading":[32],"fetchData":[64]}]]],["salon-lookbook.cjs",[[0,"salon-lookbook",{"salonId":[2,"salon-id"],"isLoading":[32],"isLoadingMore":[32],"hideLoadMore":[32],"currentPage":[32],"totalLookbooks":[32],"salonCategories":[32],"salonLookbooks":[32],"sortBy":[32],"filterBy":[32],"isLayoutSetup":[32],"fetchData":[64],"fetchLookbooks":[64],"onChangeFiltering":[64],"onChangeSorting":[64],"onLoadMore":[64],"fetchCategories":[64]}]]],["salon-reviews.cjs",[[0,"salon-reviews",{"salonId":[2,"salon-id"],"primaryColor":[1,"primary-color"],"salonInfo":[32],"stats":[32],"totalReviews":[32],"allReviews":[32],"isLoading":[32],"isSorting":[32],"isFiltering":[32],"isLoadingMore":[32],"canLoadMore":[32],"page":[32],"filterBy":[32],"sortBy":[32]}]]],["style-detail.cjs",[[0,"style-detail",{"salonId":[2,"salon-id"],"salonLookbook":[1,"salon-lookbook"],"lookbookInfo":[32],"isModalOpen":[32],"currentMediaIdx":[32],"currentMedia":[32],"albumMedias":[32],"similarStyles":[32],"totalComments":[32],"lookbookComments":[32],"isLayoutSetup":[32],"fetchData":[64]}]]],["salon-booking.cjs",[[0,"salon-booking",{"salonId":[2,"salon-id"],"buttonClass":[1,"button-class"],"buttonText":[1,"button-text"],"primaryColor":[1,"primary-color"]}]]],["salon-booking-modal.cjs",[[0,"salon-booking-modal",{"salonId":[2,"salon-id"],"primaryColor":[1,"primary-color"],"redirectUrl":[1,"redirect-url"],"isModalOpen":[32]}]]],["salon-gift-card.cjs",[[0,"salon-gift-card",{"salonId":[2,"salon-id"],"buttonClass":[1,"button-class"],"buttonText":[1,"button-text"],"primaryColor":[1,"primary-color"]}]]],["salon-gift-card-modal.cjs",[[0,"salon-gift-card-modal",{"salonId":[2,"salon-id"],"primaryColor":[1,"primary-color"],"isModalOpen":[32]}]]],["salon-ranking.cjs",[[0,"salon-ranking",{"ranking":[2],"height":[2],"width":[2]}]]],["salon-services.cjs",[[0,"salon-services",{"salonId":[2,"salon-id"],"buttonClass":[1,"button-class"],"salonServices":[32],"isLoading":[32],"fetchData":[64]}]]],["salon-stylists.cjs",[[0,"salon-stylists",{"salonId":[2,"salon-id"],"salonStylists":[32],"totalStylists":[32],"page":[32],"isLoading":[32],"isLoadingMore":[32],"canLoadMore":[32],"fetchData":[64],"onLoadMore":[64]}]]],["google-map_5.cjs",[[0,"salon-info",{"salonId":[2,"salon-id"],"salonInfo":[32],"fetchData":[64]}],[0,"salon-locations",{"salonId":[2,"salon-id"],"salonInfo":[1,"salon-info"],"isLoading":[4,"is-loading"],"withBorder":[4,"with-border"],"salonInfoState":[32]}],[0,"salon-latest-styles",{"salonId":[2,"salon-id"],"isLoading":[4,"is-loading"],"withBorder":[4,"with-border"],"isLoadingState":[32],"latestStyles":[32],"fetchData":[64]}],[0,"salon-schedules",{"salonId":[2,"salon-id"],"salonInfo":[1,"salon-info"],"isLoading":[4,"is-loading"],"withBorder":[4,"with-border"],"salonInfoState":[32]}],[0,"google-map",{"locationName":[1,"location-name"],"locationAddress":[1,"location-address"]}]]],["user-avatar.cjs",[[0,"user-avatar",{"size":[2],"name":[1],"nameStyle":[16],"shortName":[1,"short-name"],"avatar":[1]}]]]], options);
22
- });
23
-
24
- exports.setNonce = index.setNonce;