{"_id":"@teyaproduct/teya-blocks-js","_rev":"8-62567c917875a37e617174943150dc3a","name":"@teyaproduct/teya-blocks-js","dist-tags":{"latest":"0.2.0"},"versions":{"0.0.1":{"name":"@teyaproduct/teya-blocks-js","version":"0.0.1","keywords":["teya","payments","sdk","checkout","loader"],"license":"Apache-2.0","_id":"@teyaproduct/teya-blocks-js@0.0.1","maintainers":[{"name":"teya-ecommerce-team","email":"ecommerce-team@teya.com"}],"homepage":"https://github.com/saltpay/teya-blocks-js#readme","bugs":{"url":"https://github.com/saltpay/teya-blocks-js/issues"},"dist":{"shasum":"9311fe8fc56b00fd8eb52c75c050d2cf4adf8afe","tarball":"https://registry.npmjs.org/@teyaproduct/teya-blocks-js/-/teya-blocks-js-0.0.1.tgz","fileCount":8,"integrity":"sha512-5u29VKM82/BGnHFNpOs8/MSNYSHfkSUlnvDdct98eCXdC+DEDv6QrgJRX24Kjau7jBcnHtm9Mbibu88OrB7riw==","signatures":[{"sig":"MEUCIFTyO79MHzpcuDPrS+qHWvrfBkSBUx/i6aEWLBeHrGrjAiEAxl4tx/FsRfdSDOJhnuo5rPULRxfO7rPeOZMOj1t/LsU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":39883},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.js","browser":"dist/teya-blocks-js.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"244316badcfb4ed18a1bd11b97419069b175ed04","scripts":{"dev":"tsup --watch","lint":"eslint src/","build":"tsup","clean":"rm -rf dist","release":"npm run build && changeset publish","lint:fix":"eslint src/ --fix","changeset":"changeset","type-check":"tsc --noEmit","prepublishOnly":"npm run build","changeset:publish":"npm run build && changeset publish","changeset:version":"changeset version"},"_npmUser":{"name":"teya-ecommerce-team","email":"ecommerce-team@teya.com"},"repository":{"url":"git+https://github.com/saltpay/teya-blocks-js.git","type":"git"},"_npmVersion":"10.8.2","description":"Lightweight loader for Teya Blocks SDK","directories":{},"sideEffects":false,"_nodeVersion":"20.18.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","eslint":"^9.19.0","@eslint/js":"^9.19.0","typescript":"^5.3.0","@changesets/cli":"^2.30.0","typescript-eslint":"^8.56.1"},"_npmOperationalInternal":{"tmp":"tmp/teya-blocks-js_0.0.1_1772960786758_0.8123820610122132","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@teyaproduct/teya-blocks-js","version":"0.0.2","keywords":["teya","payments","sdk","checkout","loader"],"license":"Apache-2.0","_id":"@teyaproduct/teya-blocks-js@0.0.2","maintainers":[{"name":"teya-ecommerce-team","email":"ecommerce-team@teya.com"}],"homepage":"https://github.com/saltpay/teya-blocks-js#readme","bugs":{"url":"https://github.com/saltpay/teya-blocks-js/issues"},"dist":{"shasum":"c397d3b75c2d3c99bd6d18aefcc1593535632446","tarball":"https://registry.npmjs.org/@teyaproduct/teya-blocks-js/-/teya-blocks-js-0.0.2.tgz","fileCount":8,"integrity":"sha512-0a8uSskZkt3VYQmLdowANdsn6CfPCDGmBCvTljr74bqHAitq9O7mAshTcRD2vXVqkzLTiF/k4wIsz/PGGhbQOQ==","signatures":[{"sig":"MEQCIE6lRPoPyqrB8pkp5CNLBxb3MUthw0VfReV5EVs/o8plAiB9AuYPdrtG2GdvomVi7hkJzraa2Jf9mCCqS1EICxeUYg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":39893},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.js","browser":"dist/teya-blocks-js.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"f6989e3a7932fbd9e8e4238167c06969f80ed7c3","scripts":{"dev":"tsup --watch","lint":"eslint src/","build":"tsup","clean":"rm -rf dist","release":"npm run build && changeset publish","lint:fix":"eslint src/ --fix","changeset":"changeset","type-check":"tsc --noEmit","prepublishOnly":"npm run build","changeset:publish":"npm run build && changeset publish","changeset:version":"changeset version"},"_npmUser":{"name":"teya-ecommerce-team","email":"ecommerce-team@teya.com"},"repository":{"url":"git+https://github.com/saltpay/teya-blocks-js.git","type":"git"},"_npmVersion":"10.8.2","description":"Lightweight loader for Teya Blocks SDK","directories":{},"sideEffects":false,"_nodeVersion":"20.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","eslint":"^10.0.2","@eslint/js":"^9.19.0","typescript":"^5.3.0","@changesets/cli":"^2.30.0","typescript-eslint":"^8.56.1"},"_npmOperationalInternal":{"tmp":"tmp/teya-blocks-js_0.0.2_1772961341964_0.5528881176662352","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"@teyaproduct/teya-blocks-js","version":"0.1.0","keywords":["teya","payments","sdk","checkout","loader"],"license":"Apache-2.0","_id":"@teyaproduct/teya-blocks-js@0.1.0","maintainers":[{"name":"teya-ecommerce-team","email":"ecommerce-team@teya.com"}],"homepage":"https://github.com/saltpay/teya-blocks-js#readme","bugs":{"url":"https://github.com/saltpay/teya-blocks-js/issues"},"dist":{"shasum":"4fbf80d10db0bd23b2eedf4e869f6a33e6e38465","tarball":"https://registry.npmjs.org/@teyaproduct/teya-blocks-js/-/teya-blocks-js-0.1.0.tgz","fileCount":8,"integrity":"sha512-xYD3SAqWrWSJ6QPYC74mKL9fD3Z7WLiDIcdOOA1MgWVBRbUNfeYDM+U753zaTU2EHXaCGZ4fQsME77c1uW9c8g==","signatures":[{"sig":"MEYCIQCMJZpB51y9dkOOrcrKF0qjuY0AsU84c2FuyH5+OQEhpwIhAJJeBHuzTns9Dh0DX0LF1Du7BT+Mznq0OfVPgFyUFAgc","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":40720},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.js","browser":"dist/teya-blocks-js.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"e6ad4af29627dbc0d9d79bef7f8a67f1e0578f99","scripts":{"dev":"tsup --watch","lint":"eslint src/","build":"tsup","clean":"rm -rf dist","release":"npm run build && changeset publish","lint:fix":"eslint src/ --fix","changeset":"changeset","type-check":"tsc --noEmit","prepublishOnly":"npm run build","changeset:publish":"npm run build && changeset publish","changeset:version":"changeset version"},"_npmUser":{"name":"teya-ecommerce-team","email":"ecommerce-team@teya.com"},"repository":{"url":"git+https://github.com/saltpay/teya-blocks-js.git","type":"git"},"_npmVersion":"10.8.2","description":"Lightweight loader for Teya Blocks SDK","directories":{},"sideEffects":false,"_nodeVersion":"20.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","eslint":"^10.0.2","@eslint/js":"^9.19.0","typescript":"^5.3.0","@changesets/cli":"^2.30.0","typescript-eslint":"^8.56.1"},"_npmOperationalInternal":{"tmp":"tmp/teya-blocks-js_0.1.0_1773152456978_0.4647929415220937","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@teyaproduct/teya-blocks-js","version":"0.2.0","keywords":["teya","payments","sdk","checkout","loader"],"license":"Apache-2.0","_id":"@teyaproduct/teya-blocks-js@0.2.0","maintainers":[{"name":"teya-ecommerce-team","email":"ecommerce-team@teya.com"}],"homepage":"https://github.com/saltpay/teya-blocks-js#readme","bugs":{"url":"https://github.com/saltpay/teya-blocks-js/issues"},"dist":{"shasum":"6eddb79395e52dbab260af8c31539565e8d07b46","tarball":"https://registry.npmjs.org/@teyaproduct/teya-blocks-js/-/teya-blocks-js-0.2.0.tgz","fileCount":8,"integrity":"sha512-1Yv8JRPBo4ZQOmz8FunAB6LuRkPmzr45atyV5V78Nnw5mErFfHAwh6+lQLLR7BHuA09YRvCelz8aVduDRg70OA==","signatures":[{"sig":"MEYCIQDUjVzyKp7OeZ/Yrh+1WbRQ7eNGf3KR/SaQMQF7LlONAgIhAN1mpLw2uumILx5UmpdCHhFqgJdWXycI/iemmEBb/rVh","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":40721},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.js","browser":"dist/teya-blocks-js.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"5b395d38a8a592bfe0bbbd75a552df95d5842c25","scripts":{"dev":"tsup --watch","lint":"eslint src/","build":"tsup","clean":"rm -rf dist","release":"npm run build && changeset publish","lint:fix":"eslint src/ --fix","changeset":"changeset","type-check":"tsc --noEmit","prepublishOnly":"npm run build","changeset:publish":"npm run build && changeset publish","changeset:version":"changeset version"},"_npmUser":{"name":"teya-ecommerce-team","email":"ecommerce-team@teya.com"},"repository":{"url":"git+https://github.com/saltpay/teya-blocks-js.git","type":"git"},"_npmVersion":"10.8.2","description":"Lightweight loader for Teya Blocks SDK","directories":{},"sideEffects":false,"_nodeVersion":"20.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","eslint":"^10.0.2","@eslint/js":"^9.19.0","typescript":"^5.3.0","@changesets/cli":"^2.30.0","typescript-eslint":"^8.56.1"},"_npmOperationalInternal":{"tmp":"tmp/teya-blocks-js_0.2.0_1773666382458_0.49808364377582803","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-03-08T09:06:26.655Z","modified":"2026-09-21T08:22:42.346Z","1.0.0":"2026-03-06T14:30:38.980Z","0.0.1":"2026-03-08T09:06:26.923Z","0.0.2":"2026-03-08T09:15:42.116Z","0.1.0":"2026-03-10T14:20:57.157Z","0.2.0":"2026-03-16T13:06:22.603Z"},"bugs":{"url":"https://github.com/saltpay/teya-blocks-js/issues"},"license":"Apache-2.0","homepage":"https://github.com/saltpay/teya-blocks-js#readme","keywords":["teya","payments","sdk","checkout","loader"],"repository":{"url":"git+https://github.com/saltpay/teya-blocks-js.git","type":"git"},"description":"Lightweight loader for Teya Blocks SDK","maintainers":[{"email":"ecommerce-team@teya.com","name":"teya-ecommerce-team"},{"email":"open-source@teya.com","name":"opensource-teya"}],"readme":"# @teyaproduct/teya-blocks-js\n\nLightweight JavaScript loader for the Teya Blocks payment SDK. Loads the full SDK from CDN and provides TypeScript types.\n\n## Installation\n\n```bash\nnpm install @teyaproduct/teya-blocks-js\n```\nor \n```bash\n<script src=\"https://cdn.teya.com/static/web-sdk/js/teya-blocks-js.js\"></script>\n```\n\n## Usage\n\n### ES Modules\n\n```typescript\nimport { initTeyaBlocks } from '@teyaproduct/teya-blocks-js';\n\nconst teya = await initTeyaBlocks('your-session-token');\n\nif (teya) {\n  const card = teya.elements.create('card', {\n    onReady: () => console.log('Card element ready'),\n    onChange: (event) => console.log('Card changed:', event),\n  });\n\n  card.mount('#card-container');\n}\n```\n\n### Script Tag (CDN)\n\n```html\n<script src=\"https://cdn.teya.com/static/web-sdk/js/teya-blocks-js.js\"></script>\n<script>\n  TeyaBlocksLoader.initTeyaBlocks('your-session-token').then(function (teya) {\n    if (teya) {\n      var checkout = teya.elements.create('checkout', {\n        onSuccess: function (response, method) {\n          console.log('Payment successful:', method);\n        },\n        onError: function (error, method) {\n          console.error('Payment failed:', error);\n        },\n      });\n      checkout.mount('#checkout-container');\n    }\n  });\n</script>\n```\n\n## API\n\n### initTeyaBlocks(sessionToken, options?)\n\nInitializes the SDK by loading it from CDN.\n\n```typescript\nconst teya = await initTeyaBlocks(sessionToken, {\n  developmentMode: false,\n  locale: 'en-GB',\n  appearance: {\n    theme: 'default',\n    fontFamily: 'inter',\n  },\n});\n```\n\n**Parameters:**\n\n| Parameter      | Type                | Required | Description          |\n| -------------- | ------------------- | -------- | -------------------- |\n| `sessionToken` | `string`            | Yes      | Your session token   |\n| `options`      | `TeyaBlocksOptions` | No       | Configuration options|\n\n**Options:**\n\n| Option            | Type         | Default   | Description                          |\n| ----------------- | ------------ | --------- | ------------------------------------ |\n| `developmentMode` | `boolean`    | `false`   | Use development CDN                  |\n| `locale`          | `Locale`     | `'en-GB'` | Locale for labels and error messages |\n| `appearance`      | `Appearance` | -         | Theme and styling customization      |\n| `cspNonce`        | `string`     | -         | CSP nonce for inline styles          |\n\n**Returns:** `Promise<TeyaBlocks | null>` - Returns `null` on failure.\n\n### Elements\n\nCreate payment elements using `teya.elements.create()`:\n\n```typescript\n// Card element - single input for card details\nconst card = teya.elements.create('card', options);\n\n// Checkout element - complete payment form with multiple methods\nconst checkout = teya.elements.create('checkout', options);\n\n// Apple Pay element\nconst applePay = teya.elements.create('applePay', options);\n```\n\n**Element Methods:**\n\n| Method                | Description                    |\n| --------------------- | ------------------------------ |\n| `mount(selector)`     | Mount element to DOM container |\n| `unmount()`           | Remove element from DOM        |\n| `destroy()`           | Destroy element instance       |\n| `update(options)`     | Update element options         |\n| `submitPayment()`     | Submit payment (card/checkout) |\n\n## TypeScript\n\nFull TypeScript support with exported types:\n\n```typescript\nimport type {\n  TeyaBlocks,\n  TeyaBlocksOptions,\n  CardElement,\n  CardElementOptions,\n  CheckoutElement,\n  CheckoutElementOptions,\n  ApplePayElement,\n  PaymentSubmitResponse,\n  PaymentSubmitError,\n} from '@teyaproduct/teya-blocks-js';\n```\n","readmeFilename":"README.md"}