loyalty-protocol 1.0.3 → 1.0.4
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.cjs +46 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +19 -0
- package/index.ts +5 -0
- package/package.json +9 -4
- package/tsconfig.json +17 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
default: () => index_default,
|
|
24
|
+
useLoyaltyChannel: () => useLoyaltyChannel
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
|
+
|
|
28
|
+
// src/hooks/useLoyaltyChannel.ts
|
|
29
|
+
var useLoyaltyChannel = () => {
|
|
30
|
+
const sendInformationToLoyaltyProtocol = ({ url }) => {
|
|
31
|
+
const iframe = document.getElementById(
|
|
32
|
+
"loyalty-protocol"
|
|
33
|
+
);
|
|
34
|
+
if (!iframe || typeof iframe.contentWindow === "undefined")
|
|
35
|
+
throw new Error(`Element with ID: loyalty-protocol is not iframe window`);
|
|
36
|
+
iframe.contentWindow?.postMessage(url, "https://stage.kstore.global/");
|
|
37
|
+
};
|
|
38
|
+
return { sendInformationToLoyaltyProtocol };
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// index.ts
|
|
42
|
+
var index_default = useLoyaltyChannel;
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
useLoyaltyChannel
|
|
46
|
+
});
|
package/dist/index.d.cts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// src/hooks/useLoyaltyChannel.ts
|
|
2
|
+
var useLoyaltyChannel = () => {
|
|
3
|
+
const sendInformationToLoyaltyProtocol = ({ url }) => {
|
|
4
|
+
const iframe = document.getElementById(
|
|
5
|
+
"loyalty-protocol"
|
|
6
|
+
);
|
|
7
|
+
if (!iframe || typeof iframe.contentWindow === "undefined")
|
|
8
|
+
throw new Error(`Element with ID: loyalty-protocol is not iframe window`);
|
|
9
|
+
iframe.contentWindow?.postMessage(url, "https://stage.kstore.global/");
|
|
10
|
+
};
|
|
11
|
+
return { sendInformationToLoyaltyProtocol };
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// index.ts
|
|
15
|
+
var index_default = useLoyaltyChannel;
|
|
16
|
+
export {
|
|
17
|
+
index_default as default,
|
|
18
|
+
useLoyaltyChannel
|
|
19
|
+
};
|
package/index.ts
ADDED
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "loyalty-protocol",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "index.js",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
7
|
-
".": "./index.js"
|
|
7
|
+
".": "./dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
11
|
+
"build": "tsup index.ts --format esm,cjs --dts"
|
|
11
12
|
},
|
|
12
13
|
"keywords": [],
|
|
13
14
|
"author": "",
|
|
@@ -16,5 +17,9 @@
|
|
|
16
17
|
"private": false,
|
|
17
18
|
"dependencies": {
|
|
18
19
|
"loyalty-protocol": "^1.0.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"tsup": "^8.5.0",
|
|
23
|
+
"typescript": "^5.9.2"
|
|
19
24
|
}
|
|
20
25
|
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"outDir": "dist",
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"allowSyntheticDefaultImports": true,
|
|
9
|
+
"moduleResolution": "Node",
|
|
10
|
+
"jsx": "react-jsx",
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"strict": true,
|
|
13
|
+
"skipLibCheck": true
|
|
14
|
+
},
|
|
15
|
+
"include": ["src", "index.ts"],
|
|
16
|
+
"exclude": ["node_modules", "dist"]
|
|
17
|
+
}
|