Files
klz-cables.com/.pnpm-store/v10/files/eb/d0f22bdf2d67577f5388af5258c5327d5e48bb8e4a384b4ae2f1f3928c0462264ae551d461ec722da543c7e78ecdeef4443fe6b25f7a6067e796ebdf53e200
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

1 line
4.0 KiB
Plaintext

{"version":3,"file":"users.js","names":[],"sources":["../../../../src/rest/commands/utils/users.ts"],"sourcesContent":["import type { RestCommand } from '../../types.js';\n\n/**\n * Invite a new user by email.\n *\n * @param email User email to invite.\n * @param role Role of the new user.\n * @param invite_url Provide a custom invite url which the link in the email will lead to. The invite token will be passed as a parameter.\n *\n * @returns Nothing\n */\nexport const inviteUser =\n\t<Schema>(email: string, role: string, invite_url?: string): RestCommand<void, Schema> =>\n\t() => ({\n\t\tpath: `/users/invite`,\n\t\tmethod: 'POST',\n\t\tbody: JSON.stringify({\n\t\t\temail,\n\t\t\trole,\n\t\t\t...(invite_url ? { invite_url } : {}),\n\t\t}),\n\t});\n\n/**\n * Accept your invite. The invite user endpoint sends the email a link to the Admin App.\n *\n * @param token Accept invite token.\n * @param password Password for the user.\n *\n * @returns Nothing\n */\nexport const acceptUserInvite =\n\t<Schema>(token: string, password: string): RestCommand<void, Schema> =>\n\t() => ({\n\t\tpath: `/users/invite/accept`,\n\t\tmethod: 'POST',\n\t\tbody: JSON.stringify({\n\t\t\ttoken,\n\t\t\tpassword,\n\t\t}),\n\t});\n\n/**\n * Register a new user.\n *\n * @param email The new user email.\n * @param password The new user password.\n * @param options Optional registration fields.\n *\n * @returns Nothing\n */\nexport const registerUser =\n\t<Schema>(\n\t\temail: string,\n\t\tpassword: string,\n\t\toptions: { verification_url?: string; first_name?: string; last_name?: string } = {},\n\t): RestCommand<void, Schema> =>\n\t() => ({\n\t\tpath: `/users/register`,\n\t\tmethod: 'POST',\n\t\tbody: JSON.stringify({\n\t\t\temail,\n\t\t\tpassword,\n\t\t\t...options,\n\t\t}),\n\t});\n\n/**\n * Verify a registered user email using a token sent to the address.\n *\n * @param token Accept registration token.\n *\n * @returns Nothing\n */\nexport const registerUserVerify =\n\t<Schema>(token: string): RestCommand<void, Schema> =>\n\t() => ({\n\t\tpath: `/users/register/verify-email`,\n\t\tparams: { token },\n\t\tmethod: 'GET',\n\t});\n\n/**\n * Generates a secret and returns the URL to be used in an authenticator app.\n *\n * @param password The user's password.\n *\n * @returns A two-factor secret\n */\nexport const generateTwoFactorSecret =\n\t<Schema>(password: string): RestCommand<{ secret: string; otpauth_url: string }, Schema> =>\n\t() => ({\n\t\tpath: `/users/me/tfa/generate`,\n\t\tmethod: 'POST',\n\t\tbody: JSON.stringify({\n\t\t\tpassword,\n\t\t}),\n\t});\n\n/**\n * Adds a TFA secret to the user account.\n *\n * @param secret The TFA secret from tfa/generate.\n * @param otp OTP generated with the secret, to recheck if the user has a correct TFA setup\n *\n * @returns Nothing\n */\nexport const enableTwoFactor =\n\t<Schema>(secret: string, otp: string): RestCommand<void, Schema> =>\n\t() => ({\n\t\tpath: `/users/me/tfa/enable`,\n\t\tmethod: 'POST',\n\t\tbody: JSON.stringify({\n\t\t\tsecret,\n\t\t\totp,\n\t\t}),\n\t});\n\n/**\n * Disables two-factor authentication by removing the OTP secret from the user.\n *\n * @param otp One-time password generated by the authenticator app.\n *\n * @returns Nothing\n */\nexport const disableTwoFactor =\n\t<Schema>(otp: string): RestCommand<void, Schema> =>\n\t() => ({\n\t\tpath: `/users/me/tfa/disable`,\n\t\tmethod: 'POST',\n\t\tbody: JSON.stringify({ otp }),\n\t});\n"],"mappings":"AAWA,MAAa,GACH,EAAe,EAAc,SAC/B,CACN,KAAM,gBACN,OAAQ,OACR,KAAM,KAAK,UAAU,CACpB,QACA,OACA,GAAI,EAAa,CAAE,aAAY,CAAG,EAAE,CACpC,CAAC,CACF,EAUW,GACH,EAAe,SACjB,CACN,KAAM,uBACN,OAAQ,OACR,KAAM,KAAK,UAAU,CACpB,QACA,WACA,CAAC,CACF,EAWW,GAEX,EACA,EACA,EAAkF,EAAE,QAE9E,CACN,KAAM,kBACN,OAAQ,OACR,KAAM,KAAK,UAAU,CACpB,QACA,WACA,GAAG,EACH,CAAC,CACF,EASW,EACH,QACF,CACN,KAAM,+BACN,OAAQ,CAAE,QAAO,CACjB,OAAQ,MACR,EASW,EACH,QACF,CACN,KAAM,yBACN,OAAQ,OACR,KAAM,KAAK,UAAU,CACpB,WACA,CAAC,CACF,EAUW,GACH,EAAgB,SAClB,CACN,KAAM,uBACN,OAAQ,OACR,KAAM,KAAK,UAAU,CACpB,SACA,MACA,CAAC,CACF,EASW,EACH,QACF,CACN,KAAM,wBACN,OAAQ,OACR,KAAM,KAAK,UAAU,CAAE,MAAK,CAAC,CAC7B"}