@odus/checkout 1.12.0 → 1.14.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.
Files changed (45) hide show
  1. package/dist/api/getCheckoutDetails.query.d.ts.map +1 -1
  2. package/dist/checkout.es.js +210 -167
  3. package/dist/components/checkout/form/Form.d.ts +17 -0
  4. package/dist/components/checkout/form/Form.d.ts.map +1 -1
  5. package/dist/components/checkout/form/FormComponentManager.d.ts +6 -1
  6. package/dist/components/checkout/form/FormComponentManager.d.ts.map +1 -1
  7. package/dist/components/checkout/form/PaymentMethods.d.ts +2 -0
  8. package/dist/components/checkout/form/PaymentMethods.d.ts.map +1 -1
  9. package/dist/components/payment-methods/applePay/ApplePayButton.d.ts +5 -0
  10. package/dist/components/payment-methods/applePay/ApplePayButton.d.ts.map +1 -1
  11. package/dist/core/api/CheckoutAPI.service.d.ts.map +1 -1
  12. package/dist/core/vgs/VGSCollectService.d.ts +6 -0
  13. package/dist/core/vgs/VGSCollectService.d.ts.map +1 -1
  14. package/dist/core/vgs/vgsCsp.d.ts +17 -0
  15. package/dist/core/vgs/vgsCsp.d.ts.map +1 -0
  16. package/dist/elements/ApplePayElement.d.ts +3 -0
  17. package/dist/elements/ApplePayElement.d.ts.map +1 -1
  18. package/dist/elements/BaseElement.d.ts +15 -0
  19. package/dist/elements/BaseElement.d.ts.map +1 -1
  20. package/dist/elements/CardElement.d.ts +10 -3
  21. package/dist/elements/CardElement.d.ts.map +1 -1
  22. package/dist/elements/OdusElements.d.ts +9 -0
  23. package/dist/elements/OdusElements.d.ts.map +1 -1
  24. package/dist/elements/card/VgsCardAdapter.d.ts +2 -0
  25. package/dist/elements/card/VgsCardAdapter.d.ts.map +1 -1
  26. package/dist/elements.es.js +304 -248
  27. package/dist/phone.js +10 -14
  28. package/dist/services/checkout/Checkout.service.d.ts +2 -0
  29. package/dist/services/checkout/Checkout.service.d.ts.map +1 -1
  30. package/dist/services/checkout/CheckoutForm.service.d.ts +3 -0
  31. package/dist/services/checkout/CheckoutForm.service.d.ts.map +1 -1
  32. package/dist/services/telemetry/CheckoutReadiness.service.d.ts +88 -0
  33. package/dist/services/telemetry/CheckoutReadiness.service.d.ts.map +1 -0
  34. package/dist/services/telemetry/Telemetry.service.d.ts +6 -0
  35. package/dist/services/telemetry/Telemetry.service.d.ts.map +1 -1
  36. package/dist/shared.js +1335 -1026
  37. package/dist/types/api/ApiError.type.d.ts +3 -0
  38. package/dist/types/api/ApiError.type.d.ts.map +1 -1
  39. package/dist/types/telemetry/TelemetryEvents.type.d.ts +189 -1
  40. package/dist/types/telemetry/TelemetryEvents.type.d.ts.map +1 -1
  41. package/dist/utils/helpers/failureCause.util.d.ts +24 -0
  42. package/dist/utils/helpers/failureCause.util.d.ts.map +1 -0
  43. package/dist/utils/helpers/stageFailure.util.d.ts +35 -0
  44. package/dist/utils/helpers/stageFailure.util.d.ts.map +1 -0
  45. package/package.json +2 -2
@@ -1,7 +1,10 @@
1
+ import { FailureClass } from '../telemetry/TelemetryEvents.type';
1
2
  export type ApiError = {
2
3
  message: string;
3
4
  status: number;
4
5
  statusText: string;
5
6
  details?: any;
7
+ /** Set where the HTTP status alone cannot say why the call failed. */
8
+ failureClass?: FailureClass;
6
9
  };
7
10
  //# sourceMappingURL=ApiError.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ApiError.type.d.ts","sourceRoot":"","sources":["../../../src/types/api/ApiError.type.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,GAAG,CAAC;CACf,CAAC"}
1
+ {"version":3,"file":"ApiError.type.d.ts","sourceRoot":"","sources":["../../../src/types/api/ApiError.type.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEtE,MAAM,MAAM,QAAQ,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,sEAAsE;IACtE,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC"}
@@ -17,6 +17,9 @@ export declare const CheckoutEvents: {
17
17
  readonly VGS_TOKENIZATION_SUCCESS: "vgs.tokenization.success";
18
18
  readonly VGS_TOKENIZATION_FAILED: "vgs.tokenization.failed";
19
19
  readonly CARD_CAPTURE_UNAVAILABLE: "card.capture.unavailable";
20
+ readonly APPLE_PAY_START_FAILED: "apple_pay.start.failed";
21
+ readonly CHECKOUT_STAGE_STARTED: "checkout.stage.started";
22
+ readonly CHECKOUT_STAGE_OUTCOME: "checkout.stage.outcome";
20
23
  };
21
24
  export type CheckoutEventName = (typeof CheckoutEvents)[keyof typeof CheckoutEvents];
22
25
  export declare const CheckoutMeasurements: {
@@ -46,6 +49,53 @@ export type PaymentSubmitAttributes = {
46
49
  payment_id: string;
47
50
  payment_method?: string;
48
51
  };
52
+ /**
53
+ * Why a payment call failed. Sent as `failure_class` on
54
+ * `payment.association.failed` and `payment.submit.failed`, so a failure we
55
+ * caused can be told apart from a merchant error or a decline.
56
+ */
57
+ export declare const FailureClasses: {
58
+ /** No HTTP response arrived. */
59
+ readonly NETWORK: "network";
60
+ /** The API answered 4xx: a merchant error, an invalid key or a decline. */
61
+ readonly CLIENT_ERROR: "client_error";
62
+ /** The API answered with a status that is not 2xx or 4xx, usually 5xx. */
63
+ readonly SERVER_ERROR: "server_error";
64
+ /** The API answered 2xx with a body the SDK cannot use. */
65
+ readonly INVALID_RESPONSE: "invalid_response";
66
+ /** The SDK did not send the request, because a precondition was missing. */
67
+ readonly NOT_SENT: "not_sent";
68
+ /** The SDK code itself threw. */
69
+ readonly SDK_ERROR: "sdk_error";
70
+ /** A callback the merchant gave the SDK threw. */
71
+ readonly MERCHANT_CALLBACK: "merchant_callback";
72
+ };
73
+ export type FailureClass = (typeof FailureClasses)[keyof typeof FailureClasses];
74
+ /** The value of `http_status` when the failure has no HTTP status. */
75
+ export declare const NO_HTTP_STATUS = "none";
76
+ export type FailureCauseAttributes = {
77
+ failure_class: FailureClass;
78
+ /** The HTTP status code, or `none` when the SDK has no status for the failure. */
79
+ http_status: string;
80
+ };
81
+ export type PaymentSubmitFailedAttributes = PaymentSubmitAttributes & FailureCauseAttributes & {
82
+ error_message: string;
83
+ };
84
+ /**
85
+ * Where an association stopped. `checkout_details` is the request for the
86
+ * checkout details and the check of its answer. `form_setup` is the drop-in
87
+ * form setup that follows it, which is SDK code only.
88
+ */
89
+ export declare const PaymentAssociationFailedStages: {
90
+ readonly CHECKOUT_DETAILS: "checkout_details";
91
+ readonly FORM_SETUP: "form_setup";
92
+ };
93
+ export type PaymentAssociationFailedStage = (typeof PaymentAssociationFailedStages)[keyof typeof PaymentAssociationFailedStages];
94
+ export type PaymentAssociationFailedAttributes = FailureCauseAttributes & {
95
+ payment_id: string;
96
+ stage: PaymentAssociationFailedStage;
97
+ error_message: string;
98
+ };
49
99
  export type PaymentResultAttributes = {
50
100
  payment_id: string;
51
101
  status: string;
@@ -61,10 +111,37 @@ export type VGSIframeLoadedAttributes = {
61
111
  export type VGSTokenizationAttributes = {
62
112
  duration_ms?: string;
63
113
  error_message?: string;
64
- error_code?: string;
114
+ error_code?: TokenizationFailureCause;
115
+ /** The status VGS answered with, when the failure has one. */
116
+ http_status?: string;
65
117
  vgs_trace_id?: string;
66
118
  vgs_fingerprint?: string;
67
119
  };
120
+ /**
121
+ * Why a card did not tokenize. Sent as `error_code` on
122
+ * `vgs.tokenization.failed`. Only `invalid_input` is the shopper's: VGS
123
+ * refused what the shopper typed. Every other cause is a failure of the
124
+ * integration.
125
+ */
126
+ export declare const TokenizationFailureCauses: {
127
+ /** VGS validated the fields and refused the shopper's input. */
128
+ readonly INVALID_INPUT: "invalid_input";
129
+ /** VGS reported a failure that does not name an invalid field. */
130
+ readonly REQUEST_FAILED: "request_failed";
131
+ /** The card API answered with errors. */
132
+ readonly REJECTED: "rejected";
133
+ /** The card API answered without a card id. */
134
+ readonly NO_CARD_ID: "no_card_id";
135
+ /** The card was created, and the update that adds its expiry failed. */
136
+ readonly CARD_UPDATE_FAILED: "card_update_failed";
137
+ /** The VGS form or its session was not there to tokenize with. */
138
+ readonly NOT_INITIALIZED: "not_initialized";
139
+ /** The card block failed closed, so there was nothing to tokenize. */
140
+ readonly CAPTURE_UNAVAILABLE: "capture_unavailable";
141
+ /** SDK code threw, and VGS was not asked. */
142
+ readonly SDK_ERROR: "sdk_error";
143
+ };
144
+ export type TokenizationFailureCause = (typeof TokenizationFailureCauses)[keyof typeof TokenizationFailureCauses];
68
145
  /**
69
146
  * The card block failed closed. `reason` says which precondition was missing,
70
147
  * so a whole environment without card tokenization is visible as a spike here
@@ -79,4 +156,115 @@ export declare const CardCaptureUnavailableReasons: {
79
156
  readonly NO_TOKENIZATION_SESSION: "no_tokenization_session";
80
157
  };
81
158
  export type CardCaptureUnavailableReason = (typeof CardCaptureUnavailableReasons)[keyof typeof CardCaptureUnavailableReasons];
159
+ /**
160
+ * The shopper tapped Apple Pay and could not pay with it. `stage` says where
161
+ * the session stopped. A shopper who closes the sheet does not send this.
162
+ */
163
+ export type ApplePayStartFailedAttributes = {
164
+ payment_id: string;
165
+ stage: ApplePayStartFailedStage;
166
+ error_message: string;
167
+ };
168
+ export declare const ApplePayStartFailedStages: {
169
+ /** The session could not be created or begun. */
170
+ readonly SESSION_START: "session_start";
171
+ /** The merchant session could not be fetched, decoded or completed. */
172
+ readonly MERCHANT_VALIDATION: "merchant_validation";
173
+ };
174
+ export type ApplePayStartFailedStage = (typeof ApplePayStartFailedStages)[keyof typeof ApplePayStartFailedStages];
175
+ /**
176
+ * Why a checkout load ended without the checkout becoming ready. Sent as the
177
+ * `reason` of `checkout.stage.outcome` for the readiness stage, and of
178
+ * `checkout.load_time` and `form.render_time`.
179
+ */
180
+ export declare const CheckoutLoadFailureReasons: {
181
+ readonly ASSOCIATION_FAILED: "association_failed";
182
+ /** SDK code threw while it put the checkout on the page. */
183
+ readonly MOUNT_FAILED: "mount_failed";
184
+ /** The merchant mounted into a container that does not exist. */
185
+ readonly CONTAINER_NOT_FOUND: "container_not_found";
186
+ /** The drop-in form could not draw one of its parts. */
187
+ readonly FORM_RENDER_FAILED: "form_render_failed";
188
+ /** The merchant's Content Security Policy blocked VGS. */
189
+ readonly VGS_BLOCKED_BY_CSP: "vgs_blocked_by_csp";
190
+ readonly INIT_FAILED: "init_failed";
191
+ readonly FIELDS_NOT_READY: "fields_not_ready";
192
+ readonly NO_TOKENIZATION_SESSION: "no_tokenization_session";
193
+ };
194
+ export type CheckoutLoadFailureReason = (typeof CheckoutLoadFailureReasons)[keyof typeof CheckoutLoadFailureReasons];
195
+ export type CheckoutLoadOutcome = {
196
+ status: 'ready';
197
+ } | {
198
+ status: 'failed';
199
+ reason: CheckoutLoadFailureReason;
200
+ /** Detail sent beside the reason, such as which form part failed. */
201
+ attributes?: Record<string, string>;
202
+ };
203
+ /**
204
+ * The two stages of a checkout session that the readiness objective counts.
205
+ * Each stage sends one `checkout.stage.outcome`, which carries its valid event
206
+ * and, when it failed, its bad event.
207
+ */
208
+ export declare const CheckoutStages: {
209
+ readonly READINESS: "readiness";
210
+ readonly FIRST_SUBMIT: "first_submit";
211
+ };
212
+ export type CheckoutStage = (typeof CheckoutStages)[keyof typeof CheckoutStages];
213
+ export declare const ReadinessOutcomes: {
214
+ readonly READY: "ready";
215
+ /** A failure that is ours ended the stage. */
216
+ readonly FAILED: "failed";
217
+ /** The stage reached no outcome before the deadline. */
218
+ readonly DEADLINE: "deadline";
219
+ /** The page closed, or the merchant destroyed the checkout, first. */
220
+ readonly LEFT: "left";
221
+ };
222
+ export type ReadinessOutcome = (typeof ReadinessOutcomes)[keyof typeof ReadinessOutcomes];
223
+ export declare const SubmitOutcomes: {
224
+ readonly SUCCEEDED: "succeeded";
225
+ readonly FAILED: "failed";
226
+ };
227
+ export type SubmitOutcome = (typeof SubmitOutcomes)[keyof typeof SubmitOutcomes];
228
+ /**
229
+ * Whose failure ended the stage. The objective counts `ours` as bad, leaves
230
+ * `not_ours` out of both halves, and reads `none` as good — except a `left`
231
+ * stage, which is bad when `waited_ms` passes the grace time.
232
+ */
233
+ export declare const StageFaults: {
234
+ readonly OURS: "ours";
235
+ readonly NOT_OURS: "not_ours";
236
+ readonly NONE: "none";
237
+ };
238
+ export type StageFault = (typeof StageFaults)[keyof typeof StageFaults];
239
+ /** The `reason` of a stage that has no failure to name. */
240
+ export declare const NO_STAGE_REASON = "none";
241
+ export declare const SubmitFailureReasons: {
242
+ readonly TOKENIZATION_FAILED: "tokenization_failed";
243
+ readonly APPLE_PAY_START_FAILED: "apple_pay_start_failed";
244
+ readonly AUTHORIZE_FAILED: "authorize_failed";
245
+ };
246
+ export type SubmitFailureReason = (typeof SubmitFailureReasons)[keyof typeof SubmitFailureReasons];
247
+ export type StageFailure<Reason extends string> = {
248
+ reason: Reason;
249
+ /** Detail sent beside the reason: a status, a cause, a stage. */
250
+ attributes?: Record<string, string>;
251
+ };
252
+ export type SubmitStageResult = {
253
+ outcome: typeof SubmitOutcomes.SUCCEEDED;
254
+ paymentMethod: string;
255
+ } | (StageFailure<SubmitFailureReason> & {
256
+ outcome: typeof SubmitOutcomes.FAILED;
257
+ fault: Exclude<StageFault, 'none'>;
258
+ paymentMethod: string;
259
+ });
260
+ export type CheckoutStageOutcomeAttributes = {
261
+ stage: CheckoutStage;
262
+ outcome: ReadinessOutcome | SubmitOutcome;
263
+ reason: string;
264
+ fault: StageFault;
265
+ /** Milliseconds the shopper waited. Sent for the readiness stage only. */
266
+ waited_ms?: string;
267
+ payment_id?: string;
268
+ payment_method?: string;
269
+ } & Record<string, string>;
82
270
  //# sourceMappingURL=TelemetryEvents.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TelemetryEvents.type.d.ts","source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AAM,CAAC;IACf,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB;IAAE,OAAO,EAAE,OAAO,cAAc,CAAC,SAAS,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GACnE,CAAC,YAAY,CAAC,mBAAmB,CAAC,GAAG;IACnC,OAAO,EAAE,OAAO,cAAc,CAAC,MAAM,CAAC;IACtC,KAAK,EAAE,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC,CAAC;AAEP,MAAM,MAAM,8BAA8B,GAAG;IAC3C,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,EAAE,gBAAgB,GAAG,aAAa,CAAC;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,UAAU,CAAC;IAClB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { FailureCauseAttributes, FailureClass } from '../../types/telemetry/TelemetryEvents.type';
2
+ /**
3
+ * Records why the call failed. The error itself does not change, and the same
4
+ * error is returned. A non-object cannot carry a tag and is returned as it is.
5
+ */
6
+ export declare const tagFailure: <T>(error: T, failureClass: FailureClass, status?: number) => T;
7
+ /**
8
+ * Records the HTTP status of a parsed response body, so a later check that
9
+ * rejects the body can still report the status.
10
+ */
11
+ export declare const rememberResponseStatus: <T>(body: T, status: number) => T;
12
+ export declare const responseStatusOf: (body: unknown) => number | undefined;
13
+ /**
14
+ * Reads the telemetry attributes that say why a payment call failed. A tag
15
+ * comes first. An error with an HTTP status and no tag is classified by the
16
+ * status. An error with neither came from SDK code.
17
+ */
18
+ export declare const describeFailure: (error: unknown) => FailureCauseAttributes;
19
+ /**
20
+ * Runs a merchant callback. If it throws, the error is tagged as the
21
+ * merchant's and thrown again, so the flow around it does not change.
22
+ */
23
+ export declare const runMerchantCallback: (callback: () => void) => void;
24
+ //# sourceMappingURL=failureCause.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"failureCause.util.d.ts","sourceRoot":"","sources":["../../../src/utils/helpers/failureCause.util.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EAGlB,MAAM,4CAA4C,CAAC;AAkBpD;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,EAC1B,OAAO,CAAC,EACR,cAAc,YAAY,EAC1B,SAAS,MAAM,KACd,CAMF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GAAI,CAAC,EAAE,MAAM,CAAC,EAAE,QAAQ,MAAM,KAAG,CAMnE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,MAAM,OAAO,KAAG,MAAM,GAAG,SACD,CAAC;AAE1D;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,KAAG,sBAyBhD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,UAAU,MAAM,IAAI,KAAG,IAM1D,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { ApplePayStartFailedStage, CheckoutLoadFailureReason, PaymentAssociationFailedStage, StageFailure, SubmitStageResult, TokenizationFailureCause } from '../../types/telemetry/TelemetryEvents.type';
2
+ /**
3
+ * Records why a card did not tokenize. The error itself does not change, and
4
+ * the same error is returned, so a caller that reads the VGS errors still
5
+ * reads them.
6
+ */
7
+ export declare const tagTokenizationFailure: <T>(error: T, cause: TokenizationFailureCause) => T;
8
+ export declare const tokenizationCauseOf: (error: unknown) => TokenizationFailureCause | undefined;
9
+ /**
10
+ * Describes a failed association for the readiness stage, and says whether
11
+ * the failure is ours.
12
+ */
13
+ export declare const describeAssociationFailure: (error: unknown, stage: PaymentAssociationFailedStage) => StageFailure<CheckoutLoadFailureReason> & {
14
+ ours: boolean;
15
+ };
16
+ /**
17
+ * Describes a failed first submit. A tokenization failure is ours unless VGS
18
+ * refused the shopper's input. Any other failure is described by its HTTP
19
+ * cause.
20
+ */
21
+ export declare const describeSubmitFailure: (error: unknown, paymentMethod: string) => Extract<SubmitStageResult, {
22
+ outcome: "failed";
23
+ }>;
24
+ /**
25
+ * Describes a card that did not tokenize. A failure without a recorded cause
26
+ * came from SDK code. Only the shopper's invalid input is not ours.
27
+ */
28
+ export declare const describeTokenizationFailure: (error: unknown, paymentMethod: string) => Extract<SubmitStageResult, {
29
+ outcome: "failed";
30
+ }>;
31
+ /** Apple Pay could not start, so the shopper could not use a method we drew. */
32
+ export declare const applePayStartFailure: (stage: ApplePayStartFailedStage) => Extract<SubmitStageResult, {
33
+ outcome: "failed";
34
+ }>;
35
+ //# sourceMappingURL=stageFailure.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stageFailure.util.d.ts","sourceRoot":"","sources":["../../../src/utils/helpers/stageFailure.util.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAK9B,KAAK,6BAA6B,EAClC,KAAK,YAAY,EAGjB,KAAK,iBAAiB,EAEtB,KAAK,wBAAwB,EAE9B,MAAM,4CAA4C,CAAC;AAQpD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAAI,CAAC,EACtC,OAAO,CAAC,EACR,OAAO,wBAAwB,KAC9B,CAMF,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,OAAO,OAAO,KACb,wBAAwB,GAAG,SAC+B,CAAC;AAsB9D;;;GAGG;AACH,eAAO,MAAM,0BAA0B,GACrC,OAAO,OAAO,EACd,OAAO,6BAA6B,KACnC,YAAY,CAAC,yBAAyB,CAAC,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAQ3D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAChC,OAAO,OAAO,EACd,eAAe,MAAM,KACpB,OAAO,CAAC,iBAAiB,EAAE;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,CAgBlD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,GACtC,OAAO,OAAO,EACd,eAAe,MAAM,KACpB,OAAO,CAAC,iBAAiB,EAAE;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,CAclD,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,oBAAoB,GAC/B,OAAO,wBAAwB,KAC9B,OAAO,CAAC,iBAAiB,EAAE;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,CAMjD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odus/checkout",
3
- "version": "1.12.0",
3
+ "version": "1.14.0",
4
4
  "displayName": "ODUS Checkout SDK",
5
5
  "keywords": [
6
6
  "odus",
@@ -132,6 +132,6 @@
132
132
  "dependencies": {
133
133
  "@types/applepayjs": "^14.0.9",
134
134
  "@vgs/collect-js": "^0.8.0",
135
- "libphonenumber-js": "^1.13.12"
135
+ "libphonenumber-js": "^1.13.14"
136
136
  }
137
137
  }