@bunnyapp/components 1.0.2 → 1.0.3
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/index.js +64 -25
- package/dist/esm/index.js +64 -25
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1550,14 +1550,14 @@ var BrandContext = React.createContext({
|
|
|
1550
1550
|
topNavImageUrl: common.DEFAULT_TOP_NAV_IMAGE_URL,
|
|
1551
1551
|
});
|
|
1552
1552
|
|
|
1553
|
-
var MUTATION$
|
|
1553
|
+
var MUTATION$9 = "{\n entityBranding {\n accentColor\n brandColor\n topNavImageUrl\n }\n }";
|
|
1554
1554
|
var getBranding = function (_a) {
|
|
1555
1555
|
var token = _a.token, subdomain = _a.subdomain;
|
|
1556
1556
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
1557
1557
|
var response;
|
|
1558
1558
|
return __generator(this, function (_b) {
|
|
1559
1559
|
switch (_b.label) {
|
|
1560
|
-
case 0: return [4 /*yield*/, common.gqlRequest({ query: MUTATION$
|
|
1560
|
+
case 0: return [4 /*yield*/, common.gqlRequest({ query: MUTATION$9, token: token, subdomain: subdomain })];
|
|
1561
1561
|
case 1:
|
|
1562
1562
|
response = _b.sent();
|
|
1563
1563
|
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.entityBranding];
|
|
@@ -2789,7 +2789,7 @@ var PaymentForm = function (_a) {
|
|
|
2789
2789
|
return (jsxRuntime.jsx(ActualPaymentForm, { invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, quote: quote, setIsSaving: setIsSaving }));
|
|
2790
2790
|
};
|
|
2791
2791
|
|
|
2792
|
-
var MUTATION$
|
|
2792
|
+
var MUTATION$8 = "\n mutation checkout(\n $invoiceId: ID,\n $quoteId: ID,\n $paymentMethodId: ID,\n $paymentMethodData: CheckoutPaymentMethodAttributes\n ) {\n checkout(\n invoiceId: $invoiceId,\n quoteId: $quoteId,\n paymentMethodId: $paymentMethodId,\n paymentMethodData: $paymentMethodData\n ) {\n invoice {\n id\n state\n amount\n amountDue\n }\n payment {\n id\n state\n amount\n }\n paymentApplication {\n id\n invoiceId\n paymentId\n }\n transaction {\n id\n amount\n }\n }\n }\n";
|
|
2793
2793
|
var checkout = function (_a) {
|
|
2794
2794
|
var quoteId = _a.quoteId, invoiceId = _a.invoiceId, paymentMethodId = _a.paymentMethodId, paymentMethodData = _a.paymentMethodData, token = _a.token, subdomain = _a.subdomain;
|
|
2795
2795
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -2806,7 +2806,7 @@ var checkout = function (_a) {
|
|
|
2806
2806
|
mutationVars.paymentMethodData = __assign(__assign({}, paymentMethodData), { metadata: paymentMethodData.metadata });
|
|
2807
2807
|
}
|
|
2808
2808
|
return [4 /*yield*/, common.gqlRequest({
|
|
2809
|
-
query: MUTATION$
|
|
2809
|
+
query: MUTATION$8,
|
|
2810
2810
|
token: token,
|
|
2811
2811
|
vars: mutationVars,
|
|
2812
2812
|
subdomain: subdomain,
|
|
@@ -2943,7 +2943,7 @@ function InvoicePDF(_a) {
|
|
|
2943
2943
|
}, title: "Invoice PDF", width: "100%" }));
|
|
2944
2944
|
}
|
|
2945
2945
|
|
|
2946
|
-
var MUTATION$
|
|
2946
|
+
var MUTATION$7 = "\nquery FormattedInvoice($id: ID) {\n formattedInvoice(id: $id) {\n amount\n amountDue\n amountPaid\n billingCity\n billingCountry\n billingState\n billingStreet\n billingZip\n createdAt\n credits\n currency\n currencyId\n currencySymbol\n customerBillingCity\n customerBillingContact\n customerBillingCountry\n customerBillingState\n customerBillingStreet\n customerBillingZip\n customerName\n dueAt\n html\n id\n isLegacy\n netPaymentDays\n number\n payableId\n poNumber\n printedState\n smallUnitAmountDue\n state\n subscriptionEndDate\n subscriptionStartDate\n subtotal\n taxAmount\n taxNumber\n uuid\n vendorName\n formattedLines {\n amount\n billingPeriodEnd\n billingPeriodStart\n chargeType\n discount\n frequency\n lineText\n position\n price\n priceDecimals\n priceListChargeId\n priceListChargeName\n priceListName\n prorationRate\n quantity\n unitOfMeasure\n priceTiers {\n price\n starts\n }\n }\n }\n}";
|
|
2947
2947
|
var getFormattedInvoice = function (_a) {
|
|
2948
2948
|
var id = _a.id, token = _a.token, subdomain = _a.subdomain;
|
|
2949
2949
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -2953,7 +2953,7 @@ var getFormattedInvoice = function (_a) {
|
|
|
2953
2953
|
case 0:
|
|
2954
2954
|
vars = { id: id };
|
|
2955
2955
|
return [4 /*yield*/, common.gqlRequest({
|
|
2956
|
-
query: MUTATION$
|
|
2956
|
+
query: MUTATION$7,
|
|
2957
2957
|
token: token,
|
|
2958
2958
|
vars: vars,
|
|
2959
2959
|
subdomain: subdomain,
|
|
@@ -3247,7 +3247,7 @@ var PandadocPollingModal = function (_a) {
|
|
|
3247
3247
|
return (jsxRuntime.jsxs(antd.Modal, __assign({ title: "Uploading quote to Pandadoc", open: isVisible, closable: false, footer: null }, { children: [jsxRuntime.jsxs("div", __assign({ className: "py-4 text-center" }, { children: ["This may take a few seconds", ".".repeat(numberOfPolls)] })), jsxRuntime.jsx("div", __assign({ className: "text-center" }, { children: infoMessage }))] })));
|
|
3248
3248
|
};
|
|
3249
3249
|
|
|
3250
|
-
var MUTATION$
|
|
3250
|
+
var MUTATION$6 = "\n query formattedQuote ($id: ID) {\n formattedQuote (id: $id) {\n payableId\n acceptedAt\n acceptedByName\n amount\n amountDue\n amountsByPeriod {\n id\n name\n amount\n }\n object { documents { id filename size date url } }\n billingCity\n billingCountry\n billingState\n billingStreet\n billingZip\n contactName\n currency\n customerBillingCity\n customerBillingCountry\n customerBillingState\n customerBillingStreet\n customerBillingZip\n customerName\n discount\n discountValue\n duration\n endDate\n expiresAt\n html\n formattedLines {\n amount\n amountsByPeriod {\n quantity\n id\n name\n startDate\n endDate\n amount\n amountsByTier {\n id\n tier {\n starts\n ends\n price\n }\n quantity\n amount\n }\n prorationRate\n }\n billingPeriodEnd\n billingPeriodStart\n chargeType\n discount\n frequency\n isRamp\n periods\n planName\n position\n price\n priceDecimals\n priceListChargeId\n priceListChargeName\n priceListId\n priceListName\n priceTiers {\n price\n starts\n }\n pricingModel\n productName\n prorationRate\n quantity\n showProductNameOnLineItem\n taxCode\n trialEndDate\n trialStartDate\n unitOfMeasure\n vatCode\n }\n netPaymentDays\n notes\n number\n poNumberRequired\n salesContactEmail\n sharedAt\n startDate\n state\n subtotal\n taxAmount\n taxNumberLabel\n taxNumberRequired\n vendorName\n }\n }";
|
|
3251
3251
|
var getFormattedQuote = function (_a) {
|
|
3252
3252
|
var id = _a.id, token = _a.token, subdomain = _a.subdomain;
|
|
3253
3253
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -3257,7 +3257,7 @@ var getFormattedQuote = function (_a) {
|
|
|
3257
3257
|
case 0:
|
|
3258
3258
|
vars = { id: id };
|
|
3259
3259
|
return [4 /*yield*/, common.gqlRequest({
|
|
3260
|
-
query: MUTATION$
|
|
3260
|
+
query: MUTATION$6,
|
|
3261
3261
|
token: token,
|
|
3262
3262
|
vars: vars,
|
|
3263
3263
|
subdomain: subdomain,
|
|
@@ -3450,7 +3450,7 @@ function PaymentMethod(_a) {
|
|
|
3450
3450
|
return (jsxRuntime.jsx(PaymentMethodContext.Provider, __assign({ value: { footer: footer, processPublicUrl: processPublicUrl } }, { children: jsxRuntime.jsx(ActualPaymentMethod, {}) })));
|
|
3451
3451
|
}
|
|
3452
3452
|
|
|
3453
|
-
var MUTATION$
|
|
3453
|
+
var MUTATION$5 = "\nmutation accountUpdate(\n $id: ID!,\n $attributes: AccountAttributes!) {\n accountUpdate(\n id: $id,\n attributes: $attributes\n ) {\n account { id }\n errors\n }\n }\n";
|
|
3454
3454
|
var accountUpdate = function (_a) {
|
|
3455
3455
|
var accountId = _a.accountId, attributes = _a.attributes, token = _a.token;
|
|
3456
3456
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -3460,7 +3460,7 @@ var accountUpdate = function (_a) {
|
|
|
3460
3460
|
switch (_c.label) {
|
|
3461
3461
|
case 0:
|
|
3462
3462
|
vars = { id: accountId, attributes: attributes };
|
|
3463
|
-
return [4 /*yield*/, common.gqlRequest({ query: MUTATION$
|
|
3463
|
+
return [4 /*yield*/, common.gqlRequest({ query: MUTATION$5, token: token, vars: vars })];
|
|
3464
3464
|
case 1:
|
|
3465
3465
|
response = _c.sent();
|
|
3466
3466
|
errors = (_b = response === null || response === void 0 ? void 0 : response.accountUpdate) === null || _b === void 0 ? void 0 : _b.errors;
|
|
@@ -3728,7 +3728,7 @@ var Checkout = function (_a) {
|
|
|
3728
3728
|
}, setIsSaving: setIsSaving }))] }))] })) })));
|
|
3729
3729
|
};
|
|
3730
3730
|
|
|
3731
|
-
var MUTATION$
|
|
3731
|
+
var MUTATION$4 = function () { return "\nmutation AccountSignup (\n $entityId: ID!,\n $pluginId: String!,\n $paymentMethodId: String,\n $priceListCode: String!,\n $accountId: ID!,\n $quoteId: ID!\n) {\n accountSignup(\n entityId: $entityId,\n pluginId: $pluginId,\n paymentMethodId: $paymentMethodId,\n priceListCode: $priceListCode,\n accountId: $accountId,\n quoteId: $quoteId\n ) {\n errors\n quote {\n acceptedByName\n acceptedByTitle\n accountId\n amount\n amountDue\n applicationDate\n applied\n backdatedPeriods\n backdatedQuote\n billingDay\n contactId\n createdAt\n credits\n currencyId\n dealId\n discount\n discountValue\n endDate\n evergreen\n expiresAt\n id\n invoiceImmediately\n invoiceImmediatelyAvailable\n invoiceUntil\n isPendingApprovalRequest\n kind\n message\n name\n netPaymentDays\n notes\n number\n ownerId\n payableId\n periodAmount\n poNumber\n requiresApproval\n smallUnitAmountDue\n splitInvoice\n startDate\n state\n subtotal\n taxAmount\n taxCode\n updatedAt\n uuid\n }\n }\n}"; };
|
|
3732
3732
|
var accountSignup = function (_a) {
|
|
3733
3733
|
var token = _a.token, subdomain = _a.subdomain, entityId = _a.entityId, accountId = _a.accountId, quoteId = _a.quoteId, paymentToken = _a.paymentToken, paymentMethodId = _a.paymentMethodId, pluginId = _a.pluginId, priceListCode = _a.priceListCode;
|
|
3734
3734
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -3747,7 +3747,7 @@ var accountSignup = function (_a) {
|
|
|
3747
3747
|
priceListCode: priceListCode,
|
|
3748
3748
|
};
|
|
3749
3749
|
return [4 /*yield*/, common.gqlRequest({
|
|
3750
|
-
query: MUTATION$
|
|
3750
|
+
query: MUTATION$4(),
|
|
3751
3751
|
token: token,
|
|
3752
3752
|
vars: vars,
|
|
3753
3753
|
subdomain: subdomain,
|
|
@@ -3763,7 +3763,7 @@ var accountSignup = function (_a) {
|
|
|
3763
3763
|
});
|
|
3764
3764
|
};
|
|
3765
3765
|
|
|
3766
|
-
var MUTATION$
|
|
3766
|
+
var MUTATION$3 = function () { return "\nmutation QuoteAccountSignup (\n $accountName: String!,\n $billingContact: ContactAttributes!,\n $entityId: ID!,\n $priceListCode: String!\n) {\n quoteAccountSignup(\n entityId: $entityId,\n priceListCode: $priceListCode,\n accountName: $accountName,\n billingContact: $billingContact\n ) {\n account {\n id\n }\n amount\n currencyId\n quote {\n id\n }\n tenant {\n code\n }\n errors\n }\n}"; };
|
|
3767
3767
|
var quoteAccountSignup = function (_a) {
|
|
3768
3768
|
var token = _a.token, subdomain = _a.subdomain, entityId = _a.entityId, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
|
|
3769
3769
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -3779,7 +3779,7 @@ var quoteAccountSignup = function (_a) {
|
|
|
3779
3779
|
billingContact: billingContact,
|
|
3780
3780
|
};
|
|
3781
3781
|
return [4 /*yield*/, common.gqlRequest({
|
|
3782
|
-
query: MUTATION$
|
|
3782
|
+
query: MUTATION$3(),
|
|
3783
3783
|
token: token,
|
|
3784
3784
|
vars: vars,
|
|
3785
3785
|
subdomain: subdomain,
|
|
@@ -3795,7 +3795,7 @@ var quoteAccountSignup = function (_a) {
|
|
|
3795
3795
|
});
|
|
3796
3796
|
};
|
|
3797
3797
|
|
|
3798
|
-
var MUTATION$
|
|
3798
|
+
var MUTATION$2 = function () { return "\nquery PriceList($code: String!) {\n priceList (code: $code) {\n basePrice\n code\n createdAt\n currencyId\n id\n isVisible\n name\n periodMonths\n planId\n priceDescription\n productId\n sku\n trialAllowed\n trialLengthDays\n updatedAt\n }\n}"; };
|
|
3799
3799
|
var getPriceList = function (_a) {
|
|
3800
3800
|
var token = _a.token, code = _a.code, subdomain = _a.subdomain;
|
|
3801
3801
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -3803,7 +3803,7 @@ var getPriceList = function (_a) {
|
|
|
3803
3803
|
return __generator(this, function (_b) {
|
|
3804
3804
|
switch (_b.label) {
|
|
3805
3805
|
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
3806
|
-
query: MUTATION$
|
|
3806
|
+
query: MUTATION$2(),
|
|
3807
3807
|
token: token,
|
|
3808
3808
|
vars: { code: code },
|
|
3809
3809
|
subdomain: subdomain,
|
|
@@ -3895,6 +3895,31 @@ var StyedLink = styled__default["default"].a(templateObject_1$4 || (templateObje
|
|
|
3895
3895
|
var StyledBunnyLink = styled__default["default"](StyedLink)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n &:hover {\n color: ", " !important;\n }\n"], ["\n &:hover {\n color: ", " !important;\n }\n"])), common.PRIMARY_COLOR);
|
|
3896
3896
|
var templateObject_1$4, templateObject_2;
|
|
3897
3897
|
|
|
3898
|
+
var MUTATION$1 = "\n mutation portalSessionCreate ($tenantCode: String!, $expiry: Int!, $returnUrl: String!) {\n portalSessionCreate (tenantCode: $tenantCode, expiry: $expiry, returnUrl: $returnUrl) {\n errors\n token\n }\n }\n";
|
|
3899
|
+
var portalSessionCreate = function (_a) {
|
|
3900
|
+
var tenantCode = _a.tenantCode, expiry = _a.expiry, returnUrl = _a.returnUrl, token = _a.token, subdomain = _a.subdomain;
|
|
3901
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
3902
|
+
var response, errors;
|
|
3903
|
+
var _b;
|
|
3904
|
+
return __generator(this, function (_c) {
|
|
3905
|
+
switch (_c.label) {
|
|
3906
|
+
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
3907
|
+
query: MUTATION$1,
|
|
3908
|
+
token: token,
|
|
3909
|
+
vars: { tenantCode: tenantCode, expiry: expiry, returnUrl: returnUrl },
|
|
3910
|
+
subdomain: subdomain,
|
|
3911
|
+
})];
|
|
3912
|
+
case 1:
|
|
3913
|
+
response = _c.sent();
|
|
3914
|
+
errors = (response === null || response === void 0 ? void 0 : response.portalSessionCreate).errors;
|
|
3915
|
+
if (errors)
|
|
3916
|
+
throw errors;
|
|
3917
|
+
return [2 /*return*/, (_b = response === null || response === void 0 ? void 0 : response.portalSessionCreate) === null || _b === void 0 ? void 0 : _b.token];
|
|
3918
|
+
}
|
|
3919
|
+
});
|
|
3920
|
+
});
|
|
3921
|
+
};
|
|
3922
|
+
|
|
3898
3923
|
var showErrorNotification = common.NotificationUtils.useErrorNotification();
|
|
3899
3924
|
function Signup(_a) {
|
|
3900
3925
|
var priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
|
|
@@ -3910,10 +3935,11 @@ function Signup(_a) {
|
|
|
3910
3935
|
var _c = React.useState(undefined), quote = _c[0], setQuote = _c[1];
|
|
3911
3936
|
var _d = React.useState(undefined), accountId = _d[0], setAccountId = _d[1];
|
|
3912
3937
|
var _e = React.useState(undefined), quoteId = _e[0], setQuoteId = _e[1];
|
|
3913
|
-
var _f = React.useState(undefined),
|
|
3914
|
-
var _g = React.useState(
|
|
3915
|
-
var _h = React.useState(false),
|
|
3916
|
-
var _j = React.useState(false),
|
|
3938
|
+
var _f = React.useState(undefined), portalSessionToken = _f[0], setPortalSessionToken = _f[1];
|
|
3939
|
+
var _g = React.useState(undefined), formData = _g[0], setFormData = _g[1];
|
|
3940
|
+
var _h = React.useState(false), proceedingToPayment = _h[0], setProceedingToPayment = _h[1];
|
|
3941
|
+
var _j = React.useState(false), paying = _j[0], setIsPaying = _j[1];
|
|
3942
|
+
var _k = React.useState(false), purchaseSucceeded = _k[0], setPurchaseSucceeded = _k[1];
|
|
3917
3943
|
// Queries
|
|
3918
3944
|
var priceListData = reactQuery.useQuery({
|
|
3919
3945
|
queryKey: ["priceList", priceListCode],
|
|
@@ -3921,7 +3947,7 @@ function Signup(_a) {
|
|
|
3921
3947
|
}).data;
|
|
3922
3948
|
function handleSubmit(formData) {
|
|
3923
3949
|
return __awaiter(this, void 0, void 0, function () {
|
|
3924
|
-
var data;
|
|
3950
|
+
var data, portalSessionToken;
|
|
3925
3951
|
return __generator(this, function (_a) {
|
|
3926
3952
|
switch (_a.label) {
|
|
3927
3953
|
case 0:
|
|
@@ -3942,11 +3968,21 @@ function Signup(_a) {
|
|
|
3942
3968
|
case 1:
|
|
3943
3969
|
data = _a.sent();
|
|
3944
3970
|
setAccountId(data.account.id);
|
|
3945
|
-
|
|
3971
|
+
return [4 /*yield*/, portalSessionCreate({
|
|
3972
|
+
token: token,
|
|
3973
|
+
subdomain: subdomain,
|
|
3974
|
+
tenantCode: data.tenant.code,
|
|
3975
|
+
expiry: 24,
|
|
3976
|
+
returnUrl: returnUrl || "",
|
|
3977
|
+
})];
|
|
3978
|
+
case 2:
|
|
3979
|
+
portalSessionToken = _a.sent();
|
|
3980
|
+
setPortalSessionToken(portalSessionToken);
|
|
3981
|
+
setQuoteId(data.quote.id);
|
|
3946
3982
|
setProceedingToPayment(false);
|
|
3947
3983
|
setQuote({
|
|
3948
|
-
amountDue: data.
|
|
3949
|
-
currencyId: data.currencyId,
|
|
3984
|
+
amountDue: data.quote.amountDue,
|
|
3985
|
+
currencyId: data.quote.currencyId,
|
|
3950
3986
|
});
|
|
3951
3987
|
return [2 /*return*/];
|
|
3952
3988
|
}
|
|
@@ -3971,8 +4007,11 @@ function Signup(_a) {
|
|
|
3971
4007
|
if (!accountId) {
|
|
3972
4008
|
throw new Error("Account ID is required");
|
|
3973
4009
|
}
|
|
4010
|
+
if (!portalSessionToken) {
|
|
4011
|
+
throw new Error("Portal session token is required");
|
|
4012
|
+
}
|
|
3974
4013
|
return [4 /*yield*/, accountSignup({
|
|
3975
|
-
token:
|
|
4014
|
+
token: portalSessionToken,
|
|
3976
4015
|
subdomain: subdomain,
|
|
3977
4016
|
entityId: entityId,
|
|
3978
4017
|
quoteId: quoteId,
|
package/dist/esm/index.js
CHANGED
|
@@ -1521,14 +1521,14 @@ var BrandContext = createContext({
|
|
|
1521
1521
|
topNavImageUrl: DEFAULT_TOP_NAV_IMAGE_URL,
|
|
1522
1522
|
});
|
|
1523
1523
|
|
|
1524
|
-
var MUTATION$
|
|
1524
|
+
var MUTATION$9 = "{\n entityBranding {\n accentColor\n brandColor\n topNavImageUrl\n }\n }";
|
|
1525
1525
|
var getBranding = function (_a) {
|
|
1526
1526
|
var token = _a.token, subdomain = _a.subdomain;
|
|
1527
1527
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
1528
1528
|
var response;
|
|
1529
1529
|
return __generator(this, function (_b) {
|
|
1530
1530
|
switch (_b.label) {
|
|
1531
|
-
case 0: return [4 /*yield*/, gqlRequest({ query: MUTATION$
|
|
1531
|
+
case 0: return [4 /*yield*/, gqlRequest({ query: MUTATION$9, token: token, subdomain: subdomain })];
|
|
1532
1532
|
case 1:
|
|
1533
1533
|
response = _b.sent();
|
|
1534
1534
|
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.entityBranding];
|
|
@@ -2760,7 +2760,7 @@ var PaymentForm = function (_a) {
|
|
|
2760
2760
|
return (jsx(ActualPaymentForm, { invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, quote: quote, setIsSaving: setIsSaving }));
|
|
2761
2761
|
};
|
|
2762
2762
|
|
|
2763
|
-
var MUTATION$
|
|
2763
|
+
var MUTATION$8 = "\n mutation checkout(\n $invoiceId: ID,\n $quoteId: ID,\n $paymentMethodId: ID,\n $paymentMethodData: CheckoutPaymentMethodAttributes\n ) {\n checkout(\n invoiceId: $invoiceId,\n quoteId: $quoteId,\n paymentMethodId: $paymentMethodId,\n paymentMethodData: $paymentMethodData\n ) {\n invoice {\n id\n state\n amount\n amountDue\n }\n payment {\n id\n state\n amount\n }\n paymentApplication {\n id\n invoiceId\n paymentId\n }\n transaction {\n id\n amount\n }\n }\n }\n";
|
|
2764
2764
|
var checkout = function (_a) {
|
|
2765
2765
|
var quoteId = _a.quoteId, invoiceId = _a.invoiceId, paymentMethodId = _a.paymentMethodId, paymentMethodData = _a.paymentMethodData, token = _a.token, subdomain = _a.subdomain;
|
|
2766
2766
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -2777,7 +2777,7 @@ var checkout = function (_a) {
|
|
|
2777
2777
|
mutationVars.paymentMethodData = __assign(__assign({}, paymentMethodData), { metadata: paymentMethodData.metadata });
|
|
2778
2778
|
}
|
|
2779
2779
|
return [4 /*yield*/, gqlRequest({
|
|
2780
|
-
query: MUTATION$
|
|
2780
|
+
query: MUTATION$8,
|
|
2781
2781
|
token: token,
|
|
2782
2782
|
vars: mutationVars,
|
|
2783
2783
|
subdomain: subdomain,
|
|
@@ -2914,7 +2914,7 @@ function InvoicePDF(_a) {
|
|
|
2914
2914
|
}, title: "Invoice PDF", width: "100%" }));
|
|
2915
2915
|
}
|
|
2916
2916
|
|
|
2917
|
-
var MUTATION$
|
|
2917
|
+
var MUTATION$7 = "\nquery FormattedInvoice($id: ID) {\n formattedInvoice(id: $id) {\n amount\n amountDue\n amountPaid\n billingCity\n billingCountry\n billingState\n billingStreet\n billingZip\n createdAt\n credits\n currency\n currencyId\n currencySymbol\n customerBillingCity\n customerBillingContact\n customerBillingCountry\n customerBillingState\n customerBillingStreet\n customerBillingZip\n customerName\n dueAt\n html\n id\n isLegacy\n netPaymentDays\n number\n payableId\n poNumber\n printedState\n smallUnitAmountDue\n state\n subscriptionEndDate\n subscriptionStartDate\n subtotal\n taxAmount\n taxNumber\n uuid\n vendorName\n formattedLines {\n amount\n billingPeriodEnd\n billingPeriodStart\n chargeType\n discount\n frequency\n lineText\n position\n price\n priceDecimals\n priceListChargeId\n priceListChargeName\n priceListName\n prorationRate\n quantity\n unitOfMeasure\n priceTiers {\n price\n starts\n }\n }\n }\n}";
|
|
2918
2918
|
var getFormattedInvoice = function (_a) {
|
|
2919
2919
|
var id = _a.id, token = _a.token, subdomain = _a.subdomain;
|
|
2920
2920
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -2924,7 +2924,7 @@ var getFormattedInvoice = function (_a) {
|
|
|
2924
2924
|
case 0:
|
|
2925
2925
|
vars = { id: id };
|
|
2926
2926
|
return [4 /*yield*/, gqlRequest({
|
|
2927
|
-
query: MUTATION$
|
|
2927
|
+
query: MUTATION$7,
|
|
2928
2928
|
token: token,
|
|
2929
2929
|
vars: vars,
|
|
2930
2930
|
subdomain: subdomain,
|
|
@@ -3218,7 +3218,7 @@ var PandadocPollingModal = function (_a) {
|
|
|
3218
3218
|
return (jsxs(Modal, __assign({ title: "Uploading quote to Pandadoc", open: isVisible, closable: false, footer: null }, { children: [jsxs("div", __assign({ className: "py-4 text-center" }, { children: ["This may take a few seconds", ".".repeat(numberOfPolls)] })), jsx("div", __assign({ className: "text-center" }, { children: infoMessage }))] })));
|
|
3219
3219
|
};
|
|
3220
3220
|
|
|
3221
|
-
var MUTATION$
|
|
3221
|
+
var MUTATION$6 = "\n query formattedQuote ($id: ID) {\n formattedQuote (id: $id) {\n payableId\n acceptedAt\n acceptedByName\n amount\n amountDue\n amountsByPeriod {\n id\n name\n amount\n }\n object { documents { id filename size date url } }\n billingCity\n billingCountry\n billingState\n billingStreet\n billingZip\n contactName\n currency\n customerBillingCity\n customerBillingCountry\n customerBillingState\n customerBillingStreet\n customerBillingZip\n customerName\n discount\n discountValue\n duration\n endDate\n expiresAt\n html\n formattedLines {\n amount\n amountsByPeriod {\n quantity\n id\n name\n startDate\n endDate\n amount\n amountsByTier {\n id\n tier {\n starts\n ends\n price\n }\n quantity\n amount\n }\n prorationRate\n }\n billingPeriodEnd\n billingPeriodStart\n chargeType\n discount\n frequency\n isRamp\n periods\n planName\n position\n price\n priceDecimals\n priceListChargeId\n priceListChargeName\n priceListId\n priceListName\n priceTiers {\n price\n starts\n }\n pricingModel\n productName\n prorationRate\n quantity\n showProductNameOnLineItem\n taxCode\n trialEndDate\n trialStartDate\n unitOfMeasure\n vatCode\n }\n netPaymentDays\n notes\n number\n poNumberRequired\n salesContactEmail\n sharedAt\n startDate\n state\n subtotal\n taxAmount\n taxNumberLabel\n taxNumberRequired\n vendorName\n }\n }";
|
|
3222
3222
|
var getFormattedQuote = function (_a) {
|
|
3223
3223
|
var id = _a.id, token = _a.token, subdomain = _a.subdomain;
|
|
3224
3224
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -3228,7 +3228,7 @@ var getFormattedQuote = function (_a) {
|
|
|
3228
3228
|
case 0:
|
|
3229
3229
|
vars = { id: id };
|
|
3230
3230
|
return [4 /*yield*/, gqlRequest({
|
|
3231
|
-
query: MUTATION$
|
|
3231
|
+
query: MUTATION$6,
|
|
3232
3232
|
token: token,
|
|
3233
3233
|
vars: vars,
|
|
3234
3234
|
subdomain: subdomain,
|
|
@@ -3421,7 +3421,7 @@ function PaymentMethod(_a) {
|
|
|
3421
3421
|
return (jsx(PaymentMethodContext.Provider, __assign({ value: { footer: footer, processPublicUrl: processPublicUrl } }, { children: jsx(ActualPaymentMethod, {}) })));
|
|
3422
3422
|
}
|
|
3423
3423
|
|
|
3424
|
-
var MUTATION$
|
|
3424
|
+
var MUTATION$5 = "\nmutation accountUpdate(\n $id: ID!,\n $attributes: AccountAttributes!) {\n accountUpdate(\n id: $id,\n attributes: $attributes\n ) {\n account { id }\n errors\n }\n }\n";
|
|
3425
3425
|
var accountUpdate = function (_a) {
|
|
3426
3426
|
var accountId = _a.accountId, attributes = _a.attributes, token = _a.token;
|
|
3427
3427
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -3431,7 +3431,7 @@ var accountUpdate = function (_a) {
|
|
|
3431
3431
|
switch (_c.label) {
|
|
3432
3432
|
case 0:
|
|
3433
3433
|
vars = { id: accountId, attributes: attributes };
|
|
3434
|
-
return [4 /*yield*/, gqlRequest({ query: MUTATION$
|
|
3434
|
+
return [4 /*yield*/, gqlRequest({ query: MUTATION$5, token: token, vars: vars })];
|
|
3435
3435
|
case 1:
|
|
3436
3436
|
response = _c.sent();
|
|
3437
3437
|
errors = (_b = response === null || response === void 0 ? void 0 : response.accountUpdate) === null || _b === void 0 ? void 0 : _b.errors;
|
|
@@ -3699,7 +3699,7 @@ var Checkout = function (_a) {
|
|
|
3699
3699
|
}, setIsSaving: setIsSaving }))] }))] })) })));
|
|
3700
3700
|
};
|
|
3701
3701
|
|
|
3702
|
-
var MUTATION$
|
|
3702
|
+
var MUTATION$4 = function () { return "\nmutation AccountSignup (\n $entityId: ID!,\n $pluginId: String!,\n $paymentMethodId: String,\n $priceListCode: String!,\n $accountId: ID!,\n $quoteId: ID!\n) {\n accountSignup(\n entityId: $entityId,\n pluginId: $pluginId,\n paymentMethodId: $paymentMethodId,\n priceListCode: $priceListCode,\n accountId: $accountId,\n quoteId: $quoteId\n ) {\n errors\n quote {\n acceptedByName\n acceptedByTitle\n accountId\n amount\n amountDue\n applicationDate\n applied\n backdatedPeriods\n backdatedQuote\n billingDay\n contactId\n createdAt\n credits\n currencyId\n dealId\n discount\n discountValue\n endDate\n evergreen\n expiresAt\n id\n invoiceImmediately\n invoiceImmediatelyAvailable\n invoiceUntil\n isPendingApprovalRequest\n kind\n message\n name\n netPaymentDays\n notes\n number\n ownerId\n payableId\n periodAmount\n poNumber\n requiresApproval\n smallUnitAmountDue\n splitInvoice\n startDate\n state\n subtotal\n taxAmount\n taxCode\n updatedAt\n uuid\n }\n }\n}"; };
|
|
3703
3703
|
var accountSignup = function (_a) {
|
|
3704
3704
|
var token = _a.token, subdomain = _a.subdomain, entityId = _a.entityId, accountId = _a.accountId, quoteId = _a.quoteId, paymentToken = _a.paymentToken, paymentMethodId = _a.paymentMethodId, pluginId = _a.pluginId, priceListCode = _a.priceListCode;
|
|
3705
3705
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -3718,7 +3718,7 @@ var accountSignup = function (_a) {
|
|
|
3718
3718
|
priceListCode: priceListCode,
|
|
3719
3719
|
};
|
|
3720
3720
|
return [4 /*yield*/, gqlRequest({
|
|
3721
|
-
query: MUTATION$
|
|
3721
|
+
query: MUTATION$4(),
|
|
3722
3722
|
token: token,
|
|
3723
3723
|
vars: vars,
|
|
3724
3724
|
subdomain: subdomain,
|
|
@@ -3734,7 +3734,7 @@ var accountSignup = function (_a) {
|
|
|
3734
3734
|
});
|
|
3735
3735
|
};
|
|
3736
3736
|
|
|
3737
|
-
var MUTATION$
|
|
3737
|
+
var MUTATION$3 = function () { return "\nmutation QuoteAccountSignup (\n $accountName: String!,\n $billingContact: ContactAttributes!,\n $entityId: ID!,\n $priceListCode: String!\n) {\n quoteAccountSignup(\n entityId: $entityId,\n priceListCode: $priceListCode,\n accountName: $accountName,\n billingContact: $billingContact\n ) {\n account {\n id\n }\n amount\n currencyId\n quote {\n id\n }\n tenant {\n code\n }\n errors\n }\n}"; };
|
|
3738
3738
|
var quoteAccountSignup = function (_a) {
|
|
3739
3739
|
var token = _a.token, subdomain = _a.subdomain, entityId = _a.entityId, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
|
|
3740
3740
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -3750,7 +3750,7 @@ var quoteAccountSignup = function (_a) {
|
|
|
3750
3750
|
billingContact: billingContact,
|
|
3751
3751
|
};
|
|
3752
3752
|
return [4 /*yield*/, gqlRequest({
|
|
3753
|
-
query: MUTATION$
|
|
3753
|
+
query: MUTATION$3(),
|
|
3754
3754
|
token: token,
|
|
3755
3755
|
vars: vars,
|
|
3756
3756
|
subdomain: subdomain,
|
|
@@ -3766,7 +3766,7 @@ var quoteAccountSignup = function (_a) {
|
|
|
3766
3766
|
});
|
|
3767
3767
|
};
|
|
3768
3768
|
|
|
3769
|
-
var MUTATION$
|
|
3769
|
+
var MUTATION$2 = function () { return "\nquery PriceList($code: String!) {\n priceList (code: $code) {\n basePrice\n code\n createdAt\n currencyId\n id\n isVisible\n name\n periodMonths\n planId\n priceDescription\n productId\n sku\n trialAllowed\n trialLengthDays\n updatedAt\n }\n}"; };
|
|
3770
3770
|
var getPriceList = function (_a) {
|
|
3771
3771
|
var token = _a.token, code = _a.code, subdomain = _a.subdomain;
|
|
3772
3772
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -3774,7 +3774,7 @@ var getPriceList = function (_a) {
|
|
|
3774
3774
|
return __generator(this, function (_b) {
|
|
3775
3775
|
switch (_b.label) {
|
|
3776
3776
|
case 0: return [4 /*yield*/, gqlRequest({
|
|
3777
|
-
query: MUTATION$
|
|
3777
|
+
query: MUTATION$2(),
|
|
3778
3778
|
token: token,
|
|
3779
3779
|
vars: { code: code },
|
|
3780
3780
|
subdomain: subdomain,
|
|
@@ -3866,6 +3866,31 @@ var StyedLink = styled.a(templateObject_1$4 || (templateObject_1$4 = __makeTempl
|
|
|
3866
3866
|
var StyledBunnyLink = styled(StyedLink)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n &:hover {\n color: ", " !important;\n }\n"], ["\n &:hover {\n color: ", " !important;\n }\n"])), PRIMARY_COLOR);
|
|
3867
3867
|
var templateObject_1$4, templateObject_2;
|
|
3868
3868
|
|
|
3869
|
+
var MUTATION$1 = "\n mutation portalSessionCreate ($tenantCode: String!, $expiry: Int!, $returnUrl: String!) {\n portalSessionCreate (tenantCode: $tenantCode, expiry: $expiry, returnUrl: $returnUrl) {\n errors\n token\n }\n }\n";
|
|
3870
|
+
var portalSessionCreate = function (_a) {
|
|
3871
|
+
var tenantCode = _a.tenantCode, expiry = _a.expiry, returnUrl = _a.returnUrl, token = _a.token, subdomain = _a.subdomain;
|
|
3872
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
3873
|
+
var response, errors;
|
|
3874
|
+
var _b;
|
|
3875
|
+
return __generator(this, function (_c) {
|
|
3876
|
+
switch (_c.label) {
|
|
3877
|
+
case 0: return [4 /*yield*/, gqlRequest({
|
|
3878
|
+
query: MUTATION$1,
|
|
3879
|
+
token: token,
|
|
3880
|
+
vars: { tenantCode: tenantCode, expiry: expiry, returnUrl: returnUrl },
|
|
3881
|
+
subdomain: subdomain,
|
|
3882
|
+
})];
|
|
3883
|
+
case 1:
|
|
3884
|
+
response = _c.sent();
|
|
3885
|
+
errors = (response === null || response === void 0 ? void 0 : response.portalSessionCreate).errors;
|
|
3886
|
+
if (errors)
|
|
3887
|
+
throw errors;
|
|
3888
|
+
return [2 /*return*/, (_b = response === null || response === void 0 ? void 0 : response.portalSessionCreate) === null || _b === void 0 ? void 0 : _b.token];
|
|
3889
|
+
}
|
|
3890
|
+
});
|
|
3891
|
+
});
|
|
3892
|
+
};
|
|
3893
|
+
|
|
3869
3894
|
var showErrorNotification = NotificationUtils.useErrorNotification();
|
|
3870
3895
|
function Signup(_a) {
|
|
3871
3896
|
var priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
|
|
@@ -3881,10 +3906,11 @@ function Signup(_a) {
|
|
|
3881
3906
|
var _c = useState(undefined), quote = _c[0], setQuote = _c[1];
|
|
3882
3907
|
var _d = useState(undefined), accountId = _d[0], setAccountId = _d[1];
|
|
3883
3908
|
var _e = useState(undefined), quoteId = _e[0], setQuoteId = _e[1];
|
|
3884
|
-
var _f = useState(undefined),
|
|
3885
|
-
var _g = useState(
|
|
3886
|
-
var _h = useState(false),
|
|
3887
|
-
var _j = useState(false),
|
|
3909
|
+
var _f = useState(undefined), portalSessionToken = _f[0], setPortalSessionToken = _f[1];
|
|
3910
|
+
var _g = useState(undefined), formData = _g[0], setFormData = _g[1];
|
|
3911
|
+
var _h = useState(false), proceedingToPayment = _h[0], setProceedingToPayment = _h[1];
|
|
3912
|
+
var _j = useState(false), paying = _j[0], setIsPaying = _j[1];
|
|
3913
|
+
var _k = useState(false), purchaseSucceeded = _k[0], setPurchaseSucceeded = _k[1];
|
|
3888
3914
|
// Queries
|
|
3889
3915
|
var priceListData = useQuery({
|
|
3890
3916
|
queryKey: ["priceList", priceListCode],
|
|
@@ -3892,7 +3918,7 @@ function Signup(_a) {
|
|
|
3892
3918
|
}).data;
|
|
3893
3919
|
function handleSubmit(formData) {
|
|
3894
3920
|
return __awaiter(this, void 0, void 0, function () {
|
|
3895
|
-
var data;
|
|
3921
|
+
var data, portalSessionToken;
|
|
3896
3922
|
return __generator(this, function (_a) {
|
|
3897
3923
|
switch (_a.label) {
|
|
3898
3924
|
case 0:
|
|
@@ -3913,11 +3939,21 @@ function Signup(_a) {
|
|
|
3913
3939
|
case 1:
|
|
3914
3940
|
data = _a.sent();
|
|
3915
3941
|
setAccountId(data.account.id);
|
|
3916
|
-
|
|
3942
|
+
return [4 /*yield*/, portalSessionCreate({
|
|
3943
|
+
token: token,
|
|
3944
|
+
subdomain: subdomain,
|
|
3945
|
+
tenantCode: data.tenant.code,
|
|
3946
|
+
expiry: 24,
|
|
3947
|
+
returnUrl: returnUrl || "",
|
|
3948
|
+
})];
|
|
3949
|
+
case 2:
|
|
3950
|
+
portalSessionToken = _a.sent();
|
|
3951
|
+
setPortalSessionToken(portalSessionToken);
|
|
3952
|
+
setQuoteId(data.quote.id);
|
|
3917
3953
|
setProceedingToPayment(false);
|
|
3918
3954
|
setQuote({
|
|
3919
|
-
amountDue: data.
|
|
3920
|
-
currencyId: data.currencyId,
|
|
3955
|
+
amountDue: data.quote.amountDue,
|
|
3956
|
+
currencyId: data.quote.currencyId,
|
|
3921
3957
|
});
|
|
3922
3958
|
return [2 /*return*/];
|
|
3923
3959
|
}
|
|
@@ -3942,8 +3978,11 @@ function Signup(_a) {
|
|
|
3942
3978
|
if (!accountId) {
|
|
3943
3979
|
throw new Error("Account ID is required");
|
|
3944
3980
|
}
|
|
3981
|
+
if (!portalSessionToken) {
|
|
3982
|
+
throw new Error("Portal session token is required");
|
|
3983
|
+
}
|
|
3945
3984
|
return [4 /*yield*/, accountSignup({
|
|
3946
|
-
token:
|
|
3985
|
+
token: portalSessionToken,
|
|
3947
3986
|
subdomain: subdomain,
|
|
3948
3987
|
entityId: entityId,
|
|
3949
3988
|
quoteId: quoteId,
|
package/package.json
CHANGED