@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.
@@ -1 +1 @@
1
- {"version":3,"file":"createReferralProgramsCollection.d.ts","sourceRoot":"","sources":["../../src/collections/createReferralProgramsCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAwC7D,eAAO,MAAM,gCAAgC,GAC3C,cAAc,4BAA4B,KACzC,gBAiUF,CAAC"}
1
+ {"version":3,"file":"createReferralProgramsCollection.d.ts","sourceRoot":"","sources":["../../src/collections/createReferralProgramsCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAwC7D,eAAO,MAAM,gCAAgC,GAC3C,cAAc,4BAA4B,KACzC,gBAsTF,CAAC"}
package/dist/index.js CHANGED
@@ -536,10 +536,10 @@ const createReferralProgramsCollection = (pluginConfig) => {
536
536
  condition: ({ siblingData }) => siblingData?.totalCommission?.type !== "fixed",
537
537
  description: "When using percentage rules this is auto-calculated; for fixed-type rules you may enter a literal amount"
538
538
  },
539
- hooks: {
540
- beforeValidate: [({ siblingData }) => deriveCustomerSplit(siblingData?.partnerSplit, siblingData?.totalCommission?.type)],
541
- beforeChange: [({ siblingData }) => deriveCustomerSplit(siblingData?.partnerSplit, siblingData?.totalCommission?.type)]
542
- }
539
+ hooks: { beforeValidate: [({ siblingData }) => {
540
+ if (!siblingData) return 0;
541
+ return deriveCustomerSplit(siblingData.partnerSplit, siblingData.totalCommission);
542
+ }] }
543
543
  }
544
544
  ]
545
545
  }