@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
@@ -428,7 +428,7 @@ const ReferralTableRewardsCell = class {
428
428
  constructor(hostRef) {
429
429
  index.registerInstance(this, hostRef);
430
430
  this.statusText = "{status, select, AVAILABLE {Available} CANCELLED {Cancelled} PENDING {Pending} PENDING_REVIEW {Pending} PAYOUT_APPROVED {Payout Approved} PROCESSING {Payment Processing} PAYOUT_FAILED {Payout Failed} PAYOUT_CANCELLED {Payout Cancelled} PENDING_TAX_REVIEW {Pending} PENDING_NEW_TAX_FORM {Pending} PENDING_TAX_SUBMISSION {Pending} PENDING_PARTNER_CREATION {Pending} DENIED {Denied} EXPIRED {Expired} REDEEMED {Redeemed} other {Not available} }";
431
- this.statusLongText = "{status, select, AVAILABLE {Reward expiring on} CANCELLED {Reward cancelled on} PENDING {Available on} PENDING_REVIEW {Pending since} PAYOUT_APPROVED {Processing until {scheduledPayoutDate}. Payout is then scheduled based on your settings.} PAYOUT_FAILED {Payout failed due to a fulfillment issue and is currently being retried.} PAYOUT_CANCELLED {If you think this is a mistake, contact our Support team.} PENDING_TAX_REVIEW {Awaiting tax form review} PENDING_NEW_TAX_FORM {Invalid tax form. Submit a new form to receive your rewards.} PROCESSING {Processing until {scheduledPayoutDate}. Payout is then scheduled based on your settings.} PENDING_TAX_SUBMISSION {Submit your tax documents to receive your rewards} PENDING_PARTNER_CREATION {Complete your tax and cash payout setup to receive your rewards} DENIED {Denied on} EXPIRED {Reward expired on} other {Not available} }";
431
+ this.statusLongText = "{status, select, AVAILABLE {Reward expiring on} CANCELLED {Reward cancelled on} PENDING {Available on} PENDING_REVIEW {Pending since} PAYOUT_APPROVED {Processing until {scheduledPayoutDate}. Payout is then scheduled based on your settings.} PAYOUT_FAILED {Payout failed due to a fulfillment issue and is currently being retried.} PAYOUT_CANCELLED {If you think this is a mistake, contact our Support team.} PENDING_TAX_REVIEW {Awaiting tax form review} PENDING_NEW_TAX_FORM {Invalid tax form. Submit a new form to receive your rewards.} PROCESSING {Processing until {scheduledPayoutDate}. Payout is then scheduled based on your settings.} PENDING_TAX_SUBMISSION {Submit your tax documents to receive your rewards} PENDING_PARTNER_CREATION {Complete your cash payout setup to receive your rewards} DENIED {Denied on} EXPIRED {Reward expired on} other {Not available} }";
432
432
  this.pendingForText = "{status} for {date}";
433
433
  this.locale = "en";
434
434
  }
@@ -535,7 +535,7 @@ const ReferralTableRewardsCell = class {
535
535
  }
536
536
  };
537
537
  const getState = (reward, taxConnection) => {
538
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
538
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
539
539
  const possibleStates = [
540
540
  "REDEEMED",
541
541
  "CANCELLED",
@@ -559,12 +559,21 @@ const ReferralTableRewardsCell = class {
559
559
  if (((_f = (_e = reward.referral) === null || _e === void 0 ? void 0 : _e.fraudData) === null || _f === void 0 ? void 0 : _f.moderationStatus) === "DENIED")
560
560
  return "DENIED";
561
561
  }
562
- const partnerFundsStatus = (_g = reward.partnerFundsTransfer) === null || _g === void 0 ? void 0 : _g.status;
562
+ const isCashReward = reward.rewardedCash;
563
+ if (isCashReward) {
564
+ if (!((_g = this.taxConnection) === null || _g === void 0 ? void 0 : _g.connected) ||
565
+ (((_h = this.taxConnection) === null || _h === void 0 ? void 0 : _h.connected) &&
566
+ !((_k = (_j = this.taxConnection) === null || _j === void 0 ? void 0 : _j.publisher) === null || _k === void 0 ? void 0 : _k.withdrawalSettings)))
567
+ return "PENDING_PARTNER_CREATION";
568
+ }
569
+ const partnerFundsStatus = (_l = reward.partnerFundsTransfer) === null || _l === void 0 ? void 0 : _l.status;
563
570
  if (reward.partnerFundsTransfer) {
564
571
  if (partnerFundsStatus === "REVERSED")
565
572
  return "PAYOUT_CANCELLED";
566
573
  if (partnerFundsStatus === "OVERDUE")
567
574
  return "PAYOUT_FAILED";
575
+ }
576
+ if (reward.partnerFundsTransfer) {
568
577
  if (reward.partnerFundsTransfer.dateScheduled &&
569
578
  reward.partnerFundsTransfer.dateScheduled > Date.now()) {
570
579
  return "PROCESSING";
@@ -577,13 +586,13 @@ const ReferralTableRewardsCell = class {
577
586
  partnerFundsStatus !== "REVERSED"))
578
587
  return "PAYOUT_APPROVED";
579
588
  }
580
- if ((_h = reward === null || reward === void 0 ? void 0 : reward.pendingReasons) === null || _h === void 0 ? void 0 : _h.includes("US_TAX")) {
589
+ if ((_m = reward === null || reward === void 0 ? void 0 : reward.pendingReasons) === null || _m === void 0 ? void 0 : _m.includes("US_TAX")) {
581
590
  if (!(taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.taxHandlingEnabled))
582
591
  return "PENDING";
583
592
  if (!(taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.connected))
584
593
  return "PENDING_PARTNER_CREATION";
585
- if ((_j = taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.publisher) === null || _j === void 0 ? void 0 : _j.requiredTaxDocumentType) {
586
- if (!((_k = taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.publisher) === null || _k === void 0 ? void 0 : _k.currentTaxDocument))
594
+ if ((_o = taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.publisher) === null || _o === void 0 ? void 0 : _o.requiredTaxDocumentType) {
595
+ if (!((_p = taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.publisher) === null || _p === void 0 ? void 0 : _p.currentTaxDocument))
587
596
  return "PENDING_TAX_SUBMISSION";
588
597
  const status = taxConnection.publisher.currentTaxDocument.status;
589
598
  if (status === "INACTIVE" ||
@@ -593,10 +602,19 @@ const ReferralTableRewardsCell = class {
593
602
  if (status === "NOT_VERIFIED")
594
603
  return "PENDING_TAX_REVIEW";
595
604
  }
596
- if (!((_l = taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.publisher) === null || _l === void 0 ? void 0 : _l.withdrawalSettings))
605
+ if (!((_q = taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.publisher) === null || _q === void 0 ? void 0 : _q.withdrawalSettings))
606
+ return "PENDING_PARTNER_CREATION";
607
+ }
608
+ // Fallback: when rewardStatus() forced PENDING because the user is
609
+ // connected but hasn't set up withdrawal settings (no pendingReasons
610
+ // were returned by the API, e.g. for credit rewards with a PFT).
611
+ if (reward.rewardedCash) {
612
+ if (!(taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.connected) ||
613
+ ((taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.connected) &&
614
+ !((_r = taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.publisher) === null || _r === void 0 ? void 0 : _r.withdrawalSettings)))
597
615
  return "PENDING_PARTNER_CREATION";
598
616
  }
599
- if ((_m = reward === null || reward === void 0 ? void 0 : reward.pendingReasons) === null || _m === void 0 ? void 0 : _m.includes("MISSING_PAYOUT_CONFIGURATION")) {
617
+ if ((_s = reward === null || reward === void 0 ? void 0 : reward.pendingReasons) === null || _s === void 0 ? void 0 : _s.includes("MISSING_PAYOUT_CONFIGURATION")) {
600
618
  return "PENDING_PARTNER_CREATION";
601
619
  }
602
620
  if (reward.statuses.length === 1)
@@ -656,7 +674,7 @@ const ReferralTableRewardsCell = class {
656
674
  date: getTimeDiff(reward.dateScheduledFor),
657
675
  }))) : (index.h("sl-badge", { class: getBadgeCSSClass(slBadgeType), type: slBadgeType, pill: true }, badgeText)), reward.dateExpires && state === "AVAILABLE" && (index.h("sl-badge", { class: getBadgeCSSClass(slBadgeType), type: "info", pill: true }, this.expiringText, ` ${getTimeDiff(reward.dateExpires)}`)))), index.h("div", null, state === "PENDING_REVIEW" && ((_c = reward.referral) === null || _c === void 0 ? void 0 : _c.dateModerated) && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText, " ", index.h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.luxon.DateTime.fromMillis(reward.referral.dateModerated)
658
676
  .setLocale(utils.luxonLocale(this.locale))
659
- .toLocaleString(luxon.luxon.DateTime.DATE_MED))))), state === "PAYOUT_APPROVED" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "PROCESSING" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "PAYOUT_FAILED" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "PAYOUT_CANCELLED" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "PENDING_TAX_REVIEW" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "PENDING_NEW_TAX_FORM" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "PENDING_TAX_SUBMISSION" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "PENDING_PARTNER_CREATION" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "DENIED" && ((_d = reward.referral) === null || _d === void 0 ? void 0 : _d.dateModerated) && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText, " ", index.h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.luxon.DateTime.fromMillis(reward.referral.dateModerated)
677
+ .toLocaleString(luxon.luxon.DateTime.DATE_MED))))), state === "" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "PROCESSING" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "PAYOUT_APPROVED" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "PAYOUT_FAILED" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "PAYOUT_CANCELLED" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "PENDING_TAX_REVIEW" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "PENDING_NEW_TAX_FORM" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "PENDING_TAX_SUBMISSION" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "PENDING_PARTNER_CREATION" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "DENIED" && ((_d = reward.referral) === null || _d === void 0 ? void 0 : _d.dateModerated) && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText, " ", index.h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.luxon.DateTime.fromMillis(reward.referral.dateModerated)
660
678
  .setLocale(utils.luxonLocale(this.locale))
661
679
  .toLocaleString(luxon.luxon.DateTime.DATE_MED)), ".", this.deniedHelpText ? ` ${this.deniedHelpText}` : ``))), reward.dateGiven && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, this.rewardReceivedText, " ", index.h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.luxon.DateTime.fromMillis(reward.dateGiven)
662
680
  .setLocale(utils.luxonLocale(this.locale))
@@ -60,6 +60,7 @@ const GET_REWARDS = index_module.dist.gql `
60
60
  fuelTankCode
61
61
  fuelTankType
62
62
  currency
63
+ rewardedCash
63
64
  prettyValue(locale: $locale)
64
65
  prettyValueNumber: prettyValue(
65
66
  formatType: NUMBER_FORMATTED
@@ -854,7 +855,7 @@ const RewardTableStatusCell = class {
854
855
  this.pendingTaxReview = "Awaiting tax form review.";
855
856
  this.pendingNewTaxForm = "Invalid tax form. Submit a new form to receive your rewards.";
856
857
  this.pendingTaxSubmission = "Submit your tax documents to receive your rewards.";
857
- this.pendingPartnerCreation = "Complete your tax and cash payout setup to receive your rewards.";
858
+ this.pendingPartnerCreation = "Complete your cash payout setup to receive your rewards.";
858
859
  this.pendingScheduled = "Until";
859
860
  this.pendingUnhandled = "Fulfillment error";
860
861
  this.pendingReviewText = "Awaiting review";
@@ -865,16 +866,26 @@ const RewardTableStatusCell = class {
865
866
  this.payoutProcessing = "Processing until {date}. Payout is then scheduled based on your settings.";
866
867
  }
867
868
  rewardStatus(reward) {
868
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
869
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
869
870
  const hasExpired = (_a = reward.statuses) === null || _a === void 0 ? void 0 : _a.includes("EXPIRED");
870
871
  const isPending = (_b = reward.statuses) === null || _b === void 0 ? void 0 : _b.includes("PENDING");
871
872
  const integrationOrFueltankReward = reward.type === "INTEGRATION" || reward.type === "FUELTANK";
873
+ // AL: TODO Scott said we should change this to use pendingReasons instead of fraudStatus - probably dont want to change this for backwards compatibility
872
874
  const fraudStatus = (_d = (_c = reward.referral) === null || _c === void 0 ? void 0 : _c.fraudData) === null || _d === void 0 ? void 0 : _d.moderationStatus;
873
875
  if (fraudStatus === "DENIED")
874
876
  return "DENIED";
875
877
  if (fraudStatus === "PENDING")
876
878
  return "PENDING_REVIEW";
877
- const partnerTransferStatus = (_e = reward.partnerFundsTransfer) === null || _e === void 0 ? void 0 : _e.status;
879
+ const isCashReward = reward.rewardedCash;
880
+ console.log(this.reward, "reward in status cell");
881
+ // pft can now be created before withdrawal settings exist
882
+ if (isCashReward) {
883
+ if (!((_e = this.taxConnection) === null || _e === void 0 ? void 0 : _e.connected) ||
884
+ (((_f = this.taxConnection) === null || _f === void 0 ? void 0 : _f.connected) &&
885
+ !((_h = (_g = this.taxConnection) === null || _g === void 0 ? void 0 : _g.publisher) === null || _h === void 0 ? void 0 : _h.withdrawalSettings)))
886
+ return "PENDING";
887
+ }
888
+ const partnerTransferStatus = (_j = reward.partnerFundsTransfer) === null || _j === void 0 ? void 0 : _j.status;
878
889
  if (reward.partnerFundsTransfer) {
879
890
  if (partnerTransferStatus === "REVERSED")
880
891
  return "PAYOUT_CANCELLED";
@@ -899,24 +910,24 @@ const RewardTableStatusCell = class {
899
910
  if (isPending)
900
911
  return "PENDING";
901
912
  if (reward.type === "CREDIT") {
902
- return ((_f = reward.statuses) === null || _f === void 0 ? void 0 : _f.includes("REDEEMED")) ? "REDEEMED" : "AVAILABLE";
913
+ return ((_k = reward.statuses) === null || _k === void 0 ? void 0 : _k.includes("REDEEMED")) ? "REDEEMED" : "AVAILABLE";
903
914
  }
904
- if (reward.type === "PCT_DISCOUNT" && ((_g = reward.statuses) === null || _g === void 0 ? void 0 : _g.includes("AVAILABLE"))) {
915
+ if (reward.type === "PCT_DISCOUNT" && ((_l = reward.statuses) === null || _l === void 0 ? void 0 : _l.includes("AVAILABLE"))) {
905
916
  return "AVAILABLE";
906
917
  }
907
918
  if (integrationOrFueltankReward && isPending) {
908
919
  return "PENDING";
909
920
  }
910
- if (integrationOrFueltankReward && ((_h = reward.statuses) === null || _h === void 0 ? void 0 : _h.includes("CANCELLED"))) {
921
+ if (integrationOrFueltankReward && ((_m = reward.statuses) === null || _m === void 0 ? void 0 : _m.includes("CANCELLED"))) {
911
922
  return "CANCELLED";
912
923
  }
913
- if (integrationOrFueltankReward && ((_j = reward.statuses) === null || _j === void 0 ? void 0 : _j.includes("AVAILABLE"))) {
924
+ if (integrationOrFueltankReward && ((_o = reward.statuses) === null || _o === void 0 ? void 0 : _o.includes("AVAILABLE"))) {
914
925
  return "AVAILABLE";
915
926
  }
916
927
  return "";
917
928
  }
918
929
  getTaxPendingReasons(reward, taxConnection) {
919
- var _a, _b, _c, _d, _e;
930
+ var _a, _b, _c, _d, _e, _f;
920
931
  if ((_a = reward === null || reward === void 0 ? void 0 : reward.pendingReasons) === null || _a === void 0 ? void 0 : _a.includes("US_TAX")) {
921
932
  if (!(taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.taxHandlingEnabled))
922
933
  return this.pendingUsTax;
@@ -931,12 +942,22 @@ const RewardTableStatusCell = class {
931
942
  if (status === "NOT_VERIFIED")
932
943
  return this.pendingTaxReview;
933
944
  }
934
- if (!((_d = taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.publisher) === null || _d === void 0 ? void 0 : _d.withdrawalSettings))
945
+ if (!((_d = taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.publisher) === null || _d === void 0 ? void 0 : _d.withdrawalSettings)) {
935
946
  return this.pendingPartnerCreation;
947
+ }
936
948
  }
937
949
  if ((_e = reward === null || reward === void 0 ? void 0 : reward.pendingReasons) === null || _e === void 0 ? void 0 : _e.includes("MISSING_PAYOUT_CONFIGURATION")) {
938
950
  return this.pendingPartnerCreation;
939
951
  }
952
+ // Fallback: when rewardStatus() forced PENDING because the user is
953
+ // connected but hasn't set up withdrawal settings (no pendingReasons
954
+ // were returned by the API, e.g. for credit rewards with a PFT).
955
+ if (reward.rewardedCash) {
956
+ if (!(taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.connected) ||
957
+ ((taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.connected) &&
958
+ !((_f = taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.publisher) === null || _f === void 0 ? void 0 : _f.withdrawalSettings)))
959
+ return this.pendingPartnerCreation;
960
+ }
940
961
  return "";
941
962
  }
942
963
  getBadgeType(rewardStatus) {