@saasquatch/mint-components 1.11.1-52 → 1.11.1-54

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.
@@ -431,6 +431,15 @@ const ReferralTableRewardsCell = class {
431
431
  }
432
432
  render() {
433
433
  var _a;
434
+ reRender.useRequestRerender([
435
+ this.statusText,
436
+ this.statusLongText,
437
+ this.fuelTankText,
438
+ this.rewardReceivedText,
439
+ this.expiringText,
440
+ this.pendingForText,
441
+ this.hideDetails,
442
+ ]);
434
443
  global.intl.locale = this.locale;
435
444
  const style = {
436
445
  "@keyframes slideRight": {
@@ -579,40 +588,31 @@ const ReferralTableRewardsCell = class {
579
588
  .replace("in", "")
580
589
  .trim();
581
590
  };
582
- function getPropValue(prop) {
583
- return this[prop];
584
- }
585
591
  return (_a = this.rewards) === null || _a === void 0 ? void 0 : _a.map((reward) => {
586
592
  var _a, _b;
587
593
  const state = getState(reward, this.taxConnection);
588
594
  const slBadgeType = getSLBadgeType(state);
589
- const badgeText = global.intl.formatMessage({
590
- id: "statusShortMessage",
591
- defaultMessage: getPropValue("statusText"),
592
- }, {
595
+ const badgeText = global.intl.formatMessage({ id: "statusShortMessage", defaultMessage: this.statusText }, {
593
596
  status: state,
594
597
  });
595
598
  console.log({
596
599
  state,
597
600
  intl: global.intl,
598
601
  badgeText,
599
- statusText: getPropValue("statusText"),
600
- statusText2: this.statusText,
602
+ statusText: this.statusText,
601
603
  reward,
602
- locale: this.locale,
603
- locale2: getPropValue("locale"),
604
604
  });
605
605
  const statusText = global.intl.formatMessage({
606
606
  id: "statusLongMessage",
607
- defaultMessage: getPropValue("statusLongText"),
607
+ defaultMessage: this.statusLongText,
608
608
  }, {
609
609
  status: state,
610
610
  });
611
- return (index.h("sl-details", { class: sheet.classes.Details, disabled: getPropValue("hideDetails") }, index.h("style", { type: "text/css" }, styleString), index.h("div", { slot: "summary", class: sheet.classes.DetailsContainer }, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, index.h("span", { part: "sqm-cell-value", class: sheet.classes.BoldText }, reward.prettyValue)), index.h("div", { class: sheet.classes.BadgeContainer }, state === "PENDING" && reward.dateScheduledFor ? (index.h("sl-badge", { class: slBadgeType === "primary"
611
+ return (index.h("sl-details", { class: sheet.classes.Details, disabled: this.hideDetails }, index.h("style", { type: "text/css" }, styleString), index.h("div", { slot: "summary", class: sheet.classes.DetailsContainer }, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, index.h("span", { part: "sqm-cell-value", class: sheet.classes.BoldText }, reward.prettyValue)), index.h("div", { class: sheet.classes.BadgeContainer }, state === "PENDING" && reward.dateScheduledFor ? (index.h("sl-badge", { class: slBadgeType === "primary"
612
612
  ? sheet.classes.RedeemBadge
613
613
  : sheet.classes.StatusBadge, type: slBadgeType, pill: true }, global.intl.formatMessage({
614
614
  id: "pendingForText",
615
- defaultMessage: getPropValue("pendingForText"),
615
+ defaultMessage: this.pendingForText,
616
616
  }, {
617
617
  status: badgeText,
618
618
  date: getTimeDiff(reward.dateScheduledFor),
@@ -620,23 +620,21 @@ const ReferralTableRewardsCell = class {
620
620
  ? sheet.classes.RedeemBadge
621
621
  : sheet.classes.StatusBadge, type: slBadgeType, pill: true }, badgeText)), reward.dateExpires && state === "AVAILABLE" && (index.h("sl-badge", { class: slBadgeType === "primary"
622
622
  ? sheet.classes.RedeemBadge
623
- : sheet.classes.StatusBadge, type: "info", pill: true }, getPropValue("expiringText"), ` ${getTimeDiff(reward.dateExpires)}`)))), index.h("div", null, state === "PENDING_REVIEW" && ((_a = reward.referral) === null || _a === void 0 ? void 0 : _a.dateModerated) && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText, " ", index.h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.luxon.DateTime.fromMillis(reward.referral.dateModerated)
624
- .setLocale(utils.luxonLocale(getPropValue("locale")))
623
+ : sheet.classes.StatusBadge, type: "info", pill: true }, this.expiringText, ` ${getTimeDiff(reward.dateExpires)}`)))), index.h("div", null, state === "PENDING_REVIEW" && ((_a = reward.referral) === null || _a === void 0 ? void 0 : _a.dateModerated) && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText, " ", index.h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.luxon.DateTime.fromMillis(reward.referral.dateModerated)
624
+ .setLocale(utils.luxonLocale(this.locale))
625
625
  .toLocaleString(luxon.luxon.DateTime.DATE_MED))))), state === "PAYOUT_APPROVED" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "PAYOUT_FAILED" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "PAYOUT_CANCELLED" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "PENDING_TAX_REVIEW" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "PENDING_NEW_TAX_FORM" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "PENDING_TAX_SUBMISSION" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "PENDING_PARTNER_CREATION" && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText))), state === "DENIED" && ((_b = reward.referral) === null || _b === void 0 ? void 0 : _b.dateModerated) && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText, " ", index.h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.luxon.DateTime.fromMillis(reward.referral.dateModerated)
626
- .setLocale(utils.luxonLocale(getPropValue("locale")))
627
- .toLocaleString(luxon.luxon.DateTime.DATE_MED)), ".", getPropValue("deniedHelpText")
628
- ? ` ${getPropValue("deniedHelpText")}`
629
- : ``))), reward.dateGiven && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, getPropValue("rewardReceivedText"), " ", index.h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.luxon.DateTime.fromMillis(reward.dateGiven)
630
- .setLocale(utils.luxonLocale(getPropValue("locale")))
626
+ .setLocale(utils.luxonLocale(this.locale))
627
+ .toLocaleString(luxon.luxon.DateTime.DATE_MED)), ".", this.deniedHelpText ? ` ${this.deniedHelpText}` : ``))), reward.dateGiven && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, this.rewardReceivedText, " ", index.h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.luxon.DateTime.fromMillis(reward.dateGiven)
628
+ .setLocale(utils.luxonLocale(this.locale))
631
629
  .toLocaleString(luxon.luxon.DateTime.DATE_MED))))), state === "EXPIRED" && reward.dateExpires && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText, " ", index.h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.luxon.DateTime.fromMillis(reward.dateExpires)
632
- .setLocale(utils.luxonLocale(getPropValue("locale")))
630
+ .setLocale(utils.luxonLocale(this.locale))
633
631
  .toLocaleString(luxon.luxon.DateTime.DATE_MED))))), state === "CANCELLED" && reward.dateCancelled && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText, " ", index.h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.luxon.DateTime.fromMillis(reward.dateCancelled)
634
- .setLocale(utils.luxonLocale(getPropValue("locale")))
632
+ .setLocale(utils.luxonLocale(this.locale))
635
633
  .toLocaleString(luxon.luxon.DateTime.DATE_MED))))), state === "PENDING" && reward.dateScheduledFor && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText, " ", index.h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.luxon.DateTime.fromMillis(reward.dateScheduledFor)
636
- .setLocale(utils.luxonLocale(getPropValue("locale")))
634
+ .setLocale(utils.luxonLocale(this.locale))
637
635
  .toLocaleString(luxon.luxon.DateTime.DATE_MED))))), " ", state === "AVAILABLE" && reward.dateExpires && (index.h("div", null, index.h(sqmTextSpanView.TextSpanView, { type: "p" }, statusText, " ", index.h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.luxon.DateTime.fromMillis(reward.dateExpires)
638
- .setLocale(utils.luxonLocale(getPropValue("locale")))
639
- .toLocaleString(luxon.luxon.DateTime.DATE_MED))))), reward.fuelTankCode && (index.h("div", null, getPropValue("fuelTankText"), " ", index.h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, reward.fuelTankCode))))));
636
+ .setLocale(utils.luxonLocale(this.locale))
637
+ .toLocaleString(luxon.luxon.DateTime.DATE_MED))))), reward.fuelTankCode && (index.h("div", null, this.fuelTankText, " ", index.h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, reward.fuelTankCode))))));
640
638
  });
641
639
  }
642
640
  };
@@ -1,15 +1,25 @@
1
1
  import { Component, h, Prop } from "@stencil/core";
2
2
  import { DateTime } from "luxon";
3
- import { TextSpanView } from "../../sqm-text-span/sqm-text-span-view";
4
- import { createStyleSheet } from "../../../styling/JSS";
5
3
  import { intl } from "../../../global/global";
4
+ import { createStyleSheet } from "../../../styling/JSS";
5
+ import { useRequestRerender } from "../../../tables/re-render";
6
6
  import { luxonLocale } from "../../../utils/utils";
7
+ import { TextSpanView } from "../../sqm-text-span/sqm-text-span-view";
7
8
  export class ReferralTableRewardsCell {
8
9
  constructor() {
9
10
  this.locale = "en";
10
11
  }
11
12
  render() {
12
13
  var _a;
14
+ useRequestRerender([
15
+ this.statusText,
16
+ this.statusLongText,
17
+ this.fuelTankText,
18
+ this.rewardReceivedText,
19
+ this.expiringText,
20
+ this.pendingForText,
21
+ this.hideDetails,
22
+ ]);
13
23
  intl.locale = this.locale;
14
24
  const style = {
15
25
  "@keyframes slideRight": {
@@ -158,36 +168,27 @@ export class ReferralTableRewardsCell {
158
168
  .replace("in", "")
159
169
  .trim();
160
170
  };
161
- function getPropValue(prop) {
162
- return this[prop];
163
- }
164
171
  return (_a = this.rewards) === null || _a === void 0 ? void 0 : _a.map((reward) => {
165
172
  var _a, _b;
166
173
  const state = getState(reward, this.taxConnection);
167
174
  const slBadgeType = getSLBadgeType(state);
168
- const badgeText = intl.formatMessage({
169
- id: "statusShortMessage",
170
- defaultMessage: getPropValue("statusText"),
171
- }, {
175
+ const badgeText = intl.formatMessage({ id: "statusShortMessage", defaultMessage: this.statusText }, {
172
176
  status: state,
173
177
  });
174
178
  console.log({
175
179
  state,
176
180
  intl,
177
181
  badgeText,
178
- statusText: getPropValue("statusText"),
179
- statusText2: this.statusText,
182
+ statusText: this.statusText,
180
183
  reward,
181
- locale: this.locale,
182
- locale2: getPropValue("locale"),
183
184
  });
184
185
  const statusText = intl.formatMessage({
185
186
  id: "statusLongMessage",
186
- defaultMessage: getPropValue("statusLongText"),
187
+ defaultMessage: this.statusLongText,
187
188
  }, {
188
189
  status: state,
189
190
  });
190
- return (h("sl-details", { class: sheet.classes.Details, disabled: getPropValue("hideDetails") },
191
+ return (h("sl-details", { class: sheet.classes.Details, disabled: this.hideDetails },
191
192
  h("style", { type: "text/css" }, styleString),
192
193
  h("div", { slot: "summary", class: sheet.classes.DetailsContainer },
193
194
  h(TextSpanView, { type: "p" },
@@ -197,7 +198,7 @@ export class ReferralTableRewardsCell {
197
198
  ? sheet.classes.RedeemBadge
198
199
  : sheet.classes.StatusBadge, type: slBadgeType, pill: true }, intl.formatMessage({
199
200
  id: "pendingForText",
200
- defaultMessage: getPropValue("pendingForText"),
201
+ defaultMessage: this.pendingForText,
201
202
  }, {
202
203
  status: badgeText,
203
204
  date: getTimeDiff(reward.dateScheduledFor),
@@ -207,7 +208,7 @@ export class ReferralTableRewardsCell {
207
208
  reward.dateExpires && state === "AVAILABLE" && (h("sl-badge", { class: slBadgeType === "primary"
208
209
  ? sheet.classes.RedeemBadge
209
210
  : sheet.classes.StatusBadge, type: "info", pill: true },
210
- getPropValue("expiringText"),
211
+ this.expiringText,
211
212
  ` ${getTimeDiff(reward.dateExpires)}`)))),
212
213
  h("div", null,
213
214
  state === "PENDING_REVIEW" && ((_a = reward.referral) === null || _a === void 0 ? void 0 : _a.dateModerated) && (h("div", null,
@@ -215,7 +216,7 @@ export class ReferralTableRewardsCell {
215
216
  statusText,
216
217
  " ",
217
218
  h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, DateTime.fromMillis(reward.referral.dateModerated)
218
- .setLocale(luxonLocale(getPropValue("locale")))
219
+ .setLocale(luxonLocale(this.locale))
219
220
  .toLocaleString(DateTime.DATE_MED))))),
220
221
  state === "PAYOUT_APPROVED" && (h("div", null,
221
222
  h(TextSpanView, { type: "p" }, statusText))),
@@ -236,39 +237,37 @@ export class ReferralTableRewardsCell {
236
237
  statusText,
237
238
  " ",
238
239
  h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, DateTime.fromMillis(reward.referral.dateModerated)
239
- .setLocale(luxonLocale(getPropValue("locale")))
240
+ .setLocale(luxonLocale(this.locale))
240
241
  .toLocaleString(DateTime.DATE_MED)),
241
242
  ".",
242
- getPropValue("deniedHelpText")
243
- ? ` ${getPropValue("deniedHelpText")}`
244
- : ``))),
243
+ this.deniedHelpText ? ` ${this.deniedHelpText}` : ``))),
245
244
  reward.dateGiven && (h("div", null,
246
245
  h(TextSpanView, { type: "p" },
247
- getPropValue("rewardReceivedText"),
246
+ this.rewardReceivedText,
248
247
  " ",
249
248
  h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, DateTime.fromMillis(reward.dateGiven)
250
- .setLocale(luxonLocale(getPropValue("locale")))
249
+ .setLocale(luxonLocale(this.locale))
251
250
  .toLocaleString(DateTime.DATE_MED))))),
252
251
  state === "EXPIRED" && reward.dateExpires && (h("div", null,
253
252
  h(TextSpanView, { type: "p" },
254
253
  statusText,
255
254
  " ",
256
255
  h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, DateTime.fromMillis(reward.dateExpires)
257
- .setLocale(luxonLocale(getPropValue("locale")))
256
+ .setLocale(luxonLocale(this.locale))
258
257
  .toLocaleString(DateTime.DATE_MED))))),
259
258
  state === "CANCELLED" && reward.dateCancelled && (h("div", null,
260
259
  h(TextSpanView, { type: "p" },
261
260
  statusText,
262
261
  " ",
263
262
  h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, DateTime.fromMillis(reward.dateCancelled)
264
- .setLocale(luxonLocale(getPropValue("locale")))
263
+ .setLocale(luxonLocale(this.locale))
265
264
  .toLocaleString(DateTime.DATE_MED))))),
266
265
  state === "PENDING" && reward.dateScheduledFor && (h("div", null,
267
266
  h(TextSpanView, { type: "p" },
268
267
  statusText,
269
268
  " ",
270
269
  h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, DateTime.fromMillis(reward.dateScheduledFor)
271
- .setLocale(luxonLocale(getPropValue("locale")))
270
+ .setLocale(luxonLocale(this.locale))
272
271
  .toLocaleString(DateTime.DATE_MED))))),
273
272
  " ",
274
273
  state === "AVAILABLE" && reward.dateExpires && (h("div", null,
@@ -276,10 +275,10 @@ export class ReferralTableRewardsCell {
276
275
  statusText,
277
276
  " ",
278
277
  h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, DateTime.fromMillis(reward.dateExpires)
279
- .setLocale(luxonLocale(getPropValue("locale")))
278
+ .setLocale(luxonLocale(this.locale))
280
279
  .toLocaleString(DateTime.DATE_MED))))),
281
280
  reward.fuelTankCode && (h("div", null,
282
- getPropValue("fuelTankText"),
281
+ this.fuelTankText,
283
282
  " ",
284
283
  h("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, reward.fuelTankCode))))));
285
284
  });
@@ -427,6 +427,15 @@ const ReferralTableRewardsCell = class {
427
427
  }
428
428
  render() {
429
429
  var _a;
430
+ useRequestRerender([
431
+ this.statusText,
432
+ this.statusLongText,
433
+ this.fuelTankText,
434
+ this.rewardReceivedText,
435
+ this.expiringText,
436
+ this.pendingForText,
437
+ this.hideDetails,
438
+ ]);
430
439
  intl.locale = this.locale;
431
440
  const style = {
432
441
  "@keyframes slideRight": {
@@ -575,40 +584,31 @@ const ReferralTableRewardsCell = class {
575
584
  .replace("in", "")
576
585
  .trim();
577
586
  };
578
- function getPropValue(prop) {
579
- return this[prop];
580
- }
581
587
  return (_a = this.rewards) === null || _a === void 0 ? void 0 : _a.map((reward) => {
582
588
  var _a, _b;
583
589
  const state = getState(reward, this.taxConnection);
584
590
  const slBadgeType = getSLBadgeType(state);
585
- const badgeText = intl.formatMessage({
586
- id: "statusShortMessage",
587
- defaultMessage: getPropValue("statusText"),
588
- }, {
591
+ const badgeText = intl.formatMessage({ id: "statusShortMessage", defaultMessage: this.statusText }, {
589
592
  status: state,
590
593
  });
591
594
  console.log({
592
595
  state,
593
596
  intl,
594
597
  badgeText,
595
- statusText: getPropValue("statusText"),
596
- statusText2: this.statusText,
598
+ statusText: this.statusText,
597
599
  reward,
598
- locale: this.locale,
599
- locale2: getPropValue("locale"),
600
600
  });
601
601
  const statusText = intl.formatMessage({
602
602
  id: "statusLongMessage",
603
- defaultMessage: getPropValue("statusLongText"),
603
+ defaultMessage: this.statusLongText,
604
604
  }, {
605
605
  status: state,
606
606
  });
607
- return (h$1("sl-details", { class: sheet.classes.Details, disabled: getPropValue("hideDetails") }, h$1("style", { type: "text/css" }, styleString), h$1("div", { slot: "summary", class: sheet.classes.DetailsContainer }, h$1(TextSpanView, { type: "p" }, h$1("span", { part: "sqm-cell-value", class: sheet.classes.BoldText }, reward.prettyValue)), h$1("div", { class: sheet.classes.BadgeContainer }, state === "PENDING" && reward.dateScheduledFor ? (h$1("sl-badge", { class: slBadgeType === "primary"
607
+ return (h$1("sl-details", { class: sheet.classes.Details, disabled: this.hideDetails }, h$1("style", { type: "text/css" }, styleString), h$1("div", { slot: "summary", class: sheet.classes.DetailsContainer }, h$1(TextSpanView, { type: "p" }, h$1("span", { part: "sqm-cell-value", class: sheet.classes.BoldText }, reward.prettyValue)), h$1("div", { class: sheet.classes.BadgeContainer }, state === "PENDING" && reward.dateScheduledFor ? (h$1("sl-badge", { class: slBadgeType === "primary"
608
608
  ? sheet.classes.RedeemBadge
609
609
  : sheet.classes.StatusBadge, type: slBadgeType, pill: true }, intl.formatMessage({
610
610
  id: "pendingForText",
611
- defaultMessage: getPropValue("pendingForText"),
611
+ defaultMessage: this.pendingForText,
612
612
  }, {
613
613
  status: badgeText,
614
614
  date: getTimeDiff(reward.dateScheduledFor),
@@ -616,23 +616,21 @@ const ReferralTableRewardsCell = class {
616
616
  ? sheet.classes.RedeemBadge
617
617
  : sheet.classes.StatusBadge, type: slBadgeType, pill: true }, badgeText)), reward.dateExpires && state === "AVAILABLE" && (h$1("sl-badge", { class: slBadgeType === "primary"
618
618
  ? sheet.classes.RedeemBadge
619
- : sheet.classes.StatusBadge, type: "info", pill: true }, getPropValue("expiringText"), ` ${getTimeDiff(reward.dateExpires)}`)))), h$1("div", null, state === "PENDING_REVIEW" && ((_a = reward.referral) === null || _a === void 0 ? void 0 : _a.dateModerated) && (h$1("div", null, h$1(TextSpanView, { type: "p" }, statusText, " ", h$1("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.DateTime.fromMillis(reward.referral.dateModerated)
620
- .setLocale(luxonLocale(getPropValue("locale")))
619
+ : sheet.classes.StatusBadge, type: "info", pill: true }, this.expiringText, ` ${getTimeDiff(reward.dateExpires)}`)))), h$1("div", null, state === "PENDING_REVIEW" && ((_a = reward.referral) === null || _a === void 0 ? void 0 : _a.dateModerated) && (h$1("div", null, h$1(TextSpanView, { type: "p" }, statusText, " ", h$1("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.DateTime.fromMillis(reward.referral.dateModerated)
620
+ .setLocale(luxonLocale(this.locale))
621
621
  .toLocaleString(luxon.DateTime.DATE_MED))))), state === "PAYOUT_APPROVED" && (h$1("div", null, h$1(TextSpanView, { type: "p" }, statusText))), state === "PAYOUT_FAILED" && (h$1("div", null, h$1(TextSpanView, { type: "p" }, statusText))), state === "PAYOUT_CANCELLED" && (h$1("div", null, h$1(TextSpanView, { type: "p" }, statusText))), state === "PENDING_TAX_REVIEW" && (h$1("div", null, h$1(TextSpanView, { type: "p" }, statusText))), state === "PENDING_NEW_TAX_FORM" && (h$1("div", null, h$1(TextSpanView, { type: "p" }, statusText))), state === "PENDING_TAX_SUBMISSION" && (h$1("div", null, h$1(TextSpanView, { type: "p" }, statusText))), state === "PENDING_PARTNER_CREATION" && (h$1("div", null, h$1(TextSpanView, { type: "p" }, statusText))), state === "DENIED" && ((_b = reward.referral) === null || _b === void 0 ? void 0 : _b.dateModerated) && (h$1("div", null, h$1(TextSpanView, { type: "p" }, statusText, " ", h$1("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.DateTime.fromMillis(reward.referral.dateModerated)
622
- .setLocale(luxonLocale(getPropValue("locale")))
623
- .toLocaleString(luxon.DateTime.DATE_MED)), ".", getPropValue("deniedHelpText")
624
- ? ` ${getPropValue("deniedHelpText")}`
625
- : ``))), reward.dateGiven && (h$1("div", null, h$1(TextSpanView, { type: "p" }, getPropValue("rewardReceivedText"), " ", h$1("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.DateTime.fromMillis(reward.dateGiven)
626
- .setLocale(luxonLocale(getPropValue("locale")))
622
+ .setLocale(luxonLocale(this.locale))
623
+ .toLocaleString(luxon.DateTime.DATE_MED)), ".", this.deniedHelpText ? ` ${this.deniedHelpText}` : ``))), reward.dateGiven && (h$1("div", null, h$1(TextSpanView, { type: "p" }, this.rewardReceivedText, " ", h$1("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.DateTime.fromMillis(reward.dateGiven)
624
+ .setLocale(luxonLocale(this.locale))
627
625
  .toLocaleString(luxon.DateTime.DATE_MED))))), state === "EXPIRED" && reward.dateExpires && (h$1("div", null, h$1(TextSpanView, { type: "p" }, statusText, " ", h$1("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.DateTime.fromMillis(reward.dateExpires)
628
- .setLocale(luxonLocale(getPropValue("locale")))
626
+ .setLocale(luxonLocale(this.locale))
629
627
  .toLocaleString(luxon.DateTime.DATE_MED))))), state === "CANCELLED" && reward.dateCancelled && (h$1("div", null, h$1(TextSpanView, { type: "p" }, statusText, " ", h$1("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.DateTime.fromMillis(reward.dateCancelled)
630
- .setLocale(luxonLocale(getPropValue("locale")))
628
+ .setLocale(luxonLocale(this.locale))
631
629
  .toLocaleString(luxon.DateTime.DATE_MED))))), state === "PENDING" && reward.dateScheduledFor && (h$1("div", null, h$1(TextSpanView, { type: "p" }, statusText, " ", h$1("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.DateTime.fromMillis(reward.dateScheduledFor)
632
- .setLocale(luxonLocale(getPropValue("locale")))
630
+ .setLocale(luxonLocale(this.locale))
633
631
  .toLocaleString(luxon.DateTime.DATE_MED))))), " ", state === "AVAILABLE" && reward.dateExpires && (h$1("div", null, h$1(TextSpanView, { type: "p" }, statusText, " ", h$1("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, luxon.DateTime.fromMillis(reward.dateExpires)
634
- .setLocale(luxonLocale(getPropValue("locale")))
635
- .toLocaleString(luxon.DateTime.DATE_MED))))), reward.fuelTankCode && (h$1("div", null, getPropValue("fuelTankText"), " ", h$1("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, reward.fuelTankCode))))));
632
+ .setLocale(luxonLocale(this.locale))
633
+ .toLocaleString(luxon.DateTime.DATE_MED))))), reward.fuelTankCode && (h$1("div", null, this.fuelTankText, " ", h$1("span", { class: sheet.classes.BoldText, part: "sqm-cell-value" }, reward.fuelTankCode))))));
636
634
  });
637
635
  }
638
636
  };
@@ -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,l){function i(e){try{o(a.next(e))}catch(e){l(e)}}function s(e){try{o(a["throw"](e))}catch(e){l(e)}}function o(e){e.done?r(e.value):n(e.value).then(i,s)}o((a=a.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},a,n,l,i;return i={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(e){return function(t){return o([e,t])}}function o(i){if(a)throw new TypeError("Generator is already executing.");while(r)try{if(a=1,n&&(l=i[0]&2?n["return"]:i[0]?n["throw"]||((l=n["return"])&&l.call(n),0):n.next)&&!(l=l.call(n,i[1])).done)return l;if(n=0,l)i=[i[0]&2,l.value];switch(i[0]){case 0:case 1:l=i;break;case 4:r.label++;return{value:i[1],done:false};case 5:r.label++;n=i[1];i=[0];continue;case 7:i=r.ops.pop();r.trys.pop();continue;default:if(!(l=r.trys,l=l.length>0&&l[l.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!l||i[1]>l[0]&&i[1]<l[3])){r.label=i[1];break}if(i[0]===6&&r.label<l[1]){r.label=l[1];l=i;break}if(l&&r.label<l[2]){r.label=l[2];r.ops.push(i);break}if(l[2])r.ops.pop();r.trys.pop();continue}i=t.call(e,r)}catch(e){i=[6,e];n=0}finally{a=l=0}if(i[0]&5)throw i[1];return{value:i[0]?i[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 l=arguments[t],i=0,s=l.length;i<s;i++,n++)a[n]=l[i];return a};import{r as registerInstance,h as h$1,g as getElement,c as Host}from"./index-17b4da69.js";import{n as h,j as useReducer,u as useMemo,f as useEffect}from"./stencil-hooks.module-ac12ca1c.js";import{i as intl}from"./global-04c7d3b5.js";import{i as isDemo}from"./index.module-def4aec5.js";import{c as cjs}from"./cjs-bdfb4486.js";import"./mixins-f60a614c.js";import{c as createStyleSheet}from"./JSS-67b5cff8.js";import{G as GenericTableView}from"./GenericTableView-d59d8ab4.js";import{a as useRequestRerender,u as useRerenderListener}from"./re-render-12fd274a.js";import{u as useChildElements}from"./useChildElements-32e1bda1.js";import{l as luxon}from"./luxon-7600be8d.js";import{g as getPaypalMeta}from"./mockRewardData-0eb6e778.js";import{u as useReferralTable,t as tryMethod}from"./useReferralTable-f4de0650.js";import{l as luxonLocale}from"./utils-334c1e34.js";import{T as TextSpanView}from"./sqm-text-span-view-8d140661.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,l=r.callbacks,i=r.elements;useRequestRerender([this.showReferrer,this.perPage]);return h$1(GenericTableView,{states:a,data:n,callbacks:l,elements:i})};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],l=a[1];var i=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,i,o,u,d,c,f,h,p,v,m,T;var _=this;return __generator(this,(function(E){switch(E.label){case 0:n=s===null||s===void 0?void 0:s.referredByReferral;i=e.showReferrer&&!!((r=s===null||s===void 0?void 0:s.referredByReferral)===null||r===void 0?void 0:r.dateReferralStarted);if(i){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(l){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(!i)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=E.sent();E.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([E.sent()])).filter((function(e){return e}));E.label=4;case 4:h=p;l({rows:h});T=u;if(!T)return[3,6];return[4,Promise.all(u)];case 5:T=E.sent();E.label=6;case 6:m=T;l({columns:m,loading:false,page:0});return[2]}}))}))}useEffect((function(){l({loading:true});(s===null||s===void 0?void 0:s.data)&&u(o)}),[s===null||s===void 0?void 0:s.data,o,i]);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.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 l=function(e,t){var r,a,n,l,i,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(((l=(n=e.referral)===null||n===void 0?void 0:n.fraudData)===null||l===void 0?void 0:l.moderationStatus)==="PENDING")return"PENDING_REVIEW";if(((s=(i=e.referral)===null||i===void 0?void 0:i.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 i=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()};function o(e){return this[e]}return(t=this.rewards)===null||t===void 0?void 0:t.map((function(t){var r,u;var d=l(t,e.taxConnection);var c=i(d);var f=intl.formatMessage({id:"statusShortMessage",defaultMessage:o("statusText")},{status:d});console.log({state:d,intl:intl,badgeText:f,statusText:o("statusText"),statusText2:e.statusText,reward:t,locale:e.locale,locale2:o("locale")});var h=intl.formatMessage({id:"statusLongMessage",defaultMessage:o("statusLongText")},{status:d});return h$1("sl-details",{class:a.classes.Details,disabled:o("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},d==="PENDING"&&t.dateScheduledFor?h$1("sl-badge",{class:c==="primary"?a.classes.RedeemBadge:a.classes.StatusBadge,type:c,pill:true},intl.formatMessage({id:"pendingForText",defaultMessage:o("pendingForText")},{status:f,date:s(t.dateScheduledFor)})):h$1("sl-badge",{class:c==="primary"?a.classes.RedeemBadge:a.classes.StatusBadge,type:c,pill:true},f),t.dateExpires&&d==="AVAILABLE"&&h$1("sl-badge",{class:c==="primary"?a.classes.RedeemBadge:a.classes.StatusBadge,type:"info",pill:true},o("expiringText")," "+s(t.dateExpires)))),h$1("div",null,d==="PENDING_REVIEW"&&((r=t.referral)===null||r===void 0?void 0:r.dateModerated)&&h$1("div",null,h$1(TextSpanView,{type:"p"},h," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},luxon.DateTime.fromMillis(t.referral.dateModerated).setLocale(luxonLocale(o("locale"))).toLocaleString(luxon.DateTime.DATE_MED)))),d==="PAYOUT_APPROVED"&&h$1("div",null,h$1(TextSpanView,{type:"p"},h)),d==="PAYOUT_FAILED"&&h$1("div",null,h$1(TextSpanView,{type:"p"},h)),d==="PAYOUT_CANCELLED"&&h$1("div",null,h$1(TextSpanView,{type:"p"},h)),d==="PENDING_TAX_REVIEW"&&h$1("div",null,h$1(TextSpanView,{type:"p"},h)),d==="PENDING_NEW_TAX_FORM"&&h$1("div",null,h$1(TextSpanView,{type:"p"},h)),d==="PENDING_TAX_SUBMISSION"&&h$1("div",null,h$1(TextSpanView,{type:"p"},h)),d==="PENDING_PARTNER_CREATION"&&h$1("div",null,h$1(TextSpanView,{type:"p"},h)),d==="DENIED"&&((u=t.referral)===null||u===void 0?void 0:u.dateModerated)&&h$1("div",null,h$1(TextSpanView,{type:"p"},h," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},luxon.DateTime.fromMillis(t.referral.dateModerated).setLocale(luxonLocale(o("locale"))).toLocaleString(luxon.DateTime.DATE_MED)),".",o("deniedHelpText")?" "+o("deniedHelpText"):"")),t.dateGiven&&h$1("div",null,h$1(TextSpanView,{type:"p"},o("rewardReceivedText")," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},luxon.DateTime.fromMillis(t.dateGiven).setLocale(luxonLocale(o("locale"))).toLocaleString(luxon.DateTime.DATE_MED)))),d==="EXPIRED"&&t.dateExpires&&h$1("div",null,h$1(TextSpanView,{type:"p"},h," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},luxon.DateTime.fromMillis(t.dateExpires).setLocale(luxonLocale(o("locale"))).toLocaleString(luxon.DateTime.DATE_MED)))),d==="CANCELLED"&&t.dateCancelled&&h$1("div",null,h$1(TextSpanView,{type:"p"},h," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},luxon.DateTime.fromMillis(t.dateCancelled).setLocale(luxonLocale(o("locale"))).toLocaleString(luxon.DateTime.DATE_MED)))),d==="PENDING"&&t.dateScheduledFor&&h$1("div",null,h$1(TextSpanView,{type:"p"},h," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},luxon.DateTime.fromMillis(t.dateScheduledFor).setLocale(luxonLocale(o("locale"))).toLocaleString(luxon.DateTime.DATE_MED))))," ",d==="AVAILABLE"&&t.dateExpires&&h$1("div",null,h$1(TextSpanView,{type:"p"},h," ",h$1("span",{class:a.classes.BoldText,part:"sqm-cell-value"},luxon.DateTime.fromMillis(t.dateExpires).setLocale(luxonLocale(o("locale"))).toLocaleString(luxon.DateTime.DATE_MED)))),t.fuelTankCode&&h$1("div",null,o("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){console.log({statusText:this.statusText});return[2,h$1("sqm-referral-table-rewards-cell",{rewards:e.rewards,"tax-connection":t===null||t===void 0?void 0:t.taxConnection,"status-text":this.statusText,"status-long-text":this.statusLongText,"fuel-tank-text":this.fuelTankText,"reward-received-text":this.rewardReceivedText,"expiring-text":this.expiringText,"pending-for-text":this.pendingForText,"hide-details":this.hideDetails,"denied-help-text":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(l){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,l,i,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=((l=e===null||e===void 0?void 0:e.referrerUser)===null||l===void 0?void 0:l.firstName)+" "+((i=e===null||e===void 0?void 0:e.referrerUser)===null||i===void 0?void 0:i.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,l;return __generator(this,(function(i){if(!e){l=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)){l=this.anonymousUser}else{l=((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:l})]}))}))};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,l){function i(e){try{o(a.next(e))}catch(e){l(e)}}function s(e){try{o(a["throw"](e))}catch(e){l(e)}}function o(e){e.done?r(e.value):n(e.value).then(i,s)}o((a=a.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},a,n,l,i;return i={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(e){return function(t){return o([e,t])}}function o(i){if(a)throw new TypeError("Generator is already executing.");while(r)try{if(a=1,n&&(l=i[0]&2?n["return"]:i[0]?n["throw"]||((l=n["return"])&&l.call(n),0):n.next)&&!(l=l.call(n,i[1])).done)return l;if(n=0,l)i=[i[0]&2,l.value];switch(i[0]){case 0:case 1:l=i;break;case 4:r.label++;return{value:i[1],done:false};case 5:r.label++;n=i[1];i=[0];continue;case 7:i=r.ops.pop();r.trys.pop();continue;default:if(!(l=r.trys,l=l.length>0&&l[l.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!l||i[1]>l[0]&&i[1]<l[3])){r.label=i[1];break}if(i[0]===6&&r.label<l[1]){r.label=l[1];l=i;break}if(l&&r.label<l[2]){r.label=l[2];r.ops.push(i);break}if(l[2])r.ops.pop();r.trys.pop();continue}i=t.call(e,r)}catch(e){i=[6,e];n=0}finally{a=l=0}if(i[0]&5)throw i[1];return{value:i[0]?i[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 l=arguments[t],i=0,s=l.length;i<s;i++,n++)a[n]=l[i];return a};import{r as registerInstance,h as h$1,g as getElement,c as Host}from"./index-17b4da69.js";import{n as h,j as useReducer,u as useMemo,f as useEffect}from"./stencil-hooks.module-ac12ca1c.js";import{i as intl}from"./global-04c7d3b5.js";import{i as isDemo}from"./index.module-def4aec5.js";import{c as cjs}from"./cjs-bdfb4486.js";import"./mixins-f60a614c.js";import{c as createStyleSheet}from"./JSS-67b5cff8.js";import{G as GenericTableView}from"./GenericTableView-d59d8ab4.js";import{a as useRequestRerender,u as useRerenderListener}from"./re-render-12fd274a.js";import{u as useChildElements}from"./useChildElements-32e1bda1.js";import{l as luxon}from"./luxon-7600be8d.js";import{g as getPaypalMeta}from"./mockRewardData-0eb6e778.js";import{u as useReferralTable,t as tryMethod}from"./useReferralTable-f4de0650.js";import{l as luxonLocale}from"./utils-334c1e34.js";import{T as TextSpanView}from"./sqm-text-span-view-8d140661.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,l=r.callbacks,i=r.elements;useRequestRerender([this.showReferrer,this.perPage]);return h$1(GenericTableView,{states:a,data:n,callbacks:l,elements:i})};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],l=a[1];var i=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,i,o,u,d,c,f,h,p,v,m,T;var _=this;return __generator(this,(function(E){switch(E.label){case 0:n=s===null||s===void 0?void 0:s.referredByReferral;i=e.showReferrer&&!!((r=s===null||s===void 0?void 0:s.referredByReferral)===null||r===void 0?void 0:r.dateReferralStarted);if(i){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(l){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(!i)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=E.sent();E.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([E.sent()])).filter((function(e){return e}));E.label=4;case 4:h=p;l({rows:h});T=u;if(!T)return[3,6];return[4,Promise.all(u)];case 5:T=E.sent();E.label=6;case 6:m=T;l({columns:m,loading:false,page:0});return[2]}}))}))}useEffect((function(){l({loading:true});(s===null||s===void 0?void 0:s.data)&&u(o)}),[s===null||s===void 0?void 0:s.data,o,i]);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.locale="en"}e.prototype.render=function(){var e=this;var t;useRequestRerender([this.statusText,this.statusLongText,this.fuelTankText,this.rewardReceivedText,this.expiringText,this.pendingForText,this.hideDetails]);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 l=function(e,t){var r,a,n,l,i,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(((l=(n=e.referral)===null||n===void 0?void 0:n.fraudData)===null||l===void 0?void 0:l.moderationStatus)==="PENDING")return"PENDING_REVIEW";if(((s=(i=e.referral)===null||i===void 0?void 0:i.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 i=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=l(t,e.taxConnection);var d=i(u);var c=intl.formatMessage({id:"statusShortMessage",defaultMessage:e.statusText},{status:u});console.log({state:u,intl:intl,badgeText:c,statusText:e.statusText,reward:t});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){console.log({statusText:this.statusText});return[2,h$1("sqm-referral-table-rewards-cell",{rewards:e.rewards,"tax-connection":t===null||t===void 0?void 0:t.taxConnection,"status-text":this.statusText,"status-long-text":this.statusLongText,"fuel-tank-text":this.fuelTankText,"reward-received-text":this.rewardReceivedText,"expiring-text":this.expiringText,"pending-for-text":this.pendingForText,"hide-details":this.hideDetails,"denied-help-text":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(l){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,l,i,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=((l=e===null||e===void 0?void 0:e.referrerUser)===null||l===void 0?void 0:l.firstName)+" "+((i=e===null||e===void 0?void 0:e.referrerUser)===null||i===void 0?void 0:i.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,l;return __generator(this,(function(i){if(!e){l=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)){l=this.anonymousUser}else{l=((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:l})]}))}))};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};