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/plus/walletPassGallery/serve.ts
var serve_exports = {};
__export(serve_exports, {
  bindCodeToCustomer: () => bindCodeToCustomer,
  getActiveLogs: () => getActiveLogs,
  getAssetList: () => getAssetList,
  getDetailApi: () => getDetailApi,
  getUnbindList: () => getUnbindList,
  getWalletDetail: () => getWalletDetail,
  getWalletPassDetail: () => getWalletPassDetail,
  getWalletPassList: () => getWalletPassList,
  goOrder: () => goOrder,
  orderRechargeProduct: () => orderRechargeProduct,
  setRequest: () => setRequest,
  updateWalletPassHolder: () => updateWalletPassHolder
});
module.exports = __toCommonJS(serve_exports);
var import_utils = require("../../utils");
var import_utils2 = require("@pisell/utils");
var getWalletPassList = async (params, options) => {
  try {
    const { data } = await import_utils.request.getRequest().get(`${(options == null ? void 0 : options.apiPrefix) || "/h5"}/machinecode/lowcode/list`, params);
    return data || { list: [], count: 0 };
  } catch (error) {
    console.error(
      import_utils2.locales.getText("wallet-pass-gallery.log.getWalletListFailed"),
      error
    );
    return { list: [], count: 0 };
  }
};
var bindCodeToCustomer = async (params) => {
  const { data } = await import_utils.request.getRequest().put(`/h5/voucher/bind/customer`, params);
  return data;
};
var getUnbindList = async (params) => {
  const { data } = await import_utils.request.getRequest().get(`/h5/machinecode/unbind/list`, params);
  return data;
};
var goOrder = async (params) => {
  try {
    const { data } = await import_utils.request.getRequest().post(`/h5/store/order/add`, params);
    return data;
  } catch (error) {
    console.error(
      import_utils2.locales.getText("wallet-pass-gallery.log.orderFailed"),
      error
    );
    throw error;
  }
};
var setRequest = (req) => {
  import_utils.request.setRequest(req);
};
var getAssetList = async (params) => {
  const { data } = await import_utils.request.getRequest().get(`/h5/pay/asset/lowcode/list`, params);
  return data;
};
var getActiveLogs = async (params) => {
  const { data } = await import_utils.request.getRequest().get(`/shop/asset`, params);
  return data;
};
var getDetailApi = async (params) => {
  const { data } = await import_utils.request.getRequest().get(
    `${params.apiPrefix || "/h5"}/machinecode/lowcode/detail/${params.id}`,
    {
      order_behavior_count: 1,
      // 订单行为次数
      order_behavior_count_customer: 1,
      // 客户订单行为次数
      order_behavior_count_customer_id: params.apiPrefix === "/shop" ? params.order_behavior_count_customer_id : void 0
    },
    {
      isOriginHost: true
    }
  );
  return data;
};
var orderRechargeProduct = async (params) => {
  const { data } = await import_utils.request.getRequest().post(`/h5/order/order`, params);
  return data;
};
var getWalletDetail = async (id) => {
  return import_utils.request.getRequest().get(`/h5/wallet/${id}`, {});
};
var updateWalletPassHolder = async (id, params) => {
  const { data } = await import_utils.request.getRequest().post(`/h5/machinecode/${id}/bind-holder`, params);
  return data;
};
var getWalletPassDetail = async (id, params) => {
  const { data } = await import_utils.request.getRequest().get(`/h5/machinecode/lowcode/detail/${id}`, params);
  return data;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  bindCodeToCustomer,
  getActiveLogs,
  getAssetList,
  getDetailApi,
  getUnbindList,
  getWalletDetail,
  getWalletPassDetail,
  getWalletPassList,
  goOrder,
  orderRechargeProduct,
  setRequest,
  updateWalletPassHolder
});
