feat(cafe24): 편집기에 상품 다이렉트 주소 + 클립보드 복사

상세 화면 상단에 고객이 보는 상세페이지 주소를 보여주고 「주소 복사」·「쇼핑몰에서
열기」를 붙였다.

    https://miras.co.kr/product/detail.html?product_no=119

도메인은 하드코딩하지 않고 CAFE24_SHOP_URL 로 받는다. 커스텀 도메인은 mall_id 로
알 수 없기 때문이다. 미설정 시 카페24 기본 도메인(https://<mall_id>.cafe24.com)으로
대체해 환경변수가 없어도 항상 유효한 주소가 나온다. 스킴 누락·끝 슬래시도 정규화한다.

주소 칸은 readonly <input> 이라 기존 복사 버튼(data-copy)이 값을 그대로 읽어간다 —
클립보드 로직을 새로 만들지 않았다. 클립보드 API 가 막힌 환경에서는 입력칸 선택으로
대체되고, 칸을 클릭하면 전체 선택된다.

CAFE24_SHOP_URL 은 .env.example 과 문서에 설명을 함께 넣었다(신규 환경변수 규칙).

검증: 유닛테스트 61개 통과(신규 2개 — 스킴/슬래시 유무 3가지 입력에서 같은 주소,
미설정 시 카페24 도메인 대체). 렌더 확인 — 주소 표시·복사 버튼·새 창 열기(noopener),
주소를 만들 수 없으면 줄 자체를 숨김.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-14 16:46:04 +09:00
parent 8ec38db6d1
commit 469de15998
10 changed files with 102 additions and 3 deletions
@@ -29,6 +29,18 @@
</div>
</div>
{# 고객이 보는 상세페이지 주소. readonly input 이라 기존 복사 버튼(data-copy)이
그대로 동작한다(값을 box.value 로 읽는다). #}
{% if product_url %}
<div class="cf24-url-row">
<input class="cf24-url" id="cf24-url" type="text" readonly value="{{ product_url }}"
onclick="this.select();" aria-label="상품 상세페이지 주소" />
<button class="erp-btn erp-btn-outline" type="button" data-copy="cf24-url">주소 복사</button>
<a class="erp-btn erp-btn-outline" href="{{ product_url }}"
target="_blank" rel="noopener noreferrer">쇼핑몰에서 열기</a>
</div>
{% endif %}
{% if desc %}
<form class="cf24-editor-form" method="post"
action="/cafe24/products/{{ product_no }}/apply"
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/cafe24.css?v=20260814q" />
<link rel="stylesheet" href="/static/cafe24.css?v=20260814r" />
{% endblock %}
{% block content %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/cafe24.css?v=20260814q" />
<link rel="stylesheet" href="/static/cafe24.css?v=20260814r" />
{% endblock %}
{% block content %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/cafe24.css?v=20260814q" />
<link rel="stylesheet" href="/static/cafe24.css?v=20260814r" />
{% endblock %}
{% block content %}