@strivacity/sdk-core 2.3.0 → 3.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +6 -2
  3. package/dist/flows/BaseFlow.cjs.map +1 -1
  4. package/dist/flows/BaseFlow.d.ts +1 -1
  5. package/dist/flows/BaseFlow.mjs.map +1 -1
  6. package/dist/flows/EmbeddedFlow.cjs +2 -0
  7. package/dist/flows/EmbeddedFlow.cjs.map +1 -0
  8. package/dist/flows/EmbeddedFlow.d.ts +25 -0
  9. package/dist/flows/EmbeddedFlow.mjs +2 -0
  10. package/dist/flows/EmbeddedFlow.mjs.map +1 -0
  11. package/dist/flows/NativeFlow.cjs +1 -1
  12. package/dist/flows/NativeFlow.cjs.map +1 -1
  13. package/dist/flows/NativeFlow.d.ts +1 -1
  14. package/dist/flows/NativeFlow.mjs +1 -1
  15. package/dist/flows/NativeFlow.mjs.map +1 -1
  16. package/dist/flows/PopupFlow.cjs +1 -1
  17. package/dist/flows/PopupFlow.cjs.map +1 -1
  18. package/dist/flows/PopupFlow.mjs +1 -1
  19. package/dist/flows/PopupFlow.mjs.map +1 -1
  20. package/dist/flows/RedirectFlow.cjs +1 -1
  21. package/dist/flows/RedirectFlow.cjs.map +1 -1
  22. package/dist/flows/RedirectFlow.mjs +1 -1
  23. package/dist/flows/RedirectFlow.mjs.map +1 -1
  24. package/dist/index.cjs +1 -1
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.ts +8 -4
  27. package/dist/index.mjs +1 -1
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/types.cjs.map +1 -1
  30. package/dist/types.d.ts +42 -1
  31. package/dist/types.mjs.map +1 -1
  32. package/dist/utils/EmbeddedFlowHandler.cjs +2 -0
  33. package/dist/utils/EmbeddedFlowHandler.cjs.map +1 -0
  34. package/dist/utils/EmbeddedFlowHandler.d.ts +61 -0
  35. package/dist/utils/EmbeddedFlowHandler.mjs +2 -0
  36. package/dist/utils/EmbeddedFlowHandler.mjs.map +1 -0
  37. package/dist/utils/NativeFlowHandler.cjs +1 -1
  38. package/dist/utils/NativeFlowHandler.cjs.map +1 -1
  39. package/dist/utils/NativeFlowHandler.d.ts +1 -1
  40. package/dist/utils/NativeFlowHandler.mjs +1 -1
  41. package/dist/utils/NativeFlowHandler.mjs.map +1 -1
  42. package/dist/utils/errors.cjs +1 -1
  43. package/dist/utils/errors.cjs.map +1 -1
  44. package/dist/utils/errors.d.ts +12 -0
  45. package/dist/utils/errors.mjs +1 -1
  46. package/dist/utils/errors.mjs.map +1 -1
  47. package/dist/utils/handlers.cjs +1 -1
  48. package/dist/utils/handlers.cjs.map +1 -1
  49. package/dist/utils/handlers.d.ts +1 -3
  50. package/dist/utils/handlers.mjs +1 -1
  51. package/dist/utils/handlers.mjs.map +1 -1
  52. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.cjs","sources":["../../src/utils/handlers.ts"],"sourcesContent":["import type { RedirectParams, ResponseMode, PopupParams, PopupWindowFeatures } from '../types';\n\nlet popupWindow: WindowProxy | null = null;\n\n/**\n * Handles URL redirection to a target window using a specified location method.\n *\n * @param {string} url The URL to redirect to.\n * @param {RedirectParams} [params] Optional parameters for the redirection, including the target window and location method.\n * @returns {Promise<void>} A promise that resolves when the redirection occurs.\n */\nasync function redirectUrlHandler(url: string, params?: RedirectParams): Promise<void> {\n\tconst targetWindow = params?.targetWindow === 'top' ? window.top : window.self;\n\tconst method = params?.locationMethod || 'assign';\n\n\tif (targetWindow) {\n\t\ttargetWindow.location[method](url);\n\t}\n\n\t// NOTE: Wait for the previous action\n\treturn new Promise((resolve) => resolve());\n}\n\n/**\n * Handles the callback after a redirect and parses the response from the URL.\n *\n * @param {string} [url=globalThis.window?.location.href] The URL to parse, defaults to the current window location.\n * @param {ResponseMode} responseMode The response mode, either 'query' or 'fragment'.\n * @returns {Promise<Record<string, string>>} A promise that resolves to the parsed response data.\n */\nfunction redirectCallbackHandler(url: string = globalThis.window?.location.href, responseMode?: ResponseMode): Promise<Record<string, string>> {\n\tconst data = new URL(url)[responseMode === 'query' ? 'search' : 'hash'].slice(1);\n\n\treturn Promise.resolve(Object.fromEntries(new URLSearchParams(data)));\n}\n\n/**\n * Opens a popup window to handle URL redirection and resolves with the data received from the popup.\n *\n * @param {string} url The URL to redirect to in the popup.\n * @param {PopupParams} [params] Optional parameters for the popup, including window features and target.\n * @param {{ checkOrigin: boolean }} [options] Optional settings for the popup handler.\n * @returns {Promise<Record<string, string>>} A promise that resolves to the data received from the popup window.\n * @throws {Error} If the popup window is blocked or closed by the user.\n */\nasync function popupUrlHandler(url: string, params?: PopupParams, options: { checkOrigin: boolean } = { checkOrigin: true }): Promise<Record<string, string>> {\n\tconst disposables = new Set<() => void>();\n\tconst closeWindow = (): void => {\n\t\tif (popupWindow) {\n\t\t\tif (!popupWindow.closed) {\n\t\t\t\tpopupWindow.close();\n\t\t\t}\n\n\t\t\tpopupWindow = null;\n\t\t}\n\n\t\tfor (const dispose of disposables) {\n\t\t\tdispose();\n\t\t}\n\n\t\tdisposables.clear();\n\t};\n\n\tif (popupWindow) {\n\t\tcloseWindow();\n\t}\n\n\tconst popupWindowFeatures: PopupWindowFeatures = {\n\t\tlocation: false,\n\t\ttoolbar: false,\n\t\theight: 640,\n\t\t...params?.popupWindowFeatures,\n\t};\n\n\tif (popupWindowFeatures.width === undefined) {\n\t\tpopupWindowFeatures.width = [800, 720, 600, 480].find((width) => width <= window.outerWidth / 1.618) ?? 360;\n\t}\n\n\tpopupWindowFeatures.left = Math.max(0, Math.round(window.screenX + (window.outerWidth - popupWindowFeatures.width) / 2));\n\n\tif (popupWindowFeatures.height !== undefined) {\n\t\tpopupWindowFeatures.top = Math.max(0, Math.round(window.screenY + (window.outerHeight - popupWindowFeatures.height) / 2));\n\t}\n\n\tpopupWindow = window.open(\n\t\tundefined,\n\t\tparams?.popupWindowTarget || '_blank',\n\t\tObject.entries(popupWindowFeatures)\n\t\t\t.filter(([, value]) => value !== null)\n\t\t\t.map(([key, value]) => `${key}=${typeof value !== 'boolean' ? (value as string) : value ? 'yes' : 'no'}`)\n\t\t\t.join(','),\n\t);\n\n\tif (!popupWindow) {\n\t\tthrow new Error('Popup window blocked');\n\t}\n\n\tpopupWindow.focus();\n\tpopupWindow.location.replace(url);\n\n\tconst data = await new Promise<Record<string, string>>((resolve, reject) => {\n\t\tconst listener = (event: MessageEvent<Record<string, string>>) => {\n\t\t\tif ((!options.checkOrigin || event.origin === window.location.origin) && event.source === popupWindow && event.data) {\n\t\t\t\tresolve(event.data);\n\t\t\t}\n\t\t};\n\n\t\tconst timer = setInterval(() => {\n\t\t\tif (popupWindow?.closed) {\n\t\t\t\tclearInterval(timer);\n\t\t\t\treject(Error('Popup closed by user'));\n\t\t\t}\n\t\t}, 500);\n\n\t\twindow.addEventListener('message', listener);\n\t\tdisposables.add(() => window.removeEventListener('message', listener));\n\t\tdisposables.add(() => clearInterval(timer));\n\t});\n\n\tcloseWindow();\n\n\treturn data;\n}\n\n/**\n * Handles the callback from a popup window, parsing the response parameters from the URL and posting them to the opener window.\n *\n * @param {string} [_url] the URL is not used in this function, but it is kept for type compatibility.\n * @param {ResponseMode} responseMode The response mode, either 'query' or 'fragment'.\n */\nfunction popupCallbackHandler(_url?: string, responseMode?: ResponseMode): Promise<void> {\n\tconst args: Record<string, string> = {};\n\n\tif (responseMode === 'fragment') {\n\t\tnew URLSearchParams(globalThis.window?.location.hash.replace('#', '?')).forEach((value, key) => (args[key] = value));\n\t} else {\n\t\tnew URLSearchParams(globalThis.window?.location.search).forEach((value, key) => (args[key] = value));\n\t}\n\n\tglobalThis.window?.opener?.postMessage(args, '*');\n\n\t// NOTE: Wait for the previous action\n\treturn new Promise(() => undefined);\n}\n\nexport { redirectUrlHandler, redirectCallbackHandler, popupUrlHandler, popupCallbackHandler };\n"],"names":["popupWindow","redirectUrlHandler","url","params","targetWindow","method","resolve","redirectCallbackHandler","responseMode","data","popupUrlHandler","options","disposables","closeWindow","dispose","popupWindowFeatures","width","value","key","reject","listener","event","timer","popupCallbackHandler","_url","args"],"mappings":"gFAEA,IAAIA,EAAkC,KAStC,eAAeC,EAAmBC,EAAaC,EAAwC,CACtF,MAAMC,EAAeD,GAAQ,eAAiB,MAAQ,OAAO,IAAM,OAAO,KACpEE,EAASF,GAAQ,gBAAkB,SAEzC,OAAIC,GACHA,EAAa,SAASC,CAAM,EAAEH,CAAG,EAI3B,IAAI,QAASI,GAAYA,GAAS,CAC1C,CASA,SAASC,EAAwBL,EAAc,WAAW,QAAQ,SAAS,KAAMM,EAA8D,CAC9I,MAAMC,EAAO,IAAI,IAAIP,CAAG,EAAEM,IAAiB,QAAU,SAAW,MAAM,EAAE,MAAM,CAAC,EAE/E,OAAO,QAAQ,QAAQ,OAAO,YAAY,IAAI,gBAAgBC,CAAI,CAAC,CAAC,CACrE,CAWA,eAAeC,EAAgBR,EAAaC,EAAsBQ,EAAoC,CAAE,YAAa,IAAyC,CAC7J,MAAMC,MAAkB,IAClBC,EAAc,IAAY,CAC3Bb,IACEA,EAAY,QAChBA,EAAY,MAAA,EAGbA,EAAc,MAGf,UAAWc,KAAWF,EACrBE,EAAA,EAGDF,EAAY,MAAA,CACb,EAEIZ,GACHa,EAAA,EAGD,MAAME,EAA2C,CAChD,SAAU,GACV,QAAS,GACT,OAAQ,IACR,GAAGZ,GAAQ,mBAAA,EAsBZ,GAnBIY,EAAoB,QAAU,SACjCA,EAAoB,MAAQ,CAAC,IAAK,IAAK,IAAK,GAAG,EAAE,KAAMC,GAAUA,GAAS,OAAO,WAAa,KAAK,GAAK,KAGzGD,EAAoB,KAAO,KAAK,IAAI,EAAG,KAAK,MAAM,OAAO,SAAW,OAAO,WAAaA,EAAoB,OAAS,CAAC,CAAC,EAEnHA,EAAoB,SAAW,SAClCA,EAAoB,IAAM,KAAK,IAAI,EAAG,KAAK,MAAM,OAAO,SAAW,OAAO,YAAcA,EAAoB,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QAAQ,QAAQ,YAAYQ,EAAM,GAAG,EAGzC,IAAI,QAAQ,IAAA,EAAe,CACnC"}
1
+ {"version":3,"file":"handlers.cjs","sources":["../../src/utils/handlers.ts"],"sourcesContent":["import type { RedirectParams, ResponseMode, PopupParams, PopupWindowFeatures } from '../types';\nimport { PopupBlockedError, PopupClosedError } from './errors';\n\nlet popupWindow: WindowProxy | null = null;\n\n/**\n * Handles URL redirection to a target window using a specified location method.\n *\n * @param {string} url The URL to redirect to.\n * @param {RedirectParams} [params] Optional parameters for the redirection, including the target window and location method.\n * @returns {Promise<void>} A promise that resolves when the redirection occurs.\n */\nasync function redirectUrlHandler(url: string, params?: RedirectParams): Promise<void> {\n\tconst targetWindow = params?.targetWindow === 'top' ? window.top : window.self;\n\tconst method = params?.locationMethod || 'assign';\n\n\tif (targetWindow) {\n\t\ttargetWindow.location[method](url);\n\t}\n\n\t// NOTE: Wait for the previous action\n\treturn new Promise((resolve) => resolve());\n}\n\n/**\n * Handles the callback after a redirect and parses the response from the URL.\n *\n * @param {string} [url=globalThis.window?.location.href] The URL to parse, defaults to the current window location.\n * @param {ResponseMode} responseMode The response mode, either 'query' or 'fragment'.\n * @returns {Promise<Record<string, string>>} A promise that resolves to the parsed response data.\n */\nfunction redirectCallbackHandler(url: string = globalThis.window?.location.href, responseMode?: ResponseMode): Promise<Record<string, string>> {\n\tconst data = new URL(url)[responseMode === 'query' ? 'search' : 'hash'].slice(1);\n\n\treturn Promise.resolve(Object.fromEntries(new URLSearchParams(data)));\n}\n\n/**\n * Opens a popup window to handle URL redirection and resolves with the data received from the popup.\n *\n * @param {string} url The URL to redirect to in the popup.\n * @param {PopupParams} [params] Optional parameters for the popup, including window features and target.\n * @param {{ checkOrigin: boolean }} [options] Optional settings for the popup handler.\n * @returns {Promise<Record<string, string>>} A promise that resolves to the data received from the popup window.\n * @throws {Error} If the popup window is blocked or closed by the user.\n */\nasync function popupUrlHandler(\n\tpopupHandlerOrUrl: string | ((popupWindow: Window) => void | Promise<void>),\n\tparams?: PopupParams,\n): Promise<Record<string, string>> {\n\tconst disposables = new Set<() => void>();\n\tconst closeWindow = (): void => {\n\t\tif (popupWindow) {\n\t\t\tif (!popupWindow.closed) {\n\t\t\t\tpopupWindow.close();\n\t\t\t}\n\n\t\t\tpopupWindow = null;\n\t\t}\n\n\t\tfor (const dispose of disposables) {\n\t\t\tdispose();\n\t\t}\n\n\t\tdisposables.clear();\n\t};\n\n\tif (popupWindow) {\n\t\tcloseWindow();\n\t}\n\n\tconst popupWindowFeatures: PopupWindowFeatures = {\n\t\tlocation: false,\n\t\ttoolbar: false,\n\t\theight: 640,\n\t\t...params?.popupWindowFeatures,\n\t};\n\n\tif (popupWindowFeatures.width === undefined) {\n\t\tpopupWindowFeatures.width = [800, 720, 600, 480].find((width) => width <= window.outerWidth / 1.618) ?? 360;\n\t}\n\n\tpopupWindowFeatures.left = Math.max(0, Math.round(window.screenX + (window.outerWidth - popupWindowFeatures.width) / 2));\n\n\tif (popupWindowFeatures.height !== undefined) {\n\t\tpopupWindowFeatures.top = Math.max(0, Math.round(window.screenY + (window.outerHeight - popupWindowFeatures.height) / 2));\n\t}\n\n\tpopupWindow = window.open(\n\t\tundefined,\n\t\tparams?.popupWindowTarget || '_blank',\n\t\tObject.entries(popupWindowFeatures)\n\t\t\t.filter(([, value]) => value !== null)\n\t\t\t.map(([key, value]) => `${key}=${typeof value !== 'boolean' ? (value as string) : value ? 'yes' : 'no'}`)\n\t\t\t.join(','),\n\t);\n\n\tif (!popupWindow) {\n\t\tthrow new PopupBlockedError();\n\t}\n\n\tpopupWindow.focus();\n\n\tif (typeof popupHandlerOrUrl === 'function') {\n\t\tawait popupHandlerOrUrl(popupWindow);\n\t} else {\n\t\tpopupWindow.location.replace(popupHandlerOrUrl);\n\t}\n\n\tconst data = await new Promise<Record<string, string>>((resolve, reject) => {\n\t\tconst listener = (event: MessageEvent<Record<string, string>>) => {\n\t\t\tif ((!params?.checkOrigin || event.origin === window.location.origin) && event.source === popupWindow && event.data) {\n\t\t\t\tresolve(event.data);\n\t\t\t}\n\t\t};\n\n\t\tconst timer = setInterval(() => {\n\t\t\tif (popupWindow?.closed) {\n\t\t\t\tclearInterval(timer);\n\t\t\t\treject(new PopupClosedError());\n\t\t\t}\n\t\t}, 500);\n\n\t\twindow.addEventListener('message', listener);\n\t\tdisposables.add(() => window.removeEventListener('message', listener));\n\t\tdisposables.add(() => clearInterval(timer));\n\t});\n\n\tcloseWindow();\n\n\treturn data;\n}\n\n/**\n * Handles the callback from a popup window, parsing the response parameters from the URL and posting them to the opener window.\n *\n * @param {string} [_url] the URL is not used in this function, but it is kept for type compatibility.\n * @param {ResponseMode} responseMode The response mode, either 'query' or 'fragment'.\n */\nfunction popupCallbackHandler(_url?: string, responseMode?: ResponseMode): Promise<void> {\n\tconst args: Record<string, string> = {};\n\n\tif (responseMode === 'fragment') {\n\t\tnew URLSearchParams(globalThis.window?.location.hash.replace('#', '?')).forEach((value, key) => (args[key] = value));\n\t} else {\n\t\tnew URLSearchParams(globalThis.window?.location.search).forEach((value, key) => (args[key] = value));\n\t}\n\n\tglobalThis.window?.opener?.postMessage(args, '*');\n\n\t// NOTE: Wait for the previous action\n\treturn new Promise(() => undefined);\n}\n\nexport { redirectUrlHandler, redirectCallbackHandler, popupUrlHandler, popupCallbackHandler };\n"],"names":["popupWindow","redirectUrlHandler","url","params","targetWindow","method","resolve","redirectCallbackHandler","responseMode","data","popupUrlHandler","popupHandlerOrUrl","disposables","closeWindow","dispose","popupWindowFeatures","width","value","key","PopupBlockedError","reject","listener","event","timer","PopupClosedError","popupCallbackHandler","_url","args"],"mappings":"gHAGA,IAAIA,EAAkC,KAStC,eAAeC,EAAmBC,EAAaC,EAAwC,CACtF,MAAMC,EAAeD,GAAQ,eAAiB,MAAQ,OAAO,IAAM,OAAO,KACpEE,EAASF,GAAQ,gBAAkB,SAEzC,OAAIC,GACHA,EAAa,SAASC,CAAM,EAAEH,CAAG,EAI3B,IAAI,QAASI,GAAYA,GAA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sB,WAChC,MAAMA,EAAkBX,CAAW,EAEnCA,EAAY,SAAS,QAAQW,CAAiB,EAG/C,MAAMF,EAAO,MAAM,IAAI,QAAgC,CAACH,EAASc,IAAW,CAC3E,MAAMC,EAAYC,GAAgD,EAC5D,CAACnB,GAAQ,aAAemB,EAAM,SAAW,OAAO,SAAS,SAAWA,EAAM,SAAWtB,GAAesB,EAAM,MAC9GhB,EAAQgB,EAAM,IAAI,CAEpB,EAEMC,EAAQ,YAAY,IAAM,CAC3BvB,GAAa,SAChB,cAAcuB,CAAK,EACnBH,EAAO,IAAII,EAAAA,gBAAkB,EAE/B,EAAG,GAAG,EAEN,OAAO,iBAAiB,UAAWH,CAAQ,EAC3CT,EAAY,IAAI,IAAM,OAAO,oBAAoB,UAAWS,CAAQ,CAAC,EACrET,EAAY,IAAI,IAAM,cAAcW,CAAK,CAAC,CAC3C,CAAC,EAED,OAAAV,EAAA,EAEOJ,CACR,CAQA,SAASgB,EAAqBC,EAAelB,EAA4C,CACxF,MAAMmB,EAA+B,CAAA,EAErC,OAAInB,IAAiB,WACpB,IAAI,gBAAgB,WAAW,QAAQ,SAAS,KAAK,QAAQ,IAAK,GAAG,CAAC,EAAE,QAAQ,CAACS,EAAOC,IAASS,EAAKT,CAAG,EAAID,CAAM,EAEnH,IAAI,gBAAgB,WAAW,QAAQ,SAAS,MAAM,EAAE,QAAQ,CAACA,EAAOC,IAASS,EAAKT,CAAG,EAAID,CAAM,EAGpG,WAAW,QAAQ,QAAQ,YAAYU,EAAM,GAAG,EAGzC,IAAI,QAAQ,IAAA,EAAe,CACnC"}
@@ -24,9 +24,7 @@ declare function redirectCallbackHandler(url?: string, responseMode?: ResponseMo
24
24
  * @returns {Promise<Record<string, string>>} A promise that resolves to the data received from the popup window.
25
25
  * @throws {Error} If the popup window is blocked or closed by the user.
26
26
  */
27
- declare function popupUrlHandler(url: string, params?: PopupParams, options?: {
28
- checkOrigin: boolean;
29
- }): Promise<Record<string, string>>;
27
+ declare function popupUrlHandler(popupHandlerOrUrl: string | ((popupWindow: Window) => void | Promise<void>), params?: PopupParams): Promise<Record<string, string>>;
30
28
  /**
31
29
  * Handles the callback from a popup window, parsing the response parameters from the URL and posting them to the opener window.
32
30
  *
@@ -1,2 +1,2 @@
1
- let o=null;async function p(s,i){const e=i?.targetWindow==="top"?window.top:window.self,n=i?.locationMethod||"assign";return e&&e.location[n](s),new Promise(r=>r())}function u(s=globalThis.window?.location.href,i){const e=new URL(s)[i==="query"?"search":"hash"].slice(1);return Promise.resolve(Object.fromEntries(new URLSearchParams(e)))}async function f(s,i,e={checkOrigin:!0}){const n=new Set,r=()=>{o&&(o.closed||o.close(),o=null);for(const t of n)t();n.clear()};o&&r();const a={location:!1,toolbar:!1,height:640,...i?.popupWindowFeatures};if(a.width===void 0&&(a.width=[800,720,600,480].find(t=>t<=window.outerWidth/1.618)??360),a.left=Math.max(0,Math.round(window.screenX+(window.outerWidth-a.width)/2)),a.height!==void 0&&(a.top=Math.max(0,Math.round(window.screenY+(window.outerHeight-a.height)/2))),o=window.open(void 0,i?.popupWindowTarget||"_blank",Object.entries(a).filter(([,t])=>t!==null).map(([t,d])=>`${t}=${typeof d!="boolean"?d:d?"yes":"no"}`).join(",")),!o)throw new Error("Popup window blocked");o.focus(),o.location.replace(s);const h=await new Promise((t,d)=>{const c=l=>{(!e.checkOrigin||l.origin===window.location.origin)&&l.source===o&&l.data&&t(l.data)},w=setInterval(()=>{o?.closed&&(clearInterval(w),d(Error("Popup closed by user")))},500);window.addEventListener("message",c),n.add(()=>window.removeEventListener("message",c)),n.add(()=>clearInterval(w))});return r(),h}function g(s,i){const e={};return i==="fragment"?new URLSearchParams(globalThis.window?.location.hash.replace("#","?")).forEach((n,r)=>e[r]=n):new URLSearchParams(globalThis.window?.location.search).forEach((n,r)=>e[r]=n),globalThis.window?.opener?.postMessage(e,"*"),new Promise(()=>{})}export{g as popupCallbackHandler,f as popupUrlHandler,u as redirectCallbackHandler,p as redirectUrlHandler};
1
+ import{PopupBlockedError as h,PopupClosedError as f}from"./errors.mjs";let n=null;async function u(r,i){const e=i?.targetWindow==="top"?window.top:window.self,a=i?.locationMethod||"assign";return e&&e.location[a](r),new Promise(o=>o())}function g(r=globalThis.window?.location.href,i){const e=new URL(r)[i==="query"?"search":"hash"].slice(1);return Promise.resolve(Object.fromEntries(new URLSearchParams(e)))}async function m(r,i){const e=new Set,a=()=>{n&&(n.closed||n.close(),n=null);for(const t of e)t();e.clear()};n&&a();const o={location:!1,toolbar:!1,height:640,...i?.popupWindowFeatures};if(o.width===void 0&&(o.width=[800,720,600,480].find(t=>t<=window.outerWidth/1.618)??360),o.left=Math.max(0,Math.round(window.screenX+(window.outerWidth-o.width)/2)),o.height!==void 0&&(o.top=Math.max(0,Math.round(window.screenY+(window.outerHeight-o.height)/2))),n=window.open(void 0,i?.popupWindowTarget||"_blank",Object.entries(o).filter(([,t])=>t!==null).map(([t,s])=>`${t}=${typeof s!="boolean"?s:s?"yes":"no"}`).join(",")),!n)throw new h;n.focus(),typeof r=="function"?await r(n):n.location.replace(r);const w=await new Promise((t,s)=>{const d=c=>{(!i?.checkOrigin||c.origin===window.location.origin)&&c.source===n&&c.data&&t(c.data)},l=setInterval(()=>{n?.closed&&(clearInterval(l),s(new f))},500);window.addEventListener("message",d),e.add(()=>window.removeEventListener("message",d)),e.add(()=>clearInterval(l))});return a(),w}function b(r,i){const e={};return i==="fragment"?new URLSearchParams(globalThis.window?.location.hash.replace("#","?")).forEach((a,o)=>e[o]=a):new URLSearchParams(globalThis.window?.location.search).forEach((a,o)=>e[o]=a),globalThis.window?.opener?.postMessage(e,"*"),new Promise(()=>{})}export{b as popupCallbackHandler,m as popupUrlHandler,g as redirectCallbackHandler,u as redirectUrlHandler};
2
2
  //# sourceMappingURL=handlers.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.mjs","sources":["../../src/utils/handlers.ts"],"sourcesContent":["import type { RedirectParams, ResponseMode, PopupParams, PopupWindowFeatures } from '../types';\n\nlet popupWindow: WindowProxy | null = null;\n\n/**\n * Handles URL redirection to a target window using a specified location method.\n *\n * @param {string} url The URL to redirect to.\n * @param {RedirectParams} [params] Optional parameters for the redirection, including the target window and location method.\n * @returns {Promise<void>} A promise that resolves when the redirection occurs.\n */\nasync function redirectUrlHandler(url: string, params?: RedirectParams): Promise<void> {\n\tconst targetWindow = params?.targetWindow === 'top' ? window.top : window.self;\n\tconst method = params?.locationMethod || 'assign';\n\n\tif (targetWindow) {\n\t\ttargetWindow.location[method](url);\n\t}\n\n\t// NOTE: Wait for the previous action\n\treturn new Promise((resolve) => resolve());\n}\n\n/**\n * Handles the callback after a redirect and parses the response from the URL.\n *\n * @param {string} [url=globalThis.window?.location.href] The URL to parse, defaults to the current window location.\n * @param {ResponseMode} responseMode The response mode, either 'query' or 'fragment'.\n * @returns {Promise<Record<string, string>>} A promise that resolves to the parsed response data.\n */\nfunction redirectCallbackHandler(url: string = globalThis.window?.location.href, responseMode?: ResponseMode): Promise<Record<string, string>> {\n\tconst data = new URL(url)[responseMode === 'query' ? 'search' : 'hash'].slice(1);\n\n\treturn Promise.resolve(Object.fromEntries(new URLSearchParams(data)));\n}\n\n/**\n * Opens a popup window to handle URL redirection and resolves with the data received from the popup.\n *\n * @param {string} url The URL to redirect to in the popup.\n * @param {PopupParams} [params] Optional parameters for the popup, including window features and target.\n * @param {{ checkOrigin: boolean }} [options] Optional settings for the popup handler.\n * @returns {Promise<Record<string, string>>} A promise that resolves to the data received from the popup window.\n * @throws {Error} If the popup window is blocked or closed by the user.\n */\nasync function popupUrlHandler(url: string, params?: PopupParams, options: { checkOrigin: boolean } = { checkOrigin: true }): Promise<Record<string, string>> {\n\tconst disposables = new Set<() => void>();\n\tconst closeWindow = (): void => {\n\t\tif (popupWindow) {\n\t\t\tif (!popupWindow.closed) {\n\t\t\t\tpopupWindow.close();\n\t\t\t}\n\n\t\t\tpopupWindow = null;\n\t\t}\n\n\t\tfor (const dispose of disposables) {\n\t\t\tdispose();\n\t\t}\n\n\t\tdisposables.clear();\n\t};\n\n\tif (popupWindow) {\n\t\tcloseWindow();\n\t}\n\n\tconst popupWindowFeatures: PopupWindowFeatures = {\n\t\tlocation: false,\n\t\ttoolbar: false,\n\t\theight: 640,\n\t\t...params?.popupWindowFeatures,\n\t};\n\n\tif (popupWindowFeatures.width === undefined) {\n\t\tpopupWindowFeatures.width = [800, 720, 600, 480].find((width) => width <= window.outerWidth / 1.618) ?? 360;\n\t}\n\n\tpopupWindowFeatures.left = Math.max(0, Math.round(window.screenX + (window.outerWidth - popupWindowFeatures.width) / 2));\n\n\tif (popupWindowFeatures.height !== undefined) {\n\t\tpopupWindowFeatures.top = Math.max(0, Math.round(window.screenY + (window.outerHeight - popupWindowFeatures.height) / 2));\n\t}\n\n\tpopupWindow = window.open(\n\t\tundefined,\n\t\tparams?.popupWindowTarget || '_blank',\n\t\tObject.entries(popupWindowFeatures)\n\t\t\t.filter(([, value]) => value !== null)\n\t\t\t.map(([key, value]) => `${key}=${typeof value !== 'boolean' ? (value as string) : value ? 'yes' : 'no'}`)\n\t\t\t.join(','),\n\t);\n\n\tif (!popupWindow) {\n\t\tthrow new Error('Popup window blocked');\n\t}\n\n\tpopupWindow.focus();\n\tpopupWindow.location.replace(url);\n\n\tconst data = await new Promise<Record<string, string>>((resolve, reject) => {\n\t\tconst listener = (event: MessageEvent<Record<string, string>>) => {\n\t\t\tif ((!options.checkOrigin || event.origin === window.location.origin) && event.source === popupWindow && event.data) {\n\t\t\t\tresolve(event.data);\n\t\t\t}\n\t\t};\n\n\t\tconst timer = setInterval(() => {\n\t\t\tif (popupWindow?.closed) {\n\t\t\t\tclearInterval(timer);\n\t\t\t\treject(Error('Popup closed by user'));\n\t\t\t}\n\t\t}, 500);\n\n\t\twindow.addEventListener('message', listener);\n\t\tdisposables.add(() => window.removeEventListener('message', listener));\n\t\tdisposables.add(() => clearInterval(timer));\n\t});\n\n\tcloseWindow();\n\n\treturn data;\n}\n\n/**\n * Handles the callback from a popup window, parsing the response parameters from the URL and posting them to the opener window.\n *\n * @param {string} [_url] the URL is not used in this function, but it is kept for type compatibility.\n * @param {ResponseMode} responseMode The response mode, either 'query' or 'fragment'.\n */\nfunction popupCallbackHandler(_url?: string, responseMode?: ResponseMode): Promise<void> {\n\tconst args: Record<string, string> = {};\n\n\tif (responseMode === 'fragment') {\n\t\tnew URLSearchParams(globalThis.window?.location.hash.replace('#', '?')).forEach((value, key) => (args[key] = value));\n\t} else {\n\t\tnew URLSearchParams(globalThis.window?.location.search).forEach((value, key) => (args[key] = value));\n\t}\n\n\tglobalThis.window?.opener?.postMessage(args, '*');\n\n\t// NOTE: Wait for the previous action\n\treturn new Promise(() => undefined);\n}\n\nexport { redirectUrlHandler, redirectCallbackHandler, popupUrlHandler, popupCallbackHandler };\n"],"names":["popupWindow","redirectUrlHandler","url","params","targetWindow","method","resolve","redirectCallbackHandler","responseMode","data","popupUrlHandler","options","disposables","closeWindow","dispose","popupWindowFeatures","width","value","key","reject","listener","event","timer","popupCallbackHandler","_url","args"],"mappings":"AAEA,IAAIA,EAAkC,KAStC,eAAeC,EAAmBC,EAAaC,EAAwC,CACtF,MAAMC,EAAeD,GAAQ,eAAiB,MAAQ,OAAO,IAAM,OAAO,KACpEE,EAASF,GAAQ,gBAAkB,SAEzC,OAAIC,GACHA,EAAa,SAASC,CAAM,EAAEH,CAAG,EAI3B,IAAI,QAASI,GAAYA,GAAS,CAC1C,CASA,SAASC,EAAwBL,EAAc,WAAW,QAAQ,SAAS,KAAMM,EAA8D,CAC9I,MAAMC,EAAO,IAAI,IAAIP,CAAG,EAAEM,IAAiB,QAAU,SAAW,MAAM,EAAE,MAAM,CAAC,EAE/E,OAAO,QAAQ,QAAQ,OAAO,YAAY,IAAI,gBAAgBC,CAAI,CAAC,CAAC,CACrE,CAWA,eAAeC,EAAgBR,EAAaC,EAAsBQ,EAAoC,CAAE,YAAa,IAAyC,CAC7J,MAAMC,MAAkB,IAClBC,EAAc,IAAY,CAC3Bb,IACEA,EAAY,QA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,EAAG,GAAG,EAEN,OAAO,iBAAiB,UAAWC,CAAQ,EAC3CR,EAAY,IAAI,IAAM,OAAO,oBAAoB,UAAWQ,CAAQ,CAAC,EACrER,EAAY,IAAI,IAAM,cAAcU,CAAK,CAAC,CAC3C,CAAC,EAED,OAAAT,EAAA,EAEOJ,CACR,CAQA,SAASc,EAAqBC,EAAehB,EAA4C,CACxF,MAAMiB,EAA+B,CAAA,EAErC,OAAIjB,IAAiB,WACpB,IAAI,gBAAgB,WAAW,QAAQ,SAAS,KAAK,QAAQ,IAAK,GAAG,CAAC,EAAE,QAAQ,CAACS,EAAOC,IAASO,EAAKP,CAAG,EAAID,CAAM,EAEnH,IAAI,gBAAgB,WAAW,QAAQ,SAAS,MAAM,EAAE,QAAQ,CAACA,EAAOC,IAASO,EAAKP,CAAG,EAAID,CAAM,EAGpG,WAAW,QAAQ,QAAQ,YAAYQ,EAAM,GAAG,EAGzC,IAAI,QAAQ,IAAA,EAAe,CACnC"}
1
+ {"version":3,"file":"handlers.mjs","sources":["../../src/utils/handlers.ts"],"sourcesContent":["import type { RedirectParams, ResponseMode, PopupParams, PopupWindowFeatures } from '../types';\nimport { PopupBlockedError, PopupClosedError } from './errors';\n\nlet popupWindow: WindowProxy | null = null;\n\n/**\n * Handles URL redirection to a target window using a specified location method.\n *\n * @param {string} url The URL to redirect to.\n * @param {RedirectParams} [params] Optional parameters for the redirection, including the target window and location method.\n * @returns {Promise<void>} A promise that resolves when the redirection occurs.\n */\nasync function redirectUrlHandler(url: string, params?: RedirectParams): Promise<void> {\n\tconst targetWindow = params?.targetWindow === 'top' ? window.top : window.self;\n\tconst method = params?.locationMethod || 'assign';\n\n\tif (targetWindow) {\n\t\ttargetWindow.location[method](url);\n\t}\n\n\t// NOTE: Wait for the previous action\n\treturn new Promise((resolve) => resolve());\n}\n\n/**\n * Handles the callback after a redirect and parses the response from the URL.\n *\n * @param {string} [url=globalThis.window?.location.href] The URL to parse, defaults to the current window location.\n * @param {ResponseMode} responseMode The response mode, either 'query' or 'fragment'.\n * @returns {Promise<Record<string, string>>} A promise that resolves to the parsed response data.\n */\nfunction redirectCallbackHandler(url: string = globalThis.window?.location.href, responseMode?: ResponseMode): Promise<Record<string, string>> {\n\tconst data = new URL(url)[responseMode === 'query' ? 'search' : 'hash'].slice(1);\n\n\treturn Promise.resolve(Object.fromEntries(new URLSearchParams(data)));\n}\n\n/**\n * Opens a popup window to handle URL redirection and resolves with the data received from the popup.\n *\n * @param {string} url The URL to redirect to in the popup.\n * @param {PopupParams} [params] Optional parameters for the popup, including window features and target.\n * @param {{ checkOrigin: boolean }} [options] Optional settings for the popup handler.\n * @returns {Promise<Record<string, string>>} A promise that resolves to the data received from the popup window.\n * @throws {Error} If the popup window is blocked or closed by the user.\n */\nasync function popupUrlHandler(\n\tpopupHandlerOrUrl: string | ((popupWindow: Window) => void | Promise<void>),\n\tparams?: PopupParams,\n): Promise<Record<string, string>> {\n\tconst disposables = new Set<() => void>();\n\tconst closeWindow = (): void => {\n\t\tif (popupWindow) {\n\t\t\tif (!popupWindow.closed) {\n\t\t\t\tpopupWindow.close();\n\t\t\t}\n\n\t\t\tpopupWindow = null;\n\t\t}\n\n\t\tfor (const dispose of disposables) {\n\t\t\tdispose();\n\t\t}\n\n\t\tdisposables.clear();\n\t};\n\n\tif (popupWindow) {\n\t\tcloseWindow();\n\t}\n\n\tconst popupWindowFeatures: PopupWindowFeatures = {\n\t\tlocation: false,\n\t\ttoolbar: false,\n\t\theight: 640,\n\t\t...params?.popupWindowFeatures,\n\t};\n\n\tif (popupWindowFeatures.width === undefined) {\n\t\tpopupWindowFeatures.width = [800, 720, 600, 480].find((width) => width <= window.outerWidth / 1.618) ?? 360;\n\t}\n\n\tpopupWindowFeatures.left = Math.max(0, Math.round(window.screenX + (window.outerWidth - popupWindowFeatures.width) / 2));\n\n\tif (popupWindowFeatures.height !== undefined) {\n\t\tpopupWindowFeatures.top = Math.max(0, Math.round(window.screenY + (window.outerHeight - popupWindowFeatures.height) / 2));\n\t}\n\n\tpopupWindow = window.open(\n\t\tundefined,\n\t\tparams?.popupWindowTarget || '_blank',\n\t\tObject.entries(popupWindowFeatures)\n\t\t\t.filter(([, value]) => value !== null)\n\t\t\t.map(([key, value]) => `${key}=${typeof value !== 'boolean' ? (value as string) : value ? 'yes' : 'no'}`)\n\t\t\t.join(','),\n\t);\n\n\tif (!popupWindow) {\n\t\tthrow new PopupBlockedError();\n\t}\n\n\tpopupWindow.focus();\n\n\tif (typeof popupHandlerOrUrl === 'function') {\n\t\tawait popupHandlerOrUrl(popupWindow);\n\t} else {\n\t\tpopupWindow.location.replace(popupHandlerOrUrl);\n\t}\n\n\tconst data = await new Promise<Record<string, string>>((resolve, reject) => {\n\t\tconst listener = (event: MessageEvent<Record<string, string>>) => {\n\t\t\tif ((!params?.checkOrigin || event.origin === window.location.origin) && event.source === popupWindow && event.data) {\n\t\t\t\tresolve(event.data);\n\t\t\t}\n\t\t};\n\n\t\tconst timer = setInterval(() => {\n\t\t\tif (popupWindow?.closed) {\n\t\t\t\tclearInterval(timer);\n\t\t\t\treject(new PopupClosedError());\n\t\t\t}\n\t\t}, 500);\n\n\t\twindow.addEventListener('message', listener);\n\t\tdisposables.add(() => window.removeEventListener('message', listener));\n\t\tdisposables.add(() => clearInterval(timer));\n\t});\n\n\tcloseWindow();\n\n\treturn data;\n}\n\n/**\n * Handles the callback from a popup window, parsing the response parameters from the URL and posting them to the opener window.\n *\n * @param {string} [_url] the URL is not used in this function, but it is kept for type compatibility.\n * @param {ResponseMode} responseMode The response mode, either 'query' or 'fragment'.\n */\nfunction popupCallbackHandler(_url?: string, responseMode?: ResponseMode): Promise<void> {\n\tconst args: Record<string, string> = {};\n\n\tif (responseMode === 'fragment') {\n\t\tnew URLSearchParams(globalThis.window?.location.hash.replace('#', '?')).forEach((value, key) => (args[key] = value));\n\t} else {\n\t\tnew URLSearchParams(globalThis.window?.location.search).forEach((value, key) => (args[key] = value));\n\t}\n\n\tglobalThis.window?.opener?.postMessage(args, '*');\n\n\t// NOTE: Wait for the previous action\n\treturn new Promise(() => undefined);\n}\n\nexport { redirectUrlHandler, redirectCallbackHandler, popupUrlHandler, popupCallbackHandler };\n"],"names":["popupWindow","redirectUrlHandler","url","params","targetWindow","method","resolve","redirectCallbackHandler","responseMode","data","popupUrlHandler","popupHandlerOrUrl","disposables","closeWindow","dispose","popupWindowFeatures","width","value","key","PopupBlockedError","reject","listener","event","timer","PopupClosedError","popupCallbackHandler","_url","args"],"mappings":"uEAGA,IAAIA,EAAkC,KAStC,eAAeC,EAAmBC,EAAaC,EAAwC,CACtF,MAAMC,EAAeD,GAAQ,eAAiB,MAAQ,OAAO,IAAM,OAAO,KACpEE,EAASF,GAAQ,gBAAkB,SAEzC,OAAIC,GACHA,EAAa,SAASC,CAAM,EAAEH,CAAG,EAI3B,IAAI,QAASI,GAAYA,GAAS,CAC1C,CASA,SAASC,EAAwBL,EAAc,WAAW,QAAQ,SAAS,KAAMM,EAA8D,CAC9I,MAAMC,EAAO,IAAI,IAAIP,CAAG,EAAEM,IAAiB,QAAU,SAAW,MAAM,EAAE,MAAM,CAAC,EAE/E,OAAO,QAAQ,QAAQ,OAAO,YAAY,IAAI,gBAAgBC,CAAI,CAAC,CAAC,CACrE,CAWA,eAAeC,EACdC,EACAR,EACkC,CAClC,MAAMS,MAAkB,IAClBC,EAAc,IAAY,CAC3Bb,IACEA,EAAY,QAChBA,EAAY,MAAA,EAGbA,EAAc,MAGf,UAAWc,KAAWF,EACrBE,EAAA,EAGDF,EAAY,MAAA,CACb,EAEIZ,GACHa,EAAA,EAGD,MAAME,EAA2C,CAChD,SAAU,GACV,QAAS,GACT,OAAQ,IACR,GAAGZ,GAAQ,mBAAA,EAsBZ,GAnBIY,EAAoB,QAAU,SACjCA,EAAoB,MAAQ,CAAC,IAAK,IAAK,IAAK,GAAG,EAAE,KAAMC,GAAUA,GAAS,OAAO,WAAa,KAAK,GAAK,KAGzGD,EAAoB,KAAO,KAAK,IAAI,EAAG,KAAK,M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K,GAAG,CAAC,EAAE,QAAQ,CAACS,EAAOC,IAASS,EAAKT,CAAG,EAAID,CAAM,EAEnH,IAAI,gBAAgB,WAAW,QAAQ,SAAS,MAAM,EAAE,QAAQ,CAACA,EAAOC,IAASS,EAAKT,CAAG,EAAID,CAAM,EAGpG,WAAW,QAAQ,QAAQ,YAAYU,EAAM,GAAG,EAGzC,IAAI,QAAQ,IAAA,EAAe,CACnC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strivacity/sdk-core",
3
- "version": "2.3.0",
3
+ "version": "3.0.0-rc.0",
4
4
  "license": "MIT",
5
5
  "description": "Strivacity JavaScript SDK client",
6
6
  "author": "strivacity <opensource@strivacity.com>",