@designcrowd/fe-shared-lib 1.1.3 → 1.1.4-gt-7422

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/Dockerfile CHANGED
@@ -27,7 +27,7 @@ COPY . .
27
27
  COPY .npmignore ./
28
28
 
29
29
  RUN mkdir artifacts
30
- RUN npm publish || touch artifacts/npm_publish_failed
30
+ RUN npm publish -otp=881429 || touch artifacts/npm_publish_failed
31
31
  RUN cp package.json artifacts/
32
32
 
33
33
  ENTRYPOINT ["/bin/echo", "Nothing to do."]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designcrowd/fe-shared-lib",
3
- "version": "1.1.3",
3
+ "version": "1.1.4-gt-7422",
4
4
  "scripts": {
5
5
  "start": "npm run storybook",
6
6
  "build": "npm run build:css --production",
@@ -24,7 +24,24 @@ const getPaymentConfigsByBrandPageToken = async (brandPageToken) => {
24
24
  }
25
25
  };
26
26
 
27
+ const deletePaymentConfigByBrandPageTokenAndConfigId = async (brandPageToken, paymentConfigId) => {
28
+ try {
29
+ const response = await getAxios().delete(`/maker/api/brand-pages/${brandPageToken}/payment-configs`, {
30
+ data: { PaymentConfigId: paymentConfigId },
31
+ });
32
+
33
+ if (response.status === 200) {
34
+ return response.data;
35
+ }
36
+
37
+ return null;
38
+ } catch (err) {
39
+ return null;
40
+ }
41
+ };
42
+
27
43
  export default {
28
44
  setBrandPageApiClientAxios,
29
45
  getPaymentConfigsByBrandPageToken,
46
+ deletePaymentConfigByBrandPageTokenAndConfigId,
30
47
  };
@@ -1,4 +1,5 @@
1
1
  import brandPageApiClient from '../../clients/brand-page-api.client';
2
+ import vClickOutside from 'click-outside-vue3';
2
3
 
3
4
  export const paymentConfigStatuses = Object.freeze({
4
5
  active: 'Active',
@@ -24,9 +25,14 @@ export default {
24
25
  default: undefined,
25
26
  },
26
27
  },
28
+ directives: {
29
+ clickOutside: vClickOutside,
30
+ },
27
31
  data: () => ({
28
32
  isLoading: true,
29
33
  paymentConfigs: [],
34
+ selectedPaymentConfig: {},
35
+ isStripeOptionActionVisible: false,
30
36
  }),
31
37
  methods: {
32
38
  getPaymentConfigStatusDisplayText(paymentConfigStatus) {
@@ -0,0 +1,106 @@
1
+ <template>
2
+ <Modal
3
+ full-screen-breakpoint="sm"
4
+ classes="publish-bp--modal tw-px-2 md:tw-px-8"
5
+ close-on-esc
6
+ :visible="true"
7
+ :hide-scrollbar="false"
8
+ @close-modal="onCloseModal"
9
+ >
10
+ <template #header>
11
+ <div class="tw-text-center tw-font-bold tw-mb-4 tw-mt-8 tw-text-2xl">
12
+ <span>Delete Payment Provider</span>
13
+ </div>
14
+ </template>
15
+ <template #default>
16
+ <div class="tw-text-center tw-w-full tw-border-0 tw-border-solid tw-border-grayscale-400 tw-border-t tw-p-4">
17
+ <div v-if="isLoading" class="tw-flex tw-justify-center">
18
+ <Loader />
19
+ </div>
20
+ <div v-else>
21
+ <div class="tw-text-center tw-w-full">
22
+ <p class="tw-text-grayscale-600">Are you sure you want to delete this payment provider?</p>
23
+ <p class="tw-text-grayscale-600">
24
+ Once deleted, your site will no longer show any payment options to visitors. You won’t be able to accept
25
+ payments unless you set up a new provider.
26
+ </p>
27
+ </div>
28
+ </div>
29
+ </div>
30
+ </template>
31
+ <template #footer>
32
+ <div
33
+ class="tw-font-sans tw-text-center tw-flex tw-gap-2 tw-justify-center tw-mt-4 tw-border-0 tw-border-solid tw-border-grayscale-400 tw-border-t"
34
+ :style="isMobile ? 'padding-left: 1.5rem; padding-right: 1.5rem;' : ''"
35
+ >
36
+ <Button label="Cancel" size="medium" variant="outline" class="tw-my-4" @on-click="onCloseModal" />
37
+ <Button label="Delete Provider" variant="primary" size="medium" class="tw-my-4" @on-click="onConfirmDelete" />
38
+ </div>
39
+ </template>
40
+ </Modal>
41
+ </template>
42
+ <script>
43
+ import Modal from '../../../../src/atoms/components/Modal/Modal.vue';
44
+ import Button from '../../../../src/atoms/components/Button/Button.vue';
45
+ import Loader from '../../../../src/atoms/components/Loader/Loader.vue';
46
+ import brandPageApiClient from './../../clients/brand-page-api.client';
47
+ export default {
48
+ components: {
49
+ Modal,
50
+ Button,
51
+ Loader,
52
+ },
53
+ emits: ['close-modal', 'on-delete'],
54
+ props: {
55
+ paymentConfig: {
56
+ type: Object,
57
+ required: true,
58
+ default: () => ({}),
59
+ },
60
+ brandPageToken: {
61
+ type: String,
62
+ required: false,
63
+ },
64
+ },
65
+ data: () => ({
66
+ isLoading: false,
67
+ }),
68
+ methods: {
69
+ onCloseModal() {
70
+ this.$emit('close-modal');
71
+ },
72
+
73
+ async onConfirmDelete() {
74
+ const paymentConfigId = this.paymentConfig.id;
75
+ if (!this.brandPageToken) {
76
+ if (process.env.NODE_ENV !== 'production') {
77
+ console.error(`brandPageToken is required`);
78
+ }
79
+ return;
80
+ }
81
+
82
+ if (!paymentConfigId) {
83
+ if (process.env.NODE_ENV !== 'production') {
84
+ console.error(`paymentConfigId is required`);
85
+ }
86
+ return;
87
+ }
88
+
89
+ try {
90
+ this.isLoading = true;
91
+
92
+ const result = await brandPageApiClient.deletePaymentConfigByBrandPageTokenAndConfigId(
93
+ this.brandPageToken,
94
+ paymentConfigId,
95
+ );
96
+
97
+ if (result) {
98
+ this.$emit('on-delete', paymentConfigId);
99
+ }
100
+ } finally {
101
+ this.isLoading = false;
102
+ }
103
+ },
104
+ },
105
+ };
106
+ </script>
@@ -4,44 +4,130 @@
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"
15
15
  :class="{ 'tw-mb-2': index !== paymentConfigs.length - 1 }"
16
16
  >
17
17
  <img class="tw-h-6" :src="paymentConfig.paymentProviderImageUrl" alt="Payment provider's logo" />
18
- <span class="tw-text-sm tw-grow tw-select-none tw-flex tw-flex-col">
19
- <span>{{ paymentConfig.name }}</span>
20
- <small class="stripe-acct">({{ paymentConfig.paymentProviderExternalId }})</small>
21
- </span>
22
- <p
23
- class="tw-ml-auto tw-text-xs tw-rounded-full tw-py-0.5 tw-my-0 tw-text-white tw-px-4 tw-outline-none tw-uppercase"
24
- :class="getPaymentConfigStatusDisplayClasses(paymentConfig.status)"
25
- >
26
- {{ getPaymentConfigStatusDisplayText(paymentConfig.status) }}
27
- </p>
18
+ <div class="tw-flex tw-gap-4 tw-w-full tw-items-center">
19
+ <div class="tw-flex status-alignment tw-justify-between tw-gap-2 tw-w-full">
20
+ <span class="tw-text-sm tw-grow tw-select-none tw-flex tw-flex-col">
21
+ <span>{{ paymentConfig.name }}</span>
22
+ <small class="stripe-acct">({{ paymentConfig.paymentProviderExternalId }})</small>
23
+ </span>
24
+ <p
25
+ class="tw-flex tw-items-center tw-h-fit tw-w-fit tw-text-xs tw-rounded-full tw-py-0.5 tw-my-0 tw-text-white tw-px-4 tw-outline-none tw-uppercase"
26
+ :class="getPaymentConfigStatusDisplayClasses(paymentConfig.status)"
27
+ >
28
+ {{ getPaymentConfigStatusDisplayText(paymentConfig.status) }}
29
+ </p>
30
+ </div>
31
+ <Button
32
+ icon="other"
33
+ variant="no-border"
34
+ icon-size="sm"
35
+ size="sm"
36
+ @on-click.stop="onClickStripeOptions(index)"
37
+ />
38
+ </div>
28
39
  </div>
29
- </a>
40
+
41
+ <!-- Dropdown options -->
42
+ <ul
43
+ v-if="activeStripeOptionIndex === index"
44
+ 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"
45
+ >
46
+ <li
47
+ class="tw-py-2 tw-px-3 tw-cursor-pointer tw-text-sm hover:tw-bg-grayscale-200"
48
+ @click="onClickDeleteConfirmation(paymentConfig.id)"
49
+ >
50
+ <span class="tw-whitespace-nowrap tw-flex tw-gap-2"
51
+ ><Icon name="delete" size="sm" />Delete payment method</span
52
+ >
53
+ </li>
54
+ </ul>
55
+ </div>
30
56
  </div>
31
57
  </div>
58
+ <PaymentConfigDeleteConfigModal
59
+ v-if="showDeleteConfirmationModal"
60
+ :payment-config="selectedPaymentConfig"
61
+ :brand-page-token="brandPageToken"
62
+ @close-modal="onCloseModal"
63
+ @on-delete="onLoadPaymentConfigs"
64
+ />
32
65
  </template>
66
+
33
67
  <script>
34
68
  import Loader from '../../../../src/atoms/components/Loader/Loader.vue';
69
+ import Button from '../../../../src/atoms/components/Button/Button.vue';
70
+ import PaymentConfigDeleteConfigModal from './PaymentConfigDeleteConfigModal.vue';
71
+ import Icon from '../../../../src/atoms/components/Icon/Icon.vue';
35
72
 
36
73
  import PaymentConfigMixin from './PaymentConfig.mixin';
37
74
 
38
75
  export default {
39
76
  components: {
40
77
  Loader,
78
+ Button,
79
+ Icon,
80
+ PaymentConfigDeleteConfigModal,
41
81
  },
82
+
42
83
  mixins: [PaymentConfigMixin],
84
+ emits: ['on-load'],
85
+ data() {
86
+ return {
87
+ activeStripeOptionIndex: null,
88
+ showDeleteConfirmationModal: false,
89
+ };
90
+ },
91
+ methods: {
92
+ onClickStripeOptions(index) {
93
+ this.activeStripeOptionIndex = this.activeStripeOptionIndex === index ? null : index;
94
+ },
95
+
96
+ onClickDeleteConfirmation(id) {
97
+ this.selectedPaymentConfig = this.paymentConfigs.find((x) => x.id === id);
98
+ this.showDeleteConfirmationModal = true;
99
+ },
100
+
101
+ onCloseModal() {
102
+ this.showDeleteConfirmationModal = false;
103
+ },
104
+
105
+ onClickOutsideStripeOptions() {
106
+ this.activeStripeOptionIndex = null;
107
+ },
108
+ onLoadPaymentConfigs(paymentConfigId) {
109
+ this.showDeleteConfirmationModal = false;
110
+ this.paymentConfigs = this.paymentConfigs.filter((p) => p.id !== paymentConfigId);
111
+ this.$emit('on-load', this.paymentConfigs);
112
+ },
113
+ },
43
114
  async mounted() {
44
115
  await this.updatePaymentConfigs();
45
116
  },
46
117
  };
47
118
  </script>
119
+ <style>
120
+ .top-class {
121
+ top: 3rem;
122
+ }
123
+ @media (min-width: 640px) {
124
+ .status-alignment {
125
+ @apply tw-flex-row tw-items-center;
126
+ }
127
+ }
128
+ @media (max-width: 640px) {
129
+ .status-alignment {
130
+ @apply tw-flex-col;
131
+ }
132
+ }
133
+ </style>
@@ -162,7 +162,7 @@ export default {
162
162
  uploadMultiple: false,
163
163
  acceptedFiles: ACCEPTED_MIME_TYPES.join(','),
164
164
  accept(file) {
165
- const extension = file.name.split('.').pop();
165
+ const extension = file.name.split('.').pop().toLowerCase();
166
166
 
167
167
  if (ACCEPTED_FILE_EXTENSIONS.indexOf(extension) < 0) {
168
168
  self.displayError(UNSUPPORTED_FILE_ERROR_MSG);