logix-payment-shift4 1.0.3 → 1.0.5

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.js CHANGED
@@ -184,18 +184,27 @@ function _unsupportedIterableToArray(r, a) {
184
184
  function PaymentForm(_ref) {
185
185
  var amount = _ref.amount,
186
186
  currency = _ref.currency;
187
+ _ref.currencyIcon;
188
+ var color = _ref.color,
189
+ _ref$formwidth = _ref.formwidth,
190
+ formwidth = _ref$formwidth === void 0 ? 400 : _ref$formwidth,
191
+ _ref$formborderRadius = _ref.formborderRadius,
192
+ formborderRadius = _ref$formborderRadius === void 0 ? 20 : _ref$formborderRadius,
193
+ _ref$formbackgroundCo = _ref.formbackgroundColor,
194
+ formbackgroundColor = _ref$formbackgroundCo === void 0 ? "#fff" : _ref$formbackgroundCo;
195
+ _ref.companyLogo;
187
196
  var formRef = React.useRef();
188
197
  var initializedRef = React.useRef(false); // yalnız bir dəfə mount üçün
189
198
  var shift4Ref = React.useRef(null);
190
199
  var componentsRef = React.useRef(null);
191
200
  var _useState = React.useState(""),
192
- _useState2 = _slicedToArray(_useState, 2),
193
- error = _useState2[0],
194
- setError = _useState2[1];
201
+ _useState2 = _slicedToArray(_useState, 2);
202
+ _useState2[0];
203
+ var setError = _useState2[1];
195
204
  var _useState3 = React.useState(""),
196
- _useState4 = _slicedToArray(_useState3, 2),
197
- success = _useState4[0],
198
- setSuccess = _useState4[1];
205
+ _useState4 = _slicedToArray(_useState3, 2);
206
+ _useState4[0];
207
+ var setSuccess = _useState4[1];
199
208
  var _useState5 = React.useState(false),
200
209
  _useState6 = _slicedToArray(_useState5, 2),
201
210
  isSubmitting = _useState6[0],
@@ -325,63 +334,29 @@ function PaymentForm(_ref) {
325
334
  style: {
326
335
  display: "flex",
327
336
  justifyContent: "center",
328
- alignItems: "center",
329
- minHeight: "100vh",
330
- backgroundColor: "#f0f2f5",
331
- // yumşaq fon
332
- padding: "20px"
333
- }
334
- }, /*#__PURE__*/React.createElement("div", {
335
- style: {
336
337
  width: "100%",
337
- maxWidth: "420px",
338
- // mobil üçün də uyğun
339
- padding: "30px",
340
- backgroundColor: "#ffffff",
341
- borderRadius: "12px",
342
- boxShadow: "0 6px 20px rgba(0,0,0,0.1)"
338
+ padding: "20px",
339
+ boxSizing: "border-box"
343
340
  }
344
- }, /*#__PURE__*/React.createElement("h2", {
345
- style: {
346
- textAlign: "center",
347
- marginBottom: "20px",
348
- color: "#333",
349
- fontWeight: "600"
350
- }
351
- }, "Secure Payment"), /*#__PURE__*/React.createElement("div", {
352
- id: "payment-error",
353
- className: "alert alert-danger",
354
- style: {
355
- marginBottom: "15px",
356
- padding: "10px",
357
- backgroundColor: "#ffe5e5",
358
- color: "#a00",
359
- borderRadius: "6px",
360
- display: error ? "block" : "none"
361
- },
362
- role: "alert",
363
- "aria-live": "polite"
364
- }, error), /*#__PURE__*/React.createElement("div", {
365
- id: "payment-success",
366
- className: "alert alert-success",
367
- style: {
368
- marginBottom: "15px",
369
- padding: "10px",
370
- backgroundColor: "#e7f6eb",
371
- color: "#1c7c3a",
372
- borderRadius: "6px",
373
- display: success ? "block" : "none"
374
- },
375
- role: "status",
376
- "aria-live": "polite"
377
- }, success), /*#__PURE__*/React.createElement("form", {
341
+ }, /*#__PURE__*/React.createElement("form", {
378
342
  ref: formRef,
379
343
  id: "payment-form",
380
- className: "grid gap-5",
381
344
  onSubmit: handleSubmit,
382
- method: "post"
345
+ method: "post",
346
+ style: {
347
+ display: "grid",
348
+ gap: "12px",
349
+ padding: "24px",
350
+ backgroundColor: formbackgroundColor,
351
+ borderRadius: formborderRadius,
352
+ width: formwidth,
353
+ boxSizing: "border-box"
354
+ }
383
355
  }, /*#__PURE__*/React.createElement("div", {
384
- className: "grid gap-2"
356
+ style: {
357
+ display: "grid",
358
+ gap: "8px"
359
+ }
385
360
  }, /*#__PURE__*/React.createElement("label", {
386
361
  style: {
387
362
  fontWeight: "500",
@@ -392,15 +367,16 @@ function PaymentForm(_ref) {
392
367
  className: "form-control",
393
368
  style: {
394
369
  padding: "12px",
395
- borderRadius: "6px",
396
- border: "1px solid #ccc"
370
+ borderRadius: "10px",
371
+ border: "1px solid #ccc",
372
+ boxShadow: "inset 0 2px 4px rgba(0,0,0,0.05)"
397
373
  }
398
374
  })), /*#__PURE__*/React.createElement("div", {
399
- className: "grid gap-2",
400
375
  style: {
401
- gridTemplateColumns: "1fr 1fr",
402
376
  display: "grid",
403
- gap: "10px"
377
+ gridTemplateColumns: "1fr 1fr",
378
+ gap: "10px",
379
+ marginTop: "12px"
404
380
  }
405
381
  }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
406
382
  style: {
@@ -412,8 +388,9 @@ function PaymentForm(_ref) {
412
388
  className: "form-control",
413
389
  style: {
414
390
  padding: "12px",
415
- borderRadius: "6px",
416
- border: "1px solid #ccc"
391
+ borderRadius: "10px",
392
+ border: "1px solid #ccc",
393
+ boxShadow: "inset 0 2px 4px rgba(0,0,0,0.05)"
417
394
  }
418
395
  })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
419
396
  style: {
@@ -425,25 +402,26 @@ function PaymentForm(_ref) {
425
402
  className: "form-control",
426
403
  style: {
427
404
  padding: "12px",
428
- borderRadius: "6px",
429
- border: "1px solid #ccc"
405
+ borderRadius: "10px",
406
+ border: "1px solid #ccc",
407
+ boxShadow: "inset 0 2px 4px rgba(0,0,0,0.05)"
430
408
  }
431
409
  }))), /*#__PURE__*/React.createElement("button", {
432
410
  type: "submit",
433
411
  disabled: !isReady || isSubmitting,
434
412
  style: {
413
+ marginTop: "16px",
435
414
  width: "100%",
436
415
  padding: "14px",
437
- backgroundColor: "#4f46e5",
416
+ backgroundColor: color,
438
417
  color: "white",
439
418
  border: "none",
440
- borderRadius: "8px",
419
+ borderRadius: "12px",
441
420
  fontWeight: "600",
442
- cursor: "pointer",
443
- opacity: !isReady || isSubmitting ? 0.7 : 1,
444
- marginTop: "10px"
421
+ cursor: !isReady || isSubmitting ? "not-allowed" : "pointer",
422
+ opacity: !isReady || isSubmitting ? 0.7 : 1
445
423
  }
446
- }, isSubmitting ? "Processing..." : "Buy now"))));
424
+ }, isSubmitting ? "Processing..." : "Buy now")));
447
425
  }
448
426
 
449
427
  exports.PaymentForm = PaymentForm;
package/dist/index.esm.js CHANGED
@@ -182,18 +182,27 @@ function _unsupportedIterableToArray(r, a) {
182
182
  function PaymentForm(_ref) {
183
183
  var amount = _ref.amount,
184
184
  currency = _ref.currency;
185
+ _ref.currencyIcon;
186
+ var color = _ref.color,
187
+ _ref$formwidth = _ref.formwidth,
188
+ formwidth = _ref$formwidth === void 0 ? 400 : _ref$formwidth,
189
+ _ref$formborderRadius = _ref.formborderRadius,
190
+ formborderRadius = _ref$formborderRadius === void 0 ? 20 : _ref$formborderRadius,
191
+ _ref$formbackgroundCo = _ref.formbackgroundColor,
192
+ formbackgroundColor = _ref$formbackgroundCo === void 0 ? "#fff" : _ref$formbackgroundCo;
193
+ _ref.companyLogo;
185
194
  var formRef = useRef();
186
195
  var initializedRef = useRef(false); // yalnız bir dəfə mount üçün
187
196
  var shift4Ref = useRef(null);
188
197
  var componentsRef = useRef(null);
189
198
  var _useState = useState(""),
190
- _useState2 = _slicedToArray(_useState, 2),
191
- error = _useState2[0],
192
- setError = _useState2[1];
199
+ _useState2 = _slicedToArray(_useState, 2);
200
+ _useState2[0];
201
+ var setError = _useState2[1];
193
202
  var _useState3 = useState(""),
194
- _useState4 = _slicedToArray(_useState3, 2),
195
- success = _useState4[0],
196
- setSuccess = _useState4[1];
203
+ _useState4 = _slicedToArray(_useState3, 2);
204
+ _useState4[0];
205
+ var setSuccess = _useState4[1];
197
206
  var _useState5 = useState(false),
198
207
  _useState6 = _slicedToArray(_useState5, 2),
199
208
  isSubmitting = _useState6[0],
@@ -323,63 +332,29 @@ function PaymentForm(_ref) {
323
332
  style: {
324
333
  display: "flex",
325
334
  justifyContent: "center",
326
- alignItems: "center",
327
- minHeight: "100vh",
328
- backgroundColor: "#f0f2f5",
329
- // yumşaq fon
330
- padding: "20px"
331
- }
332
- }, /*#__PURE__*/React.createElement("div", {
333
- style: {
334
335
  width: "100%",
335
- maxWidth: "420px",
336
- // mobil üçün də uyğun
337
- padding: "30px",
338
- backgroundColor: "#ffffff",
339
- borderRadius: "12px",
340
- boxShadow: "0 6px 20px rgba(0,0,0,0.1)"
336
+ padding: "20px",
337
+ boxSizing: "border-box"
341
338
  }
342
- }, /*#__PURE__*/React.createElement("h2", {
343
- style: {
344
- textAlign: "center",
345
- marginBottom: "20px",
346
- color: "#333",
347
- fontWeight: "600"
348
- }
349
- }, "Secure Payment"), /*#__PURE__*/React.createElement("div", {
350
- id: "payment-error",
351
- className: "alert alert-danger",
352
- style: {
353
- marginBottom: "15px",
354
- padding: "10px",
355
- backgroundColor: "#ffe5e5",
356
- color: "#a00",
357
- borderRadius: "6px",
358
- display: error ? "block" : "none"
359
- },
360
- role: "alert",
361
- "aria-live": "polite"
362
- }, error), /*#__PURE__*/React.createElement("div", {
363
- id: "payment-success",
364
- className: "alert alert-success",
365
- style: {
366
- marginBottom: "15px",
367
- padding: "10px",
368
- backgroundColor: "#e7f6eb",
369
- color: "#1c7c3a",
370
- borderRadius: "6px",
371
- display: success ? "block" : "none"
372
- },
373
- role: "status",
374
- "aria-live": "polite"
375
- }, success), /*#__PURE__*/React.createElement("form", {
339
+ }, /*#__PURE__*/React.createElement("form", {
376
340
  ref: formRef,
377
341
  id: "payment-form",
378
- className: "grid gap-5",
379
342
  onSubmit: handleSubmit,
380
- method: "post"
343
+ method: "post",
344
+ style: {
345
+ display: "grid",
346
+ gap: "12px",
347
+ padding: "24px",
348
+ backgroundColor: formbackgroundColor,
349
+ borderRadius: formborderRadius,
350
+ width: formwidth,
351
+ boxSizing: "border-box"
352
+ }
381
353
  }, /*#__PURE__*/React.createElement("div", {
382
- className: "grid gap-2"
354
+ style: {
355
+ display: "grid",
356
+ gap: "8px"
357
+ }
383
358
  }, /*#__PURE__*/React.createElement("label", {
384
359
  style: {
385
360
  fontWeight: "500",
@@ -390,15 +365,16 @@ function PaymentForm(_ref) {
390
365
  className: "form-control",
391
366
  style: {
392
367
  padding: "12px",
393
- borderRadius: "6px",
394
- border: "1px solid #ccc"
368
+ borderRadius: "10px",
369
+ border: "1px solid #ccc",
370
+ boxShadow: "inset 0 2px 4px rgba(0,0,0,0.05)"
395
371
  }
396
372
  })), /*#__PURE__*/React.createElement("div", {
397
- className: "grid gap-2",
398
373
  style: {
399
- gridTemplateColumns: "1fr 1fr",
400
374
  display: "grid",
401
- gap: "10px"
375
+ gridTemplateColumns: "1fr 1fr",
376
+ gap: "10px",
377
+ marginTop: "12px"
402
378
  }
403
379
  }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
404
380
  style: {
@@ -410,8 +386,9 @@ function PaymentForm(_ref) {
410
386
  className: "form-control",
411
387
  style: {
412
388
  padding: "12px",
413
- borderRadius: "6px",
414
- border: "1px solid #ccc"
389
+ borderRadius: "10px",
390
+ border: "1px solid #ccc",
391
+ boxShadow: "inset 0 2px 4px rgba(0,0,0,0.05)"
415
392
  }
416
393
  })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
417
394
  style: {
@@ -423,25 +400,26 @@ function PaymentForm(_ref) {
423
400
  className: "form-control",
424
401
  style: {
425
402
  padding: "12px",
426
- borderRadius: "6px",
427
- border: "1px solid #ccc"
403
+ borderRadius: "10px",
404
+ border: "1px solid #ccc",
405
+ boxShadow: "inset 0 2px 4px rgba(0,0,0,0.05)"
428
406
  }
429
407
  }))), /*#__PURE__*/React.createElement("button", {
430
408
  type: "submit",
431
409
  disabled: !isReady || isSubmitting,
432
410
  style: {
411
+ marginTop: "16px",
433
412
  width: "100%",
434
413
  padding: "14px",
435
- backgroundColor: "#4f46e5",
414
+ backgroundColor: color,
436
415
  color: "white",
437
416
  border: "none",
438
- borderRadius: "8px",
417
+ borderRadius: "12px",
439
418
  fontWeight: "600",
440
- cursor: "pointer",
441
- opacity: !isReady || isSubmitting ? 0.7 : 1,
442
- marginTop: "10px"
419
+ cursor: !isReady || isSubmitting ? "not-allowed" : "pointer",
420
+ opacity: !isReady || isSubmitting ? 0.7 : 1
443
421
  }
444
- }, isSubmitting ? "Processing..." : "Buy now"))));
422
+ }, isSubmitting ? "Processing..." : "Buy now")));
445
423
  }
446
424
 
447
425
  export { PaymentForm };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "logix-payment-shift4",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "description": "A React component library for integrating Shift4 payments with Logix applications.",
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useRef, useState } from "react";
2
2
 
3
- export default function PaymentForm({amount,currency}) {
3
+ export default function PaymentForm({amount,currency,currencyIcon,color,formwidth=400,formborderRadius=20,formbackgroundColor="#fff",companyLogo}) {
4
4
  const formRef = useRef();
5
5
  const initializedRef = useRef(false); // yalnız bir dəfə mount üçün
6
6
  const shift4Ref = useRef(null);
@@ -90,105 +90,98 @@ export default function PaymentForm({amount,currency}) {
90
90
  };
91
91
 
92
92
  return (
93
- <div
93
+ <div
94
94
  style={{
95
95
  display: "flex",
96
96
  justifyContent: "center",
97
- alignItems: "center",
98
- minHeight: "100vh",
99
- backgroundColor: "#f0f2f5", // yumşaq fon
97
+ width: "100%",
100
98
  padding: "20px",
99
+ boxSizing: "border-box"
101
100
  }}
102
101
  >
103
- <div
102
+ <form
103
+ ref={formRef}
104
+ id="payment-form"
105
+ onSubmit={handleSubmit}
106
+ method="post"
104
107
  style={{
105
- width: "100%",
106
- maxWidth: "420px", // mobil üçün də uyğun
107
- padding: "30px",
108
- backgroundColor: "#ffffff",
109
- borderRadius: "12px",
110
- boxShadow: "0 6px 20px rgba(0,0,0,0.1)",
108
+ display: "grid",
109
+ gap: "12px",
110
+ padding: "24px",
111
+ backgroundColor: formbackgroundColor,
112
+ borderRadius: formborderRadius,
113
+ width: formwidth,
114
+ boxSizing: "border-box"
111
115
  }}
112
116
  >
113
- <h2 style={{ textAlign: "center", marginBottom: "20px", color: "#333", fontWeight: "600" }}>
114
- Secure Payment
115
- </h2>
117
+
118
+
119
+ {/* Card Number */}
120
+ <div style={{ display: "grid", gap: "8px" }}>
121
+ <label style={{ fontWeight: "500", color: "#555" }}>Card number</label>
122
+ <div
123
+ data-shift4="number"
124
+ className="form-control"
125
+ style={{
126
+ padding: "12px",
127
+ borderRadius: "10px",
128
+ border: "1px solid #ccc",
129
+ boxShadow: "inset 0 2px 4px rgba(0,0,0,0.05)"
130
+ }}
131
+ />
132
+ </div>
116
133
 
117
- <div
118
- id="payment-error"
119
- className="alert alert-danger"
120
- style={{
121
- marginBottom: "15px",
122
- padding: "10px",
123
- backgroundColor: "#ffe5e5",
124
- color: "#a00",
125
- borderRadius: "6px",
126
- display: error ? "block" : "none",
127
- }}
128
- role="alert"
129
- aria-live="polite"
130
- >
131
- {error}
134
+ {/* Expiration + CVC */}
135
+ <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: "10px", marginTop: "12px" }}>
136
+ <div>
137
+ <label style={{ fontWeight: "500", color: "#555" }}>Expiration</label>
138
+ <div
139
+ data-shift4="expiry"
140
+ className="form-control"
141
+ style={{
142
+ padding: "12px",
143
+ borderRadius: "10px",
144
+ border: "1px solid #ccc",
145
+ boxShadow: "inset 0 2px 4px rgba(0,0,0,0.05)"
146
+ }}
147
+ />
148
+ </div>
149
+ <div>
150
+ <label style={{ fontWeight: "500", color: "#555" }}>CVC</label>
151
+ <div
152
+ data-shift4="cvc"
153
+ className="form-control"
154
+ style={{
155
+ padding: "12px",
156
+ borderRadius: "10px",
157
+ border: "1px solid #ccc",
158
+ boxShadow: "inset 0 2px 4px rgba(0,0,0,0.05)"
159
+ }}
160
+ />
161
+ </div>
132
162
  </div>
133
163
 
134
- <div
135
- id="payment-success"
136
- className="alert alert-success"
164
+ {/* Submit Button */}
165
+ <button
166
+ type="submit"
167
+ disabled={!isReady || isSubmitting}
137
168
  style={{
138
- marginBottom: "15px",
139
- padding: "10px",
140
- backgroundColor: "#e7f6eb",
141
- color: "#1c7c3a",
142
- borderRadius: "6px",
143
- display: success ? "block" : "none",
169
+ marginTop: "16px",
170
+ width: "100%",
171
+ padding: "14px",
172
+ backgroundColor: color,
173
+ color: "white",
174
+ border: "none",
175
+ borderRadius: "12px",
176
+ fontWeight: "600",
177
+ cursor: !isReady || isSubmitting ? "not-allowed" : "pointer",
178
+ opacity: !isReady || isSubmitting ? 0.7 : 1
144
179
  }}
145
- role="status"
146
- aria-live="polite"
147
180
  >
148
- {success}
149
- </div>
150
-
151
- <form ref={formRef} id="payment-form" className="grid gap-5" onSubmit={handleSubmit} method="post">
152
- {/* Card Number */}
153
- <div className="grid gap-2">
154
- <label style={{ fontWeight: "500", color: "#555" }}>Card number</label>
155
- <div data-shift4="number" className="form-control" style={{ padding: "12px", borderRadius: "6px", border: "1px solid #ccc" }}></div>
156
- </div>
157
-
158
- {/* Expiration + CVC */}
159
- <div className="grid gap-2" style={{ gridTemplateColumns: "1fr 1fr", display: "grid", gap: "10px" }}>
160
- <div>
161
- <label style={{ fontWeight: "500", color: "#555" }}>Expiration</label>
162
- <div data-shift4="expiry" className="form-control" style={{ padding: "12px", borderRadius: "6px", border: "1px solid #ccc" }}></div>
163
- </div>
164
-
165
- <div>
166
- <label style={{ fontWeight: "500", color: "#555" }}>CVC</label>
167
- <div data-shift4="cvc" className="form-control" style={{ padding: "12px", borderRadius: "6px", border: "1px solid #ccc" }}></div>
168
- </div>
169
- </div>
170
-
171
- {/* Submit Button */}
172
- <button
173
- type="submit"
174
- disabled={!isReady || isSubmitting}
175
- style={{
176
- width: "100%",
177
- padding: "14px",
178
- backgroundColor: "#4f46e5",
179
- color: "white",
180
- border: "none",
181
- borderRadius: "8px",
182
- fontWeight: "600",
183
- cursor: "pointer",
184
- opacity: !isReady || isSubmitting ? 0.7 : 1,
185
- marginTop: "10px",
186
- }}
187
- >
188
- {isSubmitting ? "Processing..." : "Buy now"}
189
- </button>
190
- </form>
191
- </div>
181
+ {isSubmitting ? "Processing..." : "Buy now"}
182
+ </button>
183
+ </form>
192
184
  </div>
185
+
193
186
  );
194
187
  }