{"_id":"@autobooks/session-extension","_rev":"10-2051d365d57207b81171a823671fbf11","name":"@autobooks/session-extension","dist-tags":{"alpha":"0.0.0-alpha-20220609202942","latest":"1.0.2"},"versions":{"0.1.0-alpha.0":{"name":"@autobooks/session-extension","version":"0.1.0-alpha.0","author":{"name":"Autobooks","email":"accountmanagementsupport@autobooks.co"},"license":"UNLICENSED","_id":"@autobooks/session-extension@0.1.0-alpha.0","maintainers":[{"name":"autobooksrob","email":"rmeyer@autobooks.co"}],"dist":{"shasum":"6ba02fd75a0251f0f512b60c29cf1ec6bc3e11a6","tarball":"https://registry.npmjs.org/@autobooks/session-extension/-/session-extension-0.1.0-alpha.0.tgz","fileCount":6,"integrity":"sha512-5cWtIlRoTyvCKFRJTGBiQcHIgJjXrnmZTIXV5rkzB27Cxo1rfWE4Cwfjg4f9foZ04578oVaegnL81BgVrOq2Tg==","signatures":[{"sig":"MEQCIBkxzI4i6zrA8q5IMuTd9/ViwKrm488GgW5MPLHSzeb8AiBCfWftXmZDnN8zmeWSThgC/jj6vwHzSYSQbto3KyWdiA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":8448,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgdE4hCRA9TVsSAnZWagAAKkUQAJCVRqjP6RoLeXxzAO4e\nXqkkwwp7rB/4m47uHK7gdHiWL/tAC530cg4LTbdDaMyIohiQkqee3Dhi1tZa\n4byekHpTeCzZBROLTMcTk6Ir9ZxrGpb7947btibKu4kNMHTHjEvW5K0cNWSa\nuTVmbsMLrqZhvrrgansdRJ/b4ZBqMkOsiwWbwep22JJcQp7PDDIoernBZcob\nty+PDjfGXkQVarhjtApveIdgW4oOiDTYeVcEfI6hBQDTGJT+JCc4hsUPSBUr\nCRtzJb2KHXcKSlVIQeIsHRj6QpAPlvSLb9nXoDj7iJWNclRmBhTIf6Sz90/u\npMVznzP+k+mUa29uG1KEG3gjdqpiYhOqoAUeYW1di2IW+QtwhJULKOYRsusw\nxJfDJauCgbK6CYLtIK12d2Fp3ikGMUFYTNJYOk8Ic5i+4pISiKlPyY/JFdWV\nOjuUo3nohKdpHpriIV6Gb3/Eg8Qu0M5LIVh4VlJltvif1/kwrBGn/war0Suh\n1f6X81W3gzUIBsX0DnEAvEBtSoSYYnpShGHu18LdCeGzJ3G6z5kok3ku1LXh\nxH/eeQzw+joP005OhyDS5zKuC/5s0gzrFPA3dHc+ZnwCoiSewExgBjVAU+fo\njA5CcJJr7jyx1afukmjCXfiSBPBQJkOmvsw/tuts9nZs/oSKizJKyAjoett6\n3313\r\n=m0dI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"dev":"tsc -p tsconfig.internal.json --watch","build":"tsc -p tsconfig.internal.json","prepare":"cross-env NODE_ENV=production yarn run build:client","build:client":"node scripts/build-client.js"},"_npmUser":{"name":"autobooksrob","email":"rmeyer@autobooks.co"},"_npmVersion":"6.14.8","description":"A package to handle session extension from inside the Autobooks Webapp to parent contexts","directories":{},"_nodeVersion":"12.21.0","_hasShrinkwrap":false,"devDependencies":{"esbuild":"^0.11.2","cross-env":"^7.0.3","typescript":"^4.2.2"},"_npmOperationalInternal":{"tmp":"tmp/session-extension_0.1.0-alpha.0_1618234912734_0.5647353023347155","host":"s3://npm-registry-packages"}},"0.1.0-alpha.1":{"name":"@autobooks/session-extension","version":"0.1.0-alpha.1","author":{"name":"Autobooks","email":"accountmanagementsupport@autobooks.co"},"license":"UNLICENSED","_id":"@autobooks/session-extension@0.1.0-alpha.1","maintainers":[{"name":"autobooksrob","email":"rmeyer@autobooks.co"}],"dist":{"shasum":"bb57c52e0c421cbae67b114608a3bf2050773f8f","tarball":"https://registry.npmjs.org/@autobooks/session-extension/-/session-extension-0.1.0-alpha.1.tgz","fileCount":6,"integrity":"sha512-GVNgOSmvt29IfZJ5lYr6RNX+23Fb4kc+ujm8bxm8njdbQ7YYPzjzVKvrvYyhR1TtDF5Dy6R/5zy9av5xf+K87A==","signatures":[{"sig":"MEUCIHLUZj/kTcxBDF5+AsNwvUxUrrlEoh4N38VRamimslmTAiEA/NOBtYqhleluF7kAVHTNGfyDn9zBHGxok7UviCB96pY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":8609,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgdE/HCRA9TVsSAnZWagAA+3kP/0w/YBS2cskQ/+CUy1tI\ng9VE0H3TyERhtwe572F9z/zZU2vl5oodFY7yvusj7Amf2tNbAvctGbHaxP/8\npX5lIdpM7YQEWdxm0SoH5gXWu6ALaL+jMICjwsqqOpxxrY270iRb1S8YgJw8\nPx0LFITAU6AV/qCHYTLnPuhTvApFV0VylijQpQ1Ocw+3bHbne0GNY/571gTI\nozIwgaPUrKupiJe4hM46MDcnbdMMEn1OoDDgFcdo/6wRDp/DLem0NOUESr6S\nTOcjQopf56bRuGIDApg1/Y0Yom3bL7Yu1dmkmh0jNdH+iMwmXkaSb3HDLlk9\nzB4tDLjYV8JztSLe5zt4gXxxkh9PMUu58NgJnAbvmcNpUSj/PIMxAZ8HcBmH\nIcZ9fO9OgfSto0SiU24hqdfSnuhryyEedxLrLlZK0FW35Iw9KvpbPgoYs5bW\nhHE15xEzrDWDx3v4gz7TPG120/npO1oF56/Ku02I0RTNB7AYIv5YalOiR1B9\nYf1M2Ll/4MZ6iUhwrb79i7YSbJrTdu5lN6g1oyAWm2ZkVhwP1XNJnRz4jruF\n0t59qP4sIksL0WcXD89wftGx58Iy5yMS3FLaXMm1CD+X2T0/oe/YMqgaa3kr\nXnPrkjDq3iQmBVLA3MieY9hxXAoN2CMvWYK3SpXuRL3aTbKC5llleoDody73\n9fPK\r\n=Ky8x\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"dev":"tsc -p tsconfig.internal.json --watch","build":"tsc -p tsconfig.internal.json","prepare":"cross-env NODE_ENV=production yarn run build:client","build:client":"node scripts/build-client.js"},"_npmUser":{"name":"autobooksrob","email":"rmeyer@autobooks.co"},"_npmVersion":"6.14.8","description":"A package to handle session extension from inside the Autobooks Webapp to parent contexts","directories":{},"_nodeVersion":"12.21.0","_hasShrinkwrap":false,"devDependencies":{"esbuild":"^0.11.2","cross-env":"^7.0.3","typescript":"^4.2.2"},"_npmOperationalInternal":{"tmp":"tmp/session-extension_0.1.0-alpha.1_1618235334885_0.4801284153992351","host":"s3://npm-registry-packages"}},"0.0.0-alpha-20220609202942":{"name":"@autobooks/session-extension","version":"0.0.0-alpha-20220609202942","author":{"name":"Autobooks","email":"accountmanagementsupport@autobooks.co"},"license":"UNLICENSED","_id":"@autobooks/session-extension@0.0.0-alpha-20220609202942","maintainers":[{"name":"autobooksrob","email":"rmeyer@autobooks.co"},{"name":"autobooks-admin","email":"dev@autobooks.co"},{"name":"lukas-deco","email":"lukas@autobooks.co"}],"dist":{"shasum":"937c1ac706c03c812e80091015d85bf70d8b3f69","tarball":"https://registry.npmjs.org/@autobooks/session-extension/-/session-extension-0.0.0-alpha-20220609202942.tgz","fileCount":6,"integrity":"sha512-N/cPNQ9Yt8LWYjZDe0J7Twv0h+DMNmPiqka2FiY/s0aUWZu4v3ljyVUpDDe+x8CyZFEU7voxabBm545wPebMJg==","signatures":[{"sig":"MEUCIAMe6B+TzN9o+QuK2+C90UVlCekRsiFqbFXStT4NMPV2AiEA2/zAsawmpbW46QRkfV8wwN7euFolDNfpIwlfqF/naYM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9694,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJioloeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmognQ/7B91lsjCNSZ7WZL++9QMYqKS2voINm0Gq20eROaK7XA6hrU4c\r\nLalfuTYbS1UPtbZfwr0r47XiIwqswLDJehODNtG/wFMpyfbwDpDV3TVKRNj+\r\n8vt/igAZ6j5JnbDhzWanNGYBaqqMa/FITqQFq4sPf0XIOOOIZ2+iusVE2M4t\r\nBcgJJ11vCvmLd0HAPxCObA+vvORDCsNV6Mwzg76no10B3T2NSdrZXC0bbyZ9\r\n37aMGG2L+u1DLO8rYmtO8tPoMAuJhbSThMe8ixKjIWODCV2Ccfs6GXB/pdXn\r\nzfEHV3CR1kHXhCXDItF1kBF28ZSDtxCmvlE/aNTlTK98bv0UromlO117GRBo\r\n2/zfOqx8ALDyPWdpR8dqgnHDZWK58+AMHXnEL77M9GRXI2gB1BwBh0rbTOSb\r\nd8A+StFzEn2eLukHx2uIi3GbQtHkD+VwEtAymQ2wbT0yC4Y2t6dTlPLwZ/D0\r\nUnAmvnrHoOfJUTInfyfFVLK5snGF8C0+2CzExWXPbtmRGoqdWANZ+twwSu6p\r\nNle4cfykQqfMk+8Xafmz781iGa9AVzbXVAGYekecPWJMsUbPW5/GlO3hWJe2\r\nA4P78ysg/1rhibU1fTz3fe35CZmVry2iUlxgLzomPdD+gIVijZBokz+JKICM\r\nWQUlRwdYdEmFkWungYQwoRHPBdflYFbfDec=\r\n=n0xp\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/index.js","types":"./dist/index.d.ts","readme":"# @autobooks/session-extension\n\nThis package provides support for session extension in a parent context from activity detected from the Autobooks web application.\n\n## Installation\n\n```console\nyarn add @autobooks/session-extension\n```\n\n## Requirements\n\nRuntime requirements are:\n\n- Support for ES6\n- Support for `Promise.prototype.race`\n\nAt compile time, you need a bundler that supports `commonjs` module format.\n\n## Support\n\nFor support requests, email [accountmanagementsupport@autobooks.co]\n\n## Documentation\n\nExample usage:\n\n```javascript\nimport { connect } from \"@autobooks/session-extension\";\n\nconst iframeElement = document.getElementById(\"app-iframe\");\n\niframeElement.addEventListener(\"load\", () => {\n  try {\n    const { startKeepAlive, disconnect } = await connect({\n      iframeElement,\n      targetOrigin: \"https://app.autobooks.co\",\n      connectTimeout: 5000, // optional\n    });\n\n    const stopKeepAlive = startKeepAlive(60000, () => {\n      fetch(\"/my-keep-alive-endpoint\", { method: \"POST\", credentials: \"include\" });\n    });\n\n    setTimeout(() => {\n      disconnect(); // internally calls stopKeepAlive\n      stopKeepAlive();\n    }, 10000);\n  } catch {\n    // error handling\n  }\n});\n```\n\nThe package exports a single function, called `connect`. `connect` takes a single argument, an object of this shape:\n\n```typescript\ntype Options = {\n  iframeElement: HTMLIFrameElement;\n  targetOrigin: Origin;\n  connectTimeout?: number;\n};\n```\n\nIt is important that `connect` be called **after** the `iframeElement` has loaded, otherwise it may fail to initialize.\n\n`connect` returns a `Promise<Connection>`:\n\n```typescript\ntype Connection = {\n  startKeepAlive: (pollIntervalMS: number, onKeepAlive: () => void) => () => void;\n  disconnect: () => void;\n};\n```\n\nYou can then use this `Connection` to ask the Autobooks client to inform you when a user has been active in the last _n_ milliseconds using the `startKeepAlive` function. Every _n_ milliseconds, the Autobooks client will trigger the `onKeepAlive` callback _if and only if the client detected user activity in that time period_.\n","gitHead":"a5d6c815a1b5d382a0957f616d227baa8fdb4b2f","scripts":{"dev":"tsc -p tsconfig.json --watch","build":"node scripts/build-client.js","prepare":"cross-env NODE_ENV=production yarn run build"},"_npmUser":{"name":"autobooksrob","email":"rmeyer@autobooks.co"},"_npmVersion":"8.3.1","description":"A package to handle session extension from inside the Autobooks Webapp to parent contexts","directories":{},"lint-staged":{"*.{ts,tsx}":["prettier --parser typescript --write --config ../../.prettierrc.yaml --ignore-path ../../.prettierignore"],"*.{js,json,css,md}":["prettier --write --config ../../.prettierrc.yaml --ignore-path ../../.prettierignore"]},"_nodeVersion":"16.14.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"esbuild":"^0.12.15","cross-env":"^7.0.3","typescript":"^4.2.2","@autobooks/session-extension-messages":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/session-extension_0.0.0-alpha-20220609202942_1654807069943_0.4705484319547135","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@autobooks/session-extension","version":"1.0.1","author":{"name":"Autobooks","email":"accountmanagementsupport@autobooks.co"},"license":"UNLICENSED","_id":"@autobooks/session-extension@1.0.1","maintainers":[{"name":"autobooksrob","email":"rmeyer@autobooks.co"},{"name":"autobooks-admin","email":"dev@autobooks.co"}],"dist":{"shasum":"c328fa1c2ebce36f89705ed40adf7228da9dfe2f","tarball":"https://registry.npmjs.org/@autobooks/session-extension/-/session-extension-1.0.1.tgz","fileCount":8,"integrity":"sha512-04o0jFud6R8YW/le90n1U/ah5P5rUx4PiGe07U6uJl6YfUnqWXiW0Mc8/LS+YQzmN+is0KvMRMpMoi0d4M3bZA==","signatures":[{"sig":"MEQCIFqtJzhT3n9qMlPDZWW7HQK89A+hEVcH2Inutb/vTJg5AiBgJvoBJ7Ap+aOnGsYe2sVNp20xajBb62qAS2sUCrCK4w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16509,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjGQG3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrVLA//QWZdrpJPGilNAiCxsan0+fJTkj+8pXX/FODP4vyuBohASgQj\r\nyjwIyv+uh4qzvJ8RI8wL4/JsdSCJsAjcAZh9qNy76KkxUVbBNsexAusvu3hB\r\nrTXHLQhLPa+8p/LEK3wJ30X70ctH6YBhUgdkWWEvu3Mf88gYD3DLugYzcXr7\r\nHTHG/QhuTuVrQKNZcaFuSuert5ZWXwLs7o3B9yoWIs54QJ2zAXTVcnksKNjw\r\nBndW07poox7LKC8TS3QYTyB6sz1nGvG7i20brjVa2V8O7HKTs9BdIE5rrMnt\r\nnxttOxhQq3/0eZT9ZunQl/0KbOG1YoO9bzYElw72pSi7yLQgYacvQ6JNG2hF\r\nljCtm7NnqVkDZy2U70Glr3J6+2pdUfUvsrOp01xRc73uEo2p84QaAqXJI8Tb\r\nVzcaeK3r3EGT3fOblyHJVdbvChYoyBqfTrTGME3uTCMldEb+SqRyQgkV30C7\r\nkmvwt3gjF2HTQBaJK1qKlYSuXXGgLOiPgIXvkMKydthtcj/pyajbAcYuqVOx\r\nehB7rGKhgaXieT1yeS6CSg7MrRuBkb8Gg+XZMBTHXDAeuMe5IYS1tvN8saRU\r\nQ7FggO3d5T/gaBLvnSyPp4xqBpRn76AEhPCIjLf6wXl0/eerHABCov7oE8lb\r\n3rR4Wvk9/41gQgZKMQy4/cRW/aHZus5DXcc=\r\n=4e0v\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"node":"./dist/index.js","import":"./dist/index.mjs","default":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"394016811ce3fa8c92b8015e2167e3917b6437af","scripts":{"dev":"tsc -p tsconfig.json --watch","build":"node scripts/build-client.cjs","prepare":"cross-env NODE_ENV=production yarn run build","typecheck":"tsc -p tsconfig.json --noEmit --emitDeclarationOnly false"},"_npmUser":{"name":"autobooksrob","email":"rmeyer@autobooks.co"},"_npmVersion":"8.11.0","description":"A package to handle session extension from inside the Autobooks Webapp to parent contexts","directories":{},"lint-staged":{"*.{ts,tsx}":["prettier --parser typescript --write --config ../../.prettierrc.yaml --ignore-path ../../.prettierignore"],"*.{js,json,css,md}":["prettier --write --config ../../.prettierrc.yaml --ignore-path ../../.prettierignore"]},"_nodeVersion":"16.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"esbuild":"^0.14.47","cross-env":"^7.0.3","typescript":"^4.2.2","@autobooks/session-extension-messages":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/session-extension_1.0.1_1662583223504_0.32201085531279694","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@autobooks/session-extension","version":"1.0.2","author":{"name":"Autobooks","email":"accountmanagementsupport@autobooks.co"},"license":"UNLICENSED","_id":"@autobooks/session-extension@1.0.2","maintainers":[{"name":"autobooksrob","email":"rmeyer@autobooks.co"},{"name":"autobooks-admin","email":"dev@autobooks.co"}],"dist":{"shasum":"7a93d05afd1abc3432e2b19920d6693d05a59f64","tarball":"https://registry.npmjs.org/@autobooks/session-extension/-/session-extension-1.0.2.tgz","fileCount":8,"integrity":"sha512-usbYb+Lip4Z45IMo7Mm/5DwPKU4YlAeM3L4L1gfko2SvfTVqTetTkswTz9JhOYJ3JxALV0LLEBNEP/gLmGGizQ==","signatures":[{"sig":"MEUCIQDCwxxTG8/Q5tZ0srN5kYaILGKnoo2fo8uXIyuMDLnZygIgPYDJlhJR+DzSR2Iqad9dVkc4VnzgAW89InVOAbbR14w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16754,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkD0jLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqxyw/8Cn7VrVdI/NKzL561SkqgGVzDjQvVSK27jecGSKD/SDw5rHgf\r\nFNBtWLki6HpFnGTC9B4hNwFp+gXwmRClqYN6Hjnm03ruW5sxfMFBc3gHs1w9\r\nw4UxeohvnhtzL0PsVvGEN9xdP/GSIkFeDozM6QO/3XRf6ge9fjvE8LVkwA41\r\nRyVsrpWwB0CD6LPcA6h41ZbkpS7sZ37wYnFoqpt+m8Mw9Fc4Mbox5UvCQB6Z\r\n1xAumM0aO47zJmWNomDxNt2aJrVC6Jc4AEusAZf+zO4lGT1r1apgBPBQuek7\r\nk30HmGaVb0z4aINljM64glY9GwlifSCWKc/2lWP/jfli7swkaKyc6HhPJkng\r\nQDh9aPR0pmjJtDLiK+3fUeR70sy9DA+6MdIsGRCees2DGXhF1sIkps8bh/We\r\nU11FH6IAXgVE3YPvuKqa60xiZvRWtXjvWfxpXGlD5yExd37YkuWQy/eMG51K\r\nyouhcoTIm5DZ6g0+3geufs+1cnivYAWw1EoyGN316jZVrtCUe7N31EsSnjKL\r\nRcLR70X/WRQLCYzeH/Xo+cJr2lcStR8T6E0uOCbMsJ3u6p35bFz6py5KNOnq\r\nyh/0177YzXbyowGVzY2esD8lr4VUhCaBcxw8bFiU6OHllXeVGI99HyEQAV3t\r\nQAZ337Hqo6fwjELxi8dJ+otF8gVpjAGBN00=\r\n=B7wE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"node":"./dist/index.js","import":"./dist/index.mjs","default":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"8acd6a471a1c4210603a370e6d5015c7434eb491","scripts":{"dev":"tsc -p tsconfig.json --watch","build":"node scripts/build-client.cjs","prepare":"cross-env NODE_ENV=production yarn run build","typecheck":"tsc -p tsconfig.json --noEmit --emitDeclarationOnly false"},"_npmUser":{"name":"autobooksrob","email":"rmeyer@autobooks.co"},"_npmVersion":"8.19.3","description":"A package to handle session extension from inside the Autobooks Webapp to parent contexts","directories":{},"lint-staged":{"*.{ts,tsx}":["prettier --parser typescript --write --config ../../.prettierrc.cjs --ignore-path ../../.prettierignore"],"*.{js,json,css,md}":["prettier --write --config ../../.prettierrc.cjs --ignore-path ../../.prettierignore"]},"_nodeVersion":"16.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"esbuild":"~0.16.0","prettier":"^2.8.4","cross-env":"^7.0.3","typescript":"^4.2.2","@types/prettier":"^2","@ianvs/prettier-plugin-sort-imports":"3.7.1","@autobooks/session-extension-messages":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/session-extension_1.0.2_1678723274845_0.2784852555789783","host":"s3://npm-registry-packages"}}},"time":{"created":"2021-04-12T13:41:52.485Z","modified":"2025-08-08T20:09:11.672Z","0.1.0-alpha.0":"2021-04-12T13:41:52.850Z","0.1.0-alpha.1":"2021-04-12T13:48:55.039Z","0.0.0-alpha-20220609202942":"2022-06-09T20:37:50.228Z","1.0.1":"2022-09-07T20:40:23.713Z","1.0.2":"2023-03-13T16:01:15.017Z"},"author":{"name":"Autobooks","email":"accountmanagementsupport@autobooks.co"},"license":"UNLICENSED","description":"A package to handle session extension from inside the Autobooks Webapp to parent contexts","maintainers":[{"email":"rmeyer@autobooks.co","name":"autobooksrob"},{"email":"dev@autobooks.co","name":"autobooks-admin"},{"email":"kurt@autobooks.co","name":"kplantus"}],"readme":"# @autobooks/session-extension\n\nThis package provides support for session extension in a parent context from activity detected from the Autobooks web application.\n\n## Installation\n\n```console\nyarn add @autobooks/session-extension\n```\n\n## Requirements\n\nRuntime requirements are:\n\n- Support for ES6\n- Support for `Promise.prototype.race`\n\nAt compile time, you need a bundler that supports `commonjs` module format.\n\n## Support\n\nFor support requests, email [accountmanagementsupport@autobooks.co]\n\n## Documentation\n\nExample usage:\n\n```javascript\nimport { connect } from \"@autobooks/session-extension\";\n\nconst iframeElement = document.getElementById(\"app-iframe\");\n\niframeElement.addEventListener(\"load\", () => {\n  try {\n    const { startKeepAlive, disconnect } = await connect({\n      iframeElement,\n      targetOrigin: \"https://app.autobooks.co\",\n      connectTimeout: 5000, // optional\n    });\n\n    const stopKeepAlive = startKeepAlive(60000, () => {\n      fetch(\"/my-keep-alive-endpoint\", { method: \"POST\", credentials: \"include\" });\n    });\n\n    setTimeout(() => {\n      disconnect(); // internally calls stopKeepAlive\n      stopKeepAlive();\n    }, 10000);\n  } catch {\n    // error handling\n  }\n});\n```\n\nThe package exports a single function, called `connect`. `connect` takes a single argument, an object of this shape:\n\n```typescript\ntype Options = {\n  iframeElement: HTMLIFrameElement;\n  targetOrigin: Origin;\n  connectTimeout?: number;\n};\n```\n\nIt is important that `connect` be called **after** the `iframeElement` has loaded, otherwise it may fail to initialize.\n\n`connect` returns a `Promise<Connection>`:\n\n```typescript\ntype Connection = {\n  startKeepAlive: (pollIntervalMS: number, onKeepAlive: () => void) => () => void;\n  disconnect: () => void;\n};\n```\n\nYou can then use this `Connection` to ask the Autobooks client to inform you when a user has been active in the last _n_ milliseconds using the `startKeepAlive` function. Every _n_ milliseconds, the Autobooks client will trigger the `onKeepAlive` callback _if and only if the client detected user activity in that time period_.\n","readmeFilename":"README.md"}