File size: 8,732 Bytes
c4412d0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Test Embedded Chat Bot</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            min-height: 100vh;
            font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
            line-height: 1.6;
            background-color: #fff;
            color: #333;
        }

        .header {
            background: #f3f4f6;
            padding: 1rem 2rem;
            border-bottom: 1px solid #e5e7eb;
            position: sticky;
            top: 0;
            z-index: 10;
        }

        .content {
            max-width: 1200px;
            margin: 0 auto;
            padding: 2rem;
        }

        .section {
            margin-bottom: 5rem;
        }

        .section h2 {
            font-size: 1.5rem;
            margin-bottom: 1rem;
            color: #111827;
        }

        .card-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 1.5rem;
            margin-bottom: 2rem;
        }

        .card {
            background: #fff;
            padding: 1.5rem;
            border-radius: 0.5rem;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
            border: 1px solid #e5e7eb;
            min-height: 200px;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }

        .card h3 {
            color: #111827;
            margin-bottom: 0.5rem;
        }

        .card p {
            color: #4b5563;
        }

        .footer {
            background: #f3f4f6;
            padding: 2rem;
            text-align: center;
            border-top: 1px solid #e5e7eb;
            color: #6b7280;
            margin-top: 5rem;
        }

        .spacer {
            height: 50vh;
            display: flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.05), transparent);
            margin: 3rem 0;
            font-size: 1.2rem;
            color: #666;
            font-style: italic;
        }

        @media (prefers-color-scheme: dark) {
            body {
                background-color: #1a1a1a;
                color: #e5e5e5;
            }

            .header, .footer {
                background: #2d2d2d;
                border-color: #404040;
            }

            .card {
                background: #2d2d2d;
                border-color: #404040;
            }

            .card h3 {
                color: #e5e5e5;
            }

            .card p {
                color: #a3a3a3;
            }

            .spacer {
                background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.05), transparent);
                color: #999;
            }
        }
    </style>
</head>
<body>
    <header class="header">
        <h1>Test Page for Embedded Chat Bot</h1>
    </header>

    <main class="content">
        <section class="section">
            <h2>About This Test Page</h2>
            <p>This is a full-page test environment for the PlayGO AI Chat Bot. The chat bot appears as a floating button at the bottom right corner of the page.</p>
        </section>

        <div class="spacer">
            Scroll down to see more content...
        </div>

        <section class="section">
            <h2>Sample Content</h2>
            <div class="card-grid">
                <div class="card">
                    <h3>Card 1</h3>
                    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
                </div>
                <div class="card">
                    <h3>Card 2</h3>
                    <p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
                </div>
                <div class="card">
                    <h3>Card 3</h3>
                    <p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
                </div>
            </div>
        </section>

        <div class="spacer">
            Keep scrolling to test the chat bot's fixed position...
        </div>

        <section class="section">
            <h2>More Content</h2>
            <div class="card-grid">
                <div class="card">
                    <h3>Card 4</h3>
                    <p>Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
                </div>
                <div class="card">
                    <h3>Card 5</h3>
                    <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.</p>
                </div>
                <div class="card">
                    <h3>Card 6</h3>
                    <p>Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur.</p>
                </div>
            </div>
        </section>

        <div class="spacer">
            The chat bot should remain visible at all times...
        </div>

        <section class="section">
            <h2>Final Section</h2>
            <div class="card-grid">
                <div class="card">
                    <h3>Card 7</h3>
                    <p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum.</p>
                </div>
                <div class="card">
                    <h3>Card 8</h3>
                    <p>Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod.</p>
                </div>
                <div class="card">
                    <h3>Card 9</h3>
                    <p>Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates.</p>
                </div>
            </div>
        </section>
    </main>

    <footer class="footer">
        <p>Test Page Footer</p>
    </footer>

    <!-- Embed script -->
    <script>
        // Debug logging
        console.log('Setting up PlayGo Chat Widget');

        // Create queue before loading script
        window.PlayGoChatWidget = {
            q: [],
            ready: false
        };

        // Initialize configuration
        const config = {
            buttonText: '需要協助嗎?',
            theme: 'system',
            primaryColor: '#FF6B6B',
            placeholder: 'Type your message...'
        };

        // Add custom CSS for chat widget spacing
        const style = document.createElement('style');
        style.textContent = `
            #playgo-chat-widget {
                padding: 16px !important;
                border-radius: 16px !important;
                background: transparent !important;
            }

            #playgo-chat-widget iframe {
                border-radius: 16px !important;
                box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.08) !important;
                transition: height 0.5s ease-in-out, box-shadow 0.3s ease-in-out !important;
            }

            #playgo-chat-widget iframe:hover {
                box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.08) !important;
            }

            @media (prefers-color-scheme: dark) {
                #playgo-chat-widget iframe {
                    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2) !important;
                }

                #playgo-chat-widget iframe:hover {
                    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3), 0 4px 8px rgba(0, 0, 0, 0.2) !important;
                }
            }
        `;
        document.head.appendChild(style);

        // Add to queue
        window.PlayGoChatWidget.q.push(['init', config]);

        // Load script
        (function() {
            console.log('Loading embed script');
            const script = document.createElement('script');
            script.src = '/api/embed';
            script.async = true;
            script.onload = function() {
                console.log('Embed script loaded');
            };
            script.onerror = function(error) {
                console.error('Error loading embed script:', error);
            };
            document.body.appendChild(script);
        })();
    </script>
</body>
</html>