react-generic-user 0.0.0-stage → 0.0.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/LICENSE ADDED
@@ -0,0 +1,121 @@
1
+ Creative Commons Legal Code
2
+
3
+ CC0 1.0 Universal
4
+
5
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12
+ HEREUNDER.
13
+
14
+ Statement of Purpose
15
+
16
+ The laws of most jurisdictions throughout the world automatically confer
17
+ exclusive Copyright and Related Rights (defined below) upon the creator
18
+ and subsequent owner(s) (each and all, an "owner") of an original work of
19
+ authorship and/or a database (each, a "Work").
20
+
21
+ Certain owners wish to permanently relinquish those rights to a Work for
22
+ the purpose of contributing to a commons of creative, cultural and
23
+ scientific works ("Commons") that the public can reliably and without fear
24
+ of later claims of infringement build upon, modify, incorporate in other
25
+ works, reuse and redistribute as freely as possible in any form whatsoever
26
+ and for any purposes, including without limitation commercial purposes.
27
+ These owners may contribute to the Commons to promote the ideal of a free
28
+ culture and the further production of creative, cultural and scientific
29
+ works, or to gain reputation or greater distribution for their Work in
30
+ part through the use and efforts of others.
31
+
32
+ For these and/or other purposes and motivations, and without any
33
+ expectation of additional consideration or compensation, the person
34
+ associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35
+ is an owner of Copyright and Related Rights in the Work, voluntarily
36
+ elects to apply CC0 to the Work and publicly distribute the Work under its
37
+ terms, with knowledge of his or her Copyright and Related Rights in the
38
+ Work and the meaning and intended legal effect of CC0 on those rights.
39
+
40
+ 1. Copyright and Related Rights. A Work made available under CC0 may be
41
+ protected by copyright and related or neighboring rights ("Copyright and
42
+ Related Rights"). Copyright and Related Rights include, but are not
43
+ limited to, the following:
44
+
45
+ i. the right to reproduce, adapt, distribute, perform, display,
46
+ communicate, and translate a Work;
47
+ ii. moral rights retained by the original author(s) and/or performer(s);
48
+ iii. publicity and privacy rights pertaining to a person's image or
49
+ likeness depicted in a Work;
50
+ iv. rights protecting against unfair competition in regards to a Work,
51
+ subject to the limitations in paragraph 4(a), below;
52
+ v. rights protecting the extraction, dissemination, use and reuse of data
53
+ in a Work;
54
+ vi. database rights (such as those arising under Directive 96/9/EC of the
55
+ European Parliament and of the Council of 11 March 1996 on the legal
56
+ protection of databases, and under any national implementation
57
+ thereof, including any amended or successor version of such
58
+ directive); and
59
+ vii. other similar, equivalent or corresponding rights throughout the
60
+ world based on applicable law or treaty, and any national
61
+ implementations thereof.
62
+
63
+ 2. Waiver. To the greatest extent permitted by, but not in contravention
64
+ of, applicable law, Affirmer hereby overtly, fully, permanently,
65
+ irrevocably and unconditionally waives, abandons, and surrenders all of
66
+ Affirmer's Copyright and Related Rights and associated claims and causes
67
+ of action, whether now known or unknown (including existing as well as
68
+ future claims and causes of action), in the Work (i) in all territories
69
+ worldwide, (ii) for the maximum duration provided by applicable law or
70
+ treaty (including future time extensions), (iii) in any current or future
71
+ medium and for any number of copies, and (iv) for any purpose whatsoever,
72
+ including without limitation commercial, advertising or promotional
73
+ purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74
+ member of the public at large and to the detriment of Affirmer's heirs and
75
+ successors, fully intending that such Waiver shall not be subject to
76
+ revocation, rescission, cancellation, termination, or any other legal or
77
+ equitable action to disrupt the quiet enjoyment of the Work by the public
78
+ as contemplated by Affirmer's express Statement of Purpose.
79
+
80
+ 3. Public License Fallback. Should any part of the Waiver for any reason
81
+ be judged legally invalid or ineffective under applicable law, then the
82
+ Waiver shall be preserved to the maximum extent permitted taking into
83
+ account Affirmer's express Statement of Purpose. In addition, to the
84
+ extent the Waiver is so judged Affirmer hereby grants to each affected
85
+ person a royalty-free, non transferable, non sublicensable, non exclusive,
86
+ irrevocable and unconditional license to exercise Affirmer's Copyright and
87
+ Related Rights in the Work (i) in all territories worldwide, (ii) for the
88
+ maximum duration provided by applicable law or treaty (including future
89
+ time extensions), (iii) in any current or future medium and for any number
90
+ of copies, and (iv) for any purpose whatsoever, including without
91
+ limitation commercial, advertising or promotional purposes (the
92
+ "License"). The License shall be deemed effective as of the date CC0 was
93
+ applied by Affirmer to the Work. Should any part of the License for any
94
+ reason be judged legally invalid or ineffective under applicable law, such
95
+ partial invalidity or ineffectiveness shall not invalidate the remainder
96
+ of the License, and in such case Affirmer hereby affirms that he or she
97
+ will not (i) exercise any of his or her remaining Copyright and Related
98
+ Rights in the Work or (ii) assert any associated claims and causes of
99
+ action with respect to the Work, in either case contrary to Affirmer's
100
+ express Statement of Purpose.
101
+
102
+ 4. Limitations and Disclaimers.
103
+
104
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
105
+ surrendered, licensed or otherwise affected by this document.
106
+ b. Affirmer offers the Work as-is and makes no representations or
107
+ warranties of any kind concerning the Work, express, implied,
108
+ statutory or otherwise, including without limitation warranties of
109
+ title, merchantability, fitness for a particular purpose, non
110
+ infringement, or the absence of latent or other defects, accuracy, or
111
+ the present or absence of errors, whether or not discoverable, all to
112
+ the greatest extent permissible under applicable law.
113
+ c. Affirmer disclaims responsibility for clearing rights of other persons
114
+ that may apply to the Work or any use thereof, including without
115
+ limitation any person's Copyright and Related Rights in the Work.
116
+ Further, Affirmer disclaims responsibility for obtaining any necessary
117
+ consents, permissions or other rights required for any use of the
118
+ Work.
119
+ d. Affirmer understands and acknowledges that Creative Commons is not a
120
+ party to this document and has no duty or obligation with respect to
121
+ this CC0 or use of the Work.
@@ -0,0 +1,2 @@
1
+ /* !/usr/bin/env css
2
+ -*- coding: utf-8 -*- */.login{display:grid;grid-gap:20px;grid-gap:var(--w-default-space,20px);gap:20px;gap:var(--w-default-space,20px);grid-template-columns:1fr;margin:0 auto;width:400px}.login .login__status{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;color:#018786;color:var(--mdc-theme-secondary,#018786);font-family:Roboto,sans-serif;font-family:var(--mdc-typography-headline2-font-family,var(--mdc-typography-font-family,Roboto,sans-serif));font-size:3.75rem;font-size:var(--mdc-typography-headline2-font-size,3.75rem);font-weight:300;font-weight:var(--mdc-typography-headline2-font-weight,300);letter-spacing:-.0083em;letter-spacing:var(--mdc-typography-headline2-letter-spacing,-.0083em);line-height:3.75rem;line-height:var(--mdc-typography-headline2-line-height,3.75rem);text-align:center}.login .login__button,.login .login__name,.login .login__password{visibility:visible}
@@ -0,0 +1,17 @@
1
+ import type { FunctionComponent } from 'react';
2
+ import type { AuthenticatedProps, BaseUserContext, BaseUserSession, BaseLoginData, LoginProps, Routing, User } from './type';
3
+ export declare const CSS_CLASS_NAMES: Record<string, string>;
4
+ /**
5
+ * Creates components to protect content and to log in.
6
+ * NOTE: User hook should either be a "ContextUserHook" or "ReduxUserHook".
7
+ * @param useUser - Hook to retrieve current user.
8
+ * @param routing - Integration of the used routing library.
9
+ * @param routing.Redirect - Component redirecting to given location.
10
+ * @param routing.useLocation - Hook to determine current location.
11
+ * @returns Components.
12
+ */
13
+ export declare const componentFactory: <LoginData extends BaseLoginData = BaseLoginData, UserContext extends BaseUserContext = BaseUserContext, SessionType extends BaseUserSession<UserContext> = BaseUserSession<UserContext>>(useUser: () => User<LoginData, UserContext, SessionType>, { Redirect, useLocation }: Routing) => {
14
+ Authenticated: FunctionComponent<AuthenticatedProps>;
15
+ Login: FunctionComponent<LoginProps<LoginData, UserContext, SessionType>>;
16
+ };
17
+ export default componentFactory;
@@ -0,0 +1,167 @@
1
+ if(typeof window==='undefined'||window===null)var window=(typeof globalThis==='undefined'||globalThis===null)?{}:globalThis;import { default as __WEBPACK_EXTERNAL_MODULE_react_input_material_components_TextInput_e3667393_default__ } from "react-input-material/components/TextInput";
2
+ import { Button as __WEBPACK_EXTERNAL_MODULE__rmwc_button_e0454fea_Button__ } from "@rmwc/button";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_clientnode__ from "clientnode";
4
+ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
5
+ import * as __WEBPACK_EXTERNAL_MODULE_react_generic_tools_67824958__ from "react-generic-tools";
6
+ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_00f484c1__ from "react/jsx-runtime";
7
+ /******/ var __webpack_modules__ = ([
8
+ /* 0 */,
9
+ /* 1 */
10
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
11
+
12
+ var x = function(y) {
13
+ var x = {}; __webpack_require__.d(x, y); return x
14
+ }
15
+ var y = function(x) { return function() { return x; }; }
16
+ module.exports = x({ ["memo"]: function() { return __WEBPACK_EXTERNAL_MODULE_react__.memo; }, ["useEffect"]: function() { return __WEBPACK_EXTERNAL_MODULE_react__.useEffect; }, ["useState"]: function() { return __WEBPACK_EXTERNAL_MODULE_react__.useState; } });
17
+
18
+ /***/ }),
19
+ /* 2 */
20
+ /***/ (function(__unused_webpack_module, __webpack_exports__) {
21
+
22
+ // extracted by mini-css-extract-plugin
23
+ /* harmony default export */ __webpack_exports__.A = ({"login":"login","loginStatus":"login__status","loginButton":"login__button","loginName":"login__name","loginPassword":"login__password"});
24
+
25
+ /***/ }),
26
+ /* 3 */
27
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
28
+
29
+ var x = function(y) {
30
+ var x = {}; __webpack_require__.d(x, y); return x
31
+ }
32
+ var y = function(x) { return function() { return x; }; }
33
+ module.exports = x({ ["Fragment"]: function() { return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_00f484c1__.Fragment; }, ["jsx"]: function() { return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_00f484c1__.jsx; }, ["jsxs"]: function() { return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_00f484c1__.jsxs; } });
34
+
35
+ /***/ }),
36
+ /* 4 */,
37
+ /* 5 */
38
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
39
+
40
+
41
+ // EXPORTS
42
+ __webpack_require__.d(__webpack_exports__, {
43
+ sr: function() { return /* binding */ CSS_CLASS_NAMES; },
44
+ WV: function() { return /* binding */ componentFactory; },
45
+ Ay: function() { return /* binding */ components; }
46
+ });
47
+
48
+ // EXTERNAL MODULE: external "clientnode"
49
+ var external_clientnode_ = __webpack_require__(8);
50
+ // EXTERNAL MODULE: external "react"
51
+ var external_react_ = __webpack_require__(1);
52
+ ;// external "react-input-material/components/TextInput"
53
+
54
+ // EXTERNAL MODULE: external "react-generic-tools"
55
+ var external_react_generic_tools_ = __webpack_require__(9);
56
+ ;// external "@rmwc/button"
57
+
58
+ // EXTERNAL MODULE: ./src/style.module.css
59
+ var style_module = __webpack_require__(2);
60
+ // EXTERNAL MODULE: external "react/jsx-runtime"
61
+ var jsx_runtime_ = __webpack_require__(3);
62
+ ;// ./src/components.tsx
63
+ // #!/usr/bin/env babel-node
64
+ // -*- coding: utf-8 -*-
65
+ /** @module index *//* !
66
+ region header
67
+ [Project page](https://tsickert.com/react-generic-user)
68
+
69
+ Copyright Torben Sickert (info["~at~"]tsickert.com) 16.12.2012
70
+ endregion
71
+ */// region imports
72
+ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _regenerator(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var r,e,o="function"==typeof Symbol?Symbol:{},n=o.iterator||"@@iterator",a=o.toStringTag||"@@toStringTag";function i(o,n,a,i){var u=n&&n.prototype instanceof Generator?n:Generator,f=Object.create(u.prototype);return _regeneratorDefine2(f,"_invoke",function(t,o,n){var a,i,u,f=0,p=n||[],y=!1,G={p:0,n:0,v:r,a:l,f:l.bind(r,4),d:function d(t,e){return a=t,i=0,u=r,G.n=e,c}};function l(t,o){for(i=t,u=o,e=0;!y&&f&&!n&&e<p.length;e++){var n,a=p[e],l=G.p,F=a[2];t>3?(n=F===o)&&(u=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=r):a[0]<=l&&((n=t<2&&l<a[1])?(i=0,G.v=o,G.n=a[1]):l<F&&(n=t<3||a[0]>o||o>F)&&(a[4]=t,a[5]=o,G.n=F,i=0))}if(n||t>1)return c;throw y=!0,o}return function(n,p,F){if(f>1)throw TypeError("Generator is already running");for(y&&1===p&&l(p,F),i=p,u=F;(e=i<2?r:u)||!y;){a||(i?i<3?(i>1&&(G.n=-1),l(i,u)):G.n=u:G.v=u);try{if(f=2,a){if(i||(n="next"),e=a[n]){if(!(e=e.call(a,u)))throw TypeError("iterator result is not an object");if(!e.done)return e;u=e.value,i<2&&(i=0)}else 1===i&&(e=a.return)&&e.call(a),i<2&&(u=TypeError("The iterator does not provide a '"+n+"' method"),i=1);a=r}else if((e=(y=G.n<0)?u:t.call(o,G))!==c)break}catch(t){a=r,i=1,u=t}finally{f=1}}return{value:e,done:y}}}(o,a,i),!0),f}var c={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(_regeneratorDefine2(e={},n,function(){return this}),e),f=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(u);function p(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,GeneratorFunctionPrototype):(r.__proto__=GeneratorFunctionPrototype,_regeneratorDefine2(r,a,"GeneratorFunction")),r.prototype=Object.create(f),r}return GeneratorFunction.prototype=GeneratorFunctionPrototype,_regeneratorDefine2(f,"constructor",GeneratorFunctionPrototype),_regeneratorDefine2(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",_regeneratorDefine2(GeneratorFunctionPrototype,a,"GeneratorFunction"),_regeneratorDefine2(f),_regeneratorDefine2(f,a,"Generator"),_regeneratorDefine2(f,n,function(){return this}),_regeneratorDefine2(f,"toString",function(){return"[object Generator]"}),(_regenerator=function _regenerator(){return{w:i,m:p}})()}function _regeneratorDefine2(e,r,n,t){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}_regeneratorDefine2=function _regeneratorDefine(e,r,n,t){function o(r,n){_regeneratorDefine2(e,r,function(e){return this._invoke(r,n,e)})}r?i?i(e,r,{value:n,enumerable:!t,configurable:!t,writable:!t}):e[r]=n:(o("next",0),o("throw",1),o("return",2))},_regeneratorDefine2(e,r,n,t)}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){return void e(n)}i.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n)}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n)}_next(void 0)})}}function _slicedToArray(e,i){return _iterableToArrayLimit(e,i)||_unsupportedIterableToArray(e,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var o={}.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}function _iterableToArrayLimit(r,t){var e=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(Array.isArray(r)&&(null==e||e===("undefined"!=typeof Symbol&&[][Symbol.iterator])||e===[]["@@iterator"]))return r;if(null!=e){var l,n,i,a,u=[],o=!0,f=!1;try{if(i=(e=e.call(r)).next,0===t){if(Object(e)!==e)return;o=!1}else for(;!(o=(l=i.call(e)).done)&&(u.push(l.value),u.length!==t);o=!0);}catch(r){f=!0,n=r}finally{try{if(!o&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(f)throw n}}return u}}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function _objectSpread(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(o),!0).forEach(function(t){_defineProperty(r,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):ownKeys(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))})}return r}function _defineProperty(r,t,o){return(t=_toPropertyKey(t))in r?Object.defineProperty(r,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[t]=o,r}function _toPropertyKey(r){var o=_toPrimitive(r,"string");return"symbol"==_typeof(o)?o:o+""}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var r;if("undefined"!=typeof Symbol&&void 0!==(r=t[Symbol.toPrimitive])){var i=r.call(t,e||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)};// endregion
73
+ var CSS_CLASS_NAMES=style_module/* default */.A;/**
74
+ * Creates components to protect content and to log in.
75
+ * NOTE: User hook should either be a "ContextUserHook" or "ReduxUserHook".
76
+ * @param useUser - Hook to retrieve current user.
77
+ * @param routing - Integration of the used routing library.
78
+ * @param routing.Redirect - Component redirecting to given location.
79
+ * @param routing.useLocation - Hook to determine current location.
80
+ * @returns Components.
81
+ */var componentFactory=function componentFactory(useUser,_ref){var Redirect=_ref.Redirect,useLocation=_ref.useLocation;return{/**
82
+ * @param options - Options for given component.
83
+ * @param options.children - Content to render when authenticated.
84
+ * @param options.fallbackLocation - Location to redirect to when
85
+ * authentication was unsuccessful.
86
+ * @param options.loadingFallback - String to show when determining
87
+ * authentication result.
88
+ * @returns An content to be rendered.
89
+ * A wrapper for <Route> that redirects to the login screen if you're
90
+ * not yet authenticated.
91
+ */Authenticated:/*#__PURE__*/(0,external_react_.memo)(function(_ref2){var _fallbackLocation;var children=_ref2.children,fallbackLocation=_ref2.fallbackLocation,_ref2$loadingFallback=_ref2.loadingFallback,loadingFallback=_ref2$loadingFallback===void 0?"loading...":_ref2$loadingFallback;var location=useLocation();var user=useUser();(0,external_react_.useEffect)(function(){if(user.session.authenticated===null)user.authenticate()},[user.session.authenticated]);fallbackLocation=(0,external_react_generic_tools_.useMemorizedValue)(typeof fallbackLocation==="string"?{pathname:fallbackLocation}:fallbackLocation,fallbackLocation);var loginTarget=(0,external_react_generic_tools_.useMemorizedValue)(_objectSpread({},fallbackLocation),fallbackLocation);if(user.session.authenticated){if((0,external_clientnode_.isFunction)(children))return/*#__PURE__*/(0,jsx_runtime_.jsx)(jsx_runtime_.Fragment,{children:children({fallbackLocation:fallbackLocation,location:location,user:user})});return/*#__PURE__*/(0,jsx_runtime_.jsx)(jsx_runtime_.Fragment,{children:children})}if(user.session.authenticated===null)return/*#__PURE__*/(0,jsx_runtime_.jsx)(jsx_runtime_.Fragment,{children:loadingFallback!==null&&loadingFallback!==void 0?loadingFallback:""});if(((_fallbackLocation=fallbackLocation)===null||_fallbackLocation===void 0?void 0:_fallbackLocation.pathname)===location.pathname)return/*#__PURE__*/(0,jsx_runtime_.jsx)(jsx_runtime_.Fragment,{});return/*#__PURE__*/(0,jsx_runtime_.jsx)(Redirect,{replace:true,state:{from:location},to:loginTarget})}),Login:function Login(_ref3){var buttonProperties=_ref3.buttonProperties,inputProperties=_ref3.inputProperties,loginProperties=_ref3.loginProperties,passwordProperties=_ref3.passwordProperties,children=_ref3.children,onSubmitted=_ref3.onSubmitted,onSuccess=_ref3.onSuccess;var user=useUser();var _useState=(0,external_react_.useState)(_objectSpread(_objectSpread({},loginProperties),{},{invalid:true})),_useState2=_slicedToArray(_useState,2),loginInput=_useState2[0],setLoginInput=_useState2[1];var _useState3=(0,external_react_.useState)(_objectSpread(_objectSpread({},passwordProperties),{},{invalid:true})),_useState4=_slicedToArray(_useState3,2),passwordInput=_useState4[0],setPasswordInput=_useState4[1];var _useState5=(0,external_react_.useState)(false),_useState6=_slicedToArray(_useState5,2),submitted=_useState6[0],setSubmitted=_useState6[1];var _useState7=(0,external_react_.useState)(false),_useState8=_slicedToArray(_useState7,2),sent=_useState8[0],setSent=_useState8[1];(0,external_react_.useEffect)(function(){if(user.session.authenticated&&onSuccess)onSuccess(user)},[user.session.authenticated,onSuccess]);var login=(0,external_react_generic_tools_.useMemorizedValue)(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(event){var _loginInput$value,_passwordInput$value;var result,_loginInput$value2,_passwordInput$value2,_result;return _regenerator().w(function(_context){while(1)switch(_context.n){case 0:event.preventDefault();result=onSubmitted&&onSubmitted((_loginInput$value=loginInput.value)!==null&&_loginInput$value!==void 0?_loginInput$value:null,(_passwordInput$value=passwordInput.value)!==null&&_passwordInput$value!==void 0?_passwordInput$value:null);if(!(typeof result!=="boolean"||result)){_context.n=1;break}setSubmitted(true);if(!(loginInput.valid&&passwordInput.valid)){_context.n=1;break}_result=user.login({login:(_loginInput$value2=loginInput.value)!==null&&_loginInput$value2!==void 0?_loginInput$value2:null,password:(_passwordInput$value2=passwordInput.value)!==null&&_passwordInput$value2!==void 0?_passwordInput$value2:null});setSent(true);if(!(onSuccess&&_result!==null&&_result!==void 0&&_result.then)){_context.n=1;break}_context.n=1;return _result.then(function(){onSuccess(user)});case 1:return _context.a(2)}},_callee)})),onSubmitted,onSuccess,loginInput.value,loginInput.valid,passwordInput.value,passwordInput.valid,setSent,setSubmitted);var renderStatus=(0,external_react_generic_tools_.useMemorizedValue)((0,external_clientnode_.isFunction)(children)?children:children?function(){return children}:function(_ref5){var sent=_ref5.sent,submitted=_ref5.submitted,pending=_ref5.pending,authenticated=_ref5.authenticated,loginInput=_ref5.loginInput,passwordInput=_ref5.passwordInput;return pending?/*#__PURE__*/(0,jsx_runtime_.jsx)("div",{className:CSS_CLASS_NAMES.loginStatus,children:"authenticating..."}):submitted&&!authenticated&&(sent||loginInput.invalid||passwordInput.invalid)?/*#__PURE__*/(0,jsx_runtime_.jsx)("div",{className:CSS_CLASS_NAMES.loginStatus,role:"alert",children:loginInput.invalid?"Please type valid login.":passwordInput.invalid?"Please type valid password.":"Invalid credentials!"}):""},children);var setSentToFalse=(0,external_react_generic_tools_.useMemorizedValue)(function(){setSent(false)},setSent);return/*#__PURE__*/(0,jsx_runtime_.jsxs)("form",{className:CSS_CLASS_NAMES.login,children:[renderStatus({sent:sent,submitted:submitted,pending:Boolean(user.session.authenticating),authenticated:Boolean(user.session.authenticated),loginInput:loginInput,passwordInput:passwordInput}),/*#__PURE__*/(0,jsx_runtime_.jsx)(__WEBPACK_EXTERNAL_MODULE_react_input_material_components_TextInput_e3667393_default__,_objectSpread(_objectSpread({className:CSS_CLASS_NAMES.loginName,componentProperties:(0,external_react_generic_tools_.useMemorizedValue)({autoComplete:"username"}),name:"login",onChange:setLoginInput,onChangeValue:setSentToFalse,required:true,trailingIcon:"account_circle"},(0,external_react_generic_tools_.useMemorizedValue)(inputProperties||{},inputProperties)),(0,external_react_generic_tools_.useMemorizedValue)(loginProperties||{},inputProperties))),/*#__PURE__*/(0,jsx_runtime_.jsx)(__WEBPACK_EXTERNAL_MODULE_react_input_material_components_TextInput_e3667393_default__,_objectSpread(_objectSpread({className:CSS_CLASS_NAMES.loginPassword,componentProperties:(0,external_react_generic_tools_.useMemorizedValue)({autoComplete:"current-password"}),name:"password",onChange:setPasswordInput,onChangeValue:setSentToFalse,required:true,trailingIcon:"password_preset"},(0,external_react_generic_tools_.useMemorizedValue)(inputProperties||{},inputProperties)),(0,external_react_generic_tools_.useMemorizedValue)(passwordProperties||{},passwordProperties))),/*#__PURE__*/(0,jsx_runtime_.jsx)(__WEBPACK_EXTERNAL_MODULE__rmwc_button_e0454fea_Button__,_objectSpread({children:"Log in",className:CSS_CLASS_NAMES.loginButton,onClick:(0,external_react_generic_tools_.useMemorizedValue)(function(event){void login(event)},login),trailingIcon:"input"},(0,external_react_generic_tools_.useMemorizedValue)(buttonProperties||{},buttonProperties)))]})}}};/* harmony default export */ var components = (componentFactory);
92
+
93
+ /***/ }),
94
+ /* 6 */,
95
+ /* 7 */,
96
+ /* 8 */
97
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
98
+
99
+ var x = function(y) {
100
+ var x = {}; __webpack_require__.d(x, y); return x
101
+ }
102
+ var y = function(x) { return function() { return x; }; }
103
+ module.exports = x({ ["isFunction"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode__.isFunction; } });
104
+
105
+ /***/ }),
106
+ /* 9 */
107
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
108
+
109
+ var x = function(y) {
110
+ var x = {}; __webpack_require__.d(x, y); return x
111
+ }
112
+ var y = function(x) { return function() { return x; }; }
113
+ module.exports = x({ ["useMemorizedValue"]: function() { return __WEBPACK_EXTERNAL_MODULE_react_generic_tools_67824958__.useMemorizedValue; } });
114
+
115
+ /***/ })
116
+ /******/ ]);
117
+ /************************************************************************/
118
+ /******/ // The module cache
119
+ /******/ var __webpack_module_cache__ = {};
120
+ /******/
121
+ /******/ // The require function
122
+ /******/ function __webpack_require__(moduleId) {
123
+ /******/ // Check if module is in cache
124
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
125
+ /******/ if (cachedModule !== undefined) {
126
+ /******/ return cachedModule.exports;
127
+ /******/ }
128
+ /******/ // Create a new module (and put it into the cache)
129
+ /******/ var module = __webpack_module_cache__[moduleId] = {
130
+ /******/ // no module.id needed
131
+ /******/ // no module.loaded needed
132
+ /******/ exports: {}
133
+ /******/ };
134
+ /******/
135
+ /******/ // Execute the module function
136
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
137
+ /******/
138
+ /******/ // Return the exports of the module
139
+ /******/ return module.exports;
140
+ /******/ }
141
+ /******/
142
+ /************************************************************************/
143
+ /******/ /* webpack/runtime/define property getters */
144
+ /******/ // define getter/value functions for harmony exports
145
+ /******/ __webpack_require__.d = function(exports, definition) {
146
+ /******/ for(var key in definition) {
147
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
148
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
149
+ /******/ }
150
+ /******/ }
151
+ /******/ };
152
+ /******/
153
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
154
+ /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); };
155
+ /******/
156
+ /************************************************************************/
157
+ /******/
158
+ /******/ // startup
159
+ /******/ // Load entry module and return exports
160
+ /******/ // This entry module is referenced by other modules so it can't be inlined
161
+ /******/ __webpack_require__(2);
162
+ /******/ var __webpack_exports__ = __webpack_require__(5);
163
+ /******/ var __webpack_exports__CSS_CLASS_NAMES = __webpack_exports__.sr;
164
+ /******/ var __webpack_exports__componentFactory = __webpack_exports__.WV;
165
+ /******/ var __webpack_exports__default = __webpack_exports__.Ay;
166
+ /******/ export { __webpack_exports__CSS_CLASS_NAMES as CSS_CLASS_NAMES, __webpack_exports__componentFactory as componentFactory, __webpack_exports__default as default };
167
+ /******/
@@ -0,0 +1,3 @@
1
+ import type { BaseUserContext, BaseLoginData, ContextSessionHandler, ContextUserSession, SessionTools } from './type';
2
+ export declare const sessionFactory: <LoginDataType extends BaseLoginData = BaseLoginData, UserContext extends BaseUserContext = BaseUserContext>({ authenticate, login, logout }: ContextSessionHandler<LoginDataType, UserContext>) => SessionTools<LoginDataType, UserContext, ContextUserSession<UserContext>>;
3
+ export default sessionFactory;
@@ -0,0 +1,115 @@
1
+ if(typeof window==='undefined'||window===null)var window=(typeof globalThis==='undefined'||globalThis===null)?{}:globalThis;import * as __WEBPACK_EXTERNAL_MODULE_core_js_modules_es_array_includes_js_66c3fd7d__ from "core-js/modules/es.array.includes.js";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_00f484c1__ from "react/jsx-runtime";
4
+ /******/ var __webpack_modules__ = ([
5
+ /* 0 */,
6
+ /* 1 */
7
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
8
+
9
+ var x = function(y) {
10
+ var x = {}; __webpack_require__.d(x, y); return x
11
+ }
12
+ var y = function(x) { return function() { return x; }; }
13
+ module.exports = x({ ["createContext"]: function() { return __WEBPACK_EXTERNAL_MODULE_react__.createContext; }, ["useContext"]: function() { return __WEBPACK_EXTERNAL_MODULE_react__.useContext; }, ["useState"]: function() { return __WEBPACK_EXTERNAL_MODULE_react__.useState; } });
14
+
15
+ /***/ }),
16
+ /* 2 */,
17
+ /* 3 */
18
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
19
+
20
+ var x = function(y) {
21
+ var x = {}; __webpack_require__.d(x, y); return x
22
+ }
23
+ var y = function(x) { return function() { return x; }; }
24
+ module.exports = x({ ["jsx"]: function() { return __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_00f484c1__.jsx; } });
25
+
26
+ /***/ }),
27
+ /* 4 */
28
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
29
+
30
+ var x = function(y) {
31
+ var x = {}; __webpack_require__.d(x, y); return x
32
+ }
33
+ var y = function(x) { return function() { return x; }; }
34
+ module.exports = x({ });
35
+
36
+ /***/ })
37
+ /******/ ]);
38
+ /************************************************************************/
39
+ /******/ // The module cache
40
+ /******/ var __webpack_module_cache__ = {};
41
+ /******/
42
+ /******/ // The require function
43
+ /******/ function __webpack_require__(moduleId) {
44
+ /******/ // Check if module is in cache
45
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
46
+ /******/ if (cachedModule !== undefined) {
47
+ /******/ return cachedModule.exports;
48
+ /******/ }
49
+ /******/ // Create a new module (and put it into the cache)
50
+ /******/ var module = __webpack_module_cache__[moduleId] = {
51
+ /******/ // no module.id needed
52
+ /******/ // no module.loaded needed
53
+ /******/ exports: {}
54
+ /******/ };
55
+ /******/
56
+ /******/ // Execute the module function
57
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
58
+ /******/
59
+ /******/ // Return the exports of the module
60
+ /******/ return module.exports;
61
+ /******/ }
62
+ /******/
63
+ /************************************************************************/
64
+ /******/ /* webpack/runtime/define property getters */
65
+ /******/ // define getter/value functions for harmony exports
66
+ /******/ __webpack_require__.d = function(exports, definition) {
67
+ /******/ for(var key in definition) {
68
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
69
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
70
+ /******/ }
71
+ /******/ }
72
+ /******/ };
73
+ /******/
74
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
75
+ /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); };
76
+ /******/
77
+ /************************************************************************/
78
+ var __webpack_exports__ = {};
79
+ /* harmony import */ var core_js_modules_es_array_includes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
80
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
81
+ /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3);
82
+ // #!/usr/bin/env babel-node
83
+ // -*- coding: utf-8 -*-
84
+ /** @module index *//* !
85
+ region header
86
+ [Project page](https://tsickert.com/react-generic-user)
87
+
88
+ Copyright Torben Sickert (info["~at~"]tsickert.com) 16.12.2012
89
+ endregion
90
+ */// region imports
91
+ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function _objectSpread(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(o),!0).forEach(function(t){_defineProperty(r,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):ownKeys(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))})}return r}function _defineProperty(r,t,o){return(t=_toPropertyKey(t))in r?Object.defineProperty(r,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[t]=o,r}function _toPropertyKey(r){var o=_toPrimitive(r,"string");return"symbol"==_typeof(o)?o:o+""}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var r;if("undefined"!=typeof Symbol&&void 0!==(r=t[Symbol.toPrimitive])){var i=r.call(t,e||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function _slicedToArray(e,i){return _iterableToArrayLimit(e,i)||_unsupportedIterableToArray(e,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var o={}.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}function _iterableToArrayLimit(r,t){var e=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(Array.isArray(r)&&(null==e||e===("undefined"!=typeof Symbol&&[][Symbol.iterator])||e===[]["@@iterator"]))return r;if(null!=e){var l,n,i,a,u=[],o=!0,f=!1;try{if(i=(e=e.call(r)).next,0===t){if(Object(e)!==e)return;o=!1}else for(;!(o=(l=i.call(e)).done)&&(u.push(l.value),u.length!==t);o=!0);}catch(r){f=!0,n=r}finally{try{if(!o&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(f)throw n}}return u}};// endregion
92
+ var sessionFactory=function sessionFactory(_ref){var _authenticate=_ref.authenticate,_login=_ref.login,_logout=_ref.logout;var userContext=/*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.createContext)(undefined);var useUser=function useUser(){var user=(0,react__WEBPACK_IMPORTED_MODULE_1__.useContext)(userContext);if(user===undefined)throw new Error("No user context available. Did you wrap components using "+"the user context into the \"UserProvider\" component?");return user};var useHasRole=function useHasRole(role){var _user$session$userCon;var user=useUser();var roles=(_user$session$userCon=user.session.userContext)===null||_user$session$userCon===void 0?void 0:_user$session$userCon.roles;return Boolean(roles&&[].concat(role).every(function(role){return roles.includes(role)}))};var useUserState=function useUserState(options){if(options===void 0){options={}}var _useState=(0,react__WEBPACK_IMPORTED_MODULE_1__.useState)({session:{authenticated:null,authenticating:null,deauthenticating:null},authenticate:function authenticate(){setUser(function(oldUser){/*
93
+ If already an authentication request is running do
94
+ nothing.
95
+ */if(oldUser.session.authenticating)return oldUser;var authenticater=function authenticater(){return new Promise(function(resolve,reject){_authenticate(oldUser.session).then(function(userContext){setUser(function(oldUser){if(options.onAuthenticate)options.onAuthenticate(userContext);resolve(userContext);return _objectSpread(_objectSpread({},oldUser),{},{session:_objectSpread(_objectSpread({},oldUser.session),{},{authenticated:true,authenticating:null,userContext:userContext})})})}).catch(function(error){setUser(function(oldUser){/*
96
+ eslint-disable
97
+ prefer-promise-reject-errors
98
+ */reject(error);/*
99
+ eslint-enable
100
+ prefer-promise-reject-errors
101
+ */return _objectSpread(_objectSpread({},oldUser),{},{session:_objectSpread(_objectSpread({},oldUser.session),{},{authenticating:null})})})})})};return _objectSpread(_objectSpread({},oldUser),{},{session:_objectSpread(_objectSpread({},oldUser.session),{},{authenticating:oldUser.session.deauthenticating?oldUser.session.deauthenticating.then(authenticater,authenticater):authenticater()})})})},login:function login(loginData){setUser(function(oldUser){if(oldUser.session.authenticating)return oldUser;var authenticater=function authenticater(){return new Promise(function(resolve,reject){_login(loginData).then(function(userContext){setUser(function(oldUser){if(options.onAuthenticate)options.onAuthenticate(userContext);resolve(userContext);return _objectSpread(_objectSpread({},oldUser),{},{session:_objectSpread(_objectSpread({},oldUser.session),{},{authenticated:true,authenticating:null,userContext:userContext})})})}).catch(function(error){setUser(function(oldUser){/*
102
+ eslint-disable
103
+ prefer-promise-reject-errors
104
+ */reject(error);/*
105
+ eslint-enable
106
+ prefer-promise-reject-errors
107
+ */return _objectSpread(_objectSpread({},oldUser),{},{session:_objectSpread(_objectSpread({},oldUser.session),{},{authenticating:null})})})})})};return _objectSpread(_objectSpread({},oldUser),{},{session:_objectSpread(_objectSpread({},oldUser.session),{},{authenticating:oldUser.session.deauthenticating?oldUser.session.deauthenticating.then(authenticater,authenticater):authenticater()})})})},logout:function logout(){setUser(function(oldUser){if(oldUser.session.deauthenticating)return oldUser;var deauthenticater=function deauthenticater(){return new Promise(function(resolve,reject){_logout(oldUser.session).then(function(deauthenticated){setUser(function(oldUser){if(deauthenticated&&options.onDeauthenticate)options.onDeauthenticate(oldUser.session.userContext);resolve(deauthenticated);return _objectSpread(_objectSpread({},oldUser),{},{session:_objectSpread(_objectSpread({},oldUser.session),{},{authenticated:!deauthenticated,deauthenticating:null,userContext:deauthenticated?undefined:oldUser.session.userContext})})})}).catch(function(error){setUser(function(oldUser){/*
108
+ eslint-disable
109
+ prefer-promise-reject-errors
110
+ */reject(error);/*
111
+ eslint-enable
112
+ prefer-promise-reject-errors
113
+ */return _objectSpread(_objectSpread({},oldUser),{},{session:_objectSpread(_objectSpread({},oldUser.session),{},{deauthenticating:null})})})})})};return _objectSpread(_objectSpread({},oldUser),{},{session:_objectSpread(_objectSpread({},oldUser.session),{},{deauthenticating:oldUser.session.authenticating?oldUser.session.authenticating.then(deauthenticater,deauthenticater):deauthenticater()})})})}}),_useState2=_slicedToArray(_useState,2),user=_useState2[0],setUser=_useState2[1];return user};return{UserProvider:function UserProvider(_ref2){var children=_ref2.children,options=_ref2.options;return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(userContext.Provider,{value:useUserState(options),children:children})},userContext:userContext,useHasRole:useHasRole,useIsAdmin:function useIsAdmin(){return useHasRole("_admin")},useUser:useUser,useUserState:useUserState}};/* harmony default export */ __webpack_exports__.A = (sessionFactory);
114
+ var __webpack_exports__default = __webpack_exports__.A;
115
+ export { __webpack_exports__default as default, sessionFactory };
@@ -0,0 +1,40 @@
1
+ import type { BaseLocator } from 'react-generic-tools/endToEndTestHelper';
2
+ /**
3
+ * Provides locators to interact with a rendered login form.
4
+ * @param parent - Locator to search for login form elements in.
5
+ * @returns Stable and optional locators.
6
+ */
7
+ export declare const loginHarness: (parent: BaseLocator) => {
8
+ stable: {
9
+ nameInput: {
10
+ main: import("playwright-core").Locator;
11
+ inputNode: import("playwright-core").Locator;
12
+ richInputNode: import("playwright-core").Locator;
13
+ activateCodeEditor: () => Promise<void>;
14
+ activateRichtextEditor: () => Promise<void>;
15
+ getOptions: () => Promise<string[]>;
16
+ isMenuOpen: () => Promise<boolean>;
17
+ fill: (valueRepresentation: string) => Promise<void>;
18
+ inputValue: () => Promise<string | null>;
19
+ };
20
+ passwordInput: {
21
+ main: import("playwright-core").Locator;
22
+ inputNode: import("playwright-core").Locator;
23
+ richInputNode: import("playwright-core").Locator;
24
+ activateCodeEditor: () => Promise<void>;
25
+ activateRichtextEditor: () => Promise<void>;
26
+ getOptions: () => Promise<string[]>;
27
+ isMenuOpen: () => Promise<boolean>;
28
+ fill: (valueRepresentation: string) => Promise<void>;
29
+ inputValue: () => Promise<string | null>;
30
+ };
31
+ loginButton: {
32
+ main: import("playwright-core").Locator;
33
+ };
34
+ };
35
+ optional: {
36
+ statusMessage: import("playwright-core").Locator;
37
+ errorStatusMessage: import("playwright-core").Locator;
38
+ };
39
+ };
40
+ export default loginHarness;
@@ -0,0 +1,28 @@
1
+ if(typeof window==='undefined'||window===null)var window=(typeof globalThis==='undefined'||globalThis===null)?{}:globalThis;import { default as __WEBPACK_EXTERNAL_MODULE_react_input_material_components_TextInput_harness_1f30e93e_default__ } from "react-input-material/components/TextInput/harness";
2
+
3
+ ;// external "react-input-material/components/TextInput/harness"
4
+
5
+ ;// ./src/harness.ts
6
+ // #!/usr/bin/env babel-node
7
+ // -*- coding: utf-8 -*-
8
+ /** @module harness *//* !
9
+ region header
10
+ [Project page](https://tsickert.com/react-generic-user)
11
+
12
+ Copyright Torben Sickert (info["~at~"]tsickert.com) 16.12.2012
13
+
14
+ License
15
+ -------
16
+
17
+ This library written by Torben Sickert stands under a creative commons
18
+ naming 3.0 unported license.
19
+ See https://creativecommons.org/licenses/by/3.0/deed.de
20
+ endregion
21
+ */// region imports
22
+ // endregion
23
+ /**
24
+ * Provides locators to interact with a rendered login form.
25
+ * @param parent - Locator to search for login form elements in.
26
+ * @returns Stable and optional locators.
27
+ */var loginHarness=function loginHarness(parent){return{stable:{nameInput:__WEBPACK_EXTERNAL_MODULE_react_input_material_components_TextInput_harness_1f30e93e_default__(parent.locator(".login__name")),passwordInput:__WEBPACK_EXTERNAL_MODULE_react_input_material_components_TextInput_harness_1f30e93e_default__(parent.locator(".login__password")),loginButton:{main:parent.locator(".login__button")}},optional:{statusMessage:parent.locator(".login__status"),errorStatusMessage:parent.locator(".login__status").and(parent.getByRole("alert"))}}};/* harmony default export */ var harness = (loginHarness);
28
+ export { harness as default, loginHarness };
package/dist/index.css ADDED
@@ -0,0 +1,2 @@
1
+ /* !/usr/bin/env css
2
+ -*- coding: utf-8 -*- */.login{display:grid;grid-gap:20px;grid-gap:var(--w-default-space,20px);gap:20px;gap:var(--w-default-space,20px);grid-template-columns:1fr;margin:0 auto;width:400px}.login .login__status{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;color:#018786;color:var(--mdc-theme-secondary,#018786);font-family:Roboto,sans-serif;font-family:var(--mdc-typography-headline2-font-family,var(--mdc-typography-font-family,Roboto,sans-serif));font-size:3.75rem;font-size:var(--mdc-typography-headline2-font-size,3.75rem);font-weight:300;font-weight:var(--mdc-typography-headline2-font-weight,300);letter-spacing:-.0083em;letter-spacing:var(--mdc-typography-headline2-letter-spacing,-.0083em);line-height:3.75rem;line-height:var(--mdc-typography-headline2-line-height,3.75rem);text-align:center}.login .login__button,.login .login__name,.login .login__password{visibility:visible}
@@ -0,0 +1,4 @@
1
+ export { componentFactory, CSS_CLASS_NAMES } from './components';
2
+ export { sessionFactory as contextSessionFactory } from './context';
3
+ export { sessionFactory as reduxSessionFactory } from './redux';
4
+ export * from './type';