private getCardsForSlot()

in src/logic/BrazeCards.ts [121:151]


    private getCardsForSlot(targetSlotName: CardSlotName): BrazeCard[] {
        const cachedCards = this.braze.getCachedContentCards().cards.flatMap((brazeCard) => {
            const { extras } = brazeCard;

            if (extras && extras.slotName && extras.slotName === targetSlotName) {
                if (brazeCard.id === undefined) {
                    this.errorHandler(
                        new Error('braze card had no ID'),
                        'BrazeCards.getCardsForSlot',
                    );
                    return [];
                } else {
                    return [
                        new BrazeCard(
                            brazeCard.id,
                            targetSlotName,
                            brazeCard,
                            this.braze,
                            this.errorHandler,
                        ),
                    ];
                }
            } else {
                // TODO: Consider whether this an error state, or something we're happy to ignore
                //       Will there be other content cards in users' feeds that we should ignore?
                return [];
            }
        });

        return cachedCards;
    }