Assist_Design/apps/portal/public/storybook/assets/AddonGroup-BSDkN5FG.js
Temuulen Ankhbayar e704488eb9 chore: add Storybook static build output
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 15:25:18 +09:00

14 lines
5.9 KiB
JavaScript

import{j as n}from"./jsx-runtime-D_zvdyIk.js";import{F as c}from"./CheckCircleIcon-DrKOIitY.js";function f(e){const s=[],t=new Set,d=[...e].sort((i,a)=>(i.displayOrder??0)-(a.displayOrder??0));for(const i of d)if(!t.has(i.sku)){if(i.isBundledAddon&&i.bundledAddonId){const a=d.find(u=>u.id===i.bundledAddonId);if(a&&!t.has(a.sku)){const u=y(i,a);s.push(u),t.add(i.sku),t.add(a.sku);continue}}s.push(p(i)),t.add(i.sku)}return s}function y(e,s){const t=e.billingCycle==="Monthly"?e:s,d=e.billingCycle==="Onetime"?e:s,i=t.name.replace(/\s*(Monthly|Installation|Fee)\s*/gi,"").trim();return{id:`bundle-${e.sku}-${s.sku}`,name:i,description:`${i} (monthly service + installation)`,monthlyPrice:typeof t.monthlyPrice=="number"&&t.monthlyPrice>0?t.monthlyPrice:void 0,activationPrice:typeof d.oneTimePrice=="number"&&d.oneTimePrice>0?d.oneTimePrice:void 0,skus:[e.sku,s.sku],isBundled:!0,displayOrder:Math.min(e.displayOrder??0,s.displayOrder??0)}}function p(e){return{id:e.sku,name:e.name,description:e.description||"",monthlyPrice:typeof e.monthlyPrice=="number"&&e.monthlyPrice>0?e.monthlyPrice:void 0,activationPrice:typeof e.oneTimePrice=="number"&&e.oneTimePrice>0?e.oneTimePrice:void 0,skus:[e.sku],isBundled:!1,displayOrder:e.displayOrder??0}}function h({addons:e,selectedAddonSkus:s,onAddonToggle:t,showSkus:d=!1}){const i=s.length===0,a=f(e),u=r=>{if(r.skus.every(l=>s.includes(l)))t(s.filter(l=>!r.skus.includes(l)));else{const l=s.filter(m=>!r.skus.includes(m));t([...l,...r.skus])}};return a.length===0?n.jsx("div",{className:"text-center py-4 text-gray-500",children:n.jsx("p",{children:"No add-ons available for this plan"})}):n.jsxs("div",{className:"space-y-4",children:[a.map(r=>{const o=r.skus.every(l=>s.includes(l));return n.jsxs("label",{className:`flex items-start gap-3 p-4 rounded-lg border-2 cursor-pointer transition-all ${o?"border-green-500 bg-green-50 ring-2 ring-green-100":"border-gray-200 hover:border-gray-300"}`,children:[n.jsx("input",{type:"checkbox",checked:o,onChange:()=>u(r),className:"text-green-600 focus:ring-green-500 mt-1"}),n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"font-medium text-gray-900",children:r.name}),o&&n.jsx(c,{className:"h-5 w-5 text-green-600"})]}),n.jsx("p",{className:"text-sm text-gray-600 mt-1",children:r.description}),n.jsxs("div",{className:"flex flex-wrap gap-4 mt-2",children:[r.monthlyPrice!==void 0&&n.jsxs("span",{className:"text-sm font-semibold text-blue-600",children:["¥",r.monthlyPrice.toLocaleString(),"/month"]}),r.activationPrice!==void 0&&n.jsxs("span",{className:"text-sm font-semibold text-orange-600",children:["Activation: ¥",r.activationPrice.toLocaleString()]})]}),r.isBundled&&n.jsxs("div",{className:"text-xs text-green-600 mt-1 flex items-center gap-1",children:[n.jsx("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M3.172 5.172a4 4 0 015.656 0L10 6.343l1.172-1.171a4 4 0 115.656 5.656L10 17.657l-6.828-6.829a4 4 0 010-5.656z",clipRule:"evenodd"})}),"Bundle Package"]}),d&&n.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:["SKUs: ",r.skus.join(", ")]})]})]},r.id)}),n.jsxs("div",{"aria-hidden":!i,className:`overflow-hidden rounded-xl border border-dashed border-blue-200/70 bg-blue-50/80 px-5 transition-all duration-300 ease-out ${i?"opacity-100 translate-y-0 max-h-32 py-4":"pointer-events-none opacity-0 -translate-y-2 max-h-0 py-0"}`,children:[n.jsx("p",{className:"text-sm font-medium text-blue-800",children:"No add-ons selected"}),n.jsx("p",{className:"text-xs text-blue-700/80 mt-1",children:"Pick optional services now or continue without extras—add them later anytime."})]})]})}h.__docgenInfo={description:"",methods:[],displayName:"AddonGroup",props:{addons:{required:!0,tsType:{name:"Array",elements:[{name:"signature",type:"object",raw:`{
id: string;
sku: string;
name: string;
description?: string | undefined;
displayOrder?: number | undefined;
billingCycle?: string | undefined;
monthlyPrice?: number | undefined;
oneTimePrice?: number | undefined;
unitPrice?: number | undefined;
bundledAddonId?: string | undefined;
isBundledAddon?: boolean | undefined;
}`,signature:{properties:[{key:"id",value:{name:"string",required:!0}},{key:"sku",value:{name:"string",required:!0}},{key:"name",value:{name:"string",required:!0}},{key:"description",value:{name:"union",raw:"string | undefined",elements:[{name:"string"},{name:"undefined"}],required:!1}},{key:"displayOrder",value:{name:"union",raw:"number | undefined",elements:[{name:"number"},{name:"undefined"}],required:!1}},{key:"billingCycle",value:{name:"union",raw:"string | undefined",elements:[{name:"string"},{name:"undefined"}],required:!1}},{key:"monthlyPrice",value:{name:"union",raw:"number | undefined",elements:[{name:"number"},{name:"undefined"}],required:!1}},{key:"oneTimePrice",value:{name:"union",raw:"number | undefined",elements:[{name:"number"},{name:"undefined"}],required:!1}},{key:"unitPrice",value:{name:"union",raw:"number | undefined",elements:[{name:"number"},{name:"undefined"}],required:!1}},{key:"bundledAddonId",value:{name:"union",raw:"string | undefined",elements:[{name:"string"},{name:"undefined"}],required:!1}},{key:"isBundledAddon",value:{name:"union",raw:"boolean | undefined",elements:[{name:"boolean"},{name:"undefined"}],required:!1}}]}}],raw:"AddonItem[]"},description:""},selectedAddonSkus:{required:!0,tsType:{name:"Array",elements:[{name:"string"}],raw:"string[]"},description:""},onAddonToggle:{required:!0,tsType:{name:"signature",type:"function",raw:"(skus: string[]) => void",signature:{arguments:[{type:{name:"Array",elements:[{name:"string"}],raw:"string[]"},name:"skus"}],return:{name:"void"}}},description:""},showSkus:{required:!1,tsType:{name:"union",raw:"boolean | undefined",elements:[{name:"boolean"},{name:"undefined"}]},description:"",defaultValue:{value:"false",computed:!1}}}};export{h as A};