@wix/payments 1.0.324 → 1.0.326

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.
@@ -0,0 +1,106 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+
3
+ //#region ../../node_modules/@wix/editor-react-types/dist/image.d.ts
4
+ type Point = {
5
+ x: number;
6
+ y: number;
7
+ };
8
+ type Crop = Point & {
9
+ width: number;
10
+ height: number;
11
+ };
12
+ /**
13
+ * An image from Wix Media.
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * import type { Image } from '@wix/editor-react-types';
18
+ *
19
+ * interface MyComponentProps {
20
+ * image?: Image;
21
+ * }
22
+ *
23
+ * const MyComponent = ({ image }: MyComponentProps) => (
24
+ * <img src={image?.url} alt={image?.alt} />
25
+ * );
26
+ * ```
27
+ */
28
+ type Image = {
29
+ /** The image URI. */uri?: string; /** The image URL. */
30
+ url: string; /** The image file name. */
31
+ name?: string; /** The image height in pixels. */
32
+ height?: number; /** The image width in pixels. */
33
+ width?: number; /** Whether the image is animated (e.g. GIF). */
34
+ animated?: boolean; /** The crop region applied to the image. */
35
+ crop?: Crop; /** The image quality, as a percentage from 0 to 100. */
36
+ quality?: number; /** The image alt text for accessibility. */
37
+ alt?: string;
38
+ };
39
+ //#endregion
40
+ //#region src/extensions/my-wallet/context-providers/my-wallet-context.d.ts
41
+ /**
42
+ * A PayPal account's details. Outside the public `@wix/payments` SDK: the service sends them and the
43
+ * legacy wallet reads them (`payments-my-wallet` `utils/payPal.ts`).
44
+ */
45
+ interface SavedAccountInfo {
46
+ email: string | null;
47
+ accountHolder: string | null;
48
+ }
49
+ type PaymentMethodTypeId = 'creditCard' | 'payPal';
50
+ interface SavedPaymentMethodDetails {
51
+ typeId: PaymentMethodTypeId;
52
+ /** Null on a card. */
53
+ accountInfo: SavedAccountInfo | null;
54
+ }
55
+ /** What the site publishes for the method's brand, null when it publishes nothing for it. */
56
+ interface SavedPaymentMethodType {
57
+ displayName: string | null;
58
+ /** The brand's name is its `alt` when the site names it. */
59
+ icon: Image | null;
60
+ }
61
+ /**
62
+ * One saved payment method, in the SDK's names. The card's `cardInfo` fields sit on the row itself,
63
+ * `null` on a PayPal account, so the binding picker lists them without a group to open.
64
+ */
65
+ interface SavedPaymentMethod {
66
+ /** @internal */
67
+ id: string;
68
+ primary: boolean;
69
+ lastFourDigits: string | null;
70
+ expirationMonth: number | null;
71
+ expirationYear: number | null;
72
+ /** @internal */
73
+ cardholderName: string | null;
74
+ /** @internal */
75
+ paymentMethod: SavedPaymentMethodDetails;
76
+ paymentMethodType: SavedPaymentMethodType | null;
77
+ /** Resolves `false` when the change failed, so whatever offered it can say so (`GEN-13`). */
78
+ onSetDefault: () => Promise<boolean>;
79
+ /** Resolves `false` when the removal failed. */
80
+ onRemove: () => Promise<boolean>;
81
+ }
82
+ /** The logged-in member's saved payment methods and their paging state. */
83
+ interface WalletContextValue {
84
+ savedPaymentMethods: SavedPaymentMethod[];
85
+ /**
86
+ * True while the first saved-method query or a further page is pending. A boolean because the
87
+ * repeater's `isLoading` takes only one, and it is what draws the loading rows and holds back the
88
+ * empty slot.
89
+ */
90
+ isLoading: boolean;
91
+ /** True while the service names a page past the ones already loaded. */
92
+ hasMore: boolean;
93
+ /** Settles once the next page is on screen, and resolves rather than rejects when it fails. */
94
+ onLoadMore: () => Promise<void>;
95
+ }
96
+ /** Reads the Wallet context. Throws when no Wallet context provider is attached. */
97
+ declare function useWallet(): WalletContextValue;
98
+ //#endregion
99
+ //#region src/extensions/my-wallet/context-providers/my-wallet-context-provider.d.ts
100
+ interface WalletContextProviderProps {
101
+ pageSize?: number;
102
+ }
103
+ /** Provides the logged-in member's saved payment methods, and the actions that change them, to its children. */
104
+ declare const WalletContextProvider: FC<PropsWithChildren<WalletContextProviderProps>>;
105
+
106
+ export { type SavedPaymentMethod, WalletContextProvider, type WalletContextValue, WalletContextProvider as default, useWallet };