@anker-in/lib 1.1.3 → 1.1.4
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/.turbo/turbo-build.log +7 -7
- package/dist/cjs/registration/hooks/useSubscriptions.d.ts +1 -12
- package/dist/cjs/registration/hooks/useSubscriptions.d.ts.map +1 -1
- package/dist/cjs/registration/hooks/useSubscriptions.js +1 -1
- package/dist/cjs/registration/hooks/useSubscriptions.js.map +3 -3
- package/dist/esm/registration/hooks/useSubscriptions.d.ts +1 -12
- package/dist/esm/registration/hooks/useSubscriptions.d.ts.map +1 -1
- package/dist/esm/registration/hooks/useSubscriptions.js +1 -1
- package/dist/esm/registration/hooks/useSubscriptions.js.map +3 -3
- package/package.json +1 -1
- package/src/registration/hooks/useSubscriptions.ts +14 -28
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
|
|
2
|
-
> @anker-in/lib@1.1.
|
|
2
|
+
> @anker-in/lib@1.1.3 build /Users/anker/Code/headless-ui/packages/lib
|
|
3
3
|
> pnpm run build:js:esm & pnpm run build:js:cjs & pnpm run build:types:esm & pnpm run build:types:cjs
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @anker-in/lib@1.1.
|
|
6
|
+
> @anker-in/lib@1.1.3 build:js:cjs /Users/anker/Code/headless-ui/packages/lib
|
|
7
7
|
> node esbuild-cjs.mjs
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
> @anker-in/lib@1.1.
|
|
10
|
+
> @anker-in/lib@1.1.3 build:js:esm /Users/anker/Code/headless-ui/packages/lib
|
|
11
11
|
> node esbuild-esm.mjs
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
> @anker-in/lib@1.1.
|
|
15
|
-
> tsc --outdir dist/
|
|
14
|
+
> @anker-in/lib@1.1.3 build:types:esm /Users/anker/Code/headless-ui/packages/lib
|
|
15
|
+
> tsc --outdir dist/esm
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
> @anker-in/lib@1.1.
|
|
19
|
-
> tsc --outdir dist/
|
|
18
|
+
> @anker-in/lib@1.1.3 build:types:cjs /Users/anker/Code/headless-ui/packages/lib
|
|
19
|
+
> tsc --outdir dist/cjs
|
|
20
20
|
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
import { SWRResponse } from 'swr';
|
|
2
|
-
export interface Subscription {
|
|
3
|
-
preference: {
|
|
4
|
-
subscribe: boolean;
|
|
5
|
-
brand: string;
|
|
6
|
-
}[];
|
|
7
|
-
}
|
|
8
|
-
export type SubscriptionApiResponse = {
|
|
9
|
-
data: Subscription;
|
|
10
|
-
};
|
|
11
|
-
export type FetchSubscriptionResponse = SWRResponse<Subscription>;
|
|
12
1
|
export declare function useSubscriptions({ email }: {
|
|
13
2
|
email?: string;
|
|
14
|
-
}):
|
|
3
|
+
}): import("swr").SWRResponse<any, any, any>;
|
|
15
4
|
//# sourceMappingURL=useSubscriptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSubscriptions.d.ts","sourceRoot":"","sources":["../../../../src/registration/hooks/useSubscriptions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSubscriptions.d.ts","sourceRoot":"","sources":["../../../../src/registration/hooks/useSubscriptions.ts"],"names":[],"mappings":"AAKA,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,4CAgB7D"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var a=Object.create;var i=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var b=(o,t)=>{for(var s in t)i(o,s,{get:t[s],enumerable:!0})},n=(o,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of l(t))!d.call(o,e)&&e!==s&&i(o,e,{get:()=>t[e],enumerable:!(r=m(t,e))||r.enumerable});return o};var h=(o,t,s)=>(s=o!=null?a(f(o)):{},n(t||!o||!o.__esModule?i(s,"default",{value:o,enumerable:!0}):s,o)),y=o=>n(i({},"__esModule",{value:!0}),o);var x={};b(x,{useSubscriptions:()=>g});module.exports=y(x);var c=h(require("swr")),u=require("../../context"),p=require("../../utils");function g({email:o}){const{locale:t}=(0,u.useHeadlessContext)();return(0,c.default)(o?["/api/multipass/account/subscriptions",o]:null,async([s,r])=>(0,p.fetcher)({method:"GET",url:s,body:{email:r},action:"login",locale:t,headers:{},type:""}))}
|
|
2
2
|
//# sourceMappingURL=useSubscriptions.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/registration/hooks/useSubscriptions.ts"],
|
|
4
|
-
"sourcesContent": ["import useSWR
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,
|
|
6
|
-
"names": ["useSubscriptions_exports", "__export", "useSubscriptions", "__toCommonJS", "import_swr", "import_context", "import_utils", "email", "locale", "
|
|
4
|
+
"sourcesContent": ["import useSWR from 'swr'\n\nimport { useHeadlessContext } from '../../context'\nimport { fetcher } from '../../utils'\n\nexport function useSubscriptions({ email }: { email?: string }) {\n const { locale } = useHeadlessContext()\n\n return useSWR(email ? ['/api/multipass/account/subscriptions', email] : null, async ([url, email]) =>\n fetcher({\n method: 'GET',\n url,\n body: {\n email,\n },\n action: 'login',\n locale,\n headers: {},\n type: '',\n })\n )\n}\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmB,kBAEnBC,EAAmC,yBACnCC,EAAwB,uBAEjB,SAASJ,EAAiB,CAAE,MAAAK,CAAM,EAAuB,CAC9D,KAAM,CAAE,OAAAC,CAAO,KAAI,sBAAmB,EAEtC,SAAO,EAAAC,SAAOF,EAAQ,CAAC,uCAAwCA,CAAK,EAAI,KAAM,MAAO,CAACG,EAAKH,CAAK,OAC9F,WAAQ,CACN,OAAQ,MACR,IAAAG,EACA,KAAM,CACJ,MAAAH,CACF,EACA,OAAQ,QACR,OAAAC,EACA,QAAS,CAAC,EACV,KAAM,EACR,CAAC,CACH,CACF",
|
|
6
|
+
"names": ["useSubscriptions_exports", "__export", "useSubscriptions", "__toCommonJS", "import_swr", "import_context", "import_utils", "email", "locale", "useSWR", "url"]
|
|
7
7
|
}
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
import { SWRResponse } from 'swr';
|
|
2
|
-
export interface Subscription {
|
|
3
|
-
preference: {
|
|
4
|
-
subscribe: boolean;
|
|
5
|
-
brand: string;
|
|
6
|
-
}[];
|
|
7
|
-
}
|
|
8
|
-
export type SubscriptionApiResponse = {
|
|
9
|
-
data: Subscription;
|
|
10
|
-
};
|
|
11
|
-
export type FetchSubscriptionResponse = SWRResponse<Subscription>;
|
|
12
1
|
export declare function useSubscriptions({ email }: {
|
|
13
2
|
email?: string;
|
|
14
|
-
}):
|
|
3
|
+
}): import("swr").SWRResponse<any, any, any>;
|
|
15
4
|
//# sourceMappingURL=useSubscriptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSubscriptions.d.ts","sourceRoot":"","sources":["../../../../src/registration/hooks/useSubscriptions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSubscriptions.d.ts","sourceRoot":"","sources":["../../../../src/registration/hooks/useSubscriptions.ts"],"names":[],"mappings":"AAKA,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,4CAgB7D"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r from"swr";import{useHeadlessContext as i}from"../../context";import{fetcher as n}from"../../utils";function a({email:o}){const{locale:t}=i();return r(o?["/api/multipass/account/subscriptions",o]:null,async([s,e])=>n({method:"GET",url:s,body:{email:e},action:"login",locale:t,headers:{},type:""}))}export{a as useSubscriptions};
|
|
2
2
|
//# sourceMappingURL=useSubscriptions.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/registration/hooks/useSubscriptions.ts"],
|
|
4
|
-
"sourcesContent": ["import useSWR
|
|
5
|
-
"mappings": "AAAA,OAAOA,
|
|
6
|
-
"names": ["useSWR", "useHeadlessContext", "fetcher", "useSubscriptions", "email", "locale", "
|
|
4
|
+
"sourcesContent": ["import useSWR from 'swr'\n\nimport { useHeadlessContext } from '../../context'\nimport { fetcher } from '../../utils'\n\nexport function useSubscriptions({ email }: { email?: string }) {\n const { locale } = useHeadlessContext()\n\n return useSWR(email ? ['/api/multipass/account/subscriptions', email] : null, async ([url, email]) =>\n fetcher({\n method: 'GET',\n url,\n body: {\n email,\n },\n action: 'login',\n locale,\n headers: {},\n type: '',\n })\n )\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAOA,MAAY,MAEnB,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,WAAAC,MAAe,cAEjB,SAASC,EAAiB,CAAE,MAAAC,CAAM,EAAuB,CAC9D,KAAM,CAAE,OAAAC,CAAO,EAAIJ,EAAmB,EAEtC,OAAOD,EAAOI,EAAQ,CAAC,uCAAwCA,CAAK,EAAI,KAAM,MAAO,CAACE,EAAKF,CAAK,IAC9FF,EAAQ,CACN,OAAQ,MACR,IAAAI,EACA,KAAM,CACJ,MAAAF,CACF,EACA,OAAQ,QACR,OAAAC,EACA,QAAS,CAAC,EACV,KAAM,EACR,CAAC,CACH,CACF",
|
|
6
|
+
"names": ["useSWR", "useHeadlessContext", "fetcher", "useSubscriptions", "email", "locale", "url"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,36 +1,22 @@
|
|
|
1
|
-
import useSWR
|
|
1
|
+
import useSWR from 'swr'
|
|
2
2
|
|
|
3
3
|
import { useHeadlessContext } from '../../context'
|
|
4
4
|
import { fetcher } from '../../utils'
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
preference: {
|
|
8
|
-
subscribe: boolean
|
|
9
|
-
brand: string
|
|
10
|
-
}[]
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type SubscriptionApiResponse = { data: Subscription }
|
|
14
|
-
export type FetchSubscriptionResponse = SWRResponse<Subscription>
|
|
15
|
-
|
|
16
|
-
export function useSubscriptions({ email }: { email?: string }): FetchSubscriptionResponse {
|
|
6
|
+
export function useSubscriptions({ email }: { email?: string }) {
|
|
17
7
|
const { locale } = useHeadlessContext()
|
|
18
8
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
type: '',
|
|
32
|
-
})
|
|
9
|
+
return useSWR(email ? ['/api/multipass/account/subscriptions', email] : null, async ([url, email]) =>
|
|
10
|
+
fetcher({
|
|
11
|
+
method: 'GET',
|
|
12
|
+
url,
|
|
13
|
+
body: {
|
|
14
|
+
email,
|
|
15
|
+
},
|
|
16
|
+
action: 'login',
|
|
17
|
+
locale,
|
|
18
|
+
headers: {},
|
|
19
|
+
type: '',
|
|
20
|
+
})
|
|
33
21
|
)
|
|
34
|
-
|
|
35
|
-
return { data: data?.data, ...rest } as unknown as FetchSubscriptionResponse
|
|
36
22
|
}
|