@wtree/payload-ecommerce-coupon 3.77.4 → 3.77.5

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.mjs CHANGED
@@ -534,10 +534,10 @@ const createReferralProgramsCollection = (pluginConfig) => {
534
534
  condition: ({ siblingData }) => siblingData?.totalCommission?.type !== "fixed",
535
535
  description: "When using percentage rules this is auto-calculated; for fixed-type rules you may enter a literal amount"
536
536
  },
537
- hooks: {
538
- beforeValidate: [({ siblingData }) => deriveCustomerSplit(siblingData?.partnerSplit, siblingData?.totalCommission?.type)],
539
- beforeChange: [({ siblingData }) => deriveCustomerSplit(siblingData?.partnerSplit, siblingData?.totalCommission?.type)]
540
- }
537
+ hooks: { beforeValidate: [({ siblingData }) => {
538
+ if (!siblingData) return 0;
539
+ return deriveCustomerSplit(siblingData.partnerSplit, siblingData.totalCommission);
540
+ }] }
541
541
  }
542
542
  ]
543
543
  }