1// CWA Store Configuration Utility
2// Allows switching between different Cartridge World Australia stores
4export interface CWAStore {
11// Available CWA stores from environment variables
12export const CWA_STORES: CWAStore[] = [
16 url: process.env.FIELDPINE_STORE_IIG || 'https://iig.cwanz.online',
17 location: 'Primary Store'
21 name: 'Murwillumbah Store',
22 url: process.env.FIELDPINE_STORE_MURWILLUMBAH || 'https://murwillumbah.cwanz.online',
23 location: 'Murwillumbah'
28 url: process.env.FIELDPINE_STORE_COWRA || 'https://cowra.cwanz.online',
33// Get current store configuration
34export function getCurrentStore(): CWAStore {
35 const currentUrl = process.env.FIELDPINE_BASE_URL || process.env.NEXT_PUBLIC_FIELDPINE_BASE_URL;
36 const store = CWA_STORES.find(s => s.url === currentUrl);
37 return store || CWA_STORES[0]; // Default to first store
41export function getStoreById(id: string): CWAStore | undefined {
42 return CWA_STORES.find(s => s.id === id);
46export const CWA_DOCS_URL = process.env.FIELDPINE_DOCS_URL || 'https://cwanz.docs.fieldpine.com';
48// Helper to get login URL for a specific store
49export function getStoreLoginUrl(storeId: string): string {
50 const store = getStoreById(storeId);
51 return store ? `${store.url}/login` : `${CWA_STORES[0].url}/login`;