@delopay/sdk 0.134.0 → 0.137.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/{chunk-R4MDAZWF.js → chunk-OMJ6MVD4.js} +358 -2
- package/dist/chunk-OMJ6MVD4.js.map +1 -0
- package/dist/index.cjs +375 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +529 -10
- package/dist/index.d.ts +529 -10
- package/dist/index.js +37 -1
- package/dist/internal.cjs +375 -1
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +37 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-R4MDAZWF.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AIRWALLEX_AUTOFILL_TREATMENTS,
|
|
3
|
+
AIRWALLEX_CARD_LAYOUTS,
|
|
4
|
+
AIRWALLEX_CARD_PRESETS,
|
|
5
|
+
AIRWALLEX_CARD_PRESET_FALLBACK,
|
|
6
|
+
AIRWALLEX_FIELD_CHROMES,
|
|
7
|
+
AIRWALLEX_FIELD_FONT_SIZES,
|
|
8
|
+
AIRWALLEX_FIELD_WEIGHTS,
|
|
9
|
+
AIRWALLEX_FOCUS_RINGS,
|
|
10
|
+
AIRWALLEX_LABEL_STYLES,
|
|
11
|
+
AIRWALLEX_NETWORK_MARKS,
|
|
2
12
|
ALL_CUSTOM_FIELD_CONDITION_SOURCES,
|
|
3
13
|
ALL_CUSTOM_FIELD_OPERATORS,
|
|
4
14
|
ALL_CUSTOM_FIELD_TYPES,
|
|
@@ -69,9 +79,15 @@ import {
|
|
|
69
79
|
WCAG_AA_TEXT,
|
|
70
80
|
WCAG_AA_UI,
|
|
71
81
|
Webhooks,
|
|
82
|
+
airwallexCardLayout,
|
|
83
|
+
airwallexCardLayoutIsCoherent,
|
|
84
|
+
airwallexCellWeight,
|
|
85
|
+
airwallexFieldFontPx,
|
|
86
|
+
airwallexFieldWeightValue,
|
|
72
87
|
allOf,
|
|
73
88
|
anyOf,
|
|
74
89
|
applyBrandingVariables,
|
|
90
|
+
asAirwallexCardPreset,
|
|
75
91
|
buildBrandingExport,
|
|
76
92
|
buttonPadValue,
|
|
77
93
|
canonicalSectionId,
|
|
@@ -135,6 +151,8 @@ import {
|
|
|
135
151
|
programToTree,
|
|
136
152
|
radiusValue,
|
|
137
153
|
readableInkOn,
|
|
154
|
+
resolveAirwallexCardPreset,
|
|
155
|
+
resolveAirwallexLabelStyle,
|
|
138
156
|
ruleMatchToTree,
|
|
139
157
|
sanitizeCustomCss,
|
|
140
158
|
sectionLabel,
|
|
@@ -149,8 +167,18 @@ import {
|
|
|
149
167
|
validatePanes,
|
|
150
168
|
verticalGapValue,
|
|
151
169
|
visibleCustomFields
|
|
152
|
-
} from "./chunk-
|
|
170
|
+
} from "./chunk-OMJ6MVD4.js";
|
|
153
171
|
export {
|
|
172
|
+
AIRWALLEX_AUTOFILL_TREATMENTS,
|
|
173
|
+
AIRWALLEX_CARD_LAYOUTS,
|
|
174
|
+
AIRWALLEX_CARD_PRESETS,
|
|
175
|
+
AIRWALLEX_CARD_PRESET_FALLBACK,
|
|
176
|
+
AIRWALLEX_FIELD_CHROMES,
|
|
177
|
+
AIRWALLEX_FIELD_FONT_SIZES,
|
|
178
|
+
AIRWALLEX_FIELD_WEIGHTS,
|
|
179
|
+
AIRWALLEX_FOCUS_RINGS,
|
|
180
|
+
AIRWALLEX_LABEL_STYLES,
|
|
181
|
+
AIRWALLEX_NETWORK_MARKS,
|
|
154
182
|
ALL_CUSTOM_FIELD_CONDITION_SOURCES,
|
|
155
183
|
ALL_CUSTOM_FIELD_OPERATORS,
|
|
156
184
|
ALL_CUSTOM_FIELD_TYPES,
|
|
@@ -221,9 +249,15 @@ export {
|
|
|
221
249
|
WCAG_AA_TEXT,
|
|
222
250
|
WCAG_AA_UI,
|
|
223
251
|
Webhooks,
|
|
252
|
+
airwallexCardLayout,
|
|
253
|
+
airwallexCardLayoutIsCoherent,
|
|
254
|
+
airwallexCellWeight,
|
|
255
|
+
airwallexFieldFontPx,
|
|
256
|
+
airwallexFieldWeightValue,
|
|
224
257
|
allOf,
|
|
225
258
|
anyOf,
|
|
226
259
|
applyBrandingVariables,
|
|
260
|
+
asAirwallexCardPreset,
|
|
227
261
|
buildBrandingExport,
|
|
228
262
|
buttonPadValue,
|
|
229
263
|
canonicalSectionId,
|
|
@@ -287,6 +321,8 @@ export {
|
|
|
287
321
|
programToTree,
|
|
288
322
|
radiusValue,
|
|
289
323
|
readableInkOn,
|
|
324
|
+
resolveAirwallexCardPreset,
|
|
325
|
+
resolveAirwallexLabelStyle,
|
|
290
326
|
ruleMatchToTree,
|
|
291
327
|
sanitizeCustomCss,
|
|
292
328
|
sectionLabel,
|
package/dist/internal.cjs
CHANGED
|
@@ -20,6 +20,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/internal.ts
|
|
21
21
|
var internal_exports = {};
|
|
22
22
|
__export(internal_exports, {
|
|
23
|
+
AIRWALLEX_AUTOFILL_TREATMENTS: () => AIRWALLEX_AUTOFILL_TREATMENTS,
|
|
24
|
+
AIRWALLEX_CARD_LAYOUTS: () => AIRWALLEX_CARD_LAYOUTS,
|
|
25
|
+
AIRWALLEX_CARD_PRESETS: () => AIRWALLEX_CARD_PRESETS,
|
|
26
|
+
AIRWALLEX_CARD_PRESET_FALLBACK: () => AIRWALLEX_CARD_PRESET_FALLBACK,
|
|
27
|
+
AIRWALLEX_FIELD_CHROMES: () => AIRWALLEX_FIELD_CHROMES,
|
|
28
|
+
AIRWALLEX_FIELD_FONT_SIZES: () => AIRWALLEX_FIELD_FONT_SIZES,
|
|
29
|
+
AIRWALLEX_FIELD_WEIGHTS: () => AIRWALLEX_FIELD_WEIGHTS,
|
|
30
|
+
AIRWALLEX_FOCUS_RINGS: () => AIRWALLEX_FOCUS_RINGS,
|
|
31
|
+
AIRWALLEX_LABEL_STYLES: () => AIRWALLEX_LABEL_STYLES,
|
|
32
|
+
AIRWALLEX_NETWORK_MARKS: () => AIRWALLEX_NETWORK_MARKS,
|
|
23
33
|
ALL_CUSTOM_FIELD_CONDITION_SOURCES: () => ALL_CUSTOM_FIELD_CONDITION_SOURCES,
|
|
24
34
|
ALL_CUSTOM_FIELD_OPERATORS: () => ALL_CUSTOM_FIELD_OPERATORS,
|
|
25
35
|
ALL_CUSTOM_FIELD_TYPES: () => ALL_CUSTOM_FIELD_TYPES,
|
|
@@ -102,9 +112,15 @@ __export(internal_exports, {
|
|
|
102
112
|
WCAG_AA_TEXT: () => WCAG_AA_TEXT,
|
|
103
113
|
WCAG_AA_UI: () => WCAG_AA_UI,
|
|
104
114
|
Webhooks: () => Webhooks,
|
|
115
|
+
airwallexCardLayout: () => airwallexCardLayout,
|
|
116
|
+
airwallexCardLayoutIsCoherent: () => airwallexCardLayoutIsCoherent,
|
|
117
|
+
airwallexCellWeight: () => airwallexCellWeight,
|
|
118
|
+
airwallexFieldFontPx: () => airwallexFieldFontPx,
|
|
119
|
+
airwallexFieldWeightValue: () => airwallexFieldWeightValue,
|
|
105
120
|
allOf: () => allOf,
|
|
106
121
|
anyOf: () => anyOf,
|
|
107
122
|
applyBrandingVariables: () => applyBrandingVariables,
|
|
123
|
+
asAirwallexCardPreset: () => asAirwallexCardPreset,
|
|
108
124
|
buildBrandingExport: () => buildBrandingExport,
|
|
109
125
|
buttonPadValue: () => buttonPadValue,
|
|
110
126
|
canonicalSectionId: () => canonicalSectionId,
|
|
@@ -168,6 +184,8 @@ __export(internal_exports, {
|
|
|
168
184
|
programToTree: () => programToTree,
|
|
169
185
|
radiusValue: () => radiusValue,
|
|
170
186
|
readableInkOn: () => readableInkOn,
|
|
187
|
+
resolveAirwallexCardPreset: () => resolveAirwallexCardPreset,
|
|
188
|
+
resolveAirwallexLabelStyle: () => resolveAirwallexLabelStyle,
|
|
171
189
|
ruleMatchToTree: () => ruleMatchToTree,
|
|
172
190
|
sanitizeCustomCss: () => sanitizeCustomCss,
|
|
173
191
|
sectionLabel: () => sectionLabel,
|
|
@@ -1057,10 +1075,68 @@ var Customers = class {
|
|
|
1057
1075
|
query: toQuery(params)
|
|
1058
1076
|
});
|
|
1059
1077
|
}
|
|
1078
|
+
/**
|
|
1079
|
+
* Retrieve one customer, scoped to the authenticated dashboard user's shop
|
|
1080
|
+
* (business profile). The shop-scoped counterpart of {@link retrieve}, and
|
|
1081
|
+
* what makes a shop's own customer list clickable: the list is
|
|
1082
|
+
* `ProfileCustomerRead` while {@link retrieve} is merchant-level, so a shop
|
|
1083
|
+
* member could see a customer they could not open.
|
|
1084
|
+
*
|
|
1085
|
+
* A customer belonging to a sibling shop answers `CustomerNotFound` — the
|
|
1086
|
+
* same answer as a customer that does not exist, deliberately, so one shop
|
|
1087
|
+
* cannot enumerate another's customer ids.
|
|
1088
|
+
*
|
|
1089
|
+
* `GET /customers/profile/{customerId}`
|
|
1090
|
+
*
|
|
1091
|
+
* @param customerId - The unique customer ID.
|
|
1092
|
+
* @returns The customer, with `profile_ids` narrowed to the caller's own shop.
|
|
1093
|
+
*/
|
|
1094
|
+
async retrieveByProfile(customerId) {
|
|
1095
|
+
return this.request("GET", `/customers/profile/${encodeURIComponent(customerId)}`);
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* Create a customer from a shop, recording that it belongs to that shop so
|
|
1099
|
+
* the shop can see the customer it just created. The shop is taken from the
|
|
1100
|
+
* credential; a caller-chosen `customer_id` is rejected.
|
|
1101
|
+
*
|
|
1102
|
+
* `POST /customers/profile`
|
|
1103
|
+
*
|
|
1104
|
+
* @param params - The customer to create.
|
|
1105
|
+
* @returns The created customer.
|
|
1106
|
+
*/
|
|
1107
|
+
async createByProfile(params) {
|
|
1108
|
+
return this.request("POST", "/customers/profile", { body: params });
|
|
1109
|
+
}
|
|
1110
|
+
/**
|
|
1111
|
+
* Update a customer from a shop, if the customer belongs to that shop.
|
|
1112
|
+
* A sibling shop's customer answers `CustomerNotFound`, as with
|
|
1113
|
+
* {@link retrieveByProfile}.
|
|
1114
|
+
*
|
|
1115
|
+
* `POST /customers/profile/{customerId}`
|
|
1116
|
+
*
|
|
1117
|
+
* @param customerId - The customer ID to update.
|
|
1118
|
+
* @param params - Fields to update.
|
|
1119
|
+
* @returns The updated customer.
|
|
1120
|
+
*/
|
|
1121
|
+
async updateByProfile(customerId, params) {
|
|
1122
|
+
return this.request("POST", `/customers/profile/${encodeURIComponent(customerId)}`, {
|
|
1123
|
+
body: params
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1060
1126
|
/** List mandates for a customer. `GET /customers/{customerId}/mandates` */
|
|
1061
1127
|
async listMandates(customerId) {
|
|
1062
1128
|
return this.request("GET", `/customers/${encodeURIComponent(customerId)}/mandates`);
|
|
1063
1129
|
}
|
|
1130
|
+
/**
|
|
1131
|
+
* List one customer's mandates, scoped to the caller's shop. Same membership
|
|
1132
|
+
* rule as {@link retrieveByProfile}: a sibling shop's customer answers
|
|
1133
|
+
* `CustomerNotFound` before any mandate is read.
|
|
1134
|
+
*
|
|
1135
|
+
* `GET /customers/profile/{customerId}/mandates`
|
|
1136
|
+
*/
|
|
1137
|
+
async listMandatesByProfile(customerId) {
|
|
1138
|
+
return this.request("GET", `/customers/profile/${encodeURIComponent(customerId)}/mandates`);
|
|
1139
|
+
}
|
|
1064
1140
|
};
|
|
1065
1141
|
|
|
1066
1142
|
// src/resources/disputes.ts
|
|
@@ -1792,6 +1868,43 @@ var Payments = class {
|
|
|
1792
1868
|
options
|
|
1793
1869
|
);
|
|
1794
1870
|
}
|
|
1871
|
+
/**
|
|
1872
|
+
* What the payment's rail says about settling each attempt: whether the
|
|
1873
|
+
* money is still `pending` in the rail's hands, `available` in its balance
|
|
1874
|
+
* (**not** paid out), `paid_out` to a bank — with the payout's date and
|
|
1875
|
+
* reference — or came back as `payout_failed`; and, for the rest, which
|
|
1876
|
+
* kind of not-knowing applies (`unavailable`, `unknown`, `not_recorded`).
|
|
1877
|
+
* See {@link ConnectorSettlementStatus} for the seven values. The same
|
|
1878
|
+
* status for the active attempt rides on every list row and retrieve as
|
|
1879
|
+
* `connector_settlement_status`, and the list filters on it.
|
|
1880
|
+
*
|
|
1881
|
+
* Not the hosted-shop settlement API under `settlement.*`, which is host →
|
|
1882
|
+
* shop owner and manual; this is acquirer → merchant bank, per payment.
|
|
1883
|
+
*
|
|
1884
|
+
* `GET /payments/{paymentId}/settlement`
|
|
1885
|
+
*
|
|
1886
|
+
* @param paymentId - The payment intent ID.
|
|
1887
|
+
* @param options - Optional per-call extras: extra `headers`, a `timeout`
|
|
1888
|
+
* override, and an `AbortSignal`.
|
|
1889
|
+
* @returns The attempts this caller may see, oldest first, each with its
|
|
1890
|
+
* settlement status.
|
|
1891
|
+
* @throws If the payment does not exist (404), or the caller is a
|
|
1892
|
+
* profile-scoped (shop) role, who is refused rather than shown a redacted
|
|
1893
|
+
* body (403).
|
|
1894
|
+
*
|
|
1895
|
+
* @example
|
|
1896
|
+
* ```typescript
|
|
1897
|
+
* const { attempts } = await delopay.payments.settlement('pay_abc123');
|
|
1898
|
+
* for (const attempt of attempts) {
|
|
1899
|
+
* if (attempt.status === 'paid_out') {
|
|
1900
|
+
* console.log(attempt.paid_out_at, attempt.payout_reference);
|
|
1901
|
+
* }
|
|
1902
|
+
* }
|
|
1903
|
+
* ```
|
|
1904
|
+
*/
|
|
1905
|
+
async settlement(paymentId, options) {
|
|
1906
|
+
return this.request("GET", `/payments/${encodeURIComponent(paymentId)}/settlement`, options);
|
|
1907
|
+
}
|
|
1795
1908
|
/**
|
|
1796
1909
|
* Update an existing payment intent before it is confirmed.
|
|
1797
1910
|
*
|
|
@@ -1963,7 +2076,10 @@ var Payments = class {
|
|
|
1963
2076
|
/**
|
|
1964
2077
|
* List payments by filter, scoped to the caller's profile (the shop-user
|
|
1965
2078
|
* twin of `listByFilter`). The backend narrows to the profile from the
|
|
1966
|
-
* auth context, so `profile_id` / `project_id` must not be sent
|
|
2079
|
+
* auth context, so `profile_id` / `project_id` must not be sent — and
|
|
2080
|
+
* neither may `connector_settlement_status`, which this route refuses
|
|
2081
|
+
* (403): a shop-scoped viewer is not shown the settlement state, and the
|
|
2082
|
+
* type leaves the key out so it cannot be probed through `total_count`.
|
|
1967
2083
|
*
|
|
1968
2084
|
* Not to be confused with {@link Payments.listByProfile}, which is the GET
|
|
1969
2085
|
* cursor variant and rejects this body.
|
|
@@ -5401,6 +5517,120 @@ function feeProgram() {
|
|
|
5401
5517
|
return new FeeProgramBuilder();
|
|
5402
5518
|
}
|
|
5403
5519
|
|
|
5520
|
+
// src/airwallexCard.ts
|
|
5521
|
+
var AIRWALLEX_CARD_PRESETS = [
|
|
5522
|
+
"single_row",
|
|
5523
|
+
"split_fields",
|
|
5524
|
+
"split_fields_labelled",
|
|
5525
|
+
"stacked",
|
|
5526
|
+
"number_expiry_row",
|
|
5527
|
+
"compact"
|
|
5528
|
+
];
|
|
5529
|
+
var SPLIT = ["cardNumber", "expiry", "cvc"];
|
|
5530
|
+
var AIRWALLEX_CARD_LAYOUTS = {
|
|
5531
|
+
// Airwallex's combined element. One iframe, one row, and the only preset
|
|
5532
|
+
// whose insides are not ours to lay out — which is why it carries no
|
|
5533
|
+
// captions: there is nothing to caption but the row as a whole.
|
|
5534
|
+
single_row: {
|
|
5535
|
+
elements: ["card"],
|
|
5536
|
+
rows: [["card"]],
|
|
5537
|
+
labels: false,
|
|
5538
|
+
density: "default"
|
|
5539
|
+
},
|
|
5540
|
+
// The trio with placeholders carrying the meaning. Shorter than the
|
|
5541
|
+
// labelled variant and fine on a wide surface.
|
|
5542
|
+
split_fields: {
|
|
5543
|
+
elements: SPLIT,
|
|
5544
|
+
rows: [["cardNumber"], ["expiry", "cvc"]],
|
|
5545
|
+
labels: false,
|
|
5546
|
+
density: "default"
|
|
5547
|
+
},
|
|
5548
|
+
// The default. The same geometry, captioned — which is what makes it
|
|
5549
|
+
// survive a narrow embed, where a bare field row stops being self-evident.
|
|
5550
|
+
split_fields_labelled: {
|
|
5551
|
+
elements: SPLIT,
|
|
5552
|
+
rows: [["cardNumber"], ["expiry", "cvc"]],
|
|
5553
|
+
labels: true,
|
|
5554
|
+
density: "default"
|
|
5555
|
+
},
|
|
5556
|
+
// Every field full width. Expiry and CVC side by side start to crowd below
|
|
5557
|
+
// roughly 320px, and this is the layout that does not.
|
|
5558
|
+
stacked: {
|
|
5559
|
+
elements: SPLIT,
|
|
5560
|
+
rows: [["cardNumber"], ["expiry"], ["cvc"]],
|
|
5561
|
+
labels: true,
|
|
5562
|
+
density: "default"
|
|
5563
|
+
},
|
|
5564
|
+
// Two rows instead of two-plus-one: shorter than the split forms without
|
|
5565
|
+
// the ambiguity of a single combined field.
|
|
5566
|
+
//
|
|
5567
|
+
// 3:2, not an even split. A card number is nineteen characters and an expiry
|
|
5568
|
+
// is five, so halving the row clipped the number's own placeholder at 460px
|
|
5569
|
+
// — seen in the preview before this was weighted. The proposal drew it even;
|
|
5570
|
+
// the merchant-facing decision was taken on the two drawn side by side and
|
|
5571
|
+
// the weighted one was chosen, so do not "restore" the even split to match
|
|
5572
|
+
// the original mock.
|
|
5573
|
+
number_expiry_row: {
|
|
5574
|
+
elements: SPLIT,
|
|
5575
|
+
rows: [["cardNumber", "expiry"], ["cvc"]],
|
|
5576
|
+
weights: { cardNumber: 3, expiry: 2 },
|
|
5577
|
+
labels: true,
|
|
5578
|
+
density: "default"
|
|
5579
|
+
},
|
|
5580
|
+
// Split geometry at reduced density and type size, for a checkout embedded
|
|
5581
|
+
// in a page that already has its own chrome.
|
|
5582
|
+
compact: {
|
|
5583
|
+
elements: SPLIT,
|
|
5584
|
+
rows: [["cardNumber"], ["expiry", "cvc"]],
|
|
5585
|
+
labels: false,
|
|
5586
|
+
density: "compact"
|
|
5587
|
+
}
|
|
5588
|
+
};
|
|
5589
|
+
var AIRWALLEX_CARD_PRESET_FALLBACK = "split_fields_labelled";
|
|
5590
|
+
function resolveAirwallexCardPreset(fromBranding, fromConnector) {
|
|
5591
|
+
return asPreset(fromBranding) ?? asPreset(fromConnector) ?? AIRWALLEX_CARD_PRESET_FALLBACK;
|
|
5592
|
+
}
|
|
5593
|
+
function asAirwallexCardPreset(value) {
|
|
5594
|
+
return asPreset(value);
|
|
5595
|
+
}
|
|
5596
|
+
function asPreset(value) {
|
|
5597
|
+
if (typeof value !== "string") return null;
|
|
5598
|
+
const trimmed = value.trim().toLowerCase();
|
|
5599
|
+
return AIRWALLEX_CARD_PRESETS.includes(trimmed) ? trimmed : null;
|
|
5600
|
+
}
|
|
5601
|
+
function airwallexCardLayout(preset) {
|
|
5602
|
+
return AIRWALLEX_CARD_LAYOUTS[preset];
|
|
5603
|
+
}
|
|
5604
|
+
function airwallexCellWeight(layout, field) {
|
|
5605
|
+
const weight = layout.weights?.[field];
|
|
5606
|
+
return typeof weight === "number" && Number.isFinite(weight) && weight > 0 ? weight : 1;
|
|
5607
|
+
}
|
|
5608
|
+
function airwallexCardLayoutIsCoherent(layout) {
|
|
5609
|
+
const drawn = layout.rows.flat();
|
|
5610
|
+
if (drawn.length !== layout.elements.length) return false;
|
|
5611
|
+
return layout.elements.every((field) => drawn.filter((f) => f === field).length === 1);
|
|
5612
|
+
}
|
|
5613
|
+
var AIRWALLEX_LABEL_STYLES = ["above", "inline", "floating", "none"];
|
|
5614
|
+
function resolveAirwallexLabelStyle(override, layout) {
|
|
5615
|
+
if (typeof override === "string" && AIRWALLEX_LABEL_STYLES.includes(override)) {
|
|
5616
|
+
return override;
|
|
5617
|
+
}
|
|
5618
|
+
return layout.labels ? "above" : "none";
|
|
5619
|
+
}
|
|
5620
|
+
var AIRWALLEX_FIELD_CHROMES = ["outlined", "filled", "underline"];
|
|
5621
|
+
var AIRWALLEX_FOCUS_RINGS = ["none", "subtle", "strong"];
|
|
5622
|
+
var AIRWALLEX_AUTOFILL_TREATMENTS = ["system", "brand", "neutral"];
|
|
5623
|
+
var AIRWALLEX_FIELD_FONT_SIZES = ["sm", "md", "lg"];
|
|
5624
|
+
var AIRWALLEX_FIELD_WEIGHTS = ["regular", "medium", "semibold"];
|
|
5625
|
+
function airwallexFieldFontPx(size, density) {
|
|
5626
|
+
const base = size === "sm" ? 14 : size === "lg" ? 18 : 16;
|
|
5627
|
+
return density === "compact" ? Math.max(13, base - 1) : base;
|
|
5628
|
+
}
|
|
5629
|
+
function airwallexFieldWeightValue(weight) {
|
|
5630
|
+
return weight === "regular" ? 400 : weight === "semibold" ? 600 : 500;
|
|
5631
|
+
}
|
|
5632
|
+
var AIRWALLEX_NETWORK_MARKS = ["visa", "mastercard", "amex", "discover"];
|
|
5633
|
+
|
|
5404
5634
|
// src/branding.ts
|
|
5405
5635
|
function surchargeShowsLabel(labelMode, style, position) {
|
|
5406
5636
|
if (labelMode !== "labelled") return false;
|
|
@@ -5936,6 +6166,25 @@ var DEFAULT_BRANDING_BASE = {
|
|
|
5936
6166
|
paymentLayout: "tabs",
|
|
5937
6167
|
labelStyle: "above",
|
|
5938
6168
|
showPoweredBy: true,
|
|
6169
|
+
// Every one of these defaults to what the Airwallex pane already did before
|
|
6170
|
+
// the section existed, so a merchant who never opens it sees no change:
|
|
6171
|
+
// empty preset (defer to the connector account), an outlined box, 16px /
|
|
6172
|
+
// 500 type, no focus ring, the browser's own autofill highlight, no valid
|
|
6173
|
+
// tint, no marks. The single deliberate change of behaviour is not here —
|
|
6174
|
+
// it is the fallback at the END of `resolveAirwallexCardPreset`, which
|
|
6175
|
+
// moves a shop that configured NOTHING from the combined row to the
|
|
6176
|
+
// labelled split form.
|
|
6177
|
+
airwallexCardPreset: "",
|
|
6178
|
+
// Off. With this on, no buyer can pay by card on the shop.
|
|
6179
|
+
airwallexHideCard: false,
|
|
6180
|
+
airwallexFieldChrome: "outlined",
|
|
6181
|
+
airwallexLabelStyle: "",
|
|
6182
|
+
airwallexFieldFontSize: "md",
|
|
6183
|
+
airwallexFieldWeight: "medium",
|
|
6184
|
+
airwallexFocusRing: "none",
|
|
6185
|
+
airwallexAutofill: "system",
|
|
6186
|
+
airwallexValidTint: false,
|
|
6187
|
+
airwallexNetworkMarks: false,
|
|
5939
6188
|
customCss: ""
|
|
5940
6189
|
};
|
|
5941
6190
|
var DEFAULT_BRANDING = {
|
|
@@ -6045,6 +6294,10 @@ function pickEnum(value, allowed, fallback) {
|
|
|
6045
6294
|
if (typeof value !== "string") return fallback;
|
|
6046
6295
|
return allowed.includes(value) ? value : fallback;
|
|
6047
6296
|
}
|
|
6297
|
+
function pickEnumOrEmpty(value, allowed) {
|
|
6298
|
+
if (typeof value !== "string") return "";
|
|
6299
|
+
return allowed.includes(value) ? value : "";
|
|
6300
|
+
}
|
|
6048
6301
|
function parseBool(value, fallback) {
|
|
6049
6302
|
if (typeof value === "boolean") return value;
|
|
6050
6303
|
if (value === "true") return true;
|
|
@@ -6615,6 +6868,53 @@ function decodeBranding(source) {
|
|
|
6615
6868
|
),
|
|
6616
6869
|
labelStyle,
|
|
6617
6870
|
showPoweredBy: source.branding_visibility !== false,
|
|
6871
|
+
// The two that can be empty use `pickEnumOrEmpty`, not `pickEnum`: a
|
|
6872
|
+
// value this build does not know has to decode to "unset" and defer, the
|
|
6873
|
+
// same as a key that was never written. Sending it to a concrete default
|
|
6874
|
+
// instead would make an older checkout override the connector account of
|
|
6875
|
+
// a merchant who picked a preset a newer dashboard offers.
|
|
6876
|
+
airwallexCardPreset: pickEnumOrEmpty(
|
|
6877
|
+
extras["airwallexCardPreset"],
|
|
6878
|
+
AIRWALLEX_CARD_PRESETS
|
|
6879
|
+
),
|
|
6880
|
+
airwallexHideCard: parseBool(extras["airwallexHideCard"], DEFAULT_BRANDING.airwallexHideCard),
|
|
6881
|
+
airwallexFieldChrome: pickEnum(
|
|
6882
|
+
extras["airwallexFieldChrome"],
|
|
6883
|
+
AIRWALLEX_FIELD_CHROMES,
|
|
6884
|
+
DEFAULT_BRANDING.airwallexFieldChrome
|
|
6885
|
+
),
|
|
6886
|
+
airwallexLabelStyle: pickEnumOrEmpty(
|
|
6887
|
+
extras["airwallexLabelStyle"],
|
|
6888
|
+
AIRWALLEX_LABEL_STYLES
|
|
6889
|
+
),
|
|
6890
|
+
airwallexFieldFontSize: pickEnum(
|
|
6891
|
+
extras["airwallexFieldFontSize"],
|
|
6892
|
+
AIRWALLEX_FIELD_FONT_SIZES,
|
|
6893
|
+
DEFAULT_BRANDING.airwallexFieldFontSize
|
|
6894
|
+
),
|
|
6895
|
+
airwallexFieldWeight: pickEnum(
|
|
6896
|
+
extras["airwallexFieldWeight"],
|
|
6897
|
+
AIRWALLEX_FIELD_WEIGHTS,
|
|
6898
|
+
DEFAULT_BRANDING.airwallexFieldWeight
|
|
6899
|
+
),
|
|
6900
|
+
airwallexFocusRing: pickEnum(
|
|
6901
|
+
extras["airwallexFocusRing"],
|
|
6902
|
+
AIRWALLEX_FOCUS_RINGS,
|
|
6903
|
+
DEFAULT_BRANDING.airwallexFocusRing
|
|
6904
|
+
),
|
|
6905
|
+
airwallexAutofill: pickEnum(
|
|
6906
|
+
extras["airwallexAutofill"],
|
|
6907
|
+
AIRWALLEX_AUTOFILL_TREATMENTS,
|
|
6908
|
+
DEFAULT_BRANDING.airwallexAutofill
|
|
6909
|
+
),
|
|
6910
|
+
airwallexValidTint: parseBool(
|
|
6911
|
+
extras["airwallexValidTint"],
|
|
6912
|
+
DEFAULT_BRANDING.airwallexValidTint
|
|
6913
|
+
),
|
|
6914
|
+
airwallexNetworkMarks: parseBool(
|
|
6915
|
+
extras["airwallexNetworkMarks"],
|
|
6916
|
+
DEFAULT_BRANDING.airwallexNetworkMarks
|
|
6917
|
+
),
|
|
6618
6918
|
customCss: s(extras["customCss"])
|
|
6619
6919
|
};
|
|
6620
6920
|
}
|
|
@@ -6670,6 +6970,21 @@ function encodeBranding(branding, base) {
|
|
|
6670
6970
|
logoShape: branding.logoShape,
|
|
6671
6971
|
logoSize: branding.logoSize,
|
|
6672
6972
|
labelStyle: branding.labelStyle,
|
|
6973
|
+
// Written unconditionally, empty string included. The encoder REPLACES
|
|
6974
|
+
// `sdk_ui_rules.branding` wholesale, so a key it skips is a key it
|
|
6975
|
+
// deletes — and here the empty string is a real value ("no choice made"),
|
|
6976
|
+
// not an absence. Omitting it would be indistinguishable from omitting it
|
|
6977
|
+
// by accident, which is how `summaryOrder` was lost.
|
|
6978
|
+
airwallexCardPreset: branding.airwallexCardPreset,
|
|
6979
|
+
airwallexHideCard: String(branding.airwallexHideCard),
|
|
6980
|
+
airwallexFieldChrome: branding.airwallexFieldChrome,
|
|
6981
|
+
airwallexLabelStyle: branding.airwallexLabelStyle,
|
|
6982
|
+
airwallexFieldFontSize: branding.airwallexFieldFontSize,
|
|
6983
|
+
airwallexFieldWeight: branding.airwallexFieldWeight,
|
|
6984
|
+
airwallexFocusRing: branding.airwallexFocusRing,
|
|
6985
|
+
airwallexAutofill: branding.airwallexAutofill,
|
|
6986
|
+
airwallexValidTint: String(branding.airwallexValidTint),
|
|
6987
|
+
airwallexNetworkMarks: String(branding.airwallexNetworkMarks),
|
|
6673
6988
|
trustBadges: encodeBadges(branding.trustBadges),
|
|
6674
6989
|
[METHOD_SECTION_ORDER_KEY]: encodeMethodSectionOrder(branding.methodSectionOrder)
|
|
6675
6990
|
};
|
|
@@ -6897,6 +7212,47 @@ function parseImportedBranding(raw) {
|
|
|
6897
7212
|
),
|
|
6898
7213
|
labelStyle,
|
|
6899
7214
|
showPoweredBy: parseBool(root["showPoweredBy"], dflt.showPoweredBy),
|
|
7215
|
+
// An imported profile that predates this section carries none of these
|
|
7216
|
+
// and lands on the defaults — which is to say on "defer", so importing an
|
|
7217
|
+
// old export into a shop does not take that shop's connector setting
|
|
7218
|
+
// away. The one field that would be dangerous to import loosely is the
|
|
7219
|
+
// hide switch, and `parseBool` only says true for a literal `true`.
|
|
7220
|
+
airwallexCardPreset: pickEnumOrEmpty(
|
|
7221
|
+
root["airwallexCardPreset"],
|
|
7222
|
+
AIRWALLEX_CARD_PRESETS
|
|
7223
|
+
),
|
|
7224
|
+
airwallexHideCard: parseBool(root["airwallexHideCard"], dflt.airwallexHideCard),
|
|
7225
|
+
airwallexFieldChrome: pickEnum(
|
|
7226
|
+
root["airwallexFieldChrome"],
|
|
7227
|
+
AIRWALLEX_FIELD_CHROMES,
|
|
7228
|
+
dflt.airwallexFieldChrome
|
|
7229
|
+
),
|
|
7230
|
+
airwallexLabelStyle: pickEnumOrEmpty(
|
|
7231
|
+
root["airwallexLabelStyle"],
|
|
7232
|
+
AIRWALLEX_LABEL_STYLES
|
|
7233
|
+
),
|
|
7234
|
+
airwallexFieldFontSize: pickEnum(
|
|
7235
|
+
root["airwallexFieldFontSize"],
|
|
7236
|
+
AIRWALLEX_FIELD_FONT_SIZES,
|
|
7237
|
+
dflt.airwallexFieldFontSize
|
|
7238
|
+
),
|
|
7239
|
+
airwallexFieldWeight: pickEnum(
|
|
7240
|
+
root["airwallexFieldWeight"],
|
|
7241
|
+
AIRWALLEX_FIELD_WEIGHTS,
|
|
7242
|
+
dflt.airwallexFieldWeight
|
|
7243
|
+
),
|
|
7244
|
+
airwallexFocusRing: pickEnum(
|
|
7245
|
+
root["airwallexFocusRing"],
|
|
7246
|
+
AIRWALLEX_FOCUS_RINGS,
|
|
7247
|
+
dflt.airwallexFocusRing
|
|
7248
|
+
),
|
|
7249
|
+
airwallexAutofill: pickEnum(
|
|
7250
|
+
root["airwallexAutofill"],
|
|
7251
|
+
AIRWALLEX_AUTOFILL_TREATMENTS,
|
|
7252
|
+
dflt.airwallexAutofill
|
|
7253
|
+
),
|
|
7254
|
+
airwallexValidTint: parseBool(root["airwallexValidTint"], dflt.airwallexValidTint),
|
|
7255
|
+
airwallexNetworkMarks: parseBool(root["airwallexNetworkMarks"], dflt.airwallexNetworkMarks),
|
|
6900
7256
|
customCss: sStr(root["customCss"], dflt.customCss).slice(0, CUSTOM_CSS_MAX_LENGTH)
|
|
6901
7257
|
};
|
|
6902
7258
|
}
|
|
@@ -8723,6 +9079,16 @@ var DelopayInternal = class extends Delopay {
|
|
|
8723
9079
|
};
|
|
8724
9080
|
// Annotate the CommonJS export names for ESM import in node:
|
|
8725
9081
|
0 && (module.exports = {
|
|
9082
|
+
AIRWALLEX_AUTOFILL_TREATMENTS,
|
|
9083
|
+
AIRWALLEX_CARD_LAYOUTS,
|
|
9084
|
+
AIRWALLEX_CARD_PRESETS,
|
|
9085
|
+
AIRWALLEX_CARD_PRESET_FALLBACK,
|
|
9086
|
+
AIRWALLEX_FIELD_CHROMES,
|
|
9087
|
+
AIRWALLEX_FIELD_FONT_SIZES,
|
|
9088
|
+
AIRWALLEX_FIELD_WEIGHTS,
|
|
9089
|
+
AIRWALLEX_FOCUS_RINGS,
|
|
9090
|
+
AIRWALLEX_LABEL_STYLES,
|
|
9091
|
+
AIRWALLEX_NETWORK_MARKS,
|
|
8726
9092
|
ALL_CUSTOM_FIELD_CONDITION_SOURCES,
|
|
8727
9093
|
ALL_CUSTOM_FIELD_OPERATORS,
|
|
8728
9094
|
ALL_CUSTOM_FIELD_TYPES,
|
|
@@ -8805,9 +9171,15 @@ var DelopayInternal = class extends Delopay {
|
|
|
8805
9171
|
WCAG_AA_TEXT,
|
|
8806
9172
|
WCAG_AA_UI,
|
|
8807
9173
|
Webhooks,
|
|
9174
|
+
airwallexCardLayout,
|
|
9175
|
+
airwallexCardLayoutIsCoherent,
|
|
9176
|
+
airwallexCellWeight,
|
|
9177
|
+
airwallexFieldFontPx,
|
|
9178
|
+
airwallexFieldWeightValue,
|
|
8808
9179
|
allOf,
|
|
8809
9180
|
anyOf,
|
|
8810
9181
|
applyBrandingVariables,
|
|
9182
|
+
asAirwallexCardPreset,
|
|
8811
9183
|
buildBrandingExport,
|
|
8812
9184
|
buttonPadValue,
|
|
8813
9185
|
canonicalSectionId,
|
|
@@ -8871,6 +9243,8 @@ var DelopayInternal = class extends Delopay {
|
|
|
8871
9243
|
programToTree,
|
|
8872
9244
|
radiusValue,
|
|
8873
9245
|
readableInkOn,
|
|
9246
|
+
resolveAirwallexCardPreset,
|
|
9247
|
+
resolveAirwallexLabelStyle,
|
|
8874
9248
|
ruleMatchToTree,
|
|
8875
9249
|
sanitizeCustomCss,
|
|
8876
9250
|
sectionLabel,
|