@paypercut/checkout-js 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -1
- package/dist/developer-assistance.cjs +2668 -0
- package/dist/developer-assistance.cjs.map +1 -0
- package/dist/developer-assistance.d.cts +2 -0
- package/dist/developer-assistance.d.mts +2 -0
- package/dist/developer-assistance.mjs +2665 -0
- package/dist/developer-assistance.mjs.map +1 -0
- package/dist/index.cjs +382 -149
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +898 -0
- package/dist/index.d.mts +898 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +381 -149
- package/dist/index.mjs.map +1 -1
- package/dist/paypercut-checkout.iife.min.js +1 -1
- package/dist/paypercut-checkout.iife.min.js.map +1 -1
- package/dist/paypercut-developer-assistance.iife.min.js +2 -0
- package/dist/paypercut-developer-assistance.iife.min.js.map +1 -0
- package/package.json +16 -6
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ A lightweight, framework-agnostic JavaScript SDK for embedding Paypercut Checkou
|
|
|
13
13
|
|
|
14
14
|
- [Installation](#installation)
|
|
15
15
|
- [Elements](#elements)
|
|
16
|
+
- [Developer Assistance](#developer-assistance)
|
|
16
17
|
- [Complete TypeScript / ESM example](#complete-typescript--esm-example)
|
|
17
18
|
- [Complete vanilla JavaScript example](#complete-vanilla-javascript-example)
|
|
18
19
|
- [Card Element](#card-element)
|
|
@@ -101,6 +102,76 @@ Mounting an Element never creates a Payment Method and never creates or confirms
|
|
|
101
102
|
a payment. The merchant server remains authoritative for the final amount,
|
|
102
103
|
currency, order state, authorization, capture, and fulfillment.
|
|
103
104
|
|
|
105
|
+
### Developer Assistance
|
|
106
|
+
|
|
107
|
+
The Developer Assistant is an optional configuration preview tool for developers
|
|
108
|
+
and administrators. Use it for development or an authenticated, restricted
|
|
109
|
+
preview. It ships separately so the default SDK ESM, CommonJS, and browser
|
|
110
|
+
bundles contain none of its UI or supporting assets.
|
|
111
|
+
|
|
112
|
+
For TypeScript or ESM, enable it on the client created from the root package:
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
import { Paypercut } from '@paypercut/checkout-js';
|
|
116
|
+
|
|
117
|
+
const paypercut = Paypercut({
|
|
118
|
+
publishableKey: 'pk_test_replace_me',
|
|
119
|
+
developerAssistant: true,
|
|
120
|
+
});
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
For a classic browser script, load the version-pinned root IIFE and use its
|
|
124
|
+
`Paypercut` global. The root script loads the matching optional artifact when it
|
|
125
|
+
is needed; do not add a second script tag for Developer Assistance:
|
|
126
|
+
|
|
127
|
+
```html
|
|
128
|
+
<!-- Replace VERSION with the exact released SDK version you use. -->
|
|
129
|
+
<script src="https://unpkg.com/@paypercut/checkout-js@VERSION/dist/paypercut-checkout.iife.min.js"></script>
|
|
130
|
+
<script>
|
|
131
|
+
const paypercut = Paypercut({
|
|
132
|
+
publishableKey: 'pk_test_replace_me',
|
|
133
|
+
developerAssistant: true,
|
|
134
|
+
});
|
|
135
|
+
</script>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Continue with the [complete TypeScript / ESM](#complete-typescript--esm-example)
|
|
139
|
+
or [complete vanilla JavaScript](#complete-vanilla-javascript-example) checkout
|
|
140
|
+
example; `developerAssistant` changes only whether the Developer Assistant is
|
|
141
|
+
available.
|
|
142
|
+
|
|
143
|
+
`developerAssistant` is a strict boolean. It defaults to `false`, is enabled only
|
|
144
|
+
when explicitly set to `true`, and rejects other values during `Paypercut`
|
|
145
|
+
initialization. The SDK does not authenticate developers or administrators and
|
|
146
|
+
this option is not an access-control boundary. Gate it with your own environment
|
|
147
|
+
check or authenticated feature flag. Enabling it on a public checkout makes the
|
|
148
|
+
controls visible to that checkout's visitors. Production use is not technically
|
|
149
|
+
blocked, but the SDK provides no production support guarantee for the Developer
|
|
150
|
+
Assistant and it should not be exposed to ordinary shoppers.
|
|
151
|
+
|
|
152
|
+
Developer Assistance requires a browser DOM and activates for compatible Card
|
|
153
|
+
and Express Checkout Elements. In a server-rendered application, initialize the
|
|
154
|
+
client and mount its Elements only from a client-side lifecycle. The Developer
|
|
155
|
+
Assistant mounts once, stays available across compatible component
|
|
156
|
+
reconfiguration or reload, and follows the owning Elements lifecycle. Call
|
|
157
|
+
`elements.destroy()` during page or component teardown as described in
|
|
158
|
+
[Lifecycle and safe teardown](#lifecycle-and-safe-teardown); after the last
|
|
159
|
+
compatible enabled Element is destroyed, the Developer Assistant is removed.
|
|
160
|
+
|
|
161
|
+
Loading is best-effort. Missing browser or script-loading capability, a blocked
|
|
162
|
+
request, or an unavailable version-matched artifact disables only Developer
|
|
163
|
+
Assistance: checkout and payment flows continue, and the SDK emits one sanitized
|
|
164
|
+
`developer_assistance_load_failed` console warning. The Developer Assistant
|
|
165
|
+
collects no usage telemetry. Its only public application contract is the
|
|
166
|
+
`developerAssistant` boolean; there is no separate Developer Assistance API to
|
|
167
|
+
initialize or manage.
|
|
168
|
+
|
|
169
|
+
If the page enforces Content Security Policy, its `script-src` must allow the
|
|
170
|
+
origin serving the root SDK and its separately loaded, exact-version Developer
|
|
171
|
+
Assistance artifact. Keep the `frame-src` and `connect-src` permissions required
|
|
172
|
+
by the Card or Express Checkout integration as described in
|
|
173
|
+
[Content Security Policy](#content-security-policy).
|
|
174
|
+
|
|
104
175
|
### Complete TypeScript / ESM example
|
|
105
176
|
|
|
106
177
|
Use this merchant-owned markup:
|
|
@@ -1637,7 +1708,7 @@ Tip: Prefer subscribing with the SdkEvent enum for stronger typing.
|
|
|
1637
1708
|
<body>
|
|
1638
1709
|
<div id="checkout"></div>
|
|
1639
1710
|
|
|
1640
|
-
<script src="https://cdn.jsdelivr.net/npm/@paypercut/checkout-js@1.
|
|
1711
|
+
<script src="https://cdn.jsdelivr.net/npm/@paypercut/checkout-js@1.4.0/dist/paypercut-checkout.iife.min.js"></script>
|
|
1641
1712
|
<script>
|
|
1642
1713
|
const checkout = PaypercutCheckout({
|
|
1643
1714
|
id: '01KB23M9EC960C50G3AH14FTTT',
|