{"_id":"@ananthapadma.s/test-sdk-5","name":"@ananthapadma.s/test-sdk-5","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@ananthapadma.s/test-sdk-5","version":"1.0.0","description":"SDK for integrating with the Stylist POS system","main":"assets/stylist-sdk.min.js","module":"assets/stylist-sdk.esm.js","types":"assets/types/index.d.ts","scripts":{"build":"rollup -c","build:watch":"rollup -c -w","clean":"rm -rf assets","test":"jest","test:coverage":"jest --coverage","test:watch":"jest --watch","test:example":"ts-node examples/test.ts","lint":"eslint . --ext .ts","lint:fix":"eslint . --ext .ts --fix","prepare":"npm run clean && npm run build","prepublishOnly":"","example:auth":"ts-node examples/auth-example.ts","example:cart":"ts-node examples/cart-example.ts","example:all":"npm run test:example && npm run example:auth && npm run example:cart","docs":"typedoc src/index.ts","dev":"vite","build:ui":"vite build","preview":"vite preview"},"keywords":["stylist","pos","sdk","cart","ecommerce","typescript","api-client"],"author":{"name":"Stylist"},"license":"MIT","devDependencies":{"@rollup/plugin-terser":"^0.4.4","@rollup/plugin-typescript":"^12.1.2","@types/jest":"^29.5.0","@types/node":"^18.19.100","@types/react":"^18.3.23","@types/react-dom":"^18.3.7","@typescript-eslint/eslint-plugin":"^5.57.1","@typescript-eslint/parser":"^5.57.1","@vitejs/plugin-react":"^4.6.0","autoprefixer":"^10.4.21","eslint":"^8.37.0","javascript-obfuscator":"^4.1.1","jest":"^29.5.0","postcss":"^8.5.6","rollup":"^4.40.0","rollup-plugin-obfuscator":"^1.1.0","tailwindcss":"^3.4.17","ts-jest":"^29.1.0","ts-node":"^10.9.2","typedoc":"^0.25.12","typescript":"^5.8.3","vite":"^5.4.19"},"dependencies":{"@radix-ui/react-dialog":"^1.0.5","@radix-ui/react-dropdown-menu":"^2.0.6","@radix-ui/react-icons":"^1.3.2","@radix-ui/react-label":"^2.1.7","@radix-ui/react-popover":"^1.1.14","@radix-ui/react-separator":"^1.1.6","@radix-ui/react-slot":"^1.2.3","@radix-ui/react-toast":"^1.1.5","@types/isomorphic-fetch":"^0.0.39","@zxing/browser":"^0.1.5","class-variance-authority":"^0.7.1","clsx":"^2.1.1","isomorphic-fetch":"^3.0.0","lucide-react":"^0.509.0","react":"^18.3.1","react-dom":"^18.3.1","shadcn-ui":"^0.9.5","tailwind-merge":"^2.6.0","tailwindcss-animate":"^1.0.7"},"engines":{"node":">=18.0.0","npm":">=8.0.0"},"repository":{"type":"git","url":"git+https://github.com/stylist/sdk.git"},"bugs":{"url":"https://github.com/stylist/sdk/issues"},"homepage":"https://github.com/stylist/sdk#readme","sideEffects":false,"_id":"@ananthapadma.s/test-sdk-5@1.0.0","gitHead":"519f225360406b52396490cf08742d53c24434b6","_nodeVersion":"22.17.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-EKRruwzCAHxYUibdXUsfrCQBtMSlAb7PqYPGKA5GkTL4wTnFDPfWQpW94St8J0zMGx6tYG1N6tJ5jeSPnrgjqw==","shasum":"ab738f17dd67ee68810de48d89f8000dedfa4ace","tarball":"https://registry.npmjs.org/@ananthapadma.s/test-sdk-5/-/test-sdk-5-1.0.0.tgz","fileCount":39,"unpackedSize":167091,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICbnqu3Ng6ESFBW5TaSp9f0bEpVCw5FypsHvONRkJyZHAiB+LU5jY3GxfDWj82HIcFHftJa74/q9Ex2ksay03248EQ=="}]},"_npmUser":{"name":"ananthapadma.s","email":"ananthpadma.s@xyretail.com"},"directories":{},"maintainers":[{"name":"ananthapadma.s","email":"ananthpadma.s@xyretail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/test-sdk-5_1.0.0_1764683603520_0.9372444849724815"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-02T13:53:23.456Z","1.0.0":"2025-12-02T13:53:23.693Z","modified":"2025-12-02T13:53:23.963Z"},"maintainers":[{"name":"ananthapadma.s","email":"ananthpadma.s@xyretail.com"}],"description":"SDK for integrating with the Stylist POS system","homepage":"https://github.com/stylist/sdk#readme","keywords":["stylist","pos","sdk","cart","ecommerce","typescript","api-client"],"repository":{"type":"git","url":"git+https://github.com/stylist/sdk.git"},"author":{"name":"Stylist"},"bugs":{"url":"https://github.com/stylist/sdk/issues"},"license":"MIT","readme":"# Stylist SDK\n\nA TypeScript SDK for interacting with the Stylist API. This SDK provides a simple and type-safe way to interact with the Stylist platform's API endpoints.\n\n## Features\n\n- Type-safe API calls\n- Authentication handling\n- Cart management\n- Error handling\n- Response interceptors and middleware\n- Swagger UI for testing and documentation\n- shadcn UI components for consistent and accessible UI elements\n\n## Project Structure\n\n```\nStylistSDK/\n├── src/                          # SDK source code\n│   ├── config/                   # API configurations\n│   ├── errors/                   # Error definitions\n│   ├── interfaces/               # Type definitions\n│   ├── middleware/               # Request/response interceptors\n│   │   └── logging-middleware.ts # Debug logging\n│   ├── services/                 # Core functionality\n│   ├── ui/                       # UI components\n│   │   └── shadcn/               # shadcn UI components\n│   │       ├── components/       # Reusable UI components\n│   │       ├── lib/              # Utility functions\n│   │       └── styles/           # Global styles and themes\n│   ├── utils/                    # Utility functions\n│   │   └── network-controller.ts # HTTP request handling\n│   └── index.ts                  # Main SDK entry point\n├── swagger-ui/                   # Swagger UI testing interface\n│   ├── src/                      # React components\n│   │   └── components/           # Swagger UI component\n│   └── public/                   # Static files\n├── assets/                       # Build output\n└── package.json                  # SDK dependencies\n```\n\n## Installation\n\n```bash\nnpm install @stylist/sdk\n```\n\n## Usage\n\n### Initialization\n\n```typescript\nimport { StylistSDK } from '@stylist/sdk';\n\nconst sdk = new StylistSDK({\n  baseUrl: 'https://stylist-master.xyretail.com',\n  apiKey: 'your-api-key'\n});\n```\n\n### Authentication\n\n```typescript\n// Verify user credentials\nconst authResponse = await sdk.auth.verifyCredentials({\n  username: 'user@example.com',\n  password: 'password123'\n});\n\n// Handle authentication errors\ntry {\n  await sdk.auth.verifyCredentials(credentials);\n} catch (error) {\n  if (error instanceof AuthenticationError) {\n    console.error('Authentication failed:', error.message);\n  }\n}\n```\n\n### Cart Management\n\n```typescript\n// Create a new cart\nconst cart = await sdk.cart.createCart();\n\n// Add items to cart\nconst cartItems = await sdk.cart.addItems(cart.cartId, {\n  items: [{\n    productId: '123',\n    quantity: 1\n  }]\n});\n\n// Get cart details\nconst cartDetails = await sdk.cart.getCart(cart.cartId);\n\n// Remove item from cart\nawait sdk.cart.removeItemFromCart(cart.cartId, 'item-id');\n\n// Set customer in cart\nawait sdk.cart.setCustomerInCart(cart.cartId, {\n  id: 'customer-id',\n  name: 'John Doe',\n  email: 'john@example.com'\n});\n\n// Navigate to cart\nsdk.cart.goToCart({ \n  cartUri: '/cart/123',\n  inApp: true // Set to false to open in new window\n});\n```\n\n### Response Interceptors\n\n```typescript\nimport { LoggingMiddleware } from '@stylist/sdk/middleware';\n\n// Add logging middleware\nsdk.addMiddleware(new LoggingMiddleware());\n\n// Custom middleware example\nclass CustomMiddleware implements ResponseInterceptor {\n  async onSuccess(response: Response): Promise<Response> {\n    // Handle successful responses\n    return response;\n  }\n\n  async onError(error: Error): Promise<never> {\n    // Handle errors\n    throw error;\n  }\n}\n```\n\n### Error Handling\n\n```typescript\ntry {\n  await sdk.cart.addItems(cartId, items);\n} catch (error) {\n  if (error instanceof ValidationError) {\n    console.error('Invalid input:', error.message);\n  } else if (error instanceof NetworkError) {\n    console.error('Network error:', error.message);\n  } else {\n    console.error('Unexpected error:', error);\n  }\n}\n```\n\n## Development\n\n### Prerequisites\n- Node.js (v16 or higher)\n- npm or yarn\n\n### Setup\n1. Clone the repository\n2. Install dependencies: `npm install`\n3. Build the SDK: `npm run build`\n\n### UI Components\nThe SDK includes a set of reusable UI components built with shadcn/ui. These components are:\n- Fully accessible\n- Customizable through Tailwind CSS\n- Dark mode compatible\n- Type-safe with TypeScript\n\nAvailable components:\n- Button\n- Input\n- Card\n- Badge\n\nTo use these components:\n```typescript\nimport { Button } from '@/ui/shadcn/components/button';\nimport { Input } from '@/ui/shadcn/components/input';\nimport { Card } from '@/ui/shadcn/components/card';\nimport { Badge } from '@/ui/shadcn/components/badge';\n```\n\n### Testing Interface\nThe SDK includes a Swagger UI interface for testing API endpoints. To access it:\n\n1. Navigate to the swagger-ui directory: `cd swagger-ui`\n2. Install dependencies: `npm install`\n3. Start the development server: `npm run dev`\n4. Open http://localhost:5174 in your browser\n\nThe Swagger UI provides:\n- Interactive API documentation\n- Endpoint testing interface\n- Request/response schemas\n- Authentication testing\n\n## API Endpoints\n\n### Authentication\n- `/_a/actionSheet.xyidentity.VerifyCredentialsV2Action` - Verify user credentials\n\n### Cart Management\n- `/cart` - Create a new cart\n- `/cart/{cartId}` - Get cart details\n- `/cart/{cartId}/items` - Add items to cart\n\n## Error Handling\n\nThe SDK includes comprehensive error handling for various API scenarios:\n\n```typescript\ntry {\n  await sdk.auth.verifyCredentials(credentials);\n} catch (error) {\n  if (error instanceof AuthenticationError) {\n    // Handle authentication errors\n  } else if (error instanceof ValidationError) {\n    // Handle validation errors\n  } else {\n    // Handle other errors\n  }\n}\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add: amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","readmeFilename":"README.md","_rev":"1-92a73096d7b2c40c81476099b0502c49"}