konnektive-one 1.0.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/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "konnektive-one",
3
+ "version": "1.0.0",
4
+ "description": "Konnektive / CheckoutChamp checkout engine — single-bundle (jQuery + sweetalert2). Load dist/engine.js with a data-config attribute pointing at your OPconfig.js.",
5
+ "main": "dist/engine.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/drewaltukhov/konnektive-one.git"
9
+ },
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "scripts": {
14
+ "rm": "rimraf ./dist",
15
+ "build": "npm run rm && webpack --color --progress --mode=development",
16
+ "build:prod": "npm run rm && NODE_ENV=production webpack --color --progress --mode=production",
17
+ "watch": "npm run build -- --watch",
18
+ "dev": "concurrently \"npm run serve\" \"npm run watch\"",
19
+ "serve": "http-server ./dist -a 0.0.0.0 -p 3000",
20
+ "publish": "npm run build:prod && npm publish",
21
+ "lint": "eslint ./src",
22
+ "lint:fix": "eslint ./src --fix"
23
+ },
24
+ "author": "brunoferreiras",
25
+ "license": "ISC",
26
+ "dependencies": {
27
+ "jquery": "^3.6.2",
28
+ "sweetalert2": "^11.4.8"
29
+ },
30
+ "devDependencies": {
31
+ "@babel/cli": "^7.17.6",
32
+ "@babel/core": "^7.17.9",
33
+ "@babel/preset-env": "^7.16.11",
34
+ "babel-loader": "^8.2.4",
35
+ "babel-preset-minify": "^0.5.1",
36
+ "concurrently": "^7.1.0",
37
+ "eslint": "^8.13.0",
38
+ "eslint-config-airbnb-base": "^15.0.0",
39
+ "eslint-plugin-import": "^2.26.0",
40
+ "glob": "^7.2.0",
41
+ "http-server": "^14.1.0",
42
+ "npm-watch": "^0.11.0",
43
+ "rimraf": "^3.0.2",
44
+ "webpack": "^5.72.0",
45
+ "webpack-cli": "^4.10.0"
46
+ }
47
+ }
package/readme.md ADDED
@@ -0,0 +1,83 @@
1
+ # konnektive-one
2
+
3
+ Single-bundle checkout engine for Konnektive / CheckoutChamp. jQuery + sweetalert2.
4
+ Everything ships in one file: `dist/engine.js`.
5
+
6
+ ## Using it on a page
7
+
8
+ Add **one** framework tag. `data-config` points at your operation's config file,
9
+ which the engine loads and which calls `PaymentEngine.init({...})`:
10
+
11
+ ```html
12
+ <script src="https://cdn.jsdelivr.net/npm/konnektive-one@1/dist/engine.js"
13
+ data-config="assets/js/OPconfig.js"></script>
14
+ ```
15
+
16
+ `OPconfig.js` (per-operation, lives on the site):
17
+
18
+ ```js
19
+ PaymentEngine.init({
20
+ provider: 'konnektive',
21
+ // ZIP autofill + country filtering (were <script> tag attributes before)
22
+ zipProvider: '', // '' = basic USPS lookup, 'google' = Google Places
23
+ zipCityPlaceholder: 'City',
24
+ zipFeedback: false,
25
+ zipExtendedDropdown: false,
26
+ countries: 'US', // 'all' | 'US' | 'US,CA'
27
+ countriesExcept: '',
28
+ products: [ /* ... */ ],
29
+ // ...the rest of your operation config
30
+ });
31
+ ```
32
+
33
+ The engine auto-detects the page (checkout forms, etc.) and wires everything up.
34
+
35
+ ### Config-dependent page scripts
36
+
37
+ Scripts that read `getConfig()` at load time must wait until the config is set.
38
+ Use `PaymentEngine.ready` (a Promise resolving with the config) or the
39
+ `konnektive:ready` DOM event. Keep the dependency visible in the page body:
40
+
41
+ ```html
42
+ <!-- runs only after PaymentEngine.ready (config available) -->
43
+ <script>
44
+ PaymentEngine.ready.then(function () {
45
+ ['assets/js/buynow.js'].forEach(function (src) {
46
+ var s = document.createElement('script'); s.src = src; document.body.appendChild(s);
47
+ });
48
+ });
49
+ </script>
50
+ ```
51
+
52
+ Inline handlers (e.g. `onchange="combineExpDate()"`) need no special wiring —
53
+ every framework function is exposed as a global once `engine.js` loads.
54
+
55
+ ### Tracking / thank-you pages
56
+
57
+ Fire a conversion pixel and skip the checkout flow:
58
+
59
+ ```js
60
+ PaymentEngine.init({ track: 'sale' }); // 'conversion' | 'sale' | 'pv' | 'bpv' | 'spv'
61
+ ```
62
+
63
+ ## Dependencies
64
+
65
+ - jQuery (load it before `engine.js`; it is a webpack external, not bundled)
66
+
67
+ ## Development
68
+
69
+ ```bash
70
+ npm install
71
+ npm run build # dev build -> dist/engine.js (with source map)
72
+ npm run build:prod # minified production build
73
+ npm run serve # static server on http://localhost:3000
74
+ npm run dev # watch + serve
75
+ ```
76
+
77
+ ## Publishing
78
+
79
+ Update `version` in `package.json` (npm versions are permanent), then:
80
+
81
+ ```bash
82
+ npm run build:prod && npm publish
83
+ ```