@uninspired/auth-client 0.0.11 → 0.0.13
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.
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +5 -4
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +5 -4
- package/dist/types/index.d.ts +134 -5
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var{defineProperty:
|
|
1
|
+
var{defineProperty:c,getOwnPropertyNames:g,getOwnPropertyDescriptor:R}=Object,k=Object.prototype.hasOwnProperty;var a=new WeakMap,x=(e)=>{var t=a.get(e),r;if(t)return t;if(t=c({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function")g(e).map((n)=>!k.call(t,n)&&c(t,n,{get:()=>e[n],enumerable:!(r=R(e,n))||r.enumerable}));return a.set(e,t),t};var P=(e,t)=>{for(var r in t)c(e,r,{get:t[r],enumerable:!0,configurable:!0,set:(n)=>t[r]=()=>n})};var M={};P(M,{makeUsBetterAuthClient:()=>A,makeRedirectIntent:()=>y,makePublicClient:()=>b,makeMailingListClient:()=>O,makeLoginUrl:()=>q,makeCheckoutUrl:()=>j,makeCheckoutClient:()=>L,makeAppClient:()=>d});module.exports=x(M);var m=require("hono/client"),b=(e,t)=>{return m.hc(e,t)};var l=require("hono/client"),d=(e,t)=>{return l.hc(e,{...t,fetch:(r,n)=>(t?.fetch??fetch)(r,{...n,credentials:"include",headers:{...n.headers,"Content-Type":"application/json"}})})};var i=require("better-auth/client/plugins"),h=require("better-auth/react"),A=(e)=>{return h.createAuthClient({baseURL:e,plugins:[i.customSessionClient(),i.magicLinkClient(),i.emailOTPClient(),i.passkeyClient()]})};var f=require("hono/client"),L=(e,t)=>{return f.hc(e,{...t,fetch:(r,n)=>(t?.fetch??fetch)(r,{...n,credentials:"include",headers:{...n.headers,"Content-Type":"application/json"}})})};var C=require("hono/client"),O=(e,t,r)=>{return C.hc(e,{...r,headers:{...r?.headers,"X-Public-Key":t}})};function q(e,t,r){let n=new URL("/login",e);if(t)n.searchParams.set("intent",y(t,r));return n.toString()}function T(...e){}function j(e,t,r,n,s,p,u){T({priceId:t,productId:r,discountCode:n,loginUrl:s,pricingUrl:p,successUrl:u});let o=new URL("/auth/checkout",e);if(o.searchParams.set("priceId",t),o.searchParams.set("productId",r),n)o.searchParams.set("discountCode",n);if(s)o.searchParams.set("loginUrl",s);if(p)o.searchParams.set("pricingUrl",p);if(u)o.searchParams.set("successUrl",u);return o.toString()}function y(e,t){return JSON.stringify({type:"redirect",redirectUrl:e,appName:t})}
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=2ED0EA5600DA226664756E2164756E21
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/clients/publicClient.ts", "../../src/clients/appClient.ts", "../../src/clients/authClient.ts", "../../src/clients/checkoutClient.ts", "../../src/utils/intent.ts"],
|
|
3
|
+
"sources": ["../../src/clients/publicClient.ts", "../../src/clients/appClient.ts", "../../src/clients/authClient.ts", "../../src/clients/checkoutClient.ts", "../../src/clients/mailingListClient.ts", "../../src/utils/intent.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import type { PublicRouter } from \"@us-accounts/api\";\nimport { hc, type ClientRequestOptions } from \"hono/client\";\n\nexport type PublicClient = ReturnType<typeof hc<PublicRouter>>;\n\nexport const makePublicClient = (\n baseURL: string,\n options?: ClientRequestOptions,\n): PublicClient => {\n return hc<PublicRouter>(baseURL, options);\n};\n",
|
|
6
6
|
"import type { AppRouter } from \"@us-accounts/api\";\nimport { hc, type ClientRequestOptions } from \"hono/client\";\n\nexport type AppClient = ReturnType<typeof hc<AppRouter>>;\n\nexport const makeAppClient = (\n baseURL: string,\n options?: ClientRequestOptions,\n): AppClient => {\n return hc<AppRouter>(baseURL, {\n ...options,\n fetch: (url: any, init: any) =>\n (options?.fetch ?? fetch)(url, {\n ...init,\n credentials: \"include\",\n headers: {\n ...init.headers,\n \"Content-Type\": \"application/json\",\n },\n }),\n });\n};\n",
|
|
7
7
|
"import {\n customSessionClient,\n magicLinkClient,\n emailOTPClient,\n passkeyClient,\n} from \"better-auth/client/plugins\";\nimport { createAuthClient } from \"better-auth/react\";\nimport type { Auth } from \"@us-accounts/api\";\n\nexport const makeUsBetterAuthClient = (baseURL: string) => {\n return createAuthClient({\n baseURL,\n plugins: [\n customSessionClient<Auth>(),\n magicLinkClient(),\n emailOTPClient(),\n passkeyClient(),\n ],\n });\n};\n",
|
|
8
8
|
"import type { CheckoutRouter } from \"@us-accounts/api\";\nimport { hc, type ClientRequestOptions } from \"hono/client\";\n\nexport type CheckoutClient = ReturnType<typeof hc<CheckoutRouter>>;\n\nexport const makeCheckoutClient = (\n baseURL: string,\n options?: ClientRequestOptions,\n): CheckoutClient => {\n return hc<CheckoutRouter>(baseURL, {\n ...options,\n fetch: (url: any, init: any) =>\n (options?.fetch ?? fetch)(url, {\n ...init,\n credentials: \"include\",\n headers: {\n ...init.headers,\n \"Content-Type\": \"application/json\",\n },\n }),\n });\n};\n",
|
|
9
|
-
"import type {
|
|
9
|
+
"import type { MailingListRouter } from \"@us-accounts/api\";\nimport { hc, type ClientRequestOptions } from \"hono/client\";\n\nexport type MailingListClient = ReturnType<typeof hc<MailingListRouter>>;\n\nexport const makeMailingListClient = (\n baseURL: string,\n publicKey: string,\n options?: ClientRequestOptions,\n): MailingListClient => {\n return hc<MailingListRouter>(baseURL, {\n ...options,\n headers: {\n ...options?.headers,\n \"X-Public-Key\": publicKey,\n },\n });\n};\n",
|
|
10
|
+
"import type { CheckoutSearch, RedirectIntent } from \"@us-accounts/utils\";\n\nexport function makeLoginUrl(\n apiUrl: string,\n redirectUrl?: string,\n appName?: string,\n) {\n const url = new URL(\"/login\", apiUrl);\n if (redirectUrl) {\n url.searchParams.set(\"intent\", makeRedirectIntent(redirectUrl, appName));\n }\n return url.toString();\n}\n\nfunction noop(...args: any[]) {\n // Do nothing\n}\n\nexport function makeCheckoutUrl(\n apiUrl: string,\n priceId: string,\n productId: string,\n discountCode?: string,\n loginUrl?: string,\n pricingUrl?: string,\n successUrl?: string,\n) {\n const obj = {\n priceId,\n productId,\n discountCode,\n loginUrl,\n pricingUrl,\n successUrl,\n } satisfies CheckoutSearch;\n noop(obj);\n\n const url = new URL(\"/auth/checkout\", apiUrl);\n url.searchParams.set(\"priceId\", priceId);\n url.searchParams.set(\"productId\", productId);\n if (discountCode) {\n url.searchParams.set(\"discountCode\", discountCode);\n }\n if (loginUrl) {\n url.searchParams.set(\"loginUrl\", loginUrl);\n }\n if (pricingUrl) {\n url.searchParams.set(\"pricingUrl\", pricingUrl);\n }\n if (successUrl) {\n url.searchParams.set(\"successUrl\", successUrl);\n }\n return url.toString();\n}\n\nexport function makeRedirectIntent(\n redirectUrl: string,\n appName?: string,\n): string {\n const obj = {\n type: \"redirect\",\n redirectUrl,\n appName,\n } satisfies RedirectIntent;\n\n return JSON.stringify(obj);\n}\n"
|
|
10
11
|
],
|
|
11
|
-
"mappings": "
|
|
12
|
-
"debugId": "
|
|
12
|
+
"mappings": "4qBAC8C,IAA9C,yBAIa,EAAmB,CAC9B,EACA,IACiB,CACjB,OAAO,KAAiB,EAAS,CAAO,GCRI,IAA9C,yBAIa,EAAgB,CAC3B,EACA,IACc,CACd,OAAO,KAAc,EAAS,IACzB,EACH,MAAO,CAAC,EAAU,KACf,GAAS,OAAS,OAAO,EAAK,IAC1B,EACH,YAAa,UACb,QAAS,IACJ,EAAK,QACR,eAAgB,kBAClB,CACF,CAAC,CACL,CAAC,GCfI,IALP,wCAMA,+BAGa,EAAyB,CAAC,IAAoB,CACzD,OAAO,mBAAiB,CACtB,UACA,QAAS,CACP,sBAA0B,EAC1B,kBAAgB,EAChB,iBAAe,EACf,gBAAc,CAChB,CACF,CAAC,GCjB2C,IAA9C,yBAIa,EAAqB,CAChC,EACA,IACmB,CACnB,OAAO,KAAmB,EAAS,IAC9B,EACH,MAAO,CAAC,EAAU,KACf,GAAS,OAAS,OAAO,EAAK,IAC1B,EACH,YAAa,UACb,QAAS,IACJ,EAAK,QACR,eAAgB,kBAClB,CACF,CAAC,CACL,CAAC,GCnB2C,IAA9C,yBAIa,EAAwB,CACnC,EACA,EACA,IACsB,CACtB,OAAO,KAAsB,EAAS,IACjC,EACH,QAAS,IACJ,GAAS,QACZ,eAAgB,CAClB,CACF,CAAC,GCdI,SAAS,CAAY,CAC1B,EACA,EACA,EACA,CACA,IAAM,EAAM,IAAI,IAAI,SAAU,CAAM,EACpC,GAAI,EACF,EAAI,aAAa,IAAI,SAAU,EAAmB,EAAa,CAAO,CAAC,EAEzE,OAAO,EAAI,SAAS,EAGtB,SAAS,CAAI,IAAI,EAAa,EAIvB,SAAS,CAAe,CAC7B,EACA,EACA,EACA,EACA,EACA,EACA,EACA,CASA,EARY,CACV,UACA,YACA,eACA,WACA,aACA,YACF,CACQ,EAER,IAAM,EAAM,IAAI,IAAI,iBAAkB,CAAM,EAG5C,GAFA,EAAI,aAAa,IAAI,UAAW,CAAO,EACvC,EAAI,aAAa,IAAI,YAAa,CAAS,EACvC,EACF,EAAI,aAAa,IAAI,eAAgB,CAAY,EAEnD,GAAI,EACF,EAAI,aAAa,IAAI,WAAY,CAAQ,EAE3C,GAAI,EACF,EAAI,aAAa,IAAI,aAAc,CAAU,EAE/C,GAAI,EACF,EAAI,aAAa,IAAI,aAAc,CAAU,EAE/C,OAAO,EAAI,SAAS,EAGf,SAAS,CAAkB,CAChC,EACA,EACQ,CAOR,OAAO,KAAK,UANA,CACV,KAAM,WACN,cACA,SACF,CAEyB",
|
|
13
|
+
"debugId": "2ED0EA5600DA226664756E2164756E21",
|
|
13
14
|
"names": []
|
|
14
15
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{hc as
|
|
1
|
+
import{hc as u}from"hono/client";var P=(e,t)=>{return u(e,t)};import{hc as c}from"hono/client";var A=(e,t)=>{return c(e,{...t,fetch:(r,n)=>(t?.fetch??fetch)(r,{...n,credentials:"include",headers:{...n.headers,"Content-Type":"application/json"}})})};import{customSessionClient as a,magicLinkClient as m,emailOTPClient as l,passkeyClient as h}from"better-auth/client/plugins";import{createAuthClient as f}from"better-auth/react";var T=(e)=>{return f({baseURL:e,plugins:[a(),m(),l(),h()]})};import{hc as C}from"hono/client";var S=(e,t)=>{return C(e,{...t,fetch:(r,n)=>(t?.fetch??fetch)(r,{...n,credentials:"include",headers:{...n.headers,"Content-Type":"application/json"}})})};import{hc as y}from"hono/client";var B=(e,t,r)=>{return y(e,{...r,headers:{...r?.headers,"X-Public-Key":t}})};function D(e,t,r){let n=new URL("/login",e);if(t)n.searchParams.set("intent",R(t,r));return n.toString()}function g(...e){}function E(e,t,r,n,o,s,p){g({priceId:t,productId:r,discountCode:n,loginUrl:o,pricingUrl:s,successUrl:p});let i=new URL("/auth/checkout",e);if(i.searchParams.set("priceId",t),i.searchParams.set("productId",r),n)i.searchParams.set("discountCode",n);if(o)i.searchParams.set("loginUrl",o);if(s)i.searchParams.set("pricingUrl",s);if(p)i.searchParams.set("successUrl",p);return i.toString()}function R(e,t){return JSON.stringify({type:"redirect",redirectUrl:e,appName:t})}export{T as makeUsBetterAuthClient,R as makeRedirectIntent,P as makePublicClient,B as makeMailingListClient,D as makeLoginUrl,E as makeCheckoutUrl,S as makeCheckoutClient,A as makeAppClient};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=007B2F935D38AB1064756E2164756E21
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/clients/publicClient.ts", "../../src/clients/appClient.ts", "../../src/clients/authClient.ts", "../../src/clients/checkoutClient.ts", "../../src/utils/intent.ts"],
|
|
3
|
+
"sources": ["../../src/clients/publicClient.ts", "../../src/clients/appClient.ts", "../../src/clients/authClient.ts", "../../src/clients/checkoutClient.ts", "../../src/clients/mailingListClient.ts", "../../src/utils/intent.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import type { PublicRouter } from \"@us-accounts/api\";\nimport { hc, type ClientRequestOptions } from \"hono/client\";\n\nexport type PublicClient = ReturnType<typeof hc<PublicRouter>>;\n\nexport const makePublicClient = (\n baseURL: string,\n options?: ClientRequestOptions,\n): PublicClient => {\n return hc<PublicRouter>(baseURL, options);\n};\n",
|
|
6
6
|
"import type { AppRouter } from \"@us-accounts/api\";\nimport { hc, type ClientRequestOptions } from \"hono/client\";\n\nexport type AppClient = ReturnType<typeof hc<AppRouter>>;\n\nexport const makeAppClient = (\n baseURL: string,\n options?: ClientRequestOptions,\n): AppClient => {\n return hc<AppRouter>(baseURL, {\n ...options,\n fetch: (url: any, init: any) =>\n (options?.fetch ?? fetch)(url, {\n ...init,\n credentials: \"include\",\n headers: {\n ...init.headers,\n \"Content-Type\": \"application/json\",\n },\n }),\n });\n};\n",
|
|
7
7
|
"import {\n customSessionClient,\n magicLinkClient,\n emailOTPClient,\n passkeyClient,\n} from \"better-auth/client/plugins\";\nimport { createAuthClient } from \"better-auth/react\";\nimport type { Auth } from \"@us-accounts/api\";\n\nexport const makeUsBetterAuthClient = (baseURL: string) => {\n return createAuthClient({\n baseURL,\n plugins: [\n customSessionClient<Auth>(),\n magicLinkClient(),\n emailOTPClient(),\n passkeyClient(),\n ],\n });\n};\n",
|
|
8
8
|
"import type { CheckoutRouter } from \"@us-accounts/api\";\nimport { hc, type ClientRequestOptions } from \"hono/client\";\n\nexport type CheckoutClient = ReturnType<typeof hc<CheckoutRouter>>;\n\nexport const makeCheckoutClient = (\n baseURL: string,\n options?: ClientRequestOptions,\n): CheckoutClient => {\n return hc<CheckoutRouter>(baseURL, {\n ...options,\n fetch: (url: any, init: any) =>\n (options?.fetch ?? fetch)(url, {\n ...init,\n credentials: \"include\",\n headers: {\n ...init.headers,\n \"Content-Type\": \"application/json\",\n },\n }),\n });\n};\n",
|
|
9
|
-
"import type {
|
|
9
|
+
"import type { MailingListRouter } from \"@us-accounts/api\";\nimport { hc, type ClientRequestOptions } from \"hono/client\";\n\nexport type MailingListClient = ReturnType<typeof hc<MailingListRouter>>;\n\nexport const makeMailingListClient = (\n baseURL: string,\n publicKey: string,\n options?: ClientRequestOptions,\n): MailingListClient => {\n return hc<MailingListRouter>(baseURL, {\n ...options,\n headers: {\n ...options?.headers,\n \"X-Public-Key\": publicKey,\n },\n });\n};\n",
|
|
10
|
+
"import type { CheckoutSearch, RedirectIntent } from \"@us-accounts/utils\";\n\nexport function makeLoginUrl(\n apiUrl: string,\n redirectUrl?: string,\n appName?: string,\n) {\n const url = new URL(\"/login\", apiUrl);\n if (redirectUrl) {\n url.searchParams.set(\"intent\", makeRedirectIntent(redirectUrl, appName));\n }\n return url.toString();\n}\n\nfunction noop(...args: any[]) {\n // Do nothing\n}\n\nexport function makeCheckoutUrl(\n apiUrl: string,\n priceId: string,\n productId: string,\n discountCode?: string,\n loginUrl?: string,\n pricingUrl?: string,\n successUrl?: string,\n) {\n const obj = {\n priceId,\n productId,\n discountCode,\n loginUrl,\n pricingUrl,\n successUrl,\n } satisfies CheckoutSearch;\n noop(obj);\n\n const url = new URL(\"/auth/checkout\", apiUrl);\n url.searchParams.set(\"priceId\", priceId);\n url.searchParams.set(\"productId\", productId);\n if (discountCode) {\n url.searchParams.set(\"discountCode\", discountCode);\n }\n if (loginUrl) {\n url.searchParams.set(\"loginUrl\", loginUrl);\n }\n if (pricingUrl) {\n url.searchParams.set(\"pricingUrl\", pricingUrl);\n }\n if (successUrl) {\n url.searchParams.set(\"successUrl\", successUrl);\n }\n return url.toString();\n}\n\nexport function makeRedirectIntent(\n redirectUrl: string,\n appName?: string,\n): string {\n const obj = {\n type: \"redirect\",\n redirectUrl,\n appName,\n } satisfies RedirectIntent;\n\n return JSON.stringify(obj);\n}\n"
|
|
10
11
|
],
|
|
11
|
-
"mappings": "AACA,aAAS,oBAIF,IAAM,EAAmB,CAC9B,EACA,IACiB,CACjB,OAAO,EAAiB,EAAS,CAAO,GCR1C,aAAS,oBAIF,IAAM,EAAgB,CAC3B,EACA,IACc,CACd,OAAO,EAAc,EAAS,IACzB,EACH,MAAO,CAAC,EAAU,KACf,GAAS,OAAS,OAAO,EAAK,IAC1B,EACH,YAAa,UACb,QAAS,IACJ,EAAK,QACR,eAAgB,kBAClB,CACF,CAAC,CACL,CAAC,GCpBH,8BACE,qBACA,oBACA,mBACA,mCAEF,2BAAS,0BAGF,IAAM,EAAyB,CAAC,IAAoB,CACzD,OAAO,EAAiB,CACtB,UACA,QAAS,CACP,EAA0B,EAC1B,EAAgB,EAChB,EAAe,EACf,EAAc,CAChB,CACF,CAAC,GCjBH,aAAS,oBAIF,IAAM,EAAqB,CAChC,EACA,IACmB,CACnB,OAAO,EAAmB,EAAS,IAC9B,EACH,MAAO,CAAC,EAAU,KACf,GAAS,OAAS,OAAO,EAAK,IAC1B,EACH,YAAa,UACb,QAAS,IACJ,EAAK,QACR,eAAgB,kBAClB,CACF,CAAC,CACL,CAAC,
|
|
12
|
-
"debugId": "
|
|
12
|
+
"mappings": "AACA,aAAS,oBAIF,IAAM,EAAmB,CAC9B,EACA,IACiB,CACjB,OAAO,EAAiB,EAAS,CAAO,GCR1C,aAAS,oBAIF,IAAM,EAAgB,CAC3B,EACA,IACc,CACd,OAAO,EAAc,EAAS,IACzB,EACH,MAAO,CAAC,EAAU,KACf,GAAS,OAAS,OAAO,EAAK,IAC1B,EACH,YAAa,UACb,QAAS,IACJ,EAAK,QACR,eAAgB,kBAClB,CACF,CAAC,CACL,CAAC,GCpBH,8BACE,qBACA,oBACA,mBACA,mCAEF,2BAAS,0BAGF,IAAM,EAAyB,CAAC,IAAoB,CACzD,OAAO,EAAiB,CACtB,UACA,QAAS,CACP,EAA0B,EAC1B,EAAgB,EAChB,EAAe,EACf,EAAc,CAChB,CACF,CAAC,GCjBH,aAAS,oBAIF,IAAM,EAAqB,CAChC,EACA,IACmB,CACnB,OAAO,EAAmB,EAAS,IAC9B,EACH,MAAO,CAAC,EAAU,KACf,GAAS,OAAS,OAAO,EAAK,IAC1B,EACH,YAAa,UACb,QAAS,IACJ,EAAK,QACR,eAAgB,kBAClB,CACF,CAAC,CACL,CAAC,GCnBH,aAAS,oBAIF,IAAM,EAAwB,CACnC,EACA,EACA,IACsB,CACtB,OAAO,EAAsB,EAAS,IACjC,EACH,QAAS,IACJ,GAAS,QACZ,eAAgB,CAClB,CACF,CAAC,GCdI,SAAS,CAAY,CAC1B,EACA,EACA,EACA,CACA,IAAM,EAAM,IAAI,IAAI,SAAU,CAAM,EACpC,GAAI,EACF,EAAI,aAAa,IAAI,SAAU,EAAmB,EAAa,CAAO,CAAC,EAEzE,OAAO,EAAI,SAAS,EAGtB,SAAS,CAAI,IAAI,EAAa,EAIvB,SAAS,CAAe,CAC7B,EACA,EACA,EACA,EACA,EACA,EACA,EACA,CASA,EARY,CACV,UACA,YACA,eACA,WACA,aACA,YACF,CACQ,EAER,IAAM,EAAM,IAAI,IAAI,iBAAkB,CAAM,EAG5C,GAFA,EAAI,aAAa,IAAI,UAAW,CAAO,EACvC,EAAI,aAAa,IAAI,YAAa,CAAS,EACvC,EACF,EAAI,aAAa,IAAI,eAAgB,CAAY,EAEnD,GAAI,EACF,EAAI,aAAa,IAAI,WAAY,CAAQ,EAE3C,GAAI,EACF,EAAI,aAAa,IAAI,aAAc,CAAU,EAE/C,GAAI,EACF,EAAI,aAAa,IAAI,aAAc,CAAU,EAE/C,OAAO,EAAI,SAAS,EAGf,SAAS,CAAkB,CAChC,EACA,EACQ,CAOR,OAAO,KAAK,UANA,CACV,KAAM,WACN,cACA,SACF,CAEyB",
|
|
13
|
+
"debugId": "007B2F935D38AB1064756E2164756E21",
|
|
13
14
|
"names": []
|
|
14
15
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import * as undici_types from 'undici-types';
|
|
|
8
8
|
import * as better_auth from 'better-auth';
|
|
9
9
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
10
10
|
import * as better_auth_plugins_passkey from 'better-auth/plugins/passkey';
|
|
11
|
+
import * as hono_types from 'hono/types';
|
|
11
12
|
|
|
12
13
|
declare const checkoutRouter: hono_hono_base.HonoBase<{
|
|
13
14
|
Variables: {
|
|
@@ -93,7 +94,7 @@ declare const appRouter: hono_hono_base.HonoBase<{
|
|
|
93
94
|
input: {
|
|
94
95
|
param: {
|
|
95
96
|
subscriptionId: string;
|
|
96
|
-
action: "
|
|
97
|
+
action: "cancel" | "update";
|
|
97
98
|
};
|
|
98
99
|
};
|
|
99
100
|
output: undefined;
|
|
@@ -101,6 +102,20 @@ declare const appRouter: hono_hono_base.HonoBase<{
|
|
|
101
102
|
status: 302;
|
|
102
103
|
};
|
|
103
104
|
};
|
|
105
|
+
} & {
|
|
106
|
+
"/subscribe": {
|
|
107
|
+
$post: {
|
|
108
|
+
input: {};
|
|
109
|
+
output: "Unauthorized";
|
|
110
|
+
outputFormat: "text";
|
|
111
|
+
status: 401;
|
|
112
|
+
} | {
|
|
113
|
+
input: {};
|
|
114
|
+
output: "Success";
|
|
115
|
+
outputFormat: "text";
|
|
116
|
+
status: 200;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
104
119
|
}, "/">;
|
|
105
120
|
type AppRouter = typeof appRouter;
|
|
106
121
|
|
|
@@ -232,6 +247,114 @@ declare const publicRouter: hono_hono_base.HonoBase<{
|
|
|
232
247
|
}, "/">;
|
|
233
248
|
type PublicRouter = typeof publicRouter;
|
|
234
249
|
|
|
250
|
+
declare const mailingListRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, {
|
|
251
|
+
"/subscribe": {
|
|
252
|
+
$post: {
|
|
253
|
+
input: {
|
|
254
|
+
json: {
|
|
255
|
+
email: string;
|
|
256
|
+
userGroup: string;
|
|
257
|
+
callbackUrl: string;
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
output: "Unauthorized";
|
|
261
|
+
outputFormat: "text";
|
|
262
|
+
status: 401;
|
|
263
|
+
} | {
|
|
264
|
+
input: {
|
|
265
|
+
json: {
|
|
266
|
+
email: string;
|
|
267
|
+
userGroup: string;
|
|
268
|
+
callbackUrl: string;
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
output: "Success";
|
|
272
|
+
outputFormat: "text";
|
|
273
|
+
status: 200;
|
|
274
|
+
} | {
|
|
275
|
+
input: {
|
|
276
|
+
json: {
|
|
277
|
+
email: string;
|
|
278
|
+
userGroup: string;
|
|
279
|
+
callbackUrl: string;
|
|
280
|
+
};
|
|
281
|
+
};
|
|
282
|
+
output: "Could not send email";
|
|
283
|
+
outputFormat: "text";
|
|
284
|
+
status: 500;
|
|
285
|
+
} | {
|
|
286
|
+
input: {
|
|
287
|
+
json: {
|
|
288
|
+
email: string;
|
|
289
|
+
userGroup: string;
|
|
290
|
+
callbackUrl: string;
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
output: "Contact already subscribed";
|
|
294
|
+
outputFormat: "text";
|
|
295
|
+
status: 400;
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
} & {
|
|
299
|
+
"/opt-in": {
|
|
300
|
+
$get: {
|
|
301
|
+
input: {
|
|
302
|
+
query: {
|
|
303
|
+
code: string;
|
|
304
|
+
email: string;
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
output: undefined;
|
|
308
|
+
outputFormat: "redirect";
|
|
309
|
+
status: 302;
|
|
310
|
+
} | {
|
|
311
|
+
input: {
|
|
312
|
+
query: {
|
|
313
|
+
code: string;
|
|
314
|
+
email: string;
|
|
315
|
+
};
|
|
316
|
+
};
|
|
317
|
+
output: "Invalid opt-in token";
|
|
318
|
+
outputFormat: "text";
|
|
319
|
+
status: 400;
|
|
320
|
+
} | {
|
|
321
|
+
input: {
|
|
322
|
+
query: {
|
|
323
|
+
code: string;
|
|
324
|
+
email: string;
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
output: "Contact does not exist";
|
|
328
|
+
outputFormat: "text";
|
|
329
|
+
status: 400;
|
|
330
|
+
} | {
|
|
331
|
+
input: {
|
|
332
|
+
query: {
|
|
333
|
+
code: string;
|
|
334
|
+
email: string;
|
|
335
|
+
};
|
|
336
|
+
};
|
|
337
|
+
output: "Could not opt in contact";
|
|
338
|
+
outputFormat: "text";
|
|
339
|
+
status: 500;
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
} & {
|
|
343
|
+
"/unsubscribe": {
|
|
344
|
+
$post: {
|
|
345
|
+
input: {
|
|
346
|
+
query: {
|
|
347
|
+
email: string;
|
|
348
|
+
};
|
|
349
|
+
};
|
|
350
|
+
output: "Success";
|
|
351
|
+
outputFormat: "text";
|
|
352
|
+
status: 200;
|
|
353
|
+
};
|
|
354
|
+
};
|
|
355
|
+
}, "/">;
|
|
356
|
+
type MailingListRouter = typeof mailingListRouter;
|
|
357
|
+
|
|
235
358
|
type PublicClient = ReturnType<typeof hc<PublicRouter>>;
|
|
236
359
|
declare const makePublicClient: (baseURL: string, options?: ClientRequestOptions) => PublicClient;
|
|
237
360
|
|
|
@@ -3143,6 +3266,7 @@ declare const makeUsBetterAuthClient: (baseURL: string) => {
|
|
|
3143
3266
|
customer: {
|
|
3144
3267
|
id: string;
|
|
3145
3268
|
};
|
|
3269
|
+
subscribedToNewsletter: boolean;
|
|
3146
3270
|
}, {
|
|
3147
3271
|
code?: string;
|
|
3148
3272
|
message?: string;
|
|
@@ -3254,6 +3378,7 @@ declare const makeUsBetterAuthClient: (baseURL: string) => {
|
|
|
3254
3378
|
customer: {
|
|
3255
3379
|
id: string;
|
|
3256
3380
|
};
|
|
3381
|
+
subscribedToNewsletter: boolean;
|
|
3257
3382
|
} | null;
|
|
3258
3383
|
isPending: boolean;
|
|
3259
3384
|
error: _better_fetch_fetch.BetterFetchError | null;
|
|
@@ -3312,6 +3437,7 @@ declare const makeUsBetterAuthClient: (baseURL: string) => {
|
|
|
3312
3437
|
customer: {
|
|
3313
3438
|
id: string;
|
|
3314
3439
|
};
|
|
3440
|
+
subscribedToNewsletter: boolean;
|
|
3315
3441
|
};
|
|
3316
3442
|
};
|
|
3317
3443
|
$fetch: _better_fetch_fetch.BetterFetch<{
|
|
@@ -3415,9 +3541,12 @@ declare const makeUsBetterAuthClient: (baseURL: string) => {
|
|
|
3415
3541
|
type CheckoutClient = ReturnType<typeof hc<CheckoutRouter>>;
|
|
3416
3542
|
declare const makeCheckoutClient: (baseURL: string, options?: ClientRequestOptions) => CheckoutClient;
|
|
3417
3543
|
|
|
3418
|
-
|
|
3544
|
+
type MailingListClient = ReturnType<typeof hc<MailingListRouter>>;
|
|
3545
|
+
declare const makeMailingListClient: (baseURL: string, publicKey: string, options?: ClientRequestOptions) => MailingListClient;
|
|
3546
|
+
|
|
3547
|
+
declare function makeLoginUrl(apiUrl: string, redirectUrl?: string, appName?: string): string;
|
|
3419
3548
|
declare function makeCheckoutUrl(apiUrl: string, priceId: string, productId: string, discountCode?: string, loginUrl?: string, pricingUrl?: string, successUrl?: string): string;
|
|
3420
|
-
declare function makeRedirectIntent(redirectUrl: string): string;
|
|
3549
|
+
declare function makeRedirectIntent(redirectUrl: string, appName?: string): string;
|
|
3421
3550
|
|
|
3422
|
-
export { makeAppClient, makeCheckoutClient, makeCheckoutUrl, makeLoginUrl, makePublicClient, makeRedirectIntent, makeUsBetterAuthClient };
|
|
3423
|
-
export type { AppClient, CheckoutClient, PublicClient };
|
|
3551
|
+
export { makeAppClient, makeCheckoutClient, makeCheckoutUrl, makeLoginUrl, makeMailingListClient, makePublicClient, makeRedirectIntent, makeUsBetterAuthClient };
|
|
3552
|
+
export type { AppClient, CheckoutClient, MailingListClient, PublicClient };
|