New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

akashi-dakoku-core

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

akashi-dakoku-core - npm Package Compare versions

Comparing version

to
0.5.0

@@ -12,2 +12,3 @@ import type { Page } from 'puppeteer';

note: string;
time: string;
telework?: string;

@@ -14,0 +15,0 @@ };

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkLogin = exports.dakoku = void 0;
const listener_1 = require("./listener");
const initialOptions = {

@@ -17,3 +18,3 @@ username: '',

const login = (page) => async (username, password, company) => {
await page.goto('https://atnd.ak4.jp/login', {
await page.goto('https://atnd.ak4.jp/login?next=%2Fmypage%2Fpunch', {
waitUntil: 'domcontentloaded',

@@ -26,3 +27,3 @@ });

await page.waitForNavigation();
if (page.url() !== 'https://atnd.ak4.jp/manager') {
if (page.url() !== 'https://atnd.ak4.jp/mypage/punch') {
throw new Error('ログインに失敗しました');

@@ -32,2 +33,3 @@ }

const core = (page) => async (options, mode, telework = false) => {
var _a, _b, _c;
const { username, password, company } = {

@@ -42,24 +44,20 @@ ...initialOptions,

});
listener_1.listenPunchResponse(page);
await page.click('#sound-switch [title="打刻音OFF"]');
await page.click(`a[data-punch-type="${mode}"]`);
await page.waitForSelector('div[data-modal-id="embossing"].is-show');
const $status = await page.$('.p-embossing-modal__status');
const status = await page.evaluate((element) => element.textContent, $status);
const $note = await page.$('.p-embossing-modal__alert__note:last-child');
const note = await page.evaluate((element) => element.textContent, $note);
const res = await listener_1.getPunchResponse();
await page.click('div[data-modal-id="embossing"] .modal-button-area > div');
const response = { status, note };
const response = {
status: (_a = res === null || res === void 0 ? void 0 : res.display_name) !== null && _a !== void 0 ? _a : '',
note: (_b = res === null || res === void 0 ? void 0 : res.alerts_type.join('/')) !== null && _b !== void 0 ? _b : '',
time: (_c = res === null || res === void 0 ? void 0 : res.server_time) !== null && _c !== void 0 ? _c : '',
};
if (telework) {
const $button = await page.$('#telework-switch > button');
const button = await page.evaluate((element) => element.textContent, $button);
if (button === 'テレワークを開始する') {
await page.click('#telework-switch > button');
await page.waitForSelector('div.p-toast--runtime.is-show');
const $status = await page.$('div.p-toast--runtime.is-show');
const status = await page.evaluate((element) => element.textContent, $status);
response.telework = status;
}
else {
response.telework = '既にテレワークを開始しています';
}
await page.goto('https://atnd.ak4.jp/mypage/set_telework?val=true');
const res = await page.evaluate(() => {
const json = JSON.parse(document.querySelector('body').innerText);
return json;
});
response.telework = res.toast;
}

@@ -66,0 +64,0 @@ await page.close();

{
"name": "akashi-dakoku-core",
"version": "0.4.0",
"version": "0.5.0",
"description": "AKASHI 打刻 コア",

@@ -5,0 +5,0 @@ "main": "lib/index.js",