<commit_before>import { LightningElement, api, wire } from 'lwc';
import { NavigationMixin } from 'lightning/navigation';
import { getRecord } from 'lightning/uiRecordApi';
import { handleError } from 'c/utilTemplateBuilder';
import { registerListener, unregisterListener } from 'c/pubsubNoPageRef';
import { deepClone, arraysMatch } from 'c/utilCommon';
import geLabelService from 'c/geLabelService';
import getOpenDonations from '@salesforce/apex/GE_FormRendererService.getOpenDonations';

const PAYMENT = 'payment';
const OPPORTUNITY = 'opportunity';

export default class geReviewDonations extends NavigationMixin(LightningElement) {

    CUSTOM_LABELS = geLabelService.CUSTOM_LABELS;

    @api donorId;

    _donor;
    _donorType;
    _donationType;
    _selectedDonation;
    _opportunities = [];
    _hasPreviouslySelectedDonation = false;
    _dedicatedListenerEventName = 'geDonationMatchingEvent';

    connectedCallback() {
        registerListener('geDonationMatchingEvent', this.handleReceiveEvent, this);
        registerListener('resetReviewDonationsEvent', this.handleResetReviewDonationsComponent, this);
    }

    disconnectedCallback() {
        unregisterListener('geDonationMatchingEvent', this.handleReceiveEvent, this);
        unregisterListener('resetReviewDonationsEvent', this.handleResetReviewDonationsComponent, this);
    }

    @wire(getRecord, { recordId: '$donorId', optionalFields: ['Account.Name', 'Contact.Name'] })
    wiredGetRecordMethod({ error, data }) {
        if (error) return handleError(error);
        if (data) {
            this._donor = data;
            this._donorType = this._donor.apiName;
        }
    }

    @wire(getOpenDonations, { donorId: '$donorId', donorType: '$_donorType' })
    wiredOpenDonations({ error, data }) {
        if (error) return handleError(error);
        if (!data) return this._opportunities = [];
        if (data) return this.setOpenDonations(data);
    }<commit_msg>use existing property instead of magic string<commit_after>import { LightningElement, api, wire } from 'lwc';
import { NavigationMixin } from 'lightning/navigation';
import { getRecord } from 'lightning/uiRecordApi';
import { handleError } from 'c/utilTemplateBuilder';
import { registerListener, unregisterListener } from 'c/pubsubNoPageRef';
import { deepClone, arraysMatch } from 'c/utilCommon';
import geLabelService from 'c/geLabelService';
import getOpenDonations from '@salesforce/apex/GE_FormRendererService.getOpenDonations';

const PAYMENT = 'payment';
const OPPORTUNITY = 'opportunity';

export default class geReviewDonations extends NavigationMixin(LightningElement) {

    CUSTOM_LABELS = geLabelService.CUSTOM_LABELS;

    @api donorId;

    _donor;
    _donorType;
    _donationType;
    _selectedDonation;
    _opportunities = [];
    _hasPreviouslySelectedDonation = false;
    _dedicatedListenerEventName = 'geDonationMatchingEvent';

    connectedCallback() {
        registerListener(this._dedicatedListenerEventName, this.handleReceiveEvent, this);
        registerListener('resetReviewDonationsEvent', this.handleResetReviewDonationsComponent, this);
    }

    disconnectedCallback() {
        unregisterListener(this._dedicatedListenerEventName, this.handleReceiveEvent, this);
        unregisterListener('resetReviewDonationsEvent', this.handleResetReviewDonationsComponent, this);
    }

    @wire(getRecord, { recordId: '$donorId', optionalFields: ['Account.Name', 'Contact.Name'] })
    wiredGetRecordMethod({ error, data }) {
        if (error) return handleError(error);
        if (data) {
            this._donor = data;
            this._donorType = this._donor.apiName;
        }
    }

    @wire(getOpenDonations, { donorId: '$donorId', donorType: '$_donorType' })
    wiredOpenDonations({ error, data }) {
        if (error) return handleError(error);
        if (!data) return this._opportunities = [];
        if (data) return this.setOpenDonations(data);
    }
{'fraction_non_alphanumeric': 0.10520991401112798, 'fraction_numerical': 0.0, 'mean_word_length': 4.366350067842605, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3392611', 'n_tokens_mistral': 1155, 'n_tokens_neox': 1123, 'n_words': 234}