@bunnyapp/components 1.5.0-beta.3 → 1.5.0-beta.5
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.4';
|
|
158
158
|
var createRequestHeaders = function (token) {
|
|
159
159
|
var headers = createClientDevHeaders({ token: token });
|
|
160
160
|
// Add the components version header
|
|
@@ -266,7 +266,8 @@ function ContextualWrapper(_a) {
|
|
|
266
266
|
var branding = reactQuery.useQuery({
|
|
267
267
|
queryKey: common.QueryKeyFactory.default.brandingKey(token),
|
|
268
268
|
queryFn: function () { return getBranding({ token: token, apiHost: apiHost }); },
|
|
269
|
-
staleTime: 1000 * 60 * 5,
|
|
269
|
+
staleTime: 1000 * 60 * 5,
|
|
270
|
+
enabled: !!token && !!apiHost,
|
|
270
271
|
}).data;
|
|
271
272
|
var isMobile = common.useIsMobile();
|
|
272
273
|
var entityBranding = react.useMemo(function () {
|
|
@@ -21398,17 +21399,6 @@ var quoteSubscriptionActivate = function (_a) {
|
|
|
21398
21399
|
token: token,
|
|
21399
21400
|
});
|
|
21400
21401
|
};
|
|
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
21402
|
|
|
21413
21403
|
var formatDateForApi = function (date) {
|
|
21414
21404
|
if (typeof date === 'string')
|
|
@@ -22435,24 +22425,6 @@ var useQuoteCreate = function (_a) {
|
|
|
22435
22425
|
enabled: Boolean(quoteId),
|
|
22436
22426
|
}).data;
|
|
22437
22427
|
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
22428
|
mutationFn: function (_a) {
|
|
22457
22429
|
var subscriptionId = _a.subscriptionId, priceListId = _a.priceListId;
|
|
22458
22430
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -22469,8 +22441,8 @@ var useQuoteCreate = function (_a) {
|
|
|
22469
22441
|
var quote = (_a = subscriptionUpdateData === null || subscriptionUpdateData === void 0 ? void 0 : subscriptionUpdateData.quoteSubscriptionUpgrade) === null || _a === void 0 ? void 0 : _a.quote;
|
|
22470
22442
|
setQuoteId(quote.id);
|
|
22471
22443
|
},
|
|
22472
|
-
}), quoteUpgrade =
|
|
22473
|
-
var
|
|
22444
|
+
}), quoteUpgrade = _c.mutate, isUpdatingQuote = _c.isPending;
|
|
22445
|
+
var _d = reactQuery.useMutation({
|
|
22474
22446
|
mutationFn: function (_a) {
|
|
22475
22447
|
var subscriptionId = _a.subscriptionId;
|
|
22476
22448
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -22487,15 +22459,15 @@ var useQuoteCreate = function (_a) {
|
|
|
22487
22459
|
var quote = (_a = subscriptionAddonUpdateData === null || subscriptionAddonUpdateData === void 0 ? void 0 : subscriptionAddonUpdateData.quoteSubscriptionAddon) === null || _a === void 0 ? void 0 : _a.quote;
|
|
22488
22460
|
setQuoteId(quote.id);
|
|
22489
22461
|
},
|
|
22490
|
-
}), createEmptyQuote =
|
|
22491
|
-
var
|
|
22462
|
+
}), createEmptyQuote = _d.mutate, isCreatingEmptyQuote = _d.isPending;
|
|
22463
|
+
var _e = reactQuery.useMutation({
|
|
22492
22464
|
mutationFn: quoteSubscriptionActivate,
|
|
22493
22465
|
onSuccess: function (response) {
|
|
22494
22466
|
var _a;
|
|
22495
22467
|
var quote = (_a = response === null || response === void 0 ? void 0 : response.quoteSubscriptionActivate) === null || _a === void 0 ? void 0 : _a.quote;
|
|
22496
22468
|
setQuoteId(quote.id);
|
|
22497
22469
|
},
|
|
22498
|
-
}), subscriptionActivate =
|
|
22470
|
+
}), subscriptionActivate = _e.mutate, isActivatingSubscription = _e.isPending;
|
|
22499
22471
|
react.useEffect(function () {
|
|
22500
22472
|
var _a, _b;
|
|
22501
22473
|
if (!(upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id)) {
|
|
@@ -22507,14 +22479,9 @@ var useQuoteCreate = function (_a) {
|
|
|
22507
22479
|
var buyingAddonsForCurrentSubscription = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id);
|
|
22508
22480
|
var isActivatingTrialSubscription = ((_a = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === common.SubscriptionState.TRIAL &&
|
|
22509
22481
|
upgradingSubscription.priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id);
|
|
22510
|
-
var
|
|
22482
|
+
var isActivatingExpiredTrialSubscription = ((_b = upgradingSubscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.TRIAL_EXPIRED &&
|
|
22511
22483
|
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) {
|
|
22484
|
+
if (isActivatingTrialSubscription || isActivatingExpiredTrialSubscription) {
|
|
22518
22485
|
subscriptionActivate({
|
|
22519
22486
|
subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
|
|
22520
22487
|
apiHost: apiHost,
|
|
@@ -22535,10 +22502,7 @@ var useQuoteCreate = function (_a) {
|
|
|
22535
22502
|
}, [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
22503
|
return {
|
|
22537
22504
|
quote: quote,
|
|
22538
|
-
isQuotePending: isUpdatingQuote ||
|
|
22539
|
-
isCreatingEmptyQuote ||
|
|
22540
|
-
isActivatingSubscription ||
|
|
22541
|
-
isReinstatingSubscription,
|
|
22505
|
+
isQuotePending: isUpdatingQuote || isCreatingEmptyQuote || isActivatingSubscription,
|
|
22542
22506
|
};
|
|
22543
22507
|
};
|
|
22544
22508
|
|
|
@@ -24195,8 +24159,12 @@ var Subscriptions = function (_a) {
|
|
|
24195
24159
|
}
|
|
24196
24160
|
}, [allSubscriptionsExpired, subscriptions, isChangingPlan]);
|
|
24197
24161
|
react.useEffect(function () {
|
|
24198
|
-
if (hasExpiredOrCanceledSubscriptions && subscriptions.length > 0)
|
|
24162
|
+
if (hasExpiredOrCanceledSubscriptions && subscriptions.length > 0) {
|
|
24199
24163
|
setExpiredSwitchVisible(true);
|
|
24164
|
+
}
|
|
24165
|
+
else {
|
|
24166
|
+
setExpiredSwitchVisible(false);
|
|
24167
|
+
}
|
|
24200
24168
|
}, [hasExpiredOrCanceledSubscriptions, subscriptions]);
|
|
24201
24169
|
if (isChangingPlan || isInPreviewMode) {
|
|
24202
24170
|
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.4';
|
|
147
147
|
var createRequestHeaders = function (token) {
|
|
148
148
|
var headers = createClientDevHeaders({ token: token });
|
|
149
149
|
// Add the components version header
|
|
@@ -255,7 +255,8 @@ function ContextualWrapper(_a) {
|
|
|
255
255
|
var branding = useQuery({
|
|
256
256
|
queryKey: QueryKeyFactory.default.brandingKey(token),
|
|
257
257
|
queryFn: function () { return getBranding({ token: token, apiHost: apiHost }); },
|
|
258
|
-
staleTime: 1000 * 60 * 5,
|
|
258
|
+
staleTime: 1000 * 60 * 5,
|
|
259
|
+
enabled: !!token && !!apiHost,
|
|
259
260
|
}).data;
|
|
260
261
|
var isMobile = useIsMobile();
|
|
261
262
|
var entityBranding = useMemo(function () {
|
|
@@ -21387,17 +21388,6 @@ var quoteSubscriptionActivate = function (_a) {
|
|
|
21387
21388
|
token: token,
|
|
21388
21389
|
});
|
|
21389
21390
|
};
|
|
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
21391
|
|
|
21402
21392
|
var formatDateForApi = function (date) {
|
|
21403
21393
|
if (typeof date === 'string')
|
|
@@ -22424,24 +22414,6 @@ var useQuoteCreate = function (_a) {
|
|
|
22424
22414
|
enabled: Boolean(quoteId),
|
|
22425
22415
|
}).data;
|
|
22426
22416
|
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
22417
|
mutationFn: function (_a) {
|
|
22446
22418
|
var subscriptionId = _a.subscriptionId, priceListId = _a.priceListId;
|
|
22447
22419
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -22458,8 +22430,8 @@ var useQuoteCreate = function (_a) {
|
|
|
22458
22430
|
var quote = (_a = subscriptionUpdateData === null || subscriptionUpdateData === void 0 ? void 0 : subscriptionUpdateData.quoteSubscriptionUpgrade) === null || _a === void 0 ? void 0 : _a.quote;
|
|
22459
22431
|
setQuoteId(quote.id);
|
|
22460
22432
|
},
|
|
22461
|
-
}), quoteUpgrade =
|
|
22462
|
-
var
|
|
22433
|
+
}), quoteUpgrade = _c.mutate, isUpdatingQuote = _c.isPending;
|
|
22434
|
+
var _d = useMutation({
|
|
22463
22435
|
mutationFn: function (_a) {
|
|
22464
22436
|
var subscriptionId = _a.subscriptionId;
|
|
22465
22437
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -22476,15 +22448,15 @@ var useQuoteCreate = function (_a) {
|
|
|
22476
22448
|
var quote = (_a = subscriptionAddonUpdateData === null || subscriptionAddonUpdateData === void 0 ? void 0 : subscriptionAddonUpdateData.quoteSubscriptionAddon) === null || _a === void 0 ? void 0 : _a.quote;
|
|
22477
22449
|
setQuoteId(quote.id);
|
|
22478
22450
|
},
|
|
22479
|
-
}), createEmptyQuote =
|
|
22480
|
-
var
|
|
22451
|
+
}), createEmptyQuote = _d.mutate, isCreatingEmptyQuote = _d.isPending;
|
|
22452
|
+
var _e = useMutation({
|
|
22481
22453
|
mutationFn: quoteSubscriptionActivate,
|
|
22482
22454
|
onSuccess: function (response) {
|
|
22483
22455
|
var _a;
|
|
22484
22456
|
var quote = (_a = response === null || response === void 0 ? void 0 : response.quoteSubscriptionActivate) === null || _a === void 0 ? void 0 : _a.quote;
|
|
22485
22457
|
setQuoteId(quote.id);
|
|
22486
22458
|
},
|
|
22487
|
-
}), subscriptionActivate =
|
|
22459
|
+
}), subscriptionActivate = _e.mutate, isActivatingSubscription = _e.isPending;
|
|
22488
22460
|
useEffect(function () {
|
|
22489
22461
|
var _a, _b;
|
|
22490
22462
|
if (!(upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id)) {
|
|
@@ -22496,14 +22468,9 @@ var useQuoteCreate = function (_a) {
|
|
|
22496
22468
|
var buyingAddonsForCurrentSubscription = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id);
|
|
22497
22469
|
var isActivatingTrialSubscription = ((_a = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState.TRIAL &&
|
|
22498
22470
|
upgradingSubscription.priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id);
|
|
22499
|
-
var
|
|
22471
|
+
var isActivatingExpiredTrialSubscription = ((_b = upgradingSubscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState.TRIAL_EXPIRED &&
|
|
22500
22472
|
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) {
|
|
22473
|
+
if (isActivatingTrialSubscription || isActivatingExpiredTrialSubscription) {
|
|
22507
22474
|
subscriptionActivate({
|
|
22508
22475
|
subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
|
|
22509
22476
|
apiHost: apiHost,
|
|
@@ -22524,10 +22491,7 @@ var useQuoteCreate = function (_a) {
|
|
|
22524
22491
|
}, [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
22492
|
return {
|
|
22526
22493
|
quote: quote,
|
|
22527
|
-
isQuotePending: isUpdatingQuote ||
|
|
22528
|
-
isCreatingEmptyQuote ||
|
|
22529
|
-
isActivatingSubscription ||
|
|
22530
|
-
isReinstatingSubscription,
|
|
22494
|
+
isQuotePending: isUpdatingQuote || isCreatingEmptyQuote || isActivatingSubscription,
|
|
22531
22495
|
};
|
|
22532
22496
|
};
|
|
22533
22497
|
|
|
@@ -24184,8 +24148,12 @@ var Subscriptions = function (_a) {
|
|
|
24184
24148
|
}
|
|
24185
24149
|
}, [allSubscriptionsExpired, subscriptions, isChangingPlan]);
|
|
24186
24150
|
useEffect(function () {
|
|
24187
|
-
if (hasExpiredOrCanceledSubscriptions && subscriptions.length > 0)
|
|
24151
|
+
if (hasExpiredOrCanceledSubscriptions && subscriptions.length > 0) {
|
|
24188
24152
|
setExpiredSwitchVisible(true);
|
|
24153
|
+
}
|
|
24154
|
+
else {
|
|
24155
|
+
setExpiredSwitchVisible(false);
|
|
24156
|
+
}
|
|
24189
24157
|
}, [hasExpiredOrCanceledSubscriptions, subscriptions]);
|
|
24190
24158
|
if (isChangingPlan || isInPreviewMode) {
|
|
24191
24159
|
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