@orderingstack/front-hooks 4.1.0 → 4.1.1
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.js +15 -28
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +6865 -7919
- package/dist/index.es.js.map +1 -1
- package/dist/web-09a5bf51.mjs +34 -0
- package/dist/web-09a5bf51.mjs.map +1 -0
- package/dist/web-a769eb78.js +2 -0
- package/dist/web-a769eb78.js.map +1 -0
- package/package.json +3 -2
- package/dist/dist/src/index.d.ts +0 -7
- package/dist/dist/src/useAvailability.d.ts +0 -10
- package/dist/dist/src/useCms.d.ts +0 -14
- package/dist/dist/src/useDisplayPrice.d.ts +0 -14
- package/dist/dist/src/useGroupOrderLines.d.ts +0 -3
- package/dist/dist/src/useInterval.d.ts +0 -2
- package/dist/dist/src/useOnClickOutside.d.ts +0 -3
- package/dist/dist/src/utils/timeAvailabilityFilter.d.ts +0 -10
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { WebPlugin as t } from "@capacitor/core";
|
|
2
|
+
class i extends t {
|
|
3
|
+
constructor() {
|
|
4
|
+
super(...arguments), this.PREFIX = "cap_sec_", this.addPrefix = (e) => this.PREFIX + e, this.removePrefix = (e) => e.replace(this.PREFIX, "");
|
|
5
|
+
}
|
|
6
|
+
get(e) {
|
|
7
|
+
const r = localStorage.getItem(this.addPrefix(e.key));
|
|
8
|
+
return r !== null ? Promise.resolve({
|
|
9
|
+
value: atob(r)
|
|
10
|
+
}) : Promise.reject("Item with given key does not exist");
|
|
11
|
+
}
|
|
12
|
+
set(e) {
|
|
13
|
+
return localStorage.setItem(this.addPrefix(e.key), btoa(e.value)), Promise.resolve({ value: !0 });
|
|
14
|
+
}
|
|
15
|
+
remove(e) {
|
|
16
|
+
return localStorage.getItem(this.addPrefix(e.key)) ? (localStorage.removeItem(this.addPrefix(e.key)), Promise.resolve({ value: !0 })) : Promise.reject("Item with given key does not exist");
|
|
17
|
+
}
|
|
18
|
+
clear() {
|
|
19
|
+
for (const e in localStorage)
|
|
20
|
+
e.indexOf(this.PREFIX) === 0 && localStorage.removeItem(e);
|
|
21
|
+
return Promise.resolve({ value: !0 });
|
|
22
|
+
}
|
|
23
|
+
keys() {
|
|
24
|
+
const e = Object.keys(localStorage).filter((r) => r.indexOf(this.PREFIX) === 0).map(this.removePrefix);
|
|
25
|
+
return Promise.resolve({ value: e });
|
|
26
|
+
}
|
|
27
|
+
getPlatform() {
|
|
28
|
+
return Promise.resolve({ value: "web" });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
i as SecureStoragePluginWeb
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=web-09a5bf51.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-09a5bf51.mjs","sources":["../node_modules/capacitor-secure-storage-plugin/dist/esm/web.js"],"sourcesContent":["import { WebPlugin } from '@capacitor/core';\nexport class SecureStoragePluginWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.PREFIX = 'cap_sec_';\n this.addPrefix = (key) => this.PREFIX + key;\n this.removePrefix = (key) => key.replace(this.PREFIX, '');\n }\n get(options) {\n const value = localStorage.getItem(this.addPrefix(options.key));\n return value !== null\n ? Promise.resolve({\n value: atob(value),\n })\n : Promise.reject('Item with given key does not exist');\n }\n set(options) {\n localStorage.setItem(this.addPrefix(options.key), btoa(options.value));\n return Promise.resolve({ value: true });\n }\n remove(options) {\n if (localStorage.getItem(this.addPrefix(options.key))) {\n localStorage.removeItem(this.addPrefix(options.key));\n return Promise.resolve({ value: true });\n }\n else {\n return Promise.reject('Item with given key does not exist');\n }\n }\n clear() {\n for (const key in localStorage) {\n if (key.indexOf(this.PREFIX) === 0) {\n localStorage.removeItem(key);\n }\n }\n return Promise.resolve({ value: true });\n }\n keys() {\n const keys = Object.keys(localStorage)\n .filter(k => k.indexOf(this.PREFIX) === 0)\n .map(this.removePrefix);\n return Promise.resolve({ value: keys });\n }\n getPlatform() {\n return Promise.resolve({ value: 'web' });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["SecureStoragePluginWeb","WebPlugin","key","options","value","keys","k"],"mappings":";AACO,MAAMA,UAA+BC,EAAU;AAAA,EAClD,cAAc;AACV,UAAM,GAAG,SAAS,GAClB,KAAK,SAAS,YACd,KAAK,YAAY,CAACC,MAAQ,KAAK,SAASA,GACxC,KAAK,eAAe,CAACA,MAAQA,EAAI,QAAQ,KAAK,QAAQ,EAAE;AAAA,EAC3D;AAAA,EACD,IAAIC,GAAS;AACT,UAAMC,IAAQ,aAAa,QAAQ,KAAK,UAAUD,EAAQ,GAAG,CAAC;AAC9D,WAAOC,MAAU,OACX,QAAQ,QAAQ;AAAA,MACd,OAAO,KAAKA,CAAK;AAAA,IACjC,CAAa,IACC,QAAQ,OAAO,oCAAoC;AAAA,EAC5D;AAAA,EACD,IAAID,GAAS;AACT,wBAAa,QAAQ,KAAK,UAAUA,EAAQ,GAAG,GAAG,KAAKA,EAAQ,KAAK,CAAC,GAC9D,QAAQ,QAAQ,EAAE,OAAO,GAAM,CAAA;AAAA,EACzC;AAAA,EACD,OAAOA,GAAS;AACZ,WAAI,aAAa,QAAQ,KAAK,UAAUA,EAAQ,GAAG,CAAC,KAChD,aAAa,WAAW,KAAK,UAAUA,EAAQ,GAAG,CAAC,GAC5C,QAAQ,QAAQ,EAAE,OAAO,GAAM,CAAA,KAG/B,QAAQ,OAAO,oCAAoC;AAAA,EAEjE;AAAA,EACD,QAAQ;AACJ,eAAWD,KAAO;AACd,MAAIA,EAAI,QAAQ,KAAK,MAAM,MAAM,KAC7B,aAAa,WAAWA,CAAG;AAGnC,WAAO,QAAQ,QAAQ,EAAE,OAAO,GAAM,CAAA;AAAA,EACzC;AAAA,EACD,OAAO;AACH,UAAMG,IAAO,OAAO,KAAK,YAAY,EAChC,OAAO,CAAAC,MAAKA,EAAE,QAAQ,KAAK,MAAM,MAAM,CAAC,EACxC,IAAI,KAAK,YAAY;AAC1B,WAAO,QAAQ,QAAQ,EAAE,OAAOD,EAAM,CAAA;AAAA,EACzC;AAAA,EACD,cAAc;AACV,WAAO,QAAQ,QAAQ,EAAE,OAAO,MAAO,CAAA;AAAA,EAC1C;AACL;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@capacitor/core");class o extends t.WebPlugin{constructor(){super(...arguments),this.PREFIX="cap_sec_",this.addPrefix=e=>this.PREFIX+e,this.removePrefix=e=>e.replace(this.PREFIX,"")}get(e){const r=localStorage.getItem(this.addPrefix(e.key));return r!==null?Promise.resolve({value:atob(r)}):Promise.reject("Item with given key does not exist")}set(e){return localStorage.setItem(this.addPrefix(e.key),btoa(e.value)),Promise.resolve({value:!0})}remove(e){return localStorage.getItem(this.addPrefix(e.key))?(localStorage.removeItem(this.addPrefix(e.key)),Promise.resolve({value:!0})):Promise.reject("Item with given key does not exist")}clear(){for(const e in localStorage)e.indexOf(this.PREFIX)===0&&localStorage.removeItem(e);return Promise.resolve({value:!0})}keys(){const e=Object.keys(localStorage).filter(r=>r.indexOf(this.PREFIX)===0).map(this.removePrefix);return Promise.resolve({value:e})}getPlatform(){return Promise.resolve({value:"web"})}}exports.SecureStoragePluginWeb=o;
|
|
2
|
+
//# sourceMappingURL=web-a769eb78.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-a769eb78.js","sources":["../node_modules/capacitor-secure-storage-plugin/dist/esm/web.js"],"sourcesContent":["import { WebPlugin } from '@capacitor/core';\nexport class SecureStoragePluginWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.PREFIX = 'cap_sec_';\n this.addPrefix = (key) => this.PREFIX + key;\n this.removePrefix = (key) => key.replace(this.PREFIX, '');\n }\n get(options) {\n const value = localStorage.getItem(this.addPrefix(options.key));\n return value !== null\n ? Promise.resolve({\n value: atob(value),\n })\n : Promise.reject('Item with given key does not exist');\n }\n set(options) {\n localStorage.setItem(this.addPrefix(options.key), btoa(options.value));\n return Promise.resolve({ value: true });\n }\n remove(options) {\n if (localStorage.getItem(this.addPrefix(options.key))) {\n localStorage.removeItem(this.addPrefix(options.key));\n return Promise.resolve({ value: true });\n }\n else {\n return Promise.reject('Item with given key does not exist');\n }\n }\n clear() {\n for (const key in localStorage) {\n if (key.indexOf(this.PREFIX) === 0) {\n localStorage.removeItem(key);\n }\n }\n return Promise.resolve({ value: true });\n }\n keys() {\n const keys = Object.keys(localStorage)\n .filter(k => k.indexOf(this.PREFIX) === 0)\n .map(this.removePrefix);\n return Promise.resolve({ value: keys });\n }\n getPlatform() {\n return Promise.resolve({ value: 'web' });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["SecureStoragePluginWeb","WebPlugin","key","options","value","keys","k"],"mappings":"mHACO,MAAMA,UAA+BC,EAAAA,SAAU,CAClD,aAAc,CACV,MAAM,GAAG,SAAS,EAClB,KAAK,OAAS,WACd,KAAK,UAAaC,GAAQ,KAAK,OAASA,EACxC,KAAK,aAAgBA,GAAQA,EAAI,QAAQ,KAAK,OAAQ,EAAE,CAC3D,CACD,IAAIC,EAAS,CACT,MAAMC,EAAQ,aAAa,QAAQ,KAAK,UAAUD,EAAQ,GAAG,CAAC,EAC9D,OAAOC,IAAU,KACX,QAAQ,QAAQ,CACd,MAAO,KAAKA,CAAK,CACjC,CAAa,EACC,QAAQ,OAAO,oCAAoC,CAC5D,CACD,IAAID,EAAS,CACT,oBAAa,QAAQ,KAAK,UAAUA,EAAQ,GAAG,EAAG,KAAKA,EAAQ,KAAK,CAAC,EAC9D,QAAQ,QAAQ,CAAE,MAAO,EAAM,CAAA,CACzC,CACD,OAAOA,EAAS,CACZ,OAAI,aAAa,QAAQ,KAAK,UAAUA,EAAQ,GAAG,CAAC,GAChD,aAAa,WAAW,KAAK,UAAUA,EAAQ,GAAG,CAAC,EAC5C,QAAQ,QAAQ,CAAE,MAAO,EAAM,CAAA,GAG/B,QAAQ,OAAO,oCAAoC,CAEjE,CACD,OAAQ,CACJ,UAAWD,KAAO,aACVA,EAAI,QAAQ,KAAK,MAAM,IAAM,GAC7B,aAAa,WAAWA,CAAG,EAGnC,OAAO,QAAQ,QAAQ,CAAE,MAAO,EAAM,CAAA,CACzC,CACD,MAAO,CACH,MAAMG,EAAO,OAAO,KAAK,YAAY,EAChC,OAAOC,GAAKA,EAAE,QAAQ,KAAK,MAAM,IAAM,CAAC,EACxC,IAAI,KAAK,YAAY,EAC1B,OAAO,QAAQ,QAAQ,CAAE,MAAOD,CAAM,CAAA,CACzC,CACD,aAAc,CACV,OAAO,QAAQ,QAAQ,CAAE,MAAO,KAAO,CAAA,CAC1C,CACL","x_google_ignoreList":[0]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orderingstack/front-hooks",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"@orderingstack/ordering-core-react": "^1.0.0",
|
|
26
26
|
"react": ">=16.8.0",
|
|
27
27
|
"react-i18next": "^12.1.1",
|
|
28
|
-
"react-router-dom": ">=5.3.3"
|
|
28
|
+
"react-router-dom": ">=5.3.3",
|
|
29
|
+
"@capacitor/core": "^4.0.0"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@orderingstack/ordering-core-react": "^1.0.0",
|
package/dist/dist/src/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Product } from '@orderingstack/ordering-types';
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* @param originalMenu
|
|
5
|
-
* @param markOnly - boolean to only mark products with "outsideAvailabilitySlot" flag, if false removes products
|
|
6
|
-
* @param timeZone - venue timezone
|
|
7
|
-
* @param interval - availability checking interval [seconds]
|
|
8
|
-
*/
|
|
9
|
-
export declare function useAvailability(originalMenu?: Product[], markOnly?: boolean, timeZone?: string | undefined, interval?: number): Product[] | undefined;
|
|
10
|
-
//# sourceMappingURL=useAvailability.d.ts.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
interface IVenueId {
|
|
2
|
-
venue: string;
|
|
3
|
-
}
|
|
4
|
-
export declare function useCms<T>(id: string, intervalSeconds?: number, baseUrl?: string, tenant?: string): {
|
|
5
|
-
value: T | null;
|
|
6
|
-
isError: boolean;
|
|
7
|
-
isLoading: boolean;
|
|
8
|
-
};
|
|
9
|
-
export declare function useVenueCms<T extends IVenueId>(id: string, intervalSeconds?: number, baseUrl?: string, tenant?: string, venue?: string): {
|
|
10
|
-
value: T | null;
|
|
11
|
-
isError: boolean;
|
|
12
|
-
};
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=useCms.d.ts.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Product, ProductConfig } from '@orderingstack/ordering-types';
|
|
2
|
-
interface UseDisplayPriceProps {
|
|
3
|
-
product: Product;
|
|
4
|
-
state?: ProductConfig;
|
|
5
|
-
selected?: boolean;
|
|
6
|
-
cheapestGroupOptionsProduct?: number;
|
|
7
|
-
}
|
|
8
|
-
export declare const useDisplayPrice: ({ product, state, selected, cheapestGroupOptionsProduct, }: UseDisplayPriceProps) => {
|
|
9
|
-
displayPrice: number;
|
|
10
|
-
showAsMinPrice: boolean | "" | undefined;
|
|
11
|
-
calculatedPriceDefaultProductState: number;
|
|
12
|
-
};
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=useDisplayPrice.d.ts.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ConfigType } from 'dayjs';
|
|
2
|
-
import { Product } from '@orderingstack/ordering-types';
|
|
3
|
-
export declare const getHourAndMinutes: (text: string) => {
|
|
4
|
-
hour: number;
|
|
5
|
-
minutes: number;
|
|
6
|
-
};
|
|
7
|
-
export declare function isProductAvailable(item: Product, timeZone: string | undefined, dueTime: ConfigType): boolean;
|
|
8
|
-
export declare const filterTimeAvailabilityOfItems: (items: Product[], timeZone?: string | undefined, dueTime?: ConfigType, markOnly?: boolean) => Product[];
|
|
9
|
-
export declare const filterTimeAvailabilityOfProducts: (products: Product[], timeZone?: string | undefined, dueTime?: ConfigType, markOnly?: boolean) => Product[];
|
|
10
|
-
//# sourceMappingURL=timeAvailabilityFilter.d.ts.map
|