2026-10-22 04:21:26 +08:00
|
|
|
|
'use strict';
|
|
|
|
|
|
// 模板只保存表单预设;金额仍用元、重量仍用克,不继承订单或流水身份。
|
|
|
|
|
|
(function (root, factory) {
|
2026-10-25 14:19:24 +08:00
|
|
|
|
const api = factory(
|
|
|
|
|
|
typeof module === 'object' && module.exports ? require('./fee-estimates') : root.FeeEstimates,
|
|
|
|
|
|
typeof module === 'object' && module.exports ? require('./credit-card-fees') : root.CreditCardFees,
|
|
|
|
|
|
);
|
2026-10-22 04:21:26 +08:00
|
|
|
|
if (typeof module === 'object' && module.exports) module.exports = api;
|
|
|
|
|
|
else root.OrderTemplates = api;
|
2026-12-05 08:00:41 -08:00
|
|
|
|
})(
|
|
|
|
|
|
typeof globalThis === 'object' ? globalThis : /** @type {typeof globalThis} */ (/** @type {unknown} */ (this)),
|
|
|
|
|
|
/** @param {typeof import('./fee-estimates')} Fees @param {typeof import('./credit-card-fees')} Cards */ function (
|
|
|
|
|
|
Fees,
|
|
|
|
|
|
Cards,
|
|
|
|
|
|
) {
|
|
|
|
|
|
const products = ['足金999', '足银999', '纯银925'],
|
|
|
|
|
|
charges = ['编绳', '证书', '包装', '快递', '附加费'];
|
|
|
|
|
|
const pockets = ['', '现货', '金料', '找金', '回收旧料', '君宝汇'];
|
|
|
|
|
|
const accounts = [
|
|
|
|
|
|
'助理2微信',
|
|
|
|
|
|
'助理2支付宝',
|
|
|
|
|
|
'助理2现金',
|
|
|
|
|
|
'助理2信用卡',
|
|
|
|
|
|
'助理微信',
|
|
|
|
|
|
'助理支付宝',
|
|
|
|
|
|
'助理现金',
|
|
|
|
|
|
'助理信用卡',
|
|
|
|
|
|
'麦麦微信',
|
|
|
|
|
|
'麦麦支付宝',
|
|
|
|
|
|
'麦麦现金',
|
|
|
|
|
|
'麦麦信用卡',
|
|
|
|
|
|
];
|
|
|
|
|
|
/** @param {string} account */
|
|
|
|
|
|
const normalizeAccount = account =>
|
|
|
|
|
|
Cards?.normalizeAccount
|
|
|
|
|
|
? Cards.normalizeAccount(account)
|
|
|
|
|
|
: ['助理信用卡', '助理1信用卡', '助理2信用卡', '麦麦信用卡'].includes(account)
|
|
|
|
|
|
? '麦麦信用卡'
|
|
|
|
|
|
: account;
|
|
|
|
|
|
/** @param {{system?:unknown;key?:unknown}} item */
|
|
|
|
|
|
const cardFee = item => item?.system === 'credit_card' || String(item?.key || '').startsWith('card_fee:');
|
|
|
|
|
|
/** @param {unknown} value */
|
|
|
|
|
|
const properties = value =>
|
|
|
|
|
|
value && typeof value === 'object' ? /** @type {Record<string,unknown>} */ (value) : {};
|
|
|
|
|
|
const uuid = /^[a-f0-9-]{36}$/;
|
|
|
|
|
|
/** @param {unknown} value @param {string} name */
|
|
|
|
|
|
function object(value, name) {
|
|
|
|
|
|
if (!value || typeof value !== 'object' || Array.isArray(value)) throw new Error(name + '格式无效');
|
|
|
|
|
|
return /** @type {Record<string,unknown>} */ (value);
|
|
|
|
|
|
}
|
|
|
|
|
|
/** @param {unknown} value @param {string} name */
|
|
|
|
|
|
function string(value, name, max = 100) {
|
|
|
|
|
|
if (value != null && !['string', 'number'].includes(typeof value)) throw new Error(name + '格式无效');
|
|
|
|
|
|
const result = String(value ?? '').trim();
|
|
|
|
|
|
if (result.length > max) throw new Error(name + '最多填写' + max + '字');
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
/** @param {unknown} value @param {readonly string[]} values @param {string} name @param {unknown} fallback */
|
|
|
|
|
|
function pick(value, values, name, fallback) {
|
|
|
|
|
|
const result = value ?? fallback;
|
|
|
|
|
|
if (typeof result !== 'string' || !values.includes(result)) throw new Error(name + '无效');
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
/** @param {unknown} value @param {string} name */
|
|
|
|
|
|
function numeric(value, name, places = 2) {
|
|
|
|
|
|
const result = string(value, name, 24);
|
|
|
|
|
|
if (!result) return '';
|
|
|
|
|
|
if (!new RegExp('^\\d+(?:\\.\\d{1,' + places + '})?$').test(result))
|
|
|
|
|
|
throw new Error(name + '须为非负数字,最多' + places + '位小数');
|
|
|
|
|
|
const [whole, fraction = ''] = result.split('.');
|
|
|
|
|
|
if (BigInt(whole) * 10n ** BigInt(places) + BigInt(fraction.padEnd(places, '0')) > 100000000000n)
|
|
|
|
|
|
throw new Error(name + '超出支持范围');
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
/** @param {unknown} value @param {string} name */
|
|
|
|
|
|
function count(value, name) {
|
|
|
|
|
|
const result = string(value, name, 12);
|
|
|
|
|
|
if (result && !/^\d+$/.test(result)) throw new Error(name + '须为非负整数');
|
|
|
|
|
|
if (Number(result) > 1000000000) throw new Error(name + '超出支持范围');
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
/** @param {string} value */
|
|
|
|
|
|
const validMember = value =>
|
|
|
|
|
|
['owner', 'assistant', 'assistant2'].includes(value) ||
|
|
|
|
|
|
/^staff_[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/.test(value);
|
|
|
|
|
|
/** @param {unknown} value @param {unknown} [fallback] */
|
|
|
|
|
|
function payer(value, fallback = 'owner') {
|
|
|
|
|
|
const result = value ?? fallback;
|
|
|
|
|
|
if (typeof result !== 'string' || (result !== '' && !validMember(result))) throw new Error('成本付款人无效');
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
/** @param {unknown} value */
|
|
|
|
|
|
function paymentAccount(value) {
|
|
|
|
|
|
if (value != null && typeof value !== 'string') throw new Error('收款账户无效');
|
|
|
|
|
|
const result = normalizeAccount(value ?? '助理微信');
|
|
|
|
|
|
if (
|
|
|
|
|
|
!accounts.includes(result) &&
|
|
|
|
|
|
!/^staff_[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}(微信|支付宝|现金)$/.test(result)
|
|
|
|
|
|
)
|
|
|
|
|
|
throw new Error('收款账户无效');
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
/** @param {unknown} [input] @param {Record<string,unknown>} [fallback] */
|
|
|
|
|
|
function manualMaterial(input = {}, fallback = {}) {
|
|
|
|
|
|
const value = object(input, '备用料费');
|
|
|
|
|
|
return {
|
|
|
|
|
|
mode: pick(value.mode, ['gram', 'total'], '备用料费方式', fallback.mode || 'gram'),
|
|
|
|
|
|
rate: numeric(value.rate ?? fallback.rate, '备用进货料价'),
|
|
|
|
|
|
total: numeric(value.total ?? fallback.total, '备用料费合计'),
|
|
|
|
|
|
originalTotal: '',
|
|
|
|
|
|
payer: payer(value.payer, fallback.payer ?? 'owner'),
|
2026-10-22 04:21:26 +08:00
|
|
|
|
};
|
2026-12-05 08:00:41 -08:00
|
|
|
|
}
|
|
|
|
|
|
/** @param {Record<string,unknown>} draft @param {import('../web/src/shared/orderPresets').TemplateOptions} [options] */
|
|
|
|
|
|
function fromDraft(draft, { newId = () => globalThis.crypto.randomUUID(), pocketKeys = pockets } = {}) {
|
|
|
|
|
|
object(draft, '开单预设');
|
|
|
|
|
|
if (!Array.isArray(draft.lines) || !draft.lines.length || draft.lines.length > 60)
|
|
|
|
|
|
throw new Error('模板需要1~60行商品');
|
|
|
|
|
|
const ids = new Map(),
|
|
|
|
|
|
seen = new Set();
|
|
|
|
|
|
const lines = draft.lines.map(raw => {
|
|
|
|
|
|
const line = object(raw, '模板商品'),
|
|
|
|
|
|
unit = pick(line.unit, ['g', '件'], '商品单位', 'g');
|
|
|
|
|
|
const name = string(line.name, '商品名称', 60),
|
2026-10-22 04:21:26 +08:00
|
|
|
|
nameType = pick(
|
2026-12-05 08:00:41 -08:00
|
|
|
|
line.nameType,
|
|
|
|
|
|
[...products, '其他'],
|
|
|
|
|
|
'商品名称',
|
|
|
|
|
|
products.includes(name) ? name : name ? '其他' : '足金999',
|
2026-10-22 04:21:26 +08:00
|
|
|
|
);
|
2026-12-05 08:00:41 -08:00
|
|
|
|
/** @type {Omit<import('../web/src/shared/orderPresets').TemplateProduct, 'charges'>} */
|
|
|
|
|
|
const product = {
|
2026-11-20 00:43:55 +08:00
|
|
|
|
nameType,
|
2026-12-05 08:00:41 -08:00
|
|
|
|
customName: string(line.customName ?? (nameType === '其他' ? name : ''), '其他商品名称', 60),
|
|
|
|
|
|
unit,
|
|
|
|
|
|
quantity: unit === 'g' ? numeric(line.quantity, '商品克重', 3) : count(line.quantity, '商品件数'),
|
|
|
|
|
|
pocket:
|
|
|
|
|
|
unit === '件' || ['足银999', '纯银925'].includes(nameType)
|
|
|
|
|
|
? ''
|
|
|
|
|
|
: pick(line.pocket, ['', ...pocketKeys], '出库货盘', nameType === '足金999' ? '现货' : ''),
|
|
|
|
|
|
payer: payer(line.payer, 'owner'),
|
|
|
|
|
|
pricingMode:
|
|
|
|
|
|
unit === '件'
|
|
|
|
|
|
? 'manual'
|
|
|
|
|
|
: pick(line.pricingMode, ['auto', 'manual'], '计价方式', line.sale != null ? 'manual' : 'auto'),
|
|
|
|
|
|
goldPrice: numeric(line.goldPrice, '销售金价'),
|
|
|
|
|
|
laborMode: pick(line.laborMode, ['gram', 'piece'], '销售工费方式', 'gram'),
|
|
|
|
|
|
laborRate: numeric(line.laborRate, '销售工费'),
|
|
|
|
|
|
pieces: count(line.pieces ?? '1', '计工费件数'),
|
|
|
|
|
|
priceNote: string(line.priceNote, '销售单价说明', 100),
|
|
|
|
|
|
sale: numeric(line.sale, '本行销售额'),
|
|
|
|
|
|
baseSale: numeric(line.baseSale ?? line.sale, '商品基础金额'),
|
2026-10-22 04:21:26 +08:00
|
|
|
|
};
|
2026-12-05 08:00:41 -08:00
|
|
|
|
product.name = nameType === '其他' ? product.customName : nameType;
|
|
|
|
|
|
if (line.stockCount != null && String(line.stockCount).trim() !== '') {
|
|
|
|
|
|
product.stockCount = count(line.stockCount, '出库数量(对)');
|
|
|
|
|
|
if (Number(product.stockCount) < 1) throw new Error('出库数量(对)须为正整数,一对填1');
|
2026-10-22 04:21:26 +08:00
|
|
|
|
}
|
2026-12-05 08:00:41 -08:00
|
|
|
|
const rawCharges = line.charges ?? [];
|
|
|
|
|
|
if (!Array.isArray(rawCharges) || rawCharges.length > 100) throw new Error('每行最多填写100项附加项目');
|
|
|
|
|
|
/** @type {import('../web/src/shared/orderPresets').TemplateProduct['charges']} */
|
|
|
|
|
|
const normalizedCharges = rawCharges.map(rawCharge => {
|
|
|
|
|
|
const c = object(rawCharge, '附加项目'),
|
|
|
|
|
|
old = string(c.id, '附加项目标识', 36);
|
|
|
|
|
|
if (old && (!uuid.test(old) || seen.has(old))) throw new Error('附加项目标识无效或重复');
|
|
|
|
|
|
if (old) seen.add(old);
|
|
|
|
|
|
const name = string(c.name, '附加项目名称', 40),
|
|
|
|
|
|
nameType = pick(
|
|
|
|
|
|
c.nameType,
|
|
|
|
|
|
[...charges, '其他'],
|
|
|
|
|
|
'附加项目',
|
|
|
|
|
|
charges.includes(name) ? name : name ? '其他' : '编绳',
|
|
|
|
|
|
);
|
|
|
|
|
|
if (c.costRemoved !== undefined && typeof c.costRemoved !== 'boolean')
|
|
|
|
|
|
throw new Error('内部成本移除标记无效');
|
|
|
|
|
|
const id = newId();
|
|
|
|
|
|
if (old) ids.set(old, id);
|
|
|
|
|
|
const customName = string(c.customName ?? (nameType === '其他' ? name : ''), '附加项目名称', 40),
|
|
|
|
|
|
amount = numeric(c.amount, '附加金额');
|
|
|
|
|
|
/** @type {Record<string,string>} */
|
|
|
|
|
|
const prices = {};
|
|
|
|
|
|
if (c.chargePrices != null) {
|
|
|
|
|
|
const values = object(c.chargePrices, '附加项目预设报价');
|
|
|
|
|
|
for (const key of [...charges, '其他'])
|
|
|
|
|
|
if (Object.hasOwn(values, key)) prices[key] = numeric(values[key], '附加项目报价');
|
2026-11-19 02:23:28 +08:00
|
|
|
|
}
|
2026-12-04 00:53:53 +08:00
|
|
|
|
return {
|
2026-12-05 08:00:41 -08:00
|
|
|
|
id,
|
|
|
|
|
|
nameType,
|
|
|
|
|
|
customName,
|
|
|
|
|
|
name: nameType === '其他' ? customName : nameType,
|
|
|
|
|
|
amount,
|
|
|
|
|
|
chargePrices: { ...prices, [nameType]: amount },
|
|
|
|
|
|
...(c.costRemoved === true ? { costRemoved: true } : {}),
|
|
|
|
|
|
};
|
|
|
|
|
|
});
|
|
|
|
|
|
const result = {...product, charges:normalizedCharges};
|
|
|
|
|
|
if (line.costParts != null) {
|
|
|
|
|
|
const costs = object(line.costParts, '分项成本');
|
|
|
|
|
|
const parts = Object.fromEntries(
|
|
|
|
|
|
['material', 'labor', 'accessories', 'other'].map(key => [key, numeric(costs[key], '货品成本')]),
|
|
|
|
|
|
);
|
|
|
|
|
|
const material = object(line.costMaterial ?? {}, '料费方式'),
|
|
|
|
|
|
labor = object(line.costLabor ?? {}, '进货工费方式');
|
|
|
|
|
|
const mode = pick(
|
|
|
|
|
|
material.mode,
|
|
|
|
|
|
['gram', 'total', 'pool'],
|
|
|
|
|
|
'进货料费方式',
|
|
|
|
|
|
unit === 'g' && parts.material === '' ? 'gram' : 'total',
|
|
|
|
|
|
);
|
|
|
|
|
|
result.costParts = parts;
|
|
|
|
|
|
result.costPayers = {
|
|
|
|
|
|
material: payer(properties(line.costPayers).material, result.payer),
|
|
|
|
|
|
labor: payer(properties(line.costPayers).labor, result.payer),
|
|
|
|
|
|
};
|
|
|
|
|
|
result.costMaterial = {
|
|
|
|
|
|
mode: unit === '件' ? 'total' : mode,
|
|
|
|
|
|
...(mode === 'gram' ? { rate: numeric(material.rate, '进货料价') } : {}),
|
|
|
|
|
|
};
|
|
|
|
|
|
result.costLabor = {
|
|
|
|
|
|
mode: unit === '件' ? 'total' : pick(labor.mode, ['gram', 'total'], '进货工费方式', 'total'),
|
|
|
|
|
|
rate: numeric(labor.rate, '进货克工费'),
|
2026-12-04 00:53:53 +08:00
|
|
|
|
};
|
2026-12-05 08:00:41 -08:00
|
|
|
|
if (result.costMaterial.mode === 'pool') {
|
|
|
|
|
|
if (['足银999', '纯银925'].includes(nameType)) throw new Error('银饰模板请手动填写料费');
|
|
|
|
|
|
parts.material = '';
|
|
|
|
|
|
result.materialPoolDraft = {
|
|
|
|
|
|
defaultDate: true,
|
|
|
|
|
|
manual: manualMaterial(properties(line.materialPoolDraft).manual),
|
|
|
|
|
|
};
|
|
|
|
|
|
} else if (line.costMaterialDraft) {
|
|
|
|
|
|
const remembered = manualMaterial(line.costMaterialDraft, {
|
|
|
|
|
|
mode: result.costMaterial.mode,
|
|
|
|
|
|
rate: material.rate,
|
|
|
|
|
|
total: parts.material,
|
|
|
|
|
|
payer: result.costPayers.material,
|
|
|
|
|
|
});
|
|
|
|
|
|
result.costMaterialDraft = {
|
|
|
|
|
|
mode: remembered.mode,
|
|
|
|
|
|
rate: remembered.rate,
|
|
|
|
|
|
total: remembered.total,
|
|
|
|
|
|
originalTotal: '',
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (Object.hasOwn(line, 'cost')) result.cost = numeric(line.cost, '货品成本');
|
|
|
|
|
|
return result;
|
|
|
|
|
|
});
|
|
|
|
|
|
const fees = draft.fee_items ?? [];
|
|
|
|
|
|
if (!Array.isArray(fees) || fees.length > 6100) throw new Error('模板费用项目过多');
|
|
|
|
|
|
const cardExpenseIds = new Set(
|
|
|
|
|
|
fees
|
|
|
|
|
|
.filter(cardFee)
|
|
|
|
|
|
.map(fee => fee.expense_id)
|
|
|
|
|
|
.filter(Boolean),
|
|
|
|
|
|
);
|
|
|
|
|
|
const keys = new Set(),
|
|
|
|
|
|
items = fees
|
|
|
|
|
|
.map(raw => {
|
|
|
|
|
|
const fee = object(raw, '模板费用');
|
|
|
|
|
|
if (cardFee(fee) || (fee.expense_id && cardExpenseIds.has(fee.expense_id))) return null;
|
|
|
|
|
|
const kind =
|
|
|
|
|
|
!fee.expense_id &&
|
|
|
|
|
|
!fee.funding &&
|
|
|
|
|
|
typeof fee.key === 'string' &&
|
|
|
|
|
|
typeof fee.note === 'string' &&
|
|
|
|
|
|
typeof fee.payer === 'string' &&
|
|
|
|
|
|
(typeof fee.amount === 'string' || typeof fee.amount === 'number')
|
|
|
|
|
|
? Fees.presetKind({ key: fee.key, note: fee.note, amount: fee.amount, payer: fee.payer })
|
|
|
|
|
|
: '';
|
|
|
|
|
|
if (kind === 'box') {
|
|
|
|
|
|
Fees.boxCount(String(fee.note).match(/(([^)]*)个 ×/)?.[1]);
|
|
|
|
|
|
if (fee.amount === '') throw new Error('请先填写正整数的盒子数量');
|
|
|
|
|
|
}
|
|
|
|
|
|
const old = string(fee.key, '费用标识', 80);
|
|
|
|
|
|
if (
|
|
|
|
|
|
!['shipping', 'box', 'certificate', 'braiding', 'sticker', 'other'].includes(old) &&
|
|
|
|
|
|
!/^(charge|manual):[a-f0-9-]{36}$/.test(old)
|
|
|
|
|
|
)
|
|
|
|
|
|
throw new Error('模板费用项目无效');
|
|
|
|
|
|
if (keys.has(old)) throw new Error('模板费用项目不能重复');
|
|
|
|
|
|
keys.add(old);
|
|
|
|
|
|
const linked = old.startsWith('charge:') ? ids.get(old.slice(7)) : null;
|
|
|
|
|
|
if (old.startsWith('charge:') && !linked) return null;
|
|
|
|
|
|
return {
|
|
|
|
|
|
key: linked ? 'charge:' + linked : old === 'shipping' || kind ? old : 'manual:' + newId(),
|
|
|
|
|
|
note: string(fee.note, '费用名称', 150),
|
|
|
|
|
|
amount: numeric(fee.amount, '实际费用'),
|
|
|
|
|
|
payer: payer(fee.payer, 'assistant'),
|
|
|
|
|
|
status: 'estimated',
|
|
|
|
|
|
edited: fee.edited !== false,
|
|
|
|
|
|
...(linked ? { sourceName: string(fee.sourceName || fee.note, '附加项目名称', 40) } : {}),
|
|
|
|
|
|
};
|
|
|
|
|
|
})
|
|
|
|
|
|
.filter(row => row !== null);
|
|
|
|
|
|
const preset = {
|
|
|
|
|
|
salesperson: string(draft.salesperson, '开单人', 30),
|
|
|
|
|
|
payment_account: paymentAccount(draft.payment_account),
|
|
|
|
|
|
credit_card_fee_payer: payer(draft.credit_card_fee_payer, 'owner'),
|
|
|
|
|
|
discount: numeric(draft.discount ?? '0', '整单优惠'),
|
|
|
|
|
|
note: string(draft.note, '客户单备注', 240),
|
|
|
|
|
|
fee_auto_initialized: true,
|
|
|
|
|
|
...(draft.fee_cost_mode === 'checkboxes' ? { fee_cost_mode: 'checkboxes' } : {}),
|
|
|
|
|
|
lines,
|
|
|
|
|
|
fee_items: Fees.sync(items, lines, { checkboxCosts: draft.fee_cost_mode === 'checkboxes' }),
|
|
|
|
|
|
};
|
|
|
|
|
|
if (JSON.stringify(preset).length > 240000) throw new Error('模板内容过大,请减少商品或附加项目');
|
|
|
|
|
|
return preset;
|
|
|
|
|
|
}
|
|
|
|
|
|
/** @param {Record<string,unknown>} preset @param {import('../web/src/shared/orderPresets').TemplateOptions} [options] */
|
|
|
|
|
|
function apply(preset, { today, salesperson = '', newId, pocketKeys } = {}) {
|
|
|
|
|
|
if (
|
|
|
|
|
|
!/^\d{4}-\d{2}-\d{2}$/.test(today || '') ||
|
|
|
|
|
|
!Number.isFinite(Date.parse(today + 'T00:00:00Z')) ||
|
|
|
|
|
|
new Date(today + 'T00:00:00Z').toISOString().slice(0, 10) !== today
|
|
|
|
|
|
)
|
|
|
|
|
|
throw new Error('未取得有效系统日期,请刷新后再套用模板。');
|
|
|
|
|
|
const draft = fromDraft({ ...preset, fee_cost_mode: 'checkboxes' }, { newId, pocketKeys });
|
|
|
|
|
|
for (const line of draft.lines)
|
|
|
|
|
|
if (line.costMaterial?.mode === 'pool') {
|
|
|
|
|
|
line.costMaterial = { mode: 'pool', poolId: today };
|
|
|
|
|
|
line.materialPoolDraft = { ...line.materialPoolDraft, poolId: today, defaultDate: true };
|
|
|
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
|
|
|
...draft,
|
|
|
|
|
|
date: today,
|
|
|
|
|
|
fees_date: today,
|
|
|
|
|
|
customer: '',
|
|
|
|
|
|
salesperson: draft.salesperson || salesperson,
|
|
|
|
|
|
rounding_mode: 'yuan',
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
return { fromDraft, apply };
|
|
|
|
|
|
},
|
|
|
|
|
|
);
|