@sbc-connect/nuxt-pay 0.1.16 → 0.1.18

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/.env.example CHANGED
@@ -2,6 +2,7 @@
2
2
  NUXT_PUBLIC_BASE_URL="http://localhost:3000/"
3
3
  NUXT_PUBLIC_REGISTRY_HOME_URL="https://dev.bcregistry.gov.bc.ca/"
4
4
  NUXT_PUBLIC_AUTH_WEB_URL="https://dev.account.bcregistry.gov.bc.ca/"
5
+ NUXT_PUBLIC_PAYMENT_PORTAL_URL="https://dev.account.bcregistry.gov.bc.ca/makepayment/"
5
6
 
6
7
  # API Key
7
8
  NUXT_PUBLIC_X_API_KEY=""
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @sbc-connect/nuxt-pay
2
2
 
3
+ ## 0.1.18
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @sbc-connect/nuxt-auth@0.1.18
9
+
10
+ ## 0.1.17
11
+
12
+ ### Patch Changes
13
+
14
+ - [#58](https://github.com/bcgov/connect-nuxt/pull/58) [`a98c264`](https://github.com/bcgov/connect-nuxt/commit/a98c2647e041061223d504c8e974670148c08c0b) Thanks [@deetz99](https://github.com/deetz99)! - Fix base layout, add loading state to fee widget
15
+
16
+ - Updated dependencies []:
17
+ - @sbc-connect/nuxt-auth@0.1.17
18
+
3
19
  ## 0.1.16
4
20
 
5
21
  ### Patch Changes
package/app/app.config.ts CHANGED
@@ -1,2 +1 @@
1
- /* eslint-disable max-len */
2
1
  export default defineAppConfig({})
@@ -1,12 +1,24 @@
1
1
  <script setup lang="ts">
2
- defineProps<{ description: string, fee: number, showFeeValue: boolean }>()
2
+ const { t } = useI18n()
3
+
4
+ const props = defineProps<{ description: string, fee: number, showFeeValue: boolean }>()
5
+
6
+ const itemFee = computed(() => {
7
+ const total = props.fee.toFixed(2)
8
+ if (total === '0.00') {
9
+ return t('connect.label.noFee')
10
+ }
11
+ return `$${total}`
12
+ })
3
13
  </script>
4
14
 
5
15
  <template>
6
- <div class="flex justify-between pl-9 pr-4 py-3">
7
- <p class="font-bold">
16
+ <div class="flex justify-between pl-9 pr-3 py-3">
17
+ <p class="font-bold text-highlighted">
8
18
  {{ description }}
9
19
  </p>
10
- <p>{{ showFeeValue ? `$${fee.toFixed(2)}`: '$ -' }}</p>
20
+ <p class="text-highlighted">
21
+ {{ showFeeValue ? itemFee: '$ -' }}
22
+ </p>
11
23
  </div>
12
24
  </template>
@@ -14,7 +14,8 @@ const {
14
14
  userSelectedPaymentMethod,
15
15
  allowedPaymentMethods,
16
16
  userPaymentAccount,
17
- allowAlternatePaymentMethod
17
+ allowAlternatePaymentMethod,
18
+ loading
18
19
  } = storeToRefs(useConnectFeeStore())
19
20
 
20
21
  const isPlaceholderActive = ref(false)
@@ -60,10 +61,11 @@ const getItemFee = (feeItem: ConnectFeeItem) => {
60
61
  if (feeItem.isPlaceholder) {
61
62
  return '$ -'
62
63
  }
63
- if (feeItem.waived) {
64
+ const total = (feeItem.filingFees * (feeItem.quantity || 1)).toFixed(2)
65
+ if (feeItem.waived || total === '0.00') {
64
66
  return t('connect.label.noFee')
65
67
  }
66
- return `$${(feeItem.filingFees * (feeItem.quantity || 1)).toFixed(2)}`
68
+ return `$${total}`
67
69
  }
68
70
  </script>
69
71
 
@@ -75,7 +77,7 @@ const getItemFee = (feeItem: ConnectFeeItem) => {
75
77
  <UButton
76
78
  :tabindex="isFoldable ? 0 : -1"
77
79
  :role="isFoldable ? 'button' : 'title'"
78
- class="flex w-full bg-brand py-2 pl-4 text-lg lg:text-3xl font-bold transition-all"
80
+ class="flex w-full bg-brand py-2 pl-3 text-lg font-bold transition-all"
79
81
  :class="[folded ? 'rounded' : 'rounded-b-none rounded-t', isFoldable ? '' : 'pointer-events-none']"
80
82
  :aria-label="$t('connect.label.feeSummary')"
81
83
  :label="$t('connect.label.feeSummary')"
@@ -93,16 +95,20 @@ const getItemFee = (feeItem: ConnectFeeItem) => {
93
95
  </UButton>
94
96
  <ConnectTransitionCollapse>
95
97
  <div v-if="!folded">
96
- <div class="divide-y divide-line-muted pt-1 text-sm">
98
+ <div v-if="loading && !isPlaceholderActive" class="flex justify-between p-3">
99
+ <USkeleton class="h-5 w-1/2 max-w-[150px]" />
100
+ <USkeleton class="h-5 w-1/4 max-w-[100px]" />
101
+ </div>
102
+ <div v-else class="divide-y divide-line-muted text-sm">
97
103
  <div
98
104
  v-for="feeItem in feeItems"
99
105
  :key="feeItem.filingTypeCode"
100
106
  data-testid="fee-item"
101
- class="flex justify-between px-4 py-3"
107
+ class="flex justify-between p-3"
102
108
  >
103
109
  <div>
104
110
  <p class="flex items-center gap-1 font-bold">
105
- <span>{{ feeItem.label }}</span>
111
+ <span class="text-highlighted">{{ feeItem.label }}</span>
106
112
  </p>
107
113
  <p
108
114
  v-if="feeItem.quantity !== undefined && feeItem.quantityDesc"
@@ -111,7 +117,9 @@ const getItemFee = (feeItem: ConnectFeeItem) => {
111
117
  x {{ feeItem.quantity }} {{ feeItem.quantityDesc }}
112
118
  </p>
113
119
  </div>
114
- <p>{{ getItemFee(feeItem) }}</p>
120
+ <p class="text-highlighted">
121
+ {{ getItemFee(feeItem) }}
122
+ </p>
115
123
  </div>
116
124
  <ConnectFeeExtraFee
117
125
  v-if="!!feeOptions.showFutureEffectiveFee || (!!feeOptions.showAllActiveFees && totalFutureEffectiveFees)"
@@ -160,10 +168,13 @@ const getItemFee = (feeItem: ConnectFeeItem) => {
160
168
  data-testid="total-fee"
161
169
  class="flex flex-row items-end justify-between border-t border-line-muted p-3"
162
170
  >
163
- <p class="mb-1 font-bold">
171
+ <USkeleton v-if="loading && !isPlaceholderActive" class="h-8 w-1/3 max-w-[100px]" />
172
+ <p v-else class="mb-1 font-bold text-highlighted">
164
173
  {{ $t("connect.label.totalFees") }}
165
174
  </p>
166
- <p class="flex items-end text-sm text-neutral">
175
+
176
+ <USkeleton v-if="loading && !isPlaceholderActive" class="h-8 w-1/3 max-w-[100px]" />
177
+ <p v-else class="flex items-end text-sm text-neutral">
167
178
  <span class="mb-1">{{ $t("connect.label.cad") }}</span>
168
179
  <b class="ml-[5px] flex items-end text-2xl text-black">
169
180
  {{ !isPlaceholderActive ? `$${total.toFixed(2)}` : '$ -' }}
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <div class="flex flex-col lg:flex-row lg:gap-6 grow">
3
- <div class="grow max-w-full overflow-hidden">
2
+ <div class="flex flex-col lg:flex-row lg:gap-6 grow app-inner-container">
3
+ <div class="grow overflow-hidden">
4
4
  <slot />
5
5
  </div>
6
6
 
@@ -0,0 +1,7 @@
1
+ export enum ConnectPayStatus {
2
+ CREATED = 'CREATED',
3
+ COMPLETED = 'COMPLETED',
4
+ DELETED = 'DELETED',
5
+ REFUNDED = 'REFUNDED',
6
+ FAILED = 'FAILED'
7
+ }
@@ -34,12 +34,14 @@ export const useConnectFeeStore = defineStore('connect-pay-fee-store', () => {
34
34
  total: 0
35
35
  }
36
36
  const placeholderFeeItem = ref<ConnectFeeItem>(defaultPlaceholder)
37
+ const loading = ref<boolean>(false)
37
38
 
38
39
  const initFees = async (
39
40
  feeCodes: { code: string, entityType: string, label: string, quantityDesc?: string }[],
40
41
  placeholder: { label: string, matchServiceFeeToCode?: string },
41
42
  options?: ConnectFeeOptions
42
43
  ) => {
44
+ loading.value = true
43
45
  // Get all the fee information for each fee code from the pay api
44
46
  const feePromises = []
45
47
  for (const feeInfo of feeCodes) {
@@ -72,6 +74,7 @@ export const useConnectFeeStore = defineStore('connect-pay-fee-store', () => {
72
74
  ...options
73
75
  }
74
76
  }
77
+ loading.value = false
75
78
  }
76
79
 
77
80
  const getTotalFromFees = (feeValue: string, isTax = false) => {
@@ -249,6 +252,7 @@ export const useConnectFeeStore = defineStore('connect-pay-fee-store', () => {
249
252
  feeOptions.value = defaultFeeOptions
250
253
  fees.value = {}
251
254
  placeholderFeeItem.value = defaultPlaceholder
255
+ loading.value = false
252
256
  $resetAlternatePayOptions()
253
257
  }
254
258
 
@@ -263,6 +267,7 @@ export const useConnectFeeStore = defineStore('connect-pay-fee-store', () => {
263
267
  totalPst,
264
268
  totalServiceFees,
265
269
  total,
270
+ loading,
266
271
  initFees,
267
272
  addReplaceFee,
268
273
  removeFee,
package/nuxt.config.ts CHANGED
@@ -42,7 +42,8 @@ export default defineNuxtConfig({
42
42
  runtimeConfig: {
43
43
  public: {
44
44
  payApiUrl: '',
45
- payApiVersion: ''
45
+ payApiVersion: '',
46
+ paymentPortalUrl: ''
46
47
  }
47
48
  }
48
49
  })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sbc-connect/nuxt-pay",
3
3
  "type": "module",
4
- "version": "0.1.16",
4
+ "version": "0.1.18",
5
5
  "repository": "github:bcgov/connect-nuxt",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "./nuxt.config.ts",
@@ -17,7 +17,7 @@
17
17
  "@sbc-connect/vitest-config": "0.0.6"
18
18
  },
19
19
  "dependencies": {
20
- "@sbc-connect/nuxt-auth": "0.1.16"
20
+ "@sbc-connect/nuxt-auth": "0.1.18"
21
21
  },
22
22
  "scripts": {
23
23
  "preinstall": "npx only-allow pnpm",
@@ -31,6 +31,7 @@
31
31
  "test": "pnpm run test:unit; pnpm run test:e2e",
32
32
  "test:unit": "vitest run",
33
33
  "test:e2e": "npx playwright test",
34
+ "test:e2e:ui": "npx playwright test --ui",
34
35
  "typecheck": "npx nuxt typecheck"
35
36
  }
36
37
  }