@saasquatch/mint-components 2.2.0-1 → 2.2.0-2

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 (35) hide show
  1. package/dist/cjs/sqm-referral-table_11.cjs.entry.js +27 -9
  2. package/dist/cjs/sqm-rewards-table_9.cjs.entry.js +30 -9
  3. package/dist/cjs/sqm-stencilbook.cjs.entry.js +470 -303
  4. package/dist/collection/components/sqm-referral-table/ReferralTable.stories.js +1 -0
  5. package/dist/collection/components/sqm-referral-table/ReferralTableRewardsCell.stories.js +1 -0
  6. package/dist/collection/components/sqm-referral-table/TaxAndCashReferralTableRewardsCell.stories.js +209 -157
  7. package/dist/collection/components/sqm-referral-table/cells/sqm-referral-table-rewards-cell.js +30 -10
  8. package/dist/collection/components/sqm-rewards-table/RewardsTableCell.stories.js +1 -0
  9. package/dist/collection/components/sqm-rewards-table/TaxAndCashRewardsTableCell.stories.js +223 -148
  10. package/dist/collection/components/sqm-rewards-table/cells/sqm-rewards-table-status-cell.js +30 -10
  11. package/dist/collection/components/sqm-rewards-table/useRewardsTable.js +1 -0
  12. package/dist/esm/sqm-referral-table_11.entry.js +27 -9
  13. package/dist/esm/sqm-rewards-table_9.entry.js +30 -9
  14. package/dist/esm/sqm-stencilbook.entry.js +470 -303
  15. package/dist/esm-es5/sqm-referral-table_11.entry.js +1 -1
  16. package/dist/esm-es5/sqm-rewards-table_9.entry.js +1 -1
  17. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  18. package/dist/mint-components/mint-components.esm.js +1 -1
  19. package/dist/mint-components/p-162da001.system.entry.js +1 -0
  20. package/dist/mint-components/p-1c413a06.system.js +1 -1
  21. package/dist/mint-components/p-1f76371b.entry.js +9 -0
  22. package/dist/mint-components/p-bdf858c3.entry.js +1 -0
  23. package/dist/mint-components/{p-9e43f1eb.entry.js → p-be5ecf62.entry.js} +3 -2
  24. package/dist/mint-components/p-d3ac8246.system.entry.js +1 -0
  25. package/dist/mint-components/{p-0b2a428f.system.entry.js → p-e83d08d7.system.entry.js} +1 -1
  26. package/dist/types/components/sqm-referral-table/TaxAndCashReferralTableRewardsCell.stories.d.ts +16 -0
  27. package/dist/types/components/sqm-rewards-table/TaxAndCashRewardsTableCell.stories.d.ts +18 -7
  28. package/dist/types/saasquatch.d.ts +1 -0
  29. package/docs/docs.docx +0 -0
  30. package/docs/raisins.json +1 -1
  31. package/package.json +1 -1
  32. package/dist/mint-components/p-55627a5c.entry.js +0 -1
  33. package/dist/mint-components/p-7a744cb2.entry.js +0 -9
  34. package/dist/mint-components/p-d01949f7.system.entry.js +0 -1
  35. package/dist/mint-components/p-e9e05970.system.entry.js +0 -1
@@ -56,6 +56,7 @@ const GET_REWARDS = dist.gql `
56
56
  fuelTankCode
57
57
  fuelTankType
58
58
  currency
59
+ rewardedCash
59
60
  prettyValue(locale: $locale)
60
61
  prettyValueNumber: prettyValue(
61
62
  formatType: NUMBER_FORMATTED
@@ -850,7 +851,7 @@ const RewardTableStatusCell = class {
850
851
  this.pendingTaxReview = "Awaiting tax form review.";
851
852
  this.pendingNewTaxForm = "Invalid tax form. Submit a new form to receive your rewards.";
852
853
  this.pendingTaxSubmission = "Submit your tax documents to receive your rewards.";
853
- this.pendingPartnerCreation = "Complete your tax and cash payout setup to receive your rewards.";
854
+ this.pendingPartnerCreation = "Complete your cash payout setup to receive your rewards.";
854
855
  this.pendingScheduled = "Until";
855
856
  this.pendingUnhandled = "Fulfillment error";
856
857
  this.pendingReviewText = "Awaiting review";
@@ -861,16 +862,26 @@ const RewardTableStatusCell = class {
861
862
  this.payoutProcessing = "Processing until {date}. Payout is then scheduled based on your settings.";
862
863
  }
863
864
  rewardStatus(reward) {
864
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
865
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
865
866
  const hasExpired = (_a = reward.statuses) === null || _a === void 0 ? void 0 : _a.includes("EXPIRED");
866
867
  const isPending = (_b = reward.statuses) === null || _b === void 0 ? void 0 : _b.includes("PENDING");
867
868
  const integrationOrFueltankReward = reward.type === "INTEGRATION" || reward.type === "FUELTANK";
869
+ // AL: TODO Scott said we should change this to use pendingReasons instead of fraudStatus - probably dont want to change this for backwards compatibility
868
870
  const fraudStatus = (_d = (_c = reward.referral) === null || _c === void 0 ? void 0 : _c.fraudData) === null || _d === void 0 ? void 0 : _d.moderationStatus;
869
871
  if (fraudStatus === "DENIED")
870
872
  return "DENIED";
871
873
  if (fraudStatus === "PENDING")
872
874
  return "PENDING_REVIEW";
873
- const partnerTransferStatus = (_e = reward.partnerFundsTransfer) === null || _e === void 0 ? void 0 : _e.status;
875
+ const isCashReward = reward.rewardedCash;
876
+ console.log(this.reward, "reward in status cell");
877
+ // pft can now be created before withdrawal settings exist
878
+ if (isCashReward) {
879
+ if (!((_e = this.taxConnection) === null || _e === void 0 ? void 0 : _e.connected) ||
880
+ (((_f = this.taxConnection) === null || _f === void 0 ? void 0 : _f.connected) &&
881
+ !((_h = (_g = this.taxConnection) === null || _g === void 0 ? void 0 : _g.publisher) === null || _h === void 0 ? void 0 : _h.withdrawalSettings)))
882
+ return "PENDING";
883
+ }
884
+ const partnerTransferStatus = (_j = reward.partnerFundsTransfer) === null || _j === void 0 ? void 0 : _j.status;
874
885
  if (reward.partnerFundsTransfer) {
875
886
  if (partnerTransferStatus === "REVERSED")
876
887
  return "PAYOUT_CANCELLED";
@@ -895,24 +906,24 @@ const RewardTableStatusCell = class {
895
906
  if (isPending)
896
907
  return "PENDING";
897
908
  if (reward.type === "CREDIT") {
898
- return ((_f = reward.statuses) === null || _f === void 0 ? void 0 : _f.includes("REDEEMED")) ? "REDEEMED" : "AVAILABLE";
909
+ return ((_k = reward.statuses) === null || _k === void 0 ? void 0 : _k.includes("REDEEMED")) ? "REDEEMED" : "AVAILABLE";
899
910
  }
900
- if (reward.type === "PCT_DISCOUNT" && ((_g = reward.statuses) === null || _g === void 0 ? void 0 : _g.includes("AVAILABLE"))) {
911
+ if (reward.type === "PCT_DISCOUNT" && ((_l = reward.statuses) === null || _l === void 0 ? void 0 : _l.includes("AVAILABLE"))) {
901
912
  return "AVAILABLE";
902
913
  }
903
914
  if (integrationOrFueltankReward && isPending) {
904
915
  return "PENDING";
905
916
  }
906
- if (integrationOrFueltankReward && ((_h = reward.statuses) === null || _h === void 0 ? void 0 : _h.includes("CANCELLED"))) {
917
+ if (integrationOrFueltankReward && ((_m = reward.statuses) === null || _m === void 0 ? void 0 : _m.includes("CANCELLED"))) {
907
918
  return "CANCELLED";
908
919
  }
909
- if (integrationOrFueltankReward && ((_j = reward.statuses) === null || _j === void 0 ? void 0 : _j.includes("AVAILABLE"))) {
920
+ if (integrationOrFueltankReward && ((_o = reward.statuses) === null || _o === void 0 ? void 0 : _o.includes("AVAILABLE"))) {
910
921
  return "AVAILABLE";
911
922
  }
912
923
  return "";
913
924
  }
914
925
  getTaxPendingReasons(reward, taxConnection) {
915
- var _a, _b, _c, _d, _e;
926
+ var _a, _b, _c, _d, _e, _f;
916
927
  if ((_a = reward === null || reward === void 0 ? void 0 : reward.pendingReasons) === null || _a === void 0 ? void 0 : _a.includes("US_TAX")) {
917
928
  if (!(taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.taxHandlingEnabled))
918
929
  return this.pendingUsTax;
@@ -927,12 +938,22 @@ const RewardTableStatusCell = class {
927
938
  if (status === "NOT_VERIFIED")
928
939
  return this.pendingTaxReview;
929
940
  }
930
- if (!((_d = taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.publisher) === null || _d === void 0 ? void 0 : _d.withdrawalSettings))
941
+ if (!((_d = taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.publisher) === null || _d === void 0 ? void 0 : _d.withdrawalSettings)) {
931
942
  return this.pendingPartnerCreation;
943
+ }
932
944
  }
933
945
  if ((_e = reward === null || reward === void 0 ? void 0 : reward.pendingReasons) === null || _e === void 0 ? void 0 : _e.includes("MISSING_PAYOUT_CONFIGURATION")) {
934
946
  return this.pendingPartnerCreation;
935
947
  }
948
+ // Fallback: when rewardStatus() forced PENDING because the user is
949
+ // connected but hasn't set up withdrawal settings (no pendingReasons
950
+ // were returned by the API, e.g. for credit rewards with a PFT).
951
+ if (reward.rewardedCash) {
952
+ if (!(taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.connected) ||
953
+ ((taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.connected) &&
954
+ !((_f = taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.publisher) === null || _f === void 0 ? void 0 : _f.withdrawalSettings)))
955
+ return this.pendingPartnerCreation;
956
+ }
936
957
  return "";
937
958
  }
938
959
  getBadgeType(rewardStatus) {