function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import React from 'react';
import { PisellFinancialSummary } from "./PisellFinancialSummary";
import { financialSummaryLocales } from "./index";
import { locales } from '@pisell/utils';
// 初始化多语言，便于 Story 中标题显示为中文
if (typeof locales.init === 'function') {
  try {
    locales.init(financialSummaryLocales, 'zh-CN');
  } catch (_) {
    // ignore if already inited
  }
}
var defaultData = {
  balanceDue: 54,
  total: {
    value: 54,
    children: [{
      label: 'Subtotal',
      value: 60.2,
      itemsCount: '3 items'
    }, {
      label: 'GST/Tax',
      value: 1,
      infoTooltip: 'Tax tooltip'
    }, {
      label: 'Delivery Fee',
      value: 3
    }, {
      label: 'Holiday surcharge',
      value: 3
    }, {
      label: 'Discount',
      value: -5
    }]
  },
  paid: [{
    methodName: 'Card',
    amount: 54,
    time: '14:00'
  }],
  refund: []
};
var meta = {
  title: 'Plus Components/PisellFinancialSummary',
  component: PisellFinancialSummary,
  tags: ['autodocs'],
  parameters: {
    layout: 'padded',
    backgrounds: {
      default: 'gray',
      values: [{
        name: 'gray',
        value: '#f5f5f5'
      }, {
        name: 'white',
        value: '#ffffff'
      }]
    },
    docs: {
      description: {
        component: '资金汇总组件：展示 Balance Due、Total、Paid、Refund 层级结构，基于 PisellHierarchicalSummaryList。适用于订单详情、销售记录、购物车结算等场景。'
      }
    }
  },
  decorators: [function (Story) {
    return /*#__PURE__*/React.createElement("div", {
      style: {
        background: '#f5f5f5',
        minHeight: '100%',
        padding: 24
      }
    }, /*#__PURE__*/React.createElement(Story, null));
  }],
  argTypes: {
    data: {
      description: '资金汇总数据'
    },
    showTotal: {
      control: 'boolean',
      description: '是否显示 Total 区块'
    },
    showPaid: {
      control: 'boolean',
      description: '是否显示 Paid 区块'
    },
    showRefund: {
      control: 'boolean',
      description: '是否显示 Refund 区块'
    },
    currencySymbol: {
      control: 'text',
      description: '货币符号'
    },
    amountPrecision: {
      control: 'number',
      description: '金额小数位'
    },
    hideZeroAmountRows: {
      control: 'boolean',
      description: '是否隐藏 0 金额行'
    }
  }
};
export default meta;
/** 最全示例：应付余额 + 费用合计（多行明细）+ 付款历史（多条 Collapse）+ 退款（Collapse），默认展开到三级 */
var fullExampleData = {
  balanceDue: 130,
  total: {
    value: 54,
    children: [{
      label: 'Subtotal',
      value: 60.2,
      itemsCount: '3 items'
    }, {
      label: 'GST/Tax',
      value: 1,
      infoTooltip: 'Tax tooltip'
    }, {
      label: 'Delivery Fee/运费',
      value: 3
    }, {
      label: 'Surcharges',
      value: 3,
      itemsCount: '2 items',
      children: [{
        label: 'Holiday surcharge/节假日附加费',
        value: 1
      }, {
        label: '自定义其他附加费用',
        value: 2
      }]
    }, {
      label: 'Discount',
      value: -9,
      itemsCount: '3 items',
      children: [{
        label: '积分抵扣',
        value: -3
      }, {
        label: '会员抵扣',
        value: -3
      }, {
        label: '商品折扣',
        value: -3,
        children: [{
          label: '两件10元',
          value: -1
        }, {
          label: '活动标题',
          value: -2
        }]
      }]
    }]
  },
  paid: [{
    key: 'paid-1',
    methodName: 'Visa (12****1234)',
    time: '20:00',
    date: '30/08/2025',
    customer: 'Customer',
    channel: 'Online Store',
    amount: -30,
    bodyRows: [{
      label: 'Visa (12****1234)',
      amount: '-$30',
      action: {
        label: 'Void',
        onClick: function onClick() {}
      }
    }]
  }, {
    key: 'paid-2',
    methodName: 'Card',
    time: '20:00',
    date: '28/08/2025',
    customer: 'Staff: Jenny',
    channel: 'Terminal 1100',
    amount: -50,
    bodyRows: [{
      label: 'Card（Code: 6a****533d）',
      amount: '-$20',
      action: {
        label: 'Void',
        onClick: function onClick() {}
      }
    }, {
      label: 'Card（Code: 4a****133d）',
      amount: '-$10',
      action: {
        label: 'Void',
        onClick: function onClick() {}
      }
    }]
  }],
  refund: [{
    key: 'refund-1',
    label: 'Order cancelled',
    amount: 20,
    time: '15:00',
    date: '29/08/2025',
    customer: 'Staff',
    channel: 'Counter',
    bodyRows: [{
      label: 'Order cancelled',
      amount: '$20',
      action: {
        label: 'View',
        onClick: function onClick() {}
      }
    }]
  }]
};
export var FullExample = {
  name: '最全示例',
  parameters: {
    docs: {
      description: {
        story: '一级标题总价（应付余额）、二级标题费用合计 / 付款历史 / 退款；费用合计展开为多行明细，付款历史与退款展开为 Collapse 列表。'
      }
    },
    backgrounds: {
      default: 'white',
      values: [{
        name: 'white',
        value: '#ffffff'
      }]
    }
  },
  decorators: [function (Story) {
    return /*#__PURE__*/React.createElement("div", {
      style: {
        background: '#fff',
        padding: 24,
        maxWidth: 560,
        margin: '0 auto'
      }
    }, /*#__PURE__*/React.createElement(Story, null));
  }],
  args: {
    data: fullExampleData,
    currencySymbol: '$',
    amountPrecision: 2,
    defaultExpandedLevel: 4,
    titleBalanceDue: '应付余额',
    titleTotal: '费用合计',
    titlePaid: '付款历史',
    titleRefund: '退款'
  }
};
export var Default = {
  args: {
    data: defaultData,
    currencySymbol: 'A$'
  }
};
export var WithRefund = {
  args: {
    data: _objectSpread(_objectSpread({}, defaultData), {}, {
      refund: [{
        label: 'Order cancelled',
        amount: 10,
        time: '15:00'
      }]
    }),
    currencySymbol: 'A$'
  }
};
export var BalanceDueOnly = {
  args: {
    data: {
      balanceDue: 100
    },
    currencySymbol: '$'
  }
};
export var MissingBalanceDue = {
  args: {
    data: _objectSpread(_objectSpread({}, defaultData), {}, {
      balanceDue: null
    }),
    missingValuePlaceholder: '—',
    currencySymbol: 'A$'
  }
};
export var HideZeroAmountRows = {
  args: {
    data: {
      balanceDue: 50,
      total: {
        value: 50,
        children: [{
          label: 'Subtotal',
          value: 50
        }, {
          label: 'Discount',
          value: 0
        }, {
          label: 'Fee',
          value: 0
        }]
      }
    },
    hideZeroAmountRows: true,
    currencySymbol: '$'
  }
};
export var TitleOverride = {
  args: {
    data: defaultData,
    titleBalanceDue: '应付金额',
    titleTotal: '费用合计',
    titlePaid: '已付',
    titleRefund: '退款',
    currencySymbol: '¥'
  }
};
export var NoPaidNoRefund = {
  args: {
    data: {
      balanceDue: 54,
      total: defaultData.total
    },
    currencySymbol: 'A$'
  }
};

/**
 * 与 Figma 设计稿 1:1 一致的展示，用于视觉对比与验收。
 * 设计稿链接：https://www.figma.com/design/pM8Ho6d7kCMv9vIBvFHUlj/Pisell-2.0-Component-Library?node-id=14256-4201
 * 内容与层级按设计文档 §6.1 / §8：Balance due、Total（Subtotal/Tax/Fee/Surcharge/Discount）、Paid、Refund；默认展开 Total/Paid 见明细。
 */
export var FigmaDesign = {
  name: 'Figma 14256-4201（设计稿 1:1）',
  parameters: {
    docs: {
      description: {
        story: '与 [Figma 设计稿 node 14256-4201](https://www.figma.com/design/pM8Ho6d7kCMv9vIBvFHUlj/Pisell-2.0-Component-Library?node-id=14256-4201&m=dev) 完全一致的展示，白底、展开 Total/Paid 明细，便于视觉对比。'
      }
    },
    backgrounds: {
      default: 'white',
      values: [{
        name: 'white',
        value: '#ffffff'
      }]
    }
  },
  decorators: [function (Story) {
    return /*#__PURE__*/React.createElement("div", {
      style: {
        background: '#ffffff',
        padding: 0,
        maxWidth: 400,
        minHeight: 320,
        margin: '0 auto'
      }
    }, /*#__PURE__*/React.createElement(Story, null));
  }],
  args: {
    data: {
      balanceDue: 54,
      total: {
        value: 54,
        children: [{
          label: 'Subtotal',
          value: 60.2,
          itemsCount: '3 items'
        }, {
          label: 'GST/Tax',
          value: 1,
          infoTooltip: 'Tax tooltip'
        }, {
          label: 'Delivery Fee',
          value: 3
        }, {
          label: 'Holiday surcharge',
          value: 3
        }, {
          label: 'Discount',
          value: -5
        }]
      },
      paid: [{
        methodName: 'Card',
        amount: 54,
        time: '14:00'
      }],
      refund: []
    },
    currencySymbol: 'A$',
    amountPrecision: 2,
    defaultExpandedLevel: 2
  }
};

/**
 * Figma 14256:4201「总结」：一级标题总价（应付余额）、二级标题费用合计/付款历史/退款，同一列表。
 * 设计稿：https://www.figma.com/design/pM8Ho6d7kCMv9vIBvFHUlj/Pisell-2.0-Component-Library?node-id=14256-4201
 */
export var Figma14256_4201_FullSummary = {
  name: 'Figma 14256-4201 完整总结',
  parameters: {
    docs: {
      description: {
        story: '[Figma 14256:4201](https://www.figma.com/design/pM8Ho6d7kCMv9vIBvFHUlj/Pisell-2.0-Component-Library?node-id=14256-4201&m=dev) 结构：一级标题为总价（应付余额），二级标题为费用合计、付款历史、退款；同一列表展开可见 Subtotal/GST/支付记录等明细。'
      }
    },
    backgrounds: {
      default: 'white',
      values: [{
        name: 'white',
        value: '#ffffff'
      }]
    }
  },
  decorators: [function (Story) {
    return /*#__PURE__*/React.createElement("div", {
      style: {
        background: '#ffffff',
        padding: 0,
        maxWidth: 600,
        margin: '0 auto'
      }
    }, /*#__PURE__*/React.createElement(Story, null));
  }],
  args: {
    data: {
      balanceDue: 130,
      total: {
        value: 54,
        children: [{
          label: 'Subtotal',
          value: 60.2,
          itemsCount: '3 items'
        }, {
          label: 'GST/Tax',
          value: 1,
          infoTooltip: 'Tax tooltip'
        }, {
          label: 'Delivery Fee/运费',
          value: 3
        }, {
          label: 'Surcharges',
          value: 3,
          itemsCount: '2 items',
          children: [{
            label: 'Holiday surcharge/节假日附加费',
            value: 1
          }, {
            label: '自定义其他附加费用',
            value: 2
          }]
        }, {
          label: 'Discount',
          value: -9,
          itemsCount: '3 items',
          children: [{
            label: '积分抵扣',
            value: -3
          }, {
            label: '会员抵扣',
            value: -3
          }, {
            label: '商品折扣',
            value: -3,
            children: [{
              label: '两件10元',
              value: -1
            }, {
              label: '活动标题',
              value: -2
            }]
          }]
        }]
      },
      paid: [{
        key: 'paid-1',
        methodName: 'Visa (12****1234)',
        time: '20:00',
        date: '30/08/2025',
        customer: 'Customer',
        channel: 'Online Store',
        amount: -30
      }, {
        key: 'paid-2',
        methodName: 'Card',
        time: '20:00',
        date: '28/08/2025',
        customer: 'Staff: Jenny',
        channel: 'Terminal 1100',
        amount: -50
      }],
      refund: []
    },
    currencySymbol: '$',
    amountPrecision: 2,
    defaultExpandedLevel: 3
  }
};