@clicktap/state 0.11.1 → 0.11.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.
@@ -1,2 +0,0 @@
1
- export declare function request<T>(url: string, options: object): Promise<T>;
2
- export default request;
@@ -1,8 +0,0 @@
1
- import { QuoteMachineContext, QuoteMachineEvents } from '../types';
2
- export declare function addItems({ context, event, }: {
3
- context: QuoteMachineContext;
4
- event: QuoteMachineEvents;
5
- }): QuoteMachineContext | {
6
- items: Record<string, any>[];
7
- };
8
- export default addItems;
@@ -1,2 +0,0 @@
1
- export * from './addItems';
2
- export * from './removeItems';
@@ -1,8 +0,0 @@
1
- import { QuoteMachineContext, QuoteMachineEvents } from '../types';
2
- export declare function removeItems({ context, event, }: {
3
- context: QuoteMachineContext;
4
- event: QuoteMachineEvents;
5
- }): QuoteMachineContext | {
6
- items: Record<string, any>[];
7
- };
8
- export default removeItems;
@@ -1,7 +0,0 @@
1
- import { AddItemsEvent, AddItemsSuccessEvent, QuoteMachineContext } from '../types';
2
- export declare const addItems: import("xstate").PromiseActorLogic<AddItemsSuccessEvent, {
3
- endpoint: QuoteMachineContext['endpoints']['addItems'];
4
- items: AddItemsEvent['items'];
5
- quoteId: QuoteMachineContext['quoteId'];
6
- }>;
7
- export default addItems;
@@ -1,3 +0,0 @@
1
- export * from './addItems';
2
- export * from './removeItems';
3
- export * from './refresh';
@@ -1,6 +0,0 @@
1
- import { RefreshSuccessEvent, QuoteMachineContext } from '../types';
2
- export declare const refresh: import("xstate").PromiseActorLogic<RefreshSuccessEvent, {
3
- endpoint: QuoteMachineContext['endpoints']['refresh'];
4
- quoteId: QuoteMachineContext['quoteId'];
5
- }>;
6
- export default refresh;
@@ -1,7 +0,0 @@
1
- import { RemoveItemsEvent, RemoveItemsSuccessEvent, QuoteMachineContext } from '../types';
2
- export declare const removeItems: import("xstate").PromiseActorLogic<RemoveItemsSuccessEvent, {
3
- endpoint: QuoteMachineContext['endpoints']['removeItems'];
4
- items: RemoveItemsEvent['items'];
5
- quoteId: QuoteMachineContext['quoteId'];
6
- }>;
7
- export default removeItems;
@@ -1,5 +0,0 @@
1
- import { QuoteMachineContext } from '../types';
2
- export declare const hasItems: ({ context }: {
3
- context: QuoteMachineContext;
4
- }) => boolean;
5
- export default hasItems;
@@ -1 +0,0 @@
1
- export * from './hasItems';
@@ -1,113 +0,0 @@
1
- import type { QuoteMachineContext } from './types';
2
- export declare const quoteMachine: import("xstate").StateMachine<QuoteMachineContext, import("./types").SetEmptyEvent | import("./types").SetActiveEvent | import("./types").AddItemsEvent | import("./types").RemoveItemsEvent | import("./types").ClearItemsEvent | import("./types").RefreshEvent | import("./types").ApplyPromotionEvent | import("./types").RemovePromotionEvent | import("./types").AddAddressEvent | import("./types").RemoveAddressEvent | import("./types").ApplyPaymentMethodEvent | import("./types").AddRewardEvent | import("./types").RemoveRewardEvent | import("./types").AddStoreCreditEvent | import("./types").RemoveStoreCreditEvent | import("./types").AddGiftCardEvent | import("./types").RemoveGiftCardEvent | import("xstate").DoneActorEvent<import("./types").AddItemsSuccessEvent> | import("xstate").DoneActorEvent<import("./types").RemoveItemsSuccessEvent> | import("xstate").DoneActorEvent<import("./types").ClearItemsSuccessEvent> | import("xstate").DoneActorEvent<import("./types").RefreshSuccessEvent>, {
3
- [x: string]: import("xstate").ActorRef<import("xstate").PromiseSnapshot<import("./types").AddItemsSuccessEvent, {
4
- endpoint: "";
5
- items: {
6
- id: string;
7
- quantity: number;
8
- options: Record<string, any>;
9
- }[];
10
- quoteId: string;
11
- }>, {
12
- [k: string]: unknown;
13
- type: string;
14
- }> | import("xstate").ActorRef<import("xstate").PromiseSnapshot<import("./types").RemoveItemsSuccessEvent, {
15
- endpoint: "";
16
- items: {
17
- id: string;
18
- quantity: number;
19
- }[];
20
- quoteId: string;
21
- }>, {
22
- [k: string]: unknown;
23
- type: string;
24
- }> | import("xstate").ActorRef<import("xstate").PromiseSnapshot<import("./types").RefreshSuccessEvent, {
25
- endpoint: "";
26
- quoteId: string;
27
- }>, {
28
- [k: string]: unknown;
29
- type: string;
30
- }> | undefined;
31
- }, {
32
- src: "addItems";
33
- logic: import("xstate").PromiseActorLogic<import("./types").AddItemsSuccessEvent, {
34
- endpoint: "";
35
- items: {
36
- id: string;
37
- quantity: number;
38
- options: Record<string, any>;
39
- }[];
40
- quoteId: string;
41
- }>;
42
- id: string | undefined;
43
- } | {
44
- src: "removeItems";
45
- logic: import("xstate").PromiseActorLogic<import("./types").RemoveItemsSuccessEvent, {
46
- endpoint: "";
47
- items: {
48
- id: string;
49
- quantity: number;
50
- }[];
51
- quoteId: string;
52
- }>;
53
- id: string | undefined;
54
- } | {
55
- src: "refresh";
56
- logic: import("xstate").PromiseActorLogic<import("./types").RefreshSuccessEvent, {
57
- endpoint: "";
58
- quoteId: string;
59
- }>;
60
- id: string | undefined;
61
- }, {
62
- type: "addItems";
63
- params: import("xstate").NonReducibleUnknown;
64
- } | {
65
- type: "removeItems";
66
- params: import("xstate").NonReducibleUnknown;
67
- }, {
68
- type: "hasItems";
69
- params: unknown;
70
- }, string, {}, string, {
71
- initialContext: Partial<QuoteMachineContext>;
72
- initialState?: string | undefined;
73
- }, import("xstate").NonReducibleUnknown, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("./types").SetEmptyEvent | import("./types").SetActiveEvent | import("./types").AddItemsEvent | import("./types").RemoveItemsEvent | import("./types").ClearItemsEvent | import("./types").RefreshEvent | import("./types").ApplyPromotionEvent | import("./types").RemovePromotionEvent | import("./types").AddAddressEvent | import("./types").RemoveAddressEvent | import("./types").ApplyPaymentMethodEvent | import("./types").AddRewardEvent | import("./types").RemoveRewardEvent | import("./types").AddStoreCreditEvent | import("./types").RemoveStoreCreditEvent | import("./types").AddGiftCardEvent | import("./types").RemoveGiftCardEvent | import("xstate").DoneActorEvent<import("./types").AddItemsSuccessEvent> | import("xstate").DoneActorEvent<import("./types").RemoveItemsSuccessEvent> | import("xstate").DoneActorEvent<import("./types").ClearItemsSuccessEvent> | import("xstate").DoneActorEvent<import("./types").RefreshSuccessEvent>, {
74
- src: "addItems";
75
- logic: import("xstate").PromiseActorLogic<import("./types").AddItemsSuccessEvent, {
76
- endpoint: "";
77
- items: {
78
- id: string;
79
- quantity: number;
80
- options: Record<string, any>;
81
- }[];
82
- quoteId: string;
83
- }>;
84
- id: string | undefined;
85
- } | {
86
- src: "removeItems";
87
- logic: import("xstate").PromiseActorLogic<import("./types").RemoveItemsSuccessEvent, {
88
- endpoint: "";
89
- items: {
90
- id: string;
91
- quantity: number;
92
- }[];
93
- quoteId: string;
94
- }>;
95
- id: string | undefined;
96
- } | {
97
- src: "refresh";
98
- logic: import("xstate").PromiseActorLogic<import("./types").RefreshSuccessEvent, {
99
- endpoint: "";
100
- quoteId: string;
101
- }>;
102
- id: string | undefined;
103
- }, {
104
- type: "addItems";
105
- params: import("xstate").NonReducibleUnknown;
106
- } | {
107
- type: "removeItems";
108
- params: import("xstate").NonReducibleUnknown;
109
- }, {
110
- type: "hasItems";
111
- params: unknown;
112
- }, string, string>>;
113
- export default quoteMachine;
@@ -1,135 +0,0 @@
1
- import { DoneActorEvent } from 'xstate';
2
- /** @todo how do we want to handle quote items? */
3
- export interface QuoteMachineContext {
4
- quoteId: string;
5
- currency: string;
6
- items: Array<Record<string, any>>;
7
- promotions: Array<Record<string, any>>;
8
- addresses: {
9
- billing: {
10
- available: Array<Record<string, any>>;
11
- };
12
- shipping: {
13
- available: Array<Record<string, any>>;
14
- selected: string | null;
15
- };
16
- };
17
- totals: {
18
- discount: number;
19
- tax: number;
20
- shipping: number;
21
- shippingTax: number;
22
- subtotal: number;
23
- grandTotal: number;
24
- };
25
- payments: Array<Record<string, any>>;
26
- storeCredit: Array<Record<string, any>>;
27
- rewards: Array<Record<string, any>>;
28
- giftCards: Array<Record<string, any>>;
29
- settings: Array<Record<string, any>>;
30
- endpoints: {
31
- addItems: '';
32
- removeItems: '';
33
- clearItems: '';
34
- refresh: '';
35
- applyPromotion: '';
36
- removePromotion: '';
37
- addAddress: '';
38
- removeAddress: '';
39
- applyPaymentMethod: '';
40
- addReward: '';
41
- removeReward: '';
42
- addStoreCredit: '';
43
- removeStoreCredit: '';
44
- addGiftCard: '';
45
- removeGiftCard: '';
46
- };
47
- errors: Array<string>;
48
- }
49
- export interface SetEmptyEvent {
50
- type: 'SET_EMPTY';
51
- }
52
- export interface SetActiveEvent {
53
- type: 'SET_ACTIVE';
54
- }
55
- export interface AddItemsEvent {
56
- type: 'ADD_ITEMS';
57
- items: Array<{
58
- id: string;
59
- quantity: number;
60
- options: Record<string, any>;
61
- }>;
62
- }
63
- export interface RemoveItemsEvent {
64
- type: 'REMOVE_ITEMS';
65
- items: Array<{
66
- id: string;
67
- quantity: number;
68
- }>;
69
- }
70
- export interface ClearItemsEvent {
71
- type: 'CLEAR_ITEMS';
72
- }
73
- export interface RefreshEvent {
74
- type: 'REFRESH';
75
- }
76
- export interface ApplyPromotionEvent {
77
- type: 'APPLY_PROMOTION';
78
- }
79
- export interface RemovePromotionEvent {
80
- type: 'REMOVE_PROMOTION';
81
- }
82
- export interface AddAddressEvent {
83
- type: 'ADD_ADDRESS';
84
- }
85
- export interface RemoveAddressEvent {
86
- type: 'REMOVE_ADDRESS';
87
- }
88
- export interface ApplyPaymentMethodEvent {
89
- type: 'APPLY_PAYMENT_METHOD';
90
- }
91
- export interface AddRewardEvent {
92
- type: 'ADD_REWARD';
93
- }
94
- export interface RemoveRewardEvent {
95
- type: 'REMOVE_REWARD';
96
- }
97
- export interface AddStoreCreditEvent {
98
- type: 'ADD_STORE_CREDIT';
99
- }
100
- export interface RemoveStoreCreditEvent {
101
- type: 'REMOVE_STORE_CREDIT';
102
- }
103
- export interface AddGiftCardEvent {
104
- type: 'ADD_GIFT_CARD';
105
- }
106
- export interface RemoveGiftCardEvent {
107
- type: 'REMOVE_GIFT_CARD';
108
- }
109
- export interface AddItemsSuccessEvent {
110
- type: 'ADD_ITEMS_SUCCESS';
111
- items: Array<Record<string, any>>;
112
- }
113
- export interface RemoveItemsSuccessEvent {
114
- type: 'REMOVE_ITEMS_SUCCESS';
115
- items: Array<Record<string, any>>;
116
- }
117
- export interface ClearItemsSuccessEvent {
118
- type: 'CLEAR_ITEMS_SUCCESS';
119
- }
120
- export interface RefreshSuccessEvent {
121
- type: 'REFRESH_SUCCESS';
122
- }
123
- export type QuoteMachineEvents = SetEmptyEvent | SetActiveEvent | AddItemsEvent | RemoveItemsEvent | ClearItemsEvent | RefreshEvent | ApplyPromotionEvent | RemovePromotionEvent | AddAddressEvent | RemoveAddressEvent | ApplyPaymentMethodEvent | AddRewardEvent | RemoveRewardEvent | AddStoreCreditEvent | RemoveStoreCreditEvent | AddGiftCardEvent | RemoveGiftCardEvent | DoneActorEvent<AddItemsSuccessEvent> | DoneActorEvent<RemoveItemsSuccessEvent> | DoneActorEvent<ClearItemsSuccessEvent> | DoneActorEvent<RefreshSuccessEvent>;
124
- export type AddItemsResponse = {
125
- message?: string;
126
- success: boolean;
127
- };
128
- export type RemoveItemsResponse = {
129
- message?: string;
130
- success: boolean;
131
- };
132
- export type RefreshResponse = {
133
- message?: string;
134
- success: boolean;
135
- };
File without changes
File without changes
File without changes
File without changes