swell-js 5.1.2 → 5.2.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swell-js",
3
- "version": "5.1.2",
3
+ "version": "5.2.0",
4
4
  "description": "Swell JS library for client-side stores",
5
5
  "engines": {
6
6
  "node": ">=16"
@@ -50,6 +50,7 @@
50
50
  "@types/applepayjs": "^14.0.9",
51
51
  "@types/googlepay": "^0.7.7",
52
52
  "@types/jest": "^29.5.11",
53
+ "@types/lodash-es": "^4.17.12",
53
54
  "@typescript-eslint/eslint-plugin": "^6.21.0",
54
55
  "@typescript-eslint/parser": "^6.21.0",
55
56
  "babel-jest": "^29.7.0",
package/types/index.d.ts CHANGED
@@ -34,6 +34,7 @@ import type {
34
34
  InputPaymentElementPaypalCase,
35
35
  InputPaymentElementGoogleCase,
36
36
  InputPaymentElementAppleCase,
37
+ InputPaymentElementSezzleCase,
37
38
  InputPaymentRedirectCase,
38
39
  PaymentCase,
39
40
  } from './payment';
@@ -326,6 +327,7 @@ export interface SwellClient<C extends 'snake' | 'camel' = 'snake'> {
326
327
  paypal?: InputPaymentElementPaypalCase[C];
327
328
  google?: InputPaymentElementGoogleCase[C];
328
329
  apple?: InputPaymentElementAppleCase[C];
330
+ sezzle?: InputPaymentElementSezzleCase[C];
329
331
  }): Promise<void>;
330
332
 
331
333
  tokenize(input?: {
@@ -486,18 +488,18 @@ export interface SwellClient<C extends 'snake' | 'camel' = 'snake'> {
486
488
  };
487
489
 
488
490
  utils: {
489
- get: typeof import('lodash-es/get');
490
- set: typeof import('lodash-es/set');
491
- uniq: typeof import('lodash-es/uniq');
492
- find: typeof import('lodash-es/find');
493
- round: typeof import('lodash-es/round');
494
- pick: typeof import('lodash-es/pick');
495
- findIndex: typeof import('lodash-es/findIndex');
496
- cloneDeep: typeof import('lodash-es/cloneDeep');
497
- toNumber: typeof import('lodash-es/toNumber');
498
- toLower: typeof import('lodash-es/toLower');
499
- isEqual: typeof import('lodash-es/isEqual');
500
- isEmpty: typeof import('lodash-es/isEmpty');
491
+ get: typeof import('lodash-es/get').default;
492
+ set: typeof import('lodash-es/set').default;
493
+ uniq: typeof import('lodash-es/uniq').default;
494
+ find: typeof import('lodash-es/find').default;
495
+ round: typeof import('lodash-es/round').default;
496
+ pick: typeof import('lodash-es/pick').default;
497
+ findIndex: typeof import('lodash-es/findIndex').default;
498
+ cloneDeep: typeof import('lodash-es/cloneDeep').default;
499
+ toNumber: typeof import('lodash-es/toNumber').default;
500
+ toLower: typeof import('lodash-es/toLower').default;
501
+ isEqual: typeof import('lodash-es/isEqual').default;
502
+ isEmpty: typeof import('lodash-es/isEmpty').default;
501
503
  merge: typeof import('deepmerge');
502
504
 
503
505
  map<T, R>(arr: T[], mapper: (item: T) => R): R[];
@@ -17,6 +17,7 @@ import type {
17
17
  InputPaymentElementGoogle,
18
18
  InputPaymentElementIdeal,
19
19
  InputPaymentElementPaypal,
20
+ InputPaymentElementSezzle,
20
21
  InputPaymentRedirect,
21
22
  } from './snake';
22
23
 
@@ -54,5 +55,8 @@ export type InputPaymentElementAppleCamel =
54
55
  export type InputPaymentElementGoogleCamel =
55
56
  ConvertSnakeToCamelCase<InputPaymentElementGoogle>;
56
57
 
58
+ export type InputPaymentElementSezzleCamel =
59
+ ConvertSnakeToCamelCase<InputPaymentElementSezzle>;
60
+
57
61
  export type InputPaymentRedirectCamel =
58
62
  ConvertSnakeToCamelCase<InputPaymentRedirect>;
@@ -7,6 +7,7 @@ import type {
7
7
  InputPaymentElementGoogle,
8
8
  InputPaymentElementIdeal,
9
9
  InputPaymentElementPaypal,
10
+ InputPaymentElementSezzle,
10
11
  InputPaymentRedirect,
11
12
  Payment,
12
13
  } from './snake';
@@ -18,6 +19,7 @@ import type {
18
19
  InputPaymentElementGoogleCamel,
19
20
  InputPaymentElementIdealCamel,
20
21
  InputPaymentElementPaypalCamel,
22
+ InputPaymentElementSezzleCamel,
21
23
  InputPaymentRedirectCamel,
22
24
  PaymentCamel,
23
25
  } from './camel';
@@ -52,6 +54,11 @@ export type InputPaymentElementPaypalCase = MakeCase<
52
54
  InputPaymentElementPaypalCamel
53
55
  >;
54
56
 
57
+ export type InputPaymentElementSezzleCase = MakeCase<
58
+ InputPaymentElementSezzle,
59
+ InputPaymentElementSezzleCamel
60
+ >;
61
+
55
62
  export type InputPaymentRedirectCase = MakeCase<
56
63
  InputPaymentRedirect,
57
64
  InputPaymentRedirectCamel
@@ -48,21 +48,21 @@ export interface Payment extends BaseModel {
48
48
  export interface InputPaymentElementBase {
49
49
  element_id?: string;
50
50
  /** @optional called when the Element value changes */
51
- on_change?: (event: unknown) => void;
51
+ onChange?: (event: unknown) => void;
52
52
  /** @optional called when the Element is fully rendered */
53
- on_ready?: (event: unknown) => void;
53
+ onReady?: (event: unknown) => void;
54
54
  /** @optional called when the Element gains focus */
55
- on_focus?: (event: unknown) => void;
55
+ onFocus?: (event: unknown) => void;
56
56
  /** @optional called when the Element loses focus */
57
- on_blur?: (event: unknown) => void;
57
+ onBlur?: (event: unknown) => void;
58
58
  /** @optional */
59
- on_escape?: (event: unknown) => void;
59
+ onEscape?: (event: unknown) => void;
60
60
  /** @optional optional, called when the Element is clicked */
61
- on_click?: (event: unknown) => void;
61
+ onClick?: (event: unknown) => void;
62
62
  /** @optional called on card payment success */
63
- on_success?: (event: unknown) => void;
63
+ onSuccess?: (data?: unknown) => void;
64
64
  /** @optional called on card payment error */
65
- on_error?: (event: unknown) => void;
65
+ onError?: (error: Error) => void;
66
66
  }
67
67
 
68
68
  export interface InputPaymentElementCard extends InputPaymentElementBase {
@@ -127,9 +127,41 @@ export interface InputPaymentElementGoogle extends InputPaymentElementBase {
127
127
  };
128
128
  }
129
129
 
130
+ export interface InputPaymentElementSezzle extends InputPaymentElementBase {
131
+ /** @see {@link https://docs.sezzle.com/docs/guides/express/express-checkout#options-2} */
132
+ style?: {
133
+ /** @default "Checkout with %%logo%%" */
134
+ templateText?: string;
135
+ borderType?: 'square' | 'semi-rounded';
136
+ customClass?: string;
137
+ /** @default "1px" */
138
+ paddingTop?: string;
139
+ /** @default "7px" */
140
+ paddingBottom?: string;
141
+ /** @default "30px" */
142
+ paddingLeft?: string;
143
+ /** @default "30px" */
144
+ paddingRight?: string;
145
+ /** @default "84px" */
146
+ sezzleImageWidth?: string;
147
+ sezzleImagePositionTop?: string;
148
+ sezzleImagePositionBottom?: string;
149
+ sezzleImagePositionLeft?: string;
150
+ sezzleImagePositionRight?: string;
151
+ letterSpacing?: string;
152
+ width?: string;
153
+ /** @default "4.2em" */
154
+ height?: string;
155
+ };
156
+
157
+ classes?: {
158
+ base?: string;
159
+ };
160
+ }
161
+
130
162
  export interface InputPaymentRedirect {
131
163
  /** @optional called on card payment success */
132
- on_success?: (event: unknown) => void;
164
+ onSuccess?: (event: unknown) => void;
133
165
  /** @optional called on card payment error */
134
- on_error?: (event: unknown) => void;
166
+ onError?: (event: unknown) => void;
135
167
  }