UNPKG

@reclaimprotocol/browser-extension-sdk

Version:

This guide will walk you through integrating the Reclaim Protocol Browser Extension SDK into your own browser extension or web application. It covers installation, manifest configuration, background initialization, content script setup, and how to trigg

667 lines (591 loc) 13.5 kB
.reclaim-popup { position: fixed; bottom: 20px; right: 20px; width: 320px; max-height: 85vh; background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); color: #ffffff; border-radius: 16px; padding: 0; font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; z-index: 9999; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1); font-size: 13px; opacity: 1; transform: translateY(0); will-change: transform, opacity; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.1); overflow: hidden; } .reclaim-popup::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent); } .reclaim-popup.dragging { cursor: grabbing; user-select: none; box-shadow: 0 20px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.15); transform: scale(1.01); } .reclaim-popup-header { display: flex; align-items: center; padding: 12px 18px 8px 18px; margin-bottom: 0; cursor: grab; user-select: none; border-radius: 16px 16px 0 0; transition: all 0.2s ease; background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%); border-bottom: 1px solid rgba(255, 255, 255, 0.05); } .reclaim-popup-header:hover { background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.04) 100%); } .reclaim-popup-header:active { cursor: grabbing; } .reclaim-popup-content { padding: 8px 18px 16px 18px; display: flex; flex-direction: column; justify-content: center; min-height: 280px; max-height: 400px; overflow-y: auto; } .reclaim-popup-logo { width: 24px; height: 24px; margin-right: 10px; pointer-events: none; border-radius: 4px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); } .reclaim-popup-title { margin: 0; font-size: 16px; font-weight: 700; pointer-events: none; background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; letter-spacing: -0.01em; } /* Compact info grid */ .reclaim-info-grid { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; } .reclaim-info-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: rgba(255, 255, 255, 0.02); border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.05); transition: all 0.2s ease; } .reclaim-info-item:hover { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.08); } .reclaim-info-label { color: rgba(255, 255, 255, 0.6); font-size: 9px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; flex-shrink: 0; margin-right: 8px; width: 90px; } .reclaim-info-value { color: #ffffff; font-size: 13px; font-weight: 600; text-align: right; line-height: 1.3; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; transition: all 0.2s ease; position: relative; flex: 1; } .reclaim-info-value:hover { color: #3b82f6; } .reclaim-info-value.expandable { cursor: pointer; } .reclaim-info-value.expanded { white-space: normal; word-break: break-word; text-overflow: clip; overflow: visible; max-width: none; } .reclaim-info-tooltip { position: absolute; background: linear-gradient(135deg, #1f2937 0%, #111827 100%); color: #ffffff; padding: 8px 12px; border-radius: 8px; font-size: 12px; font-weight: 500; white-space: normal; word-break: break-word; max-width: 280px; right: 0; top: 100%; margin-top: 8px; opacity: 0; pointer-events: none; transition: all 0.2s ease; z-index: 10001; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 255, 255, 0.1); } .reclaim-info-tooltip.show { opacity: 1; pointer-events: auto; } .reclaim-info-tooltip::before { content: ""; position: absolute; top: -6px; right: 12px; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 6px solid #1f2937; } /* Session section */ .reclaim-session-section { display: flex; align-items: center; justify-content: space-between; padding: 12px; background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(5, 150, 105, 0.04) 100%); border-radius: 8px; border: 1px solid rgba(16, 185, 129, 0.15); margin-bottom: 12px; position: relative; } .reclaim-session-content { display: flex; flex-direction: column; flex: 1; min-width: 0; } .reclaim-session-content .reclaim-info-label { margin-bottom: 4px; } .reclaim-session-content .reclaim-info-value { text-align: left; font-size: 12px; font-family: "SF Mono", "Monaco", "Menlo", monospace; word-break: break-all; } .reclaim-copy-icon { cursor: pointer; padding: 6px; border-radius: 6px; transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); margin-left: 8px; flex-shrink: 0; } .reclaim-copy-icon:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.2); transform: translateY(-1px); } .reclaim-copy-icon:active { transform: translateY(0); } .reclaim-copy-icon svg { width: 14px; height: 14px; fill: rgba(255, 255, 255, 0.8); transition: fill 0.2s ease; } .reclaim-copy-icon:hover svg { fill: #ffffff; } .reclaim-copy-feedback { position: absolute; background: linear-gradient(135deg, #10b981 0%, #059669 100%); color: #ffffff; padding: 4px 8px; border-radius: 6px; font-size: 11px; font-weight: 500; transform: translateX(-50%); white-space: nowrap; pointer-events: none; opacity: 0; transition: all 0.2s ease; z-index: 10000; box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3); top: -32px; left: 50%; } .reclaim-copy-feedback.show { opacity: 1; transform: translateX(-50%) translateY(-2px); } /* Combined verification container */ .reclaim-verification-container { margin-bottom: 4px; transform: translateY(0); opacity: 1; will-change: transform, opacity; transition: all 0.3s ease; } /* Compact steps */ .reclaim-steps-container { padding: 12px; background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(37, 99, 235, 0.04) 100%); border-radius: 10px; border: 1px solid rgba(59, 130, 246, 0.15); transform: translateY(0); opacity: 1; will-change: transform, opacity; transition: all 0.3s ease; } .reclaim-steps-container.hidden { display: none; } .reclaim-steps-header { display: flex; align-items: center; margin-bottom: 8px; } .reclaim-steps-icon { font-size: 12px; margin-right: 6px; } .reclaim-steps-title { font-size: 13px; font-weight: 600; color: #ffffff; } .reclaim-steps-list { display: flex; flex-direction: column; gap: 6px; } .reclaim-step { display: flex; align-items: center; padding: 8px 10px; background: rgba(255, 255, 255, 0.02); border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.05); transition: all 0.2s ease; } .reclaim-step:hover { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.08); } .reclaim-step-number { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); color: white; border-radius: 50%; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; margin-right: 8px; flex-shrink: 0; box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3); } .reclaim-step-text { font-size: 12px; line-height: 1.4; color: rgba(255, 255, 255, 0.9); font-weight: 500; } /* Status container */ .reclaim-status-container { padding: 12px; background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(5, 150, 105, 0.04) 100%); border-radius: 10px; border: 1px solid rgba(16, 185, 129, 0.15); transform: translateY(8px); opacity: 0; will-change: transform, opacity; transition: all 0.3s ease; margin-top: 12px; display: none; } .reclaim-status-container.visible { transform: translateY(0); opacity: 1; display: block; } /* Adjust content spacing when status is visible */ .reclaim-popup-content:has(.reclaim-status-container.visible) { justify-content: flex-start; padding-top: 20px; } /* Alternative for browsers that don't support :has() */ .reclaim-popup-content.status-active { justify-content: flex-start; padding-top: 20px; } .reclaim-status-progress { display: flex; flex-direction: column; margin-bottom: 10px; } .reclaim-progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; } .reclaim-status-text { font-size: 13px; font-weight: 600; color: #ffffff; } .reclaim-progress-counter { font-size: 11px; color: rgba(255, 255, 255, 0.7); font-weight: 500; padding: 2px 6px; background: rgba(255, 255, 255, 0.1); border-radius: 4px; } .reclaim-progress-bar-container { height: 4px; width: 100%; background: rgba(255, 255, 255, 0.1); border-radius: 2px; overflow: hidden; position: relative; } .reclaim-progress-bar-container::before { content: ""; position: absolute; top: 0; left: 0; height: 100%; width: 100%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent); animation: reclaim-shimmer 2s infinite; } .reclaim-progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, #3b82f6 0%, #06b6d4 100%); border-radius: 2px; transform: scaleX(0); transform-origin: left; will-change: transform; transition: transform 0.3s ease; position: relative; overflow: hidden; } .reclaim-progress-bar::after { content: ""; position: absolute; top: 0; left: 0; height: 100%; width: 100%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent); animation: reclaim-progress-shine 2s infinite; } .reclaim-progress-bar.success { background: linear-gradient(90deg, #10b981 0%, #059669 100%); } .reclaim-progress-bar.error { background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%); } .reclaim-status-message { margin-top: 8px; font-size: 12px; color: rgba(255, 255, 255, 0.8); font-weight: 500; line-height: 1.3; } .reclaim-status-icon { display: flex; justify-content: center; margin: 8px 0; } .reclaim-icon-circle { background: linear-gradient(135deg, #10b981 0%, #059669 100%); border-radius: 50%; width: 32px; height: 32px; display: flex; justify-content: center; align-items: center; transition: all 0.3s ease; box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4); animation: reclaim-success-pulse 2s infinite; } .reclaim-icon-circle.error { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4); } .reclaim-circular-loader { display: flex; justify-content: center; align-items: center; margin: 8px 0; } .reclaim-circular-loader svg { width: 40px; height: 40px; animation: reclaim-rotate 2s linear infinite; } .reclaim-circular-loader circle { stroke: url(#progressGradient); stroke-width: 3; stroke-dasharray: 150, 200; stroke-dashoffset: -10; stroke-linecap: round; fill: none; animation: reclaim-dash 1.5s ease-in-out infinite; } @keyframes reclaim-rotate { 100% { transform: rotate(360deg); } } @keyframes reclaim-dash { 0% { stroke-dasharray: 1, 200; stroke-dashoffset: 0; } 50% { stroke-dasharray: 89, 200; stroke-dashoffset: -35; } 100% { stroke-dasharray: 89, 200; stroke-dashoffset: -124; } } @keyframes reclaim-shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } } @keyframes reclaim-progress-shine { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } } @keyframes reclaim-success-pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } } @keyframes reclaim-appear { 0% { opacity: 0; transform: translateY(20px) scale(0.95); } 100% { opacity: 1; transform: translateY(0) scale(1); } } @keyframes reclaim-success-checkmark { 0% { stroke-dashoffset: 24; } 100% { stroke-dashoffset: 0; } } .reclaim-success-checkmark { stroke-dasharray: 24; stroke-dashoffset: 24; animation: reclaim-success-checkmark 0.5s ease forwards; } /* For small screens */ @media (max-width: 400px) { .reclaim-popup { width: calc(100% - 24px); bottom: 12px; right: 12px; left: 12px; max-width: 100%; max-height: 90vh; } .reclaim-popup-content { min-height: 240px; max-height: calc(90vh - 80px); } .reclaim-info-value { max-width: 150px; } .reclaim-info-tooltip { max-width: calc(100vw - 60px); right: -20px; } } /* Dark mode enhancements */ @media (prefers-color-scheme: dark) { .reclaim-popup { background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 100%); border-color: rgba(255, 255, 255, 0.15); } }