@bunnyapp/components 1.5.0-beta.3 → 1.5.0-beta.4
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
CHANGED
|
@@ -154,7 +154,7 @@ var BrandContext = react.createContext({
|
|
|
154
154
|
});
|
|
155
155
|
|
|
156
156
|
// This will be replaced at build time by rollup-plugin-replace
|
|
157
|
-
var PACKAGE_VERSION = '1.5.0-beta.
|
|
157
|
+
var PACKAGE_VERSION = '1.5.0-beta.3';
|
|
158
158
|
var createRequestHeaders = function (token) {
|
|
159
159
|
var headers = createClientDevHeaders({ token: token });
|
|
160
160
|
// Add the components version header
|
|
@@ -21398,17 +21398,6 @@ var quoteSubscriptionActivate = function (_a) {
|
|
|
21398
21398
|
token: token,
|
|
21399
21399
|
});
|
|
21400
21400
|
};
|
|
21401
|
-
var quoteSubscriptionReinstate = function (_a) {
|
|
21402
|
-
var subscriptionId = _a.subscriptionId, apiHost = _a.apiHost, token = _a.token;
|
|
21403
|
-
return gqlRequest({
|
|
21404
|
-
query: "mutation QuoteSubscriptionReinstate($ids: [ID!]!) {\n quoteSubscriptionReinstate(ids: $ids) {\n quote {\n id\n }\n }\n }",
|
|
21405
|
-
vars: {
|
|
21406
|
-
ids: [subscriptionId],
|
|
21407
|
-
},
|
|
21408
|
-
apiHost: apiHost,
|
|
21409
|
-
token: token,
|
|
21410
|
-
});
|
|
21411
|
-
};
|
|
21412
21401
|
|
|
21413
21402
|
var formatDateForApi = function (date) {
|
|
21414
21403
|
if (typeof date === 'string')
|
|
@@ -22435,24 +22424,6 @@ var useQuoteCreate = function (_a) {
|
|
|
22435
22424
|
enabled: Boolean(quoteId),
|
|
22436
22425
|
}).data;
|
|
22437
22426
|
var _c = reactQuery.useMutation({
|
|
22438
|
-
mutationFn: function (_a) {
|
|
22439
|
-
var subscriptionId = _a.subscriptionId;
|
|
22440
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
22441
|
-
return __generator(this, function (_b) {
|
|
22442
|
-
switch (_b.label) {
|
|
22443
|
-
case 0: return [4 /*yield*/, quoteSubscriptionReinstate({ subscriptionId: subscriptionId, apiHost: apiHost, token: token })];
|
|
22444
|
-
case 1: return [2 /*return*/, _b.sent()];
|
|
22445
|
-
}
|
|
22446
|
-
});
|
|
22447
|
-
});
|
|
22448
|
-
},
|
|
22449
|
-
onSuccess: function (quoteSubscriptionReinstateData) {
|
|
22450
|
-
var _a;
|
|
22451
|
-
var quote = (_a = quoteSubscriptionReinstateData === null || quoteSubscriptionReinstateData === void 0 ? void 0 : quoteSubscriptionReinstateData.quoteSubscriptionReinstate) === null || _a === void 0 ? void 0 : _a.quote;
|
|
22452
|
-
setQuoteId(quote.id);
|
|
22453
|
-
},
|
|
22454
|
-
}), quoteSubscriptionReinstateMutation = _c.mutate, isReinstatingSubscription = _c.isPending;
|
|
22455
|
-
var _d = reactQuery.useMutation({
|
|
22456
22427
|
mutationFn: function (_a) {
|
|
22457
22428
|
var subscriptionId = _a.subscriptionId, priceListId = _a.priceListId;
|
|
22458
22429
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -22469,8 +22440,8 @@ var useQuoteCreate = function (_a) {
|
|
|
22469
22440
|
var quote = (_a = subscriptionUpdateData === null || subscriptionUpdateData === void 0 ? void 0 : subscriptionUpdateData.quoteSubscriptionUpgrade) === null || _a === void 0 ? void 0 : _a.quote;
|
|
22470
22441
|
setQuoteId(quote.id);
|
|
22471
22442
|
},
|
|
22472
|
-
}), quoteUpgrade =
|
|
22473
|
-
var
|
|
22443
|
+
}), quoteUpgrade = _c.mutate, isUpdatingQuote = _c.isPending;
|
|
22444
|
+
var _d = reactQuery.useMutation({
|
|
22474
22445
|
mutationFn: function (_a) {
|
|
22475
22446
|
var subscriptionId = _a.subscriptionId;
|
|
22476
22447
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -22487,15 +22458,15 @@ var useQuoteCreate = function (_a) {
|
|
|
22487
22458
|
var quote = (_a = subscriptionAddonUpdateData === null || subscriptionAddonUpdateData === void 0 ? void 0 : subscriptionAddonUpdateData.quoteSubscriptionAddon) === null || _a === void 0 ? void 0 : _a.quote;
|
|
22488
22459
|
setQuoteId(quote.id);
|
|
22489
22460
|
},
|
|
22490
|
-
}), createEmptyQuote =
|
|
22491
|
-
var
|
|
22461
|
+
}), createEmptyQuote = _d.mutate, isCreatingEmptyQuote = _d.isPending;
|
|
22462
|
+
var _e = reactQuery.useMutation({
|
|
22492
22463
|
mutationFn: quoteSubscriptionActivate,
|
|
22493
22464
|
onSuccess: function (response) {
|
|
22494
22465
|
var _a;
|
|
22495
22466
|
var quote = (_a = response === null || response === void 0 ? void 0 : response.quoteSubscriptionActivate) === null || _a === void 0 ? void 0 : _a.quote;
|
|
22496
22467
|
setQuoteId(quote.id);
|
|
22497
22468
|
},
|
|
22498
|
-
}), subscriptionActivate =
|
|
22469
|
+
}), subscriptionActivate = _e.mutate, isActivatingSubscription = _e.isPending;
|
|
22499
22470
|
react.useEffect(function () {
|
|
22500
22471
|
var _a, _b;
|
|
22501
22472
|
if (!(upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id)) {
|
|
@@ -22507,14 +22478,9 @@ var useQuoteCreate = function (_a) {
|
|
|
22507
22478
|
var buyingAddonsForCurrentSubscription = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id);
|
|
22508
22479
|
var isActivatingTrialSubscription = ((_a = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === common.SubscriptionState.TRIAL &&
|
|
22509
22480
|
upgradingSubscription.priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id);
|
|
22510
|
-
var
|
|
22481
|
+
var isActivatingExpiredTrialSubscription = ((_b = upgradingSubscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.TRIAL_EXPIRED &&
|
|
22511
22482
|
upgradingSubscription.priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id);
|
|
22512
|
-
if (
|
|
22513
|
-
quoteSubscriptionReinstateMutation({
|
|
22514
|
-
subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
|
|
22515
|
-
});
|
|
22516
|
-
}
|
|
22517
|
-
else if (isActivatingTrialSubscription) {
|
|
22483
|
+
if (isActivatingTrialSubscription || isActivatingExpiredTrialSubscription) {
|
|
22518
22484
|
subscriptionActivate({
|
|
22519
22485
|
subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
|
|
22520
22486
|
apiHost: apiHost,
|
|
@@ -22535,10 +22501,7 @@ var useQuoteCreate = function (_a) {
|
|
|
22535
22501
|
}, [selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id, upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id, upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id]);
|
|
22536
22502
|
return {
|
|
22537
22503
|
quote: quote,
|
|
22538
|
-
isQuotePending: isUpdatingQuote ||
|
|
22539
|
-
isCreatingEmptyQuote ||
|
|
22540
|
-
isActivatingSubscription ||
|
|
22541
|
-
isReinstatingSubscription,
|
|
22504
|
+
isQuotePending: isUpdatingQuote || isCreatingEmptyQuote || isActivatingSubscription,
|
|
22542
22505
|
};
|
|
22543
22506
|
};
|
|
22544
22507
|
|
|
@@ -24195,8 +24158,12 @@ var Subscriptions = function (_a) {
|
|
|
24195
24158
|
}
|
|
24196
24159
|
}, [allSubscriptionsExpired, subscriptions, isChangingPlan]);
|
|
24197
24160
|
react.useEffect(function () {
|
|
24198
|
-
if (hasExpiredOrCanceledSubscriptions && subscriptions.length > 0)
|
|
24161
|
+
if (hasExpiredOrCanceledSubscriptions && subscriptions.length > 0) {
|
|
24199
24162
|
setExpiredSwitchVisible(true);
|
|
24163
|
+
}
|
|
24164
|
+
else {
|
|
24165
|
+
setExpiredSwitchVisible(false);
|
|
24166
|
+
}
|
|
24200
24167
|
}, [hasExpiredOrCanceledSubscriptions, subscriptions]);
|
|
24201
24168
|
if (isChangingPlan || isInPreviewMode) {
|
|
24202
24169
|
return (jsxRuntime.jsx(UpgradeWrapper, { onChangePlanCancel: function () {
|
|
@@ -21,8 +21,3 @@ export declare const quoteSubscriptionActivate: ({ subscriptionId, apiHost, toke
|
|
|
21
21
|
apiHost: string;
|
|
22
22
|
token?: string | undefined;
|
|
23
23
|
}) => Promise<unknown>;
|
|
24
|
-
export declare const quoteSubscriptionReinstate: ({ subscriptionId, apiHost, token, }: {
|
|
25
|
-
subscriptionId: string;
|
|
26
|
-
apiHost: string;
|
|
27
|
-
token?: string | undefined;
|
|
28
|
-
}) => Promise<unknown>;
|
package/dist/esm/index.js
CHANGED
|
@@ -143,7 +143,7 @@ var BrandContext = createContext({
|
|
|
143
143
|
});
|
|
144
144
|
|
|
145
145
|
// This will be replaced at build time by rollup-plugin-replace
|
|
146
|
-
var PACKAGE_VERSION = '1.5.0-beta.
|
|
146
|
+
var PACKAGE_VERSION = '1.5.0-beta.3';
|
|
147
147
|
var createRequestHeaders = function (token) {
|
|
148
148
|
var headers = createClientDevHeaders({ token: token });
|
|
149
149
|
// Add the components version header
|
|
@@ -21387,17 +21387,6 @@ var quoteSubscriptionActivate = function (_a) {
|
|
|
21387
21387
|
token: token,
|
|
21388
21388
|
});
|
|
21389
21389
|
};
|
|
21390
|
-
var quoteSubscriptionReinstate = function (_a) {
|
|
21391
|
-
var subscriptionId = _a.subscriptionId, apiHost = _a.apiHost, token = _a.token;
|
|
21392
|
-
return gqlRequest({
|
|
21393
|
-
query: "mutation QuoteSubscriptionReinstate($ids: [ID!]!) {\n quoteSubscriptionReinstate(ids: $ids) {\n quote {\n id\n }\n }\n }",
|
|
21394
|
-
vars: {
|
|
21395
|
-
ids: [subscriptionId],
|
|
21396
|
-
},
|
|
21397
|
-
apiHost: apiHost,
|
|
21398
|
-
token: token,
|
|
21399
|
-
});
|
|
21400
|
-
};
|
|
21401
21390
|
|
|
21402
21391
|
var formatDateForApi = function (date) {
|
|
21403
21392
|
if (typeof date === 'string')
|
|
@@ -22424,24 +22413,6 @@ var useQuoteCreate = function (_a) {
|
|
|
22424
22413
|
enabled: Boolean(quoteId),
|
|
22425
22414
|
}).data;
|
|
22426
22415
|
var _c = useMutation({
|
|
22427
|
-
mutationFn: function (_a) {
|
|
22428
|
-
var subscriptionId = _a.subscriptionId;
|
|
22429
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
22430
|
-
return __generator(this, function (_b) {
|
|
22431
|
-
switch (_b.label) {
|
|
22432
|
-
case 0: return [4 /*yield*/, quoteSubscriptionReinstate({ subscriptionId: subscriptionId, apiHost: apiHost, token: token })];
|
|
22433
|
-
case 1: return [2 /*return*/, _b.sent()];
|
|
22434
|
-
}
|
|
22435
|
-
});
|
|
22436
|
-
});
|
|
22437
|
-
},
|
|
22438
|
-
onSuccess: function (quoteSubscriptionReinstateData) {
|
|
22439
|
-
var _a;
|
|
22440
|
-
var quote = (_a = quoteSubscriptionReinstateData === null || quoteSubscriptionReinstateData === void 0 ? void 0 : quoteSubscriptionReinstateData.quoteSubscriptionReinstate) === null || _a === void 0 ? void 0 : _a.quote;
|
|
22441
|
-
setQuoteId(quote.id);
|
|
22442
|
-
},
|
|
22443
|
-
}), quoteSubscriptionReinstateMutation = _c.mutate, isReinstatingSubscription = _c.isPending;
|
|
22444
|
-
var _d = useMutation({
|
|
22445
22416
|
mutationFn: function (_a) {
|
|
22446
22417
|
var subscriptionId = _a.subscriptionId, priceListId = _a.priceListId;
|
|
22447
22418
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -22458,8 +22429,8 @@ var useQuoteCreate = function (_a) {
|
|
|
22458
22429
|
var quote = (_a = subscriptionUpdateData === null || subscriptionUpdateData === void 0 ? void 0 : subscriptionUpdateData.quoteSubscriptionUpgrade) === null || _a === void 0 ? void 0 : _a.quote;
|
|
22459
22430
|
setQuoteId(quote.id);
|
|
22460
22431
|
},
|
|
22461
|
-
}), quoteUpgrade =
|
|
22462
|
-
var
|
|
22432
|
+
}), quoteUpgrade = _c.mutate, isUpdatingQuote = _c.isPending;
|
|
22433
|
+
var _d = useMutation({
|
|
22463
22434
|
mutationFn: function (_a) {
|
|
22464
22435
|
var subscriptionId = _a.subscriptionId;
|
|
22465
22436
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -22476,15 +22447,15 @@ var useQuoteCreate = function (_a) {
|
|
|
22476
22447
|
var quote = (_a = subscriptionAddonUpdateData === null || subscriptionAddonUpdateData === void 0 ? void 0 : subscriptionAddonUpdateData.quoteSubscriptionAddon) === null || _a === void 0 ? void 0 : _a.quote;
|
|
22477
22448
|
setQuoteId(quote.id);
|
|
22478
22449
|
},
|
|
22479
|
-
}), createEmptyQuote =
|
|
22480
|
-
var
|
|
22450
|
+
}), createEmptyQuote = _d.mutate, isCreatingEmptyQuote = _d.isPending;
|
|
22451
|
+
var _e = useMutation({
|
|
22481
22452
|
mutationFn: quoteSubscriptionActivate,
|
|
22482
22453
|
onSuccess: function (response) {
|
|
22483
22454
|
var _a;
|
|
22484
22455
|
var quote = (_a = response === null || response === void 0 ? void 0 : response.quoteSubscriptionActivate) === null || _a === void 0 ? void 0 : _a.quote;
|
|
22485
22456
|
setQuoteId(quote.id);
|
|
22486
22457
|
},
|
|
22487
|
-
}), subscriptionActivate =
|
|
22458
|
+
}), subscriptionActivate = _e.mutate, isActivatingSubscription = _e.isPending;
|
|
22488
22459
|
useEffect(function () {
|
|
22489
22460
|
var _a, _b;
|
|
22490
22461
|
if (!(upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id)) {
|
|
@@ -22496,14 +22467,9 @@ var useQuoteCreate = function (_a) {
|
|
|
22496
22467
|
var buyingAddonsForCurrentSubscription = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id);
|
|
22497
22468
|
var isActivatingTrialSubscription = ((_a = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState.TRIAL &&
|
|
22498
22469
|
upgradingSubscription.priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id);
|
|
22499
|
-
var
|
|
22470
|
+
var isActivatingExpiredTrialSubscription = ((_b = upgradingSubscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState.TRIAL_EXPIRED &&
|
|
22500
22471
|
upgradingSubscription.priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id);
|
|
22501
|
-
if (
|
|
22502
|
-
quoteSubscriptionReinstateMutation({
|
|
22503
|
-
subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
|
|
22504
|
-
});
|
|
22505
|
-
}
|
|
22506
|
-
else if (isActivatingTrialSubscription) {
|
|
22472
|
+
if (isActivatingTrialSubscription || isActivatingExpiredTrialSubscription) {
|
|
22507
22473
|
subscriptionActivate({
|
|
22508
22474
|
subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
|
|
22509
22475
|
apiHost: apiHost,
|
|
@@ -22524,10 +22490,7 @@ var useQuoteCreate = function (_a) {
|
|
|
22524
22490
|
}, [selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id, upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id, upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id]);
|
|
22525
22491
|
return {
|
|
22526
22492
|
quote: quote,
|
|
22527
|
-
isQuotePending: isUpdatingQuote ||
|
|
22528
|
-
isCreatingEmptyQuote ||
|
|
22529
|
-
isActivatingSubscription ||
|
|
22530
|
-
isReinstatingSubscription,
|
|
22493
|
+
isQuotePending: isUpdatingQuote || isCreatingEmptyQuote || isActivatingSubscription,
|
|
22531
22494
|
};
|
|
22532
22495
|
};
|
|
22533
22496
|
|
|
@@ -24184,8 +24147,12 @@ var Subscriptions = function (_a) {
|
|
|
24184
24147
|
}
|
|
24185
24148
|
}, [allSubscriptionsExpired, subscriptions, isChangingPlan]);
|
|
24186
24149
|
useEffect(function () {
|
|
24187
|
-
if (hasExpiredOrCanceledSubscriptions && subscriptions.length > 0)
|
|
24150
|
+
if (hasExpiredOrCanceledSubscriptions && subscriptions.length > 0) {
|
|
24188
24151
|
setExpiredSwitchVisible(true);
|
|
24152
|
+
}
|
|
24153
|
+
else {
|
|
24154
|
+
setExpiredSwitchVisible(false);
|
|
24155
|
+
}
|
|
24189
24156
|
}, [hasExpiredOrCanceledSubscriptions, subscriptions]);
|
|
24190
24157
|
if (isChangingPlan || isInPreviewMode) {
|
|
24191
24158
|
return (jsx(UpgradeWrapper, { onChangePlanCancel: function () {
|
|
@@ -21,8 +21,3 @@ export declare const quoteSubscriptionActivate: ({ subscriptionId, apiHost, toke
|
|
|
21
21
|
apiHost: string;
|
|
22
22
|
token?: string | undefined;
|
|
23
23
|
}) => Promise<unknown>;
|
|
24
|
-
export declare const quoteSubscriptionReinstate: ({ subscriptionId, apiHost, token, }: {
|
|
25
|
-
subscriptionId: string;
|
|
26
|
-
apiHost: string;
|
|
27
|
-
token?: string | undefined;
|
|
28
|
-
}) => Promise<unknown>;
|
package/package.json
CHANGED