@everymatrix/cashier-methods-list 1.29.8 → 1.30.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/cashier-methods-list",
3
- "version": "1.29.8",
3
+ "version": "1.30.0",
4
4
  "main": "index.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -35,5 +35,5 @@
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "a6ce52ac3c8209814f7d801c927c7d2d9224b2ae"
38
+ "gitHead": "b9795b320e7d96e10963f25cdea2d9300029d8d7"
39
39
  }
@@ -10,11 +10,12 @@
10
10
  export let endpoint:string;
11
11
  export let session:string;
12
12
  export let customerid: string;
13
+ export let assetsurl: string;
13
14
  export let currency: string;
14
15
  export let numberofmethodsshown: string;
15
16
  export let translationurl:string='';
16
17
  export let clientstyling:string = '';
17
- export let clientstylingurl:string = ''
18
+ export let clientstylingurl:string = '';
18
19
 
19
20
  let paymethnames = [];
20
21
  let logoSrc = '';
@@ -26,8 +27,9 @@
26
27
  let selectedPaymentMethod: string;
27
28
  let methodsButtonToggleText: string = '';
28
29
  let paymentMethodsToShow: PaymentMethod[] = [];
29
- let showMerchantList: boolean = true;
30
+ let showMethodsList: boolean = true;
30
31
  let formatter = new Intl.NumberFormat(local, {minimumFractionDigits: 2 });
32
+ let errorMessage = '';
31
33
 
32
34
  $: endpoint && session && customerid && getMetaData();
33
35
  $: lang && setActiveLanguage();
@@ -73,6 +75,10 @@
73
75
  })
74
76
  }
75
77
  fetch(url, requestParams).then(res => res.json()).then(data => {
78
+ if (data.error) {
79
+ errorMessage = data.error;
80
+ return;
81
+ }
76
82
  paymentMethods = data.PaymentMethods.PaymentMethods.map((payMeth) => ({
77
83
  ...payMeth,
78
84
  LogoUrl: payMeth.Logos && payMeth.Logos.length && payMeth.Logos[0].LogoUrl ? `https:${payMeth.Logos[0].LogoUrl}` : '',
@@ -109,11 +115,11 @@
109
115
  }
110
116
 
111
117
  const showMethodList = () => {
112
- showMerchantList = true;
118
+ showMethodsList = true;
113
119
  }
114
120
 
115
121
  const hideMethodList = (e) => {
116
- showMerchantList = !e.detail.hideMethodsList;
122
+ showMethodsList = !e.detail.hideMethodsList;
117
123
  }
118
124
 
119
125
  const setClientStyling = ():void => {
@@ -150,7 +156,7 @@
150
156
 
151
157
  </script>
152
158
 
153
- {#if showMerchantList }
159
+ {#if showMethodsList }
154
160
  <div class="CashierMethodListWidget" bind:this={customStylingContainer}>
155
161
  <div class="CashierMethodList">
156
162
  {#each paymentMethodsToShow as payMeth, index}
@@ -174,6 +180,19 @@
174
180
  {/if}
175
181
  </div>
176
182
  {/if}
183
+ {#if errorMessage}
184
+ <cashier-error
185
+ {lang}
186
+ {assetsurl}
187
+ {translationurl}
188
+ {clientstylingurl}
189
+ {clientstyling}
190
+ hidebuttons="true"
191
+ >
192
+ <span slot="text">{errorMessage}</span>
193
+ </cashier-error>
194
+ {/if}
195
+
177
196
  <style lang="scss">
178
197
  $color-black-transparency-10: var(--mmw--color-black-transparency-10, rgba(0, 0, 0, .1));
179
198
  $border-radius-medium-plus: var(--mmw--border-radius-medium-plus, 6px);