@flopay/shared 1.2.8 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +134 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +326 -6
- package/dist/index.d.ts +326 -6
- package/dist/index.mjs +133 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -44,6 +44,7 @@ __export(index_exports, {
|
|
|
44
44
|
DEFAULT_CURRENCY: () => DEFAULT_CURRENCY,
|
|
45
45
|
ELEMENT_TYPES: () => ELEMENT_TYPES,
|
|
46
46
|
FLAT_APPEARANCE: () => FLAT_APPEARANCE,
|
|
47
|
+
FLO_SDK_VERSION_HEADER: () => FLO_SDK_VERSION_HEADER,
|
|
47
48
|
FloPayError: () => FloPayError,
|
|
48
49
|
GLASS_DARK_APPEARANCE: () => GLASS_DARK_APPEARANCE,
|
|
49
50
|
GLASS_LIGHT_APPEARANCE: () => GLASS_LIGHT_APPEARANCE,
|
|
@@ -182,7 +183,8 @@ var PAYMENT_METHOD_LOGOS = {
|
|
|
182
183
|
};
|
|
183
184
|
|
|
184
185
|
// src/constants.ts
|
|
185
|
-
var SDK_VERSION = "1.
|
|
186
|
+
var SDK_VERSION = "1.3.0";
|
|
187
|
+
var FLO_SDK_VERSION_HEADER = "x-flo-sdk-version";
|
|
186
188
|
var BILLING_API_URL_STAGING = "https://api.stage.flopay.com";
|
|
187
189
|
var BILLING_API_URL_PRODUCTION = "https://api.flopay.com";
|
|
188
190
|
var DEFAULT_API_BASE_URL = BILLING_API_URL_STAGING;
|
|
@@ -864,6 +866,9 @@ function stripeExpressMethodToOptionKey(method) {
|
|
|
864
866
|
function buildPlaceholderMark(glyph, discColor, glyphColor) {
|
|
865
867
|
return `<svg viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg" role="img" aria-hidden="true"><circle cx="11" cy="11" r="11" fill="${discColor}"/><text x="11" y="15.5" text-anchor="middle" font-size="13" font-weight="700" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" fill="${glyphColor}">${glyph}</text></svg>`;
|
|
866
868
|
}
|
|
869
|
+
function buildBankMark(discColor, glyphColor) {
|
|
870
|
+
return `<svg viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg" role="img" aria-hidden="true"><circle cx="11" cy="11" r="11" fill="${discColor}"/><g fill="${glyphColor}"><path d="M11 4 L17.5 8 L4.5 8 Z"/><rect x="5" y="8.4" width="12" height="1.2" rx="0.3"/><rect x="5.9" y="10" width="1.5" height="5"/><rect x="8.55" y="10" width="1.5" height="5"/><rect x="11.95" y="10" width="1.5" height="5"/><rect x="14.6" y="10" width="1.5" height="5"/><rect x="4.6" y="15.4" width="12.8" height="1.5" rx="0.3"/></g></svg>`;
|
|
871
|
+
}
|
|
867
872
|
var SEPA_COUNTRIES = [
|
|
868
873
|
"AT",
|
|
869
874
|
"BE",
|
|
@@ -904,6 +909,7 @@ var SEPA_COUNTRIES = [
|
|
|
904
909
|
"VA"
|
|
905
910
|
// non-EEA SEPA participants
|
|
906
911
|
];
|
|
912
|
+
var BANK_TRANSFER_COUNTRIES = [...SEPA_COUNTRIES, "JP", "MX", "US"];
|
|
907
913
|
var STRIPE_METHOD_MATRIX = {
|
|
908
914
|
// ─── Express wallets ────────────────────────────────────────────────────
|
|
909
915
|
apple_pay: {
|
|
@@ -936,14 +942,42 @@ var STRIPE_METHOD_MATRIX = {
|
|
|
936
942
|
express: true,
|
|
937
943
|
needsExplicitConfirm: false
|
|
938
944
|
},
|
|
945
|
+
// ─── Klarna: PaymentElement tile, explicit confirm ─────────────────────
|
|
946
|
+
// Klarna renders as a PaymentElement tile (NOT express) so it always appears
|
|
947
|
+
// when the backend includes it in `enabledPaymentMethods`. Stripe's
|
|
948
|
+
// ExpressCheckoutElement only paints a Klarna button in eligible *real*
|
|
949
|
+
// browsers (never headless), which made it effectively invisible and looked
|
|
950
|
+
// like an SDK-level disable — as a tile it's purely backend-driven. Klarna
|
|
951
|
+
// may redirect during confirm, but it still surfaces a deliberate "Pay with
|
|
952
|
+
// Klarna" step: it omits `needsExplicitConfirm: false`, so the default
|
|
953
|
+
// `needsStripeMethodExplicitConfirm(...) === true` applies — unlike the
|
|
954
|
+
// auto-confirm APMs below.
|
|
939
955
|
klarna: {
|
|
940
956
|
displayName: "Klarna",
|
|
941
957
|
currencies: ["usd", "eur", "gbp", "aud", "nzd", "cad", "chf", "sek", "nok", "dkk", "pln", "czk", "ron"],
|
|
942
958
|
amounts: { usd: { min: 100 }, eur: { min: 100 }, gbp: { min: 100 } },
|
|
943
|
-
|
|
944
|
-
|
|
959
|
+
// Default (explicit "Pay with Klarna" button) — Klarna's PaymentElement can
|
|
960
|
+
// collect inline data and isn't a pure redirect-only method, so surface a
|
|
961
|
+
// deliberate confirm rather than auto-submitting on tile click.
|
|
962
|
+
theme: {
|
|
963
|
+
light: {
|
|
964
|
+
backgroundColor: "#FFB3C7",
|
|
965
|
+
textColor: "#0A0B09",
|
|
966
|
+
borderColor: "#FFB3C7",
|
|
967
|
+
logoSvg: buildPlaceholderMark("K", "#0A0B09", "#FFB3C7")
|
|
968
|
+
},
|
|
969
|
+
dark: {
|
|
970
|
+
backgroundColor: "#FFB3C7",
|
|
971
|
+
textColor: "#0A0B09",
|
|
972
|
+
borderColor: "#FFB3C7",
|
|
973
|
+
logoSvg: buildPlaceholderMark("K", "#0A0B09", "#FFB3C7")
|
|
974
|
+
}
|
|
975
|
+
}
|
|
945
976
|
},
|
|
946
977
|
// ─── PaymentElement APMs: auto-confirm (redirect-only, no Pay button) ───
|
|
978
|
+
// Affirm and Cash App Pay are pure redirect/handoff methods with no inline
|
|
979
|
+
// inputs, so they auto-submit on tile click (`needsExplicitConfirm: false`).
|
|
980
|
+
//
|
|
947
981
|
// Affirm currently rejects on non-USD currencies via
|
|
948
982
|
// /v1/elements/sessions, hence the narrow currency list. Below $35.00 USD
|
|
949
983
|
// it returns `amount_too_small` and blanks out the whole accordion, hence
|
|
@@ -1008,11 +1042,28 @@ var STRIPE_METHOD_MATRIX = {
|
|
|
1008
1042
|
gbp: { min: 100, max: 12e4 },
|
|
1009
1043
|
aud: { min: 100, max: 2e5 },
|
|
1010
1044
|
nzd: { min: 100, max: 2e5 }
|
|
1045
|
+
},
|
|
1046
|
+
// Afterpay's brand mint (#B2FCE4) with black wordmark/icon — the signature
|
|
1047
|
+
// palette from afterpay.com's brand system.
|
|
1048
|
+
theme: {
|
|
1049
|
+
light: {
|
|
1050
|
+
backgroundColor: "#B2FCE4",
|
|
1051
|
+
textColor: "#0A0B09",
|
|
1052
|
+
borderColor: "#B2FCE4",
|
|
1053
|
+
logoSvg: buildPlaceholderMark("A", "#0A0B09", "#B2FCE4")
|
|
1054
|
+
},
|
|
1055
|
+
dark: {
|
|
1056
|
+
backgroundColor: "#B2FCE4",
|
|
1057
|
+
textColor: "#0A0B09",
|
|
1058
|
+
borderColor: "#B2FCE4",
|
|
1059
|
+
logoSvg: buildPlaceholderMark("A", "#0A0B09", "#B2FCE4")
|
|
1060
|
+
}
|
|
1011
1061
|
}
|
|
1012
1062
|
},
|
|
1013
1063
|
alipay: {
|
|
1014
1064
|
displayName: "Alipay",
|
|
1015
|
-
currencies
|
|
1065
|
+
// Presentment currencies only — Alipay is offered to USD / CNY carts.
|
|
1066
|
+
currencies: ["usd", "cny"],
|
|
1016
1067
|
theme: {
|
|
1017
1068
|
light: {
|
|
1018
1069
|
backgroundColor: "#1677FF",
|
|
@@ -1049,6 +1100,25 @@ var STRIPE_METHOD_MATRIX = {
|
|
|
1049
1100
|
}
|
|
1050
1101
|
}
|
|
1051
1102
|
},
|
|
1103
|
+
bizum: {
|
|
1104
|
+
displayName: "Bizum",
|
|
1105
|
+
currencies: ["eur"],
|
|
1106
|
+
countries: ["ES"],
|
|
1107
|
+
theme: {
|
|
1108
|
+
light: {
|
|
1109
|
+
backgroundColor: "#00BFB3",
|
|
1110
|
+
textColor: "#FFFFFF",
|
|
1111
|
+
borderColor: "#00BFB3",
|
|
1112
|
+
logoSvg: buildPlaceholderMark("B", "#FFFFFF", "#00BFB3")
|
|
1113
|
+
},
|
|
1114
|
+
dark: {
|
|
1115
|
+
backgroundColor: "#00BFB3",
|
|
1116
|
+
textColor: "#FFFFFF",
|
|
1117
|
+
borderColor: "#00BFB3",
|
|
1118
|
+
logoSvg: buildPlaceholderMark("B", "#FFFFFF", "#00BFB3")
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
},
|
|
1052
1122
|
blik: {
|
|
1053
1123
|
displayName: "BLIK",
|
|
1054
1124
|
currencies: ["pln"],
|
|
@@ -1069,7 +1139,25 @@ var STRIPE_METHOD_MATRIX = {
|
|
|
1069
1139
|
}
|
|
1070
1140
|
},
|
|
1071
1141
|
boleto: { displayName: "Boleto", currencies: ["brl"], countries: ["BR"] },
|
|
1072
|
-
customer_balance: {
|
|
1142
|
+
customer_balance: {
|
|
1143
|
+
displayName: "Bank Transfer",
|
|
1144
|
+
currencies: ["eur", "usd"],
|
|
1145
|
+
countries: BANK_TRANSFER_COUNTRIES,
|
|
1146
|
+
theme: {
|
|
1147
|
+
light: {
|
|
1148
|
+
backgroundColor: "#1F2937",
|
|
1149
|
+
textColor: "#FFFFFF",
|
|
1150
|
+
borderColor: "#1F2937",
|
|
1151
|
+
logoSvg: buildBankMark("#1F2937", "#FFFFFF")
|
|
1152
|
+
},
|
|
1153
|
+
dark: {
|
|
1154
|
+
backgroundColor: "#374151",
|
|
1155
|
+
textColor: "#FFFFFF",
|
|
1156
|
+
borderColor: "#374151",
|
|
1157
|
+
logoSvg: buildBankMark("#374151", "#FFFFFF")
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
},
|
|
1073
1161
|
eps: {
|
|
1074
1162
|
displayName: "EPS",
|
|
1075
1163
|
currencies: ["eur"],
|
|
@@ -1128,6 +1216,25 @@ var STRIPE_METHOD_MATRIX = {
|
|
|
1128
1216
|
}
|
|
1129
1217
|
},
|
|
1130
1218
|
konbini: { displayName: "Konbini", currencies: ["jpy"], countries: ["JP"] },
|
|
1219
|
+
kr_card: {
|
|
1220
|
+
displayName: "Korean Card",
|
|
1221
|
+
currencies: ["krw"],
|
|
1222
|
+
countries: ["KR"],
|
|
1223
|
+
theme: {
|
|
1224
|
+
light: {
|
|
1225
|
+
backgroundColor: "#0B3D91",
|
|
1226
|
+
textColor: "#FFFFFF",
|
|
1227
|
+
borderColor: "#0B3D91",
|
|
1228
|
+
logoSvg: buildPlaceholderMark("K", "#FFFFFF", "#0B3D91")
|
|
1229
|
+
},
|
|
1230
|
+
dark: {
|
|
1231
|
+
backgroundColor: "#0B3D91",
|
|
1232
|
+
textColor: "#FFFFFF",
|
|
1233
|
+
borderColor: "#0B3D91",
|
|
1234
|
+
logoSvg: buildPlaceholderMark("K", "#FFFFFF", "#0B3D91")
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
},
|
|
1131
1238
|
multibanco: { displayName: "Multibanco", currencies: ["eur"], countries: ["PT"] },
|
|
1132
1239
|
oxxo: { displayName: "OXXO", currencies: ["mxn"], countries: ["MX"] },
|
|
1133
1240
|
p24: {
|
|
@@ -1193,10 +1300,30 @@ var STRIPE_METHOD_MATRIX = {
|
|
|
1193
1300
|
}
|
|
1194
1301
|
}
|
|
1195
1302
|
},
|
|
1303
|
+
upi: {
|
|
1304
|
+
displayName: "UPI",
|
|
1305
|
+
currencies: ["inr"],
|
|
1306
|
+
countries: ["IN"],
|
|
1307
|
+
theme: {
|
|
1308
|
+
light: {
|
|
1309
|
+
backgroundColor: "#FF7909",
|
|
1310
|
+
textColor: "#FFFFFF",
|
|
1311
|
+
borderColor: "#FF7909",
|
|
1312
|
+
logoSvg: buildPlaceholderMark("U", "#FFFFFF", "#FF7909")
|
|
1313
|
+
},
|
|
1314
|
+
dark: {
|
|
1315
|
+
backgroundColor: "#FF7909",
|
|
1316
|
+
textColor: "#FFFFFF",
|
|
1317
|
+
borderColor: "#FF7909",
|
|
1318
|
+
logoSvg: buildPlaceholderMark("U", "#FFFFFF", "#FF7909")
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
},
|
|
1196
1322
|
us_bank_account: { displayName: "US Bank Account", currencies: ["usd"], countries: ["US"] },
|
|
1197
1323
|
wechat_pay: {
|
|
1198
1324
|
displayName: "WeChat Pay",
|
|
1199
|
-
|
|
1325
|
+
// Presentment currencies only — WeChat Pay is offered to USD / CNY carts.
|
|
1326
|
+
currencies: ["usd", "cny"],
|
|
1200
1327
|
theme: {
|
|
1201
1328
|
light: {
|
|
1202
1329
|
backgroundColor: "#07C160",
|
|
@@ -2059,6 +2186,7 @@ function isSetupIntentClientSecret(clientSecret) {
|
|
|
2059
2186
|
DEFAULT_CURRENCY,
|
|
2060
2187
|
ELEMENT_TYPES,
|
|
2061
2188
|
FLAT_APPEARANCE,
|
|
2189
|
+
FLO_SDK_VERSION_HEADER,
|
|
2062
2190
|
FloPayError,
|
|
2063
2191
|
GLASS_DARK_APPEARANCE,
|
|
2064
2192
|
GLASS_LIGHT_APPEARANCE,
|