Click the widget card to test the parent modal functionality!
This widget opens a modal in the parent page (outside iframe), just like Tabby widgets.
✅ Modal opened successfully!
Widget will appear here... Click it to open parent modal!
Testing multiple widget instances on the same page
Widget A (Points Alert)
Widget B (Points Card)
Test 6: Dynamic Points Update
Initialize widget and then update points dynamically
Widget will appear here...
Test 7: Points Alert Close Functionality ✨
Test the close button functionality for points-alert!
Click the close button (X) on the widget to test the removal functionality.
The widget should be removed from both the iframe and parent container. Important: Clicking anywhere on points-alert should also hide it (no modal opens).
Widget will appear here... Click the X button or anywhere on the alert to close it!
PointsWidget.init({
type: 'points-alert',
lang: 'ar',
points: 150,
container: '#widget-7'
});
// When close button is clicked:
// 1. Widget removes itself from iframe
// 2. Sends postMessage: { action: "hide-alert-widget", type: "points-alert" }
// 3. Parent removes the alert widget (no modal opens)
// When clicking anywhere on points-alert:
// 1. Sends postMessage: { action: "hide-alert-widget", type: "points-alert" }
// 2. Parent removes the alert widget (no modal opens)
✅ Close action triggered! Check console for details.
Test 8: CORS Headers Testing 🔒
Test CORS headers for widget resources
This verifies that the widget modal endpoint and assets return proper CORS headers.
Click buttons below to test CORS...
// Test CORS with fetch()
fetch('https://sandbox.papp.sa/widget/modal?type=points-card&lang=ar')
.then(response => {
console.log('CORS Headers:', response.headers.get('Access-Control-Allow-Origin'));
});
// Test CORS with image
const img = new Image();
img.crossOrigin = 'anonymous';
img.src = 'https://sandbox.papp.sa/tool/assets/images/coin.svg';