@designcrowd/fe-shared-lib 1.1.2 → 1.1.3-kp-2

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.
@@ -4,11 +4,11 @@
4
4
  <Loader />
5
5
  </div>
6
6
  <div v-else>
7
- <a
7
+ <div
8
8
  v-for="(paymentConfig, index) in paymentConfigs"
9
9
  :key="paymentConfig.id"
10
- :href="paymentConfig.dashboardUrl"
11
- target="_blank"
10
+ v-click-outside="onClickOutsideStripeOptions"
11
+ class="tw-relative"
12
12
  >
13
13
  <div
14
14
  class="tw-w-full tw-flex tw-font-sans tw-text-sm tw-items-center tw-p-3 tw-gap-2 tw-rounded tw-bg-white tw-border tw-border-solid tw-border-grayscale-500 tw-text-secondary-500 hover:tw-bg-grayscale-200"
@@ -25,23 +25,93 @@
25
25
  >
26
26
  {{ getPaymentConfigStatusDisplayText(paymentConfig.status) }}
27
27
  </p>
28
+ <Button
29
+ icon="other"
30
+ variant="no-border"
31
+ icon-size="sm"
32
+ size="sm"
33
+ @on-click.stop="onClickStripeOptions(index)"
34
+ />
28
35
  </div>
29
- </a>
36
+
37
+ <!-- Dropdown options -->
38
+ <ul
39
+ v-if="activeStripeOptionIndex === index"
40
+ class="tw-absolute tw-right-0 top-class tw-list-none tw-bg-white tw-rounded tw-border tw-border-solid tw-border-grayscale-500 tw-shadow-md tw-py-3 tw-z-30 tw-text-left"
41
+ >
42
+ <li
43
+ class="tw-py-2 tw-px-3 tw-cursor-pointer tw-text-sm hover:tw-bg-grayscale-200"
44
+ @click="onClickDeleteConfirmation(paymentConfig.id)"
45
+ >
46
+ <span class="tw-whitespace-nowrap tw-flex tw-gap-2"
47
+ ><Icon name="delete" size="sm" />Delete payment method</span
48
+ >
49
+ </li>
50
+ </ul>
51
+ </div>
30
52
  </div>
31
53
  </div>
54
+ <PaymentConfigDeleteConfigModal
55
+ v-if="showDeleteConfirmationModal"
56
+ :payment-config="selectedPaymentConfig"
57
+ :brand-page-token="brandPageToken"
58
+ @close-modal="onCloseModal"
59
+ />
32
60
  </template>
61
+
33
62
  <script>
34
63
  import Loader from '../../../../src/atoms/components/Loader/Loader.vue';
64
+ import Button from '../../../../src/atoms/components/Button/Button.vue';
65
+ import PaymentConfigDeleteConfigModal from './PaymentConfigDeleteConfigModal.vue';
66
+ import Icon from '../../../../src/atoms/components/Icon/Icon.vue';
35
67
 
36
68
  import PaymentConfigMixin from './PaymentConfig.mixin';
37
69
 
38
70
  export default {
39
71
  components: {
40
72
  Loader,
73
+ Button,
74
+ Icon,
75
+ PaymentConfigDeleteConfigModal,
41
76
  },
77
+
42
78
  mixins: [PaymentConfigMixin],
79
+ data() {
80
+ return {
81
+ activeStripeOptionIndex: null,
82
+ showDeleteConfirmationModal: false,
83
+ };
84
+ },
85
+ methods: {
86
+ onClickStripeOptions(index) {
87
+ this.activeStripeOptionIndex = this.activeStripeOptionIndex === index ? null : index;
88
+ },
89
+
90
+ onClickDeleteConfirmation(id) {
91
+ this.selectedPaymentConfig = this.paymentConfigs.find((x) => x.id === id);
92
+ this.showDeleteConfirmationModal = true;
93
+ },
94
+
95
+ onCloseModal() {
96
+ this.showDeleteConfirmationModal = false;
97
+ },
98
+
99
+ onClickOutsideStripeOptions() {
100
+ debugger;
101
+ this.activeStripeOptionIndex = null;
102
+ },
103
+ onLoadPaymentConfigs(paymentConfigId) {
104
+ this.paymentConfigs = result.filter((p) => this.paymentConfigs.some((p) => p.id === paymentConfigId));
105
+ this.$emit('on-load', this.paymentConfigs);
106
+ },
107
+ },
43
108
  async mounted() {
44
109
  await this.updatePaymentConfigs();
45
110
  },
46
111
  };
47
112
  </script>
113
+ <style>
114
+ .top-class {
115
+ top: 0.5rem;
116
+ }
117
+ </style>