@maxio-com/self-service 1.11.3 → 1.11.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/maxio-components.cjs.js +1 -1
- package/dist/maxio-components.esm.js +1 -1
- package/dist/maxio-components.esm.js.LICENSE.txt +2 -2
- package/dist/maxio-components.umd.js +1 -1
- package/dist/maxio-components.umd.js.LICENSE.txt +2 -2
- package/package.json +2 -2
- package/typings/packages/subscriptions-manager/src/components/Subscription/Subscription.d.ts +3 -1
- package/typings/packages/subscriptions-manager/src/containers/CouponsContainer/CouponsContainer.d.ts +3 -3
- package/typings/packages/subscriptions-manager/src/containers/SubscriptionContainer/SubscriptionContainer.d.ts +4 -4
- package/typings/packages/subscriptions-manager/src/containers/SubscriptionContainer/hooks/useSubscriptionDetailsService.d.ts +15 -0
- package/typings/packages/subscriptions-manager/src/hooks/index.d.ts +1 -2
- package/typings/packages/subscriptions-manager/src/machines/index.d.ts +1 -2
- package/typings/packages/subscriptions-manager/src/machines/modals/selectors.d.ts +2 -2
- package/typings/packages/subscriptions-manager/src/machines/modals/types.d.ts +3 -3
- package/typings/packages/subscriptions-manager/src/machines/subscription/selectors.d.ts +18 -0
- package/typings/packages/subscriptions-manager/src/machines/subscription/subscription.d.ts +14 -0
- package/typings/packages/subscriptions-manager/src/machines/subscription/types.d.ts +36 -2
- package/typings/packages/subscriptions-manager/src/machines/subscriptions/selectors.d.ts +56 -0
- package/typings/packages/subscriptions-manager/src/modals/AddCoupon/components/Content/Content.d.ts +3 -3
- package/typings/packages/subscriptions-manager/src/modals/AddCoupon/components/Content/utils.d.ts +1 -1
- package/typings/packages/subscriptions-manager/src/models/subscription/subscription.d.ts +30 -1
- package/typings/packages/subscriptions-manager/src/models/subscription/types.d.ts +5 -0
- package/typings/sdk/components-sdk/src/constants.d.ts +1 -0
- package/typings/sdk/components-sdk/src/types.d.ts +1 -1
- package/typings/sdk/components-sdk/src/utils/createComponentFactory.d.ts +2 -1
- package/typings/packages/subscriptions-manager/src/hooks/useCoupons.d.ts +0 -9
- package/typings/packages/subscriptions-manager/src/machines/coupons/coupons.d.ts +0 -5
- package/typings/packages/subscriptions-manager/src/machines/coupons/index.d.ts +0 -2
- package/typings/packages/subscriptions-manager/src/machines/coupons/selectors.d.ts +0 -12
- package/typings/packages/subscriptions-manager/src/machines/coupons/types.d.ts +0 -34
- package/typings/sdk/components-sdk/src/settings.d.ts +0 -2
- /package/typings/packages/subscriptions-manager/src/machines/{coupons → subscription}/utils.d.ts +0 -0
|
@@ -168,7 +168,7 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
168
168
|
*/
|
|
169
169
|
|
|
170
170
|
/**
|
|
171
|
-
* @remix-run/router v1.
|
|
171
|
+
* @remix-run/router v1.18.0
|
|
172
172
|
*
|
|
173
173
|
* Copyright (c) Remix Software Inc.
|
|
174
174
|
*
|
|
@@ -179,7 +179,7 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
179
179
|
*/
|
|
180
180
|
|
|
181
181
|
/**
|
|
182
|
-
* React Router v6.
|
|
182
|
+
* React Router v6.25.1
|
|
183
183
|
*
|
|
184
184
|
* Copyright (c) Remix Software Inc.
|
|
185
185
|
*
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"module": "dist/maxio-components.esm.js",
|
|
6
6
|
"browser": "dist/maxio-components.umd.js",
|
|
7
7
|
"types": "typings/sdk/components-sdk/src/index.d.ts",
|
|
8
|
-
"version": "1.11.
|
|
8
|
+
"version": "1.11.4",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"import": "./dist/maxio-components.esm.js",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
112
112
|
"rollup-plugin-progress": "^1.1.2",
|
|
113
113
|
"rollup-plugin-typescript2": "^0.32.1",
|
|
114
|
-
"semantic-release": "^19.0.
|
|
114
|
+
"semantic-release": "^19.0.5",
|
|
115
115
|
"semantic-release-cli": "^5.4.4",
|
|
116
116
|
"serve": "^14.1.2",
|
|
117
117
|
"storybook": "^8.0.0",
|
package/typings/packages/subscriptions-manager/src/components/Subscription/Subscription.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { SubscriptionBilling } from '../../models/subscription/types';
|
|
|
7
7
|
import { SubscriptionActions } from '../../containers/SubscriptionContainer/hooks/useSubscriptionAvailableActions';
|
|
8
8
|
import { Currency } from "../../../../formatters/src";
|
|
9
9
|
import { Coupon } from '../../models/subscription/types';
|
|
10
|
+
import { SubscriptionDetailsMachineInterpreter } from '../../machines/subscription/types';
|
|
10
11
|
type SubscriptionProps = {
|
|
11
12
|
id: number;
|
|
12
13
|
catalogId: number;
|
|
@@ -33,6 +34,7 @@ type SubscriptionProps = {
|
|
|
33
34
|
referralCode?: string;
|
|
34
35
|
threeDsActionLink?: string;
|
|
35
36
|
coupons: Coupon[];
|
|
37
|
+
subscriptionDetailsService: SubscriptionDetailsMachineInterpreter;
|
|
36
38
|
} & FormattedSubscriptionDetails;
|
|
37
|
-
declare const Subscription: ({ id, catalogId, name, price, statusTag, description, status, onShowDetails, detailsVisible, cardColor, nextBillingAmount, nextBillingDate, basePlanPrice, cancellationDate, expirationDate, layout, autoResumeDate, trialExpirationDate, priceAfterTrial, trialPrice, currentBalance, nextBillingAttempt, interval, billingDetails, renderComponentsSection, renderCustomFieldsSection, scheduledCancellationDate, availableActions, referralCode, threeDsActionLink, currency, coupons, }: SubscriptionProps) => React.JSX.Element;
|
|
39
|
+
declare const Subscription: ({ id, catalogId, name, price, statusTag, description, status, onShowDetails, detailsVisible, cardColor, nextBillingAmount, nextBillingDate, basePlanPrice, cancellationDate, expirationDate, layout, autoResumeDate, trialExpirationDate, priceAfterTrial, trialPrice, currentBalance, nextBillingAttempt, interval, billingDetails, renderComponentsSection, renderCustomFieldsSection, scheduledCancellationDate, availableActions, referralCode, threeDsActionLink, currency, coupons, subscriptionDetailsService, }: SubscriptionProps) => React.JSX.Element;
|
|
38
40
|
export default Subscription;
|
package/typings/packages/subscriptions-manager/src/containers/CouponsContainer/CouponsContainer.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Currency } from "../../../../formatters/src";
|
|
3
|
-
import {
|
|
3
|
+
import { SubscriptionDetailsMachineInterpreter } from '../../machines/subscription/types';
|
|
4
4
|
type Props = {
|
|
5
5
|
subscriptionId: number;
|
|
6
6
|
catalogId: number;
|
|
7
7
|
currency: Currency;
|
|
8
|
-
|
|
8
|
+
subscriptionDetailsService: SubscriptionDetailsMachineInterpreter;
|
|
9
9
|
};
|
|
10
|
-
declare const CouponsContainer: ({ subscriptionId, catalogId, currency,
|
|
10
|
+
declare const CouponsContainer: ({ subscriptionId, catalogId, currency, subscriptionDetailsService, }: Props) => React.JSX.Element;
|
|
11
11
|
export default CouponsContainer;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ActorRefWithDeprecatedState, Typestate } from 'xstate';
|
|
3
2
|
import { SubscriptionLayout } from '../../components/Subscription';
|
|
4
|
-
import {
|
|
3
|
+
import { SubscriptionProduct, SubscriptionStatus } from '../../models';
|
|
5
4
|
export type SubscriptionContainerProps = {
|
|
6
5
|
id: number;
|
|
7
|
-
subscriptionRef: ActorRefWithDeprecatedState<SubscriptionModel, SubscriptionEvents, Typestate<SubscriptionModel>, any>;
|
|
8
6
|
onShowDetails?: (subscriptionId: number) => void;
|
|
9
7
|
layout?: SubscriptionLayout;
|
|
10
8
|
detailsVisible: boolean;
|
|
9
|
+
product: SubscriptionProduct;
|
|
10
|
+
status: SubscriptionStatus;
|
|
11
11
|
};
|
|
12
|
-
declare const SubscriptionContainer: ({ id, onShowDetails,
|
|
12
|
+
declare const SubscriptionContainer: ({ id, onShowDetails, layout, detailsVisible, product, status, }: SubscriptionContainerProps) => React.JSX.Element;
|
|
13
13
|
export default SubscriptionContainer;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
import { AddCouponEvent } from '../../../../src/models/subscription/subscription';
|
|
1
2
|
export declare const useSubscriptionDetailsService: (subscriptionId: number) => import("xstate").Interpreter<import("../../../models/subscription/types").SubscriptionModelWithCoupons, any, import("xstate/lib/model.types").UnionFromCreatorsReturnTypes<import("xstate/lib/model.types").FinalEventCreators<{
|
|
2
3
|
UPDATE_SUBSCRIPTION: (event: import("../../../models/subscription/types").UpdateSubscriptionEvent) => import("../../../models/subscription/types").UpdateSubscriptionEvent;
|
|
3
4
|
GET_SUBSCRIPTION_DETAILS: (event: import("../../../models/subscription/types").GetSubscriptionDetailsEvent) => {
|
|
4
5
|
event: import("../../../models/subscription/types").GetSubscriptionDetailsEvent;
|
|
5
6
|
};
|
|
7
|
+
GET_COUPONS: (event: import("../../../../src/models/subscription/subscription").GetCouponsEvent) => {
|
|
8
|
+
coupons: import("../../../models/subscription/types").Coupon[];
|
|
9
|
+
};
|
|
10
|
+
ADD_COUPON: (event: AddCouponEvent) => {
|
|
11
|
+
couponCode: string;
|
|
12
|
+
};
|
|
13
|
+
ADD_ANOTHER_COUPON: () => {};
|
|
6
14
|
}>>, {
|
|
7
15
|
value: any;
|
|
8
16
|
context: import("../../../models/subscription/types").SubscriptionModelWithCoupons;
|
|
@@ -11,4 +19,11 @@ export declare const useSubscriptionDetailsService: (subscriptionId: number) =>
|
|
|
11
19
|
GET_SUBSCRIPTION_DETAILS: (event: import("../../../models/subscription/types").GetSubscriptionDetailsEvent) => {
|
|
12
20
|
event: import("../../../models/subscription/types").GetSubscriptionDetailsEvent;
|
|
13
21
|
};
|
|
22
|
+
GET_COUPONS: (event: import("../../../../src/models/subscription/subscription").GetCouponsEvent) => {
|
|
23
|
+
coupons: import("../../../models/subscription/types").Coupon[];
|
|
24
|
+
};
|
|
25
|
+
ADD_COUPON: (event: AddCouponEvent) => {
|
|
26
|
+
couponCode: string;
|
|
27
|
+
};
|
|
28
|
+
ADD_ANOTHER_COUPON: () => {};
|
|
14
29
|
}>>, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;
|
|
@@ -16,6 +16,5 @@ import { useSortPaymentProfiles } from './useSortPaymentProfiles';
|
|
|
16
16
|
import { useDeletePaymentProfile } from './useDeletePaymentProfile';
|
|
17
17
|
import { useChangePlan } from './useChangePlan';
|
|
18
18
|
import { useThreeDs } from './useThreeDs';
|
|
19
|
-
|
|
20
|
-
export { useCoupons, useChangePlan, useDeletePaymentProfile, useSortPaymentProfiles, useChangePaymentProfile, useReactivateSubscription, useCancelSubscriptionService, useSubscriptionResumeService, useServices, useDataAccess, useSubscriptionStatus, useFormatSubscriptionDetails, useComponentSettings, useCreatePaymentProfile, useAddonsConfigurationService, useUndoCancelationService, usePaymentProfileAvailableActions, useAvailablePaymentMethods, PaymentProfileActions, useThreeDs, };
|
|
19
|
+
export { useChangePlan, useDeletePaymentProfile, useSortPaymentProfiles, useChangePaymentProfile, useReactivateSubscription, useCancelSubscriptionService, useSubscriptionResumeService, useServices, useDataAccess, useSubscriptionStatus, useFormatSubscriptionDetails, useComponentSettings, useCreatePaymentProfile, useAddonsConfigurationService, useUndoCancelationService, usePaymentProfileAvailableActions, useAvailablePaymentMethods, PaymentProfileActions, useThreeDs, };
|
|
21
20
|
export type { FormattedSubscriptionDetails, PaymentMethods };
|
|
@@ -10,7 +10,6 @@ import { paymentProfiles, paymentProfilesSelectors, PaymentProfilesInterpreter }
|
|
|
10
10
|
import { addOnsConfiguration, Allocation, SerializedPrice, SerializedComponent, AllocationsPreview, AddonsConfigurationContext, AllocationsError, AddonsInterpreter } from './addOnsConfiguration';
|
|
11
11
|
import { changePlan } from './changePlan';
|
|
12
12
|
import { threeDs as threeDsMachine } from './threeDs';
|
|
13
|
-
|
|
14
|
-
export { changePlan, modals, modalsSelectors, createSubscriptionsMachine, subscriptionsSelectors, subscriptionSelectors, productCatalogSelectors, componentSelectors, componentsSelectors, paymentGatewaySelectors, paymentGateway, productCatalog, paymentProfiles, paymentProfilesSelectors, createPaymentProfile, paymentProfileSelectors, addOnsConfiguration, threeDsMachine, coupons, };
|
|
13
|
+
export { changePlan, modals, modalsSelectors, createSubscriptionsMachine, subscriptionsSelectors, subscriptionSelectors, productCatalogSelectors, componentSelectors, componentsSelectors, paymentGatewaySelectors, paymentGateway, productCatalog, paymentProfiles, paymentProfilesSelectors, createPaymentProfile, paymentProfileSelectors, addOnsConfiguration, threeDsMachine, };
|
|
15
14
|
export type { PaymentProfilesInterpreter, SubscriptionsInterpreter, SubscriptionRef, ProductCatalogInterpreter, PaymentProfileInterpreter, AddonsInterpreter, PaymentProfileFromType, PaymentProfileFieldError, PaymentProfileFields, ModalsInterpreter, Allocation, SerializedComponent, SerializedPrice, AllocationsPreview, AddonsConfigurationContext, PaymentMethod, PaymentGatewayInterpreter, AllocationsError, };
|
|
16
15
|
export { DEFAULT_VISIBLE_SUBSCRIPTIONS };
|
|
@@ -98,7 +98,7 @@ export declare const getAddCoupon: (machineState: ModalsState) => {
|
|
|
98
98
|
meta: {
|
|
99
99
|
subscriptionId: number;
|
|
100
100
|
catalogId: number;
|
|
101
|
-
|
|
101
|
+
subscriptionDetailsService: import("../subscription/types").SubscriptionDetailsMachineInterpreter;
|
|
102
102
|
currency: "DKK" | "AUD" | "BRL" | "CAD" | "CHF" | "CNY" | "CZK" | "EUR" | "GBP" | "HKD" | "INR" | "JPY" | "MXN" | "MYR" | "NOK" | "NZD" | "PHP" | "PLN" | "RON" | "RUB" | "SEK" | "SGD" | "USD" | "ZAR" | "AED" | "SAR" | "ILS";
|
|
103
103
|
};
|
|
104
104
|
};
|
|
@@ -108,7 +108,7 @@ export declare const modalsSelectors: {
|
|
|
108
108
|
meta: {
|
|
109
109
|
subscriptionId: number;
|
|
110
110
|
catalogId: number;
|
|
111
|
-
|
|
111
|
+
subscriptionDetailsService: import("../subscription/types").SubscriptionDetailsMachineInterpreter;
|
|
112
112
|
currency: "DKK" | "AUD" | "BRL" | "CAD" | "CHF" | "CNY" | "CZK" | "EUR" | "GBP" | "HKD" | "INR" | "JPY" | "MXN" | "MYR" | "NOK" | "NZD" | "PHP" | "PLN" | "RON" | "RUB" | "SEK" | "SGD" | "USD" | "ZAR" | "AED" | "SAR" | "ILS";
|
|
113
113
|
};
|
|
114
114
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Interpreter } from 'xstate';
|
|
2
2
|
import { PaymentMethod } from '../createPaymentProfile';
|
|
3
|
-
import { CouponsMachineInterpreter } from '../coupons/types';
|
|
4
3
|
import { Currency } from "../../../../formatters/src";
|
|
4
|
+
import { SubscriptionDetailsMachineInterpreter } from '../subscription/types';
|
|
5
5
|
export type Context = {
|
|
6
6
|
deletePaymentProfile: {
|
|
7
7
|
catalogId: number | null;
|
|
@@ -61,7 +61,7 @@ export type Context = {
|
|
|
61
61
|
addCoupon: {
|
|
62
62
|
subscriptionId: number | null;
|
|
63
63
|
catalogId: number | null;
|
|
64
|
-
|
|
64
|
+
subscriptionDetailsService: null | SubscriptionDetailsMachineInterpreter;
|
|
65
65
|
currency: Currency;
|
|
66
66
|
};
|
|
67
67
|
};
|
|
@@ -126,7 +126,7 @@ export type Events = {
|
|
|
126
126
|
type: 'SHOW_ADD_COUPON';
|
|
127
127
|
catalogId: number;
|
|
128
128
|
subscriptionId: number;
|
|
129
|
-
|
|
129
|
+
subscriptionDetailsService: SubscriptionDetailsMachineInterpreter;
|
|
130
130
|
currency: Currency;
|
|
131
131
|
};
|
|
132
132
|
export type ModalsInterpreter = Interpreter<Context, Record<string, any>, Events>;
|
|
@@ -3,6 +3,15 @@ import { createSubscriptionMachine } from './subscription';
|
|
|
3
3
|
type SubscriptionMachine = ReturnType<typeof createSubscriptionMachine>;
|
|
4
4
|
type SubscriptionState = State<SubscriptionMachine['context']>;
|
|
5
5
|
export declare const getSubscriptionState: (machineState: SubscriptionState) => import("../../models").SubscriptionStatus;
|
|
6
|
+
export declare const getAddedCoupon: (state: SubscriptionState) => import("../../models/subscription/types").Coupon;
|
|
7
|
+
export declare const getError: (state: SubscriptionState) => import("./types").CouponErrorCodes;
|
|
8
|
+
export declare const getCouponsStatus: (state: SubscriptionState) => {
|
|
9
|
+
isError: boolean;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
isAddingCoupon: boolean;
|
|
12
|
+
isCouponAdded: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare const getCoupons: (state: SubscriptionState) => import("../../models/subscription/types").Coupon[];
|
|
6
15
|
export declare const getSubscriptionDetails: (machineState: SubscriptionState) => {
|
|
7
16
|
id: number;
|
|
8
17
|
status: import("../../models").SubscriptionStatus;
|
|
@@ -63,5 +72,14 @@ export declare const subscriptionSelectors: {
|
|
|
63
72
|
coupons: import("../../models/subscription/types").Coupon[];
|
|
64
73
|
isLoading: boolean;
|
|
65
74
|
};
|
|
75
|
+
getCouponsStatus: (state: SubscriptionState) => {
|
|
76
|
+
isError: boolean;
|
|
77
|
+
isLoading: boolean;
|
|
78
|
+
isAddingCoupon: boolean;
|
|
79
|
+
isCouponAdded: boolean;
|
|
80
|
+
};
|
|
81
|
+
getError: (state: SubscriptionState) => import("./types").CouponErrorCodes;
|
|
82
|
+
getAddedCoupon: (state: SubscriptionState) => import("../../models/subscription/types").Coupon;
|
|
83
|
+
getCoupons: (state: SubscriptionState) => import("../../models/subscription/types").Coupon[];
|
|
66
84
|
};
|
|
67
85
|
export {};
|
|
@@ -5,6 +5,13 @@ export declare const createSubscriptionMachine: (defaultContext?: Partial<Contex
|
|
|
5
5
|
GET_SUBSCRIPTION_DETAILS: (event: import("../../models/subscription/types").GetSubscriptionDetailsEvent) => {
|
|
6
6
|
event: import("../../models/subscription/types").GetSubscriptionDetailsEvent;
|
|
7
7
|
};
|
|
8
|
+
GET_COUPONS: (event: import("../../models/subscription/subscription").GetCouponsEvent) => {
|
|
9
|
+
coupons: import("../../models/subscription/types").Coupon[];
|
|
10
|
+
};
|
|
11
|
+
ADD_COUPON: (event: import("../../models/subscription/subscription").AddCouponEvent) => {
|
|
12
|
+
couponCode: string;
|
|
13
|
+
};
|
|
14
|
+
ADD_ANOTHER_COUPON: () => {};
|
|
8
15
|
}>>, {
|
|
9
16
|
value: any;
|
|
10
17
|
context: import("../../models/subscription/types").SubscriptionModelWithCoupons;
|
|
@@ -13,4 +20,11 @@ export declare const createSubscriptionMachine: (defaultContext?: Partial<Contex
|
|
|
13
20
|
GET_SUBSCRIPTION_DETAILS: (event: import("../../models/subscription/types").GetSubscriptionDetailsEvent) => {
|
|
14
21
|
event: import("../../models/subscription/types").GetSubscriptionDetailsEvent;
|
|
15
22
|
};
|
|
23
|
+
GET_COUPONS: (event: import("../../models/subscription/subscription").GetCouponsEvent) => {
|
|
24
|
+
coupons: import("../../models/subscription/types").Coupon[];
|
|
25
|
+
};
|
|
26
|
+
ADD_COUPON: (event: import("../../models/subscription/subscription").AddCouponEvent) => {
|
|
27
|
+
couponCode: string;
|
|
28
|
+
};
|
|
29
|
+
ADD_ANOTHER_COUPON: () => {};
|
|
16
30
|
}>>, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ContextFrom, Interpreter } from 'xstate';
|
|
2
|
+
import { SubscriptionModel, subscriptionModel } from '../../models';
|
|
3
|
+
import { ModelEventsFrom } from 'xstate/lib/model.types';
|
|
4
|
+
import { Coupon, SubscriptionModelWithCoupons } from '../../models/subscription/types';
|
|
2
5
|
export type UpdateSubscription = {
|
|
3
6
|
type: 'UPDATE_SUBSCRIPTION';
|
|
4
7
|
data: Partial<SubscriptionModel>;
|
|
@@ -7,4 +10,35 @@ export type GetSubscriptionDetails = {
|
|
|
7
10
|
type: 'GET_SUBSCRIPTION_DETAILS';
|
|
8
11
|
data: Partial<SubscriptionModel>;
|
|
9
12
|
};
|
|
10
|
-
|
|
13
|
+
type SubscriptionModelContext = ContextFrom<typeof subscriptionModel>;
|
|
14
|
+
type SubscriptionModelEvents = ModelEventsFrom<typeof subscriptionModel>;
|
|
15
|
+
export type SubscriptionDetailsMachineInterpreter = Interpreter<SubscriptionModelContext, any, SubscriptionModelEvents>;
|
|
16
|
+
export type Events = GetCouponsEvent | GetCouponsSuccessEvent | AddCouponEvent | AddAnotherCouponEvent | ErrorEvent;
|
|
17
|
+
export type Context = {
|
|
18
|
+
error: CouponErrorCodes | null;
|
|
19
|
+
coupons: SubscriptionModelWithCoupons['coupons'];
|
|
20
|
+
addedCoupon: Coupon;
|
|
21
|
+
};
|
|
22
|
+
export type GetCouponsEvent = {
|
|
23
|
+
type: 'GET_COUPONS';
|
|
24
|
+
coupons: Coupon[];
|
|
25
|
+
};
|
|
26
|
+
export type GetCouponsSuccessEvent = {
|
|
27
|
+
type: 'GET_COUPONS_SUCCESS';
|
|
28
|
+
data: SubscriptionModelWithCoupons;
|
|
29
|
+
};
|
|
30
|
+
export type AddCouponEvent = {
|
|
31
|
+
type: 'ADD_COUPON';
|
|
32
|
+
couponCode: string;
|
|
33
|
+
};
|
|
34
|
+
export type AddAnotherCouponEvent = {
|
|
35
|
+
type: 'ADD_ANOTHER_COUPON';
|
|
36
|
+
};
|
|
37
|
+
export type ErrorEvent = {
|
|
38
|
+
type: 'ERROR';
|
|
39
|
+
data: {
|
|
40
|
+
errorCode: CouponErrorCodes;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export type CouponErrorCodes = 'CouponNotFound' | 'NonStackableCoupon' | 'CouponNoLongerActive' | 'InvalidCoupon';
|
|
44
|
+
export {};
|
|
@@ -13,6 +13,13 @@ export declare const getSubscriptionsByCategoryId: (catalogId: number) => (machi
|
|
|
13
13
|
GET_SUBSCRIPTION_DETAILS: (event: import("../../models/subscription/types").GetSubscriptionDetailsEvent) => {
|
|
14
14
|
event: import("../../models/subscription/types").GetSubscriptionDetailsEvent;
|
|
15
15
|
};
|
|
16
|
+
GET_COUPONS: (event: import("../../models/subscription/subscription").GetCouponsEvent) => {
|
|
17
|
+
coupons: import("../../models/subscription/types").Coupon[];
|
|
18
|
+
};
|
|
19
|
+
ADD_COUPON: (event: import("../../models/subscription/subscription").AddCouponEvent) => {
|
|
20
|
+
couponCode: string;
|
|
21
|
+
};
|
|
22
|
+
ADD_ANOTHER_COUPON: () => {};
|
|
16
23
|
}>>, {
|
|
17
24
|
value: any;
|
|
18
25
|
context: import("../../models/subscription/types").SubscriptionModelWithCoupons;
|
|
@@ -21,6 +28,13 @@ export declare const getSubscriptionsByCategoryId: (catalogId: number) => (machi
|
|
|
21
28
|
GET_SUBSCRIPTION_DETAILS: (event: import("../../models/subscription/types").GetSubscriptionDetailsEvent) => {
|
|
22
29
|
event: import("../../models/subscription/types").GetSubscriptionDetailsEvent;
|
|
23
30
|
};
|
|
31
|
+
GET_COUPONS: (event: import("../../models/subscription/subscription").GetCouponsEvent) => {
|
|
32
|
+
coupons: import("../../models/subscription/types").Coupon[];
|
|
33
|
+
};
|
|
34
|
+
ADD_COUPON: (event: import("../../models/subscription/subscription").AddCouponEvent) => {
|
|
35
|
+
couponCode: string;
|
|
36
|
+
};
|
|
37
|
+
ADD_ANOTHER_COUPON: () => {};
|
|
24
38
|
}>>, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;
|
|
25
39
|
customFieldsRef: import("xstate").ActorRefWithDeprecatedState<import("../customFields/types").Context, import("xstate").AnyEventObject, {
|
|
26
40
|
value: any;
|
|
@@ -38,6 +52,13 @@ export declare const getSubscriptionById: (catalogId: number, subscriptionId: nu
|
|
|
38
52
|
GET_SUBSCRIPTION_DETAILS: (event: import("../../models/subscription/types").GetSubscriptionDetailsEvent) => {
|
|
39
53
|
event: import("../../models/subscription/types").GetSubscriptionDetailsEvent;
|
|
40
54
|
};
|
|
55
|
+
GET_COUPONS: (event: import("../../models/subscription/subscription").GetCouponsEvent) => {
|
|
56
|
+
coupons: import("../../models/subscription/types").Coupon[];
|
|
57
|
+
};
|
|
58
|
+
ADD_COUPON: (event: import("../../models/subscription/subscription").AddCouponEvent) => {
|
|
59
|
+
couponCode: string;
|
|
60
|
+
};
|
|
61
|
+
ADD_ANOTHER_COUPON: () => {};
|
|
41
62
|
}>>, {
|
|
42
63
|
value: any;
|
|
43
64
|
context: import("../../models/subscription/types").SubscriptionModelWithCoupons;
|
|
@@ -46,6 +67,13 @@ export declare const getSubscriptionById: (catalogId: number, subscriptionId: nu
|
|
|
46
67
|
GET_SUBSCRIPTION_DETAILS: (event: import("../../models/subscription/types").GetSubscriptionDetailsEvent) => {
|
|
47
68
|
event: import("../../models/subscription/types").GetSubscriptionDetailsEvent;
|
|
48
69
|
};
|
|
70
|
+
GET_COUPONS: (event: import("../../models/subscription/subscription").GetCouponsEvent) => {
|
|
71
|
+
coupons: import("../../models/subscription/types").Coupon[];
|
|
72
|
+
};
|
|
73
|
+
ADD_COUPON: (event: import("../../models/subscription/subscription").AddCouponEvent) => {
|
|
74
|
+
couponCode: string;
|
|
75
|
+
};
|
|
76
|
+
ADD_ANOTHER_COUPON: () => {};
|
|
49
77
|
}>>, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;
|
|
50
78
|
customFieldsRef: import("xstate").ActorRefWithDeprecatedState<import("../customFields/types").Context, import("xstate").AnyEventObject, {
|
|
51
79
|
value: any;
|
|
@@ -72,6 +100,13 @@ export declare const subscriptionsSelectors: {
|
|
|
72
100
|
GET_SUBSCRIPTION_DETAILS: (event: import("../../models/subscription/types").GetSubscriptionDetailsEvent) => {
|
|
73
101
|
event: import("../../models/subscription/types").GetSubscriptionDetailsEvent;
|
|
74
102
|
};
|
|
103
|
+
GET_COUPONS: (event: import("../../models/subscription/subscription").GetCouponsEvent) => {
|
|
104
|
+
coupons: import("../../models/subscription/types").Coupon[];
|
|
105
|
+
};
|
|
106
|
+
ADD_COUPON: (event: import("../../models/subscription/subscription").AddCouponEvent) => {
|
|
107
|
+
couponCode: string;
|
|
108
|
+
};
|
|
109
|
+
ADD_ANOTHER_COUPON: () => {};
|
|
75
110
|
}>>, {
|
|
76
111
|
value: any;
|
|
77
112
|
context: import("../../models/subscription/types").SubscriptionModelWithCoupons;
|
|
@@ -80,6 +115,13 @@ export declare const subscriptionsSelectors: {
|
|
|
80
115
|
GET_SUBSCRIPTION_DETAILS: (event: import("../../models/subscription/types").GetSubscriptionDetailsEvent) => {
|
|
81
116
|
event: import("../../models/subscription/types").GetSubscriptionDetailsEvent;
|
|
82
117
|
};
|
|
118
|
+
GET_COUPONS: (event: import("../../models/subscription/subscription").GetCouponsEvent) => {
|
|
119
|
+
coupons: import("../../models/subscription/types").Coupon[];
|
|
120
|
+
};
|
|
121
|
+
ADD_COUPON: (event: import("../../models/subscription/subscription").AddCouponEvent) => {
|
|
122
|
+
couponCode: string;
|
|
123
|
+
};
|
|
124
|
+
ADD_ANOTHER_COUPON: () => {};
|
|
83
125
|
}>>, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;
|
|
84
126
|
customFieldsRef: import("xstate").ActorRefWithDeprecatedState<import("../customFields/types").Context, import("xstate").AnyEventObject, {
|
|
85
127
|
value: any;
|
|
@@ -103,6 +145,13 @@ export declare const subscriptionsSelectors: {
|
|
|
103
145
|
GET_SUBSCRIPTION_DETAILS: (event: import("../../models/subscription/types").GetSubscriptionDetailsEvent) => {
|
|
104
146
|
event: import("../../models/subscription/types").GetSubscriptionDetailsEvent;
|
|
105
147
|
};
|
|
148
|
+
GET_COUPONS: (event: import("../../models/subscription/subscription").GetCouponsEvent) => {
|
|
149
|
+
coupons: import("../../models/subscription/types").Coupon[];
|
|
150
|
+
};
|
|
151
|
+
ADD_COUPON: (event: import("../../models/subscription/subscription").AddCouponEvent) => {
|
|
152
|
+
couponCode: string;
|
|
153
|
+
};
|
|
154
|
+
ADD_ANOTHER_COUPON: () => {};
|
|
106
155
|
}>>, {
|
|
107
156
|
value: any;
|
|
108
157
|
context: import("../../models/subscription/types").SubscriptionModelWithCoupons;
|
|
@@ -111,6 +160,13 @@ export declare const subscriptionsSelectors: {
|
|
|
111
160
|
GET_SUBSCRIPTION_DETAILS: (event: import("../../models/subscription/types").GetSubscriptionDetailsEvent) => {
|
|
112
161
|
event: import("../../models/subscription/types").GetSubscriptionDetailsEvent;
|
|
113
162
|
};
|
|
163
|
+
GET_COUPONS: (event: import("../../models/subscription/subscription").GetCouponsEvent) => {
|
|
164
|
+
coupons: import("../../models/subscription/types").Coupon[];
|
|
165
|
+
};
|
|
166
|
+
ADD_COUPON: (event: import("../../models/subscription/subscription").AddCouponEvent) => {
|
|
167
|
+
couponCode: string;
|
|
168
|
+
};
|
|
169
|
+
ADD_ANOTHER_COUPON: () => {};
|
|
114
170
|
}>>, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;
|
|
115
171
|
customFieldsRef: import("xstate").ActorRefWithDeprecatedState<import("../customFields/types").Context, import("xstate").AnyEventObject, {
|
|
116
172
|
value: any;
|
package/typings/packages/subscriptions-manager/src/modals/AddCoupon/components/Content/Content.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SubscriptionDetailsMachineInterpreter } from '../../../../machines/subscription/types';
|
|
3
3
|
import { Currency } from "../../../../../../formatters/src";
|
|
4
4
|
type AddCouponModal = {
|
|
5
5
|
displayMode: 'layer' | 'window';
|
|
6
6
|
onClose: () => void;
|
|
7
7
|
catalogId: number;
|
|
8
8
|
subscriptionId: number;
|
|
9
|
-
|
|
9
|
+
subscriptionDetailsService: SubscriptionDetailsMachineInterpreter;
|
|
10
10
|
currency: Currency;
|
|
11
11
|
};
|
|
12
|
-
declare const Content: ({ onClose, displayMode,
|
|
12
|
+
declare const Content: ({ onClose, displayMode, subscriptionDetailsService, currency, }: AddCouponModal) => React.JSX.Element;
|
|
13
13
|
export default Content;
|
package/typings/packages/subscriptions-manager/src/modals/AddCoupon/components/Content/utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TFunction } from 'react-i18next';
|
|
2
2
|
import { Currency } from "../../../../../../formatters/src";
|
|
3
3
|
import { Coupon } from '../../../../models/subscription/types';
|
|
4
|
-
import { CouponErrorCodes } from '../../../../machines/
|
|
4
|
+
import { CouponErrorCodes } from '../../../../machines/subscription/types';
|
|
5
5
|
export declare const getAlertTitle: ({ code, percentage, recurring, amountInCents }: Coupon, t: TFunction<'subscriptions-manager'[]>, currency: Currency) => string;
|
|
6
6
|
export declare const getAlertMsg: ({ percentage, amountInCents, expiresAt }: Coupon, t: TFunction<'subscriptions-manager'[]>, currency: Currency) => string;
|
|
7
7
|
export declare const getCouponErrorMsg: (error: CouponErrorCodes, t: TFunction<'subscriptions-manager'[]>) => string;
|
|
@@ -1,15 +1,44 @@
|
|
|
1
|
-
import { SubscriptionModelWithCoupons, UpdateSubscriptionEvent, GetSubscriptionDetailsEvent } from './types';
|
|
1
|
+
import { SubscriptionModelWithCoupons, UpdateSubscriptionEvent, GetSubscriptionDetailsEvent, Coupon } from './types';
|
|
2
2
|
declare const subscriptionModel: import("xstate/lib/model.types").Model<SubscriptionModelWithCoupons, import("xstate/lib/model.types").UnionFromCreatorsReturnTypes<import("xstate/lib/model.types").FinalEventCreators<{
|
|
3
3
|
UPDATE_SUBSCRIPTION: (event: UpdateSubscriptionEvent) => UpdateSubscriptionEvent;
|
|
4
4
|
GET_SUBSCRIPTION_DETAILS: (event: GetSubscriptionDetailsEvent) => {
|
|
5
5
|
event: GetSubscriptionDetailsEvent;
|
|
6
6
|
};
|
|
7
|
+
GET_COUPONS: (event: GetCouponsEvent) => {
|
|
8
|
+
coupons: Coupon[];
|
|
9
|
+
};
|
|
10
|
+
ADD_COUPON: (event: AddCouponEvent) => {
|
|
11
|
+
couponCode: string;
|
|
12
|
+
};
|
|
13
|
+
ADD_ANOTHER_COUPON: () => {};
|
|
7
14
|
}>>, import("xstate").BaseActionObject, import("xstate/lib/model.types").FinalModelCreators<{
|
|
8
15
|
events: {
|
|
9
16
|
UPDATE_SUBSCRIPTION: (event: UpdateSubscriptionEvent) => UpdateSubscriptionEvent;
|
|
10
17
|
GET_SUBSCRIPTION_DETAILS: (event: GetSubscriptionDetailsEvent) => {
|
|
11
18
|
event: GetSubscriptionDetailsEvent;
|
|
12
19
|
};
|
|
20
|
+
GET_COUPONS: (event: GetCouponsEvent) => {
|
|
21
|
+
coupons: Coupon[];
|
|
22
|
+
};
|
|
23
|
+
ADD_COUPON: (event: AddCouponEvent) => {
|
|
24
|
+
couponCode: string;
|
|
25
|
+
};
|
|
26
|
+
ADD_ANOTHER_COUPON: () => {};
|
|
13
27
|
};
|
|
14
28
|
}>>;
|
|
29
|
+
export type AddCouponEvent = {
|
|
30
|
+
type: 'ADD_COUPON';
|
|
31
|
+
couponCode: string;
|
|
32
|
+
};
|
|
33
|
+
export type GetCouponsEvent = {
|
|
34
|
+
type: 'GET_COUPONS';
|
|
35
|
+
coupons: Coupon[];
|
|
36
|
+
};
|
|
37
|
+
export type GetCouponsSuccessEvent = {
|
|
38
|
+
type: 'GET_COUPONS_SUCCESS';
|
|
39
|
+
data: SubscriptionModelWithCoupons;
|
|
40
|
+
};
|
|
41
|
+
export type AddAnotherCouponEvent = {
|
|
42
|
+
type: 'ADD_ANOTHER_COUPON';
|
|
43
|
+
};
|
|
15
44
|
export default subscriptionModel;
|
|
@@ -2,6 +2,7 @@ import { PartialDeep } from 'type-fest';
|
|
|
2
2
|
import { Currency } from "../../../../formatters/src";
|
|
3
3
|
import { AddressFields } from "../../../../address/src";
|
|
4
4
|
import type { CreditCard, BankAccount } from '../paymentProfile';
|
|
5
|
+
import { CouponErrorCodes } from '../../machines/subscription/types';
|
|
5
6
|
export interface SubscriptionModel {
|
|
6
7
|
id: number;
|
|
7
8
|
currency: Currency;
|
|
@@ -82,7 +83,11 @@ export type Coupon = {
|
|
|
82
83
|
expiresAt: string;
|
|
83
84
|
recurring: boolean;
|
|
84
85
|
percentage: number;
|
|
86
|
+
subscriptionBalanceInCents: number;
|
|
87
|
+
subscriptionCurrentBillingAmountInCents: number;
|
|
85
88
|
};
|
|
86
89
|
export type SubscriptionModelWithCoupons = SubscriptionModel & {
|
|
87
90
|
coupons?: Coupon[];
|
|
91
|
+
error?: CouponErrorCodes | null;
|
|
92
|
+
addedCoupon?: Coupon | null;
|
|
88
93
|
};
|
|
@@ -4,6 +4,7 @@ import ChargifyComponents from '../SDK';
|
|
|
4
4
|
type Params = {
|
|
5
5
|
componentsTheme: PartialDeep<Theme>;
|
|
6
6
|
locale: string;
|
|
7
|
+
loadPath: string;
|
|
7
8
|
};
|
|
8
|
-
export declare const createComponentFactory: ({ componentsTheme, locale }: Params) => ChargifyComponents;
|
|
9
|
+
export declare const createComponentFactory: ({ componentsTheme, locale, loadPath, }: Params) => ChargifyComponents;
|
|
9
10
|
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
type Props = {
|
|
2
|
-
subscriptionId: number;
|
|
3
|
-
catalogId: number;
|
|
4
|
-
};
|
|
5
|
-
export declare const useCoupons: ({ subscriptionId, catalogId }: Props) => import("xstate").Interpreter<import("../machines/coupons/types").Context, any, import("../machines/coupons/types").Events, {
|
|
6
|
-
value: any;
|
|
7
|
-
context: import("../machines/coupons/types").Context;
|
|
8
|
-
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("../machines/coupons/types").Events, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;
|
|
9
|
-
export {};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Events, Context } from './types';
|
|
2
|
-
export declare const coupons: import("xstate").StateMachine<Context, any, Events, {
|
|
3
|
-
value: any;
|
|
4
|
-
context: Context;
|
|
5
|
-
}, import("xstate").BaseActionObject, import("xstate").ServiceMap, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, Events, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { CouponsMachineState } from './types';
|
|
2
|
-
export declare const couponsSelectors: {
|
|
3
|
-
getError: (state: CouponsMachineState) => import("./types").CouponErrorCodes;
|
|
4
|
-
getCoupons: (state: CouponsMachineState) => import("../../models/subscription/types").Coupon[];
|
|
5
|
-
getCouponsStatus: (state: CouponsMachineState) => {
|
|
6
|
-
isError: boolean;
|
|
7
|
-
isLoading: boolean;
|
|
8
|
-
isAddingCoupon: boolean;
|
|
9
|
-
isCouponAdded: boolean;
|
|
10
|
-
};
|
|
11
|
-
getAddedCoupon: (state: CouponsMachineState) => import("../../models/subscription/types").Coupon;
|
|
12
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Coupon, SubscriptionModelWithCoupons } from '../../models/subscription/types';
|
|
2
|
-
import { coupons } from './coupons';
|
|
3
|
-
import { Interpreter, State } from 'xstate';
|
|
4
|
-
export type CouponsMachine = typeof coupons;
|
|
5
|
-
export type CouponsMachineState = State<CouponsMachine['context']>;
|
|
6
|
-
export type Events = GetCouponsEvent | GetCouponsSuccessEvent | AddCouponEvent | AddAnotherCouponEvent | ErrorEvent;
|
|
7
|
-
export type Context = {
|
|
8
|
-
error: CouponErrorCodes | null;
|
|
9
|
-
coupons: SubscriptionModelWithCoupons['coupons'];
|
|
10
|
-
addedCoupon: Coupon;
|
|
11
|
-
};
|
|
12
|
-
export type GetCouponsEvent = {
|
|
13
|
-
type: 'GET_COUPONS';
|
|
14
|
-
coupons: Coupon[];
|
|
15
|
-
};
|
|
16
|
-
export type GetCouponsSuccessEvent = {
|
|
17
|
-
type: 'GET_COUPONS_SUCCESS';
|
|
18
|
-
data: SubscriptionModelWithCoupons;
|
|
19
|
-
};
|
|
20
|
-
export type AddCouponEvent = {
|
|
21
|
-
type: 'ADD_COUPON';
|
|
22
|
-
couponCode: string;
|
|
23
|
-
};
|
|
24
|
-
export type AddAnotherCouponEvent = {
|
|
25
|
-
type: 'ADD_ANOTHER_COUPON';
|
|
26
|
-
};
|
|
27
|
-
export type ErrorEvent = {
|
|
28
|
-
type: 'ERROR';
|
|
29
|
-
data: {
|
|
30
|
-
errorCode: CouponErrorCodes;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
export type CouponErrorCodes = 'CouponNotFound' | 'NonStackableCoupon' | 'CouponNoLongerActive' | 'InvalidCoupon';
|
|
34
|
-
export type CouponsMachineInterpreter = Interpreter<Context, any, Events>;
|
/package/typings/packages/subscriptions-manager/src/machines/{coupons → subscription}/utils.d.ts
RENAMED
|
File without changes
|