@intoss/shared 0.0.6 → 0.0.7
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/index.cjs +1 -1
- package/dist/index.d.cts +97 -7
- package/dist/index.d.ts +97 -7
- package/dist/index.js +1 -1
- package/package.json +1 -71
- package/dist/advertisement/index.cjs +0 -1
- package/dist/advertisement/index.d.cts +0 -30
- package/dist/advertisement/index.d.ts +0 -30
- package/dist/advertisement/index.js +0 -1
- package/dist/auth-state/index.cjs +0 -1
- package/dist/auth-state/index.d.cts +0 -20
- package/dist/auth-state/index.d.ts +0 -20
- package/dist/auth-state/index.js +0 -1
- package/dist/calendar/index.cjs +0 -1
- package/dist/calendar/index.d.cts +0 -11
- package/dist/calendar/index.d.ts +0 -11
- package/dist/calendar/index.js +0 -1
- package/dist/chunk-5USVVOWK.js +0 -1
- package/dist/chunk-AWNNY7AC.js +0 -1
- package/dist/chunk-BNFSLIDD.js +0 -1
- package/dist/chunk-IMEAYFIW.js +0 -1
- package/dist/chunk-LUKG4S33.js +0 -1
- package/dist/chunk-WCRBLSWN.js +0 -1
- package/dist/config/index.cjs +0 -1
- package/dist/config/index.d.cts +0 -12
- package/dist/config/index.d.ts +0 -12
- package/dist/config/index.js +0 -1
- package/dist/query/index.cjs +0 -1
- package/dist/query/index.d.cts +0 -24
- package/dist/query/index.d.ts +0 -24
- package/dist/query/index.js +0 -1
- package/dist/storage/index.cjs +0 -1
- package/dist/storage/index.d.cts +0 -3
- package/dist/storage/index.d.ts +0 -3
- package/dist/storage/index.js +0 -1
- package/dist/view-model/index.cjs +0 -1
- package/dist/view-model/index.d.cts +0 -11
- package/dist/view-model/index.d.ts +0 -11
- package/dist/view-model/index.js +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var b=Object.defineProperty;var he=Object.getOwnPropertyDescriptor;var xe=Object.getOwnPropertyNames;var Ce=Object.prototype.hasOwnProperty;var Pe=(e,t)=>{for(var o in t)b(e,o,{get:t[o],enumerable:!0})},Se=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of xe(t))!Ce.call(e,r)&&r!==o&&b(e,r,{get:()=>t[r],enumerable:!(s=he(t,r))||s.enumerable});return e};var ye=e=>Se(b({},"__esModule",{value:!0}),e);var ve={};Pe(ve,{AdGroupProvider:()=>O,AuthStateProvider:()=>L,ConfigProvider:()=>N,FetcherProvider:()=>D,QueryProvider:()=>G,bind:()=>w,calculateDay:()=>Y,calculateDayOfWeek:()=>Q,calculateHour:()=>U,calculateMinute:()=>q,calculateWeek:()=>H,useAdGroup:()=>W,useAdvertisement:()=>K,useAuthState:()=>M,useConfig:()=>g,useFetcher:()=>h,useSignInWithToss:()=>z,useStorage:()=>B});module.exports=ye(ve);var C=require("react");var V=require("@apps-in-toss/framework"),k=(0,V.getOperationalEnvironment)()==="sandbox"?"local":(0,V.getSchemeUri)().startsWith("intoss-private")?"preview":"production",X={local:"http://localhost:3000",preview:"https://preview-api.intoss.app",production:"https://api.intoss.app"}[k];var j=require("react/jsx-runtime"),Z=(0,C.createContext)({appName:"",apiEndpoint:"http://localhost:3000",runningEnvironment:"local"}),N=({appName:e,children:t})=>{let o=(0,C.useMemo)(()=>({appName:e,apiEndpoint:X,runningEnvironment:k}),[e]);return(0,j.jsx)(Z.Provider,{value:o,children:t})},g=()=>(0,C.useContext)(Z);var a=require("react"),te=require("react/jsx-runtime"),ee=(0,a.createContext)({getInterstitialAdGroupId:()=>"ait-ad-test-interstitial-id",getRewardedAdGroupId:()=>"ait-ad-test-rewarded-id"}),O=({initial:e,children:t})=>{let{appName:o,runningEnvironment:s}=g(),[r,i]=(0,a.useState)(s!=="production"),[n,p]=(0,a.useState)(e),l=(0,a.useCallback)(d=>n[d]??"ait-ad-test-interstitial-id",[n]),f=(0,a.useCallback)(d=>n[d]??"ait-ad-test-rewarded-id",[n]),m=(0,a.useMemo)(()=>({getInterstitialAdGroupId:l,getRewardedAdGroupId:f}),[l,f]);return(0,a.useEffect)(()=>{if(r)return;let d=new AbortController,S=setTimeout(()=>d.abort(),3e3);fetch(`https://static.intoss.app/${o}/assets/adGroupList.json`,{signal:d.signal}).then(F=>F.json()).then(p).finally(()=>{clearTimeout(S),i(!0)})},[o,r]),r?(0,te.jsx)(ee.Provider,{value:m,children:t}):null},W=()=>(0,a.useContext)(ee);var v=require("@apps-in-toss/framework"),u=require("react"),K=({primaryAdGroup:e,secondaryAdGroup:t,onShowAd:o,onDissmissAd:s})=>{let[r,i]=(0,u.useState)(!1),[n,p]=(0,u.useState)(!1),[l,f]=(0,u.useState)(),[m,d]=(0,u.useState)(null),S=(0,u.useCallback)(E=>new Promise(_=>{let A=v.GoogleAdMob.loadAppsInTossAdMob({options:{adGroupId:E},onEvent:I=>{switch(I.type){case"loaded":_([!0,A]);break}},onError:()=>_([!1,A])})}),[]),F=(0,u.useCallback)(async()=>{if(v.GoogleAdMob.loadAppsInTossAdMob.isSupported()!==!0){i(!0);return}if(n)return;let[E,_]=await S(e.id);if(E){i(!0),p(!0),f(e.id),d(()=>_);return}if(_(),!t){i(!0);return}let[A,I]=await S(t.id);if(A){i(!0),p(!0),f(t.id),d(()=>I);return}I(),i(!0)},[e,t,n,S]),y=(0,u.useCallback)(()=>{m?.(),p(!1),f(void 0),d(null)},[m]),ge=(0,u.useCallback)(()=>{if(v.GoogleAdMob.loadAppsInTossAdMob.isSupported()!==!0){o?.(),s?.();return}if(!n||!l){o?.(),s?.();return}v.GoogleAdMob.showAppsInTossAdMob({options:{adGroupId:l},onEvent:E=>{switch(E.type){case"show":(l===e.id&&e.type==="interstitial"||l===t?.id&&t.type==="interstitial")&&o?.();break;case"failedToShow":o?.(),y();break;case"dismissed":s?.(),y();break;case"userEarnedReward":o?.();break}},onError:()=>{o?.(),y()}})},[n,l,e,t,o,s,y]);return(0,u.useEffect)(()=>{l||F()},[l,F]),(0,u.useEffect)(()=>()=>y(),[]),{initialized:r,adLoaded:n,showAd:ge}};var oe=require("@tanstack/react-query"),P=require("react"),ne=require("react/jsx-runtime"),re=(0,P.createContext)({isPreparing:!0,isLoggedIn:!1,retry:()=>Promise.resolve()}),L=({children:e})=>{let{data:t,isFetching:o,refetch:s}=(0,oe.useQuery)({queryKey:["/my/user"]}),r=(0,P.useMemo)(()=>({isPreparing:o,isLoggedIn:!!t?.user?.id,retry:s}),[t,o,s]);return(0,ne.jsx)(re.Provider,{value:r,children:e})},M=()=>(0,P.useContext)(re);var R=require("@apps-in-toss/framework");var se=require("@apps-in-toss/framework");var c=require("react"),ae=require("react/jsx-runtime"),Ee="@auth/token",ie=(0,c.createContext)({fetcher:fetch,setToken:()=>null}),D=({baseUrl:e,children:t})=>{let{appName:o,apiEndpoint:s}=g(),[r,i]=(0,c.useState)(null),[n,p]=(0,c.useState)(!1),l=(0,c.useCallback)((f,m)=>fetch(`${e??s}/${o}${f}`,{...m,headers:{...m?.headers,...r?{Authorization:`Bearer ${r}`}:{}}}).then(d=>d.json()),[o,s,r,e]);return(0,c.useEffect)(()=>{se.Storage.getItem(Ee).then(i).finally(()=>p(!0))},[]),(0,ae.jsx)(ie.Provider,{value:{fetcher:l,setToken:i},children:n?t:null})},h=()=>(0,c.useContext)(ie);var T=require("react"),w=(e,t,o)=>{let{displayName:s}=o??{},r=(0,T.memo)(t),i=(0,T.memo)(n=>(0,T.createElement)(r,e(n)));return i.ViewComponent=r,s&&(i.displayName=s,i.ViewComponent.displayName=`${s}View`),i};var de=require("@tanstack/react-query");var ue=require("@tanstack/react-query"),pe=require("react");var le=({children:e})=>{let{fetcher:t}=h();return{queryClient:(0,pe.useMemo)(()=>new ue.QueryClient({defaultOptions:{queries:{queryFn:({queryKey:s})=>t(s[0])}}}),[t]),children:e}};var ce=require("react/jsx-runtime"),G=w(le,({queryClient:e,children:t})=>(0,ce.jsx)(de.QueryClientProvider,{client:e,children:t}));var fe=require("@tanstack/react-query"),me=require("react");var _e="@auth/token",z=({onSuccess:e})=>{let{retry:t}=M(),{fetcher:o,setToken:s}=h(),r=(0,fe.useMutation)({mutationFn:async n=>o("/my/sessions",{method:"POST",body:JSON.stringify(n)}),onSuccess:async n=>{s(n.token),await R.Storage.setItem(_e,n.token),await t(),e?.()}});return{signInWithToss:(0,me.useCallback)(async()=>{let{authorizationCode:n,referrer:p}=await(0,R.appLogin)();r.mutate({authorizationCode:n,referrer:p})},[r]),isLoading:r.isPending}};var Y=e=>Math.floor((e+324e5)/864e5);var Q=e=>(e+3)%7;var U=e=>Math.floor((e+324e5)%864e5/36e5);var q=e=>Math.floor((e+324e5)%36e5/6e4);var H=e=>Math.floor((e+3)/7);var $=require("@apps-in-toss/framework"),x=require("react"),J=require("react-native"),B=e=>{let[t,o]=(0,x.useState)(),[s,r]=(0,x.useState)(!0),i=(0,x.useCallback)(n=>(o(n),J.DeviceEventEmitter.emit(e,n),$.Storage.setItem(e,JSON.stringify({value:n}))),[e]);return(0,x.useEffect)(()=>{r(!0),$.Storage.getItem(e).then(p=>{try{o(p===null?void 0:JSON.parse(p).value)}catch{o(void 0)}finally{r(!1)}});let n=J.DeviceEventEmitter.addListener(e,o);return()=>n.remove()},[e]),[t,i,s]};0&&(module.exports={AdGroupProvider,AuthStateProvider,ConfigProvider,FetcherProvider,QueryProvider,bind,calculateDay,calculateDayOfWeek,calculateHour,calculateMinute,calculateWeek,useAdGroup,useAdvertisement,useAuthState,useConfig,useFetcher,useSignInWithToss,useStorage});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,97 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { FC, PropsWithChildren } from 'react';
|
|
3
|
+
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
4
|
+
|
|
5
|
+
type Props$5 = PropsWithChildren<{
|
|
6
|
+
initial: Record<string, string>;
|
|
7
|
+
}>;
|
|
8
|
+
declare const AdGroupProvider: FC<Props$5>;
|
|
9
|
+
declare const useAdGroup: () => {
|
|
10
|
+
getInterstitialAdGroupId: (key: string) => string;
|
|
11
|
+
getRewardedAdGroupId: (key: string) => string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type Props$4 = {
|
|
15
|
+
primaryAdGroup: {
|
|
16
|
+
id: string;
|
|
17
|
+
type: "rewarded" | "interstitial";
|
|
18
|
+
};
|
|
19
|
+
secondaryAdGroup?: {
|
|
20
|
+
id: string;
|
|
21
|
+
type: "rewarded" | "interstitial";
|
|
22
|
+
};
|
|
23
|
+
onShowAd?: () => void;
|
|
24
|
+
onDissmissAd?: () => void;
|
|
25
|
+
};
|
|
26
|
+
declare const useAdvertisement: ({ primaryAdGroup, secondaryAdGroup, onShowAd, onDissmissAd, }: Props$4) => {
|
|
27
|
+
initialized: boolean;
|
|
28
|
+
adLoaded: boolean;
|
|
29
|
+
showAd: () => void;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
type AuthStateContextValues = {
|
|
33
|
+
isPreparing: boolean;
|
|
34
|
+
isLoggedIn: boolean;
|
|
35
|
+
retry: () => Promise<unknown>;
|
|
36
|
+
};
|
|
37
|
+
type Props$3 = PropsWithChildren<unknown>;
|
|
38
|
+
declare const AuthStateProvider: FC<Props$3>;
|
|
39
|
+
declare const useAuthState: () => AuthStateContextValues;
|
|
40
|
+
|
|
41
|
+
type Props$2 = {
|
|
42
|
+
onSuccess?: () => void;
|
|
43
|
+
};
|
|
44
|
+
declare const useSignInWithToss: ({ onSuccess }: Props$2) => {
|
|
45
|
+
signInWithToss: () => Promise<void>;
|
|
46
|
+
isLoading: boolean;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
declare const calculateDay: (timestamp: number) => number;
|
|
50
|
+
|
|
51
|
+
declare const calculateDayOfWeek: (day: number) => number;
|
|
52
|
+
|
|
53
|
+
declare const calculateHour: (timestamp: number) => number;
|
|
54
|
+
|
|
55
|
+
declare const calculateMinute: (timestamp: number) => number;
|
|
56
|
+
|
|
57
|
+
declare const calculateWeek: (day: number) => number;
|
|
58
|
+
|
|
59
|
+
type ConfigContextValues = {
|
|
60
|
+
appName: string;
|
|
61
|
+
apiEndpoint: string;
|
|
62
|
+
runningEnvironment: "local" | "preview" | "production";
|
|
63
|
+
};
|
|
64
|
+
type Props$1 = PropsWithChildren<Pick<ConfigContextValues, "appName">>;
|
|
65
|
+
declare const ConfigProvider: FC<Props$1>;
|
|
66
|
+
declare const useConfig: () => ConfigContextValues;
|
|
67
|
+
|
|
68
|
+
type FetcherContextValues = {
|
|
69
|
+
fetcher: <T = Record<string, string>>(...args: Parameters<typeof fetch>) => Promise<T>;
|
|
70
|
+
setToken: (value: string) => void;
|
|
71
|
+
};
|
|
72
|
+
type Props = PropsWithChildren<{
|
|
73
|
+
baseUrl?: string;
|
|
74
|
+
}>;
|
|
75
|
+
declare const FetcherProvider: FC<Props>;
|
|
76
|
+
declare const useFetcher: () => FetcherContextValues;
|
|
77
|
+
|
|
78
|
+
declare const QueryProvider: react.FC<{
|
|
79
|
+
children?: react.ReactNode | undefined;
|
|
80
|
+
}> & {
|
|
81
|
+
ViewComponent: react.FC<{
|
|
82
|
+
queryClient: _tanstack_query_core.QueryClient;
|
|
83
|
+
children: react.ReactNode;
|
|
84
|
+
} & Record<string, unknown>>;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
declare const useStorage: <Value>(key: string) => [Value | undefined, (value: Value) => Promise<void>, boolean];
|
|
88
|
+
|
|
89
|
+
type ViewModelType<ViewModelProps, ViewModelResult> = (props: ViewModelProps) => ViewModelResult;
|
|
90
|
+
type Options = {
|
|
91
|
+
displayName?: string;
|
|
92
|
+
};
|
|
93
|
+
declare const bind: <ViewModelProps extends Record<string, unknown>, ViewModelResult>(useViewModel: ViewModelType<ViewModelProps, ViewModelResult>, ViewComponent: FC<ViewModelResult>, options?: Options) => FC<ViewModelProps> & {
|
|
94
|
+
ViewComponent: FC<ViewModelResult & Record<string, unknown>>;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export { AdGroupProvider, type AuthStateContextValues, AuthStateProvider, ConfigProvider, FetcherProvider, QueryProvider, bind, calculateDay, calculateDayOfWeek, calculateHour, calculateMinute, calculateWeek, useAdGroup, useAdvertisement, useAuthState, useConfig, useFetcher, useSignInWithToss, useStorage };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,97 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { FC, PropsWithChildren } from 'react';
|
|
3
|
+
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
4
|
+
|
|
5
|
+
type Props$5 = PropsWithChildren<{
|
|
6
|
+
initial: Record<string, string>;
|
|
7
|
+
}>;
|
|
8
|
+
declare const AdGroupProvider: FC<Props$5>;
|
|
9
|
+
declare const useAdGroup: () => {
|
|
10
|
+
getInterstitialAdGroupId: (key: string) => string;
|
|
11
|
+
getRewardedAdGroupId: (key: string) => string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type Props$4 = {
|
|
15
|
+
primaryAdGroup: {
|
|
16
|
+
id: string;
|
|
17
|
+
type: "rewarded" | "interstitial";
|
|
18
|
+
};
|
|
19
|
+
secondaryAdGroup?: {
|
|
20
|
+
id: string;
|
|
21
|
+
type: "rewarded" | "interstitial";
|
|
22
|
+
};
|
|
23
|
+
onShowAd?: () => void;
|
|
24
|
+
onDissmissAd?: () => void;
|
|
25
|
+
};
|
|
26
|
+
declare const useAdvertisement: ({ primaryAdGroup, secondaryAdGroup, onShowAd, onDissmissAd, }: Props$4) => {
|
|
27
|
+
initialized: boolean;
|
|
28
|
+
adLoaded: boolean;
|
|
29
|
+
showAd: () => void;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
type AuthStateContextValues = {
|
|
33
|
+
isPreparing: boolean;
|
|
34
|
+
isLoggedIn: boolean;
|
|
35
|
+
retry: () => Promise<unknown>;
|
|
36
|
+
};
|
|
37
|
+
type Props$3 = PropsWithChildren<unknown>;
|
|
38
|
+
declare const AuthStateProvider: FC<Props$3>;
|
|
39
|
+
declare const useAuthState: () => AuthStateContextValues;
|
|
40
|
+
|
|
41
|
+
type Props$2 = {
|
|
42
|
+
onSuccess?: () => void;
|
|
43
|
+
};
|
|
44
|
+
declare const useSignInWithToss: ({ onSuccess }: Props$2) => {
|
|
45
|
+
signInWithToss: () => Promise<void>;
|
|
46
|
+
isLoading: boolean;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
declare const calculateDay: (timestamp: number) => number;
|
|
50
|
+
|
|
51
|
+
declare const calculateDayOfWeek: (day: number) => number;
|
|
52
|
+
|
|
53
|
+
declare const calculateHour: (timestamp: number) => number;
|
|
54
|
+
|
|
55
|
+
declare const calculateMinute: (timestamp: number) => number;
|
|
56
|
+
|
|
57
|
+
declare const calculateWeek: (day: number) => number;
|
|
58
|
+
|
|
59
|
+
type ConfigContextValues = {
|
|
60
|
+
appName: string;
|
|
61
|
+
apiEndpoint: string;
|
|
62
|
+
runningEnvironment: "local" | "preview" | "production";
|
|
63
|
+
};
|
|
64
|
+
type Props$1 = PropsWithChildren<Pick<ConfigContextValues, "appName">>;
|
|
65
|
+
declare const ConfigProvider: FC<Props$1>;
|
|
66
|
+
declare const useConfig: () => ConfigContextValues;
|
|
67
|
+
|
|
68
|
+
type FetcherContextValues = {
|
|
69
|
+
fetcher: <T = Record<string, string>>(...args: Parameters<typeof fetch>) => Promise<T>;
|
|
70
|
+
setToken: (value: string) => void;
|
|
71
|
+
};
|
|
72
|
+
type Props = PropsWithChildren<{
|
|
73
|
+
baseUrl?: string;
|
|
74
|
+
}>;
|
|
75
|
+
declare const FetcherProvider: FC<Props>;
|
|
76
|
+
declare const useFetcher: () => FetcherContextValues;
|
|
77
|
+
|
|
78
|
+
declare const QueryProvider: react.FC<{
|
|
79
|
+
children?: react.ReactNode | undefined;
|
|
80
|
+
}> & {
|
|
81
|
+
ViewComponent: react.FC<{
|
|
82
|
+
queryClient: _tanstack_query_core.QueryClient;
|
|
83
|
+
children: react.ReactNode;
|
|
84
|
+
} & Record<string, unknown>>;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
declare const useStorage: <Value>(key: string) => [Value | undefined, (value: Value) => Promise<void>, boolean];
|
|
88
|
+
|
|
89
|
+
type ViewModelType<ViewModelProps, ViewModelResult> = (props: ViewModelProps) => ViewModelResult;
|
|
90
|
+
type Options = {
|
|
91
|
+
displayName?: string;
|
|
92
|
+
};
|
|
93
|
+
declare const bind: <ViewModelProps extends Record<string, unknown>, ViewModelResult>(useViewModel: ViewModelType<ViewModelProps, ViewModelResult>, ViewComponent: FC<ViewModelResult>, options?: Options) => FC<ViewModelProps> & {
|
|
94
|
+
ViewComponent: FC<ViewModelResult & Record<string, unknown>>;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export { AdGroupProvider, type AuthStateContextValues, AuthStateProvider, ConfigProvider, FetcherProvider, QueryProvider, bind, calculateDay, calculateDayOfWeek, calculateHour, calculateMinute, calculateWeek, useAdGroup, useAdvertisement, useAuthState, useConfig, useFetcher, useSignInWithToss, useStorage };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{createContext as ne,useContext as se,useMemo as ie}from"react";import{getOperationalEnvironment as oe,getSchemeUri as re}from"@apps-in-toss/framework";var T=oe()==="sandbox"?"local":re().startsWith("intoss-private")?"preview":"production",w={local:"http://localhost:3000",preview:"https://preview-api.intoss.app",production:"https://api.intoss.app"}[T];import{jsx as ae}from"react/jsx-runtime";var F=ne({appName:"",apiEndpoint:"http://localhost:3000",runningEnvironment:"local"}),A=({appName:e,children:o})=>{let t=ie(()=>({appName:e,apiEndpoint:w,runningEnvironment:T}),[e]);return ae(F.Provider,{value:t,children:o})},c=()=>se(F);import{createContext as ue,useCallback as I,useContext as pe,useEffect as le,useMemo as de,useState as V}from"react";import{jsx as ce}from"react/jsx-runtime";var R=ue({getInterstitialAdGroupId:()=>"ait-ad-test-interstitial-id",getRewardedAdGroupId:()=>"ait-ad-test-rewarded-id"}),b=({initial:e,children:o})=>{let{appName:t,runningEnvironment:n}=c(),[s,i]=V(n!=="production"),[r,a]=V(e),u=I(p=>r[p]??"ait-ad-test-interstitial-id",[r]),l=I(p=>r[p]??"ait-ad-test-rewarded-id",[r]),d=de(()=>({getInterstitialAdGroupId:u,getRewardedAdGroupId:l}),[u,l]);return le(()=>{if(s)return;let p=new AbortController,m=setTimeout(()=>p.abort(),3e3);fetch(`https://static.intoss.app/${t}/assets/adGroupList.json`,{signal:p.signal}).then(C=>C.json()).then(a).finally(()=>{clearTimeout(m),i(!0)})},[t,s]),s?ce(R.Provider,{value:d,children:o}):null},k=()=>pe(R);import{GoogleAdMob as y}from"@apps-in-toss/framework";import{useCallback as E,useEffect as N,useState as _}from"react";var O=({primaryAdGroup:e,secondaryAdGroup:o,onShowAd:t,onDissmissAd:n})=>{let[s,i]=_(!1),[r,a]=_(!1),[u,l]=_(),[d,p]=_(null),m=E(h=>new Promise(x=>{let P=y.loadAppsInTossAdMob({options:{adGroupId:h},onEvent:S=>{switch(S.type){case"loaded":x([!0,P]);break}},onError:()=>x([!1,P])})}),[]),C=E(async()=>{if(y.loadAppsInTossAdMob.isSupported()!==!0){i(!0);return}if(r)return;let[h,x]=await m(e.id);if(h){i(!0),a(!0),l(e.id),p(()=>x);return}if(x(),!o){i(!0);return}let[P,S]=await m(o.id);if(P){i(!0),a(!0),l(o.id),p(()=>S);return}S(),i(!0)},[e,o,r,m]),g=E(()=>{d?.(),a(!1),l(void 0),p(null)},[d]),te=E(()=>{if(y.loadAppsInTossAdMob.isSupported()!==!0){t?.(),n?.();return}if(!r||!u){t?.(),n?.();return}y.showAppsInTossAdMob({options:{adGroupId:u},onEvent:h=>{switch(h.type){case"show":(u===e.id&&e.type==="interstitial"||u===o?.id&&o.type==="interstitial")&&t?.();break;case"failedToShow":t?.(),g();break;case"dismissed":n?.(),g();break;case"userEarnedReward":t?.();break}},onError:()=>{t?.(),g()}})},[r,u,e,o,t,n,g]);return N(()=>{u||C()},[u,C]),N(()=>()=>g(),[]),{initialized:s,adLoaded:r,showAd:te}};import{useQuery as fe}from"@tanstack/react-query";import{createContext as me,useContext as ge,useMemo as he}from"react";import{jsx as xe}from"react/jsx-runtime";var W=me({isPreparing:!0,isLoggedIn:!1,retry:()=>Promise.resolve()}),K=({children:e})=>{let{data:o,isFetching:t,refetch:n}=fe({queryKey:["/my/user"]}),s=he(()=>({isPreparing:t,isLoggedIn:!!o?.user?.id,retry:n}),[o,t,n]);return xe(W.Provider,{value:s,children:e})},v=()=>ge(W);import{appLogin as Ie,Storage as Ve}from"@apps-in-toss/framework";import{Storage as Ce}from"@apps-in-toss/framework";import{createContext as Pe,useCallback as Se,useContext as ye,useEffect as Ee,useState as L}from"react";import{jsx as ve}from"react/jsx-runtime";var _e="@auth/token",D=Pe({fetcher:fetch,setToken:()=>null}),G=({baseUrl:e,children:o})=>{let{appName:t,apiEndpoint:n}=c(),[s,i]=L(null),[r,a]=L(!1),u=Se((l,d)=>fetch(`${e??n}/${t}${l}`,{...d,headers:{...d?.headers,...s?{Authorization:`Bearer ${s}`}:{}}}).then(p=>p.json()),[t,n,s,e]);return Ee(()=>{Ce.getItem(_e).then(i).finally(()=>a(!0))},[]),ve(D.Provider,{value:{fetcher:u,setToken:i},children:r?o:null})},f=()=>ye(D);import{createElement as Me,memo as z}from"react";var M=(e,o,t)=>{let{displayName:n}=t??{},s=z(o),i=z(r=>Me(s,e(r)));return i.ViewComponent=s,n&&(i.displayName=n,i.ViewComponent.displayName=`${n}View`),i};import{QueryClientProvider as Fe}from"@tanstack/react-query";import{QueryClient as Te}from"@tanstack/react-query";import{useMemo as we}from"react";var Y=({children:e})=>{let{fetcher:o}=f();return{queryClient:we(()=>new Te({defaultOptions:{queries:{queryFn:({queryKey:n})=>o(n[0])}}}),[o]),children:e}};import{jsx as Ae}from"react/jsx-runtime";var Q=M(Y,({queryClient:e,children:o})=>Ae(Fe,{client:e,children:o}));import{useMutation as Re}from"@tanstack/react-query";import{useCallback as be}from"react";var ke="@auth/token",U=({onSuccess:e})=>{let{retry:o}=v(),{fetcher:t,setToken:n}=f(),s=Re({mutationFn:async r=>t("/my/sessions",{method:"POST",body:JSON.stringify(r)}),onSuccess:async r=>{n(r.token),await Ve.setItem(ke,r.token),await o(),e?.()}});return{signInWithToss:be(async()=>{let{authorizationCode:r,referrer:a}=await Ie();s.mutate({authorizationCode:r,referrer:a})},[s]),isLoading:s.isPending}};var q=e=>Math.floor((e+324e5)/864e5);var H=e=>(e+3)%7;var $=e=>Math.floor((e+324e5)%864e5/36e5);var J=e=>Math.floor((e+324e5)%36e5/6e4);var B=e=>Math.floor((e+3)/7);import{Storage as X}from"@apps-in-toss/framework";import{useCallback as Ne,useEffect as Oe,useState as Z}from"react";import{DeviceEventEmitter as j}from"react-native";var ee=e=>{let[o,t]=Z(),[n,s]=Z(!0),i=Ne(r=>(t(r),j.emit(e,r),X.setItem(e,JSON.stringify({value:r}))),[e]);return Oe(()=>{s(!0),X.getItem(e).then(a=>{try{t(a===null?void 0:JSON.parse(a).value)}catch{t(void 0)}finally{s(!1)}});let r=j.addListener(e,t);return()=>r.remove()},[e]),[o,i,n]};export{b as AdGroupProvider,K as AuthStateProvider,A as ConfigProvider,G as FetcherProvider,Q as QueryProvider,M as bind,q as calculateDay,H as calculateDayOfWeek,$ as calculateHour,J as calculateMinute,B as calculateWeek,k as useAdGroup,O as useAdvertisement,v as useAuthState,c as useConfig,f as useFetcher,U as useSignInWithToss,ee as useStorage};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intoss/shared",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -16,76 +16,6 @@
|
|
|
16
16
|
"default": "./dist/index.cjs"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
|
-
"./advertisement": {
|
|
20
|
-
"import": {
|
|
21
|
-
"types": "./dist/advertisement/index.d.ts",
|
|
22
|
-
"default": "./dist/advertisement/index.js"
|
|
23
|
-
},
|
|
24
|
-
"require": {
|
|
25
|
-
"types": "./dist/advertisement/index.d.cts",
|
|
26
|
-
"default": "./dist/advertisement/index.cjs"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"./auth-state": {
|
|
30
|
-
"import": {
|
|
31
|
-
"types": "./dist/auth-state/index.d.ts",
|
|
32
|
-
"default": "./dist/auth-state/index.js"
|
|
33
|
-
},
|
|
34
|
-
"require": {
|
|
35
|
-
"types": "./dist/auth-state/index.d.cts",
|
|
36
|
-
"default": "./dist/auth-state/index.cjs"
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"./calendar": {
|
|
40
|
-
"import": {
|
|
41
|
-
"types": "./dist/calendar/index.d.ts",
|
|
42
|
-
"default": "./dist/calendar/index.js"
|
|
43
|
-
},
|
|
44
|
-
"require": {
|
|
45
|
-
"types": "./dist/calendar/index.d.cts",
|
|
46
|
-
"default": "./dist/calendar/index.cjs"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
"./config": {
|
|
50
|
-
"import": {
|
|
51
|
-
"types": "./dist/config/index.d.ts",
|
|
52
|
-
"default": "./dist/config/index.js"
|
|
53
|
-
},
|
|
54
|
-
"require": {
|
|
55
|
-
"types": "./dist/config/index.d.cts",
|
|
56
|
-
"default": "./dist/config/index.cjs"
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
"./query": {
|
|
60
|
-
"import": {
|
|
61
|
-
"types": "./dist/query/index.d.ts",
|
|
62
|
-
"default": "./dist/query/index.js"
|
|
63
|
-
},
|
|
64
|
-
"require": {
|
|
65
|
-
"types": "./dist/query/index.d.cts",
|
|
66
|
-
"default": "./dist/query/index.cjs"
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"./storage": {
|
|
70
|
-
"import": {
|
|
71
|
-
"types": "./dist/storage/index.d.ts",
|
|
72
|
-
"default": "./dist/storage/index.js"
|
|
73
|
-
},
|
|
74
|
-
"require": {
|
|
75
|
-
"types": "./dist/storage/index.d.cts",
|
|
76
|
-
"default": "./dist/storage/index.cjs"
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
"./view-model": {
|
|
80
|
-
"import": {
|
|
81
|
-
"types": "./dist/view-model/index.d.ts",
|
|
82
|
-
"default": "./dist/view-model/index.js"
|
|
83
|
-
},
|
|
84
|
-
"require": {
|
|
85
|
-
"types": "./dist/view-model/index.d.cts",
|
|
86
|
-
"default": "./dist/view-model/index.cjs"
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
19
|
"./package.json": "./package.json"
|
|
90
20
|
},
|
|
91
21
|
"files": [
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var w=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var O=(e,t)=>{for(var o in t)w(e,o,{get:t[o],enumerable:!0})},z=(e,t,o,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of V(t))!W.call(e,n)&&n!==o&&w(e,n,{get:()=>t[n],enumerable:!(p=L(t,n))||p.enumerable});return e};var F=e=>z(w({},"__esModule",{value:!0}),e);var j={};O(j,{AdGroupProvider:()=>b,useAdGroup:()=>y,useAdvertisement:()=>G});module.exports=F(j);var v=require("react");var E=require("@apps-in-toss/framework"),T=(0,E.getOperationalEnvironment)()==="sandbox"?"local":(0,E.getSchemeUri)().startsWith("intoss-private")?"preview":"production",_={local:"http://localhost:3000",preview:"https://preview-api.intoss.app",production:"https://api.intoss.app"}[T];var S=require("react/jsx-runtime"),U=(0,v.createContext)({appName:"",apiEndpoint:"http://localhost:3000",runningEnvironment:"local"});var N=()=>(0,v.useContext)(U);var r=require("react"),M=require("react/jsx-runtime"),k=(0,r.createContext)({getInterstitialAdGroupId:()=>"ait-ad-test-interstitial-id",getRewardedAdGroupId:()=>"ait-ad-test-rewarded-id"}),b=({initial:e,children:t})=>{let{appName:o,runningEnvironment:p}=N(),[n,u]=(0,r.useState)(p!=="production"),[s,c]=(0,r.useState)(e),a=(0,r.useCallback)(d=>s[d]??"ait-ad-test-interstitial-id",[s]),l=(0,r.useCallback)(d=>s[d]??"ait-ad-test-rewarded-id",[s]),I=(0,r.useMemo)(()=>({getInterstitialAdGroupId:a,getRewardedAdGroupId:l}),[a,l]);return(0,r.useEffect)(()=>{if(n)return;let d=new AbortController,f=setTimeout(()=>d.abort(),3e3);fetch(`https://static.intoss.app/${o}/assets/adGroupList.json`,{signal:d.signal}).then(P=>P.json()).then(c).finally(()=>{clearTimeout(f),u(!0)})},[o,n]),n?(0,M.jsx)(k.Provider,{value:I,children:t}):null},y=()=>(0,r.useContext)(k);var x=require("@apps-in-toss/framework"),i=require("react"),G=({primaryAdGroup:e,secondaryAdGroup:t,onShowAd:o,onDissmissAd:p})=>{let[n,u]=(0,i.useState)(!1),[s,c]=(0,i.useState)(!1),[a,l]=(0,i.useState)(),[I,d]=(0,i.useState)(null),f=(0,i.useCallback)(C=>new Promise(m=>{let A=x.GoogleAdMob.loadAppsInTossAdMob({options:{adGroupId:C},onEvent:h=>{switch(h.type){case"loaded":m([!0,A]);break}},onError:()=>m([!1,A])})}),[]),P=(0,i.useCallback)(async()=>{if(x.GoogleAdMob.loadAppsInTossAdMob.isSupported()!==!0){u(!0);return}if(s)return;let[C,m]=await f(e.id);if(C){u(!0),c(!0),l(e.id),d(()=>m);return}if(m(),!t){u(!0);return}let[A,h]=await f(t.id);if(A){u(!0),c(!0),l(t.id),d(()=>h);return}h(),u(!0)},[e,t,s,f]),g=(0,i.useCallback)(()=>{I?.(),c(!1),l(void 0),d(null)},[I]),R=(0,i.useCallback)(()=>{if(x.GoogleAdMob.loadAppsInTossAdMob.isSupported()!==!0){o?.(),p?.();return}if(!s||!a){o?.(),p?.();return}x.GoogleAdMob.showAppsInTossAdMob({options:{adGroupId:a},onEvent:C=>{switch(C.type){case"show":(a===e.id&&e.type==="interstitial"||a===t?.id&&t.type==="interstitial")&&o?.();break;case"failedToShow":o?.(),g();break;case"dismissed":p?.(),g();break;case"userEarnedReward":o?.();break}},onError:()=>{o?.(),g()}})},[s,a,e,t,o,p,g]);return(0,i.useEffect)(()=>{a||P()},[a,P]),(0,i.useEffect)(()=>()=>g(),[]),{initialized:n,adLoaded:s,showAd:R}};0&&(module.exports={AdGroupProvider,useAdGroup,useAdvertisement});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
|
|
3
|
-
type Props$1 = PropsWithChildren<{
|
|
4
|
-
initial: Record<string, string>;
|
|
5
|
-
}>;
|
|
6
|
-
declare const AdGroupProvider: FC<Props$1>;
|
|
7
|
-
declare const useAdGroup: () => {
|
|
8
|
-
getInterstitialAdGroupId: (key: string) => string;
|
|
9
|
-
getRewardedAdGroupId: (key: string) => string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
type Props = {
|
|
13
|
-
primaryAdGroup: {
|
|
14
|
-
id: string;
|
|
15
|
-
type: "rewarded" | "interstitial";
|
|
16
|
-
};
|
|
17
|
-
secondaryAdGroup?: {
|
|
18
|
-
id: string;
|
|
19
|
-
type: "rewarded" | "interstitial";
|
|
20
|
-
};
|
|
21
|
-
onShowAd?: () => void;
|
|
22
|
-
onDissmissAd?: () => void;
|
|
23
|
-
};
|
|
24
|
-
declare const useAdvertisement: ({ primaryAdGroup, secondaryAdGroup, onShowAd, onDissmissAd, }: Props) => {
|
|
25
|
-
initialized: boolean;
|
|
26
|
-
adLoaded: boolean;
|
|
27
|
-
showAd: () => void;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export { AdGroupProvider, useAdGroup, useAdvertisement };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
|
|
3
|
-
type Props$1 = PropsWithChildren<{
|
|
4
|
-
initial: Record<string, string>;
|
|
5
|
-
}>;
|
|
6
|
-
declare const AdGroupProvider: FC<Props$1>;
|
|
7
|
-
declare const useAdGroup: () => {
|
|
8
|
-
getInterstitialAdGroupId: (key: string) => string;
|
|
9
|
-
getRewardedAdGroupId: (key: string) => string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
type Props = {
|
|
13
|
-
primaryAdGroup: {
|
|
14
|
-
id: string;
|
|
15
|
-
type: "rewarded" | "interstitial";
|
|
16
|
-
};
|
|
17
|
-
secondaryAdGroup?: {
|
|
18
|
-
id: string;
|
|
19
|
-
type: "rewarded" | "interstitial";
|
|
20
|
-
};
|
|
21
|
-
onShowAd?: () => void;
|
|
22
|
-
onDissmissAd?: () => void;
|
|
23
|
-
};
|
|
24
|
-
declare const useAdvertisement: ({ primaryAdGroup, secondaryAdGroup, onShowAd, onDissmissAd, }: Props) => {
|
|
25
|
-
initialized: boolean;
|
|
26
|
-
adLoaded: boolean;
|
|
27
|
-
showAd: () => void;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export { AdGroupProvider, useAdGroup, useAdvertisement };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"../chunk-BNFSLIDD.js";import"../chunk-WCRBLSWN.js";export{a as AdGroupProvider,b as useAdGroup,c as useAdvertisement};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var C=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var b=(t,e)=>{for(var n in e)C(t,n,{get:e[n],enumerable:!0})},Q=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of A(e))!O.call(t,o)&&o!==n&&C(t,o,{get:()=>e[o],enumerable:!(r=W(e,o))||r.enumerable});return t};var q=t=>Q(C({},"__esModule",{value:!0}),t);var G={};b(G,{AuthStateProvider:()=>g,useAuthState:()=>l,useSignInWithToss:()=>P});module.exports=q(G);var y=require("@tanstack/react-query"),p=require("react"),v=require("react/jsx-runtime"),x=(0,p.createContext)({isPreparing:!0,isLoggedIn:!1,retry:()=>Promise.resolve()}),g=({children:t})=>{let{data:e,isFetching:n,refetch:r}=(0,y.useQuery)({queryKey:["/my/user"]}),o=(0,p.useMemo)(()=>({isPreparing:n,isLoggedIn:!!e?.user?.id,retry:r}),[e,n,r]);return(0,v.jsx)(x.Provider,{value:o,children:t})},l=()=>(0,p.useContext)(x);var f=require("@apps-in-toss/framework");var L=require("@apps-in-toss/framework");var m=require("react");var d=require("@apps-in-toss/framework"),w=(0,d.getOperationalEnvironment)()==="sandbox"?"local":(0,d.getSchemeUri)().startsWith("intoss-private")?"preview":"production",z={local:"http://localhost:3000",preview:"https://preview-api.intoss.app",production:"https://api.intoss.app"}[w];var _=require("react/jsx-runtime"),ee=(0,m.createContext)({appName:"",apiEndpoint:"http://localhost:3000",runningEnvironment:"local"});var s=require("react"),U=require("react/jsx-runtime");var $=(0,s.createContext)({fetcher:fetch,setToken:()=>null});var u=()=>(0,s.useContext)($);var c=require("react"),h=(t,e,n)=>{let{displayName:r}=n??{},o=(0,c.memo)(e),a=(0,c.memo)(i=>(0,c.createElement)(o,t(i)));return a.ViewComponent=o,r&&(a.displayName=r,a.ViewComponent.displayName=`${r}View`),a};var M=require("@tanstack/react-query");var F=require("@tanstack/react-query"),N=require("react");var S=({children:t})=>{let{fetcher:e}=u();return{queryClient:(0,N.useMemo)(()=>new F.QueryClient({defaultOptions:{queries:{queryFn:({queryKey:r})=>e(r[0])}}}),[e]),children:t}};var I=require("react/jsx-runtime"),T=h(S,({queryClient:t,children:e})=>(0,I.jsx)(M.QueryClientProvider,{client:t,children:e}));var k=require("@tanstack/react-query"),E=require("react");var D="@auth/token",P=({onSuccess:t})=>{let{retry:e}=l(),{fetcher:n,setToken:r}=u(),o=(0,k.useMutation)({mutationFn:async i=>n("/my/sessions",{method:"POST",body:JSON.stringify(i)}),onSuccess:async i=>{r(i.token),await f.Storage.setItem(D,i.token),await e(),t?.()}});return{signInWithToss:(0,E.useCallback)(async()=>{let{authorizationCode:i,referrer:R}=await(0,f.appLogin)();o.mutate({authorizationCode:i,referrer:R})},[o]),isLoading:o.isPending}};0&&(module.exports={AuthStateProvider,useAuthState,useSignInWithToss});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
|
|
3
|
-
type AuthStateContextValues = {
|
|
4
|
-
isPreparing: boolean;
|
|
5
|
-
isLoggedIn: boolean;
|
|
6
|
-
retry: () => Promise<unknown>;
|
|
7
|
-
};
|
|
8
|
-
type Props$1 = PropsWithChildren<unknown>;
|
|
9
|
-
declare const AuthStateProvider: FC<Props$1>;
|
|
10
|
-
declare const useAuthState: () => AuthStateContextValues;
|
|
11
|
-
|
|
12
|
-
type Props = {
|
|
13
|
-
onSuccess?: () => void;
|
|
14
|
-
};
|
|
15
|
-
declare const useSignInWithToss: ({ onSuccess }: Props) => {
|
|
16
|
-
signInWithToss: () => Promise<void>;
|
|
17
|
-
isLoading: boolean;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export { type AuthStateContextValues, AuthStateProvider, useAuthState, useSignInWithToss };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
|
|
3
|
-
type AuthStateContextValues = {
|
|
4
|
-
isPreparing: boolean;
|
|
5
|
-
isLoggedIn: boolean;
|
|
6
|
-
retry: () => Promise<unknown>;
|
|
7
|
-
};
|
|
8
|
-
type Props$1 = PropsWithChildren<unknown>;
|
|
9
|
-
declare const AuthStateProvider: FC<Props$1>;
|
|
10
|
-
declare const useAuthState: () => AuthStateContextValues;
|
|
11
|
-
|
|
12
|
-
type Props = {
|
|
13
|
-
onSuccess?: () => void;
|
|
14
|
-
};
|
|
15
|
-
declare const useSignInWithToss: ({ onSuccess }: Props) => {
|
|
16
|
-
signInWithToss: () => Promise<void>;
|
|
17
|
-
isLoading: boolean;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export { type AuthStateContextValues, AuthStateProvider, useAuthState, useSignInWithToss };
|
package/dist/auth-state/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as u}from"../chunk-AWNNY7AC.js";import"../chunk-WCRBLSWN.js";import"../chunk-5USVVOWK.js";import{useQuery as m}from"@tanstack/react-query";import{createContext as c,useContext as S,useMemo as y}from"react";import{jsx as d}from"react/jsx-runtime";var a=c({isPreparing:!0,isLoggedIn:!1,retry:()=>Promise.resolve()}),p=({children:i})=>{let{data:o,isFetching:r,refetch:s}=m({queryKey:["/my/user"]}),e=y(()=>({isPreparing:r,isLoggedIn:!!o?.user?.id,retry:s}),[o,r,s]);return d(a.Provider,{value:e,children:i})},n=()=>S(a);import{appLogin as P,Storage as f}from"@apps-in-toss/framework";import{useMutation as x}from"@tanstack/react-query";import{useCallback as l}from"react";var C="@auth/token",h=({onSuccess:i})=>{let{retry:o}=n(),{fetcher:r,setToken:s}=u(),e=x({mutationFn:async t=>r("/my/sessions",{method:"POST",body:JSON.stringify(t)}),onSuccess:async t=>{s(t.token),await f.setItem(C,t.token),await o(),i?.()}});return{signInWithToss:l(async()=>{let{authorizationCode:t,referrer:g}=await P();e.mutate({authorizationCode:t,referrer:g})},[e]),isLoading:e.isPending}};export{p as AuthStateProvider,n as useAuthState,h as useSignInWithToss};
|
package/dist/calendar/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var c=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var F=(_,t)=>{for(var e in t)c(_,e,{get:t[e],enumerable:!0})},f=(_,t,e,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of n(t))!T.call(_,o)&&o!==e&&c(_,o,{get:()=>t[o],enumerable:!(u=M(t,o))||u.enumerable});return _};var O=_=>f(c({},"__esModule",{value:!0}),_);var m={};F(m,{calculateDay:()=>a,calculateDayOfWeek:()=>r,calculateHour:()=>S,calculateMinute:()=>l,calculateWeek:()=>E});module.exports=O(m);var a=_=>Math.floor((_+324e5)/864e5);var r=_=>(_+3)%7;var S=_=>Math.floor((_+324e5)%864e5/36e5);var l=_=>Math.floor((_+324e5)%36e5/6e4);var E=_=>Math.floor((_+3)/7);0&&(module.exports={calculateDay,calculateDayOfWeek,calculateHour,calculateMinute,calculateWeek});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
declare const calculateDay: (timestamp: number) => number;
|
|
2
|
-
|
|
3
|
-
declare const calculateDayOfWeek: (day: number) => number;
|
|
4
|
-
|
|
5
|
-
declare const calculateHour: (timestamp: number) => number;
|
|
6
|
-
|
|
7
|
-
declare const calculateMinute: (timestamp: number) => number;
|
|
8
|
-
|
|
9
|
-
declare const calculateWeek: (day: number) => number;
|
|
10
|
-
|
|
11
|
-
export { calculateDay, calculateDayOfWeek, calculateHour, calculateMinute, calculateWeek };
|
package/dist/calendar/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
declare const calculateDay: (timestamp: number) => number;
|
|
2
|
-
|
|
3
|
-
declare const calculateDayOfWeek: (day: number) => number;
|
|
4
|
-
|
|
5
|
-
declare const calculateHour: (timestamp: number) => number;
|
|
6
|
-
|
|
7
|
-
declare const calculateMinute: (timestamp: number) => number;
|
|
8
|
-
|
|
9
|
-
declare const calculateWeek: (day: number) => number;
|
|
10
|
-
|
|
11
|
-
export { calculateDay, calculateDayOfWeek, calculateHour, calculateMinute, calculateWeek };
|
package/dist/calendar/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e}from"../chunk-IMEAYFIW.js";export{a as calculateDay,b as calculateDayOfWeek,c as calculateHour,d as calculateMinute,e as calculateWeek};
|
package/dist/chunk-5USVVOWK.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createElement as w,memo as i}from"react";var s=(t,d,l)=>{let{displayName:o}=l??{},n=i(d),e=i(p=>w(n,t(p)));return e.ViewComponent=n,o&&(e.displayName=o,e.ViewComponent.displayName=`${o}View`),e};export{s as a};
|
package/dist/chunk-AWNNY7AC.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as p}from"./chunk-WCRBLSWN.js";import{a as c}from"./chunk-5USVVOWK.js";import{Storage as F}from"@apps-in-toss/framework";import{createContext as x,useCallback as g,useContext as Q,useEffect as k,useState as h}from"react";import{jsx as q}from"react/jsx-runtime";var T="@auth/token",l=x({fetcher:fetch,setToken:()=>null}),f=({baseUrl:e,children:r})=>{let{appName:n,apiEndpoint:t}=p(),[i,s]=h(null),[a,P]=h(!1),y=g((C,u)=>fetch(`${e??t}/${n}${C}`,{...u,headers:{...u?.headers,...i?{Authorization:`Bearer ${i}`}:{}}}).then(v=>v.json()),[n,t,i,e]);return k(()=>{F.getItem(T).then(s).finally(()=>P(!0))},[]),q(l.Provider,{value:{fetcher:y,setToken:s},children:a?r:null})},o=()=>Q(l);import{QueryClientProvider as $}from"@tanstack/react-query";import{QueryClient as E}from"@tanstack/react-query";import{useMemo as W}from"react";var d=({children:e})=>{let{fetcher:r}=o();return{queryClient:W(()=>new E({defaultOptions:{queries:{queryFn:({queryKey:t})=>r(t[0])}}}),[r]),children:e}};import{jsx as z}from"react/jsx-runtime";var m=c(d,({queryClient:e,children:r})=>z($,{client:e,children:r}));export{f as a,o as b,m as c};
|
package/dist/chunk-BNFSLIDD.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as P}from"./chunk-WCRBLSWN.js";import{createContext as M,useCallback as x,useContext as R,useEffect as z,useMemo as W,useState as G}from"react";import{jsx as F}from"react/jsx-runtime";var h=M({getInterstitialAdGroupId:()=>"ait-ad-test-interstitial-id",getRewardedAdGroupId:()=>"ait-ad-test-rewarded-id"}),k=({initial:o,children:s})=>{let{appName:t,runningEnvironment:d}=P(),[u,n]=G(d!=="production"),[e,p]=G(o),r=x(i=>e[i]??"ait-ad-test-interstitial-id",[e]),a=x(i=>e[i]??"ait-ad-test-rewarded-id",[e]),A=W(()=>({getInterstitialAdGroupId:r,getRewardedAdGroupId:a}),[r,a]);return z(()=>{if(u)return;let i=new AbortController,l=setTimeout(()=>i.abort(),3e3);fetch(`https://static.intoss.app/${t}/assets/adGroupList.json`,{signal:i.signal}).then(m=>m.json()).then(p).finally(()=>{clearTimeout(l),n(!0)})},[t,u]),u?F(h.Provider,{value:A,children:s}):null},y=()=>R(h);import{GoogleAdMob as b}from"@apps-in-toss/framework";import{useCallback as v,useEffect as E,useState as w}from"react";var L=({primaryAdGroup:o,secondaryAdGroup:s,onShowAd:t,onDissmissAd:d})=>{let[u,n]=w(!1),[e,p]=w(!1),[r,a]=w(),[A,i]=w(null),l=v(f=>new Promise(g=>{let I=b.loadAppsInTossAdMob({options:{adGroupId:f},onEvent:C=>{switch(C.type){case"loaded":g([!0,I]);break}},onError:()=>g([!1,I])})}),[]),m=v(async()=>{if(b.loadAppsInTossAdMob.isSupported()!==!0){n(!0);return}if(e)return;let[f,g]=await l(o.id);if(f){n(!0),p(!0),a(o.id),i(()=>g);return}if(g(),!s){n(!0);return}let[I,C]=await l(s.id);if(I){n(!0),p(!0),a(s.id),i(()=>C);return}C(),n(!0)},[o,s,e,l]),c=v(()=>{A?.(),p(!1),a(void 0),i(null)},[A]),T=v(()=>{if(b.loadAppsInTossAdMob.isSupported()!==!0){t?.(),d?.();return}if(!e||!r){t?.(),d?.();return}b.showAppsInTossAdMob({options:{adGroupId:r},onEvent:f=>{switch(f.type){case"show":(r===o.id&&o.type==="interstitial"||r===s?.id&&s.type==="interstitial")&&t?.();break;case"failedToShow":t?.(),c();break;case"dismissed":d?.(),c();break;case"userEarnedReward":t?.();break}},onError:()=>{t?.(),c()}})},[e,r,o,s,t,d,c]);return E(()=>{r||m()},[r,m]),E(()=>()=>c(),[]),{initialized:u,adLoaded:e,showAd:T}};export{k as a,y as b,L as c};
|
package/dist/chunk-IMEAYFIW.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t=_=>Math.floor((_+324e5)/864e5);var o=_=>(_+3)%7;var e=_=>Math.floor((_+324e5)%864e5/36e5);var c=_=>Math.floor((_+324e5)%36e5/6e4);var a=_=>Math.floor((_+3)/7);export{t as a,o as b,e as c,c as d,a as e};
|
package/dist/chunk-LUKG4S33.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Storage as o}from"@apps-in-toss/framework";import{useCallback as m,useEffect as c,useState as u}from"react";import{DeviceEventEmitter as s}from"react-native";var i=e=>{let[l,r]=u(),[d,a]=u(!0),f=m(t=>(r(t),s.emit(e,t),o.setItem(e,JSON.stringify({value:t}))),[e]);return c(()=>{a(!0),o.getItem(e).then(n=>{try{r(n===null?void 0:JSON.parse(n).value)}catch{r(void 0)}finally{a(!1)}});let t=s.addListener(e,r);return()=>t.remove()},[e]),[l,f,d]};export{i as a};
|
package/dist/chunk-WCRBLSWN.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createContext as c,useContext as l,useMemo as g}from"react";import{getOperationalEnvironment as a,getSchemeUri as C}from"@apps-in-toss/framework";var o=a()==="sandbox"?"local":C().startsWith("intoss-private")?"preview":"production",n={local:"http://localhost:3000",preview:"https://preview-api.intoss.app",production:"https://api.intoss.app"}[o];import{jsx as N}from"react/jsx-runtime";var e=c({appName:"",apiEndpoint:"http://localhost:3000",runningEnvironment:"local"}),i=({appName:t,children:p})=>{let s=g(()=>({appName:t,apiEndpoint:n,runningEnvironment:o}),[t]);return N(e.Provider,{value:s,children:p})},r=()=>l(e);export{i as a,r as b};
|
package/dist/config/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var p=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var v=(t,o)=>{for(var n in o)p(t,n,{get:o[n],enumerable:!0})},x=(t,o,n,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of u(o))!m.call(t,i)&&i!==n&&p(t,i,{get:()=>o[i],enumerable:!(c=f(o,i))||c.enumerable});return t};var d=t=>x(p({},"__esModule",{value:!0}),t);var P={};v(P,{ConfigProvider:()=>a,useConfig:()=>C});module.exports=d(P);var e=require("react");var r=require("@apps-in-toss/framework"),s=(0,r.getOperationalEnvironment)()==="sandbox"?"local":(0,r.getSchemeUri)().startsWith("intoss-private")?"preview":"production",l={local:"http://localhost:3000",preview:"https://preview-api.intoss.app",production:"https://api.intoss.app"}[s];var N=require("react/jsx-runtime"),g=(0,e.createContext)({appName:"",apiEndpoint:"http://localhost:3000",runningEnvironment:"local"}),a=({appName:t,children:o})=>{let n=(0,e.useMemo)(()=>({appName:t,apiEndpoint:l,runningEnvironment:s}),[t]);return(0,N.jsx)(g.Provider,{value:n,children:o})},C=()=>(0,e.useContext)(g);0&&(module.exports={ConfigProvider,useConfig});
|
package/dist/config/index.d.cts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
|
|
3
|
-
type ConfigContextValues = {
|
|
4
|
-
appName: string;
|
|
5
|
-
apiEndpoint: string;
|
|
6
|
-
runningEnvironment: "local" | "preview" | "production";
|
|
7
|
-
};
|
|
8
|
-
type Props = PropsWithChildren<Pick<ConfigContextValues, "appName">>;
|
|
9
|
-
declare const ConfigProvider: FC<Props>;
|
|
10
|
-
declare const useConfig: () => ConfigContextValues;
|
|
11
|
-
|
|
12
|
-
export { ConfigProvider, useConfig };
|
package/dist/config/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
|
|
3
|
-
type ConfigContextValues = {
|
|
4
|
-
appName: string;
|
|
5
|
-
apiEndpoint: string;
|
|
6
|
-
runningEnvironment: "local" | "preview" | "production";
|
|
7
|
-
};
|
|
8
|
-
type Props = PropsWithChildren<Pick<ConfigContextValues, "appName">>;
|
|
9
|
-
declare const ConfigProvider: FC<Props>;
|
|
10
|
-
declare const useConfig: () => ConfigContextValues;
|
|
11
|
-
|
|
12
|
-
export { ConfigProvider, useConfig };
|
package/dist/config/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"../chunk-WCRBLSWN.js";export{a as ConfigProvider,b as useConfig};
|
package/dist/query/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var C=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var W=(o,e)=>{for(var i in e)C(o,i,{get:e[i],enumerable:!0})},b=(o,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of O(e))!Q.call(o,t)&&t!==i&&C(o,t,{get:()=>e[t],enumerable:!(r=I(e,t))||r.enumerable});return o};var _=o=>b(C({},"__esModule",{value:!0}),o);var U={};W(U,{FetcherProvider:()=>f,QueryProvider:()=>h,useFetcher:()=>l});module.exports=_(U);var w=require("@apps-in-toss/framework");var p=require("react");var d=require("@apps-in-toss/framework"),g=(0,d.getOperationalEnvironment)()==="sandbox"?"local":(0,d.getSchemeUri)().startsWith("intoss-private")?"preview":"production",$={local:"http://localhost:3000",preview:"https://preview-api.intoss.app",production:"https://api.intoss.app"}[g];var z=require("react/jsx-runtime"),q=(0,p.createContext)({appName:"",apiEndpoint:"http://localhost:3000",runningEnvironment:"local"});var u=()=>(0,p.useContext)(q);var n=require("react"),x=require("react/jsx-runtime"),S="@auth/token",y=(0,n.createContext)({fetcher:fetch,setToken:()=>null}),f=({baseUrl:o,children:e})=>{let{appName:i,apiEndpoint:r}=u(),[t,s]=(0,n.useState)(null),[m,E]=(0,n.useState)(!1),R=(0,n.useCallback)((k,P)=>fetch(`${o??r}/${i}${k}`,{...P,headers:{...P?.headers,...t?{Authorization:`Bearer ${t}`}:{}}}).then(T=>T.json()),[i,r,t,o]);return(0,n.useEffect)(()=>{w.Storage.getItem(S).then(s).finally(()=>E(!0))},[]),(0,x.jsx)(y.Provider,{value:{fetcher:R,setToken:s},children:m?e:null})},l=()=>(0,n.useContext)(y);var a=require("react"),c=(o,e,i)=>{let{displayName:r}=i??{},t=(0,a.memo)(e),s=(0,a.memo)(m=>(0,a.createElement)(t,o(m)));return s.ViewComponent=t,r&&(s.displayName=r,s.ViewComponent.displayName=`${r}View`),s};var F=require("@tanstack/react-query");var v=require("@tanstack/react-query"),V=require("react");var N=({children:o})=>{let{fetcher:e}=l();return{queryClient:(0,V.useMemo)(()=>new v.QueryClient({defaultOptions:{queries:{queryFn:({queryKey:r})=>e(r[0])}}}),[e]),children:o}};var M=require("react/jsx-runtime"),h=c(N,({queryClient:o,children:e})=>(0,M.jsx)(F.QueryClientProvider,{client:o,children:e}));0&&(module.exports={FetcherProvider,QueryProvider,useFetcher});
|
package/dist/query/index.d.cts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { FC, PropsWithChildren } from 'react';
|
|
3
|
-
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
4
|
-
|
|
5
|
-
type FetcherContextValues = {
|
|
6
|
-
fetcher: <T = Record<string, string>>(...args: Parameters<typeof fetch>) => Promise<T>;
|
|
7
|
-
setToken: (value: string) => void;
|
|
8
|
-
};
|
|
9
|
-
type Props = PropsWithChildren<{
|
|
10
|
-
baseUrl?: string;
|
|
11
|
-
}>;
|
|
12
|
-
declare const FetcherProvider: FC<Props>;
|
|
13
|
-
declare const useFetcher: () => FetcherContextValues;
|
|
14
|
-
|
|
15
|
-
declare const QueryProvider: react.FC<{
|
|
16
|
-
children?: react.ReactNode | undefined;
|
|
17
|
-
}> & {
|
|
18
|
-
ViewComponent: react.FC<{
|
|
19
|
-
queryClient: _tanstack_query_core.QueryClient;
|
|
20
|
-
children: react.ReactNode;
|
|
21
|
-
} & Record<string, unknown>>;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export { FetcherProvider, QueryProvider, useFetcher };
|
package/dist/query/index.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { FC, PropsWithChildren } from 'react';
|
|
3
|
-
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
4
|
-
|
|
5
|
-
type FetcherContextValues = {
|
|
6
|
-
fetcher: <T = Record<string, string>>(...args: Parameters<typeof fetch>) => Promise<T>;
|
|
7
|
-
setToken: (value: string) => void;
|
|
8
|
-
};
|
|
9
|
-
type Props = PropsWithChildren<{
|
|
10
|
-
baseUrl?: string;
|
|
11
|
-
}>;
|
|
12
|
-
declare const FetcherProvider: FC<Props>;
|
|
13
|
-
declare const useFetcher: () => FetcherContextValues;
|
|
14
|
-
|
|
15
|
-
declare const QueryProvider: react.FC<{
|
|
16
|
-
children?: react.ReactNode | undefined;
|
|
17
|
-
}> & {
|
|
18
|
-
ViewComponent: react.FC<{
|
|
19
|
-
queryClient: _tanstack_query_core.QueryClient;
|
|
20
|
-
children: react.ReactNode;
|
|
21
|
-
} & Record<string, unknown>>;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export { FetcherProvider, QueryProvider, useFetcher };
|
package/dist/query/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"../chunk-AWNNY7AC.js";import"../chunk-WCRBLSWN.js";import"../chunk-5USVVOWK.js";export{a as FetcherProvider,c as QueryProvider,b as useFetcher};
|
package/dist/storage/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var s=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var V=(e,t)=>{for(var r in t)s(e,r,{get:t[r],enumerable:!0})},S=(e,t,r,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of g(t))!p.call(e,a)&&a!==r&&s(e,a,{get:()=>t[a],enumerable:!(u=c(t,a))||u.enumerable});return e};var v=e=>S(s({},"__esModule",{value:!0}),e);var L={};V(L,{useStorage:()=>d});module.exports=v(L);var i=require("@apps-in-toss/framework"),n=require("react"),l=require("react-native"),d=e=>{let[t,r]=(0,n.useState)(),[u,a]=(0,n.useState)(!0),m=(0,n.useCallback)(o=>(r(o),l.DeviceEventEmitter.emit(e,o),i.Storage.setItem(e,JSON.stringify({value:o}))),[e]);return(0,n.useEffect)(()=>{a(!0),i.Storage.getItem(e).then(f=>{try{r(f===null?void 0:JSON.parse(f).value)}catch{r(void 0)}finally{a(!1)}});let o=l.DeviceEventEmitter.addListener(e,r);return()=>o.remove()},[e]),[t,m,u]};0&&(module.exports={useStorage});
|
package/dist/storage/index.d.cts
DELETED
package/dist/storage/index.d.ts
DELETED
package/dist/storage/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"../chunk-LUKG4S33.js";export{a as useStorage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var l=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var M=(o,e)=>{for(var i in e)l(o,i,{get:e[i],enumerable:!0})},u=(o,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of V(e))!m.call(o,n)&&n!==i&&l(o,n,{get:()=>e[n],enumerable:!(s=r(e,n))||s.enumerable});return o};var a=o=>u(l({},"__esModule",{value:!0}),o);var R={};M(R,{bind:()=>p});module.exports=a(R);var t=require("react"),p=(o,e,i)=>{let{displayName:s}=i??{},n=(0,t.memo)(e),d=(0,t.memo)(w=>(0,t.createElement)(n,o(w)));return d.ViewComponent=n,s&&(d.displayName=s,d.ViewComponent.displayName=`${s}View`),d};0&&(module.exports={bind});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
|
|
3
|
-
type ViewModelType<ViewModelProps, ViewModelResult> = (props: ViewModelProps) => ViewModelResult;
|
|
4
|
-
type Options = {
|
|
5
|
-
displayName?: string;
|
|
6
|
-
};
|
|
7
|
-
declare const bind: <ViewModelProps extends Record<string, unknown>, ViewModelResult>(useViewModel: ViewModelType<ViewModelProps, ViewModelResult>, ViewComponent: FC<ViewModelResult>, options?: Options) => FC<ViewModelProps> & {
|
|
8
|
-
ViewComponent: FC<ViewModelResult & Record<string, unknown>>;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export { bind };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
|
|
3
|
-
type ViewModelType<ViewModelProps, ViewModelResult> = (props: ViewModelProps) => ViewModelResult;
|
|
4
|
-
type Options = {
|
|
5
|
-
displayName?: string;
|
|
6
|
-
};
|
|
7
|
-
declare const bind: <ViewModelProps extends Record<string, unknown>, ViewModelResult>(useViewModel: ViewModelType<ViewModelProps, ViewModelResult>, ViewComponent: FC<ViewModelResult>, options?: Options) => FC<ViewModelProps> & {
|
|
8
|
-
ViewComponent: FC<ViewModelResult & Record<string, unknown>>;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export { bind };
|
package/dist/view-model/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"../chunk-5USVVOWK.js";export{a as bind};
|