@adyen/kyc-components
Version:
This guide assumes that you have already an account with Adyen. A legalEntity needs to be created, and you need to have a `legalEntityId` to instatiate a Component.
62 lines (61 loc) • 3.46 kB
JavaScript
try {
let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "09e71d24-c95f-4c2d-923b-8711551cf9bf", e._sentryDebugIdIdentifier = "sentry-dbid-09e71d24-c95f-4c2d-923b-8711551cf9bf");
} catch (e) {}
import { r as summaryItem } from "./summaryItem-Dehjwp8D.js";
import { t as isEmpty } from "./isEmpty-Dw2W8jeR.js";
import { r as mapSchemaFieldsToApiScriptLocalization } from "./mapAddressLocalizationToJpAddressSchema-Cu5HfF7K.js";
import { jsx, jsxs } from "preact/jsx-runtime";
//#region src/components/Shared/forms/Address/localized/jp/mapJpAddressSummary.tsx
var mapJpAddressSummary = (data, datasetUtils) => {
if (!data) return {};
return {
country: datasetUtils.getCountryName("JP") ?? "JP",
postalCode: summaryItem("postalCode", data.postalCode),
stateOrProvince: summaryItem("prefecture", /* @__PURE__ */ jsxs("div", { children: [
/* @__PURE__ */ jsx("p", { children: data.jaHaniStateOrProvince }),
/* @__PURE__ */ jsx("p", { children: data.jaKanaStateOrProvince }),
/* @__PURE__ */ jsx("p", { children: data.stateOrProvince })
] })),
city: summaryItem("districtTownAreaCityWard", /* @__PURE__ */ jsxs("div", { children: [
/* @__PURE__ */ jsx("p", { children: data.jaHaniCity }),
/* @__PURE__ */ jsx("p", { children: data.jaKanaCity }),
/* @__PURE__ */ jsx("p", { children: data.city })
] })),
otherAddressInformation: summaryItem("chomeAndBanchi", data.otherAddressInformation),
address: summaryItem("buildingNameFloorRoomNumberEtc", /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", { children: data.jaHaniAddress }), /* @__PURE__ */ jsx("p", { children: data.address })] }))
};
};
var mapJpAddressSummaryNewSummary = (data, datasetUtils) => {
if (!data) return {};
return {
country: datasetUtils.getCountryName("JP") ?? "JP",
postalCode: data.postalCode,
prefecture: /* @__PURE__ */ jsxs("div", { children: [
/* @__PURE__ */ jsx("p", { children: data.jaHaniStateOrProvince }),
/* @__PURE__ */ jsx("p", { children: data.jaKanaStateOrProvince }),
/* @__PURE__ */ jsx("p", { children: data.stateOrProvince })
] }),
districtTownAreaCityWard: /* @__PURE__ */ jsxs("div", { children: [
/* @__PURE__ */ jsx("p", { children: data.jaHaniCity }),
/* @__PURE__ */ jsx("p", { children: data.jaKanaCity }),
/* @__PURE__ */ jsx("p", { children: data.city })
] }),
chomeAndBanchi: data.otherAddressInformation,
buildingNameFloorRoomNumberEtc: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", { children: data.jaHaniAddress }), /* @__PURE__ */ jsx("p", { children: data.address })] })
};
};
//#endregion
//#region src/components/Shared/forms/Address/localized/jp/mapJpAddressSchemaToAddressLocalizations.ts
var mapJpAddressSchemaToAddressLocalizations = (data) => {
if (!data) return [];
return [mapSchemaFieldsToApiScriptLocalization(data, "jaHani"), mapSchemaFieldsToApiScriptLocalization(data, "jaKana")].filter(({ fields }) => !isEmpty(fields)).map(({ script, fields }) => ({
script,
fields: {
city: fields.city,
..."address" in fields ? { street: fields.address } : void 0
}
}));
};
//#endregion
export { mapJpAddressSummary as n, mapJpAddressSummaryNewSummary as r, mapJpAddressSchemaToAddressLocalizations as t };