| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- "use client";
- import {
- createContext,
- } from "react";
- import {CurrencyItem} from "@/types/currency/type";
- import { Country } from "@/types/checkout/type";
- export interface StoreConfig {
- storeName: string;
- defaultCurrency: string;
- defaultLocale: string;
-
- defaultChannel: string;
- currentCurrency: string; // 货币码 e.g. USD GBP
- currentLocale: string;
- currentChannel: string;
- }
- export interface AppConfig {
- currencies: CurrencyItem[];
- countries: Country[];
- store: StoreConfig;
- }
- export const ConfigContext = createContext<AppConfig|null>(null);
- export function ConfigProvider({
- config,
- children
- }:{
- config:AppConfig;
- children:React.ReactNode;
- }){
- return (
- <ConfigContext.Provider
- value={config}
- >
- {children}
- </ConfigContext.Provider>
- );
- }
|