@flash-pay/vue 0.1.0 → 2.0.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/dist/index.cjs.js +80 -1
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.mts +105 -0
- package/dist/index.d.ts +105 -3
- package/dist/index.es.js +46 -44
- package/dist/index.es.js.map +1 -0
- package/package.json +8 -8
- package/dist/FlashpayCheckout.test.d.ts +0 -1
- package/dist/FlashpayCheckout.vue.d.ts +0 -9
- package/dist/types.d.ts +0 -12
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1,80 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
FlashpayCheckout: () => FlashpayCheckout
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
|
|
27
|
+
// src/FlashpayCheckout.ts
|
|
28
|
+
var import_vue = require("vue");
|
|
29
|
+
var import_browser_sdk = require("@flash-pay/browser-sdk");
|
|
30
|
+
var FlashpayCheckout = (0, import_vue.defineComponent)({
|
|
31
|
+
name: "FlashpayCheckout",
|
|
32
|
+
props: {
|
|
33
|
+
transactionId: { type: String, required: true },
|
|
34
|
+
showTitle: { type: Boolean, default: true },
|
|
35
|
+
showDescription: { type: Boolean, default: true },
|
|
36
|
+
showAmount: { type: Boolean, default: true },
|
|
37
|
+
style: { type: Object, default: void 0 },
|
|
38
|
+
origin: { type: String, default: void 0 },
|
|
39
|
+
onSuccess: { type: Function, default: void 0 },
|
|
40
|
+
onFailure: { type: Function, default: void 0 },
|
|
41
|
+
onClose: { type: Function, default: void 0 }
|
|
42
|
+
},
|
|
43
|
+
setup(props) {
|
|
44
|
+
const containerRef = (0, import_vue.ref)(null);
|
|
45
|
+
let instance = null;
|
|
46
|
+
function init() {
|
|
47
|
+
instance?.destroy();
|
|
48
|
+
instance = null;
|
|
49
|
+
if (!containerRef.value) return;
|
|
50
|
+
instance = (0, import_browser_sdk.checkout)({
|
|
51
|
+
transactionId: props.transactionId,
|
|
52
|
+
container: containerRef.value,
|
|
53
|
+
showTitle: props.showTitle,
|
|
54
|
+
showDescription: props.showDescription,
|
|
55
|
+
showAmount: props.showAmount,
|
|
56
|
+
style: props.style,
|
|
57
|
+
origin: props.origin,
|
|
58
|
+
onSuccess: (data) => props.onSuccess?.(data),
|
|
59
|
+
onFailure: (data) => props.onFailure?.(data),
|
|
60
|
+
onClose: (data) => props.onClose?.(data)
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
(0, import_vue.onMounted)(init);
|
|
64
|
+
(0, import_vue.watch)(
|
|
65
|
+
() => [props.transactionId, props.showTitle, props.showDescription, props.showAmount, props.style, props.origin],
|
|
66
|
+
init,
|
|
67
|
+
{ deep: true }
|
|
68
|
+
);
|
|
69
|
+
(0, import_vue.onUnmounted)(() => {
|
|
70
|
+
instance?.destroy();
|
|
71
|
+
instance = null;
|
|
72
|
+
});
|
|
73
|
+
return () => (0, import_vue.h)("div", { ref: containerRef });
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
77
|
+
0 && (module.exports = {
|
|
78
|
+
FlashpayCheckout
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/FlashpayCheckout.ts"],"sourcesContent":["export { FlashpayCheckout } from \"./FlashpayCheckout\";\nexport type { FlashpayCheckoutProps } from \"./types\";\nexport type { PaymentEventData, PaymentData } from \"@flash-pay/browser-sdk\";\n","import { defineComponent, ref, watch, onMounted, onUnmounted, h, type PropType } from 'vue';\nimport { checkout } from '@flash-pay/browser-sdk';\nimport type { CheckoutInstance, PaymentEventData } from '@flash-pay/browser-sdk';\n\nexport const FlashpayCheckout = defineComponent({\n name: 'FlashpayCheckout',\n props: {\n transactionId: { type: String, required: true },\n showTitle: { type: Boolean, default: true },\n showDescription: { type: Boolean, default: true },\n showAmount: { type: Boolean, default: true },\n style: { type: Object as PropType<Partial<CSSStyleDeclaration>>, default: undefined },\n origin: { type: String, default: undefined },\n onSuccess: { type: Function as PropType<(data: PaymentEventData) => void>, default: undefined },\n onFailure: { type: Function as PropType<(data: PaymentEventData) => void>, default: undefined },\n onClose: { type: Function as PropType<(data: PaymentEventData) => void>, default: undefined },\n },\n setup(props) {\n const containerRef = ref<HTMLElement | null>(null);\n let instance: CheckoutInstance | null = null;\n\n function init() {\n instance?.destroy();\n instance = null;\n if (!containerRef.value) return;\n instance = checkout({\n transactionId: props.transactionId,\n container: containerRef.value,\n showTitle: props.showTitle,\n showDescription: props.showDescription,\n showAmount: props.showAmount,\n style: props.style,\n origin: props.origin,\n onSuccess: (data) => props.onSuccess?.(data),\n onFailure: (data) => props.onFailure?.(data),\n onClose: (data) => props.onClose?.(data),\n });\n }\n\n onMounted(init);\n\n // Re-init when any config prop changes; deep:true handles style object mutations\n watch(\n () => [props.transactionId, props.showTitle, props.showDescription, props.showAmount, props.style, props.origin],\n init,\n { deep: true },\n );\n\n onUnmounted(() => {\n instance?.destroy();\n instance = null;\n });\n\n return () => h('div', { ref: containerRef });\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAsF;AACtF,yBAAyB;AAGlB,IAAM,uBAAmB,4BAAgB;AAAA,EAC9C,MAAM;AAAA,EACN,OAAO;AAAA,IACL,eAAe,EAAE,MAAM,QAAQ,UAAU,KAAK;AAAA,IAC9C,WAAW,EAAE,MAAM,SAAS,SAAS,KAAK;AAAA,IAC1C,iBAAiB,EAAE,MAAM,SAAS,SAAS,KAAK;AAAA,IAChD,YAAY,EAAE,MAAM,SAAS,SAAS,KAAK;AAAA,IAC3C,OAAO,EAAE,MAAM,QAAkD,SAAS,OAAU;AAAA,IACpF,QAAQ,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA,IAC3C,WAAW,EAAE,MAAM,UAAwD,SAAS,OAAU;AAAA,IAC9F,WAAW,EAAE,MAAM,UAAwD,SAAS,OAAU;AAAA,IAC9F,SAAS,EAAE,MAAM,UAAwD,SAAS,OAAU;AAAA,EAC9F;AAAA,EACA,MAAM,OAAO;AACX,UAAM,mBAAe,gBAAwB,IAAI;AACjD,QAAI,WAAoC;AAExC,aAAS,OAAO;AACd,gBAAU,QAAQ;AAClB,iBAAW;AACX,UAAI,CAAC,aAAa,MAAO;AACzB,qBAAW,6BAAS;AAAA,QAClB,eAAe,MAAM;AAAA,QACrB,WAAW,aAAa;AAAA,QACxB,WAAW,MAAM;AAAA,QACjB,iBAAiB,MAAM;AAAA,QACvB,YAAY,MAAM;AAAA,QAClB,OAAO,MAAM;AAAA,QACb,QAAQ,MAAM;AAAA,QACd,WAAW,CAAC,SAAS,MAAM,YAAY,IAAI;AAAA,QAC3C,WAAW,CAAC,SAAS,MAAM,YAAY,IAAI;AAAA,QAC3C,SAAS,CAAC,SAAS,MAAM,UAAU,IAAI;AAAA,MACzC,CAAC;AAAA,IACH;AAEA,8BAAU,IAAI;AAGd;AAAA,MACE,MAAM,CAAC,MAAM,eAAe,MAAM,WAAW,MAAM,iBAAiB,MAAM,YAAY,MAAM,OAAO,MAAM,MAAM;AAAA,MAC/G;AAAA,MACA,EAAE,MAAM,KAAK;AAAA,IACf;AAEA,gCAAY,MAAM;AAChB,gBAAU,QAAQ;AAClB,iBAAW;AAAA,IACb,CAAC;AAED,WAAO,UAAM,cAAE,OAAO,EAAE,KAAK,aAAa,CAAC;AAAA,EAC7C;AACF,CAAC;","names":[]}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { PropType } from 'vue';
|
|
3
|
+
import { PaymentEventData } from '@flash-pay/browser-sdk';
|
|
4
|
+
export { PaymentData, PaymentEventData } from '@flash-pay/browser-sdk';
|
|
5
|
+
|
|
6
|
+
declare const FlashpayCheckout: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
7
|
+
transactionId: {
|
|
8
|
+
type: StringConstructor;
|
|
9
|
+
required: true;
|
|
10
|
+
};
|
|
11
|
+
showTitle: {
|
|
12
|
+
type: BooleanConstructor;
|
|
13
|
+
default: boolean;
|
|
14
|
+
};
|
|
15
|
+
showDescription: {
|
|
16
|
+
type: BooleanConstructor;
|
|
17
|
+
default: boolean;
|
|
18
|
+
};
|
|
19
|
+
showAmount: {
|
|
20
|
+
type: BooleanConstructor;
|
|
21
|
+
default: boolean;
|
|
22
|
+
};
|
|
23
|
+
style: {
|
|
24
|
+
type: PropType<Partial<CSSStyleDeclaration>>;
|
|
25
|
+
default: undefined;
|
|
26
|
+
};
|
|
27
|
+
origin: {
|
|
28
|
+
type: StringConstructor;
|
|
29
|
+
default: undefined;
|
|
30
|
+
};
|
|
31
|
+
onSuccess: {
|
|
32
|
+
type: PropType<(data: PaymentEventData) => void>;
|
|
33
|
+
default: undefined;
|
|
34
|
+
};
|
|
35
|
+
onFailure: {
|
|
36
|
+
type: PropType<(data: PaymentEventData) => void>;
|
|
37
|
+
default: undefined;
|
|
38
|
+
};
|
|
39
|
+
onClose: {
|
|
40
|
+
type: PropType<(data: PaymentEventData) => void>;
|
|
41
|
+
default: undefined;
|
|
42
|
+
};
|
|
43
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
46
|
+
transactionId: {
|
|
47
|
+
type: StringConstructor;
|
|
48
|
+
required: true;
|
|
49
|
+
};
|
|
50
|
+
showTitle: {
|
|
51
|
+
type: BooleanConstructor;
|
|
52
|
+
default: boolean;
|
|
53
|
+
};
|
|
54
|
+
showDescription: {
|
|
55
|
+
type: BooleanConstructor;
|
|
56
|
+
default: boolean;
|
|
57
|
+
};
|
|
58
|
+
showAmount: {
|
|
59
|
+
type: BooleanConstructor;
|
|
60
|
+
default: boolean;
|
|
61
|
+
};
|
|
62
|
+
style: {
|
|
63
|
+
type: PropType<Partial<CSSStyleDeclaration>>;
|
|
64
|
+
default: undefined;
|
|
65
|
+
};
|
|
66
|
+
origin: {
|
|
67
|
+
type: StringConstructor;
|
|
68
|
+
default: undefined;
|
|
69
|
+
};
|
|
70
|
+
onSuccess: {
|
|
71
|
+
type: PropType<(data: PaymentEventData) => void>;
|
|
72
|
+
default: undefined;
|
|
73
|
+
};
|
|
74
|
+
onFailure: {
|
|
75
|
+
type: PropType<(data: PaymentEventData) => void>;
|
|
76
|
+
default: undefined;
|
|
77
|
+
};
|
|
78
|
+
onClose: {
|
|
79
|
+
type: PropType<(data: PaymentEventData) => void>;
|
|
80
|
+
default: undefined;
|
|
81
|
+
};
|
|
82
|
+
}>> & Readonly<{}>, {
|
|
83
|
+
showTitle: boolean;
|
|
84
|
+
showDescription: boolean;
|
|
85
|
+
showAmount: boolean;
|
|
86
|
+
style: Partial<CSSStyleDeclaration>;
|
|
87
|
+
origin: string;
|
|
88
|
+
onSuccess: (data: PaymentEventData) => void;
|
|
89
|
+
onFailure: (data: PaymentEventData) => void;
|
|
90
|
+
onClose: (data: PaymentEventData) => void;
|
|
91
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
92
|
+
|
|
93
|
+
interface FlashpayCheckoutProps {
|
|
94
|
+
transactionId: string;
|
|
95
|
+
onSuccess?: (data: PaymentEventData) => void;
|
|
96
|
+
onFailure?: (data: PaymentEventData) => void;
|
|
97
|
+
onClose?: (data: PaymentEventData) => void;
|
|
98
|
+
showTitle?: boolean;
|
|
99
|
+
showDescription?: boolean;
|
|
100
|
+
showAmount?: boolean;
|
|
101
|
+
style?: Partial<CSSStyleDeclaration>;
|
|
102
|
+
origin?: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export { FlashpayCheckout, type FlashpayCheckoutProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { PropType } from 'vue';
|
|
3
|
+
import { PaymentEventData } from '@flash-pay/browser-sdk';
|
|
4
|
+
export { PaymentData, PaymentEventData } from '@flash-pay/browser-sdk';
|
|
5
|
+
|
|
6
|
+
declare const FlashpayCheckout: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
7
|
+
transactionId: {
|
|
8
|
+
type: StringConstructor;
|
|
9
|
+
required: true;
|
|
10
|
+
};
|
|
11
|
+
showTitle: {
|
|
12
|
+
type: BooleanConstructor;
|
|
13
|
+
default: boolean;
|
|
14
|
+
};
|
|
15
|
+
showDescription: {
|
|
16
|
+
type: BooleanConstructor;
|
|
17
|
+
default: boolean;
|
|
18
|
+
};
|
|
19
|
+
showAmount: {
|
|
20
|
+
type: BooleanConstructor;
|
|
21
|
+
default: boolean;
|
|
22
|
+
};
|
|
23
|
+
style: {
|
|
24
|
+
type: PropType<Partial<CSSStyleDeclaration>>;
|
|
25
|
+
default: undefined;
|
|
26
|
+
};
|
|
27
|
+
origin: {
|
|
28
|
+
type: StringConstructor;
|
|
29
|
+
default: undefined;
|
|
30
|
+
};
|
|
31
|
+
onSuccess: {
|
|
32
|
+
type: PropType<(data: PaymentEventData) => void>;
|
|
33
|
+
default: undefined;
|
|
34
|
+
};
|
|
35
|
+
onFailure: {
|
|
36
|
+
type: PropType<(data: PaymentEventData) => void>;
|
|
37
|
+
default: undefined;
|
|
38
|
+
};
|
|
39
|
+
onClose: {
|
|
40
|
+
type: PropType<(data: PaymentEventData) => void>;
|
|
41
|
+
default: undefined;
|
|
42
|
+
};
|
|
43
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
46
|
+
transactionId: {
|
|
47
|
+
type: StringConstructor;
|
|
48
|
+
required: true;
|
|
49
|
+
};
|
|
50
|
+
showTitle: {
|
|
51
|
+
type: BooleanConstructor;
|
|
52
|
+
default: boolean;
|
|
53
|
+
};
|
|
54
|
+
showDescription: {
|
|
55
|
+
type: BooleanConstructor;
|
|
56
|
+
default: boolean;
|
|
57
|
+
};
|
|
58
|
+
showAmount: {
|
|
59
|
+
type: BooleanConstructor;
|
|
60
|
+
default: boolean;
|
|
61
|
+
};
|
|
62
|
+
style: {
|
|
63
|
+
type: PropType<Partial<CSSStyleDeclaration>>;
|
|
64
|
+
default: undefined;
|
|
65
|
+
};
|
|
66
|
+
origin: {
|
|
67
|
+
type: StringConstructor;
|
|
68
|
+
default: undefined;
|
|
69
|
+
};
|
|
70
|
+
onSuccess: {
|
|
71
|
+
type: PropType<(data: PaymentEventData) => void>;
|
|
72
|
+
default: undefined;
|
|
73
|
+
};
|
|
74
|
+
onFailure: {
|
|
75
|
+
type: PropType<(data: PaymentEventData) => void>;
|
|
76
|
+
default: undefined;
|
|
77
|
+
};
|
|
78
|
+
onClose: {
|
|
79
|
+
type: PropType<(data: PaymentEventData) => void>;
|
|
80
|
+
default: undefined;
|
|
81
|
+
};
|
|
82
|
+
}>> & Readonly<{}>, {
|
|
83
|
+
showTitle: boolean;
|
|
84
|
+
showDescription: boolean;
|
|
85
|
+
showAmount: boolean;
|
|
86
|
+
style: Partial<CSSStyleDeclaration>;
|
|
87
|
+
origin: string;
|
|
88
|
+
onSuccess: (data: PaymentEventData) => void;
|
|
89
|
+
onFailure: (data: PaymentEventData) => void;
|
|
90
|
+
onClose: (data: PaymentEventData) => void;
|
|
91
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
92
|
+
|
|
93
|
+
interface FlashpayCheckoutProps {
|
|
94
|
+
transactionId: string;
|
|
95
|
+
onSuccess?: (data: PaymentEventData) => void;
|
|
96
|
+
onFailure?: (data: PaymentEventData) => void;
|
|
97
|
+
onClose?: (data: PaymentEventData) => void;
|
|
98
|
+
showTitle?: boolean;
|
|
99
|
+
showDescription?: boolean;
|
|
100
|
+
showAmount?: boolean;
|
|
101
|
+
style?: Partial<CSSStyleDeclaration>;
|
|
102
|
+
origin?: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export { FlashpayCheckout, type FlashpayCheckoutProps };
|
package/dist/index.es.js
CHANGED
|
@@ -1,51 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
// src/FlashpayCheckout.ts
|
|
2
|
+
import { defineComponent, ref, watch, onMounted, onUnmounted, h } from "vue";
|
|
3
|
+
import { checkout } from "@flash-pay/browser-sdk";
|
|
4
|
+
var FlashpayCheckout = defineComponent({
|
|
5
|
+
name: "FlashpayCheckout",
|
|
5
6
|
props: {
|
|
6
|
-
transactionId: {},
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
transactionId: { type: String, required: true },
|
|
8
|
+
showTitle: { type: Boolean, default: true },
|
|
9
|
+
showDescription: { type: Boolean, default: true },
|
|
10
|
+
showAmount: { type: Boolean, default: true },
|
|
11
|
+
style: { type: Object, default: void 0 },
|
|
12
|
+
origin: { type: String, default: void 0 },
|
|
13
|
+
onSuccess: { type: Function, default: void 0 },
|
|
14
|
+
onFailure: { type: Function, default: void 0 },
|
|
15
|
+
onClose: { type: Function, default: void 0 }
|
|
15
16
|
},
|
|
16
|
-
setup(
|
|
17
|
-
const
|
|
18
|
-
let
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
origin: e.origin,
|
|
36
|
-
onSuccess: (o) => a.value?.(o),
|
|
37
|
-
onFailure: (o) => c.value?.(o),
|
|
38
|
-
onClose: (o) => u.value?.(o)
|
|
39
|
-
}));
|
|
17
|
+
setup(props) {
|
|
18
|
+
const containerRef = ref(null);
|
|
19
|
+
let instance = null;
|
|
20
|
+
function init() {
|
|
21
|
+
instance?.destroy();
|
|
22
|
+
instance = null;
|
|
23
|
+
if (!containerRef.value) return;
|
|
24
|
+
instance = checkout({
|
|
25
|
+
transactionId: props.transactionId,
|
|
26
|
+
container: containerRef.value,
|
|
27
|
+
showTitle: props.showTitle,
|
|
28
|
+
showDescription: props.showDescription,
|
|
29
|
+
showAmount: props.showAmount,
|
|
30
|
+
style: props.style,
|
|
31
|
+
origin: props.origin,
|
|
32
|
+
onSuccess: (data) => props.onSuccess?.(data),
|
|
33
|
+
onFailure: (data) => props.onFailure?.(data),
|
|
34
|
+
onClose: (data) => props.onClose?.(data)
|
|
35
|
+
});
|
|
40
36
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
onMounted(init);
|
|
38
|
+
watch(
|
|
39
|
+
() => [props.transactionId, props.showTitle, props.showDescription, props.showAmount, props.style, props.origin],
|
|
40
|
+
init,
|
|
41
|
+
{ deep: true }
|
|
42
|
+
);
|
|
43
|
+
onUnmounted(() => {
|
|
44
|
+
instance?.destroy();
|
|
45
|
+
instance = null;
|
|
46
|
+
});
|
|
47
|
+
return () => h("div", { ref: containerRef });
|
|
47
48
|
}
|
|
48
49
|
});
|
|
49
50
|
export {
|
|
50
|
-
|
|
51
|
+
FlashpayCheckout
|
|
51
52
|
};
|
|
53
|
+
//# sourceMappingURL=index.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/FlashpayCheckout.ts"],"sourcesContent":["import { defineComponent, ref, watch, onMounted, onUnmounted, h, type PropType } from 'vue';\nimport { checkout } from '@flash-pay/browser-sdk';\nimport type { CheckoutInstance, PaymentEventData } from '@flash-pay/browser-sdk';\n\nexport const FlashpayCheckout = defineComponent({\n name: 'FlashpayCheckout',\n props: {\n transactionId: { type: String, required: true },\n showTitle: { type: Boolean, default: true },\n showDescription: { type: Boolean, default: true },\n showAmount: { type: Boolean, default: true },\n style: { type: Object as PropType<Partial<CSSStyleDeclaration>>, default: undefined },\n origin: { type: String, default: undefined },\n onSuccess: { type: Function as PropType<(data: PaymentEventData) => void>, default: undefined },\n onFailure: { type: Function as PropType<(data: PaymentEventData) => void>, default: undefined },\n onClose: { type: Function as PropType<(data: PaymentEventData) => void>, default: undefined },\n },\n setup(props) {\n const containerRef = ref<HTMLElement | null>(null);\n let instance: CheckoutInstance | null = null;\n\n function init() {\n instance?.destroy();\n instance = null;\n if (!containerRef.value) return;\n instance = checkout({\n transactionId: props.transactionId,\n container: containerRef.value,\n showTitle: props.showTitle,\n showDescription: props.showDescription,\n showAmount: props.showAmount,\n style: props.style,\n origin: props.origin,\n onSuccess: (data) => props.onSuccess?.(data),\n onFailure: (data) => props.onFailure?.(data),\n onClose: (data) => props.onClose?.(data),\n });\n }\n\n onMounted(init);\n\n // Re-init when any config prop changes; deep:true handles style object mutations\n watch(\n () => [props.transactionId, props.showTitle, props.showDescription, props.showAmount, props.style, props.origin],\n init,\n { deep: true },\n );\n\n onUnmounted(() => {\n instance?.destroy();\n instance = null;\n });\n\n return () => h('div', { ref: containerRef });\n },\n});\n"],"mappings":";AAAA,SAAS,iBAAiB,KAAK,OAAO,WAAW,aAAa,SAAwB;AACtF,SAAS,gBAAgB;AAGlB,IAAM,mBAAmB,gBAAgB;AAAA,EAC9C,MAAM;AAAA,EACN,OAAO;AAAA,IACL,eAAe,EAAE,MAAM,QAAQ,UAAU,KAAK;AAAA,IAC9C,WAAW,EAAE,MAAM,SAAS,SAAS,KAAK;AAAA,IAC1C,iBAAiB,EAAE,MAAM,SAAS,SAAS,KAAK;AAAA,IAChD,YAAY,EAAE,MAAM,SAAS,SAAS,KAAK;AAAA,IAC3C,OAAO,EAAE,MAAM,QAAkD,SAAS,OAAU;AAAA,IACpF,QAAQ,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA,IAC3C,WAAW,EAAE,MAAM,UAAwD,SAAS,OAAU;AAAA,IAC9F,WAAW,EAAE,MAAM,UAAwD,SAAS,OAAU;AAAA,IAC9F,SAAS,EAAE,MAAM,UAAwD,SAAS,OAAU;AAAA,EAC9F;AAAA,EACA,MAAM,OAAO;AACX,UAAM,eAAe,IAAwB,IAAI;AACjD,QAAI,WAAoC;AAExC,aAAS,OAAO;AACd,gBAAU,QAAQ;AAClB,iBAAW;AACX,UAAI,CAAC,aAAa,MAAO;AACzB,iBAAW,SAAS;AAAA,QAClB,eAAe,MAAM;AAAA,QACrB,WAAW,aAAa;AAAA,QACxB,WAAW,MAAM;AAAA,QACjB,iBAAiB,MAAM;AAAA,QACvB,YAAY,MAAM;AAAA,QAClB,OAAO,MAAM;AAAA,QACb,QAAQ,MAAM;AAAA,QACd,WAAW,CAAC,SAAS,MAAM,YAAY,IAAI;AAAA,QAC3C,WAAW,CAAC,SAAS,MAAM,YAAY,IAAI;AAAA,QAC3C,SAAS,CAAC,SAAS,MAAM,UAAU,IAAI;AAAA,MACzC,CAAC;AAAA,IACH;AAEA,cAAU,IAAI;AAGd;AAAA,MACE,MAAM,CAAC,MAAM,eAAe,MAAM,WAAW,MAAM,iBAAiB,MAAM,YAAY,MAAM,OAAO,MAAM,MAAM;AAAA,MAC/G;AAAA,MACA,EAAE,MAAM,KAAK;AAAA,IACf;AAEA,gBAAY,MAAM;AAChB,gBAAU,QAAQ;AAClB,iBAAW;AAAA,IACb,CAAC;AAED,WAAO,MAAM,EAAE,OAAO,EAAE,KAAK,aAAa,CAAC;AAAA,EAC7C;AACF,CAAC;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flash-pay/vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Vue 3 component for Flashpay checkout",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
10
11
|
"import": "./dist/index.es.js",
|
|
11
|
-
"require": "./dist/index.cjs.js"
|
|
12
|
-
"types": "./dist/index.d.ts"
|
|
12
|
+
"require": "./dist/index.cjs.js"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"sideEffects": false,
|
|
16
|
-
"files": [
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
17
19
|
"scripts": {
|
|
18
|
-
"build": "
|
|
20
|
+
"build": "tsup",
|
|
19
21
|
"test": "vitest run",
|
|
20
22
|
"test:watch": "vitest"
|
|
21
23
|
},
|
|
@@ -25,10 +27,8 @@
|
|
|
25
27
|
},
|
|
26
28
|
"devDependencies": {
|
|
27
29
|
"@flash-pay/browser-sdk": "workspace:*",
|
|
28
|
-
"@vitejs/plugin-vue": "^5.2.4",
|
|
29
30
|
"@vue/test-utils": "^2.4.6",
|
|
30
|
-
"
|
|
31
|
-
"vite-plugin-dts": "^4.5.4",
|
|
31
|
+
"tsup": "^8.5.0",
|
|
32
32
|
"vitest": "^3.2.4",
|
|
33
33
|
"jsdom": "^26.1.0",
|
|
34
34
|
"vue": "^3.5.17",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FlashpayCheckoutProps } from './types';
|
|
2
|
-
declare const _default: import('vue').DefineComponent<FlashpayCheckoutProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FlashpayCheckoutProps> & Readonly<{}>, {
|
|
3
|
-
showTitle: boolean;
|
|
4
|
-
showDescription: boolean;
|
|
5
|
-
showAmount: boolean;
|
|
6
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
7
|
-
containerRef: HTMLDivElement;
|
|
8
|
-
}, HTMLDivElement>;
|
|
9
|
-
export default _default;
|
package/dist/types.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PaymentEventData } from '@flash-pay/browser-sdk';
|
|
2
|
-
export interface FlashpayCheckoutProps {
|
|
3
|
-
transactionId: string;
|
|
4
|
-
onSuccess?: (data: PaymentEventData) => void;
|
|
5
|
-
onFailure?: (data: PaymentEventData) => void;
|
|
6
|
-
onClose?: (data: PaymentEventData) => void;
|
|
7
|
-
showTitle?: boolean;
|
|
8
|
-
showDescription?: boolean;
|
|
9
|
-
showAmount?: boolean;
|
|
10
|
-
style?: Partial<CSSStyleDeclaration>;
|
|
11
|
-
origin?: string;
|
|
12
|
-
}
|