{"_id":"@airwallex/login-widget","_rev":"8-349204175319c9f3aa76eb6cc610843a","name":"@airwallex/login-widget","dist-tags":{"beta":"1.0.0-beta.3","latest":"1.2.1"},"versions":{"1.0.0-beta.1":{"name":"@airwallex/login-widget","version":"1.0.0-beta.1","description":"airwallex login widget","repository":{"type":"git","url":"git+https://github.com/airwallex/airwallex-login-widget.git"},"author":{"name":"Airwallex"},"license":"MIT","keywords":["Airwallex","Login","Widget","Two factor"],"publishConfig":{"access":"public"},"type":"module","source":"./src/index.ts","exports":{"require":"./dist/index.cjs","default":"./dist/index.modern.js"},"main":"./dist/index.cjs","module":"./dist/index.module.js","unpkg":"./dist/index.umd.js","types":"./dist/index.d.ts","scripts":{"prepare":"husky install","watch":"microbundle watch","build":"tsc --noEmit && microbundle build","test":"jest","lint":"eslint \"src/*.{ts,tsx}\""},"devDependencies":{"@commitlint/cli":"^15.0.0","@commitlint/config-conventional":"^15.0.0","@semantic-release/changelog":"^6.0.0","@semantic-release/git":"^10.0.0","@swc/core":"^1.2.102","@swc/jest":"^0.2.5","@testing-library/dom":"^8.10.1","@testing-library/jest-dom":"^5.14.1","@types/jest":"^27.0.2","@typescript-eslint/eslint-plugin":"^5.2.0","@typescript-eslint/parser":"^5.2.0","eslint":"^8.1.0","eslint-config-prettier":"^8.3.0","eslint-plugin-jest":"^25.2.2","eslint-plugin-jest-dom":"^3.9.2","husky":"^7.0.4","jest":"^27.3.1","lint-staged":"^11.2.3","microbundle":"^0.14.1","prettier":"^2.4.1","semantic-release":"^18.0.0","ts-node":"^10.3.0","typescript":"^4.4.4"},"browserslist":["defaults","maintained node versions"],"lint-staged":{"**/*.{js,jsx,ts,tsx,json,css,scss,md}":["prettier --write"],"**/*.{js,jsx,ts,tsx}":["eslint"]},"prettier":{"printWidth":120,"singleQuote":true,"trailingComma":"all"},"gitHead":"4532c1d028c7a2071f9e9469ac781cc308d6aa25","bugs":{"url":"https://github.com/airwallex/airwallex-login-widget/issues"},"homepage":"https://github.com/airwallex/airwallex-login-widget#readme","_id":"@airwallex/login-widget@1.0.0-beta.1","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-kpl4E0I3xpC88ngWpCuzRjs88gVRaf9kp6a5o4NjNFeddp7+dPKXsTzoID5FtdsbE8O27sgy/y9bjb0oANGTfw==","shasum":"62541039dd682084cd2a2f72d25ea403d29952aa","tarball":"https://registry.npmjs.org/@airwallex/login-widget/-/login-widget-1.0.0-beta.1.tgz","fileCount":71,"unpackedSize":180301,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhnMAnCRA9TVsSAnZWagAAvOoQAJhOb53vWmVQU91zVqBo\npUyCo5OVcmMe09STOuu6363HIjdiLxtKspbNA3AIMouzdkpjq3GY/2xXOtUz\nUgjakwq7PhvuFfT0h4cSykTbZ0M7Wp3+Sm5tLGSXdJgrhJGakS2BaLVUE57X\nNTmL5dyqWWUBKFVGhPSMZioQEj4q4eEHnRamnoyA3U2qZCfKwMmP03IHajtz\npxZg1UrcY991Ygfwrvno6qmf3uRiG3tnE/m90T8/QKdjotnowI7Neib2cAna\noVI0yBWG8xH8HiMUYkMRxA5DnDW9yna94ocG8i2VpJn+dOXKxSJIjdrYkbzP\nHlrAr60RoAs0ibxdd/fIEmkDXpmzPZcEXhQ3WE2/DZc27BsEJcD9peXpSTgD\nK8NtOEenjoJL0EBTliNuhcF9Go7zB780E1Kt+2+oXhKZv2/Evyu2aG2546xC\nnWNWWsFKUsx8PwwVw7YcFaPURqx4UlfTKaflbozfhdjvRHFVsu4Fmc7BCiCw\ngbWSfFt1MNBani95I96cB2CSAVEircR5hvCtKvV7HTLaMoSkBeFD1nacRHK2\n5UX9ph0VtQLYcgFMJeacAKJKvoZQ14zTR/cPuUE+leKuLPREZYog9I4KtOhs\nf2dmeUHDC/MmcaaRe/QSwqazi6VlHsQd2HF0SI4JsL3gDvAH+LfqSvSRlS6G\nCrCs\r\n=0Gt0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCNf63Ds573uI/h9tqv3MLsQZc0xFN1D3KnQbma0/3K3gIhAJkVD2ZhWe+DG00qAdbQhnIZTfiP1NOrlRkQmRFvYc20"}]},"_npmUser":{"name":"airwallex","email":"wallex.test@gmail.com"},"directories":{},"maintainers":[{"name":"airwallex","email":"wallex.test@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/login-widget_1.0.0-beta.1_1637662759526_0.32031000542999455"},"_hasShrinkwrap":false},"1.0.0-beta.2":{"name":"@airwallex/login-widget","version":"1.0.0-beta.2","description":"airwallex login widget","repository":{"type":"git","url":"git+https://github.com/airwallex/airwallex-login-widget.git"},"author":{"name":"Airwallex"},"license":"MIT","keywords":["Airwallex","Login","Widget","Two factor"],"publishConfig":{"access":"public"},"type":"module","source":"./src/index.ts","exports":{"require":"./dist/index.cjs","default":"./dist/index.modern.js"},"main":"./dist/index.cjs","module":"./dist/index.module.js","unpkg":"./dist/index.umd.js","types":"./dist/index.d.ts","scripts":{"prepare":"husky install","watch":"microbundle watch","build":"tsc --noEmit && microbundle build","test":"jest","lint":"eslint \"src/*.{ts,tsx}\""},"devDependencies":{"@commitlint/cli":"^15.0.0","@commitlint/config-conventional":"^15.0.0","@semantic-release/changelog":"^6.0.0","@semantic-release/git":"^10.0.0","@swc/core":"^1.2.102","@swc/jest":"^0.2.5","@testing-library/dom":"^8.10.1","@testing-library/jest-dom":"^5.14.1","@types/jest":"^27.0.2","@typescript-eslint/eslint-plugin":"^5.2.0","@typescript-eslint/parser":"^5.2.0","eslint":"^8.1.0","eslint-config-prettier":"^8.3.0","eslint-plugin-jest":"^25.2.2","eslint-plugin-jest-dom":"^3.9.2","husky":"^7.0.4","jest":"^27.3.1","lint-staged":"^11.2.3","microbundle":"^0.14.1","prettier":"^2.4.1","semantic-release":"^18.0.0","ts-node":"^10.3.0","typescript":"^4.4.4"},"browserslist":["defaults","maintained node versions"],"lint-staged":{"**/*.{js,jsx,ts,tsx,json,css,scss,md}":["prettier --write"],"**/*.{js,jsx,ts,tsx}":["eslint"]},"prettier":{"printWidth":120,"singleQuote":true,"trailingComma":"all"},"readme":"# Airwallex Login Widget\n\n## Installation\n\n```shell\nnpm install @airwallex/login-widget\n```\n\n## Get Started\n\nInitialize the widget:\n\n```js\nimport { LoginWidget } from '@airwallex/login-widget';\n\n// Must initialize before creating any login widgets.\n// These options will apply to all the login widgets.\nLoginWidget.init({\n  // The URL of the logo to display in the login widget.\n  // The recommended size of the image is 72x72 px.\n  logoUrl: 'https://your_website_logo_url',\n  // The environment of the widget.\n  env: 'production',\n  // 'en' or 'zh', these are the supported languages right now\n  locale: 'en',\n});\n```\n\nCreate a widget instance:\n\n```js\nimport { LoginWidget } from '@airwallex/login-widget';\n\nconst loginWidget = new LoginWidget({\n  // These are optional when instantiating the widget,\n  // but are required before authenticating.\n  // You could set them later using the widget's `update` method\n  authSummaryText: 'your_auth_summary_justification_text',\n  resourceId: 'the_unique_resource_id_to_be_authenticated',\n  // You could also customize the labels\n  labels: { emailLabel: 'User name' },\n});\n```\n\nListen to the cancel event, so that when the user clicks the exit button, you could unmount the widget\n\n```js\nloginWidget.on('cancel', () => {\n  loginWidget.unmount();\n});\n```\n\nAlso remember to listen to the auth success event\n\n```js\nloginWidget.on('auth_success', ({ signedToken }) => {\n  // Do something with the token\n});\n```\n\nYou will have to create a mask yourself, and mount the widget on top of it:\n\n```html\n<div class=\"mask\">\n  <div id=\"widget-container\"></div>\n</div>\n```\n\n```js\nloginWidget.mount('#widget-container');\n```\n\n## `LoginWidget`\n\n### `LoginWidget.init`\n\ntype: `(initOptions: WidgetInitOptions) => void;`\n\n```typescript\ninterface WidgetInitOptions {\n  /**\n   * The URL of the logo to display in the login widget.\n   * The recommended size of the image is 72x72 px.\n   */\n  logoUrl: string;\n  /**\n   * The environment of the login widget\n   * @default 'production'\n   */\n  env?: Environment;\n  /**\n   * The language of the login widget.\n   * @default 'en'\n   */\n  locale?: Language | undefined;\n}\n\ntype Language = 'en' | 'zh';\n\ntype Environment = 'staging' | 'demo' | 'production';\n```\n\n### `LoginWidget.constructor`\n\ntype: `constructor(options?: LoginWidgetOptions);`\n\n```typescript\ninterface LoginWidgetOptions {\n  authSummaryText: string;\n  resourceId: string;\n  labels?: LoginWidgetOptionsLabels | undefined;\n}\n\ninterface LoginWidgetOptionsLabels {\n  authButton?: string;\n  authCode?: string;\n  emailLabel?: string;\n  forgotPassword?: string;\n  loginButton?: string;\n  loginSubTitle?: string;\n  loginTitle?: string;\n  mfaTitle?: string;\n  passwordLabel?: string;\n  supportLink?: string;\n}\n```\n\n### `LoginWidget.prototype.on`\n\n#### `LoginWidget.prototype.on('ready', () => void)`\n\nEmitted when widget is ready to use.\n\n#### `LoginWidget.prototype.on('cancel', () => void)`\n\nEmitted when the user clicks the exit button.\n\n#### `LoginWidget.prototype.on('blur', (ev: LoginWidgetFieldEvent) => void)`\n\nEmitted when the user blurs the field.\n\n#### `LoginWidget.prototype.on('change', (ev: LoginWidgetFieldEvent) => void)`\n\nEmitted when the user changes the value of a field.\n\n#### `LoginWidget.prototype.on('focus', (ev: LoginWidgetFieldEvent) => void)`\n\nEmitted when the user focuses the field.\n\n```typescript\ninterface LoginWidgetFiledEvent {\n  /**\n   * Whether the input of the field is valid.\n   */\n  complete: boolean;\n  /**\n   * The name of the field.\n   */\n  field: FieldName;\n}\n\ntype FieldName = 'username' | 'password' | 'authcode';\n```\n\n#### `LoginWidget.prototype.on('login_success', () => void)`\n\nEmitted when the user login successfully.\n\n#### `LoginWidget.prototype.on('auth_success', (ev: LoginWidgetAuthSuccessEvent) => void)`\n\nEmitted when authentication is successful.\n\n```typescript\ninterface LoginWidgetAuthSuccessEvent {\n  signedToken: string;\n}\n```\n\n#### `LoginWidget.prototype.on('error', (ev: LoginWidgetErrorEvent) => void)`\n\nEmitted when error occurs.\n\n```typescript\ninterface LoginWidgetErrorEvent {\n  errorCode: string;\n  message: string;\n}\n\nconst ERROR_CODE_MAP = {\n  BAD_CREDENTIAL: 'User name or password is incorrect',\n  INVALID_AUTH_CODE: 'Invalid authorization code',\n  INVALID_RESOURCE_ID: 'Invalid resource ID',\n  TWO_FACTOR_AUTHENTICATION_NOT_ENABLED: 'Two-factor authentication is not enabled',\n  UNKNOWN_ERROR: 'Unknown error',\n  USER_AUTH_LOCKED: 'User has been locked due to multiple failed authentication attempts',\n  USER_LOGIN_LOCKED: 'User has been locked due to multiple failed login attempts',\n};\n```\n\n### `LoginWidget.prototype.removeEventListener`\n\nUnsubscribe the event.\n\ntype: `(eventType, listenerToBeRemoved) => void;`\n\n### `LoginWidget.prototype.mount`\n\nAppend the widget to the given DOM element.\n\nIf the DOM element could not be found, will throw an error.\n\ntype: `(domElement: string | HTMLElement) => void;`\n\n`domElement` is either a CSS Selector or a DOM element.\n\n### `LoginWidget.prototype.update`\n\nYou could also update the widget on the fly.\n\nEvery option used to initialize the widget could also be used to update the widget.\n\ntype: `(options: LoginWidgetUpdateOptions) => void;`\n\n```typescript\ninterface LoginWidgetUpdateOptions {\n  authSummaryText?: string | undefined;\n  resourceId?: string | undefined;\n  labels?: LoginWidgetOptionsLabels | undefined;\n}\n```\n\n### `LoginWidget.prototype.unmount`\n\nRemove the widget from the DOM.\n\nAll event listeners will NOT be removed, they must be removed manually.\n\ntype: `() => void;`\n\n## The Customizable Parts\n\n![Customizable Parts in Login Page](assets/customizable-parts-login.png)\n\n![Customizable Parts in Auth Page](assets/customizable-parts-auth.png)\n","readmeFilename":"README.md","gitHead":"d5bf2b1d93517988d32d2b7f4faf326a891f0eb0","bugs":{"url":"https://github.com/airwallex/airwallex-login-widget/issues"},"homepage":"https://github.com/airwallex/airwallex-login-widget#readme","_id":"@airwallex/login-widget@1.0.0-beta.2","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-9qMpeqkyUa5Wx03Sz58E0W4cp3RCMP+EPPoj5biL9z1WAfs5u1Exbumuoko1IKwlr8Lr3P1PRbSY6ykauMLiSg==","shasum":"23299b68b13f35fee41bdf17ad29dd7d6a72a07e","tarball":"https://registry.npmjs.org/@airwallex/login-widget/-/login-widget-1.0.0-beta.2.tgz","fileCount":71,"unpackedSize":181712,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhpYyeCRA9TVsSAnZWagAAD4cP/R1CX2cy5gHTFeFnkCPs\nlljuimK0Lp2gIU78YufdCn+0vQ504qa0PIwtIM8ImsJxU5T7qmcOTC8oz0+U\nfcxd1OXWIR/srjlGkznEA5w9wQPxtXdPB39RfQAa6w4KgOYALRPIMnbslEkv\nTq+Uu4dwq+GPyvbJIJyyIELSjDezUOmd7CoZWnUgPuJm44YazY7xPBsh2qTv\nZpN4CM9TBCuB5DVqynlYp7L5II7eihYVq23PoU1szrc7RTjeq/iG4zzgMI7K\n7/Vh8vSxo87PqekP91g08BiC79a8bUwopuk9VL0s5QJ5eIASMyheH/NXU8Yt\nVxxPOnQHvZU6HjqUl5O42S49vx+vXHgczPynQijyN9SirAR/CQCUwKF3kDWv\npZ8Nx2afQPDdWHCSDcrUvwjT7soZlyHvhuEXNLcX/HF2WDmlpAlcQ95XhUHx\nvnQQneIFg/AmBXJIUQ9jGnPMcPKmmrMBeSN/hP7lKp+UBVj9E4uOUQrNvLpN\n3Xi1WZCAit8AIzpVyHyilLmtRc5ZR33XAPviJahr4PAlKueoR0y0K1OBYG5K\n2z18PUeig37ycS2xno/GK9rXBKBAvaUaMyYAhRKwzm0yXkzHz9pTMSXB1C68\nrJL8dphz2FcBrHVhU9h7l+EheKJLiqsTK+E22441nMz5Lmu0J9nN7tZ2BLwx\n1P9G\r\n=wXz/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHTd8/bpTrOHe+b3/l6G1tplN9FWx/qux+H8qOZhhVhdAiEAySHARCYma3zt9ZTIgEc2K6c+Y8m3e+2y9zlSFPls6J8="}]},"_npmUser":{"name":"airwallex","email":"wallex.test@gmail.com"},"directories":{},"maintainers":[{"name":"airwallex","email":"wallex.test@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/login-widget_1.0.0-beta.2_1638239390489_0.1490293298271297"},"_hasShrinkwrap":false},"1.0.0-beta.3":{"name":"@airwallex/login-widget","version":"1.0.0-beta.3","description":"airwallex login widget","repository":{"type":"git","url":"git+https://github.com/airwallex/airwallex-login-widget.git"},"author":{"name":"Airwallex"},"license":"MIT","keywords":["Airwallex","Login","Widget","Two factor"],"publishConfig":{"access":"public"},"type":"module","source":"./src/index.ts","exports":{"require":"./dist/index.cjs","default":"./dist/index.modern.js"},"main":"./dist/index.cjs","module":"./dist/index.module.js","unpkg":"./dist/index.umd.js","types":"./dist/index.d.ts","scripts":{"prepare":"husky install","watch":"microbundle watch","build":"tsc --noEmit && microbundle build","test":"jest","lint":"eslint \"src/*.{ts,tsx}\""},"devDependencies":{"@commitlint/cli":"^15.0.0","@commitlint/config-conventional":"^15.0.0","@semantic-release/changelog":"^6.0.0","@semantic-release/git":"^10.0.0","@swc/core":"^1.2.102","@swc/jest":"^0.2.5","@testing-library/dom":"^8.10.1","@testing-library/jest-dom":"^5.14.1","@types/jest":"^27.0.2","@typescript-eslint/eslint-plugin":"^5.2.0","@typescript-eslint/parser":"^5.2.0","eslint":"^8.1.0","eslint-config-prettier":"^8.3.0","eslint-plugin-jest":"^25.2.2","eslint-plugin-jest-dom":"^3.9.2","husky":"^7.0.4","jest":"^27.3.1","lint-staged":"^11.2.3","microbundle":"^0.14.1","prettier":"^2.4.1","semantic-release":"^18.0.0","ts-node":"^10.3.0","typescript":"^4.4.4"},"browserslist":["defaults","maintained node versions"],"lint-staged":{"**/*.{js,jsx,ts,tsx,json,css,scss,md}":["prettier --write"],"**/*.{js,jsx,ts,tsx}":["eslint"]},"prettier":{"printWidth":120,"singleQuote":true,"trailingComma":"all"},"readme":"# Airwallex Login Widget\n\n## Installation\n\n```shell\nnpm install @airwallex/login-widget\n```\n\n## Get Started\n\nInitialize the widget:\n\n```js\nimport { LoginWidget } from '@airwallex/login-widget';\n\n// Must initialize before creating any login widgets.\n// These options will apply to all the login widgets.\nLoginWidget.init({\n  // The URL of the logo to display in the login widget.\n  // The recommended size of the image is 72x72 px.\n  logoUrl: 'https://your_website_logo_url',\n  // The environment of the widget.\n  env: 'production',\n  // 'en' or 'zh', these are the supported languages right now\n  locale: 'en',\n});\n```\n\nCreate a widget instance:\n\n```js\nimport { LoginWidget } from '@airwallex/login-widget';\n\nconst loginWidget = new LoginWidget({\n  // These are optional when instantiating the widget,\n  // but are required before authenticating.\n  // You could set them later using the widget's `update` method\n  authSummaryText: 'your_auth_summary_justification_text',\n  resourceId: 'the_unique_resource_id_to_be_authenticated',\n  // You could also customize the labels\n  labels: { emailLabel: 'User name' },\n});\n```\n\nListen to the cancel event, so that when the user clicks the exit button, you could unmount the widget\n\n```js\nloginWidget.on('cancel', () => {\n  loginWidget.unmount();\n});\n```\n\nAlso remember to listen to the auth success event\n\n```js\nloginWidget.on('auth_success', ({ signedToken }) => {\n  // Do something with the token\n});\n```\n\nYou will have to create a mask yourself, and mount the widget on top of it:\n\n```html\n<div class=\"mask\">\n  <div id=\"widget-container\"></div>\n</div>\n```\n\n```js\nloginWidget.mount('#widget-container');\n```\n\n## `LoginWidget`\n\n### `LoginWidget.init`\n\ntype: `(initOptions: WidgetInitOptions) => void;`\n\n```typescript\ninterface WidgetInitOptions {\n  /**\n   * The URL of the logo to display in the login widget.\n   * The recommended size of the image is 72x72 px.\n   */\n  logoUrl: string;\n  /**\n   * The environment of the login widget\n   * @default 'production'\n   */\n  env?: Environment;\n  /**\n   * The language of the login widget.\n   * @default 'en'\n   */\n  locale?: Language | undefined;\n}\n\ntype Language = 'en' | 'zh';\n\ntype Environment = 'staging' | 'demo' | 'production';\n```\n\n### `LoginWidget.constructor`\n\ntype: `constructor(options?: LoginWidgetOptions);`\n\n```typescript\ninterface LoginWidgetOptions {\n  authSummaryText: string;\n  resourceId: string;\n  labels?: LoginWidgetOptionsLabels | undefined;\n}\n\ninterface LoginWidgetOptionsLabels {\n  authButton?: string;\n  authCode?: string;\n  emailLabel?: string;\n  forgotPassword?: string;\n  loginButton?: string;\n  loginSubTitle?: string;\n  loginTitle?: string;\n  mfaTitle?: string;\n  passwordLabel?: string;\n  supportLink?: string;\n}\n```\n\n### `LoginWidget.prototype.on`\n\n#### `LoginWidget.prototype.on('ready', () => void)`\n\nEmitted when widget is ready to use.\n\n#### `LoginWidget.prototype.on('cancel', () => void)`\n\nEmitted when the user clicks the exit button.\n\n#### `LoginWidget.prototype.on('blur', (ev: LoginWidgetFieldEvent) => void)`\n\nEmitted when the user blurs the field.\n\n#### `LoginWidget.prototype.on('change', (ev: LoginWidgetFieldEvent) => void)`\n\nEmitted when the user changes the value of a field.\n\n#### `LoginWidget.prototype.on('focus', (ev: LoginWidgetFieldEvent) => void)`\n\nEmitted when the user focuses the field.\n\n```typescript\ninterface LoginWidgetFiledEvent {\n  /**\n   * Whether the input of the field is valid.\n   */\n  complete: boolean;\n  /**\n   * The name of the field.\n   */\n  field: FieldName;\n}\n\ntype FieldName = 'username' | 'password' | 'authcode';\n```\n\n#### `LoginWidget.prototype.on('login_success', () => void)`\n\nEmitted when the user login successfully.\n\n#### `LoginWidget.prototype.on('auth_success', (ev: LoginWidgetAuthSuccessEvent) => void)`\n\nEmitted when authentication is successful.\n\n```typescript\ninterface LoginWidgetAuthSuccessEvent {\n  signedToken: string;\n}\n```\n\n#### `LoginWidget.prototype.on('error', (ev: LoginWidgetErrorEvent) => void)`\n\nEmitted when error occurs.\n\n```typescript\ninterface LoginWidgetErrorEvent {\n  errorCode: string;\n  message: string;\n}\n\nconst ERROR_CODE_MAP = {\n  BAD_CREDENTIAL: 'User name or password is incorrect',\n  INVALID_AUTH_CODE: 'Invalid authorization code',\n  INVALID_RESOURCE_ID: 'Invalid resource ID',\n  TWO_FACTOR_AUTHENTICATION_NOT_ENABLED: 'Two-factor authentication is not enabled',\n  UNKNOWN_ERROR: 'Unknown error',\n  USER_AUTH_LOCKED: 'User has been locked due to multiple failed authentication attempts',\n  USER_LOGIN_LOCKED: 'User has been locked due to multiple failed login attempts',\n};\n```\n\n### `LoginWidget.prototype.removeEventListener`\n\nUnsubscribe the event.\n\ntype: `(eventType, listenerToBeRemoved) => void;`\n\n### `LoginWidget.prototype.mount`\n\nAppend the widget to the given DOM element.\n\nIf the DOM element could not be found, will throw an error.\n\ntype: `(domElement: string | HTMLElement) => void;`\n\n`domElement` is either a CSS Selector or a DOM element.\n\n### `LoginWidget.prototype.update`\n\nYou could also update the widget on the fly.\n\nEvery option used to initialize the widget could also be used to update the widget.\n\ntype: `(options: LoginWidgetUpdateOptions) => void;`\n\n```typescript\ninterface LoginWidgetUpdateOptions {\n  authSummaryText?: string | undefined;\n  resourceId?: string | undefined;\n  labels?: LoginWidgetOptionsLabels | undefined;\n}\n```\n\n### `LoginWidget.prototype.unmount`\n\nRemove the widget from the DOM.\n\nAll event listeners will NOT be removed, they must be removed manually.\n\ntype: `() => void;`\n\n## The Customizable Parts\n\n![Customizable Parts in Login Page](assets/customizable-parts-login.png)\n\n![Customizable Parts in Auth Page](assets/customizable-parts-auth.png)\n","readmeFilename":"README.md","gitHead":"14dc714865895714487ce5b93758afb505133a7f","bugs":{"url":"https://github.com/airwallex/airwallex-login-widget/issues"},"homepage":"https://github.com/airwallex/airwallex-login-widget#readme","_id":"@airwallex/login-widget@1.0.0-beta.3","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-POdorhWlth3ukKpfVD0TTZavoarppZsUlbP98YgWuIFM46a3BtgSQOHUF85/pGfiziZenaJrHgyPoaWQs7gMBA==","shasum":"701f296aff9437259c0b038253e5ab2425a96147","tarball":"https://registry.npmjs.org/@airwallex/login-widget/-/login-widget-1.0.0-beta.3.tgz","fileCount":71,"unpackedSize":181724,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhrcTsCRA9TVsSAnZWagAAuBsP/R0ohSYu+hbNXvgLYggP\ngXS52hjW52TIjEAFuv/CUzatAF8kT/IuFFETH9LB2FX2QGD5Px8gHnmSAP2e\nEGw8StzRoqFA8GWuHt2L0YHSY/2s9wwOcwHVP7n5jCSFjsCCSWH6POakFllu\ntymJoDpSTbszgBbfFk+H4Td0x8KY6DiaP6Nd1QkQB1Vjt36D8qTrE8t4ANU/\n+puFQcB+AtnIr9YoE/KUtVIxergkuSpEK3T3lg5PsBpJFx2BH7tU8sUd31tj\ngB2j8XLfJcOhIEvJTZK59Jl3ZfRN0jYsVqFBpYvaWM5upDE8J+CxZgJJgNjL\nbPXtgIL5j8WL1s7PCFKu2u4x6gh+jKFSUUKOBEyoNqLgmOB0NZRhQQtZtJiu\nApSCOymgkWYiF82/3HPX3713Q/tWHCmQqxk1TFEKvs9lL6FXokbBa/5GkU3r\nlI0bkd2su6YX42y//HvRp1/pdnKYXgzR814tvVqMEhBtZekkLBji3sJlL7Jn\nSb7RO564+zpG99Pwyyk9PX2Sto+Rd+bTE9OzgKPuphJ2scWW/ofUZr58i9ZP\nc+6RoUG25s3xvadOuy/C3nAyXd18RUaMy2UXa/n4xo0P62W30GR1QGJL9G5p\nqwHoeSp2ihFGNU9rM9i0s94CuFVGmrrgZZSgoxQ+WpOP8yYZj7IlTdDgVyDs\nkgxz\r\n=VgF/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDZU2wO61JAC3GjpbYelXnSarpD5WMlSj+93yhnt+yX6QIgIXXBuJF6BbYGHsm2w+clU8xhkg3cvUd+RB+XSMYk3so="}]},"_npmUser":{"name":"airwallex","email":"wallex.test@gmail.com"},"directories":{},"maintainers":[{"name":"airwallex","email":"wallex.test@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/login-widget_1.0.0-beta.3_1638778092818_0.9715209815949724"},"_hasShrinkwrap":false},"1.0.0":{"name":"@airwallex/login-widget","version":"1.0.0","description":"airwallex login widget","repository":{"type":"git","url":"git+https://github.com/airwallex/airwallex-login-widget.git"},"author":{"name":"Airwallex"},"license":"MIT","keywords":["Airwallex","Login","Widget","Two factor"],"publishConfig":{"access":"public"},"type":"module","source":"./src/index.ts","exports":{"require":"./dist/index.cjs","default":"./dist/index.modern.js"},"main":"./dist/index.cjs","module":"./dist/index.module.js","unpkg":"./dist/index.umd.js","types":"./dist/index.d.ts","scripts":{"prepare":"husky install","watch":"microbundle watch","build":"tsc --noEmit && microbundle build","test":"jest","lint":"eslint \"src/*.{ts,tsx}\""},"devDependencies":{"@commitlint/cli":"^15.0.0","@commitlint/config-conventional":"^15.0.0","@semantic-release/changelog":"^6.0.0","@semantic-release/git":"^10.0.0","@swc/core":"^1.2.102","@swc/jest":"^0.2.5","@testing-library/dom":"^8.10.1","@testing-library/jest-dom":"^5.14.1","@types/jest":"^27.0.2","@typescript-eslint/eslint-plugin":"^5.2.0","@typescript-eslint/parser":"^5.2.0","eslint":"^8.1.0","eslint-config-prettier":"^8.3.0","eslint-plugin-jest":"^25.2.2","eslint-plugin-jest-dom":"^3.9.2","husky":"^7.0.4","jest":"^27.3.1","lint-staged":"^11.2.3","microbundle":"^0.14.1","prettier":"^2.4.1","semantic-release":"^18.0.0","ts-node":"^10.3.0","typescript":"^4.4.4"},"browserslist":["defaults","maintained node versions"],"lint-staged":{"**/*.{js,jsx,ts,tsx,json,css,scss,md}":["prettier --write"],"**/*.{js,jsx,ts,tsx}":["eslint"]},"prettier":{"printWidth":120,"singleQuote":true,"trailingComma":"all"},"gitHead":"0302375bba753af6bd8927b5a942fa5f05600e3a","bugs":{"url":"https://github.com/airwallex/airwallex-login-widget/issues"},"homepage":"https://github.com/airwallex/airwallex-login-widget#readme","_id":"@airwallex/login-widget@1.0.0","_nodeVersion":"16.13.1","_npmVersion":"8.1.2","dist":{"integrity":"sha512-mn4ewU1MNLZMojQ1VEYLuep47VAO3PdmacZUPrRidOAAzBfXnrHle8KrpRMydscRHMy6mAMngchZ12uEkJb80Q==","shasum":"65c608606047abfc575c05c95bdd32f2cf695178","tarball":"https://registry.npmjs.org/@airwallex/login-widget/-/login-widget-1.0.0.tgz","fileCount":71,"unpackedSize":181956,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhy9qPCRA9TVsSAnZWagAAyNAP/01m2jpT22cKagffb8fh\nOImF+kWtJXJ3d3uCJdXjn41Dez8lH6PLAnm0dRW5j6mXCubzINjAw057g2BH\nEl5pK7QiPsEqkf+HfCfOVPzXGDMPtvE3z/YlgTAT56cqtFFaQEcvmA2ZWlPr\nl+fue2ynQmdFLUW/3Co6bwQtYYyoWQ5o7E6G/W6q4cmeaRWKRgH7V0qcmKUL\nLyTz/VYvsB0zEBLmp+21oJ6uuDUg+HH37z6BY7ty9HYwcluaOhDfdVPRTHv8\ng2v+bo6Q1ivBbzztjEtOhCAhG9IVUHTpBe0VroPqA7FrdjT4vWnv9sKiWcOA\nBgXOFE1eghD01QcdM4B7h5Td+ne7yGDnSbgnbYi2umTM1ajYppgvcoHjETnz\nDy5XM55xTPBt53qgdc6rOSNlgcHnZyagGV9iM0J2Pnc/nffCyPsur9QqMOOp\nS+6kVJhYNf+3VkuzrFI7LsIoXEv2HdR3EAUWXtDj1Q7ZWGrICPmnZVl1Hod+\nYfd05oFKVuAFsGpC6lUmR9+IFVd/U94kCFFpi/QxqrPZ2GOYQv9rvBW2XcLU\nLpByFBJpLpe/4yO26HXfKyTucP5WLllAcgZezI/CuoYhesloxYbZg3eoQppS\n2lZT7jU1w9QRau952KO3kAvO9t2TrYP9eb+OQ3KpFAAIfKz0KaL8+/HvU3WS\n5BwY\r\n=qrL7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCJfQaBDfR95Js0a547DbIQq96eAoZiNEcRJ5CTrWwUggIgIrFiXhzlkVLhRLJS5IJlrv2eNih9wRDMrzFkt0JeHXU="}]},"_npmUser":{"name":"airwallex","email":"wallex.test@gmail.com"},"directories":{},"maintainers":[{"name":"airwallex","email":"wallex.test@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/login-widget_1.0.0_1640749711206_0.2647617085551439"},"_hasShrinkwrap":false},"1.1.0":{"name":"@airwallex/login-widget","version":"1.1.0","description":"airwallex login widget","repository":{"type":"git","url":"git+https://github.com/airwallex/airwallex-login-widget.git"},"author":{"name":"Airwallex"},"license":"MIT","keywords":["Airwallex","Login","Widget","Two factor"],"publishConfig":{"access":"public"},"type":"module","source":"./src/index.ts","exports":{"require":"./dist/index.cjs","default":"./dist/index.modern.js"},"main":"./dist/index.cjs","module":"./dist/index.module.js","unpkg":"./dist/index.umd.js","types":"./dist/index.d.ts","scripts":{"prepare":"husky install","watch":"microbundle watch","build":"tsc --noEmit && microbundle build","test":"jest","lint":"eslint \"src/*.{ts,tsx}\""},"devDependencies":{"@commitlint/cli":"^15.0.0","@commitlint/config-conventional":"^15.0.0","@semantic-release/changelog":"^6.0.0","@semantic-release/git":"^10.0.0","@swc/core":"^1.2.102","@swc/jest":"^0.2.5","@testing-library/dom":"^8.10.1","@testing-library/jest-dom":"^5.14.1","@types/jest":"^27.0.2","@typescript-eslint/eslint-plugin":"^5.2.0","@typescript-eslint/parser":"^5.2.0","eslint":"^8.1.0","eslint-config-prettier":"^8.3.0","eslint-plugin-jest":"^25.2.2","eslint-plugin-jest-dom":"^3.9.2","husky":"^7.0.4","jest":"^27.3.1","lint-staged":"^11.2.3","microbundle":"^0.14.1","prettier":"^2.4.1","semantic-release":"^18.0.0","ts-node":"^10.3.0","typescript":"^4.4.4"},"browserslist":["defaults","maintained node versions"],"lint-staged":{"**/*.{js,jsx,ts,tsx,json,css,scss,md}":["prettier --write"],"**/*.{js,jsx,ts,tsx}":["eslint"]},"prettier":{"printWidth":120,"singleQuote":true,"trailingComma":"all"},"gitHead":"73d7d551b5f03105ccabc188eaf626f5f56d83d9","bugs":{"url":"https://github.com/airwallex/airwallex-login-widget/issues"},"homepage":"https://github.com/airwallex/airwallex-login-widget#readme","_id":"@airwallex/login-widget@1.1.0","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"integrity":"sha512-udZ1Jad7ATNtBB5JU1kRylZ4QGYBW5mbzscf5o3l39zOxsd9lwie+NsnNN0iIROmHiJqIwvTMe0BTigswN3pRg==","shasum":"e0e657ebac4dbb69238200fdf2d67cda25529b35","tarball":"https://registry.npmjs.org/@airwallex/login-widget/-/login-widget-1.1.0.tgz","fileCount":71,"unpackedSize":182354,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh8k42CRA9TVsSAnZWagAAApcQAIlkeANWj2xvG5MEuk+Y\n2B+Bb/vNlJuRzf0JKpxuPxa9qsNlyBrJsGxC81AGkp+R49nET+euZE+D911k\nGrpz3j37FI1Eb+zqygu3aC/D3+4/hRnh6ngmyexWVn7l2SCnYI2yqNmGtLqL\nfYA4dOdXr2utYbkCxAzKYyRh5KTZIT6UDi4w2liqeU+GsMQXfYlr1/Tx0WAA\nQ/qpd1F5/uQxVUp6DVVaV4uOB6rwDfxwm/JN2cVkulXGvYiC2mFPxErcbZqe\nxxuC11JFusCHhwdscFXEWE9SkJag4Ah0GuNg1tu8BRyhUWep58T0QtsmOfEQ\nI4cwBOSaawZNIEgOBnjPqRp7d48xR9HX42O33b0s5eRLwJGhLQAX/jlxF2h3\n4LLdpmnLogK2f5woXuvWYxYxPUmxhrAb8YGjF7Do4Scdf6qTCW1dFdwtKZUi\nrKeBXGITjuGAAWbIHBgNjnjS+R8Xr5f09nGOPCW4k4c3EeBTrYMWTpKYE/pe\nQ9AcsgJTxXgJdCSiNVgURfecTtmavV4zZt4eAp+bnve1xkgTKb5CQrryfuAS\nb4qzjtylR4zBMHMV8RbM7EvnfcdEeUnbXuehTAl3bjafLhFVFtJYrh5xB3Pi\nM47AEvP5k6fF3lnfzpZEmqw8FEEURcyLQkog/hf9sYjZ4XxT/ICi/CjKDNU3\nnlQF\r\n=tmJL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEyKaXqN77sepND9ywiVYMRZI/2fyIsOL4NZkwzxc7nFAiEA3rFpihfaIvae+Ar2apMDdagrkGrGq7V2QjlL54GUYnA="}]},"_npmUser":{"name":"airwallex","email":"wallex.test@gmail.com"},"directories":{},"maintainers":[{"name":"airwallex","email":"wallex.test@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/login-widget_1.1.0_1643269686437_0.6138089825637816"},"_hasShrinkwrap":false},"1.1.1":{"name":"@airwallex/login-widget","version":"1.1.1","description":"airwallex login widget","repository":{"type":"git","url":"git+https://github.com/airwallex/airwallex-login-widget.git"},"author":{"name":"Airwallex"},"license":"MIT","keywords":["Airwallex","Login","Widget","Two factor"],"publishConfig":{"access":"public"},"type":"module","source":"./src/index.ts","exports":{"require":"./dist/index.cjs","default":"./dist/index.modern.js"},"main":"./dist/index.cjs","module":"./dist/index.module.js","unpkg":"./dist/index.umd.js","types":"./dist/index.d.ts","scripts":{"prepare":"husky install","watch":"microbundle watch","build":"tsc --noEmit && microbundle build","test":"jest","lint":"eslint \"src/*.{ts,tsx}\""},"devDependencies":{"@commitlint/cli":"^15.0.0","@commitlint/config-conventional":"^15.0.0","@semantic-release/changelog":"^6.0.0","@semantic-release/git":"^10.0.0","@swc/core":"^1.2.102","@swc/jest":"^0.2.5","@testing-library/dom":"^8.10.1","@testing-library/jest-dom":"^5.14.1","@types/jest":"^27.0.2","@typescript-eslint/eslint-plugin":"^5.2.0","@typescript-eslint/parser":"^5.2.0","eslint":"^8.1.0","eslint-config-prettier":"^8.3.0","eslint-plugin-jest":"^25.2.2","eslint-plugin-jest-dom":"^3.9.2","husky":"^7.0.4","jest":"^27.3.1","lint-staged":"^11.2.3","microbundle":"^0.14.1","prettier":"^2.4.1","semantic-release":"^18.0.0","ts-node":"^10.3.0","typescript":"^4.4.4"},"browserslist":["defaults","maintained node versions"],"lint-staged":{"**/*.{js,jsx,ts,tsx,json,css,scss,md}":["prettier --write"],"**/*.{js,jsx,ts,tsx}":["eslint"]},"prettier":{"printWidth":120,"singleQuote":true,"trailingComma":"all"},"gitHead":"37831ef1b6fca7964349ce556204dace3cb51190","bugs":{"url":"https://github.com/airwallex/airwallex-login-widget/issues"},"homepage":"https://github.com/airwallex/airwallex-login-widget#readme","_id":"@airwallex/login-widget@1.1.1","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"integrity":"sha512-z9/ep4EDokqBtwCGidPFz4TD/fe3RuClIKLTmFE3/8SvEQnkVBhiD2VbdVBBOiisU5lWOepNCe31Lrz2mArr0g==","shasum":"8db34f5715119f52748fe7dd1b6a08f6c89e8180","tarball":"https://registry.npmjs.org/@airwallex/login-widget/-/login-widget-1.1.1.tgz","fileCount":71,"unpackedSize":182354,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiA3mPCRA9TVsSAnZWagAAk4oP/jpOtudEmPrMDreVw7JJ\n92+HZgkiD+avOAhc999NTb/biVcw0AvFewYeYmTos4/U4+QpULYkdOTNUpzc\nFKTIY1yGd3G3rcW7iykCkxP/AAvYLakDdqY7wwP+UNKajPzwQKyDbfEW+ypR\n8WWbzxgYl2fhJDX1D5ggC/H10N4Qf3uO3msN9I6g1mdxCvDBDOuOadvMFUaw\n7R5Num6NweVxEoRDIHNYnIituJUEtpsYbgJtZuJ7aWJmQ9eqFep9NjwF25ot\nNGCqyJ//HT87/gxLHadj+e7yybYUY+oIHI6y7F4k+jZ8M2XZVE2BW0oYhdA2\nc0ygnHDt64XuIpEIdswhh36nS/KbdhLEq+5S67C5Ad/UnMsxnDkVUqu/7jRL\nVPebKIWBXLDMkUT+BzziyLGMzRVd2m9PzkhLbDibE5ENOmorzErCOG0rQOfo\njuF22j20UOrWpsmRlsv3vTISr1joL3QFih6eo4LfJtAarIBsExddluEQ9Zx6\nsthKkJCoy8cCNt3hEWCRhnChreMXPPEdirzM8EJ/qAbdKDLpOaimyu89HGmC\n4ydL+aOwRkwyTKlb9Uk9T1GDnev5Kourlj2UH6Qzell3/h0TKMMCwhl4VK8Q\n3ixb0w+DNk2Ao4DvBZs6tU13WXx+AP5zANAw263AIUXapHk7r5LovcyTEo81\nUOAR\r\n=Oc+r\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQChcGViUFsjEvEgnpfmMhh6N607VIcodqbqCKemNJI47gIhALZUJsTWjbuI+8blvstkDP0txrdoyIpnuvOZTLXDXmCL"}]},"_npmUser":{"name":"airwallex","email":"wallex.test@gmail.com"},"directories":{},"maintainers":[{"name":"airwallex","email":"wallex.test@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/login-widget_1.1.1_1644394895653_0.3963920183197571"},"_hasShrinkwrap":false},"1.2.0":{"name":"@airwallex/login-widget","version":"1.2.0","description":"airwallex login widget","repository":{"type":"git","url":"git+https://github.com/airwallex/airwallex-login-widget.git"},"author":{"name":"Airwallex"},"license":"MIT","keywords":["Airwallex","Login","Widget","Two factor"],"publishConfig":{"access":"public"},"type":"module","source":"./src/index.ts","exports":{"require":"./dist/index.cjs","default":"./dist/index.modern.js"},"main":"./dist/index.cjs","module":"./dist/index.module.js","unpkg":"./dist/index.umd.js","types":"./dist/index.d.ts","scripts":{"prepare":"husky install","watch":"microbundle watch","build":"tsc --noEmit && microbundle build","test":"jest","lint":"eslint \"src/*.{ts,tsx}\""},"devDependencies":{"@commitlint/cli":"^15.0.0","@commitlint/config-conventional":"^15.0.0","@semantic-release/changelog":"^6.0.0","@semantic-release/git":"^10.0.0","@swc/core":"^1.2.102","@swc/jest":"^0.2.5","@testing-library/dom":"^8.10.1","@testing-library/jest-dom":"^5.14.1","@types/jest":"^27.0.2","@typescript-eslint/eslint-plugin":"^5.2.0","@typescript-eslint/parser":"^5.2.0","eslint":"^8.1.0","eslint-config-prettier":"^8.3.0","eslint-plugin-jest":"^25.2.2","eslint-plugin-jest-dom":"^3.9.2","husky":"^7.0.4","jest":"^27.3.1","lint-staged":"^11.2.3","microbundle":"^0.14.1","prettier":"^2.4.1","semantic-release":"^18.0.0","ts-node":"^10.3.0","typescript":"^4.4.4"},"browserslist":["defaults","maintained node versions"],"lint-staged":{"**/*.{js,jsx,ts,tsx,json,css,scss,md}":["prettier --write"],"**/*.{js,jsx,ts,tsx}":["eslint"]},"prettier":{"printWidth":120,"singleQuote":true,"trailingComma":"all"},"gitHead":"c4556861e854ecbbd291441def1ddde004157a61","bugs":{"url":"https://github.com/airwallex/airwallex-login-widget/issues"},"homepage":"https://github.com/airwallex/airwallex-login-widget#readme","_id":"@airwallex/login-widget@1.2.0","_nodeVersion":"16.14.0","_npmVersion":"8.3.1","dist":{"integrity":"sha512-XvwA6+fT11SuLyWGI/QDgmfi8ak+FYFbGDDTzSZQ8laJg1isdl4O0YG+wYiz8PfsQ3Gy1dKlELFTLPbx2idSnw==","shasum":"6cacbd8ec15197c8abcaece88f52e4c745848f8a","tarball":"https://registry.npmjs.org/@airwallex/login-widget/-/login-widget-1.2.0.tgz","fileCount":71,"unpackedSize":183880,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiDeWqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrhkg//WHjkUwhtng5MFoJLaMEPTclUnOB5BC+1a0hIOAdXw3eIwise\r\nUzv3D7hDjn58nvTdvjihFlvKhoG1SnEnFikMIzFazFXKJyYHQyQp0p2j402b\r\nYoJpbDfQUhF4DJOp9iurR9wC42sDmsdjL3SpmGf7o8K2r0DRuHs4ALKZzfuS\r\neOC2gPm6j1a/JvB4yilfovAzBdCVJa5mBQDRPY88jSBGafmvpHANgQqvE6lA\r\nEE8ptkVQ+/fFK8FFhZSn9CSIrIHPjnqb6OnjzJuR0JcDPmbxe6fmTfCKUOR3\r\n4eFffqmHSDHfcH7y2Rhukd1LiHI9waXN20jTg2QUfsBHmQYYbFq+EohhWXph\r\nax9iTpDy+q6FOKJ99PwznlF6VnvHPdAeX55/v8q7XUOe9BGyKSZIwd3MabRX\r\nkn/yWy2tFbTEV3bsNSCTbsPpqPE0KAg4Bt2VdoucBMzmZ5GXbJJflWdY4Uik\r\n7adZvcR8cr23lM7OwFVqMnFl9/8IVjnA0ZX3JgRzg/RlFvPnpESYiaAUHPjC\r\nvZLuD2TPzQEfHbhWTB+W/w5oLy1uBCbkih64LleqlCTKn4wcjga4vV40n81X\r\nQ9RRhlkUrwY9KQrDbjIFPutn7hg2CKLRKJXaJAItZ7B65oWNItx/NcoTsL8k\r\nujyoEo/UytOzXHJCHoVujU7ZB4JfG6qnjfo=\r\n=Hwh3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDSIYSYaCIn2ZyGMPUKnJ/RGyRQBnt6pd5u5gex81f4HwIhANrHuZJBj2W3/nkuimeYnO3JJyIyFeB5p1MgQBSnCbVL"}]},"_npmUser":{"name":"airwallex","email":"wallex.test@gmail.com"},"directories":{},"maintainers":[{"name":"airwallex","email":"wallex.test@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/login-widget_1.2.0_1645077929843_0.306302166663615"},"_hasShrinkwrap":false},"1.2.1":{"name":"@airwallex/login-widget","version":"1.2.1","description":"airwallex login widget","repository":{"type":"git","url":"git+https://github.com/airwallex/airwallex-login-widget.git"},"author":{"name":"Airwallex"},"license":"Apache-2.0","keywords":["Airwallex","Login","Widget","Two factor"],"publishConfig":{"access":"public"},"type":"module","source":"./src/index.ts","exports":{"require":"./dist/index.cjs","default":"./dist/index.modern.js"},"main":"./dist/index.cjs","module":"./dist/index.module.js","unpkg":"./dist/index.umd.js","types":"./dist/index.d.ts","scripts":{"prepare":"husky install","watch":"microbundle watch","build":"tsc --noEmit && microbundle build","test":"jest","lint":"eslint \"src/*.{ts,tsx}\""},"devDependencies":{"@commitlint/cli":"^15.0.0","@commitlint/config-conventional":"^15.0.0","@semantic-release/changelog":"^6.0.0","@semantic-release/git":"^10.0.0","@swc/core":"^1.2.102","@swc/jest":"^0.2.5","@testing-library/dom":"^8.10.1","@testing-library/jest-dom":"^5.14.1","@types/jest":"^27.0.2","@typescript-eslint/eslint-plugin":"^5.2.0","@typescript-eslint/parser":"^5.2.0","eslint":"^8.1.0","eslint-config-prettier":"^8.3.0","eslint-plugin-jest":"^25.2.2","eslint-plugin-jest-dom":"^3.9.2","husky":"^7.0.4","jest":"^27.3.1","lint-staged":"^11.2.3","microbundle":"^0.14.1","prettier":"^2.4.1","semantic-release":"^18.0.0","ts-node":"^10.3.0","typescript":"^4.4.4"},"browserslist":["defaults","maintained node versions"],"lint-staged":{"**/*.{js,jsx,ts,tsx,json,css,scss,md}":["prettier --write"],"**/*.{js,jsx,ts,tsx}":["eslint"]},"prettier":{"printWidth":120,"singleQuote":true,"trailingComma":"all"},"gitHead":"91cf8bf3575f3f3260aeec6e19d0d662f8b0a515","bugs":{"url":"https://github.com/airwallex/airwallex-login-widget/issues"},"homepage":"https://github.com/airwallex/airwallex-login-widget#readme","_id":"@airwallex/login-widget@1.2.1","_nodeVersion":"16.17.1","_npmVersion":"8.15.0","dist":{"integrity":"sha512-fMUxMuo8gYEb5x2EZXhgKIyULporqPeuo23Nm/W33wJqyS6tQD2i29ZftW4MihQOYIaaMysVtbFSfdQYWkDzRA==","shasum":"0ac160a92d2c5123b2bb9abd4769a844af1a0493","tarball":"https://registry.npmjs.org/@airwallex/login-widget/-/login-widget-1.2.1.tgz","fileCount":72,"unpackedSize":195221,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDo13h76EIhHAyJybboirrigu0sdfqU+rNMOk4ZZ121PAiEArD9KDInbssn7gnbjesFzlRNLeS9ZzXh7VJtFbKngpcI="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjVixNACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoD0w//W6zGa2qZ/C9Ockb0bkgTB9y1/q4dS+8zrFsK7QbRZYHyhjdO\r\nA77Ogize0ny/pvsPbH+aqhnroDqEWRPxQMtmT3jT4chze/00VNpiJINNC4oi\r\ngR+nAoI61M5x23gMoNhBYlV9m8Jo4rjhpASPA8hIE873F4EKmg2iM0lxebu+\r\nwxt7J1PnMywfL2xAM3YhlSAZA3/CEqmQNWuCNDnEvSEZnmG0OnYTG6pX1tbT\r\nzGvK/XsspA9CCR6Uf6+sOg1n4tBs5sKo2vKMwpALo6Au0ftaN+iUVnIi1DmU\r\nMVR9s5uGVxAdKSjzHiDiMXRiSKE9iWYAVsjmDPIot0iHQ1oH7UTQ+TrShWWp\r\nsNOZFjMgW72ctN7Z0Zg8aVw+dpBwOPCylmi62r2ADknDQ7vdnliifWb2EM6r\r\nz2B8xLxwW8B/QeuiqzaM4/Av7NxwwtCRuYkviGa5j30h9HbqaL2RJfj3TBPg\r\nAx56zkSMems+HIKlQFHKD8Df7t5dveMWK6f/WMvleg33b4uffnLc1E54vmi8\r\n484buE1CPqcxZduVxJIIriwhjQzSE/opMUxjjBsj+C2jVf4LUFUowl7tI0MS\r\nPUmN06RLtxi576N+xnkGm3ogJXnWhqFltf8H2GAbDJnKURP+OibBD+TbCx2M\r\nBIGgwEaNErUmFZgve+YHQMl3A45arL2EEBY=\r\n=7kvP\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"airwallex","email":"wallex.test@gmail.com"},"directories":{},"maintainers":[{"name":"airwallex","email":"wallex.test@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/login-widget_1.2.1_1666591821290_0.8753368919269011"},"_hasShrinkwrap":false}},"time":{"created":"2021-11-23T10:19:19.487Z","1.0.0-beta.1":"2021-11-23T10:19:19.707Z","modified":"2022-10-24T06:10:21.634Z","1.0.0-beta.2":"2021-11-30T02:29:50.693Z","1.0.0-beta.3":"2021-12-06T08:08:12.997Z","1.0.0":"2021-12-29T03:48:31.370Z","1.1.0":"2022-01-27T07:48:06.589Z","1.1.1":"2022-02-09T08:21:35.884Z","1.2.0":"2022-02-17T06:05:30.056Z","1.2.1":"2022-10-24T06:10:21.531Z"},"maintainers":[{"name":"airwallex","email":"wallex.test@gmail.com"}],"description":"airwallex login widget","homepage":"https://github.com/airwallex/airwallex-login-widget#readme","keywords":["Airwallex","Login","Widget","Two factor"],"repository":{"type":"git","url":"git+https://github.com/airwallex/airwallex-login-widget.git"},"author":{"name":"Airwallex"},"bugs":{"url":"https://github.com/airwallex/airwallex-login-widget/issues"},"license":"Apache-2.0","readme":"# Airwallex Login Widget\n\n## Installation\n\n```shell\nnpm install @airwallex/login-widget\n```\n\n## Get Started\n\nInitialize the widget:\n\n```js\nimport { LoginWidget } from '@airwallex/login-widget';\n\n// Must initialize before creating any login widgets.\n// These options will apply to all the login widgets.\nLoginWidget.init({\n  // The URL of the logo to display in the login widget.\n  // The recommended size of the image is 72x72 px.\n  logoUrl: 'https://your_website_logo_url',\n  // The environment of the widget.\n  env: 'production',\n  // 'en' or 'zh', these are the supported languages right now\n  locale: 'en',\n});\n```\n\nCreate a widget instance:\n\n```js\nimport { LoginWidget } from '@airwallex/login-widget';\n\nconst loginWidget = new LoginWidget({\n  // These are optional when instantiating the widget,\n  // but are required before authenticating.\n  // You could set them later using the widget's `update` method\n  authSummaryText: 'your_auth_summary_justification_text',\n  resourceId: 'the_unique_resource_id_to_be_authenticated',\n  // You could also customize the labels\n  labels: { emailLabel: 'User name' },\n  enableDisclaimer: true,\n});\n```\n\nListen to the cancel event, so that when the user clicks the exit button, you could unmount the widget\n\n```js\nloginWidget.on('cancel', () => {\n  loginWidget.unmount();\n});\n```\n\nAlso remember to listen to the auth success event\n\n```js\nloginWidget.on('auth_success', ({ signedToken }) => {\n  // Do something with the token\n});\n```\n\nYou will have to create a mask yourself, and mount the widget on top of it:\n\n```html\n<div class=\"mask\">\n  <div id=\"widget-container\"></div>\n</div>\n```\n\n```js\nloginWidget.mount('#widget-container');\n```\n\n## `Tips`\n\nFor better experience mobile responsive friendly, recommend set `<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no\" />` in html head.\n\n## `LoginWidget`\n\n### `LoginWidget.init`\n\ntype: `(initOptions?: WidgetInitOptions) => void;`\n\n```typescript\ninterface WidgetInitOptions {\n  /**\n   * The URL of the logo to display in the login widget.\n   * The recommended size of the image is 72x72 px.\n   */\n  logoUrl?: string | undefined;\n  /**\n   * The environment of the login widget\n   * @default 'production'\n   */\n  env?: Environment;\n  /**\n   * The language of the login widget.\n   * @default 'en'\n   */\n  locale?: Language | undefined;\n}\n\ntype Language = 'en' | 'zh';\n\ntype Environment = 'staging' | 'demo' | 'production';\n```\n\n### `LoginWidget.constructor`\n\ntype: `constructor(options?: LoginWidgetOptions);`\n\n```typescript\ninterface LoginWidgetOptions {\n  authSummaryText: string;\n  resourceId: string;\n  labels?: LoginWidgetOptionsLabels | undefined;\n}\n\ninterface LoginWidgetOptionsLabels {\n  authButton?: string;\n  authCode?: string;\n  emailLabel?: string;\n  forgotPassword?: string;\n  loginButton?: string;\n  loginSubTitle?: string;\n  loginTitle?: string;\n  mfaTitle?: string;\n  passwordLabel?: string;\n  supportLink?: string;\n}\n```\n\n### `LoginWidget.prototype.on`\n\n#### `LoginWidget.prototype.on('ready', () => void)`\n\nEmitted when widget is ready to use.\n\n#### `LoginWidget.prototype.on('cancel', () => void)`\n\nEmitted when the user clicks the exit button.\n\n#### `LoginWidget.prototype.on('blur', (ev: LoginWidgetFieldEvent) => void)`\n\nEmitted when the user blurs the field.\n\n#### `LoginWidget.prototype.on('change', (ev: LoginWidgetFieldEvent) => void)`\n\nEmitted when the user changes the value of a field.\n\n#### `LoginWidget.prototype.on('focus', (ev: LoginWidgetFieldEvent) => void)`\n\nEmitted when the user focuses the field.\n\n```typescript\ninterface LoginWidgetFiledEvent {\n  /**\n   * Whether the input of the field is valid.\n   */\n  complete: boolean;\n  /**\n   * The name of the field.\n   */\n  field: FieldName;\n}\n\ntype FieldName = 'username' | 'password' | 'authcode';\n```\n\n#### `LoginWidget.prototype.on('login_success', () => void)`\n\nEmitted when the user login successfully.\n\n#### `LoginWidget.prototype.on('auth_success', (ev: LoginWidgetAuthSuccessEvent) => void)`\n\nEmitted when authentication is successful.\n\n```typescript\ninterface LoginWidgetAuthSuccessEvent {\n  signedToken: string;\n}\n```\n\n#### `LoginWidget.prototype.on('error', (ev: LoginWidgetErrorEvent) => void)`\n\nEmitted when error occurs.\n\n```typescript\ninterface LoginWidgetErrorEvent {\n  errorCode: string;\n  message: string;\n}\n\nconst ERROR_CODE_MAP = {\n  BAD_CREDENTIAL: 'User name or password is incorrect',\n  INVALID_AUTH_CODE: 'Invalid authorization code',\n  INVALID_RESOURCE_ID: 'Invalid resource ID',\n  TWO_FACTOR_AUTHENTICATION_NOT_ENABLED: 'Two-factor authentication is not enabled',\n  UNKNOWN_ERROR: 'Unknown error',\n  USER_AUTH_LOCKED: 'User has been locked due to multiple failed authentication attempts',\n  USER_LOGIN_LOCKED: 'User has been locked due to multiple failed login attempts',\n};\n```\n\n### `LoginWidget.prototype.removeEventListener`\n\nUnsubscribe the event.\n\ntype: `(eventType, listenerToBeRemoved) => void;`\n\n### `LoginWidget.prototype.mount`\n\nAppend the widget to the given DOM element.\n\nIf the DOM element could not be found, will throw an error.\n\ntype: `(domElement: string | HTMLElement) => void;`\n\n`domElement` is either a CSS Selector or a DOM element.\n\n### `LoginWidget.prototype.update`\n\nYou could also update the widget on the fly.\n\nEvery option used to initialize the widget could also be used to update the widget.\n\ntype: `(options: LoginWidgetUpdateOptions) => void;`\n\n```typescript\ninterface LoginWidgetUpdateOptions {\n  authSummaryText?: string | undefined;\n  resourceId?: string | undefined;\n  labels?: LoginWidgetOptionsLabels | undefined;\n  enableDisclaimer?: boolean | undefined;\n}\n```\n\n### `LoginWidget.prototype.unmount`\n\nRemove the widget from the DOM.\n\nAll event listeners will NOT be removed, they must be removed manually.\n\ntype: `() => void;`\n\n## The Customizable Parts\n\n![Customizable Parts in Login Page](assets/customizable-parts-login.png)\n\n![Customizable Parts in Auth Page](assets/customizable-parts-auth.png)\n","readmeFilename":"README.md"}