{ "target_layout": "_admin_base", "init_actions": [ { "comment": "관리자 헤더 표시 통화 복원 — 호스트 _admin_base 는 통화/이커머스를 모른다. 이커머스가 이 init 단계를 layout_extensions(init_actions 병합)로 기여한다. localStorage(g7_preferred_currency) → _global.preferredCurrency, 없으면 default_currency. 표시 전용(영속 저장 없음). 핸들러는 이커머스 모듈 소유.", "handler": "sirsoft-ecommerce.initPreferredCurrency", "params": { "defaultCurrency": "{{_global.modules?.['sirsoft-ecommerce']?.language_currency?.default_currency ?? 'KRW'}}" } }, { "comment": "관리자 헤더 배송국가 복원 (표시 전용) — localStorage(g7_preferred_shipping_country) → _global.preferredShippingCountry, 없으면 default_country.", "handler": "sirsoft-ecommerce.initPreferredShippingCountry", "params": { "defaultCountry": "{{_global.modules?.['sirsoft-ecommerce']?.shipping?.default_country ?? 'KR'}}" } }, { "comment": "셀렉터 통화 목록 파생 주입 (유저 헤더 미러). is_default 또는 환율>0 통화만. 셀렉터 if 게이트가 이 파생 상태(availableCurrencies)를 참조 → init_actions 실행 후에만 truthy → 첫 페인트 깜빡임(G7Config 원본 직접 참조 시 동기 truthy 로 잠깐 보였다 사라짐) 제거.", "handler": "setState", "params": { "target": "global", "availableCurrencies": "{{(_global.modules?.['sirsoft-ecommerce']?.language_currency?.currencies ?? []).filter(c => c.is_default || (c.exchange_rate ?? 0) > 0)}}" } }, { "comment": "헤더 배송국가 셀렉터 목록 파생 주입 (유저 헤더 미러). 활성 국가만 {code, name(현지화)} 형태로. 해외배송 활성 게이트는 셀렉터 if 가 international_shipping_enabled 로 별도 체크(유저 헤더 동형). 셀렉터 if 게이트가 이 파생 상태(availableShippingCountries)를 참조.", "handler": "setState", "params": { "target": "global", "availableShippingCountries": "{{(_global.modules?.['sirsoft-ecommerce']?.shipping?.available_countries ?? []).filter(c => c.is_active).map(c => ({ code: c.code, name: (c.name?.[_global.locale] ?? c.name?.ko ?? c.code) }))}}" } } ], "injections": [ { "target_id": "header_currency_inject_anchor", "position": "append_child", "components": [ { "id": "ext_admin_header_currency_selector", "comment": "관리자 헤더 통화+배송국가 공용 셀렉터 (이커머스 주입, D4). slot='header_currency' 로 SlotContext 등록 → header_right 의 SlotContainer 가 떙겨 렌더. 헤더는 이 조각을 모름. 관리자 헤더 = 자기 화면 표시 전용(세션/localStorage). 영속 저장 없음(표시 전용). 표시 제어: 기본 hidden(display:none) → init_actions 가 채운 파생 상태(availableCurrencies/availableShippingCountries)가 표시 조건을 만족할 때만 hidden 해제. if(마운트 게이트) 대신 className 토글이라 첫 페인트부터 무조건 숨김 → 깜빡임(떴다 사라짐) 원천 차단.", "type": "basic", "name": "Div", "slot": "header_currency", "props": { "className": "relative {{(_global.availableCurrencies ?? []).length > 0 || ((_global.availableShippingCountries ?? []).length > 1 && _global.modules?.['sirsoft-ecommerce']?.shipping?.international_shipping_enabled === true) ? '' : 'hidden'}}" }, "children": [ { "type": "basic", "name": "Button", "props": { "className": "flex items-center gap-1.5 px-2.5 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg cursor-pointer transition-colors", "aria-haspopup": "listbox", "aria-expanded": "{{_local.showCurrencyDropdown ?? false}}", "aria-label": "$t:sirsoft-ecommerce.common.currency_label" }, "children": [ { "comment": "트리거 배송국가 코드 (해외배송 활성 시) — 관리자 헤더는 flag 없이 코드 병기", "type": "basic", "name": "Span", "if": "{{(_global.availableShippingCountries ?? []).length > 1 && _global.modules?.['sirsoft-ecommerce']?.shipping?.international_shipping_enabled === true}}", "props": { "className": "text-xs text-gray-500 dark:text-gray-400" }, "text": "{{_global.preferredShippingCountry ?? _global.modules?.['sirsoft-ecommerce']?.shipping?.default_country ?? 'KR'}}" }, { "type": "basic", "name": "Icon", "props": { "name": "coins", "className": "w-4 h-4" } }, { "type": "basic", "name": "Span", "props": { "className": "font-medium" }, "text": "{{_global.preferredCurrency ?? _global.modules?.['sirsoft-ecommerce']?.language_currency?.default_currency ?? 'KRW'}}" }, { "type": "basic", "name": "Icon", "props": { "name": "chevron-down", "className": "w-3 h-3" } } ], "actions": [ { "type": "click", "handler": "setState", "params": { "target": "local", "showCurrencyDropdown": "{{!_local.showCurrencyDropdown}}" } } ] }, { "comment": "드롭다운 메뉴", "type": "basic", "name": "Div", "if": "{{_local.showCurrencyDropdown}}", "props": { "className": "absolute right-0 top-full mt-2 w-44 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50 py-1 overflow-hidden", "role": "listbox" }, "children": [ { "type": "basic", "name": "Div", "props": { "className": "px-4 py-1.5 text-xs font-semibold text-gray-400 dark:text-gray-500 uppercase tracking-wide" }, "text": "$t:sirsoft-ecommerce.common.currency_label" }, { "type": "basic", "name": "Div", "iteration": { "source": "{{_global.availableCurrencies ?? []}}", "item_var": "currency" }, "children": [ { "type": "basic", "name": "Button", "props": { "className": "w-full px-4 py-2.5 text-left text-sm flex items-center gap-3 cursor-pointer transition-colors {{_global.preferredCurrency === currency.code ? 'bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'}}", "role": "option", "aria-selected": "{{_global.preferredCurrency === currency.code}}" }, "children": [ { "type": "basic", "name": "Span", "props": { "className": "text-base" }, "text": "{{currency.flag}}" }, { "type": "basic", "name": "Span", "props": { "className": "flex-1" }, "children": [ { "type": "basic", "name": "Span", "props": { "className": "font-medium" }, "text": "{{currency.code}}" }, { "type": "basic", "name": "Span", "props": { "className": "text-gray-500 dark:text-gray-400 ml-1" }, "text": "({{currency.symbol}})" } ] }, { "type": "basic", "name": "Icon", "if": "{{_global.preferredCurrency === currency.code}}", "props": { "name": "check", "className": "w-4 h-4" } } ], "actions": [ { "type": "click", "handler": "sequence", "actions": [ { "handler": "setState", "params": { "target": "global", "preferredCurrency": "{{currency.code}}" } }, { "handler": "saveToLocalStorage", "params": { "key": "g7_preferred_currency", "value": "{{currency.code}}" } }, { "handler": "setState", "params": { "target": "local", "showCurrencyDropdown": false } } ] } ] } ] }, { "comment": "── 구분선 ──", "type": "basic", "name": "Div", "if": "{{(_global.availableShippingCountries ?? []).length > 1 && _global.modules?.['sirsoft-ecommerce']?.shipping?.international_shipping_enabled === true}}", "props": { "className": "my-1 border-t border-gray-200 dark:border-gray-700" } }, { "comment": "── 배송국가 섹션 (표시 전용) ──", "type": "basic", "name": "Div", "if": "{{(_global.availableShippingCountries ?? []).length > 1 && _global.modules?.['sirsoft-ecommerce']?.shipping?.international_shipping_enabled === true}}", "children": [ { "type": "basic", "name": "Div", "props": { "className": "px-4 py-1.5 text-xs font-semibold text-gray-400 dark:text-gray-500 uppercase tracking-wide" }, "text": "$t:sirsoft-ecommerce.common.shipping_country_label" }, { "type": "basic", "name": "Div", "iteration": { "source": "{{_global.availableShippingCountries ?? []}}", "item_var": "shipCountry" }, "children": [ { "type": "basic", "name": "Button", "props": { "className": "w-full px-4 py-2.5 text-left text-sm flex items-center gap-3 cursor-pointer transition-colors {{(_global.preferredShippingCountry ?? 'KR') === shipCountry.code ? 'bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400' : 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'}}", "role": "option", "aria-selected": "{{(_global.preferredShippingCountry ?? 'KR') === shipCountry.code}}" }, "children": [ { "type": "basic", "name": "Span", "props": { "className": "flex-1 font-medium" }, "text": "{{shipCountry.name ?? shipCountry.code}}" }, { "type": "basic", "name": "Icon", "if": "{{(_global.preferredShippingCountry ?? 'KR') === shipCountry.code}}", "props": { "name": "check", "className": "w-4 h-4" } } ], "actions": [ { "type": "click", "handler": "sequence", "actions": [ { "handler": "setState", "params": { "target": "global", "preferredShippingCountry": "{{shipCountry.code}}" } }, { "handler": "saveToLocalStorage", "params": { "key": "g7_preferred_shipping_country", "value": "{{shipCountry.code}}" } }, { "handler": "setState", "params": { "target": "local", "showCurrencyDropdown": false } } ] } ] } ] } ] } ] }, { "comment": "배경 클릭 시 닫기", "type": "basic", "name": "Div", "if": "{{_local.showCurrencyDropdown}}", "props": { "className": "fixed inset-0 z-40" }, "actions": [ { "type": "click", "handler": "setState", "params": { "target": "local", "showCurrencyDropdown": false } } ] } ] } ] } ], "priority": 320 }