choco-one-click-payment 1.1.31 → 1.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +330 -324
- package/dist/index.js +26 -20
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.choco-one-click-widget{position:fixed;top:0;left:0;right:0;bottom:0;z-index:999999;font-family:Sirius,sans-serif;--choco-widget-accent-color: #2F2F2F;pointer-events:none}.choco-one-click-widget--embedded{position:static;top:auto;left:auto;right:auto;bottom:auto;z-index:auto;pointer-events:auto;min-height:1px}.choco-one-click-widget--embedded .choco-widget-bottom-bar{position:static;box-shadow:none;border-radius:24px}.choco-one-click-widget--embedded .choco-widget-payment-sheet{position:fixed}.choco-one-click-widget *{box-sizing:border-box;font-family:Sirius,sans-serif}.choco-one-click-widget .choco-widget-bottom-bar{opacity:0;transform:translateY(16px)}.choco-one-click-widget .choco-widget-balance-section,.choco-one-click-widget .choco-widget-payment-info{opacity:0;transform:translateY(8px)}.choco-one-click-widget--visible .choco-widget-bottom-bar,.choco-one-click-widget--visible .choco-widget-balance-section,.choco-one-click-widget--visible .choco-widget-payment-info{opacity:1;transform:translateY(0)}.choco-widget-bottom-bar{position:absolute;bottom:0;left:0;right:0;background:#fff;border-radius:24px 24px 0 0;padding:16px;box-shadow:0 -4px 20px #0000001a;transition:transform .24s cubic-bezier(.4,0,.2,1),opacity .2s ease;pointer-events:auto}.choco-widget-payment-info{display:flex;flex-direction:column;gap:12px;align-items:stretch;transition:transform .22s ease,opacity .2s ease}.choco-widget-payment-info-main{display:flex;gap:12px;align-items:center}.choco-widget-payment-method{gap:12px;background:#f1f2f7;border-radius:16px;padding:5px 8px;cursor:pointer;transition:background .2s ease;border:none;font-family:inherit;text-align:left;width:100%;position:relative;height:46px}.choco-widget-payment-method:disabled{cursor:not-allowed;pointer-events:none;opacity:.5}.choco-widget-payment-method.google_pay,.choco-widget-payment-method.apple_pay{max-width:140px}.choco-widget-method-icon-placeholder{font-size:24px}.choco-widget-method-details{flex:1}.choco-widget-method-label{font-size:14px;color:#000}.choco-widget-method-value{font-size:14px;font-weight:600;color:#000;display:flex;align-items:center;gap:4px}.choco-widget-method-icon-wrapper svg{display:block;width:100%;max-width:29px;max-height:18px;margin-top:2px}.choco-widget-method-icon-wrapper:empty{display:none}.choco-widget-method-icon-wrapper.google_pay svg{height:17px;max-width:35px;border:1px solid #3C4043;padding:3px 4px 2px;border-radius:8px}.choco-widget-method-name{font-size:14px;font-weight:700}.choco-widget-method-name.google_pay,.choco-widget-method-name.apple_pay{display:none}.choco-widget-method-chevron{position:absolute;right:5px;top:0;bottom:0;margin:auto 0;width:24px;height:24px}.choco-widget-pay-button{background:var(--choco-widget-accent-color);color:#fff;border:none;border-radius:16px;height:46px;padding:0 16px;font-size:16px;font-weight:600;cursor:pointer;transition:all .2s ease;white-space:nowrap;width:100%;overflow:hidden}.choco-widget-pay-button--loading{cursor:not-allowed;pointer-events:none;position:relative}.choco-widget-pay-button--loading:before{content:"";display:block;width:16px;height:16px;border:2px solid #ffffff;border-top:2px solid transparent;border-radius:50%;animation:choco-spin 1s linear infinite;position:absolute;left:0;right:0;margin:0 auto;z-index:2}.choco-widget-pay-button--loading:after{content:"";display:block;width:100%;height:100%;background:#2f2f2f;position:absolute;left:0;top:0}.choco-widget-pay-button:disabled{opacity:.5;pointer-events:none}.choco-widget-pay-button--hidden{display:none}.choco-widget-google-pay-amount{min-width:124px;height:46px;display:flex;flex-direction:column;justify-content:center;text-align:right;width:100%}.choco-widget-google-pay-amount--hidden{display:none}.choco-widget-google-pay-amount-label{font-size:20px;font-weight:700;line-height:24px;color:#1d1d1d}.choco-widget-google-pay-amount-value{font-size:14px;line-height:18px;color:#1d1d1d;white-space:nowrap;opacity:.5}.choco-widget-google-pay-amount-value--hidden{display:none}.choco-widget-google-pay-amount-value-number{text-decoration:line-through}.choco-widget-google-pay-row--hidden{display:none}.choco-widget-wallet-blocked{pointer-events:none;opacity:.6}.choco-widget-google-pay-button-slot{width:100%}.choco-widget-google-pay-button-slot>button{width:100%!important;height:52px;min-height:52px;border-radius:12px!important;font-size:16px!important}.choco-widget-apple-pay-row--hidden{display:none}.choco-widget-apple-pay-button-slot{width:100%}.choco-widget-apple-pay-button-wrapper{position:relative;width:100%;height:52px}.choco-widget-apple-pay-button{width:100%;height:52px;min-height:52px;border:0;border-radius:12px;cursor:pointer;background:#000;color:#fff;font-size:16px;display:flex;align-items:center;justify-content:center;gap:8px;padding:0 16px}.choco-widget-apple-pay-button--native{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:52px;opacity:.01;z-index:2}.choco-widget-apple-pay-button-overlay{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;gap:8px;background:#000;border-radius:12px;pointer-events:none;z-index:1}.choco-widget-apple-pay-button-text{font-size:16px;line-height:20px;font-weight:600;color:#fff}.choco-widget-apple-pay-button-icon{display:inline-flex;align-items:center;justify-content:center}.choco-widget-payment-sheet{position:absolute;bottom:0;left:0;right:0;top:0;background:#00000080;display:flex;align-items:flex-end;opacity:0;pointer-events:none;transition:opacity .3s ease}.choco-widget-payment-sheet--open{opacity:1;pointer-events:auto}.choco-widget-payment-sheet--open .choco-widget-sheet-content{transform:translateY(0)}.choco-widget-sheet-content{background:#fff;border-radius:24px 24px 0 0;width:100%;max-height:70vh;overflow-y:auto;transform:translateY(100%);transition:transform .3s cubic-bezier(.4,0,.2,1);padding:8px 16px 16px;position:relative;will-change:transform}.choco-widget-sheet-content--dragging{transition:none}.choco-widget-sheet-grabber{flex-shrink:0;display:flex;align-items:center;justify-content:center;cursor:grab;touch-action:none;margin-bottom:8px;-webkit-user-select:none;user-select:none}.choco-widget-sheet-grabber:active{cursor:grabbing}.choco-widget-sheet-grabber:before{content:"";width:72px;height:6px;background:#e5e5e7;border-radius:42px}.choco-widget-sheet-content{-webkit-overflow-scrolling:touch;overscroll-behavior:contain}.choco-widget-sheet-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;position:relative}.choco-widget-sheet-title{font-size:20px;font-weight:700;color:#000;margin:0;flex:1;text-align:center}.choco-widget-payment-sheet--edit .choco-widget-sheet-title{padding-left:30px}.choco-widget-payment-sheet--no-cards .choco-widget-sheet-title{padding-right:30px}.choco-widget-payment-sheet--delete-confirm .choco-widget-sheet-title{padding:0}.choco-widget-sheet-button{background:none;border:none;width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;padding:0}.choco-widget-sheet-button svg{color:#000}.choco-widget-sheet-delete-confirm{display:none;padding-top:16px}.choco-widget-payment-sheet--delete-confirm .choco-widget-payment-methods,.choco-widget-payment-sheet--delete-confirm .choco-widget-cashback-section{display:none!important}.choco-widget-payment-sheet--delete-confirm .choco-widget-sheet-delete-confirm{display:block}.choco-widget-sheet-delete-confirm-text{margin:0 0 24px;font-size:16px;line-height:1.4;color:#242424;text-align:center}.choco-widget-sheet-delete-confirm-actions{display:flex;gap:12px}.choco-widget-delete-confirm-btn{flex:1;padding:14px 20px;font-size:16px;font-weight:600;font-family:inherit;border-radius:16px;border:none;cursor:pointer;transition:background .2s ease,opacity .2s ease}.choco-widget-delete-confirm-btn--cancel{background:#f1f2f7;color:#242424}.choco-widget-delete-confirm-btn--delete{background:var(--choco-widget-accent-color);color:#fff}.choco-widget-delete-confirm-btn--loading{cursor:not-allowed;pointer-events:none;position:relative}.choco-widget-sheet-delete-confirm-actions.choco-widget-sheet-delete-confirm-actions--loading .choco-widget-delete-confirm-btn{pointer-events:none;cursor:not-allowed;opacity:.7}.choco-widget-delete-confirm-btn--delete.choco-widget-delete-confirm-btn--loading:before{content:"";display:block;width:16px;height:16px;border:2px solid #ffffff;border-top:2px solid transparent;border-radius:50%;animation:choco-spin 1s linear infinite;position:absolute;left:0;right:0;margin:0 auto;z-index:2}.choco-widget-delete-confirm-btn--delete.choco-widget-delete-confirm-btn--loading:after{content:"";display:block;width:100%;height:100%;background:#cc3434;position:absolute;left:0;top:0;border-radius:16px}.choco-widget-add-card-sheet{align-items:stretch}.choco-widget-add-card-sheet .choco-widget-add-card-sheet-content{max-height:none;height:100%;display:flex;flex-direction:column;transform:none;border-radius:0;padding:0}.choco-widget-add-card-sheet--open .choco-widget-add-card-sheet-content{transform:none}.choco-widget-add-card-sheet .choco-widget-sheet-header{flex-shrink:0;margin-bottom:0;padding:12px 0;border-bottom:1px solid #eee}.choco-widget-add-card-iframe-wrapper{flex:1;min-height:0;background:#fff}.choco-widget-add-card-iframe{width:100%;height:100%;border:none;display:block}.choco-widget-balance-section{margin-bottom:12px;padding:12px 8px;background:#f1f2f7;border-radius:12px;transition:transform .22s ease,opacity .2s ease}.choco-widget-balance-section.disabled{opacity:.5;pointer-events:none}.choco-widget-balance-toggle{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;padding:4px 0}.choco-widget-balance-toggle:last-child{margin-bottom:0}.choco-widget-balance-info{display:flex;align-items:center;gap:12px}.choco-widget-balance-text{display:flex;flex-direction:column}.choco-widget-balance-label-wrapper{display:flex;align-items:center;gap:8px}.choco-widget-balance-label{font-size:16px;font-weight:500}.choco-widget-balance-sublabel{font-size:12px;color:#767485;margin-top:2px}.choco-widget-balance-icon{width:22px;height:22px}.choco-widget-balance-amount{font-size:16px;font-weight:500;color:#000}.choco-widget-toggle{position:relative;display:inline-block;width:42px;height:26px}.choco-widget-toggle input{opacity:0;width:0;height:0}.choco-widget-toggle-slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#d4d3df;transition:.3s;border-radius:28px}.choco-widget-toggle-slider:before{position:absolute;content:"";height:22px;width:22px;left:2px;bottom:0;top:0;margin:auto;background-color:#fff;transition:.3s;border-radius:50%}.choco-widget-toggle input:checked+.choco-widget-toggle-slider{background-color:var(--choco-widget-accent-color)}.choco-widget-toggle input:checked+.choco-widget-toggle-slider:before{transform:translate(16px)}.choco-widget-cashback-section{margin-top:20px;padding-top:20px;border-top:1px solid #f0f0f0}.choco-widget-cashback-info{display:flex;align-items:center;gap:8px;padding:12px 16px;background:#fff5ee;border-radius:12px;font-size:14px;color:#ff6b00}.choco-widget-cashback-icon{font-size:20px}.choco-widget-cashback-text strong{font-weight:700}.choco-widget-payment-methods{display:flex;flex-direction:column;gap:8px}.choco-widget-method-item{display:flex;align-items:center;gap:12px;padding:10px 0;cursor:pointer;transition:all .2s ease;border:2px solid transparent;width:100%;border:0;background:none;text-align:left;font-family:inherit;font-size:inherit}.choco-widget-method-item-icon-wrapper{width:37px}.choco-widget-method-item-icon-wrapper svg{display:block;width:100%;max-width:29px;height:29px;margin:0 auto}.choco-widget-method-item-icon-wrapper.google_pay{outline:1px solid #3C4043;padding:3px 5px 2px;border-radius:15px}.choco-widget-method-item-icon-wrapper.google_pay svg{height:15px;max-width:29px}.choco-widget-method-item-label{flex:1;font-size:16px;color:#000}.choco-widget-method-item-check,.choco-widget-method-item-trash-btn{flex-shrink:0;display:flex;align-items:center;justify-content:center;padding:6px;margin:-6px 0 -6px 6px;background:none;border:none;cursor:pointer;border-radius:8px;-webkit-tap-highlight-color:transparent}.choco-widget-method-item-check{height:30px;width:30px}.choco-widget-method-item-trash-btn:hover{background:#cc343414}.choco-widget-method-item-trash{flex-shrink:0;width:20px;height:20px}.choco-widget-bottom-bar-prerender{position:absolute;bottom:0;left:0;right:0;background:#fff;border-radius:24px 24px 0 0;box-shadow:0 -4px 20px #0000001a;transition:transform .3s cubic-bezier(.4,0,.2,1);height:78px}.choco-widget-payment-loading{width:30px;height:30px;animation:choco-spin 1s linear infinite;border:3px solid var(--choco-widget-accent-color);border-top:3px solid transparent;border-radius:50%;position:absolute;top:0;bottom:0;left:0;right:0;margin:auto}@keyframes choco-spin{to{transform:rotate(360deg)}}@keyframes choco-fade-in{0%{opacity:0;transform:translate(-50%,-50%) scale(.9)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}@media(max-width:768px){.choco-widget-bottom-bar{padding:16px 16px 20px}.choco-widget-sheet-content{max-height:80vh}.choco-widget-sheet-title{font-size:18px}.choco-widget-method-item-label{font-size:17px}}@media(max-width:768px)and (min-height:812px){.choco-widget-bottom-bar,.choco-widget-sheet-content{padding-bottom:calc(20px + env(safe-area-inset-bottom,20px))}}@supports (padding: env(safe-area-inset-bottom)){.choco-widget-bottom-bar{padding-bottom:calc(16px + env(safe-area-inset-bottom))}.choco-widget-sheet-content{padding-bottom:calc(20px + env(safe-area-inset-bottom))}}')),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.choco-one-click-widget{position:fixed;top:0;left:0;right:0;bottom:0;z-index:999999;font-family:Sirius,sans-serif;--choco-widget-accent-color: #2F2F2F;pointer-events:none}.choco-one-click-widget--embedded{position:static;top:auto;left:auto;right:auto;bottom:auto;z-index:auto;pointer-events:auto;min-height:1px}.choco-one-click-widget--embedded .choco-widget-bottom-bar{position:static;box-shadow:none;border-radius:24px}.choco-one-click-widget--embedded .choco-widget-payment-sheet{position:fixed}.choco-one-click-widget *{box-sizing:border-box;font-family:Sirius,sans-serif}.choco-one-click-widget .choco-widget-bottom-bar{opacity:0;transform:translateY(16px)}.choco-one-click-widget .choco-widget-balance-section,.choco-one-click-widget .choco-widget-payment-info{opacity:0;transform:translateY(8px)}.choco-one-click-widget--visible .choco-widget-bottom-bar,.choco-one-click-widget--visible .choco-widget-balance-section,.choco-one-click-widget--visible .choco-widget-payment-info{opacity:1;transform:translateY(0)}.choco-widget-bottom-bar{position:absolute;bottom:0;left:0;right:0;background:#fff;border-radius:24px 24px 0 0;padding:16px;box-shadow:0 -4px 20px #0000001a;transition:transform .24s cubic-bezier(.4,0,.2,1),opacity .2s ease;pointer-events:auto}.choco-widget-payment-info{display:flex;flex-direction:column;gap:12px;align-items:stretch;transition:transform .22s ease,opacity .2s ease}.choco-widget-payment-info-main{display:flex;gap:12px;align-items:center}.choco-widget-payment-method{gap:12px;background:#f1f2f7;border-radius:16px;padding:5px 8px;cursor:pointer;transition:background .2s ease;border:none;font-family:inherit;text-align:left;width:100%;position:relative;height:46px}.choco-widget-payment-method:disabled{cursor:not-allowed;pointer-events:none;opacity:.5}.choco-widget-payment-method.google_pay,.choco-widget-payment-method.apple_pay{max-width:140px}.choco-widget-method-icon-placeholder{font-size:24px}.choco-widget-method-details{flex:1}.choco-widget-method-label{font-size:14px;color:#000}.choco-widget-method-value{font-size:14px;font-weight:600;color:#000;display:flex;align-items:center;gap:4px}.choco-widget-method-icon-wrapper svg{display:block;width:100%;max-width:29px;max-height:18px;margin-top:2px}.choco-widget-method-icon-wrapper:empty{display:none}.choco-widget-method-icon-wrapper.google_pay svg{height:17px;max-width:35px;border:1px solid #3C4043;padding:3px 4px 2px;border-radius:8px}.choco-widget-method-name{font-size:14px;font-weight:700}.choco-widget-method-name.google_pay,.choco-widget-method-name.apple_pay{display:none}.choco-widget-method-chevron{position:absolute;right:5px;top:0;bottom:0;margin:auto 0;width:24px;height:24px}.choco-widget-pay-button{background:var(--choco-widget-accent-color);color:#fff;border:none;border-radius:16px;height:46px;padding:0 16px;font-size:16px;font-weight:600;cursor:pointer;transition:all .2s ease;white-space:nowrap;width:100%;overflow:hidden}.choco-widget-pay-button--loading{cursor:not-allowed;pointer-events:none;position:relative}.choco-widget-pay-button--loading:before{content:"";display:block;width:16px;height:16px;border:2px solid #ffffff;border-top:2px solid transparent;border-radius:50%;animation:choco-spin 1s linear infinite;position:absolute;left:0;right:0;margin:0 auto;z-index:2}.choco-widget-pay-button--loading:after{content:"";display:block;width:100%;height:100%;background:#2f2f2f;position:absolute;left:0;top:0}.choco-widget-pay-button:disabled{opacity:.5;pointer-events:none}.choco-widget-pay-button--hidden{display:none}.choco-widget-google-pay-amount{min-width:124px;height:46px;display:flex;flex-direction:column;justify-content:center;text-align:right;width:100%}.choco-widget-google-pay-amount--hidden{display:none}.choco-widget-google-pay-amount-label{font-size:20px;font-weight:700;line-height:24px;color:#1d1d1d}.choco-widget-google-pay-amount-value{font-size:14px;line-height:18px;color:#1d1d1d;white-space:nowrap;opacity:.5}.choco-widget-google-pay-amount-value--hidden{display:none}.choco-widget-google-pay-amount-value-number{text-decoration:line-through}.choco-widget-google-pay-row--hidden{display:none}.choco-widget-wallet-blocked{pointer-events:none;opacity:.6}.choco-widget-google-pay-button-slot{width:100%}.choco-widget-google-pay-button-slot>button{width:100%!important;height:52px;min-height:52px;border-radius:12px!important;font-size:16px!important}.choco-widget-apple-pay-row--hidden{display:none}.choco-widget-apple-pay-button-slot{width:100%}.choco-widget-apple-pay-button-wrapper{position:relative;width:100%;height:52px}.choco-widget-apple-pay-button{width:100%;height:52px;min-height:52px;border:0;border-radius:12px;cursor:pointer;background:#000;color:#fff;font-size:16px;display:flex;align-items:center;justify-content:center;gap:8px;padding:0 16px}.choco-widget-apple-pay-button--native{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:52px;opacity:.01;z-index:2}.choco-widget-apple-pay-button-overlay{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;gap:8px;background:#000;border-radius:12px;pointer-events:none;z-index:1}.choco-widget-apple-pay-button-text{font-size:16px;line-height:20px;font-weight:600;color:#fff}.choco-widget-apple-pay-button-icon{display:inline-flex;align-items:center;justify-content:center}.choco-widget-payment-sheet{position:absolute;bottom:0;left:0;right:0;top:0;background:#00000080;display:flex;align-items:flex-end;opacity:0;pointer-events:none;transition:opacity .3s ease}.choco-widget-payment-sheet--open{opacity:1;pointer-events:auto}.choco-widget-payment-sheet--open .choco-widget-sheet-content{transform:translateY(0)}.choco-widget-sheet-content{background:#fff;border-radius:24px 24px 0 0;width:100%;max-height:70vh;overflow-y:auto;transform:translateY(100%);transition:transform .3s cubic-bezier(.4,0,.2,1);padding:8px 16px 16px;position:relative;will-change:transform}.choco-widget-sheet-content--dragging{transition:none}.choco-widget-sheet-grabber{flex-shrink:0;display:flex;align-items:center;justify-content:center;cursor:grab;touch-action:none;margin-bottom:8px;-webkit-user-select:none;user-select:none}.choco-widget-sheet-grabber:active{cursor:grabbing}.choco-widget-sheet-grabber:before{content:"";width:72px;height:6px;background:#e5e5e7;border-radius:42px}.choco-widget-sheet-content{-webkit-overflow-scrolling:touch;overscroll-behavior:contain}.choco-widget-sheet-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;position:relative}.choco-widget-sheet-title{font-size:20px;font-weight:700;color:#000;margin:0;flex:1;text-align:center}.choco-widget-payment-sheet--edit .choco-widget-sheet-title{padding-left:30px}.choco-widget-payment-sheet--no-cards .choco-widget-sheet-title{padding-right:30px}.choco-widget-payment-sheet--delete-confirm .choco-widget-sheet-title{padding:0}.choco-widget-sheet-button{background:none;border:none;width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;padding:0}.choco-widget-sheet-button svg{color:#000}.choco-widget-sheet-delete-confirm{display:none;padding-top:16px}.choco-widget-payment-sheet--delete-confirm .choco-widget-payment-methods,.choco-widget-payment-sheet--delete-confirm .choco-widget-cashback-section{display:none!important}.choco-widget-payment-sheet--delete-confirm .choco-widget-sheet-delete-confirm{display:block}.choco-widget-sheet-delete-confirm-text{margin:0 0 24px;font-size:16px;line-height:1.4;color:#242424;text-align:center}.choco-widget-sheet-delete-confirm-actions{display:flex;gap:12px}.choco-widget-delete-confirm-btn{flex:1;padding:14px 20px;font-size:16px;font-weight:600;font-family:inherit;border-radius:16px;border:none;cursor:pointer;transition:background .2s ease,opacity .2s ease}.choco-widget-delete-confirm-btn--cancel{background:#f1f2f7;color:#242424}.choco-widget-delete-confirm-btn--delete{background:var(--choco-widget-accent-color);color:#fff}.choco-widget-delete-confirm-btn--loading{cursor:not-allowed;pointer-events:none;position:relative}.choco-widget-sheet-delete-confirm-actions.choco-widget-sheet-delete-confirm-actions--loading .choco-widget-delete-confirm-btn{pointer-events:none;cursor:not-allowed;opacity:.7}.choco-widget-delete-confirm-btn--delete.choco-widget-delete-confirm-btn--loading:before{content:"";display:block;width:16px;height:16px;border:2px solid #ffffff;border-top:2px solid transparent;border-radius:50%;animation:choco-spin 1s linear infinite;position:absolute;left:0;right:0;margin:0 auto;z-index:2}.choco-widget-delete-confirm-btn--delete.choco-widget-delete-confirm-btn--loading:after{content:"";display:block;width:100%;height:100%;background:#cc3434;position:absolute;left:0;top:0;border-radius:16px}.choco-widget-add-card-sheet{align-items:stretch}.choco-widget-add-card-sheet .choco-widget-add-card-sheet-content{max-height:none;height:100%;display:flex;flex-direction:column;transform:none;border-radius:0;padding:0}.choco-widget-add-card-sheet--open .choco-widget-add-card-sheet-content{transform:none}.choco-widget-add-card-sheet .choco-widget-sheet-header{flex-shrink:0;margin-bottom:0;padding:12px 0;border-bottom:1px solid #eee}.choco-widget-add-card-iframe-wrapper{flex:1;min-height:0;background:#fff}.choco-widget-add-card-iframe{width:100%;height:100%;border:none;display:block}.choco-widget-balance-section{margin-bottom:12px;padding:12px 8px;background:#f1f2f7;border-radius:12px;transition:transform .22s ease,opacity .2s ease}.choco-widget-balance-section.disabled{opacity:.5;pointer-events:none}.choco-widget-balance-toggle{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;padding:4px 0}.choco-widget-balance-toggle:last-child{margin-bottom:0}.choco-widget-balance-info{display:flex;align-items:center;gap:12px}.choco-widget-balance-text{display:flex;flex-direction:column}.choco-widget-balance-label-wrapper{display:flex;align-items:center;gap:8px}.choco-widget-balance-label{font-size:16px;font-weight:500}.choco-widget-balance-sublabel{font-size:12px;color:#767485;margin-top:2px}.choco-widget-balance-icon{width:22px;height:22px}.choco-widget-balance-amount{font-size:16px;font-weight:500;color:#000;white-space:nowrap}.choco-widget-toggle{position:relative;display:inline-block;width:42px;height:26px}.choco-widget-toggle input{opacity:0;width:0;height:0}.choco-widget-toggle-slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#d4d3df;transition:.3s;border-radius:28px}.choco-widget-toggle-slider:before{position:absolute;content:"";height:22px;width:22px;left:2px;bottom:0;top:0;margin:auto;background-color:#fff;transition:.3s;border-radius:50%}.choco-widget-toggle input:checked+.choco-widget-toggle-slider{background-color:var(--choco-widget-accent-color)}.choco-widget-toggle input:checked+.choco-widget-toggle-slider:before{transform:translate(16px)}.choco-widget-cashback-section{margin-top:20px;padding-top:20px;border-top:1px solid #f0f0f0}.choco-widget-cashback-info{display:flex;align-items:center;gap:8px;padding:12px 16px;background:#fff5ee;border-radius:12px;font-size:14px;color:#ff6b00}.choco-widget-cashback-icon{font-size:20px}.choco-widget-cashback-text strong{font-weight:700}.choco-widget-payment-methods{display:flex;flex-direction:column;gap:8px}.choco-widget-method-item{display:flex;align-items:center;gap:12px;padding:10px 0;cursor:pointer;transition:all .2s ease;border:2px solid transparent;width:100%;border:0;background:none;text-align:left;font-family:inherit;font-size:inherit}.choco-widget-method-item-icon-wrapper{width:37px}.choco-widget-method-item-icon-wrapper svg{display:block;width:100%;max-width:29px;height:29px;margin:0 auto}.choco-widget-method-item-icon-wrapper.google_pay{outline:1px solid #3C4043;padding:3px 5px 2px;border-radius:15px}.choco-widget-method-item-icon-wrapper.google_pay svg{height:15px;max-width:29px}.choco-widget-method-item-label{flex:1;font-size:16px;color:#000}.choco-widget-method-item-check,.choco-widget-method-item-trash-btn{flex-shrink:0;display:flex;align-items:center;justify-content:center;padding:6px;margin:-6px 0 -6px 6px;background:none;border:none;cursor:pointer;border-radius:8px;-webkit-tap-highlight-color:transparent}.choco-widget-method-item-check{height:30px;width:30px}.choco-widget-method-item-trash-btn:hover{background:#cc343414}.choco-widget-method-item-trash{flex-shrink:0;width:20px;height:20px}.choco-widget-bottom-bar-prerender{position:absolute;bottom:0;left:0;right:0;background:#fff;border-radius:24px 24px 0 0;box-shadow:0 -4px 20px #0000001a;transition:transform .3s cubic-bezier(.4,0,.2,1);height:78px}.choco-widget-payment-loading{width:30px;height:30px;animation:choco-spin 1s linear infinite;border:3px solid var(--choco-widget-accent-color);border-top:3px solid transparent;border-radius:50%;position:absolute;top:0;bottom:0;left:0;right:0;margin:auto}@keyframes choco-spin{to{transform:rotate(360deg)}}@keyframes choco-fade-in{0%{opacity:0;transform:translate(-50%,-50%) scale(.9)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}@media(max-width:768px){.choco-widget-bottom-bar{padding:16px 16px 20px}.choco-widget-sheet-content{max-height:80vh}.choco-widget-sheet-title{font-size:18px}.choco-widget-method-item-label{font-size:17px}}@media(max-width:768px)and (min-height:812px){.choco-widget-bottom-bar,.choco-widget-sheet-content{padding-bottom:calc(20px + env(safe-area-inset-bottom,20px))}}@supports (padding: env(safe-area-inset-bottom)){.choco-widget-bottom-bar{padding-bottom:calc(16px + env(safe-area-inset-bottom))}.choco-widget-sheet-content{padding-bottom:calc(20px + env(safe-area-inset-bottom))}}')),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
2
|
const mt = {
|
|
3
3
|
ru: {
|
|
4
4
|
paymentMethod: "Способ оплаты",
|
|
@@ -172,31 +172,31 @@ for (let e = 0; e < 256; ++e)
|
|
|
172
172
|
function It(e, t = 0) {
|
|
173
173
|
return H[e[t + 0]] + H[e[t + 1]] + H[e[t + 2]] + H[e[t + 3]] + "-" + H[e[t + 4]] + H[e[t + 5]] + "-" + H[e[t + 6]] + H[e[t + 7]] + "-" + H[e[t + 8]] + H[e[t + 9]] + "-" + H[e[t + 10]] + H[e[t + 11]] + H[e[t + 12]] + H[e[t + 13]] + H[e[t + 14]] + H[e[t + 15]];
|
|
174
174
|
}
|
|
175
|
-
const Qt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto),
|
|
175
|
+
const Qt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Ke = {
|
|
176
176
|
randomUUID: Qt
|
|
177
177
|
};
|
|
178
178
|
function Be(e, t, o) {
|
|
179
|
-
if (
|
|
180
|
-
return
|
|
179
|
+
if (Ke.randomUUID && !e)
|
|
180
|
+
return Ke.randomUUID();
|
|
181
181
|
e = e || {};
|
|
182
182
|
const i = e.random || (e.rng || Bt)();
|
|
183
183
|
return i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, It(i);
|
|
184
184
|
}
|
|
185
|
-
const
|
|
186
|
-
function
|
|
185
|
+
const We = "choco_device_id";
|
|
186
|
+
function V(e, t = "ru", o = "KZT") {
|
|
187
187
|
const i = Number(e), s = t === "ru" ? "ru-RU" : "en-US";
|
|
188
188
|
return `${i.toLocaleString(s)} ${bt[o]}`;
|
|
189
189
|
}
|
|
190
|
-
function
|
|
191
|
-
let e = localStorage.getItem(
|
|
192
|
-
return e || (e = Be(), localStorage.setItem(
|
|
190
|
+
function rt() {
|
|
191
|
+
let e = localStorage.getItem(We);
|
|
192
|
+
return e || (e = Be(), localStorage.setItem(We, e)), e;
|
|
193
193
|
}
|
|
194
194
|
function Ce() {
|
|
195
195
|
if (typeof window > "u") return !1;
|
|
196
196
|
const e = window.safari !== void 0, t = window.navigator.userAgent || "", o = !!t.match(/iPad/i) || !!t.match(/iPhone/i), i = !!t.match(/WebKit/i), s = o && i && !t.match(/CriOS/i);
|
|
197
197
|
return e || s;
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function ot() {
|
|
200
200
|
if (typeof navigator > "u") return 0;
|
|
201
201
|
const e = navigator.userAgent || "", t = e.indexOf("OS");
|
|
202
202
|
return (e.indexOf("iPhone") > -1 || e.indexOf("iPad") > -1) && t > -1 ? Number(e.substring(t + 3, t + 6).replace("_", ".")) : 0;
|
|
@@ -220,9 +220,9 @@ function me(e) {
|
|
|
220
220
|
function St(e) {
|
|
221
221
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
222
222
|
}
|
|
223
|
-
var fe = { exports: {} }, Pt = fe.exports,
|
|
223
|
+
var fe = { exports: {} }, Pt = fe.exports, Ve;
|
|
224
224
|
function kt() {
|
|
225
|
-
return
|
|
225
|
+
return Ve || (Ve = 1, (function(e, t) {
|
|
226
226
|
(function(i, s) {
|
|
227
227
|
e.exports = s();
|
|
228
228
|
})(Pt, function() {
|
|
@@ -233,10 +233,10 @@ function kt() {
|
|
|
233
233
|
/***/
|
|
234
234
|
382: (
|
|
235
235
|
/***/
|
|
236
|
-
(function(a,
|
|
237
|
-
Object.defineProperty(
|
|
236
|
+
(function(a, l, f) {
|
|
237
|
+
Object.defineProperty(l, "__esModule", {
|
|
238
238
|
value: !0
|
|
239
|
-
}),
|
|
239
|
+
}), l.Centrifuge = void 0;
|
|
240
240
|
var C = P(f(187)), S = P(f(471)), _ = f(147), E = f(853);
|
|
241
241
|
function P(g) {
|
|
242
242
|
return g && g.__esModule ? g : { default: g };
|
|
@@ -388,9 +388,9 @@ function kt() {
|
|
|
388
388
|
}
|
|
389
389
|
}, {
|
|
390
390
|
key: "_ajax",
|
|
391
|
-
value: function(n, r, c,
|
|
391
|
+
value: function(n, r, c, d, y) {
|
|
392
392
|
var v = this, Q = "";
|
|
393
|
-
this._debug("sending AJAX request to", n, "with data", JSON.stringify(
|
|
393
|
+
this._debug("sending AJAX request to", n, "with data", JSON.stringify(d));
|
|
394
394
|
var I;
|
|
395
395
|
this._xmlhttprequest !== null ? I = new this._xmlhttprequest() : I = f.g.XMLHttpRequest ? new f.g.XMLHttpRequest() : new f.g.ActiveXObject("Microsoft.XMLHTTP");
|
|
396
396
|
for (var R in r)
|
|
@@ -421,7 +421,7 @@ function kt() {
|
|
|
421
421
|
data: null
|
|
422
422
|
});
|
|
423
423
|
}, setTimeout(function() {
|
|
424
|
-
return I.send(JSON.stringify(
|
|
424
|
+
return I.send(JSON.stringify(d));
|
|
425
425
|
}, 20), I;
|
|
426
426
|
}
|
|
427
427
|
}, {
|
|
@@ -536,10 +536,10 @@ function kt() {
|
|
|
536
536
|
if (this._callbacks.hasOwnProperty(r)) {
|
|
537
537
|
var c = this._callbacks[r];
|
|
538
538
|
clearTimeout(c.timeout);
|
|
539
|
-
var
|
|
540
|
-
if (!
|
|
539
|
+
var d = c.errback;
|
|
540
|
+
if (!d)
|
|
541
541
|
continue;
|
|
542
|
-
|
|
542
|
+
d({
|
|
543
543
|
error: this._createErrorObject("disconnected")
|
|
544
544
|
});
|
|
545
545
|
}
|
|
@@ -568,9 +568,9 @@ function kt() {
|
|
|
568
568
|
for (var r in n) {
|
|
569
569
|
var c = r.id;
|
|
570
570
|
if (c in this._callbacks) {
|
|
571
|
-
var
|
|
571
|
+
var d = this._callbacks[c];
|
|
572
572
|
clearTimeout(this._callbacks[c].timeout), delete this._callbacks[c];
|
|
573
|
-
var y =
|
|
573
|
+
var y = d.errback;
|
|
574
574
|
y({
|
|
575
575
|
error: this._createErrorObject(M, 0)
|
|
576
576
|
});
|
|
@@ -605,10 +605,10 @@ function kt() {
|
|
|
605
605
|
n._transportClosed = !1, n._isSockjs ? (n._transportName = "sockjs-" + n._transport.transport, n._transport.onheartbeat = function() {
|
|
606
606
|
return n._restartPing();
|
|
607
607
|
}) : n._transportName = "websocket";
|
|
608
|
-
var
|
|
608
|
+
var d = {
|
|
609
609
|
// method: this._methodType.CONNECT
|
|
610
610
|
};
|
|
611
|
-
(n._token || n._connectData || n._config.name || n._config.version) && (
|
|
611
|
+
(n._token || n._connectData || n._config.name || n._config.version) && (d.params = {}), n._token && (d.params.token = n._token), n._connectData && (d.params.data = n._connectData), n._config.name && (d.params.name = n._config.name), n._config.version && (d.params.version = n._config.version);
|
|
612
612
|
var y = {}, v = !1;
|
|
613
613
|
for (var Q in n._serverSubs)
|
|
614
614
|
if (n._serverSubs.hasOwnProperty(Q) && n._serverSubs[Q].recoverable) {
|
|
@@ -618,26 +618,26 @@ function kt() {
|
|
|
618
618
|
};
|
|
619
619
|
n._serverSubs[Q].seq || n._serverSubs[Q].gen ? (n._serverSubs[Q].seq && (I.seq = n._serverSubs[Q].seq), n._serverSubs[Q].gen && (I.gen = n._serverSubs[Q].gen)) : n._serverSubs[Q].offset && (I.offset = n._serverSubs[Q].offset), n._serverSubs[Q].epoch && (I.epoch = n._serverSubs[Q].epoch), y[Q] = I;
|
|
620
620
|
}
|
|
621
|
-
v && (
|
|
621
|
+
v && (d.params || (d.params = {}), d.params.subs = y), n._latencyStart = /* @__PURE__ */ new Date(), n._call(d).then(function(R) {
|
|
622
622
|
n._connectResponse(n._decoder.decodeCommandResult(n._methodType.CONNECT, R.result), v), R.next && R.next();
|
|
623
623
|
}, function(R) {
|
|
624
624
|
var X = R.error;
|
|
625
625
|
X.code === 109 && (n._refreshRequired = !0), n._disconnect("connect error", !0), R.next && R.next();
|
|
626
626
|
});
|
|
627
|
-
}, this._transport.onerror = function(
|
|
628
|
-
n._debug("transport level error",
|
|
629
|
-
}, this._transport.onclose = function(
|
|
627
|
+
}, this._transport.onerror = function(d) {
|
|
628
|
+
n._debug("transport level error", d);
|
|
629
|
+
}, this._transport.onclose = function(d) {
|
|
630
630
|
n._transportClosed = !0;
|
|
631
631
|
var y = M, v = !0;
|
|
632
|
-
if (
|
|
632
|
+
if (d && "reason" in d && d.reason)
|
|
633
633
|
try {
|
|
634
|
-
var Q = JSON.parse(
|
|
634
|
+
var Q = JSON.parse(d.reason);
|
|
635
635
|
n._debug("reason is an advice object", Q), y = Q.reason, v = Q.reconnect;
|
|
636
636
|
} catch {
|
|
637
|
-
y =
|
|
637
|
+
y = d.reason, n._debug("reason is a plain string", y);
|
|
638
638
|
}
|
|
639
639
|
if (n._config.onTransportClose !== null && n._config.onTransportClose({
|
|
640
|
-
event:
|
|
640
|
+
event: d,
|
|
641
641
|
reason: y,
|
|
642
642
|
reconnect: v
|
|
643
643
|
}), n._disconnect(y, v), n._reconnect === !0) {
|
|
@@ -647,8 +647,8 @@ function kt() {
|
|
|
647
647
|
n._reconnect === !0 && (n._refreshRequired ? n._refresh() : n._connect());
|
|
648
648
|
}, I);
|
|
649
649
|
}
|
|
650
|
-
}, this._transport.onmessage = function(
|
|
651
|
-
n._dataReceived(
|
|
650
|
+
}, this._transport.onmessage = function(d) {
|
|
651
|
+
n._dataReceived(d.data);
|
|
652
652
|
};
|
|
653
653
|
}
|
|
654
654
|
}, {
|
|
@@ -668,11 +668,11 @@ function kt() {
|
|
|
668
668
|
data: r
|
|
669
669
|
};
|
|
670
670
|
n !== "" && (c.method = n);
|
|
671
|
-
var
|
|
671
|
+
var d = {
|
|
672
672
|
method: this._methodType.RPC,
|
|
673
673
|
params: c
|
|
674
674
|
};
|
|
675
|
-
return this._methodCall(
|
|
675
|
+
return this._methodCall(d, function(y) {
|
|
676
676
|
return y;
|
|
677
677
|
});
|
|
678
678
|
}
|
|
@@ -704,9 +704,9 @@ function kt() {
|
|
|
704
704
|
key: "_methodCall",
|
|
705
705
|
value: function(n, r) {
|
|
706
706
|
var c = this;
|
|
707
|
-
return this.isConnected() ? new Promise(function(
|
|
707
|
+
return this.isConnected() ? new Promise(function(d, y) {
|
|
708
708
|
c._call(n).then(function(v) {
|
|
709
|
-
|
|
709
|
+
d(r(c._decoder.decodeCommandResult(n.method, v.result))), v.next && v.next();
|
|
710
710
|
}, function(v) {
|
|
711
711
|
y(v.error), v.next && v.next();
|
|
712
712
|
});
|
|
@@ -729,11 +729,11 @@ function kt() {
|
|
|
729
729
|
}, {
|
|
730
730
|
key: "history",
|
|
731
731
|
value: function(n, r) {
|
|
732
|
-
var c = this._getHistoryParams(n, r),
|
|
732
|
+
var c = this._getHistoryParams(n, r), d = {
|
|
733
733
|
method: this._methodType.HISTORY,
|
|
734
734
|
params: c
|
|
735
735
|
};
|
|
736
|
-
return this._methodCall(
|
|
736
|
+
return this._methodCall(d, function(y) {
|
|
737
737
|
return {
|
|
738
738
|
publications: y.publications,
|
|
739
739
|
epoch: y.epoch || "",
|
|
@@ -777,23 +777,23 @@ function kt() {
|
|
|
777
777
|
value: function(n) {
|
|
778
778
|
var r = this, c = this._decoder.decodeReplies(n);
|
|
779
779
|
this._dispatchPromise = this._dispatchPromise.then(function() {
|
|
780
|
-
var
|
|
780
|
+
var d;
|
|
781
781
|
r._dispatchPromise = new Promise(function(y) {
|
|
782
|
-
|
|
783
|
-
}), r._dispatchSynchronized(c,
|
|
782
|
+
d = y;
|
|
783
|
+
}), r._dispatchSynchronized(c, d);
|
|
784
784
|
}), this._restartPing();
|
|
785
785
|
}
|
|
786
786
|
}, {
|
|
787
787
|
key: "_dispatchSynchronized",
|
|
788
788
|
value: function(n, r) {
|
|
789
|
-
var c = this,
|
|
790
|
-
n.hasOwnProperty(I) && (
|
|
789
|
+
var c = this, d = Promise.resolve(), y = function(I) {
|
|
790
|
+
n.hasOwnProperty(I) && (d = d.then(function() {
|
|
791
791
|
return c._dispatchReply(n[I]);
|
|
792
792
|
}));
|
|
793
793
|
};
|
|
794
794
|
for (var v in n)
|
|
795
795
|
y(v);
|
|
796
|
-
|
|
796
|
+
d = d.then(function() {
|
|
797
797
|
r();
|
|
798
798
|
});
|
|
799
799
|
}
|
|
@@ -805,16 +805,16 @@ function kt() {
|
|
|
805
805
|
});
|
|
806
806
|
if (n == null)
|
|
807
807
|
return this._debug("dispatch: got undefined or null reply"), r(), c;
|
|
808
|
-
var
|
|
809
|
-
return
|
|
808
|
+
var d = n.id;
|
|
809
|
+
return d && d > 0 ? this._handleReply(n, r) : this._handlePush(n.result, r), c;
|
|
810
810
|
}
|
|
811
811
|
}, {
|
|
812
812
|
key: "_call",
|
|
813
813
|
value: function(n) {
|
|
814
814
|
var r = this;
|
|
815
|
-
return new Promise(function(c,
|
|
815
|
+
return new Promise(function(c, d) {
|
|
816
816
|
var y = r._addMessage(n);
|
|
817
|
-
r._registerCall(y, c,
|
|
817
|
+
r._registerCall(y, c, d);
|
|
818
818
|
});
|
|
819
819
|
}
|
|
820
820
|
}, {
|
|
@@ -835,9 +835,9 @@ function kt() {
|
|
|
835
835
|
return;
|
|
836
836
|
}
|
|
837
837
|
if (this._clearConnectedState(c), this._debug("disconnected:", n, r), this._setStatus("disconnected"), this._refreshTimeout && (clearTimeout(this._refreshTimeout), this._refreshTimeout = null), this._reconnecting === !1) {
|
|
838
|
-
for (var
|
|
839
|
-
this._serverSubs.hasOwnProperty(
|
|
840
|
-
channel:
|
|
838
|
+
for (var d in this._serverSubs)
|
|
839
|
+
this._serverSubs.hasOwnProperty(d) && this.emit("unsubscribe", {
|
|
840
|
+
channel: d
|
|
841
841
|
});
|
|
842
842
|
this.emit("disconnect", {
|
|
843
843
|
reason: n,
|
|
@@ -860,7 +860,7 @@ function kt() {
|
|
|
860
860
|
return;
|
|
861
861
|
}
|
|
862
862
|
this._refreshTimeout !== null && (clearTimeout(this._refreshTimeout), this._refreshTimeout = null);
|
|
863
|
-
var r = this._clientID, c = this._newXHRID(),
|
|
863
|
+
var r = this._clientID, c = this._newXHRID(), d = function(I) {
|
|
864
864
|
if (c in n._xhrs && delete n._xhrs[c], n._clientID === r) {
|
|
865
865
|
if (I.error || I.status !== 200) {
|
|
866
866
|
if (I.error ? n._debug("error refreshing connection token", I.error) : n._debug("error refreshing connection token: wrong status code", I.status), n._numRefreshFailed++, n._refreshTimeout !== null && (clearTimeout(n._refreshTimeout), n._refreshTimeout = null), n._config.refreshAttempts !== null && n._numRefreshFailed >= n._config.refreshAttempts) {
|
|
@@ -897,9 +897,9 @@ function kt() {
|
|
|
897
897
|
};
|
|
898
898
|
if (this._config.onRefresh !== null) {
|
|
899
899
|
var y = {};
|
|
900
|
-
this._config.onRefresh(y,
|
|
900
|
+
this._config.onRefresh(y, d);
|
|
901
901
|
} else {
|
|
902
|
-
var v = this._ajax(this._config.refreshEndpoint, this._config.refreshParams, this._config.refreshHeaders, this._config.refreshData,
|
|
902
|
+
var v = this._ajax(this._config.refreshEndpoint, this._config.refreshParams, this._config.refreshHeaders, this._config.refreshData, d);
|
|
903
903
|
this._xhrs[c] = v;
|
|
904
904
|
}
|
|
905
905
|
}
|
|
@@ -934,8 +934,8 @@ function kt() {
|
|
|
934
934
|
this._clearSubRefreshTimeout(n);
|
|
935
935
|
else
|
|
936
936
|
return;
|
|
937
|
-
var c = this._clientID,
|
|
938
|
-
if (
|
|
937
|
+
var c = this._clientID, d = this._newXHRID(), y = function(R) {
|
|
938
|
+
if (d in r._xhrs && delete r._xhrs[d], !(R.error || R.status !== 200 || r._clientID !== c)) {
|
|
939
939
|
var X = {};
|
|
940
940
|
if (R.data.channels)
|
|
941
941
|
for (var U in R.data.channels) {
|
|
@@ -968,7 +968,7 @@ function kt() {
|
|
|
968
968
|
}, y);
|
|
969
969
|
else {
|
|
970
970
|
var Q = this._ajax(this._config.subscribeEndpoint, this._config.subscribeParams, this._config.subscribeHeaders, v, y);
|
|
971
|
-
this._xhrs[
|
|
971
|
+
this._xhrs[d] = Q;
|
|
972
972
|
}
|
|
973
973
|
}
|
|
974
974
|
}, {
|
|
@@ -981,8 +981,8 @@ function kt() {
|
|
|
981
981
|
value: function(n, r) {
|
|
982
982
|
var c = this;
|
|
983
983
|
this._debug("subscription refresh error", n, r), this._clearSubRefreshTimeout(n);
|
|
984
|
-
var
|
|
985
|
-
if (
|
|
984
|
+
var d = this._getSub(n);
|
|
985
|
+
if (d !== null) {
|
|
986
986
|
var y = Math.round(Math.random() * 1e3), v = setTimeout(function() {
|
|
987
987
|
return c._subRefresh(n);
|
|
988
988
|
}, this._config.subRefreshInterval + y);
|
|
@@ -994,8 +994,8 @@ function kt() {
|
|
|
994
994
|
value: function(n, r) {
|
|
995
995
|
var c = this;
|
|
996
996
|
this._debug("subscription refresh success", n), this._clearSubRefreshTimeout(n);
|
|
997
|
-
var
|
|
998
|
-
if (
|
|
997
|
+
var d = this._getSub(n);
|
|
998
|
+
if (d !== null && r.expires === !0) {
|
|
999
999
|
var y = setTimeout(function() {
|
|
1000
1000
|
return c._subRefresh(n);
|
|
1001
1001
|
}, this._getTTLMilliseconds(r.ttl));
|
|
@@ -1007,8 +1007,8 @@ function kt() {
|
|
|
1007
1007
|
value: function(n, r) {
|
|
1008
1008
|
var c = this;
|
|
1009
1009
|
this._debug("subscribing on", n.channel);
|
|
1010
|
-
var
|
|
1011
|
-
if (
|
|
1010
|
+
var d = n.channel;
|
|
1011
|
+
if (d in this._subs || (this._subs[d] = n), !this.isConnected()) {
|
|
1012
1012
|
n._setNew();
|
|
1013
1013
|
return;
|
|
1014
1014
|
}
|
|
@@ -1016,29 +1016,29 @@ function kt() {
|
|
|
1016
1016
|
var y = {
|
|
1017
1017
|
method: this._methodType.SUBSCRIBE,
|
|
1018
1018
|
params: {
|
|
1019
|
-
channel:
|
|
1019
|
+
channel: d
|
|
1020
1020
|
}
|
|
1021
1021
|
};
|
|
1022
|
-
if (n._subscribeData && (y.params.data = n._subscribeData), (0, E.startsWith)(
|
|
1023
|
-
this._isSubscribeBatching ? this._privateChannels[
|
|
1022
|
+
if (n._subscribeData && (y.params.data = n._subscribeData), (0, E.startsWith)(d, this._config.privateChannelPrefix))
|
|
1023
|
+
this._isSubscribeBatching ? this._privateChannels[d] = !0 : (this.startSubscribeBatching(), this._subscribe(n), this.stopSubscribeBatching());
|
|
1024
1024
|
else {
|
|
1025
1025
|
var v = n._needRecover();
|
|
1026
1026
|
if (v === !0) {
|
|
1027
1027
|
y.params.recover = !0;
|
|
1028
|
-
var Q = this._getLastSeq(
|
|
1028
|
+
var Q = this._getLastSeq(d), I = this._getLastGen(d);
|
|
1029
1029
|
if (Q || I)
|
|
1030
1030
|
Q && (y.params.seq = Q), I && (y.params.gen = I);
|
|
1031
1031
|
else {
|
|
1032
|
-
var R = this._getLastOffset(
|
|
1032
|
+
var R = this._getLastOffset(d);
|
|
1033
1033
|
R && (y.params.offset = R);
|
|
1034
1034
|
}
|
|
1035
|
-
var X = this._getLastEpoch(
|
|
1035
|
+
var X = this._getLastEpoch(d);
|
|
1036
1036
|
X && (y.params.epoch = X);
|
|
1037
1037
|
}
|
|
1038
1038
|
this._call(y).then(function(U) {
|
|
1039
|
-
c._subscribeResponse(
|
|
1039
|
+
c._subscribeResponse(d, v, c._decoder.decodeCommandResult(c._methodType.SUBSCRIBE, U.result)), U.next && U.next();
|
|
1040
1040
|
}, function(U) {
|
|
1041
|
-
c._subscribeError(
|
|
1041
|
+
c._subscribeError(d, U.error), U.next && U.next();
|
|
1042
1042
|
});
|
|
1043
1043
|
}
|
|
1044
1044
|
}
|
|
@@ -1076,7 +1076,7 @@ function kt() {
|
|
|
1076
1076
|
}, {
|
|
1077
1077
|
key: "_connectResponse",
|
|
1078
1078
|
value: function(n, r) {
|
|
1079
|
-
var c = this,
|
|
1079
|
+
var c = this, d = this._reconnecting;
|
|
1080
1080
|
if (this._reconnecting = !1, this._resetRetry(), this._refreshRequired = !1, !this.isConnected()) {
|
|
1081
1081
|
this._latencyStart !== null && (this._latency = (/* @__PURE__ */ new Date()).getTime() - this._latencyStart.getTime(), this._latencyStart = null), this._clientID = n.client, this._setStatus("connected"), this._refreshTimeout && clearTimeout(this._refreshTimeout), n.expires && (this._refreshTimeout = setTimeout(function() {
|
|
1082
1082
|
return c._refresh();
|
|
@@ -1084,7 +1084,7 @@ function kt() {
|
|
|
1084
1084
|
for (var y in this._subs)
|
|
1085
1085
|
if (this._subs.hasOwnProperty(y)) {
|
|
1086
1086
|
var v = this._subs[y];
|
|
1087
|
-
v._shouldResubscribe() && this._subscribe(v,
|
|
1087
|
+
v._shouldResubscribe() && this._subscribe(v, d);
|
|
1088
1088
|
}
|
|
1089
1089
|
this.stopSubscribeBatching(), this.stopBatching(), this._startPing();
|
|
1090
1090
|
var Q = {
|
|
@@ -1100,9 +1100,9 @@ function kt() {
|
|
|
1100
1100
|
value: function(n) {
|
|
1101
1101
|
for (var r in n)
|
|
1102
1102
|
if (n.hasOwnProperty(r)) {
|
|
1103
|
-
var c = n[r],
|
|
1103
|
+
var c = n[r], d = this._serverSubs[r] !== void 0, y = {
|
|
1104
1104
|
channel: r,
|
|
1105
|
-
isResubscribe:
|
|
1105
|
+
isResubscribe: d
|
|
1106
1106
|
};
|
|
1107
1107
|
y = this._expandSubscribeContext(y, c), this.emit("subscribe", y);
|
|
1108
1108
|
}
|
|
@@ -1167,12 +1167,12 @@ function kt() {
|
|
|
1167
1167
|
value: function(n, r) {
|
|
1168
1168
|
var c = !1;
|
|
1169
1169
|
"recovered" in r && (c = r.recovered), n.recovered = c;
|
|
1170
|
-
var
|
|
1171
|
-
"positioned" in r && (
|
|
1170
|
+
var d = !1;
|
|
1171
|
+
"positioned" in r && (d = r.positioned);
|
|
1172
1172
|
var y = "";
|
|
1173
1173
|
"epoch" in r && (y = r.epoch);
|
|
1174
1174
|
var v = 0;
|
|
1175
|
-
return "offset" in r && (v = r.offset),
|
|
1175
|
+
return "offset" in r && (v = r.offset), d && (n.streamPosition = {
|
|
1176
1176
|
offset: v,
|
|
1177
1177
|
epoch: y
|
|
1178
1178
|
}), r.data && (n.data = r.data), n;
|
|
@@ -1180,7 +1180,7 @@ function kt() {
|
|
|
1180
1180
|
}, {
|
|
1181
1181
|
key: "_subscribeResponse",
|
|
1182
1182
|
value: function(n, r, c) {
|
|
1183
|
-
var
|
|
1183
|
+
var d = this, y = this._getSub(n);
|
|
1184
1184
|
if (y && y._isSubscribing()) {
|
|
1185
1185
|
y._setSubscribeSuccess(c);
|
|
1186
1186
|
var v = c.publications;
|
|
@@ -1191,7 +1191,7 @@ function kt() {
|
|
|
1191
1191
|
}
|
|
1192
1192
|
if (c.recoverable && (!r || !c.recovered) && (this._lastSeq[n] = c.seq || 0, this._lastGen[n] = c.gen || 0, this._lastOffset[n] = c.offset || 0), this._lastEpoch[n] = c.epoch || "", c.recoverable && (y._recoverable = !0), c.expires === !0) {
|
|
1193
1193
|
var I = setTimeout(function() {
|
|
1194
|
-
return
|
|
1194
|
+
return d._subRefresh(n);
|
|
1195
1195
|
}, this._getTTLMilliseconds(c.ttl));
|
|
1196
1196
|
this._subRefreshTimeouts[n] = I;
|
|
1197
1197
|
}
|
|
@@ -1200,7 +1200,7 @@ function kt() {
|
|
|
1200
1200
|
}, {
|
|
1201
1201
|
key: "_handleReply",
|
|
1202
1202
|
value: function(n, r) {
|
|
1203
|
-
var c = n.id,
|
|
1203
|
+
var c = n.id, d = n.result;
|
|
1204
1204
|
if (!(c in this._callbacks)) {
|
|
1205
1205
|
r();
|
|
1206
1206
|
return;
|
|
@@ -1222,7 +1222,7 @@ function kt() {
|
|
|
1222
1222
|
if (!v)
|
|
1223
1223
|
return;
|
|
1224
1224
|
v({
|
|
1225
|
-
result:
|
|
1225
|
+
result: d,
|
|
1226
1226
|
next: r
|
|
1227
1227
|
});
|
|
1228
1228
|
}
|
|
@@ -1232,34 +1232,34 @@ function kt() {
|
|
|
1232
1232
|
value: function(n, r) {
|
|
1233
1233
|
var c = {
|
|
1234
1234
|
info: r.info
|
|
1235
|
-
},
|
|
1236
|
-
if (!
|
|
1235
|
+
}, d = this._getSub(n);
|
|
1236
|
+
if (!d) {
|
|
1237
1237
|
this._isServerSub(n) && (c.channel = n, this.emit("join", c));
|
|
1238
1238
|
return;
|
|
1239
1239
|
}
|
|
1240
|
-
|
|
1240
|
+
d.emit("join", c);
|
|
1241
1241
|
}
|
|
1242
1242
|
}, {
|
|
1243
1243
|
key: "_handleLeave",
|
|
1244
1244
|
value: function(n, r) {
|
|
1245
1245
|
var c = {
|
|
1246
1246
|
info: r.info
|
|
1247
|
-
},
|
|
1248
|
-
if (!
|
|
1247
|
+
}, d = this._getSub(n);
|
|
1248
|
+
if (!d) {
|
|
1249
1249
|
this._isServerSub(n) && (c.channel = n, this.emit("leave", c));
|
|
1250
1250
|
return;
|
|
1251
1251
|
}
|
|
1252
|
-
|
|
1252
|
+
d.emit("leave", c);
|
|
1253
1253
|
}
|
|
1254
1254
|
}, {
|
|
1255
1255
|
key: "_handleUnsub",
|
|
1256
1256
|
value: function(n, r) {
|
|
1257
|
-
var c = {},
|
|
1258
|
-
if (!
|
|
1257
|
+
var c = {}, d = this._getSub(n);
|
|
1258
|
+
if (!d) {
|
|
1259
1259
|
this._isServerSub(n) && (delete this._serverSubs[n], c.channel = n, this.emit("unsubscribe", c));
|
|
1260
1260
|
return;
|
|
1261
1261
|
}
|
|
1262
|
-
|
|
1262
|
+
d.unsubscribe(), r.resubscribe === !0 && d.subscribe();
|
|
1263
1263
|
}
|
|
1264
1264
|
}, {
|
|
1265
1265
|
key: "_handleSub",
|
|
@@ -1280,17 +1280,17 @@ function kt() {
|
|
|
1280
1280
|
}, {
|
|
1281
1281
|
key: "_handlePublication",
|
|
1282
1282
|
value: function(n, r) {
|
|
1283
|
-
var c = this._getSub(n),
|
|
1283
|
+
var c = this._getSub(n), d = {
|
|
1284
1284
|
data: r.data,
|
|
1285
1285
|
seq: r.seq,
|
|
1286
1286
|
gen: r.gen,
|
|
1287
1287
|
offset: r.offset
|
|
1288
1288
|
};
|
|
1289
|
-
if (r.info && (
|
|
1290
|
-
this._isServerSub(n) && (r.seq !== void 0 && (this._serverSubs[n].seq = r.seq), r.gen !== void 0 && (this._serverSubs[n].gen = r.gen), r.offset !== void 0 && (this._serverSubs[n].offset = r.offset),
|
|
1289
|
+
if (r.info && (d.info = r.info), !c) {
|
|
1290
|
+
this._isServerSub(n) && (r.seq !== void 0 && (this._serverSubs[n].seq = r.seq), r.gen !== void 0 && (this._serverSubs[n].gen = r.gen), r.offset !== void 0 && (this._serverSubs[n].offset = r.offset), d.channel = n, this.emit("publish", d));
|
|
1291
1291
|
return;
|
|
1292
1292
|
}
|
|
1293
|
-
r.seq !== void 0 && (this._lastSeq[n] = r.seq), r.gen !== void 0 && (this._lastGen[n] = r.gen), r.offset !== void 0 && (this._lastOffset[n] = r.offset), c.emit("publish",
|
|
1293
|
+
r.seq !== void 0 && (this._lastSeq[n] = r.seq), r.gen !== void 0 && (this._lastGen[n] = r.gen), r.offset !== void 0 && (this._lastOffset[n] = r.offset), c.emit("publish", d);
|
|
1294
1294
|
}
|
|
1295
1295
|
}, {
|
|
1296
1296
|
key: "_handleMessage",
|
|
@@ -1300,25 +1300,25 @@ function kt() {
|
|
|
1300
1300
|
}, {
|
|
1301
1301
|
key: "_handlePush",
|
|
1302
1302
|
value: function(n, r) {
|
|
1303
|
-
var c = this._decoder.decodePush(n),
|
|
1304
|
-
"type" in c && (
|
|
1303
|
+
var c = this._decoder.decodePush(n), d = 0;
|
|
1304
|
+
"type" in c && (d = c.type);
|
|
1305
1305
|
var y = c.channel;
|
|
1306
|
-
if (
|
|
1306
|
+
if (d === this._pushType.PUBLICATION) {
|
|
1307
1307
|
var v = this._decoder.decodePushData(this._pushType.PUBLICATION, c.data);
|
|
1308
1308
|
this._handlePublication(y, v);
|
|
1309
|
-
} else if (
|
|
1309
|
+
} else if (d === this._pushType.MESSAGE) {
|
|
1310
1310
|
var Q = this._decoder.decodePushData(this._pushType.MESSAGE, c.data);
|
|
1311
1311
|
this._handleMessage(Q);
|
|
1312
|
-
} else if (
|
|
1312
|
+
} else if (d === this._pushType.JOIN) {
|
|
1313
1313
|
var I = this._decoder.decodePushData(this._pushType.JOIN, c.data);
|
|
1314
1314
|
this._handleJoin(y, I);
|
|
1315
|
-
} else if (
|
|
1315
|
+
} else if (d === this._pushType.LEAVE) {
|
|
1316
1316
|
var R = this._decoder.decodePushData(this._pushType.LEAVE, c.data);
|
|
1317
1317
|
this._handleLeave(y, R);
|
|
1318
|
-
} else if (
|
|
1318
|
+
} else if (d === this._pushType.UNSUBSCRIBE) {
|
|
1319
1319
|
var X = this._decoder.decodePushData(this._pushType.UNSUBSCRIBE, c.data);
|
|
1320
1320
|
this._handleUnsub(y, X);
|
|
1321
|
-
} else if (
|
|
1321
|
+
} else if (d === this._pushType.SUBSCRIBE) {
|
|
1322
1322
|
var U = this._decoder.decodePushData(this._pushType.UNSUBSCRIBE, c.data);
|
|
1323
1323
|
this._handleSub(y, U);
|
|
1324
1324
|
}
|
|
@@ -1383,14 +1383,14 @@ function kt() {
|
|
|
1383
1383
|
}, {
|
|
1384
1384
|
key: "_registerCall",
|
|
1385
1385
|
value: function(n, r, c) {
|
|
1386
|
-
var
|
|
1386
|
+
var d = this;
|
|
1387
1387
|
this._callbacks[n] = {
|
|
1388
1388
|
callback: r,
|
|
1389
1389
|
errback: c,
|
|
1390
1390
|
timeout: null
|
|
1391
1391
|
}, this._callbacks[n].timeout = setTimeout(function() {
|
|
1392
|
-
delete
|
|
1393
|
-
error:
|
|
1392
|
+
delete d._callbacks[n], (0, E.isFunction)(c) && c({
|
|
1393
|
+
error: d._createErrorObject(x)
|
|
1394
1394
|
});
|
|
1395
1395
|
}, this._config.timeout);
|
|
1396
1396
|
}
|
|
@@ -1443,12 +1443,12 @@ function kt() {
|
|
|
1443
1443
|
var r = this._privateChannels;
|
|
1444
1444
|
this._privateChannels = {};
|
|
1445
1445
|
var c = [];
|
|
1446
|
-
for (var
|
|
1447
|
-
if (r.hasOwnProperty(
|
|
1448
|
-
var y = this._getSub(
|
|
1446
|
+
for (var d in r)
|
|
1447
|
+
if (r.hasOwnProperty(d)) {
|
|
1448
|
+
var y = this._getSub(d);
|
|
1449
1449
|
if (!y)
|
|
1450
1450
|
continue;
|
|
1451
|
-
c.push(
|
|
1451
|
+
c.push(d);
|
|
1452
1452
|
}
|
|
1453
1453
|
if (c.length === 0) {
|
|
1454
1454
|
this._debug("no private channels found, no need to make request");
|
|
@@ -1474,46 +1474,46 @@ function kt() {
|
|
|
1474
1474
|
var ke = D.data.channels[W];
|
|
1475
1475
|
ke.channel && (le[ke.channel] = ke.token);
|
|
1476
1476
|
}
|
|
1477
|
-
var
|
|
1478
|
-
n._isBatching || (n.startBatching(),
|
|
1479
|
-
for (var
|
|
1480
|
-
if (c.hasOwnProperty(
|
|
1477
|
+
var He = !1;
|
|
1478
|
+
n._isBatching || (n.startBatching(), He = !0);
|
|
1479
|
+
for (var xe in c)
|
|
1480
|
+
if (c.hasOwnProperty(xe)) {
|
|
1481
1481
|
var yt = (function() {
|
|
1482
|
-
var z = c[
|
|
1483
|
-
if (
|
|
1482
|
+
var z = c[xe], Fe = le[z];
|
|
1483
|
+
if (Fe) {
|
|
1484
1484
|
var oe = {
|
|
1485
1485
|
method: n._methodType.SUBSCRIBE,
|
|
1486
1486
|
params: {
|
|
1487
1487
|
channel: z,
|
|
1488
|
-
token:
|
|
1488
|
+
token: Fe
|
|
1489
1489
|
}
|
|
1490
|
-
},
|
|
1491
|
-
if (
|
|
1490
|
+
}, Je = n._getSub(z);
|
|
1491
|
+
if (Je === null)
|
|
1492
1492
|
return "continue";
|
|
1493
|
-
var
|
|
1494
|
-
if (
|
|
1493
|
+
var qe = Je._needRecover();
|
|
1494
|
+
if (qe === !0) {
|
|
1495
1495
|
oe.params.recover = !0;
|
|
1496
1496
|
var we = n._getLastSeq(z), _e = n._getLastGen(z);
|
|
1497
1497
|
if (we || _e)
|
|
1498
1498
|
we && (oe.params.seq = we), _e && (oe.params.gen = _e);
|
|
1499
1499
|
else {
|
|
1500
|
-
var
|
|
1501
|
-
|
|
1500
|
+
var je = n._getLastOffset(z);
|
|
1501
|
+
je && (oe.params.offset = je);
|
|
1502
1502
|
}
|
|
1503
|
-
var
|
|
1504
|
-
|
|
1503
|
+
var ze = n._getLastEpoch(z);
|
|
1504
|
+
ze && (oe.params.epoch = ze);
|
|
1505
1505
|
}
|
|
1506
|
-
n._call(oe).then(function(
|
|
1507
|
-
n._subscribeResponse(z,
|
|
1508
|
-
}, function(
|
|
1509
|
-
n._subscribeError(z,
|
|
1506
|
+
n._call(oe).then(function(Z) {
|
|
1507
|
+
n._subscribeResponse(z, qe, n._decoder.decodeCommandResult(n._methodType.SUBSCRIBE, Z.result)), Z.next && Z.next();
|
|
1508
|
+
}, function(Z) {
|
|
1509
|
+
n._subscribeError(z, Z.error), Z.next && Z.next();
|
|
1510
1510
|
});
|
|
1511
1511
|
} else
|
|
1512
1512
|
return n._subscribeError(z, n._createErrorObject("permission denied", 103)), "continue";
|
|
1513
1513
|
})();
|
|
1514
1514
|
if (yt === "continue") continue;
|
|
1515
1515
|
}
|
|
1516
|
-
|
|
1516
|
+
He && n.stopBatching();
|
|
1517
1517
|
}
|
|
1518
1518
|
};
|
|
1519
1519
|
if (this._config.onPrivateSubscribe !== null)
|
|
@@ -1533,35 +1533,35 @@ function kt() {
|
|
|
1533
1533
|
}, {
|
|
1534
1534
|
key: "subscribe",
|
|
1535
1535
|
value: function(n, r, c) {
|
|
1536
|
-
var
|
|
1537
|
-
if (
|
|
1538
|
-
return
|
|
1536
|
+
var d = this._getSub(n);
|
|
1537
|
+
if (d !== null)
|
|
1538
|
+
return d._setEvents(r), d._isUnsubscribed() && d.subscribe(c), d;
|
|
1539
1539
|
var y = new S.default(this, n, r);
|
|
1540
1540
|
return this._subs[n] = y, y.subscribe(c), y;
|
|
1541
1541
|
}
|
|
1542
1542
|
}]), p;
|
|
1543
1543
|
})(C.default);
|
|
1544
|
-
|
|
1544
|
+
l.Centrifuge = m;
|
|
1545
1545
|
})
|
|
1546
1546
|
),
|
|
1547
1547
|
/***/
|
|
1548
1548
|
579: (
|
|
1549
1549
|
/***/
|
|
1550
|
-
(function(a,
|
|
1551
|
-
Object.defineProperty(
|
|
1550
|
+
(function(a, l, f) {
|
|
1551
|
+
Object.defineProperty(l, "__esModule", {
|
|
1552
1552
|
value: !0
|
|
1553
|
-
}),
|
|
1553
|
+
}), l.default = void 0;
|
|
1554
1554
|
var C = f(382), S = C.Centrifuge;
|
|
1555
|
-
|
|
1555
|
+
l.default = S, a.exports = l.default;
|
|
1556
1556
|
})
|
|
1557
1557
|
),
|
|
1558
1558
|
/***/
|
|
1559
1559
|
147: (
|
|
1560
1560
|
/***/
|
|
1561
|
-
(function(a,
|
|
1562
|
-
Object.defineProperty(
|
|
1561
|
+
(function(a, l) {
|
|
1562
|
+
Object.defineProperty(l, "__esModule", {
|
|
1563
1563
|
value: !0
|
|
1564
|
-
}),
|
|
1564
|
+
}), l.JsonPushType = l.JsonMethodType = l.JsonEncoder = l.JsonDecoder = void 0;
|
|
1565
1565
|
function f(B, k) {
|
|
1566
1566
|
if (!(B instanceof k))
|
|
1567
1567
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -1589,7 +1589,7 @@ function kt() {
|
|
|
1589
1589
|
REFRESH: 10,
|
|
1590
1590
|
SUB_REFRESH: 11
|
|
1591
1591
|
};
|
|
1592
|
-
|
|
1592
|
+
l.JsonMethodType = _;
|
|
1593
1593
|
var E = {
|
|
1594
1594
|
PUBLICATION: 0,
|
|
1595
1595
|
JOIN: 1,
|
|
@@ -1598,7 +1598,7 @@ function kt() {
|
|
|
1598
1598
|
MESSAGE: 4,
|
|
1599
1599
|
SUBSCRIBE: 5
|
|
1600
1600
|
};
|
|
1601
|
-
|
|
1601
|
+
l.JsonPushType = E;
|
|
1602
1602
|
var P = /* @__PURE__ */ (function() {
|
|
1603
1603
|
function B() {
|
|
1604
1604
|
f(this, B);
|
|
@@ -1613,7 +1613,7 @@ function kt() {
|
|
|
1613
1613
|
}
|
|
1614
1614
|
}]), B;
|
|
1615
1615
|
})();
|
|
1616
|
-
|
|
1616
|
+
l.JsonEncoder = P;
|
|
1617
1617
|
var T = /* @__PURE__ */ (function() {
|
|
1618
1618
|
function B() {
|
|
1619
1619
|
f(this, B);
|
|
@@ -1645,13 +1645,13 @@ function kt() {
|
|
|
1645
1645
|
}
|
|
1646
1646
|
}]), B;
|
|
1647
1647
|
})();
|
|
1648
|
-
|
|
1648
|
+
l.JsonDecoder = T;
|
|
1649
1649
|
})
|
|
1650
1650
|
),
|
|
1651
1651
|
/***/
|
|
1652
1652
|
471: (
|
|
1653
1653
|
/***/
|
|
1654
|
-
(function(a,
|
|
1654
|
+
(function(a, l, f) {
|
|
1655
1655
|
function C(h) {
|
|
1656
1656
|
"@babel/helpers - typeof";
|
|
1657
1657
|
return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? C = function(A) {
|
|
@@ -1660,9 +1660,9 @@ function kt() {
|
|
|
1660
1660
|
return A && typeof Symbol == "function" && A.constructor === Symbol && A !== Symbol.prototype ? "symbol" : typeof A;
|
|
1661
1661
|
}, C(h);
|
|
1662
1662
|
}
|
|
1663
|
-
Object.defineProperty(
|
|
1663
|
+
Object.defineProperty(l, "__esModule", {
|
|
1664
1664
|
value: !0
|
|
1665
|
-
}),
|
|
1665
|
+
}), l.default = void 0;
|
|
1666
1666
|
var S = E(f(187)), _ = f(853);
|
|
1667
1667
|
function E(h) {
|
|
1668
1668
|
return h && h.__esModule ? h : { default: h };
|
|
@@ -1733,10 +1733,10 @@ function kt() {
|
|
|
1733
1733
|
k(A, h);
|
|
1734
1734
|
var p = w(A);
|
|
1735
1735
|
function A(n, r, c) {
|
|
1736
|
-
var
|
|
1737
|
-
return P(this, A),
|
|
1736
|
+
var d;
|
|
1737
|
+
return P(this, A), d = p.call(this), d.channel = r, d._centrifuge = n, d._status = q, d._error = null, d._isResubscribe = !1, d._ready = !1, d._subscriptionPromise = null, d._noResubscribe = !1, d._recoverable = !1, d._recover = !1, d._setEvents(c), d._initializePromise(), d._promises = {}, d._promiseId = 0, d._subscribeData = null, d.on("error", function(y) {
|
|
1738
1738
|
this._centrifuge._debug("subscription error", y);
|
|
1739
|
-
}),
|
|
1739
|
+
}), d;
|
|
1740
1740
|
}
|
|
1741
1741
|
return B(A, [{
|
|
1742
1742
|
key: "_nextPromiseId",
|
|
@@ -1747,11 +1747,11 @@ function kt() {
|
|
|
1747
1747
|
key: "_initializePromise",
|
|
1748
1748
|
value: function() {
|
|
1749
1749
|
var r = this;
|
|
1750
|
-
this._ready = !1, this._subscriptionPromise = new Promise(function(c,
|
|
1750
|
+
this._ready = !1, this._subscriptionPromise = new Promise(function(c, d) {
|
|
1751
1751
|
r._resolve = function(y) {
|
|
1752
1752
|
r._ready = !0, c(y);
|
|
1753
1753
|
}, r._reject = function(y) {
|
|
1754
|
-
r._ready = !0,
|
|
1754
|
+
r._ready = !0, d(y);
|
|
1755
1755
|
};
|
|
1756
1756
|
}).then(function() {
|
|
1757
1757
|
}, function() {
|
|
@@ -1774,8 +1774,8 @@ function kt() {
|
|
|
1774
1774
|
if ((0, _.isFunction)(r))
|
|
1775
1775
|
this.on("publish", r);
|
|
1776
1776
|
else if (Object.prototype.toString.call(r) === Object.prototype.toString.call({}))
|
|
1777
|
-
for (var c = ["publish", "join", "leave", "unsubscribe", "subscribe", "error"],
|
|
1778
|
-
var v = c[
|
|
1777
|
+
for (var c = ["publish", "join", "leave", "unsubscribe", "subscribe", "error"], d = 0, y = c.length; d < y; d++) {
|
|
1778
|
+
var v = c[d];
|
|
1779
1779
|
v in r && this.on(v, r[v]);
|
|
1780
1780
|
}
|
|
1781
1781
|
}
|
|
@@ -1827,8 +1827,8 @@ function kt() {
|
|
|
1827
1827
|
this._status = x;
|
|
1828
1828
|
var c = this._getSubscribeSuccessContext(r);
|
|
1829
1829
|
this._recover = !1, this.emit("subscribe", c), this._resolve(c);
|
|
1830
|
-
for (var
|
|
1831
|
-
clearTimeout(this._promises[
|
|
1830
|
+
for (var d in this._promises)
|
|
1831
|
+
clearTimeout(this._promises[d].timeout), this._promises[d].resolve(), delete this._promises[d];
|
|
1832
1832
|
}
|
|
1833
1833
|
}
|
|
1834
1834
|
}, {
|
|
@@ -1838,8 +1838,8 @@ function kt() {
|
|
|
1838
1838
|
this._status = M, this._error = r;
|
|
1839
1839
|
var c = this._getSubscribeErrorContext();
|
|
1840
1840
|
this.emit("error", c), this._reject(c);
|
|
1841
|
-
for (var
|
|
1842
|
-
clearTimeout(this._promises[
|
|
1841
|
+
for (var d in this._promises)
|
|
1842
|
+
clearTimeout(this._promises[d].timeout), this._promises[d].reject(r), delete this._promises[d];
|
|
1843
1843
|
}
|
|
1844
1844
|
}
|
|
1845
1845
|
}, {
|
|
@@ -1905,7 +1905,7 @@ function kt() {
|
|
|
1905
1905
|
return Promise.resolve();
|
|
1906
1906
|
if (this._isError())
|
|
1907
1907
|
return Promise.reject(this._error);
|
|
1908
|
-
var c = new Promise(function(
|
|
1908
|
+
var c = new Promise(function(d, y) {
|
|
1909
1909
|
var v = setTimeout(function() {
|
|
1910
1910
|
y({
|
|
1911
1911
|
code: 0,
|
|
@@ -1914,7 +1914,7 @@ function kt() {
|
|
|
1914
1914
|
}, r._centrifuge._config.timeout);
|
|
1915
1915
|
r._promises[r._nextPromiseId()] = {
|
|
1916
1916
|
timeout: v,
|
|
1917
|
-
resolve:
|
|
1917
|
+
resolve: d,
|
|
1918
1918
|
reject: y
|
|
1919
1919
|
};
|
|
1920
1920
|
});
|
|
@@ -1954,16 +1954,16 @@ function kt() {
|
|
|
1954
1954
|
}
|
|
1955
1955
|
}]), A;
|
|
1956
1956
|
})(S.default);
|
|
1957
|
-
|
|
1957
|
+
l.default = g, a.exports = l.default;
|
|
1958
1958
|
})
|
|
1959
1959
|
),
|
|
1960
1960
|
/***/
|
|
1961
1961
|
853: (
|
|
1962
1962
|
/***/
|
|
1963
|
-
(function(a,
|
|
1964
|
-
Object.defineProperty(
|
|
1963
|
+
(function(a, l, f) {
|
|
1964
|
+
Object.defineProperty(l, "__esModule", {
|
|
1965
1965
|
value: !0
|
|
1966
|
-
}),
|
|
1966
|
+
}), l.backoff = E, l.errorExists = P, l.extend = T, l.isFunction = S, l.log = _, l.startsWith = C;
|
|
1967
1967
|
function C(B, k) {
|
|
1968
1968
|
return B.lastIndexOf(k, 0) === 0;
|
|
1969
1969
|
}
|
|
@@ -1994,10 +1994,10 @@ function kt() {
|
|
|
1994
1994
|
187: (
|
|
1995
1995
|
/***/
|
|
1996
1996
|
(function(a) {
|
|
1997
|
-
var
|
|
1997
|
+
var l = typeof Reflect == "object" ? Reflect : null, f = l && typeof l.apply == "function" ? l.apply : function(g, h, p) {
|
|
1998
1998
|
return Function.prototype.apply.call(g, h, p);
|
|
1999
1999
|
}, C;
|
|
2000
|
-
|
|
2000
|
+
l && typeof l.ownKeys == "function" ? C = l.ownKeys : Object.getOwnPropertySymbols ? C = function(g) {
|
|
2001
2001
|
return Object.getOwnPropertyNames(g).concat(Object.getOwnPropertySymbols(g));
|
|
2002
2002
|
} : C = function(g) {
|
|
2003
2003
|
return Object.getOwnPropertyNames(g);
|
|
@@ -2053,13 +2053,13 @@ function kt() {
|
|
|
2053
2053
|
var c = new Error("Unhandled error." + (r ? " (" + r.message + ")" : ""));
|
|
2054
2054
|
throw c.context = r, c;
|
|
2055
2055
|
}
|
|
2056
|
-
var
|
|
2057
|
-
if (
|
|
2056
|
+
var d = n[g];
|
|
2057
|
+
if (d === void 0)
|
|
2058
2058
|
return !1;
|
|
2059
|
-
if (typeof
|
|
2060
|
-
f(
|
|
2059
|
+
if (typeof d == "function")
|
|
2060
|
+
f(d, this, h);
|
|
2061
2061
|
else
|
|
2062
|
-
for (var y =
|
|
2062
|
+
for (var y = d.length, v = J(d, y), p = 0; p < y; ++p)
|
|
2063
2063
|
f(v[p], this, h);
|
|
2064
2064
|
return !0;
|
|
2065
2065
|
};
|
|
@@ -2205,9 +2205,9 @@ function kt() {
|
|
|
2205
2205
|
/******/
|
|
2206
2206
|
}, i = {};
|
|
2207
2207
|
function s(a) {
|
|
2208
|
-
var
|
|
2209
|
-
if (
|
|
2210
|
-
return
|
|
2208
|
+
var l = i[a];
|
|
2209
|
+
if (l !== void 0)
|
|
2210
|
+
return l.exports;
|
|
2211
2211
|
var f = i[a] = {
|
|
2212
2212
|
/******/
|
|
2213
2213
|
// no module.id needed
|
|
@@ -2239,7 +2239,7 @@ function kt() {
|
|
|
2239
2239
|
var wt = kt();
|
|
2240
2240
|
const _t = /* @__PURE__ */ St(wt);
|
|
2241
2241
|
let he = null;
|
|
2242
|
-
function
|
|
2242
|
+
function Ye(e, t) {
|
|
2243
2243
|
if (!(e != null && e.client_url) || !(e != null && e.token) || !(e != null && e.channel))
|
|
2244
2244
|
return console.error("[Centrifuge] Invalid socket_connections"), null;
|
|
2245
2245
|
const { client_url: o, token: i, channel: s } = e;
|
|
@@ -2255,16 +2255,16 @@ function Ve(e, t) {
|
|
|
2255
2255
|
const u = new _t(o);
|
|
2256
2256
|
return u.setToken(i), u.on("connect", (a) => {
|
|
2257
2257
|
console.log("[Centrifuge] Connected", a), console.log("[Centrifuge] Subscribing to channel:", s);
|
|
2258
|
-
const
|
|
2259
|
-
|
|
2258
|
+
const l = u.subscribe(s);
|
|
2259
|
+
l.on("publish", (f) => {
|
|
2260
2260
|
console.log("[Centrifuge] Publish event received:", f);
|
|
2261
2261
|
const C = Tt(f);
|
|
2262
2262
|
C && t(C);
|
|
2263
|
-
}),
|
|
2263
|
+
}), l.on("subscribe", (f) => {
|
|
2264
2264
|
console.log("[Centrifuge] ✅ Channel subscribed successfully:", s, f);
|
|
2265
|
-
}),
|
|
2265
|
+
}), l.on("error", (f) => {
|
|
2266
2266
|
console.error("[Centrifuge] ❌ Subscription error:", f);
|
|
2267
|
-
}),
|
|
2267
|
+
}), l.on("unsubscribe", (f) => {
|
|
2268
2268
|
console.log("[Centrifuge] Channel unsubscribed:", f);
|
|
2269
2269
|
});
|
|
2270
2270
|
}), u.on("disconnect", (a) => console.log("[Centrifuge] Disconnected", a)), u.on("error", (a) => console.error("[Centrifuge] Error", a)), console.log("[Centrifuge] Calling connect()..."), u.connect(), he = u, { centrifuge: u };
|
|
@@ -2283,11 +2283,11 @@ const $ = {
|
|
|
2283
2283
|
iconType: "kaspi_pay",
|
|
2284
2284
|
label: "Kaspi.kz",
|
|
2285
2285
|
type: "kaspi_pay"
|
|
2286
|
-
},
|
|
2286
|
+
}, st = {
|
|
2287
2287
|
iconType: "apple_pay",
|
|
2288
2288
|
label: "Apple Pay",
|
|
2289
2289
|
type: "apple_pay"
|
|
2290
|
-
},
|
|
2290
|
+
}, it = {
|
|
2291
2291
|
iconType: "google_pay",
|
|
2292
2292
|
label: "Google Pay",
|
|
2293
2293
|
type: "google_pay"
|
|
@@ -2295,28 +2295,28 @@ const $ = {
|
|
|
2295
2295
|
function K(e) {
|
|
2296
2296
|
return e === "enabled" || e === !0;
|
|
2297
2297
|
}
|
|
2298
|
-
function
|
|
2298
|
+
function Ge(e) {
|
|
2299
2299
|
if (!e) return null;
|
|
2300
2300
|
let t = String(e).trim().toLowerCase();
|
|
2301
2301
|
return t.startsWith("payment_method_") && (t = t.replace("payment_method_", "")), t === "kaspi" ? "kaspi_pay" : t === "apple" ? "apple_pay" : t === "google" ? "google_pay" : t === "newcard" ? "new_card" : t === "card" ? "card" : ["kaspi_pay", "apple_pay", "google_pay", "new_card"].includes(t) ? t : null;
|
|
2302
2302
|
}
|
|
2303
2303
|
function Lt(e) {
|
|
2304
|
-
var u, a,
|
|
2304
|
+
var u, a, l;
|
|
2305
2305
|
const t = e, o = ((u = t == null ? void 0 : t.context) == null ? void 0 : u.last_payment_method) ?? (t == null ? void 0 : t.last_payment_method) ?? ((a = t == null ? void 0 : t.attributes) == null ? void 0 : a.last_payment_method);
|
|
2306
2306
|
if (!o) return null;
|
|
2307
2307
|
if (typeof o == "string")
|
|
2308
|
-
return { type:
|
|
2308
|
+
return { type: Ge(o), cardId: null };
|
|
2309
2309
|
if (typeof o != "object") return null;
|
|
2310
|
-
const i = o.type ?? o.payment_method ?? o.method, s = o.card_id ?? o.cardId ?? o.id ?? ((
|
|
2310
|
+
const i = o.type ?? o.payment_method ?? o.method, s = o.card_id ?? o.cardId ?? o.id ?? ((l = o.card) == null ? void 0 : l.id) ?? null;
|
|
2311
2311
|
return {
|
|
2312
|
-
type:
|
|
2312
|
+
type: Ge(i),
|
|
2313
2313
|
cardId: s != null ? String(s) : null
|
|
2314
2314
|
};
|
|
2315
2315
|
}
|
|
2316
2316
|
function Rt(e, t, o = {}) {
|
|
2317
2317
|
var k, b, w, L;
|
|
2318
|
-
const i = [], s = (k = e == null ? void 0 : e.kaspi) == null ? void 0 : k.data, u = ((b = e == null ? void 0 : e.cards_v2) == null ? void 0 : b.data) || [], a = ((L = (w = e == null ? void 0 : e.payment_methods) == null ? void 0 : w.data) == null ? void 0 : L.attributes) || {},
|
|
2319
|
-
return s != null && s.isKaspiOnly &&
|
|
2318
|
+
const i = [], s = (k = e == null ? void 0 : e.kaspi) == null ? void 0 : k.data, u = ((b = e == null ? void 0 : e.cards_v2) == null ? void 0 : b.data) || [], a = ((L = (w = e == null ? void 0 : e.payment_methods) == null ? void 0 : w.data) == null ? void 0 : L.attributes) || {}, l = K(a.payment_method_kaspi), f = K(a.payment_method_card), C = typeof window < "u" && window.self === window.top, _ = De() === "ios", E = !!(o != null && o.onlyKaspiAvailable), P = !!(o != null && o.disableKaspi);
|
|
2319
|
+
return s != null && s.isKaspiOnly && l && !P ? [$] : E ? s != null && s.isAvailable && l && !P ? [$] : [] : (K(a.payment_method_apple_pay) && !me("apple_pay") && (Ce() && C || ye() || _ || ot() === 16) && i.push(st), s != null && s.isAvailable && l && !P && i.push($), f && u.filter((O) => !O.isExpired).forEach((O) => {
|
|
2320
2320
|
i.push({
|
|
2321
2321
|
iconType: ge(O.attributes.mask),
|
|
2322
2322
|
type: "card",
|
|
@@ -2325,7 +2325,7 @@ function Rt(e, t, o = {}) {
|
|
|
2325
2325
|
cardType: O.type,
|
|
2326
2326
|
isDefault: O.attributes.isDefault
|
|
2327
2327
|
});
|
|
2328
|
-
}), K(a.payment_method_google_pay) && !me("google_pay") && !(o != null && o.disableGooglePay) && !Ce() && !ye() && i.push(
|
|
2328
|
+
}), K(a.payment_method_google_pay) && !me("google_pay") && !(o != null && o.disableGooglePay) && !Ce() && !ye() && i.push(it), K(a.payment_method_new_card) && i.push({
|
|
2329
2329
|
iconType: "new_card",
|
|
2330
2330
|
type: "new_card",
|
|
2331
2331
|
label: t ? t("newCard") : "Оплата новой картой"
|
|
@@ -2333,14 +2333,14 @@ function Rt(e, t, o = {}) {
|
|
|
2333
2333
|
}
|
|
2334
2334
|
function Le(e, t = {}) {
|
|
2335
2335
|
var B, k, b, w;
|
|
2336
|
-
const o = (B = e == null ? void 0 : e.kaspi) == null ? void 0 : B.data, i = ((k = e == null ? void 0 : e.cards_v2) == null ? void 0 : k.data) || [], s = ((w = (b = e == null ? void 0 : e.payment_methods) == null ? void 0 : b.data) == null ? void 0 : w.attributes) || {}, u = K(s.payment_method_kaspi), a = K(s.payment_method_card),
|
|
2337
|
-
if (o != null && o.isKaspiOnly && u && !
|
|
2336
|
+
const o = (B = e == null ? void 0 : e.kaspi) == null ? void 0 : B.data, i = ((k = e == null ? void 0 : e.cards_v2) == null ? void 0 : k.data) || [], s = ((w = (b = e == null ? void 0 : e.payment_methods) == null ? void 0 : b.data) == null ? void 0 : w.attributes) || {}, u = K(s.payment_method_kaspi), a = K(s.payment_method_card), l = !!(t != null && t.disableKaspi), f = typeof window < "u" && window.self === window.top, S = De() === "ios", _ = K(s.payment_method_apple_pay) && !me("apple_pay") && (Ce() && f || ye() || S || ot() === 16), E = K(s.payment_method_google_pay) && !me("google_pay") && !(t != null && t.disableGooglePay) && !Ce() && !ye();
|
|
2337
|
+
if (o != null && o.isKaspiOnly && u && !l || t != null && t.onlyKaspiAvailable && (o != null && o.isAvailable) && u && !l)
|
|
2338
2338
|
return $;
|
|
2339
2339
|
const P = Lt(e);
|
|
2340
|
-
if ((P == null ? void 0 : P.type) === "kaspi_pay" && (o != null && o.isAvailable) && u && !
|
|
2340
|
+
if ((P == null ? void 0 : P.type) === "kaspi_pay" && (o != null && o.isAvailable) && u && !l)
|
|
2341
2341
|
return $;
|
|
2342
|
-
if ((P == null ? void 0 : P.type) === "apple_pay" && _) return
|
|
2343
|
-
if ((P == null ? void 0 : P.type) === "google_pay" && E) return
|
|
2342
|
+
if ((P == null ? void 0 : P.type) === "apple_pay" && _) return st;
|
|
2343
|
+
if ((P == null ? void 0 : P.type) === "google_pay" && E) return it;
|
|
2344
2344
|
if ((P == null ? void 0 : P.type) === "new_card" && K(s.payment_method_new_card))
|
|
2345
2345
|
return { iconType: "new_card", type: "new_card", label: "Оплата новой картой" };
|
|
2346
2346
|
if ((P == null ? void 0 : P.type) === "card" && a) {
|
|
@@ -2368,7 +2368,7 @@ function Le(e, t = {}) {
|
|
|
2368
2368
|
cardType: L.type
|
|
2369
2369
|
};
|
|
2370
2370
|
}
|
|
2371
|
-
if (o != null && o.isAvailable && u && !
|
|
2371
|
+
if (o != null && o.isAvailable && u && !l) return $;
|
|
2372
2372
|
const T = a ? i.find((L) => !L.isExpired) : null;
|
|
2373
2373
|
return T ? {
|
|
2374
2374
|
iconType: ge(T.attributes.mask),
|
|
@@ -2378,7 +2378,7 @@ function Le(e, t = {}) {
|
|
|
2378
2378
|
cardType: T.type
|
|
2379
2379
|
} : null;
|
|
2380
2380
|
}
|
|
2381
|
-
function
|
|
2381
|
+
function at(e) {
|
|
2382
2382
|
if (typeof localStorage > "u") return null;
|
|
2383
2383
|
try {
|
|
2384
2384
|
return localStorage.getItem(e);
|
|
@@ -2409,7 +2409,7 @@ async function Ot(e, t) {
|
|
|
2409
2409
|
return `HTTP ${e.status}: ${e.statusText}`;
|
|
2410
2410
|
}
|
|
2411
2411
|
}
|
|
2412
|
-
async function
|
|
2412
|
+
async function G(e, t) {
|
|
2413
2413
|
const o = await Ot(e, t);
|
|
2414
2414
|
throw Object.assign(new Error(o), { status: e.status });
|
|
2415
2415
|
}
|
|
@@ -2449,16 +2449,16 @@ async function Se(e, t, o, i, s) {
|
|
|
2449
2449
|
},
|
|
2450
2450
|
body: JSON.stringify(i)
|
|
2451
2451
|
});
|
|
2452
|
-
return u.ok || await
|
|
2452
|
+
return u.ok || await G(u, s), u.json();
|
|
2453
2453
|
}
|
|
2454
2454
|
async function Mt(e, t, o) {
|
|
2455
|
-
var
|
|
2455
|
+
var l, f, C, S;
|
|
2456
2456
|
const i = await fetch(`${e}/api/v2/oauth2/tokens`, {
|
|
2457
2457
|
method: "POST",
|
|
2458
2458
|
headers: {
|
|
2459
2459
|
"Content-Type": "application/json",
|
|
2460
2460
|
"X-Idempotency-Key": Be(),
|
|
2461
|
-
"X-Fingerprint":
|
|
2461
|
+
"X-Fingerprint": rt()
|
|
2462
2462
|
},
|
|
2463
2463
|
body: JSON.stringify({
|
|
2464
2464
|
client_id: t,
|
|
@@ -2466,13 +2466,13 @@ async function Mt(e, t, o) {
|
|
|
2466
2466
|
track_id: o
|
|
2467
2467
|
})
|
|
2468
2468
|
});
|
|
2469
|
-
i.ok || await
|
|
2470
|
-
const s = await i.json(), u = (s == null ? void 0 : s.access_token) ?? ((f = (
|
|
2469
|
+
i.ok || await G(i, "Не удалось авторизоваться через track_id");
|
|
2470
|
+
const s = await i.json(), u = (s == null ? void 0 : s.access_token) ?? ((f = (l = s == null ? void 0 : s.data) == null ? void 0 : l.attributes) == null ? void 0 : f.access_token), a = (s == null ? void 0 : s.refresh_token) ?? ((S = (C = s == null ? void 0 : s.data) == null ? void 0 : C.attributes) == null ? void 0 : S.refresh_token) ?? null;
|
|
2471
2471
|
if (!u) throw new Error("В ответе отсутствует access_token");
|
|
2472
2472
|
return { access_token: u, refresh_token: a };
|
|
2473
2473
|
}
|
|
2474
2474
|
async function Nt(e, t, o) {
|
|
2475
|
-
var
|
|
2475
|
+
var l, f, C, S;
|
|
2476
2476
|
const i = await fetch(`${e}/api/v2/oauth2/tokens`, {
|
|
2477
2477
|
method: "POST",
|
|
2478
2478
|
headers: { "Content-Type": "application/json" },
|
|
@@ -2482,8 +2482,8 @@ async function Nt(e, t, o) {
|
|
|
2482
2482
|
refresh_token: o
|
|
2483
2483
|
})
|
|
2484
2484
|
});
|
|
2485
|
-
i.ok || await
|
|
2486
|
-
const s = await i.json(), u = (s == null ? void 0 : s.access_token) ?? ((f = (
|
|
2485
|
+
i.ok || await G(i, "Не удалось обновить токен по refresh_token");
|
|
2486
|
+
const s = await i.json(), u = (s == null ? void 0 : s.access_token) ?? ((f = (l = s == null ? void 0 : s.data) == null ? void 0 : l.attributes) == null ? void 0 : f.access_token), a = (s == null ? void 0 : s.refresh_token) ?? ((S = (C = s == null ? void 0 : s.data) == null ? void 0 : C.attributes) == null ? void 0 : S.refresh_token) ?? null;
|
|
2487
2487
|
if (!u) throw new Error("В ответе отсутствует access_token");
|
|
2488
2488
|
return { access_token: u, refresh_token: a };
|
|
2489
2489
|
}
|
|
@@ -2504,7 +2504,7 @@ async function Oe(e, t) {
|
|
|
2504
2504
|
}
|
|
2505
2505
|
})
|
|
2506
2506
|
});
|
|
2507
|
-
return o.ok || await
|
|
2507
|
+
return o.ok || await G(o, "Ошибка получения контекста оплаты"), o.json();
|
|
2508
2508
|
}
|
|
2509
2509
|
async function Dt(e, t, o) {
|
|
2510
2510
|
const i = await fetch(`${e}/payment-gateway/v1/cards/${o}`, {
|
|
@@ -2514,7 +2514,7 @@ async function Dt(e, t, o) {
|
|
|
2514
2514
|
Authorization: `Bearer ${t.accessToken}`
|
|
2515
2515
|
}
|
|
2516
2516
|
});
|
|
2517
|
-
return i.ok || await
|
|
2517
|
+
return i.ok || await G(i, "Не удалось удалить карту"), i.json().catch(() => ({}));
|
|
2518
2518
|
}
|
|
2519
2519
|
async function Xt(e, t, o) {
|
|
2520
2520
|
const i = await fetch(
|
|
@@ -2527,7 +2527,7 @@ async function Xt(e, t, o) {
|
|
|
2527
2527
|
}
|
|
2528
2528
|
}
|
|
2529
2529
|
);
|
|
2530
|
-
return i.ok || await
|
|
2530
|
+
return i.ok || await G(i, "Не удалось отметить карту как основную"), i.json().catch(() => ({}));
|
|
2531
2531
|
}
|
|
2532
2532
|
async function Ut(e, t, o) {
|
|
2533
2533
|
const i = await fetch(`${e}/orders/v1/orders/${o}/status`, {
|
|
@@ -2545,8 +2545,8 @@ async function Ut(e, t, o) {
|
|
|
2545
2545
|
const s = await i.json(), u = (s == null ? void 0 : s.data) ?? s;
|
|
2546
2546
|
return { data: { status: u == null ? void 0 : u.status, payload: (u == null ? void 0 : u.payload) ?? {} } };
|
|
2547
2547
|
}
|
|
2548
|
-
async function
|
|
2549
|
-
const { checkoutAmount: u, checkoutPaymentMethod: a, useBalanceFlag:
|
|
2548
|
+
async function Ze(e, t, o, i, s = {}) {
|
|
2549
|
+
const { checkoutAmount: u, checkoutPaymentMethod: a, useBalanceFlag: l, voucher: f } = Ie(
|
|
2550
2550
|
t,
|
|
2551
2551
|
{
|
|
2552
2552
|
type: i.type,
|
|
@@ -2558,12 +2558,12 @@ async function Ge(e, t, o, i, s = {}) {
|
|
|
2558
2558
|
e,
|
|
2559
2559
|
t,
|
|
2560
2560
|
o,
|
|
2561
|
-
Qe(t, a, u,
|
|
2561
|
+
Qe(t, a, u, l, f),
|
|
2562
2562
|
"Ошибка создания заказа"
|
|
2563
2563
|
);
|
|
2564
2564
|
}
|
|
2565
2565
|
async function Ht(e, t, o, i = {}) {
|
|
2566
|
-
const { checkoutAmount: s, checkoutPaymentMethod: u, useBalanceFlag: a, voucher:
|
|
2566
|
+
const { checkoutAmount: s, checkoutPaymentMethod: u, useBalanceFlag: a, voucher: l } = Ie(
|
|
2567
2567
|
t,
|
|
2568
2568
|
{ type: "new_card" },
|
|
2569
2569
|
i
|
|
@@ -2572,7 +2572,7 @@ async function Ht(e, t, o, i = {}) {
|
|
|
2572
2572
|
e,
|
|
2573
2573
|
t,
|
|
2574
2574
|
o,
|
|
2575
|
-
Qe(t, u, s, a,
|
|
2575
|
+
Qe(t, u, s, a, l),
|
|
2576
2576
|
"Ошибка создания заказа для новой карты"
|
|
2577
2577
|
);
|
|
2578
2578
|
}
|
|
@@ -2587,7 +2587,7 @@ async function xt(e, t) {
|
|
|
2587
2587
|
}
|
|
2588
2588
|
}
|
|
2589
2589
|
);
|
|
2590
|
-
return o.ok || await
|
|
2590
|
+
return o.ok || await G(o, "Ошибка получения купонов"), o.json();
|
|
2591
2591
|
}
|
|
2592
2592
|
async function Ft(e, t, o) {
|
|
2593
2593
|
const i = window.location.hostname, s = await fetch(`${e}/payment-gateway/v1/apple/session`, {
|
|
@@ -2599,10 +2599,10 @@ async function Ft(e, t, o) {
|
|
|
2599
2599
|
},
|
|
2600
2600
|
body: JSON.stringify({ validationUrl: o, domainName: i })
|
|
2601
2601
|
});
|
|
2602
|
-
return s.ok || await
|
|
2602
|
+
return s.ok || await G(s, "Ошибка получения Apple Pay сессии"), s.json();
|
|
2603
2603
|
}
|
|
2604
2604
|
async function Jt(e, t, o, i, s = {}) {
|
|
2605
|
-
const { checkoutAmount: u, checkoutPaymentMethod: a, useBalanceFlag:
|
|
2605
|
+
const { checkoutAmount: u, checkoutPaymentMethod: a, useBalanceFlag: l, voucher: f } = Ie(
|
|
2606
2606
|
t,
|
|
2607
2607
|
{ type: "apple_pay", data: i },
|
|
2608
2608
|
s
|
|
@@ -2611,12 +2611,12 @@ async function Jt(e, t, o, i, s = {}) {
|
|
|
2611
2611
|
e,
|
|
2612
2612
|
t,
|
|
2613
2613
|
o,
|
|
2614
|
-
Qe(t, a, u,
|
|
2614
|
+
Qe(t, a, u, l, f),
|
|
2615
2615
|
"Ошибка создания заказа с Apple Pay"
|
|
2616
2616
|
);
|
|
2617
2617
|
}
|
|
2618
|
-
async function
|
|
2619
|
-
const { checkoutAmount: u, checkoutPaymentMethod: a, useBalanceFlag:
|
|
2618
|
+
async function ct(e, t, o, i, s = {}) {
|
|
2619
|
+
const { checkoutAmount: u, checkoutPaymentMethod: a, useBalanceFlag: l, voucher: f } = Ie(
|
|
2620
2620
|
t,
|
|
2621
2621
|
{ type: "google_pay", data: i },
|
|
2622
2622
|
s
|
|
@@ -2625,7 +2625,7 @@ async function at(e, t, o, i, s = {}) {
|
|
|
2625
2625
|
e,
|
|
2626
2626
|
t,
|
|
2627
2627
|
o,
|
|
2628
|
-
Qe(t, a, u,
|
|
2628
|
+
Qe(t, a, u, l, f),
|
|
2629
2629
|
"Ошибка создания заказа с Google Pay"
|
|
2630
2630
|
);
|
|
2631
2631
|
}
|
|
@@ -2674,11 +2674,11 @@ function qt(e) {
|
|
|
2674
2674
|
function Me(e, t) {
|
|
2675
2675
|
Re("webPayToken", e), t && Re("webPayRefreshToken", t);
|
|
2676
2676
|
}
|
|
2677
|
-
function
|
|
2677
|
+
function $e() {
|
|
2678
2678
|
be("webPayToken"), be("webPayRefreshToken");
|
|
2679
2679
|
}
|
|
2680
2680
|
async function jt(e) {
|
|
2681
|
-
const t =
|
|
2681
|
+
const t = at("webPayRefreshToken");
|
|
2682
2682
|
if (t && e.config.clientId)
|
|
2683
2683
|
try {
|
|
2684
2684
|
const i = await Nt(
|
|
@@ -2771,7 +2771,7 @@ function $t(e) {
|
|
|
2771
2771
|
const t = e == null ? void 0 : e.toLowerCase();
|
|
2772
2772
|
return t && Zt[t] || "";
|
|
2773
2773
|
}
|
|
2774
|
-
const
|
|
2774
|
+
const Xe = `<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2775
2775
|
<path d="M19.7045 10.7313C15.0567 10.7313 11.2687 6.94328 11.2687 2.26866C11.2687 2.10746 11.1612 2 11 2C10.8388 2 10.7313 2.10746 10.7313 2.26866C10.7313 6.94328 6.94328 10.7313 2.26866 10.7313C2.10746 10.7313 2 10.8388 2 11C2 11.1612 2.10746 11.2687 2.26866 11.2687C6.94328 11.2687 10.7313 15.0567 10.7313 19.7313C10.7313 19.8925 10.8388 20 11 20C11.1612 20 11.2687 19.8925 11.2687 19.7313C11.2687 15.0567 15.0567 11.2687 19.7313 11.2687C19.8925 11.2687 20 11.1612 20 11C20 10.8388 19.8657 10.7313 19.7045 10.7313Z" fill="#2F2F2F"/>
|
|
2776
2776
|
</svg>
|
|
2777
2777
|
`, en = '<svg class="choco-widget-method-item-trash" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4.16663 5.83317H15.8333" stroke="#CC3434" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M15 5.8335V15.0002C15 15.921 14.2542 16.6668 13.3333 16.6668H6.66667C5.74583 16.6668 5 15.921 5 15.0002V5.8335" stroke="#CC3434" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M12.5 3.12516H7.5" stroke="#CC3434" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M8.33329 9.1665V13.3332" stroke="#CC3434" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M11.6667 9.1665V13.3332" stroke="#CC3434" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>', tn = '<svg class="choco-widget-method-item-check" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13.3333 4.3335L5.99996 11.6668L2.66663 8.3335" stroke="#242424" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
@@ -2781,7 +2781,7 @@ function Ee(e) {
|
|
|
2781
2781
|
function At(e, t, o, i = {}) {
|
|
2782
2782
|
const { editMode: s = !1 } = i;
|
|
2783
2783
|
return (s ? e.filter((a) => a.type === "card") : e).map((a) => {
|
|
2784
|
-
const
|
|
2784
|
+
const l = !s && !!t && t.type === a.type && t.cardId === a.cardId, f = JSON.stringify(a).replace(/'/g, "'");
|
|
2785
2785
|
return s ? `
|
|
2786
2786
|
<div
|
|
2787
2787
|
class="choco-widget-method-item choco-widget-method-item--edit"
|
|
@@ -2801,16 +2801,16 @@ function At(e, t, o, i = {}) {
|
|
|
2801
2801
|
</div>
|
|
2802
2802
|
` : `
|
|
2803
2803
|
<button
|
|
2804
|
-
class="choco-widget-method-item ${
|
|
2804
|
+
class="choco-widget-method-item ${l ? "choco-widget-method-item--selected" : ""}"
|
|
2805
2805
|
data-method='${f}'
|
|
2806
2806
|
data-action="select-method"
|
|
2807
2807
|
role="listitem"
|
|
2808
|
-
aria-label="${a.label}${
|
|
2808
|
+
aria-label="${a.label}${l ? " (выбрано)" : ""}"
|
|
2809
2809
|
type="button"
|
|
2810
2810
|
>
|
|
2811
2811
|
<div class="choco-widget-method-item-icon-wrapper ${a.type}" aria-hidden="true">${Ee(a)}</div>
|
|
2812
2812
|
<div class="choco-widget-method-item-label">${a.label}</div>
|
|
2813
|
-
${
|
|
2813
|
+
${l ? tn : ""}
|
|
2814
2814
|
</button>
|
|
2815
2815
|
`;
|
|
2816
2816
|
}).join("");
|
|
@@ -2828,9 +2828,9 @@ function nn(e, t, o, i) {
|
|
|
2828
2828
|
</div>
|
|
2829
2829
|
<div class="choco-widget-balance-label-wrapper">
|
|
2830
2830
|
<div class="choco-widget-balance-icon">
|
|
2831
|
-
${
|
|
2831
|
+
${Xe}
|
|
2832
2832
|
</div>
|
|
2833
|
-
<div class="choco-widget-balance-amount">${s ?
|
|
2833
|
+
<div class="choco-widget-balance-amount">${s ? V(e.amount, "ru", i) : 0}</div>
|
|
2834
2834
|
<label class="choco-widget-toggle">
|
|
2835
2835
|
<input type="checkbox" ${t ? "checked" : ""} />
|
|
2836
2836
|
<span class="choco-widget-toggle-slider"></span>
|
|
@@ -2839,17 +2839,23 @@ function nn(e, t, o, i) {
|
|
|
2839
2839
|
</div>
|
|
2840
2840
|
`;
|
|
2841
2841
|
}
|
|
2842
|
-
function rn(e, t, o) {
|
|
2842
|
+
function rn(e, t, o, i) {
|
|
2843
2843
|
if (!e) return "";
|
|
2844
|
-
const
|
|
2844
|
+
const s = new Date(e.expires_at), u = isNaN(s.getTime()) ? "" : `${String(s.getDate()).padStart(2, "0")}.${String(s.getMonth() + 1).padStart(2, "0")}`, a = u ? o("couponUntil", { date: u }) : "", l = Number(e.reward_amount), f = Number.isFinite(l) && l > 0 ? V(l, "ru", i) : null;
|
|
2845
2845
|
return `
|
|
2846
2846
|
<div class="choco-widget-balance-toggle" data-action="toggle-coupon">
|
|
2847
2847
|
<div class="choco-widget-balance-info">
|
|
2848
2848
|
<div class="choco-widget-balance-text">
|
|
2849
|
-
<div class="choco-widget-balance-label">${o("coupon")}${
|
|
2849
|
+
<div class="choco-widget-balance-label">${o("coupon")}${a ? ` <span style="color:#767485">(${a})</span>` : ""}</div>
|
|
2850
2850
|
</div>
|
|
2851
2851
|
</div>
|
|
2852
2852
|
<div class="choco-widget-balance-label-wrapper">
|
|
2853
|
+
${f ? `
|
|
2854
|
+
<div class="choco-widget-balance-icon">
|
|
2855
|
+
${Xe}
|
|
2856
|
+
</div>
|
|
2857
|
+
<div class="choco-widget-balance-amount">${f}</div>
|
|
2858
|
+
` : ""}
|
|
2853
2859
|
<label class="choco-widget-toggle">
|
|
2854
2860
|
<input type="checkbox" ${t ? "checked" : ""} />
|
|
2855
2861
|
<span class="choco-widget-toggle-slider"></span>
|
|
@@ -2858,7 +2864,7 @@ function rn(e, t, o) {
|
|
|
2858
2864
|
</div>
|
|
2859
2865
|
`;
|
|
2860
2866
|
}
|
|
2861
|
-
function on(e, t, o, i, s, u, a,
|
|
2867
|
+
function on(e, t, o, i, s, u, a, l) {
|
|
2862
2868
|
if (!e && !o && !s) return "";
|
|
2863
2869
|
const f = e ? `
|
|
2864
2870
|
<div class="choco-widget-balance-toggle" data-action="toggle-balance">
|
|
@@ -2869,7 +2875,7 @@ function on(e, t, o, i, s, u, a, d) {
|
|
|
2869
2875
|
</div>
|
|
2870
2876
|
<div class="choco-widget-balance-label-wrapper">
|
|
2871
2877
|
<div class="choco-widget-balance-icon">
|
|
2872
|
-
${
|
|
2878
|
+
${Xe}
|
|
2873
2879
|
</div>
|
|
2874
2880
|
<div class="choco-widget-balance-amount">${e}</div>
|
|
2875
2881
|
<label class="choco-widget-toggle">
|
|
@@ -2881,9 +2887,9 @@ function on(e, t, o, i, s, u, a, d) {
|
|
|
2881
2887
|
` : "";
|
|
2882
2888
|
return `
|
|
2883
2889
|
<div class="choco-widget-balance-section">
|
|
2884
|
-
${rn(s, u, a)}
|
|
2890
|
+
${rn(s, u, a, l)}
|
|
2885
2891
|
${f}
|
|
2886
|
-
${nn(o, i, a,
|
|
2892
|
+
${nn(o, i, a, l)}
|
|
2887
2893
|
</div>
|
|
2888
2894
|
`;
|
|
2889
2895
|
}
|
|
@@ -2907,7 +2913,7 @@ function an(e) {
|
|
|
2907
2913
|
paymentMethod: s,
|
|
2908
2914
|
methods: u,
|
|
2909
2915
|
selectedMethod: a,
|
|
2910
|
-
balanceFormatted:
|
|
2916
|
+
balanceFormatted: l,
|
|
2911
2917
|
useBalance: f,
|
|
2912
2918
|
bonuses: C,
|
|
2913
2919
|
useBonuses: S,
|
|
@@ -2919,7 +2925,7 @@ function an(e) {
|
|
|
2919
2925
|
loading: k,
|
|
2920
2926
|
t: b,
|
|
2921
2927
|
currency: w
|
|
2922
|
-
} = e, L = (s == null ? void 0 : s.label) ?? b("selectMethod"), O = Ee(s), J = At(u, a), N = on(
|
|
2928
|
+
} = e, L = (s == null ? void 0 : s.label) ?? b("selectMethod"), O = Ee(s), J = At(u, a), N = on(l, f, C, S, _, E, b, w), q = sn(P, b), F = (a == null ? void 0 : a.type) === "google_pay", x = (a == null ? void 0 : a.type) === "apple_pay", M = F || x;
|
|
2923
2929
|
return `
|
|
2924
2930
|
<div class="choco-widget-bottom-bar" role="region" aria-label="${b("paymentMethod")}">
|
|
2925
2931
|
${N}
|
|
@@ -3073,10 +3079,10 @@ function hn(e) {
|
|
|
3073
3079
|
var S, _, E, P, T;
|
|
3074
3080
|
if (!ut(e)) return;
|
|
3075
3081
|
e.container.style.setProperty("--choco-widget-accent-color", e.config.color), e.container.classList.remove("choco-one-click-widget--visible");
|
|
3076
|
-
const t = e.getAvailablePaymentMethods(), o = (S = e.checkoutContext) == null ? void 0 : S.data, i = e.config.currency || "KZT", s = (P = (E = (_ = o == null ? void 0 : o.balance) == null ? void 0 : _.data) == null ? void 0 : E.money) == null ? void 0 : P[i], u = s > 0 ?
|
|
3082
|
+
const t = e.getAvailablePaymentMethods(), o = (S = e.checkoutContext) == null ? void 0 : S.data, i = e.config.currency || "KZT", s = (P = (E = (_ = o == null ? void 0 : o.balance) == null ? void 0 : _.data) == null ? void 0 : E.money) == null ? void 0 : P[i], u = s > 0 ? V(s, e.config.locale, e.config.currency) : null, a = (T = o == null ? void 0 : o.cashback) == null ? void 0 : T.data, l = (a == null ? void 0 : a.cashbackAmount) > 0 ? V(a.cashbackAmount, e.config.locale, e.config.currency) : null, f = e._getPayableAmount(), C = f < e.config.amount;
|
|
3077
3083
|
e.container.innerHTML = an({
|
|
3078
|
-
amountFormatted:
|
|
3079
|
-
originalAmountFormatted:
|
|
3084
|
+
amountFormatted: V(f, e.config.locale, e.config.currency),
|
|
3085
|
+
originalAmountFormatted: V(
|
|
3080
3086
|
e.config.amount,
|
|
3081
3087
|
e.config.locale,
|
|
3082
3088
|
e.config.currency
|
|
@@ -3091,7 +3097,7 @@ function hn(e) {
|
|
|
3091
3097
|
useBonuses: e.useBonuses,
|
|
3092
3098
|
coupon: e.selectedCoupon,
|
|
3093
3099
|
useCoupon: e.useCoupon,
|
|
3094
|
-
cashbackFormatted:
|
|
3100
|
+
cashbackFormatted: l,
|
|
3095
3101
|
disabled: e.disabled,
|
|
3096
3102
|
paymentMethodDisabled: e.paymentMethodDisabled,
|
|
3097
3103
|
loading: e.loading,
|
|
@@ -3155,12 +3161,12 @@ function pe(e) {
|
|
|
3155
3161
|
), u = (T = e.container) == null ? void 0 : T.querySelector(
|
|
3156
3162
|
".choco-widget-google-pay-amount-value-number"
|
|
3157
3163
|
);
|
|
3158
|
-
const a = e._getPayableAmount(),
|
|
3164
|
+
const a = e._getPayableAmount(), l = V(a, e.config.locale, e.config.currency), f = a < e.config.amount, C = V(
|
|
3159
3165
|
e.config.amount,
|
|
3160
3166
|
e.config.locale,
|
|
3161
3167
|
e.config.currency
|
|
3162
3168
|
);
|
|
3163
|
-
if (t && (t.textContent = `${e.t("pay")} ${
|
|
3169
|
+
if (t && (t.textContent = `${e.t("pay")} ${l}`, t.setAttribute("aria-label", `${e.t("pay")} ${l}`)), i && (i.textContent = `${e.t("total")} ${l}`), !f) {
|
|
3164
3170
|
s == null || s.remove();
|
|
3165
3171
|
return;
|
|
3166
3172
|
}
|
|
@@ -3172,11 +3178,11 @@ function dt(e) {
|
|
|
3172
3178
|
var f, C, S, _, E, P, T, B, k, b;
|
|
3173
3179
|
const t = ((f = e.selectedPaymentMethod) == null ? void 0 : f.type) === "google_pay", o = ((C = e.selectedPaymentMethod) == null ? void 0 : C.type) === "apple_pay", i = t || o, s = (S = e.container) == null ? void 0 : S.querySelector(".choco-widget-pay-button"), u = (_ = e.container) == null ? void 0 : _.querySelector(
|
|
3174
3180
|
".choco-widget-google-pay-amount"
|
|
3175
|
-
), a = (E = e.container) == null ? void 0 : E.querySelector(".choco-widget-google-pay-row"),
|
|
3181
|
+
), a = (E = e.container) == null ? void 0 : E.querySelector(".choco-widget-google-pay-row"), l = (P = e.container) == null ? void 0 : P.querySelector(".choco-widget-apple-pay-row");
|
|
3176
3182
|
if (s == null || s.classList.toggle("choco-widget-pay-button--hidden", i), u == null || u.classList.toggle(
|
|
3177
3183
|
"choco-widget-google-pay-amount--hidden",
|
|
3178
3184
|
!i
|
|
3179
|
-
), a == null || a.classList.toggle("choco-widget-google-pay-row--hidden", !t),
|
|
3185
|
+
), a == null || a.classList.toggle("choco-widget-google-pay-row--hidden", !t), l == null || l.classList.toggle("choco-widget-apple-pay-row--hidden", !o), t) {
|
|
3180
3186
|
fn(e);
|
|
3181
3187
|
const w = (T = e.container) == null ? void 0 : T.querySelector(
|
|
3182
3188
|
'[data-action="apple-pay-button-slot"]'
|
|
@@ -3200,11 +3206,11 @@ function dt(e) {
|
|
|
3200
3206
|
pe(e), te(e);
|
|
3201
3207
|
}
|
|
3202
3208
|
async function fn(e) {
|
|
3203
|
-
var a,
|
|
3209
|
+
var a, l, f, C, S;
|
|
3204
3210
|
const t = (a = e.container) == null ? void 0 : a.querySelector(
|
|
3205
3211
|
'[data-action="google-pay-button-slot"]'
|
|
3206
3212
|
);
|
|
3207
|
-
if (!t || (t.innerHTML = "", ((
|
|
3213
|
+
if (!t || (t.innerHTML = "", ((l = e.selectedPaymentMethod) == null ? void 0 : l.type) !== "google_pay")) return;
|
|
3208
3214
|
const o = ++e._googlePayButtonRenderVersion;
|
|
3209
3215
|
try {
|
|
3210
3216
|
await e._loadGooglePaySdk();
|
|
@@ -3269,10 +3275,10 @@ function j(e) {
|
|
|
3269
3275
|
".choco-widget-apple-pay-button-slot button"
|
|
3270
3276
|
), u = (B = e.container) == null ? void 0 : B.querySelector(
|
|
3271
3277
|
".choco-widget-google-pay-amount"
|
|
3272
|
-
), a = (k = e.container) == null ? void 0 : k.querySelector(".choco-widget-google-pay-row"),
|
|
3278
|
+
), a = (k = e.container) == null ? void 0 : k.querySelector(".choco-widget-google-pay-row"), l = (b = e.container) == null ? void 0 : b.querySelector(".choco-widget-apple-pay-row"), f = (w = e.container) == null ? void 0 : w.querySelector(
|
|
3273
3279
|
".choco-widget-balance-section"
|
|
3274
3280
|
), C = e._isInteractionBlocked(), S = e.paymentMethodDisabled || C;
|
|
3275
|
-
t && (t.disabled = S), o && (o.disabled = C, o.classList.remove("choco-widget-pay-button--loading")), i && (i.disabled = C), s && (s.disabled = C), u == null || u.classList.toggle("choco-widget-wallet-blocked", C), u == null || u.setAttribute("aria-disabled", String(C)), a == null || a.classList.toggle("choco-widget-wallet-blocked", C), a == null || a.setAttribute("aria-disabled", String(C)),
|
|
3281
|
+
t && (t.disabled = S), o && (o.disabled = C, o.classList.remove("choco-widget-pay-button--loading")), i && (i.disabled = C), s && (s.disabled = C), u == null || u.classList.toggle("choco-widget-wallet-blocked", C), u == null || u.setAttribute("aria-disabled", String(C)), a == null || a.classList.toggle("choco-widget-wallet-blocked", C), a == null || a.setAttribute("aria-disabled", String(C)), l == null || l.classList.toggle("choco-widget-wallet-blocked", C), l == null || l.setAttribute("aria-disabled", String(C)), f == null || f.classList.remove("disabled");
|
|
3276
3282
|
}
|
|
3277
3283
|
function te(e) {
|
|
3278
3284
|
var _, E, P, T, B, k, b, w;
|
|
@@ -3282,10 +3288,10 @@ function te(e) {
|
|
|
3282
3288
|
".choco-widget-apple-pay-button-slot button"
|
|
3283
3289
|
), u = (B = e.container) == null ? void 0 : B.querySelector(
|
|
3284
3290
|
".choco-widget-google-pay-amount"
|
|
3285
|
-
), a = (k = e.container) == null ? void 0 : k.querySelector(".choco-widget-google-pay-row"),
|
|
3291
|
+
), a = (k = e.container) == null ? void 0 : k.querySelector(".choco-widget-google-pay-row"), l = (b = e.container) == null ? void 0 : b.querySelector(".choco-widget-apple-pay-row"), f = (w = e.container) == null ? void 0 : w.querySelector(
|
|
3286
3292
|
".choco-widget-balance-section"
|
|
3287
3293
|
), C = e._isInteractionBlocked(), S = e.paymentMethodDisabled || C;
|
|
3288
|
-
f == null || f.classList.toggle("disabled", C), t && (t.disabled = S), o && (o.disabled = C, o.classList.toggle("choco-widget-pay-button--loading", e.loading)), i && (i.disabled = C), s && (s.disabled = C), u == null || u.classList.toggle("choco-widget-wallet-blocked", C), u == null || u.setAttribute("aria-disabled", String(C)), a == null || a.classList.toggle("choco-widget-wallet-blocked", C), a == null || a.setAttribute("aria-disabled", String(C)),
|
|
3294
|
+
f == null || f.classList.toggle("disabled", C), t && (t.disabled = S), o && (o.disabled = C, o.classList.toggle("choco-widget-pay-button--loading", e.loading)), i && (i.disabled = C), s && (s.disabled = C), u == null || u.classList.toggle("choco-widget-wallet-blocked", C), u == null || u.setAttribute("aria-disabled", String(C)), a == null || a.classList.toggle("choco-widget-wallet-blocked", C), a == null || a.setAttribute("aria-disabled", String(C)), l == null || l.classList.toggle("choco-widget-wallet-blocked", C), l == null || l.setAttribute("aria-disabled", String(C));
|
|
3289
3295
|
}
|
|
3290
3296
|
function ht(e) {
|
|
3291
3297
|
var o;
|
|
@@ -3293,7 +3299,7 @@ function ht(e) {
|
|
|
3293
3299
|
const t = (o = e.container) == null ? void 0 : o.querySelector('[data-sheet="payment"]');
|
|
3294
3300
|
t && (t.classList.add("choco-widget-payment-sheet--open"), e.isPaymentSheetOpen = !0, ue(e));
|
|
3295
3301
|
}
|
|
3296
|
-
function
|
|
3302
|
+
function Y(e) {
|
|
3297
3303
|
var o;
|
|
3298
3304
|
const t = (o = e.container) == null ? void 0 : o.querySelector('[data-sheet="payment"]');
|
|
3299
3305
|
if (t) {
|
|
@@ -3306,10 +3312,10 @@ function ue(e) {
|
|
|
3306
3312
|
var f;
|
|
3307
3313
|
const t = (f = e.container) == null ? void 0 : f.querySelector('[data-sheet="payment"]');
|
|
3308
3314
|
if (!t) return;
|
|
3309
|
-
const o = t.querySelector(".choco-widget-sheet-title"), i = t.querySelector('[data-action="close-sheet"]'), s = t.querySelector('[data-action="edit-sheet"]'), u = t.querySelector('[data-action="previous-sheet"]'),
|
|
3310
|
-
e.isPaymentSheetEditMode ? (t.classList.add("choco-widget-payment-sheet--edit"), o && (o.textContent = e.t("editCards")), i && (i.style.display = "none"), s && (s.style.display = "none"), u && (u.style.display = "")) : (t.classList.remove("choco-widget-payment-sheet--edit"), t.classList.toggle("choco-widget-payment-sheet--no-cards", !
|
|
3315
|
+
const o = t.querySelector(".choco-widget-sheet-title"), i = t.querySelector('[data-action="close-sheet"]'), s = t.querySelector('[data-action="edit-sheet"]'), u = t.querySelector('[data-action="previous-sheet"]'), l = e.getAvailablePaymentMethods().some((C) => C.type === "card");
|
|
3316
|
+
e.isPaymentSheetEditMode ? (t.classList.add("choco-widget-payment-sheet--edit"), o && (o.textContent = e.t("editCards")), i && (i.style.display = "none"), s && (s.style.display = "none"), u && (u.style.display = "")) : (t.classList.remove("choco-widget-payment-sheet--edit"), t.classList.toggle("choco-widget-payment-sheet--no-cards", !l), o && (o.textContent = e.t("paymentMethods")), i && (i.style.display = ""), s && (s.style.display = l ? "" : "none"), u && (u.style.display = "none"));
|
|
3311
3317
|
}
|
|
3312
|
-
function
|
|
3318
|
+
function et(e) {
|
|
3313
3319
|
if (!e.addCardActionUrl || !e.container) return;
|
|
3314
3320
|
const t = e.container.querySelector('[data-sheet="add-card"]'), o = e.container.querySelector(
|
|
3315
3321
|
"#choco-widget-add-card-iframe"
|
|
@@ -3348,12 +3354,12 @@ function ve(e) {
|
|
|
3348
3354
|
t == null || t.classList.remove("choco-widget-payment-sheet--delete-confirm"), ue(e);
|
|
3349
3355
|
}
|
|
3350
3356
|
function Ne(e, t) {
|
|
3351
|
-
var u, a,
|
|
3357
|
+
var u, a, l;
|
|
3352
3358
|
const o = (u = e.container) == null ? void 0 : u.querySelector(
|
|
3353
3359
|
".choco-widget-sheet-delete-confirm-actions"
|
|
3354
3360
|
), i = (a = e.container) == null ? void 0 : a.querySelector(
|
|
3355
3361
|
'[data-action="confirm-delete-cancel"]'
|
|
3356
|
-
), s = (
|
|
3362
|
+
), s = (l = e.container) == null ? void 0 : l.querySelector(
|
|
3357
3363
|
'[data-action="confirm-delete-submit"]'
|
|
3358
3364
|
);
|
|
3359
3365
|
o == null || o.classList.toggle("choco-widget-sheet-delete-confirm-actions--loading", t), i && (i.disabled = t), s && (s.disabled = t, s.classList.toggle("choco-widget-delete-confirm-btn--loading", t));
|
|
@@ -3379,15 +3385,15 @@ async function mn(e, t) {
|
|
|
3379
3385
|
function ft(e, t) {
|
|
3380
3386
|
if (!e._isInteractionBlocked()) {
|
|
3381
3387
|
if (e.selectedPaymentMethod = t, e._emitPaymentMethodSelected(), t.type === "new_card") {
|
|
3382
|
-
e._emitUserEvent("one_click_pay_method_resolved", { payment_method: t.type }),
|
|
3388
|
+
e._emitUserEvent("one_click_pay_method_resolved", { payment_method: t.type }), Y(e), e.handlePayment();
|
|
3383
3389
|
return;
|
|
3384
3390
|
}
|
|
3385
3391
|
e._emitUserEvent("one_click_pay_method_resolved", {
|
|
3386
3392
|
payment_method: e._getPaymentMethodForUserEvent()
|
|
3387
|
-
}), Ae(e),
|
|
3393
|
+
}), Ae(e), Y(e), lt(e);
|
|
3388
3394
|
}
|
|
3389
3395
|
}
|
|
3390
|
-
function
|
|
3396
|
+
function tt(e, t) {
|
|
3391
3397
|
var i;
|
|
3392
3398
|
const o = t.type || ((i = t.data) == null ? void 0 : i.type);
|
|
3393
3399
|
if (!o) {
|
|
@@ -3429,15 +3435,15 @@ function ce(e, t) {
|
|
|
3429
3435
|
e.apiUrl,
|
|
3430
3436
|
e._getApiConfig(),
|
|
3431
3437
|
String(t)
|
|
3432
|
-
),
|
|
3433
|
-
if (
|
|
3438
|
+
), l = a == null ? void 0 : a.status, f = (a == null ? void 0 : a.payload) || {};
|
|
3439
|
+
if (l === "success") {
|
|
3434
3440
|
e._orderStatusResolved = !0, ee(e), pt(e, {
|
|
3435
3441
|
id: String(f.id || t),
|
|
3436
3442
|
attributes: { amount: f.amount, paid_at: f.paid_at || "" }
|
|
3437
3443
|
});
|
|
3438
3444
|
return;
|
|
3439
3445
|
}
|
|
3440
|
-
|
|
3446
|
+
l === "fail" && (e._orderStatusResolved = !0, ee(e), Ct(e, {
|
|
3441
3447
|
id: String(f.id || t),
|
|
3442
3448
|
attributes: { message: f.message || e.t("paymentError") }
|
|
3443
3449
|
}));
|
|
@@ -3448,14 +3454,14 @@ function ce(e, t) {
|
|
|
3448
3454
|
};
|
|
3449
3455
|
e._orderStatusPollingId = setInterval(u, o), u();
|
|
3450
3456
|
}
|
|
3451
|
-
function
|
|
3457
|
+
function Ue() {
|
|
3452
3458
|
return typeof document > "u" ? !1 : document.hidden || document.visibilityState === "hidden";
|
|
3453
3459
|
}
|
|
3454
3460
|
function gt(e, t) {
|
|
3455
3461
|
j(e), e.config.onSuccess(t);
|
|
3456
3462
|
}
|
|
3457
3463
|
function Te(e) {
|
|
3458
|
-
if (!e._pendingSuccessPayload ||
|
|
3464
|
+
if (!e._pendingSuccessPayload || Ue()) return;
|
|
3459
3465
|
const t = e._pendingSuccessPayload;
|
|
3460
3466
|
e._pendingSuccessPayload = null, gt(e, t);
|
|
3461
3467
|
}
|
|
@@ -3463,7 +3469,7 @@ function pt(e, t) {
|
|
|
3463
3469
|
var s, u;
|
|
3464
3470
|
e.isAddCardViewOpen && ae(e);
|
|
3465
3471
|
const o = t.attributes || ((s = t.data) == null ? void 0 : s.attributes) || {}, i = { id: t.id || ((u = t.data) == null ? void 0 : u.id), attributes: o };
|
|
3466
|
-
if (
|
|
3472
|
+
if (Ue()) {
|
|
3467
3473
|
e._pendingSuccessPayload = i;
|
|
3468
3474
|
return;
|
|
3469
3475
|
}
|
|
@@ -3476,7 +3482,7 @@ function Ct(e, t) {
|
|
|
3476
3482
|
e.config.onError({ id: t.id || ((s = t.data) == null ? void 0 : s.id), attributes: o });
|
|
3477
3483
|
}
|
|
3478
3484
|
function bn(e, t) {
|
|
3479
|
-
var u, a,
|
|
3485
|
+
var u, a, l;
|
|
3480
3486
|
const o = t.attributes || ((u = t.data) == null ? void 0 : u.attributes) || {}, i = o.action_link || o.action_url, s = o.action_url_type || o.action_type || "redirect";
|
|
3481
3487
|
if (!i) {
|
|
3482
3488
|
console.error(e.t("errorActionUrlMissing")), e.waitingForNewCardAction && (e.waitingForNewCardAction = !1, j(e), e.config.onError({ attributes: { message: e.t("errorNoServerResponse") } }));
|
|
@@ -3487,7 +3493,7 @@ function bn(e, t) {
|
|
|
3487
3493
|
return;
|
|
3488
3494
|
}
|
|
3489
3495
|
if (((a = e.selectedPaymentMethod) == null ? void 0 : a.type) === "kaspi_pay") {
|
|
3490
|
-
const f = t.id || ((
|
|
3496
|
+
const f = t.id || ((l = t.data) == null ? void 0 : l.id);
|
|
3491
3497
|
if (f && !e._orderStatusResolved && !e._orderStatusPollingId && ce(e, String(f)), typeof e.config.onKaspiLink == "function") {
|
|
3492
3498
|
e.config.onKaspiLink({
|
|
3493
3499
|
action_link: i,
|
|
@@ -3512,16 +3518,16 @@ async function En(e) {
|
|
|
3512
3518
|
if (e._isBalanceFullyCoveringAmount()) {
|
|
3513
3519
|
ne(e);
|
|
3514
3520
|
try {
|
|
3515
|
-
const a = await
|
|
3521
|
+
const a = await Ze(
|
|
3516
3522
|
e.apiUrl,
|
|
3517
3523
|
e._getApiConfig(),
|
|
3518
3524
|
e.deviceId,
|
|
3519
3525
|
e.selectedPaymentMethod,
|
|
3520
3526
|
t
|
|
3521
3527
|
);
|
|
3522
|
-
await
|
|
3523
|
-
const
|
|
3524
|
-
return
|
|
3528
|
+
await nt(e);
|
|
3529
|
+
const l = (a == null ? void 0 : a.id) ?? ((o = a == null ? void 0 : a.data) == null ? void 0 : o.id);
|
|
3530
|
+
return l && ce(e, String(l)), a;
|
|
3525
3531
|
} catch (a) {
|
|
3526
3532
|
throw j(e), e.config.onError({
|
|
3527
3533
|
attributes: { message: e._resolveErrorMessage(a) }
|
|
@@ -3542,16 +3548,16 @@ async function En(e) {
|
|
|
3542
3548
|
}
|
|
3543
3549
|
ne(e);
|
|
3544
3550
|
try {
|
|
3545
|
-
const a = await
|
|
3551
|
+
const a = await Ze(
|
|
3546
3552
|
e.apiUrl,
|
|
3547
3553
|
e._getApiConfig(),
|
|
3548
3554
|
e.deviceId,
|
|
3549
3555
|
e.selectedPaymentMethod,
|
|
3550
3556
|
t
|
|
3551
3557
|
);
|
|
3552
|
-
await
|
|
3553
|
-
const
|
|
3554
|
-
if (
|
|
3558
|
+
await nt(e);
|
|
3559
|
+
const l = (a == null ? void 0 : a.id) ?? ((i = a == null ? void 0 : a.data) == null ? void 0 : i.id);
|
|
3560
|
+
if (l && ce(e, String(l)), ((s = e.selectedPaymentMethod) == null ? void 0 : s.type) === "kaspi_pay") {
|
|
3555
3561
|
const f = (a == null ? void 0 : a.attributes) || ((u = a == null ? void 0 : a.data) == null ? void 0 : u.attributes) || {}, C = f.action_link || f.action_url, S = f.action_url_type || f.action_type || "redirect";
|
|
3556
3562
|
if (C)
|
|
3557
3563
|
return typeof e.config.onKaspiLink == "function" ? (e.config.onKaspiLink({
|
|
@@ -3566,7 +3572,7 @@ async function En(e) {
|
|
|
3566
3572
|
throw j(e), e.config.onError({ message: e._resolveErrorMessage(a) }), a;
|
|
3567
3573
|
}
|
|
3568
3574
|
}
|
|
3569
|
-
async function
|
|
3575
|
+
async function nt(e) {
|
|
3570
3576
|
var t, o;
|
|
3571
3577
|
if (!(((t = e.selectedPaymentMethod) == null ? void 0 : t.type) !== "card" || !((o = e.selectedPaymentMethod) != null && o.cardId)))
|
|
3572
3578
|
try {
|
|
@@ -3620,13 +3626,13 @@ async function Bn(e, t) {
|
|
|
3620
3626
|
}
|
|
3621
3627
|
}, s = new o(3, i);
|
|
3622
3628
|
se = s, s.onvalidatemerchant = async (u) => {
|
|
3623
|
-
var a,
|
|
3629
|
+
var a, l;
|
|
3624
3630
|
try {
|
|
3625
3631
|
const f = await Ft(
|
|
3626
3632
|
e.apiUrl,
|
|
3627
3633
|
e._getApiConfig(),
|
|
3628
3634
|
u.validationURL
|
|
3629
|
-
), C = ((
|
|
3635
|
+
), C = ((l = (a = f == null ? void 0 : f.data) == null ? void 0 : a.attributes) == null ? void 0 : l.session) || f, S = JSON.parse(atob(C));
|
|
3630
3636
|
s.completeMerchantValidation(S);
|
|
3631
3637
|
} catch (f) {
|
|
3632
3638
|
console.error("Apple Pay session error:", f), s.abort(), e.config.onError({ attributes: { message: e.t("errorApplePayInit") } });
|
|
@@ -3638,7 +3644,7 @@ async function Bn(e, t) {
|
|
|
3638
3644
|
const C = await e.config.onBeforeCheckout();
|
|
3639
3645
|
C && typeof C == "object" && Object.assign(e.config, C);
|
|
3640
3646
|
}
|
|
3641
|
-
const
|
|
3647
|
+
const l = await Jt(
|
|
3642
3648
|
e.apiUrl,
|
|
3643
3649
|
e._getApiConfig(),
|
|
3644
3650
|
e.deviceId,
|
|
@@ -3646,12 +3652,12 @@ async function Bn(e, t) {
|
|
|
3646
3652
|
t
|
|
3647
3653
|
);
|
|
3648
3654
|
s.completePayment(o.STATUS_SUCCESS), se = null;
|
|
3649
|
-
const f = (
|
|
3655
|
+
const f = (l == null ? void 0 : l.id) ?? ((a = l == null ? void 0 : l.data) == null ? void 0 : a.id);
|
|
3650
3656
|
f && ce(e, String(f));
|
|
3651
|
-
} catch (
|
|
3652
|
-
console.error("Apple Pay payment error:",
|
|
3657
|
+
} catch (l) {
|
|
3658
|
+
console.error("Apple Pay payment error:", l), s.completePayment(o.STATUS_FAILURE), j(e), e.config.onError({
|
|
3653
3659
|
attributes: {
|
|
3654
|
-
message: e._resolveErrorMessage(
|
|
3660
|
+
message: e._resolveErrorMessage(l, "errorApplePayPayment")
|
|
3655
3661
|
}
|
|
3656
3662
|
});
|
|
3657
3663
|
}
|
|
@@ -3666,8 +3672,8 @@ async function In(e, t) {
|
|
|
3666
3672
|
e.config.onError({ attributes: { message: e.t("errorGooglePayUnsupported") } });
|
|
3667
3673
|
return;
|
|
3668
3674
|
}
|
|
3669
|
-
const a = s == null ? void 0 : s.gateway,
|
|
3670
|
-
if (!a || !
|
|
3675
|
+
const a = s == null ? void 0 : s.gateway, l = s == null ? void 0 : s.merchant_id;
|
|
3676
|
+
if (!a || !l) {
|
|
3671
3677
|
e.config.onError({
|
|
3672
3678
|
attributes: { message: e.t("errorGooglePaySettingsUnavailable") }
|
|
3673
3679
|
});
|
|
@@ -3681,7 +3687,7 @@ async function In(e, t) {
|
|
|
3681
3687
|
return;
|
|
3682
3688
|
}
|
|
3683
3689
|
if (e.config.isNativeAndroid) {
|
|
3684
|
-
await Qn(e, t, { gateway: a, gatewayMerchantId:
|
|
3690
|
+
await Qn(e, t, { gateway: a, gatewayMerchantId: l });
|
|
3685
3691
|
return;
|
|
3686
3692
|
}
|
|
3687
3693
|
const _ = Number(e._getCheckoutAmount()).toFixed(2);
|
|
@@ -3706,7 +3712,7 @@ async function In(e, t) {
|
|
|
3706
3712
|
},
|
|
3707
3713
|
tokenizationSpecification: {
|
|
3708
3714
|
type: "PAYMENT_GATEWAY",
|
|
3709
|
-
parameters: { gateway: a, gatewayMerchantId:
|
|
3715
|
+
parameters: { gateway: a, gatewayMerchantId: l }
|
|
3710
3716
|
}
|
|
3711
3717
|
}
|
|
3712
3718
|
], T = {
|
|
@@ -3737,7 +3743,7 @@ async function In(e, t) {
|
|
|
3737
3743
|
ne(e);
|
|
3738
3744
|
const q = await B.loadPaymentData(T), F = (O = (L = q == null ? void 0 : q.paymentMethodData) == null ? void 0 : L.tokenizationData) == null ? void 0 : O.token;
|
|
3739
3745
|
if (!F) throw new Error(e.t("errorGooglePayPayment"));
|
|
3740
|
-
const x = JSON.parse(F), M = await
|
|
3746
|
+
const x = JSON.parse(F), M = await ct(
|
|
3741
3747
|
e.apiUrl,
|
|
3742
3748
|
e._getApiConfig(),
|
|
3743
3749
|
e.deviceId,
|
|
@@ -3765,14 +3771,14 @@ async function Qn(e, t, o) {
|
|
|
3765
3771
|
amount: Number(e._getCheckoutAmount()),
|
|
3766
3772
|
gateway: o.gateway,
|
|
3767
3773
|
gatewayMerchantId: o.gatewayMerchantId
|
|
3768
|
-
}), u = JSON.parse(s), a = await
|
|
3774
|
+
}), u = JSON.parse(s), a = await ct(
|
|
3769
3775
|
e.apiUrl,
|
|
3770
3776
|
e._getApiConfig(),
|
|
3771
3777
|
e.deviceId,
|
|
3772
3778
|
u,
|
|
3773
3779
|
t
|
|
3774
|
-
),
|
|
3775
|
-
|
|
3780
|
+
), l = (a == null ? void 0 : a.id) ?? ((i = a == null ? void 0 : a.data) == null ? void 0 : i.id);
|
|
3781
|
+
l && ce(e, String(l));
|
|
3776
3782
|
} catch (s) {
|
|
3777
3783
|
j(e), s.statusCode === "CANCELED" ? e.config.onCancel() : (e.config.onError({
|
|
3778
3784
|
attributes: {
|
|
@@ -3782,10 +3788,10 @@ async function Qn(e, t, o) {
|
|
|
3782
3788
|
}
|
|
3783
3789
|
}
|
|
3784
3790
|
function Sn(e) {
|
|
3785
|
-
var a,
|
|
3791
|
+
var a, l, f, C, S, _, E, P, T, B, k;
|
|
3786
3792
|
const t = e.container;
|
|
3787
|
-
(a = t.querySelector('[data-action="pay"]')) == null || a.addEventListener("click", () => e.handlePayment()), (
|
|
3788
|
-
e._pendingDeleteMethod ? ve(e) :
|
|
3793
|
+
(a = t.querySelector('[data-action="pay"]')) == null || a.addEventListener("click", () => e.handlePayment()), (l = t.querySelector('[data-action="change-method"]')) == null || l.addEventListener("click", () => ht(e)), t.querySelectorAll('[data-action="close"]').forEach((b) => b.addEventListener("click", () => e.close())), (f = t.querySelector('[data-action="close-sheet"]')) == null || f.addEventListener("click", () => {
|
|
3794
|
+
e._pendingDeleteMethod ? ve(e) : Y(e);
|
|
3789
3795
|
}), (C = t.querySelector('[data-action="edit-sheet"]')) == null || C.addEventListener("click", () => {
|
|
3790
3796
|
e.isPaymentSheetEditMode = !0, Ae(e), ue(e);
|
|
3791
3797
|
}), (S = t.querySelector('[data-action="previous-sheet"]')) == null || S.addEventListener("click", () => {
|
|
@@ -3793,7 +3799,7 @@ function Sn(e) {
|
|
|
3793
3799
|
}), (_ = t.querySelector('[data-action="close-add-card"]')) == null || _.addEventListener("click", () => ae(e)), (E = t.querySelector('[data-action="confirm-delete-cancel"]')) == null || E.addEventListener("click", () => ve(e)), (P = t.querySelector('[data-action="confirm-delete-submit"]')) == null || P.addEventListener("click", () => {
|
|
3794
3800
|
if (e._pendingDeleteMethod) {
|
|
3795
3801
|
const b = e._pendingDeleteMethod;
|
|
3796
|
-
Ne(e, !0), mn(e, b).then(() =>
|
|
3802
|
+
Ne(e, !0), mn(e, b).then(() => Y(e)).finally(() => Ne(e, !1));
|
|
3797
3803
|
}
|
|
3798
3804
|
}), t.querySelectorAll(".choco-widget-method-item").forEach((b) => {
|
|
3799
3805
|
b.addEventListener("click", (w) => {
|
|
@@ -3805,7 +3811,7 @@ function Sn(e) {
|
|
|
3805
3811
|
});
|
|
3806
3812
|
const o = t.querySelector('[data-sheet="payment"]');
|
|
3807
3813
|
o && (o.addEventListener("click", (b) => {
|
|
3808
|
-
b.target === o &&
|
|
3814
|
+
b.target === o && Y(e);
|
|
3809
3815
|
}), kn(e, o));
|
|
3810
3816
|
const i = t.querySelector('[data-action="toggle-balance"]');
|
|
3811
3817
|
i && ((T = i.querySelector("input[type='checkbox']")) == null || T.addEventListener("change", (b) => {
|
|
@@ -3822,37 +3828,37 @@ function Sn(e) {
|
|
|
3822
3828
|
}
|
|
3823
3829
|
function Pn(e, t) {
|
|
3824
3830
|
var o, i;
|
|
3825
|
-
e.isOpen && (t.key === "Escape" && (t.preventDefault(), e._pendingDeleteMethod ? ve(e) : e.isAddCardViewOpen ? ae(e) : e.isPaymentSheetOpen ?
|
|
3831
|
+
e.isOpen && (t.key === "Escape" && (t.preventDefault(), e._pendingDeleteMethod ? ve(e) : e.isAddCardViewOpen ? ae(e) : e.isPaymentSheetOpen ? Y(e) : e.close()), t.key === "Enter" && ((i = (o = t.target) == null ? void 0 : o.dataset) == null ? void 0 : i.action) === "pay" && (t.preventDefault(), e.handlePayment()));
|
|
3826
3832
|
}
|
|
3827
3833
|
function kn(e, t) {
|
|
3828
3834
|
const o = t.querySelector('[data-action="sheet-drag-handle"]'), i = t.querySelector(".choco-widget-sheet-content");
|
|
3829
3835
|
if (!o || !i) return;
|
|
3830
3836
|
const s = 80;
|
|
3831
3837
|
let u = 0, a = 0;
|
|
3832
|
-
const
|
|
3838
|
+
const l = (C) => {
|
|
3833
3839
|
a = C.clientY;
|
|
3834
3840
|
const S = Math.max(0, a - u);
|
|
3835
3841
|
i.style.transform = `translateY(${S}px)`;
|
|
3836
3842
|
}, f = (C) => {
|
|
3837
|
-
o.releasePointerCapture(C.pointerId), o.removeEventListener("pointermove",
|
|
3843
|
+
o.releasePointerCapture(C.pointerId), o.removeEventListener("pointermove", l), o.removeEventListener("pointerup", f), o.removeEventListener("pointercancel", f);
|
|
3838
3844
|
const S = Math.max(0, a - u);
|
|
3839
3845
|
if (i.classList.remove("choco-widget-sheet-content--dragging"), S >= s) {
|
|
3840
3846
|
i.style.transform = "translateY(100%)";
|
|
3841
3847
|
const _ = () => {
|
|
3842
|
-
i.removeEventListener("transitionend", _), i.style.transform = "",
|
|
3848
|
+
i.removeEventListener("transitionend", _), i.style.transform = "", Y(e);
|
|
3843
3849
|
};
|
|
3844
3850
|
i.addEventListener("transitionend", _);
|
|
3845
3851
|
} else
|
|
3846
3852
|
i.style.transform = "";
|
|
3847
3853
|
};
|
|
3848
3854
|
o.addEventListener("pointerdown", (C) => {
|
|
3849
|
-
!e.isPaymentSheetOpen || C.button !== 0 || (C.preventDefault(), u = C.clientY, a = C.clientY, i.classList.add("choco-widget-sheet-content--dragging"), o.setPointerCapture(C.pointerId), o.addEventListener("pointermove",
|
|
3855
|
+
!e.isPaymentSheetOpen || C.button !== 0 || (C.preventDefault(), u = C.clientY, a = C.clientY, i.classList.add("choco-widget-sheet-content--dragging"), o.setPointerCapture(C.pointerId), o.addEventListener("pointermove", l), o.addEventListener("pointerup", f), o.addEventListener("pointercancel", f));
|
|
3850
3856
|
});
|
|
3851
3857
|
}
|
|
3852
3858
|
class ie {
|
|
3853
3859
|
// ─── Статические методы / logout ─────────────────────────────────────────────
|
|
3854
3860
|
static _getAuthStorageValue(t) {
|
|
3855
|
-
return
|
|
3861
|
+
return at(t);
|
|
3856
3862
|
}
|
|
3857
3863
|
static _setAuthStorageValue(t, o) {
|
|
3858
3864
|
Re(t, o);
|
|
@@ -3861,11 +3867,11 @@ class ie {
|
|
|
3861
3867
|
be(t);
|
|
3862
3868
|
}
|
|
3863
3869
|
static async logout() {
|
|
3864
|
-
|
|
3870
|
+
$e();
|
|
3865
3871
|
}
|
|
3866
3872
|
// ─── Конструктор ──────────────────────────────────────────────────────────────
|
|
3867
3873
|
constructor(t) {
|
|
3868
|
-
this.config = qt(t), this.accessToken = null, this.deviceId =
|
|
3874
|
+
this.config = qt(t), this.accessToken = null, this.deviceId = rt(), this.apiUrl = Et(this.config.environment), this.translations = mt, this.checkoutContext = null, this.centrifuge = null, this.selectedPaymentMethod = null, this.selectedCoupon = null, this.useCoupon = !1, this.container = null, this.isOpen = !1, this.isPaymentSheetOpen = !1, this.isPaymentSheetEditMode = !1, this.loading = !1, this.disabled = !1, this.paymentMethodDisabled = !1, this.useBalance = !1, this.useBonuses = !1, this.addCardActionUrl = null, this.isAddCardViewOpen = !1, this.waitingForNewCardAction = !1, this.newCardActionRequiredTimeoutId = null, this._googlePayScriptPromise = null, this._googlePayButtonRenderVersion = 0, this._orderStatusPollingId = null, this._orderStatusResolved = !1, this._pendingDeleteMethod = null, this._pendingSuccessPayload = null, this._lifecycleListenersAttached = !1, this._boundAddCardMessage = null, this._boundKeyDown = (o) => Pn(this, o), this._boundVisibilityChange = () => this._onVisibilityChange(), this._boundWindowFocus = () => this._onWindowFocus(), this._boundPageShow = () => this._onPageShow();
|
|
3869
3875
|
}
|
|
3870
3876
|
// ─── Локализация ──────────────────────────────────────────────────────────────
|
|
3871
3877
|
t(t, o = {}) {
|
|
@@ -3873,7 +3879,7 @@ class ie {
|
|
|
3873
3879
|
const i = this.config.locale || "ru", s = ((u = this.translations[i]) == null ? void 0 : u[t]) || this.translations.ru[t];
|
|
3874
3880
|
return typeof s != "string" ? t : s.replace(
|
|
3875
3881
|
/{(\w+)}/g,
|
|
3876
|
-
(a,
|
|
3882
|
+
(a, l) => Object.prototype.hasOwnProperty.call(o, l) ? String(o[l]) : a
|
|
3877
3883
|
);
|
|
3878
3884
|
}
|
|
3879
3885
|
_resolveErrorMessage(t, o = "paymentError") {
|
|
@@ -3887,8 +3893,8 @@ class ie {
|
|
|
3887
3893
|
return this.disabled || this.loading;
|
|
3888
3894
|
}
|
|
3889
3895
|
_getBalanceAmount() {
|
|
3890
|
-
var s, u, a,
|
|
3891
|
-
const t = (
|
|
3896
|
+
var s, u, a, l;
|
|
3897
|
+
const t = (l = (a = (u = (s = this.checkoutContext) == null ? void 0 : s.data) == null ? void 0 : u.balance) == null ? void 0 : a.data) == null ? void 0 : l.money, o = this.config.currency || "KZT", i = Number(t == null ? void 0 : t[o]);
|
|
3892
3898
|
return Number.isFinite(i) && i > 0 ? i : 0;
|
|
3893
3899
|
}
|
|
3894
3900
|
_getBonusesAmount() {
|
|
@@ -3912,7 +3918,7 @@ class ie {
|
|
|
3912
3918
|
return Number.isFinite(t) && t > 0 ? t : 0;
|
|
3913
3919
|
}
|
|
3914
3920
|
_getPaymentBreakdown() {
|
|
3915
|
-
const t = this.config.amount, o = this._getBalanceAmount(), i = this.useBalance ? Math.min(o, t) : 0, s = t - i, u = this.useBalance && i >= t, a = this.useBonuses ? this._getAvailableBonus() : 0,
|
|
3921
|
+
const t = this.config.amount, o = this._getBalanceAmount(), i = this.useBalance ? Math.min(o, t) : 0, s = t - i, u = this.useBalance && i >= t, a = this.useBonuses ? this._getAvailableBonus() : 0, l = Math.max(s - a, 0), f = this._getCouponDiscount(), C = Math.max(l - f, 0), S = this.useBalance ? t : C, _ = this.useBalance && !u, E = this.useCoupon && this.selectedCoupon ? {
|
|
3916
3922
|
id: this.selectedCoupon.voucher_id,
|
|
3917
3923
|
template_id: this.selectedCoupon.template_id,
|
|
3918
3924
|
type: this.selectedCoupon.type
|
|
@@ -3962,7 +3968,7 @@ class ie {
|
|
|
3962
3968
|
pe(this);
|
|
3963
3969
|
}
|
|
3964
3970
|
_showAddCardView() {
|
|
3965
|
-
|
|
3971
|
+
et(this);
|
|
3966
3972
|
}
|
|
3967
3973
|
_closeAddCardView() {
|
|
3968
3974
|
ae(this);
|
|
@@ -3983,7 +3989,7 @@ class ie {
|
|
|
3983
3989
|
Me(t, o);
|
|
3984
3990
|
}
|
|
3985
3991
|
_clearAuthStorage() {
|
|
3986
|
-
|
|
3992
|
+
$e();
|
|
3987
3993
|
}
|
|
3988
3994
|
_getAuthStorageValue(t) {
|
|
3989
3995
|
return ie._getAuthStorageValue(t);
|
|
@@ -4024,7 +4030,7 @@ class ie {
|
|
|
4024
4030
|
this._lifecycleListenersAttached && (document.removeEventListener("visibilitychange", this._boundVisibilityChange), window.removeEventListener("focus", this._boundWindowFocus), window.removeEventListener("pageshow", this._boundPageShow), this._lifecycleListenersAttached = !1);
|
|
4025
4031
|
}
|
|
4026
4032
|
_onVisibilityChange() {
|
|
4027
|
-
|
|
4033
|
+
Ue() || Te(this);
|
|
4028
4034
|
}
|
|
4029
4035
|
_onWindowFocus() {
|
|
4030
4036
|
Te(this);
|
|
@@ -4083,9 +4089,9 @@ class ie {
|
|
|
4083
4089
|
return this.config.onError({ attributes: { message: u.message } }), !1;
|
|
4084
4090
|
}
|
|
4085
4091
|
await this._fetchCoupons();
|
|
4086
|
-
const i =
|
|
4092
|
+
const i = Ye(
|
|
4087
4093
|
(o = (t = this.checkoutContext) == null ? void 0 : t.data) == null ? void 0 : o.socket_connections,
|
|
4088
|
-
(s) =>
|
|
4094
|
+
(s) => tt(this, s)
|
|
4089
4095
|
);
|
|
4090
4096
|
return i && (this.centrifuge = i.centrifuge), this.selectedPaymentMethod = Le(
|
|
4091
4097
|
this.checkoutContext.data,
|
|
@@ -4143,7 +4149,7 @@ class ie {
|
|
|
4143
4149
|
ht(this);
|
|
4144
4150
|
}
|
|
4145
4151
|
closePaymentSheet() {
|
|
4146
|
-
|
|
4152
|
+
Y(this);
|
|
4147
4153
|
}
|
|
4148
4154
|
async updateAmount(t) {
|
|
4149
4155
|
if (typeof t != "number" || !Number.isFinite(t) || t < 0)
|
|
@@ -4164,7 +4170,7 @@ class ie {
|
|
|
4164
4170
|
const s = this.container.querySelector('[data-sheet="payment"]');
|
|
4165
4171
|
s && (s.classList.add("choco-widget-payment-sheet--open"), this.isPaymentSheetOpen = !0);
|
|
4166
4172
|
}
|
|
4167
|
-
i &&
|
|
4173
|
+
i && et(this);
|
|
4168
4174
|
}
|
|
4169
4175
|
async setLoading(t) {
|
|
4170
4176
|
this.loading = !!t, te(this);
|
|
@@ -4194,9 +4200,9 @@ class ie {
|
|
|
4194
4200
|
return this.config.onError({ attributes: { message: a.message } }), !1;
|
|
4195
4201
|
}
|
|
4196
4202
|
await this._fetchCoupons(), this.centrifuge && (this.centrifuge.disconnect(), this.centrifuge = null);
|
|
4197
|
-
const s =
|
|
4203
|
+
const s = Ye(
|
|
4198
4204
|
(i = (o = this.checkoutContext) == null ? void 0 : o.data) == null ? void 0 : i.socket_connections,
|
|
4199
|
-
(u) =>
|
|
4205
|
+
(u) => tt(this, u)
|
|
4200
4206
|
);
|
|
4201
4207
|
return s && (this.centrifuge = s.centrifuge), this.selectedPaymentMethod = Le(
|
|
4202
4208
|
this.checkoutContext.data,
|