@saasquatch/mint-components 1.14.2 → 1.14.3-0
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/cjs/{mockRewardData-272e22d6.js → mockRewardData-7815f10f.js} +1 -1
- package/dist/cjs/sqm-referral-table_11.cjs.entry.js +3 -3
- package/dist/cjs/sqm-rewards-table_9.cjs.entry.js +2 -2
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +3 -3
- package/dist/collection/components/sqm-referral-table/cells/sqm-referral-table-rewards-cell.js +1 -1
- package/dist/collection/components/sqm-referral-table/mockReferralData.js +1 -1
- package/dist/collection/components/sqm-rewards-table/RewardsTableCell.stories.js +2 -2
- package/dist/collection/components/sqm-rewards-table/cells/sqm-rewards-table-status-cell.js +1 -1
- package/dist/collection/components/sqm-rewards-table/mockRewardData.js +1 -1
- package/dist/esm/{mockRewardData-8bd1b356.js → mockRewardData-a3cdb832.js} +1 -1
- package/dist/esm/sqm-referral-table_11.entry.js +3 -3
- package/dist/esm/sqm-rewards-table_9.entry.js +2 -2
- package/dist/esm/sqm-stencilbook.entry.js +3 -3
- package/dist/esm-es5/sqm-referral-table_11.entry.js +1 -1
- package/dist/esm-es5/sqm-rewards-table_9.entry.js +1 -1
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/{p-693942df.entry.js → p-08090b99.entry.js} +2 -2
- package/dist/mint-components/{p-1f089c3f.system.entry.js → p-207da855.system.entry.js} +1 -1
- package/dist/mint-components/p-37996351.system.js +1 -1
- package/dist/mint-components/{p-fe2e2f4a.entry.js → p-89104bc4.entry.js} +1 -1
- package/dist/mint-components/{p-ef6381d4.entry.js → p-b06add5c.entry.js} +1 -1
- package/dist/mint-components/{p-de8e9981.system.entry.js → p-cc833efb.system.entry.js} +1 -1
- package/dist/mint-components/{p-5d7e308c.system.entry.js → p-fc7a2647.system.entry.js} +1 -1
- package/docs/docs.docx +0 -0
- package/package.json +1 -1
- package/shoelace/assets/icons/twitter-x.svg +4 -0
- /package/dist/esm-es5/{mockRewardData-8bd1b356.js → mockRewardData-a3cdb832.js} +0 -0
- /package/dist/mint-components/{p-726a9924.js → p-938f64d9.js} +0 -0
- /package/dist/mint-components/{p-8413ade9.system.js → p-ae1ea5ac.system.js} +0 -0
|
@@ -82,7 +82,7 @@ const getMockData = (status) => {
|
|
|
82
82
|
dateExpires = today.minus({ days: 1 }).toMillis();
|
|
83
83
|
}
|
|
84
84
|
else if (randomStatus === "PENDING") {
|
|
85
|
-
// pendingReason = ["
|
|
85
|
+
// pendingReason = ["MISSING_PAYOUT_CONFIGURATION"];
|
|
86
86
|
const reason = pendingReasons[Math.floor(Math.random() * 3)];
|
|
87
87
|
pendingReason = [reason];
|
|
88
88
|
if (reason === "SCHEDULED") {
|
|
@@ -14,7 +14,7 @@ const GenericTableView = require('./GenericTableView-a9f4ba75.js');
|
|
|
14
14
|
const reRender = require('./re-render-b324deab.js');
|
|
15
15
|
const useChildElements = require('./useChildElements-1b35d945.js');
|
|
16
16
|
const luxon = require('./luxon-2926d85f.js');
|
|
17
|
-
const mockRewardData = require('./mockRewardData-
|
|
17
|
+
const mockRewardData = require('./mockRewardData-7815f10f.js');
|
|
18
18
|
const useReferralTable = require('./useReferralTable-7c3f9600.js');
|
|
19
19
|
const sqmTextSpanView = require('./sqm-text-span-view-0aa82125.js');
|
|
20
20
|
|
|
@@ -114,7 +114,7 @@ const getMockData = () => {
|
|
|
114
114
|
prettyValue: "1 Point",
|
|
115
115
|
statuses: statuses[Math.floor(Math.random() * statuses.length)],
|
|
116
116
|
// statuses: ["PENDING"],
|
|
117
|
-
// pendingReasons: ["US_TAX", "
|
|
117
|
+
// pendingReasons: ["US_TAX", "MISSING_PAYOUT_CONFIGURATION"],
|
|
118
118
|
globalRewardKey: null,
|
|
119
119
|
programRewardKey: "partnerReward",
|
|
120
120
|
meta: {
|
|
@@ -544,7 +544,7 @@ const ReferralTableRewardsCell = class {
|
|
|
544
544
|
if (!((_l = taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.publisher) === null || _l === void 0 ? void 0 : _l.withdrawalSettings))
|
|
545
545
|
return "PENDING_PARTNER_CREATION";
|
|
546
546
|
}
|
|
547
|
-
if ((_m = reward === null || reward === void 0 ? void 0 : reward.pendingReasons) === null || _m === void 0 ? void 0 : _m.includes("
|
|
547
|
+
if ((_m = reward === null || reward === void 0 ? void 0 : reward.pendingReasons) === null || _m === void 0 ? void 0 : _m.includes("MISSING_PAYOUT_CONFIGURATION")) {
|
|
548
548
|
return "PENDING_PARTNER_CREATION";
|
|
549
549
|
}
|
|
550
550
|
if (reward.statuses.length === 1)
|
|
@@ -14,7 +14,7 @@ const GenericTableView = require('./GenericTableView-a9f4ba75.js');
|
|
|
14
14
|
const reRender = require('./re-render-b324deab.js');
|
|
15
15
|
const useChildElements = require('./useChildElements-1b35d945.js');
|
|
16
16
|
const luxon = require('./luxon-2926d85f.js');
|
|
17
|
-
const mockRewardData = require('./mockRewardData-
|
|
17
|
+
const mockRewardData = require('./mockRewardData-7815f10f.js');
|
|
18
18
|
const useReferralTable = require('./useReferralTable-7c3f9600.js');
|
|
19
19
|
|
|
20
20
|
const debug = stencilHooks_module.browser("sq:useRewardsTable");
|
|
@@ -886,7 +886,7 @@ const RewardTableStatusCell = class {
|
|
|
886
886
|
if (!((_d = taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.publisher) === null || _d === void 0 ? void 0 : _d.withdrawalSettings))
|
|
887
887
|
return this.pendingPartnerCreation;
|
|
888
888
|
}
|
|
889
|
-
if ((_e = reward === null || reward === void 0 ? void 0 : reward.pendingReasons) === null || _e === void 0 ? void 0 : _e.includes("
|
|
889
|
+
if ((_e = reward === null || reward === void 0 ? void 0 : reward.pendingReasons) === null || _e === void 0 ? void 0 : _e.includes("MISSING_PAYOUT_CONFIGURATION")) {
|
|
890
890
|
return this.pendingPartnerCreation;
|
|
891
891
|
}
|
|
892
892
|
return "";
|
|
@@ -12028,7 +12028,7 @@ const scenario1 = "@author:derek\n@owner:derek\nFeature: Reward Table Date Colum
|
|
|
12028
12028
|
|
|
12029
12029
|
const scenario2 = "@author:derek\n@owner:derek\nFeature: Reward Table reward Column\n\n Shows the exact reward\n\n Background:\n Given the reward column is included in the reward table\n And rewards with translations exist\n\n @motivating\n @ui\n Scenario Outline: The title of the reward column is configurable\n Given the \"column-title\" prop is set to <value>\n Then the reward column is shown with <columnTitle>\n Examples:\n | value | columnTitle |\n | Reward | |\n | My column title | My column title |\n\n @motivating\n Scenario: The reward column displays the prettyValue of the reward given\n Given a user with a reward\n When they view the rewards table\n Then they see the name of their reward in the reward column\n And the name is the prettyValue translated for the users locale\n\n @motivating\n @ui\n Scenario: The reward column displays an availability bar if the reward is redeemable\n Given a user with a <status> credit reward of <value>\n But the user has <redeemedAmount>\n When they view the rewards table\n Then the reward column displays <value>\n And under it displays an availability bar with <percentage> filled\n And under it displays <availabilityText>\n Examples:\n | status | value | percentage | availableAmount | availabilityText |\n | AVAILABLE | 10 Points | 100% | 10 Points | 10 Points remaining |\n | AVAILABLE | 10 Points | 90% | 9 Points | 9 Points remaining |\n | AVAILABLE | 10 Points | 10% | 1 Point | 1 Point remaining |\n | PENDING | 10 Points | 100% | 10 Points | 10 Points remaining |\n | PENDING | 10 Points | 90% | 9 Points | 9 Points remaining |\n | PENDING | 10 Points | 10% | 1 Point | 1 Point remaining |\n\n @motivating\n @ui\n Scenario Outline: The reward column displays an availability bar if the reward was redeemable but had been cancelled or expired\n Given a user with a credit reward of <value>\n And the reward has <status>\n But the user has <redeemedAmount>\n When they view the rewards table\n When they view the rewards table\n Then the reward column displays <value>\n And under it displays an availability bar with <percentage> filled\n And under it displays <redeemedText>\n Examples:\n | status | value | percentage | redeemedAmount | redeemedText |\n | EXPIRED | 10 Points | 100% | 0 Point | 0 Point redeemed |\n | EXPIRED | 10 Points | 80% | 2 Point | 2 Point redeemed |\n | CANCELLED | 10 Points | 100% | 0 Point | 0 Point redeemed |\n | CANCELLED | 10 Points | 20% | 8 Point | 8 Point redeemed |\n\n @motivating\n @ui\n Scenario: The reward column doesn't display the availability bar if the reward is not redeemable\n Given a user with a non credit reward\n When they view the rewards table\n Then they see the name of the reward\n But they do not see the availablity bar\n\n @motivating\n @ui\n Scenario Outline: The reward column doesn't display the availability bar if the reward is only 1 reward unit\n Given a user with a credit reward for 1 of a reward unit\n And it has <status>\n When they view the rewards table\n Then they see the name of the reward\n But they do not see the availablity bar\n Examples:\n | status |\n | AVAILABLE |\n | PENDING |\n | EXPIRED |\n | CANCELLED |\n\n @motivating\n @ui\n Scenario: The reward column doesn't display the availability bar for redeemed credit rewards\n Given a user with a \"REDEEMED\" credit reward\n When they view the rewards table\n Then they see the name of the reward\n But they do not see the availablity bar\n\n @motivating\n @ui\n Scenario: Users can copy their fuel tank codes\n Given a user with a fuel tank reward\n When they view the rewards table\n Then they see their fuel tank reward\n And they see their fuel tank code bolded in blue\n When they click on their code\n Then a tool tip appears saying it has been copied to their clipboard\n And their code is copied to their clipboard";
|
|
12030
12030
|
|
|
12031
|
-
const scenario3 = "@author:derek @owner:derek\nFeature: Reward Table Status Column\n Shows the status of each reward\n\n Background
|
|
12031
|
+
const scenario3 = "@author:derek @owner:derek\nFeature: Reward Table Status Column\n Shows the status of each reward\n\n Background:\n Given the status column is included in the reward table\n\n @motivating @ui\n Scenario Outline: The title of the status column is configurable\n Given the \"column-title\" prop is set to <value>\n Then the status column is shown with <columnTitle>\n\n Examples:\n | value | columnTitle |\n | Status | |\n | My column title | My column title |\n\n @motivating @ui\n Scenario Outline: The status column displays the status of each reward\n Given a user\n And they have a <status> reward\n When they view the reward table\n Then the status of their reward is displayed in <pillColour> pill with <text>\n\n Examples:\n | status | text | pillColour |\n | AVAILABLE | Available | Green |\n | CANCELLED | Cancelled | Red |\n | PENDING | Pending | Orange |\n | EXPIRED | Expired | Red |\n | REDEEMED | Redeemed | Blue |\n | PENDING_REVIEW | Pending | Orange |\n | PAYOUT_TRANSFERRED | Payout Approved | blue |\n | PAYOUT_NOT_YET_DUE | Payout Approved | blue |\n | PAYOUT_OVERDUE | Payout Failed | Red |\n | PAYOUT_REVERSED | Payout Cancelled | Red |\n | PENDING_TAX_REVIEW | Pending | Orange |\n | PENDING_NEW_TAX_FORM | Pending | Orange |\n | PENDING_TAX_SUBMISSION | Pending | Orange |\n | PENDING_PARTNER_CREATION | Pending | Orange |\n | DENIED | Denied | Red |\n\n @motivating\n Scenario Outline: Reward status related information is displayed under status pills\n Given a user\n And they have a <reward>\n And their program is\n When they view the reward table\n Then they see their reward\n And under the pill is <text>\n And the date is localized to the users locale\n\n Examples:\n | reward | text |\n | available reward with an expiry date | localized expiry date in format \"Month-Day-Year\" |\n | redeemed reward | localized redemption date in format \"Month-Day-Year\" |\n | expired reward | localized expired date in format \"Month-Day-Year\" |\n | cancelled reward | localized cancelled date in format \"Month-Day-Year\" |\n | pending reward with a end date | localized pending for date in format \"Month-Day-Year\" |\n | pending reward due to W9 | W-9 required |\n | pending reward due to fufillment error | Fulfillment error |\n | reward pending review of referral | Pending review |\n | pending reward due to no connected Impact partner | Complete your tax and cash payout setup to receive your rewards. |\n | pending reward due to an invalid tax document | Invalid tax form. Submit a new form to receive your rewards. |\n | pending reward due to user required to submit a tax document | Submit your tax documents to receive your rewards. |\n | pending reward due to tax document being in review | Awaiting tax form review. |\n | reward whose payout failed | Payout failed due to a fulfillment issue and is currently being retried. |\n | reward whose payout was approved | Reward approved for payout and was scheduled for payment based on your settings. |\n | reward whose payout was cancelled | If you think this is a mistake, contact our Support team. |\n | cancelled reward from denied referral | Flagged as fraud |\n\n @minutia\n Scenario Outline: Tax-related reward statuses are based on the user's Impact tax connection\n Given a user\n And they are in a program that has Impact tax handling enabled\n And they have at least one pending reward\n And the reward's pending reasons include \"MISSING_PAYOUT_CONFIGURATION\"\n Then the status description will be\n \"\"\"\n Complete your tax and cash payout setup to receive your rewards.\n \"\"\"\n\n @motivating\n Scenario Outline: Statuses can be customized\n Given the \"status-text\" prop is \"{status, select, AVAILABLE {Redeem me!} CANCELLED {Unavailable} PENDING {Coming soon!} EXPIRED {Past due} REDEEMED {Spent} PENDING_REVIEW {Pending Review!} PAYOUT_SENT {Payout Sent!} PAYOUT_FAILED {Payout Failed!} PENDING_TAX_REVIEW {Pending Tax Review!} PENDING_NEW_TAX_FORM {Pending new tax form!} PENDING_TAX_SUBMISSION {Pending tax submission!} PENDING_PARTNER_CREATION {Pending partner creation!} DENIED {Unlucky!}}\"\n And a user\n And they have a <status> reward\n When they view the reward table\n Then the status of their reward is displayed in <pillColour> pill with <text>\n\n Examples:\n | status | text | pillColour |\n | AVAILABLE | Redeem me! | Green |\n | CANCELLED | Unavailable | Red |\n | PENDING | Coming soon! | Orange |\n | EXPIRED | Past due | Red |\n | REDEEMED | Spent | Blue |\n | PENDING_REVIEW | Pending Review! | Orange |\n | PAYOUT_TRANSFERRED | Payout Approved! | Blue |\n | PAYOUT_NOT_YET_DUE | Payout Approved! | Blue |\n | PAYOUT_OVERDUE | Payout Failed! | Red |\n | PAYOUT_REVERSED | Payout Cancelled! | Red |\n | DENIED | Unlucky! | Red |\n\n @minutia @ui\n Scenario: Expiry status date text can be configured\n Given the \"expiry-text\" prop has <value>\n And a user with an available reward with an expiry date\n When they view the reward table\n Then they see <text> under the Available Status pill\n\n Examples:\n | value | text |\n | | Expires on <EXPIRY DATE> |\n | Redeem before | Redeem before <EXPIRY DATE> |\n";
|
|
12032
12032
|
|
|
12033
12033
|
const scenario4 = "@author:derek @owner:derek\nFeature: Reward Table Source Column\n Shows the source of each reward\n\n @motivating @ui\n Scenario Outline: The title of the source column is configurable\n Given the \"column-title\" prop is set to <value>\n Then the source column is shown with <columnTitle>\n\n Examples:\n | value | columnTitle |\n | Source | |\n | My column title | My column title |\n\n @motivating @ui\n Scenario: The source column displays manual if the reward is caused by a manual action\n Given a user with a \"MANUAL\" reward\n When they view the rewards table\n Then the source of their reward is displayed as \"Manual\"\n\n @motivating @ui\n Scenario: The source column displays the program name if the reward is caused automatically by a program\n Given a user with a \"AUTOMATED\" program reward\n And the program has name \"Loyalty Program\"\n When they view the rewards table\n Then the source of their reward is displayed as \"Loyalty Program\"\n\n @motivating @ui\n Scenario Outline: The source column displays customizable reward exchange text with amount if the reward is caused by reward exchange\n Given the \"reward-exchange-text\" prop is <propValue>\n And a user with a \"MANUAL\" reward\n But it was created by a reward exchange\n Then they view the rewards table\n Then the source displays <exchangeText>\n And under it displays the following\n | prettyRedeemedCredit → prettyValue |\n\n Examples:\n | propValue | exchangeText |\n | | Reward Exchange |\n | Exchanged | Exchanged |\n\n @motivating @ui\n Scenario Outline: The source column displays customizable referral information if the reward is from a referral\n Given the \"reward-source-text\" prop is <propValue>\n And a user with a referral reward\n And that reward has <rewardSource>\n When they view the rewards table\n Then then source displays <referralText>\n And under it displays the full name of the <referralUser>\n\n Examples:\n | propValue | rewardSource | referralText | referralUser |\n | | REFERRED | Referred by | referrer user |\n | | FRIEND_SIGNUP | Referral to | referred user |\n | {rewardSource, select, FRIEND_SIGNUP {You Referred} REFERRED {Referred you} other {}} | REFERRED | Referred you | referrer user |\n | {rewardSource, select, FRIEND_SIGNUP {You Referred} REFERRED {Referred you} other {}} | FRIEND_SIGNUP | You Referred | referred user |\n\n @motivating @ui\n Scenario Outline: The source column displays the existing name for a referral if either the first name or last name does not exist\n Given a user with a referral reward\n And referral user exists\n And referral user has <name>\n But referral user has no <otherName>\n When they view the rewards table\n Then referral user's name is displayed as <name>\n\n Examples:\n | name | otherName |\n | first.name | last.name |\n | last.name | first.name |\n\n @motivating @ui\n Scenario Outline: The source column displays referral as \"Anonymous User\" if the referral user has no names\n Given a user with a referral reward\n And that reward has <rewardSource>\n And the <referralUser> has no first name\n And the <referralUser> has no last name\n When they view the rewards table\n Then then source displays <sourceText>\n And under it displays \"Anonymous User\"\n\n Examples:\n | rewardSource | referralUser | sourceText |\n | FRIEND_SIGNUP | referrer | Referral to |\n | REFERRED | referred user | Referred by |\n\n @motivating @ui\n Scenario Outline: The source column displays referral as \"Deleted User\" if the referral user is deleted in the system\n Given a user with a referral reward\n And that reward has <rewardSource>\n But <referral> user was deleted\n When they view the rewards table\n Then the source displays <sourceText>\n And under it displays \"Deleted User\"\n\n Examples:\n | rewardSource | referral | sourceText |\n | \"FRIEND_SIGNUP\" | referrer | Referral to |\n | \"REFERRED\" | referred | Referred by |\n\n @motivating @ui\n Scenario Outline: The source column displays referral as \"Deleted referral\" if the referral user is deleted in the system\n Given a user with a referral reward\n And that reward has <rewardSource>\n But <referral> user was deleted\n When they view the rewards table\n Then the source displays <sourceText>\n And under it displays \"Deleted referral\"\n\n Examples:\n | rewardSource | referral | sourceText |\n | \"FRIEND_SIGNUP\" | referrer | Referral to |\n | \"REFERRED\" | referred | Referred by |\n\n @minutia @ui\n Scenario Outline: Name fallbacks for referral users without names are customizable\n Given <prop> with <value>\n And a user with a referral reward\n But the referral user <hadAction>\n When they view the rewards table\n Then the source displays <value> as the referral user\n\n Examples:\n | prop | value | hadAction |\n | deleted-user | Former Customer | was deleted |\n | anonymous-user | Nameless User | had first and last name deleted |\n\n @motivating\n Scenario Outline: Source text can be customized\n Given the \"reward-source-text\" prop is \"{rewardSource, select, MANUAL {Support} AUTOMATED {Loyalty Program} other {}}\"\n And a user with a <rewardSource> reward\n When they view the rewards table\n Then the source is <sourceText>\n\n Examples:\n | rewardSource | sourceText |\n | MANUAL | Support |\n | AUTOMATED | Loyalty Program |\n";
|
|
12034
12034
|
|
|
@@ -12059,7 +12059,7 @@ const rewardsData$1 = {
|
|
|
12059
12059
|
prettyAvailableNumber: "19",
|
|
12060
12060
|
prettyRedeemedNumber: "0",
|
|
12061
12061
|
statuses: ["AVAILABLE", "PENDING"],
|
|
12062
|
-
pendingReasons: ["US_TAX", "
|
|
12062
|
+
pendingReasons: ["US_TAX", "MISSING_PAYOUT_CONFIGURATION"],
|
|
12063
12063
|
globalRewardKey: null,
|
|
12064
12064
|
rewardSource: "MANUAL",
|
|
12065
12065
|
prettyRedeemedCredit: "0 Points",
|
|
@@ -12352,7 +12352,7 @@ const StatusCellPendingTaxSubmission = () => {
|
|
|
12352
12352
|
const StatusCellPendingPartnerCreation = () => {
|
|
12353
12353
|
return (index.h("sqm-rewards-table-status-cell", { statusText: "Pending", reward: {
|
|
12354
12354
|
...rewardsData$1,
|
|
12355
|
-
pendingReasons: ["
|
|
12355
|
+
pendingReasons: ["MISSING_PAYOUT_CONFIGURATION"],
|
|
12356
12356
|
} }));
|
|
12357
12357
|
};
|
|
12358
12358
|
const StatusCellPayoutSent = () => {
|
package/dist/collection/components/sqm-referral-table/cells/sqm-referral-table-rewards-cell.js
CHANGED
|
@@ -123,7 +123,7 @@ export class ReferralTableRewardsCell {
|
|
|
123
123
|
if (!((_l = taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.publisher) === null || _l === void 0 ? void 0 : _l.withdrawalSettings))
|
|
124
124
|
return "PENDING_PARTNER_CREATION";
|
|
125
125
|
}
|
|
126
|
-
if ((_m = reward === null || reward === void 0 ? void 0 : reward.pendingReasons) === null || _m === void 0 ? void 0 : _m.includes("
|
|
126
|
+
if ((_m = reward === null || reward === void 0 ? void 0 : reward.pendingReasons) === null || _m === void 0 ? void 0 : _m.includes("MISSING_PAYOUT_CONFIGURATION")) {
|
|
127
127
|
return "PENDING_PARTNER_CREATION";
|
|
128
128
|
}
|
|
129
129
|
if (reward.statuses.length === 1)
|
|
@@ -96,7 +96,7 @@ const getMockData = () => {
|
|
|
96
96
|
prettyValue: "1 Point",
|
|
97
97
|
statuses: statuses[Math.floor(Math.random() * statuses.length)],
|
|
98
98
|
// statuses: ["PENDING"],
|
|
99
|
-
// pendingReasons: ["US_TAX", "
|
|
99
|
+
// pendingReasons: ["US_TAX", "MISSING_PAYOUT_CONFIGURATION"],
|
|
100
100
|
globalRewardKey: null,
|
|
101
101
|
programRewardKey: "partnerReward",
|
|
102
102
|
meta: {
|
|
@@ -30,7 +30,7 @@ const rewardsData = {
|
|
|
30
30
|
prettyAvailableNumber: "19",
|
|
31
31
|
prettyRedeemedNumber: "0",
|
|
32
32
|
statuses: ["AVAILABLE", "PENDING"],
|
|
33
|
-
pendingReasons: ["US_TAX", "
|
|
33
|
+
pendingReasons: ["US_TAX", "MISSING_PAYOUT_CONFIGURATION"],
|
|
34
34
|
globalRewardKey: null,
|
|
35
35
|
rewardSource: "MANUAL",
|
|
36
36
|
prettyRedeemedCredit: "0 Points",
|
|
@@ -323,7 +323,7 @@ export const StatusCellPendingTaxSubmission = () => {
|
|
|
323
323
|
export const StatusCellPendingPartnerCreation = () => {
|
|
324
324
|
return (h("sqm-rewards-table-status-cell", { statusText: "Pending", reward: {
|
|
325
325
|
...rewardsData,
|
|
326
|
-
pendingReasons: ["
|
|
326
|
+
pendingReasons: ["MISSING_PAYOUT_CONFIGURATION"],
|
|
327
327
|
} }));
|
|
328
328
|
};
|
|
329
329
|
export const StatusCellPayoutSent = () => {
|
|
@@ -104,7 +104,7 @@ export class RewardTableStatusCell {
|
|
|
104
104
|
if (!((_d = taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.publisher) === null || _d === void 0 ? void 0 : _d.withdrawalSettings))
|
|
105
105
|
return this.pendingPartnerCreation;
|
|
106
106
|
}
|
|
107
|
-
if ((_e = reward === null || reward === void 0 ? void 0 : reward.pendingReasons) === null || _e === void 0 ? void 0 : _e.includes("
|
|
107
|
+
if ((_e = reward === null || reward === void 0 ? void 0 : reward.pendingReasons) === null || _e === void 0 ? void 0 : _e.includes("MISSING_PAYOUT_CONFIGURATION")) {
|
|
108
108
|
return this.pendingPartnerCreation;
|
|
109
109
|
}
|
|
110
110
|
return "";
|
|
@@ -83,7 +83,7 @@ const getMockData = (status) => {
|
|
|
83
83
|
dateExpires = today.minus({ days: 1 }).toMillis();
|
|
84
84
|
}
|
|
85
85
|
else if (randomStatus === "PENDING") {
|
|
86
|
-
// pendingReason = ["
|
|
86
|
+
// pendingReason = ["MISSING_PAYOUT_CONFIGURATION"];
|
|
87
87
|
const reason = pendingReasons[Math.floor(Math.random() * 3)];
|
|
88
88
|
pendingReason = [reason];
|
|
89
89
|
if (reason === "SCHEDULED") {
|
|
@@ -80,7 +80,7 @@ const getMockData = (status) => {
|
|
|
80
80
|
dateExpires = today.minus({ days: 1 }).toMillis();
|
|
81
81
|
}
|
|
82
82
|
else if (randomStatus === "PENDING") {
|
|
83
|
-
// pendingReason = ["
|
|
83
|
+
// pendingReason = ["MISSING_PAYOUT_CONFIGURATION"];
|
|
84
84
|
const reason = pendingReasons[Math.floor(Math.random() * 3)];
|
|
85
85
|
pendingReason = [reason];
|
|
86
86
|
if (reason === "SCHEDULED") {
|
|
@@ -10,7 +10,7 @@ import { G as GenericTableView } from './GenericTableView-7b9087af.js';
|
|
|
10
10
|
import { a as useRequestRerender, u as useRerenderListener } from './re-render-cc945f38.js';
|
|
11
11
|
import { u as useChildElements } from './useChildElements-7945ae56.js';
|
|
12
12
|
import { l as luxon } from './luxon-8d51c92b.js';
|
|
13
|
-
import { g as getPaypalMeta } from './mockRewardData-
|
|
13
|
+
import { g as getPaypalMeta } from './mockRewardData-a3cdb832.js';
|
|
14
14
|
import { u as useReferralTable, t as tryMethod } from './useReferralTable-b3876ed6.js';
|
|
15
15
|
import { T as TextSpanView } from './sqm-text-span-view-ca32495e.js';
|
|
16
16
|
|
|
@@ -110,7 +110,7 @@ const getMockData = () => {
|
|
|
110
110
|
prettyValue: "1 Point",
|
|
111
111
|
statuses: statuses[Math.floor(Math.random() * statuses.length)],
|
|
112
112
|
// statuses: ["PENDING"],
|
|
113
|
-
// pendingReasons: ["US_TAX", "
|
|
113
|
+
// pendingReasons: ["US_TAX", "MISSING_PAYOUT_CONFIGURATION"],
|
|
114
114
|
globalRewardKey: null,
|
|
115
115
|
programRewardKey: "partnerReward",
|
|
116
116
|
meta: {
|
|
@@ -540,7 +540,7 @@ const ReferralTableRewardsCell = class {
|
|
|
540
540
|
if (!((_l = taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.publisher) === null || _l === void 0 ? void 0 : _l.withdrawalSettings))
|
|
541
541
|
return "PENDING_PARTNER_CREATION";
|
|
542
542
|
}
|
|
543
|
-
if ((_m = reward === null || reward === void 0 ? void 0 : reward.pendingReasons) === null || _m === void 0 ? void 0 : _m.includes("
|
|
543
|
+
if ((_m = reward === null || reward === void 0 ? void 0 : reward.pendingReasons) === null || _m === void 0 ? void 0 : _m.includes("MISSING_PAYOUT_CONFIGURATION")) {
|
|
544
544
|
return "PENDING_PARTNER_CREATION";
|
|
545
545
|
}
|
|
546
546
|
if (reward.statuses.length === 1)
|
|
@@ -10,7 +10,7 @@ import { G as GenericTableView } from './GenericTableView-7b9087af.js';
|
|
|
10
10
|
import { u as useRerenderListener, a as useRequestRerender } from './re-render-cc945f38.js';
|
|
11
11
|
import { u as useChildElements } from './useChildElements-7945ae56.js';
|
|
12
12
|
import { l as luxon } from './luxon-8d51c92b.js';
|
|
13
|
-
import { m as mockRewardData } from './mockRewardData-
|
|
13
|
+
import { m as mockRewardData } from './mockRewardData-a3cdb832.js';
|
|
14
14
|
import { g as generateUserError } from './useReferralTable-b3876ed6.js';
|
|
15
15
|
|
|
16
16
|
const debug = browser("sq:useRewardsTable");
|
|
@@ -882,7 +882,7 @@ const RewardTableStatusCell = class {
|
|
|
882
882
|
if (!((_d = taxConnection === null || taxConnection === void 0 ? void 0 : taxConnection.publisher) === null || _d === void 0 ? void 0 : _d.withdrawalSettings))
|
|
883
883
|
return this.pendingPartnerCreation;
|
|
884
884
|
}
|
|
885
|
-
if ((_e = reward === null || reward === void 0 ? void 0 : reward.pendingReasons) === null || _e === void 0 ? void 0 : _e.includes("
|
|
885
|
+
if ((_e = reward === null || reward === void 0 ? void 0 : reward.pendingReasons) === null || _e === void 0 ? void 0 : _e.includes("MISSING_PAYOUT_CONFIGURATION")) {
|
|
886
886
|
return this.pendingPartnerCreation;
|
|
887
887
|
}
|
|
888
888
|
return "";
|
|
@@ -12024,7 +12024,7 @@ const scenario1 = "@author:derek\n@owner:derek\nFeature: Reward Table Date Colum
|
|
|
12024
12024
|
|
|
12025
12025
|
const scenario2 = "@author:derek\n@owner:derek\nFeature: Reward Table reward Column\n\n Shows the exact reward\n\n Background:\n Given the reward column is included in the reward table\n And rewards with translations exist\n\n @motivating\n @ui\n Scenario Outline: The title of the reward column is configurable\n Given the \"column-title\" prop is set to <value>\n Then the reward column is shown with <columnTitle>\n Examples:\n | value | columnTitle |\n | Reward | |\n | My column title | My column title |\n\n @motivating\n Scenario: The reward column displays the prettyValue of the reward given\n Given a user with a reward\n When they view the rewards table\n Then they see the name of their reward in the reward column\n And the name is the prettyValue translated for the users locale\n\n @motivating\n @ui\n Scenario: The reward column displays an availability bar if the reward is redeemable\n Given a user with a <status> credit reward of <value>\n But the user has <redeemedAmount>\n When they view the rewards table\n Then the reward column displays <value>\n And under it displays an availability bar with <percentage> filled\n And under it displays <availabilityText>\n Examples:\n | status | value | percentage | availableAmount | availabilityText |\n | AVAILABLE | 10 Points | 100% | 10 Points | 10 Points remaining |\n | AVAILABLE | 10 Points | 90% | 9 Points | 9 Points remaining |\n | AVAILABLE | 10 Points | 10% | 1 Point | 1 Point remaining |\n | PENDING | 10 Points | 100% | 10 Points | 10 Points remaining |\n | PENDING | 10 Points | 90% | 9 Points | 9 Points remaining |\n | PENDING | 10 Points | 10% | 1 Point | 1 Point remaining |\n\n @motivating\n @ui\n Scenario Outline: The reward column displays an availability bar if the reward was redeemable but had been cancelled or expired\n Given a user with a credit reward of <value>\n And the reward has <status>\n But the user has <redeemedAmount>\n When they view the rewards table\n When they view the rewards table\n Then the reward column displays <value>\n And under it displays an availability bar with <percentage> filled\n And under it displays <redeemedText>\n Examples:\n | status | value | percentage | redeemedAmount | redeemedText |\n | EXPIRED | 10 Points | 100% | 0 Point | 0 Point redeemed |\n | EXPIRED | 10 Points | 80% | 2 Point | 2 Point redeemed |\n | CANCELLED | 10 Points | 100% | 0 Point | 0 Point redeemed |\n | CANCELLED | 10 Points | 20% | 8 Point | 8 Point redeemed |\n\n @motivating\n @ui\n Scenario: The reward column doesn't display the availability bar if the reward is not redeemable\n Given a user with a non credit reward\n When they view the rewards table\n Then they see the name of the reward\n But they do not see the availablity bar\n\n @motivating\n @ui\n Scenario Outline: The reward column doesn't display the availability bar if the reward is only 1 reward unit\n Given a user with a credit reward for 1 of a reward unit\n And it has <status>\n When they view the rewards table\n Then they see the name of the reward\n But they do not see the availablity bar\n Examples:\n | status |\n | AVAILABLE |\n | PENDING |\n | EXPIRED |\n | CANCELLED |\n\n @motivating\n @ui\n Scenario: The reward column doesn't display the availability bar for redeemed credit rewards\n Given a user with a \"REDEEMED\" credit reward\n When they view the rewards table\n Then they see the name of the reward\n But they do not see the availablity bar\n\n @motivating\n @ui\n Scenario: Users can copy their fuel tank codes\n Given a user with a fuel tank reward\n When they view the rewards table\n Then they see their fuel tank reward\n And they see their fuel tank code bolded in blue\n When they click on their code\n Then a tool tip appears saying it has been copied to their clipboard\n And their code is copied to their clipboard";
|
|
12026
12026
|
|
|
12027
|
-
const scenario3 = "@author:derek @owner:derek\nFeature: Reward Table Status Column\n Shows the status of each reward\n\n Background
|
|
12027
|
+
const scenario3 = "@author:derek @owner:derek\nFeature: Reward Table Status Column\n Shows the status of each reward\n\n Background:\n Given the status column is included in the reward table\n\n @motivating @ui\n Scenario Outline: The title of the status column is configurable\n Given the \"column-title\" prop is set to <value>\n Then the status column is shown with <columnTitle>\n\n Examples:\n | value | columnTitle |\n | Status | |\n | My column title | My column title |\n\n @motivating @ui\n Scenario Outline: The status column displays the status of each reward\n Given a user\n And they have a <status> reward\n When they view the reward table\n Then the status of their reward is displayed in <pillColour> pill with <text>\n\n Examples:\n | status | text | pillColour |\n | AVAILABLE | Available | Green |\n | CANCELLED | Cancelled | Red |\n | PENDING | Pending | Orange |\n | EXPIRED | Expired | Red |\n | REDEEMED | Redeemed | Blue |\n | PENDING_REVIEW | Pending | Orange |\n | PAYOUT_TRANSFERRED | Payout Approved | blue |\n | PAYOUT_NOT_YET_DUE | Payout Approved | blue |\n | PAYOUT_OVERDUE | Payout Failed | Red |\n | PAYOUT_REVERSED | Payout Cancelled | Red |\n | PENDING_TAX_REVIEW | Pending | Orange |\n | PENDING_NEW_TAX_FORM | Pending | Orange |\n | PENDING_TAX_SUBMISSION | Pending | Orange |\n | PENDING_PARTNER_CREATION | Pending | Orange |\n | DENIED | Denied | Red |\n\n @motivating\n Scenario Outline: Reward status related information is displayed under status pills\n Given a user\n And they have a <reward>\n And their program is\n When they view the reward table\n Then they see their reward\n And under the pill is <text>\n And the date is localized to the users locale\n\n Examples:\n | reward | text |\n | available reward with an expiry date | localized expiry date in format \"Month-Day-Year\" |\n | redeemed reward | localized redemption date in format \"Month-Day-Year\" |\n | expired reward | localized expired date in format \"Month-Day-Year\" |\n | cancelled reward | localized cancelled date in format \"Month-Day-Year\" |\n | pending reward with a end date | localized pending for date in format \"Month-Day-Year\" |\n | pending reward due to W9 | W-9 required |\n | pending reward due to fufillment error | Fulfillment error |\n | reward pending review of referral | Pending review |\n | pending reward due to no connected Impact partner | Complete your tax and cash payout setup to receive your rewards. |\n | pending reward due to an invalid tax document | Invalid tax form. Submit a new form to receive your rewards. |\n | pending reward due to user required to submit a tax document | Submit your tax documents to receive your rewards. |\n | pending reward due to tax document being in review | Awaiting tax form review. |\n | reward whose payout failed | Payout failed due to a fulfillment issue and is currently being retried. |\n | reward whose payout was approved | Reward approved for payout and was scheduled for payment based on your settings. |\n | reward whose payout was cancelled | If you think this is a mistake, contact our Support team. |\n | cancelled reward from denied referral | Flagged as fraud |\n\n @minutia\n Scenario Outline: Tax-related reward statuses are based on the user's Impact tax connection\n Given a user\n And they are in a program that has Impact tax handling enabled\n And they have at least one pending reward\n And the reward's pending reasons include \"MISSING_PAYOUT_CONFIGURATION\"\n Then the status description will be\n \"\"\"\n Complete your tax and cash payout setup to receive your rewards.\n \"\"\"\n\n @motivating\n Scenario Outline: Statuses can be customized\n Given the \"status-text\" prop is \"{status, select, AVAILABLE {Redeem me!} CANCELLED {Unavailable} PENDING {Coming soon!} EXPIRED {Past due} REDEEMED {Spent} PENDING_REVIEW {Pending Review!} PAYOUT_SENT {Payout Sent!} PAYOUT_FAILED {Payout Failed!} PENDING_TAX_REVIEW {Pending Tax Review!} PENDING_NEW_TAX_FORM {Pending new tax form!} PENDING_TAX_SUBMISSION {Pending tax submission!} PENDING_PARTNER_CREATION {Pending partner creation!} DENIED {Unlucky!}}\"\n And a user\n And they have a <status> reward\n When they view the reward table\n Then the status of their reward is displayed in <pillColour> pill with <text>\n\n Examples:\n | status | text | pillColour |\n | AVAILABLE | Redeem me! | Green |\n | CANCELLED | Unavailable | Red |\n | PENDING | Coming soon! | Orange |\n | EXPIRED | Past due | Red |\n | REDEEMED | Spent | Blue |\n | PENDING_REVIEW | Pending Review! | Orange |\n | PAYOUT_TRANSFERRED | Payout Approved! | Blue |\n | PAYOUT_NOT_YET_DUE | Payout Approved! | Blue |\n | PAYOUT_OVERDUE | Payout Failed! | Red |\n | PAYOUT_REVERSED | Payout Cancelled! | Red |\n | DENIED | Unlucky! | Red |\n\n @minutia @ui\n Scenario: Expiry status date text can be configured\n Given the \"expiry-text\" prop has <value>\n And a user with an available reward with an expiry date\n When they view the reward table\n Then they see <text> under the Available Status pill\n\n Examples:\n | value | text |\n | | Expires on <EXPIRY DATE> |\n | Redeem before | Redeem before <EXPIRY DATE> |\n";
|
|
12028
12028
|
|
|
12029
12029
|
const scenario4 = "@author:derek @owner:derek\nFeature: Reward Table Source Column\n Shows the source of each reward\n\n @motivating @ui\n Scenario Outline: The title of the source column is configurable\n Given the \"column-title\" prop is set to <value>\n Then the source column is shown with <columnTitle>\n\n Examples:\n | value | columnTitle |\n | Source | |\n | My column title | My column title |\n\n @motivating @ui\n Scenario: The source column displays manual if the reward is caused by a manual action\n Given a user with a \"MANUAL\" reward\n When they view the rewards table\n Then the source of their reward is displayed as \"Manual\"\n\n @motivating @ui\n Scenario: The source column displays the program name if the reward is caused automatically by a program\n Given a user with a \"AUTOMATED\" program reward\n And the program has name \"Loyalty Program\"\n When they view the rewards table\n Then the source of their reward is displayed as \"Loyalty Program\"\n\n @motivating @ui\n Scenario Outline: The source column displays customizable reward exchange text with amount if the reward is caused by reward exchange\n Given the \"reward-exchange-text\" prop is <propValue>\n And a user with a \"MANUAL\" reward\n But it was created by a reward exchange\n Then they view the rewards table\n Then the source displays <exchangeText>\n And under it displays the following\n | prettyRedeemedCredit → prettyValue |\n\n Examples:\n | propValue | exchangeText |\n | | Reward Exchange |\n | Exchanged | Exchanged |\n\n @motivating @ui\n Scenario Outline: The source column displays customizable referral information if the reward is from a referral\n Given the \"reward-source-text\" prop is <propValue>\n And a user with a referral reward\n And that reward has <rewardSource>\n When they view the rewards table\n Then then source displays <referralText>\n And under it displays the full name of the <referralUser>\n\n Examples:\n | propValue | rewardSource | referralText | referralUser |\n | | REFERRED | Referred by | referrer user |\n | | FRIEND_SIGNUP | Referral to | referred user |\n | {rewardSource, select, FRIEND_SIGNUP {You Referred} REFERRED {Referred you} other {}} | REFERRED | Referred you | referrer user |\n | {rewardSource, select, FRIEND_SIGNUP {You Referred} REFERRED {Referred you} other {}} | FRIEND_SIGNUP | You Referred | referred user |\n\n @motivating @ui\n Scenario Outline: The source column displays the existing name for a referral if either the first name or last name does not exist\n Given a user with a referral reward\n And referral user exists\n And referral user has <name>\n But referral user has no <otherName>\n When they view the rewards table\n Then referral user's name is displayed as <name>\n\n Examples:\n | name | otherName |\n | first.name | last.name |\n | last.name | first.name |\n\n @motivating @ui\n Scenario Outline: The source column displays referral as \"Anonymous User\" if the referral user has no names\n Given a user with a referral reward\n And that reward has <rewardSource>\n And the <referralUser> has no first name\n And the <referralUser> has no last name\n When they view the rewards table\n Then then source displays <sourceText>\n And under it displays \"Anonymous User\"\n\n Examples:\n | rewardSource | referralUser | sourceText |\n | FRIEND_SIGNUP | referrer | Referral to |\n | REFERRED | referred user | Referred by |\n\n @motivating @ui\n Scenario Outline: The source column displays referral as \"Deleted User\" if the referral user is deleted in the system\n Given a user with a referral reward\n And that reward has <rewardSource>\n But <referral> user was deleted\n When they view the rewards table\n Then the source displays <sourceText>\n And under it displays \"Deleted User\"\n\n Examples:\n | rewardSource | referral | sourceText |\n | \"FRIEND_SIGNUP\" | referrer | Referral to |\n | \"REFERRED\" | referred | Referred by |\n\n @motivating @ui\n Scenario Outline: The source column displays referral as \"Deleted referral\" if the referral user is deleted in the system\n Given a user with a referral reward\n And that reward has <rewardSource>\n But <referral> user was deleted\n When they view the rewards table\n Then the source displays <sourceText>\n And under it displays \"Deleted referral\"\n\n Examples:\n | rewardSource | referral | sourceText |\n | \"FRIEND_SIGNUP\" | referrer | Referral to |\n | \"REFERRED\" | referred | Referred by |\n\n @minutia @ui\n Scenario Outline: Name fallbacks for referral users without names are customizable\n Given <prop> with <value>\n And a user with a referral reward\n But the referral user <hadAction>\n When they view the rewards table\n Then the source displays <value> as the referral user\n\n Examples:\n | prop | value | hadAction |\n | deleted-user | Former Customer | was deleted |\n | anonymous-user | Nameless User | had first and last name deleted |\n\n @motivating\n Scenario Outline: Source text can be customized\n Given the \"reward-source-text\" prop is \"{rewardSource, select, MANUAL {Support} AUTOMATED {Loyalty Program} other {}}\"\n And a user with a <rewardSource> reward\n When they view the rewards table\n Then the source is <sourceText>\n\n Examples:\n | rewardSource | sourceText |\n | MANUAL | Support |\n | AUTOMATED | Loyalty Program |\n";
|
|
12030
12030
|
|
|
@@ -12055,7 +12055,7 @@ const rewardsData$1 = {
|
|
|
12055
12055
|
prettyAvailableNumber: "19",
|
|
12056
12056
|
prettyRedeemedNumber: "0",
|
|
12057
12057
|
statuses: ["AVAILABLE", "PENDING"],
|
|
12058
|
-
pendingReasons: ["US_TAX", "
|
|
12058
|
+
pendingReasons: ["US_TAX", "MISSING_PAYOUT_CONFIGURATION"],
|
|
12059
12059
|
globalRewardKey: null,
|
|
12060
12060
|
rewardSource: "MANUAL",
|
|
12061
12061
|
prettyRedeemedCredit: "0 Points",
|
|
@@ -12348,7 +12348,7 @@ const StatusCellPendingTaxSubmission = () => {
|
|
|
12348
12348
|
const StatusCellPendingPartnerCreation = () => {
|
|
12349
12349
|
return (h("sqm-rewards-table-status-cell", { statusText: "Pending", reward: {
|
|
12350
12350
|
...rewardsData$1,
|
|
12351
|
-
pendingReasons: ["
|
|
12351
|
+
pendingReasons: ["MISSING_PAYOUT_CONFIGURATION"],
|
|
12352
12352
|
} }));
|
|
12353
12353
|
};
|
|
12354
12354
|
const StatusCellPayoutSent = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++){t=arguments[r];for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n))e[n]=t[n]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,r,a){function n(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function l(e){try{o(a.next(e))}catch(e){i(e)}}function s(e){try{o(a["throw"](e))}catch(e){i(e)}}function o(e){e.done?r(e.value):n(e.value).then(l,s)}o((a=a.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,n,i,l;return l={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(l[Symbol.iterator]=function(){return this}),l;function s(e){return function(t){return o([e,t])}}function o(l){if(a)throw new TypeError("Generator is already executing.");while(r)try{if(a=1,n&&(i=l[0]&2?n["return"]:l[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;if(n=0,i)l=[l[0]&2,i.value];switch(l[0]){case 0:case 1:i=l;break;case 4:r.label++;return{value:l[1],done:false};case 5:r.label++;n=l[1];l=[0];continue;case 7:l=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){r.label=l[1];break}if(l[0]===6&&r.label<i[1]){r.label=i[1];i=l;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(l);break}if(i[2])r.ops.pop();r.trys.pop();continue}l=t.call(e,r)}catch(e){l=[6,e];n=0}finally{a=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:true}}};var __spreadArrays=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var a=Array(e),n=0,t=0;t<r;t++)for(var i=arguments[t],l=0,s=i.length;l<s;l++,n++)a[n]=i[l];return a};import{r as registerInstance,h as h$1,g as getElement,c as Host}from"./index-91e7729f.js";import{n as h,j as useReducer,u as useMemo,f as useEffect}from"./stencil-hooks.module-4bc38af4.js";import{i as intl}from"./global-be1f9992.js";import{i as isDemo}from"./index.module-89a79f66.js";import{c as cjs}from"./cjs-bdfb4486.js";import{l as luxonLocale}from"./utils-334c1e34.js";import{c as createStyleSheet}from"./JSS-67b5cff8.js";import"./mixins-83f90fa1.js";import{G as GenericTableView}from"./GenericTableView-7b9087af.js";import{a as useRequestRerender,u as useRerenderListener}from"./re-render-cc945f38.js";import{u as useChildElements}from"./useChildElements-7945ae56.js";import{l as luxon}from"./luxon-8d51c92b.js";import{g as getPaypalMeta}from"./mockRewardData-8bd1b356.js";import{u as useReferralTable,t as tryMethod}from"./useReferralTable-b3876ed6.js";import{T as TextSpanView}from"./sqm-text-span-view-ca32495e.js";var mockReferralData=function(e){if(e===void 0){e=4}var t=__spreadArrays(Array(e)).map((function(){return getMockData()}));return{totalCount:6,count:e,referredByReferral:{dateConverted:null,dateReferralStarted:1643912659850,referrerUser:{firstName:"John",lastName:"Snow",rewards:[]}},data:t}};var statuses=[["AVAILABLE"],["PENDING"],["CANCELLED"],["EXPIRED"],["REDEEMED"]];var firstNames=["Rajesh","Pierre","Ji-Ho","Chinua","Charleston","Sally","Gael","Jill","Jane","Khadija"];var lastNames=["Smith","Parker","Kent","Chew","Stark","Banner","Jones","Odinson","Pym","Rogers"];var getMockData=function(){return{id:"5cae6b0fcc540e209db45b53",referredUser:{id:"5cae6b0ce4b0d81c67b78e82",accountId:"SPX1MZBIPTFL3E1H",firstName:firstNames[Math.floor(Math.random()*firstNames.length)],lastName:lastNames[Math.floor(Math.random()*lastNames.length)],email:"example.uexwltgh@mailosaur.io",programGoals:[]},shareLinkUsed:null,referralCodeUsed:"JIMBONEUTRON2",moderationStatus:"PENDING",dateConverted:Math.floor(Math.random()*10)>=5?luxon.DateTime.now().minus({days:6}).toMillis():null,dateFraudChecksCompleted:null,dateModerated:1558730033306,dateModified:1554934543447,dateReferralEnded:null,dateReferralPaid:null,dateReferralStarted:luxon.DateTime.now().minus({days:8}).toMillis(),dateUserModified:null,programId:"sam-partner-test-2",program:{id:"sam-partner-test-2",name:"Partner Program 2.0"},rewards:Math.floor(Math.random()*10)>=5?[{id:"5cae6b16cc540e209db45cfa",type:"CREDIT",value:1,unit:"POINT",name:"Partner Reward",dateGiven:1554934550726,dateExpires:null,dateCancelled:null,dateRedeemed:1637004373582,dateScheduledFor:null,fuelTankCode:null,fuelTankType:null,currency:null,prettyValue:"1 Point",statuses:statuses[Math.floor(Math.random()*statuses.length)],globalRewardKey:null,programRewardKey:"partnerReward",meta:__assign({},getPaypalMeta()),rewardRedemptionTransactions:{data:[{exchangedRewards:{data:[{prettyValue:"CAD10.00 Visa* Prepaid Card CAD",type:"INTEGRATION",fuelTankCode:null,globalRewardKey:"gc1"}]}}]}}]:[],childNodes:{data:[{data:{id:"5cae6b16cc540e209db45cb3",statuses:statuses[Math.floor(Math.random()*statuses.length)],type:"PCT_DISCOUNT",value:50},depth:1},{data:{id:"5cae6b16cc540e209db45cfa",statuses:statuses[Math.floor(Math.random()*statuses.length)],type:"CREDIT",value:1},depth:1}]}}};var ReferralTable=function(){function e(e){registerInstance(this,e);this.perPage=4;this.hideLabels=false;this.prevLabel="Prev";this.moreLabel="Next";this.showReferrer=false;this.hiddenColumns="0";this.smBreakpoint=599;this.mdBreakpoint=799;h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.render=function(){var e=h$1(EmptySlot,null);var t=h$1(LoadingSlot,null);var r=isDemo()?useReferralTableDemo(this,e,t):useReferralTable(this,e,t),a=r.states,n=r.data,i=r.callbacks,l=r.elements;useRequestRerender([this.showReferrer,this.perPage]);return h$1(GenericTableView,{states:a,data:n,callbacks:i,elements:l})};return e}();function EmptySlot(){return h$1("slot",{name:"empty"},h$1("sqm-empty",{"empty-state-image":"https://res.cloudinary.com/saasquatch/image/upload/v1644000223/squatch-assets/empty_referral2.png","empty-state-header":"View your referral details","empty-state-text":"Refer a friend to view the status of your referrals and rewards earned"}))}function LoadingSlot(){return h$1("slot",{name:"loading"},h$1(LoadingRow,null),h$1(LoadingRow,null),h$1(LoadingRow,null),h$1(LoadingRow,null))}function LoadingRow(){return h$1("sqm-table-row",null,h$1("sqm-table-cell",{colspan:5},h$1("sl-skeleton",null)))}function useReferralTableDemo(e,t,r){var a=useReducer((function(e,t){return __assign(__assign({},e),t)}),{columns:[],rows:[],loading:false,page:0}),n=a[0],i=a[1];var l=useRerenderListener();var s=useMemo((function(){var t;return((t=e.demoData)===null||t===void 0?void 0:t.mockData)||mockReferralData(e.perPage)}),[e.perPage]);var o=useChildElements();function u(t){return __awaiter(this,void 0,void 0,(function(){var r,a,n,l,o,u,d,c,f,h,p,v,m,E;var _=this;return __generator(this,(function(T){switch(T.label){case 0:n=s===null||s===void 0?void 0:s.referredByReferral;l=e.showReferrer&&!!((r=s===null||s===void 0?void 0:s.referredByReferral)===null||r===void 0?void 0:r.dateReferralStarted);if(l){a=s.data.slice(0,e.perPage-1)}else{a=s.data.slice(0,e.perPage)}o=t.filter((function(e){var t,r;return e.slot!=="loading"&&e.slot!=="empty"&&((t=e===null||e===void 0?void 0:e.firstElementChild)===null||t===void 0?void 0:t.getAttribute("slot"))!=="loading"&&((r=e===null||e===void 0?void 0:e.firstElementChild)===null||r===void 0?void 0:r.getAttribute("slot"))!=="empty"}));u=o===null||o===void 0?void 0:o.map((function(e,t){return __awaiter(_,void 0,void 0,(function(){var r,a,n;return __generator(this,(function(i){a=(r=e===null||e===void 0?void 0:e.firstElementChild)===null||r===void 0?void 0:r.getAttribute("slot");if(e.tagName==="RAISINS-PLOP-TARGET"&&a!=="loading"&&a!=="empty"){e.setAttribute("slot","column-"+t);e.style.position="absolute";n=e.firstElementChild.childNodes[1];n.innerHTML="+";n.style.lineHeight="20px";return[2,tryMethod(e,(function(){return e.renderLabel(t)}))]}return[2,tryMethod(e,(function(){return e.renderLabel()}))]}))}))}));if(!l)return[3,2];c=o===null||o===void 0?void 0:o.map((function(e){return __awaiter(_,void 0,void 0,(function(){return __generator(this,(function(t){return[2,tryMethod(e,(function t(){return e.renderCell(n,e)}))]}))}))}));return[4,Promise.all(c)];case 1:d=T.sent();T.label=2;case 2:f=a===null||a===void 0?void 0:a.map((function(e){return __awaiter(_,void 0,void 0,(function(){var t,r;var a=this;return __generator(this,(function(n){switch(n.label){case 0:t=o===null||o===void 0?void 0:o.map((function(t){return __awaiter(a,void 0,void 0,(function(){return __generator(this,(function(r){return[2,tryMethod(t,(function(){return t.renderCell(e,undefined)}))]}))}))}));return[4,Promise.all(t)];case 1:r=n.sent();return[2,r]}}))}))}));p=f;if(!p)return[3,4];v=[[d]];return[4,Promise.all(f)];case 3:p=__spreadArrays.apply(void 0,v.concat([T.sent()])).filter((function(e){return e}));T.label=4;case 4:h=p;i({rows:h});E=u;if(!E)return[3,6];return[4,Promise.all(u)];case 5:E=T.sent();T.label=6;case 6:m=E;i({columns:m,loading:false,page:0});return[2]}}))}))}useEffect((function(){i({loading:true});(s===null||s===void 0?void 0:s.data)&&u(o)}),[s===null||s===void 0?void 0:s.data,o,l]);var d=cjs({states:{hasPrev:false,hasNext:false,loading:false,show:"rows"},callbacks:{prevPage:function(){return console.log("Prev")},nextPage:function(){return console.log("Next")}},data:{textOverrides:{showLabels:!e.hideLabels,prevLabel:e.prevLabel,moreLabel:e.moreLabel},hiddenColumns:e.hiddenColumns,referralData:[],mdBreakpoint:799,smBreakpoint:599},elements:{columns:n.columns,rows:n.rows,emptyElement:t,loadingElement:r}},e.demoData||{},{arrayMerge:function(e,t){return t}});return d}var ReferralTableCell=function(){function e(e){registerInstance(this,e);this.ignored=true;h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.render=function(){return h$1("div",{innerHTML:this.innerTemplate})};return e}();var ReferralTableGenericColumn=function(){function e(e){registerInstance(this,e);h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.renderCell=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,h$1("sqm-referral-table-cell",{"inner-template":getElement(this).innerHTML})]}))}))};e.prototype.renderLabel=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,Promise.resolve(this.columnTitle)]}))}))};e.prototype.render=function(){useRequestRerender([this.columnTitle]);return h$1(Host,{style:{display:"none"}},h$1("slot",null))};return e}();var ReferralTableDateCell=function(){function e(e){registerInstance(this,e);this.ignored=true;this.locale="en";h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.render=function(){var e;var t=!this.date?"-":(e=luxon.DateTime.fromMillis(this.date))===null||e===void 0?void 0:e.setLocale(luxonLocale(this.locale)).toLocaleString(luxon.DateTime.DATE_MED);return t};return e}();var ReferralTableDateColumn=function(){function e(e){registerInstance(this,e);this.columnTitle="Date converted";this.dateShown="dateConverted";h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.renderCell=function(e,t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(r){return[2,h$1("sqm-referral-table-date-cell",{date:e[this.dateShown],locale:t===null||t===void 0?void 0:t.locale})]}))}))};e.prototype.renderLabel=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.columnTitle]}))}))};e.prototype.renderReferrerCell=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,h$1("sqm-referral-table-date-cell",{date:e[this.dateShown]})]}))}))};e.prototype.render=function(){useRequestRerender([this.dateShown,this.columnTitle]);return h$1(Host,{style:{display:"none"}})};return e}();var ReferralTableRewardsCell=function(){function e(e){registerInstance(this,e);this.statusText="{status, select, AVAILABLE {Available} CANCELLED {Cancelled} PENDING {Pending} PENDING_REVIEW {Pending} PAYOUT_APPROVED {Payout Approved} 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} }";this.statusLongText="{status, select, AVAILABLE {Reward expiring on} CANCELLED {Reward cancelled on} PENDING {Available on} PENDING_REVIEW {Pending since} PAYOUT_APPROVED {Reward approved for payout and was scheduled for payment 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.} 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} }";this.locale="en"}e.prototype.render=function(){var e=this;var t;intl.locale=this.locale;var r={"@keyframes slideRight":{from:{opacity:0},to:{opacity:1}},DetailsContainer:{width:"100%",display:"flex","align-items":"center","justify-content":"space-between","margin-right":"var(--sl-spacing-small)","flex-wrap":"wrap"},Details:{"padding-bottom":"var(--sl-spacing-small)","max-width":"500px","&::part(header)":{padding:"var(--sl-spacing-x-small)",cursor:""+(this.hideDetails?"default":"pointer")},"&::part(content)":{padding:"var(--sl-spacing-x-small) var(--sl-spacing-medium)"},"&::part(base)":{opacity:"1"},"&::part(summary-icon)":{display:""+(this.hideDetails?"none":"flex")},"&::part(summary-icon[open])":{transform:"rotate(-90deg)",background:"red"}},BadgeContainer:{"& > :not(:last-child)":{"margin-right":"var(--sl-spacing-x-small)"}},BoldText:{"font-weight":"var(--sl-font-weight-semibold)"},StatusBadge:{paddingLeft:"var(--sl-spacing-xxx-small)","&::part(base)":{textAlign:"center",maxWidth:"170px",whiteSpace:"pre-line"}},RedeemBadge:{paddingLeft:"var(--sl-spacing-xxx-small)","&::part(base)":{background:"var(--sl-color-blue-600)"}}};var a=createStyleSheet(r);var n=a.toString();var i=function(e,t){var r,a,n,i,l,s,o,u,d,c,f,h;var p=["REDEEMED","CANCELLED","EXPIRED","PENDING","AVAILABLE","PENDING_REVIEW","DENIED","PAYOUT_APPROVED","PAYOUT_CANCELLED","PAYOUT_FAILED","PENDING_TAX_REVIEW","PENDING_NEW_TAX_FORM","PENDING_TAX_SUBMISSION","PENDING_PARTNER_CREATION"];if(((a=(r=e.referral)===null||r===void 0?void 0:r.fraudData)===null||a===void 0?void 0:a.moderationStatus)!=="APPROVED"){if(((i=(n=e.referral)===null||n===void 0?void 0:n.fraudData)===null||i===void 0?void 0:i.moderationStatus)==="PENDING")return"PENDING_REVIEW";if(((s=(l=e.referral)===null||l===void 0?void 0:l.fraudData)===null||s===void 0?void 0:s.moderationStatus)==="DENIED")return"DENIED"}var v=(o=e.partnerFundsTransfer)===null||o===void 0?void 0:o.status;if(v==="NOT_YET_DUE"||v==="TRANSFERRED"){return"PAYOUT_APPROVED"}else if(v==="OVERDUE")return"PAYOUT_FAILED";else if(v==="REVERSED")return"PAYOUT_CANCELLED";if((u=e===null||e===void 0?void 0:e.pendingReasons)===null||u===void 0?void 0:u.includes("US_TAX")){if(!(t===null||t===void 0?void 0:t.taxHandlingEnabled))return"PENDING";if(!(t===null||t===void 0?void 0:t.connected))return"PENDING_PARTNER_CREATION";if((d=t===null||t===void 0?void 0:t.publisher)===null||d===void 0?void 0:d.requiredTaxDocumentType){if(!((c=t===null||t===void 0?void 0:t.publisher)===null||c===void 0?void 0:c.currentTaxDocument))return"PENDING_TAX_SUBMISSION";var m=t.publisher.currentTaxDocument.status;if(m==="INACTIVE")return"PENDING_NEW_TAX_FORM";if(m==="NOT_VERIFIED")return"PENDING_TAX_REVIEW"}if(!((f=t===null||t===void 0?void 0:t.publisher)===null||f===void 0?void 0:f.withdrawalSettings))return"PENDING_PARTNER_CREATION"}if((h=e===null||e===void 0?void 0:e.pendingReasons)===null||h===void 0?void 0:h.includes("PAYOUT_CONFIGURATION_MISSING")){return"PENDING_PARTNER_CREATION"}if(e.statuses.length===1)return e.statuses[0];return p.find((function(t){return e.statuses.includes(t)&&t}))};var l=function(e){switch(e){case"REDEEMED":case"PAYOUT_APPROVED":return"primary";case"DENIED":case"EXPIRED":case"CANCELLED":case"PAYOUT_FAILED":case"PAYOUT_CANCELLED":return"danger";case"PENDING":case"PENDING_REVIEW":case"PENDING_TAX_REVIEW":case"PENDING_NEW_TAX_FORM":case"PENDING_TAX_SUBMISSION":case"PENDING_PARTNER_CREATION":return"warning";case"AVAILABLE":return"success"}};var s=function(t){return luxon.DateTime.fromMillis(t).setLocale(luxonLocale(e.locale)).toRelative().replace("in","").trim()};return(t=this.rewards)===null||t===void 0?void 0:t.map((function(t){var r,o;var u=i(t,e.taxConnection);var d=l(u);var c=intl.formatMessage({id:"statusShortMessage",defaultMessage:e.statusText},{status:u});var f=intl.formatMessage({id:"statusLongMessage",defaultMessage:e.statusLongText},{status:u});return h$1("sl-details",{class:a.classes.Details,disabled:e.hideDetails},h$1("style",{type:"text/css"},n),h$1("div",{slot:"summary",class:a.classes.DetailsContainer},h$1(TextSpanView,{type:"p"},h$1("span",{part:"sqm-cell-value",class:a.classes.BoldText},t.prettyValue)),h$1("div",{class:a.classes.BadgeContainer},u==="PENDING"&&t.dateScheduledFor?h$1("sl-badge",{class:d==="primary"?a.classes.RedeemBadge:a.classes.StatusBadge,type:d,pill:true},intl.formatMessage({id:"pendingForText",defaultMessage:e.pendingForText},{status:c,date:s(t.dateScheduledFor)})):h$1("sl-badge",{class:d==="primary"?a.classes.RedeemBadge:a.classes.StatusBadge,type:d,pill:true},c),t.dateExpires&&u==="AVAILABLE"&&h$1("sl-badge",{class:d==="primary"?a.classes.RedeemBadge:a.classes.StatusBadge,type:"info",pill:true},e.expiringText," "+s(t.dateExpires)))),h$1("div",null,u==="PENDING_REVIEW"&&((r=t.referral)===null||r===void 0?void 0:r.dateModerated)&&h$1("div",null,h$1(TextSpanView,{type:"p"},f," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},luxon.DateTime.fromMillis(t.referral.dateModerated).setLocale(luxonLocale(e.locale)).toLocaleString(luxon.DateTime.DATE_MED)))),u==="PAYOUT_APPROVED"&&h$1("div",null,h$1(TextSpanView,{type:"p"},f)),u==="PAYOUT_FAILED"&&h$1("div",null,h$1(TextSpanView,{type:"p"},f)),u==="PAYOUT_CANCELLED"&&h$1("div",null,h$1(TextSpanView,{type:"p"},f)),u==="PENDING_TAX_REVIEW"&&h$1("div",null,h$1(TextSpanView,{type:"p"},f)),u==="PENDING_NEW_TAX_FORM"&&h$1("div",null,h$1(TextSpanView,{type:"p"},f)),u==="PENDING_TAX_SUBMISSION"&&h$1("div",null,h$1(TextSpanView,{type:"p"},f)),u==="PENDING_PARTNER_CREATION"&&h$1("div",null,h$1(TextSpanView,{type:"p"},f)),u==="DENIED"&&((o=t.referral)===null||o===void 0?void 0:o.dateModerated)&&h$1("div",null,h$1(TextSpanView,{type:"p"},f," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},luxon.DateTime.fromMillis(t.referral.dateModerated).setLocale(luxonLocale(e.locale)).toLocaleString(luxon.DateTime.DATE_MED)),".",e.deniedHelpText?" "+e.deniedHelpText:"")),t.dateGiven&&h$1("div",null,h$1(TextSpanView,{type:"p"},e.rewardReceivedText," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},luxon.DateTime.fromMillis(t.dateGiven).setLocale(luxonLocale(e.locale)).toLocaleString(luxon.DateTime.DATE_MED)))),u==="EXPIRED"&&t.dateExpires&&h$1("div",null,h$1(TextSpanView,{type:"p"},f," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},luxon.DateTime.fromMillis(t.dateExpires).setLocale(luxonLocale(e.locale)).toLocaleString(luxon.DateTime.DATE_MED)))),u==="CANCELLED"&&t.dateCancelled&&h$1("div",null,h$1(TextSpanView,{type:"p"},f," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},luxon.DateTime.fromMillis(t.dateCancelled).setLocale(luxonLocale(e.locale)).toLocaleString(luxon.DateTime.DATE_MED)))),u==="PENDING"&&t.dateScheduledFor&&h$1("div",null,h$1(TextSpanView,{type:"p"},f," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},luxon.DateTime.fromMillis(t.dateScheduledFor).setLocale(luxonLocale(e.locale)).toLocaleString(luxon.DateTime.DATE_MED))))," ",u==="AVAILABLE"&&t.dateExpires&&h$1("div",null,h$1(TextSpanView,{type:"p"},f," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},luxon.DateTime.fromMillis(t.dateExpires).setLocale(luxonLocale(e.locale)).toLocaleString(luxon.DateTime.DATE_MED)))),t.fuelTankCode&&h$1("div",null,e.fuelTankText," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},t.fuelTankCode))))}))};return e}();var ReferralTableRewardsColumn=function(){function e(e){registerInstance(this,e);this.columnTitle="Rewards";this.statusText="{status, select, AVAILABLE {Available} CANCELLED {Cancelled} PENDING {Pending} PENDING_REVIEW {Pending} PAYOUT_APPROVED {Payout Approved} 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} }";this.statusLongText="{status, select, AVAILABLE {Reward expiring on} CANCELLED {Reward cancelled on} PENDING {Available on} PENDING_REVIEW {Pending since} PAYOUT_APPROVED {Reward approved for payout and was scheduled for payment 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.} 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} }";this.fuelTankText="Your code is";this.rewardReceivedText="Reward received on";this.expiringText="Expiring in";this.pendingForText="{status} for {date}";this.deniedHelpText="Contact support if you think this is a mistake.";this.hideDetails=false;h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.renderCell=function(e,t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(r){return[2,h$1("sqm-referral-table-rewards-cell",{rewards:e.rewards,taxConnection:t===null||t===void 0?void 0:t.taxConnection,statusText:this.statusText,statusLongText:this.statusLongText,fuelTankText:this.fuelTankText,rewardReceivedText:this.rewardReceivedText,expiringText:this.expiringText,pendingForText:this.pendingForText,hideDetails:this.hideDetails,deniedHelpText:this.deniedHelpText,locale:t===null||t===void 0?void 0:t.locale,exportparts:"sqm-cell-value"})]}))}))};e.prototype.renderLabel=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.columnTitle]}))}))};e.prototype.renderReferrerCell=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,h$1("sqm-referral-table-rewards-cell",{rewards:e.rewards,exportparts:"sqm-cell-value"})]}))}))};e.prototype.render=function(){useRequestRerender([this.columnTitle,this.statusText,this.statusLongText,this.fuelTankText,this.rewardReceivedText,this.expiringText,this.pendingForText,this.hideDetails]);return h$1(Host,{style:{display:"none"}})};return e}();var style={Badge:{"&::part(base)":{fontSize:"var(--sl-font-size-small)",padding:"4px 8px",whiteSpace:"pre-line"}},SubText:{fontSize:"var(--sl-font-size-small)",color:"var(--sl-color-neutral-500)",margin:"0"}};var sheet=createStyleSheet(style);var styleString=sheet.toString();var ReferralTableStatusCell=function(){function e(e){registerInstance(this,e)}e.prototype.render=function(){var e=this;var t=function(t){if(t==="PENDING")return"warning";if(t==="DENIED")return"danger";if(e.converted)return"success";return"warning"};return h$1("div",null,h$1("style",{type:"text/css"},styleString),h$1("sl-badge",{pill:true,type:t(this.fraudStatus),class:sheet.classes.Badge},this.statusText),this.statusSubText?h$1("p",{class:sheet.classes.SubText},this.statusSubText):null)};return e}();var ReferralTableStatusColumn=function(){function e(e){registerInstance(this,e);this.columnTitle="Status";this.convertedStatusText="Converted";this.inProgressStatusText="In Progress";this.pendingReviewStatusText="Pending";this.deniedStatusText="Denied";this.pendingReviewStatusSubText="Awaiting review";this.deniedStatusSubText="Detected self-referral";h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.renderCell=function(e){return __awaiter(this,void 0,void 0,(function(){var t,r,a,n;return __generator(this,(function(i){n=(t=e===null||e===void 0?void 0:e.fraudData)===null||t===void 0?void 0:t.moderationStatus;if(n==="DENIED"){r=this.deniedStatusText;a=this.deniedStatusSubText}else if(n==="PENDING"){r=this.pendingReviewStatusText;a=this.pendingReviewStatusSubText}else{r=e.dateConverted?this.convertedStatusText:this.inProgressStatusText}return[2,h$1("sqm-referral-table-status-cell",{"status-text":r,"status-sub-text":a,"fraud-status":n,converted:e.dateConverted?true:false})]}))}))};e.prototype.renderLabel=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.columnTitle]}))}))};e.prototype.renderReferrerCell=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(r){t=e.dateConverted?this.convertedStatusText:this.inProgressStatusText;return[2,h$1("sqm-referral-table-status-cell",{"status-text":t,converted:e.dateConverted?true:false})]}))}))};e.prototype.render=function(){useRequestRerender([this.columnTitle,this.convertedStatusText,this.inProgressStatusText]);return h$1(Host,{style:{display:"none"}})};return e}();var ReferralTableUserCell=function(){function e(e){registerInstance(this,e)}e.prototype.render=function(){return this.name};return e}();var ReferralTableUserColumn=function(){function e(e){registerInstance(this,e);this.columnTitle="Customer";this.anonymousUser="Anonymous User";this.deletedUser="Deleted User";h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.renderCell=function(e){return __awaiter(this,void 0,void 0,(function(){var t,r,a,n,i,l,s,o,u;return __generator(this,(function(d){if(!(e===null||e===void 0?void 0:e.referredUser)&&!(e===null||e===void 0?void 0:e.referrerUser)){u=this.deletedUser}else if(!((t=e===null||e===void 0?void 0:e.referredUser)===null||t===void 0?void 0:t.firstName)&&!((r=e===null||e===void 0?void 0:e.referredUser)===null||r===void 0?void 0:r.lastName)&&!((a=e===null||e===void 0?void 0:e.referrerUser)===null||a===void 0?void 0:a.firstName)&&!((n=e===null||e===void 0?void 0:e.referrerUser)===null||n===void 0?void 0:n.lastName)){u=this.anonymousUser}else if(e===null||e===void 0?void 0:e.referrerUser){u=((i=e===null||e===void 0?void 0:e.referrerUser)===null||i===void 0?void 0:i.firstName)+" "+((l=e===null||e===void 0?void 0:e.referrerUser)===null||l===void 0?void 0:l.lastName)}else{u=((s=e===null||e===void 0?void 0:e.referredUser)===null||s===void 0?void 0:s.firstName)+" "+((o=e===null||e===void 0?void 0:e.referredUser)===null||o===void 0?void 0:o.lastName)}return[2,h$1("sqm-referral-table-user-cell",{name:u})]}))}))};e.prototype.renderLabel=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.columnTitle]}))}))};e.prototype.renderReferrerCell=function(e){return __awaiter(this,void 0,void 0,(function(){var t,r,a,n,i;return __generator(this,(function(l){if(!e){i=this.deletedUser}else if(!((t=e===null||e===void 0?void 0:e.referrerUser)===null||t===void 0?void 0:t.firstName)&&!((r=e.referrerUser)===null||r===void 0?void 0:r.lastName)){i=this.anonymousUser}else{i=((a=e===null||e===void 0?void 0:e.referrerUser)===null||a===void 0?void 0:a.firstName)+" "+((n=e===null||e===void 0?void 0:e.referrerUser)===null||n===void 0?void 0:n.lastName)}return[2,h$1("sqm-referral-table-user-cell",{name:i})]}))}))};e.prototype.render=function(){useRequestRerender([this.deletedUser,this.anonymousUser,this.columnTitle]);return h$1(Host,{style:{display:"none"}})};return e}();export{ReferralTable as sqm_referral_table,ReferralTableCell as sqm_referral_table_cell,ReferralTableGenericColumn as sqm_referral_table_column,ReferralTableDateCell as sqm_referral_table_date_cell,ReferralTableDateColumn as sqm_referral_table_date_column,ReferralTableRewardsCell as sqm_referral_table_rewards_cell,ReferralTableRewardsColumn as sqm_referral_table_rewards_column,ReferralTableStatusCell as sqm_referral_table_status_cell,ReferralTableStatusColumn as sqm_referral_table_status_column,ReferralTableUserCell as sqm_referral_table_user_cell,ReferralTableUserColumn as sqm_referral_table_user_column};
|
|
1
|
+
var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++){t=arguments[r];for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n))e[n]=t[n]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,r,a){function n(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function l(e){try{o(a.next(e))}catch(e){i(e)}}function s(e){try{o(a["throw"](e))}catch(e){i(e)}}function o(e){e.done?r(e.value):n(e.value).then(l,s)}o((a=a.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,n,i,l;return l={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(l[Symbol.iterator]=function(){return this}),l;function s(e){return function(t){return o([e,t])}}function o(l){if(a)throw new TypeError("Generator is already executing.");while(r)try{if(a=1,n&&(i=l[0]&2?n["return"]:l[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;if(n=0,i)l=[l[0]&2,i.value];switch(l[0]){case 0:case 1:i=l;break;case 4:r.label++;return{value:l[1],done:false};case 5:r.label++;n=l[1];l=[0];continue;case 7:l=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){r.label=l[1];break}if(l[0]===6&&r.label<i[1]){r.label=i[1];i=l;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(l);break}if(i[2])r.ops.pop();r.trys.pop();continue}l=t.call(e,r)}catch(e){l=[6,e];n=0}finally{a=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:true}}};var __spreadArrays=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var a=Array(e),n=0,t=0;t<r;t++)for(var i=arguments[t],l=0,s=i.length;l<s;l++,n++)a[n]=i[l];return a};import{r as registerInstance,h as h$1,g as getElement,c as Host}from"./index-91e7729f.js";import{n as h,j as useReducer,u as useMemo,f as useEffect}from"./stencil-hooks.module-4bc38af4.js";import{i as intl}from"./global-be1f9992.js";import{i as isDemo}from"./index.module-89a79f66.js";import{c as cjs}from"./cjs-bdfb4486.js";import{l as luxonLocale}from"./utils-334c1e34.js";import{c as createStyleSheet}from"./JSS-67b5cff8.js";import"./mixins-83f90fa1.js";import{G as GenericTableView}from"./GenericTableView-7b9087af.js";import{a as useRequestRerender,u as useRerenderListener}from"./re-render-cc945f38.js";import{u as useChildElements}from"./useChildElements-7945ae56.js";import{l as luxon}from"./luxon-8d51c92b.js";import{g as getPaypalMeta}from"./mockRewardData-a3cdb832.js";import{u as useReferralTable,t as tryMethod}from"./useReferralTable-b3876ed6.js";import{T as TextSpanView}from"./sqm-text-span-view-ca32495e.js";var mockReferralData=function(e){if(e===void 0){e=4}var t=__spreadArrays(Array(e)).map((function(){return getMockData()}));return{totalCount:6,count:e,referredByReferral:{dateConverted:null,dateReferralStarted:1643912659850,referrerUser:{firstName:"John",lastName:"Snow",rewards:[]}},data:t}};var statuses=[["AVAILABLE"],["PENDING"],["CANCELLED"],["EXPIRED"],["REDEEMED"]];var firstNames=["Rajesh","Pierre","Ji-Ho","Chinua","Charleston","Sally","Gael","Jill","Jane","Khadija"];var lastNames=["Smith","Parker","Kent","Chew","Stark","Banner","Jones","Odinson","Pym","Rogers"];var getMockData=function(){return{id:"5cae6b0fcc540e209db45b53",referredUser:{id:"5cae6b0ce4b0d81c67b78e82",accountId:"SPX1MZBIPTFL3E1H",firstName:firstNames[Math.floor(Math.random()*firstNames.length)],lastName:lastNames[Math.floor(Math.random()*lastNames.length)],email:"example.uexwltgh@mailosaur.io",programGoals:[]},shareLinkUsed:null,referralCodeUsed:"JIMBONEUTRON2",moderationStatus:"PENDING",dateConverted:Math.floor(Math.random()*10)>=5?luxon.DateTime.now().minus({days:6}).toMillis():null,dateFraudChecksCompleted:null,dateModerated:1558730033306,dateModified:1554934543447,dateReferralEnded:null,dateReferralPaid:null,dateReferralStarted:luxon.DateTime.now().minus({days:8}).toMillis(),dateUserModified:null,programId:"sam-partner-test-2",program:{id:"sam-partner-test-2",name:"Partner Program 2.0"},rewards:Math.floor(Math.random()*10)>=5?[{id:"5cae6b16cc540e209db45cfa",type:"CREDIT",value:1,unit:"POINT",name:"Partner Reward",dateGiven:1554934550726,dateExpires:null,dateCancelled:null,dateRedeemed:1637004373582,dateScheduledFor:null,fuelTankCode:null,fuelTankType:null,currency:null,prettyValue:"1 Point",statuses:statuses[Math.floor(Math.random()*statuses.length)],globalRewardKey:null,programRewardKey:"partnerReward",meta:__assign({},getPaypalMeta()),rewardRedemptionTransactions:{data:[{exchangedRewards:{data:[{prettyValue:"CAD10.00 Visa* Prepaid Card CAD",type:"INTEGRATION",fuelTankCode:null,globalRewardKey:"gc1"}]}}]}}]:[],childNodes:{data:[{data:{id:"5cae6b16cc540e209db45cb3",statuses:statuses[Math.floor(Math.random()*statuses.length)],type:"PCT_DISCOUNT",value:50},depth:1},{data:{id:"5cae6b16cc540e209db45cfa",statuses:statuses[Math.floor(Math.random()*statuses.length)],type:"CREDIT",value:1},depth:1}]}}};var ReferralTable=function(){function e(e){registerInstance(this,e);this.perPage=4;this.hideLabels=false;this.prevLabel="Prev";this.moreLabel="Next";this.showReferrer=false;this.hiddenColumns="0";this.smBreakpoint=599;this.mdBreakpoint=799;h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.render=function(){var e=h$1(EmptySlot,null);var t=h$1(LoadingSlot,null);var r=isDemo()?useReferralTableDemo(this,e,t):useReferralTable(this,e,t),a=r.states,n=r.data,i=r.callbacks,l=r.elements;useRequestRerender([this.showReferrer,this.perPage]);return h$1(GenericTableView,{states:a,data:n,callbacks:i,elements:l})};return e}();function EmptySlot(){return h$1("slot",{name:"empty"},h$1("sqm-empty",{"empty-state-image":"https://res.cloudinary.com/saasquatch/image/upload/v1644000223/squatch-assets/empty_referral2.png","empty-state-header":"View your referral details","empty-state-text":"Refer a friend to view the status of your referrals and rewards earned"}))}function LoadingSlot(){return h$1("slot",{name:"loading"},h$1(LoadingRow,null),h$1(LoadingRow,null),h$1(LoadingRow,null),h$1(LoadingRow,null))}function LoadingRow(){return h$1("sqm-table-row",null,h$1("sqm-table-cell",{colspan:5},h$1("sl-skeleton",null)))}function useReferralTableDemo(e,t,r){var a=useReducer((function(e,t){return __assign(__assign({},e),t)}),{columns:[],rows:[],loading:false,page:0}),n=a[0],i=a[1];var l=useRerenderListener();var s=useMemo((function(){var t;return((t=e.demoData)===null||t===void 0?void 0:t.mockData)||mockReferralData(e.perPage)}),[e.perPage]);var o=useChildElements();function u(t){return __awaiter(this,void 0,void 0,(function(){var r,a,n,l,o,u,d,c,f,h,p,v,m,E;var _=this;return __generator(this,(function(T){switch(T.label){case 0:n=s===null||s===void 0?void 0:s.referredByReferral;l=e.showReferrer&&!!((r=s===null||s===void 0?void 0:s.referredByReferral)===null||r===void 0?void 0:r.dateReferralStarted);if(l){a=s.data.slice(0,e.perPage-1)}else{a=s.data.slice(0,e.perPage)}o=t.filter((function(e){var t,r;return e.slot!=="loading"&&e.slot!=="empty"&&((t=e===null||e===void 0?void 0:e.firstElementChild)===null||t===void 0?void 0:t.getAttribute("slot"))!=="loading"&&((r=e===null||e===void 0?void 0:e.firstElementChild)===null||r===void 0?void 0:r.getAttribute("slot"))!=="empty"}));u=o===null||o===void 0?void 0:o.map((function(e,t){return __awaiter(_,void 0,void 0,(function(){var r,a,n;return __generator(this,(function(i){a=(r=e===null||e===void 0?void 0:e.firstElementChild)===null||r===void 0?void 0:r.getAttribute("slot");if(e.tagName==="RAISINS-PLOP-TARGET"&&a!=="loading"&&a!=="empty"){e.setAttribute("slot","column-"+t);e.style.position="absolute";n=e.firstElementChild.childNodes[1];n.innerHTML="+";n.style.lineHeight="20px";return[2,tryMethod(e,(function(){return e.renderLabel(t)}))]}return[2,tryMethod(e,(function(){return e.renderLabel()}))]}))}))}));if(!l)return[3,2];c=o===null||o===void 0?void 0:o.map((function(e){return __awaiter(_,void 0,void 0,(function(){return __generator(this,(function(t){return[2,tryMethod(e,(function t(){return e.renderCell(n,e)}))]}))}))}));return[4,Promise.all(c)];case 1:d=T.sent();T.label=2;case 2:f=a===null||a===void 0?void 0:a.map((function(e){return __awaiter(_,void 0,void 0,(function(){var t,r;var a=this;return __generator(this,(function(n){switch(n.label){case 0:t=o===null||o===void 0?void 0:o.map((function(t){return __awaiter(a,void 0,void 0,(function(){return __generator(this,(function(r){return[2,tryMethod(t,(function(){return t.renderCell(e,undefined)}))]}))}))}));return[4,Promise.all(t)];case 1:r=n.sent();return[2,r]}}))}))}));p=f;if(!p)return[3,4];v=[[d]];return[4,Promise.all(f)];case 3:p=__spreadArrays.apply(void 0,v.concat([T.sent()])).filter((function(e){return e}));T.label=4;case 4:h=p;i({rows:h});E=u;if(!E)return[3,6];return[4,Promise.all(u)];case 5:E=T.sent();T.label=6;case 6:m=E;i({columns:m,loading:false,page:0});return[2]}}))}))}useEffect((function(){i({loading:true});(s===null||s===void 0?void 0:s.data)&&u(o)}),[s===null||s===void 0?void 0:s.data,o,l]);var d=cjs({states:{hasPrev:false,hasNext:false,loading:false,show:"rows"},callbacks:{prevPage:function(){return console.log("Prev")},nextPage:function(){return console.log("Next")}},data:{textOverrides:{showLabels:!e.hideLabels,prevLabel:e.prevLabel,moreLabel:e.moreLabel},hiddenColumns:e.hiddenColumns,referralData:[],mdBreakpoint:799,smBreakpoint:599},elements:{columns:n.columns,rows:n.rows,emptyElement:t,loadingElement:r}},e.demoData||{},{arrayMerge:function(e,t){return t}});return d}var ReferralTableCell=function(){function e(e){registerInstance(this,e);this.ignored=true;h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.render=function(){return h$1("div",{innerHTML:this.innerTemplate})};return e}();var ReferralTableGenericColumn=function(){function e(e){registerInstance(this,e);h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.renderCell=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,h$1("sqm-referral-table-cell",{"inner-template":getElement(this).innerHTML})]}))}))};e.prototype.renderLabel=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,Promise.resolve(this.columnTitle)]}))}))};e.prototype.render=function(){useRequestRerender([this.columnTitle]);return h$1(Host,{style:{display:"none"}},h$1("slot",null))};return e}();var ReferralTableDateCell=function(){function e(e){registerInstance(this,e);this.ignored=true;this.locale="en";h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.render=function(){var e;var t=!this.date?"-":(e=luxon.DateTime.fromMillis(this.date))===null||e===void 0?void 0:e.setLocale(luxonLocale(this.locale)).toLocaleString(luxon.DateTime.DATE_MED);return t};return e}();var ReferralTableDateColumn=function(){function e(e){registerInstance(this,e);this.columnTitle="Date converted";this.dateShown="dateConverted";h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.renderCell=function(e,t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(r){return[2,h$1("sqm-referral-table-date-cell",{date:e[this.dateShown],locale:t===null||t===void 0?void 0:t.locale})]}))}))};e.prototype.renderLabel=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.columnTitle]}))}))};e.prototype.renderReferrerCell=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,h$1("sqm-referral-table-date-cell",{date:e[this.dateShown]})]}))}))};e.prototype.render=function(){useRequestRerender([this.dateShown,this.columnTitle]);return h$1(Host,{style:{display:"none"}})};return e}();var ReferralTableRewardsCell=function(){function e(e){registerInstance(this,e);this.statusText="{status, select, AVAILABLE {Available} CANCELLED {Cancelled} PENDING {Pending} PENDING_REVIEW {Pending} PAYOUT_APPROVED {Payout Approved} 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} }";this.statusLongText="{status, select, AVAILABLE {Reward expiring on} CANCELLED {Reward cancelled on} PENDING {Available on} PENDING_REVIEW {Pending since} PAYOUT_APPROVED {Reward approved for payout and was scheduled for payment 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.} 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} }";this.locale="en"}e.prototype.render=function(){var e=this;var t;intl.locale=this.locale;var r={"@keyframes slideRight":{from:{opacity:0},to:{opacity:1}},DetailsContainer:{width:"100%",display:"flex","align-items":"center","justify-content":"space-between","margin-right":"var(--sl-spacing-small)","flex-wrap":"wrap"},Details:{"padding-bottom":"var(--sl-spacing-small)","max-width":"500px","&::part(header)":{padding:"var(--sl-spacing-x-small)",cursor:""+(this.hideDetails?"default":"pointer")},"&::part(content)":{padding:"var(--sl-spacing-x-small) var(--sl-spacing-medium)"},"&::part(base)":{opacity:"1"},"&::part(summary-icon)":{display:""+(this.hideDetails?"none":"flex")},"&::part(summary-icon[open])":{transform:"rotate(-90deg)",background:"red"}},BadgeContainer:{"& > :not(:last-child)":{"margin-right":"var(--sl-spacing-x-small)"}},BoldText:{"font-weight":"var(--sl-font-weight-semibold)"},StatusBadge:{paddingLeft:"var(--sl-spacing-xxx-small)","&::part(base)":{textAlign:"center",maxWidth:"170px",whiteSpace:"pre-line"}},RedeemBadge:{paddingLeft:"var(--sl-spacing-xxx-small)","&::part(base)":{background:"var(--sl-color-blue-600)"}}};var a=createStyleSheet(r);var n=a.toString();var i=function(e,t){var r,a,n,i,l,s,o,u,d,c,f,h;var p=["REDEEMED","CANCELLED","EXPIRED","PENDING","AVAILABLE","PENDING_REVIEW","DENIED","PAYOUT_APPROVED","PAYOUT_CANCELLED","PAYOUT_FAILED","PENDING_TAX_REVIEW","PENDING_NEW_TAX_FORM","PENDING_TAX_SUBMISSION","PENDING_PARTNER_CREATION"];if(((a=(r=e.referral)===null||r===void 0?void 0:r.fraudData)===null||a===void 0?void 0:a.moderationStatus)!=="APPROVED"){if(((i=(n=e.referral)===null||n===void 0?void 0:n.fraudData)===null||i===void 0?void 0:i.moderationStatus)==="PENDING")return"PENDING_REVIEW";if(((s=(l=e.referral)===null||l===void 0?void 0:l.fraudData)===null||s===void 0?void 0:s.moderationStatus)==="DENIED")return"DENIED"}var v=(o=e.partnerFundsTransfer)===null||o===void 0?void 0:o.status;if(v==="NOT_YET_DUE"||v==="TRANSFERRED"){return"PAYOUT_APPROVED"}else if(v==="OVERDUE")return"PAYOUT_FAILED";else if(v==="REVERSED")return"PAYOUT_CANCELLED";if((u=e===null||e===void 0?void 0:e.pendingReasons)===null||u===void 0?void 0:u.includes("US_TAX")){if(!(t===null||t===void 0?void 0:t.taxHandlingEnabled))return"PENDING";if(!(t===null||t===void 0?void 0:t.connected))return"PENDING_PARTNER_CREATION";if((d=t===null||t===void 0?void 0:t.publisher)===null||d===void 0?void 0:d.requiredTaxDocumentType){if(!((c=t===null||t===void 0?void 0:t.publisher)===null||c===void 0?void 0:c.currentTaxDocument))return"PENDING_TAX_SUBMISSION";var m=t.publisher.currentTaxDocument.status;if(m==="INACTIVE")return"PENDING_NEW_TAX_FORM";if(m==="NOT_VERIFIED")return"PENDING_TAX_REVIEW"}if(!((f=t===null||t===void 0?void 0:t.publisher)===null||f===void 0?void 0:f.withdrawalSettings))return"PENDING_PARTNER_CREATION"}if((h=e===null||e===void 0?void 0:e.pendingReasons)===null||h===void 0?void 0:h.includes("MISSING_PAYOUT_CONFIGURATION")){return"PENDING_PARTNER_CREATION"}if(e.statuses.length===1)return e.statuses[0];return p.find((function(t){return e.statuses.includes(t)&&t}))};var l=function(e){switch(e){case"REDEEMED":case"PAYOUT_APPROVED":return"primary";case"DENIED":case"EXPIRED":case"CANCELLED":case"PAYOUT_FAILED":case"PAYOUT_CANCELLED":return"danger";case"PENDING":case"PENDING_REVIEW":case"PENDING_TAX_REVIEW":case"PENDING_NEW_TAX_FORM":case"PENDING_TAX_SUBMISSION":case"PENDING_PARTNER_CREATION":return"warning";case"AVAILABLE":return"success"}};var s=function(t){return luxon.DateTime.fromMillis(t).setLocale(luxonLocale(e.locale)).toRelative().replace("in","").trim()};return(t=this.rewards)===null||t===void 0?void 0:t.map((function(t){var r,o;var u=i(t,e.taxConnection);var d=l(u);var c=intl.formatMessage({id:"statusShortMessage",defaultMessage:e.statusText},{status:u});var f=intl.formatMessage({id:"statusLongMessage",defaultMessage:e.statusLongText},{status:u});return h$1("sl-details",{class:a.classes.Details,disabled:e.hideDetails},h$1("style",{type:"text/css"},n),h$1("div",{slot:"summary",class:a.classes.DetailsContainer},h$1(TextSpanView,{type:"p"},h$1("span",{part:"sqm-cell-value",class:a.classes.BoldText},t.prettyValue)),h$1("div",{class:a.classes.BadgeContainer},u==="PENDING"&&t.dateScheduledFor?h$1("sl-badge",{class:d==="primary"?a.classes.RedeemBadge:a.classes.StatusBadge,type:d,pill:true},intl.formatMessage({id:"pendingForText",defaultMessage:e.pendingForText},{status:c,date:s(t.dateScheduledFor)})):h$1("sl-badge",{class:d==="primary"?a.classes.RedeemBadge:a.classes.StatusBadge,type:d,pill:true},c),t.dateExpires&&u==="AVAILABLE"&&h$1("sl-badge",{class:d==="primary"?a.classes.RedeemBadge:a.classes.StatusBadge,type:"info",pill:true},e.expiringText," "+s(t.dateExpires)))),h$1("div",null,u==="PENDING_REVIEW"&&((r=t.referral)===null||r===void 0?void 0:r.dateModerated)&&h$1("div",null,h$1(TextSpanView,{type:"p"},f," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},luxon.DateTime.fromMillis(t.referral.dateModerated).setLocale(luxonLocale(e.locale)).toLocaleString(luxon.DateTime.DATE_MED)))),u==="PAYOUT_APPROVED"&&h$1("div",null,h$1(TextSpanView,{type:"p"},f)),u==="PAYOUT_FAILED"&&h$1("div",null,h$1(TextSpanView,{type:"p"},f)),u==="PAYOUT_CANCELLED"&&h$1("div",null,h$1(TextSpanView,{type:"p"},f)),u==="PENDING_TAX_REVIEW"&&h$1("div",null,h$1(TextSpanView,{type:"p"},f)),u==="PENDING_NEW_TAX_FORM"&&h$1("div",null,h$1(TextSpanView,{type:"p"},f)),u==="PENDING_TAX_SUBMISSION"&&h$1("div",null,h$1(TextSpanView,{type:"p"},f)),u==="PENDING_PARTNER_CREATION"&&h$1("div",null,h$1(TextSpanView,{type:"p"},f)),u==="DENIED"&&((o=t.referral)===null||o===void 0?void 0:o.dateModerated)&&h$1("div",null,h$1(TextSpanView,{type:"p"},f," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},luxon.DateTime.fromMillis(t.referral.dateModerated).setLocale(luxonLocale(e.locale)).toLocaleString(luxon.DateTime.DATE_MED)),".",e.deniedHelpText?" "+e.deniedHelpText:"")),t.dateGiven&&h$1("div",null,h$1(TextSpanView,{type:"p"},e.rewardReceivedText," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},luxon.DateTime.fromMillis(t.dateGiven).setLocale(luxonLocale(e.locale)).toLocaleString(luxon.DateTime.DATE_MED)))),u==="EXPIRED"&&t.dateExpires&&h$1("div",null,h$1(TextSpanView,{type:"p"},f," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},luxon.DateTime.fromMillis(t.dateExpires).setLocale(luxonLocale(e.locale)).toLocaleString(luxon.DateTime.DATE_MED)))),u==="CANCELLED"&&t.dateCancelled&&h$1("div",null,h$1(TextSpanView,{type:"p"},f," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},luxon.DateTime.fromMillis(t.dateCancelled).setLocale(luxonLocale(e.locale)).toLocaleString(luxon.DateTime.DATE_MED)))),u==="PENDING"&&t.dateScheduledFor&&h$1("div",null,h$1(TextSpanView,{type:"p"},f," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},luxon.DateTime.fromMillis(t.dateScheduledFor).setLocale(luxonLocale(e.locale)).toLocaleString(luxon.DateTime.DATE_MED))))," ",u==="AVAILABLE"&&t.dateExpires&&h$1("div",null,h$1(TextSpanView,{type:"p"},f," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},luxon.DateTime.fromMillis(t.dateExpires).setLocale(luxonLocale(e.locale)).toLocaleString(luxon.DateTime.DATE_MED)))),t.fuelTankCode&&h$1("div",null,e.fuelTankText," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},t.fuelTankCode))))}))};return e}();var ReferralTableRewardsColumn=function(){function e(e){registerInstance(this,e);this.columnTitle="Rewards";this.statusText="{status, select, AVAILABLE {Available} CANCELLED {Cancelled} PENDING {Pending} PENDING_REVIEW {Pending} PAYOUT_APPROVED {Payout Approved} 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} }";this.statusLongText="{status, select, AVAILABLE {Reward expiring on} CANCELLED {Reward cancelled on} PENDING {Available on} PENDING_REVIEW {Pending since} PAYOUT_APPROVED {Reward approved for payout and was scheduled for payment 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.} 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} }";this.fuelTankText="Your code is";this.rewardReceivedText="Reward received on";this.expiringText="Expiring in";this.pendingForText="{status} for {date}";this.deniedHelpText="Contact support if you think this is a mistake.";this.hideDetails=false;h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.renderCell=function(e,t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(r){return[2,h$1("sqm-referral-table-rewards-cell",{rewards:e.rewards,taxConnection:t===null||t===void 0?void 0:t.taxConnection,statusText:this.statusText,statusLongText:this.statusLongText,fuelTankText:this.fuelTankText,rewardReceivedText:this.rewardReceivedText,expiringText:this.expiringText,pendingForText:this.pendingForText,hideDetails:this.hideDetails,deniedHelpText:this.deniedHelpText,locale:t===null||t===void 0?void 0:t.locale,exportparts:"sqm-cell-value"})]}))}))};e.prototype.renderLabel=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.columnTitle]}))}))};e.prototype.renderReferrerCell=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,h$1("sqm-referral-table-rewards-cell",{rewards:e.rewards,exportparts:"sqm-cell-value"})]}))}))};e.prototype.render=function(){useRequestRerender([this.columnTitle,this.statusText,this.statusLongText,this.fuelTankText,this.rewardReceivedText,this.expiringText,this.pendingForText,this.hideDetails]);return h$1(Host,{style:{display:"none"}})};return e}();var style={Badge:{"&::part(base)":{fontSize:"var(--sl-font-size-small)",padding:"4px 8px",whiteSpace:"pre-line"}},SubText:{fontSize:"var(--sl-font-size-small)",color:"var(--sl-color-neutral-500)",margin:"0"}};var sheet=createStyleSheet(style);var styleString=sheet.toString();var ReferralTableStatusCell=function(){function e(e){registerInstance(this,e)}e.prototype.render=function(){var e=this;var t=function(t){if(t==="PENDING")return"warning";if(t==="DENIED")return"danger";if(e.converted)return"success";return"warning"};return h$1("div",null,h$1("style",{type:"text/css"},styleString),h$1("sl-badge",{pill:true,type:t(this.fraudStatus),class:sheet.classes.Badge},this.statusText),this.statusSubText?h$1("p",{class:sheet.classes.SubText},this.statusSubText):null)};return e}();var ReferralTableStatusColumn=function(){function e(e){registerInstance(this,e);this.columnTitle="Status";this.convertedStatusText="Converted";this.inProgressStatusText="In Progress";this.pendingReviewStatusText="Pending";this.deniedStatusText="Denied";this.pendingReviewStatusSubText="Awaiting review";this.deniedStatusSubText="Detected self-referral";h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.renderCell=function(e){return __awaiter(this,void 0,void 0,(function(){var t,r,a,n;return __generator(this,(function(i){n=(t=e===null||e===void 0?void 0:e.fraudData)===null||t===void 0?void 0:t.moderationStatus;if(n==="DENIED"){r=this.deniedStatusText;a=this.deniedStatusSubText}else if(n==="PENDING"){r=this.pendingReviewStatusText;a=this.pendingReviewStatusSubText}else{r=e.dateConverted?this.convertedStatusText:this.inProgressStatusText}return[2,h$1("sqm-referral-table-status-cell",{"status-text":r,"status-sub-text":a,"fraud-status":n,converted:e.dateConverted?true:false})]}))}))};e.prototype.renderLabel=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.columnTitle]}))}))};e.prototype.renderReferrerCell=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(r){t=e.dateConverted?this.convertedStatusText:this.inProgressStatusText;return[2,h$1("sqm-referral-table-status-cell",{"status-text":t,converted:e.dateConverted?true:false})]}))}))};e.prototype.render=function(){useRequestRerender([this.columnTitle,this.convertedStatusText,this.inProgressStatusText]);return h$1(Host,{style:{display:"none"}})};return e}();var ReferralTableUserCell=function(){function e(e){registerInstance(this,e)}e.prototype.render=function(){return this.name};return e}();var ReferralTableUserColumn=function(){function e(e){registerInstance(this,e);this.columnTitle="Customer";this.anonymousUser="Anonymous User";this.deletedUser="Deleted User";h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.renderCell=function(e){return __awaiter(this,void 0,void 0,(function(){var t,r,a,n,i,l,s,o,u;return __generator(this,(function(d){if(!(e===null||e===void 0?void 0:e.referredUser)&&!(e===null||e===void 0?void 0:e.referrerUser)){u=this.deletedUser}else if(!((t=e===null||e===void 0?void 0:e.referredUser)===null||t===void 0?void 0:t.firstName)&&!((r=e===null||e===void 0?void 0:e.referredUser)===null||r===void 0?void 0:r.lastName)&&!((a=e===null||e===void 0?void 0:e.referrerUser)===null||a===void 0?void 0:a.firstName)&&!((n=e===null||e===void 0?void 0:e.referrerUser)===null||n===void 0?void 0:n.lastName)){u=this.anonymousUser}else if(e===null||e===void 0?void 0:e.referrerUser){u=((i=e===null||e===void 0?void 0:e.referrerUser)===null||i===void 0?void 0:i.firstName)+" "+((l=e===null||e===void 0?void 0:e.referrerUser)===null||l===void 0?void 0:l.lastName)}else{u=((s=e===null||e===void 0?void 0:e.referredUser)===null||s===void 0?void 0:s.firstName)+" "+((o=e===null||e===void 0?void 0:e.referredUser)===null||o===void 0?void 0:o.lastName)}return[2,h$1("sqm-referral-table-user-cell",{name:u})]}))}))};e.prototype.renderLabel=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.columnTitle]}))}))};e.prototype.renderReferrerCell=function(e){return __awaiter(this,void 0,void 0,(function(){var t,r,a,n,i;return __generator(this,(function(l){if(!e){i=this.deletedUser}else if(!((t=e===null||e===void 0?void 0:e.referrerUser)===null||t===void 0?void 0:t.firstName)&&!((r=e.referrerUser)===null||r===void 0?void 0:r.lastName)){i=this.anonymousUser}else{i=((a=e===null||e===void 0?void 0:e.referrerUser)===null||a===void 0?void 0:a.firstName)+" "+((n=e===null||e===void 0?void 0:e.referrerUser)===null||n===void 0?void 0:n.lastName)}return[2,h$1("sqm-referral-table-user-cell",{name:i})]}))}))};e.prototype.render=function(){useRequestRerender([this.deletedUser,this.anonymousUser,this.columnTitle]);return h$1(Host,{style:{display:"none"}})};return e}();export{ReferralTable as sqm_referral_table,ReferralTableCell as sqm_referral_table_cell,ReferralTableGenericColumn as sqm_referral_table_column,ReferralTableDateCell as sqm_referral_table_date_cell,ReferralTableDateColumn as sqm_referral_table_date_column,ReferralTableRewardsCell as sqm_referral_table_rewards_cell,ReferralTableRewardsColumn as sqm_referral_table_rewards_column,ReferralTableStatusCell as sqm_referral_table_status_cell,ReferralTableStatusColumn as sqm_referral_table_status_column,ReferralTableUserCell as sqm_referral_table_user_cell,ReferralTableUserColumn as sqm_referral_table_user_column};
|