@coinflowlabs/vue 1.17.0 → 1.18.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/README.md +4 -0
- package/dist/coinflow-vue.css +1 -0
- package/dist/coinflow-vue.js +7327 -7048
- package/dist/coinflow-vue.umd.cjs +20 -14
- package/dist/components/card-form/CoinflowCardFormV2.vue.d.ts +5 -4
- package/dist/index.d.ts +4 -3
- package/dist/lib/common/card-form/cardEntryLayout.d.ts +88 -0
- package/dist/lib/common/card-form/cardFormSkeleton.d.ts +104 -0
- package/dist/lib/common/index.d.ts +2 -0
- package/dist/testing/CardFormV2Test.vue.d.ts +8 -6
- package/dist/testing/SingleTest.vue.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
|
-
import { CoinflowEnvs, MerchantTheme } from '../../lib/common';
|
|
2
|
+
import { CardFormVariant, CoinflowEnvs, MerchantTheme } from '../../lib/common';
|
|
3
3
|
export interface CardFormV2TokenResponse {
|
|
4
4
|
token: string;
|
|
5
5
|
expMonth?: string;
|
|
@@ -14,7 +14,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
14
14
|
merchantId: string;
|
|
15
15
|
env?: CoinflowEnvs;
|
|
16
16
|
theme?: MerchantTheme;
|
|
17
|
-
variant:
|
|
17
|
+
variant: CardFormVariant;
|
|
18
18
|
token?: string;
|
|
19
19
|
onLoad?: () => void;
|
|
20
20
|
}>;
|
|
@@ -28,13 +28,14 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
28
28
|
merchantId: string;
|
|
29
29
|
env?: CoinflowEnvs;
|
|
30
30
|
theme?: MerchantTheme;
|
|
31
|
-
variant:
|
|
31
|
+
variant: CardFormVariant;
|
|
32
32
|
token?: string;
|
|
33
33
|
onLoad?: () => void;
|
|
34
34
|
}>;
|
|
35
35
|
required: true;
|
|
36
36
|
};
|
|
37
37
|
}>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
38
|
+
wrapperRef: HTMLDivElement;
|
|
38
39
|
iframeRef: HTMLIFrameElement;
|
|
39
|
-
},
|
|
40
|
+
}, HTMLDivElement>;
|
|
40
41
|
export default _default;
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ declare const CoinflowCardForm: import('vue').DefineComponent<import('vue').Extr
|
|
|
16
16
|
merchantId: string;
|
|
17
17
|
env?: import('.').CoinflowEnvs;
|
|
18
18
|
theme?: import('.').MerchantTheme;
|
|
19
|
-
variant:
|
|
19
|
+
variant: import('.').CardFormVariant;
|
|
20
20
|
token?: string;
|
|
21
21
|
onLoad?: () => void;
|
|
22
22
|
}>;
|
|
@@ -30,15 +30,16 @@ declare const CoinflowCardForm: import('vue').DefineComponent<import('vue').Extr
|
|
|
30
30
|
merchantId: string;
|
|
31
31
|
env?: import('.').CoinflowEnvs;
|
|
32
32
|
theme?: import('.').MerchantTheme;
|
|
33
|
-
variant:
|
|
33
|
+
variant: import('.').CardFormVariant;
|
|
34
34
|
token?: string;
|
|
35
35
|
onLoad?: () => void;
|
|
36
36
|
}>;
|
|
37
37
|
required: true;
|
|
38
38
|
};
|
|
39
39
|
}>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
40
|
+
wrapperRef: HTMLDivElement;
|
|
40
41
|
iframeRef: HTMLIFrameElement;
|
|
41
|
-
},
|
|
42
|
+
}, HTMLDivElement>;
|
|
42
43
|
/** @deprecated Use CoinflowCardForm instead */
|
|
43
44
|
declare const CoinflowLegacyCardNumberInput: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
44
45
|
args: {
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single source of truth for the card-entry responsive layout.
|
|
3
|
+
*
|
|
4
|
+
* The real card-entry form (`UnifiedCardEntry` in the core-flows app) and the
|
|
5
|
+
* React/Vue/Angular skeleton loaders all render the same grid. Historically the
|
|
6
|
+
* form drove the inline↔two-row switch from JS (a ResizeObserver toggling React
|
|
7
|
+
* state) while the skeletons hard-coded their own guesses, so the two drifted.
|
|
8
|
+
*
|
|
9
|
+
* This module defines the grid templates and the breakpoint ONCE, as pure data
|
|
10
|
+
* plus a CSS builder, so every consumer reflows at exactly the same width via a
|
|
11
|
+
* CSS container query — no JS width measurement, nothing to keep in sync.
|
|
12
|
+
*/
|
|
13
|
+
export type CardEntryInputName = 'card-number' | 'expiration' | 'cvv';
|
|
14
|
+
/**
|
|
15
|
+
* Minimum width (px) each field needs before the row is too cramped and the
|
|
16
|
+
* layout drops to two rows. Mirrors the real form's field sizing.
|
|
17
|
+
*/
|
|
18
|
+
export declare const CARD_ENTRY_MIN_WIDTHS: Record<CardEntryInputName, number>;
|
|
19
|
+
/** Notional gap (px) between fields, summed into the reflow breakpoint. */
|
|
20
|
+
export declare const CARD_ENTRY_SLOT_GAP_PX = 8;
|
|
21
|
+
/** Field row height — matches the real form's `3rem` grid rows. */
|
|
22
|
+
export declare const CARD_ENTRY_ROW_HEIGHT = "3rem";
|
|
23
|
+
export declare const CARD_ENTRY_ROW_HEIGHT_PX = 48;
|
|
24
|
+
/** 1px accent line between rows / between exp & cvv in the two-row layout. */
|
|
25
|
+
export declare const CARD_ENTRY_DIVIDER_PX = 1;
|
|
26
|
+
/**
|
|
27
|
+
* The form draws its fields inside a 1px border, so the query container (the
|
|
28
|
+
* full iframe width) is 2px wider than the field row that `minRowWidth`
|
|
29
|
+
* describes. The breakpoint bakes this in so form and skeleton flip together.
|
|
30
|
+
*/
|
|
31
|
+
export declare const CARD_ENTRY_BORDER_PX = 1;
|
|
32
|
+
/**
|
|
33
|
+
* The form insets its box by this much on every side (Tailwind `m-0.5`) so the
|
|
34
|
+
* focus ring has room and isn't clipped at the iframe edge. It adds to the box's
|
|
35
|
+
* rendered height, so the skeleton's height guess includes it to avoid a jump
|
|
36
|
+
* when the loaded form replaces the skeleton.
|
|
37
|
+
*/
|
|
38
|
+
export declare const CARD_ENTRY_MARGIN_PX = 2;
|
|
39
|
+
export type CardEntryConfig = {
|
|
40
|
+
/** Mounted fields, in DOM/visual order. */
|
|
41
|
+
inputs: CardEntryInputName[];
|
|
42
|
+
/** Whether the animated card-brand icon renders left of the PAN slot. */
|
|
43
|
+
hasIcon?: boolean;
|
|
44
|
+
/** Whether the layout may drop to two rows when narrow (default true). */
|
|
45
|
+
allowTwoRow?: boolean;
|
|
46
|
+
};
|
|
47
|
+
export type CardEntryDivider = {
|
|
48
|
+
area: string;
|
|
49
|
+
orientation: 'v' | 'h';
|
|
50
|
+
};
|
|
51
|
+
export type CardEntryLayout = {
|
|
52
|
+
/** grid-template for the wide (inline) layout. */
|
|
53
|
+
inline: string;
|
|
54
|
+
/** grid-template for the narrow (two-row) layout, or null if it never reflows. */
|
|
55
|
+
twoRow: string | null;
|
|
56
|
+
/**
|
|
57
|
+
* Container width (px) below which the two-row layout applies, measured on the
|
|
58
|
+
* query container (full iframe width, incl. the form's border). Null when the
|
|
59
|
+
* config never reflows.
|
|
60
|
+
*/
|
|
61
|
+
breakpointPx: number | null;
|
|
62
|
+
/** grid-area names that hold a field, in DOM order (same in both layouts). */
|
|
63
|
+
fieldAreas: string[];
|
|
64
|
+
/** Whether an `icon` area is present (both layouts). */
|
|
65
|
+
hasIconArea: boolean;
|
|
66
|
+
/** Accent-line elements shown only in the two-row layout. */
|
|
67
|
+
twoRowDividers: CardEntryDivider[];
|
|
68
|
+
};
|
|
69
|
+
/** Resolve the full layout (templates + breakpoint + areas) for a config. */
|
|
70
|
+
export declare function buildCardEntryLayout({ inputs, hasIcon, allowTwoRow, }: CardEntryConfig): CardEntryLayout;
|
|
71
|
+
/**
|
|
72
|
+
* Container-query CSS that switches `gridSelector` between the inline and
|
|
73
|
+
* two-row templates at the layout's breakpoint. The element matched by
|
|
74
|
+
* `gridSelector` must be a descendant of a `container-type: inline-size`
|
|
75
|
+
* ancestor named `containerName`.
|
|
76
|
+
*
|
|
77
|
+
* `extraBaseRules` are emitted before the `@container` block (e.g. the default
|
|
78
|
+
* hidden state of two-row-only dividers); `extraCompactRules` are emitted inside
|
|
79
|
+
* it (e.g. revealing those dividers / hiding wide-only chrome). Keeping the base
|
|
80
|
+
* state first ensures the compact rules win when the query matches.
|
|
81
|
+
*/
|
|
82
|
+
export declare function buildCardEntryGridCss({ gridSelector, layout, containerName, extraBaseRules, extraCompactRules, }: {
|
|
83
|
+
gridSelector: string;
|
|
84
|
+
layout: CardEntryLayout;
|
|
85
|
+
containerName?: string;
|
|
86
|
+
extraBaseRules?: string;
|
|
87
|
+
extraCompactRules?: string;
|
|
88
|
+
}): string;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-agnostic definitions for the V2 card-form skeleton loader.
|
|
3
|
+
*
|
|
4
|
+
* The React, Vue, and Angular libraries all render the same skeleton while the
|
|
5
|
+
* card-form iframe loads. The grid templates and breakpoint come from the shared
|
|
6
|
+
* {@link buildCardEntryLayout} — the SAME source of truth the real form uses —
|
|
7
|
+
* so the skeleton reflows at exactly the width the loaded form does. Only the
|
|
8
|
+
* box styling and per-framework wiring live here.
|
|
9
|
+
*/
|
|
10
|
+
export type CardFormVariant = 'card-form' | 'card-number-form' | 'cvv-form';
|
|
11
|
+
export declare const INLINE_SKELETON_HEIGHT_PX: number;
|
|
12
|
+
/** Two-row layouts are a second field row plus the 1px divider taller. */
|
|
13
|
+
export declare const COMPACT_SKELETON_HEIGHT_PX: number;
|
|
14
|
+
export type SkeletonLayout = {
|
|
15
|
+
/** Single-row grid used at the iframe's default (wide) width. */
|
|
16
|
+
inline: string;
|
|
17
|
+
/** Two-row grid applied below `compactMaxWidthPx`; omitted when it never reflows. */
|
|
18
|
+
compact?: string;
|
|
19
|
+
/** Container width (px) below which the two-row grid applies. */
|
|
20
|
+
compactMaxWidthPx?: number;
|
|
21
|
+
/** grid-area names to render one skeleton box for, in DOM order (same in both layouts). */
|
|
22
|
+
areas: string[];
|
|
23
|
+
};
|
|
24
|
+
export declare const SKELETON_LAYOUTS: Record<CardFormVariant, SkeletonLayout>;
|
|
25
|
+
/** Name of the shared pulse keyframes; referenced by the box `animation`. */
|
|
26
|
+
export declare const SKELETON_PULSE_ANIMATION_NAME = "coinflow-card-form-skeleton-pulse";
|
|
27
|
+
/**
|
|
28
|
+
* Duration (ms) of the skeleton's opacity fade-out. Matches the `opacity 300ms`
|
|
29
|
+
* transition each renderer applies. Renderers unmount the skeleton on
|
|
30
|
+
* `transitionend`, but that event can be skipped (reduced-motion, an ancestor
|
|
31
|
+
* `display:none`, or opacity already 0) — so they also use this as a fallback
|
|
32
|
+
* timeout to force the unmount and avoid a stuck (invisible) skeleton.
|
|
33
|
+
*/
|
|
34
|
+
export declare const SKELETON_FADE_MS = 300;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the given container width would trigger the variant's two-row layout.
|
|
37
|
+
* Mirrors the real form's container query (`width < breakpoint`). Variants
|
|
38
|
+
* without a two-row layout never reflow.
|
|
39
|
+
*/
|
|
40
|
+
export declare function shouldStackSkeleton({ variant, width, }: {
|
|
41
|
+
variant: CardFormVariant;
|
|
42
|
+
width: number;
|
|
43
|
+
}): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Height to guess before the iframe reports its real height. The two-row layout
|
|
46
|
+
* is a field row plus divider taller than the inline one.
|
|
47
|
+
*/
|
|
48
|
+
export declare function guessSkeletonHeightPx({ variant, width, }: {
|
|
49
|
+
variant: CardFormVariant;
|
|
50
|
+
width: number;
|
|
51
|
+
}): number;
|
|
52
|
+
/**
|
|
53
|
+
* The `grid-template` to apply for the given container width. Frameworks that
|
|
54
|
+
* drive the layout from JS (Vue, Angular) call this from their resize observer;
|
|
55
|
+
* React instead injects a CSS container query via {@link buildSkeletonCss}.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getSkeletonGridTemplate({ variant, width, }: {
|
|
58
|
+
variant: CardFormVariant;
|
|
59
|
+
width: number;
|
|
60
|
+
}): string;
|
|
61
|
+
/** Stable class name for a variant's skeleton grid element. */
|
|
62
|
+
export declare function getSkeletonGridClass(variant: CardFormVariant): string;
|
|
63
|
+
/**
|
|
64
|
+
* CSS (keyframes + grid + container-query breakpoint) for the container-query
|
|
65
|
+
* driven renderer used by React, where the skeleton root is a query container.
|
|
66
|
+
*/
|
|
67
|
+
export declare function buildSkeletonCss(variant: CardFormVariant): string;
|
|
68
|
+
/**
|
|
69
|
+
* Padding (px) to inset the skeleton grid by, applied on the skeleton root. It
|
|
70
|
+
* equals the form's own chrome — its `m-0.5` margin plus 1px border — so the
|
|
71
|
+
* boxes land in the same area the real fields will, and the grid fills the root
|
|
72
|
+
* exactly (no dead space that would make the boxes look too short).
|
|
73
|
+
*/
|
|
74
|
+
export declare const SKELETON_ROOT_PADDING_PX: number;
|
|
75
|
+
/**
|
|
76
|
+
* Inline style for each skeleton box, MINUS the `background` — the fill color is
|
|
77
|
+
* theme-dependent (see {@link getSkeletonColors}) so each renderer merges it in.
|
|
78
|
+
* A hairline margin keeps a subtle gap between boxes while letting them fill
|
|
79
|
+
* nearly the full field height (the root padding handles the outer inset). Uses
|
|
80
|
+
* string units so it renders identically in React, Vue, and Angular.
|
|
81
|
+
*/
|
|
82
|
+
export declare const SKELETON_BOX_STYLE: {
|
|
83
|
+
readonly minWidth: "0";
|
|
84
|
+
readonly margin: "1px";
|
|
85
|
+
readonly borderRadius: "4px";
|
|
86
|
+
readonly opacity: "1";
|
|
87
|
+
readonly animation: "coinflow-card-form-skeleton-pulse 1.5s ease-in-out infinite";
|
|
88
|
+
};
|
|
89
|
+
export type SkeletonColors = {
|
|
90
|
+
/** Faint backdrop behind the boxes. */
|
|
91
|
+
backdrop: string;
|
|
92
|
+
/** Box fill. */
|
|
93
|
+
box: string;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Best-effort skeleton palette. The skeleton renders in the SDK (parent), so it
|
|
97
|
+
* can't see the form's resolved colors — it only has the optional `theme` the
|
|
98
|
+
* integrator passed. When `theme.background` is a parseable color we tint the
|
|
99
|
+
* skeleton light-on-dark or dark-on-light to match; otherwise we fall back to a
|
|
100
|
+
* neutral mid-grey that stays visible on any surface.
|
|
101
|
+
*/
|
|
102
|
+
export declare function getSkeletonColors(theme?: {
|
|
103
|
+
background?: string;
|
|
104
|
+
}): SkeletonColors;
|
|
@@ -4,6 +4,8 @@ export * from './CoinflowLibMessageHandlers';
|
|
|
4
4
|
export * from './EventBus';
|
|
5
5
|
export * from './card-form/TokenEx';
|
|
6
6
|
export * from './card-form/tokenexHelpers';
|
|
7
|
+
export * from './card-form/cardEntryLayout';
|
|
8
|
+
export * from './card-form/cardFormSkeleton';
|
|
7
9
|
export * from './types/Subtotal';
|
|
8
10
|
export * from './types/AnyObject';
|
|
9
11
|
export * from './types/giftCardCartItem';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { CardFormVariant, MerchantTheme } from '../lib/common';
|
|
1
2
|
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
2
|
-
|
|
3
|
+
tokenizer: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
|
|
3
4
|
args: {
|
|
4
5
|
type: import('vue').PropType<{
|
|
5
6
|
merchantId: string;
|
|
6
7
|
env?: import('..').CoinflowEnvs;
|
|
7
|
-
theme?:
|
|
8
|
-
variant:
|
|
8
|
+
theme?: MerchantTheme;
|
|
9
|
+
variant: CardFormVariant;
|
|
9
10
|
token?: string;
|
|
10
11
|
onLoad?: () => void;
|
|
11
12
|
}>;
|
|
@@ -14,8 +15,9 @@ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import
|
|
|
14
15
|
}>> & Readonly<{}>, {
|
|
15
16
|
tokenize: () => Promise<import('../components/card-form/CoinflowCardFormV2.vue').CardFormV2TokenResponse>;
|
|
16
17
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
18
|
+
wrapperRef: HTMLDivElement;
|
|
17
19
|
iframeRef: HTMLIFrameElement;
|
|
18
|
-
},
|
|
20
|
+
}, HTMLDivElement, import('vue').ComponentProvideOptions, {
|
|
19
21
|
P: {};
|
|
20
22
|
B: {};
|
|
21
23
|
D: {};
|
|
@@ -27,8 +29,8 @@ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import
|
|
|
27
29
|
type: import('vue').PropType<{
|
|
28
30
|
merchantId: string;
|
|
29
31
|
env?: import('..').CoinflowEnvs;
|
|
30
|
-
theme?:
|
|
31
|
-
variant:
|
|
32
|
+
theme?: MerchantTheme;
|
|
33
|
+
variant: CardFormVariant;
|
|
32
34
|
token?: string;
|
|
33
35
|
onLoad?: () => void;
|
|
34
36
|
}>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
2
|
+
export default _default;
|