@akinon/pz-saved-card 1.101.0-rc.75 → 1.101.0-rc.76

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @akinon/pz-saved-card
2
2
 
3
+ ## 1.101.0-rc.76
4
+
5
+ ### Minor Changes
6
+
7
+ - 6bfbdc2: ZERO-3653: optimize saved card option
8
+
3
9
  ## 1.101.0-rc.75
4
10
 
5
11
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/pz-saved-card",
3
- "version": "1.101.0-rc.75",
3
+ "version": "1.101.0-rc.76",
4
4
  "license": "MIT",
5
5
  "main": "src/index.tsx",
6
6
  "peerDependencies": {
@@ -181,7 +181,6 @@ const IyzicoSavedCardOption = ({
181
181
  const [months, setMonths] = useState([]);
182
182
  const [years, setYears] = useState([]);
183
183
  const [formError, setFormError] = useState(null);
184
- const [showCardForm, setShowCardForm] = useState(true);
185
184
 
186
185
  const getFormSchema = () => {
187
186
  if (customFormSchema?.[type]) {
@@ -305,33 +304,16 @@ const IyzicoSavedCardOption = ({
305
304
  setType('new-card');
306
305
  }
307
306
 
308
- const checkInterval = setInterval(() => {
309
- if (window.iyziUcsInit?.scriptType === 'CONSUMER_WITH_CARD_EXIST') {
310
- if (
311
- !window.universalCardStorage?.consumerToken ||
312
- window.universalCardStorage?.cardToken
313
- ) {
314
- setType('existing-card');
315
- } else {
316
- setType('new-card');
317
- }
318
- }
319
- }, 500);
320
-
321
- return () => clearInterval(checkInterval);
322
- }, [type]);
323
-
324
- useEffect(() => {
325
307
  const checkboxInterval = setInterval(() => {
326
308
  if (window.universalCardStorage?.cardToken !== undefined) {
327
- setShowCardForm(false);
309
+ setType('existing-card');
328
310
  } else {
329
- setShowCardForm(true);
311
+ setType('new-card');
330
312
  }
331
313
  }, 100);
332
314
 
333
315
  return () => clearInterval(checkboxInterval);
334
- }, [type, setFormValue]);
316
+ }, [type]);
335
317
 
336
318
  return (
337
319
  <>
@@ -369,7 +351,7 @@ const IyzicoSavedCardOption = ({
369
351
  </>
370
352
  )}
371
353
 
372
- {showCardForm && (
354
+ {type === 'new-card' && (
373
355
  <>
374
356
  {customRender?.cardFormSection ? (
375
357
  customRender.cardFormSection({