{"_id":"paymob-chatbot","_rev":"6-b7b5dcb070ccab4ca634e8c72f3b7e75","name":"paymob-chatbot","dist-tags":{"latest":"1.0.5"},"versions":{"1.0.0":{"name":"paymob-chatbot","version":"1.0.0","keywords":["paymob","chatbot","paymob-chatbot"],"author":{"url":"https://developers.paymob.com","name":"Paymob","email":"support@paymob.com"},"license":"MIT","_id":"paymob-chatbot@1.0.0","maintainers":[{"name":"ahmed_elbanna","email":"ahmedelpna@gmail.com"}],"homepage":"https://developers.paymob.com","dist":{"shasum":"d029285248b94e57a36aa4af8911b70603e0e3c1","tarball":"https://registry.npmjs.org/paymob-chatbot/-/paymob-chatbot-1.0.0.tgz","fileCount":6,"integrity":"sha512-32HaDxXWCPpd/IBgzko0CPuCZy8umrjvroX1mSye2TcUMPkHAygT6JZO+1cvpE3tH+qq06mXVT6sEHtrgERdbQ==","signatures":[{"sig":"MEUCIQDQ+vv9s5hZwUgb7zWXIqtUvVGDsxD62Dg+fhhCwpZi1AIgBudXbVkqiwGas1I2zqCGWYncPYcy03ZKRKXPjmBGTVE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":155455},"main":"./main.js","gitHead":"0b7fc673a9799509ef26b6b280fa3662a423caa4","_npmUser":{"name":"ahmed_elbanna","email":"ahmedelpna@gmail.com"},"_npmVersion":"10.8.2","description":"Embed the Paymob AI assistant into any website with a single script tag. The SDK renders a floating chat button in the bottom-right corner of your page and opens a fully-featured AI chat popup powered by Paymob.","directories":{},"_nodeVersion":"20.19.6","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/paymob-chatbot_1.0.0_1780948552968_0.004713003649621239","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"paymob-chatbot","version":"1.0.1","keywords":["paymob","chatbot","paymob-chatbot"],"author":{"url":"https://developers.paymob.com","name":"Paymob","email":"support@paymob.com"},"license":"MIT","_id":"paymob-chatbot@1.0.1","maintainers":[{"name":"ahmed_elbanna","email":"ahmedelpna@gmail.com"}],"homepage":"https://developers.paymob.com","dist":{"shasum":"8f6d573073a425660f132c191732d8a6fe5b32bb","tarball":"https://registry.npmjs.org/paymob-chatbot/-/paymob-chatbot-1.0.1.tgz","fileCount":6,"integrity":"sha512-rutpfdtbcNnP9JaUS8fX32JqhRBt6RfblWZLnYXVgVPVcNix3bDnDvz/jL3xuwdIKXogChX2QtLCkMOGGCWL0w==","signatures":[{"sig":"MEUCIQD+ibBC4tYrcX+y9EkgxVaEUrVytSY4GjmyfOfkVhpQJQIgSKnK6MTUCzWHxyi3I2Mij8yTQX9o51GjsyN8DyVbuT0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":155569},"main":"./main.js","gitHead":"ca3c329b520f7a93aec535cf56568155fc884947","_npmUser":{"name":"ahmed_elbanna","email":"ahmedelpna@gmail.com"},"_npmVersion":"8.19.4","description":"Embed the Paymob AI assistant into any website with a single script tag. The SDK renders a floating chat button in the bottom-right corner of your page and opens a fully-featured AI chat popup powered by Paymob.","directories":{},"_nodeVersion":"16.20.2","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/paymob-chatbot_1.0.1_1780950565265_0.5257027532808423","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"paymob-chatbot","version":"1.0.2","keywords":["paymob","chatbot","paymob-chatbot"],"author":{"url":"https://developers.paymob.com","name":"Paymob","email":"support@paymob.com"},"license":"MIT","_id":"paymob-chatbot@1.0.2","maintainers":[{"name":"ahmed_elbanna","email":"ahmedelpna@gmail.com"}],"homepage":"https://developers.paymob.com","dist":{"shasum":"b143d4d7a98b21efb524eae8d95688b112562538","tarball":"https://registry.npmjs.org/paymob-chatbot/-/paymob-chatbot-1.0.2.tgz","fileCount":6,"integrity":"sha512-lqpKX2CiPxZIi4jMHQVAd2cbeC1qqg+MW/SgXZo40hXp6SWicwILIQg5adJqvvZQ2mB8AwNAM7ZmFOWIGXc9bA==","signatures":[{"sig":"MEQCIAoxrJyZo4t+NkrtEECd0FRzf5xlVzACZtna48sZnRrrAiBV1haUfnIstbsRbKaCRaRrfKpGHu6H3mvnhzdtM6nWhg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":158171},"main":"./main.js","gitHead":"a216eacc54d966dc22d7bb9f31b3652789b910a6","_npmUser":{"name":"ahmed_elbanna","email":"ahmedelpna@gmail.com"},"_npmVersion":"10.8.2","description":"Embed the Paymob AI assistant into any website with a single script tag. The SDK renders a floating chat button in the bottom-right corner of your page and opens a fully-featured AI chat popup powered by Paymob.","directories":{},"_nodeVersion":"20.19.6","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/paymob-chatbot_1.0.2_1781081645683_0.6705292562980807","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"paymob-chatbot","version":"1.0.3","keywords":["paymob","chatbot","paymob-chatbot"],"author":{"url":"https://developers.paymob.com","name":"Paymob","email":"support@paymob.com"},"license":"MIT","_id":"paymob-chatbot@1.0.3","maintainers":[{"name":"ahmed_elbanna","email":"ahmedelpna@gmail.com"}],"homepage":"https://developers.paymob.com","dist":{"shasum":"e1964b03d17a9b1d27f86a850808c66330ad73d9","tarball":"https://registry.npmjs.org/paymob-chatbot/-/paymob-chatbot-1.0.3.tgz","fileCount":6,"integrity":"sha512-rYYiG4M2Acswf5m/9x6el9P5tBRG+qH5ESJJgDWhIFUGWPRDX3DVPaE3RiwHwpmZcREnxjl/NmyuJfzbfKkosA==","signatures":[{"sig":"MEYCIQDr03JZhQFI7522jq4z/Mn9dOUUKCxuW3gl19q0UQexBAIhAI5cy20zN4YTR21GYMxotB9ITs1rwNdFhzKrKPQadH+L","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":158347},"main":"./main.js","gitHead":"1076bf49bdbe20763fac0756a03250c611f4b269","_npmUser":{"name":"ahmed_elbanna","email":"ahmedelpna@gmail.com"},"_npmVersion":"8.19.4","description":"Embed the Paymob AI assistant into any website with a single script tag. The SDK renders a floating chat button in the bottom-right corner of your page and opens a fully-featured AI chat popup powered by Paymob.","directories":{},"_nodeVersion":"16.20.2","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/paymob-chatbot_1.0.3_1781177178400_0.7845134659852002","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"paymob-chatbot","version":"1.0.4","keywords":["paymob","chatbot","paymob-chatbot"],"author":{"url":"https://developers.paymob.com","name":"Paymob","email":"support@paymob.com"},"license":"MIT","_id":"paymob-chatbot@1.0.4","maintainers":[{"name":"ahmed_elbanna","email":"ahmedelpna@gmail.com"}],"homepage":"https://developers.paymob.com","dist":{"shasum":"ee8f45791c0b31e91156944be0c812d487732d0e","tarball":"https://registry.npmjs.org/paymob-chatbot/-/paymob-chatbot-1.0.4.tgz","fileCount":6,"integrity":"sha512-FLAGLgNhd758srB7MCZQxVCnjQ+/v01M7MMhV2snhn1P1RQ7Op9u+Z2vD4jV5F3NEp2Phs+mXJxfCk02Rsy7mg==","signatures":[{"sig":"MEUCIC8rLy7UqUgVtBAu9/gAI/rrVA/eDoFjph6Xc7c2J85BAiEA4pxmnm+IpTVYbWqDUkwQHPGXs2aD+KWOYePeoz/M0Nk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":158341},"main":"./main.js","gitHead":"70d6c91f790e69403051d17d3718c12b39924de1","_npmUser":{"name":"ahmed_elbanna","email":"ahmedelpna@gmail.com"},"_npmVersion":"8.19.4","description":"Embed the Paymob AI assistant into any website with a single script tag. The SDK renders a floating chat button in the bottom-right corner of your page and opens a fully-featured AI chat popup powered by Paymob.","directories":{},"_nodeVersion":"16.20.2","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/paymob-chatbot_1.0.4_1781185684629_0.7191705585199761","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"paymob-chatbot","version":"1.0.5","keywords":["paymob","chatbot","paymob-chatbot"],"main":"./main.js","license":"MIT","homepage":"https://developers.paymob.com","author":{"name":"Paymob","email":"support@paymob.com","url":"https://developers.paymob.com"},"gitHead":"d798c19fec825ed01ed262452c818cd425d0cf74","description":"Embed the Paymob AI assistant into any website with a single script tag. The SDK renders a floating chat button in the bottom-right corner of your page and opens a fully-featured AI chat popup powered by Paymob.","_id":"paymob-chatbot@1.0.5","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"integrity":"sha512-voKtzS5oqmvkX+/7HZVwJz6NBJKBCBU8OA6MHOUcVrzFSxgemFTdq7Od3wGFOOx6LSqsHYIqC2ilj1DuLk8Vyw==","shasum":"765d4250ae99e73de512c362ebd48002eaac2d17","tarball":"https://registry.npmjs.org/paymob-chatbot/-/paymob-chatbot-1.0.5.tgz","fileCount":6,"unpackedSize":158419,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCLtpLRyk9hmbJCfc9W9jVYz2kKWD+B1jLho5vewQEyHQIgdJjnAh3sJ+SvX4gQFa+ZoBs7jDs1fpoBew5wd8dwAUg="}]},"_npmUser":{"name":"ahmed_elbanna","email":"ahmedelpna@gmail.com"},"directories":{},"maintainers":[{"name":"ahmed_elbanna","email":"ahmedelpna@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/paymob-chatbot_1.0.5_1782662023332_0.030232800361535084"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-08T19:55:52.898Z","modified":"2026-06-28T15:53:43.571Z","1.0.0":"2026-06-08T19:55:53.126Z","1.0.1":"2026-06-08T20:29:25.383Z","1.0.2":"2026-06-10T08:54:05.816Z","1.0.3":"2026-06-11T11:26:18.548Z","1.0.4":"2026-06-11T13:48:04.797Z","1.0.5":"2026-06-28T15:53:43.468Z"},"author":{"name":"Paymob","email":"support@paymob.com","url":"https://developers.paymob.com"},"license":"MIT","homepage":"https://developers.paymob.com","keywords":["paymob","chatbot","paymob-chatbot"],"description":"Embed the Paymob AI assistant into any website with a single script tag. The SDK renders a floating chat button in the bottom-right corner of your page and opens a fully-featured AI chat popup powered by Paymob.","maintainers":[{"name":"ahmed_elbanna","email":"ahmedelpna@gmail.com"}],"readme":"# Paymob Chatbot SDK\n\nEmbed the Paymob AI assistant into any website with a single script tag. The SDK renders a floating chat button in the bottom-right corner of your page and opens a fully-featured AI chat popup powered by Paymob.\n\n---\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n- [Configuration Options](#configuration-options)\n- [The auth Object](#the-auth-object)\n- [API Reference](#api-reference)\n- [Usage Examples](#usage-examples)\n- [Browser Support](#browser-support)\n\n---\n\n## Installation\n\n### CDN (recommended)\n\nAdd the script tag before the closing `</body>` tag of your HTML page:\n\n```html\n<!-- Latest version -->\n<script src=\"https://cdn.jsdelivr.net/npm/paymob-chatbot@latest/main.js\"></script>\n```\n\n### npm\n\n```bash\nnpm install paymob-chatbot\n```\n\n```js\nimport { Chatbot } from 'paymob-chatbot';\n```\n\n---\n\n## Quick Start\n\n```html\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"UTF-8\" />\n  <title>My Store</title>\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n</head>\n<body>\n\n  <!-- Your page content -->\n\n  <script src=\"https://cdn.jsdelivr.net/npm/paymob-chatbot@latest/main.js\"></script>\n  <script>\n    const chat = new window.PaymobChatbot({\n      auth: {\n        token: 'your_auth_token',\n        platform: 'merchant-dashboard',\n        region: 'egypt',\n        user_type: 'merchant',\n      },\n    });\n  </script>\n</body>\n</html>\n```\n\nA floating chat button will appear in the bottom-right corner. Clicking it opens the Paymob AI assistant. The chatbot will display a loading screen until the auth handshake completes automatically.\n\n---\n\n## Configuration Options\n\n| Option | Type | Required | Default | Description |\n|---|---|---|---|---|\n| `auth` | `object` | ✅ Yes | — | Authentication object. Must contain exactly `token`, `platform`, `region`, and `user_type` — all strings. See [The auth Object](#the-auth-object) for details. |\n| `showToggle` | `boolean` | No | `true` | Show or hide the floating chat button. Set to `false` to control the popup entirely via `open()` / `close()`. |\n\n---\n\n## The auth Object\n\nThe `auth` parameter is **required** and must be a plain object containing exactly these four string keys:\n\n| Key | Type | Description |\n|---|---|---|\n| `token` | `string` | Your merchant authentication token issued by Paymob. |\n| `platform` | `string` | The platform the SDK is running on. Allowed values: `\"merchant-dashboard\"`, `\"merchant-app\"`, `\"sales-app\"`. |\n| `region` | `string` | The merchant's region. Allowed values: `\"egypt\"`, `\"uae\"`, `\"oman\"`, `\"ksa\"`, `\"glb\"`. |\n| `user_type` | `string` | The type of user initiating the session. Allowed values: `\"merchant\"`, `\"sales\"`. |\n\n```js\nauth: {\n  token: 'your_auth_token',\n  platform: 'merchant-dashboard',\n  region: 'egypt', // 'egypt' | 'uae' | 'oman' | 'ksa' | 'glb'\n  user_type: 'merchant',\n}\n```\n\n**All four keys are required.** If any key is missing, has the wrong type, is an empty string, or if the object contains extra keys, the SDK will **not render** and will log a descriptive error to the browser console instead.\n\n### Validation errors\n\nThe SDK validates the `auth` object at construction time. Open your browser's developer console to see the exact issue:\n\n```\n[PaymobChatbot] auth.token is required but missing.\n[PaymobChatbot] auth.platform must be a string, got number.\n[PaymobChatbot] auth.region must not be an empty string.\n[PaymobChatbot] auth contains unexpected key \"userId\". Allowed keys: token, platform, region, user_type.\n```\n\n---\n\n## API Reference\n\n### `new PaymobChatbot(options)`\n\nCreates and mounts the chat widget on the page. The widget is appended to `<body>` automatically.\n\n```js\nconst chat = new window.PaymobChatbot({\n  auth: {\n    token: 'your_auth_token',\n    platform: 'merchant-dashboard',\n    region: 'egypt',\n    user_type: 'merchant',\n  },\n});\n```\n\n---\n\n### `chat.open()`\n\nOpens the chat popup programmatically.\n\n```js\nchat.open();\n```\n\n---\n\n### `chat.close()`\n\nCloses the chat popup programmatically.\n\n```js\nchat.close();\n```\n\n---\n\n### `chat.destroy()`\n\nCompletely removes the widget (button + popup) from the DOM and cleans up all injected styles. Useful for single-page applications when navigating away.\n\n```js\nchat.destroy();\n```\n\n---\n\n## Usage Examples\n\n### Default — floating button + popup\n\n```js\nconst chat = new window.PaymobChatbot({\n  auth: {\n    token: 'your_auth_token',\n    platform: 'merchant-dashboard',\n    region: 'egypt',\n    user_type: 'merchant',\n  },\n});\n```\n\n---\n\n### Hide the toggle button — programmatic control only\n\nUse this when you want to trigger the chat from your own button or UI element.\n\n```html\n<button id=\"open-chat\">Talk to Paymob AI</button>\n\n<script src=\"https://cdn.jsdelivr.net/npm/paymob-chatbot@latest/main.js\"></script>\n<script>\n  const chat = new window.PaymobChatbot({\n    auth: {\n      token: 'your_auth_token',\n      platform: 'merchant-dashboard',\n      region: 'egypt',\n      user_type: 'merchant',\n    },\n    showToggle: false,  // hides the default floating button\n  });\n\n  document.getElementById('open-chat').addEventListener('click', () => {\n    chat.open();\n  });\n</script>\n```\n\n---\n\n### Open the chat automatically on page load\n\n```js\nconst chat = new window.PaymobChatbot({\n  auth: {\n    token: 'your_auth_token',\n    platform: 'merchant-dashboard',\n    region: 'egypt',\n    user_type: 'merchant',\n  },\n});\n\n// Open after a short delay\nsetTimeout(() => {\n  chat.open();\n}, 3000);\n```\n\n---\n\n### React / Next.js integration\n\n```jsx\nimport { useEffect, useRef } from 'react';\nimport { Chatbot } from 'paymob-chatbot';\n\nexport function ChatWidget({ authToken }) {\n  const chatRef = useRef(null);\n\n  useEffect(() => {\n    chatRef.current = new Chatbot({\n      auth: {\n        token: authToken,\n        platform: 'merchant-dashboard',\n        region: 'egypt',\n        user_type: 'merchant',\n      },\n    });\n\n    // Cleanup on unmount\n    return () => {\n      chatRef.current?.destroy();\n    };\n  }, []);\n\n  return null;\n}\n```\n\n---\n\n### Vue.js integration\n\n```js\nimport { Chatbot } from 'paymob-chatbot';\n\nexport default {\n  props: ['authToken'],\n  mounted() {\n    this.chat = new Chatbot({\n      auth: {\n        token: this.authToken,\n        platform: 'merchant-dashboard',\n        region: 'egypt',\n        user_type: 'merchant',\n      },\n    });\n  },\n  beforeUnmount() {\n    this.chat?.destroy();\n  },\n};\n```\n\n---\n\n\n## Browser Support\n\n| Browser | Minimum Version |\n|---|---|\n| Chrome | 80+ |\n| Firefox | 75+ |\n| Safari | 13+ |\n| Edge | 80+ |\n\n---\n\n## License\n\nMIT © [Paymob](https://paymob.com)\n","readmeFilename":"README.md"}