@plusscommunities/pluss-maintenance-web-forms 1.1.25-beta.2 → 1.1.25-beta.3

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/dist/index.cjs.js CHANGED
@@ -4954,16 +4954,45 @@ var AddJob = /*#__PURE__*/function (_Component) {
4954
4954
 
4955
4955
  if (!___default['default'].isEmpty(_this.state.customFields) && !___default['default'].some(_this.state.customFields, 'isTitle')) {
4956
4956
  update.title = user.displayName;
4957
- }
4957
+ } // Update UI immediately (non-blocking)
4958
4958
 
4959
- _this.setState(update);
4959
+
4960
+ _this.setState(update); // PC-1255: Auto-populate contact details when staff create requests on behalf of residents
4961
+ // Requires userManagement permission - gracefully falls back to manual entry if denied
4962
+ // Fetch in background to avoid blocking UI
4963
+
4964
+
4965
+ userActions.fetchUser(_this.props.auth.site, user.userId).then(function (response) {
4966
+ if (response.data && response.data.user) {
4967
+ var contactUpdate = {}; // Auto-populate phone and room from user profile
4968
+
4969
+ if (response.data.user.phoneNumber) {
4970
+ contactUpdate.phone = response.data.user.phoneNumber;
4971
+ }
4972
+
4973
+ if (response.data.user.unit) {
4974
+ contactUpdate.room = response.data.user.unit;
4975
+ } // Update contact fields when data arrives
4976
+
4977
+
4978
+ if (Object.keys(contactUpdate).length > 0) {
4979
+ _this.setState(contactUpdate);
4980
+ }
4981
+ }
4982
+ }).catch(function (error) {
4983
+ // Permission denied (403) or other error - continue without auto-population
4984
+ // Staff can still create the request, just need to enter contact details manually
4985
+ console.log('Could not fetch user details for auto-population:', error);
4986
+ });
4960
4987
  });
4961
4988
 
4962
4989
  _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onUnselectUser", function () {
4963
4990
  var update = {
4964
4991
  selectedUser: null,
4965
4992
  userID: '',
4966
- userName: ''
4993
+ userName: '',
4994
+ phone: '',
4995
+ room: ''
4967
4996
  };
4968
4997
 
4969
4998
  if (!___default['default'].isEmpty(_this.state.customFields) && !___default['default'].some(_this.state.customFields, 'isTitle')) {
package/dist/index.esm.js CHANGED
@@ -4911,16 +4911,45 @@ var AddJob = /*#__PURE__*/function (_Component) {
4911
4911
 
4912
4912
  if (!_.isEmpty(_this.state.customFields) && !_.some(_this.state.customFields, 'isTitle')) {
4913
4913
  update.title = user.displayName;
4914
- }
4914
+ } // Update UI immediately (non-blocking)
4915
4915
 
4916
- _this.setState(update);
4916
+
4917
+ _this.setState(update); // PC-1255: Auto-populate contact details when staff create requests on behalf of residents
4918
+ // Requires userManagement permission - gracefully falls back to manual entry if denied
4919
+ // Fetch in background to avoid blocking UI
4920
+
4921
+
4922
+ userActions.fetchUser(_this.props.auth.site, user.userId).then(function (response) {
4923
+ if (response.data && response.data.user) {
4924
+ var contactUpdate = {}; // Auto-populate phone and room from user profile
4925
+
4926
+ if (response.data.user.phoneNumber) {
4927
+ contactUpdate.phone = response.data.user.phoneNumber;
4928
+ }
4929
+
4930
+ if (response.data.user.unit) {
4931
+ contactUpdate.room = response.data.user.unit;
4932
+ } // Update contact fields when data arrives
4933
+
4934
+
4935
+ if (Object.keys(contactUpdate).length > 0) {
4936
+ _this.setState(contactUpdate);
4937
+ }
4938
+ }
4939
+ }).catch(function (error) {
4940
+ // Permission denied (403) or other error - continue without auto-population
4941
+ // Staff can still create the request, just need to enter contact details manually
4942
+ console.log('Could not fetch user details for auto-population:', error);
4943
+ });
4917
4944
  });
4918
4945
 
4919
4946
  _defineProperty(_assertThisInitialized(_this), "onUnselectUser", function () {
4920
4947
  var update = {
4921
4948
  selectedUser: null,
4922
4949
  userID: '',
4923
- userName: ''
4950
+ userName: '',
4951
+ phone: '',
4952
+ room: ''
4924
4953
  };
4925
4954
 
4926
4955
  if (!_.isEmpty(_this.state.customFields) && !_.some(_this.state.customFields, 'isTitle')) {
package/dist/index.umd.js CHANGED
@@ -4933,16 +4933,45 @@
4933
4933
 
4934
4934
  if (!___default['default'].isEmpty(_this.state.customFields) && !___default['default'].some(_this.state.customFields, 'isTitle')) {
4935
4935
  update.title = user.displayName;
4936
- }
4936
+ } // Update UI immediately (non-blocking)
4937
4937
 
4938
- _this.setState(update);
4938
+
4939
+ _this.setState(update); // PC-1255: Auto-populate contact details when staff create requests on behalf of residents
4940
+ // Requires userManagement permission - gracefully falls back to manual entry if denied
4941
+ // Fetch in background to avoid blocking UI
4942
+
4943
+
4944
+ userActions.fetchUser(_this.props.auth.site, user.userId).then(function (response) {
4945
+ if (response.data && response.data.user) {
4946
+ var contactUpdate = {}; // Auto-populate phone and room from user profile
4947
+
4948
+ if (response.data.user.phoneNumber) {
4949
+ contactUpdate.phone = response.data.user.phoneNumber;
4950
+ }
4951
+
4952
+ if (response.data.user.unit) {
4953
+ contactUpdate.room = response.data.user.unit;
4954
+ } // Update contact fields when data arrives
4955
+
4956
+
4957
+ if (Object.keys(contactUpdate).length > 0) {
4958
+ _this.setState(contactUpdate);
4959
+ }
4960
+ }
4961
+ }).catch(function (error) {
4962
+ // Permission denied (403) or other error - continue without auto-population
4963
+ // Staff can still create the request, just need to enter contact details manually
4964
+ console.log('Could not fetch user details for auto-population:', error);
4965
+ });
4939
4966
  });
4940
4967
 
4941
4968
  _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onUnselectUser", function () {
4942
4969
  var update = {
4943
4970
  selectedUser: null,
4944
4971
  userID: '',
4945
- userName: ''
4972
+ userName: '',
4973
+ phone: '',
4974
+ room: ''
4946
4975
  };
4947
4976
 
4948
4977
  if (!___default['default'].isEmpty(_this.state.customFields) && !___default['default'].some(_this.state.customFields, 'isTitle')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-maintenance-web-forms",
3
- "version": "1.1.25-beta.2",
3
+ "version": "1.1.25-beta.3",
4
4
  "description": "Extension package to enable maintenance on Pluss Communities Platform",
5
5
  "main": "dist/index.cjs.js",
6
6
  "scripts": {
@@ -199,11 +199,40 @@ class AddJob extends Component {
199
199
  if (!_.isEmpty(this.state.customFields) && !_.some(this.state.customFields, 'isTitle')) {
200
200
  update.title = user.displayName;
201
201
  }
202
+
203
+ // Update UI immediately (non-blocking)
202
204
  this.setState(update);
205
+
206
+ // PC-1255: Auto-populate contact details when staff create requests on behalf of residents
207
+ // Requires userManagement permission - gracefully falls back to manual entry if denied
208
+ // Fetch in background to avoid blocking UI
209
+ userActions
210
+ .fetchUser(this.props.auth.site, user.userId)
211
+ .then((response) => {
212
+ if (response.data && response.data.user) {
213
+ const contactUpdate = {};
214
+ // Auto-populate phone and room from user profile
215
+ if (response.data.user.phoneNumber) {
216
+ contactUpdate.phone = response.data.user.phoneNumber;
217
+ }
218
+ if (response.data.user.unit) {
219
+ contactUpdate.room = response.data.user.unit;
220
+ }
221
+ // Update contact fields when data arrives
222
+ if (Object.keys(contactUpdate).length > 0) {
223
+ this.setState(contactUpdate);
224
+ }
225
+ }
226
+ })
227
+ .catch((error) => {
228
+ // Permission denied (403) or other error - continue without auto-population
229
+ // Staff can still create the request, just need to enter contact details manually
230
+ console.log('Could not fetch user details for auto-population:', error);
231
+ });
203
232
  };
204
233
 
205
234
  onUnselectUser = () => {
206
- const update = { selectedUser: null, userID: '', userName: '' };
235
+ const update = { selectedUser: null, userID: '', userName: '', phone: '', room: '' };
207
236
  if (!_.isEmpty(this.state.customFields) && !_.some(this.state.customFields, 'isTitle')) {
208
237
  update.title = '';
209
238
  }