@leaflink/stash 48.5.0 → 48.6.1
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/DataViewToolbar.js +39 -36
- package/dist/DataViewToolbar.js.map +1 -1
- package/dist/PlaidLink.js +37 -44
- package/dist/PlaidLink.js.map +1 -1
- package/dist/PlaidLink.vue.d.ts +3 -5
- package/dist/Table.js +52 -50
- package/dist/Table.js.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/usePlaidLink.d.ts +19 -0
- package/dist/usePlaidLink.js +42 -0
- package/dist/usePlaidLink.js.map +1 -0
- package/dist/useScriptTag.d.ts +21 -0
- package/dist/useScriptTag.js +19 -0
- package/dist/useScriptTag.js.map +1 -0
- package/package.json +1 -1
- package/types/index.ts +1 -0
- package/types/plaid.ts +7 -0
package/dist/DataViewToolbar.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { t as
|
|
1
|
+
import { defineComponent as M, inject as $, ref as j, computed as x, onBeforeMount as z, openBlock as a, createElementBlock as n, normalizeClass as U, unref as e, createElementVNode as k, createBlock as W, createCommentVNode as s, renderSlot as F, toDisplayString as J, Fragment as K, createVNode as r, withCtx as y } from "vue";
|
|
2
|
+
import { t as S } from "./locale.js";
|
|
3
3
|
import _ from "./Button.js";
|
|
4
|
-
import
|
|
4
|
+
import L from "./Checkbox.js";
|
|
5
5
|
import "lodash-es/cloneDeep";
|
|
6
6
|
import C from "./Icon.js";
|
|
7
7
|
import "./Paginate.vue_used_vue_type_style_index_0_lang.module-18343da7.js";
|
|
@@ -14,13 +14,13 @@ import "lodash-es/uniqueId";
|
|
|
14
14
|
import "./Checkbox.vue_used_vue_type_style_index_0_lang.module-fa8d9c06.js";
|
|
15
15
|
import "./index-79ce320f.js";
|
|
16
16
|
import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
|
|
17
|
-
const
|
|
17
|
+
const O = { class: "tw-flex tw-place-items-center" }, q = { class: "tw-flex tw-items-center tw-gap-x-2 lg:tw-gap-x-6" }, G = {
|
|
18
18
|
key: 0,
|
|
19
19
|
class: "tw-flex tw-items-center"
|
|
20
|
-
},
|
|
20
|
+
}, H = {
|
|
21
21
|
key: 0,
|
|
22
22
|
class: "tw-mr-1.5 tw-text-xs"
|
|
23
|
-
},
|
|
23
|
+
}, me = /* @__PURE__ */ M({
|
|
24
24
|
__name: "DataViewToolbar",
|
|
25
25
|
props: {
|
|
26
26
|
allRowsSelected: { type: Boolean, default: !1 },
|
|
@@ -42,73 +42,76 @@ const K = { class: "tw-flex tw-place-items-center" }, O = { class: "tw-flex tw-i
|
|
|
42
42
|
pageSize: f,
|
|
43
43
|
totalDataCount: v,
|
|
44
44
|
goPrevPage: R,
|
|
45
|
-
goNextPage: D
|
|
46
|
-
|
|
45
|
+
goNextPage: D,
|
|
46
|
+
isEmpty: I,
|
|
47
|
+
isLoading: T
|
|
48
|
+
} = $(B.key, B.defaults), b = j(0), g = x(() => i.value ? "none" : u.value === "table" ? "rounded-top" : o.radius), A = x(() => {
|
|
47
49
|
const d = f.value * (l.value - 1) + 1, t = Math.min(f.value * l.value, v.value), c = v.value;
|
|
48
|
-
return
|
|
50
|
+
return S("ll.pageStats", { from: d, to: t, total: c });
|
|
49
51
|
});
|
|
50
|
-
function
|
|
51
|
-
P("select"),
|
|
52
|
+
function h() {
|
|
53
|
+
P("select"), b.value++;
|
|
52
54
|
}
|
|
53
|
-
return
|
|
55
|
+
return z(() => {
|
|
54
56
|
p && (p.value = !0);
|
|
55
57
|
}), (d, t) => (a(), n("div", {
|
|
56
|
-
class:
|
|
58
|
+
class: U(["stash-data-view-toolbar tw-flex tw-min-h-15 tw-items-center tw-justify-between tw-bg-white tw-py-1.5", {
|
|
57
59
|
"tw-border-t tw-border-ice-200": e(i),
|
|
58
|
-
"tw-rounded":
|
|
59
|
-
"tw-rounded-t":
|
|
60
|
+
"tw-rounded": g.value === "rounded",
|
|
61
|
+
"tw-rounded-t": g.value === "rounded-top",
|
|
60
62
|
"tw-mb-3": e(u) !== "table" && !e(i),
|
|
61
63
|
"tw-px-0": e(m) === "compact",
|
|
62
64
|
"lg:tw-px-3": e(m) === "comfortable"
|
|
63
65
|
}]),
|
|
64
66
|
"data-test": "stash-data-view-toolbar"
|
|
65
67
|
}, [
|
|
66
|
-
k("div",
|
|
67
|
-
e(N) ? (a(),
|
|
68
|
-
key:
|
|
68
|
+
k("div", O, [
|
|
69
|
+
e(N) && !e(I) ? (a(), W(L, {
|
|
70
|
+
key: b.value,
|
|
69
71
|
checked: o.allRowsSelected,
|
|
70
72
|
indeterminate: o.someRowsSelected && !o.allRowsSelected,
|
|
71
|
-
title: e(
|
|
72
|
-
|
|
73
|
-
"onUpdate:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
title: e(S)("ll.selectAll"),
|
|
74
|
+
disabled: e(T),
|
|
75
|
+
"onUpdate:indeterminate": h,
|
|
76
|
+
"onUpdate:checked": h
|
|
77
|
+
}, null, 8, ["checked", "indeterminate", "title", "disabled"])) : s("", !0),
|
|
78
|
+
k("div", q, [
|
|
79
|
+
F(d.$slots, "default")
|
|
77
80
|
])
|
|
78
81
|
]),
|
|
79
|
-
e(V) ? (a(), n("div",
|
|
80
|
-
o.hidePageStats ?
|
|
81
|
-
e(w) > 1 ? (a(), n(
|
|
82
|
-
|
|
82
|
+
e(V) ? (a(), n("div", G, [
|
|
83
|
+
o.hidePageStats ? s("", !0) : (a(), n("span", H, J(A.value), 1)),
|
|
84
|
+
e(w) > 1 ? (a(), n(K, { key: 1 }, [
|
|
85
|
+
r(_, {
|
|
83
86
|
icon: "",
|
|
84
87
|
class: "tw-h-9 tw-w-9 tw-p-1.5",
|
|
85
88
|
"data-test": "button|prev-page",
|
|
86
89
|
disabled: e(l) === 1,
|
|
87
90
|
onClick: t[0] || (t[0] = (c) => e(R)({ shouldEmit: !0 }))
|
|
88
91
|
}, {
|
|
89
|
-
default:
|
|
90
|
-
|
|
92
|
+
default: y(() => [
|
|
93
|
+
r(C, { name: "chevron-left" })
|
|
91
94
|
]),
|
|
92
95
|
_: 1
|
|
93
96
|
}, 8, ["disabled"]),
|
|
94
|
-
|
|
97
|
+
r(_, {
|
|
95
98
|
icon: "",
|
|
96
99
|
class: "tw-h-9 tw-w-9 tw-p-1.5",
|
|
97
100
|
"data-test": "button|next-page",
|
|
98
101
|
disabled: e(l) === e(w),
|
|
99
102
|
onClick: t[1] || (t[1] = (c) => e(D)({ shouldEmit: !0 }))
|
|
100
103
|
}, {
|
|
101
|
-
default:
|
|
102
|
-
|
|
104
|
+
default: y(() => [
|
|
105
|
+
r(C, { name: "chevron-right" })
|
|
103
106
|
]),
|
|
104
107
|
_: 1
|
|
105
108
|
}, 8, ["disabled"])
|
|
106
|
-
], 64)) :
|
|
107
|
-
])) :
|
|
109
|
+
], 64)) : s("", !0)
|
|
110
|
+
])) : s("", !0)
|
|
108
111
|
], 2));
|
|
109
112
|
}
|
|
110
113
|
});
|
|
111
114
|
export {
|
|
112
|
-
|
|
115
|
+
me as default
|
|
113
116
|
};
|
|
114
117
|
//# sourceMappingURL=DataViewToolbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataViewToolbar.js","sources":["../src/components/DataViewToolbar/DataViewToolbar.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, inject, onBeforeMount, ref } from 'vue';\n\n import { t } from '../../locale';\n import Button from '../Button/Button.vue';\n import Checkbox from '../Checkbox/Checkbox.vue';\n import { DATA_VIEW_INJECTION } from '../DataView/DataView.vue';\n import Icon from '../Icon/Icon.vue';\n import { ToolbarRadiuses } from './DataViewToolbar.types';\n\n export interface DataViewToolbarProps {\n /**\n * When DataView has `variant=\"table\"` and Table has `is-selectable` enabled, it provides a way to flag\n * a checkbox whenever all rows are selected, just like the standalone version on TableHeaderRow.\n */\n allRowsSelected?: boolean;\n\n /**\n * Hides the page statistics (ex: \"1 - 12 of 20\") in the toolbar\n */\n hidePageStats?: boolean;\n\n /**\n * Controls the corners of DataViewToolbar with the \"border-radius\" CSS property. The default value is \"rounded\".\n */\n radius?: ToolbarRadiuses;\n\n /**\n * When DataView has variant=\"table\" and Table has `is-selectable` enabled, it provides a way to flag\n * a checkbox whenever one or more, but not all rows are selected, just like the standalone\n * version on TableHeaderRow.\n */\n someRowsSelected?: boolean;\n }\n\n const props = withDefaults(defineProps<DataViewToolbarProps>(), {\n allRowsSelected: false,\n hidePageStats: false,\n radius: 'rounded',\n someRowsSelected: false,\n });\n\n const emit =\n defineEmits<{\n (e: 'select'): void;\n }>();\n\n const {\n isWithinModule,\n variant: dataViewVariant,\n density,\n currentPage,\n hasToolbar,\n isPaginationEnabled,\n isSelectable,\n pageCount,\n pageSize,\n totalDataCount,\n goPrevPage,\n goNextPage,\n } = inject(DATA_VIEW_INJECTION.key, DATA_VIEW_INJECTION.defaults);\n\n const checkboxKey = ref(0);\n\n const computedRadius = computed<ToolbarRadiuses>(() => {\n if (isWithinModule.value) {\n return 'none';\n }\n\n if (dataViewVariant.value === 'table') {\n return 'rounded-top';\n }\n\n return props.radius;\n });\n\n // #region pagination\n const pageStats = computed(() => {\n const from = pageSize.value * (currentPage.value - 1) + 1;\n const to = Math.min(pageSize.value * currentPage.value, totalDataCount.value);\n const total = totalDataCount.value;\n\n return t('ll.pageStats', { from, to, total });\n });\n // #endregion pagination\n\n function onSelect() {\n emit('select');\n\n /**\n * In Vue (as of this writing), if a user checks a native checkbox but the v-model is `false` and does not change from `false`, then the checkbox will display as checked even though the v-model is still `false`.\n * Forcing a re-render with a `key` change allows the checkbox to stay unchecked if its v-model is still `false` and its v-model not been changed.\n * To verify that this is necessary, test the \"select all\" checkbox in the SelectionWithSomeDisabled story in Table.story.ts with and without the `key` attribute.\n */\n checkboxKey.value++;\n }\n\n onBeforeMount(() => {\n if (hasToolbar) {\n hasToolbar.value = true;\n }\n });\n</script>\n\n<template>\n <div\n class=\"stash-data-view-toolbar tw-flex tw-min-h-15 tw-items-center tw-justify-between tw-bg-white tw-py-1.5\"\n :class=\"{\n 'tw-border-t tw-border-ice-200': isWithinModule,\n 'tw-rounded': computedRadius === 'rounded',\n 'tw-rounded-t': computedRadius === 'rounded-top',\n 'tw-mb-3': dataViewVariant !== 'table' && !isWithinModule,\n 'tw-px-0': density === 'compact',\n 'lg:tw-px-3': density === 'comfortable',\n }\"\n data-test=\"stash-data-view-toolbar\"\n >\n <div class=\"tw-flex tw-place-items-center\">\n <Checkbox\n v-if=\"isSelectable\"\n :key=\"checkboxKey\"\n :checked=\"props.allRowsSelected\"\n :indeterminate=\"props.someRowsSelected && !props.allRowsSelected\"\n :title=\"t('ll.selectAll')\"\n @update:indeterminate=\"onSelect\"\n @update:checked=\"onSelect\"\n />\n <div class=\"tw-flex tw-items-center tw-gap-x-2 lg:tw-gap-x-6\">\n <!-- @slot default -->\n <slot></slot>\n </div>\n </div>\n\n <!-- Pagination -->\n <div v-if=\"isPaginationEnabled\" class=\"tw-flex tw-items-center\">\n <span v-if=\"!props.hidePageStats\" class=\"tw-mr-1.5 tw-text-xs\">\n {{ pageStats }}\n </span>\n <template v-if=\"pageCount > 1\">\n <Button\n icon\n class=\"tw-h-9 tw-w-9 tw-p-1.5\"\n data-test=\"button|prev-page\"\n :disabled=\"currentPage === 1\"\n @click=\"goPrevPage({ shouldEmit: true })\"\n >\n <Icon name=\"chevron-left\" />\n </Button>\n <Button\n icon\n class=\"tw-h-9 tw-w-9 tw-p-1.5\"\n data-test=\"button|next-page\"\n :disabled=\"currentPage === pageCount\"\n @click=\"goNextPage({ shouldEmit: true })\"\n >\n <Icon name=\"chevron-right\" />\n </Button>\n </template>\n </div>\n </div>\n</template>\n"],"names":["isWithinModule","dataViewVariant","density","currentPage","hasToolbar","isPaginationEnabled","isSelectable","pageCount","pageSize","totalDataCount","goPrevPage","goNextPage","inject","DATA_VIEW_INJECTION","checkboxKey","ref","computedRadius","computed","props","pageStats","from","to","total","t","onSelect","emit","onBeforeMount"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+CQ;AAAA,MACJ,gBAAAA;AAAA,MACA,SAASC;AAAA,MACT,SAAAC;AAAA,MACA,aAAAC;AAAA,MACA,YAAAC;AAAA,MACA,qBAAAC;AAAA,MACA,cAAAC;AAAA,MACA,WAAAC;AAAA,MACA,UAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,YAAAC;AAAA,MACA,YAAAC;AAAA,IACE,IAAAC,EAAOC,EAAoB,KAAKA,EAAoB,QAAQ,GAE1DC,IAAcC,EAAI,CAAC,GAEnBC,IAAiBC,EAA0B,
|
|
1
|
+
{"version":3,"file":"DataViewToolbar.js","sources":["../src/components/DataViewToolbar/DataViewToolbar.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, inject, onBeforeMount, ref } from 'vue';\n\n import { t } from '../../locale';\n import Button from '../Button/Button.vue';\n import Checkbox from '../Checkbox/Checkbox.vue';\n import { DATA_VIEW_INJECTION } from '../DataView/DataView.vue';\n import Icon from '../Icon/Icon.vue';\n import { ToolbarRadiuses } from './DataViewToolbar.types';\n\n export interface DataViewToolbarProps {\n /**\n * When DataView has `variant=\"table\"` and Table has `is-selectable` enabled, it provides a way to flag\n * a checkbox whenever all rows are selected, just like the standalone version on TableHeaderRow.\n */\n allRowsSelected?: boolean;\n\n /**\n * Hides the page statistics (ex: \"1 - 12 of 20\") in the toolbar\n */\n hidePageStats?: boolean;\n\n /**\n * Controls the corners of DataViewToolbar with the \"border-radius\" CSS property. The default value is \"rounded\".\n */\n radius?: ToolbarRadiuses;\n\n /**\n * When DataView has variant=\"table\" and Table has `is-selectable` enabled, it provides a way to flag\n * a checkbox whenever one or more, but not all rows are selected, just like the standalone\n * version on TableHeaderRow.\n */\n someRowsSelected?: boolean;\n }\n\n const props = withDefaults(defineProps<DataViewToolbarProps>(), {\n allRowsSelected: false,\n hidePageStats: false,\n radius: 'rounded',\n someRowsSelected: false,\n });\n\n const emit =\n defineEmits<{\n (e: 'select'): void;\n }>();\n\n const {\n isWithinModule,\n variant: dataViewVariant,\n density,\n currentPage,\n hasToolbar,\n isPaginationEnabled,\n isSelectable,\n pageCount,\n pageSize,\n totalDataCount,\n goPrevPage,\n goNextPage,\n isEmpty,\n isLoading,\n } = inject(DATA_VIEW_INJECTION.key, DATA_VIEW_INJECTION.defaults);\n\n const checkboxKey = ref(0);\n\n const computedRadius = computed<ToolbarRadiuses>(() => {\n if (isWithinModule.value) {\n return 'none';\n }\n\n if (dataViewVariant.value === 'table') {\n return 'rounded-top';\n }\n\n return props.radius;\n });\n\n // #region pagination\n const pageStats = computed(() => {\n const from = pageSize.value * (currentPage.value - 1) + 1;\n const to = Math.min(pageSize.value * currentPage.value, totalDataCount.value);\n const total = totalDataCount.value;\n\n return t('ll.pageStats', { from, to, total });\n });\n // #endregion pagination\n\n function onSelect() {\n emit('select');\n\n /**\n * In Vue (as of this writing), if a user checks a native checkbox but the v-model is `false` and does not change from `false`, then the checkbox will display as checked even though the v-model is still `false`.\n * Forcing a re-render with a `key` change allows the checkbox to stay unchecked if its v-model is still `false` and its v-model not been changed.\n * To verify that this is necessary, test the \"select all\" checkbox in the SelectionWithSomeDisabled story in Table.story.ts with and without the `key` attribute.\n */\n checkboxKey.value++;\n }\n\n onBeforeMount(() => {\n if (hasToolbar) {\n hasToolbar.value = true;\n }\n });\n</script>\n\n<template>\n <div\n class=\"stash-data-view-toolbar tw-flex tw-min-h-15 tw-items-center tw-justify-between tw-bg-white tw-py-1.5\"\n :class=\"{\n 'tw-border-t tw-border-ice-200': isWithinModule,\n 'tw-rounded': computedRadius === 'rounded',\n 'tw-rounded-t': computedRadius === 'rounded-top',\n 'tw-mb-3': dataViewVariant !== 'table' && !isWithinModule,\n 'tw-px-0': density === 'compact',\n 'lg:tw-px-3': density === 'comfortable',\n }\"\n data-test=\"stash-data-view-toolbar\"\n >\n <div class=\"tw-flex tw-place-items-center\">\n <Checkbox\n v-if=\"isSelectable && !isEmpty\"\n :key=\"checkboxKey\"\n :checked=\"props.allRowsSelected\"\n :indeterminate=\"props.someRowsSelected && !props.allRowsSelected\"\n :title=\"t('ll.selectAll')\"\n :disabled=\"isLoading\"\n @update:indeterminate=\"onSelect\"\n @update:checked=\"onSelect\"\n />\n <div class=\"tw-flex tw-items-center tw-gap-x-2 lg:tw-gap-x-6\">\n <!-- @slot default -->\n <slot></slot>\n </div>\n </div>\n\n <!-- Pagination -->\n <div v-if=\"isPaginationEnabled\" class=\"tw-flex tw-items-center\">\n <span v-if=\"!props.hidePageStats\" class=\"tw-mr-1.5 tw-text-xs\">\n {{ pageStats }}\n </span>\n <template v-if=\"pageCount > 1\">\n <Button\n icon\n class=\"tw-h-9 tw-w-9 tw-p-1.5\"\n data-test=\"button|prev-page\"\n :disabled=\"currentPage === 1\"\n @click=\"goPrevPage({ shouldEmit: true })\"\n >\n <Icon name=\"chevron-left\" />\n </Button>\n <Button\n icon\n class=\"tw-h-9 tw-w-9 tw-p-1.5\"\n data-test=\"button|next-page\"\n :disabled=\"currentPage === pageCount\"\n @click=\"goNextPage({ shouldEmit: true })\"\n >\n <Icon name=\"chevron-right\" />\n </Button>\n </template>\n </div>\n </div>\n</template>\n"],"names":["isWithinModule","dataViewVariant","density","currentPage","hasToolbar","isPaginationEnabled","isSelectable","pageCount","pageSize","totalDataCount","goPrevPage","goNextPage","isEmpty","isLoading","inject","DATA_VIEW_INJECTION","checkboxKey","ref","computedRadius","computed","props","pageStats","from","to","total","t","onSelect","emit","onBeforeMount"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+CQ;AAAA,MACJ,gBAAAA;AAAA,MACA,SAASC;AAAA,MACT,SAAAC;AAAA,MACA,aAAAC;AAAA,MACA,YAAAC;AAAA,MACA,qBAAAC;AAAA,MACA,cAAAC;AAAA,MACA,WAAAC;AAAA,MACA,UAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,YAAAC;AAAA,MACA,YAAAC;AAAA,MACA,SAAAC;AAAA,MACA,WAAAC;AAAA,IACE,IAAAC,EAAOC,EAAoB,KAAKA,EAAoB,QAAQ,GAE1DC,IAAcC,EAAI,CAAC,GAEnBC,IAAiBC,EAA0B,MAC3CnB,EAAe,QACV,SAGLC,EAAgB,UAAU,UACrB,gBAGFmB,EAAM,MACd,GAGKC,IAAYF,EAAS,MAAM;AAC/B,YAAMG,IAAOd,EAAS,SAASL,EAAY,QAAQ,KAAK,GAClDoB,IAAK,KAAK,IAAIf,EAAS,QAAQL,EAAY,OAAOM,EAAe,KAAK,GACtEe,IAAQf,EAAe;AAE7B,aAAOgB,EAAE,gBAAgB,EAAE,MAAAH,GAAM,IAAAC,GAAI,OAAAC,GAAO;AAAA,IAAA,CAC7C;AAGD,aAASE,IAAW;AAClB,MAAAC,EAAK,QAAQ,GAODX,EAAA;AAAA,IACd;AAEA,WAAAY,EAAc,MAAM;AAClB,MAAIxB,MACFA,EAAW,QAAQ;AAAA,IACrB,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/PlaidLink.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { defineComponent as m, computed as y, ref as c, openBlock as h, createElementBlock as E, renderSlot as w } from "vue";
|
|
2
|
+
import i from "@leaflink/snitch";
|
|
3
|
+
import x from "./usePlaidLink.js";
|
|
4
|
+
import "./useScriptTag.js";
|
|
5
|
+
const L = /* @__PURE__ */ m({
|
|
4
6
|
__name: "PlaidLink",
|
|
5
7
|
props: {
|
|
6
8
|
initScriptUrl: { default: "https://cdn.plaid.com/link/v2/stable/link-initialize.js" },
|
|
@@ -11,67 +13,58 @@ const _ = /* @__PURE__ */ y({
|
|
|
11
13
|
createToken: { type: Function, default: void 0 }
|
|
12
14
|
},
|
|
13
15
|
emits: ["error", "success", "exit", "load", "event"],
|
|
14
|
-
setup(
|
|
15
|
-
const
|
|
16
|
-
|
|
16
|
+
setup(u, { expose: d, emit: n }) {
|
|
17
|
+
const o = u, s = y(() => o.storageKey ? o.storageKey : `${window.location.host.split(".").splice(-3).join(".")}-plaid`), r = c(!1), p = (e, t) => {
|
|
18
|
+
r.value = !1, e && (i.error(new Error("Plaid: Error trying to link an account"), {
|
|
17
19
|
tags: { plaid: !0 },
|
|
18
20
|
extra: { PlaidError: e }
|
|
19
|
-
}), n("error", e,
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
}), n("error", e, t)), sessionStorage.removeItem(s.value), n("exit", t);
|
|
22
|
+
}, f = (e, t) => {
|
|
23
|
+
r.value = !1, sessionStorage.removeItem(s.value), n("success", e, t);
|
|
24
|
+
}, k = (...e) => n("load", ...e), v = (...e) => n("event", ...e), a = c({
|
|
25
|
+
env: o.env,
|
|
26
|
+
onSuccess: f,
|
|
27
|
+
onEvent: v,
|
|
28
|
+
onLoad: k,
|
|
29
|
+
onExit: p
|
|
30
|
+
}), { open: g } = x(a);
|
|
31
|
+
async function l() {
|
|
32
|
+
if (r.value !== !0) {
|
|
33
|
+
if (r.value = !0, typeof o.createToken == "function")
|
|
26
34
|
try {
|
|
27
|
-
const { link_token: e } = await
|
|
28
|
-
|
|
35
|
+
const { link_token: e } = await o.createToken();
|
|
36
|
+
a.value.token = e;
|
|
29
37
|
} catch (e) {
|
|
30
|
-
const
|
|
31
|
-
|
|
38
|
+
const t = new Error("Plaid: Error trying to invoke createToken");
|
|
39
|
+
i.error(t, {
|
|
32
40
|
tags: { plaid: !0 },
|
|
33
41
|
extra: { error: e }
|
|
34
|
-
}), n("error",
|
|
42
|
+
}), n("error", t);
|
|
35
43
|
}
|
|
36
44
|
else
|
|
37
|
-
|
|
38
|
-
if (!
|
|
45
|
+
o.token && (a.value.token = o.token);
|
|
46
|
+
if (!a.value.token) {
|
|
39
47
|
const e = new Error("Plaid: link token not found");
|
|
40
|
-
|
|
48
|
+
i.error(e, { tags: { plaid: !0 } }), n("error", e), r.value = !1;
|
|
41
49
|
return;
|
|
42
50
|
}
|
|
43
51
|
sessionStorage.setItem(
|
|
44
52
|
s.value,
|
|
45
|
-
JSON.stringify({ token:
|
|
46
|
-
),
|
|
47
|
-
token: i.value,
|
|
48
|
-
env: t.env,
|
|
49
|
-
onExit: k,
|
|
50
|
-
onSuccess: g,
|
|
51
|
-
onEvent: w,
|
|
52
|
-
onLoad: m
|
|
53
|
-
}).open();
|
|
53
|
+
JSON.stringify({ token: a.value.token, returnTo: o.returnTo, env: o.env })
|
|
54
|
+
), g();
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
u && u.remove();
|
|
60
|
-
const o = document.createElement("script");
|
|
61
|
-
o.type = "text/javascript", o.async = !0, o.src = t.initScriptUrl, o.addEventListener("load", () => e()), o.addEventListener("error", r), o.addEventListener("abort", r), document.head.appendChild(o);
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
return d(), f({
|
|
65
|
-
handleClick: c
|
|
66
|
-
}), (e, r) => (S(), h("span", {
|
|
57
|
+
return d({
|
|
58
|
+
handleClick: l
|
|
59
|
+
}), (e, t) => (h(), E("span", {
|
|
67
60
|
"data-test": "stash-plaid-link",
|
|
68
|
-
onClick:
|
|
61
|
+
onClick: l
|
|
69
62
|
}, [
|
|
70
|
-
|
|
63
|
+
w(e.$slots, "default", { open: r.value })
|
|
71
64
|
]));
|
|
72
65
|
}
|
|
73
66
|
});
|
|
74
67
|
export {
|
|
75
|
-
|
|
68
|
+
L as default
|
|
76
69
|
};
|
|
77
70
|
//# sourceMappingURL=PlaidLink.js.map
|
package/dist/PlaidLink.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaidLink.js","sources":["../src/components/PlaidLink/PlaidLink.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import logger from '@leaflink/snitch';\n import {
|
|
1
|
+
{"version":3,"file":"PlaidLink.js","sources":["../src/components/PlaidLink/PlaidLink.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import logger from '@leaflink/snitch';\n import { computed, ref } from 'vue';\n\n import { LinkTokenResponse, Plaid } from '../../../types/plaid';\n import usePlaidLink from '../../composables/usePlaidLink/usePlaidLink';\n\n export interface PlaidLinkProps {\n /**\n * @deprecated Plaid does not support other URLs for loading its SDK\n * Plaid initialization script url to be used\n */\n initScriptUrl?: string;\n\n /**\n * Key to be used in session storage for OAuth flow\n */\n storageKey?: string;\n\n /**\n * Url to be used to redirect the user from the OAuth flow\n */\n returnTo?: string;\n\n /**\n * Plaid link token\n */\n token?: string;\n\n /**\n * Plaid environment to connect\n */\n env?: Plaid.Environment;\n\n /**\n * Function that returns a link token object to be used with Plaid.\n * `link_token` takes precedence over `token` if informed.\n */\n createToken?: () => Promise<LinkTokenResponse>;\n }\n\n const props = withDefaults(defineProps<PlaidLinkProps>(), {\n initScriptUrl: 'https://cdn.plaid.com/link/v2/stable/link-initialize.js',\n storageKey: undefined,\n returnTo: window.location.href,\n env: 'sandbox',\n token: undefined,\n createToken: undefined,\n });\n\n const internalStorageKey = computed(() => {\n if (props.storageKey) {\n return props.storageKey;\n }\n\n // returns up to the last 3 parts of the host. e.g. for `subdomain.my.domain.com` it will return `my.domain.com`\n const host = window.location.host.split('.').splice(-3).join('.');\n\n return `${host}-plaid`;\n });\n\n const emit =\n defineEmits<{\n /**\n * Emitted whenever the exit event contains errors\n */\n (e: 'error', error: Plaid.Error | null | Error, metadata?: Plaid.OnExitMetaData): void;\n /**\n * Emitted whenever the user successfully links an item\n */\n (e: 'success', public_token: string, metadata: Plaid.OnSuccessMetaData): void;\n /**\n * Emitted whenever the user exits the Link flow\n */\n (e: 'exit', metadata: Plaid.OnExitMetaData): void;\n /**\n * Emitted when the Link is ready to be opened\n */\n (e: 'load'): void;\n /**\n * Emitted at specific points during the Link flow\n */\n (e: 'event', eventName: Plaid.EventName, metadata: Plaid.OnEventMetaData): void;\n }>();\n\n const isPlaidModalOpen = ref(false);\n\n const onExit: Plaid.OnExit = (error: Plaid.Error | null, metadata: Plaid.OnExitMetaData) => {\n isPlaidModalOpen.value = false;\n\n if (error) {\n logger.error(new Error('Plaid: Error trying to link an account'), {\n tags: { plaid: true },\n extra: { PlaidError: error },\n });\n emit('error', error, metadata);\n }\n\n sessionStorage.removeItem(internalStorageKey.value);\n\n emit('exit', metadata);\n };\n\n const onSuccess: Plaid.OnSuccess = (public_token: string, metadata: Plaid.OnSuccessMetaData) => {\n isPlaidModalOpen.value = false;\n\n sessionStorage.removeItem(internalStorageKey.value);\n\n emit('success', public_token, metadata);\n };\n\n const onLoad: Plaid.OnLoad = (...args) => emit('load', ...args);\n\n const onEvent: Plaid.OnEvent = (...args) => emit('event', ...args);\n\n const plaidLinkOptions = ref<Plaid.CreateConfig>({\n env: props.env,\n onSuccess,\n onEvent,\n onLoad,\n onExit,\n });\n\n const { open: openPlaidLink } = usePlaidLink(plaidLinkOptions);\n\n async function handleClick() {\n if (isPlaidModalOpen.value === true) {\n return;\n }\n\n isPlaidModalOpen.value = true;\n\n if (typeof props.createToken === 'function') {\n try {\n const { link_token } = await props.createToken();\n\n plaidLinkOptions.value.token = link_token;\n } catch (err) {\n const error = new Error('Plaid: Error trying to invoke createToken');\n\n logger.error(error, {\n tags: { plaid: true },\n extra: { error: err },\n });\n\n emit('error', error);\n }\n } else if (props.token) {\n plaidLinkOptions.value.token = props.token;\n }\n\n if (!plaidLinkOptions.value.token) {\n const error = new Error('Plaid: link token not found');\n\n logger.error(error, { tags: { plaid: true } });\n emit('error', error);\n\n isPlaidModalOpen.value = false;\n\n return;\n }\n\n sessionStorage.setItem(\n internalStorageKey.value,\n JSON.stringify({ token: plaidLinkOptions.value.token, returnTo: props.returnTo, env: props.env }),\n );\n\n openPlaidLink();\n }\n\n defineExpose({\n handleClick,\n });\n</script>\n\n<template>\n <span data-test=\"stash-plaid-link\" @click=\"handleClick\">\n <!-- @slot Default slot to trigger Plaid's modal -->\n <slot :open=\"isPlaidModalOpen\"></slot>\n </span>\n</template>\n"],"names":["internalStorageKey","computed","props","isPlaidModalOpen","ref","onExit","error","metadata","logger","emit","onSuccess","public_token","onLoad","args","onEvent","plaidLinkOptions","openPlaidLink","usePlaidLink","handleClick","link_token","err","__expose"],"mappings":";;;;;;;;;;;;;;;;iBAkDQA,IAAqBC,EAAS,MAC9BC,EAAM,aACDA,EAAM,aAMR,GAFM,OAAO,SAAS,KAAK,MAAM,GAAG,EAAE,OAAO,EAAE,EAAE,KAAK,GAAG,CAElD,QACf,GA0BKC,IAAmBC,EAAI,EAAK,GAE5BC,IAAuB,CAACC,GAA2BC,MAAmC;AAC1F,MAAAJ,EAAiB,QAAQ,IAErBG,MACFE,EAAO,MAAM,IAAI,MAAM,wCAAwC,GAAG;AAAA,QAChE,MAAM,EAAE,OAAO,GAAK;AAAA,QACpB,OAAO,EAAE,YAAYF,EAAM;AAAA,MAAA,CAC5B,GACIG,EAAA,SAASH,GAAOC,CAAQ,IAGhB,eAAA,WAAWP,EAAmB,KAAK,GAElDS,EAAK,QAAQF,CAAQ;AAAA,IAAA,GAGjBG,IAA6B,CAACC,GAAsBJ,MAAsC;AAC9F,MAAAJ,EAAiB,QAAQ,IAEV,eAAA,WAAWH,EAAmB,KAAK,GAE7CS,EAAA,WAAWE,GAAcJ,CAAQ;AAAA,IAAA,GAGlCK,IAAuB,IAAIC,MAASJ,EAAK,QAAQ,GAAGI,CAAI,GAExDC,IAAyB,IAAID,MAASJ,EAAK,SAAS,GAAGI,CAAI,GAE3DE,IAAmBX,EAAwB;AAAA,MAC/C,KAAKF,EAAM;AAAA,MACX,WAAAQ;AAAA,MACA,SAAAI;AAAA,MACA,QAAAF;AAAA,MACA,QAAAP;AAAA,IAAA,CACD,GAEK,EAAE,MAAMW,EAAc,IAAIC,EAAaF,CAAgB;AAE7D,mBAAeG,IAAc;AACvB,UAAAf,EAAiB,UAAU,IAM3B;AAAA,YAFJA,EAAiB,QAAQ,IAErB,OAAOD,EAAM,eAAgB;AAC3B,cAAA;AACF,kBAAM,EAAE,YAAAiB,EAAe,IAAA,MAAMjB,EAAM,YAAY;AAE/C,YAAAa,EAAiB,MAAM,QAAQI;AAAA,mBACxBC,GAAK;AACN,kBAAAd,IAAQ,IAAI,MAAM,2CAA2C;AAEnE,YAAAE,EAAO,MAAMF,GAAO;AAAA,cAClB,MAAM,EAAE,OAAO,GAAK;AAAA,cACpB,OAAO,EAAE,OAAOc,EAAI;AAAA,YAAA,CACrB,GAEDX,EAAK,SAASH,CAAK;AAAA,UACrB;AAAA;AACF,UAAWJ,EAAM,UACEa,EAAA,MAAM,QAAQb,EAAM;AAGnC,YAAA,CAACa,EAAiB,MAAM,OAAO;AAC3B,gBAAAT,IAAQ,IAAI,MAAM,6BAA6B;AAE9C,UAAAE,EAAA,MAAMF,GAAO,EAAE,MAAM,EAAE,OAAO,MAAQ,GAC7CG,EAAK,SAASH,CAAK,GAEnBH,EAAiB,QAAQ;AAEzB;AAAA,QACF;AAEe,uBAAA;AAAA,UACbH,EAAmB;AAAA,UACnB,KAAK,UAAU,EAAE,OAAOe,EAAiB,MAAM,OAAO,UAAUb,EAAM,UAAU,KAAKA,EAAM,KAAK;AAAA,QAAA,GAGpFc;;IAChB;AAEa,WAAAK,EAAA;AAAA,MACX,aAAAH;AAAA,IAAA,CACD;;;;;;;;"}
|
package/dist/PlaidLink.vue.d.ts
CHANGED
|
@@ -59,9 +59,9 @@ declare const _default: __VLS_WithTemplateSlots<DefineComponent<__VLS_WithDefaul
|
|
|
59
59
|
}>>> & {
|
|
60
60
|
onLoad?: (() => any) | undefined;
|
|
61
61
|
onError?: ((error: Error | Plaid.Error | null, metadata?: Plaid.OnExitMetaData | undefined) => any) | undefined;
|
|
62
|
-
onSuccess?: ((public_token: string, metadata: Plaid.OnSuccessMetaData) => any) | undefined;
|
|
63
62
|
onEvent?: ((eventName: Plaid.EventName, metadata: Plaid.OnEventMetaData) => any) | undefined;
|
|
64
63
|
onExit?: ((metadata: Plaid.OnExitMetaData) => any) | undefined;
|
|
64
|
+
onSuccess?: ((public_token: string, metadata: Plaid.OnSuccessMetaData) => any) | undefined;
|
|
65
65
|
}, {
|
|
66
66
|
initScriptUrl: string;
|
|
67
67
|
storageKey: string;
|
|
@@ -78,17 +78,15 @@ export default _default;
|
|
|
78
78
|
|
|
79
79
|
declare function handleClick(): Promise<void>;
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
declare interface LinkTokenResponse {
|
|
82
82
|
link_token: string;
|
|
83
|
-
/**
|
|
84
|
-
* expiration date in ISO-8601 format
|
|
85
|
-
*/
|
|
86
83
|
expiration: string;
|
|
87
84
|
request_id: string;
|
|
88
85
|
}
|
|
89
86
|
|
|
90
87
|
export declare interface PlaidLinkProps {
|
|
91
88
|
/**
|
|
89
|
+
* @deprecated Plaid does not support other URLs for loading its SDK
|
|
92
90
|
* Plaid initialization script url to be used
|
|
93
91
|
*/
|
|
94
92
|
initScriptUrl?: string;
|
package/dist/Table.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as C, inject as
|
|
1
|
+
import { defineComponent as C, inject as g, computed as o, provide as H, watchEffect as N, openBlock as p, createElementBlock as L, normalizeClass as i, unref as c, normalizeStyle as I, createElementVNode as f, renderSlot as y, createBlock as k, withCtx as d, createVNode as n } from "vue";
|
|
2
2
|
import "lodash-es/cloneDeep";
|
|
3
|
-
import { M as
|
|
3
|
+
import { M as E } from "./Module.keys-2cc7d830.js";
|
|
4
4
|
import "lodash-es/uniqueId";
|
|
5
5
|
import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
|
|
6
6
|
import "./Paginate.vue_used_vue_type_style_index_0_lang.module-18343da7.js";
|
|
7
|
-
import { D as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { T as
|
|
13
|
-
import { S as
|
|
7
|
+
import { D as S } from "./DataView.vue_used_vue_type_style_index_0_lang.module-5c180dba.js";
|
|
8
|
+
import A from "./EmptyState.js";
|
|
9
|
+
import D from "./Loading.js";
|
|
10
|
+
import x from "./TableCell.js";
|
|
11
|
+
import _ from "./TableRow.js";
|
|
12
|
+
import { T as O } from "./Table.keys-cf93df19.js";
|
|
13
|
+
import { S as V } from "./misc-76697f61.js";
|
|
14
14
|
import "./locale.js";
|
|
15
15
|
import "lodash-es/get";
|
|
16
16
|
import "./Illustration.vue_vue_type_script_setup_true_lang-4b8944da.js";
|
|
@@ -44,74 +44,76 @@ const z = { class: "tw-relative tw-min-w-full tw-max-w-initial tw-border-separat
|
|
|
44
44
|
},
|
|
45
45
|
setup(e) {
|
|
46
46
|
const t = e, {
|
|
47
|
-
density:
|
|
48
|
-
variant:
|
|
49
|
-
isEmpty:
|
|
50
|
-
isLoading:
|
|
51
|
-
isSelectable:
|
|
52
|
-
} =
|
|
53
|
-
var a,
|
|
47
|
+
density: T,
|
|
48
|
+
variant: w,
|
|
49
|
+
isEmpty: r,
|
|
50
|
+
isLoading: s,
|
|
51
|
+
isSelectable: b
|
|
52
|
+
} = g(S.key, S.defaults), { variant: u } = g(E.key, E.defaults), v = o(() => (u == null ? void 0 : u.value) === "table" || w.value === "table" ? "rounded-bottom" : t.radius), l = o(() => t.stickyHeader ? "scroll" : t.layout), h = o(() => {
|
|
53
|
+
var a, m;
|
|
54
54
|
return !!((a = t.stickyHeader) != null && a.maxHeight && // table can't scroll without a max height; sticky headers only needed for a scrollable table
|
|
55
|
-
((
|
|
55
|
+
((m = t.stickyHeader) == null ? void 0 : m.listLength) > 3);
|
|
56
56
|
}), B = o(() => {
|
|
57
57
|
var a;
|
|
58
58
|
return {
|
|
59
|
-
maxHeight:
|
|
59
|
+
maxHeight: h.value ? (a = t.stickyHeader) == null ? void 0 : a.maxHeight : ""
|
|
60
60
|
};
|
|
61
61
|
});
|
|
62
|
-
return
|
|
63
|
-
density: o(() => t.density ||
|
|
62
|
+
return H(O.key, {
|
|
63
|
+
density: o(() => t.density || T.value || V.Comfortable),
|
|
64
64
|
hasCustomExpandToggle: o(() => t.hasCustomExpandToggle),
|
|
65
65
|
hasActions: o(() => t.hasActions),
|
|
66
66
|
isExpandable: o(() => t.isExpandable),
|
|
67
|
-
isSelectable: o(
|
|
67
|
+
isSelectable: o(
|
|
68
|
+
() => t.isSelectable && !t.isLoading && !(s != null && s.value) && !t.isEmpty && !(r != null && r.value)
|
|
69
|
+
),
|
|
68
70
|
layout: l
|
|
69
|
-
}),
|
|
70
|
-
|
|
71
|
-
}), (a,
|
|
72
|
-
class:
|
|
73
|
-
{ "tw-rounded":
|
|
74
|
-
{ "tw-rounded-b":
|
|
75
|
-
{ "tw-border-t tw-border-ice-200":
|
|
71
|
+
}), N(() => {
|
|
72
|
+
b && (b.value = t.isSelectable);
|
|
73
|
+
}), (a, m) => (p(), L("div", {
|
|
74
|
+
class: i(["stash-table tw-relative", [
|
|
75
|
+
{ "tw-rounded": v.value === "rounded" },
|
|
76
|
+
{ "tw-rounded-b": v.value === "rounded-bottom" },
|
|
77
|
+
{ "tw-border-t tw-border-ice-200": c(w) === "table" },
|
|
76
78
|
{ "tw-overflow-auto tw-shadow": l.value === "scroll" },
|
|
77
79
|
{ "tw-overflow-visble lg:tw-overflow-auto lg:tw-shadow": l.value === "stack" },
|
|
78
|
-
{ "tw-min-h-[300px]":
|
|
80
|
+
{ "tw-min-h-[300px]": h.value && !t.isLoading }
|
|
79
81
|
// prevent the table from collapsing on small screen heights when the max-height is dynamic
|
|
80
82
|
]]),
|
|
81
83
|
"data-test": "stash-table",
|
|
82
|
-
style:
|
|
84
|
+
style: I(B.value)
|
|
83
85
|
}, [
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
class:
|
|
86
|
+
f("table", z, [
|
|
87
|
+
f("thead", {
|
|
88
|
+
class: i(["tw-border-b tw-border-ice-200", {
|
|
87
89
|
"tw-hidden lg:tw-table-header-group": l.value === "stack"
|
|
88
90
|
}])
|
|
89
91
|
}, [
|
|
90
|
-
|
|
92
|
+
y(a.$slots, "head")
|
|
91
93
|
], 2),
|
|
92
|
-
|
|
93
|
-
t.isLoading ||
|
|
94
|
-
default:
|
|
95
|
-
|
|
94
|
+
f("tbody", null, [
|
|
95
|
+
t.isLoading || c(s) ? (p(), k(_, { key: 0 }, {
|
|
96
|
+
default: d(() => [
|
|
97
|
+
n(x, {
|
|
96
98
|
colspan: "100%",
|
|
97
|
-
class:
|
|
99
|
+
class: i({ "tw-col-span-12": l.value === "stack" })
|
|
98
100
|
}, {
|
|
99
|
-
default:
|
|
100
|
-
|
|
101
|
+
default: d(() => [
|
|
102
|
+
n(D)
|
|
101
103
|
]),
|
|
102
104
|
_: 1
|
|
103
105
|
}, 8, ["class"])
|
|
104
106
|
]),
|
|
105
107
|
_: 1
|
|
106
|
-
})) : t.isEmpty ||
|
|
107
|
-
default:
|
|
108
|
-
|
|
108
|
+
})) : t.isEmpty || c(r) ? (p(), k(_, { key: 1 }, {
|
|
109
|
+
default: d(() => [
|
|
110
|
+
n(x, {
|
|
109
111
|
colspan: "100%",
|
|
110
|
-
class:
|
|
112
|
+
class: i({ "tw-col-span-12": l.value === "stack" })
|
|
111
113
|
}, {
|
|
112
|
-
default:
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
default: d(() => [
|
|
115
|
+
y(a.$slots, "empty", {}, () => [
|
|
116
|
+
n(A, {
|
|
115
117
|
class: "tw-w-full tw-bg-white",
|
|
116
118
|
text: t.emptyStateText
|
|
117
119
|
}, null, 8, ["text"])
|
|
@@ -121,7 +123,7 @@ const z = { class: "tw-relative tw-min-w-full tw-max-w-initial tw-border-separat
|
|
|
121
123
|
}, 8, ["class"])
|
|
122
124
|
]),
|
|
123
125
|
_: 3
|
|
124
|
-
})) :
|
|
126
|
+
})) : y(a.$slots, "body", { key: 2 })
|
|
125
127
|
])
|
|
126
128
|
])
|
|
127
129
|
], 6));
|
|
@@ -129,7 +131,7 @@ const z = { class: "tw-relative tw-min-w-full tw-max-w-initial tw-border-separat
|
|
|
129
131
|
});
|
|
130
132
|
export {
|
|
131
133
|
J as Layout,
|
|
132
|
-
|
|
134
|
+
O as TABLE_INJECTION,
|
|
133
135
|
$ as TableRadius,
|
|
134
136
|
ft as default
|
|
135
137
|
};
|
package/dist/Table.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.js","sources":["../src/components/Table/Table.types.ts","../src/components/Table/Table.vue"],"sourcesContent":["import { ComputedRef } from 'vue';\n\nimport { SpacingDensities } from '../../../types/misc';\n\nexport enum Layout {\n Scroll = 'scroll',\n Stack = 'stack',\n}\n\nexport type Layouts = `${Layout}`;\n\nexport enum TableRadius {\n None = 'none',\n Rounded = 'rounded',\n RoundedBottom = 'rounded-bottom',\n}\n\nexport type TableRadiuses = `${TableRadius}`;\n\n/**\n * Properties and utilities provided to children of a Table instance\n */\nexport interface TableInjection {\n /**\n * Controls the Table's padding; the default value is \"comfortable\". On small screens, the density will always be \"compact\".\n */\n density: ComputedRef<SpacingDensities>;\n\n /**\n * Styles the last column for \"row actions\"\n */\n hasActions: ComputedRef<boolean>;\n\n /**\n * If true, hides the default expansion toggle column\n */\n hasCustomExpandToggle: ComputedRef<boolean>;\n\n /**\n * Adds a toggle column for row expansion. This is primarily needed for ensuring the corresponding empty TableHeaderRow is included.\n */\n isExpandable: ComputedRef<boolean>;\n\n /**\n * Adds a checkbox column for selecting rows; intended for use with the `useSelection` composable.\n */\n isSelectable: ComputedRef<boolean>;\n\n /**\n * Sets the table layout; the default value is \"scroll\".\n */\n layout: ComputedRef<Layouts>;\n}\n","<script lang=\"ts\">\n import { SpacingDensities, SpacingDensity } from '../../../types/misc';\n import { MODULE_INJECTION } from '../Module/Module.keys';\n import { Layouts, TableRadiuses } from './Table.types';\n\n export * from './Table.keys';\n export * from './Table.types';\n\n export interface TableProps {\n /**\n * Controls the Table's padding; the default value is \"comfortable\". On small screens, \"compact\" density is applied regardless of this prop's value.\n */\n density?: SpacingDensities;\n\n /**\n * Sets the text for the empty state; the default value is \"No Results\".\n */\n emptyStateText?: string;\n\n /**\n * Styles the last column for \"row actions\"\n */\n hasActions?: boolean;\n\n /**\n * If true, hides the default expansion toggle column\n */\n hasCustomExpandToggle?: boolean;\n\n /**\n * Shows the empty state\n */\n isEmpty?: boolean;\n\n /**\n * Shows the loading state\n */\n isLoading?: boolean;\n\n /**\n * Adds a toggle column for row expansion. This is primarily needed for ensuring the corresponding empty TableHeaderRow is included.\n */\n isExpandable?: boolean;\n\n /**\n * Adds a checkbox column for selecting rows; intended for use with the `useSelection` composable.\n */\n isSelectable?: boolean;\n\n /**\n * Sets the table layout; the default value is \"scroll\".\n */\n layout?: Layouts;\n\n /**\n * Controls the corners of the table with the \"border-radius\" CSS property. The default value is \"rounded\".\n */\n radius?: TableRadiuses;\n\n /**\n * Allows the table head to be sticky when scrolling inside the table body\n */\n stickyHeader?: {\n listLength: number;\n maxHeight: string;\n };\n }\n</script>\n\n<script setup lang=\"ts\">\n import { computed, inject, provide, watchEffect } from 'vue';\n\n import { DATA_VIEW_INJECTION } from '../DataView/DataView.vue';\n import EmptyState from '../EmptyState/EmptyState.vue';\n import Loading from '../Loading/Loading.vue';\n import TableCell from '../TableCell/TableCell.vue';\n import TableRow from '../TableRow/TableRow.vue';\n import { TABLE_INJECTION } from './Table.keys';\n\n const props = withDefaults(defineProps<TableProps>(), {\n density: undefined,\n emptyStateText: '',\n hasActions: false,\n hasCustomExpandToggle: false,\n isEmpty: false,\n isLoading: false,\n isExpandable: false,\n isSelectable: false,\n layout: 'scroll',\n radius: 'rounded',\n stickyHeader: undefined,\n });\n\n const {\n density: dataViewDensity,\n variant: dataViewVariant,\n isEmpty: isDataViewEmpty,\n isLoading: isDataViewLoading,\n isSelectable: isDataViewSelectable,\n } = inject(DATA_VIEW_INJECTION.key, DATA_VIEW_INJECTION.defaults);\n\n const { variant: moduleVariant } = inject(MODULE_INJECTION.key, MODULE_INJECTION.defaults);\n\n const computedRadius = computed<TableRadiuses>(() => {\n // Will work for tables when rendered inside of a Module with OR without a DataView.\n if (moduleVariant?.value === 'table') {\n return 'rounded-bottom';\n }\n\n if (dataViewVariant.value === 'table') {\n return 'rounded-bottom';\n }\n\n return props.radius;\n });\n\n const computedLayout = computed<Layouts>(() => {\n if (props.stickyHeader) {\n return 'scroll';\n }\n\n return props.layout;\n });\n\n const isStickyHeaderEnabled = computed<boolean>(() => {\n return !!(\n (\n props.stickyHeader?.maxHeight && // table can't scroll without a max height; sticky headers only needed for a scrollable table\n props.stickyHeader?.listLength > 3\n ) // scrollable table and sticky headers not needed when list is small\n );\n });\n\n const rootStyle = computed(() => ({\n maxHeight: isStickyHeaderEnabled.value ? props.stickyHeader?.maxHeight : '',\n }));\n\n provide(TABLE_INJECTION.key, {\n density: computed(() => props.density || dataViewDensity.value || SpacingDensity.Comfortable),\n hasCustomExpandToggle: computed(() => props.hasCustomExpandToggle),\n hasActions: computed(() => props.hasActions),\n isExpandable: computed(() => props.isExpandable),\n isSelectable: computed(() => props.isSelectable && !props.isLoading && !props.isEmpty),\n layout: computedLayout,\n });\n\n watchEffect(() => {\n // Table can be both casted within a DataView or standalone. useSelection is still possible to be used on both cases,\n // making it important to have Table to control selection props.\n // To avoid breaking changes and developer experience, a DataView injection is passed down and updated whenever it exists,\n // and move the information up into DataView, that sometimes aren't used.\n if (isDataViewSelectable) {\n isDataViewSelectable.value = props.isSelectable;\n }\n });\n</script>\n\n<template>\n <div\n class=\"stash-table tw-relative\"\n :class=\"[\n { 'tw-rounded': computedRadius === 'rounded' },\n { 'tw-rounded-b': computedRadius === 'rounded-bottom' },\n { 'tw-border-t tw-border-ice-200': dataViewVariant === 'table' },\n { 'tw-overflow-auto tw-shadow': computedLayout === 'scroll' },\n { 'tw-overflow-visble lg:tw-overflow-auto lg:tw-shadow': computedLayout === 'stack' },\n { 'tw-min-h-[300px]': isStickyHeaderEnabled && !props.isLoading }, // prevent the table from collapsing on small screen heights when the max-height is dynamic\n ]\"\n data-test=\"stash-table\"\n :style=\"rootStyle\"\n >\n <table class=\"tw-relative tw-min-w-full tw-max-w-initial tw-border-separate\">\n <thead\n class=\"tw-border-b tw-border-ice-200\"\n :class=\"{\n 'tw-hidden lg:tw-table-header-group': computedLayout === 'stack',\n }\"\n >\n <!-- @slot head -->\n <slot name=\"head\"> </slot>\n </thead>\n <tbody>\n <!-- \n tw-col-span-12 makes the td span all columns only when layout === 'stack' and the viewport is below lg (when table elements are using display: grid ).\n The colspan attr does the same in all other cases when the table elements are using their native table styles.\n These are necessary in order to properly horizontally center Loading, and EmptyState \n -->\n <TableRow v-if=\"props.isLoading || isDataViewLoading\">\n <TableCell colspan=\"100%\" :class=\"{ 'tw-col-span-12': computedLayout === 'stack' }\">\n <Loading />\n </TableCell>\n </TableRow>\n <!-- @slot empty -->\n <template v-else-if=\"props.isEmpty || isDataViewEmpty\">\n <TableRow>\n <TableCell colspan=\"100%\" :class=\"{ 'tw-col-span-12': computedLayout === 'stack' }\">\n <slot name=\"empty\">\n <EmptyState class=\"tw-w-full tw-bg-white\" :text=\"props.emptyStateText\" />\n </slot>\n </TableCell>\n </TableRow>\n </template>\n <!-- @slot body -->\n <slot v-else name=\"body\"></slot>\n </tbody>\n </table>\n </div>\n</template>\n"],"names":["Layout","TableRadius","dataViewDensity","dataViewVariant","isDataViewEmpty","isDataViewLoading","isDataViewSelectable","inject","DATA_VIEW_INJECTION","moduleVariant","MODULE_INJECTION","computedRadius","computed","props","computedLayout","isStickyHeaderEnabled","_a","_b","rootStyle","provide","TABLE_INJECTION","SpacingDensity","watchEffect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIY,IAAAA,sBAAAA,OACVA,EAAA,SAAS,UACTA,EAAA,QAAQ,SAFEA,IAAAA,KAAA,CAAA,CAAA,GAOAC,sBAAAA,OACVA,EAAA,OAAO,QACPA,EAAA,UAAU,WACVA,EAAA,gBAAgB,kBAHNA,IAAAA,KAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;iBCkFJ;AAAA,MACJ,SAASC;AAAA,MACT,SAASC;AAAA,MACT,SAASC;AAAA,MACT,WAAWC;AAAA,MACX,cAAcC;AAAA,IACZ,IAAAC,EAAOC,EAAoB,KAAKA,EAAoB,QAAQ,GAE1D,EAAE,SAASC,MAAkBF,EAAOG,EAAiB,KAAKA,EAAiB,QAAQ,GAEnFC,IAAiBC,EAAwB,OAEzCH,KAAA,gBAAAA,EAAe,WAAU,WAIzBN,EAAgB,UAAU,UACrB,mBAGFU,EAAM,MACd,GAEKC,IAAiBF,EAAkB,MACnCC,EAAM,eACD,WAGFA,EAAM,MACd,GAEKE,IAAwBH,EAAkB,MAAM;;AAC7C,aAAA,CAAC,GAEJI,IAAAH,EAAM,iBAAN,QAAAG,EAAoB;AAAA,QACpBC,IAAAJ,EAAM,iBAAN,gBAAAI,EAAoB,cAAa;AAAA,IAAA,CAGtC,GAEKC,IAAYN,EAAS,MAAO;;AAAA;AAAA,QAChC,WAAWG,EAAsB,SAAQC,IAAAH,EAAM,iBAAN,gBAAAG,EAAoB,YAAY;AAAA,MACzE;AAAA,KAAA;AAEF,WAAAG,EAAQC,EAAgB,KAAK;AAAA,MAC3B,SAASR,EAAS,MAAMC,EAAM,WAAWX,EAAgB,SAASmB,EAAe,WAAW;AAAA,MAC5F,uBAAuBT,EAAS,MAAMC,EAAM,qBAAqB;AAAA,MACjE,YAAYD,EAAS,MAAMC,EAAM,UAAU;AAAA,MAC3C,cAAcD,EAAS,MAAMC,EAAM,YAAY;AAAA,MAC/C,cAAcD,EAAS,MAAMC,EAAM,gBAAgB,CAACA,EAAM,aAAa,CAACA,EAAM,OAAO;AAAA,MACrF,QAAQC;AAAA,IAAA,CACT,GAEDQ,EAAY,MAAM;AAKhB,MAAIhB,MACFA,EAAqB,QAAQO,EAAM;AAAA,IACrC,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"Table.js","sources":["../src/components/Table/Table.types.ts","../src/components/Table/Table.vue"],"sourcesContent":["import { ComputedRef } from 'vue';\n\nimport { SpacingDensities } from '../../../types/misc';\n\nexport enum Layout {\n Scroll = 'scroll',\n Stack = 'stack',\n}\n\nexport type Layouts = `${Layout}`;\n\nexport enum TableRadius {\n None = 'none',\n Rounded = 'rounded',\n RoundedBottom = 'rounded-bottom',\n}\n\nexport type TableRadiuses = `${TableRadius}`;\n\n/**\n * Properties and utilities provided to children of a Table instance\n */\nexport interface TableInjection {\n /**\n * Controls the Table's padding; the default value is \"comfortable\". On small screens, the density will always be \"compact\".\n */\n density: ComputedRef<SpacingDensities>;\n\n /**\n * Styles the last column for \"row actions\"\n */\n hasActions: ComputedRef<boolean>;\n\n /**\n * If true, hides the default expansion toggle column\n */\n hasCustomExpandToggle: ComputedRef<boolean>;\n\n /**\n * Adds a toggle column for row expansion. This is primarily needed for ensuring the corresponding empty TableHeaderRow is included.\n */\n isExpandable: ComputedRef<boolean>;\n\n /**\n * Adds a checkbox column for selecting rows; intended for use with the `useSelection` composable.\n */\n isSelectable: ComputedRef<boolean>;\n\n /**\n * Sets the table layout; the default value is \"scroll\".\n */\n layout: ComputedRef<Layouts>;\n}\n","<script lang=\"ts\">\n import { SpacingDensities, SpacingDensity } from '../../../types/misc';\n import { MODULE_INJECTION } from '../Module/Module.keys';\n import { Layouts, TableRadiuses } from './Table.types';\n\n export * from './Table.keys';\n export * from './Table.types';\n\n export interface TableProps {\n /**\n * Controls the Table's padding; the default value is \"comfortable\". On small screens, \"compact\" density is applied regardless of this prop's value.\n */\n density?: SpacingDensities;\n\n /**\n * Sets the text for the empty state; the default value is \"No Results\".\n */\n emptyStateText?: string;\n\n /**\n * Styles the last column for \"row actions\"\n */\n hasActions?: boolean;\n\n /**\n * If true, hides the default expansion toggle column\n */\n hasCustomExpandToggle?: boolean;\n\n /**\n * Shows the empty state\n */\n isEmpty?: boolean;\n\n /**\n * Shows the loading state\n */\n isLoading?: boolean;\n\n /**\n * Adds a toggle column for row expansion. This is primarily needed for ensuring the corresponding empty TableHeaderRow is included.\n */\n isExpandable?: boolean;\n\n /**\n * Adds a checkbox column for selecting rows; intended for use with the `useSelection` composable.\n */\n isSelectable?: boolean;\n\n /**\n * Sets the table layout; the default value is \"scroll\".\n */\n layout?: Layouts;\n\n /**\n * Controls the corners of the table with the \"border-radius\" CSS property. The default value is \"rounded\".\n */\n radius?: TableRadiuses;\n\n /**\n * Allows the table head to be sticky when scrolling inside the table body\n */\n stickyHeader?: {\n listLength: number;\n maxHeight: string;\n };\n }\n</script>\n\n<script setup lang=\"ts\">\n import { computed, inject, provide, watchEffect } from 'vue';\n\n import { DATA_VIEW_INJECTION } from '../DataView/DataView.vue';\n import EmptyState from '../EmptyState/EmptyState.vue';\n import Loading from '../Loading/Loading.vue';\n import TableCell from '../TableCell/TableCell.vue';\n import TableRow from '../TableRow/TableRow.vue';\n import { TABLE_INJECTION } from './Table.keys';\n\n const props = withDefaults(defineProps<TableProps>(), {\n density: undefined,\n emptyStateText: '',\n hasActions: false,\n hasCustomExpandToggle: false,\n isEmpty: false,\n isLoading: false,\n isExpandable: false,\n isSelectable: false,\n layout: 'scroll',\n radius: 'rounded',\n stickyHeader: undefined,\n });\n\n const {\n density: dataViewDensity,\n variant: dataViewVariant,\n isEmpty: isDataViewEmpty,\n isLoading: isDataViewLoading,\n isSelectable: isDataViewSelectable,\n } = inject(DATA_VIEW_INJECTION.key, DATA_VIEW_INJECTION.defaults);\n\n const { variant: moduleVariant } = inject(MODULE_INJECTION.key, MODULE_INJECTION.defaults);\n\n const computedRadius = computed<TableRadiuses>(() => {\n // Will work for tables when rendered inside of a Module with OR without a DataView.\n if (moduleVariant?.value === 'table') {\n return 'rounded-bottom';\n }\n\n if (dataViewVariant.value === 'table') {\n return 'rounded-bottom';\n }\n\n return props.radius;\n });\n\n const computedLayout = computed<Layouts>(() => {\n if (props.stickyHeader) {\n return 'scroll';\n }\n\n return props.layout;\n });\n\n const isStickyHeaderEnabled = computed<boolean>(() => {\n return !!(\n (\n props.stickyHeader?.maxHeight && // table can't scroll without a max height; sticky headers only needed for a scrollable table\n props.stickyHeader?.listLength > 3\n ) // scrollable table and sticky headers not needed when list is small\n );\n });\n\n const rootStyle = computed(() => ({\n maxHeight: isStickyHeaderEnabled.value ? props.stickyHeader?.maxHeight : '',\n }));\n\n provide(TABLE_INJECTION.key, {\n density: computed(() => props.density || dataViewDensity.value || SpacingDensity.Comfortable),\n hasCustomExpandToggle: computed(() => props.hasCustomExpandToggle),\n hasActions: computed(() => props.hasActions),\n isExpandable: computed(() => props.isExpandable),\n isSelectable: computed(\n () =>\n props.isSelectable &&\n !props.isLoading &&\n !isDataViewLoading?.value &&\n !props.isEmpty &&\n !isDataViewEmpty?.value,\n ),\n layout: computedLayout,\n });\n\n watchEffect(() => {\n // Table can be both casted within a DataView or standalone. useSelection is still possible to be used on both cases,\n // making it important to have Table to control selection props.\n // To avoid breaking changes and developer experience, a DataView injection is passed down and updated whenever it exists,\n // and move the information up into DataView, that sometimes aren't used.\n if (isDataViewSelectable) {\n isDataViewSelectable.value = props.isSelectable;\n }\n });\n</script>\n\n<template>\n <div\n class=\"stash-table tw-relative\"\n :class=\"[\n { 'tw-rounded': computedRadius === 'rounded' },\n { 'tw-rounded-b': computedRadius === 'rounded-bottom' },\n { 'tw-border-t tw-border-ice-200': dataViewVariant === 'table' },\n { 'tw-overflow-auto tw-shadow': computedLayout === 'scroll' },\n { 'tw-overflow-visble lg:tw-overflow-auto lg:tw-shadow': computedLayout === 'stack' },\n { 'tw-min-h-[300px]': isStickyHeaderEnabled && !props.isLoading }, // prevent the table from collapsing on small screen heights when the max-height is dynamic\n ]\"\n data-test=\"stash-table\"\n :style=\"rootStyle\"\n >\n <table class=\"tw-relative tw-min-w-full tw-max-w-initial tw-border-separate\">\n <thead\n class=\"tw-border-b tw-border-ice-200\"\n :class=\"{\n 'tw-hidden lg:tw-table-header-group': computedLayout === 'stack',\n }\"\n >\n <!-- @slot head -->\n <slot name=\"head\"> </slot>\n </thead>\n <tbody>\n <!-- \n tw-col-span-12 makes the td span all columns only when layout === 'stack' and the viewport is below lg (when table elements are using display: grid ).\n The colspan attr does the same in all other cases when the table elements are using their native table styles.\n These are necessary in order to properly horizontally center Loading, and EmptyState \n -->\n <TableRow v-if=\"props.isLoading || isDataViewLoading\">\n <TableCell colspan=\"100%\" :class=\"{ 'tw-col-span-12': computedLayout === 'stack' }\">\n <Loading />\n </TableCell>\n </TableRow>\n <!-- @slot empty -->\n <template v-else-if=\"props.isEmpty || isDataViewEmpty\">\n <TableRow>\n <TableCell colspan=\"100%\" :class=\"{ 'tw-col-span-12': computedLayout === 'stack' }\">\n <slot name=\"empty\">\n <EmptyState class=\"tw-w-full tw-bg-white\" :text=\"props.emptyStateText\" />\n </slot>\n </TableCell>\n </TableRow>\n </template>\n <!-- @slot body -->\n <slot v-else name=\"body\"></slot>\n </tbody>\n </table>\n </div>\n</template>\n"],"names":["Layout","TableRadius","dataViewDensity","dataViewVariant","isDataViewEmpty","isDataViewLoading","isDataViewSelectable","inject","DATA_VIEW_INJECTION","moduleVariant","MODULE_INJECTION","computedRadius","computed","props","computedLayout","isStickyHeaderEnabled","_a","_b","rootStyle","provide","TABLE_INJECTION","SpacingDensity","watchEffect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIY,IAAAA,sBAAAA,OACVA,EAAA,SAAS,UACTA,EAAA,QAAQ,SAFEA,IAAAA,KAAA,CAAA,CAAA,GAOAC,sBAAAA,OACVA,EAAA,OAAO,QACPA,EAAA,UAAU,WACVA,EAAA,gBAAgB,kBAHNA,IAAAA,KAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;iBCkFJ;AAAA,MACJ,SAASC;AAAA,MACT,SAASC;AAAA,MACT,SAASC;AAAA,MACT,WAAWC;AAAA,MACX,cAAcC;AAAA,IACZ,IAAAC,EAAOC,EAAoB,KAAKA,EAAoB,QAAQ,GAE1D,EAAE,SAASC,MAAkBF,EAAOG,EAAiB,KAAKA,EAAiB,QAAQ,GAEnFC,IAAiBC,EAAwB,OAEzCH,KAAA,gBAAAA,EAAe,WAAU,WAIzBN,EAAgB,UAAU,UACrB,mBAGFU,EAAM,MACd,GAEKC,IAAiBF,EAAkB,MACnCC,EAAM,eACD,WAGFA,EAAM,MACd,GAEKE,IAAwBH,EAAkB,MAAM;;AAC7C,aAAA,CAAC,GAEJI,IAAAH,EAAM,iBAAN,QAAAG,EAAoB;AAAA,QACpBC,IAAAJ,EAAM,iBAAN,gBAAAI,EAAoB,cAAa;AAAA,IAAA,CAGtC,GAEKC,IAAYN,EAAS,MAAO;;AAAA;AAAA,QAChC,WAAWG,EAAsB,SAAQC,IAAAH,EAAM,iBAAN,gBAAAG,EAAoB,YAAY;AAAA,MACzE;AAAA,KAAA;AAEF,WAAAG,EAAQC,EAAgB,KAAK;AAAA,MAC3B,SAASR,EAAS,MAAMC,EAAM,WAAWX,EAAgB,SAASmB,EAAe,WAAW;AAAA,MAC5F,uBAAuBT,EAAS,MAAMC,EAAM,qBAAqB;AAAA,MACjE,YAAYD,EAAS,MAAMC,EAAM,UAAU;AAAA,MAC3C,cAAcD,EAAS,MAAMC,EAAM,YAAY;AAAA,MAC/C,cAAcD;AAAA,QACZ,MACEC,EAAM,gBACN,CAACA,EAAM,aACP,EAACR,KAAA,QAAAA,EAAmB,UACpB,CAACQ,EAAM,WACP,EAACT,KAAA,QAAAA,EAAiB;AAAA,MACtB;AAAA,MACA,QAAQU;AAAA,IAAA,CACT,GAEDQ,EAAY,MAAM;AAKhB,MAAIhB,MACFA,EAAqB,QAAQO,EAAM;AAAA,IACrC,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -80,6 +80,12 @@ export declare interface I18nPlugin {
|
|
|
80
80
|
t: (key: string, value: string) => string;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
export declare interface LinkTokenResponse {
|
|
84
|
+
link_token: string;
|
|
85
|
+
expiration: string;
|
|
86
|
+
request_id: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
83
89
|
declare interface MenusPluginOptions {
|
|
84
90
|
mountNodeClass?: string;
|
|
85
91
|
mountNodeId?: string;
|
|
@@ -402,4 +408,7 @@ export declare interface UnifiedApiPaginationParams {
|
|
|
402
408
|
pageSize?: number;
|
|
403
409
|
}
|
|
404
410
|
|
|
411
|
+
|
|
412
|
+
export * from "plaid-link";
|
|
413
|
+
|
|
405
414
|
export { }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
|
+
import { MaybeRef } from 'vue';
|
|
3
|
+
import { Plaid } from 'plaid-link';
|
|
4
|
+
import { Ref } from 'vue';
|
|
5
|
+
|
|
6
|
+
declare function usePlaidLink(options: MaybeRef<Plaid.CreateConfig>): {
|
|
7
|
+
ready: ComputedRef<boolean>;
|
|
8
|
+
error: Ref<{
|
|
9
|
+
name: string;
|
|
10
|
+
message: string;
|
|
11
|
+
stack?: string | undefined;
|
|
12
|
+
cause?: unknown;
|
|
13
|
+
} | null>;
|
|
14
|
+
open: () => void | undefined;
|
|
15
|
+
exit: (options?: Plaid.ExitOptions) => void | undefined;
|
|
16
|
+
};
|
|
17
|
+
export default usePlaidLink;
|
|
18
|
+
|
|
19
|
+
export { }
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ref as l, watchSyncEffect as c, toValue as f, computed as s, onUnmounted as v } from "vue";
|
|
2
|
+
import p from "./useScriptTag.js";
|
|
3
|
+
const m = "https://cdn.plaid.com/link/v2/stable/link-initialize.js";
|
|
4
|
+
function P(u) {
|
|
5
|
+
const { isLoaded: i, error: r } = p(m), a = l(null), t = l(!1);
|
|
6
|
+
c(() => {
|
|
7
|
+
const e = f(u);
|
|
8
|
+
if (i.value && !(!e.token && !e.receivedRedirectUri)) {
|
|
9
|
+
if (!window.Plaid)
|
|
10
|
+
throw new Error("Error loading Plaid SDK");
|
|
11
|
+
n(), a.value = window.Plaid.create({
|
|
12
|
+
...e,
|
|
13
|
+
onLoad: () => {
|
|
14
|
+
var o;
|
|
15
|
+
t.value = !0, (o = e.onLoad) == null || o.call(e);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const d = s(
|
|
21
|
+
() => !r.value && a.value !== null && (i.value || t.value)
|
|
22
|
+
);
|
|
23
|
+
function n() {
|
|
24
|
+
a.value && (a.value.exit({ force: !0 }), a.value.destroy(), t.value = !1);
|
|
25
|
+
}
|
|
26
|
+
return v(n), {
|
|
27
|
+
ready: d,
|
|
28
|
+
error: r,
|
|
29
|
+
open: () => {
|
|
30
|
+
var e;
|
|
31
|
+
return (e = a.value) == null ? void 0 : e.open();
|
|
32
|
+
},
|
|
33
|
+
exit: (e) => {
|
|
34
|
+
var o;
|
|
35
|
+
return (o = a.value) == null ? void 0 : o.exit(e);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
P as default
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=usePlaidLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePlaidLink.js","sources":["../src/composables/usePlaidLink/usePlaidLink.ts"],"sourcesContent":["import { computed, MaybeRef, onUnmounted, ref, toValue, watchSyncEffect } from 'vue';\n\nimport { Plaid } from '../../../types/plaid';\nimport useScriptTag from '../useScriptTag/useScriptTag';\n\nconst PLAID_SDK_URL = 'https://cdn.plaid.com/link/v2/stable/link-initialize.js';\n\nexport default function usePlaidLink(options: MaybeRef<Plaid.CreateConfig>) {\n const { isLoaded: isPlaidScriptLoaded, error } = useScriptTag(PLAID_SDK_URL);\n\n const plaid = ref<Plaid.LinkHandler | null>(null);\n const iframeLoaded = ref(false);\n\n // We want to trigger this as soon as options ref changes\n watchSyncEffect(() => {\n const optionsVal = toValue(options);\n\n if (!isPlaidScriptLoaded.value) {\n return;\n }\n\n if (!optionsVal.token && !optionsVal.receivedRedirectUri) {\n return;\n }\n\n if (!window.Plaid) {\n throw new Error('Error loading Plaid SDK');\n }\n\n // destroy & exit existing instances so we don't\n // have multiple Plaid link modals at the same time\n teardown();\n\n plaid.value = window.Plaid.create({\n ...optionsVal,\n onLoad: () => {\n iframeLoaded.value = true;\n optionsVal.onLoad?.();\n },\n });\n });\n\n const ready = computed(\n () => !error.value && plaid.value !== null && (isPlaidScriptLoaded.value || iframeLoaded.value),\n );\n\n function teardown() {\n if (plaid.value) {\n plaid.value.exit({ force: true });\n plaid.value.destroy();\n\n iframeLoaded.value = false;\n }\n }\n\n onUnmounted(teardown);\n\n return {\n ready,\n error,\n open: () => plaid.value?.open(),\n exit: (options?: Plaid.ExitOptions) => plaid.value?.exit(options),\n };\n}\n"],"names":["PLAID_SDK_URL","usePlaidLink","options","isPlaidScriptLoaded","error","useScriptTag","plaid","ref","iframeLoaded","watchSyncEffect","optionsVal","toValue","teardown","_a","ready","computed","onUnmounted"],"mappings":";;AAKA,MAAMA,IAAgB;AAEtB,SAAwBC,EAAaC,GAAuC;AAC1E,QAAM,EAAE,UAAUC,GAAqB,OAAAC,EAAM,IAAIC,EAAaL,CAAa,GAErEM,IAAQC,EAA8B,IAAI,GAC1CC,IAAeD,EAAI,EAAK;AAG9B,EAAAE,EAAgB,MAAM;AACd,UAAAC,IAAaC,EAAQT,CAAO;AAE9B,QAACC,EAAoB,SAIrB,GAACO,EAAW,SAAS,CAACA,EAAW,sBAIjC;AAAA,UAAA,CAAC,OAAO;AACJ,cAAA,IAAI,MAAM,yBAAyB;AAKlC,MAAAE,KAEHN,EAAA,QAAQ,OAAO,MAAM,OAAO;AAAA,QAChC,GAAGI;AAAA,QACH,QAAQ,MAAM;;AACZ,UAAAF,EAAa,QAAQ,KACrBK,IAAAH,EAAW,WAAX,QAAAG,EAAA,KAAAH;AAAA,QACF;AAAA,MAAA,CACD;AAAA;AAAA,EAAA,CACF;AAED,QAAMI,IAAQC;AAAA,IACZ,MAAM,CAACX,EAAM,SAASE,EAAM,UAAU,SAASH,EAAoB,SAASK,EAAa;AAAA,EAAA;AAG3F,WAASI,IAAW;AAClB,IAAIN,EAAM,UACRA,EAAM,MAAM,KAAK,EAAE,OAAO,GAAM,CAAA,GAChCA,EAAM,MAAM,WAEZE,EAAa,QAAQ;AAAA,EAEzB;AAEA,SAAAQ,EAAYJ,CAAQ,GAEb;AAAA,IACL,OAAAE;AAAA,IACA,OAAAV;AAAA,IACA,MAAM,MAAM;;AAAA,cAAAS,IAAAP,EAAM,UAAN,gBAAAO,EAAa;AAAA;AAAA,IACzB,MAAM,CAACX,MAAgC;;AAAA,cAAAW,IAAAP,EAAM,UAAN,gBAAAO,EAAa,KAAKX;AAAAA;AAAAA,EAAO;AAEpE;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
declare type UseScriptOptions = {
|
|
4
|
+
manual: boolean;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
declare function useScriptTag(url: string, options?: UseScriptOptions): {
|
|
8
|
+
scriptTag: Ref<HTMLScriptElement | null>;
|
|
9
|
+
load: () => void;
|
|
10
|
+
unload: () => void;
|
|
11
|
+
isLoaded: Ref<boolean>;
|
|
12
|
+
error: Ref<{
|
|
13
|
+
name: string;
|
|
14
|
+
message: string;
|
|
15
|
+
stack?: string | undefined;
|
|
16
|
+
cause?: unknown;
|
|
17
|
+
} | null>;
|
|
18
|
+
};
|
|
19
|
+
export default useScriptTag;
|
|
20
|
+
|
|
21
|
+
export { }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ref as a, onMounted as i, onUnmounted as v } from "vue";
|
|
2
|
+
function f(r, d = { manual: !1 }) {
|
|
3
|
+
const n = a(null), t = a(!1), o = a(null), l = () => t.value = !0, u = (e) => o.value = e.error;
|
|
4
|
+
function c() {
|
|
5
|
+
let e = document.querySelector(`script[src="${r}"]`);
|
|
6
|
+
e ? t.value = !0 : (t.value = !1, o.value = null, e = document.createElement("script"), e.type = "text/javascript", e.async = !0, e.src = r, e.addEventListener("load", l), e.addEventListener("error", u), document.head.appendChild(e)), n.value = e;
|
|
7
|
+
}
|
|
8
|
+
function s() {
|
|
9
|
+
if (!document)
|
|
10
|
+
return;
|
|
11
|
+
const e = document.querySelector(`script[src="${r}"]`);
|
|
12
|
+
e && (e.removeEventListener("load", l), e.removeEventListener("error", u), document.head.removeChild(e), n.value = null, t.value = !1);
|
|
13
|
+
}
|
|
14
|
+
return d.manual || (i(c), v(s)), { scriptTag: n, load: c, unload: s, isLoaded: t, error: o };
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
f as default
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=useScriptTag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScriptTag.js","sources":["../src/composables/useScriptTag/useScriptTag.ts"],"sourcesContent":["import { onMounted, onUnmounted, ref } from 'vue';\n\ntype UseScriptOptions = {\n manual: boolean;\n};\n\nexport default function useScriptTag(url: string, options: UseScriptOptions = { manual: false }) {\n const scriptTag = ref<HTMLScriptElement | null>(null);\n const isLoaded = ref(false);\n const error = ref<Error | null>(null);\n\n const setIsLoaded = () => (isLoaded.value = true);\n const setError = (e: ErrorEvent) => (error.value = e.error);\n\n function loadScript() {\n let el = document.querySelector<HTMLScriptElement>(`script[src=\"${url}\"]`);\n\n if (!el) {\n isLoaded.value = false;\n error.value = null;\n\n el = document.createElement('script');\n\n el.type = 'text/javascript';\n el.async = true;\n el.src = url;\n el.addEventListener('load', setIsLoaded);\n el.addEventListener('error', setError);\n document.head.appendChild(el);\n } else {\n isLoaded.value = true;\n }\n\n scriptTag.value = el;\n }\n\n function unloadScript() {\n if (!document) {\n return;\n }\n\n const elToBeRemoved = document.querySelector<HTMLScriptElement>(`script[src=\"${url}\"]`);\n\n if (elToBeRemoved) {\n elToBeRemoved.removeEventListener('load', setIsLoaded);\n elToBeRemoved.removeEventListener('error', setError);\n\n document.head.removeChild(elToBeRemoved);\n\n scriptTag.value = null;\n isLoaded.value = false;\n }\n }\n\n if (!options.manual) {\n onMounted(loadScript);\n onUnmounted(unloadScript);\n }\n\n return { scriptTag, load: loadScript, unload: unloadScript, isLoaded, error };\n}\n"],"names":["useScriptTag","url","options","scriptTag","ref","isLoaded","error","setIsLoaded","setError","loadScript","el","unloadScript","elToBeRemoved","onMounted","onUnmounted"],"mappings":";AAMA,SAAwBA,EAAaC,GAAaC,IAA4B,EAAE,QAAQ,MAAS;AACzF,QAAAC,IAAYC,EAA8B,IAAI,GAC9CC,IAAWD,EAAI,EAAK,GACpBE,IAAQF,EAAkB,IAAI,GAE9BG,IAAc,MAAOF,EAAS,QAAQ,IACtCG,IAAW,CAAC,MAAmBF,EAAM,QAAQ,EAAE;AAErD,WAASG,IAAa;AACpB,QAAIC,IAAK,SAAS,cAAiC,eAAeT,CAAG,IAAI;AAEzE,IAAKS,IAaHL,EAAS,QAAQ,MAZjBA,EAAS,QAAQ,IACjBC,EAAM,QAAQ,MAETI,IAAA,SAAS,cAAc,QAAQ,GAEpCA,EAAG,OAAO,mBACVA,EAAG,QAAQ,IACXA,EAAG,MAAMT,GACNS,EAAA,iBAAiB,QAAQH,CAAW,GACpCG,EAAA,iBAAiB,SAASF,CAAQ,GAC5B,SAAA,KAAK,YAAYE,CAAE,IAK9BP,EAAU,QAAQO;AAAA,EACpB;AAEA,WAASC,IAAe;AACtB,QAAI,CAAC;AACH;AAGF,UAAMC,IAAgB,SAAS,cAAiC,eAAeX,CAAG,IAAI;AAEtF,IAAIW,MACYA,EAAA,oBAAoB,QAAQL,CAAW,GACvCK,EAAA,oBAAoB,SAASJ,CAAQ,GAE1C,SAAA,KAAK,YAAYI,CAAa,GAEvCT,EAAU,QAAQ,MAClBE,EAAS,QAAQ;AAAA,EAErB;AAEI,SAACH,EAAQ,WACXW,EAAUJ,CAAU,GACpBK,EAAYH,CAAY,IAGnB,EAAE,WAAAR,GAAW,MAAMM,GAAY,QAAQE,GAAc,UAAAN,GAAU,OAAAC;AACxE;"}
|
package/package.json
CHANGED
package/types/index.ts
CHANGED