@juo/orion-extensions 0.11.0 → 0.11.1

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.
Files changed (2) hide show
  1. package/dist/extensions.js +38 -5
  2. package/package.json +3 -3
@@ -31318,7 +31318,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
31318
31318
  const currency = computed(
31319
31319
  () => {
31320
31320
  var _a;
31321
- return ((_a = actionConfig.value) == null ? void 0 : _a.currency) ?? "USD";
31321
+ return ((_a = actionConfig.value) == null ? void 0 : _a.currency) ?? "";
31322
31322
  }
31323
31323
  );
31324
31324
  const recurringCycleLimit = computed(
@@ -31327,9 +31327,26 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
31327
31327
  return ((_a = actionConfig.value) == null ? void 0 : _a.recurringCycleLimit) ?? null;
31328
31328
  }
31329
31329
  );
31330
- const formattedDiscount = computed(
31331
- () => discountType.value === "percentage" ? `${discountValue.value}%` : `${discountValue.value} ${currency.value}`
31332
- );
31330
+ const formattedDiscount = computed(() => {
31331
+ if (discountType.value === "percentage") {
31332
+ return `${discountValue.value}%`;
31333
+ }
31334
+ const amount = Number(discountValue.value);
31335
+ const code = currency.value;
31336
+ if (code) {
31337
+ try {
31338
+ return new Intl.NumberFormat(void 0, {
31339
+ style: "currency",
31340
+ currency: code,
31341
+ minimumFractionDigits: 0,
31342
+ maximumFractionDigits: 2
31343
+ }).format(amount);
31344
+ } catch {
31345
+ return `${discountValue.value} ${code}`;
31346
+ }
31347
+ }
31348
+ return String(discountValue.value);
31349
+ });
31333
31350
  const durationText = computed(
31334
31351
  () => recurringCycleLimit.value ? `for ${recurringCycleLimit.value} order${Number(recurringCycleLimit.value) === 1 ? "" : "s"}` : "on all subscription renewals"
31335
31352
  );
@@ -32732,7 +32749,23 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
32732
32749
  const discountType = opt.discountType ?? "percentage";
32733
32750
  const recurringCycleLimit = opt.recurringCycleLimit;
32734
32751
  const currency = ((_a = actionConfig.value) == null ? void 0 : _a.currency) ?? "";
32735
- const formattedDiscount = discountType === "percentage" ? `${discountValue}%` : `${discountValue} ${currency}`.trim();
32752
+ let formattedDiscount;
32753
+ if (discountType === "percentage") {
32754
+ formattedDiscount = `${discountValue}%`;
32755
+ } else if (currency) {
32756
+ try {
32757
+ formattedDiscount = new Intl.NumberFormat(void 0, {
32758
+ style: "currency",
32759
+ currency,
32760
+ minimumFractionDigits: 0,
32761
+ maximumFractionDigits: 2
32762
+ }).format(discountValue);
32763
+ } catch {
32764
+ formattedDiscount = `${discountValue} ${currency}`;
32765
+ }
32766
+ } else {
32767
+ formattedDiscount = String(discountValue);
32768
+ }
32736
32769
  const durationText = recurringCycleLimit != null ? `for ${recurringCycleLimit} cycle${Number(recurringCycleLimit) === 1 ? "" : "s"}` : "on all subscription renewals";
32737
32770
  result[key2] = {
32738
32771
  badge: `${formattedDiscount} OFF`,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@juo/orion-extensions",
3
3
  "private": false,
4
- "version": "0.11.0",
4
+ "version": "0.11.1",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -43,8 +43,8 @@
43
43
  "tailwind-merge": "3.2.0",
44
44
  "tailwindcss": "3.3.5",
45
45
  "vue": "3.5.13",
46
- "@juo/customer-ui": "0.3.0",
47
- "@juo/orion-core": "0.17.0"
46
+ "@juo/orion-core": "0.17.1",
47
+ "@juo/customer-ui": "0.3.0"
48
48
  },
49
49
  "scripts": {
50
50
  "dev": "vite build -w",