@everymatrix/player-profile-info 0.0.294 → 0.0.297

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/player-profile-info",
3
- "version": "0.0.294",
3
+ "version": "0.0.297",
4
4
  "main": "dist/player-profile-info.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -36,5 +36,5 @@
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "3fe9793aa0c46e63b382cbbdb0ee1dc1f0f4a12f"
39
+ "gitHead": "c043babf99ed6c5f8071d070e303b123fd5016fc"
40
40
  }
@@ -114,26 +114,26 @@
114
114
  firstname = profileDetails.firstname;
115
115
  lastname = profileDetails.lastname;
116
116
  language = profileDetails.language;
117
- birth = profileDetails.birth.day + '/' + profileDetails.birth.month + '/' + profileDetails.birth.year;
117
+ birth = profileDetails.birth?.day + '/' + profileDetails.birth?.month + '/' + profileDetails.birth?.year;
118
118
  currency = profileDetails.currency;
119
119
  userTitles = profileDetails.title;
120
120
 
121
121
  // editable field values used for bindings
122
- giveConsentSMS = profileDetails.consents.acceptSMSOffers;
123
- giveConsentEmail = profileDetails.consents.acceptNewsEmail;
122
+ giveConsentSMS = profileDetails.consents?.acceptSMSOffers;
123
+ giveConsentEmail = profileDetails.consents?.acceptNewsEmail;
124
124
  playerQuestion = profileDetails.securityQuestion;
125
125
  playerAnswer = profileDetails.securityAnswer;
126
- playerPrefix = profileDetails.mobile.prefix;
127
- playerMobileNumber = profileDetails.mobile.number;
126
+ playerPrefix = profileDetails.mobile?.prefix;
127
+ playerMobileNumber = profileDetails.mobile?.number;
128
128
 
129
129
  // set values for the initial editable values object
130
130
  initialValuesArray = {
131
131
  address: profileDetails.address1,
132
132
  city: profileDetails.city,
133
- acceptNewsEmail: profileDetails.consents.acceptNewsEmail,
134
- acceptSMSOffers: profileDetails.consents.acceptSMSOffers,
135
- mobilePrefix: mobile.prefix,
136
- mobileNumber: mobile.number,
133
+ acceptNewsEmail: profileDetails.consents?.acceptNewsEmail,
134
+ acceptSMSOffers: profileDetails.consents?.acceptSMSOffers,
135
+ mobilePrefix: mobile?.prefix,
136
+ mobileNumber: mobile?.number,
137
137
  postalCode: profileDetails.postalCode,
138
138
  securityAnswer: profileDetails.securityAnswer,
139
139
  securityQuestion: profileDetails.securityQuestion,
@@ -170,11 +170,29 @@
170
170
 
171
171
  const getCountriesList = ():void => {
172
172
  fetch(`${endpoint}/player/countries`)
173
- .then((res:any) => res.json())
174
- .then((data:any) => {
175
- countriesArray = data.countries;
176
- selectedCountry = countriesArray.find((country:any) => country.Alpha2Code === countrycode) || { Name: 'I.E. Ireland'};
177
- isLoading = false;
173
+ .then((res:any) => {
174
+ if (res.status >= 300) {
175
+ return new Error('Error while fetching the countries');
176
+ }
177
+
178
+ return res.json();
179
+ })
180
+ .then((countryList:any) => {
181
+ fetch(`${endpoint}/player/operatorSupportedCountries`).then((res:any) => {
182
+ if (res.status >= 300) {
183
+ return new Error('Error while fetching the supported countries');
184
+ }
185
+
186
+ return res.json();
187
+ })
188
+ .then((supportedCountries:any) => {
189
+ countriesArray = countryList.countries.filter((item:any) => {
190
+ return supportedCountries.countries.indexOf(item.Alpha2Code) >= 0;
191
+ });
192
+
193
+ selectedCountry = countriesArray.find((country:any) => country.Alpha2Code === countrycode) || { Name: 'I.E. Ireland'};
194
+ isLoading = false;
195
+ });
178
196
  });
179
197
  }
180
198