@primer-io/checkout-web 2.52.0 โ 2.53.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/README.md +8 -0
- package/dist/Checkout.css +2 -1
- package/dist/Primer.js +2 -2
- package/dist/index.d.ts +262 -95
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -67,6 +67,14 @@ Not yet integrated with Primer and interested in learning more? [Contact us](htt
|
|
|
67
67
|
|
|
68
68
|
<br/>
|
|
69
69
|
|
|
70
|
+
# ๐งช Testing
|
|
71
|
+
|
|
72
|
+
This project uses Vitest for unit testing and specifically excludes component tests with jsdom. Only TypeScript/JavaScript-based unit tests are supported in the main test environment.
|
|
73
|
+
|
|
74
|
+
If component testing is needed, please use the Playwright e2e tests in the `/playwright` directory.
|
|
75
|
+
|
|
76
|
+
<br/>
|
|
77
|
+
|
|
70
78
|
# ๐งฑ Installation
|
|
71
79
|
|
|
72
80
|
## With npm (recommended)
|
package/dist/Checkout.css
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
@keyframes PrimerCheckout__loadingSpinner{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes blink{0%,100%{opacity:1}50%{opacity:.5}}@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}100%{stroke-dasharray:90,150;stroke-dashoffset:-35}100%{stroke-dasharray:90,150;stroke-dashoffset:-124}}.PrimerCheckout__title{padding:0;margin:0;font-size:1.15rem;color:#262626;font-weight:500}.PrimerCheckout__sceneElement{flex:0 0 auto}.PrimerCheckout__sceneElement:not(:last-child){margin-bottom:32px}.PrimerCheckout__divider{display:flex;flex-direction:row;align-items:center;transition:all cubic-bezier(0.4, 0, 0.2, 1) 300ms}.PrimerCheckout__divider>.PrimerCheckout__label{display:inline-block;margin:0px 10px}.PrimerCheckout__divider>.PrimerCheckout__dividerLineSegment{background-color:#e0e0e0;flex:1 1 auto;height:1px}.PrimerCheckout__divider--hidden{transform:translateY(-20px);opacity:0}.PrimerCheckout__textDivider{display:flex;align-items:center;text-align:center}.PrimerCheckout__textDivider::before,.PrimerCheckout__textDivider::after{display:block;content:"";flex:1;height:1px;background:#e0e0e0;min-width:16px}.PrimerCheckout__textDivider::before{margin-right:8px}@media(max-width: 600px){.PrimerCheckout__textDivider::before{margin-right:2px}}.PrimerCheckout__textDivider::after{margin-left:8px}@media(max-width: 600px){.PrimerCheckout__textDivider::after{margin-left:2px}}.PrimerCheckout__apmButton{position:relative;display:flex;align-items:stretch;justify-content:center;overflow:hidden;transition:opacity 300ms cubic-bezier(0.4, 0, 0.2, 1)}.PrimerCheckout__apmButton button{cursor:pointer;width:100%;border:none}.PrimerCheckout__apmButton:focus-within{outline:2px solid #3447f4;outline-offset:2px}.PrimerCheckout__apmButton:not(:first-of-type){margin-top:8px}.PrimerCheckout__apmButton>.paypal-buttons{transition:none !important}.PrimerCheckout__apmButton--logo{border-width:1px;border-style:solid}.PrimerCheckout__apmButton--logo:hover{opacity:.8}.PrimerCheckout__apmButton--logo img{max-height:100%;max-width:calc(100% - 8px)}.PrimerCheckout__apmButton span{font-size:.833rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#primer-checkout-apm-googlePay{height:auto;min-height:40px}.PrimerCheckout__separator{margin:32px 0px;height:1px;background:#e0e0e0}.PrimerCheckout__emptyText{transform:translateY(0px);opacity:1;transition:all cubic-bezier(0.4, 0, 0.2, 1) 300ms}.PrimerCheckout__emptyText.PrimerCheckout--exit{transform:transalteY(-20px);opacity:0}.PrimerCheckout__cardTypes{width:-moz-fit-content;width:fit-content;display:flex}.PrimerCheckout__hostedInputContent{display:flex;flex-direction:row;position:absolute;top:50%;transform:translateY(-50%);overflow:hidden;pointer-events:none;right:12px;height:100%;padding:11px 0px;align-items:center}.PrimerCheckout__cardType{position:relative;width:24px;height:100%;transition:all 300ms cubic-bezier(0.4, 0, 0.2, 1),opacity 300ms cubic-bezier(0.4, 0, 0.2, 1)}.PrimerCheckout__cardType>*{width:100%;height:100%;object-fit:contain;object-position:center}.PrimerCheckout__cardType.PrimerCheckout--hidden{display:inline-block !important;width:0px;margin-right:0px;opacity:0}.PrimerCheckout__cardType.PrimerCheckout--error::after{content:"";position:absolute;right:-4px;top:-4px;width:8px;height:8px;border-radius:50%;background-color:#ea4335}.PrimerCheckout__form{display:flex;flex-direction:column}.PrimerCheckout__formHeader{display:flex;flex-direction:row;justify-content:space-between;align-items:center;margin-bottom:32px}.PrimerCheckout__formField{position:relative;flex:0}.PrimerCheckout__formField.PrimerCheckout__formField--dual{display:flex;flex-direction:row;justify-content:space-between;align-items:baseline}.PrimerCheckout__formField.PrimerCheckout__formField--dual>.PrimerCheckout__formField{flex:0 1 calc(50% - 8px)}.PrimerCheckout__formField.PrimerCheckout__formField--dual>.PrimerCheckout__formField{margin-top:0px}@media(max-width: 600px){.PrimerCheckout__formField.PrimerCheckout__formField--dual{display:flex;flex-direction:column;align-items:initial}.PrimerCheckout__formField.PrimerCheckout__formField--dual>.PrimerCheckout__formField{flex:unset}.PrimerCheckout__formField.PrimerCheckout__formField--dual>.PrimerCheckout__formField+.PrimerCheckout__formField{margin-top:inherit}}.PrimerCheckout__formField.PrimerCheckout__formField--orientation-horizontal{display:flex;flex-direction:row;align-items:center}.PrimerCheckout__formField>.PrimerCheckout__label{display:inline-block;margin-left:1px}.PrimerCheckout__formField .PrimerCheckout__checkbox+.PrimerCheckout__label{cursor:pointer;margin-left:8px}.PrimerCheckout__helperText{position:relative;z-index:0;transition:all cubic-bezier(0.4, 0, 0.2, 1) 300ms;transform:translateY(-20px);opacity:0}.PrimerCheckout__helperText.PrimerCheckout--enter{transform:translateY(-20px);opacity:0;margin-top:0px;animation:none}.PrimerCheckout__helperText.PrimerCheckout--entering{transform:translateY(0px);opacity:1}.PrimerCheckout__helperText.PrimerCheckout--entered{opacity:1;transform:translateY(0px)}.PrimerCheckout__helperText.PrimerCheckout--exit{opacity:1;animation:none}.PrimerCheckout__helperText.PrimerCheckout--exiting{opacity:0;transform:translateY(-20px)}.PrimerCheckout__formFieldTitle{display:flex;align-items:center}.PrimerCheckout__checkbox{-webkit-appearance:none;font-size:1rem;cursor:pointer;margin:0px;padding:8px;display:inline-block;position:relative;color:#fff;border-radius:4px;border:1px solid #bdbdbd}.PrimerCheckout__checkbox:checked{color:#fff;background-color:#3447f4;border-color:#3447f4}.PrimerCheckout__checkbox::after{content:"โ";font-size:16px;position:absolute;top:50%;left:55%;transform:translate(-50%, -50%)}#primer-checkout-vault-methods{opacity:1;transform-origin:top center;transform:translateY(0px);transition:all 500ms cubic-bezier(0.4, 0, 0.2, 1)}#primer-checkout-vault-methods.PrimerCheckout--exit{opacity:0;transform:translateY(-100px)}.PrimerCheckout__dropDownMenu{border:1px solid #e0e0e0;border-radius:2px;display:flex;flex-direction:column;position:absolute;z-index:1000;top:0px;right:0px;width:100%;background-color:#fff;box-shadow:0px 1px 10px rgba(0,0,0,.1),0px 0px 20px rgba(52,71,244,.1);opacity:0;transform-origin:top center;transform:translateY(-10px) scaleY(0.9);transition:all cubic-bezier(0.4, 0, 0.2, 1) 300ms;pointer-events:none}.PrimerCheckout__dropDownMenu>.PrimerCheckout__label{padding:12px 12px 6px}.PrimerCheckout__dropDownMenu--enter{pointer-events:all;opacity:1;transform:translateY(0px) scaleY(1)}.PrimerCheckout__dropDownMenuItem{transition:background-color 100ms ease;padding:6px 12px}.PrimerCheckout__dropDownMenuItem:hover,.PrimerCheckout__dropDownMenuItem:focus{background-color:#eaf1ff}.PrimerCheckout__dropDownMenuItem>.PrimerCheckout__label{white-space:nowrap;color:#3447f4}.PrimerCheckout__paymentMethodDropDownMenuItem{margin:0px 16px;transition:all cubic-bezier(0.4, 0, 0.2, 1) 300ms}.PrimerCheckout__paymentMethodDropDownMenuItem:not(:last-child){border-bottom:1px solid #e0e0e0}.PrimerCheckout__paymentMethodDropDownMenuItem--disabled{pointer-events:none;opacity:.3}.PrimerCheckout__paymentMethodDropDownMenuItem__content{display:flex;flex-direction:row;align-items:center;padding:16px 0px}.PrimerCheckout__paymentMethodDropDownMenuItem__label.PrimerCheckout__label{min-width:0;margin-right:8px;font-size:.75rem;word-break:break-all}.PrimerCheckout__paymentMethodDropDownMenuItem__confirmationContainer{pointer-events:none;position:relative;height:0;padding-bottom:0px;opacity:0;transform:translateY(-20px);transition:all cubic-bezier(0.4, 0, 0.2, 1) 300ms,opacity cubic-bezier(0.4, 0, 0.2, 1) 200ms}.PrimerCheckout__paymentMethodDropDownMenuItem__confirmationContainer--enter{pointer-events:all;transform:translateY(0px);height:56px;opacity:1;padding-bottom:16px}.PrimerCheckout__deleteButton{display:block;width:100%;padding:0;margin:0;border:none;background:none;cursor:pointer;font-family:inherit;outline-offset:2px;outline-color:#3447f4}.PrimerCheckout__deleteButton:disabled{cursor:auto}.PrimerCheckout__deleteConfirmation{height:30px}.PrimerCheckout__confirmButton{display:block;width:100%;padding:0;margin:0;border:none;background:none;cursor:pointer;font-family:inherit;outline-offset:2px;outline-color:#3447f4;display:grid;width:100%;place-items:center;height:40px;border:1px solid #3447f4;border-radius:4px;text-align:center;color:#3447f4;font-size:.875rem}.PrimerCheckout__confirmButton:disabled{cursor:auto}.PrimerCheckout__savedPaymentMethods{display:flex;flex-direction:column}.PrimerCheckout__savedPaymentMethods__title{display:flex;flex-direction:row;align-items:center;margin-bottom:15px}.PrimerCheckout__klarnaPaymentOptions{width:100%;position:relative;overflow:hidden;transition:height 200ms ease-in-out;padding:0px 64px}.PrimerCheckout__klarnaPaymentCategory{display:block;width:100%;padding:0;margin:0;border:none;background:none;cursor:pointer;font-family:inherit;outline-offset:2px;outline-color:#3447f4;border:1px solid #e0e0e0;border-radius:2px;display:grid;grid-auto-flow:column;place-content:center;align-items:center;padding:8px 0px}.PrimerCheckout__klarnaPaymentCategory:disabled{cursor:auto}.PrimerCheckout__klarnaPaymentCategory>img{margin-right:12px}.PrimerCheckout__klarnaPaymentCategory:first-child{margin-top:20px}.PrimerCheckout__klarnaPaymentCategory+.PrimerCheckout__klarnaPaymentCategory{margin-top:12px}.PrimerCheckout__klarnaPaymentOptionButton{display:block;width:100%;padding:0;margin:0;border:none;background:none;cursor:pointer;font-family:inherit;outline-offset:2px;outline-color:#3447f4;padding:6px 12px;width:100%;display:flex;align-items:center}.PrimerCheckout__klarnaPaymentOptionButton:disabled{cursor:auto}.PrimerCheckout__klarnaPaymentOptionButton>img{margin-right:12px}.PrimerCheckout__processingIndicatorOverlay{pointer-events:none;position:absolute;top:0px;left:0px;right:0px;bottom:0px;z-index:100;display:grid;place-items:center;transition:transform 500ms cubic-bezier(0.4, 0, 0.2, 1),opacity 300ms linear;opacity:0;transform:translateY(50px)}.PrimerCheckout__processingIndicatorOverlay.PrimerCheckout--entering,.PrimerCheckout__processingIndicatorOverlay.PrimerCheckout--entered{opacity:1;transform:translateY(0px)}.PrimerCheckout__processingIndicatorContainer{padding:32px}.PrimerCheckout__check{padding:0px 16px;align-items:center;justify-content:center;text-align:center;min-height:18rem}.PrimerCheckout__checkMarkIcon{width:3rem;padding-bottom:20px}#primer-checkout-scene-credit-card-form{padding-bottom:32px}#primer-checkout-bancontact-scene-credit-card-form{padding-bottom:32px}.PrimerCheckout__creditCardButton_icon{height:81%}.PrimerCheckout__surcharge{background:rgba(36,42,47,.031372549);border-radius:5px;display:flex;flex-direction:column;gap:4px;padding:5px;margin-top:15px}.PrimerCheckout__surcharge>.PrimerCheckout__label{text-align:right}.PrimerCheckout__surcharge-message{display:flex;flex-direction:column;gap:4px;margin-top:15px}.PrimerCheckout__surcharge-message>.PrimerCheckout__label{text-align:right}.PrimerCheckout{box-sizing:border-box;background-color:rgba(0,0,0,0);position:relative;display:flex;flex-direction:column}.PrimerCheckout *[hidden=true]{display:none}.PrimerCheckout dialog{margin:0;padding:0}.PrimerCheckout input{outline-color:#3447f4}.PrimerCheckout div{box-sizing:border-box}.PrimerCheckout--hidden{display:none !important}.PrimerCheckout--exited{display:none}.PrimerCheckout--centered{text-align:center}.PrimerCheckout--loading #primer-checkout-payment-method-scene{pointer-events:none}.PrimerCheckout__scene{display:flex;flex-direction:column;position:relative;left:0;top:0;opacity:1}.PrimerCheckout__modalBody{display:grid;place-content:center;background-color:#fff;border-radius:3px;position:relative;box-shadow:1px 1px 5px 3px rgba(0,0,0,.05);overflow:hidden}.PrimerCheckout__modalBody>iframe{position:absolute;left:0px;top:0px;right:0px;bottom:0px;width:100%;height:100%}.PrimerCheckout__scene--3dsModal{position:fixed;top:0px;left:0px;right:0px;bottom:0px;z-index:101;width:100%;height:100% !important;display:grid;place-content:center;background-color:rgba(0,0,0,.2);transition:all 500ms cubic-bezier(0.4, 0, 0.2, 1);opacity:0}.PrimerCheckout__scene--3dsModal>.PrimerCheckout__modalBody{transition:all 500ms cubic-bezier(0.4, 0, 0.2, 1);opacity:0;transform:translateY(100vh)}.PrimerCheckout__scene--3dsModal.PrimerCheckout--enter{opacity:1}.PrimerCheckout__scene--3dsModal.PrimerCheckout--enter>.PrimerCheckout__modalBody{opacity:1;transform:translateY(0vh)}#primer-checkout-scene-vault{padding-bottom:32px}#primer-checkout-other-payment-methods{height:0px;width:0px;opacity:0;transition:all 500ms cubic-bezier(0.4, 0, 0.2, 1);visibility:hidden}#primer-checkout-other-payment-methods>*:last-child{height:32px}#primer-checkout-other-payment-methods.PrimerCheckout--entering,#primer-checkout-other-payment-methods.PrimerCheckout--entered{width:auto;opacity:1;visibility:visible}#primer-checkout-payment-method-divider{opacity:1;transition:all 500ms cubic-bezier(0.4, 0, 0.2, 1)}#primer-checkout-payment-method-divider.PrimerCheckout--exit{opacity:0;height:0px;margin-bottom:0px}
|
|
1
|
+
@keyframes PrimerCheckout__loadingSpinner{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes blink{0%,to{opacity:1}50%{opacity:.5}}@keyframes rotate{to{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1 150;stroke-dashoffset:0}to{stroke-dasharray:90 150;stroke-dashoffset:-35px}to{stroke-dasharray:90 150;stroke-dashoffset:-124px}}.PrimerCheckout__title{color:#262626;margin:0;padding:0;font-size:1.15rem;font-weight:500}.PrimerCheckout__sceneElement{flex:none}.PrimerCheckout__sceneElement:not(:last-child){margin-bottom:32px}.PrimerCheckout__divider{flex-direction:row;align-items:center;transition:all .3s cubic-bezier(.4,0,.2,1);display:flex}.PrimerCheckout__divider>.PrimerCheckout__label{margin:0 10px;display:inline-block}.PrimerCheckout__divider>.PrimerCheckout__dividerLineSegment{background-color:#e0e0e0;flex:auto;height:1px}.PrimerCheckout__divider--hidden{opacity:0;transform:translateY(-20px)}.PrimerCheckout__textDivider{text-align:center;align-items:center;display:flex}.PrimerCheckout__textDivider:before,.PrimerCheckout__textDivider:after{content:"";background:#e0e0e0;flex:1;min-width:16px;height:1px;display:block}.PrimerCheckout__textDivider:before{margin-right:8px}@media (max-width:600px){.PrimerCheckout__textDivider:before{margin-right:2px}}.PrimerCheckout__textDivider:after{margin-left:8px}@media (max-width:600px){.PrimerCheckout__textDivider:after{margin-left:2px}}.PrimerCheckout__apmButton{justify-content:center;align-items:stretch;transition:opacity .3s cubic-bezier(.4,0,.2,1);display:flex;position:relative;overflow:hidden}.PrimerCheckout__apmButton button{cursor:pointer;border:none;width:100%}.PrimerCheckout__apmButton:focus-within{outline-offset:2px;outline:2px solid #3447f4}.PrimerCheckout__apmButton:not(:first-of-type){margin-top:8px}.PrimerCheckout__apmButton>.paypal-buttons{transition:none!important}.PrimerCheckout__apmButton--logo{border-style:solid;border-width:1px}.PrimerCheckout__apmButton--logo:hover{opacity:.8}.PrimerCheckout__apmButton--logo img{max-width:calc(100% - 8px);max-height:100%}.PrimerCheckout__apmButton span{white-space:nowrap;text-overflow:ellipsis;font-size:.833rem;overflow:hidden}#primer-checkout-apm-googlePay{height:auto;min-height:40px}.PrimerCheckout__separator{background:#e0e0e0;height:1px;margin:32px 0}.PrimerCheckout__emptyText{opacity:1;transition:all .3s cubic-bezier(.4,0,.2,1);transform:translateY(0)}.PrimerCheckout__emptyText.PrimerCheckout--exit{transform:transalteY(-20px);opacity:0}.PrimerCheckout__cardTypes{width:-moz-fit-content;width:fit-content;display:flex}.PrimerCheckout__hostedInputContent{pointer-events:none;flex-direction:row;align-items:center;height:100%;padding:11px 0;display:flex;position:absolute;top:50%;right:12px;overflow:hidden;transform:translateY(-50%)}.PrimerCheckout__cardType{width:24px;height:100%;transition:all .3s cubic-bezier(.4,0,.2,1),opacity .3s cubic-bezier(.4,0,.2,1);position:relative}.PrimerCheckout__cardType>*{object-fit:contain;object-position:center;width:100%;height:100%}.PrimerCheckout__cardType.PrimerCheckout--hidden{opacity:0;width:0;margin-right:0;display:inline-block!important}.PrimerCheckout__cardType.PrimerCheckout--error:after{content:"";background-color:#ea4335;border-radius:50%;width:8px;height:8px;position:absolute;top:-4px;right:-4px}.PrimerCheckout__form{flex-direction:column;display:flex}.PrimerCheckout__formHeader{flex-direction:row;justify-content:space-between;align-items:center;margin-bottom:32px;display:flex}.PrimerCheckout__formField{flex:0;position:relative}.PrimerCheckout__formField.PrimerCheckout__formField--dual{flex-direction:row;justify-content:space-between;align-items:baseline;display:flex}.PrimerCheckout__formField.PrimerCheckout__formField--dual>.PrimerCheckout__formField{flex:0 calc(50% - 8px);margin-top:0}@media (max-width:600px){.PrimerCheckout__formField.PrimerCheckout__formField--dual{align-items:initial;flex-direction:column;display:flex}.PrimerCheckout__formField.PrimerCheckout__formField--dual>.PrimerCheckout__formField{flex:unset}.PrimerCheckout__formField.PrimerCheckout__formField--dual>.PrimerCheckout__formField+.PrimerCheckout__formField{margin-top:inherit}}.PrimerCheckout__formField.PrimerCheckout__formField--orientation-horizontal{flex-direction:row;align-items:center;display:flex}.PrimerCheckout__formField>.PrimerCheckout__label{margin-left:1px;display:inline-block}.PrimerCheckout__formField .PrimerCheckout__checkbox+.PrimerCheckout__label{cursor:pointer;margin-left:8px}.PrimerCheckout__helperText{z-index:0;opacity:0;transition:all .3s cubic-bezier(.4,0,.2,1);position:relative;transform:translateY(-20px)}.PrimerCheckout__helperText.PrimerCheckout--enter{opacity:0;margin-top:0;animation:none;transform:translateY(-20px)}.PrimerCheckout__helperText.PrimerCheckout--entering,.PrimerCheckout__helperText.PrimerCheckout--entered{opacity:1;transform:translateY(0)}.PrimerCheckout__helperText.PrimerCheckout--exit{opacity:1;animation:none}.PrimerCheckout__helperText.PrimerCheckout--exiting{opacity:0;transform:translateY(-20px)}.PrimerCheckout__formFieldTitle{align-items:center;display:flex}.PrimerCheckout__checkbox{-webkit-appearance:none;cursor:pointer;color:#fff;border:1px solid #bdbdbd;border-radius:4px;margin:0;padding:8px;font-size:1rem;display:inline-block;position:relative}.PrimerCheckout__checkbox:checked{color:#fff;background-color:#3447f4;border-color:#3447f4}.PrimerCheckout__checkbox:after{content:"โ";font-size:16px;position:absolute;top:50%;left:55%;transform:translate(-50%,-50%)}#primer-checkout-vault-methods{opacity:1;transform-origin:top;transition:all .5s cubic-bezier(.4,0,.2,1);transform:translateY(0)}#primer-checkout-vault-methods.PrimerCheckout--exit{opacity:0;transform:translateY(-100px)}.PrimerCheckout__dropDownMenu{z-index:1000;opacity:0;transform-origin:top;pointer-events:none;background-color:#fff;border:1px solid #e0e0e0;border-radius:2px;flex-direction:column;width:100%;transition:all .3s cubic-bezier(.4,0,.2,1);display:flex;position:absolute;top:0;right:0;transform:translateY(-10px)scaleY(.9);box-shadow:0 1px 10px rgba(0,0,0,.1),0 0 20px rgba(52,71,244,.1)}.PrimerCheckout__dropDownMenu>.PrimerCheckout__label{padding:12px 12px 6px}.PrimerCheckout__dropDownMenu--enter{pointer-events:all;opacity:1;transform:translateY(0)scaleY(1)}.PrimerCheckout__dropDownMenuItem{padding:6px 12px;transition:background-color .1s}.PrimerCheckout__dropDownMenuItem:hover,.PrimerCheckout__dropDownMenuItem:focus{background-color:#eaf1ff}.PrimerCheckout__dropDownMenuItem>.PrimerCheckout__label{white-space:nowrap;color:#3447f4}.PrimerCheckout__paymentMethodDropDownMenuItem{margin:0 16px;transition:all .3s cubic-bezier(.4,0,.2,1)}.PrimerCheckout__paymentMethodDropDownMenuItem:not(:last-child){border-bottom:1px solid #e0e0e0}.PrimerCheckout__paymentMethodDropDownMenuItem--disabled{pointer-events:none;opacity:.3}.PrimerCheckout__paymentMethodDropDownMenuItem__content{flex-direction:row;align-items:center;padding:16px 0;display:flex}.PrimerCheckout__paymentMethodDropDownMenuItem__label.PrimerCheckout__label{word-break:break-all;min-width:0;margin-right:8px;font-size:.75rem}.PrimerCheckout__paymentMethodDropDownMenuItem__confirmationContainer{pointer-events:none;opacity:0;height:0;padding-bottom:0;transition:all .3s cubic-bezier(.4,0,.2,1),opacity .2s cubic-bezier(.4,0,.2,1);position:relative;transform:translateY(-20px)}.PrimerCheckout__paymentMethodDropDownMenuItem__confirmationContainer--enter{pointer-events:all;opacity:1;height:56px;padding-bottom:16px;transform:translateY(0)}.PrimerCheckout__deleteButton{cursor:pointer;outline-offset:2px;background:0 0;border:none;outline-color:#3447f4;width:100%;margin:0;padding:0;font-family:inherit;display:block}.PrimerCheckout__deleteButton:disabled{cursor:auto}.PrimerCheckout__deleteConfirmation{height:30px}.PrimerCheckout__confirmButton{cursor:pointer;outline-offset:2px;text-align:center;color:#3447f4;background:0 0;border:1px solid #3447f4;border-radius:4px;outline-color:#3447f4;align-items:center;justify-items:center;width:100%;height:40px;margin:0;padding:0;font-family:inherit;font-size:.875rem;display:grid}.PrimerCheckout__confirmButton:disabled{cursor:auto}.PrimerCheckout__savedPaymentMethods{flex-direction:column;display:flex}.PrimerCheckout__savedPaymentMethods__title{flex-direction:row;align-items:center;margin-bottom:15px;display:flex}.PrimerCheckout__klarnaPaymentOptions{width:100%;padding:0 64px;transition:height .2s ease-in-out;position:relative;overflow:hidden}.PrimerCheckout__klarnaPaymentCategory{cursor:pointer;outline-offset:2px;background:0 0;border:1px solid #e0e0e0;border-radius:2px;outline-color:#3447f4;grid-auto-flow:column;align-content:center;justify-content:center;align-items:center;width:100%;margin:0;padding:8px 0;font-family:inherit;display:grid}.PrimerCheckout__klarnaPaymentCategory:disabled{cursor:auto}.PrimerCheckout__klarnaPaymentCategory>img{margin-right:12px}.PrimerCheckout__klarnaPaymentCategory:first-child{margin-top:20px}.PrimerCheckout__klarnaPaymentCategory+.PrimerCheckout__klarnaPaymentCategory{margin-top:12px}.PrimerCheckout__klarnaPaymentOptionButton{cursor:pointer;outline-offset:2px;background:0 0;border:none;outline-color:#3447f4;align-items:center;width:100%;margin:0;padding:6px 12px;font-family:inherit;display:flex}.PrimerCheckout__klarnaPaymentOptionButton:disabled{cursor:auto}.PrimerCheckout__klarnaPaymentOptionButton>img{margin-right:12px}.PrimerCheckout__processingIndicatorOverlay{pointer-events:none;z-index:100;opacity:0;align-items:center;justify-items:center;transition:transform .5s cubic-bezier(.4,0,.2,1),opacity .3s linear;display:grid;position:absolute;top:0;bottom:0;left:0;right:0;transform:translateY(50px)}.PrimerCheckout__processingIndicatorOverlay.PrimerCheckout--entering,.PrimerCheckout__processingIndicatorOverlay.PrimerCheckout--entered{opacity:1;transform:translateY(0)}.PrimerCheckout__processingIndicatorContainer{padding:32px}.PrimerCheckout__check{text-align:center;justify-content:center;align-items:center;min-height:18rem;padding:0 16px}.PrimerCheckout__checkMarkIcon{width:3rem;padding-bottom:20px}#primer-checkout-scene-credit-card-form,#primer-checkout-bancontact-scene-credit-card-form{padding-bottom:32px}.PrimerCheckout__creditCardButton_icon{height:81%}.PrimerCheckout__surcharge{background:rgba(36,42,47,.03);border-radius:5px;flex-direction:column;gap:4px;margin-top:15px;padding:5px;display:flex}.PrimerCheckout__surcharge>.PrimerCheckout__label{text-align:right}.PrimerCheckout__surcharge-message{flex-direction:column;gap:4px;margin-top:15px;display:flex}.PrimerCheckout__surcharge-message>.PrimerCheckout__label{text-align:right}.PrimerCheckout{box-sizing:border-box;background-color:transparent;flex-direction:column;display:flex;position:relative}.PrimerCheckout [hidden=true]{display:none}.PrimerCheckout dialog{margin:0;padding:0}.PrimerCheckout input{outline-color:#3447f4}.PrimerCheckout div{box-sizing:border-box}.PrimerCheckout--hidden{display:none!important}.PrimerCheckout--exited{display:none}.PrimerCheckout--centered{text-align:center}.PrimerCheckout--loading #primer-checkout-payment-method-scene{pointer-events:none}.PrimerCheckout__scene{opacity:1;flex-direction:column;display:flex;position:relative;top:0;left:0}.PrimerCheckout__modalBody{background-color:#fff;border-radius:3px;align-content:center;justify-content:center;display:grid;position:relative;overflow:hidden;box-shadow:1px 1px 5px 3px rgba(0,0,0,.05)}.PrimerCheckout__modalBody>iframe{width:100%;height:100%;position:absolute;top:0;bottom:0;left:0;right:0}.PrimerCheckout__scene--3dsModal{z-index:101;opacity:0;background-color:rgba(0,0,0,.2);align-content:center;justify-content:center;width:100%;transition:all .5s cubic-bezier(.4,0,.2,1);display:grid;position:fixed;top:0;bottom:0;left:0;right:0;height:100%!important}.PrimerCheckout__scene--3dsModal>.PrimerCheckout__modalBody{opacity:0;transition:all .5s cubic-bezier(.4,0,.2,1);transform:translateY(100vh)}.PrimerCheckout__scene--3dsModal.PrimerCheckout--enter{opacity:1}.PrimerCheckout__scene--3dsModal.PrimerCheckout--enter>.PrimerCheckout__modalBody{opacity:1;transform:translateY(0)}#primer-checkout-scene-vault{padding-bottom:32px}#primer-checkout-other-payment-methods{opacity:0;visibility:hidden;width:0;height:0;transition:all .5s cubic-bezier(.4,0,.2,1)}#primer-checkout-other-payment-methods>:last-child{height:32px}#primer-checkout-other-payment-methods.PrimerCheckout--entering,#primer-checkout-other-payment-methods.PrimerCheckout--entered{opacity:1;visibility:visible;width:auto}#primer-checkout-payment-method-divider{opacity:1;transition:all .5s cubic-bezier(.4,0,.2,1)}#primer-checkout-payment-method-divider.PrimerCheckout--exit{opacity:0;height:0;margin-bottom:0}
|
|
2
|
+
/*# sourceMappingURL=Checkout.css.map*/
|
package/dist/Primer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(M,T){typeof exports=="object"&&typeof module=="object"?module.exports=T():typeof define=="function"&&define.amd?define([],T):typeof exports=="object"?exports.Primer=T():M.Primer=T()})(this,()=>(()=>{var ee={189:()=>{},367:()=>{},56:()=>{}},M={};function T(R){var u=M[R];if(u!==void 0)return u.exports;var O=M[R]={exports:{}};return ee[R](O,O.exports,T),O.exports}T.d=(R,u)=>{for(var O in u)T.o(u,O)&&!T.o(R,O)&&Object.defineProperty(R,O,{enumerable:!0,get:u[O]})},T.o=(R,u)=>Object.prototype.hasOwnProperty.call(R,u),T.r=R=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(R,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(R,"__esModule",{value:!0})};var v={};return(()=>{"use strict";T.r(v),T.d(v,{CheckoutUXFlow:()=>Ke,ErrorCode:()=>ze,EventTypes:()=>Qe,HeadlessManagerType:()=>Ze,PaymentFlow:()=>We,PaymentInstrumentType:()=>w,PaymentMethodData:()=>nr.PaymentMethodData,PaymentMethodType:()=>p,Primer:()=>ir,SuccessScreenType:()=>Xe,ThreeDSecureStatus:()=>$e,TokenType:()=>rr,isStripeOptionsDropInWithFullMandateText:()=>or});const R={LEGACY:"legacy",V_2_4:"2.4"},u=R.V_2_4;let O=u;function qe(e){e||console.warn(`[Primer SDK] No API version was explicitly set. Defaulting to '${u}'.`),O=e??u}function Je(){return O}class D extends Error{constructor(t,r=!1){super(t),this.isReported=r,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}static from(t,r=!1){if(t instanceof D)return t;const n=t instanceof Error?t.message:String(t),o=new D(n,r);return t instanceof Error&&t.stack&&(o.stack=t.stack,Object.assign(o,t)),o}markAsReported(){this.isReported=!0}}const te="https://analytics.production.data.primer.io/sdk-logs";var ar=T(189),Er=T(367),b=(e=>(e.REQUEST_START="REQUEST_START",e.REQUEST_END="REQUEST_END",e))(b||{}),H=(e=>(e.START="START",e.END="END",e))(H||{});const x={createHeadless:"HEADLESS_LOADING",showUniversalCheckout:"DROP_IN_LOADING",showVaultManager:"VAULT_MANAGER_LOADING",preloadPrimer:"PRELOAD_PRIMER_LOADING"};var I=(e=>(e.NETWORK_CALL_EVENT="NETWORK_CALL_EVENT",e.CRASH_EVENT="CRASH_EVENT",e.TIMER_EVENT="TIMER_EVENT",e.MESSAGE_EVENT="MESSAGE_EVENT",e.V1_EVENT="V1_EVENT",e.SDK_FUNCTION_EVENT="SDK_FUNCTION_EVENT",e))(I||{});const et={get(e,t){let r;try{switch(e){case"PRIMER_SDK_VERSION":r="v2.52.0";break;case"PRIMER_ASSETS_URL":r=process.env.PRIMER_ASSETS_URL;break;case"PRIMER_BUILD_INTEGRATION_BUILDER":r=process.env.PRIMER_BUILD_INTEGRATION_BUILDER;break;default:break}}catch{}return r||t}};var tt=(e=>(e.CHARGING="CHARGING",e.NOT_CHARGING="NOT_CHARGING",e))(tt||{});async function rt(){if(typeof navigator>"u"||typeof performance>"u")return;const e=await navigator.getBattery?.();return{memoryFootprint:performance.memory?.usedJSHeapSize,screen:{height:screen?.height,width:screen?.width},userAgent:navigator.userAgent,locale:navigator.language,batteryLevel:e?.level,batteryStatus:e?.charging?"CHARGING":"NOT_CHARGING"}}const nt="WEB",ot=et.get("PRIMER_SDK_VERSION");async function re(e,t,r){return{...r,createdAt:Date.now(),device:await rt(),eventType:e,properties:t,sdkVersion:ot,sdkType:nt}}const ne=Symbol.for("__primerAnalytics__");let m={providers:new Map,timers:new Map,eventsQueue:new Map};if(typeof window<"u"){const e=window[ne];e?m=e:window[ne]=m}const oe=()=>m.providers,F=()=>m.timers,C=()=>m.eventsQueue,ie=500,y=new Map,Ae=64e3,it=5;function G(e,t=!1,r=1){if(y.has(e)){const i=y.get(e);clearTimeout(i),y.delete(e)}const n=()=>{const i=C().get(e);if(i?.length){let A=!0,s=[],_=0,a=0;for(;a<i.length;){const E=i[a],f=JSON.stringify(E),N=new Blob([f]).size;if(N>Ae){console.error("Event size exceeds maximum payload size and will be skipped:",E),a++;continue}if(_+N>Ae&&s.length>0){try{A=navigator.sendBeacon(e,JSON.stringify(s))}catch(P){A=!1,console.error("Unable to send events",P)}if(!A)break;s=[],_=0}s.push(E),_+=N,a++}if(s.length>0&&A)try{A=navigator.sendBeacon(e,JSON.stringify(s))}catch(E){A=!1,console.error("Unable to send events",E)}if(A)C().delete(e);else if(r<it){const E=ie*Math.pow(2,r);setTimeout(()=>G(e,t,r+1),E)}else console.error("Max retry attempts reached. Events will not be sent.")}};if(t){n();return}const o=setTimeout(n,ie);y.set(e,o)}function At(e,t){C().has(e)||C().set(e,[]),C().get(e)?.push(t),G(e)}const se=1024*5;function ae(e,t,r=new WeakSet,n=0,o=10){if(n>o||r.has(e))return e;r.add(e);const i=A=>typeof A=="object"&&A!==null?ae(A,t,r,n+1,o):t(A);return Array.isArray(e)?e.map(i):Object.fromEntries(Object.entries(e).map(([A,s])=>[A,i(s)]))}function st(e){return typeof e=="string"&&e.length>se?`${e.slice(0,se)}...`:e}function at(e){return typeof e=="function"?e.name||"function":e}let Ee=!1;function V({url:e=te,...t}){typeof document<"u"&&!Ee&&(document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){const o=l(t.checkoutSessionId);o.messageEvent({messageType:"VISIBILITY_CHANGE",message:"Checkout visibility is hidden (tab or window change, redirect or being closed)."}),G(o.url,!0)}}),Ee=!0);const r=o=>async i=>{if(typeof navigator>"u")return;const A=await re(o,i,t),_=ae(A,a=>st(at(a)));At(e,_)},n={crashEvent:r(I.CRASH_EVENT),messageEvent:r(I.MESSAGE_EVENT),networkCallEvent:r(I.NETWORK_CALL_EVENT),sdkFunctionEvent:r(I.SDK_FUNCTION_EVENT),timerStart:({id:o,...i})=>{const A=`${t.checkoutSessionId}|${o}`,s=performance?.now?performance.now():Date.now();return F().set(A,{start:s}),r(I.TIMER_EVENT)({...i,id:o,timerType:H.START})},timerEnd:({id:o,...i})=>{const A=`${t.checkoutSessionId}|${o}`,{start:s=void 0}=F().get(A)??{};F().delete(A);const _=performance?.now?performance.now():Date.now(),a=s?_-s:void 0;return r(I.TIMER_EVENT)({...i,id:o,timerType:H.END,duration:a})},v1Event:r(I.V1_EVENT),url:e};return oe().set(t.checkoutSessionId,n),l(t.checkoutSessionId)}function l(e){return new Proxy({},{get(t,r){return(oe().get(e)??V({checkoutSessionId:e}))[r]}})}const K=(e,t,r,n)=>({callType:r?b.REQUEST_END:b.REQUEST_START,id:e,errorBody:r?.error&&JSON.stringify(r.error,Object.getOwnPropertyNames(r.error)),method:t.method,responseCode:r?.status,url:t.url,duration:n});function Et(e){return e?new Promise(t=>{setTimeout(t,e)}):Promise.resolve()}const _t=8,ct=100,Tt=100;function Nt(e){return{enabled:e?.enabled??!1,maxRetries:_t,initialBackoff:ct,retryNetworkErrors:!0,retry500Errors:!1,maxJitter:Tt}}function Rt(e,t,r){const n=e*Math.pow(2,t-1),o=Math.random()*r;return Math.min(n+o,Number.MAX_SAFE_INTEGER)}async function _e(e,t,r,n=Et){let o=0;const i=Nt(t);if(!i.enabled)return e();for(;;)try{const A=await e();if(o){let s=`Request succeeded after ${o} retries.`;typeof A=="object"&&A&&"status"in A&&(s+=` Status code: ${A.status}`),r?.({messageType:"RETRY_SUCCESS",message:s,severity:"INFO"})}return A}catch(A){const s=A,_=o>=i.maxRetries,a=s.isNetworkError&&!i.retryNetworkErrors,E=s.status&&s.status>=500&&!i.retry500Errors;if(_||a||E){let P=`Failed after ${o} retries. `;throw _?P+=`Reached maximum retries (${i.maxRetries}).`:a?P+="Network error encountered and retryNetworkErrors is disabled.":E&&(P+="HTTP 500 error encountered and retry500Errors is disabled."),P+=` Last error: ${s.message}`,r?.({messageType:"RETRY_FAILED",message:P,severity:"ERROR",errorBody:JSON.stringify(A,Object.getOwnPropertyNames(A))}),new Error(P,{cause:A})}o++;const f=Rt(i.initialBackoff,o,i.maxJitter);let N="Unknown error";s.isNetworkError?N="Network error":s.status&&(N=`HTTP ${s.status} error`),r?.({messageType:"RETRY",message:`Retry attempt ${o}/${i.maxRetries} due to: ${N}. Error details: ${s.message}. Waiting for ${f.toFixed(2)}ms before next attempt.`,severity:"WARN",errorBody:JSON.stringify(A,Object.getOwnPropertyNames(A))}),await n(f)}}let W={cache:new Map};typeof window<"u"&&(window.__primerCache__??(window.__primerCache__=W),W=window.__primerCache__);const d=()=>W.cache,ce=1e3*60*60,dt=30,Te=50;function Ne(){if(d().size<=dt)return;const e=Date.now();for(const[t,r]of d())r.exp<e&&d().delete(t);if(d().size>Te)for(const[t]of d()){if(d().size<=Te)break;d().delete(t)}}function Pt({key:e,ttl:t=ce},r){t?d().set(e,{promise:Promise.resolve({...r,source:"CACHE"}),exp:Date.now()+t}):d().delete(e)}function ut(e){if(!e)return i=>i();const{key:t,refresh:r=!1,usePrimerSessionCacheTtlHeader:n=!1,ttl:o=ce}=e;return async i=>{const A=Date.now(),s=d().get(t);if(!r&&s&&s.exp>A)return s.promise;s&&d().delete(t);const _=i().then(a=>{let E=o;return n&&(E=(Number(a.headers.get("x-primer-session-cache-ttl"))||0)*1e3),Pt({key:t,ttl:E},a),Ne(),a},a=>{throw d().delete(t),a});return d().set(t,{promise:_,exp:A+o}),Ne(),_}}const $=()=>Re.randomUUID?.()||Ot(),Ot=()=>("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,e=>(e^Dt()>>e/4).toString(16)),Dt=()=>(Re.getRandomValues?.(new Uint8Array(1))[0]??Math.random()*16)&15,Re=typeof crypto<"u"?crypto:{},de=15e3,It=(e,t,r)=>Pe(e,"get",t,r),ft=(e,t,r,n)=>Pe(e,"post",t,n,JSON.stringify(r)),Pe=async(e,t,r,n,o)=>{const i=$(),A=performance?.now();let s=l(e);const _={method:t,url:r,body:o};s.networkCallEvent(K(i,_));try{const a=await fetch(r,{body:o,method:t,headers:{"content-type":"application/json","x-request-id":i,...n}});if(!a.ok){const P=new Error(`HTTP error! status: ${a.status}`);throw P.status=a.status,P}const E=await a.json();if(r.includes("client-sdk/configuration")){const{primerAccountId:P,clientSession:{clientSessionId:Ar,customer:sr}}=E;s=V({checkoutSessionId:e,clientSessionId:Ar,customerId:sr?.customerId,primerAccountId:P,url:s.url})}const N=performance?.now()-A;return s.networkCallEvent(K(i,_,{data:E},N)),{data:E,headers:a.headers,status:a.status,source:"NETWORK"}}catch(a){const f=performance?.now()-A;throw Object.assign(a,{isNetworkError:a instanceof TypeError}),s.networkCallEvent(K(i,_,{error:a},f)),a}},ue=(e,t)=>new Promise((r,n)=>{const o=setTimeout(()=>{const i=new Error("Request timed out");i.isNetworkError=!0,n(i)},t);e.then(r).catch(n).finally(()=>clearTimeout(o))}),lt=(e,t)=>{const{headers:r,retryConfig:n,cacheConfig:o,timeout:i=de,checkoutSessionId:A}=t,s=l(A);return ut(o)(()=>_e(()=>ue(It(A,e,r),i),n,_=>s.messageEvent({..._,url:e})))},_r=(e,t,r)=>{const{headers:n,retryConfig:o,cacheConfig:i,timeout:A=de,checkoutSessionId:s}=r,_=getAnalytics(s);return cacheRequest(i)(()=>retryWithExponentialBackoff(()=>ue(ft(s,e,t,n),A),o,a=>_.messageEvent({...a,url:e})))},Oe="3.7.7",Lt=Oe,L=typeof Buffer=="function",De=typeof TextDecoder=="function"?new TextDecoder:void 0,Ie=typeof TextEncoder=="function"?new TextEncoder:void 0,Y=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),U=(e=>{let t={};return e.forEach((r,n)=>t[r]=n),t})(Y),St=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,c=String.fromCharCode.bind(String),fe=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),le=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),Le=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),Se=e=>{let t,r,n,o,i="";const A=e.length%3;for(let s=0;s<e.length;){if((r=e.charCodeAt(s++))>255||(n=e.charCodeAt(s++))>255||(o=e.charCodeAt(s++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|o,i+=Y[t>>18&63]+Y[t>>12&63]+Y[t>>6&63]+Y[t&63]}return A?i.slice(0,A-3)+"===".substring(A):i},j=typeof btoa=="function"?e=>btoa(e):L?e=>Buffer.from(e,"binary").toString("base64"):Se,z=L?e=>Buffer.from(e).toString("base64"):e=>{let r=[];for(let n=0,o=e.length;n<o;n+=4096)r.push(c.apply(null,e.subarray(n,n+4096)));return j(r.join(""))},g=(e,t=!1)=>t?le(z(e)):z(e),mt=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?c(192|t>>>6)+c(128|t&63):c(224|t>>>12&15)+c(128|t>>>6&63)+c(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return c(240|t>>>18&7)+c(128|t>>>12&63)+c(128|t>>>6&63)+c(128|t&63)}},Ct=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,me=e=>e.replace(Ct,mt),Ce=L?e=>Buffer.from(e,"utf8").toString("base64"):Ie?e=>z(Ie.encode(e)):e=>j(me(e)),S=(e,t=!1)=>t?le(Ce(e)):Ce(e),Ye=e=>S(e,!0),Yt=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,ht=e=>{switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),r=t-65536;return c((r>>>10)+55296)+c((r&1023)+56320);case 3:return c((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return c((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},he=e=>e.replace(Yt,ht),pe=e=>{if(e=e.replace(/\s+/g,""),!St.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,r="",n,o;for(let i=0;i<e.length;)t=U[e.charAt(i++)]<<18|U[e.charAt(i++)]<<12|(n=U[e.charAt(i++)])<<6|(o=U[e.charAt(i++)]),r+=n===64?c(t>>16&255):o===64?c(t>>16&255,t>>8&255):c(t>>16&255,t>>8&255,t&255);return r},X=typeof atob=="function"?e=>atob(Le(e)):L?e=>Buffer.from(e,"base64").toString("binary"):pe,Me=L?e=>fe(Buffer.from(e,"base64")):e=>fe(X(e).split("").map(t=>t.charCodeAt(0))),ye=e=>Me(Ue(e)),pt=L?e=>Buffer.from(e,"base64").toString("utf8"):De?e=>De.decode(Me(e)):e=>he(X(e)),Ue=e=>Le(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),Q=e=>pt(Ue(e)),Mt=e=>{if(typeof e!="string")return!1;const t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},ge=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),ke=function(){const e=(t,r)=>Object.defineProperty(String.prototype,t,ge(r));e("fromBase64",function(){return Q(this)}),e("toBase64",function(t){return S(this,t)}),e("toBase64URI",function(){return S(this,!0)}),e("toBase64URL",function(){return S(this,!0)}),e("toUint8Array",function(){return ye(this)})},we=function(){const e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,ge(r));e("toBase64",function(t){return g(this,t)}),e("toBase64URI",function(){return g(this,!0)}),e("toBase64URL",function(){return g(this,!0)})},Be={version:Oe,VERSION:Lt,atob:X,atobPolyfill:pe,btoa:j,btoaPolyfill:Se,fromBase64:Q,toBase64:S,encode:S,encodeURI:Ye,encodeURL:Ye,utob:me,btou:he,decode:Q,isValid:Mt,fromUint8Array:g,toUint8Array:ye,extendString:ke,extendUint8Array:we,extendBuiltins:()=>{ke(),we()}},yt={encode:Ut,decode:Be.decode};function Ut(e,t={}){const{urlSafe:r=!1}=t;return Be.encode(e,r)}function gt(e){const t=Bt(e),r=t.exp*1e3;if(Date.now()>r)throw new Error(`${kt}. Expiration date: ${new Date(r).toISOString()}`);return t}const ve="The provided `clientToken`",kt=`${ve} has expired`,wt=`${ve} is malformed`;function Bt(e){try{const[t,r]=e.split("."),n=r||t;return JSON.parse(yt.decode(n))}catch{throw new Error(wt)}}const vt="v2.52.0",bt=(e,t,r)=>({"primer-client-token":e,"primer-sdk-client":"WEB","primer-sdk-version":vt,"primer-sdk-checkout-session-id":t,...r&&{"x-api-version":r}});async function Ht(e,t,r){const{accessToken:n,configurationUrl:o,analyticsUrlV2:i}=gt(e),A=V({checkoutSessionId:t,url:i}),s=Je(),_=s!==R.LEGACY?s:"2.3";A.timerStart({id:"CONFIGURATION_LOADING"});try{const{data:a,source:E}=await lt(`${o}/?withDisplayMetadata=true`,{checkoutSessionId:t,headers:bt(n,t,_),retryConfig:{enabled:!0},cacheConfig:r});return A.timerEnd({id:"CONFIGURATION_LOADING",context:{source:E}}),a}catch(a){const E=a instanceof Error?a.message:"Unknown error occurred";throw new Error(`Failed to initialize client: ${E}`)}}function be(e){return e instanceof Error?{errorBody:e.message,stacktrace:e.stack}:typeof e=="object"&&e!==null&&"message"in e?{errorBody:String(e.message),stacktrace:"stack"in e?String(e.stack):void 0}:{errorBody:String(e||"Unknown error")}}function k({checkoutSessionId:e,analytics:t,error:r,reporter:n}){t?.crashEvent?t.crashEvent({...be(r),reporter:n}):e&&Z(e,r,n)}async function Z(e,t,r){const n=te,o=await re(I.CRASH_EVENT,{...be(t),reporter:r},{checkoutSessionId:e});try{await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)})}catch(i){console.error("Failed to post crash event",i)}}const He=Symbol.for("initGlobalErrorMonitoringLoaded"),xe=(e,t)=>{typeof window<"u"&&window[He]||(window[He]=!0,window.addEventListener("error",r=>{xt(r)||Ft(r)&&k({checkoutSessionId:e,analytics:t,error:r.error,reporter:"window.onerror"})}),window.addEventListener("unhandledrejection",r=>{const n=r.reason||new Error("Unhandled promise rejection");Gt(n)&&k({checkoutSessionId:e,analytics:t,error:n,reporter:"unhandledrejection"})}))},xt=e=>e.message==="Script error."||!e.filename||e.lineno===0,Ft=e=>{const t=e.filename;return!!(t&&q(t)&&new D(e.error).isReported)},Gt=e=>{if(e&&typeof e=="object"&&"stack"in e&&typeof e.stack=="string"){const t=D.from(e);if(t.isReported)return!1;if("fileName"in e&&typeof e.fileName=="string"){const n=e.fileName;if(q(n))return!0}return Vt(t.stack).some(q)}return!1},q=e=>{try{return new URL(e,window.location.origin).hostname.endsWith(".primer.io")}catch{return!1}},Vt=e=>{if(!e)return[];const t=e.split(`
|
|
2
|
-
`),r=[],n=/^\s*at\s+(?:.*?\s+)?\(?(.+?):\d+:\d+\)?$/;for(const o of t){const i=o.match(n);if(i&&i[1])r.push(i[1]);else{const A=/@(.*?):\d+:\d+$/,s=o.match(A);s&&s[1]&&r.push(s[1])}}return r};function Kt(e,t){const r=document.createElement(e);return Object.entries(t).forEach(([n,o])=>r.setAttribute(n,o)),r}function Fe(e,t,r){return document.querySelector(`${e}[${t}^="${r}"]`)}async function Ge(e,t,r,n,o,i){const{analytics:A,name:s=t,retryConfig:_}=i;await _e(()=>new Promise((E,f)=>{const N=Fe(e,r,t)||Kt(e,{...n,[r]:t});N.onload=()=>{A?.sdkFunctionEvent({name:s,params:[`${e.charAt(0).toUpperCase()+e.slice(1)} loaded successfully: ${t}`]}),E()},N.onerror=()=>{N.remove(),f(new Error(`${o}: ${t}`))},N.parentNode||document.head.appendChild(N)}),_,E=>A?.messageEvent({...E,url:t}))}function Wt(e,t={}){return Fe("script","src",e)&&window.__Primer?(t.analytics?.sdkFunctionEvent({name:t.name??e,params:["Script already loaded"]}),Promise.resolve()):Ge("script",e,"src",{...t.attributes,async:"",crossorigin:"anonymous"},"Can't load Primer SDK",t)}function $t(e,t={}){return Array.from(document.styleSheets).some(r=>r.href===e)?(t.analytics?.sdkFunctionEvent({name:t.name??e,params:["Stylesheet already loaded"]}),Promise.resolve()):Ge("link",e,"href",{...t.attributes,rel:"stylesheet"},"Can't load Primer SDK's Stylesheet",t)}let h;async function Ve(e){return h||(h=Promise.all([Wt("https://sdk.primer.io/web/v2.52.0/PrimerCoreSDK.min.js",{analytics:e,name:"loadPrimerScript"}),$t("https://sdk.primer.io/web/v2.52.0/Checkout.css",{analytics:e,name:"loadPrimerCss"})]).then(()=>{const n=window.__Primer;return delete window.__Primer,n}).catch(n=>{throw h=void 0,n}),h)}const jt=async()=>{const e=$();try{const t=l(e);try{xe(e,t),t.sdkFunctionEvent({name:"preloadPrimer"}),t.timerStart({id:x.preloadPrimer}),await Ve(t),t.timerEnd({id:x.preloadPrimer})}catch(r){const n=D.from(r);throw n.isReported||(k({checkoutSessionId:e,analytics:t,error:n,reporter:"preloadPrimer level 1"}),n.markAsReported()),n}}catch(t){const r=D.from(t);throw r.isReported||(Z(e,r,"preloadPrimer level 0"),r.markAsReported()),r}},zt="v2.52.0",Xt=J("createHeadless"),Qt=J("showUniversalCheckout"),Zt=J("showVaultManager");function J(e){return async(...[t,r,...n])=>{qe(r?.apiVersion);const o=$();try{const i=l(o);try{xe(o,i),i.sdkFunctionEvent({name:e,params:[t,r,...n]}),i.timerStart({id:x[e]});const[A,s]=await Promise.all([Ht(t,o,r?.clientSessionCachingEnabled?{key:t,usePrimerSessionCacheTtlHeader:!0}:void 0),Ve(i)]);return s[e](A,o,t,r,...n)}catch(A){const s=D.from(A);throw s.isReported||(k({checkoutSessionId:o,analytics:i,error:s,reporter:"lazyLoad level 1"}),s.markAsReported()),s}}catch(i){const A=D.from(i);throw A.isReported||(Z(o,A,"lazyLoad level 0"),A.markAsReported()),A}}}var qt=(e=>(e.LOADING="Loading",e.NO_PAYMENT_METHOD="NoPaymentMethod",e.THREE_DS="UniversalCheckout/3ds",e.CHOOSE_PAYMENT_METHOD="UniversalCheckout/Home",e.MANAGE_PAYMENT_METHODS="VaultManager/Home",e.DIRECT_DEBIT_FORM="DirectDebit/Form",e.DIRECT_DEBIT_MANDATE="DirectDebit/Mandate",e.CREDIT_CARD_FORM="CreditCard/Form",e.SUCCESS_PAYMENT_METHOD="UniversalCheckout/Success/PaymentMethod",e.SUCCESS_CHECK="UniversalCheckout/Success/Check",e))(qt||{}),Jt=(e=>(e.ROOT="primer-checkout",e.ROOT_CONTENT="primer-checkout-content",e.SUBMIT_BUTTON="primer-checkout-submit-button",e.THREE_DS_MODAL="primer-checkout-3ds-modal",e.VAULT="primer-checkout-vault",e.VAULT_INLINE="primer-checkout-vault-inline",e.NAVIGATE_PAYMENT_METHODS="primer-checkout-navigate-to-payment-methods",e.DIVIDER="primer-checkout-payment-method-divider",e.APM_BUTTONS="primer-checkout-apm-button-container",e.CARDHOLDER_NAME="primer-checkout-cardholder-name",e.CARDHOLDER_NAME_INPUT="primer-checkout-card-cardholder-name-input",e.ACTIONS="primer-checkout-actions",e.ACTIONS_MENU="primer-checkout-actions-menu",e.SAVE_PAYMENT_METHOD_CHECKBOX="primer-checkout-save-payment-method-input",e.SAVE_PAYMENT_METHOD_FIELD="primer-checkout-save-payment-method-field",e.SAVED_PAYMENT_METHODS_EMPTY="primer-checkout-saved-payment-methods-empty-text",e.CARD_FORM="primer-checkout-card-form",e.DD_SWITCH="primer-checkout-switch-dd-inputs",e.DD_IBAN_FIELD="primer-checkout-dd-iban-field",e.DD_LOCAL_FIELD="primer-checkout-dd-local-fields",e.DD_CUSTOMER_NAME_INPUT="primer-checkout-dd-customer-name-input",e.DD_CUSTOMER_EMAIL_INPUT="primer-checkout-dd-customer-email-input",e.DD_CUSTOMER_ADDRESS_LINE1="primer-checkout-dd-customer-address-input",e.DD_CUSTOMER_ADDRESS_LINE2="primer-checkout-dd-customer-address-line2-input",e.DD_CUSTOMER_ADDRESS_CITY="primer-checkout-dd-customer-city-input",e.DD_CUSTOMER_ADDRESS_POSTAL_CODE="primer-checkout-dd-customer-postal-code-input",e.DD_IBAN_INPUT="primer-checkout-dd-iban-input",e.DD_ACCOUNT_NUMBER_INPUT="primer-checkout-dd-account-number-input",e.DD_BANK_CODE_INPUT="primer-checkout-dd-bank-code-input",e.DD_BRANCH_CODE_INPUT="primer-checkout-dd-branch-code-input",e.DD_MANDATE_SMALL_PRINT="primer-checkout-small-print",e.ERROR_MESSAGE="primer-checkout-error-message",e))(Jt||{}),er=(e=>(e.TOKEN="PrimerCheckout__token",e.HIDDEN="PrimerCheckout--hidden",e.FOCUSED="PrimerCheckout--focused",e.SELECTED="PrimerCheckout--selected",e.LOADING="PrimerCheckout--loading",e.ERROR="PrimerCheckout--error",e.CARD_TYPE="PrimerCheckout__cardType",e.SAVED_PAYMENT_METHOD="PrimerCheckout__savedPaymentMethod",e.SAVED_PAYMENT_METHOD_CONTAINER="PrimerCheckout__savedPaymentMethodContainer",e.APM_BUTTON="PrimerCheckout__apmButton",e.EDIT_BUTTON="PrimerCheckout__editButton",e.MENU="PrimerCheckout__dropDownMenu",e.MENU_ITEM="PrimerCheckout__dropDownMenuItem",e.PAYMENT_METHOD_MENU_ITEM="PrimerCheckout__paymentMethodDropDownMenuItem",e.DELETE_PAYMENT_METHOD_BUTTON="PrimerCheckout__paymentMethodDropDownMenuItem__deleteButton",e.ENTER="PrimerCheckout--enter",e.ENTERING="PrimerCheckout--entering",e.ENTERED="PrimerCheckout--entered",e.EXIT="PrimerCheckout--exit",e.EXITING="PrimerCheckout--exiting",e.EXITED="PrimerCheckout--exited",e))(er||{}),Ke=(e=>(e.CHECKOUT="CHECKOUT",e.HEADLESS_CHECKOUT="HEADLESS_CHECKOUT",e.MANAGE_PAYMENT_METHODS="MANAGE_PAYMENT_METHODS",e))(Ke||{}),We=(e=>(e.DEFAULT="DEFAULT",e.PREFER_VAULT="PREFER_VAULT",e))(We||{}),tr=(e=>(e.TOKENIZE_STARTED="tokenize-started",e.TOKENIZE_ERROR="tokenize-error",e.TOKENIZE_SUCCESS="tokenize-success",e.TOKENIZE_DID_NOT_START="tokenize-did-not-start",e))(tr||{}),$e=(e=>(e.SUCCESS="AUTH_SUCCESS",e.FAILED="AUTH_FAILED",e.SKIPPED="SKIPPED",e.CHALLENGE="CHALLENGE",e))($e||{});const w={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",AUTOMATED_CLEARING_HOUSE:"AUTOMATED_CLEARING_HOUSE",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_ACH:"STRIPE_ACH",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL_ORDER",PAYPAL_VAULTED:"PAYPAL_BILLING_AGREEMENT",GO_CARDLESS:"GOCARDLESS",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME",KLARNA_CUSTOMER_TOKEN:"KLARNA_CUSTOMER_TOKEN"},p={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",STRIPE_ACH:"STRIPE_ACH",STRIPE_IDEAL:"STRIPE_IDEAL",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",PAYMENT_CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL",GO_CARDLESS:"GOCARDLESS",KLARNA:"KLARNA",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_BANK_TRANSFER:"ADYEN_BANK_TRANSFER",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME"},Nr={PAYMENT_CARD:"PAYMENT_CARD",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD"},rr={SINGLE_USE:"SINGLE_USE",MULTI_USE:"MULTI_USE"},je={[w.PAYPAL_VAULTED]:p.PAYPAL,[w.KLARNA_CUSTOMER_TOKEN]:p.KLARNA,[w.AUTOMATED_CLEARING_HOUSE]:p.STRIPE_ACH},Rr=e=>{if(Object.values(p).includes(e))return e;if(je[e])return je[e]};var ze=(e=>(e.INITIALIZATION_ERROR="INITIALIZATION_ERROR",e.NO_PAYMENT_METHODS="NO_PAYMENT_METHODS",e.PRIMER_TEARDOWN="PRIMER_TEARDOWN",e.PRIMER_SERVER_ERROR="PRIMER_SERVER_ERROR",e.THREE_DS_AUTH_FAILED="THREE_DS_AUTH_FAILED",e.TOKENIZATION_ERROR="TOKENIZATION_ERROR",e.DUPLICATE_PAYMENT_METHOD_ERROR="DUPLICATE_PAYMENT_METHOD_ERROR",e.CARD_NUMBER_ERROR="CARD_NUMBER_ERROR",e.PAYMENT_METHOD_NOT_SETUP="PAYMENT_METHOD_NOT_SETUP",e.PAYMENT_METHOD_NOT_PROVIDED="PAYMENT_METHOD_NOT_PROVIDED",e.PAYMENT_METHOD_NOT_COMPATIBLE="PAYMENT_METHOD_NOT_COMPATIBLE",e.RESUME_ERROR="RESUME_ERROR",e.VALIDATION_ERROR="VALIDATION_ERROR",e.PAYMENT_FAILED="PAYMENT_FAILED",e.PAYMENT_CREATION_ABORTED="PAYMENT_CREATION_ABORTED",e.PAYMENT_CREATION_DISABLED="PAYMENT_CREATION_DISABLED",e.CLIENT_SESSION_UPDATE_ERROR="CLIENT_SESSION_UPDATE_ERROR",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.VAULT_FETCH="VAULT_FETCH",e.VAULT_DELETE="VAULT_DELETE",e.HEADLESS_VAULT_MANAGER_VALIDATION="HEADLESS_VAULT_MANAGER_VALIDATION",e.CARD_FORM_VALIDATION_UNEXPECTED_FIELD="CARD_FORM_VALIDATION_UNEXPECTED_FIELD",e.MISSING_FIRST_NAME_OR_LAST_NAME="MISSING_FIRST_NAME_OR_LAST_NAME",e.MISSING_EMAIL_ADDRESS="MISSING_EMAIL_ADDRESS",e.INVALID_FLOW="INVALID_FLOW",e))(ze||{});class B extends D{static fromErrorCode(t,r){return new B(t,r)}constructor(t,r){super(r.message),this.code=t,this.diagnosticsId=r.diagnosticsId??null,this.data=r.data,this.isFromDeveloper=r.isFromDeveloper??!1,this.name="PrimerClientError",Error.captureStackTrace&&Error.captureStackTrace(this,B)}}function dr(e,t,r){const n=new B(e,t);return r&&(r.messageEvent({message:`${e}: ${t.message}`,messageType:e,severity:"ERROR",diagnosticsId:t.diagnosticsId??void 0,errorId:t.errorId??void 0,data:t.data??void 0,isFromDeveloper:t.isFromDeveloper?.toString(),stack:n.stack}),n.markAsReported()),n}var nr=T(56),Xe=(e=>(e.PAYMENT_METHOD="PAYMENT_METHOD",e.CHECK="CHECK",e))(Xe||{});const or=e=>{const t=e?.mandateData;return t?"fullMandateText"in t:!1};var Qe=(e=>(e.CHANGE="change",e.ERROR="error",e.FOCUS="focus",e.BLUR="blur",e.CLICK="click",e.CLOSE="close",e))(Qe||{}),Ze=(e=>(e.CARD="CARD",e.NATIVE="NATIVE",e.REDIRECT="REDIRECT",e.KLARNA="KLARNA",e.ACH="ACH",e))(Ze||{});const ir={SDK_VERSION:zt,createHeadless:Xt,showUniversalCheckout:Qt,showVaultManager:Zt,preloadPrimer:jt}})(),v})());
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.Primer=r():e.Primer=r()}(this,()=>(()=>{"use strict";let e;var r,t,A={};A.d=(e,r)=>{for(var t in r)A.o(r,t)&&!A.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},A.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),A.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var E={};A.r(E),A.d(E,{SuccessScreenType:()=>eX,PaymentFlow:()=>eK,ThreeDSecureStatus:()=>ek,TokenType:()=>eW,isStripeOptionsDropInWithFullMandateText:()=>ez,PaymentInstrumentType:()=>eV,ErrorCode:()=>e$,EventTypes:()=>eJ,CheckoutUXFlow:()=>eb,HeadlessManagerType:()=>eZ,PaymentMethodType:()=>ex,Primer:()=>eq});let n={LEGACY:"legacy",V_2_4:"2.4"},o=n.V_2_4,_=o;class a extends Error{static from(e,r=!1){if(e instanceof a)return e;let t=new a(e instanceof Error?e.message:String(e),r);return e instanceof Error&&e.stack&&(t.stack=e.stack,Object.assign(t,e)),t}markAsReported(){this.isReported=!0}constructor(e,r=!1){super(e),function(e,r,t){r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t}(this,"isReported",void 0),this.isReported=r,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}let i="https://analytics.production.data.primer.io/sdk-logs";var s=function(e){return e.REQUEST_START="REQUEST_START",e.REQUEST_END="REQUEST_END",e}({}),N=function(e){return e.START="START",e.END="END",e}({});let R={createHeadless:"HEADLESS_LOADING",showUniversalCheckout:"DROP_IN_LOADING",showVaultManager:"VAULT_MANAGER_LOADING",preloadPrimer:"PRELOAD_PRIMER_LOADING"};var T=function(e){return e.NETWORK_CALL_EVENT="NETWORK_CALL_EVENT",e.CRASH_EVENT="CRASH_EVENT",e.TIMER_EVENT="TIMER_EVENT",e.MESSAGE_EVENT="MESSAGE_EVENT",e.V1_EVENT="V1_EVENT",e.SDK_FUNCTION_EVENT="SDK_FUNCTION_EVENT",e}({});async function O(){if("undefined"==typeof navigator||"undefined"==typeof performance)return;let e=await navigator.getBattery?.();return{memoryFootprint:performance.memory?.usedJSHeapSize,screen:{height:screen?.height,width:screen?.width},userAgent:navigator.userAgent,locale:navigator.language,batteryLevel:e?.level,batteryStatus:e?.charging?"CHARGING":"NOT_CHARGING"}}let P=({get(e,r){let t;try{switch(e){case"PRIMER_SDK_VERSION":t="v2.53.0";break;case"PRIMER_ASSETS_URL":t=process.env.PRIMER_ASSETS_URL;break;case"PRIMER_BUILD_INTEGRATION_BUILDER":t=process.env.PRIMER_BUILD_INTEGRATION_BUILDER}}catch{}return t||r}}).get("PRIMER_SDK_VERSION");async function c(e,r,t){return{...t,createdAt:Date.now(),device:await O(),eventType:e,properties:r,sdkVersion:P,sdkType:"WEB"}}let l=Symbol.for("__primerAnalytics__"),I={providers:new Map,timers:new Map,eventsQueue:new Map};if("undefined"!=typeof window){let e=window[l];e?I=e:window[l]=I}let d=()=>I.providers,L=()=>I.timers,D=()=>I.eventsQueue,Y=new Map;function S(e,r=!1,t=1){Y.has(e)&&(clearTimeout(Y.get(e)),Y.delete(e));let A=()=>{let A=D().get(e);if(A?.length){let E=!0,n=[],o=0,_=0;for(;_<A.length;){let r=A[_],t=new Blob([JSON.stringify(r)]).size;if(t>64e3){console.error("Event size exceeds maximum payload size and will be skipped:",r),_++;continue}if(o+t>64e3&&n.length>0){try{E=navigator.sendBeacon(e,JSON.stringify(n))}catch(e){E=!1,console.error("Unable to send events",e)}if(!E)break;n=[],o=0}n.push(r),o+=t,_++}if(n.length>0&&E)try{E=navigator.sendBeacon(e,JSON.stringify(n))}catch(e){E=!1,console.error("Unable to send events",e)}E?D().delete(e):t<5?setTimeout(()=>S(e,r,t+1),500*Math.pow(2,t)):console.error("Max retry attempts reached. Events will not be sent.")}};if(r)return void A();let E=setTimeout(A,500);Y.set(e,E)}let u=!1;function C({url:e=i,...r}){"undefined"==typeof document||u||(document.addEventListener("visibilitychange",()=>{if("hidden"===document.visibilityState){let e=f(r.checkoutSessionId);e.messageEvent({messageType:"VISIBILITY_CHANGE",message:"Checkout visibility is hidden (tab or window change, redirect or being closed)."}),S(e.url,!0)}}),u=!0);let t=t=>async A=>{if("undefined"==typeof navigator)return;let E=function e(r,t,A=new WeakSet,E=0,n=10){if(E>n||A.has(r))return r;A.add(r);let o=r=>"object"==typeof r&&null!==r?e(r,t,A,E+1,n):t(r);return Array.isArray(r)?r.map(o):Object.fromEntries(Object.entries(r).map(([e,r])=>[e,o(r)]))}(await c(t,A,r),e=>{var r;return"string"==typeof(r="function"==typeof e?e.name||"function":e)&&r.length>5120?`${r.slice(0,5120)}...`:r});D().has(e)||D().set(e,[]);let n=D().get(e);n?.push(E),S(e)},A={crashEvent:t(T.CRASH_EVENT),messageEvent:t(T.MESSAGE_EVENT),networkCallEvent:t(T.NETWORK_CALL_EVENT),sdkFunctionEvent:t(T.SDK_FUNCTION_EVENT),timerStart:({id:e,...A})=>{let E=`${r.checkoutSessionId}|${e}`,n=performance?.now?performance.now():Date.now();return L().set(E,{start:n}),t(T.TIMER_EVENT)({...A,id:e,timerType:N.START})},timerEnd:({id:e,...A})=>{let E=`${r.checkoutSessionId}|${e}`,{start:n}=L().get(E)??{};L().delete(E);let o=performance?.now?performance.now():Date.now();return t(T.TIMER_EVENT)({...A,id:e,timerType:N.END,duration:n?o-n:void 0})},v1Event:t(T.V1_EVENT),url:e};return d().set(r.checkoutSessionId,A),f(r.checkoutSessionId)}function f(e){return new Proxy({},{get:(r,t)=>(d().get(e)??C({checkoutSessionId:e}))[t]})}let m=(e,r,t,A)=>({callType:t?s.REQUEST_END:s.REQUEST_START,id:e,errorBody:t?.error&&JSON.stringify(t.error,Object.getOwnPropertyNames(t.error)),method:r.method,responseCode:t?.status,url:r.url,duration:A});function p(e){return e?new Promise(r=>{setTimeout(r,e)}):Promise.resolve()}async function M(e,r,t,A=p){let E=0,n={enabled:r?.enabled??!1,maxRetries:8,initialBackoff:100,retryNetworkErrors:!0,retry500Errors:!1,maxJitter:100};if(!n.enabled)return e();for(;;)try{let r=await e();if(E){let e=`Request succeeded after ${E} retries.`;"object"==typeof r&&r&&"status"in r&&(e+=` Status code: ${r.status}`),t?.({messageType:"RETRY_SUCCESS",message:e,severity:"INFO"})}return r}catch(i){let e=E>=n.maxRetries,r=i.isNetworkError&&!n.retryNetworkErrors,o=i.status&&i.status>=500&&!n.retry500Errors;if(e||r||o){let A=`Failed after ${E} retries. `;throw e?A+=`Reached maximum retries (${n.maxRetries}).`:r?A+="Network error encountered and retryNetworkErrors is disabled.":o&&(A+="HTTP 500 error encountered and retry500Errors is disabled."),A+=` Last error: ${i.message}`,t?.({messageType:"RETRY_FAILED",message:A,severity:"ERROR",errorBody:JSON.stringify(i,Object.getOwnPropertyNames(i))}),Error(A,{cause:i})}E++;let _=Math.min(n.initialBackoff*Math.pow(2,E-1)+Math.random()*n.maxJitter,Number.MAX_SAFE_INTEGER),a="Unknown error";i.isNetworkError?a="Network error":i.status&&(a=`HTTP ${i.status} error`),t?.({messageType:"RETRY",message:`Retry attempt ${E}/${n.maxRetries} due to: ${a}. Error details: ${i.message}. Waiting for ${_.toFixed(2)}ms before next attempt.`,severity:"WARN",errorBody:JSON.stringify(i,Object.getOwnPropertyNames(i))}),await A(_)}}let h={cache:new Map};"undefined"!=typeof window&&((r=window)[t="__primerCache__"]??(r[t]=h),h=window.__primerCache__);let y=()=>h.cache;function w(){if(y().size<=30)return;let e=Date.now();for(let[r,t]of y())t.exp<e&&y().delete(r);if(y().size>50)for(let[e]of y()){if(y().size<=50)break;y().delete(e)}}let g=()=>v.randomUUID?.()||U(),U=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(e^B()>>e/4).toString(16)),B=()=>(v.getRandomValues?.(new Uint8Array(1))[0]??16*Math.random())&15,v="undefined"!=typeof crypto?crypto:{},F=(e,r,t)=>G(e,"get",r,t),G=async(e,r,t,A,E)=>{let n=g(),o=performance?.now(),_=f(e),a={method:r,url:t,body:E};_.networkCallEvent(m(n,a));try{let i=await fetch(t,{body:E,method:r,headers:{"content-type":"application/json","x-request-id":n,...A}});if(!i.ok){let e=Error(`HTTP error! status: ${i.status}`);throw e.status=i.status,e}let s=await i.json();if(t.includes("client-sdk/configuration")){let{primerAccountId:r,clientSession:{clientSessionId:t,customer:A}}=s;_=C({checkoutSessionId:e,clientSessionId:t,customerId:A?.customerId,primerAccountId:r,url:_.url})}let N=performance?.now();return _.networkCallEvent(m(n,a,{data:s},N-o)),{data:s,headers:i.headers,status:i.status,source:"NETWORK"}}catch(r){let e=performance?.now();throw Object.assign(r,{isNetworkError:r instanceof TypeError}),_.networkCallEvent(m(n,a,{error:r},e-o)),r}},H=(e,r)=>new Promise((t,A)=>{let E=setTimeout(()=>{let e=Error("Request timed out");e.isNetworkError=!0,A(e)},r);e.then(t).catch(A).finally(()=>clearTimeout(E))}),b=(e,r)=>{let{headers:t,retryConfig:A,cacheConfig:E,timeout:n=15e3,checkoutSessionId:o}=r,_=f(o);return(function(e){if(!e)return e=>e();let{key:r,refresh:t=!1,usePrimerSessionCacheTtlHeader:A=!1,ttl:E=36e5}=e;return async e=>{let n=Date.now(),o=y().get(r);if(!t&&o&&o.exp>n)return o.promise;o&&y().delete(r);let _=e().then(e=>{let t=E;return A&&(t=1e3*(Number(e.headers.get("x-primer-session-cache-ttl"))||0)),!function({key:e,ttl:r=36e5},t){r?y().set(e,{promise:Promise.resolve({...t,source:"CACHE"}),exp:Date.now()+r}):y().delete(e)}({key:r,ttl:t},e),w(),e},e=>{throw y().delete(r),e});return y().set(r,{promise:_,exp:n+E}),w(),_}})(E)(()=>M(()=>H(F(o,e,t),n),A,r=>_.messageEvent({...r,url:e})))},K="function"==typeof Buffer,k="function"==typeof TextDecoder?new TextDecoder:void 0,V="function"==typeof TextEncoder?new TextEncoder:void 0,x=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),W=(e=>{let r={};return e.forEach((e,t)=>r[e]=t),r})(x),$=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,j=String.fromCharCode.bind(String),Q="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),X=e=>e.replace(/=/g,"").replace(/[+\/]/g,e=>"+"==e?"-":"_"),z=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),J="function"==typeof btoa?e=>btoa(e):K?e=>Buffer.from(e,"binary").toString("base64"):e=>{let r,t,A,E,n="",o=e.length%3;for(let o=0;o<e.length;){if((t=e.charCodeAt(o++))>255||(A=e.charCodeAt(o++))>255||(E=e.charCodeAt(o++))>255)throw TypeError("invalid character found");n+=x[(r=t<<16|A<<8|E)>>18&63]+x[r>>12&63]+x[r>>6&63]+x[63&r]}return o?n.slice(0,o-3)+"===".substring(o):n},Z=K?e=>Buffer.from(e).toString("base64"):e=>{let r=[];for(let t=0,A=e.length;t<A;t+=4096)r.push(j.apply(null,e.subarray(t,t+4096)));return J(r.join(""))},q=(e,r=!1)=>r?X(Z(e)):Z(e),ee=e=>{if(e.length<2){var r=e.charCodeAt(0);return r<128?e:r<2048?j(192|r>>>6)+j(128|63&r):j(224|r>>>12&15)+j(128|r>>>6&63)+j(128|63&r)}var r=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return j(240|r>>>18&7)+j(128|r>>>12&63)+j(128|r>>>6&63)+j(128|63&r)},er=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,et=e=>e.replace(er,ee),eA=K?e=>Buffer.from(e,"utf8").toString("base64"):V?e=>Z(V.encode(e)):e=>J(et(e)),eE=(e,r=!1)=>r?X(eA(e)):eA(e),en=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,eo=e=>{switch(e.length){case 4:var r=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return j((r>>>10)+55296)+j((1023&r)+56320);case 3:return j((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return j((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},e_=e=>e.replace(en,eo),ea="function"==typeof atob?e=>atob(z(e)):K?e=>Buffer.from(e,"base64").toString("binary"):e=>{if(e=e.replace(/\s+/g,""),!$.test(e))throw TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let r,t="",A,E;for(let n=0;n<e.length;)r=W[e.charAt(n++)]<<18|W[e.charAt(n++)]<<12|(A=W[e.charAt(n++)])<<6|(E=W[e.charAt(n++)]),t+=64===A?j(r>>16&255):64===E?j(r>>16&255,r>>8&255):j(r>>16&255,r>>8&255,255&r);return t},ei=K?e=>Q(Buffer.from(e,"base64")):e=>Q(ea(e).split("").map(e=>e.charCodeAt(0))),es=e=>ei(eR(e)),eN=K?e=>Buffer.from(e,"base64").toString("utf8"):k?e=>k.decode(ei(e)):e=>e_(ea(e)),eR=e=>z(e.replace(/[-_]/g,e=>"-"==e?"+":"/")),eT=e=>eN(eR(e)),eO=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),eP={encode:eE,decode:eT},ec={encode:function(e,r={}){let{urlSafe:t=!1}=r;return eP.encode(e,t)},decode:eP.decode},el="The provided `clientToken`",eI=`${el} has expired`,ed=`${el} is malformed`,eL=(e,r,t)=>({"primer-client-token":e,"primer-sdk-client":"WEB","primer-sdk-version":"v2.53.0","primer-sdk-checkout-session-id":r,...t&&{"x-api-version":t}});async function eD(e,r,t){let{accessToken:A,configurationUrl:E,analyticsUrlV2:o}=function(e){let r=function(e){try{let[r,t]=e.split(".");return JSON.parse(ec.decode(t||r))}catch{throw Error(ed)}}(e),t=1e3*r.exp;if(Date.now()>t)throw Error(`${eI}. Expiration date: ${new Date(t).toISOString()}`);return r}(e),a=C({checkoutSessionId:r,url:o}),i=_,s=i!==n.LEGACY?i:"2.3";a.timerStart({id:"CONFIGURATION_LOADING"});try{let{data:e,source:n}=await b(`${E}/?withDisplayMetadata=true`,{checkoutSessionId:r,headers:eL(A,r,s),retryConfig:{enabled:!0},cacheConfig:t});return a.timerEnd({id:"CONFIGURATION_LOADING",context:{source:n}}),e}catch(r){let e=r instanceof Error?r.message:"Unknown error occurred";throw Error(`Failed to initialize client: ${e}`)}}function eY(e){return e instanceof Error?{errorBody:e.message,stacktrace:e.stack}:"object"==typeof e&&null!==e&&"message"in e?{errorBody:String(e.message),stacktrace:"stack"in e?String(e.stack):void 0}:{errorBody:String(e||"Unknown error")}}function eS({checkoutSessionId:e,analytics:r,error:t,reporter:A}){r?.crashEvent?r.crashEvent({...eY(t),reporter:A}):e&&eu(e,t,A)}async function eu(e,r,t){let A=await c(T.CRASH_EVENT,{...eY(r),reporter:t},{checkoutSessionId:e});try{await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)})}catch(e){console.error("Failed to post crash event",e)}}let eC=Symbol.for("initGlobalErrorMonitoringLoaded"),ef=(e,r)=>{"undefined"!=typeof window&&window[eC]||(window[eC]=!0,window.addEventListener("error",t=>{!em(t)&&ep(t)&&eS({checkoutSessionId:e,analytics:r,error:t.error,reporter:"window.onerror"})}),window.addEventListener("unhandledrejection",t=>{let A=t.reason||Error("Unhandled promise rejection");eM(A)&&eS({checkoutSessionId:e,analytics:r,error:A,reporter:"unhandledrejection"})}))},em=e=>"Script error."===e.message||!e.filename||0===e.lineno,ep=e=>{let r=e.filename;return!!(r&&eh(r))&&!!new a(e.error).isReported||!1},eM=e=>{if(e&&"object"==typeof e&&"stack"in e&&"string"==typeof e.stack){let r=a.from(e);return!r.isReported&&(!!("fileName"in e&&"string"==typeof e.fileName&&eh(e.fileName))||ey(r.stack).some(eh))}return!1},eh=e=>{try{return new URL(e,window.location.origin).hostname.endsWith(".primer.io")}catch{return!1}},ey=e=>{if(!e)return[];let r=e.split("\n"),t=[],A=/^\s*at\s+(?:.*?\s+)?\(?(.+?):\d+:\d+\)?$/;for(let e of r){let r=e.match(A);if(r&&r[1])t.push(r[1]);else{let r=/@(.*?):\d+:\d+$/,A=e.match(r);A&&A[1]&&t.push(A[1])}}return t};function ew(e,r,t){return document.querySelector(`${e}[${r}^="${t}"]`)}async function eg(e,r,t,A,E,n){let{analytics:o,name:_=r,retryConfig:a}=n;await M(()=>new Promise((n,a)=>{let i=ew(e,t,r)||function(e,r){let t=document.createElement(e);return Object.entries(r).forEach(([e,r])=>t.setAttribute(e,r)),t}(e,{...A,[t]:r});i.onload=()=>{o?.sdkFunctionEvent({name:_,params:[`${e.charAt(0).toUpperCase()+e.slice(1)} loaded successfully: ${r}`]}),n()},i.onerror=()=>{i.remove(),a(Error(`${E}: ${r}`))},i.parentNode||document.head.appendChild(i)}),a,e=>o?.messageEvent({...e,url:r}))}async function eU(r){return e||(e=Promise.all([function(e,r={}){return ew("script","src",e)&&window.__Primer?(r.analytics?.sdkFunctionEvent({name:r.name??e,params:["Script already loaded"]}),Promise.resolve()):eg("script",e,"src",{...r.attributes,async:"",crossorigin:"anonymous"},"Can't load Primer SDK",r)}("https://sdk.primer.io/web/v2.53.0/PrimerCoreSDK.min.js",{analytics:r,name:"loadPrimerScript"}),function(e,r={}){return Array.from(document.styleSheets).some(r=>r.href===e)?(r.analytics?.sdkFunctionEvent({name:r.name??e,params:["Stylesheet already loaded"]}),Promise.resolve()):eg("link",e,"href",{...r.attributes,rel:"stylesheet"},"Can't load Primer SDK's Stylesheet",r)}("https://sdk.primer.io/web/v2.53.0/Checkout.css",{analytics:r,name:"loadPrimerCss"})]).then(()=>{let e=window.__Primer;return delete window.__Primer,e}).catch(r=>{throw e=void 0,r}))}let eB=async()=>{let e=g();try{let r=f(e);try{ef(e,r),r.sdkFunctionEvent({name:"preloadPrimer"}),r.timerStart({id:R.preloadPrimer}),await eU(r),r.timerEnd({id:R.preloadPrimer})}catch(A){let t=a.from(A);throw t.isReported||(eS({checkoutSessionId:e,analytics:r,error:t,reporter:"preloadPrimer level 1"}),t.markAsReported()),t}}catch(t){let r=a.from(t);throw r.isReported||(eu(e,r,"preloadPrimer level 0"),r.markAsReported()),r}},ev=eH("createHeadless"),eF=eH("showUniversalCheckout"),eG=eH("showVaultManager");function eH(e){return async(...[r,t,...A])=>{var E;(E=t?.apiVersion)||console.warn(`[Primer SDK] No API version was explicitly set. Defaulting to '${o}'.`),_=E??o;let n=g();try{let E=f(n);try{ef(n,E),E.sdkFunctionEvent({name:e,params:[r,t,...A]}),E.timerStart({id:R[e]});let[o,_]=await Promise.all([eD(r,n,t?.clientSessionCachingEnabled?{key:r,usePrimerSessionCacheTtlHeader:!0}:void 0),eU(E)]);return _[e](o,n,r,t,...A)}catch(r){let e=a.from(r);throw e.isReported||(eS({checkoutSessionId:n,analytics:E,error:e,reporter:"lazyLoad level 1"}),e.markAsReported()),e}}catch(r){let e=a.from(r);throw e.isReported||(eu(n,e,"lazyLoad level 0"),e.markAsReported()),e}}}var eb=function(e){return e.CHECKOUT="CHECKOUT",e.HEADLESS_CHECKOUT="HEADLESS_CHECKOUT",e.MANAGE_PAYMENT_METHODS="MANAGE_PAYMENT_METHODS",e}({}),eK=function(e){return e.DEFAULT="DEFAULT",e.PREFER_VAULT="PREFER_VAULT",e}({}),ek=function(e){return e.SUCCESS="AUTH_SUCCESS",e.FAILED="AUTH_FAILED",e.SKIPPED="SKIPPED",e.CHALLENGE="CHALLENGE",e}({});let eV={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",AUTOMATED_CLEARING_HOUSE:"AUTOMATED_CLEARING_HOUSE",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_ACH:"STRIPE_ACH",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL_ORDER",PAYPAL_VAULTED:"PAYPAL_BILLING_AGREEMENT",GO_CARDLESS:"GOCARDLESS",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME",KLARNA_CUSTOMER_TOKEN:"KLARNA_CUSTOMER_TOKEN"},ex={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",STRIPE_ACH:"STRIPE_ACH",STRIPE_IDEAL:"STRIPE_IDEAL",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",PAYMENT_CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL",GO_CARDLESS:"GOCARDLESS",KLARNA:"KLARNA",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_BANK_TRANSFER:"ADYEN_BANK_TRANSFER",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME"},eW={SINGLE_USE:"SINGLE_USE",MULTI_USE:"MULTI_USE"};eV.PAYPAL_VAULTED,ex.PAYPAL,eV.KLARNA_CUSTOMER_TOKEN,ex.KLARNA,eV.AUTOMATED_CLEARING_HOUSE,ex.STRIPE_ACH,eV.CARD,ex.PAYMENT_CARD;var e$=function(e){return e.INITIALIZATION_ERROR="INITIALIZATION_ERROR",e.NO_PAYMENT_METHODS="NO_PAYMENT_METHODS",e.PRIMER_TEARDOWN="PRIMER_TEARDOWN",e.PRIMER_SERVER_ERROR="PRIMER_SERVER_ERROR",e.THREE_DS_AUTH_FAILED="THREE_DS_AUTH_FAILED",e.TOKENIZATION_ERROR="TOKENIZATION_ERROR",e.DUPLICATE_PAYMENT_METHOD_ERROR="DUPLICATE_PAYMENT_METHOD_ERROR",e.CARD_NUMBER_ERROR="CARD_NUMBER_ERROR",e.PAYMENT_METHOD_NOT_SETUP="PAYMENT_METHOD_NOT_SETUP",e.PAYMENT_METHOD_NOT_PROVIDED="PAYMENT_METHOD_NOT_PROVIDED",e.PAYMENT_METHOD_NOT_COMPATIBLE="PAYMENT_METHOD_NOT_COMPATIBLE",e.RESUME_ERROR="RESUME_ERROR",e.VALIDATION_ERROR="VALIDATION_ERROR",e.PAYMENT_FAILED="PAYMENT_FAILED",e.PAYMENT_CREATION_ABORTED="PAYMENT_CREATION_ABORTED",e.PAYMENT_CREATION_DISABLED="PAYMENT_CREATION_DISABLED",e.CLIENT_SESSION_UPDATE_ERROR="CLIENT_SESSION_UPDATE_ERROR",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.VAULT_FETCH="VAULT_FETCH",e.VAULT_DELETE="VAULT_DELETE",e.HEADLESS_VAULT_MANAGER_VALIDATION="HEADLESS_VAULT_MANAGER_VALIDATION",e.CARD_FORM_VALIDATION_UNEXPECTED_FIELD="CARD_FORM_VALIDATION_UNEXPECTED_FIELD",e.MISSING_FIRST_NAME_OR_LAST_NAME="MISSING_FIRST_NAME_OR_LAST_NAME",e.MISSING_EMAIL_ADDRESS="MISSING_EMAIL_ADDRESS",e.INVALID_FLOW="INVALID_FLOW",e}({});function ej(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}class eQ extends a{static fromErrorCode(e,r){return new eQ(e,r)}constructor(e,r){super(r.message),ej(this,"code",void 0),ej(this,"diagnosticsId",void 0),ej(this,"data",void 0),ej(this,"isFromDeveloper",void 0),this.code=e,this.diagnosticsId=r.diagnosticsId??null,this.data=r.data,this.isFromDeveloper=r.isFromDeveloper??!1,this.name="PrimerClientError",Error.captureStackTrace&&Error.captureStackTrace(this,eQ)}}var eX=function(e){return e.PAYMENT_METHOD="PAYMENT_METHOD",e.CHECK="CHECK",e}({});let ez=e=>{let r=e?.mandateData;return!!r&&"fullMandateText"in r};var eJ=function(e){return e.CHANGE="change",e.ERROR="error",e.FOCUS="focus",e.BLUR="blur",e.CLICK="click",e.CLOSE="close",e.CONFIRMED_KLARNA_CATEGORY="CONFIRMED_KLARNA_CATEGORY",e.CONFIRMED_KLARNA_CATEGORY_ERROR="CONFIRMED_KLARNA_CATEGORY_ERROR",e.KLARNA_SESSION_UPDATE="KLARNA_SESSION_UPDATE",e.KLARNA_SESSION_REFRESH_ERROR="KLARNA_SESSION_REFRESH_ERROR",e}({}),eZ=function(e){return e.CARD="CARD",e.NATIVE="NATIVE",e.REDIRECT="REDIRECT",e.KLARNA="KLARNA",e.ACH="ACH",e}({});let eq={SDK_VERSION:"v2.53.0",createHeadless:ev,showUniversalCheckout:eF,showVaultManager:eG,preloadPrimer:eB};return E})());
|
|
2
|
+
//# sourceMappingURL=Primer.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,152 @@
|
|
|
7
7
|
* ensuring backward compatibility.
|
|
8
8
|
*/
|
|
9
9
|
export type APIVersionOption = "legacy" | "2.4";
|
|
10
|
+
declare enum ImplementationType {
|
|
11
|
+
WEB_REDIRECT = "WEB_REDIRECT",
|
|
12
|
+
NATIVE_SDK = "NATIVE_SDK"
|
|
13
|
+
}
|
|
14
|
+
declare enum ProductType {
|
|
15
|
+
DIGITAL = "DIGITAL",
|
|
16
|
+
PHYSICAL = "PHYSICAL",
|
|
17
|
+
SHIPPING_FEE = "SHIPPING_FEE"
|
|
18
|
+
}
|
|
19
|
+
export interface ClientSessionLineItem {
|
|
20
|
+
amount: number;
|
|
21
|
+
description: string;
|
|
22
|
+
discountAmount?: number;
|
|
23
|
+
itemId: string;
|
|
24
|
+
name?: string;
|
|
25
|
+
productType?: ProductType;
|
|
26
|
+
quantity: number;
|
|
27
|
+
taxAmount?: number;
|
|
28
|
+
taxCode?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ClientSessionShipping {
|
|
31
|
+
amount: number;
|
|
32
|
+
methodId?: string;
|
|
33
|
+
methodName?: string;
|
|
34
|
+
methodDescription?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface ClientSessionFeeItem {
|
|
37
|
+
type?: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
amount: number;
|
|
40
|
+
}
|
|
41
|
+
export interface ClientSessionAddress {
|
|
42
|
+
firstName?: string;
|
|
43
|
+
lastName?: string;
|
|
44
|
+
addressLine1?: string;
|
|
45
|
+
addressLine2?: string;
|
|
46
|
+
city?: string;
|
|
47
|
+
state?: string;
|
|
48
|
+
countryCode?: string;
|
|
49
|
+
postalCode?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface ClientSession {
|
|
52
|
+
orderId?: string;
|
|
53
|
+
currencyCode?: string;
|
|
54
|
+
lineItems?: ClientSessionLineItem[];
|
|
55
|
+
totalAmount?: number;
|
|
56
|
+
customerId?: string;
|
|
57
|
+
orderDetails?: {
|
|
58
|
+
countryCode?: string;
|
|
59
|
+
shipping?: ClientSessionShipping;
|
|
60
|
+
fees?: ClientSessionFeeItem[];
|
|
61
|
+
};
|
|
62
|
+
customer?: {
|
|
63
|
+
emailAddress?: string;
|
|
64
|
+
mobileNumber?: string;
|
|
65
|
+
firstName?: string;
|
|
66
|
+
lastName?: string;
|
|
67
|
+
billingAddress?: ClientSessionAddress;
|
|
68
|
+
shippingAddress?: ClientSessionAddress;
|
|
69
|
+
taxId?: string;
|
|
70
|
+
nationalDocumentId?: string;
|
|
71
|
+
};
|
|
72
|
+
paymentMethod?: {
|
|
73
|
+
options?: Record<string, any>;
|
|
74
|
+
orderedAllowedCardNetworks?: string[];
|
|
75
|
+
vaultOnSuccess?: boolean;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export interface PaymentMethodDisplayMetadata {
|
|
79
|
+
button: {
|
|
80
|
+
backgroundColor: BackgroundColor;
|
|
81
|
+
borderColor: BorderColor;
|
|
82
|
+
borderWidth: BorderWidth;
|
|
83
|
+
cornerRadius: number;
|
|
84
|
+
iconPositionRelativeToText?: "START" | "END";
|
|
85
|
+
iconUrl: IconUrl;
|
|
86
|
+
text?: string;
|
|
87
|
+
textColor?: TextColor;
|
|
88
|
+
};
|
|
89
|
+
overlay: {
|
|
90
|
+
logo: IconUrl;
|
|
91
|
+
backgroundColor: BackgroundColor;
|
|
92
|
+
};
|
|
93
|
+
popup: {
|
|
94
|
+
width: number;
|
|
95
|
+
height: number;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export interface BackgroundColor {
|
|
99
|
+
colored: string;
|
|
100
|
+
dark: string;
|
|
101
|
+
light: string;
|
|
102
|
+
}
|
|
103
|
+
export interface BorderColor {
|
|
104
|
+
dark: string;
|
|
105
|
+
light: string;
|
|
106
|
+
}
|
|
107
|
+
export interface BorderWidth {
|
|
108
|
+
colored: number;
|
|
109
|
+
dark: number;
|
|
110
|
+
light: number;
|
|
111
|
+
}
|
|
112
|
+
export interface IconUrl {
|
|
113
|
+
colored: string;
|
|
114
|
+
dark: string;
|
|
115
|
+
light: string;
|
|
116
|
+
}
|
|
117
|
+
export interface TextColor {
|
|
118
|
+
dark: string;
|
|
119
|
+
light: string;
|
|
120
|
+
}
|
|
121
|
+
export interface PaymentMethodConfig {
|
|
122
|
+
id: string;
|
|
123
|
+
type: PaymentMethodType;
|
|
124
|
+
name: string;
|
|
125
|
+
implementationType: ImplementationType;
|
|
126
|
+
displayMetadata: PaymentMethodDisplayMetadata;
|
|
127
|
+
options: {
|
|
128
|
+
captureVaultedCardCvv?: boolean;
|
|
129
|
+
clientId?: string;
|
|
130
|
+
threeDSecureToken?: string;
|
|
131
|
+
threeDSecureInitUrl?: string;
|
|
132
|
+
threeDSecureProvider?: string;
|
|
133
|
+
threeDSecureEnabled?: boolean;
|
|
134
|
+
};
|
|
135
|
+
forceRedirect?: boolean;
|
|
136
|
+
}
|
|
137
|
+
export type GoatBrand = {
|
|
138
|
+
assets: {
|
|
139
|
+
icon: string;
|
|
140
|
+
};
|
|
141
|
+
colors: {
|
|
142
|
+
background: string;
|
|
143
|
+
main: string;
|
|
144
|
+
};
|
|
145
|
+
description: string | null;
|
|
146
|
+
is_primer_app: boolean;
|
|
147
|
+
name: string;
|
|
148
|
+
website: string | null;
|
|
149
|
+
};
|
|
150
|
+
export type GoatBrandWithCdn = GoatBrand & {
|
|
151
|
+
/**
|
|
152
|
+
* The full CDN URL that can be used directly in applications
|
|
153
|
+
*/
|
|
154
|
+
goatCdnUrl: string;
|
|
155
|
+
};
|
|
10
156
|
export declare const PaymentInstrumentType: {
|
|
11
157
|
readonly WORLDPAY_IDEAL: "WORLDPAY_IDEAL";
|
|
12
158
|
readonly AUTOMATED_CLEARING_HOUSE: "AUTOMATED_CLEARING_HOUSE";
|
|
@@ -320,98 +466,95 @@ export interface CheckoutStyle {
|
|
|
320
466
|
processingIndicator?: ProcessingIndicatorStyle;
|
|
321
467
|
focusCheckoutOnInit?: boolean;
|
|
322
468
|
}
|
|
323
|
-
export
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
paymentInstrumentType: U;
|
|
328
|
-
threeDSecureAuthentication: ThreeDSAuthenticationData | null;
|
|
329
|
-
vaultData: VaultData | null;
|
|
330
|
-
userDescription?: string;
|
|
331
|
-
}
|
|
332
|
-
export type VaultedPaymentMethod = IVaultedPaymentMethod<any, any>;
|
|
333
|
-
declare enum ProductType {
|
|
334
|
-
DIGITAL = "DIGITAL",
|
|
335
|
-
PHYSICAL = "PHYSICAL",
|
|
336
|
-
SHIPPING_FEE = "SHIPPING_FEE"
|
|
337
|
-
}
|
|
338
|
-
export interface ClientSessionLineItem {
|
|
339
|
-
amount: number;
|
|
340
|
-
description: string;
|
|
341
|
-
discountAmount?: number;
|
|
342
|
-
itemId: string;
|
|
343
|
-
name?: string;
|
|
344
|
-
productType?: ProductType;
|
|
345
|
-
quantity: number;
|
|
346
|
-
taxAmount?: number;
|
|
347
|
-
taxCode?: string;
|
|
348
|
-
}
|
|
349
|
-
export interface ClientSessionShipping {
|
|
350
|
-
amount: number;
|
|
351
|
-
methodId?: string;
|
|
352
|
-
methodName?: string;
|
|
353
|
-
methodDescription?: string;
|
|
354
|
-
}
|
|
355
|
-
export interface ClientSessionFeeItem {
|
|
356
|
-
type?: string;
|
|
357
|
-
description?: string;
|
|
358
|
-
amount: number;
|
|
469
|
+
export declare enum CheckoutUXFlow {
|
|
470
|
+
CHECKOUT = "CHECKOUT",
|
|
471
|
+
HEADLESS_CHECKOUT = "HEADLESS_CHECKOUT",
|
|
472
|
+
MANAGE_PAYMENT_METHODS = "MANAGE_PAYMENT_METHODS"
|
|
359
473
|
}
|
|
360
|
-
export interface
|
|
361
|
-
|
|
362
|
-
lastName?: string;
|
|
363
|
-
addressLine1?: string;
|
|
364
|
-
addressLine2?: string;
|
|
365
|
-
city?: string;
|
|
366
|
-
state?: string;
|
|
367
|
-
countryCode?: string;
|
|
368
|
-
postalCode?: string;
|
|
474
|
+
export interface BasePaymentInstrumentData {
|
|
475
|
+
[key: string]: unknown;
|
|
369
476
|
}
|
|
370
|
-
export interface
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
477
|
+
export interface PaymentCardInstrumentData extends BasePaymentInstrumentData {
|
|
478
|
+
last4Digits: string;
|
|
479
|
+
first6Digits: string;
|
|
480
|
+
expirationMonth: string;
|
|
481
|
+
expirationYear: string;
|
|
482
|
+
cardholderName: string;
|
|
483
|
+
network: string;
|
|
484
|
+
isNetworkTokenized: boolean;
|
|
485
|
+
binData?: {
|
|
486
|
+
network: string;
|
|
487
|
+
issuerCountryCode: string;
|
|
488
|
+
issuerName: string;
|
|
489
|
+
issuerCurrencyCode: string;
|
|
490
|
+
regionalRestriction: string;
|
|
491
|
+
accountNumberType: string;
|
|
492
|
+
accountFundingType: string;
|
|
493
|
+
prepaidReloadableIndicator: string;
|
|
494
|
+
productUsageType: string;
|
|
495
|
+
productCode: string;
|
|
496
|
+
productName: string;
|
|
380
497
|
};
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
498
|
+
}
|
|
499
|
+
export interface PayPalInstrumentData extends BasePaymentInstrumentData {
|
|
500
|
+
externalPayerInfo?: {
|
|
501
|
+
externalPayerId?: string;
|
|
384
502
|
firstName?: string;
|
|
385
503
|
lastName?: string;
|
|
386
|
-
|
|
387
|
-
shippingAddress?: ClientSessionAddress;
|
|
388
|
-
taxId?: string;
|
|
389
|
-
nationalDocumentId?: string;
|
|
504
|
+
email?: string;
|
|
390
505
|
};
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
506
|
+
shippingAddress?: {
|
|
507
|
+
firstName?: string;
|
|
508
|
+
lastName?: string;
|
|
509
|
+
addressLine1?: string;
|
|
510
|
+
addressLine2?: string;
|
|
511
|
+
city?: string;
|
|
512
|
+
state?: string;
|
|
513
|
+
countryCode?: string;
|
|
514
|
+
postalCode?: string;
|
|
395
515
|
};
|
|
396
516
|
}
|
|
397
|
-
export interface
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
517
|
+
export interface KlarnaInstrumentData extends BasePaymentInstrumentData {
|
|
518
|
+
sessionData?: {
|
|
519
|
+
billingAddress?: {
|
|
520
|
+
firstName?: string;
|
|
521
|
+
lastName?: string;
|
|
522
|
+
email?: string;
|
|
523
|
+
phoneNumber?: string;
|
|
524
|
+
addressLine1?: string;
|
|
525
|
+
addressLine2?: string;
|
|
526
|
+
city?: string;
|
|
527
|
+
state?: string;
|
|
528
|
+
countryCode?: string;
|
|
529
|
+
postalCode?: string;
|
|
530
|
+
};
|
|
531
|
+
};
|
|
401
532
|
}
|
|
402
|
-
export interface
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
533
|
+
export interface ACHInstrumentData extends BasePaymentInstrumentData {
|
|
534
|
+
accountNumberLastFourDigits: string;
|
|
535
|
+
bankName: string;
|
|
536
|
+
accountType?: string;
|
|
537
|
+
routingNumber?: string;
|
|
406
538
|
}
|
|
407
|
-
export
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
539
|
+
export interface IVaultedPaymentMethod<B extends BasePaymentInstrumentData = BasePaymentInstrumentData, I extends PaymentInstrumentType = PaymentInstrumentType, T extends PaymentMethodType = PaymentMethodType> {
|
|
540
|
+
id: string;
|
|
541
|
+
analyticsId: string;
|
|
542
|
+
paymentInstrumentData: B;
|
|
543
|
+
paymentInstrumentType: I;
|
|
544
|
+
paymentMethodType: T;
|
|
545
|
+
threeDSecureAuthentication?: ThreeDSAuthenticationData | null;
|
|
546
|
+
vaultData?: VaultData | null;
|
|
547
|
+
userDescription?: string;
|
|
548
|
+
isVaulted?: boolean;
|
|
411
549
|
}
|
|
550
|
+
export type PaymentCardVaultedMethod = IVaultedPaymentMethod<PaymentCardInstrumentData, typeof PaymentInstrumentType.CARD, typeof PaymentMethodType.PAYMENT_CARD>;
|
|
551
|
+
export type PayPalVaultedMethod = IVaultedPaymentMethod<PayPalInstrumentData, typeof PaymentInstrumentType.PAYPAL_VAULTED, typeof PaymentMethodType.PAYPAL>;
|
|
552
|
+
export type KlarnaVaultedMethod = IVaultedPaymentMethod<KlarnaInstrumentData, typeof PaymentInstrumentType.KLARNA_CUSTOMER_TOKEN, typeof PaymentMethodType.KLARNA>;
|
|
553
|
+
export type ACHVaultedMethod = IVaultedPaymentMethod<ACHInstrumentData, typeof PaymentInstrumentType.AUTOMATED_CLEARING_HOUSE, typeof PaymentMethodType.STRIPE_ACH>;
|
|
554
|
+
export type VaultedPaymentMethod = PaymentCardVaultedMethod | PayPalVaultedMethod | KlarnaVaultedMethod | ACHVaultedMethod | IVaultedPaymentMethod;
|
|
412
555
|
export type SecureInputOptions = {
|
|
413
556
|
ariaLabel?: string;
|
|
414
|
-
container: string;
|
|
557
|
+
container: string | Element | HTMLElement;
|
|
415
558
|
id?: string;
|
|
416
559
|
name: string;
|
|
417
560
|
placeholder?: string;
|
|
@@ -521,13 +664,6 @@ export interface CardMetadata {
|
|
|
521
664
|
cvvLength: number;
|
|
522
665
|
cardNumberLength: number;
|
|
523
666
|
}
|
|
524
|
-
type PaymentMethodData$1 = AdyenMultibancoPaymentData;
|
|
525
|
-
export type AdyenMultibancoPaymentData = {
|
|
526
|
-
paymentMethodType: typeof PaymentMethodType.ADYEN_MULTIBANCO;
|
|
527
|
-
reference: string;
|
|
528
|
-
expiresAt: string;
|
|
529
|
-
entity: string;
|
|
530
|
-
};
|
|
531
667
|
export interface PositionalConfig {
|
|
532
668
|
container: string | Element;
|
|
533
669
|
}
|
|
@@ -842,20 +978,21 @@ export interface ThreeDSAuthenticationData {
|
|
|
842
978
|
export interface VaultData {
|
|
843
979
|
customerId: string;
|
|
844
980
|
}
|
|
845
|
-
export
|
|
981
|
+
export type PaymentCardDetails = {
|
|
846
982
|
last4Digits: string;
|
|
847
983
|
cardholderName: string;
|
|
848
984
|
network: string;
|
|
849
|
-
}
|
|
850
|
-
export
|
|
985
|
+
};
|
|
986
|
+
export type PayPalBillingAgreementDetails = {
|
|
851
987
|
paypalBillingAgreementId: string;
|
|
852
988
|
externalPayerInfo?: ExternalPayerInfo;
|
|
853
989
|
shippingAddress?: CustomerAddress;
|
|
854
|
-
}
|
|
855
|
-
export
|
|
990
|
+
};
|
|
991
|
+
export type GoCardlessDetails = {
|
|
856
992
|
gocardlessMandateId: string;
|
|
857
|
-
}
|
|
858
|
-
|
|
993
|
+
};
|
|
994
|
+
type BasePaymentInstrumentData$1 = Record<string, unknown>;
|
|
995
|
+
export interface IPaymentMethodToken<T extends BasePaymentInstrumentData$1 = BasePaymentInstrumentData$1, U extends PaymentInstrumentType = PaymentInstrumentType> {
|
|
859
996
|
token: string;
|
|
860
997
|
analyticsId: string;
|
|
861
998
|
tokenType: TokenType;
|
|
@@ -864,6 +1001,7 @@ export interface IPaymentMethodToken<T, U extends PaymentInstrumentType> {
|
|
|
864
1001
|
threeDSecureAuthentication: ThreeDSAuthenticationData | null;
|
|
865
1002
|
vaultData: VaultData | null;
|
|
866
1003
|
}
|
|
1004
|
+
export type UnknownPaymentMethodToken = IPaymentMethodToken<BasePaymentInstrumentData$1, PaymentInstrumentType>;
|
|
867
1005
|
export type BaseAmountChange = {
|
|
868
1006
|
totalAmount: number;
|
|
869
1007
|
};
|
|
@@ -876,7 +1014,7 @@ export type PaymentCardToken = IPaymentMethodToken<PaymentCardDetails, typeof Pa
|
|
|
876
1014
|
export type PayPalBillingAgreementToken = IPaymentMethodToken<PayPalBillingAgreementDetails, typeof PaymentInstrumentType.PAYPAL_VAULTED>;
|
|
877
1015
|
export type GoCardlessToken = IPaymentMethodToken<GoCardlessDetails, typeof PaymentInstrumentType.GO_CARDLESS>;
|
|
878
1016
|
export type IdealPayToken = IPaymentMethodToken<Record<string, never>, typeof PaymentInstrumentType.PAY_NL_IDEAL>;
|
|
879
|
-
export type PaymentMethodToken = PaymentCardToken | PayPalBillingAgreementToken | GoCardlessToken | IdealPayToken |
|
|
1017
|
+
export type PaymentMethodToken = PaymentCardToken | PayPalBillingAgreementToken | GoCardlessToken | IdealPayToken | UnknownPaymentMethodToken;
|
|
880
1018
|
export interface ThreeDSVerificationResult<T extends ThreeDSecureStatus> {
|
|
881
1019
|
status: T;
|
|
882
1020
|
error: PrimerClientError | null;
|
|
@@ -945,6 +1083,13 @@ export type AdvancedOptions = {
|
|
|
945
1083
|
};
|
|
946
1084
|
export type PaymentMethodAction = "PAYMENT_METHOD_SELECTED" | "PAYMENT_METHOD_UNSELECTED";
|
|
947
1085
|
export type PaymentHandling = "AUTO" | "MANUAL";
|
|
1086
|
+
type PaymentMethodData$1 = AdyenMultibancoPaymentData;
|
|
1087
|
+
export type AdyenMultibancoPaymentData = {
|
|
1088
|
+
paymentMethodType: typeof PaymentMethodType.ADYEN_MULTIBANCO;
|
|
1089
|
+
reference: string;
|
|
1090
|
+
expiresAt: string;
|
|
1091
|
+
entity: string;
|
|
1092
|
+
};
|
|
948
1093
|
export type Payment = {
|
|
949
1094
|
id: string;
|
|
950
1095
|
orderId: string;
|
|
@@ -1012,6 +1157,7 @@ export interface ClientSessionHandlers {
|
|
|
1012
1157
|
onBeforeClientSessionUpdate?: () => void;
|
|
1013
1158
|
}
|
|
1014
1159
|
export interface VaultManagerOptions extends WithAllowedCardNetworks {
|
|
1160
|
+
uxFlow?: CheckoutUXFlow.MANAGE_PAYMENT_METHODS;
|
|
1015
1161
|
container: string | Element;
|
|
1016
1162
|
locale?: SupportedLocale;
|
|
1017
1163
|
vaultOnly?: boolean;
|
|
@@ -1025,7 +1171,9 @@ export interface VaultManagerOptions extends WithAllowedCardNetworks {
|
|
|
1025
1171
|
card?: CheckoutCardOptions;
|
|
1026
1172
|
threeDSecure?: ThreeDSVerificationOptions;
|
|
1027
1173
|
giftCard?: CustomizablePaymentMethodButton;
|
|
1174
|
+
googlePay?: Omit<GooglePayOptions, "container">;
|
|
1028
1175
|
directDebit?: DirectDebitOptions;
|
|
1176
|
+
stripe?: StripeOptionsDropIn;
|
|
1029
1177
|
paypal?: Omit<PayPalOptions, "container">;
|
|
1030
1178
|
onTokenizeShouldStart?: OnTokenizeShouldStart;
|
|
1031
1179
|
onTokenizeDidNotStart?: OnTokenizeDidNotStart;
|
|
@@ -1102,7 +1250,11 @@ export declare enum EventTypes {
|
|
|
1102
1250
|
FOCUS = "focus",
|
|
1103
1251
|
BLUR = "blur",
|
|
1104
1252
|
CLICK = "click",
|
|
1105
|
-
CLOSE = "close"
|
|
1253
|
+
CLOSE = "close",
|
|
1254
|
+
CONFIRMED_KLARNA_CATEGORY = "CONFIRMED_KLARNA_CATEGORY",
|
|
1255
|
+
CONFIRMED_KLARNA_CATEGORY_ERROR = "CONFIRMED_KLARNA_CATEGORY_ERROR",
|
|
1256
|
+
KLARNA_SESSION_UPDATE = "KLARNA_SESSION_UPDATE",
|
|
1257
|
+
KLARNA_SESSION_REFRESH_ERROR = "KLARNA_SESSION_REFRESH_ERROR"
|
|
1106
1258
|
}
|
|
1107
1259
|
export interface HeadlessHostedInputOptions {
|
|
1108
1260
|
placeholder?: string;
|
|
@@ -1253,6 +1405,10 @@ export interface FormWithRedirectPaymentMethodManagerOptions {
|
|
|
1253
1405
|
}
|
|
1254
1406
|
export interface KlarnaPaymentMethodManagerOptions {
|
|
1255
1407
|
onPaymentMethodCategoriesChange?: (paymentMethodCategories: KlarnaPaymentMethodCategory[]) => void;
|
|
1408
|
+
onPaymentMethodAction?: (action: string, data: {
|
|
1409
|
+
paymentMethodType: string;
|
|
1410
|
+
category: string;
|
|
1411
|
+
}) => void;
|
|
1256
1412
|
}
|
|
1257
1413
|
export interface AchPaymentMethodManagerOptions {
|
|
1258
1414
|
onCollectBankAccountDetailsComplete?: () => void;
|
|
@@ -1274,6 +1430,15 @@ export type RenderCategoryDetails = {
|
|
|
1274
1430
|
paymentMethodCategoryId: string;
|
|
1275
1431
|
onHeightChange: (height: number) => void;
|
|
1276
1432
|
};
|
|
1433
|
+
export interface HeadlessSDKUtilities {
|
|
1434
|
+
getCardNetworkAsset(network: string): {
|
|
1435
|
+
cardUrl: string;
|
|
1436
|
+
displayName: string;
|
|
1437
|
+
};
|
|
1438
|
+
getUIOrderAmount(): string | null;
|
|
1439
|
+
getCDNAssets(paymentMethodType: PaymentMethodType): Promise<GoatBrandWithCdn | undefined>;
|
|
1440
|
+
getPaymentMethodConfiguration(paymentMethodType: PaymentMethodType): PaymentMethodConfig | undefined;
|
|
1441
|
+
}
|
|
1277
1442
|
export type PaymentMethodManagerOptions = CardPaymentMethodManagerOptions | FormWithRedirectPaymentMethodManagerOptions | KlarnaPaymentMethodManagerOptions;
|
|
1278
1443
|
export interface PrimerHeadlessCheckout {
|
|
1279
1444
|
createPaymentMethodManager(type: "PAYMENT_CARD", options?: PaymentMethodManagerOptions): Promise<ICardPaymentMethodManager | null>;
|
|
@@ -1282,6 +1447,7 @@ export interface PrimerHeadlessCheckout {
|
|
|
1282
1447
|
createPaymentMethodManager(type: "KLARNA", options?: PaymentMethodManagerOptions): Promise<IKlarnaPaymentMethodManager | null>;
|
|
1283
1448
|
createPaymentMethodManager(type: PaymentMethodType, options?: PaymentMethodManagerOptions): Promise<IRedirectPaymentMethodManager | null>;
|
|
1284
1449
|
createVaultManager(): HeadlessVaultManager;
|
|
1450
|
+
getSDKUtilities(): HeadlessSDKUtilities;
|
|
1285
1451
|
/**
|
|
1286
1452
|
* @deprecated
|
|
1287
1453
|
* The options should be set on the `createHeadless` second parameter instead:
|
|
@@ -1316,6 +1482,7 @@ export declare const Primer: {
|
|
|
1316
1482
|
};
|
|
1317
1483
|
|
|
1318
1484
|
export {
|
|
1485
|
+
BasePaymentInstrumentData$1 as BasePaymentInstrumentData,
|
|
1319
1486
|
EventListener$1 as EventListener,
|
|
1320
1487
|
PaymentMethodData$1 as PaymentMethodData,
|
|
1321
1488
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer-io/checkout-web",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.53.0",
|
|
4
4
|
"description": "Primer.js for the web",
|
|
5
5
|
"author": "Primer Developers <developers@primer.io>",
|
|
6
6
|
"homepage": "",
|
|
@@ -13,11 +13,14 @@
|
|
|
13
13
|
],
|
|
14
14
|
"types": "dist/index.d.ts",
|
|
15
15
|
"scripts": {
|
|
16
|
-
"test": "
|
|
16
|
+
"test": "vitest run",
|
|
17
|
+
"test:watch": "vitest",
|
|
18
|
+
"test:coverage": "vitest run --coverage",
|
|
17
19
|
"clean": "rm -rf ./dist ./lib ./temp",
|
|
18
20
|
"build": "yarn clean && yarn build.compile && yarn build.types",
|
|
19
|
-
"build.compile": "
|
|
20
|
-
"
|
|
21
|
+
"build.compile": "rspack build",
|
|
22
|
+
"build.doctor": "RSDOCTOR=true yarn build.compile",
|
|
23
|
+
"dev": "rspack serve --config ./rspack.dev.config.js",
|
|
21
24
|
"dev:https": "yarn dev",
|
|
22
25
|
"build.types": "dts-bundle-generator --config ./dtsconfig.json",
|
|
23
26
|
"postpublish": "clean-package restore",
|