@saasquatch/mint-components 1.8.0-21 → 1.8.0-23
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/{ShadowViewAddon-3cb21a64.js → ShadowViewAddon-a9ce6b87.js} +0 -399
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/{sqm-big-stat_42.cjs.entry.js → sqm-big-stat_37.cjs.entry.js} +139 -2055
- package/dist/cjs/{sqm-context-router.cjs.entry.js → sqm-context-router_3.cjs.entry.js} +28 -0
- package/dist/cjs/sqm-document-type-form_5.cjs.entry.js +1931 -0
- package/dist/cjs/{sqm-tax-and-cash.cjs.entry.js → sqm-docusign-embed_2.cjs.entry.js} +31 -20
- package/dist/cjs/{sqm-empty_5.cjs.entry.js → sqm-empty_4.cjs.entry.js} +0 -61
- package/dist/cjs/sqm-payout-details-card-fd7cfa76.js +404 -0
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +16 -15
- package/dist/cjs/sqm-tax-and-cash-monolith.cjs.entry.js +534 -0
- package/dist/cjs/sqm-text.cjs.entry.js +68 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/sqm-tax-and-cash-monolith/sqm-tax-and-cash-monolith.js +2515 -0
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.js +8 -7
- package/dist/esm/{ShadowViewAddon-3b0296b9.js → ShadowViewAddon-6b52e587.js} +1 -396
- package/dist/esm/data-e76577b2.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/{sqm-big-stat_42.entry.js → sqm-big-stat_37.entry.js} +141 -2052
- package/dist/esm/{sqm-context-router.entry.js → sqm-context-router_3.entry.js} +27 -1
- package/dist/esm/sqm-document-type-form_5.entry.js +1923 -0
- package/dist/esm/{sqm-tax-and-cash.entry.js → sqm-docusign-embed_2.entry.js} +32 -22
- package/dist/esm/{sqm-empty_5.entry.js → sqm-empty_4.entry.js} +1 -61
- package/dist/esm/sqm-payout-details-card-0b665414.js +399 -0
- package/dist/esm/sqm-stencilbook.entry.js +2 -1
- package/dist/esm/sqm-tax-and-cash-monolith.entry.js +530 -0
- package/dist/esm/sqm-text.entry.js +64 -0
- package/dist/esm-es5/{ShadowViewAddon-3b0296b9.js → ShadowViewAddon-6b52e587.js} +1 -1
- package/dist/esm-es5/data-e76577b2.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mint-components.js +1 -1
- package/dist/esm-es5/sqm-big-stat_37.entry.js +1 -0
- package/dist/esm-es5/{sqm-context-router.entry.js → sqm-context-router_3.entry.js} +1 -1
- package/dist/esm-es5/sqm-document-type-form_5.entry.js +1 -0
- package/dist/esm-es5/sqm-docusign-embed_2.entry.js +1 -0
- package/dist/esm-es5/sqm-empty_4.entry.js +1 -0
- package/dist/esm-es5/sqm-payout-details-card-0b665414.js +1 -0
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/esm-es5/sqm-tax-and-cash-monolith.entry.js +1 -0
- package/dist/esm-es5/sqm-text.entry.js +1 -0
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/p-10765e55.entry.js +1 -0
- package/dist/mint-components/{p-bd10ef26.entry.js → p-1e39faeb.entry.js} +2 -2
- package/dist/mint-components/p-3271c52d.system.entry.js +1 -0
- package/dist/mint-components/p-3a66e34f.entry.js +1 -0
- package/dist/mint-components/p-3d3c5d60.js +1 -1
- package/dist/mint-components/p-43681c0a.system.entry.js +1 -0
- package/dist/mint-components/p-5bb9d7af.system.entry.js +1 -0
- package/dist/mint-components/p-5d7ac8fb.system.js +1 -1
- package/dist/mint-components/p-5db3bfeb.entry.js +1 -0
- package/dist/mint-components/p-6b34e90f.system.js +1 -0
- package/dist/mint-components/{p-83312717.js → p-6ed93e76.js} +23 -23
- package/dist/mint-components/p-71721901.entry.js +1 -0
- package/dist/mint-components/p-724417ec.system.entry.js +1 -0
- package/dist/mint-components/p-8bde1ab1.entry.js +1 -0
- package/dist/mint-components/p-8cd230fe.entry.js +187 -0
- package/dist/mint-components/p-99b5f669.system.js +1 -1
- package/dist/mint-components/p-a27d125b.system.js +1 -0
- package/dist/mint-components/p-a993f018.system.entry.js +1 -0
- package/dist/mint-components/p-b025e807.entry.js +33 -0
- package/dist/mint-components/p-b528510a.system.entry.js +1 -0
- package/dist/mint-components/p-c82f3726.system.entry.js +1 -0
- package/dist/mint-components/p-de81c223.system.entry.js +1 -0
- package/dist/mint-components/p-fb86ed8e.js +1 -0
- package/dist/types/components/sqm-tax-and-cash-monolith/sqm-tax-and-cash-monolith.d.ts +520 -0
- package/dist/types/components.d.ts +3276 -2323
- package/docs/docs.docx +0 -0
- package/docs/raisins.json +1 -1
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/sqm-docusign-embed.cjs.entry.js +0 -28
- package/dist/cjs/sqm-table-cell_2.cjs.entry.js +0 -34
- package/dist/esm/sqm-docusign-embed.entry.js +0 -24
- package/dist/esm/sqm-table-cell_2.entry.js +0 -29
- package/dist/esm-es5/sqm-big-stat_42.entry.js +0 -1
- package/dist/esm-es5/sqm-docusign-embed.entry.js +0 -1
- package/dist/esm-es5/sqm-empty_5.entry.js +0 -1
- package/dist/esm-es5/sqm-table-cell_2.entry.js +0 -1
- package/dist/esm-es5/sqm-tax-and-cash.entry.js +0 -1
- package/dist/mint-components/p-089f7cf7.system.js +0 -1
- package/dist/mint-components/p-2a29fb98.entry.js +0 -1
- package/dist/mint-components/p-2a55cd31.entry.js +0 -1
- package/dist/mint-components/p-351fdd8d.entry.js +0 -1
- package/dist/mint-components/p-3bd43d9a.system.entry.js +0 -1
- package/dist/mint-components/p-3d9d2c2d.system.entry.js +0 -1
- package/dist/mint-components/p-4070ec21.system.entry.js +0 -1
- package/dist/mint-components/p-4836a42a.system.entry.js +0 -1
- package/dist/mint-components/p-ade955a5.system.entry.js +0 -1
- package/dist/mint-components/p-bc2ccdf4.entry.js +0 -1
- package/dist/mint-components/p-c84c8d51.system.entry.js +0 -1
- package/dist/mint-components/p-dce987ba.entry.js +0 -219
- package/dist/mint-components/p-ddf4ece6.entry.js +0 -1
- package/dist/mint-components/p-e08af283.system.entry.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, h as h$1, c as Host
|
|
1
|
+
import { r as registerInstance, h as h$1, c as Host } from './index-17b4da69.js';
|
|
2
2
|
import { m as h, f as useEffect, j as useState, n as d, k as useRef, b as browser, i as useReducer } from './stencil-hooks.module-2b1ac06e.js';
|
|
3
3
|
import { i as intl } from './global-0141a923.js';
|
|
4
4
|
import { i as isDemo, V, d as dist, H, W, F as Fe, b as mn, T, O, a as dn, h as hn, l as xe, S as Se, n as ke, f as useCallback, p as Ue, v as vn } from './index.module-4d07653e.js';
|
|
@@ -8,16 +8,14 @@ import './mixins-f60a614c.js';
|
|
|
8
8
|
import { c as createStyleSheet } from './JSS-67b5cff8.js';
|
|
9
9
|
import { a as useRequestRerender } from './re-render-2a199c62.js';
|
|
10
10
|
import { u as useChildElements } from './useChildElements-d4fb1098.js';
|
|
11
|
-
import
|
|
11
|
+
import './luxon-2c624667.js';
|
|
12
12
|
import { g as getProps, a as getMissingProps, s as sanitizeUrlPath } from './utils-334c1e34.js';
|
|
13
13
|
import './sqm-text-span-view-8d140661.js';
|
|
14
|
-
import { u as useParent, T as TAX_CONTEXT_NAMESPACE, b as USER_QUERY_NAMESPACE, C as COUNTRIES_NAMESPACE, f as useSetParent, U as USER_INFO_NAMESPACE, d as CURRENCIES_NAMESPACE } from './data-e76577b2.js';
|
|
15
14
|
import { R as REGISTRATION_FORM_STATE_CONTEXT, u as useRegistrationFormState } from './useRegistrationFormState-ee6b79b3.js';
|
|
16
15
|
import { A as AsYouType } from './AsYouType-46f67d0d.js';
|
|
17
|
-
import { b as useDemoBigStat,
|
|
16
|
+
import { b as useDemoBigStat, V as useBigStat, B as BigStatView, Q as autoColorScaleCss, K as CardFeedView, j as CheckboxFieldView, M as CouponCodeView, D as DropdownFieldView, E as EditProfileView, H as HeroView, I as InputFieldView, W as withShadowView, L as LeaderboardView, N as NameFieldsView, d as PortalChangePasswordView, i as PortalFooterView, P as PortalFrameView, e as PortalLoginView, f as PortalRegisterView, R as ReferralIframeView, X as demoRewardExchange, k as RewardExchangeView, a as useShareButton, S as ShareButtonView, C as CopyTextView, u as useShareLink, c as StatContainerView, T as TaskCardView } from './ShadowViewAddon-6b52e587.js';
|
|
18
17
|
import { p as pathToRegexp } from './index-ffa26b43.js';
|
|
19
18
|
import './sqm-portal-container-view-ab89c6cc.js';
|
|
20
|
-
import { a as useParentQueryValue } from './useParentQuery-90a33801.js';
|
|
21
19
|
|
|
22
20
|
const BigStat = class {
|
|
23
21
|
constructor(hostRef) {
|
|
@@ -584,694 +582,6 @@ const DividedLayout = class {
|
|
|
584
582
|
}
|
|
585
583
|
};
|
|
586
584
|
|
|
587
|
-
const style$1 = {
|
|
588
|
-
FormWrapper: {
|
|
589
|
-
display: "flex",
|
|
590
|
-
justifyContent: "flex-start",
|
|
591
|
-
flexDirection: "column",
|
|
592
|
-
},
|
|
593
|
-
CheckboxContainer: {
|
|
594
|
-
display: "flex",
|
|
595
|
-
alignItems: "flex-start",
|
|
596
|
-
justifyContent: "flex-start",
|
|
597
|
-
flexDirection: "column",
|
|
598
|
-
gap: "var(--sl-spacing-xx-small)",
|
|
599
|
-
},
|
|
600
|
-
TitleContainer: {
|
|
601
|
-
display: "flex",
|
|
602
|
-
flexDirection: "row",
|
|
603
|
-
alignItems: "center",
|
|
604
|
-
justifyContent: "flex-start",
|
|
605
|
-
gap: "var(--sl-spacing-small)",
|
|
606
|
-
},
|
|
607
|
-
TextContainer: {
|
|
608
|
-
display: "flex",
|
|
609
|
-
justifyContent: "flex-start",
|
|
610
|
-
flexDirection: "column",
|
|
611
|
-
gap: "24px",
|
|
612
|
-
paddingBottom: "16px",
|
|
613
|
-
},
|
|
614
|
-
BtnContainer: {
|
|
615
|
-
paddingTop: "36px",
|
|
616
|
-
display: "flex",
|
|
617
|
-
gap: "8px",
|
|
618
|
-
},
|
|
619
|
-
ErrorText: {
|
|
620
|
-
color: "var(--sl-color-danger-500)",
|
|
621
|
-
marginTop: "10px",
|
|
622
|
-
},
|
|
623
|
-
SecondaryBtn: {
|
|
624
|
-
"&::part(base)": {
|
|
625
|
-
color: "var(--sl-color-gray-800) !important",
|
|
626
|
-
},
|
|
627
|
-
},
|
|
628
|
-
RadioContainer: {
|
|
629
|
-
width: "100%",
|
|
630
|
-
display: "flex",
|
|
631
|
-
justifyContent: "flex-start",
|
|
632
|
-
flexDirection: "column",
|
|
633
|
-
gap: "16px",
|
|
634
|
-
padding: "16px",
|
|
635
|
-
},
|
|
636
|
-
DescriptionText: {
|
|
637
|
-
color: "var(--sl-color-neutral-500)",
|
|
638
|
-
lineHeight: "22px",
|
|
639
|
-
},
|
|
640
|
-
LabelText: {
|
|
641
|
-
fontWeight: "bold",
|
|
642
|
-
},
|
|
643
|
-
AlertContainer: {
|
|
644
|
-
"&::part(base)": {
|
|
645
|
-
backgroundColor: "var(--sl-color-red-100)",
|
|
646
|
-
borderTop: "none",
|
|
647
|
-
padding: "0 16px",
|
|
648
|
-
marginBottom: "16px",
|
|
649
|
-
},
|
|
650
|
-
"& sl-icon::part(base)": {
|
|
651
|
-
color: "var(--sl-color-danger-500)",
|
|
652
|
-
},
|
|
653
|
-
},
|
|
654
|
-
};
|
|
655
|
-
const sheet$1 = createStyleSheet(style$1);
|
|
656
|
-
const styleString$1 = sheet$1.toString();
|
|
657
|
-
const vanillaStyle = `
|
|
658
|
-
:host{
|
|
659
|
-
display: block;
|
|
660
|
-
}
|
|
661
|
-
* {
|
|
662
|
-
margin: 0;
|
|
663
|
-
padding: 0;
|
|
664
|
-
box-sizing: border-box;
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
p {
|
|
668
|
-
line-height: 18px;
|
|
669
|
-
color: var(--sl-color-gray-800);
|
|
670
|
-
font-size: var(--sl-font-size-small);
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
sl-checkbox::part(control) {
|
|
674
|
-
border-radius: 50%;
|
|
675
|
-
}
|
|
676
|
-
`;
|
|
677
|
-
const DocumentTypeFormView = (props) => {
|
|
678
|
-
var _a;
|
|
679
|
-
const { states, states: { formState }, callbacks, text, } = props;
|
|
680
|
-
const { classes } = sheet$1;
|
|
681
|
-
console.log({ formState });
|
|
682
|
-
return (h$1("sl-form", { class: classes.FormWrapper, "onSl-submit": callbacks.onSubmit },
|
|
683
|
-
h$1("style", { type: "text/css" },
|
|
684
|
-
styleString$1,
|
|
685
|
-
vanillaStyle),
|
|
686
|
-
h$1("div", { class: classes.TextContainer },
|
|
687
|
-
h$1("div", null,
|
|
688
|
-
h$1("p", null, text.formStep),
|
|
689
|
-
h$1("h3", null, text.taxForm))),
|
|
690
|
-
states.loading ? (h$1("sl-spinner", { style: { fontSize: "50px", margin: "40px" } })) : (h$1("div", null,
|
|
691
|
-
((_a = formState.errors) === null || _a === void 0 ? void 0 : _a.general) && (h$1("sl-alert", { type: "warning", open: true, class: sheet$1.classes.AlertContainer },
|
|
692
|
-
h$1("sl-icon", { slot: "icon", name: "exclamation-octagon" }),
|
|
693
|
-
h$1("strong", null, text.error.generalTitle),
|
|
694
|
-
h$1("br", null),
|
|
695
|
-
text.error.generalDescription)),
|
|
696
|
-
h$1("p", { class: classes.LabelText }, text.formLabel),
|
|
697
|
-
h$1("div", { class: classes.RadioContainer },
|
|
698
|
-
h$1("sl-radio", { disabled: states.disabled, value: "w9", name: "/documentType" },
|
|
699
|
-
h$1("p", { class: classes.LabelText }, text.w9Label),
|
|
700
|
-
h$1("p", { class: classes.DescriptionText }, text.w9Description)),
|
|
701
|
-
h$1("sl-radio", { disabled: states.disabled, value: "w8-ben", name: "/documentType" },
|
|
702
|
-
h$1("p", { class: classes.LabelText }, text.w8Label),
|
|
703
|
-
h$1("p", { class: classes.DescriptionText }, text.w8Description)),
|
|
704
|
-
h$1("sl-radio", { disabled: states.disabled, value: "w8-ben-e", name: "/documentType" },
|
|
705
|
-
h$1("p", { class: classes.LabelText }, text.w8ELabel),
|
|
706
|
-
h$1("p", { class: classes.DescriptionText }, text.w8EDescription))),
|
|
707
|
-
h$1("div", { class: classes.BtnContainer },
|
|
708
|
-
h$1("sl-button", { type: "primary", loading: states.loading, disabled: states.disabled, submit: true, exportparts: "base: primarybutton-base" }, text.submitButton),
|
|
709
|
-
h$1("sl-button", { class: classes.SecondaryBtn, type: "text", loading: states.loading, onClick: () => {
|
|
710
|
-
callbacks.onBack();
|
|
711
|
-
}, exportparts: "base: secondarybutton-base" }, text.backButton))))));
|
|
712
|
-
};
|
|
713
|
-
|
|
714
|
-
const UPSERT_USER = dist.gql `
|
|
715
|
-
mutation ($userInput: UserInput!) {
|
|
716
|
-
upsertUser(userInput: $userInput) {
|
|
717
|
-
firstName
|
|
718
|
-
lastName
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
`;
|
|
722
|
-
function useDocumentTypeForm(props) {
|
|
723
|
-
const [path, setPath] = useParent(TAX_CONTEXT_NAMESPACE);
|
|
724
|
-
const [loading, setLoading] = useState(false);
|
|
725
|
-
const [upsertUser] = Fe(UPSERT_USER);
|
|
726
|
-
const [errors, setErrors] = useState({});
|
|
727
|
-
const user = H();
|
|
728
|
-
const { refetch } = useParentQueryValue(USER_QUERY_NAMESPACE);
|
|
729
|
-
const onSubmit = async (e) => {
|
|
730
|
-
const controls = e.target.getFormControls();
|
|
731
|
-
let selectedDocumentType = null;
|
|
732
|
-
controls.forEach((control) => {
|
|
733
|
-
if (!control.name)
|
|
734
|
-
return;
|
|
735
|
-
const value = control.value;
|
|
736
|
-
const checked = control.checked;
|
|
737
|
-
if (checked)
|
|
738
|
-
selectedDocumentType = value;
|
|
739
|
-
});
|
|
740
|
-
if (selectedDocumentType === null) {
|
|
741
|
-
setErrors({ documentType: true });
|
|
742
|
-
return;
|
|
743
|
-
}
|
|
744
|
-
setLoading(true);
|
|
745
|
-
try {
|
|
746
|
-
await upsertUser({
|
|
747
|
-
userInput: {
|
|
748
|
-
id: user.id,
|
|
749
|
-
accountId: user.accountId,
|
|
750
|
-
customFields: {
|
|
751
|
-
__taxDocumentType: selectedDocumentType.toUpperCase(),
|
|
752
|
-
},
|
|
753
|
-
},
|
|
754
|
-
});
|
|
755
|
-
await refetch();
|
|
756
|
-
setPath(`/3/${selectedDocumentType}`);
|
|
757
|
-
}
|
|
758
|
-
catch (e) {
|
|
759
|
-
setErrors({ general: true });
|
|
760
|
-
}
|
|
761
|
-
finally {
|
|
762
|
-
setLoading(false);
|
|
763
|
-
}
|
|
764
|
-
};
|
|
765
|
-
return {
|
|
766
|
-
text: props.getTextProps(),
|
|
767
|
-
callbacks: {
|
|
768
|
-
onSubmit,
|
|
769
|
-
onBack: () => setPath("/2"),
|
|
770
|
-
},
|
|
771
|
-
states: {
|
|
772
|
-
loading,
|
|
773
|
-
disabled: loading,
|
|
774
|
-
formState: {
|
|
775
|
-
formSubmission: false,
|
|
776
|
-
selectedTaxForm: "w9",
|
|
777
|
-
errors,
|
|
778
|
-
},
|
|
779
|
-
},
|
|
780
|
-
};
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
const DocumentTypeForm = class {
|
|
784
|
-
constructor(hostRef) {
|
|
785
|
-
registerInstance(this, hostRef);
|
|
786
|
-
/**
|
|
787
|
-
* Sub text shown at the top of the page, used to show the current step of the tax form.
|
|
788
|
-
* @uiName Tax form step text
|
|
789
|
-
*/
|
|
790
|
-
this.formStep = "Step 3 of 4";
|
|
791
|
-
/**
|
|
792
|
-
* Sub text shown above form selection radio buttons
|
|
793
|
-
* @uiName Tax form selection heading text
|
|
794
|
-
*/
|
|
795
|
-
this.formLabel = "Select a tax form";
|
|
796
|
-
/**
|
|
797
|
-
* Heading text shown at the top of the top of page
|
|
798
|
-
* @uiName Tax form heading text
|
|
799
|
-
*/
|
|
800
|
-
this.taxForm = "Tax form";
|
|
801
|
-
/**
|
|
802
|
-
* Label text for the W9 radio button
|
|
803
|
-
* @uiName W9 radio button label
|
|
804
|
-
*/
|
|
805
|
-
this.w9Label = "W9";
|
|
806
|
-
/**
|
|
807
|
-
* Subtext for the W9 radio button
|
|
808
|
-
* @uiName W9 radio button subtext
|
|
809
|
-
*/
|
|
810
|
-
this.w9Description = "W9 For participants based in the US, joining the referral program of a US-based company.";
|
|
811
|
-
/**
|
|
812
|
-
* Label text for the W8 radio button
|
|
813
|
-
* @uiName W8 radio button label
|
|
814
|
-
*/
|
|
815
|
-
this.w8Label = "W8-Ben";
|
|
816
|
-
/**
|
|
817
|
-
* Subtext for the W8 radio button
|
|
818
|
-
* @uiName W8 radio button subtext
|
|
819
|
-
*/
|
|
820
|
-
this.w8Description = "W8-BEN For individuals residing outside of the US, joining the referral program of a US-based company.";
|
|
821
|
-
/**
|
|
822
|
-
* Label text for the W8E radio button
|
|
823
|
-
* @uiName W8E radio button label
|
|
824
|
-
*/
|
|
825
|
-
this.w8ELabel = "W8-BEN-E";
|
|
826
|
-
/**
|
|
827
|
-
* Subtext for the W8E radio button
|
|
828
|
-
* @uiName W8E radio button subtext
|
|
829
|
-
*/
|
|
830
|
-
this.w8EDescription = "W8-BEN-E For participants residing outside of the US who represent a business entity, joining the referral program of a US-based company.";
|
|
831
|
-
/**
|
|
832
|
-
* Text shown inside of submit button
|
|
833
|
-
* @uiName Submit button text
|
|
834
|
-
*/
|
|
835
|
-
this.submitButton = "Continue";
|
|
836
|
-
/**
|
|
837
|
-
* Text shown inside of back button
|
|
838
|
-
* @uiName Back button text
|
|
839
|
-
*/
|
|
840
|
-
this.backButton = "Back";
|
|
841
|
-
/**
|
|
842
|
-
* The title for error message shown at the top of the page in an error banner
|
|
843
|
-
*
|
|
844
|
-
* @uiName General error title
|
|
845
|
-
*/
|
|
846
|
-
this.generalErrorTitle = "There was a problem submitting your information";
|
|
847
|
-
/**
|
|
848
|
-
* The error message shown at the top of the page in an error banner
|
|
849
|
-
*
|
|
850
|
-
* @uiName General error text
|
|
851
|
-
*/
|
|
852
|
-
this.generalErrorDescription = "Please review your information and try again. If this problem continues, contact Support.";
|
|
853
|
-
h(this);
|
|
854
|
-
}
|
|
855
|
-
disconnectedCallback() { }
|
|
856
|
-
getTextProps() {
|
|
857
|
-
const props = getProps(this);
|
|
858
|
-
return {
|
|
859
|
-
...props,
|
|
860
|
-
error: {
|
|
861
|
-
generalTitle: props.generalErrorTitle,
|
|
862
|
-
generalDescription: props.generalErrorDescription,
|
|
863
|
-
},
|
|
864
|
-
};
|
|
865
|
-
}
|
|
866
|
-
render() {
|
|
867
|
-
const props = isDemo()
|
|
868
|
-
? useDemoDocumentTypeForm(this)
|
|
869
|
-
: useDocumentTypeForm(this);
|
|
870
|
-
return (h$1(DocumentTypeFormView, { callbacks: props.callbacks, states: props.states, text: props.text }));
|
|
871
|
-
}
|
|
872
|
-
};
|
|
873
|
-
function useDemoDocumentTypeForm(props) {
|
|
874
|
-
const [_, setPath] = useParent(TAX_CONTEXT_NAMESPACE);
|
|
875
|
-
return cjs({
|
|
876
|
-
text: props.getTextProps(),
|
|
877
|
-
callbacks: {
|
|
878
|
-
onSubmit: async () => { },
|
|
879
|
-
onBack: () => setPath("/2"),
|
|
880
|
-
},
|
|
881
|
-
states: {
|
|
882
|
-
loading: false,
|
|
883
|
-
disabled: false,
|
|
884
|
-
formState: {
|
|
885
|
-
formSubmission: false,
|
|
886
|
-
selectedTaxForm: "w9",
|
|
887
|
-
errors: {},
|
|
888
|
-
},
|
|
889
|
-
},
|
|
890
|
-
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
const style$2 = {
|
|
894
|
-
FormWrapper: {
|
|
895
|
-
display: "flex",
|
|
896
|
-
justifyContent: "flex-start",
|
|
897
|
-
flexDirection: "column",
|
|
898
|
-
},
|
|
899
|
-
CheckboxContainer: {
|
|
900
|
-
display: "flex",
|
|
901
|
-
alignItems: "flex-start",
|
|
902
|
-
justifyContent: "flex-start",
|
|
903
|
-
flexDirection: "column",
|
|
904
|
-
gap: "var(--sl-spacing-xx-small)",
|
|
905
|
-
},
|
|
906
|
-
TitleContainer: {
|
|
907
|
-
display: "flex",
|
|
908
|
-
flexDirection: "row",
|
|
909
|
-
alignItems: "center",
|
|
910
|
-
justifyContent: "flex-start",
|
|
911
|
-
gap: "var(--sl-spacing-small)",
|
|
912
|
-
},
|
|
913
|
-
TextContainer: {
|
|
914
|
-
display: "flex",
|
|
915
|
-
justifyContent: "flex-start",
|
|
916
|
-
flexDirection: "column",
|
|
917
|
-
gap: "24px",
|
|
918
|
-
paddingBottom: "16px",
|
|
919
|
-
},
|
|
920
|
-
BtnContainer: {
|
|
921
|
-
paddingTop: "36px",
|
|
922
|
-
display: "flex",
|
|
923
|
-
gap: "8px",
|
|
924
|
-
},
|
|
925
|
-
ErrorText: {
|
|
926
|
-
color: "var(--sl-color-danger-500)",
|
|
927
|
-
marginTop: "10px",
|
|
928
|
-
},
|
|
929
|
-
DescriptionText: {
|
|
930
|
-
color: "var(--sl-color-neutral-500)",
|
|
931
|
-
},
|
|
932
|
-
BoldText: {
|
|
933
|
-
fontWeight: "bold",
|
|
934
|
-
},
|
|
935
|
-
SecondaryBtn: {
|
|
936
|
-
"&::part(base)": {
|
|
937
|
-
color: "var(--sl-color-gray-800) !important",
|
|
938
|
-
},
|
|
939
|
-
},
|
|
940
|
-
ErrorAlertContainer: {
|
|
941
|
-
"&::part(base)": {
|
|
942
|
-
backgroundColor: "var(--sl-color-red-100)",
|
|
943
|
-
borderTop: "none",
|
|
944
|
-
padding: "0 16px",
|
|
945
|
-
},
|
|
946
|
-
"& sl-icon::part(base)": {
|
|
947
|
-
color: "var(--sl-color-danger-500)",
|
|
948
|
-
},
|
|
949
|
-
},
|
|
950
|
-
InfoAlert: {
|
|
951
|
-
"&::part(base)": {
|
|
952
|
-
backgroundColor: "transparent",
|
|
953
|
-
borderTop: "none",
|
|
954
|
-
padding: "0px",
|
|
955
|
-
marginBottom: "16px",
|
|
956
|
-
border: "none",
|
|
957
|
-
},
|
|
958
|
-
"&::part(message)": {
|
|
959
|
-
display: "flex",
|
|
960
|
-
alignItems: "center",
|
|
961
|
-
justifyContent: "flex-start",
|
|
962
|
-
padding: "10px",
|
|
963
|
-
height: "max-content",
|
|
964
|
-
},
|
|
965
|
-
"& sl-icon::part(base)": {
|
|
966
|
-
color: "var(--sl-color-sky-500)",
|
|
967
|
-
},
|
|
968
|
-
},
|
|
969
|
-
Container: {
|
|
970
|
-
width: "100%",
|
|
971
|
-
display: "flex",
|
|
972
|
-
justifyContent: "flex-start",
|
|
973
|
-
flexDirection: "column",
|
|
974
|
-
gap: "16px",
|
|
975
|
-
},
|
|
976
|
-
Link: {
|
|
977
|
-
color: "var(--sl-color-sky-500)",
|
|
978
|
-
textDecoration: "none",
|
|
979
|
-
"&:visited": {
|
|
980
|
-
color: "var(--sl-color-sky-500)",
|
|
981
|
-
},
|
|
982
|
-
"&:hover": {
|
|
983
|
-
textDecoration: "underline",
|
|
984
|
-
},
|
|
985
|
-
},
|
|
986
|
-
};
|
|
987
|
-
const sheet$2 = createStyleSheet(style$2);
|
|
988
|
-
const styleString$2 = sheet$2.toString();
|
|
989
|
-
const vanillaStyle$1 = `
|
|
990
|
-
:host{
|
|
991
|
-
display: block;
|
|
992
|
-
}
|
|
993
|
-
* {
|
|
994
|
-
margin: 0;
|
|
995
|
-
padding: 0;
|
|
996
|
-
box-sizing: border-box;
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
p {
|
|
1000
|
-
line-height: 18px;
|
|
1001
|
-
color: var(--sl-color-gray-800);
|
|
1002
|
-
font-size: var(--sl-font-size-small);
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
a {
|
|
1006
|
-
cursor: pointer;
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
`;
|
|
1011
|
-
const DocusignFormView = (props) => {
|
|
1012
|
-
var _a, _b;
|
|
1013
|
-
const { states, states: { formState, documentType }, callbacks, text, } = props;
|
|
1014
|
-
const { classes } = sheet$2;
|
|
1015
|
-
return (h$1("div", { class: classes.Container },
|
|
1016
|
-
h$1("style", { type: "text/css" },
|
|
1017
|
-
styleString$2,
|
|
1018
|
-
vanillaStyle$1),
|
|
1019
|
-
h$1("div", { class: classes.TextContainer },
|
|
1020
|
-
h$1("div", null,
|
|
1021
|
-
h$1("p", null, text.formStep),
|
|
1022
|
-
h$1("h3", null, text.taxForm))),
|
|
1023
|
-
((_a = formState.errors) === null || _a === void 0 ? void 0 : _a.general) && (h$1("sl-alert", { type: "warning", open: true, class: sheet$2.classes.ErrorAlertContainer },
|
|
1024
|
-
h$1("sl-icon", { slot: "icon", name: "exclamation-octagon" }),
|
|
1025
|
-
h$1("strong", null, text.error.generalTitle),
|
|
1026
|
-
h$1("br", null),
|
|
1027
|
-
text.error.generalDescription)),
|
|
1028
|
-
h$1("h5", { class: classes.BoldText }, intl.formatMessage({ id: "tax-form-label", defaultMessage: text.taxFormLabel }, { documentType })),
|
|
1029
|
-
h$1("p", null,
|
|
1030
|
-
intl.formatMessage({
|
|
1031
|
-
id: "tax-form-description",
|
|
1032
|
-
defaultMessage: text.taxFormDescription,
|
|
1033
|
-
}, { documentType }),
|
|
1034
|
-
" ",
|
|
1035
|
-
h$1("a", { onClick: callbacks.onShowDocumentType, class: classes.Link }, text.notBasedInUS)),
|
|
1036
|
-
states.loading ? (h$1("sl-spinner", { style: { fontSize: "50px", margin: "40px" } })) : (h$1("div", null,
|
|
1037
|
-
h$1("sl-alert", { exportparts: "base: alert-base, icon:alert-icon", type: "primary", open: true, class: classes.InfoAlert },
|
|
1038
|
-
h$1("sl-icon", { slot: "icon", name: "info-circle" }),
|
|
1039
|
-
text.banner),
|
|
1040
|
-
h$1("slot", { name: "docusign-iframe" }),
|
|
1041
|
-
h$1("div", null,
|
|
1042
|
-
h$1("p", { class: classes.BoldText }, text.checkboxLabel),
|
|
1043
|
-
h$1("sl-checkbox", { disabled: states.disabled, checked: formState.completedTaxForm, "onSl-change": callbacks.toggleFormSubmitted }, text.checkboxDescription),
|
|
1044
|
-
((_b = formState.errors) === null || _b === void 0 ? void 0 : _b.formSubmission) && (h$1("p", { class: classes.ErrorText }, text.error.formSubmission))),
|
|
1045
|
-
h$1("div", { class: classes.BtnContainer },
|
|
1046
|
-
h$1("sl-button", { type: "primary", loading: states.loading, disabled: states.submitDisabled, submit: true, onClick: callbacks.onSubmit, exportparts: "base: primarybutton-base" }, text.submitButton),
|
|
1047
|
-
h$1("sl-button", { class: classes.SecondaryBtn, type: "text", loading: states.loading, disabled: states.loading, onClick: () => {
|
|
1048
|
-
callbacks.onBack();
|
|
1049
|
-
}, exportparts: "base: secondarybutton-base" }, text.backButton))))));
|
|
1050
|
-
};
|
|
1051
|
-
|
|
1052
|
-
// TODO: Fill out when API is released
|
|
1053
|
-
const GET_TAX_DOCUMENT = dist.gql `
|
|
1054
|
-
query getTaxDocument ($vars: TaxDocumentInput) {}
|
|
1055
|
-
`;
|
|
1056
|
-
// TODO: Check if document already exists
|
|
1057
|
-
const CHECK_DOCUMENT_STATUS = dist.gql `
|
|
1058
|
-
query checkDocumentStatus ($vars: CheckDocumentStatusInput) {}
|
|
1059
|
-
`;
|
|
1060
|
-
const UPSERT_USER$1 = dist.gql `
|
|
1061
|
-
mutation ($userInput: UserInput!) {
|
|
1062
|
-
upsertUser(userInput: $userInput) {
|
|
1063
|
-
firstName
|
|
1064
|
-
lastName
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
`;
|
|
1068
|
-
function useDocusignForm(props, el) {
|
|
1069
|
-
var _a, _b, _c;
|
|
1070
|
-
const user = H();
|
|
1071
|
-
const [path, setPath] = useParent(TAX_CONTEXT_NAMESPACE);
|
|
1072
|
-
const { data, refetch } = useParentQueryValue(USER_QUERY_NAMESPACE);
|
|
1073
|
-
const [upsertUser] = Fe(UPSERT_USER$1);
|
|
1074
|
-
const [formSubmitted, setFormSubmitted] = useState(false);
|
|
1075
|
-
const [errors, setErrors] = useState({});
|
|
1076
|
-
const [loading, setLoading] = useState(false);
|
|
1077
|
-
const splitPath = path.split("/");
|
|
1078
|
-
const pathedDocumentType = splitPath.length === 3 ? splitPath[2] : undefined;
|
|
1079
|
-
const savedUserTaxType = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.customFields) === null || _b === void 0 ? void 0 : _b.w9Type;
|
|
1080
|
-
// TODO: Replace with real backend data
|
|
1081
|
-
const { data: taxInfo, loading: taxInfoLoading, refetch: refetchDocument, } = {
|
|
1082
|
-
data: {
|
|
1083
|
-
taxForm: pathedDocumentType,
|
|
1084
|
-
documentUrl: "https://example.com",
|
|
1085
|
-
},
|
|
1086
|
-
loading: false,
|
|
1087
|
-
refetch: (_vars) => console.debug("REFETCHING", _vars),
|
|
1088
|
-
};
|
|
1089
|
-
useEffect(() => {
|
|
1090
|
-
if (pathedDocumentType === savedUserTaxType)
|
|
1091
|
-
return;
|
|
1092
|
-
refetchDocument({ documentType: pathedDocumentType });
|
|
1093
|
-
}, [pathedDocumentType, savedUserTaxType]);
|
|
1094
|
-
useEffect(() => {
|
|
1095
|
-
// Load docusign iframe with given url
|
|
1096
|
-
const slotted = el.querySelector("sqm-docusign-embed");
|
|
1097
|
-
if (slotted) {
|
|
1098
|
-
slotted.url = taxInfo.documentUrl;
|
|
1099
|
-
}
|
|
1100
|
-
}, [taxInfo.documentUrl]);
|
|
1101
|
-
const onSubmit = async () => {
|
|
1102
|
-
if (!formSubmitted) {
|
|
1103
|
-
setErrors({ submitCheckbox: true });
|
|
1104
|
-
return;
|
|
1105
|
-
}
|
|
1106
|
-
// TODO: Check document is actually registered in the backend
|
|
1107
|
-
try {
|
|
1108
|
-
setLoading(true);
|
|
1109
|
-
// Backend request
|
|
1110
|
-
await upsertUser({
|
|
1111
|
-
userInput: {
|
|
1112
|
-
id: user.id,
|
|
1113
|
-
accountId: user.accountId,
|
|
1114
|
-
customFields: {
|
|
1115
|
-
__taxDocumentSubmitted: true,
|
|
1116
|
-
},
|
|
1117
|
-
},
|
|
1118
|
-
});
|
|
1119
|
-
await refetch();
|
|
1120
|
-
setPath("/submitted");
|
|
1121
|
-
}
|
|
1122
|
-
catch (e) {
|
|
1123
|
-
setErrors({ formSubission: { status: "document-error" } });
|
|
1124
|
-
}
|
|
1125
|
-
finally {
|
|
1126
|
-
setLoading(false);
|
|
1127
|
-
}
|
|
1128
|
-
};
|
|
1129
|
-
return {
|
|
1130
|
-
states: {
|
|
1131
|
-
disabled: taxInfoLoading || loading,
|
|
1132
|
-
submitDisabled: !formSubmitted,
|
|
1133
|
-
loading: taxInfoLoading || loading,
|
|
1134
|
-
formState: {
|
|
1135
|
-
completedTaxForm: formSubmitted,
|
|
1136
|
-
taxFormExpired: false,
|
|
1137
|
-
errors,
|
|
1138
|
-
},
|
|
1139
|
-
documentType: (_c = taxInfo.taxForm) === null || _c === void 0 ? void 0 : _c.toUpperCase(),
|
|
1140
|
-
},
|
|
1141
|
-
data: {
|
|
1142
|
-
taxForm: taxInfo === null || taxInfo === void 0 ? void 0 : taxInfo.taxForm,
|
|
1143
|
-
documentUrl: taxInfo === null || taxInfo === void 0 ? void 0 : taxInfo.documentUrl,
|
|
1144
|
-
},
|
|
1145
|
-
callbacks: {
|
|
1146
|
-
onShowDocumentType: () => setPath("/3b"),
|
|
1147
|
-
onSubmit,
|
|
1148
|
-
toggleFormSubmitted: () => setFormSubmitted((x) => !x),
|
|
1149
|
-
onBack: () => setPath("/2"),
|
|
1150
|
-
},
|
|
1151
|
-
text: props.getTextProps(),
|
|
1152
|
-
};
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
const DocusignForm = class {
|
|
1156
|
-
constructor(hostRef) {
|
|
1157
|
-
registerInstance(this, hostRef);
|
|
1158
|
-
this.ignored = true;
|
|
1159
|
-
/**
|
|
1160
|
-
* Sub text shown at the top of the page, used to show the current step of the tax form.
|
|
1161
|
-
* @uiName Tax form step text
|
|
1162
|
-
*/
|
|
1163
|
-
this.formStep = "Step 3 of 4";
|
|
1164
|
-
/**
|
|
1165
|
-
* Heading text shown at the top of the page
|
|
1166
|
-
* @uiName Tax form heading text
|
|
1167
|
-
*/
|
|
1168
|
-
this.taxForm = "Tax form";
|
|
1169
|
-
/**
|
|
1170
|
-
* Text shown at the top of the page next to the document type text
|
|
1171
|
-
* @uiName Tax form label text
|
|
1172
|
-
*/
|
|
1173
|
-
this.taxFormLabel = "{documentType} Tax Form";
|
|
1174
|
-
/**
|
|
1175
|
-
* Subtext shown at the top of the page next to the document type text
|
|
1176
|
-
* @uiName Tax form subtext
|
|
1177
|
-
*/
|
|
1178
|
-
this.taxFormDescription = "Participants based in the US and partnering with US-based brands need to submit a {documentType} form.";
|
|
1179
|
-
/**
|
|
1180
|
-
* Text shown in the link to the form for non US residents
|
|
1181
|
-
* @uiName Not based in US link text
|
|
1182
|
-
*/
|
|
1183
|
-
this.notBasedInUS = "Not based in the US?";
|
|
1184
|
-
/**
|
|
1185
|
-
* Text shown in the banner above the document
|
|
1186
|
-
* @uiName Banner text
|
|
1187
|
-
*/
|
|
1188
|
-
this.banner = "For your security, we automatically end your session when you have not interacted with the form after 20 minutes.";
|
|
1189
|
-
/**
|
|
1190
|
-
* Heading text for the form submission checkbox
|
|
1191
|
-
* @uiName Form submission checkbox heading
|
|
1192
|
-
*/
|
|
1193
|
-
this.checkboxLabel = "Form submission";
|
|
1194
|
-
/**
|
|
1195
|
-
* Label text for the form submission checkbox
|
|
1196
|
-
* @uiName Form submission checkbox label
|
|
1197
|
-
*/
|
|
1198
|
-
this.checkboxDescription = "I have completed and submitted my tax form";
|
|
1199
|
-
/**
|
|
1200
|
-
* Text shown inside of submit button
|
|
1201
|
-
* @uiName Submit button text
|
|
1202
|
-
*/
|
|
1203
|
-
this.submitButton = "Continue";
|
|
1204
|
-
/**
|
|
1205
|
-
* Text shown inside of back button
|
|
1206
|
-
* @uiName Back button text
|
|
1207
|
-
*/
|
|
1208
|
-
this.backButton = "Back";
|
|
1209
|
-
/**
|
|
1210
|
-
* The title for error message shown at the top of the page in an error banner
|
|
1211
|
-
*
|
|
1212
|
-
* @uiName General error title
|
|
1213
|
-
*/
|
|
1214
|
-
this.generalErrorTitle = "There was a problem submitting your information";
|
|
1215
|
-
/**
|
|
1216
|
-
* The error message shown at the top of the page in an error banner
|
|
1217
|
-
*
|
|
1218
|
-
* @uiName General error text
|
|
1219
|
-
*/
|
|
1220
|
-
this.generalErrorDescription = "Please review your information and try again. If this problem continues, contact Support.";
|
|
1221
|
-
/**
|
|
1222
|
-
* The error message shown at the bottom of the page if the user has not checked the form submission checkbox
|
|
1223
|
-
*
|
|
1224
|
-
* @uiName Form submission error text
|
|
1225
|
-
*/
|
|
1226
|
-
this.formSubmissionError = "This field is required";
|
|
1227
|
-
h(this);
|
|
1228
|
-
}
|
|
1229
|
-
disconnectedCallback() { }
|
|
1230
|
-
getTextProps() {
|
|
1231
|
-
const props = getProps(this);
|
|
1232
|
-
return {
|
|
1233
|
-
...props,
|
|
1234
|
-
error: {
|
|
1235
|
-
generalTitle: props.generalErrorTitle,
|
|
1236
|
-
generalDescription: props.generalErrorDescription,
|
|
1237
|
-
formSubmission: props.formSubmissionError,
|
|
1238
|
-
},
|
|
1239
|
-
};
|
|
1240
|
-
}
|
|
1241
|
-
render() {
|
|
1242
|
-
const props = isDemo()
|
|
1243
|
-
? useDocusignFormDemo(this)
|
|
1244
|
-
: useDocusignForm(this, this.el);
|
|
1245
|
-
return (h$1(Host, null, h$1(DocusignFormView, { callbacks: props.callbacks, states: props.states, text: props.text })));
|
|
1246
|
-
}
|
|
1247
|
-
get el() { return getElement(this); }
|
|
1248
|
-
};
|
|
1249
|
-
function useDocusignFormDemo(props) {
|
|
1250
|
-
return cjs({
|
|
1251
|
-
text: props.getTextProps(),
|
|
1252
|
-
states: {
|
|
1253
|
-
disabled: false,
|
|
1254
|
-
submitDisabled: false,
|
|
1255
|
-
loading: false,
|
|
1256
|
-
formState: {
|
|
1257
|
-
completedTaxForm: true,
|
|
1258
|
-
errors: {},
|
|
1259
|
-
},
|
|
1260
|
-
documentType: "W9",
|
|
1261
|
-
},
|
|
1262
|
-
data: {
|
|
1263
|
-
taxForm: "W9",
|
|
1264
|
-
documentUrl: "https://example.com",
|
|
1265
|
-
},
|
|
1266
|
-
callbacks: {
|
|
1267
|
-
onShowDocumentType: () => { },
|
|
1268
|
-
onSubmit: async () => { },
|
|
1269
|
-
toggleFormSubmitted: () => { },
|
|
1270
|
-
onBack: () => { },
|
|
1271
|
-
},
|
|
1272
|
-
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
585
|
function useDropdownField() {
|
|
1276
586
|
const registrationFormState = d(REGISTRATION_FORM_STATE_CONTEXT);
|
|
1277
587
|
return {
|
|
@@ -1343,7 +653,7 @@ const GET_USER = dist.gql `
|
|
|
1343
653
|
}
|
|
1344
654
|
}
|
|
1345
655
|
`;
|
|
1346
|
-
const UPSERT_USER
|
|
656
|
+
const UPSERT_USER = dist.gql `
|
|
1347
657
|
mutation (
|
|
1348
658
|
$id: String!
|
|
1349
659
|
$accountId: String!
|
|
@@ -1378,7 +688,7 @@ function useEditProfile(props) {
|
|
|
1378
688
|
const [userData, setUserData] = useState(undefined);
|
|
1379
689
|
const [formState, setFormState] = useState(defaultFormState);
|
|
1380
690
|
const userDataResponse = mn(GET_USER, {}, !(userIdent === null || userIdent === void 0 ? void 0 : userIdent.jwt));
|
|
1381
|
-
const [upsertUser, upsertUserResponse] = Fe(UPSERT_USER
|
|
691
|
+
const [upsertUser, upsertUserResponse] = Fe(UPSERT_USER);
|
|
1382
692
|
useEffect(() => {
|
|
1383
693
|
if ((upsertUserResponse === null || upsertUserResponse === void 0 ? void 0 : upsertUserResponse.loading) || !showEdit)
|
|
1384
694
|
return;
|
|
@@ -1784,530 +1094,38 @@ const HeroImage = class {
|
|
|
1784
1094
|
this.buttonNewTab = false;
|
|
1785
1095
|
/**
|
|
1786
1096
|
* @uiName Text padding
|
|
1787
|
-
* @uiType string
|
|
1788
|
-
* @uiEnum ["none", "xxx-small", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large", "xxxx-large"]
|
|
1789
|
-
* @uiEnumNames ["None", "XXX-Small", "XX-Small", "X-Small", "Small", "Medium", "Large", "X-Large", "XX-Large", "XXX-Large", "XXXX-Large"]
|
|
1790
|
-
*/
|
|
1791
|
-
this.paddingText = "xxxx-large";
|
|
1792
|
-
/**
|
|
1793
|
-
* @uiName Image padding
|
|
1794
|
-
* @uiType string
|
|
1795
|
-
* @uiEnum ["none", "xxx-small", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large", "xxxx-large"]
|
|
1796
|
-
* @uiEnumNames ["None", "XXX-Small", "XX-Small", "X-Small", "Small", "Medium", "Large", "X-Large", "XX-Large", "XXX-Large", "XXXX-Large"]
|
|
1797
|
-
*/
|
|
1798
|
-
this.paddingImage = "none";
|
|
1799
|
-
h(this);
|
|
1800
|
-
}
|
|
1801
|
-
disconnectedCallback() { }
|
|
1802
|
-
render() {
|
|
1803
|
-
return (h$1(HeroImageView, Object.assign({}, getProps(this)), h$1("slot", null)));
|
|
1804
|
-
}
|
|
1805
|
-
};
|
|
1806
|
-
|
|
1807
|
-
const SqmHookStoryContainer = class {
|
|
1808
|
-
constructor(hostRef) {
|
|
1809
|
-
registerInstance(this, hostRef);
|
|
1810
|
-
this.ignored = true;
|
|
1811
|
-
h(this);
|
|
1812
|
-
}
|
|
1813
|
-
disconnectedCallback() { }
|
|
1814
|
-
render() {
|
|
1815
|
-
const Story = this.hookStory;
|
|
1816
|
-
return h$1(Story, null);
|
|
1817
|
-
}
|
|
1818
|
-
};
|
|
1819
|
-
|
|
1820
|
-
const style$3 = {
|
|
1821
|
-
FormWrapper: {
|
|
1822
|
-
display: "flex",
|
|
1823
|
-
justifyContent: "flex-start",
|
|
1824
|
-
flexDirection: "column",
|
|
1825
|
-
},
|
|
1826
|
-
CheckboxContainer: {
|
|
1827
|
-
display: "flex",
|
|
1828
|
-
alignItems: "flex-start",
|
|
1829
|
-
justifyContent: "flex-start",
|
|
1830
|
-
flexDirection: "column",
|
|
1831
|
-
gap: "var(--sl-spacing-xx-small)",
|
|
1832
|
-
},
|
|
1833
|
-
TitleContainer: {
|
|
1834
|
-
display: "flex",
|
|
1835
|
-
flexDirection: "row",
|
|
1836
|
-
alignItems: "center",
|
|
1837
|
-
justifyContent: "flex-start",
|
|
1838
|
-
gap: "var(--sl-spacing-small)",
|
|
1839
|
-
},
|
|
1840
|
-
TextContainer: {
|
|
1841
|
-
display: "flex",
|
|
1842
|
-
justifyContent: "flex-start",
|
|
1843
|
-
flexDirection: "column",
|
|
1844
|
-
gap: "24px",
|
|
1845
|
-
paddingBottom: "16px",
|
|
1846
|
-
},
|
|
1847
|
-
BtnContainer: {
|
|
1848
|
-
paddingTop: "36px",
|
|
1849
|
-
display: "flex",
|
|
1850
|
-
gap: "8px",
|
|
1851
|
-
},
|
|
1852
|
-
ErrorText: {
|
|
1853
|
-
color: "var(--sl-color-danger-500)",
|
|
1854
|
-
marginTop: "10px",
|
|
1855
|
-
},
|
|
1856
|
-
DescriptionText: {
|
|
1857
|
-
color: "var(--sl-color-neutral-500)",
|
|
1858
|
-
},
|
|
1859
|
-
SecondaryBtn: {
|
|
1860
|
-
"&::part(base)": {
|
|
1861
|
-
color: "var(--sl-color-gray-800) !important",
|
|
1862
|
-
},
|
|
1863
|
-
},
|
|
1864
|
-
AlertContainer: {
|
|
1865
|
-
"&::part(base)": {
|
|
1866
|
-
backgroundColor: "var(--sl-color-red-100)",
|
|
1867
|
-
borderTop: "none",
|
|
1868
|
-
padding: "0 16px",
|
|
1869
|
-
},
|
|
1870
|
-
"& sl-icon::part(base)": {
|
|
1871
|
-
color: "var(--sl-color-danger-500)",
|
|
1872
|
-
},
|
|
1873
|
-
},
|
|
1874
|
-
PartnerAlertContainer: {
|
|
1875
|
-
"&::part(base)": {
|
|
1876
|
-
backgroundColor: "var(--sl-color-sky-100)",
|
|
1877
|
-
borderTop: "none",
|
|
1878
|
-
padding: "0 16px",
|
|
1879
|
-
},
|
|
1880
|
-
"& sl-icon::part(base)": {
|
|
1881
|
-
color: "var(--sl-color-blue-500)",
|
|
1882
|
-
},
|
|
1883
|
-
},
|
|
1884
|
-
};
|
|
1885
|
-
const sheet$3 = createStyleSheet(style$3);
|
|
1886
|
-
const styleString$3 = sheet$3.toString();
|
|
1887
|
-
const vanillaStyle$2 = `
|
|
1888
|
-
:host{
|
|
1889
|
-
display: block;
|
|
1890
|
-
}
|
|
1891
|
-
* {
|
|
1892
|
-
margin: 0;
|
|
1893
|
-
padding: 0;
|
|
1894
|
-
box-sizing: border-box;
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
|
-
p {
|
|
1898
|
-
line-height: 18px;
|
|
1899
|
-
color: var(--sl-color-gray-800);
|
|
1900
|
-
font-size: var(--sl-font-size-small);
|
|
1901
|
-
}
|
|
1902
|
-
|
|
1903
|
-
sl-checkbox::part(control) {
|
|
1904
|
-
border-radius: 50%;
|
|
1905
|
-
}
|
|
1906
|
-
`;
|
|
1907
|
-
const IndirectTaxFormView = (props) => {
|
|
1908
|
-
var _a;
|
|
1909
|
-
const { states, states: { formState }, callbacks, text, refs, slots, } = props;
|
|
1910
|
-
const { classes } = sheet$3;
|
|
1911
|
-
console.log(states, "states");
|
|
1912
|
-
return (h$1("sl-form", { class: classes.FormWrapper, "onSl-submit": callbacks.onSubmit, ref: (el) => (refs.formRef.current = el), novalidate: true },
|
|
1913
|
-
h$1("style", { type: "text/css" },
|
|
1914
|
-
styleString$3,
|
|
1915
|
-
vanillaStyle$2),
|
|
1916
|
-
h$1("div", { class: classes.TextContainer },
|
|
1917
|
-
h$1("div", null,
|
|
1918
|
-
h$1("p", null, text.formStep),
|
|
1919
|
-
h$1("h3", null, text.indirectTax)),
|
|
1920
|
-
h$1("p", null, text.indirectTaxDescription),
|
|
1921
|
-
((_a = formState.errors) === null || _a === void 0 ? void 0 : _a.general) && (h$1("sl-alert", { type: "warning", open: true, class: sheet$3.classes.AlertContainer },
|
|
1922
|
-
h$1("sl-icon", { slot: "icon", name: "exclamation-octagon" }),
|
|
1923
|
-
h$1("strong", null, text.error.generalTitle),
|
|
1924
|
-
h$1("br", null),
|
|
1925
|
-
text.error.generalDescription)),
|
|
1926
|
-
states.isPartner && (h$1("sl-alert", { type: "primary", open: true, class: sheet$3.classes.PartnerAlertContainer },
|
|
1927
|
-
h$1("sl-icon", { slot: "icon", name: "info-circle" }),
|
|
1928
|
-
h$1("strong", null, text.isPartnerAlertHeader),
|
|
1929
|
-
h$1("br", null),
|
|
1930
|
-
text.isPartnerAlertDescription)),
|
|
1931
|
-
h$1("div", null,
|
|
1932
|
-
h$1("h4", null, text.indirectTaxDetails),
|
|
1933
|
-
h$1("p", { class: classes.DescriptionText }, text.indirectTaxDetailsDescription))),
|
|
1934
|
-
states.loading ? (h$1("sl-spinner", { style: { fontSize: "50px", margin: "40px" } })) : (h$1("div", null,
|
|
1935
|
-
h$1("div", { class: classes.CheckboxContainer },
|
|
1936
|
-
h$1("div", { style: { display: "flex", flexDirection: "column" } },
|
|
1937
|
-
h$1("sl-checkbox", { exportparts: "label: input-label", checked: formState.checked === "hstCanada", onInput: () => callbacks.onChange("hstCanada"), disabled: states.disabled, id: "hstCanada", name: "/hstCanada" }, text.hstCanada),
|
|
1938
|
-
slots.registeredInCanadaDetailsSlot,
|
|
1939
|
-
h$1("sl-checkbox", { exportparts: "label: input-label", checked: formState.checked === "otherRegion", onInput: () => callbacks.onChange("otherRegion"), disabled: states.disabled, id: "otherRegion", name: "/otherRegion" }, text.otherRegion),
|
|
1940
|
-
slots.registeredInDifferentCountryDetailsSlot,
|
|
1941
|
-
h$1("sl-checkbox", { exportparts: "label: input-label", checked: formState.checked === "notRegistered", onInput: () => callbacks.onChange("notRegistered"), disabled: states.disabled, id: "notRegistered", name: "/notRegistered" }, text.notRegistered))),
|
|
1942
|
-
h$1("div", { class: classes.BtnContainer },
|
|
1943
|
-
h$1("sl-button", { type: "primary", disabled: states.disabled, submit: true, exportparts: "base: primarybutton-base" }, text.submitButton),
|
|
1944
|
-
h$1("sl-button", { class: classes.SecondaryBtn, type: "text", disabled: states.disabled, onClick: () => {
|
|
1945
|
-
callbacks.onBack();
|
|
1946
|
-
}, exportparts: "base: secondarybutton-base" }, text.backButton))))));
|
|
1947
|
-
};
|
|
1948
|
-
|
|
1949
|
-
function getOption(user) {
|
|
1950
|
-
if (!user)
|
|
1951
|
-
return;
|
|
1952
|
-
const { countryCode, customFields } = user;
|
|
1953
|
-
if ((customFields === null || customFields === void 0 ? void 0 : customFields.__taxProvince) || (customFields === null || customFields === void 0 ? void 0 : customFields.__taxIndirectTaxNumber)) {
|
|
1954
|
-
return "hstCanada";
|
|
1955
|
-
}
|
|
1956
|
-
else if ((customFields === null || customFields === void 0 ? void 0 : customFields.__taxCountry) || (customFields === null || customFields === void 0 ? void 0 : customFields.__taxVatNumber)) {
|
|
1957
|
-
return "otherRegion";
|
|
1958
|
-
}
|
|
1959
|
-
else {
|
|
1960
|
-
if (countryCode === "CA") {
|
|
1961
|
-
return "hstCanada";
|
|
1962
|
-
// TODO: Check against list of countries from backend
|
|
1963
|
-
}
|
|
1964
|
-
else if (countryCode) {
|
|
1965
|
-
return "otherRegion";
|
|
1966
|
-
}
|
|
1967
|
-
else {
|
|
1968
|
-
return "notRegistered";
|
|
1969
|
-
}
|
|
1970
|
-
}
|
|
1971
|
-
}
|
|
1972
|
-
const UPSERT_USER$3 = dist.gql `
|
|
1973
|
-
mutation ($userInput: UserInput!) {
|
|
1974
|
-
upsertUser(userInput: $userInput) {
|
|
1975
|
-
firstName
|
|
1976
|
-
lastName
|
|
1977
|
-
}
|
|
1978
|
-
}
|
|
1979
|
-
`;
|
|
1980
|
-
function useIndirectTaxForm(props) {
|
|
1981
|
-
const formRef = useRef(null);
|
|
1982
|
-
const [loading, setLoading] = useState(false);
|
|
1983
|
-
const [formState, setFormState] = useState({});
|
|
1984
|
-
const [upsertUser] = Fe(UPSERT_USER$3);
|
|
1985
|
-
const [_, setStep] = useParent(TAX_CONTEXT_NAMESPACE);
|
|
1986
|
-
const user = H();
|
|
1987
|
-
const { data: userData, refetch } = useParentQueryValue(USER_QUERY_NAMESPACE);
|
|
1988
|
-
const { data: _countries, loading: countriesLoading } = useParentQueryValue(COUNTRIES_NAMESPACE);
|
|
1989
|
-
const [option, setOption] = useState(null);
|
|
1990
|
-
const [errors, setErrors] = useState({});
|
|
1991
|
-
useEffect(() => {
|
|
1992
|
-
var _a, _b, _c, _d;
|
|
1993
|
-
const user = userData === null || userData === void 0 ? void 0 : userData.user;
|
|
1994
|
-
if (!user)
|
|
1995
|
-
return;
|
|
1996
|
-
const _option = getOption(user);
|
|
1997
|
-
setOption(_option);
|
|
1998
|
-
setFormState({
|
|
1999
|
-
province: (_a = user.customFields) === null || _a === void 0 ? void 0 : _a.__taxProvince,
|
|
2000
|
-
vatNumber: (_b = user.customFields) === null || _b === void 0 ? void 0 : _b.__taxVatNumber,
|
|
2001
|
-
countryCode: ((_c = user.customFields) === null || _c === void 0 ? void 0 : _c.__taxCountry) || user.countryCode,
|
|
2002
|
-
indirectTaxNumber: (_d = user.customFields) === null || _d === void 0 ? void 0 : _d.__taxIndirectTaxNumber,
|
|
2003
|
-
});
|
|
2004
|
-
}, [userData]);
|
|
2005
|
-
const countries = _countries === null || _countries === void 0 ? void 0 : _countries.countries.data;
|
|
2006
|
-
const onSubmit = async (event) => {
|
|
2007
|
-
var _a;
|
|
2008
|
-
if (!option) {
|
|
2009
|
-
setErrors({ taxDetails: true });
|
|
2010
|
-
return;
|
|
2011
|
-
}
|
|
2012
|
-
let formData = { taxOption: option };
|
|
2013
|
-
let validationErrors = {};
|
|
2014
|
-
const controls = event.target.getFormControls();
|
|
2015
|
-
const optionMapping = {
|
|
2016
|
-
hstCanada: ["province", "indirectTaxNumber"],
|
|
2017
|
-
otherRegion: ["selectedRegion", "vatNumber"],
|
|
2018
|
-
notRegistered: [],
|
|
2019
|
-
};
|
|
2020
|
-
const relevantFields = optionMapping[option];
|
|
2021
|
-
controls.forEach((control) => {
|
|
2022
|
-
if (!control.name || !control.id)
|
|
2023
|
-
return;
|
|
2024
|
-
if (!relevantFields.includes(control.id))
|
|
2025
|
-
return;
|
|
2026
|
-
const key = control.name;
|
|
2027
|
-
const value = control.value;
|
|
2028
|
-
jsonpointer.set(formData, key, value);
|
|
2029
|
-
if (control.required && !value) {
|
|
2030
|
-
jsonpointer.set(validationErrors, key, true);
|
|
2031
|
-
}
|
|
2032
|
-
});
|
|
2033
|
-
if (Object.keys(validationErrors).length) {
|
|
2034
|
-
setErrors(validationErrors);
|
|
2035
|
-
return;
|
|
2036
|
-
}
|
|
2037
|
-
setLoading(true);
|
|
2038
|
-
try {
|
|
2039
|
-
let defaultDocumentType;
|
|
2040
|
-
if (((_a = userData === null || userData === void 0 ? void 0 : userData.user) === null || _a === void 0 ? void 0 : _a.countryCode) === "US")
|
|
2041
|
-
defaultDocumentType = "W9";
|
|
2042
|
-
if (formData.selectedRegion === "US") {
|
|
2043
|
-
if ((userData === null || userData === void 0 ? void 0 : userData.user.customFields.participantType) ===
|
|
2044
|
-
"individualParticipant")
|
|
2045
|
-
defaultDocumentType = "W8-BEN";
|
|
2046
|
-
else if ((userData === null || userData === void 0 ? void 0 : userData.user.customFields.participantType) === "businessEntity")
|
|
2047
|
-
defaultDocumentType = "W8-BEN-E";
|
|
2048
|
-
}
|
|
2049
|
-
const customFields = {
|
|
2050
|
-
__taxOption: option,
|
|
2051
|
-
__taxDocumentType: defaultDocumentType || null,
|
|
2052
|
-
__taxProvince: formData.province || null,
|
|
2053
|
-
__taxCountry: formData.selectedRegion || null,
|
|
2054
|
-
__taxVatNumber: formData.vatNumber || null,
|
|
2055
|
-
__taxIndirectTaxNumber: formData.indirectTaxNumber || null,
|
|
2056
|
-
};
|
|
2057
|
-
console.log({ formData, customFields });
|
|
2058
|
-
// Backend request
|
|
2059
|
-
await upsertUser({
|
|
2060
|
-
userInput: {
|
|
2061
|
-
id: user.id,
|
|
2062
|
-
accountId: user.accountId,
|
|
2063
|
-
customFields,
|
|
2064
|
-
},
|
|
2065
|
-
});
|
|
2066
|
-
await refetch();
|
|
2067
|
-
if (defaultDocumentType) {
|
|
2068
|
-
setStep(`/3/${defaultDocumentType}`);
|
|
2069
|
-
}
|
|
2070
|
-
else {
|
|
2071
|
-
setStep("/submitted");
|
|
2072
|
-
}
|
|
2073
|
-
}
|
|
2074
|
-
catch (e) {
|
|
2075
|
-
setErrors({ general: true });
|
|
2076
|
-
}
|
|
2077
|
-
finally {
|
|
2078
|
-
setLoading(false);
|
|
2079
|
-
}
|
|
2080
|
-
};
|
|
2081
|
-
const onBack = () => {
|
|
2082
|
-
setStep("/1");
|
|
2083
|
-
};
|
|
2084
|
-
return {
|
|
2085
|
-
states: {
|
|
2086
|
-
disabled: loading || countriesLoading,
|
|
2087
|
-
loading: loading || countriesLoading,
|
|
2088
|
-
//AL: TODO hook up if user is partner
|
|
2089
|
-
isPartner: false,
|
|
2090
|
-
errors,
|
|
2091
|
-
formState: {
|
|
2092
|
-
checked: option,
|
|
2093
|
-
},
|
|
2094
|
-
},
|
|
2095
|
-
callbacks: {
|
|
2096
|
-
onBack,
|
|
2097
|
-
onSubmit,
|
|
2098
|
-
onChange: setOption,
|
|
2099
|
-
},
|
|
2100
|
-
data: {
|
|
2101
|
-
countries,
|
|
2102
|
-
},
|
|
2103
|
-
text: props.getTextProps(),
|
|
2104
|
-
refs: {
|
|
2105
|
-
formRef,
|
|
2106
|
-
},
|
|
2107
|
-
slotProps: {
|
|
2108
|
-
formState: { ...formState, errors },
|
|
2109
|
-
},
|
|
2110
|
-
};
|
|
2111
|
-
}
|
|
2112
|
-
|
|
2113
|
-
const IndirectTaxForm = class {
|
|
2114
|
-
constructor(hostRef) {
|
|
2115
|
-
registerInstance(this, hostRef);
|
|
2116
|
-
/**
|
|
2117
|
-
* Sub text shown at the top of the page, used to show the current step of the tax form.
|
|
2118
|
-
* @uiName Indirect tax form step text
|
|
2119
|
-
*/
|
|
2120
|
-
this.formStep = "Step 2 of 4";
|
|
2121
|
-
/**
|
|
2122
|
-
* Heading text shown at the top of the page
|
|
2123
|
-
* @uiName Indirect tax heading text
|
|
2124
|
-
*/
|
|
2125
|
-
this.indirectTax = "Indirect Tax";
|
|
2126
|
-
/**
|
|
2127
|
-
* Subtext shown at the top of the page
|
|
2128
|
-
* @uiName Indirect tax sub text
|
|
2129
|
-
*/
|
|
2130
|
-
this.indirectTaxDescription = "Indirect Taxes (e.g. VAT, HST, GST) are transactional based taxes that are required to be levied by service providers by most tax authorities.";
|
|
2131
|
-
/**
|
|
2132
|
-
* Heading text shown above the tax details radio buttons
|
|
2133
|
-
* @uiName Indirect tax details heading
|
|
2134
|
-
*/
|
|
2135
|
-
this.indirectTaxDetails = "Indirect Tax Details";
|
|
2136
|
-
/**
|
|
2137
|
-
* Sub text shown above the tax details radio buttons
|
|
2138
|
-
* @uiName Indirect tax details sub text
|
|
2139
|
-
*/
|
|
2140
|
-
this.indirectTaxDetailsDescription = "Not sure if you are registered for indirect tax? Contact our Support team to find out more.";
|
|
2141
|
-
/**
|
|
2142
|
-
* Label text for the HST Canada radio button
|
|
2143
|
-
* @uiName HST Canada radio button label
|
|
2144
|
-
*/
|
|
2145
|
-
this.hstCanada = "I am registered for HST in Canada";
|
|
2146
|
-
/**
|
|
2147
|
-
* Label text for the other region radio button
|
|
2148
|
-
* @uiName Other region radio button label
|
|
2149
|
-
*/
|
|
2150
|
-
this.otherRegion = "I am registered for Indirect Tax in a different Country / Region";
|
|
2151
|
-
/**
|
|
2152
|
-
* Label text for the not registered radio button
|
|
2153
|
-
* @uiName Not registered radio button label
|
|
2154
|
-
*/
|
|
2155
|
-
this.notRegistered = "I am not registered for Indirect Tax";
|
|
2156
|
-
/**
|
|
2157
|
-
* Label text for the Selected Region select input
|
|
2158
|
-
* @uiName Selected region select input label
|
|
2159
|
-
*/
|
|
2160
|
-
this.selectedRegion = "Country / Region of Indirect Tax";
|
|
2161
|
-
/**
|
|
2162
|
-
* Label text for the VAT Number input
|
|
2163
|
-
* @uiName VAT Number input label
|
|
2164
|
-
*/
|
|
2165
|
-
this.vatNumber = "VAT number";
|
|
2166
|
-
/**
|
|
2167
|
-
* Label text for the Province select input
|
|
2168
|
-
* @uiName Province select input label
|
|
2169
|
-
*/
|
|
2170
|
-
this.province = "Province";
|
|
2171
|
-
/**
|
|
2172
|
-
* Label text for the Indirect Tax Number input
|
|
2173
|
-
* @uiName Indirect Tax Number input label
|
|
2174
|
-
*/
|
|
2175
|
-
this.indirectTaxNumber = "Indirect Tax";
|
|
2176
|
-
/**
|
|
2177
|
-
* Alert header text shown in alert if user is already a registered partner
|
|
2178
|
-
* @uiName Participant is partner title
|
|
2179
|
-
*/
|
|
2180
|
-
this.isPartnerAlertHeader = "An account with this email already exists with our referral program provider, impact.com";
|
|
2181
|
-
/**
|
|
2182
|
-
* Alert description text shown in alert if user is already a registered partner
|
|
2183
|
-
* @uiName Participant is partner description
|
|
2184
|
-
*/
|
|
2185
|
-
this.isPartnerAlertDescription = "If you don’t recognize this referral program provider or believe this is a mistake, please contact Support or sign up for this referral program with a different email.";
|
|
2186
|
-
/**
|
|
2187
|
-
* Text shown inside of submit button
|
|
2188
|
-
* @uiName Submit button text
|
|
2189
|
-
*/
|
|
2190
|
-
this.submitButton = "Continue";
|
|
2191
|
-
/**
|
|
2192
|
-
* Text shown inside of back button
|
|
2193
|
-
* @uiName Back button text
|
|
2194
|
-
*/
|
|
2195
|
-
this.backButton = "Back";
|
|
2196
|
-
/**
|
|
2197
|
-
* Error text shown below the tax details radio buttons
|
|
2198
|
-
* @uiName Indirect tax details error text
|
|
2199
|
-
*/
|
|
2200
|
-
this.taxDetailsError = "This field is required";
|
|
2201
|
-
/**
|
|
2202
|
-
* The title for error message shown at the top of the page in an error banner
|
|
2203
|
-
*
|
|
2204
|
-
* @uiName General error title
|
|
2205
|
-
*/
|
|
2206
|
-
this.generalErrorTitle = "There was a problem submitting your information";
|
|
2207
|
-
/**
|
|
2208
|
-
* The error message shown at the top of the page in an error banner
|
|
2209
|
-
*
|
|
2210
|
-
* @uiName General error text
|
|
2211
|
-
*/
|
|
2212
|
-
this.generalErrorDescription = "Please review your information and try again. If this problem continues, contact Support.";
|
|
2213
|
-
/**
|
|
2214
|
-
* Error text shown below the Selected Region select input
|
|
2215
|
-
* @uiName Selected Region error text
|
|
2216
|
-
*/
|
|
2217
|
-
this.selectedRegionError = "Country is required";
|
|
2218
|
-
/**
|
|
2219
|
-
* Error text shown below the VAT Number input
|
|
2220
|
-
* @uiName VAT Number error text
|
|
2221
|
-
*/
|
|
2222
|
-
this.vatNumberError = "VAT number is required";
|
|
2223
|
-
/**
|
|
2224
|
-
* Error text shown below the Selected Region select input
|
|
2225
|
-
* @uiName Province error text
|
|
1097
|
+
* @uiType string
|
|
1098
|
+
* @uiEnum ["none", "xxx-small", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large", "xxxx-large"]
|
|
1099
|
+
* @uiEnumNames ["None", "XXX-Small", "XX-Small", "X-Small", "Small", "Medium", "Large", "X-Large", "XX-Large", "XXX-Large", "XXXX-Large"]
|
|
2226
1100
|
*/
|
|
2227
|
-
this.
|
|
1101
|
+
this.paddingText = "xxxx-large";
|
|
2228
1102
|
/**
|
|
2229
|
-
*
|
|
2230
|
-
* @
|
|
1103
|
+
* @uiName Image padding
|
|
1104
|
+
* @uiType string
|
|
1105
|
+
* @uiEnum ["none", "xxx-small", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large", "xxxx-large"]
|
|
1106
|
+
* @uiEnumNames ["None", "XXX-Small", "XX-Small", "X-Small", "Small", "Medium", "Large", "X-Large", "XX-Large", "XXX-Large", "XXXX-Large"]
|
|
2231
1107
|
*/
|
|
2232
|
-
this.
|
|
1108
|
+
this.paddingImage = "none";
|
|
2233
1109
|
h(this);
|
|
2234
1110
|
}
|
|
2235
1111
|
disconnectedCallback() { }
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
return {
|
|
2239
|
-
...props,
|
|
2240
|
-
error: {
|
|
2241
|
-
generalTitle: props.generalErrorTitle,
|
|
2242
|
-
generalDescription: props.generalErrorDescription,
|
|
2243
|
-
taxDetails: props.taxDetailsError,
|
|
2244
|
-
},
|
|
2245
|
-
slotText: {
|
|
2246
|
-
selectedRegion: props.selectedRegion,
|
|
2247
|
-
vatNumber: props.vatNumber,
|
|
2248
|
-
province: props.province,
|
|
2249
|
-
indirectTaxNumber: props.indirectTaxNumber,
|
|
2250
|
-
error: {
|
|
2251
|
-
selectedRegion: props.selectedRegionError,
|
|
2252
|
-
vatNumber: props.vatNumberError,
|
|
2253
|
-
province: props.provinceError,
|
|
2254
|
-
indirectTaxNumber: props.indirectTaxNumberError,
|
|
2255
|
-
},
|
|
2256
|
-
},
|
|
2257
|
-
};
|
|
1112
|
+
render() {
|
|
1113
|
+
return (h$1(HeroImageView, Object.assign({}, getProps(this)), h$1("slot", null)));
|
|
2258
1114
|
}
|
|
1115
|
+
};
|
|
1116
|
+
|
|
1117
|
+
const SqmHookStoryContainer = class {
|
|
1118
|
+
constructor(hostRef) {
|
|
1119
|
+
registerInstance(this, hostRef);
|
|
1120
|
+
this.ignored = true;
|
|
1121
|
+
h(this);
|
|
1122
|
+
}
|
|
1123
|
+
disconnectedCallback() { }
|
|
2259
1124
|
render() {
|
|
2260
|
-
const
|
|
2261
|
-
|
|
2262
|
-
: useIndirectTaxForm(this);
|
|
2263
|
-
const registeredInCanadaDetailsSlot = (h$1(IndirectDetailsSlotView, { states: {
|
|
2264
|
-
formState: props.slotProps.formState,
|
|
2265
|
-
hide: props.states.formState.checked !== "hstCanada",
|
|
2266
|
-
loading: props.states.loading,
|
|
2267
|
-
}, data: { countries: props.data.countries }, text: props.text.slotText }));
|
|
2268
|
-
const registeredInDifferentCountryDetailsSlot = (h$1(OtherRegionSlotView, { states: {
|
|
2269
|
-
hide: props.states.formState.checked !== "otherRegion",
|
|
2270
|
-
formState: props.slotProps.formState,
|
|
2271
|
-
loading: props.states.loading,
|
|
2272
|
-
}, data: { countries: props.data.countries }, text: props.text.slotText }));
|
|
2273
|
-
return (h$1(Host, null, h$1(IndirectTaxFormView, { callbacks: props.callbacks, states: props.states, refs: props.refs, text: props.text, slots: {
|
|
2274
|
-
registeredInCanadaDetailsSlot,
|
|
2275
|
-
registeredInDifferentCountryDetailsSlot,
|
|
2276
|
-
} })));
|
|
1125
|
+
const Story = this.hookStory;
|
|
1126
|
+
return h$1(Story, null);
|
|
2277
1127
|
}
|
|
2278
1128
|
};
|
|
2279
|
-
function useDemoIndirectTaxForm(props) {
|
|
2280
|
-
const [option, setOption] = useState(null);
|
|
2281
|
-
return cjs({
|
|
2282
|
-
states: {
|
|
2283
|
-
disabled: false,
|
|
2284
|
-
loading: false,
|
|
2285
|
-
//AL: TODO hook up if user is partner
|
|
2286
|
-
isPartner: false,
|
|
2287
|
-
errors: {},
|
|
2288
|
-
formState: {
|
|
2289
|
-
checked: option,
|
|
2290
|
-
},
|
|
2291
|
-
},
|
|
2292
|
-
callbacks: {
|
|
2293
|
-
onBack: () => { },
|
|
2294
|
-
onSubmit: async () => { },
|
|
2295
|
-
onChange: setOption,
|
|
2296
|
-
},
|
|
2297
|
-
data: {
|
|
2298
|
-
countries: [{ displayName: "United Kingdom", countryCode: "UK" }],
|
|
2299
|
-
},
|
|
2300
|
-
text: props.getTextProps(),
|
|
2301
|
-
refs: {
|
|
2302
|
-
formRef: { current: null },
|
|
2303
|
-
},
|
|
2304
|
-
slotProps: {
|
|
2305
|
-
formState: {
|
|
2306
|
-
errors: {},
|
|
2307
|
-
},
|
|
2308
|
-
},
|
|
2309
|
-
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
2310
|
-
}
|
|
2311
1129
|
|
|
2312
1130
|
function useInputField() {
|
|
2313
1131
|
const registrationFormState = d(REGISTRATION_FORM_STATE_CONTEXT);
|
|
@@ -2601,28 +1419,28 @@ function useLeaderboardDemo(props) {
|
|
|
2601
1419
|
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
2602
1420
|
}
|
|
2603
1421
|
|
|
2604
|
-
const style$
|
|
1422
|
+
const style$1 = {
|
|
2605
1423
|
Container: { display: "contents" },
|
|
2606
1424
|
Link: {
|
|
2607
1425
|
textDecoration: "none",
|
|
2608
1426
|
color: "inherit",
|
|
2609
1427
|
},
|
|
2610
1428
|
};
|
|
2611
|
-
const vanillaStyle
|
|
1429
|
+
const vanillaStyle = `
|
|
2612
1430
|
:host{
|
|
2613
1431
|
display: inline;
|
|
2614
1432
|
}
|
|
2615
1433
|
`;
|
|
2616
|
-
const sheet$
|
|
2617
|
-
const styleString$
|
|
1434
|
+
const sheet$1 = createStyleSheet(style$1);
|
|
1435
|
+
const styleString$1 = sheet$1.toString();
|
|
2618
1436
|
function LinkButtonView(props) {
|
|
2619
1437
|
const { onClick, buttonText } = props;
|
|
2620
|
-
return (h$1("span", { class: sheet$
|
|
1438
|
+
return (h$1("span", { class: sheet$1.classes.Container, part: "sqm-base" },
|
|
2621
1439
|
h$1("style", { type: "text/css" },
|
|
2622
|
-
styleString$
|
|
2623
|
-
vanillaStyle
|
|
1440
|
+
styleString$1,
|
|
1441
|
+
vanillaStyle),
|
|
2624
1442
|
h$1("sl-button", { type: "primary", exportparts: "base: primarybutton-base" },
|
|
2625
|
-
h$1("a", { onClick: onClick, class: sheet$
|
|
1443
|
+
h$1("a", { onClick: onClick, class: sheet$1.classes.Link, part: "sqm-link" }, buttonText))));
|
|
2626
1444
|
}
|
|
2627
1445
|
|
|
2628
1446
|
const LinkButton = class {
|
|
@@ -3571,7 +2389,7 @@ const ProgramMenu = class {
|
|
|
3571
2389
|
}
|
|
3572
2390
|
};
|
|
3573
2391
|
|
|
3574
|
-
const style$
|
|
2392
|
+
const style$2 = {
|
|
3575
2393
|
Container: {
|
|
3576
2394
|
borderRadius: "var(--sl-border-radius-large)",
|
|
3577
2395
|
color: "var(--sl-color-neutral-900)",
|
|
@@ -3599,15 +2417,15 @@ const style$5 = {
|
|
|
3599
2417
|
},
|
|
3600
2418
|
},
|
|
3601
2419
|
};
|
|
3602
|
-
const sheet$
|
|
3603
|
-
const styleString$
|
|
3604
|
-
const vanillaStyle$
|
|
2420
|
+
const sheet$2 = createStyleSheet(style$2);
|
|
2421
|
+
const styleString$2 = sheet$2.toString();
|
|
2422
|
+
const vanillaStyle$1 = `
|
|
3605
2423
|
:host{
|
|
3606
2424
|
display: block;
|
|
3607
2425
|
}
|
|
3608
2426
|
`;
|
|
3609
2427
|
function ReferralCardView(props) {
|
|
3610
|
-
return (h$1("div", { part: "sqm-base", class: sheet$
|
|
2428
|
+
return (h$1("div", { part: "sqm-base", class: sheet$2.classes.Container, style: {
|
|
3611
2429
|
border: `${props.hideBorder ? "none" : "1px solid var(--sl-color-neutral-300)"}`,
|
|
3612
2430
|
"padding-top": `var(--sl-spacing-${props.paddingTop})`,
|
|
3613
2431
|
"padding-right": `var(--sl-spacing-${props.paddingRight})`,
|
|
@@ -3618,15 +2436,15 @@ function ReferralCardView(props) {
|
|
|
3618
2436
|
margin: `${props.limitWidth ? "auto" : "none"}`,
|
|
3619
2437
|
} },
|
|
3620
2438
|
h$1("style", { type: "text/css" },
|
|
3621
|
-
styleString$
|
|
3622
|
-
vanillaStyle$
|
|
3623
|
-
props.hasHeader && (h$1("div", { class: sheet$
|
|
3624
|
-
h$1("div", { part: "sqm-column-container", class: sheet$
|
|
2439
|
+
styleString$2,
|
|
2440
|
+
vanillaStyle$1),
|
|
2441
|
+
props.hasHeader && (h$1("div", { class: sheet$2.classes.EndContainer }, props.slots.header)),
|
|
2442
|
+
h$1("div", { part: "sqm-column-container", class: sheet$2.classes.ColumnContainer, style: {
|
|
3625
2443
|
alignItems: props.verticalAlignment,
|
|
3626
2444
|
} },
|
|
3627
2445
|
props.slots.left,
|
|
3628
2446
|
props.slots.right),
|
|
3629
|
-
props.hasFooter && (h$1("div", { class: sheet$
|
|
2447
|
+
props.hasFooter && (h$1("div", { class: sheet$2.classes.EndContainer }, props.slots.footer))));
|
|
3630
2448
|
}
|
|
3631
2449
|
|
|
3632
2450
|
const ReferralCard = class {
|
|
@@ -5249,584 +4067,148 @@ function useTaskCard(props) {
|
|
|
5249
4067
|
}
|
|
5250
4068
|
function onClick() {
|
|
5251
4069
|
props.eventKey ? sendEvent(props.eventKey) : openLink();
|
|
5252
|
-
}
|
|
5253
|
-
return {
|
|
5254
|
-
states: { loadingEvent, locale },
|
|
5255
|
-
callbacks: { sendEvent, onClick },
|
|
5256
|
-
};
|
|
5257
|
-
}
|
|
5258
|
-
|
|
5259
|
-
const TaskCard = class {
|
|
5260
|
-
constructor(hostRef) {
|
|
5261
|
-
registerInstance(this, hostRef);
|
|
5262
|
-
this.ignored = true;
|
|
5263
|
-
/**
|
|
5264
|
-
* @uiName Reward amount
|
|
5265
|
-
* @uiGroup Reward
|
|
5266
|
-
*/
|
|
5267
|
-
this.rewardAmount = "0";
|
|
5268
|
-
/**
|
|
5269
|
-
* @uiName Reward unit
|
|
5270
|
-
* @uiGroup Reward
|
|
5271
|
-
*/
|
|
5272
|
-
this.rewardUnit = "Points";
|
|
5273
|
-
/**
|
|
5274
|
-
* @uiName Title
|
|
5275
|
-
* @uiGroup Task
|
|
5276
|
-
*/
|
|
5277
|
-
this.cardTitle = "Title Text";
|
|
5278
|
-
/**
|
|
5279
|
-
* @uiName Description
|
|
5280
|
-
* @uiGroup Task
|
|
5281
|
-
*/
|
|
5282
|
-
this.description = "";
|
|
5283
|
-
/**
|
|
5284
|
-
* @uiName Goal repeatable
|
|
5285
|
-
* @uiGroup Goal
|
|
5286
|
-
* @default
|
|
5287
|
-
*/
|
|
5288
|
-
this.repeatable = false;
|
|
5289
|
-
/**
|
|
5290
|
-
* The number of times a task can be completed when repeatable. Use zero for no limit (the default).
|
|
5291
|
-
*
|
|
5292
|
-
* @uiName Repeat amount
|
|
5293
|
-
* @uiGroup Reward
|
|
5294
|
-
*/
|
|
5295
|
-
this.finite = 0;
|
|
5296
|
-
/**
|
|
5297
|
-
* @uiName Show progress bar
|
|
5298
|
-
* @uiGroup Goal
|
|
5299
|
-
* @default
|
|
5300
|
-
*/
|
|
5301
|
-
this.showProgressBar = false;
|
|
5302
|
-
/**
|
|
5303
|
-
* Sets the goal for users progress to know when a task has been completed. If repeatable is checked, repeatable goals is an increment of this.
|
|
5304
|
-
*
|
|
5305
|
-
* @uiName Goal completion number
|
|
5306
|
-
* @uiGroup Goal
|
|
5307
|
-
*/
|
|
5308
|
-
this.goal = 1;
|
|
5309
|
-
/**
|
|
5310
|
-
* @uiName Progress bar steps
|
|
5311
|
-
* @uiGroup Goal
|
|
5312
|
-
* @default
|
|
5313
|
-
*/
|
|
5314
|
-
this.steps = false;
|
|
5315
|
-
/**
|
|
5316
|
-
* The unit displayed to the right of steps and progress numbers on the progress bar. Ex: $ for dollars
|
|
5317
|
-
*
|
|
5318
|
-
* @uiName Progress bar unit
|
|
5319
|
-
* @uiGroup Goal
|
|
5320
|
-
*/
|
|
5321
|
-
this.progressBarUnit = "";
|
|
5322
|
-
/**
|
|
5323
|
-
* Displayed when a user views a task card after the reward duration interval.
|
|
5324
|
-
*
|
|
5325
|
-
* @uiName Expiry date message
|
|
5326
|
-
* @uiGroup Task
|
|
5327
|
-
*/
|
|
5328
|
-
this.expiryMessage = "Ends {endDate}";
|
|
5329
|
-
/**
|
|
5330
|
-
* Shown to users before the start of the task duration.
|
|
5331
|
-
*
|
|
5332
|
-
* @uiName Start date message
|
|
5333
|
-
* @uiGroup Task
|
|
5334
|
-
*/
|
|
5335
|
-
this.startsOnMessage = "Starts {startDate}";
|
|
5336
|
-
/**
|
|
5337
|
-
* Shown to users after the end of the task duration.
|
|
5338
|
-
*
|
|
5339
|
-
* @uiName Ended date message
|
|
5340
|
-
* @uiGroup Task
|
|
5341
|
-
*/
|
|
5342
|
-
this.endedMessage = "Ended {endDate}";
|
|
5343
|
-
/**
|
|
5344
|
-
* Displays the amount of times that a user has completed a repeatable task.
|
|
5345
|
-
*
|
|
5346
|
-
* @uiName Completed count text
|
|
5347
|
-
* @uiGroup Task
|
|
5348
|
-
* @uiWidget textArea
|
|
5349
|
-
*/
|
|
5350
|
-
this.completedText = "Completed {finite, select, 0 {{count, plural, =1 {{count} time} other {{count} times}}} other {{count}/{finite} times}}";
|
|
5351
|
-
/**
|
|
5352
|
-
* @uiName Button text
|
|
5353
|
-
* @uiGroup Button
|
|
5354
|
-
*/
|
|
5355
|
-
this.buttonText = "Complete Action";
|
|
5356
|
-
/**
|
|
5357
|
-
* Button link opens in new tab
|
|
5358
|
-
* @uiName Open in new tab
|
|
5359
|
-
* @uiGroup Button
|
|
5360
|
-
* @default
|
|
5361
|
-
*/
|
|
5362
|
-
this.openNewTab = false;
|
|
5363
|
-
/**
|
|
5364
|
-
* @uiName Hide CTA button
|
|
5365
|
-
* @uiGroup Button
|
|
5366
|
-
*/
|
|
5367
|
-
this.hideButton = false;
|
|
5368
|
-
h(this);
|
|
5369
|
-
}
|
|
5370
|
-
disconnectedCallback() { }
|
|
5371
|
-
render() {
|
|
5372
|
-
const { props } = isDemo()
|
|
5373
|
-
? useDemoBigStat(this)
|
|
5374
|
-
: useBigStat({ ...getProps(this), programId: this.programId });
|
|
5375
|
-
const { value, loading } = props;
|
|
5376
|
-
const { states, callbacks } = isDemo()
|
|
5377
|
-
? useTaskCardDemo(this)
|
|
5378
|
-
: useTaskCard(this);
|
|
5379
|
-
return (h$1(TaskCardView, { callbacks: callbacks, states: {
|
|
5380
|
-
loading,
|
|
5381
|
-
loadingEvent: states.loadingEvent,
|
|
5382
|
-
progress: value,
|
|
5383
|
-
locale: states.locale,
|
|
5384
|
-
}, content: { ...getProps(this) } }));
|
|
5385
|
-
}
|
|
5386
|
-
};
|
|
5387
|
-
function useTaskCardDemo(props) {
|
|
5388
|
-
return cjs({
|
|
5389
|
-
states: { loadingEvent: false, locale: "en" },
|
|
5390
|
-
callbacks: {
|
|
5391
|
-
sendEvent: (event) => console.log(event),
|
|
5392
|
-
onClick: () => console.log("clicked"),
|
|
5393
|
-
},
|
|
5394
|
-
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
5395
|
-
}
|
|
5396
|
-
|
|
5397
|
-
const style$6 = {
|
|
5398
|
-
WarningAlertContainer: {
|
|
5399
|
-
"&::part(base)": {
|
|
5400
|
-
backgroundColor: "var(--sl-color-red-100)",
|
|
5401
|
-
borderTop: "none",
|
|
5402
|
-
},
|
|
5403
|
-
},
|
|
5404
|
-
ExpiringSoonAlertContainer: {
|
|
5405
|
-
"&::part(base)": {
|
|
5406
|
-
backgroundColor: "var(--sl-color-yellow-100)",
|
|
5407
|
-
borderTop: "none",
|
|
5408
|
-
},
|
|
5409
|
-
},
|
|
5410
|
-
BankingInformationContainer: {
|
|
5411
|
-
maxWidth: "700px",
|
|
5412
|
-
},
|
|
5413
|
-
TaxDocumentsContainer: {
|
|
5414
|
-
marginTop: "var(--sl-spacing-xx-large)",
|
|
5415
|
-
borderTop: "1px solid var(--sl-color-neutral-200)",
|
|
5416
|
-
},
|
|
5417
|
-
TaxDocumentsHeaderContainer: {
|
|
5418
|
-
marginTop: "var(--sl-spacing-x-large)",
|
|
5419
|
-
},
|
|
5420
|
-
StatusContainer: {
|
|
5421
|
-
display: "flex",
|
|
5422
|
-
flexDirection: "column",
|
|
5423
|
-
gap: "var(--sl-spacing-x-small)",
|
|
5424
|
-
"& h4": {
|
|
5425
|
-
margin: "0",
|
|
5426
|
-
},
|
|
5427
|
-
"& p": {
|
|
5428
|
-
margin: "0",
|
|
5429
|
-
},
|
|
5430
|
-
},
|
|
5431
|
-
TaxFormDetailsContainer: {
|
|
5432
|
-
display: "flex",
|
|
5433
|
-
gap: "var(--sl-spacing-small)",
|
|
5434
|
-
alignItems: "baseline",
|
|
5435
|
-
flexFlow: "row wrap",
|
|
5436
|
-
},
|
|
5437
|
-
BadgeContainer: {
|
|
5438
|
-
"&::part(base)": {
|
|
5439
|
-
padding: "var(--sl-spacing-x-small)",
|
|
5440
|
-
},
|
|
5441
|
-
},
|
|
5442
|
-
NewFormButton: {
|
|
5443
|
-
marginTop: "var(--sl-spacing-medium)",
|
|
5444
|
-
maxWidth: "179px",
|
|
5445
|
-
},
|
|
5446
|
-
EditBankDetailsButton: {
|
|
5447
|
-
marginTop: "var(--sl-spacing-x-large)",
|
|
5448
|
-
},
|
|
5449
|
-
SkeletonOne: {
|
|
5450
|
-
width: "15%",
|
|
5451
|
-
height: "10px",
|
|
5452
|
-
},
|
|
5453
|
-
SkeletonTwo: {
|
|
5454
|
-
width: "25%",
|
|
5455
|
-
height: "24px",
|
|
5456
|
-
top: "var(--sl-spacing-small)",
|
|
5457
|
-
marginBottom: "var(--sl-spacing-x-small)",
|
|
5458
|
-
},
|
|
5459
|
-
TaxSectionSkeletonContainer: {
|
|
5460
|
-
display: "flex",
|
|
5461
|
-
flexDirection: "column",
|
|
5462
|
-
},
|
|
5463
|
-
TaxDocSubtext: {
|
|
5464
|
-
margin: "0",
|
|
5465
|
-
color: "var(--sl-color-neutral-500)",
|
|
5466
|
-
lineHeight: "var(--sl-spacing-medium)",
|
|
5467
|
-
},
|
|
5468
|
-
};
|
|
5469
|
-
const sheet$6 = createStyleSheet(style$6);
|
|
5470
|
-
const styleString$6 = sheet$6.toString();
|
|
5471
|
-
const TaxDocumentSubmittedView = (props) => {
|
|
5472
|
-
var _a;
|
|
5473
|
-
const { states, text, callbacks } = props;
|
|
5474
|
-
// AL: Not sure what states will be yet, placeholder for now
|
|
5475
|
-
const testDetailsCardProps = {
|
|
5476
|
-
loading: states.loading,
|
|
5477
|
-
empty: false,
|
|
5478
|
-
otherCurrencies: false,
|
|
5479
|
-
mainCurrency: { currencyText: "USD", amountText: "100.00" },
|
|
5480
|
-
status: "upcoming",
|
|
5481
|
-
pendingStatusBadgeText: "Pending",
|
|
5482
|
-
upcomingStatusBadgeText: "Upcoming",
|
|
5483
|
-
nextPayoutStatusBadgeText: "Next payout",
|
|
5484
|
-
pendingDetailedStatusText: "Check rewards table for available date",
|
|
5485
|
-
upcomingDetailedStatusText: "November 1, 2022",
|
|
5486
|
-
nextPayoutDetailedStatusText: "November 1, 2022",
|
|
5487
|
-
otherCurrenciesText: "other currencies",
|
|
5488
|
-
w9PendingText: "Awaiting W-9 tax form",
|
|
5489
|
-
w9Pending: undefined,
|
|
5490
|
-
hasDatePending: true,
|
|
5491
|
-
hasW9Pending: false,
|
|
5492
|
-
};
|
|
5493
|
-
const statusMap = {
|
|
5494
|
-
NOT_VERIFIED: (h$1("div", { class: sheet$6.classes.TaxFormDetailsContainer },
|
|
5495
|
-
h$1("sl-badge", { type: "warning", pill: true, class: sheet$6.classes.BadgeContainer }, text.statusTextNotVerified),
|
|
5496
|
-
h$1("p", null, intl.formatMessage({
|
|
5497
|
-
id: `badgeTextAwaitingReview`,
|
|
5498
|
-
defaultMessage: text.badgeTextAwaitingReview,
|
|
5499
|
-
}, {
|
|
5500
|
-
dateSubmitted: states.dateSubmitted,
|
|
5501
|
-
})))),
|
|
5502
|
-
ACTIVE: (h$1("div", { class: sheet$6.classes.TaxFormDetailsContainer },
|
|
5503
|
-
h$1("sl-badge", { type: "success", pill: true, class: sheet$6.classes.BadgeContainer }, text.statusTextActive),
|
|
5504
|
-
h$1("p", null,
|
|
5505
|
-
intl.formatMessage({
|
|
5506
|
-
id: `badgeTextSubmittedOn`,
|
|
5507
|
-
defaultMessage: text.badgeTextSubmittedOn,
|
|
5508
|
-
}, {
|
|
5509
|
-
dateSubmitted: states.dateSubmitted,
|
|
5510
|
-
}),
|
|
5511
|
-
intl.formatMessage({
|
|
5512
|
-
id: `badgeTextExpiringSoon`,
|
|
5513
|
-
defaultMessage: text.badgeTextExpiringSoon,
|
|
5514
|
-
}, {
|
|
5515
|
-
dateExpired: states.dateExpired,
|
|
5516
|
-
})))),
|
|
5517
|
-
NOT_ACTIVE: (h$1("div", { class: sheet$6.classes.TaxFormDetailsContainer },
|
|
5518
|
-
h$1("sl-badge", { type: "danger", pill: true, class: sheet$6.classes.BadgeContainer }, text.statusTextNotActive),
|
|
5519
|
-
h$1("p", null, text.invalidForm))),
|
|
5520
|
-
EXPIRED: (h$1("div", { class: sheet$6.classes.TaxFormDetailsContainer },
|
|
5521
|
-
h$1("sl-badge", { type: "danger", pill: true, class: sheet$6.classes.BadgeContainer }, text.statusTextExpired),
|
|
5522
|
-
h$1("p", null, intl.formatMessage({
|
|
5523
|
-
id: `badgeTextExpiredOn`,
|
|
5524
|
-
defaultMessage: text.badgeTextExpiredOn,
|
|
5525
|
-
}, {
|
|
5526
|
-
dateExpired: states.dateExpired,
|
|
5527
|
-
})))),
|
|
5528
|
-
};
|
|
5529
|
-
const alertMap = {
|
|
5530
|
-
NOT_ACTIVE: (h$1("sl-alert", { type: "danger", open: true, class: sheet$6.classes.WarningAlertContainer },
|
|
5531
|
-
h$1("sl-icon", { slot: "icon", name: "exclamation-octagon" }),
|
|
5532
|
-
h$1("strong", null, intl.formatMessage({
|
|
5533
|
-
id: `taxAlertHeaderNotActive`,
|
|
5534
|
-
defaultMessage: text.taxAlertHeaderNotActive,
|
|
5535
|
-
}, {
|
|
5536
|
-
documentType: states.documentType,
|
|
5537
|
-
})),
|
|
5538
|
-
h$1("br", null),
|
|
5539
|
-
intl.formatMessage({
|
|
5540
|
-
id: `taxAlertMessage`,
|
|
5541
|
-
defaultMessage: text.taxAlertMessage,
|
|
5542
|
-
}, {
|
|
5543
|
-
documentType: states.documentType,
|
|
5544
|
-
}))),
|
|
5545
|
-
EXPIRING_SOON: (h$1("sl-alert", { type: "warning", open: true, class: sheet$6.classes.ExpiringSoonAlertContainer },
|
|
5546
|
-
h$1("sl-icon", { slot: "icon", name: "exclamation-octagon" }),
|
|
5547
|
-
h$1("strong", null, intl.formatMessage({
|
|
5548
|
-
id: `taxAlertHeaderExpiringSoon`,
|
|
5549
|
-
defaultMessage: text.taxAlertHeaderExpiringSoon,
|
|
5550
|
-
}, {
|
|
5551
|
-
documentType: states.documentType,
|
|
5552
|
-
dateExpired: states.dateExpired,
|
|
5553
|
-
})),
|
|
5554
|
-
h$1("br", null),
|
|
5555
|
-
intl.formatMessage({
|
|
5556
|
-
id: `taxAlertMessageExpiringSoon`,
|
|
5557
|
-
defaultMessage: text.taxAlertMessageExpiringSoon,
|
|
5558
|
-
}, {
|
|
5559
|
-
documentType: states.documentType,
|
|
5560
|
-
}))),
|
|
5561
|
-
EXPIRED: (h$1("sl-alert", { type: "danger", open: true, class: sheet$6.classes.WarningAlertContainer },
|
|
5562
|
-
h$1("sl-icon", { slot: "icon", name: "exclamation-octagon" }),
|
|
5563
|
-
h$1("strong", null, intl.formatMessage({
|
|
5564
|
-
id: `taxAlertHeaderExpiredOn`,
|
|
5565
|
-
defaultMessage: text.taxAlertHeaderExpiredOn,
|
|
5566
|
-
}, {
|
|
5567
|
-
documentType: states.documentType,
|
|
5568
|
-
})),
|
|
5569
|
-
h$1("br", null),
|
|
5570
|
-
intl.formatMessage({
|
|
5571
|
-
id: `taxAlertMessage`,
|
|
5572
|
-
defaultMessage: text.taxAlertMessage,
|
|
5573
|
-
}, {
|
|
5574
|
-
documentType: states.documentType,
|
|
5575
|
-
}))),
|
|
5576
|
-
};
|
|
5577
|
-
return (h$1("div", null,
|
|
5578
|
-
h$1("div", null,
|
|
5579
|
-
h$1("style", { type: "text/css" }, styleString$6),
|
|
5580
|
-
((_a = states.errors) === null || _a === void 0 ? void 0 : _a.general) && (h$1("sl-alert", { type: "danger", open: true, class: sheet$6.classes.WarningAlertContainer },
|
|
5581
|
-
h$1("sl-icon", { slot: "icon", name: "exclamation-octagon" }),
|
|
5582
|
-
h$1("strong", null, text.error.generalTitle),
|
|
5583
|
-
h$1("br", null),
|
|
5584
|
-
text.error.generalDescription)),
|
|
5585
|
-
(states.status === "NOT_ACTIVE" || states.status === "EXPIRED") &&
|
|
5586
|
-
alertMap[states.status],
|
|
5587
|
-
states.status === "ACTIVE" &&
|
|
5588
|
-
states.expiresSoon &&
|
|
5589
|
-
alertMap.EXPIRING_SOON,
|
|
5590
|
-
h$1("div", null,
|
|
5591
|
-
h$1("h3", null, text.bankingInformationSectionHeader),
|
|
5592
|
-
h$1("div", { class: sheet$6.classes.BankingInformationContainer },
|
|
5593
|
-
h$1(PayoutDetailsCardView, Object.assign({}, testDetailsCardProps)),
|
|
5594
|
-
h$1("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$6.classes.EditBankDetailsButton }, "Edit Bank Details"))),
|
|
5595
|
-
h$1("div", { class: sheet$6.classes.TaxDocumentsContainer },
|
|
5596
|
-
h$1("h3", { class: sheet$6.classes.TaxDocumentsHeaderContainer }, text.taxDocumentSectionHeader),
|
|
5597
|
-
h$1("div", null,
|
|
5598
|
-
states.loading ? (h$1("div", { class: sheet$6.classes.TaxSectionSkeletonContainer },
|
|
5599
|
-
h$1("sl-skeleton", { class: sheet$6.classes.SkeletonOne }),
|
|
5600
|
-
h$1("sl-skeleton", { class: sheet$6.classes.SkeletonTwo }))) : (h$1("span", { class: sheet$6.classes.TaxFormDetailsContainer }, states.noFormNeeded ? (h$1("p", { class: sheet$6.classes.TaxDocSubtext }, text.noFormNeededSubtext)) : (h$1("div", { class: sheet$6.classes.StatusContainer },
|
|
5601
|
-
h$1("h4", null, intl.formatMessage({
|
|
5602
|
-
id: "section-subheader",
|
|
5603
|
-
defaultMessage: text.taxDocumentSectionSubHeader,
|
|
5604
|
-
}, {
|
|
5605
|
-
documentType: states.documentType,
|
|
5606
|
-
})),
|
|
5607
|
-
statusMap[states.status])))),
|
|
5608
|
-
states.noFormNeeded ? ("") : (h$1("sl-button", { disabled: states.disabled || states.loading, onClick: callbacks.onClick, type: "default", class: sheet$6.classes.NewFormButton }, text.newFormButton)))))));
|
|
5609
|
-
};
|
|
5610
|
-
|
|
5611
|
-
function getDocumentType(user) {
|
|
5612
|
-
if (!user)
|
|
5613
|
-
return;
|
|
5614
|
-
if (user.countryCode === "US")
|
|
5615
|
-
return "W9";
|
|
5616
|
-
if (user.customFields.__taxCountry === "US") {
|
|
5617
|
-
if (user.customFields.participantType === "individualParticipant")
|
|
5618
|
-
return "W8-BEN";
|
|
5619
|
-
else if (user.customFields.participantType === "businessEntity")
|
|
5620
|
-
return "W8-BEN-E";
|
|
5621
|
-
}
|
|
5622
|
-
}
|
|
5623
|
-
function getExpiresSoon(submissionDate, expiryDate) {
|
|
5624
|
-
var _a;
|
|
5625
|
-
if (!submissionDate || !expiryDate)
|
|
5626
|
-
return false;
|
|
5627
|
-
return (((_a = luxon.DateTime.fromMillis(expiryDate).diff(luxon.DateTime.fromMillis(submissionDate), "days")) === null || _a === void 0 ? void 0 : _a.days) <= 30);
|
|
5628
|
-
}
|
|
5629
|
-
const useTaxDocumentSubmitted = (props) => {
|
|
5630
|
-
const setStep = useSetParent(TAX_CONTEXT_NAMESPACE);
|
|
5631
|
-
const { data, loading } = useParentQueryValue(USER_QUERY_NAMESPACE);
|
|
5632
|
-
console.log("submitted", { data, loading });
|
|
5633
|
-
// TODO: Fetch document status from backend
|
|
5634
|
-
const submissionDate = luxon.DateTime.now().toMillis();
|
|
5635
|
-
const dateSubmitted = luxon.DateTime.fromMillis(submissionDate).toFormat("LLL dd, yyyy");
|
|
5636
|
-
const expiryDate = luxon.DateTime.now().plus({ days: 30 }).toMillis();
|
|
5637
|
-
const dateExpired = luxon.DateTime.fromMillis(expiryDate).toFormat("LLL dd, yyyy");
|
|
5638
|
-
const expiresSoon = getExpiresSoon(expiryDate, submissionDate);
|
|
5639
|
-
console.log({
|
|
5640
|
-
dateSubmitted,
|
|
5641
|
-
dateExpired,
|
|
5642
|
-
expiresSoon,
|
|
5643
|
-
diff: luxon.DateTime.fromMillis(submissionDate).diff(luxon.DateTime.fromMillis(expiryDate)),
|
|
5644
|
-
});
|
|
5645
|
-
const documentType = getDocumentType(data === null || data === void 0 ? void 0 : data.user);
|
|
5646
|
-
return {
|
|
5647
|
-
states: {
|
|
5648
|
-
dateSubmitted,
|
|
5649
|
-
documentType,
|
|
5650
|
-
// TODO: Hook up to API
|
|
5651
|
-
status: documentType ? "NOT_VERIFIED" : undefined,
|
|
5652
|
-
noFormNeeded: !documentType,
|
|
5653
|
-
dateExpired,
|
|
5654
|
-
expiresSoon,
|
|
5655
|
-
disabled: loading,
|
|
5656
|
-
loading,
|
|
5657
|
-
},
|
|
5658
|
-
callbacks: {
|
|
5659
|
-
onClick: () => setStep(`/3/${documentType}`),
|
|
5660
|
-
},
|
|
5661
|
-
text: props.getTextProps(),
|
|
4070
|
+
}
|
|
4071
|
+
return {
|
|
4072
|
+
states: { loadingEvent, locale },
|
|
4073
|
+
callbacks: { sendEvent, onClick },
|
|
5662
4074
|
};
|
|
5663
|
-
}
|
|
4075
|
+
}
|
|
5664
4076
|
|
|
5665
|
-
const
|
|
4077
|
+
const TaskCard = class {
|
|
5666
4078
|
constructor(hostRef) {
|
|
5667
4079
|
registerInstance(this, hostRef);
|
|
4080
|
+
this.ignored = true;
|
|
5668
4081
|
/**
|
|
5669
|
-
*
|
|
5670
|
-
*
|
|
5671
|
-
* @uiName Status text
|
|
5672
|
-
*/
|
|
5673
|
-
this.statusTextActive = "Active";
|
|
5674
|
-
/**
|
|
5675
|
-
* Status text displayed in badge when tax document is Not Active
|
|
5676
|
-
*
|
|
5677
|
-
* @uiName Status text
|
|
5678
|
-
*/
|
|
5679
|
-
this.statusTextNotActive = "Invalid Tax Form";
|
|
5680
|
-
/**
|
|
5681
|
-
* Status text displayed in badge when tax document is Not Verified
|
|
5682
|
-
*
|
|
5683
|
-
* @uiName Status text
|
|
5684
|
-
*/
|
|
5685
|
-
this.statusTextNotVerified = "Not Verified";
|
|
5686
|
-
/**
|
|
5687
|
-
* Status text displayed in badge when tax document is Expired
|
|
5688
|
-
*
|
|
5689
|
-
* @uiName Status text
|
|
5690
|
-
*/
|
|
5691
|
-
this.statusTextExpired = "Expired";
|
|
5692
|
-
/**
|
|
5693
|
-
* Description text which appears beside badge showing when the form was submitted
|
|
5694
|
-
*
|
|
5695
|
-
* @uiName Badge description text
|
|
4082
|
+
* @uiName Reward amount
|
|
4083
|
+
* @uiGroup Reward
|
|
5696
4084
|
*/
|
|
5697
|
-
this.
|
|
4085
|
+
this.rewardAmount = "0";
|
|
5698
4086
|
/**
|
|
5699
|
-
*
|
|
5700
|
-
*
|
|
5701
|
-
* @uiName Badge description text
|
|
4087
|
+
* @uiName Reward unit
|
|
4088
|
+
* @uiGroup Reward
|
|
5702
4089
|
*/
|
|
5703
|
-
this.
|
|
4090
|
+
this.rewardUnit = "Points";
|
|
5704
4091
|
/**
|
|
5705
|
-
*
|
|
5706
|
-
*
|
|
5707
|
-
* @uiName Badge description text
|
|
4092
|
+
* @uiName Title
|
|
4093
|
+
* @uiGroup Task
|
|
5708
4094
|
*/
|
|
5709
|
-
this.
|
|
4095
|
+
this.cardTitle = "Title Text";
|
|
5710
4096
|
/**
|
|
5711
|
-
* Description
|
|
5712
|
-
*
|
|
5713
|
-
* @uiName Badge description text
|
|
4097
|
+
* @uiName Description
|
|
4098
|
+
* @uiGroup Task
|
|
5714
4099
|
*/
|
|
5715
|
-
this.
|
|
4100
|
+
this.description = "";
|
|
5716
4101
|
/**
|
|
5717
|
-
*
|
|
5718
|
-
*
|
|
5719
|
-
* @
|
|
4102
|
+
* @uiName Goal repeatable
|
|
4103
|
+
* @uiGroup Goal
|
|
4104
|
+
* @default
|
|
5720
4105
|
*/
|
|
5721
|
-
this.
|
|
4106
|
+
this.repeatable = false;
|
|
5722
4107
|
/**
|
|
5723
|
-
*
|
|
4108
|
+
* The number of times a task can be completed when repeatable. Use zero for no limit (the default).
|
|
5724
4109
|
*
|
|
5725
|
-
* @uiName
|
|
4110
|
+
* @uiName Repeat amount
|
|
4111
|
+
* @uiGroup Reward
|
|
5726
4112
|
*/
|
|
5727
|
-
this.
|
|
4113
|
+
this.finite = 0;
|
|
5728
4114
|
/**
|
|
5729
|
-
*
|
|
5730
|
-
*
|
|
5731
|
-
* @
|
|
4115
|
+
* @uiName Show progress bar
|
|
4116
|
+
* @uiGroup Goal
|
|
4117
|
+
* @default
|
|
5732
4118
|
*/
|
|
5733
|
-
this.
|
|
4119
|
+
this.showProgressBar = false;
|
|
5734
4120
|
/**
|
|
5735
|
-
*
|
|
4121
|
+
* Sets the goal for users progress to know when a task has been completed. If repeatable is checked, repeatable goals is an increment of this.
|
|
5736
4122
|
*
|
|
5737
|
-
* @uiName
|
|
4123
|
+
* @uiName Goal completion number
|
|
4124
|
+
* @uiGroup Goal
|
|
5738
4125
|
*/
|
|
5739
|
-
this.
|
|
4126
|
+
this.goal = 1;
|
|
5740
4127
|
/**
|
|
5741
|
-
*
|
|
5742
|
-
*
|
|
5743
|
-
* @
|
|
4128
|
+
* @uiName Progress bar steps
|
|
4129
|
+
* @uiGroup Goal
|
|
4130
|
+
* @default
|
|
5744
4131
|
*/
|
|
5745
|
-
this.
|
|
4132
|
+
this.steps = false;
|
|
5746
4133
|
/**
|
|
5747
|
-
*
|
|
4134
|
+
* The unit displayed to the right of steps and progress numbers on the progress bar. Ex: $ for dollars
|
|
5748
4135
|
*
|
|
5749
|
-
* @uiName
|
|
4136
|
+
* @uiName Progress bar unit
|
|
4137
|
+
* @uiGroup Goal
|
|
5750
4138
|
*/
|
|
5751
|
-
this.
|
|
4139
|
+
this.progressBarUnit = "";
|
|
5752
4140
|
/**
|
|
5753
|
-
*
|
|
4141
|
+
* Displayed when a user views a task card after the reward duration interval.
|
|
5754
4142
|
*
|
|
5755
|
-
* @uiName
|
|
4143
|
+
* @uiName Expiry date message
|
|
4144
|
+
* @uiGroup Task
|
|
5756
4145
|
*/
|
|
5757
|
-
this.
|
|
4146
|
+
this.expiryMessage = "Ends {endDate}";
|
|
5758
4147
|
/**
|
|
5759
|
-
*
|
|
4148
|
+
* Shown to users before the start of the task duration.
|
|
5760
4149
|
*
|
|
5761
|
-
* @uiName
|
|
4150
|
+
* @uiName Start date message
|
|
4151
|
+
* @uiGroup Task
|
|
5762
4152
|
*/
|
|
5763
|
-
this.
|
|
4153
|
+
this.startsOnMessage = "Starts {startDate}";
|
|
5764
4154
|
/**
|
|
5765
|
-
*
|
|
4155
|
+
* Shown to users after the end of the task duration.
|
|
5766
4156
|
*
|
|
5767
|
-
* @uiName
|
|
4157
|
+
* @uiName Ended date message
|
|
4158
|
+
* @uiGroup Task
|
|
5768
4159
|
*/
|
|
5769
|
-
this.
|
|
4160
|
+
this.endedMessage = "Ended {endDate}";
|
|
5770
4161
|
/**
|
|
5771
|
-
*
|
|
4162
|
+
* Displays the amount of times that a user has completed a repeatable task.
|
|
5772
4163
|
*
|
|
5773
|
-
* @uiName
|
|
4164
|
+
* @uiName Completed count text
|
|
4165
|
+
* @uiGroup Task
|
|
4166
|
+
* @uiWidget textArea
|
|
5774
4167
|
*/
|
|
5775
|
-
this.
|
|
4168
|
+
this.completedText = "Completed {finite, select, 0 {{count, plural, =1 {{count} time} other {{count} times}}} other {{count}/{finite} times}}";
|
|
5776
4169
|
/**
|
|
5777
|
-
*
|
|
5778
|
-
*
|
|
5779
|
-
* @uiName No form needed subtext
|
|
4170
|
+
* @uiName Button text
|
|
4171
|
+
* @uiGroup Button
|
|
5780
4172
|
*/
|
|
5781
|
-
this.
|
|
4173
|
+
this.buttonText = "Complete Action";
|
|
5782
4174
|
/**
|
|
5783
|
-
*
|
|
5784
|
-
*
|
|
5785
|
-
* @
|
|
4175
|
+
* Button link opens in new tab
|
|
4176
|
+
* @uiName Open in new tab
|
|
4177
|
+
* @uiGroup Button
|
|
4178
|
+
* @default
|
|
5786
4179
|
*/
|
|
5787
|
-
this.
|
|
4180
|
+
this.openNewTab = false;
|
|
5788
4181
|
/**
|
|
5789
|
-
*
|
|
5790
|
-
*
|
|
5791
|
-
* @uiName General error text
|
|
4182
|
+
* @uiName Hide CTA button
|
|
4183
|
+
* @uiGroup Button
|
|
5792
4184
|
*/
|
|
5793
|
-
this.
|
|
4185
|
+
this.hideButton = false;
|
|
5794
4186
|
h(this);
|
|
5795
4187
|
}
|
|
5796
4188
|
disconnectedCallback() { }
|
|
5797
|
-
getTextProps() {
|
|
5798
|
-
const props = getProps(this);
|
|
5799
|
-
return {
|
|
5800
|
-
...props,
|
|
5801
|
-
error: {
|
|
5802
|
-
generalDescription: props.generalErrorDescription,
|
|
5803
|
-
generalTitle: props.generalErrorTitle,
|
|
5804
|
-
},
|
|
5805
|
-
};
|
|
5806
|
-
}
|
|
5807
4189
|
render() {
|
|
5808
|
-
const props = isDemo()
|
|
5809
|
-
?
|
|
5810
|
-
:
|
|
5811
|
-
|
|
4190
|
+
const { props } = isDemo()
|
|
4191
|
+
? useDemoBigStat(this)
|
|
4192
|
+
: useBigStat({ ...getProps(this), programId: this.programId });
|
|
4193
|
+
const { value, loading } = props;
|
|
4194
|
+
const { states, callbacks } = isDemo()
|
|
4195
|
+
? useTaskCardDemo(this)
|
|
4196
|
+
: useTaskCard(this);
|
|
4197
|
+
return (h$1(TaskCardView, { callbacks: callbacks, states: {
|
|
4198
|
+
loading,
|
|
4199
|
+
loadingEvent: states.loadingEvent,
|
|
4200
|
+
progress: value,
|
|
4201
|
+
locale: states.locale,
|
|
4202
|
+
}, content: { ...getProps(this) } }));
|
|
5812
4203
|
}
|
|
5813
4204
|
};
|
|
5814
|
-
function
|
|
4205
|
+
function useTaskCardDemo(props) {
|
|
5815
4206
|
return cjs({
|
|
5816
|
-
states: {
|
|
5817
|
-
dateSubmitted: undefined,
|
|
5818
|
-
documentType: undefined,
|
|
5819
|
-
status: undefined,
|
|
5820
|
-
noFormNeeded: true,
|
|
5821
|
-
dateExpired: undefined,
|
|
5822
|
-
expiresSoon: false,
|
|
5823
|
-
disabled: false,
|
|
5824
|
-
loading: false,
|
|
5825
|
-
},
|
|
4207
|
+
states: { loadingEvent: false, locale: "en" },
|
|
5826
4208
|
callbacks: {
|
|
5827
|
-
|
|
4209
|
+
sendEvent: (event) => console.log(event),
|
|
4210
|
+
onClick: () => console.log("clicked"),
|
|
5828
4211
|
},
|
|
5829
|
-
text: props.getTextProps(),
|
|
5830
4212
|
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
5831
4213
|
}
|
|
5832
4214
|
|
|
@@ -5875,7 +4257,7 @@ const Gift = () => (h$1("svg", { width: "24", height: "24", viewBox: "0 0 24 24"
|
|
|
5875
4257
|
const Circle = () => (h$1("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
5876
4258
|
h$1("circle", { cx: "12", cy: "12", r: "9", fill: "currentColor", stroke: "currentColor", "stroke-width": "2" })));
|
|
5877
4259
|
|
|
5878
|
-
const style$
|
|
4260
|
+
const style$3 = {
|
|
5879
4261
|
TimelineReward: {
|
|
5880
4262
|
color: "var(--sl-color-neutral-900)",
|
|
5881
4263
|
lineHeight: "var(--sl-line-height-dense)",
|
|
@@ -5918,9 +4300,9 @@ const style$7 = {
|
|
|
5918
4300
|
},
|
|
5919
4301
|
},
|
|
5920
4302
|
};
|
|
5921
|
-
const sheet$
|
|
5922
|
-
const styleString$
|
|
5923
|
-
const vanillaStyle$
|
|
4303
|
+
const sheet$3 = createStyleSheet(style$3);
|
|
4304
|
+
const styleString$3 = sheet$3.toString();
|
|
4305
|
+
const vanillaStyle$2 = `
|
|
5924
4306
|
:host{
|
|
5925
4307
|
display: block;
|
|
5926
4308
|
}
|
|
@@ -5932,10 +4314,10 @@ const vanillaStyle$5 = `
|
|
|
5932
4314
|
function TimelineEntryView(props) {
|
|
5933
4315
|
var _a;
|
|
5934
4316
|
const timeline_icon = (_a = props.icon) !== null && _a !== void 0 ? _a : props.iconState;
|
|
5935
|
-
return (h$1("div", { class: sheet$
|
|
4317
|
+
return (h$1("div", { class: sheet$3.classes.TimelineReward, part: "sqm-base" },
|
|
5936
4318
|
h$1("style", { type: "text/css" },
|
|
5937
|
-
styleString$
|
|
5938
|
-
vanillaStyle$
|
|
4319
|
+
styleString$3,
|
|
4320
|
+
vanillaStyle$2),
|
|
5939
4321
|
h$1("div", { class: "container", part: "sqm-entry-container" },
|
|
5940
4322
|
h$1("div", { class: "line" }, "/"),
|
|
5941
4323
|
h$1("div", { class: "step" },
|
|
@@ -5967,299 +4349,6 @@ const TimelineReward = class {
|
|
|
5967
4349
|
}
|
|
5968
4350
|
};
|
|
5969
4351
|
|
|
5970
|
-
const UPSERT_USER$4 = dist.gql `
|
|
5971
|
-
mutation ($userInput: UserInput!) {
|
|
5972
|
-
upsertUser(userInput: $userInput) {
|
|
5973
|
-
firstName
|
|
5974
|
-
lastName
|
|
5975
|
-
}
|
|
5976
|
-
}
|
|
5977
|
-
`;
|
|
5978
|
-
function useUserInfoForm(props) {
|
|
5979
|
-
var _a, _b;
|
|
5980
|
-
const user = H();
|
|
5981
|
-
const formRef = useRef(null);
|
|
5982
|
-
const [step, setStep] = useParent(TAX_CONTEXT_NAMESPACE);
|
|
5983
|
-
const [formState, setFormState] = useParent(USER_INFO_NAMESPACE);
|
|
5984
|
-
const [mutationLoading, setMutationLoading] = useState(false);
|
|
5985
|
-
const [upsertUser] = Fe(UPSERT_USER$4);
|
|
5986
|
-
const { data, loading, refetch } = useParentQueryValue(USER_QUERY_NAMESPACE);
|
|
5987
|
-
const { data: _countries, loading: countriesLoading } = useParentQueryValue(COUNTRIES_NAMESPACE);
|
|
5988
|
-
const { data: currenciesRes, loading: loadingCurrencies } = useParentQueryValue(CURRENCIES_NAMESPACE);
|
|
5989
|
-
useEffect(() => {
|
|
5990
|
-
const user = data === null || data === void 0 ? void 0 : data.user;
|
|
5991
|
-
if (!user || step !== "/1")
|
|
5992
|
-
return;
|
|
5993
|
-
}, [data, step]);
|
|
5994
|
-
function onRadioClick(value) {
|
|
5995
|
-
setFormState({ ...formState, participantType: value });
|
|
5996
|
-
}
|
|
5997
|
-
async function onSubmit(event) {
|
|
5998
|
-
let formControls = event.target.getFormControls();
|
|
5999
|
-
let formData = {};
|
|
6000
|
-
let errors = {};
|
|
6001
|
-
formControls === null || formControls === void 0 ? void 0 : formControls.forEach((control) => {
|
|
6002
|
-
if (!control.name)
|
|
6003
|
-
return;
|
|
6004
|
-
const key = control.name;
|
|
6005
|
-
const value = control.value;
|
|
6006
|
-
if (control.name === "/participantType") {
|
|
6007
|
-
control.checked && jsonpointer.set(formData, key, value);
|
|
6008
|
-
}
|
|
6009
|
-
else {
|
|
6010
|
-
jsonpointer.set(formData, key, value);
|
|
6011
|
-
}
|
|
6012
|
-
// required validation
|
|
6013
|
-
if (control.required && !value) {
|
|
6014
|
-
jsonpointer.set(errors, key, props.allowBankingCollectionError);
|
|
6015
|
-
}
|
|
6016
|
-
// custom validation
|
|
6017
|
-
if (typeof control.validationError === "function") {
|
|
6018
|
-
const validate = control.validationError;
|
|
6019
|
-
const validationError = validate({ control, key, value });
|
|
6020
|
-
if (validationError)
|
|
6021
|
-
jsonpointer.set(errors, key, validationError);
|
|
6022
|
-
}
|
|
6023
|
-
});
|
|
6024
|
-
// participant type validation
|
|
6025
|
-
if (!formData.participantType) {
|
|
6026
|
-
jsonpointer.set(errors, "/participantType", props.participantTypeError);
|
|
6027
|
-
}
|
|
6028
|
-
if (Object.keys(errors).length) {
|
|
6029
|
-
setFormState({ ...formState, error: "", errors });
|
|
6030
|
-
// early return for validation errors
|
|
6031
|
-
return;
|
|
6032
|
-
}
|
|
6033
|
-
const { allowBankingCollection, ...userData } = formData;
|
|
6034
|
-
try {
|
|
6035
|
-
setMutationLoading(true);
|
|
6036
|
-
await upsertUser({
|
|
6037
|
-
userInput: {
|
|
6038
|
-
id: user.id,
|
|
6039
|
-
accountId: user.accountId,
|
|
6040
|
-
countryCode: userData.countryCode,
|
|
6041
|
-
customFields: {
|
|
6042
|
-
currency: userData.currency,
|
|
6043
|
-
participantType: userData.participantType,
|
|
6044
|
-
},
|
|
6045
|
-
},
|
|
6046
|
-
});
|
|
6047
|
-
await refetch();
|
|
6048
|
-
setStep("/2");
|
|
6049
|
-
}
|
|
6050
|
-
catch (e) {
|
|
6051
|
-
// TODO: Double check
|
|
6052
|
-
setFormState({ ...formState, errors: { general: true } });
|
|
6053
|
-
}
|
|
6054
|
-
finally {
|
|
6055
|
-
setMutationLoading(false);
|
|
6056
|
-
}
|
|
6057
|
-
}
|
|
6058
|
-
return {
|
|
6059
|
-
step: step,
|
|
6060
|
-
setStep: setStep,
|
|
6061
|
-
onSubmit,
|
|
6062
|
-
onRadioClick,
|
|
6063
|
-
text: props.getTextProps(),
|
|
6064
|
-
refs: {
|
|
6065
|
-
formRef,
|
|
6066
|
-
},
|
|
6067
|
-
data: {
|
|
6068
|
-
currencies: (_a = currenciesRes === null || currenciesRes === void 0 ? void 0 : currenciesRes.currencies) === null || _a === void 0 ? void 0 : _a.data,
|
|
6069
|
-
countries: (_b = _countries === null || _countries === void 0 ? void 0 : _countries.countries) === null || _b === void 0 ? void 0 : _b.data,
|
|
6070
|
-
},
|
|
6071
|
-
states: {
|
|
6072
|
-
disabled: loading,
|
|
6073
|
-
loading: loading || mutationLoading,
|
|
6074
|
-
//AL: TODO hook up if user is partner
|
|
6075
|
-
isPartner: false,
|
|
6076
|
-
formState: { ...formState },
|
|
6077
|
-
},
|
|
6078
|
-
};
|
|
6079
|
-
}
|
|
6080
|
-
|
|
6081
|
-
const TaxForm = class {
|
|
6082
|
-
constructor(hostRef) {
|
|
6083
|
-
registerInstance(this, hostRef);
|
|
6084
|
-
this.ignored = true;
|
|
6085
|
-
/**
|
|
6086
|
-
* Label text for first name input
|
|
6087
|
-
* @uiName First name label
|
|
6088
|
-
*/
|
|
6089
|
-
this.firstName = "First name";
|
|
6090
|
-
/**
|
|
6091
|
-
* Label text for last name input
|
|
6092
|
-
* @uiName Last name label
|
|
6093
|
-
*/
|
|
6094
|
-
this.lastName = "Last name";
|
|
6095
|
-
/**
|
|
6096
|
-
* Label text for email input
|
|
6097
|
-
* @uiName Email label
|
|
6098
|
-
*/
|
|
6099
|
-
this.email = "Email";
|
|
6100
|
-
/**
|
|
6101
|
-
* Label text for country input
|
|
6102
|
-
* @uiName Country label
|
|
6103
|
-
*/
|
|
6104
|
-
this.country = "Country";
|
|
6105
|
-
/**
|
|
6106
|
-
* Label text for currency input
|
|
6107
|
-
* @uiName Currency label
|
|
6108
|
-
*/
|
|
6109
|
-
this.currency = "Currency";
|
|
6110
|
-
/**
|
|
6111
|
-
* Label text for tax and banking collection checkbox
|
|
6112
|
-
* @uiName Tax and banking label
|
|
6113
|
-
*/
|
|
6114
|
-
this.allowBankingCollection = "I agree to the terms";
|
|
6115
|
-
/**
|
|
6116
|
-
* Heading text for the tax and banking collection checkbox
|
|
6117
|
-
* @uiName Tax and banking collection checkbox heading
|
|
6118
|
-
*/
|
|
6119
|
-
this.taxAndBankingCollection = "Continue";
|
|
6120
|
-
/**
|
|
6121
|
-
* Sub text shown at the top of the page, used to show the current step of the tax form.
|
|
6122
|
-
* @uiName Tax form step text
|
|
6123
|
-
*/
|
|
6124
|
-
this.formStep = "Step 1 of 4";
|
|
6125
|
-
/**
|
|
6126
|
-
* Heading text shown above the forms inputs.
|
|
6127
|
-
* @uiName Form heading text
|
|
6128
|
-
*/
|
|
6129
|
-
this.personalInformation = "Personal Information";
|
|
6130
|
-
/**
|
|
6131
|
-
* Label text for the business entity radio button
|
|
6132
|
-
* @uiName Business entity radio button label
|
|
6133
|
-
*/
|
|
6134
|
-
this.businessEntity = "I represent a business entity";
|
|
6135
|
-
/**
|
|
6136
|
-
* Label text for the individual participant radio button
|
|
6137
|
-
* @uiName Individual participant radio button label
|
|
6138
|
-
*/
|
|
6139
|
-
this.individualParticipant = "I am an individual participant";
|
|
6140
|
-
/**
|
|
6141
|
-
* Heading text for the participant type radio buttons
|
|
6142
|
-
* @uiName Participant type radio buttons heading
|
|
6143
|
-
*/
|
|
6144
|
-
this.participantType = "Participant type";
|
|
6145
|
-
/**
|
|
6146
|
-
* Text shown inside of submit button
|
|
6147
|
-
* @uiName Submit button text
|
|
6148
|
-
*/
|
|
6149
|
-
this.submitButton = "Continue";
|
|
6150
|
-
/**
|
|
6151
|
-
* Error text shown at the bottom of the first name input
|
|
6152
|
-
* @uiName First name input error text
|
|
6153
|
-
*/
|
|
6154
|
-
this.firstNameError = "Enter a first name";
|
|
6155
|
-
/**
|
|
6156
|
-
* Error text shown at the bottom of the last name input
|
|
6157
|
-
* @uiName Last name input error text
|
|
6158
|
-
*/
|
|
6159
|
-
this.lastNameError = "Enter a last name";
|
|
6160
|
-
/**
|
|
6161
|
-
* Error text shown at the bottom of the email input
|
|
6162
|
-
* @uiName Email input error text
|
|
6163
|
-
*/
|
|
6164
|
-
this.emailError = "Enter a valid email";
|
|
6165
|
-
/**
|
|
6166
|
-
* Error text shown at the bottom of the country input
|
|
6167
|
-
* @uiName Country input error text
|
|
6168
|
-
*/
|
|
6169
|
-
this.countryError = "Select a country";
|
|
6170
|
-
/**
|
|
6171
|
-
* Error text shown at the bottom of the currency input
|
|
6172
|
-
* @uiName Currency input error text
|
|
6173
|
-
*/
|
|
6174
|
-
this.currencyError = "Select a currency";
|
|
6175
|
-
/**
|
|
6176
|
-
* Error text shown at the bottom of the tax and banking collection checkbox
|
|
6177
|
-
* @uiName Tax and banking collection checkbox error text
|
|
6178
|
-
*/
|
|
6179
|
-
this.allowBankingCollectionError = "This field is required";
|
|
6180
|
-
/**
|
|
6181
|
-
* Error text shown at the bottom of the participant type checkbox
|
|
6182
|
-
* @uiName Participant type checkbox error text
|
|
6183
|
-
*/
|
|
6184
|
-
this.participantTypeError = "Select a participant type";
|
|
6185
|
-
/**
|
|
6186
|
-
* Alert header text shown in alert if user is already a registered partner
|
|
6187
|
-
* @uiName Participant is partner title
|
|
6188
|
-
*/
|
|
6189
|
-
this.isPartnerAlertHeader = "An account with this email already exists with our referral program provider, impact.com";
|
|
6190
|
-
/**
|
|
6191
|
-
* Alert description text shown in alert if user is already a registered partner
|
|
6192
|
-
* @uiName Participant is partner description
|
|
6193
|
-
*/
|
|
6194
|
-
this.isPartnerAlertDescription = "If you don’t recognize this referral program provider or believe this is a mistake, please contact Support or sign up for this referral program with a different email.";
|
|
6195
|
-
/**
|
|
6196
|
-
* The title for error message shown at the top of the page in an error banner
|
|
6197
|
-
*
|
|
6198
|
-
* @uiName General error title
|
|
6199
|
-
*/
|
|
6200
|
-
this.generalErrorTitle = "There was a problem submitting your information";
|
|
6201
|
-
/**
|
|
6202
|
-
* The error message shown at the top of the page in an error banner
|
|
6203
|
-
*
|
|
6204
|
-
* @uiName General error text
|
|
6205
|
-
*/
|
|
6206
|
-
this.generalErrorDescription = "Please review your information and try again. If this problem continues, contact Support.";
|
|
6207
|
-
h(this);
|
|
6208
|
-
}
|
|
6209
|
-
disconnectedCallback() { }
|
|
6210
|
-
getTextProps() {
|
|
6211
|
-
const props = getProps(this);
|
|
6212
|
-
return {
|
|
6213
|
-
...props,
|
|
6214
|
-
error: {
|
|
6215
|
-
firstName: props.firstNameError,
|
|
6216
|
-
lastName: props.lastNameError,
|
|
6217
|
-
email: props.emailError,
|
|
6218
|
-
countryCode: props.countryError,
|
|
6219
|
-
currency: props.currencyError,
|
|
6220
|
-
allowBankingCollection: props.allowBankingCollectionError,
|
|
6221
|
-
participantType: props.participantTypeError,
|
|
6222
|
-
generalTitle: props.generalErrorTitle,
|
|
6223
|
-
generalDescription: props.generalErrorDescription,
|
|
6224
|
-
},
|
|
6225
|
-
};
|
|
6226
|
-
}
|
|
6227
|
-
render() {
|
|
6228
|
-
const props = isDemo() ? useDemoUserInfoForm(this) : useUserInfoForm(this);
|
|
6229
|
-
return (h$1(Host, null, h$1(UserInfoFormView, { data: props.data,
|
|
6230
|
-
// @ts-ignore
|
|
6231
|
-
states: props.states, callbacks: {
|
|
6232
|
-
onSubmit: props.onSubmit,
|
|
6233
|
-
onRadioClick: props.onRadioClick,
|
|
6234
|
-
}, text: props.text, refs: props.refs })));
|
|
6235
|
-
}
|
|
6236
|
-
};
|
|
6237
|
-
function useDemoUserInfoForm(props) {
|
|
6238
|
-
const [participantType, setParticipantType] = useState(null);
|
|
6239
|
-
return cjs({
|
|
6240
|
-
step: "/1",
|
|
6241
|
-
setStep: () => { },
|
|
6242
|
-
onSubmit: () => { },
|
|
6243
|
-
onRadioClick: (value) => {
|
|
6244
|
-
setParticipantType(value);
|
|
6245
|
-
},
|
|
6246
|
-
text: props.getTextProps(),
|
|
6247
|
-
refs: {
|
|
6248
|
-
formRef: { current: null },
|
|
6249
|
-
},
|
|
6250
|
-
data: {
|
|
6251
|
-
currencies: [{ currencyCode: "CAD", displayName: "CAD" }],
|
|
6252
|
-
countries: [{ countryCode: "CA", displayName: "Canada" }],
|
|
6253
|
-
},
|
|
6254
|
-
states: {
|
|
6255
|
-
disabled: false,
|
|
6256
|
-
formState: { participantType },
|
|
6257
|
-
loading: false,
|
|
6258
|
-
isPartner: false,
|
|
6259
|
-
},
|
|
6260
|
-
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
6261
|
-
}
|
|
6262
|
-
|
|
6263
4352
|
function UserNameView(props) {
|
|
6264
4353
|
return h$1(Host, null, props.loading ? props.loadingText : props.username);
|
|
6265
4354
|
}
|
|
@@ -6318,4 +4407,4 @@ function useUserNameDemo(props) {
|
|
|
6318
4407
|
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
6319
4408
|
}
|
|
6320
4409
|
|
|
6321
|
-
export { BigStat as sqm_big_stat, BrandComponent as sqm_brand, CardFeed as sqm_card_feed, CheckboxField as sqm_checkbox_field, CouponCode as sqm_coupon_code, DividedLayout as sqm_divided_layout,
|
|
4410
|
+
export { BigStat as sqm_big_stat, BrandComponent as sqm_brand, CardFeed as sqm_card_feed, CheckboxField as sqm_checkbox_field, CouponCode as sqm_coupon_code, DividedLayout as sqm_divided_layout, DropdownField as sqm_dropdown_field, EditProfile as sqm_edit_profile, Hero as sqm_hero, HeroImage as sqm_hero_image, SqmHookStoryContainer as sqm_hook_story_container, InputField as sqm_input_field, Leaderboard as sqm_leaderboard, LinkButton as sqm_link_button, NameFields as sqm_name_fields, NavigationMenu as sqm_navigation_menu, PortalChangePassword as sqm_portal_change_password, PortalFooter as sqm_portal_footer, PortalFrame as sqm_portal_frame, PortalLogin as sqm_portal_login, PortalRegister as sqm_portal_register, ProgramExplainer as sqm_program_explainer, ProgramExplainerStep as sqm_program_explainer_step, ProgramMenu as sqm_program_menu, ReferralCard as sqm_referral_card, SqmReferralIframe as sqm_referral_iframe, SqmRewardExchangeList as sqm_reward_exchange_list, SqmRouter as sqm_router, Scroll as sqm_scroll, ShareButton as sqm_share_button, ShareCode as sqm_share_code, ShareLink as sqm_share_link, StatContainer as sqm_stat_container, TaskCard as sqm_task_card, Timeline as sqm_timeline, TimelineReward as sqm_timeline_entry, UserName as sqm_user_name };
|