@saasquatch/mint-components 2.2.0-0 → 2.2.0-2
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/{keys-cff24974.js → keys-5a2c9ed2.js} +4 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/sqm-banking-info-form_10.cjs.entry.js +12 -16
- package/dist/cjs/sqm-big-stat_46.cjs.entry.js +22 -26
- package/dist/cjs/sqm-code-verification.cjs.entry.js +1 -1
- package/dist/cjs/sqm-email-verification_2.cjs.entry.js +14 -35
- package/dist/cjs/{sqm-partner-info-modal-view-540886b4.js → sqm-partner-info-modal-view-431ff976.js} +15 -10
- package/dist/cjs/sqm-referral-table_11.cjs.entry.js +27 -9
- package/dist/cjs/sqm-rewards-table_9.cjs.entry.js +30 -9
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +487 -310
- package/dist/cjs/{sqm-user-info-form-view-01bf2f41.js → sqm-user-info-form-view-f1127a60.js} +2 -2
- package/dist/cjs/sqm-widget-verification-controller.cjs.entry.js +1 -1
- package/dist/collection/components/sqm-partner-info-modal/PartnerInfoModal.stories.js +14 -4
- package/dist/collection/components/sqm-partner-info-modal/sqm-partner-info-modal-view.js +15 -10
- package/dist/collection/components/sqm-partner-info-modal/sqm-partner-info-modal.js +1 -30
- package/dist/collection/components/sqm-partner-info-modal/usePartnerInfoModal.js +13 -26
- package/dist/collection/components/sqm-referral-table/ReferralTable.stories.js +1 -0
- package/dist/collection/components/sqm-referral-table/ReferralTableRewardsCell.stories.js +1 -0
- package/dist/collection/components/sqm-referral-table/TaxAndCashReferralTableRewardsCell.stories.js +209 -157
- package/dist/collection/components/sqm-referral-table/cells/sqm-referral-table-rewards-cell.js +30 -10
- package/dist/collection/components/sqm-rewards-table/RewardsTableCell.stories.js +1 -0
- package/dist/collection/components/sqm-rewards-table/TaxAndCashRewardsTableCell.stories.js +223 -148
- package/dist/collection/components/sqm-rewards-table/cells/sqm-rewards-table-status-cell.js +30 -10
- package/dist/collection/components/sqm-rewards-table/useRewardsTable.js +1 -0
- package/dist/collection/components/sqm-widget-verification/keys.js +2 -0
- package/dist/collection/components/sqm-widget-verification/sqm-widget-verification.js +0 -59
- package/dist/collection/components/sqm-widget-verification/useWidgetVerification.js +23 -10
- package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.js +5 -4
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.js +1 -30
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/useTaxAndCash.js +0 -1
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/UserInfoFormView.stories.js +0 -1
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +2 -2
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form.js +0 -25
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.js +5 -6
- package/dist/esm/keys-d7c5c851.js +8 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/sqm-banking-info-form_10.entry.js +12 -16
- package/dist/esm/sqm-big-stat_46.entry.js +22 -26
- package/dist/esm/sqm-code-verification.entry.js +1 -1
- package/dist/esm/sqm-email-verification_2.entry.js +14 -35
- package/dist/esm/{sqm-partner-info-modal-view-eec8606e.js → sqm-partner-info-modal-view-b3c33bc3.js} +15 -10
- package/dist/esm/sqm-referral-table_11.entry.js +27 -9
- package/dist/esm/sqm-rewards-table_9.entry.js +30 -9
- package/dist/esm/sqm-stencilbook.entry.js +487 -310
- package/dist/esm/{sqm-user-info-form-view-365cef98.js → sqm-user-info-form-view-e732dc4d.js} +2 -2
- package/dist/esm/sqm-widget-verification-controller.entry.js +1 -1
- package/dist/esm-es5/keys-d7c5c851.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mint-components.js +1 -1
- package/dist/esm-es5/sqm-banking-info-form_10.entry.js +1 -1
- package/dist/esm-es5/sqm-big-stat_46.entry.js +1 -1
- package/dist/esm-es5/sqm-code-verification.entry.js +1 -1
- package/dist/esm-es5/sqm-email-verification_2.entry.js +1 -1
- package/dist/esm-es5/sqm-partner-info-modal-view-b3c33bc3.js +1 -0
- package/dist/esm-es5/sqm-referral-table_11.entry.js +1 -1
- package/dist/esm-es5/sqm-rewards-table_9.entry.js +1 -1
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/esm-es5/{sqm-user-info-form-view-365cef98.js → sqm-user-info-form-view-e732dc4d.js} +1 -1
- package/dist/esm-es5/sqm-widget-verification-controller.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/p-162da001.system.entry.js +1 -0
- package/dist/mint-components/p-16416781.system.entry.js +1 -0
- package/dist/mint-components/p-1bff74c0.js +1 -0
- package/dist/mint-components/p-1c413a06.system.js +1 -1
- package/dist/mint-components/p-1f76371b.entry.js +9 -0
- package/dist/mint-components/{p-2d3a12f2.entry.js → p-36b91873.entry.js} +2 -2
- package/dist/mint-components/{p-038d0b8f.entry.js → p-440d3788.entry.js} +3 -3
- package/dist/mint-components/p-4c47beb0.system.js +1 -0
- package/dist/mint-components/{p-55d4caaa.entry.js → p-63102c04.entry.js} +7 -13
- package/dist/mint-components/p-6d15ce09.system.entry.js +1 -0
- package/dist/mint-components/{p-a0986077.system.entry.js → p-70a90ad8.system.entry.js} +1 -1
- package/dist/mint-components/p-837c4cf8.js +1 -0
- package/dist/mint-components/p-987a54e2.system.js +1 -0
- package/dist/mint-components/{p-88c9cc1b.entry.js → p-a67f2ccf.entry.js} +1 -1
- package/dist/mint-components/p-bdf858c3.entry.js +1 -0
- package/dist/mint-components/{p-9e43f1eb.entry.js → p-be5ecf62.entry.js} +3 -2
- package/dist/mint-components/p-d3ac8246.system.entry.js +1 -0
- package/dist/mint-components/{p-64041ee1.entry.js → p-d43c728e.entry.js} +22 -22
- package/dist/mint-components/{p-52eca331.js → p-dd5d8095.js} +1 -1
- package/dist/mint-components/{p-4d009702.system.entry.js → p-e83d08d7.system.entry.js} +1 -1
- package/dist/mint-components/{p-6194855b.system.entry.js → p-ecdbe09b.system.entry.js} +1 -1
- package/dist/mint-components/{p-a2db4345.system.js → p-ed3ae5ba.system.js} +1 -1
- package/dist/mint-components/{p-037c1a4f.system.entry.js → p-fe944f94.system.entry.js} +1 -1
- package/dist/types/components/sqm-partner-info-modal/PartnerInfoModal.stories.d.ts +1 -0
- package/dist/types/components/sqm-partner-info-modal/sqm-partner-info-modal-view.d.ts +0 -2
- package/dist/types/components/sqm-partner-info-modal/sqm-partner-info-modal.d.ts +0 -6
- package/dist/types/components/sqm-referral-table/TaxAndCashReferralTableRewardsCell.stories.d.ts +16 -0
- package/dist/types/components/sqm-rewards-table/TaxAndCashRewardsTableCell.stories.d.ts +18 -7
- package/dist/types/components/sqm-widget-verification/keys.d.ts +2 -0
- package/dist/types/components/sqm-widget-verification/sqm-widget-verification.d.ts +0 -10
- package/dist/types/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.d.ts +0 -5
- package/dist/types/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.d.ts +0 -1
- package/dist/types/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form.d.ts +0 -4
- package/dist/types/components.d.ts +0 -48
- package/dist/types/saasquatch.d.ts +1 -0
- 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/esm/keys-db1897ae.js +0 -6
- package/dist/esm-es5/keys-db1897ae.js +0 -1
- package/dist/esm-es5/sqm-partner-info-modal-view-eec8606e.js +0 -1
- package/dist/mint-components/p-39840341.js +0 -1
- package/dist/mint-components/p-55627a5c.entry.js +0 -1
- package/dist/mint-components/p-574a4089.system.js +0 -1
- package/dist/mint-components/p-7d5956ec.system.entry.js +0 -1
- package/dist/mint-components/p-91369a5f.js +0 -1
- package/dist/mint-components/p-b2a99637.system.js +0 -1
- package/dist/mint-components/p-d01949f7.system.entry.js +0 -1
- package/dist/mint-components/p-d273eb05.entry.js +0 -9
- package/dist/mint-components/p-e9e05970.system.entry.js +0 -1
- package/dist/mint-components/p-ea5eec69.system.entry.js +0 -1
package/dist/cjs/{sqm-user-info-form-view-01bf2f41.js → sqm-user-info-form-view-f1127a60.js}
RENAMED
|
@@ -1906,7 +1906,7 @@ const UserInfoFormView = (props) => {
|
|
|
1906
1906
|
default:
|
|
1907
1907
|
regionLabel = text.state;
|
|
1908
1908
|
}
|
|
1909
|
-
// when creating an impact connection without sending phoneNumber data, the impactAPI defaults the value to "
|
|
1909
|
+
// when creating an impact connection without sending phoneNumber data, the impactAPI defaults the value to "0000000" and the phoneNumberCountryCode to "DZ"
|
|
1910
1910
|
function isDisabledPartnerInput(field) {
|
|
1911
1911
|
var _a, _b;
|
|
1912
1912
|
if (((_a = data$1.partnerData) === null || _a === void 0 ? void 0 : _a.phoneNumber) === "0000000" &&
|
|
@@ -2036,7 +2036,7 @@ const UserInfoFormView = (props) => {
|
|
|
2036
2036
|
helpText: utils.formatErrorMessage(text.postalCode, formState.errors.postalCode),
|
|
2037
2037
|
}
|
|
2038
2038
|
: {}), { required: true })),
|
|
2039
|
-
index.h("sl-select", Object.assign({ id: "currency", exportparts: "label: input-label, base: input-base", name: "/currency", label: text.currency, menu: true, value: formState.currency, disabled: states.disabled || isDisabledPartnerInput("currency")
|
|
2039
|
+
index.h("sl-select", Object.assign({ id: "currency", exportparts: "label: input-label, base: input-base", name: "/currency", label: text.currency, menu: true, value: formState.currency, disabled: states.disabled || isDisabledPartnerInput("currency") }, (((_r = formState.errors) === null || _r === void 0 ? void 0 : _r.currency) ? {
|
|
2040
2040
|
class: classes.ErrorInput,
|
|
2041
2041
|
helpText: utils.formatErrorMessage(text.currency, formState.errors.currency),
|
|
2042
2042
|
}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-8277cbb3.js');
|
|
6
6
|
const domContextHooks_module = require('./dom-context-hooks.module-e7b6727c.js');
|
|
7
7
|
const index_module = require('./index.module-42d413d9.js');
|
|
8
|
-
const keys = require('./keys-
|
|
8
|
+
const keys = require('./keys-5a2c9ed2.js');
|
|
9
9
|
|
|
10
10
|
const debug = domContextHooks_module.browser("sq:widget-verification");
|
|
11
11
|
function useTemplateChildren({ parent, callback }) {
|
|
@@ -51,15 +51,13 @@ const defaultProps = {
|
|
|
51
51
|
loading: false,
|
|
52
52
|
submitting: false,
|
|
53
53
|
isExistingPartner: false,
|
|
54
|
-
countryCode:
|
|
55
|
-
currency:
|
|
54
|
+
countryCode: null,
|
|
55
|
+
currency: null,
|
|
56
56
|
error: "",
|
|
57
57
|
success: false,
|
|
58
|
-
brandName: "Test Brand",
|
|
59
58
|
filteredCountries: demoCountries,
|
|
60
59
|
filteredCurrencies: demoCurrencies,
|
|
61
60
|
allowBankingCollection: false,
|
|
62
|
-
checkboxError: "",
|
|
63
61
|
disabled: false,
|
|
64
62
|
},
|
|
65
63
|
callbacks: noopCallbacks,
|
|
@@ -102,6 +100,18 @@ export const ExistingPartnerConfirm = () => {
|
|
|
102
100
|
};
|
|
103
101
|
return h(PartnerInfoModalView, Object.assign({}, props));
|
|
104
102
|
};
|
|
103
|
+
export const ExistingPartnerEmpty = () => {
|
|
104
|
+
const props = {
|
|
105
|
+
...defaultProps,
|
|
106
|
+
states: {
|
|
107
|
+
...defaultProps.states,
|
|
108
|
+
isExistingPartner: true,
|
|
109
|
+
countryCode: "",
|
|
110
|
+
currency: "",
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
return h(PartnerInfoModalView, Object.assign({}, props));
|
|
114
|
+
};
|
|
105
115
|
export const Submitting = () => {
|
|
106
116
|
const props = {
|
|
107
117
|
...defaultProps,
|
|
@@ -28,8 +28,6 @@ const style = {
|
|
|
28
28
|
marginTop: "var(--sl-spacing-large)",
|
|
29
29
|
},
|
|
30
30
|
ErrorMessage: {
|
|
31
|
-
color: "var(--sqm-danger-color-text, #d32f2f)",
|
|
32
|
-
fontSize: "var(--sl-font-size-small)",
|
|
33
31
|
marginTop: "var(--sl-spacing-x-small)",
|
|
34
32
|
},
|
|
35
33
|
SearchInput: {
|
|
@@ -56,6 +54,11 @@ const style = {
|
|
|
56
54
|
justifyContent: "flex-start",
|
|
57
55
|
flexDirection: "column",
|
|
58
56
|
},
|
|
57
|
+
Checkbox: {
|
|
58
|
+
"&::part(label)": {
|
|
59
|
+
fontSize: "var(--sl-font-size-small)",
|
|
60
|
+
},
|
|
61
|
+
},
|
|
59
62
|
SubmitButton: {
|
|
60
63
|
width: "100%",
|
|
61
64
|
marginTop: "var(--sl-spacing-large)",
|
|
@@ -84,22 +87,24 @@ export function PartnerInfoModalContentView(props) {
|
|
|
84
87
|
styleString),
|
|
85
88
|
h("div", { class: sheet.classes.FormFields },
|
|
86
89
|
description,
|
|
87
|
-
h("sl-select", { exportparts: "label: input-label, base: input-base, menu: select-menu", label: text.countryLabel, value: states.countryCode, disabled: states.submitting ||
|
|
90
|
+
h("sl-select", { exportparts: "label: input-label, base: input-base, menu: select-menu", label: text.countryLabel, value: states.countryCode, disabled: states.submitting ||
|
|
91
|
+
(!!states.countryCode && states.isExistingPartner), required: true, hoist: true, "onSl-select": callbacks.onCountryChange },
|
|
88
92
|
h("sl-input", { class: sheet.classes.SearchInput, placeholder: text.searchCountryPlaceholder, onKeyDown: (e) => e.stopPropagation(), "onSl-input": (e) => {
|
|
89
93
|
var _a;
|
|
90
94
|
callbacks.setCountrySearch((_a = e.target) === null || _a === void 0 ? void 0 : _a.value);
|
|
91
95
|
} }),
|
|
92
96
|
h("div", { class: sheet.classes.SelectMenu }, (_a = states.filteredCountries) === null || _a === void 0 ? void 0 : _a.map((c) => (h("sl-menu-item", { value: c.countryCode }, c.displayName))))),
|
|
93
|
-
h("sl-select", { exportparts: "label: input-label, base: input-base", label: text.currencyLabel, value: states.currency, disabled: states.submitting || !!states.
|
|
94
|
-
h("sl-input", { class: sheet.classes.SearchInput, placeholder: text.searchCurrencyPlaceholder, onKeyDown: (e) => e.stopPropagation(), "onSl-input": (e) => { var _a; return callbacks.setCurrencySearch((_a = e.target) === null || _a === void 0 ? void 0 : _a.value); } }),
|
|
95
|
-
_b.map((c) => (h("sl-menu-item", { value: c.currencyCode },
|
|
97
|
+
h("sl-select", { exportparts: "label: input-label, base: input-base", label: text.currencyLabel, value: states.currency, disabled: states.submitting || !!states.currency, required: true, hoist: true, "onSl-select": callbacks.onCurrencyChange },
|
|
98
|
+
h("sl-input", { class: sheet.classes.SearchInput, placeholder: text.searchCurrencyPlaceholder, onKeyDown: (e) => e.stopPropagation(), "onSl-input": (e) => { var _a; return callbacks.setCurrencySearch((_a = e.target) === null || _a === void 0 ? void 0 : _a.value); } }),
|
|
99
|
+
h("div", { class: sheet.classes.SelectMenu }, (_b = states.filteredCurrencies) === null || _b === void 0 ? void 0 : _b.map((c) => (h("sl-menu-item", { value: c.currencyCode },
|
|
96
100
|
c.currencyCode,
|
|
97
101
|
" - ",
|
|
98
|
-
c.displayName)))),
|
|
102
|
+
c.displayName))))),
|
|
99
103
|
h("div", { class: sheet.classes.CheckboxWrapper },
|
|
100
|
-
h("sl-checkbox", { checked: states.allowBankingCollection === true, "onSl-change": callbacks.onCheckboxChange, disabled: states.submitting, required: true, value: states.allowBankingCollection, id: "allowBankingCollection", name: "/allowBankingCollection" }, bankingCollectionText),
|
|
101
|
-
|
|
102
|
-
|
|
104
|
+
h("sl-checkbox", { class: sheet.classes.Checkbox, checked: states.allowBankingCollection === true, "onSl-change": callbacks.onCheckboxChange, disabled: states.submitting, required: true, value: states.allowBankingCollection, id: "allowBankingCollection", name: "/allowBankingCollection" }, bankingCollectionText))),
|
|
105
|
+
states.error && (h("div", { class: sheet.classes.ErrorMessage },
|
|
106
|
+
h("sqm-form-message", { class: sheet.classes.ErrorMessage, type: "error" },
|
|
107
|
+
h("p", { part: "alert-description" }, states.error)))),
|
|
103
108
|
h("sl-button", { slot: "footer", type: "primary", loading: states.submitting, disabled: states.submitting ||
|
|
104
109
|
!states.countryCode ||
|
|
105
110
|
!states.currency ||
|
|
@@ -14,12 +14,6 @@ import { usePartnerInfoModal, } from "./usePartnerInfoModal";
|
|
|
14
14
|
*/
|
|
15
15
|
export class PartnerInfoModal {
|
|
16
16
|
constructor() {
|
|
17
|
-
/**
|
|
18
|
-
* Brand name shown in the modal header
|
|
19
|
-
*
|
|
20
|
-
* @uiName Brand name
|
|
21
|
-
*/
|
|
22
|
-
this.brandName = "";
|
|
23
17
|
/**
|
|
24
18
|
* Header text when user has no existing partner
|
|
25
19
|
*
|
|
@@ -135,27 +129,6 @@ export class PartnerInfoModal {
|
|
|
135
129
|
static get is() { return "sqm-partner-info-modal"; }
|
|
136
130
|
static get encapsulation() { return "shadow"; }
|
|
137
131
|
static get properties() { return {
|
|
138
|
-
"brandName": {
|
|
139
|
-
"type": "string",
|
|
140
|
-
"mutable": false,
|
|
141
|
-
"complexType": {
|
|
142
|
-
"original": "string",
|
|
143
|
-
"resolved": "string",
|
|
144
|
-
"references": {}
|
|
145
|
-
},
|
|
146
|
-
"required": false,
|
|
147
|
-
"optional": false,
|
|
148
|
-
"docs": {
|
|
149
|
-
"tags": [{
|
|
150
|
-
"text": "Brand name",
|
|
151
|
-
"name": "uiName"
|
|
152
|
-
}],
|
|
153
|
-
"text": "Brand name shown in the modal header"
|
|
154
|
-
},
|
|
155
|
-
"attribute": "brand-name",
|
|
156
|
-
"reflect": false,
|
|
157
|
-
"defaultValue": "\"\""
|
|
158
|
-
},
|
|
159
132
|
"modalHeader": {
|
|
160
133
|
"type": "string",
|
|
161
134
|
"mutable": false,
|
|
@@ -572,7 +545,7 @@ export class PartnerInfoModal {
|
|
|
572
545
|
"mutable": false,
|
|
573
546
|
"complexType": {
|
|
574
547
|
"original": "DemoData<PartnerInfoModalResult>",
|
|
575
|
-
"resolved": "{ states?: { open: boolean; loading: boolean; submitting: boolean; isExistingPartner: boolean; countryCode: string; currency: string; error: string; success: boolean;
|
|
548
|
+
"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
549
|
"references": {
|
|
577
550
|
"DemoData": {
|
|
578
551
|
"location": "import",
|
|
@@ -609,7 +582,6 @@ function useDemoPartnerInfoModal(props) {
|
|
|
609
582
|
// @ts-ignore
|
|
610
583
|
return deepmerge({
|
|
611
584
|
states: {
|
|
612
|
-
brandName: "Test Brand",
|
|
613
585
|
open: false,
|
|
614
586
|
loading: false,
|
|
615
587
|
submitting: false,
|
|
@@ -621,7 +593,6 @@ function useDemoPartnerInfoModal(props) {
|
|
|
621
593
|
filteredCountries: [],
|
|
622
594
|
filteredCurrencies: [],
|
|
623
595
|
allowBankingCollection,
|
|
624
|
-
checkboxError: "",
|
|
625
596
|
disabled: false,
|
|
626
597
|
},
|
|
627
598
|
callbacks: {
|
|
@@ -2,9 +2,8 @@ import { useLocale, useMutation, useQuery, useSetParent, } from "@saasquatch/com
|
|
|
2
2
|
import { useEffect, useMemo, useState } from "@saasquatch/universal-hooks";
|
|
3
3
|
import { gql } from "graphql-request";
|
|
4
4
|
import { TAX_FORM_UPDATED_EVENT_KEY } from "../tax-and-cash/eventKeys";
|
|
5
|
-
import {
|
|
5
|
+
import { PARTNER_CREATED_NAMESPACE } from "../sqm-widget-verification/keys";
|
|
6
6
|
import { GET_FINANCE_NETWORK_SETTINGS, } from "../tax-and-cash/data";
|
|
7
|
-
// new field under impactConnection:{ resolvedByEmail: boolean } - determines if connection came from managed identity
|
|
8
7
|
export const GET_USER_PARTNER_INFO = gql `
|
|
9
8
|
query getUserPartnerInfo {
|
|
10
9
|
user: viewer {
|
|
@@ -101,30 +100,22 @@ const START_IMPACT_CONNECTION = gql `
|
|
|
101
100
|
}
|
|
102
101
|
}
|
|
103
102
|
`;
|
|
104
|
-
const GET_BRAND_NAME = gql `
|
|
105
|
-
query getTenantSettings {
|
|
106
|
-
tenantSettings {
|
|
107
|
-
companyName
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
`;
|
|
111
103
|
export function usePartnerInfoModal(props) {
|
|
112
|
-
var _a, _b, _c, _d, _e, _f
|
|
104
|
+
var _a, _b, _c, _d, _e, _f;
|
|
113
105
|
const locale = useLocale();
|
|
114
|
-
const
|
|
106
|
+
const setPartnerCreated = useSetParent(PARTNER_CREATED_NAMESPACE);
|
|
115
107
|
const { data: userData, loading: userLoading, refetch, } = useQuery(GET_USER_PARTNER_INFO, {});
|
|
116
108
|
const user = userData === null || userData === void 0 ? void 0 : userData.user;
|
|
117
109
|
const { data: currenciesData, loading: currenciesLoading } = useQuery(GET_CURRENCIES, { variables: { locale } });
|
|
118
110
|
const { data: countriesData, loading: countriesLoading } = useQuery(GET_COUNTRIES, {});
|
|
119
|
-
const { data: tenantSettingsData } = useQuery(GET_BRAND_NAME, {});
|
|
120
111
|
const { data: financeNetworkData } = useQuery(GET_FINANCE_NETWORK_SETTINGS, {
|
|
121
112
|
variables: { filter: {} },
|
|
122
113
|
});
|
|
123
|
-
const [startImpactConnection, { loading: connectLoading
|
|
114
|
+
const [startImpactConnection, { loading: connectLoading }] = useMutation(START_IMPACT_CONNECTION);
|
|
124
115
|
const [allowBankingCollection, setAllowBankingCollection] = useState(false);
|
|
125
|
-
const [checkboxError, setCheckboxError] = useState("");
|
|
126
116
|
// No pre-filled country, use locale to determine countryCode instead
|
|
127
|
-
const [countryCode, setCountryCode] = useState(((_b = (_a = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher) === null || _b === void 0 ? void 0 : _b.countryCode) ||
|
|
117
|
+
const [countryCode, setCountryCode] = useState(((_b = (_a = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher) === null || _b === void 0 ? void 0 : _b.countryCode) ||
|
|
118
|
+
locale.replace(/^.*_/, ""));
|
|
128
119
|
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) || "");
|
|
129
120
|
const countries = ((_e = countriesData === null || countriesData === void 0 ? void 0 : countriesData.impactPayoutCountries) === null || _e === void 0 ? void 0 : _e.data) || [];
|
|
130
121
|
// copied from useTaxAndCash for displaying currencies based on country - could be in helper?
|
|
@@ -198,13 +189,11 @@ export function usePartnerInfoModal(props) {
|
|
|
198
189
|
function onCheckboxChange(e) {
|
|
199
190
|
const checked = e.target.checked;
|
|
200
191
|
setAllowBankingCollection(checked);
|
|
201
|
-
if (checked)
|
|
202
|
-
setCheckboxError("");
|
|
203
192
|
}
|
|
204
193
|
async function onSubmit() {
|
|
205
194
|
var _a, _b;
|
|
206
195
|
if (!allowBankingCollection) {
|
|
207
|
-
|
|
196
|
+
setError(props.missingFieldsErrorText);
|
|
208
197
|
return;
|
|
209
198
|
}
|
|
210
199
|
if (!countryCode || !currency) {
|
|
@@ -212,7 +201,10 @@ export function usePartnerInfoModal(props) {
|
|
|
212
201
|
return;
|
|
213
202
|
}
|
|
214
203
|
setError("");
|
|
215
|
-
|
|
204
|
+
if (!user) {
|
|
205
|
+
setError(props.networkErrorText);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
216
208
|
try {
|
|
217
209
|
const vars = {
|
|
218
210
|
user: {
|
|
@@ -221,8 +213,6 @@ export function usePartnerInfoModal(props) {
|
|
|
221
213
|
},
|
|
222
214
|
firstName: user.firstName,
|
|
223
215
|
lastName: user.lastName,
|
|
224
|
-
// phoneNumber: null,
|
|
225
|
-
// phoneNumberCountryCode: null,
|
|
226
216
|
countryCode,
|
|
227
217
|
currency,
|
|
228
218
|
};
|
|
@@ -233,7 +223,6 @@ export function usePartnerInfoModal(props) {
|
|
|
233
223
|
}
|
|
234
224
|
const connectionResult = result
|
|
235
225
|
.startImpactConnection;
|
|
236
|
-
console.log(result, connectionResult, "result and connectionResult from creating partner from modal");
|
|
237
226
|
if (!(connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.success)) {
|
|
238
227
|
const validationMsg = (_b = connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.validationErrors) === null || _b === void 0 ? void 0 : _b.map((e) => e.message).join(". ");
|
|
239
228
|
setError(validationMsg || props.networkErrorText);
|
|
@@ -242,8 +231,8 @@ export function usePartnerInfoModal(props) {
|
|
|
242
231
|
}
|
|
243
232
|
window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));
|
|
244
233
|
await refetch();
|
|
234
|
+
setPartnerCreated === null || setPartnerCreated === void 0 ? void 0 : setPartnerCreated(true);
|
|
245
235
|
setSuccess(true);
|
|
246
|
-
setVerificationContext(true);
|
|
247
236
|
}
|
|
248
237
|
catch (e) {
|
|
249
238
|
console.error("Partner creation error:", e);
|
|
@@ -258,16 +247,14 @@ export function usePartnerInfoModal(props) {
|
|
|
258
247
|
open: showModal,
|
|
259
248
|
loading: userLoading || countriesLoading || currenciesLoading,
|
|
260
249
|
submitting: connectLoading,
|
|
261
|
-
isExistingPartner: impactConnection === null || impactConnection === void 0 ? void 0 : impactConnection.publisher,
|
|
250
|
+
isExistingPartner: !!(impactConnection === null || impactConnection === void 0 ? void 0 : impactConnection.publisher),
|
|
262
251
|
countryCode,
|
|
263
252
|
currency,
|
|
264
253
|
error,
|
|
265
254
|
success,
|
|
266
|
-
brandName: ((_g = tenantSettingsData === null || tenantSettingsData === void 0 ? void 0 : tenantSettingsData.tenantSettings) === null || _g === void 0 ? void 0 : _g.companyName) || "",
|
|
267
255
|
filteredCountries: filteredCountries || [],
|
|
268
256
|
filteredCurrencies: filteredCurrencies || [],
|
|
269
257
|
allowBankingCollection,
|
|
270
|
-
checkboxError,
|
|
271
258
|
disabled: userLoading || connectLoading,
|
|
272
259
|
},
|
|
273
260
|
callbacks: {
|