Skip to content

Commit 527c350

Browse files
committed
feat: new phone number input with flags and prefilling
1 parent fb8ccb0 commit 527c350

7 files changed

Lines changed: 762 additions & 402 deletions

File tree

examples/dynamic-checkout/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
document.addEventListener("DOMContentLoaded", function () {
1212
// You need to replace these values with your own
1313
const projectId = "test-proj_qEi1u5BwoYcZb6mOMKDWIm4mpqKCq6bN"
14-
const invoiceId = "iv_1buJtZFcpQe3sdo3TdtnDWp8jTHTEk88"
14+
const invoiceId = "iv_30JJHCq6bN6TX1rV260OFo1oARdK0eQu"
1515
const clientSecret = ""
1616

1717
const client = new ProcessOut.ProcessOut(projectId)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "processout.js",
3-
"version": "1.2.6",
3+
"version": "1.2.7",
44
"description": "ProcessOut.js is a JavaScript library for ProcessOut's payment processing API.",
55
"scripts": {
66
"build:processout": "tsc -p src/processout && uglifyjs --compress --keep-fnames --ie8 dist/processout.js -o dist/processout.js",

src/nativeapm/config/theme.ts

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,82 @@ const defaultTheme: NativeApmThemeConfigType = {
132132
outline: "none",
133133
background: "transparent",
134134
padding: "8px 6px",
135-
width: "130px",
135+
width: "80px",
136136
fontSize: "0.9rem",
137137
borderRight: "6px solid transparent",
138138
height: "3rem",
139+
opacity: "0",
140+
position: "absolute",
141+
top: "0",
142+
left: "0",
143+
zIndex: "10",
144+
},
145+
selectWrapper: {
146+
position: "relative",
147+
display: "flex",
148+
alignItems: "center",
149+
justifyContent: "center",
150+
cursor: "pointer",
151+
minWidth: "60px",
152+
minHeight: "40px",
153+
width: "70px",
154+
height: "40px",
155+
boxSizing: "border-box",
156+
},
157+
flagDisplay: {
158+
display: "flex",
159+
alignItems: "center",
160+
justifyContent: "center",
161+
pointerEvents: "none",
162+
width: "100%",
163+
height: "100%",
164+
paddingRight: "3px",
165+
},
166+
flagImageVisible: {
167+
width: "24px",
168+
height: "16px",
169+
objectFit: "cover",
170+
display: "inline-block",
171+
margin: "auto",
172+
borderRadius: "4px",
173+
},
174+
flagImageHidden: {
175+
width: "24px",
176+
height: "16px",
177+
objectFit: "cover",
178+
display: "none",
179+
margin: "auto",
180+
},
181+
flagDefaultTextVisible: {
182+
textAlign: "center",
183+
display: "inline-block",
184+
alignItems: "center",
185+
justifyContent: "center",
186+
width: "20px",
187+
height: "15px",
188+
backgroundColor: "#ccc",
189+
borderRadius: "4px",
190+
content: '""',
191+
},
192+
flagDefaultTextHidden: {
193+
textAlign: "center",
194+
display: "none",
195+
alignItems: "center",
196+
justifyContent: "center",
197+
width: "100%",
198+
height: "100%",
199+
},
200+
selectChevron: {
201+
position: "absolute",
202+
right: "9px",
203+
top: "50%",
204+
transform: "translateY(-50%)",
205+
width: "0",
206+
height: "0",
207+
borderLeft: "4px solid transparent",
208+
borderRight: "4px solid transparent",
209+
borderTop: "4px solid #666",
210+
pointerEvents: "none",
139211
},
140212
phoneInputsContainer: {
141213
display: "flex",

src/nativeapm/elements/inputs/input.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,18 @@ module ProcessOut {
3535
* @type {INativeApmInput}
3636
*/
3737
inputInstance: INativeApmInput
38+
processOut: ProcessOut
3839

3940
/**
4041
* Native APM Input constructor
4142
*/
4243
constructor(
44+
processOut: ProcessOut,
4345
inputData: NativeApmInputData,
4446
theme: NativeApmThemeConfigType,
4547
prefilledValue?: string,
4648
) {
49+
this.processOut = processOut
4750
this.inputInstance = this.createInputElement(inputData, theme, prefilledValue)
4851
}
4952

@@ -87,7 +90,12 @@ module ProcessOut {
8790
return new NativeApmTextInput(inputData, theme, prefilledValue)
8891
}
8992
case "phone":
90-
return new NativeApmPhoneWithCountryInput(inputData, theme, prefilledValue)
93+
return new NativeApmPhoneWithCountryInput(
94+
this.processOut,
95+
inputData,
96+
theme,
97+
prefilledValue,
98+
)
9199

92100
case "single_select":
93101
case "single-select":

0 commit comments

Comments
 (0)