@aria-framework/customer 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aria-framework/customer",
3
- "version": "0.1.0",
4
- "description": "Aria App Framework — customer module. What makes an app customer-driven, as factories and data an app passes its own lists to. 0.1, part access: the customer's support-access setting per kind of data (version 2 of the model: no helper tier), grants and requests with their state machines, the partner's starting value and managed mark, the sweep, the audit action names, and the five tables as db-worker table definitions with their schema check. No permission name, route prefix or app word lives here.",
3
+ "version": "0.2.0",
4
+ "description": "Aria App Framework — customer module. What makes an app customer-driven, as factories and data an app passes its own lists to. 0.1, part access: the customer's support-access setting per kind of data (version 2 of the model: no helper tier), grants and requests with their state machines, the partner's starting value and managed mark, the sweep, the audit action names, and the five tables as db-worker table definitions with their schema check. 0.2, part visits: working in one customer (the way in, the house only as the partner, the level per kind with the role judged at home, the reason, four hours, the re-check on every request and live event, the gate with look only and the pin, the two audit rows, the banner, the ended and typed-work notices). No permission name, route prefix or app word lives here.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
7
7
  "publishConfig": {
@@ -11,6 +11,8 @@
11
11
  "files": [
12
12
  "index.js",
13
13
  "lib/",
14
+ "views/",
15
+ "assets/",
14
16
  "README.md",
15
17
  "CHANGELOG.md"
16
18
  ],
@@ -19,9 +21,19 @@
19
21
  "prepublishOnly": "node ../../test/packaging.js customer"
20
22
  },
21
23
  "peerDependencies": {
22
- "@aria-framework/db-worker": ">=0.31.0"
24
+ "@aria-framework/db-worker": ">=0.31.0",
25
+ "@aria-framework/tenancy": ">=0.5.0",
26
+ "express": ">=5"
27
+ },
28
+ "peerDependenciesMeta": {
29
+ "express": {
30
+ "optional": true
31
+ }
23
32
  },
24
33
  "devDependencies": {
25
- "@electric-sql/pglite": "^0.5.8"
34
+ "@electric-sql/pglite": "^0.5.8",
35
+ "ejs": "6.0.1",
36
+ "express": "5.2.1",
37
+ "express-session": "1.19.0"
26
38
  }
27
39
  }
@@ -0,0 +1,20 @@
1
+ <%# WORKING IN A CUSTOMER: the banner on every page of a visit (@aria-framework/customer, CD-20).
2
+ "Working in <customer> · <level> · reason · ends <time>", amber (make changes) or grey (look only), with Leave, in the
3
+ place of the working-in-a-partner banner. Draws nothing without `visit` (res.locals.visit, set by visits.track).
4
+ Needs the app's csrfToken() (it throws without it). No inline script, style or event handler: the typed-work
5
+ notice is the package's assets/visit.js, which reads the data attributes and the template below. %>
6
+ <% if (typeof visit !== 'undefined' && visit) { %>
7
+ <div class="alert alert-<%= visit.level === 'change' ? 'warning' : 'secondary' %> customer-visit-banner customer-visit-<%= visit.level %> border-0 rounded-0 mb-0 d-flex align-items-center justify-content-between py-2 px-4" data-work-in-banner="<%= visit.level %>" data-work-in-status="<%= visit.statusPath %>">
8
+ <div>
9
+ Working in <strong><%= visit.customerName %></strong> · <%= visit.levelLabel %> · <% if (visit.reason) { %>reason: ‘<%= visit.reason %>’<% } else { %>managed customer, no reason asked<% } %> ·
10
+ ends <time datetime="<%= visit.untilIso %>"><%= typeof formatDateTime === 'function' ? formatDateTime(visit.untilIso) : visit.untilIso %></time><% if (visit.level === 'look') { %> · you cannot make changes<% } %>
11
+ </div>
12
+ <form method="POST" action="<%= visit.leavePath %>" class="m-0" data-work-in-leave>
13
+ <input type="hidden" name="_csrf" value="<%= csrfToken() %>">
14
+ <button type="submit" class="btn btn-sm btn-dark">Leave</button>
15
+ </form>
16
+ </div>
17
+ <template data-work-in-ended-template>
18
+ <%- include('customer-visit-ended', { visitEnded: { customerName: visit.customerName, why: 'left', text: visit.endedText }, typed: true }) %>
19
+ </template>
20
+ <% } %>
@@ -0,0 +1,11 @@
1
+ <%# A VISIT HAS ENDED (@aria-framework/customer, CD-23): "Your time in <customer> has ended." or "You are no longer
2
+ working in <customer>.", then "You are back on your own pages." `visitEnded` { customerName, why, text }: what
3
+ visits.track sets on the request that ended the visit (it also flashes the same sentence), and what the banner's
4
+ template hands assets/visit.js, which shows it above a form whose submit came too late (`typed`: with "Copy what you
5
+ typed"). Draws nothing without `visitEnded`. No inline script, style or event handler. %>
6
+ <% if (typeof visitEnded !== 'undefined' && visitEnded) { %>
7
+ <div class="alert alert-info customer-visit-ended border-0 rounded-0 mb-0 py-2 px-4" role="status" data-work-in-ended="<%= visitEnded.why %>">
8
+ <span data-work-in-ended-text><%= visitEnded.text %></span>
9
+ <% if (typeof typed !== 'undefined' && typed) { %><button type="button" class="btn btn-sm btn-outline-secondary ms-2" data-work-in-copy>Copy what you typed</button><% } %>
10
+ </div>
11
+ <% } %>