@frontegg/react-hooks 4.15.0 → 4.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,7 +38,14 @@ var useBillingInformationActions = function () { return useBillingActions('infor
38
38
  var useBillingPaymentMethod = function () { return useBilling('paymentMethod'); };
39
39
  var useBillingPaymentMethodActions = function () { return useBillingActions('paymentMethod'); };
40
40
  var useInvoices = function () { return useBilling('invoices'); };
41
- var useInvoicesActions = function () { return useBillingActions('invoices'); };
41
+ var useInvoicesActions = function () { return useBillingActions('invoices'); };
42
+ var useStripeState = function () {
43
+ return FronteggStoreContext.useSelector(function (state) { return state[reduxStore.subscriptionsStoreName]['stripe']; }, reactRedux.shallowEqual);
44
+ };
45
+ var useStripeActions = function () {
46
+ var dispatch = FronteggStoreContext.useDispatch();
47
+ return React.useMemo(function () { return reduxStore.bindActionCreators(reduxStore.subscriptionActions.stripe, dispatch); }, [dispatch]);
48
+ };
42
49
 
43
50
  exports.useBillingInformation = useBillingInformation;
44
51
  exports.useBillingInformationActions = useBillingInformationActions;
@@ -52,4 +59,6 @@ exports.usePaymentProvider = usePaymentProvider;
52
59
  exports.usePaymentProviderActions = usePaymentProviderActions;
53
60
  exports.usePlans = usePlans;
54
61
  exports.usePlansActions = usePlansActions;
55
- //# sourceMappingURL=hooks-8b7d27f0.js.map
62
+ exports.useStripeActions = useStripeActions;
63
+ exports.useStripeState = useStripeState;
64
+ //# sourceMappingURL=hooks-08977f1b.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks-08977f1b.js","sources":["../src/subscriptions/hooks.ts"],"sourcesContent":["import {\n BillingActions,\n BillingState,\n CheckoutActions,\n CheckoutState,\n PaymentProviderConfigActions,\n PaymentProviderConfigState,\n PlansActions,\n PlansState,\n StripeActions,\n StripeState,\n subscriptionActions,\n subscriptionsStoreName,\n bindActionCreators,\n} from '@frontegg/redux-store';\nimport { useDispatch, useSelector } from '../FronteggStoreContext';\nimport { shallowEqual } from 'react-redux';\nimport { useMemo } from 'react';\n\nexport const usePaymentProvider = (): PaymentProviderConfigState => {\n return useSelector((state: any) => state[subscriptionsStoreName]['config'], shallowEqual);\n};\n\nexport const usePaymentProviderActions = (): PaymentProviderConfigActions => {\n const dispatch = useDispatch();\n return useMemo(() => bindActionCreators(subscriptionActions.config, dispatch), [dispatch]);\n};\n\nexport const usePlans = (): PlansState => {\n return useSelector((state: any) => state[subscriptionsStoreName]['plans'], shallowEqual);\n};\n\nexport const usePlansActions = (): PlansActions => {\n const dispatch = useDispatch();\n return useMemo(() => bindActionCreators(subscriptionActions.plans, dispatch), [dispatch]);\n};\n\nexport const useCheckout = (): CheckoutState => {\n return useSelector((state: any) => state[subscriptionsStoreName]['checkout'], shallowEqual);\n};\n\nexport const useCheckoutActions = (): CheckoutActions => {\n const dispatch = useDispatch();\n return useMemo(() => bindActionCreators(subscriptionActions.checkout, dispatch), [dispatch]);\n};\n\nconst useBilling = <T extends keyof BillingState>(billingKey: T): BillingState[T] => {\n return useSelector((state: any) => state[subscriptionsStoreName]['billing'][billingKey], shallowEqual);\n};\n\nconst useBillingActions = <T extends keyof BillingActions>(billingKey: T): BillingActions[T] => {\n const dispatch = useDispatch();\n return useMemo(() => bindActionCreators(subscriptionActions['billing'][billingKey], dispatch), [billingKey, dispatch]);\n};\n\nexport const useBillingInformation = () => useBilling('information');\nexport const useBillingInformationActions = () => useBillingActions('information');\n\nexport const useBillingPaymentMethod = () => useBilling('paymentMethod');\nexport const useBillingPaymentMethodActions = () => useBillingActions('paymentMethod');\n\nexport const useInvoices = () => useBilling('invoices');\nexport const useInvoicesActions = () => useBillingActions('invoices');\n\nexport const useStripeState = (): StripeState => {\n return useSelector((state: any) => state[subscriptionsStoreName]['stripe'], shallowEqual);\n};\n\nexport const useStripeActions = (): StripeActions => {\n const dispatch = useDispatch();\n return useMemo(() => bindActionCreators(subscriptionActions.stripe, dispatch), [dispatch]);\n};\n"],"names":["useSelector","subscriptionsStoreName","sh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7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var auditsMetadata = require('./auditsMetadata-e49c654d.js');
6
6
  var roles = require('./roles-882b4f3e.js');
7
7
  var hooks = require('./hooks-f882a3dd.js');
8
- var hooks$1 = require('./hooks-8b7d27f0.js');
8
+ var hooks$1 = require('./hooks-08977f1b.js');
9
9
  var hooks$2 = require('./hooks-c5a54ed9.js');
10
10
  var tslib = require('tslib');
11
11
  var React = require('react');
@@ -146,6 +146,8 @@ exports.usePaymentProvider = hooks$1.usePaymentProvider;
146
146
  exports.usePaymentProviderActions = hooks$1.usePaymentProviderActions;
147
147
  exports.usePlans = hooks$1.usePlans;
148
148
  exports.usePlansActions = hooks$1.usePlansActions;
149
+ exports.useStripeActions = hooks$1.useStripeActions;
150
+ exports.useStripeState = hooks$1.useStripeState;
149
151
  exports.useVendorActions = hooks$2.useVendorActions;
150
152
  exports.useVendorState = hooks$2.useVendorState;
151
153
  Object.defineProperty(exports, 'Provider', {
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/FronteggProvider.tsx"],"sourcesContent":["import React, { FC, useEffect, useMemo, useRef, useState } from 'react';\nimport { Provider } from 'react-redux';\nimport { createFronteggStore } from '@frontegg/redux-store';\nimport { ContextHolder, ContextOptions } from '@frontegg/rest-api';\nimport { useAuth, useAuthRoutes } from './auth';\nimport { FronteggStoreContext } from './FronteggStoreContext';\nimport { FronteggAppInstance } from '@frontegg/types';\n\ntype FronteggProviderProps = {\n app?: FronteggAppInstance;\n contextOptions?: ContextOptions;\n setLoading?: (loading: boolean) => void;\n};\n\nconst setLoading = (loading: boolean): void => {\n const isSSR = typeof document === 'undefined' || typeof window === 'undefined';\n\n if (!isSSR) {\n if (loading) {\n document.body.classList.add('frontegg-loading');\n } else {\n document.body.classList.remove('frontegg-loading');\n }\n }\n};\n\nconst HideChildrenIfFronteggRoutes: FC<{ basename?: string }> = ({ children, basename }) => {\n const routes = useAuthRoutes();\n const uriRef = useRef(window.location.pathname);\n const [uri, setUri] = useState(window.location.pathname);\n useEffect(() => {\n document.addEventListener('frontegg_onRedirectTo_fired', () => {\n if (uriRef.current !== window.location.pathname) {\n uriRef.current = window.location.pathname;\n setUri(document.location.pathname);\n }\n });\n window.addEventListener('popstate', () => {\n if (uriRef.current !== window.location.pathname) {\n uriRef.current = window.location.pathname;\n setUri(document.location.pathname);\n }\n });\n\n setInterval(() => {\n if (uriRef.current !== window.location.pathname) {\n uriRef.current = window.location.pathname;\n setUri(document.location.pathname);\n }\n }, 50);\n }, [setUri]);\n\n const calculatedBasename = basename ? (basename.endsWith('/') ? basename.substring(0, basename.length - 1) : '') : '';\n\n const {\n authenticatedUrl,\n signUpSuccessUrl,\n ...checkRoutes\n } = routes;\n if (Object.values(checkRoutes).map(url => `${calculatedBasename}${url}`).indexOf(uri) !== -1) {\n return null;\n }\n\n return <>{children}</>;\n};\n\nconst FronteggContent: FC<{ app?: any; setLoading: (loading: boolean) => void }> = ({ children, app, setLoading }) => {\n const { isLoading } = useAuth(({ isLoading }) => ({ isLoading }));\n const customLoginBox: boolean = app ? !!app.options?.customLoginBox : true;\n setLoading(isLoading);\n if (isLoading) {\n return null;\n }\n if (customLoginBox) {\n return <>{children}</>;\n }\n\n return <HideChildrenIfFronteggRoutes basename={app?.options.basename}>{children}</HideChildrenIfFronteggRoutes>;\n};\n\nexport const FronteggStoreProvider: FC<FronteggProviderProps> = ({\n children,\n app,\n contextOptions,\n setLoading: setLoadingProps,\n}) => {\n const context = app?.options?.contextOptions ?? contextOptions;\n const previewMode = app?.options?.previewMode ?? false;\n const authOptions = app?.options?.authOptions ?? {};\n ContextHolder.setContext(context!);\n const store = useMemo(() => createFronteggStore({ context: context! }, app, previewMode, authOptions), [app, previewMode]);\n\n return (\n <Provider context={FronteggStoreContext} store={store}>\n <FronteggContent setLoading={setLoadingProps ?? setLoading} app={app}>\n {children}\n </FronteggContent>\n </Provider>\n );\n};\n"],"names":["useAuthRoutes","useRef","useState","use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O,CACT,EACX;AACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/FronteggProvider.tsx"],"sourcesContent":["import React, { FC, useEffect, useMemo, useRef, useState } from 'react';\nimport { Provider } from 'react-redux';\nimport { createFronteggStore } from '@frontegg/redux-store';\nimport { ContextHolder, ContextOptions } from '@frontegg/rest-api';\nimport { useAuth, useAuthRoutes } from './auth';\nimport { FronteggStoreContext } from './FronteggStoreContext';\nimport { FronteggAppInstance } from '@frontegg/types';\n\ntype FronteggProviderProps = {\n app?: FronteggAppInstance;\n contextOptions?: ContextOptions;\n setLoading?: (loading: boolean) => void;\n};\n\nconst setLoading = (loading: boolean): void => {\n const isSSR = typeof document === 'undefined' || typeof window === 'undefined';\n\n if (!isSSR) {\n if (loading) {\n document.body.classList.add('frontegg-loading');\n } else {\n document.body.classList.remove('frontegg-loading');\n }\n }\n};\n\nconst HideChildrenIfFronteggRoutes: FC<{ basename?: string }> = ({ children, basename }) => {\n const routes = useAuthRoutes();\n const uriRef = useRef(window.location.pathname);\n const [uri, setUri] = useState(window.location.pathname);\n useEffect(() => {\n document.addEventListener('frontegg_onRedirectTo_fired', () => {\n if (uriRef.current !== window.location.pathname) {\n uriRef.current = window.location.pathname;\n setUri(document.location.pathname);\n }\n });\n window.addEventListener('popstate', () => {\n if (uriRef.current !== window.location.pathname) {\n uriRef.current = window.location.pathname;\n setUri(document.location.pathname);\n }\n });\n\n setInterval(() => {\n if (uriRef.current !== window.location.pathname) {\n uriRef.current = window.location.pathname;\n setUri(document.location.pathname);\n }\n }, 50);\n }, [setUri]);\n\n const calculatedBasename = basename ? (basename.endsWith('/') ? basename.substring(0, basename.length - 1) : '') : '';\n\n const {\n authenticatedUrl,\n signUpSuccessUrl,\n ...checkRoutes\n } = routes;\n if (Object.values(checkRoutes).map(url => `${calculatedBasename}${url}`).indexOf(uri) !== -1) {\n return null;\n }\n\n return <>{children}</>;\n};\n\nconst FronteggContent: FC<{ app?: any; setLoading: (loading: boolean) => void }> = ({ children, app, setLoading }) => {\n const { isLoading } = useAuth(({ isLoading }) => ({ isLoading }));\n const customLoginBox: boolean = app ? !!app.options?.customLoginBox : true;\n setLoading(isLoading);\n if (isLoading) {\n return null;\n }\n if (customLoginBox) {\n return <>{children}</>;\n }\n\n return <HideChildrenIfFronteggRoutes basename={app?.options.basename}>{children}</HideChildrenIfFronteggRoutes>;\n};\n\nexport const FronteggStoreProvider: FC<FronteggProviderProps> = ({\n children,\n app,\n contextOptions,\n setLoading: setLoadingProps,\n}) => {\n const context = app?.options?.contextOptions ?? contextOptions;\n const previewMode = app?.options?.previewMode ?? false;\n const authOptions = app?.options?.authOptions ?? {};\n ContextHolder.setContext(context!);\n const store = useMemo(() => createFronteggStore({ context: context! }, app, previewMode, authOptions), [app, previewMode]);\n\n return (\n <Provider context={FronteggStoreContext} store={store}>\n <FronteggContent setLoading={setLoadingProps ?? setLoading} app={app}>\n {children}\n </FronteggContent>\n </Provider>\n );\n};\n"],"names":["useAuthRoutes","useRef","useState","useEffect","React","useAuth","ContextHolder","useMemo","createFronteggStore","Provider","FronteggStoreContext"],"mappings":";;;;;;;;;;;;;;;;;;;;AAcA,IAAM,UAAU,GAAG,UAAC,OAAgB;IAClC,IAAM,KAAK,GAAG,OAAO,QAAQ,KAAK,WAAW,IAAI,OAAO,MAAM,KAAK,WAAW,CAAC;IAE/E,IAAI,CAAC,KAAK,EAAE;QACV,IAAI,OAAO,EAAE;YACX,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;SACjD;aAAM;YACL,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;SACpD;KACF;AACH,CAAC,CAAC;AAEF,IAAM,4BAA4B,GAA8B,UAAC,EAAsB;QAApB,QAAQ,cAAA,EAAE,Q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H,GAAG,uBAAH,GAAG,CAAE,OAAO,0CAAE,cAAc,mCAAI,cAAc,CAAC;IAC/D,IAAM,WAAW,eAAG,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,0CAAE,WAAW,mCAAI,KAAK,CAAC;IACvD,IAAM,WAAW,eAAG,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,0CAAE,WAAW,mCAAI,EAAE,CAAC;IACpDE,qBAAa,CAAC,UAAU,CAAC,OAAQ,CAAC,CAAC;IACnC,IAAM,KAAK,GAAGC,aAAO,CAAC,cAAM,OAAAC,8BAAmB,CAAC,EAAE,OAAO,EAAE,OAAQ,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,WAAW,CAAC,GAAA,EAAE,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC;IAE3H,QACEJ,wCAACK,mBAAQ,IAAC,OAAO,EAAEC,yCAAoB,EAAE,KAAK,EAAE,KAAK;QACnDN,wCAAC,eAAe,IAAC,UAAU,EAAE,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,UAAU,EAAE,GAAG,EAAE,GAAG,IACjE,QAAQ,CACO,CACT,EACX;AACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@frontegg/react-hooks",
3
3
  "libName": "FronteggReactHooks",
4
- "version": "4.15.0",
4
+ "version": "4.18.0",
5
5
  "author": "Frontegg LTD",
6
6
  "main": "index.js",
7
7
  "types": "index.d.ts",
@@ -10,7 +10,7 @@
10
10
  "build": "export NODE_ENV='production' && rm -rf dist && mkdir dist && rollup -c ./rollup.config.js"
11
11
  },
12
12
  "dependencies": {
13
- "@frontegg/redux-store": "4.15.0",
13
+ "@frontegg/redux-store": "4.18.0",
14
14
  "react-redux": "^7.x"
15
15
  },
16
16
  "devDependencies": {
@@ -1,4 +1,4 @@
1
- import { CheckoutActions, CheckoutState, PaymentProviderConfigActions, PaymentProviderConfigState, PlansActions, PlansState } from '@frontegg/redux-store';
1
+ import { CheckoutActions, CheckoutState, PaymentProviderConfigActions, PaymentProviderConfigState, PlansActions, PlansState, StripeActions, StripeState } from '@frontegg/redux-store';
2
2
  export declare const usePaymentProvider: () => PaymentProviderConfigState;
3
3
  export declare const usePaymentProviderActions: () => PaymentProviderConfigActions;
4
4
  export declare const usePlans: () => PlansState;
@@ -11,3 +11,5 @@ export declare const useBillingPaymentMethod: () => import("@frontegg/redux-stor
11
11
  export declare const useBillingPaymentMethodActions: () => import("@frontegg/redux-store").PaymentMethodActions;
12
12
  export declare const useInvoices: () => import("@frontegg/redux-store").InvoicesState;
13
13
  export declare const useInvoicesActions: () => import("@frontegg/redux-store").InvoicesActions;
14
+ export declare const useStripeState: () => StripeState;
15
+ export declare const useStripeActions: () => StripeActions;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var hooks = require('../hooks-8b7d27f0.js');
5
+ var hooks = require('../hooks-08977f1b.js');
6
6
  require('@frontegg/redux-store');
7
7
  require('../FronteggStoreContext-b66ab006.js');
8
8
  require('react');
@@ -22,4 +22,6 @@ exports.usePaymentProvider = hooks.usePaymentProvider;
22
22
  exports.usePaymentProviderActions = hooks.usePaymentProviderActions;
23
23
  exports.usePlans = hooks.usePlans;
24
24
  exports.usePlansActions = hooks.usePlansActions;
25
+ exports.useStripeActions = hooks.useStripeActions;
26
+ exports.useStripeState = hooks.useStripeState;
25
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"hooks-8b7d27f0.js","sources":["../src/subscriptions/hooks.ts"],"sourcesContent":["import {\n BillingActions,\n BillingState,\n CheckoutActions,\n CheckoutState,\n PaymentProviderConfigActions,\n PaymentProviderConfigState,\n PlansActions,\n PlansState,\n subscriptionActions,\n subscriptionsStoreName,\n bindActionCreators,\n} from '@frontegg/redux-store';\nimport { useDispatch, useSelector } from '../FronteggStoreContext';\nimport { shallowEqual } from 'react-redux';\nimport { useMemo } from 'react';\n\nexport const usePaymentProvider = (): PaymentProviderConfigState => {\n return useSelector((state: any) => state[subscriptionsStoreName]['config'], shallowEqual);\n};\n\nexport const usePaymentProviderActions = (): PaymentProviderConfigActions => {\n const dispatch = useDispatch();\n return useMemo(() => bindActionCreators(subscriptionActions.config, dispatch), [dispatch]);\n};\n\nexport const usePlans = (): PlansState => {\n return useSelector((state: any) => state[subscriptionsStoreName]['plans'], shallowEqual);\n};\n\nexport const usePlansActions = (): PlansActions => {\n const dispatch = useDispatch();\n return useMemo(() => bindActionCreators(subscriptionActions.plans, dispatch), [dispatch]);\n};\n\nexport const useCheckout = (): CheckoutState => {\n return useSelector((state: any) => state[subscriptionsStoreName]['checkout'], shallowEqual);\n};\n\nexport const useCheckoutActions = (): CheckoutActions => {\n const dispatch = useDispatch();\n return useMemo(() => bindActionCreators(subscriptionActions.checkout, dispatch), [dispatch]);\n};\n\nconst useBilling = <T extends keyof BillingState>(billingKey: T): BillingState[T] => {\n return useSelector((state: any) => state[subscriptionsStoreName]['billing'][billingKey], shallowEqual);\n};\n\nconst useBillingActions = <T extends keyof BillingActions>(billingKey: T): BillingActions[T] => {\n const dispatch = useDispatch();\n return useMemo(() => bindActionCreators(subscriptionActions['billing'][billingKey], dispatch), [billingKey, dispatch]);\n};\n\nexport const useBillingInformation = () => useBilling('information');\nexport const useBillingInformationActions = () => useBillingActions('information');\n\nexport const useBillingPaymentMethod = () => useBilling('paymentMethod');\nexport const useBillingPaymentMethodActions = () => useBillingActions('paymentMethod');\n\nexport const useInvoices = () => useBilling('invoices');\nexport const useInvoicesActions = () => useBillingActions('invoices');\n"],"names":["useSelector","subscriptionsStoreName","shallowEqual","useDispatch","useMemo","bindActionCreators","subscriptionActions"],"mappings":";;;;;;;IAiBa,kBAAkB,GAAG;IAChC,OAAOA,gCAAW,CAAC,UAAC,KAAU,IAAK,OAAA,KAAK,CAACC,iCAAsB,CAAC,CAAC,QAAQ,CAAC,GAAA,EAAEC,uBAAY,CAAC,CAAC;AAC5F,EAAE;IAEW,yBAAyB,GAAG;IACvC,IAAM,QAAQ,GAAGC,gCAAW,EAAE,CAAC;IAC/B,OAAOC,aAAO,CAAC,cAAM,OAAAC,6BAAkB,CAACC,8BAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAA,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC7F,EAAE;IAEW,QAAQ,GAAG;IACtB,OAAON,gCAAW,CAAC,UAAC,KAAU,IAAK,OAAA,KAAK,CAACC,iCAAsB,CAAC,CAAC,OAAO,CAAC,GAAA,EAAEC,uBAAY,CAAC,CAAC;AAC3F,EAAE;IAEW,eAAe,GAAG;IAC7B,IAAM,QAAQ,GAAGC,gCAAW,EAAE,CAAC;IAC/B,OAAOC,aAAO,CAAC,cAAM,OAAAC,6BAAkB,CAACC,8BAAmB,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAA,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC5F,EAAE;IAEW,WAAW,GAAG;IACzB,OAAON,gCAAW,CAAC,UAAC,KAAU,IAAK,OAAA,KAAK,CAACC,iCAAsB,CAAC,CAAC,UAAU,CAAC,GAAA,EAAEC,uBAAY,CAAC,CAAC;AAC9F,EAAE;IAEW,kBAAkB,GAAG;IAChC,IAAM,QAAQ,GAAGC,gCAAW,EAAE,CAAC;IAC/B,OAAOC,aAAO,CAAC,cAAM,OAAAC,6BAAkB,CAACC,8BAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAA,EAAE,CAAC,QAAQ,CAA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