@saasquatch/mint-components 1.8.0-126 → 1.8.0-128

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/cjs/sqm-banking-info-form_16.cjs.entry.js +210 -231
  2. package/dist/collection/components/sqm-invoice-table/cells/sqm-invoice-table-data-cell.js +0 -1
  3. package/dist/collection/components/sqm-invoice-table/sqm-invoice-table.js +0 -1
  4. package/dist/collection/components/sqm-invoice-table/useInvoiceTable.js +0 -1
  5. package/dist/collection/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.js +15 -15
  6. package/dist/collection/components/tax-and-cash/sqm-banking-info-form/useBankingInfoForm.js +7 -29
  7. package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/sqm-indirect-tax-form.js +2 -2
  8. package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.js +2 -11
  9. package/dist/collection/components/tax-and-cash/sqm-payout-details-card/sqm-payout-details-card-view.js +0 -1
  10. package/dist/collection/components/tax-and-cash/sqm-payout-details-card/usePayoutDetailsCard.js +8 -10
  11. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/data.js +1 -0
  12. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.js +18 -17
  13. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/useTaxAndCash.js +40 -7
  14. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/useTaxAndCashDashboard.js +1 -1
  15. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form.js +5 -4
  16. package/dist/collection/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.js +5 -25
  17. package/dist/esm/sqm-banking-info-form_16.entry.js +211 -232
  18. package/dist/esm-es5/sqm-banking-info-form_16.entry.js +1 -1
  19. package/dist/mint-components/mint-components.esm.js +1 -1
  20. package/dist/mint-components/p-121809a2.system.js +1 -1
  21. package/dist/mint-components/p-84144be4.system.entry.js +1 -0
  22. package/dist/mint-components/p-c085d8d5.entry.js +148 -0
  23. package/dist/types/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form-view.d.ts +4 -4
  24. package/dist/types/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.d.ts +6 -6
  25. package/dist/types/components/tax-and-cash/sqm-indirect-tax-form/sqm-indirect-tax-form.d.ts +1 -1
  26. package/dist/types/components/tax-and-cash/sqm-tax-and-cash/data.d.ts +1 -0
  27. package/dist/types/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.d.ts +9 -8
  28. package/dist/types/components/tax-and-cash/sqm-tax-and-cash/useTaxAndCash.d.ts +7 -0
  29. package/dist/types/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form.d.ts +2 -1
  30. package/dist/types/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.d.ts +3 -8
  31. package/dist/types/components.d.ts +36 -32
  32. package/dist/types/global/android.d.ts +7 -0
  33. package/dist/types/global/demo.d.ts +2 -0
  34. package/dist/types/stories/features.d.ts +4 -0
  35. package/dist/types/stories/templates.d.ts +4 -0
  36. package/docs/docs.docx +0 -0
  37. package/docs/raisins.json +1 -1
  38. package/grapesjs/grapesjs.js +1 -1
  39. package/package.json +1 -1
  40. package/dist/mint-components/p-17499dde.system.entry.js +0 -1
  41. package/dist/mint-components/p-c83aeea2.entry.js +0 -148
@@ -331,6 +331,7 @@ const USER_QUERY_NAMESPACE = "sq:user-info-query";
331
331
  const USER_FORM_CONTEXT_NAMESPACE = "sq:user-form-context";
332
332
  const FINANCE_NETWORK_SETTINGS_NAMESPACE = "sq:finance-network-settings";
333
333
  const COUNTRIES_NAMESPACE = "sq:countries:list";
334
+ const SORTED_COUNTRIES_NAMESPACE = "sq:countries:sorted";
334
335
  const COUNTRIES_QUERY_NAMESPACE = "sq:countries:query";
335
336
  const CURRENCIES_NAMESPACE = "sq:currencies:list";
336
337
  const CURRENCIES_QUERY_NAMESPACE = "sq:currencies:query";
@@ -1450,6 +1451,7 @@ function useBankingInfoForm(props) {
1450
1451
  const formRef = stencilHooks_module.useRef(null);
1451
1452
  const [step, setStep] = useParent(TAX_CONTEXT_NAMESPACE);
1452
1453
  const context = useParentValue(TAX_FORM_CONTEXT_NAMESPACE);
1454
+ const countries = useParentValue(SORTED_COUNTRIES_NAMESPACE);
1453
1455
  const { data: paymentOptionsData, loading: paymentOptionsLoading, errors: paymentOptionsError, } = useParentQueryValue(FINANCE_NETWORK_SETTINGS_NAMESPACE);
1454
1456
  const { data: userData, refetch, errors: userError, } = useParentQueryValue(USER_QUERY_NAMESPACE);
1455
1457
  const [saveWithdrawalSettings] = index_module.Me(SAVE_WITHDRAWAL_SETTINGS);
@@ -1474,29 +1476,6 @@ function useBankingInfoForm(props) {
1474
1476
  }),
1475
1477
  };
1476
1478
  const paymentMethodFeeLabel = paymentMethodFeeMap[currentPaymentOption === null || currentPaymentOption === void 0 ? void 0 : currentPaymentOption.defaultFinancePaymentMethodId];
1477
- const intlLocale = (locale === null || locale === void 0 ? void 0 : locale.replace("_", "-")) || "en";
1478
- // filter out any duplicate countries and null countryCode
1479
- const availableCountries = stencilHooks_module.useMemo(() => new Set(paymentOptions === null || paymentOptions === void 0 ? void 0 : paymentOptions.map((option) => option.countryCode).filter((value) => value)), [paymentOptions]);
1480
- const getCountryObj = (country) => {
1481
- // @ts-ignore DisplayNames not in Intl type
1482
- const name = new Intl.DisplayNames([intlLocale], {
1483
- type: "region",
1484
- }).of(country);
1485
- return {
1486
- code: country,
1487
- name,
1488
- };
1489
- };
1490
- const sortByName = (a, b) => a.name < b.name ? -1 : 1;
1491
- const _topCountries = ["CA", "GB", "US"];
1492
- const countries = stencilHooks_module.useMemo(() => Array.from(availableCountries)
1493
- .map((c) => getCountryObj(c))
1494
- .sort(sortByName)
1495
- .reduce((prev, countryObj) => {
1496
- if (_topCountries.includes(countryObj.code))
1497
- return [countryObj, ...prev];
1498
- return [...prev, countryObj];
1499
- }, []), [availableCountries]);
1500
1479
  const [filteredCountries, setFilteredCountries] = stencilHooks_module.useState(countries || []);
1501
1480
  const hasPayPal = !!(paymentOptions === null || paymentOptions === void 0 ? void 0 : paymentOptions.find((option) => option.defaultFinancePaymentMethodId === PAYPAL_PAYMENT_METHOD));
1502
1481
  const paymentMethodChecked = !hasPayPal
@@ -1526,10 +1505,10 @@ function useBankingInfoForm(props) {
1526
1505
  };
1527
1506
  }
1528
1507
  const currentPaymentOption = paymentOptions === null || paymentOptions === void 0 ? void 0 : paymentOptions.find((paymentOption) => {
1529
- if (paymentOption.countryCode !== initialData.bankCountry)
1530
- return false;
1531
1508
  if (initialData.paymentMethod === "PAYPAL" &&
1532
- paymentOption.defaultFinancePaymentMethodId !== 7)
1509
+ paymentOption.defaultFinancePaymentMethodId === 7)
1510
+ return true;
1511
+ if (paymentOption.countryCode !== initialData.bankCountry)
1533
1512
  return false;
1534
1513
  return true;
1535
1514
  });
@@ -1548,7 +1527,7 @@ function useBankingInfoForm(props) {
1548
1527
  setFilteredCountries(countries || []);
1549
1528
  }
1550
1529
  else {
1551
- setFilteredCountries(countries.filter((c) => c.name.toLowerCase().includes(countrySearch.toLowerCase())) || []);
1530
+ setFilteredCountries(countries.filter((c) => c.displayName.toLowerCase().includes(countrySearch.toLowerCase())) || []);
1552
1531
  }
1553
1532
  }, [countrySearch, countries]);
1554
1533
  const updateBankCountry = (bankCountry) => {
@@ -1805,18 +1784,18 @@ const BankingInfoForm = class {
1805
1784
  */
1806
1785
  this.classificationEntityLabel = "Classification Entity";
1807
1786
  /**
1808
- * Label text for the business select item
1809
- * @uiName Business select item label
1787
+ * One of three options listed for the classification field
1788
+ * @uiName Business classification option
1810
1789
  */
1811
1790
  this.businessSelectItemLabel = "Business";
1812
1791
  /**
1813
- * Label text for the individual select item
1814
- * @uiName Individual select item label
1792
+ * One of three options listed for the classification field
1793
+ * @uiName Individual classification option
1815
1794
  */
1816
1795
  this.individualSelectItemLabel = "Individual";
1817
1796
  /**
1818
- * Label text for the foreign select item
1819
- * @uiName Foreign select item label
1797
+ * One of three options listed for the classification field
1798
+ * @uiName Foreign classification option
1820
1799
  */
1821
1800
  this.foreignSelectItemLabel = "Foreign";
1822
1801
  /**
@@ -2004,9 +1983,9 @@ const BankingInfoForm = class {
2004
1983
  props.callbacks.setCountrySearch(e.target.value);
2005
1984
  } }), (_d = props.states.countries) === null || _d === void 0 ? void 0 :
2006
1985
  _d.map((country) => {
2007
- return (index.h("sl-menu-item", { value: country.code }, country.name));
1986
+ return (index.h("sl-menu-item", { value: country.countryCode }, country.displayName));
2008
1987
  }), (_f = (_e = props.states) === null || _e === void 0 ? void 0 : _e.allCountries) === null || _f === void 0 ? void 0 :
2009
- _f.map((c) => (index.h("sl-menu-item", { value: c.code, style: { display: "none" } }, c.name))))),
1988
+ _f.map((c) => (index.h("sl-menu-item", { value: c.countryCode, style: { display: "none" } }, c.displayName))))),
2010
1989
  paymentMethodSlot: (index.h("sl-input", { key: "paymentMethod", label: props.text.paymentMethod, placeholder: props.states.paymentMethodFeeLabel, disabled: true })),
2011
1990
  paymentThresholdSelectSlot: (index.h("sl-select", Object.assign({ required: true, label: props.text.paymentThresholdSelectLabel, name: "/paymentThreshold", id: "paymentThreshold", value: ((_h = (_g = props.states) === null || _g === void 0 ? void 0 : _g.formState) === null || _h === void 0 ? void 0 : _h.paymentThreshold) || "" }, (((_j = errors === null || errors === void 0 ? void 0 : errors.inputErrors) === null || _j === void 0 ? void 0 : _j.paymentThreshold) && {
2012
1991
  class: "error-input",
@@ -2921,6 +2900,176 @@ const IndirectTaxFormView = (props) => {
2921
2900
  index.h("sl-button", { class: classes.SecondaryBtn, type: "text", disabled: states.disabled, onClick: callbacks.onBack, exportparts: "base: secondarybutton-base" }, text.backButton))))));
2922
2901
  };
2923
2902
 
2903
+ function getCurrentStep(user) {
2904
+ var _a;
2905
+ if (!((_a = user.impactConnection) === null || _a === void 0 ? void 0 : _a.connected)) {
2906
+ return "/1";
2907
+ }
2908
+ const { requiredTaxDocumentType, currentTaxDocument, withdrawalSettings } = user.impactConnection.publisher;
2909
+ // If they do have a required document, look at current document
2910
+ if (requiredTaxDocumentType && !currentTaxDocument) {
2911
+ return "/3";
2912
+ }
2913
+ if (!withdrawalSettings)
2914
+ return "/4";
2915
+ return "/dashboard";
2916
+ }
2917
+ function useTaxAndCash() {
2918
+ var _a, _b, _c, _d, _e;
2919
+ const host = index_module.O();
2920
+ // setupDemo();
2921
+ /** END DEMO DATA */
2922
+ const user = index_module.H();
2923
+ const locale = index_module.N();
2924
+ // State for current step of form
2925
+ const [step, setStep] = useParentState({
2926
+ namespace: TAX_CONTEXT_NAMESPACE,
2927
+ initialValue: "/loading",
2928
+ });
2929
+ // State for when to hide steps, or override certain actions
2930
+ const [context, setContext] = useParentState({
2931
+ namespace: TAX_FORM_CONTEXT_NAMESPACE,
2932
+ initialValue: {},
2933
+ });
2934
+ // State to carry user form information into step 2
2935
+ const [userFormContext, setUserFormContext] = useParentState({
2936
+ namespace: USER_FORM_CONTEXT_NAMESPACE,
2937
+ initialValue: {
2938
+ firstName: undefined,
2939
+ lastName: undefined,
2940
+ email: undefined,
2941
+ countryCode: undefined,
2942
+ currency: undefined,
2943
+ },
2944
+ });
2945
+ const [_currenciesContext, setCurrenciesContext] = useParentState({
2946
+ namespace: CURRENCIES_NAMESPACE,
2947
+ initialValue: [],
2948
+ });
2949
+ const [_countriesContext, setCountriesContext] = useParentState({
2950
+ namespace: COUNTRIES_NAMESPACE,
2951
+ initialValue: [],
2952
+ });
2953
+ const [_sortedCountriesContext, setSortedCountriesContext] = useParentState({
2954
+ namespace: SORTED_COUNTRIES_NAMESPACE,
2955
+ initialValue: [],
2956
+ });
2957
+ const { data, errors } = useParentQuery({
2958
+ namespace: USER_QUERY_NAMESPACE,
2959
+ query: GET_USER,
2960
+ skip: !user,
2961
+ });
2962
+ const countryCode = ((_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher) === null || _c === void 0 ? void 0 : _c.countryCode) ||
2963
+ userFormContext.countryCode;
2964
+ useParentQuery({
2965
+ namespace: COUNTRIES_QUERY_NAMESPACE,
2966
+ query: GET_COUNTRIES,
2967
+ skip: !user,
2968
+ });
2969
+ const { data: financeNetworkData, refetch } = useParentQuery({
2970
+ namespace: FINANCE_NETWORK_SETTINGS_NAMESPACE,
2971
+ query: GET_FINANCE_NETWORK_SETTINGS,
2972
+ skip: !user,
2973
+ variables: {
2974
+ filter: getFinanceNetworkFilter(),
2975
+ },
2976
+ });
2977
+ const { data: currenciesData } = useParentQuery({
2978
+ namespace: CURRENCIES_QUERY_NAMESPACE,
2979
+ query: GET_CURRENCIES,
2980
+ skip: !user,
2981
+ variables: {
2982
+ locale,
2983
+ },
2984
+ });
2985
+ const supportedCurrencies = stencilHooks_module.useMemo(() => {
2986
+ var _a, _b;
2987
+ // Filter out any currencies not supported by finance network settings
2988
+ const allValidCurrencies = (_b = (_a = financeNetworkData === null || financeNetworkData === void 0 ? void 0 : financeNetworkData.impactFinanceNetworkSettings) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.reduce((agg, settings) => {
2989
+ var _a, _b;
2990
+ const currency = (_b = (_a = currenciesData === null || currenciesData === void 0 ? void 0 : currenciesData.currencies) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.find((currency) => currency.currencyCode === settings.currency);
2991
+ // Currency not in supported list
2992
+ if (!currency)
2993
+ return agg;
2994
+ // Currency already added to list
2995
+ if (agg.find((currency) => currency.currencyCode === settings.currency))
2996
+ return agg;
2997
+ // Currency not supported by selected country
2998
+ if (userFormContext.countryCode &&
2999
+ settings.countryCode !== countryCode)
3000
+ return agg;
3001
+ return [...agg, currency];
3002
+ }, []);
3003
+ return allValidCurrencies;
3004
+ }, [financeNetworkData, countryCode]);
3005
+ const intlLocale = (locale === null || locale === void 0 ? void 0 : locale.replace("_", "-")) || "en";
3006
+ const sortByName = (a, b) => a.displayName < b.displayName ? -1 : 1;
3007
+ const paymentOptions = (_d = financeNetworkData === null || financeNetworkData === void 0 ? void 0 : financeNetworkData.impactFinanceNetworkSettings) === null || _d === void 0 ? void 0 : _d.data;
3008
+ // filter out any duplicate countries and null countryCode
3009
+ const availableCountries = stencilHooks_module.useMemo(() => new Set(paymentOptions === null || paymentOptions === void 0 ? void 0 : paymentOptions.map((option) => option.countryCode).filter((value) => value)), [paymentOptions]);
3010
+ const _topCountries = ["CA", "GB", "US"];
3011
+ const sortedCountries = stencilHooks_module.useMemo(() => Array.from(availableCountries)
3012
+ .map((countryCode) => getCountryObj({ countryCode, locale: intlLocale }))
3013
+ .sort(sortByName)
3014
+ .reduce((prev, countryObj) => {
3015
+ if (_topCountries.includes(countryObj.countryCode))
3016
+ return [countryObj, ...prev];
3017
+ return [...prev, countryObj];
3018
+ }, []), [availableCountries]);
3019
+ stencilHooks_module.useEffect(() => {
3020
+ if (sortedCountries)
3021
+ setSortedCountriesContext(sortedCountries);
3022
+ }, [sortedCountries]);
3023
+ stencilHooks_module.useEffect(() => {
3024
+ if (supportedCurrencies)
3025
+ setCurrenciesContext(supportedCurrencies);
3026
+ }, [supportedCurrencies]);
3027
+ stencilHooks_module.useEffect(() => {
3028
+ if (errors) {
3029
+ setStep("/error");
3030
+ return;
3031
+ }
3032
+ if (!host || !user)
3033
+ return;
3034
+ if (data) {
3035
+ const user = data === null || data === void 0 ? void 0 : data.user;
3036
+ if (!user || step !== "/loading")
3037
+ return;
3038
+ const currentStep = getCurrentStep(user);
3039
+ setStep(currentStep);
3040
+ }
3041
+ }, [host, user, (_e = data === null || data === void 0 ? void 0 : data.user) === null || _e === void 0 ? void 0 : _e.email, errors]);
3042
+ function getFinanceNetworkFilter() {
3043
+ var _a, _b, _c;
3044
+ if (step === "/1")
3045
+ return {};
3046
+ if (step === "/4")
3047
+ return { currency_eq: (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher) === null || _c === void 0 ? void 0 : _c.currency };
3048
+ if (countryCode)
3049
+ return {
3050
+ countryCode_eq: countryCode,
3051
+ };
3052
+ return {};
3053
+ }
3054
+ return {
3055
+ step,
3056
+ setStep,
3057
+ context,
3058
+ namespace: getContextValueName(TAX_CONTEXT_NAMESPACE),
3059
+ loading: step === "/loading",
3060
+ };
3061
+ }
3062
+ function getCountryObj({ countryCode, locale, }) {
3063
+ // @ts-ignore DisplayNames not in Intl type
3064
+ const displayName = new Intl.DisplayNames([locale], {
3065
+ type: "region",
3066
+ }).of(countryCode);
3067
+ return {
3068
+ countryCode,
3069
+ displayName,
3070
+ };
3071
+ }
3072
+
2924
3073
  const CONNECT_PARTNER = index_module.dist.gql `
2925
3074
  mutation createImpactConnection($vars: ImpactConnectionInput!) {
2926
3075
  createImpactConnection(impactConnectionInput: $vars) {
@@ -2957,17 +3106,7 @@ function useIndirectTaxForm(props) {
2957
3106
  const { data: userData, refetch, errors: userError, } = useParentQueryValue(USER_QUERY_NAMESPACE);
2958
3107
  const { data: _countriesRes, loading: countriesLoading } = useParentQueryValue(COUNTRIES_QUERY_NAMESPACE);
2959
3108
  const intlLocale = (locale === null || locale === void 0 ? void 0 : locale.replace("_", "-")) || "en";
2960
- const getCountryObj = (countryCode) => {
2961
- // @ts-ignore DisplayNames not in Intl type
2962
- const displayName = new Intl.DisplayNames([intlLocale], {
2963
- type: "region",
2964
- }).of(countryCode);
2965
- return {
2966
- countryCode,
2967
- displayName,
2968
- };
2969
- };
2970
- const _countries = stencilHooks_module.useMemo(() => { var _a, _b; return (_b = (_a = _countriesRes === null || _countriesRes === void 0 ? void 0 : _countriesRes.impactPayoutCountries) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.map((country) => getCountryObj(country.countryCode)); }, [(_a = _countriesRes === null || _countriesRes === void 0 ? void 0 : _countriesRes.impactPayoutCountries) === null || _a === void 0 ? void 0 : _a.data]);
3109
+ const _countries = stencilHooks_module.useMemo(() => { var _a, _b; return (_b = (_a = _countriesRes === null || _countriesRes === void 0 ? void 0 : _countriesRes.impactPayoutCountries) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.map((country) => getCountryObj({ countryCode: country.countryCode, locale: intlLocale })); }, [(_a = _countriesRes === null || _countriesRes === void 0 ? void 0 : _countriesRes.impactPayoutCountries) === null || _a === void 0 ? void 0 : _a.data]);
2971
3110
  const [loading, setLoading] = stencilHooks_module.useState(false);
2972
3111
  const [formState, setFormState] = stencilHooks_module.useState({});
2973
3112
  const [errors, setErrors] = stencilHooks_module.useState({});
@@ -3209,7 +3348,7 @@ const IndirectTaxForm = class {
3209
3348
  this.isRegisteredSubRegionIncomeTax = "I am an individual registered for Income Tax purposes in Spain, and withholding tax will apply to any payments made to me.";
3210
3349
  /**
3211
3350
  * Displayed to participants registered in Spain.
3212
- * @uiName Sub-region input label
3351
+ * @uiName Sub-region of indirect tax field label
3213
3352
  */
3214
3353
  this.subRegion = "Sub-region";
3215
3354
  /**
@@ -3462,7 +3601,6 @@ function useInvoiceTable(props, emptyElement, loadingElement) {
3462
3601
  limit: props.perPage,
3463
3602
  offset: 0,
3464
3603
  }, {}, !(user === null || user === void 0 ? void 0 : user.jwt));
3465
- console.log({ invoicesData });
3466
3604
  const tick = reRender.useRerenderListener();
3467
3605
  const components = useChildElements.useChildElements();
3468
3606
  const data = invoicesData === null || invoicesData === void 0 ? void 0 : invoicesData.data;
@@ -3664,7 +3802,6 @@ function useInvoiceTableDemo(props, emptyElement, loadingElement) {
3664
3802
  ((_a = component === null || component === void 0 ? void 0 : component.firstElementChild) === null || _a === void 0 ? void 0 : _a.getAttribute("slot")) !== "loading" &&
3665
3803
  ((_b = component === null || component === void 0 ? void 0 : component.firstElementChild) === null || _b === void 0 ? void 0 : _b.getAttribute("slot")) !== "empty";
3666
3804
  });
3667
- console.log({ componentData, columnComponents });
3668
3805
  // get the column titles (renderLabel is asynchronous)
3669
3806
  const columnsPromise = columnComponents === null || columnComponents === void 0 ? void 0 : columnComponents.map(async (c, idx) => {
3670
3807
  var _a;
@@ -3740,7 +3877,6 @@ const InvoiceTableDataCell = class {
3740
3877
  }
3741
3878
  disconnectedCallback() { }
3742
3879
  render() {
3743
- console.log(this.data);
3744
3880
  return this.data;
3745
3881
  }
3746
3882
  };
@@ -3982,7 +4118,6 @@ function PayoutDetailsCardView(props) {
3982
4118
  index.h("sl-skeleton", { class: classes.SkeletonOne })));
3983
4119
  };
3984
4120
  const renderStatusBadge = (status, statusBadgeText) => {
3985
- console.log(status, statusBadgeText, "debug status text");
3986
4121
  const badgeType = status === "nextPayout" ? "success" : "primary";
3987
4122
  const statusText = global.intl.formatMessage({
3988
4123
  id: "badgeText",
@@ -4024,7 +4159,7 @@ function PayoutDetailsCardView(props) {
4024
4159
  }
4025
4160
 
4026
4161
  function usePayoutDetailsCard(props) {
4027
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
4162
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
4028
4163
  const { data, loading } = useParentQueryValue(USER_QUERY_NAMESPACE);
4029
4164
  const publisher = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher;
4030
4165
  function getPayoutDetailedStatusText(paymentDay) {
@@ -4058,24 +4193,22 @@ function usePayoutDetailsCard(props) {
4058
4193
  });
4059
4194
  }
4060
4195
  }
4061
- // TODO: need to which timezone payouts are processed in
4062
4196
  const paymentDay = getPayoutDetailedStatusText((_c = publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) === null || _c === void 0 ? void 0 : _c.paymentDay);
4063
4197
  const isPayoutToday = luxon.luxon.DateTime.now().toFormat("LLL dd, yyyy") === paymentDay;
4064
- console.log({ threshold: (_d = publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) === null || _d === void 0 ? void 0 : _d.paymentThreshold });
4065
4198
  return {
4066
4199
  states: {
4067
4200
  loading,
4068
- thresholdBalance: `${publisher === null || publisher === void 0 ? void 0 : publisher.currency}${(_e = publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) === null || _e === void 0 ? void 0 : _e.paymentThreshold}`,
4069
- balance: (_f = publisher === null || publisher === void 0 ? void 0 : publisher.payoutsAccount) === null || _f === void 0 ? void 0 : _f.balance,
4070
- badgeStatus: ((_g = publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) === null || _g === void 0 ? void 0 : _g.paymentSchedulingType) !== "FIXED_DAY"
4201
+ thresholdBalance: `${publisher === null || publisher === void 0 ? void 0 : publisher.currency}${(_d = publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) === null || _d === void 0 ? void 0 : _d.paymentThreshold}`,
4202
+ balance: (_e = publisher === null || publisher === void 0 ? void 0 : publisher.payoutsAccount) === null || _e === void 0 ? void 0 : _e.balance,
4203
+ badgeStatus: ((_f = publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) === null || _f === void 0 ? void 0 : _f.paymentSchedulingType) !== "FIXED_DAY"
4071
4204
  ? "thresholdPayout"
4072
4205
  : isPayoutToday
4073
4206
  ? "payoutToday"
4074
4207
  : "nextPayout",
4075
- payoutType: (_h = publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) === null || _h === void 0 ? void 0 : _h.paymentMethod,
4076
- error: (_j = publisher === null || publisher === void 0 ? void 0 : publisher.payoutsAccount) === null || _j === void 0 ? void 0 : _j.hold,
4077
- paypalEmailAddress: (_k = publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) === null || _k === void 0 ? void 0 : _k.paypalEmailAddress,
4078
- cardNumberPreview: (_l = publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) === null || _l === void 0 ? void 0 : _l.bankAccountNumber,
4208
+ payoutType: (_g = publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) === null || _g === void 0 ? void 0 : _g.paymentMethod,
4209
+ error: (_h = publisher === null || publisher === void 0 ? void 0 : publisher.payoutsAccount) === null || _h === void 0 ? void 0 : _h.hold,
4210
+ paypalEmailAddress: (_j = publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) === null || _j === void 0 ? void 0 : _j.paypalEmailAddress,
4211
+ cardNumberPreview: (_k = publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) === null || _k === void 0 ? void 0 : _k.bankAccountNumber,
4079
4212
  nextPayoutDate: paymentDay,
4080
4213
  },
4081
4214
  text: props.getTextProps(),
@@ -4195,143 +4328,6 @@ function extractProps(props, prefix) {
4195
4328
  return formattedProps;
4196
4329
  }
4197
4330
 
4198
- function getCurrentStep(user) {
4199
- var _a;
4200
- if (!((_a = user.impactConnection) === null || _a === void 0 ? void 0 : _a.connected)) {
4201
- return "/1";
4202
- }
4203
- const { requiredTaxDocumentType, currentTaxDocument, withdrawalSettings } = user.impactConnection.publisher;
4204
- // If they do have a required document, look at current document
4205
- if (requiredTaxDocumentType && !currentTaxDocument) {
4206
- return "/3";
4207
- }
4208
- if (!withdrawalSettings)
4209
- return "/4";
4210
- return "/dashboard";
4211
- }
4212
- function useTaxAndCash() {
4213
- var _a, _b, _c, _d;
4214
- const host = index_module.O();
4215
- // setupDemo();
4216
- /** END DEMO DATA */
4217
- const user = index_module.H();
4218
- const locale = index_module.N();
4219
- // State for current step of form
4220
- const [step, setStep] = useParentState({
4221
- namespace: TAX_CONTEXT_NAMESPACE,
4222
- initialValue: "/loading",
4223
- });
4224
- // State for when to hide steps, or override certain actions
4225
- const [context, setContext] = useParentState({
4226
- namespace: TAX_FORM_CONTEXT_NAMESPACE,
4227
- initialValue: {},
4228
- });
4229
- // State to carry user form information into step 2
4230
- const [userFormContext, setUserFormContext] = useParentState({
4231
- namespace: USER_FORM_CONTEXT_NAMESPACE,
4232
- initialValue: {
4233
- firstName: undefined,
4234
- lastName: undefined,
4235
- email: undefined,
4236
- countryCode: undefined,
4237
- currency: undefined,
4238
- },
4239
- });
4240
- const [_currenciesContext, setCurrenciesContext] = useParentState({
4241
- namespace: CURRENCIES_NAMESPACE,
4242
- initialValue: [],
4243
- });
4244
- const [_countriesContext, setCountriesContext] = useParentState({
4245
- namespace: COUNTRIES_NAMESPACE,
4246
- initialValue: [],
4247
- });
4248
- const { data, errors } = useParentQuery({
4249
- namespace: USER_QUERY_NAMESPACE,
4250
- query: GET_USER,
4251
- skip: !user,
4252
- });
4253
- const countryCode = ((_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher) === null || _c === void 0 ? void 0 : _c.countryCode) ||
4254
- userFormContext.countryCode;
4255
- useParentQuery({
4256
- namespace: COUNTRIES_QUERY_NAMESPACE,
4257
- query: GET_COUNTRIES,
4258
- skip: !user,
4259
- });
4260
- const { data: financeNetworkData, refetch } = useParentQuery({
4261
- namespace: FINANCE_NETWORK_SETTINGS_NAMESPACE,
4262
- query: GET_FINANCE_NETWORK_SETTINGS,
4263
- skip: !user,
4264
- variables: {
4265
- filter: getFinanceNetworkFilter(),
4266
- },
4267
- });
4268
- const { data: currenciesData } = useParentQuery({
4269
- namespace: CURRENCIES_QUERY_NAMESPACE,
4270
- query: GET_CURRENCIES,
4271
- skip: !user,
4272
- variables: {
4273
- locale,
4274
- },
4275
- });
4276
- const supportedCurrencies = stencilHooks_module.useMemo(() => {
4277
- var _a, _b;
4278
- // Filter out any currencies not supported by finance network settings
4279
- const allValidCurrencies = (_b = (_a = financeNetworkData === null || financeNetworkData === void 0 ? void 0 : financeNetworkData.impactFinanceNetworkSettings) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.reduce((agg, settings) => {
4280
- var _a, _b;
4281
- const currency = (_b = (_a = currenciesData === null || currenciesData === void 0 ? void 0 : currenciesData.currencies) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.find((currency) => currency.currencyCode === settings.currency);
4282
- // Currency not in supported list
4283
- if (!currency)
4284
- return agg;
4285
- // Currency already added to list
4286
- if (agg.find((currency) => currency.currencyCode === settings.currency))
4287
- return agg;
4288
- // Currency not supported by selected country
4289
- if (userFormContext.countryCode &&
4290
- settings.countryCode !== countryCode)
4291
- return agg;
4292
- return [...agg, currency];
4293
- }, []);
4294
- return allValidCurrencies;
4295
- }, [financeNetworkData, countryCode]);
4296
- stencilHooks_module.useEffect(() => {
4297
- if (supportedCurrencies)
4298
- setCurrenciesContext(supportedCurrencies);
4299
- }, [supportedCurrencies]);
4300
- // console.log({ errors });
4301
- stencilHooks_module.useEffect(() => {
4302
- if (errors) {
4303
- setStep("/error");
4304
- return;
4305
- }
4306
- if (!host || !user)
4307
- return;
4308
- if (data) {
4309
- const user = data === null || data === void 0 ? void 0 : data.user;
4310
- if (!user || step !== "/loading")
4311
- return;
4312
- const currentStep = getCurrentStep(user);
4313
- setStep(currentStep);
4314
- }
4315
- }, [host, user, (_d = data === null || data === void 0 ? void 0 : data.user) === null || _d === void 0 ? void 0 : _d.email, errors]);
4316
- function getFinanceNetworkFilter() {
4317
- var _a, _b, _c;
4318
- if (step === "/4")
4319
- return { currency_eq: (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher) === null || _c === void 0 ? void 0 : _c.currency };
4320
- if (countryCode)
4321
- return {
4322
- countryCode_eq: countryCode,
4323
- };
4324
- return {};
4325
- }
4326
- return {
4327
- step,
4328
- setStep,
4329
- context,
4330
- namespace: getContextValueName(TAX_CONTEXT_NAMESPACE),
4331
- loading: step === "/loading",
4332
- };
4333
- }
4334
-
4335
4331
  const TaxAndCashMonolith = class {
4336
4332
  constructor(hostRef) {
4337
4333
  index.registerInstance(this, hostRef);
@@ -4377,12 +4373,13 @@ const TaxAndCashMonolith = class {
4377
4373
  */
4378
4374
  this.step1_personalInformation = "Personal Information";
4379
4375
  /**
4380
- * Label text for tax and banking collection checkbox
4376
+ Edit the property called terms and conditions text to change what's displayed for {termsAndConditionsLink}.
4381
4377
  * @uiName Terms and conditions checkbox
4382
4378
  * @uiGroup Step 1 Properties
4383
4379
  */
4384
4380
  this.step1_allowBankingCollection = "I have read the {termsAndConditionsLink} and allow impact.com to collect my tax and banking information";
4385
4381
  /**
4382
+ * The text link that appears in the terms and conditions checkbox
4386
4383
  * @uiName Terms and conditions text
4387
4384
  * @uiGroup Step 1 Properties
4388
4385
  * @uiWidget textArea
@@ -4483,7 +4480,7 @@ const TaxAndCashMonolith = class {
4483
4480
  this.step2_isRegisteredSubRegionIncomeTax = "I am an individual registered for Income Tax purposes in Spain, and withholding tax will apply to any payments made to me.";
4484
4481
  /**
4485
4482
  * Displayed to participants registered in Spain.
4486
- * @uiName Sub-region input label
4483
+ * @uiName Sub-region of indirect tax field label
4487
4484
  * @uiGroup Step 2 Properties
4488
4485
  */
4489
4486
  this.step2_subRegion = "Sub-region";
@@ -4712,20 +4709,20 @@ const TaxAndCashMonolith = class {
4712
4709
  */
4713
4710
  this.step4_classificationEntityLabel = "Classification entity";
4714
4711
  /**
4715
- * Label text for the business select item
4716
- * @uiName Business select item label
4712
+ * One of three options listed for the classification field
4713
+ * @uiName Business classification option
4717
4714
  * @uiGroup Step 4 Properties
4718
4715
  */
4719
4716
  this.step4_businessSelectItemLabel = "Business";
4720
4717
  /**
4721
- * Label text for the individual select item
4722
- * @uiName Individual select item label
4718
+ * One of three options listed for the classification field
4719
+ * @uiName Individual classification option
4723
4720
  * @uiGroup Step 4 Properties
4724
4721
  */
4725
4722
  this.step4_individualSelectItemLabel = "Individual";
4726
4723
  /**
4727
- * Label text for the foreign select item
4728
- * @uiName Foreign select item label
4724
+ * One of three options listed for the classification field
4725
+ * @uiName Foreign classification option
4729
4726
  * @uiGroup Step 4 Properties
4730
4727
  */
4731
4728
  this.step4_foreignSelectItemLabel = "Foreign";
@@ -5558,7 +5555,7 @@ function getCountryName(countryCode, locale) {
5558
5555
  if (!countryCode)
5559
5556
  return undefined;
5560
5557
  // @ts-ignore: DisplayNames exists on Intl
5561
- return new Intl.DisplayNames([locale.replace("_", "-")], {
5558
+ return new Intl.DisplayNames([(locale === null || locale === void 0 ? void 0 : locale.replace("_", "-")) || "en-US"], {
5562
5559
  type: "region",
5563
5560
  }).of([countryCode]);
5564
5561
  }
@@ -6164,35 +6161,16 @@ const UserInfoFormView = (props) => {
6164
6161
  };
6165
6162
 
6166
6163
  function useUserInfoForm(props) {
6167
- var _a, _b, _c, _d, _e;
6168
- const user = index_module.H();
6169
- const locale = index_module.N();
6164
+ var _a, _b, _c, _d;
6170
6165
  const currencyRef = stencilHooks_module.useRef(undefined);
6171
6166
  const formRef = stencilHooks_module.useRef(null);
6172
6167
  const context = useParentValue(TAX_FORM_CONTEXT_NAMESPACE);
6168
+ const countries = useParentValue(SORTED_COUNTRIES_NAMESPACE);
6173
6169
  const [step, setStep] = useParent(TAX_CONTEXT_NAMESPACE);
6174
6170
  const [userFormContext, setUserFormContext] = useParent(USER_FORM_CONTEXT_NAMESPACE);
6175
6171
  const { data, loading, errors: userError, } = useParentQueryValue(USER_QUERY_NAMESPACE);
6176
- const { data: countriesRes, loading: countriesLoading } = useParentQueryValue(COUNTRIES_QUERY_NAMESPACE);
6177
6172
  const _currencies = useParentValue(CURRENCIES_NAMESPACE);
6178
6173
  const currencies = stencilHooks_module.useMemo(() => [...(_currencies || [])].sort((a, b) => a.displayName.localeCompare(b.displayName)), [_currencies]);
6179
- const intlLocale = (locale === null || locale === void 0 ? void 0 : locale.replace("_", "-")) || "en";
6180
- const getCountryObj = (countryCode) => {
6181
- // @ts-ignore DisplayNames not in Intl type
6182
- const displayName = new Intl.DisplayNames([intlLocale], {
6183
- type: "region",
6184
- }).of(countryCode);
6185
- return {
6186
- countryCode,
6187
- displayName,
6188
- };
6189
- };
6190
- const countries = stencilHooks_module.useMemo(() => {
6191
- var _a;
6192
- return [...(((_a = countriesRes === null || countriesRes === void 0 ? void 0 : countriesRes.impactPayoutCountries) === null || _a === void 0 ? void 0 : _a.data) || [])]
6193
- .sort((a, b) => a.displayName.localeCompare(b.displayName))
6194
- .map((country) => getCountryObj(country.countryCode));
6195
- }, [(_a = countriesRes === null || countriesRes === void 0 ? void 0 : countriesRes.impactPayoutCountries) === null || _a === void 0 ? void 0 : _a.data]);
6196
6174
  const [countrySearch, setCountrySearch] = stencilHooks_module.useState("");
6197
6175
  const [filteredCountries, setFilteredCountries] = stencilHooks_module.useState(countries || []);
6198
6176
  const [currencySearch, setCurrencySearch] = stencilHooks_module.useState("");
@@ -6320,8 +6298,8 @@ function useUserInfoForm(props) {
6320
6298
  disabled: loading,
6321
6299
  loadingError: !!(userError === null || userError === void 0 ? void 0 : userError.message),
6322
6300
  loading: loading,
6323
- isPartner: !!((_c = (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.impactConnection) === null || _c === void 0 ? void 0 : _c.publisher),
6324
- isUser: !!((_e = (_d = data === null || data === void 0 ? void 0 : data.user) === null || _d === void 0 ? void 0 : _d.impactConnection) === null || _e === void 0 ? void 0 : _e.user),
6301
+ isPartner: !!((_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher),
6302
+ isUser: !!((_d = (_c = data === null || data === void 0 ? void 0 : data.user) === null || _c === void 0 ? void 0 : _c.impactConnection) === null || _d === void 0 ? void 0 : _d.user),
6325
6303
  formState: {
6326
6304
  ...userFormContext,
6327
6305
  errors: formErrors,
@@ -6395,11 +6373,12 @@ const TaxForm = class {
6395
6373
  */
6396
6374
  this.generalErrorDescription = "Please review your information and try again. If this problem continues, contact Support.";
6397
6375
  /**
6398
- * Label text for tax and banking collection checkbox
6376
+ * Edit the property called terms and conditions text to change what's displayed for {termsAndConditionsLink}.
6399
6377
  * @uiName Terms and conditions checkbox
6400
6378
  */
6401
6379
  this.allowBankingCollection = "I have read the {termsAndConditionsLink} and allow impact.com to collect my tax and banking information";
6402
6380
  /**
6381
+ * The text link that appears in the terms and conditions checkbox
6403
6382
  * @uiName Terms and conditions text
6404
6383
  * @uiWidget textArea
6405
6384
  */
@@ -7,7 +7,6 @@ export class InvoiceTableDataCell {
7
7
  }
8
8
  disconnectedCallback() { }
9
9
  render() {
10
- console.log(this.data);
11
10
  return this.data;
12
11
  }
13
12
  static get is() { return "sqm-invoice-table-data-cell"; }
@@ -390,7 +390,6 @@ function useInvoiceTableDemo(props, emptyElement, loadingElement) {
390
390
  ((_a = component === null || component === void 0 ? void 0 : component.firstElementChild) === null || _a === void 0 ? void 0 : _a.getAttribute("slot")) !== "loading" &&
391
391
  ((_b = component === null || component === void 0 ? void 0 : component.firstElementChild) === null || _b === void 0 ? void 0 : _b.getAttribute("slot")) !== "empty";
392
392
  });
393
- console.log({ componentData, columnComponents });
394
393
  // get the column titles (renderLabel is asynchronous)
395
394
  const columnsPromise = columnComponents === null || columnComponents === void 0 ? void 0 : columnComponents.map(async (c, idx) => {
396
395
  var _a;