abmp-npm 10.3.12 → 10.3.13

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": "abmp-npm",
3
- "version": "10.3.12",
3
+ "version": "10.3.13",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "check-cycles": "madge --circular .",
@@ -998,8 +998,21 @@ async function personalDetailsOnReady({
998
998
  async function setInterestData() {
999
999
  const interestsData = await getInterestAll();
1000
1000
 
1001
- _$w('#removeServiceButton').onClick(event => {
1002
- handleItemDelete(event, '#serviceNameText', selectedServices, 'label', renderServices);
1001
+ _$w('#removeServiceButton').onClick(async event => {
1002
+ // Capture the stable item id BEFORE awaiting the confirm lightbox.
1003
+ // Reading the chip's text after the await is unsafe: the repeater
1004
+ // recycles its DOM items on re-render, so after a rapid sequence of
1005
+ // deletes event.context can resolve to a recycled node showing a
1006
+ // different service, removing the wrong item (or none). Matching on
1007
+ // the stable _id (as the gallery delete does) avoids that race.
1008
+ const itemId = event.context.itemId;
1009
+ const result = await wixWindow.openLightbox(LIGHTBOX_NAMES.DELETE_CONFIRM);
1010
+
1011
+ if (result && result.toDelete) {
1012
+ selectedServices = selectedServices.filter(service => service._id !== itemId);
1013
+ renderServices();
1014
+ checkFormChanges(FORM_SECTION_HANDLER_MAP.BUSINESS_SERVICES);
1015
+ }
1003
1016
  });
1004
1017
 
1005
1018
  if (Array.isArray(interestsData) && interestsData.length > 0) {