@saasquatch/mint-components 2.3.1 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/sqm-email-verification_2.cjs.entry.js +39 -14
- package/dist/cjs/{sqm-partner-info-modal-view-243aad7b.js → sqm-partner-info-modal-view-431100ad.js} +13 -4
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +47 -6
- package/dist/collection/components/sqm-partner-info-modal/PartnerInfoModal.stories.js +38 -0
- package/dist/collection/components/sqm-partner-info-modal/sqm-partner-info-modal-view.js +14 -5
- package/dist/collection/components/sqm-partner-info-modal/sqm-partner-info-modal.js +1 -1
- package/dist/collection/components/sqm-partner-info-modal/usePartnerInfoModal.js +38 -13
- package/dist/esm/sqm-email-verification_2.entry.js +39 -14
- package/dist/esm/{sqm-partner-info-modal-view-8f141a4f.js → sqm-partner-info-modal-view-34d4be5b.js} +14 -5
- package/dist/esm/sqm-stencilbook.entry.js +47 -6
- package/dist/esm-es5/sqm-email-verification_2.entry.js +1 -1
- package/dist/esm-es5/sqm-partner-info-modal-view-34d4be5b.js +1 -0
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/{p-f77b89cb.entry.js → p-2e33148c.entry.js} +2 -2
- package/dist/mint-components/{p-1f68a3e6.system.entry.js → p-3784c92c.system.entry.js} +1 -1
- package/dist/mint-components/{p-61f7bf8a.entry.js → p-a303bada.entry.js} +6 -6
- package/dist/mint-components/p-ad90628d.system.js +1 -0
- package/dist/mint-components/p-bfb00685.system.js +1 -1
- package/dist/mint-components/p-c36fedea.js +1 -0
- package/dist/mint-components/p-e7f17aa1.system.entry.js +1 -0
- package/dist/types/components/sqm-partner-info-modal/PartnerInfoModal.stories.d.ts +3 -0
- package/dist/types/components/sqm-partner-info-modal/sqm-partner-info-modal-view.d.ts +5 -0
- package/docs/docs.docx +0 -0
- package/package.json +1 -1
- package/dist/esm-es5/sqm-partner-info-modal-view-8f141a4f.js +0 -1
- package/dist/mint-components/p-55847fc2.system.entry.js +0 -1
- package/dist/mint-components/p-a094da68.js +0 -1
- package/dist/mint-components/p-e7f45f18.system.js +0 -1
|
@@ -11,7 +11,7 @@ const utils = require('./utils-6847bc06.js');
|
|
|
11
11
|
const JSS = require('./JSS-8503a151.js');
|
|
12
12
|
const sqmTextSpanView = require('./sqm-text-span-view-b9e10f5d.js');
|
|
13
13
|
const data = require('./data-89ac73dd.js');
|
|
14
|
-
const sqmPartnerInfoModalView = require('./sqm-partner-info-modal-view-
|
|
14
|
+
const sqmPartnerInfoModalView = require('./sqm-partner-info-modal-view-431100ad.js');
|
|
15
15
|
const keys = require('./keys-5a2c9ed2.js');
|
|
16
16
|
const eventKeys = require('./eventKeys-7af4df4d.js');
|
|
17
17
|
const parseStates = require('./parseStates-d1effc19.js');
|
|
@@ -498,17 +498,19 @@ const START_IMPACT_CONNECTION = index_module.dist.gql `
|
|
|
498
498
|
}
|
|
499
499
|
`;
|
|
500
500
|
function usePartnerInfoModal(props) {
|
|
501
|
-
var _a, _b, _c, _d, _e;
|
|
501
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
502
502
|
const locale = index_module.L();
|
|
503
503
|
const setPartnerCreated = index_module.En(keys.PARTNER_CREATED_NAMESPACE);
|
|
504
504
|
const { data: userData, loading: userLoading, refetch, } = index_module.wn(GET_USER_PARTNER_INFO, {});
|
|
505
505
|
const user = userData === null || userData === void 0 ? void 0 : userData.user;
|
|
506
506
|
const { data: currenciesData, loading: currenciesLoading } = index_module.wn(GET_CURRENCIES, { variables: { locale } });
|
|
507
507
|
const { data: countriesData, loading: countriesLoading } = index_module.wn(GET_COUNTRIES, {});
|
|
508
|
+
const [shouldDisplayNameFields, setShouldDisplayNameFields] = domContextHooks_module.useState(false);
|
|
509
|
+
const [firstName, setFirstName] = domContextHooks_module.useState((_a = user === null || user === void 0 ? void 0 : user.firstName) !== null && _a !== void 0 ? _a : "");
|
|
510
|
+
const [lastName, setLastName] = domContextHooks_module.useState((_b = user === null || user === void 0 ? void 0 : user.lastName) !== null && _b !== void 0 ? _b : "");
|
|
508
511
|
// No pre-filled country, use locale to determine countryCode instead
|
|
509
|
-
const [countryCode, setCountryCode] = domContextHooks_module.useState(((
|
|
510
|
-
|
|
511
|
-
const [currency, setCurrency] = domContextHooks_module.useState(((_d = (_c = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _c === void 0 ? void 0 : _c.publisher) === null || _d === void 0 ? void 0 : _d.currency) || "");
|
|
512
|
+
const [countryCode, setCountryCode] = domContextHooks_module.useState(((_d = (_c = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _c === void 0 ? void 0 : _c.publisher) === null || _d === void 0 ? void 0 : _d.countryCode) || locale.replace(/^.*_/, ""));
|
|
513
|
+
const [currency, setCurrency] = domContextHooks_module.useState(((_f = (_e = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _e === void 0 ? void 0 : _e.publisher) === null || _f === void 0 ? void 0 : _f.currency) || "");
|
|
512
514
|
const { data: financeNetworkData } = index_module.wn(data.GET_FINANCE_NETWORK_SETTINGS, {
|
|
513
515
|
variables: { filter: countryCode ? { countryCode_eq: countryCode } : {} },
|
|
514
516
|
});
|
|
@@ -527,7 +529,7 @@ function usePartnerInfoModal(props) {
|
|
|
527
529
|
return a.displayName.localeCompare(b.displayName);
|
|
528
530
|
});
|
|
529
531
|
}, [countriesData]);
|
|
530
|
-
const isExistingPartner = !!((
|
|
532
|
+
const isExistingPartner = !!((_g = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _g === void 0 ? void 0 : _g.publisher);
|
|
531
533
|
const _currencies = domContextHooks_module.useMemo(() => {
|
|
532
534
|
var _a, _b, _c;
|
|
533
535
|
// if isExistingPartner, grab all currencies since select is disabled anyways
|
|
@@ -554,14 +556,21 @@ function usePartnerInfoModal(props) {
|
|
|
554
556
|
const [filteredCurrencies, setFilteredCurrencies] = domContextHooks_module.useState(currencies || []);
|
|
555
557
|
const [error, setError] = domContextHooks_module.useState("");
|
|
556
558
|
const [success, setSuccess] = domContextHooks_module.useState(false);
|
|
559
|
+
const [initialized, setInitialized] = domContextHooks_module.useState(false);
|
|
557
560
|
domContextHooks_module.useEffect(() => {
|
|
558
561
|
var _a;
|
|
559
|
-
|
|
560
|
-
if (!userData || !publisher)
|
|
562
|
+
if (initialized || !user)
|
|
561
563
|
return;
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
564
|
+
setShouldDisplayNameFields(!user.firstName || !user.lastName);
|
|
565
|
+
setFirstName(user.firstName || "");
|
|
566
|
+
setLastName(user.lastName || "");
|
|
567
|
+
const publisher = (_a = user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher;
|
|
568
|
+
if (publisher) {
|
|
569
|
+
setCountryCode(publisher.countryCode);
|
|
570
|
+
setCurrency(publisher.currency);
|
|
571
|
+
}
|
|
572
|
+
setInitialized(true);
|
|
573
|
+
}, [user, initialized]);
|
|
565
574
|
domContextHooks_module.useEffect(() => {
|
|
566
575
|
if (!(countries === null || countries === void 0 ? void 0 : countries.length))
|
|
567
576
|
return;
|
|
@@ -583,6 +592,14 @@ function usePartnerInfoModal(props) {
|
|
|
583
592
|
}
|
|
584
593
|
}, [currencySearch, currencies]);
|
|
585
594
|
const impactConnection = user === null || user === void 0 ? void 0 : user.impactConnection;
|
|
595
|
+
function onFirstNameChange(e) {
|
|
596
|
+
const value = e.target.value;
|
|
597
|
+
setFirstName(value);
|
|
598
|
+
}
|
|
599
|
+
function onLastNameChange(e) {
|
|
600
|
+
const value = e.target.value;
|
|
601
|
+
setLastName(value);
|
|
602
|
+
}
|
|
586
603
|
function onCountryChange(e) {
|
|
587
604
|
var _a, _b;
|
|
588
605
|
const value = (_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.__value;
|
|
@@ -606,7 +623,10 @@ function usePartnerInfoModal(props) {
|
|
|
606
623
|
}
|
|
607
624
|
async function onSubmit() {
|
|
608
625
|
var _a, _b;
|
|
609
|
-
if (!allowBankingCollection ||
|
|
626
|
+
if (!allowBankingCollection ||
|
|
627
|
+
!countryCode ||
|
|
628
|
+
!currency ||
|
|
629
|
+
(shouldDisplayNameFields && (!firstName || !lastName))) {
|
|
610
630
|
setError(props.missingFieldsErrorText);
|
|
611
631
|
return;
|
|
612
632
|
}
|
|
@@ -621,8 +641,8 @@ function usePartnerInfoModal(props) {
|
|
|
621
641
|
id: user.id,
|
|
622
642
|
accountId: user.accountId,
|
|
623
643
|
},
|
|
624
|
-
firstName
|
|
625
|
-
lastName
|
|
644
|
+
firstName,
|
|
645
|
+
lastName,
|
|
626
646
|
countryCode,
|
|
627
647
|
currency,
|
|
628
648
|
};
|
|
@@ -657,7 +677,10 @@ function usePartnerInfoModal(props) {
|
|
|
657
677
|
open: showModal,
|
|
658
678
|
loading: userLoading || countriesLoading || currenciesLoading,
|
|
659
679
|
submitting: connectLoading,
|
|
680
|
+
shouldDisplayNameFields,
|
|
660
681
|
isExistingPartner,
|
|
682
|
+
firstName,
|
|
683
|
+
lastName,
|
|
661
684
|
countryCode,
|
|
662
685
|
currency,
|
|
663
686
|
error,
|
|
@@ -668,6 +691,8 @@ function usePartnerInfoModal(props) {
|
|
|
668
691
|
disabled: userLoading || connectLoading,
|
|
669
692
|
},
|
|
670
693
|
callbacks: {
|
|
694
|
+
onFirstNameChange,
|
|
695
|
+
onLastNameChange,
|
|
671
696
|
onCountryChange,
|
|
672
697
|
onCurrencyChange,
|
|
673
698
|
onCheckboxChange,
|
package/dist/cjs/{sqm-partner-info-modal-view-243aad7b.js → sqm-partner-info-modal-view-431100ad.js}
RENAMED
|
@@ -30,6 +30,12 @@ const style = {
|
|
|
30
30
|
gap: "var(--sl-spacing-medium)",
|
|
31
31
|
marginTop: "var(--sl-spacing-large)",
|
|
32
32
|
},
|
|
33
|
+
NameInput: {
|
|
34
|
+
"&::part(label)": {
|
|
35
|
+
fontWeight: "var(--sl-font-weight-normal)",
|
|
36
|
+
fontSize: "var(--sl-input-label-font-size-medium)",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
33
39
|
ErrorMessage: {
|
|
34
40
|
marginTop: "var(--sl-spacing-x-small)",
|
|
35
41
|
},
|
|
@@ -97,11 +103,12 @@ function PartnerInfoModalContentView(props) {
|
|
|
97
103
|
termsAndConditionsLink: (index.h("a", { href: text.termsAndConditionsLink, target: "_blank" }, text.termsAndConditionsLabel)),
|
|
98
104
|
});
|
|
99
105
|
return (index.h("div", null,
|
|
100
|
-
index.h("style", { type: "text/css" },
|
|
101
|
-
" ",
|
|
102
|
-
styleString),
|
|
106
|
+
index.h("style", { type: "text/css" }, styleString),
|
|
103
107
|
index.h("div", { class: sheet.classes.FormFields },
|
|
104
108
|
description,
|
|
109
|
+
states.shouldDisplayNameFields && (index.h(index.Fragment, null,
|
|
110
|
+
index.h("sl-input", { exportparts: "label: input-label, base: input-base", class: sheet.classes.NameInput, label: "First Name", value: states.firstName, "onSl-input": callbacks.onFirstNameChange, disabled: states.submitting, required: true }),
|
|
111
|
+
index.h("sl-input", { exportparts: "label: input-label, base: input-base", class: sheet.classes.NameInput, label: "Last Name", value: states.lastName, "onSl-input": callbacks.onLastNameChange, disabled: states.submitting, required: true }))),
|
|
105
112
|
index.h("sl-select", { exportparts: "label: input-label, base: input-base, menu: select-menu", label: text.countryLabel, value: states.countryCode, disabled: states.submitting ||
|
|
106
113
|
(!!states.countryCode && states.isExistingPartner), required: true, hoist: true, "onSl-select": callbacks.onCountryChange },
|
|
107
114
|
index.h("sl-input", { class: sheet.classes.SearchInput, placeholder: text.searchCountryPlaceholder, onKeyDown: (e) => e.stopPropagation(), "onSl-input": (e) => {
|
|
@@ -123,7 +130,9 @@ function PartnerInfoModalContentView(props) {
|
|
|
123
130
|
index.h("sl-button", { slot: "footer", type: "primary", loading: states.submitting, disabled: states.submitting ||
|
|
124
131
|
!states.countryCode ||
|
|
125
132
|
!states.currency ||
|
|
126
|
-
!states.allowBankingCollection
|
|
133
|
+
!states.allowBankingCollection ||
|
|
134
|
+
(states.shouldDisplayNameFields &&
|
|
135
|
+
(!states.firstName || !states.lastName)), onClick: callbacks.onSubmit, class: sheet.classes.SubmitButton, exportparts: "base: primarybutton-base" }, buttonLabel)));
|
|
127
136
|
}
|
|
128
137
|
function PartnerInfoModalView(props) {
|
|
129
138
|
const { states, text, callbacks } = props;
|
|
@@ -40,7 +40,7 @@ const sqmPortalContainerView = require('./sqm-portal-container-view-757f921b.js'
|
|
|
40
40
|
const sqmUserInfoFormView = require('./sqm-user-info-form-view-c5f9b79b.js');
|
|
41
41
|
const sqmLeadInputFieldView = require('./sqm-lead-input-field-view-88de1b78.js');
|
|
42
42
|
require('./data-89ac73dd.js');
|
|
43
|
-
const sqmPartnerInfoModalView = require('./sqm-partner-info-modal-view-
|
|
43
|
+
const sqmPartnerInfoModalView = require('./sqm-partner-info-modal-view-431100ad.js');
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* lodash (Custom Build) <https://lodash.com/>
|
|
@@ -19290,6 +19290,8 @@ const demoCurrencies = [
|
|
|
19290
19290
|
{ currencyCode: "AUD", displayName: "Australian Dollar" },
|
|
19291
19291
|
];
|
|
19292
19292
|
const noopCallbacks = {
|
|
19293
|
+
onFirstNameChange: (e) => console.log("First name changed:", e),
|
|
19294
|
+
onLastNameChange: (e) => console.log("Last name changed:", e),
|
|
19293
19295
|
onCountryChange: (e) => console.log("Country changed:", e),
|
|
19294
19296
|
onCurrencyChange: (e) => console.log("Currency changed:", e),
|
|
19295
19297
|
onCheckboxChange: (e) => console.log("Checkbox changed:", e),
|
|
@@ -19322,6 +19324,9 @@ const defaultProps$y = {
|
|
|
19322
19324
|
loading: false,
|
|
19323
19325
|
submitting: false,
|
|
19324
19326
|
isExistingPartner: false,
|
|
19327
|
+
shouldDisplayNameFields: false,
|
|
19328
|
+
firstName: "",
|
|
19329
|
+
lastName: "",
|
|
19325
19330
|
countryCode: "",
|
|
19326
19331
|
currency: "",
|
|
19327
19332
|
error: "",
|
|
@@ -19439,6 +19444,39 @@ const SQMComponentNewPartner = () => {
|
|
|
19439
19444
|
states: { open: true, isExistingPartner: false },
|
|
19440
19445
|
} }));
|
|
19441
19446
|
};
|
|
19447
|
+
const PartnerHasFirstAndLastName = () => {
|
|
19448
|
+
const props = {
|
|
19449
|
+
...defaultProps$y,
|
|
19450
|
+
states: {
|
|
19451
|
+
...defaultProps$y.states,
|
|
19452
|
+
firstName: "John",
|
|
19453
|
+
lastName: "Doe",
|
|
19454
|
+
},
|
|
19455
|
+
};
|
|
19456
|
+
return index.h(sqmPartnerInfoModalView.PartnerInfoModalView, Object.assign({}, props));
|
|
19457
|
+
};
|
|
19458
|
+
const PartnerHasFirstNameOnly = () => {
|
|
19459
|
+
const props = {
|
|
19460
|
+
...defaultProps$y,
|
|
19461
|
+
states: {
|
|
19462
|
+
...defaultProps$y.states,
|
|
19463
|
+
firstName: "John",
|
|
19464
|
+
lastName: "",
|
|
19465
|
+
shouldDisplayNameFields: true,
|
|
19466
|
+
},
|
|
19467
|
+
};
|
|
19468
|
+
return index.h(sqmPartnerInfoModalView.PartnerInfoModalView, Object.assign({}, props));
|
|
19469
|
+
};
|
|
19470
|
+
const Loading$i = () => {
|
|
19471
|
+
const props = {
|
|
19472
|
+
...defaultProps$y,
|
|
19473
|
+
states: {
|
|
19474
|
+
...defaultProps$y.states,
|
|
19475
|
+
loading: true,
|
|
19476
|
+
},
|
|
19477
|
+
};
|
|
19478
|
+
return index.h(sqmPartnerInfoModalView.PartnerInfoModalView, Object.assign({}, props));
|
|
19479
|
+
};
|
|
19442
19480
|
|
|
19443
19481
|
const PartnerInfoModal = /*#__PURE__*/Object.freeze({
|
|
19444
19482
|
__proto__: null,
|
|
@@ -19453,7 +19491,10 @@ const PartnerInfoModal = /*#__PURE__*/Object.freeze({
|
|
|
19453
19491
|
ValidationError: ValidationError$1,
|
|
19454
19492
|
Closed: Closed,
|
|
19455
19493
|
SQMComponentExistingPartner: SQMComponentExistingPartner,
|
|
19456
|
-
SQMComponentNewPartner: SQMComponentNewPartner
|
|
19494
|
+
SQMComponentNewPartner: SQMComponentNewPartner,
|
|
19495
|
+
PartnerHasFirstAndLastName: PartnerHasFirstAndLastName,
|
|
19496
|
+
PartnerHasFirstNameOnly: PartnerHasFirstNameOnly,
|
|
19497
|
+
Loading: Loading$i
|
|
19457
19498
|
});
|
|
19458
19499
|
|
|
19459
19500
|
const WidgetVerification_stories = {
|
|
@@ -19468,7 +19509,7 @@ const Step2Code = () => (index.h("sqm-widget-verification", { stateController: J
|
|
|
19468
19509
|
const Step3PartnerModal = () => (index.h("sqm-widget-verification", { stateController: JSON.stringify({
|
|
19469
19510
|
"sqm-widget-verification": { showPartnerModal: true },
|
|
19470
19511
|
}) }));
|
|
19471
|
-
const Loading$
|
|
19512
|
+
const Loading$j = () => (index.h("sqm-widget-verification", { stateController: JSON.stringify({
|
|
19472
19513
|
"sqm-widget-verification": { loading: true },
|
|
19473
19514
|
}) }));
|
|
19474
19515
|
|
|
@@ -19478,7 +19519,7 @@ const WidgetVerification = /*#__PURE__*/Object.freeze({
|
|
|
19478
19519
|
Step1Email: Step1Email,
|
|
19479
19520
|
Step2Code: Step2Code,
|
|
19480
19521
|
Step3PartnerModal: Step3PartnerModal,
|
|
19481
|
-
Loading: Loading$
|
|
19522
|
+
Loading: Loading$j
|
|
19482
19523
|
});
|
|
19483
19524
|
|
|
19484
19525
|
const scenario$G = "@owner:zach @author:zach\nFeature: User Attribute\n Displays a user's custom field value.\n\n Background: A user exists\n Given a user is logged in\n And the user has custom fields\n\n @motivating\n Scenario: A custom field value is displayed\n Given the component has prop \"value\" with value \"firstName\"\n And the user has a custom field \"firstName\" with value \"John\"\n When the component is rendered\n Then the text \"John\" is displayed\n\n @landmine\n Scenario: Nothing is rendered when the custom field does not exist\n Given the component has prop \"value\" with value \"nonExistentField\"\n And the user does not have a custom field \"nonExistentField\"\n Then component is not rendered\n And nothing is displayed\n\n @motivating\n Scenario: Nothing is rendered while user data is loading\n Given the component is loading user data\n When the component is rendered\n Then component is not rendered\n And nothing is displayed\n\n @motivating\n Scenario Outline: Optional styling props can be applied to customize the text appearance\n Given the component has prop <prop> with value <value>\n When the component is rendered\n Then the text is displayed with <cssProperty> set to <value>\n\n Examples:\n | prop | value | cssProperty |\n | fontSize | 24 | font-size |\n | color | #E91E63 | color |\n | fontWeight | 700 | font-weight |\n\n @minutia\n Scenario: Style props are optional and default to no custom styling\n Given the component has no style props set\n When the component is rendered\n Then the text is displayed with default browser styles\n";
|
|
@@ -19509,7 +19550,7 @@ const InvalidValue = () => {
|
|
|
19509
19550
|
} }),
|
|
19510
19551
|
index.h("div", { style: { background: "#e0e0e0", padding: "8px" } }, "Below")));
|
|
19511
19552
|
};
|
|
19512
|
-
const Loading$
|
|
19553
|
+
const Loading$k = () => {
|
|
19513
19554
|
return (index.h("sqm-user-attribute", { demoData: {
|
|
19514
19555
|
loading: true,
|
|
19515
19556
|
value: "impact.com",
|
|
@@ -19530,7 +19571,7 @@ const UserAttribute = /*#__PURE__*/Object.freeze({
|
|
|
19530
19571
|
'default': UserAttribute_stories,
|
|
19531
19572
|
Default: Default$x,
|
|
19532
19573
|
InvalidValue: InvalidValue,
|
|
19533
|
-
Loading: Loading$
|
|
19574
|
+
Loading: Loading$k,
|
|
19534
19575
|
WithCustomStyles: WithCustomStyles
|
|
19535
19576
|
});
|
|
19536
19577
|
|
|
@@ -20,6 +20,8 @@ const demoCurrencies = [
|
|
|
20
20
|
{ currencyCode: "AUD", displayName: "Australian Dollar" },
|
|
21
21
|
];
|
|
22
22
|
const noopCallbacks = {
|
|
23
|
+
onFirstNameChange: (e) => console.log("First name changed:", e),
|
|
24
|
+
onLastNameChange: (e) => console.log("Last name changed:", e),
|
|
23
25
|
onCountryChange: (e) => console.log("Country changed:", e),
|
|
24
26
|
onCurrencyChange: (e) => console.log("Currency changed:", e),
|
|
25
27
|
onCheckboxChange: (e) => console.log("Checkbox changed:", e),
|
|
@@ -52,6 +54,9 @@ const defaultProps = {
|
|
|
52
54
|
loading: false,
|
|
53
55
|
submitting: false,
|
|
54
56
|
isExistingPartner: false,
|
|
57
|
+
shouldDisplayNameFields: false,
|
|
58
|
+
firstName: "",
|
|
59
|
+
lastName: "",
|
|
55
60
|
countryCode: "",
|
|
56
61
|
currency: "",
|
|
57
62
|
error: "",
|
|
@@ -169,3 +174,36 @@ export const SQMComponentNewPartner = () => {
|
|
|
169
174
|
states: { open: true, isExistingPartner: false },
|
|
170
175
|
} }));
|
|
171
176
|
};
|
|
177
|
+
export const PartnerHasFirstAndLastName = () => {
|
|
178
|
+
const props = {
|
|
179
|
+
...defaultProps,
|
|
180
|
+
states: {
|
|
181
|
+
...defaultProps.states,
|
|
182
|
+
firstName: "John",
|
|
183
|
+
lastName: "Doe",
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
return h(PartnerInfoModalView, Object.assign({}, props));
|
|
187
|
+
};
|
|
188
|
+
export const PartnerHasFirstNameOnly = () => {
|
|
189
|
+
const props = {
|
|
190
|
+
...defaultProps,
|
|
191
|
+
states: {
|
|
192
|
+
...defaultProps.states,
|
|
193
|
+
firstName: "John",
|
|
194
|
+
lastName: "",
|
|
195
|
+
shouldDisplayNameFields: true,
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
return h(PartnerInfoModalView, Object.assign({}, props));
|
|
199
|
+
};
|
|
200
|
+
export const Loading = () => {
|
|
201
|
+
const props = {
|
|
202
|
+
...defaultProps,
|
|
203
|
+
states: {
|
|
204
|
+
...defaultProps.states,
|
|
205
|
+
loading: true,
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
return h(PartnerInfoModalView, Object.assign({}, props));
|
|
209
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h } from "@stencil/core";
|
|
1
|
+
import { Fragment, h } from "@stencil/core";
|
|
2
2
|
import { createStyleSheet } from "../../styling/JSS";
|
|
3
3
|
import { intl } from "../../global/global";
|
|
4
4
|
const style = {
|
|
@@ -27,6 +27,12 @@ const style = {
|
|
|
27
27
|
gap: "var(--sl-spacing-medium)",
|
|
28
28
|
marginTop: "var(--sl-spacing-large)",
|
|
29
29
|
},
|
|
30
|
+
NameInput: {
|
|
31
|
+
"&::part(label)": {
|
|
32
|
+
fontWeight: "var(--sl-font-weight-normal)",
|
|
33
|
+
fontSize: "var(--sl-input-label-font-size-medium)",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
30
36
|
ErrorMessage: {
|
|
31
37
|
marginTop: "var(--sl-spacing-x-small)",
|
|
32
38
|
},
|
|
@@ -94,11 +100,12 @@ export function PartnerInfoModalContentView(props) {
|
|
|
94
100
|
termsAndConditionsLink: (h("a", { href: text.termsAndConditionsLink, target: "_blank" }, text.termsAndConditionsLabel)),
|
|
95
101
|
});
|
|
96
102
|
return (h("div", null,
|
|
97
|
-
h("style", { type: "text/css" },
|
|
98
|
-
" ",
|
|
99
|
-
styleString),
|
|
103
|
+
h("style", { type: "text/css" }, styleString),
|
|
100
104
|
h("div", { class: sheet.classes.FormFields },
|
|
101
105
|
description,
|
|
106
|
+
states.shouldDisplayNameFields && (h(Fragment, null,
|
|
107
|
+
h("sl-input", { exportparts: "label: input-label, base: input-base", class: sheet.classes.NameInput, label: "First Name", value: states.firstName, "onSl-input": callbacks.onFirstNameChange, disabled: states.submitting, required: true }),
|
|
108
|
+
h("sl-input", { exportparts: "label: input-label, base: input-base", class: sheet.classes.NameInput, label: "Last Name", value: states.lastName, "onSl-input": callbacks.onLastNameChange, disabled: states.submitting, required: true }))),
|
|
102
109
|
h("sl-select", { exportparts: "label: input-label, base: input-base, menu: select-menu", label: text.countryLabel, value: states.countryCode, disabled: states.submitting ||
|
|
103
110
|
(!!states.countryCode && states.isExistingPartner), required: true, hoist: true, "onSl-select": callbacks.onCountryChange },
|
|
104
111
|
h("sl-input", { class: sheet.classes.SearchInput, placeholder: text.searchCountryPlaceholder, onKeyDown: (e) => e.stopPropagation(), "onSl-input": (e) => {
|
|
@@ -120,7 +127,9 @@ export function PartnerInfoModalContentView(props) {
|
|
|
120
127
|
h("sl-button", { slot: "footer", type: "primary", loading: states.submitting, disabled: states.submitting ||
|
|
121
128
|
!states.countryCode ||
|
|
122
129
|
!states.currency ||
|
|
123
|
-
!states.allowBankingCollection
|
|
130
|
+
!states.allowBankingCollection ||
|
|
131
|
+
(states.shouldDisplayNameFields &&
|
|
132
|
+
(!states.firstName || !states.lastName)), onClick: callbacks.onSubmit, class: sheet.classes.SubmitButton, exportparts: "base: primarybutton-base" }, buttonLabel)));
|
|
124
133
|
}
|
|
125
134
|
export function PartnerInfoModalView(props) {
|
|
126
135
|
const { states, text, callbacks } = props;
|
|
@@ -573,7 +573,7 @@ export class PartnerInfoModal {
|
|
|
573
573
|
"mutable": false,
|
|
574
574
|
"complexType": {
|
|
575
575
|
"original": "DemoData<PartnerInfoModalResult>",
|
|
576
|
-
"resolved": "{ states?: { open: boolean; loading: boolean; submitting: boolean; isExistingPartner: boolean; countryCode: string; currency: string; error: string; success: boolean; filteredCountries: { countryCode: string; displayName: string; }[]; filteredCurrencies: { currencyCode: string; displayName: string; }[]; allowBankingCollection: boolean; disabled: boolean; }; }",
|
|
576
|
+
"resolved": "{ states?: { open: boolean; loading: boolean; submitting: boolean; isExistingPartner: boolean; shouldDisplayNameFields: boolean; firstName: string; lastName: string; countryCode: string; currency: string; error: string; success: boolean; filteredCountries: { countryCode: string; displayName: string; }[]; filteredCurrencies: { currencyCode: string; displayName: string; }[]; allowBankingCollection: boolean; disabled: boolean; }; }",
|
|
577
577
|
"references": {
|
|
578
578
|
"DemoData": {
|
|
579
579
|
"location": "import",
|
|
@@ -75,17 +75,19 @@ const START_IMPACT_CONNECTION = gql `
|
|
|
75
75
|
}
|
|
76
76
|
`;
|
|
77
77
|
export function usePartnerInfoModal(props) {
|
|
78
|
-
var _a, _b, _c, _d, _e;
|
|
78
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
79
79
|
const locale = useLocale();
|
|
80
80
|
const setPartnerCreated = useSetParent(PARTNER_CREATED_NAMESPACE);
|
|
81
81
|
const { data: userData, loading: userLoading, refetch, } = useQuery(GET_USER_PARTNER_INFO, {});
|
|
82
82
|
const user = userData === null || userData === void 0 ? void 0 : userData.user;
|
|
83
83
|
const { data: currenciesData, loading: currenciesLoading } = useQuery(GET_CURRENCIES, { variables: { locale } });
|
|
84
84
|
const { data: countriesData, loading: countriesLoading } = useQuery(GET_COUNTRIES, {});
|
|
85
|
+
const [shouldDisplayNameFields, setShouldDisplayNameFields] = useState(false);
|
|
86
|
+
const [firstName, setFirstName] = useState((_a = user === null || user === void 0 ? void 0 : user.firstName) !== null && _a !== void 0 ? _a : "");
|
|
87
|
+
const [lastName, setLastName] = useState((_b = user === null || user === void 0 ? void 0 : user.lastName) !== null && _b !== void 0 ? _b : "");
|
|
85
88
|
// No pre-filled country, use locale to determine countryCode instead
|
|
86
|
-
const [countryCode, setCountryCode] = useState(((
|
|
87
|
-
|
|
88
|
-
const [currency, setCurrency] = useState(((_d = (_c = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _c === void 0 ? void 0 : _c.publisher) === null || _d === void 0 ? void 0 : _d.currency) || "");
|
|
89
|
+
const [countryCode, setCountryCode] = useState(((_d = (_c = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _c === void 0 ? void 0 : _c.publisher) === null || _d === void 0 ? void 0 : _d.countryCode) || locale.replace(/^.*_/, ""));
|
|
90
|
+
const [currency, setCurrency] = useState(((_f = (_e = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _e === void 0 ? void 0 : _e.publisher) === null || _f === void 0 ? void 0 : _f.currency) || "");
|
|
89
91
|
const { data: financeNetworkData } = useQuery(GET_FINANCE_NETWORK_SETTINGS, {
|
|
90
92
|
variables: { filter: countryCode ? { countryCode_eq: countryCode } : {} },
|
|
91
93
|
});
|
|
@@ -104,7 +106,7 @@ export function usePartnerInfoModal(props) {
|
|
|
104
106
|
return a.displayName.localeCompare(b.displayName);
|
|
105
107
|
});
|
|
106
108
|
}, [countriesData]);
|
|
107
|
-
const isExistingPartner = !!((
|
|
109
|
+
const isExistingPartner = !!((_g = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _g === void 0 ? void 0 : _g.publisher);
|
|
108
110
|
const _currencies = useMemo(() => {
|
|
109
111
|
var _a, _b, _c;
|
|
110
112
|
// if isExistingPartner, grab all currencies since select is disabled anyways
|
|
@@ -131,14 +133,21 @@ export function usePartnerInfoModal(props) {
|
|
|
131
133
|
const [filteredCurrencies, setFilteredCurrencies] = useState(currencies || []);
|
|
132
134
|
const [error, setError] = useState("");
|
|
133
135
|
const [success, setSuccess] = useState(false);
|
|
136
|
+
const [initialized, setInitialized] = useState(false);
|
|
134
137
|
useEffect(() => {
|
|
135
138
|
var _a;
|
|
136
|
-
|
|
137
|
-
if (!userData || !publisher)
|
|
139
|
+
if (initialized || !user)
|
|
138
140
|
return;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
141
|
+
setShouldDisplayNameFields(!user.firstName || !user.lastName);
|
|
142
|
+
setFirstName(user.firstName || "");
|
|
143
|
+
setLastName(user.lastName || "");
|
|
144
|
+
const publisher = (_a = user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher;
|
|
145
|
+
if (publisher) {
|
|
146
|
+
setCountryCode(publisher.countryCode);
|
|
147
|
+
setCurrency(publisher.currency);
|
|
148
|
+
}
|
|
149
|
+
setInitialized(true);
|
|
150
|
+
}, [user, initialized]);
|
|
142
151
|
useEffect(() => {
|
|
143
152
|
if (!(countries === null || countries === void 0 ? void 0 : countries.length))
|
|
144
153
|
return;
|
|
@@ -160,6 +169,14 @@ export function usePartnerInfoModal(props) {
|
|
|
160
169
|
}
|
|
161
170
|
}, [currencySearch, currencies]);
|
|
162
171
|
const impactConnection = user === null || user === void 0 ? void 0 : user.impactConnection;
|
|
172
|
+
function onFirstNameChange(e) {
|
|
173
|
+
const value = e.target.value;
|
|
174
|
+
setFirstName(value);
|
|
175
|
+
}
|
|
176
|
+
function onLastNameChange(e) {
|
|
177
|
+
const value = e.target.value;
|
|
178
|
+
setLastName(value);
|
|
179
|
+
}
|
|
163
180
|
function onCountryChange(e) {
|
|
164
181
|
var _a, _b;
|
|
165
182
|
const value = (_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.__value;
|
|
@@ -183,7 +200,10 @@ export function usePartnerInfoModal(props) {
|
|
|
183
200
|
}
|
|
184
201
|
async function onSubmit() {
|
|
185
202
|
var _a, _b;
|
|
186
|
-
if (!allowBankingCollection ||
|
|
203
|
+
if (!allowBankingCollection ||
|
|
204
|
+
!countryCode ||
|
|
205
|
+
!currency ||
|
|
206
|
+
(shouldDisplayNameFields && (!firstName || !lastName))) {
|
|
187
207
|
setError(props.missingFieldsErrorText);
|
|
188
208
|
return;
|
|
189
209
|
}
|
|
@@ -198,8 +218,8 @@ export function usePartnerInfoModal(props) {
|
|
|
198
218
|
id: user.id,
|
|
199
219
|
accountId: user.accountId,
|
|
200
220
|
},
|
|
201
|
-
firstName
|
|
202
|
-
lastName
|
|
221
|
+
firstName,
|
|
222
|
+
lastName,
|
|
203
223
|
countryCode,
|
|
204
224
|
currency,
|
|
205
225
|
};
|
|
@@ -234,7 +254,10 @@ export function usePartnerInfoModal(props) {
|
|
|
234
254
|
open: showModal,
|
|
235
255
|
loading: userLoading || countriesLoading || currenciesLoading,
|
|
236
256
|
submitting: connectLoading,
|
|
257
|
+
shouldDisplayNameFields,
|
|
237
258
|
isExistingPartner,
|
|
259
|
+
firstName,
|
|
260
|
+
lastName,
|
|
238
261
|
countryCode,
|
|
239
262
|
currency,
|
|
240
263
|
error,
|
|
@@ -245,6 +268,8 @@ export function usePartnerInfoModal(props) {
|
|
|
245
268
|
disabled: userLoading || connectLoading,
|
|
246
269
|
},
|
|
247
270
|
callbacks: {
|
|
271
|
+
onFirstNameChange,
|
|
272
|
+
onLastNameChange,
|
|
248
273
|
onCountryChange,
|
|
249
274
|
onCurrencyChange,
|
|
250
275
|
onCheckboxChange,
|
|
@@ -7,7 +7,7 @@ import { g as getProps } from './utils-334c1e34.js';
|
|
|
7
7
|
import { c as createStyleSheet } from './JSS-67b5cff8.js';
|
|
8
8
|
import { T as TextSpanView } from './sqm-text-span-view-72f43dff.js';
|
|
9
9
|
import { g as GET_FINANCE_NETWORK_SETTINGS } from './data-8698cbc6.js';
|
|
10
|
-
import { a as PartnerInfoModalContentView, P as PartnerInfoModalView } from './sqm-partner-info-modal-view-
|
|
10
|
+
import { a as PartnerInfoModalContentView, P as PartnerInfoModalView } from './sqm-partner-info-modal-view-34d4be5b.js';
|
|
11
11
|
import { S as SHOW_CODE_NAMESPACE, a as VERIFICATION_EMAIL_NAMESPACE, P as PARTNER_CREATED_NAMESPACE } from './keys-1054056a.js';
|
|
12
12
|
import { T as TAX_FORM_UPDATED_EVENT_KEY } from './eventKeys-f76b6a03.js';
|
|
13
13
|
import { p as parseStates } from './parseStates-ed75e224.js';
|
|
@@ -494,17 +494,19 @@ const START_IMPACT_CONNECTION = dist.gql `
|
|
|
494
494
|
}
|
|
495
495
|
`;
|
|
496
496
|
function usePartnerInfoModal(props) {
|
|
497
|
-
var _a, _b, _c, _d, _e;
|
|
497
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
498
498
|
const locale = L();
|
|
499
499
|
const setPartnerCreated = En(PARTNER_CREATED_NAMESPACE);
|
|
500
500
|
const { data: userData, loading: userLoading, refetch, } = wn(GET_USER_PARTNER_INFO, {});
|
|
501
501
|
const user = userData === null || userData === void 0 ? void 0 : userData.user;
|
|
502
502
|
const { data: currenciesData, loading: currenciesLoading } = wn(GET_CURRENCIES, { variables: { locale } });
|
|
503
503
|
const { data: countriesData, loading: countriesLoading } = wn(GET_COUNTRIES, {});
|
|
504
|
+
const [shouldDisplayNameFields, setShouldDisplayNameFields] = useState(false);
|
|
505
|
+
const [firstName, setFirstName] = useState((_a = user === null || user === void 0 ? void 0 : user.firstName) !== null && _a !== void 0 ? _a : "");
|
|
506
|
+
const [lastName, setLastName] = useState((_b = user === null || user === void 0 ? void 0 : user.lastName) !== null && _b !== void 0 ? _b : "");
|
|
504
507
|
// No pre-filled country, use locale to determine countryCode instead
|
|
505
|
-
const [countryCode, setCountryCode] = useState(((
|
|
506
|
-
|
|
507
|
-
const [currency, setCurrency] = useState(((_d = (_c = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _c === void 0 ? void 0 : _c.publisher) === null || _d === void 0 ? void 0 : _d.currency) || "");
|
|
508
|
+
const [countryCode, setCountryCode] = useState(((_d = (_c = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _c === void 0 ? void 0 : _c.publisher) === null || _d === void 0 ? void 0 : _d.countryCode) || locale.replace(/^.*_/, ""));
|
|
509
|
+
const [currency, setCurrency] = useState(((_f = (_e = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _e === void 0 ? void 0 : _e.publisher) === null || _f === void 0 ? void 0 : _f.currency) || "");
|
|
508
510
|
const { data: financeNetworkData } = wn(GET_FINANCE_NETWORK_SETTINGS, {
|
|
509
511
|
variables: { filter: countryCode ? { countryCode_eq: countryCode } : {} },
|
|
510
512
|
});
|
|
@@ -523,7 +525,7 @@ function usePartnerInfoModal(props) {
|
|
|
523
525
|
return a.displayName.localeCompare(b.displayName);
|
|
524
526
|
});
|
|
525
527
|
}, [countriesData]);
|
|
526
|
-
const isExistingPartner = !!((
|
|
528
|
+
const isExistingPartner = !!((_g = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _g === void 0 ? void 0 : _g.publisher);
|
|
527
529
|
const _currencies = useMemo(() => {
|
|
528
530
|
var _a, _b, _c;
|
|
529
531
|
// if isExistingPartner, grab all currencies since select is disabled anyways
|
|
@@ -550,14 +552,21 @@ function usePartnerInfoModal(props) {
|
|
|
550
552
|
const [filteredCurrencies, setFilteredCurrencies] = useState(currencies || []);
|
|
551
553
|
const [error, setError] = useState("");
|
|
552
554
|
const [success, setSuccess] = useState(false);
|
|
555
|
+
const [initialized, setInitialized] = useState(false);
|
|
553
556
|
useEffect(() => {
|
|
554
557
|
var _a;
|
|
555
|
-
|
|
556
|
-
if (!userData || !publisher)
|
|
558
|
+
if (initialized || !user)
|
|
557
559
|
return;
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
560
|
+
setShouldDisplayNameFields(!user.firstName || !user.lastName);
|
|
561
|
+
setFirstName(user.firstName || "");
|
|
562
|
+
setLastName(user.lastName || "");
|
|
563
|
+
const publisher = (_a = user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher;
|
|
564
|
+
if (publisher) {
|
|
565
|
+
setCountryCode(publisher.countryCode);
|
|
566
|
+
setCurrency(publisher.currency);
|
|
567
|
+
}
|
|
568
|
+
setInitialized(true);
|
|
569
|
+
}, [user, initialized]);
|
|
561
570
|
useEffect(() => {
|
|
562
571
|
if (!(countries === null || countries === void 0 ? void 0 : countries.length))
|
|
563
572
|
return;
|
|
@@ -579,6 +588,14 @@ function usePartnerInfoModal(props) {
|
|
|
579
588
|
}
|
|
580
589
|
}, [currencySearch, currencies]);
|
|
581
590
|
const impactConnection = user === null || user === void 0 ? void 0 : user.impactConnection;
|
|
591
|
+
function onFirstNameChange(e) {
|
|
592
|
+
const value = e.target.value;
|
|
593
|
+
setFirstName(value);
|
|
594
|
+
}
|
|
595
|
+
function onLastNameChange(e) {
|
|
596
|
+
const value = e.target.value;
|
|
597
|
+
setLastName(value);
|
|
598
|
+
}
|
|
582
599
|
function onCountryChange(e) {
|
|
583
600
|
var _a, _b;
|
|
584
601
|
const value = (_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.__value;
|
|
@@ -602,7 +619,10 @@ function usePartnerInfoModal(props) {
|
|
|
602
619
|
}
|
|
603
620
|
async function onSubmit() {
|
|
604
621
|
var _a, _b;
|
|
605
|
-
if (!allowBankingCollection ||
|
|
622
|
+
if (!allowBankingCollection ||
|
|
623
|
+
!countryCode ||
|
|
624
|
+
!currency ||
|
|
625
|
+
(shouldDisplayNameFields && (!firstName || !lastName))) {
|
|
606
626
|
setError(props.missingFieldsErrorText);
|
|
607
627
|
return;
|
|
608
628
|
}
|
|
@@ -617,8 +637,8 @@ function usePartnerInfoModal(props) {
|
|
|
617
637
|
id: user.id,
|
|
618
638
|
accountId: user.accountId,
|
|
619
639
|
},
|
|
620
|
-
firstName
|
|
621
|
-
lastName
|
|
640
|
+
firstName,
|
|
641
|
+
lastName,
|
|
622
642
|
countryCode,
|
|
623
643
|
currency,
|
|
624
644
|
};
|
|
@@ -653,7 +673,10 @@ function usePartnerInfoModal(props) {
|
|
|
653
673
|
open: showModal,
|
|
654
674
|
loading: userLoading || countriesLoading || currenciesLoading,
|
|
655
675
|
submitting: connectLoading,
|
|
676
|
+
shouldDisplayNameFields,
|
|
656
677
|
isExistingPartner,
|
|
678
|
+
firstName,
|
|
679
|
+
lastName,
|
|
657
680
|
countryCode,
|
|
658
681
|
currency,
|
|
659
682
|
error,
|
|
@@ -664,6 +687,8 @@ function usePartnerInfoModal(props) {
|
|
|
664
687
|
disabled: userLoading || connectLoading,
|
|
665
688
|
},
|
|
666
689
|
callbacks: {
|
|
690
|
+
onFirstNameChange,
|
|
691
|
+
onLastNameChange,
|
|
667
692
|
onCountryChange,
|
|
668
693
|
onCurrencyChange,
|
|
669
694
|
onCheckboxChange,
|