payment-kit 1.13.256 → 1.13.258

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -241,10 +241,11 @@ router.put('/:id', auth, async (req, res) => {
241
241
  return res.status(403).json({ error: 'price archived' });
242
242
  }
243
243
 
244
+ const locked = doc.locked && process.env.PAYMENT_CHANGE_LOCKED_PRICE !== '1';
244
245
  const updates: Partial<Price> = Price.formatBeforeSave(
245
246
  pick(
246
247
  req.body,
247
- doc.locked
248
+ locked
248
249
  ? ['nickname', 'description', 'metadata', 'currency_options', 'upsell']
249
250
  : ['type', 'model', 'active', 'livemode', 'nickname', 'recurring', 'description', 'tiers', 'unit_amount', 'transform_quantity', 'metadata', 'lookup_key', 'currency_options', 'upsell'] // prettier-ignore
250
251
  )
package/blocklet.yml CHANGED
@@ -14,7 +14,7 @@ repository:
14
14
  type: git
15
15
  url: git+https://github.com/blocklet/payment-kit.git
16
16
  specVersion: 1.2.8
17
- version: 1.13.256
17
+ version: 1.13.258
18
18
  logo: logo.png
19
19
  files:
20
20
  - dist
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payment-kit",
3
- "version": "1.13.256",
3
+ "version": "1.13.258",
4
4
  "scripts": {
5
5
  "dev": "blocklet dev --open",
6
6
  "eject": "vite eject",
@@ -51,7 +51,7 @@
51
51
  "@arcblock/ux": "^2.9.79",
52
52
  "@arcblock/validator": "^1.18.117",
53
53
  "@blocklet/logger": "1.16.26",
54
- "@blocklet/payment-react": "1.13.256",
54
+ "@blocklet/payment-react": "1.13.258",
55
55
  "@blocklet/sdk": "1.16.26",
56
56
  "@blocklet/ui-react": "^2.9.79",
57
57
  "@blocklet/uploader": "^0.1.6",
@@ -116,7 +116,7 @@
116
116
  "devDependencies": {
117
117
  "@abtnode/types": "1.16.26",
118
118
  "@arcblock/eslint-config-ts": "^0.3.0",
119
- "@blocklet/payment-types": "1.13.256",
119
+ "@blocklet/payment-types": "1.13.258",
120
120
  "@types/cookie-parser": "^1.4.7",
121
121
  "@types/cors": "^2.8.17",
122
122
  "@types/dotenv-flow": "^3.3.3",
@@ -155,5 +155,5 @@
155
155
  "parser": "typescript"
156
156
  }
157
157
  },
158
- "gitHead": "5534c9d95122867a83c0d67eb3d1a27675c370b7"
158
+ "gitHead": "0ea69a3f829fc306695835888f57211e872b3705"
159
159
  }
@@ -61,7 +61,7 @@ export function getInvoiceRows(invoice: TInvoiceExpanded) {
61
61
  quantity: line.quantity,
62
62
  rawQuantity: line.metadata?.quantity || 0,
63
63
  price: !line.proration
64
- ? formatAmount(getPriceUintAmountByCurrency(line.price, invoice.paymentCurrency) || line.amount, invoice.paymentCurrency.decimal) // prettier-ignore
64
+ ? formatAmount(toBN(line.amount).div(toBN(line.quantity)).toString(), invoice.paymentCurrency.decimal) // prettier-ignore
65
65
  : '',
66
66
  amount: formatAmount(line.amount, invoice.paymentCurrency.decimal),
67
67
  raw: line,
@@ -86,7 +86,7 @@ export default function PriceForm({ prefix, simple }: PriceFormProps) {
86
86
 
87
87
  const currencies = useFieldArray({ control, name: getFieldName('currency_options') });
88
88
 
89
- const isLocked = useWatch({ control, name: getFieldName('locked') });
89
+ const priceLocked = useWatch({ control, name: getFieldName('locked') });
90
90
  const isRecurring = useWatch({ control, name: getFieldName('type') }) === 'recurring';
91
91
  const isMetered = useWatch({ control, name: getFieldName('recurring.usage_type') }) === 'metered';
92
92
  const isCustomInterval = useWatch({ control, name: getFieldName('recurring.interval_config') }) === 'month_2';
@@ -97,6 +97,8 @@ export default function PriceForm({ prefix, simple }: PriceFormProps) {
97
97
  x.payment_currencies.some((c) => c.id === settings.baseCurrency.id)
98
98
  );
99
99
 
100
+ const isLocked = priceLocked && window.blocklet?.PAYMENT_CHANGE_LOCKED_PRICE !== '1';
101
+
100
102
  return (
101
103
  <Root direction="column" alignItems="flex-start" spacing={2}>
102
104
  {isLocked && <Alert severity="info">{t('admin.price.locked')}</Alert>}