{"_id":"@codeimplants/support","name":"@codeimplants/support","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@codeimplants/support","version":"1.0.0","description":"Smart support logic layer for error handling and user assistance","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","dev":"tsc --watch","clean":"rm -rf dist"},"keywords":["support","error-handling","whatsapp","email","react-native"],"author":{"name":"CodeImplants"},"license":"MIT","peerDependencies":{"react":">=18.0.0","react-native":">=0.70.0"},"devDependencies":{"@types/react":"^18.2.0","@types/react-native":"^0.72.0","typescript":"^5.0.0"},"gitHead":"e797363ce1bf640de3732cc0644bebe0269fdf2e","_id":"@codeimplants/support@1.0.0","_nodeVersion":"22.12.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-pNUR07BVVS+ygLsu4nv2kb9JvI1DPyavREOE6T1JfIJqlreqe9jEwTMWUVeDOLUwBZASQldGfYpgh3RymJ0Ecw==","shasum":"517fd227f7fd87ec762074521cf4bc3d0395047e","tarball":"https://registry.npmjs.org/@codeimplants/support/-/support-1.0.0.tgz","fileCount":26,"unpackedSize":42205,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDxgqFUEFhZmmITST1VZGfqrxbTIn3J4kO9EC8uxQZWdAiBAVpoY1JzFXHxIYXUbwwuuuQdlTfl8XwXTSW9/+2XTAQ=="}]},"_npmUser":{"name":"codeimplants","email":"codeimplants@gmail.com"},"directories":{},"maintainers":[{"name":"codeimplants","email":"codeimplants@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/support_1.0.0_1771152297245_0.5048068138997914"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-15T10:44:57.156Z","1.0.0":"2026-02-15T10:44:57.422Z","modified":"2026-02-15T10:44:57.611Z"},"maintainers":[{"name":"codeimplants","email":"codeimplants@gmail.com"}],"description":"Smart support logic layer for error handling and user assistance","keywords":["support","error-handling","whatsapp","email","react-native"],"author":{"name":"CodeImplants"},"license":"MIT","readme":"# @codeimplants/support\r\n\r\n> Smart support logic layer for error handling and user assistance across all platforms\r\n\r\n[![Platform](https://img.shields.io/badge/platform-iOS%20%7C%20Android%20%7C%20Web-blue)]()\r\n[![React Native](https://img.shields.io/badge/React%20Native-0.70%2B-green)]()\r\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.0%2B-blue)]()\r\n\r\n## Overview\r\n\r\n`@codeimplants/support` is a comprehensive support package that handles the logic of how users contact your organization based on their platform and error context. It provides seamless integration with WhatsApp, Email, and Phone services with automatic error context formatting.\r\n\r\n## Features\r\n\r\n- ✅ **Cross-Platform**: Works on iOS, Android, Web (React Native Web), Expo, and bare React Native\r\n- ✅ **Smart Deep Linking**: Platform-specific URL schemes (whatsapp://, mailto:, tel:)\r\n- ✅ **Auto Error Context**: Automatically formats error details in support messages\r\n- ✅ **Type-Safe**: Full TypeScript support with comprehensive types\r\n- ✅ **Zero Config**: Works out of the box with sensible defaults\r\n- ✅ **Customizable**: Override templates, messages, and platform-specific behavior\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @codeimplants/support\r\n# or\r\nyarn add @codeimplants/support\r\n# or\r\npnpm add @codeimplants/support\r\n```\r\n\r\n### Peer Dependencies\r\n\r\n```json\r\n{\r\n  \"react\": \">=18.0.0\",\r\n  \"react-native\": \">=0.70.0\"\r\n}\r\n```\r\n\r\n## Quick Start\r\n\r\n### 1. Wrap your app with SupportProvider\r\n\r\n```tsx\r\nimport { SupportProvider } from '@codeimplants/support';\r\n\r\nconst supportConfig = {\r\n  whatsapp: {\r\n    number: '919876543210', // Country code + number (no + or spaces)\r\n    messageTemplate: 'Hello, I need help with...',\r\n  },\r\n  email: {\r\n    address: 'support@yourapp.com',\r\n    subjectTemplate: 'Support Request',\r\n  },\r\n  phone: {\r\n    number: '+919876543210',\r\n  },\r\n};\r\n\r\nfunction App() {\r\n  return (\r\n    <SupportProvider config={supportConfig}>\r\n      <YourApp />\r\n    </SupportProvider>\r\n  );\r\n}\r\n```\r\n\r\n### 2. Use the useSupport hook\r\n\r\n```tsx\r\nimport { useSupport } from '@codeimplants/support';\r\n\r\nfunction ErrorScreen() {\r\n  const { openWhatsApp, sendEmail, makeCall, isMethodAvailable } = useSupport({\r\n    errorMessage: 'Failed to load user profile',\r\n    errorCode: '500',\r\n    screenName: 'ProfileScreen',\r\n    timestamp: new Date().toISOString(),\r\n    appVersion: '1.0.0',\r\n    platform: 'ios',\r\n    os: 'iOS 17.0',\r\n  });\r\n\r\n  return (\r\n    <View>\r\n      <Button onPress={() => openWhatsApp()}>\r\n        Contact via WhatsApp\r\n      </Button>\r\n      \r\n      <Button onPress={() => sendEmail()}>\r\n        Send Email\r\n      </Button>\r\n      \r\n      {isMethodAvailable('phone') && (\r\n        <Button onPress={() => makeCall()}>\r\n          Call Support\r\n        </Button>\r\n      )}\r\n    </View>\r\n  );\r\n}\r\n```\r\n\r\n## API Reference\r\n\r\n### SupportProvider\r\n\r\nReact Context Provider that makes support configuration available throughout your app.\r\n\r\n**Props:**\r\n- `config: SupportConfig` - Support configuration object\r\n\r\n### useSupport(errorContext?)\r\n\r\nPrimary hook for interacting with support services.\r\n\r\n**Parameters:**\r\n- `errorContext?: ErrorContext` - Optional error context to include in support messages\r\n\r\n**Returns:**\r\n```typescript\r\n{\r\n  openWhatsApp: (customMessage?: string) => Promise<SupportActionResult>;\r\n  sendEmail: (customSubject?: string, customBody?: string) => Promise<SupportActionResult>;\r\n  makeCall: () => Promise<SupportActionResult>;\r\n  isMethodAvailable: (method: 'whatsapp' | 'email' | 'phone') => boolean;\r\n  config: SupportConfig;\r\n}\r\n```\r\n\r\n### Platform Utilities\r\n\r\n```typescript\r\nimport { isWeb, isIOS, isAndroid, getNormalizedPlatform } from '@codeimplants/support';\r\n\r\n// Check platform\r\nif (isWeb()) {\r\n  // Web-specific logic\r\n}\r\n\r\n// Get normalized platform ('web' | 'ios' | 'android')\r\nconst platform = getNormalizedPlatform();\r\n```\r\n\r\n## Platform-Specific Configuration\r\n\r\nOverride configuration for specific platforms:\r\n\r\n```typescript\r\nconst config = {\r\n  whatsapp: { number: '919876543210' },\r\n  email: { address: 'support@app.com' },\r\n  \r\n  platformOverrides: {\r\n    web: {\r\n      // Web users get different email\r\n      email: { address: 'web-support@app.com' },\r\n    },\r\n    ios: {\r\n      // iOS users can call directly\r\n      phone: { number: '+919876543210' },\r\n    },\r\n  },\r\n};\r\n```\r\n\r\n## Error Context Auto-Formatting\r\n\r\nWhen you provide an `ErrorContext`, it's automatically formatted into support messages:\r\n\r\n**WhatsApp Message:**\r\n```\r\nHello, I need help with an issue.\r\n\r\n--- Error Details ---\r\nError: Failed to load user profile\r\nCode: 500\r\nScreen: ProfileScreen\r\nTime: 2024-02-11T16:30:00.000Z\r\nApp Version: 1.0.0\r\nPlatform: ios\r\n```\r\n\r\n**Email Body:**\r\n```\r\nHello,\r\n\r\nI need assistance with an issue.\r\n\r\n--- Error Details ---\r\nError: Failed to load user profile\r\nError Code: 500\r\nScreen: ProfileScreen\r\nTimestamp: 2024-02-11T16:30:00.000Z\r\nApp Version: 1.0.0\r\nPlatform: ios\r\nOS: iOS 17.0\r\n\r\nPlease describe your issue:\r\n```\r\n\r\n## Platform Compatibility\r\n\r\n### React Native (Expo)\r\n✅ Works out of the box\r\n\r\n### React Native (Bare)\r\n✅ Works out of the box\r\n\r\n### React Native Web\r\n✅ Automatically detects web platform and uses `https://wa.me/` for WhatsApp\r\n\r\n### iOS\r\n✅ Uses `whatsapp://`, `mailto:`, `tel:` URL schemes\r\n\r\n### Android\r\n✅ Uses `whatsapp://`, `mailto:`, `tel:` URL schemes\r\n\r\n## TypeScript Support\r\n\r\nFull TypeScript support with exported types:\r\n\r\n```typescript\r\nimport type {\r\n  SupportConfig,\r\n  ErrorContext,\r\n  SupportMethod,\r\n  SupportActionResult,\r\n} from '@codeimplants/support';\r\n```\r\n\r\n## License\r\n\r\nMIT\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Please open an issue or PR.\r\n","readmeFilename":"README.md","_rev":"1-ed4cc636af32560a3c7ed0553a30786e"}