@uxda/appkit 4.3.30 → 4.3.32

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.
package/dist/index.js CHANGED
@@ -3569,7 +3569,10 @@ const CUSTOM_RECHARGE_AMOUNT_ITEM = {
3569
3569
  amount: "1W \u8D77\u5145",
3570
3570
  custom: true
3571
3571
  };
3572
- function appendCustomAmountOption(items) {
3572
+ function appendCustomAmountOption(items, shouldAppendCustom = true) {
3573
+ if (!shouldAppendCustom) {
3574
+ return [...items];
3575
+ }
3573
3576
  return [...items, CUSTOM_RECHARGE_AMOUNT_ITEM];
3574
3577
  }
3575
3578
  function normalizeCustomRechargeAmountInput(value) {
@@ -3631,7 +3634,7 @@ var script$E = /* @__PURE__ */ defineComponent({
3631
3634
  customAmountText: ""
3632
3635
  });
3633
3636
  const amounts = ref([]);
3634
- const rechargeAmountItems = computed(() => appendCustomAmountOption(amounts.value));
3637
+ const rechargeAmountItems = computed(() => appendCustomAmountOption(amounts.value, !isWechat()));
3635
3638
  const isCustomAmountSelected = computed(() => rechargeAmountItems.value[state.selected]?.custom === true);
3636
3639
  const onAgreementLinkClick = (e) => {
3637
3640
  e.preventDefault();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxda/appkit",
3
- "version": "4.3.30",
3
+ "version": "4.3.32",
4
4
  "description": "小程序应用开发包",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.ts",
@@ -102,7 +102,7 @@ const state = reactive({
102
102
  })
103
103
 
104
104
  const amounts = ref<any[]>([])
105
- const rechargeAmountItems = computed(() => appendCustomAmountOption(amounts.value))
105
+ const rechargeAmountItems = computed(() => appendCustomAmountOption(amounts.value, !isWechat()))
106
106
  const isCustomAmountSelected = computed(() => rechargeAmountItems.value[state.selected]?.custom === true)
107
107
 
108
108
  const onAgreementLinkClick = (e) => {
@@ -14,8 +14,11 @@ const baseAmounts = [
14
14
  ]
15
15
 
16
16
  const withCustom = appendCustomAmountOption(baseAmounts)
17
+ const withoutCustom = appendCustomAmountOption(baseAmounts, false)
17
18
 
18
19
  assert.equal(withCustom.length, 3)
20
+ assert.equal(withoutCustom.length, 2)
21
+ assert.deepEqual(withoutCustom, baseAmounts)
19
22
  assert.deepEqual(baseAmounts, [
20
23
  { token: 150, amount: 150 },
21
24
  { token: 400, amount: 400 },
@@ -17,7 +17,11 @@ export const CUSTOM_RECHARGE_AMOUNT_ITEM: RechargeAmountItem = {
17
17
  custom: true,
18
18
  }
19
19
 
20
- export function appendCustomAmountOption(items: RechargeAmountItem[]) {
20
+ export function appendCustomAmountOption(items: RechargeAmountItem[], shouldAppendCustom = true) {
21
+ if (!shouldAppendCustom) {
22
+ return [...items]
23
+ }
24
+
21
25
  return [...items, CUSTOM_RECHARGE_AMOUNT_ITEM]
22
26
  }
23
27