|
| 1 | +<!doctype html> |
| 2 | +<html lang="en-US"> |
| 3 | + <head> |
| 4 | + <link href="/assets/index.css" rel="stylesheet" type="text/css" /> |
| 5 | + <script crossorigin="anonymous" src="https://unpkg.com/@babel/standalone@7.8.7/babel.min.js"></script> |
| 6 | + <script crossorigin="anonymous" src="https://unpkg.com/react@16.8.6/umd/react.development.js"></script> |
| 7 | + <script crossorigin="anonymous" src="https://unpkg.com/react-dom@16.8.6/umd/react-dom.development.js"></script> |
| 8 | + <script crossorigin="anonymous" src="/test-harness.js"></script> |
| 9 | + <script crossorigin="anonymous" src="/test-page-object.js"></script> |
| 10 | + <script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script> |
| 11 | + </head> |
| 12 | + <template id="avatars"> |
| 13 | + <svg data-for="1" xmlns="http://www.w3.org/2000/svg" width="75" height="150" viewBox="0 0 75 150"> |
| 14 | + <!-- Gradient Definitions --> |
| 15 | + <defs> |
| 16 | + <linearGradient id="tallGradient" x1="0%" y1="0%" x2="100%" y2="100%"> |
| 17 | + <stop offset="0%" style="stop-color:#0ea5e9"/> |
| 18 | + <stop offset="100%" style="stop-color:#6366f1"/> |
| 19 | + </linearGradient> |
| 20 | + <linearGradient id="tallHighlight" x1="0%" y1="0%" x2="100%" y2="100%"> |
| 21 | + <stop offset="0%" style="stop-color:rgba(255,255,255,0.2)"/> |
| 22 | + <stop offset="100%" style="stop-color:rgba(255,255,255,0)"/> |
| 23 | + </linearGradient> |
| 24 | + </defs> |
| 25 | + |
| 26 | + <!-- Base Rectangle --> |
| 27 | + <rect width="75" height="150" rx="37.5" fill="url(#tallGradient)"/> |
| 28 | + |
| 29 | + <!-- Highlight Overlay --> |
| 30 | + <path d="M 0 0 L 75 0 L 75 75 Q 37.5 95 0 75 Z" fill="url(#tallHighlight)" opacity="0.5"/> |
| 31 | + |
| 32 | + <!-- Face - Positioned in Upper Third --> |
| 33 | + <!-- Eyes --> |
| 34 | + <path d="M 25 55 Q 27 52 29 55" stroke="white" stroke-width="3" stroke-linecap="round" fill="none"/> |
| 35 | + <path d="M 46 55 Q 48 52 50 55" stroke="white" stroke-width="3" stroke-linecap="round" fill="none"/> |
| 36 | + |
| 37 | + <!-- Smile --> |
| 38 | + <path d="M 25 70 Q 37.5 80 50 70" stroke="white" stroke-width="3" stroke-linecap="round" fill="none"/> |
| 39 | + |
| 40 | + <!-- Decorative Elements --> |
| 41 | + <circle cx="37.5" cy="110" r="15" stroke="white" stroke-width="3" fill="none" opacity="0.3"/> |
| 42 | + <circle cx="37.5" cy="110" r="7" stroke="white" stroke-width="2" fill="none" opacity="0.2"/> |
| 43 | + </svg> |
| 44 | + <svg data-for="2" xmlns="http://www.w3.org/2000/svg" width="150" height="75" viewBox="0 0 150 75"> |
| 45 | + <!-- Gradient Definitions --> |
| 46 | + <defs> |
| 47 | + <linearGradient id="wideGradient" x1="0%" y1="0%" x2="100%" y2="100%"> |
| 48 | + <stop offset="0%" style="stop-color:#84cc16"/> |
| 49 | + <stop offset="100%" style="stop-color:#22c55e"/> |
| 50 | + </linearGradient> |
| 51 | + <linearGradient id="wideHighlight" x1="0%" y1="0%" x2="100%" y2="100%"> |
| 52 | + <stop offset="0%" style="stop-color:rgba(255,255,255,0.25)"/> |
| 53 | + <stop offset="100%" style="stop-color:rgba(255,255,255,0)"/> |
| 54 | + </linearGradient> |
| 55 | + </defs> |
| 56 | + |
| 57 | + <!-- Base Rectangle --> |
| 58 | + <rect width="150" height="75" rx="37.5" fill="url(#wideGradient)"/> |
| 59 | + |
| 60 | + <!-- Highlight Overlay --> |
| 61 | + <path d="M 0 0 Q 75 -10 150 0 L 150 40 Q 75 30 0 40 Z" fill="url(#wideHighlight)" opacity="0.5"/> |
| 62 | + |
| 63 | + <!-- Face - Centered --> |
| 64 | + <!-- Eyes --> |
| 65 | + <path d="M 55 35 Q 58 32 61 35" stroke="white" stroke-width="3" stroke-linecap="round" fill="none"/> |
| 66 | + <path d="M 89 35 Q 92 32 95 35" stroke="white" stroke-width="3" stroke-linecap="round" fill="none"/> |
| 67 | + |
| 68 | + <!-- Smile --> |
| 69 | + <path d="M 55 45 Q 75 55 95 45" stroke="white" stroke-width="3" stroke-linecap="round" fill="none"/> |
| 70 | + |
| 71 | + <!-- Decorative Elements --> |
| 72 | + <circle cx="30" cy="37.5" r="8" stroke="white" stroke-width="2" fill="none" opacity="0.2"/> |
| 73 | + <circle cx="120" cy="37.5" r="8" stroke="white" stroke-width="2" fill="none" opacity="0.2"/> |
| 74 | + </svg> |
| 75 | + </template> |
| 76 | + <body> |
| 77 | + <main id="webchat"></main> |
| 78 | + <script type="text/babel" data-presets="env,stage-3,react"> |
| 79 | + const { |
| 80 | + React: { useMemo }, |
| 81 | + WebChat: { |
| 82 | + hooks: { useDirection } |
| 83 | + } |
| 84 | + } = window; |
| 85 | + |
| 86 | + run(async function () { |
| 87 | + await host.windowSize(undefined, 1280, document.getElementById('webchat')); |
| 88 | + |
| 89 | + WebChat.renderWebChat( |
| 90 | + { |
| 91 | + directLine: await testHelpers.createDirectLineWithTranscript([ |
| 92 | + { |
| 93 | + from: { role: 'bot' }, |
| 94 | + id: '1.0', |
| 95 | + text: 'Cillum ea irure amet reprehenderit minim.', |
| 96 | + timestamp: -300001, |
| 97 | + type: 'message' |
| 98 | + }, |
| 99 | + { |
| 100 | + from: { role: 'bot' }, |
| 101 | + id: '1.1', |
| 102 | + text: 'Minim ut laboris enim nostrud magna irure occaecat laborum occaecat ex.', |
| 103 | + timestamp: -300001, |
| 104 | + type: 'message' |
| 105 | + }, |
| 106 | + { |
| 107 | + channelData: { state: 'sent' }, |
| 108 | + from: { role: 'user' }, |
| 109 | + id: '2.0', |
| 110 | + text: 'Tempor deserunt ut enim eu elit.', |
| 111 | + timestamp: -300001, |
| 112 | + type: 'message' |
| 113 | + }, |
| 114 | + { |
| 115 | + channelData: { state: 'sent' }, |
| 116 | + from: { role: 'user' }, |
| 117 | + id: '2.1', |
| 118 | + text: 'Elit occaecat quis velit qui ad.', |
| 119 | + timestamp: -300001, |
| 120 | + type: 'message' |
| 121 | + }, |
| 122 | + { |
| 123 | + from: { role: 'bot' }, |
| 124 | + id: '3.0', |
| 125 | + text: 'Nulla irure laborum officia tempor aute consequat eiusmod nisi velit ipsum magna.', |
| 126 | + timestamp: -300001, |
| 127 | + type: 'message' |
| 128 | + }, |
| 129 | + { |
| 130 | + from: { role: 'bot' }, |
| 131 | + id: '3.1', |
| 132 | + text: 'Minim fugiat aute do ea veniam.', |
| 133 | + timestamp: -300001, |
| 134 | + type: 'message' |
| 135 | + }, |
| 136 | + { |
| 137 | + channelData: { state: 'sent' }, |
| 138 | + from: { role: 'user' }, |
| 139 | + id: '4.0', |
| 140 | + text: 'This first activity has user avatar', |
| 141 | + timestamp: 0, |
| 142 | + type: 'message' |
| 143 | + }, |
| 144 | + { |
| 145 | + channelData: { state: 'sent' }, |
| 146 | + from: { role: 'user' }, |
| 147 | + id: '4.1', |
| 148 | + text: 'This shows no avatar as the activities in the same group', |
| 149 | + timestamp: 0, |
| 150 | + type: 'message' |
| 151 | + }, |
| 152 | + { |
| 153 | + attachmentLayout: 'carousel', |
| 154 | + attachments: [ |
| 155 | + { |
| 156 | + contentType: 'image/jpeg', |
| 157 | + contentUrl: |
| 158 | + 'https://raw.githubusercontent.com/compulim/BotFramework-MockBot/master/public/assets/surface1.jpg', |
| 159 | + name: 'front of Surface Pro' |
| 160 | + }, |
| 161 | + { |
| 162 | + contentType: 'image/jpeg', |
| 163 | + contentUrl: |
| 164 | + 'https://raw.githubusercontent.com/compulim/BotFramework-MockBot/master/public/assets/surface2.jpg', |
| 165 | + name: 'back of Surface Pro' |
| 166 | + } |
| 167 | + ], |
| 168 | + from: { role: 'bot' }, |
| 169 | + id: '5.0', |
| 170 | + text: 'Bot message with attachment', |
| 171 | + timestamp: 0, |
| 172 | + type: 'message' |
| 173 | + }, |
| 174 | + { |
| 175 | + from: { role: 'bot' }, |
| 176 | + id: '5.1', |
| 177 | + text: 'Follow-up message within the group', |
| 178 | + timestamp: 0, |
| 179 | + type: 'message' |
| 180 | + } |
| 181 | + ]), |
| 182 | + store: testHelpers.createStore(), |
| 183 | + styleOptions: { |
| 184 | + botAvatarImage: `data:image/svg+xml;utf8,${encodeURIComponent(window.avatars.content.querySelector(`[data-for="1"]`).outerHTML)}`, |
| 185 | + botAvatarInitials: 'Bot', |
| 186 | + bubbleBackground: '#0063B1', |
| 187 | + bubbleBorderColor: '#0063B1', |
| 188 | + bubbleBorderRadius: 4, |
| 189 | + bubbleFromUserBackground: '#0063B1', |
| 190 | + bubbleFromUserBorderColor: '#0063B1', |
| 191 | + bubbleFromUserBorderRadius: 4, |
| 192 | + bubbleFromUserNubOffset: 0, |
| 193 | + bubbleFromUserNubSize: 10, |
| 194 | + bubbleFromUserTextColor: 'White', |
| 195 | + bubbleNubOffset: 0, |
| 196 | + bubbleNubSize: 10, |
| 197 | + bubbleTextColor: 'White', |
| 198 | + userAvatarInitials: 'You', |
| 199 | + userAvatarImage: `data:image/svg+xml;utf8,${encodeURIComponent(window.avatars.content.querySelector(`[data-for="2"]`).outerHTML)}`, |
| 200 | + } |
| 201 | + }, |
| 202 | + document.getElementById('webchat') |
| 203 | + ); |
| 204 | + |
| 205 | + await pageConditions.uiConnected(); |
| 206 | + |
| 207 | + await host.snapshot('local'); |
| 208 | + }); |
| 209 | + </script> |
| 210 | + </body> |
| 211 | +</html> |
0 commit comments