UNPKG

autumn-js

Version:
46 lines (44 loc) 1.75 kB
"use client"; "use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/react/hooks/internal/check/customerToFeatures.ts var customerToFeatures_exports = {}; __export(customerToFeatures_exports, { customerToFeatures: () => customerToFeatures }); module.exports = __toCommonJS(customerToFeatures_exports); var customerToFeatures = ({ customer }) => { const balances = Object.values(customer.balances); const flags = Object.values(customer.flags); const customerStates = [...balances, ...flags]; if (customerStates.length === 0) return []; const firstCustomerState = customerStates[0]; if (!firstCustomerState.feature) { throw new Error( "[customerToFeatures] please expand `balances.feature` or `flags.feature` to get features for the customer" ); } return customerStates.map((customerState) => customerState.feature).filter((feature) => Boolean(feature)); }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { customerToFeatures });