PageSourceSearch

https://order.kyobobook.co.kr/assets/js/common/startup-main.js?t=202609221026

js kyobobook.co.kr collected 2026-09-24 08:32:01 UTC 5,685 bytes, 140 lines download raw bytes

1"use strict";
2/* eslint-disable no-var */
3/* globals KbbJS */
4
5const OrderApp = (function (params) {
6    /* --------------------------------------------------------------------------------
7     * 기능명: KbbJS 초기화 이후 서비스 시작
8     * -------------------------------------------------------------------------------- */
9    let startupMain = () => {
10        // 공통 함수 추가
11        Object.assign(order.common, _interfaces);
12
13        KbbJS.ready()
14            .then(core => core.auth.ready())
15            .then(auth => auth.authorize())
16            .then(userModel => {
17                if (userModel != null) {
18                    order.user.data = userModel.data;
19                    order.user.exists = true;
20                    order.user.notExists = false;
21                }
22
23                if (authLogin()) {
24                    initializeCall();
25                }
26        });
27    };  // startupMain()
28
29    /* --------------------------------------------------------------------------------
30     * 기능명: 로그인
31     * return (bool) true 계속, false 중지
32     * -------------------------------------------------------------------------------- */
33    let authLogin = () => {
34        let urlPath = location.pathname;
35
36        // 장바구니와 주문서, 비회원로그인 페이지의 경우 비로그인 가능
37        if (urlPath.startsWith("/cart") || urlPath.startsWith("/order") || urlPath.startsWith("/giftcard-reject") || urlPath.startsWith("/nologin")) {
38            return true;
39        }
40
41        // 로그인은 회원 로그인 또는 비회원 cookie로 확인
42        if (!KbbJS.auth.authorized && Cookies.get("non_member_login") === undefined) {
43            // 비회원임 => 로그인 요청 필요
44
45            // KbbJS 로딩바 강제 제거
46            $("#KbbLoading").removeClass("show");
47            $("html").removeClass("loading").addClass("kbb_loaded");
48
49            // 로그인 페이지로 이동
50            KbbJS.auth.redirectLogin();
51            /*
52            // 확인 버튼을 클릭하면 로그인 페이지로 이동
53            KbbJS.ui.authorizeWithAlert().then(function (user) {
54                // undefined: 로그인 페이지로 이동
55                // false: 비회원 (취소 버튼 클릭)
56                // object: 로그인 회원 정보
57                if (user === undefined) {
58                    // 로그인 페이지로 이동을 선택한 경우 추가적인 초기화 불필요
59                    return false;
60                }
61
62                // 초기화 수행
63                initializeCall();
64            });
65             */
66            return false;
67        }
68        return true;
69    }; // authLogin()
70
71    /* --------------------------------------------------------------------------------
72     * 기능명: 초기화 인터페이스 호출
73     * -------------------------------------------------------------------------------- */
74    let initializeCall = () => {
75        let promise;
76        if (order.startup['main'] !== undefined) {
77            switch (Object.getPrototypeOf(order.startup['main']).constructor.name) {
78                case 'Function':
79                    console.log(">>>>> 초기화 인터페이스 <<<<<");
80                    promise = new Promise(function (resolve, reject) {
81                        try {
82                            order.startup.main();
83                            resolve();
84                        } catch (e) {
85                            reject(e);
86                        }
87                    });
88                    break;
89                case 'AsyncFunction':
90                    console.log(">>>>> 초기화 인터페이스 (비동기) <<<<<");
91                    promise = order.startup.main();
92                    break;
93                default:
94                    console.log(">>>>>
94 초기화 인터페이스 없음 <<<<<")
95            }
96        }
97
98        if (promise !== undefined && promise instanceof Promise) {
99            promise.then(function () {
100                console.log(">>>>> 초기화 인터페이스 완료 <<<<<");
101                if (order.startup['success'] !== undefined &&
102                    Object.getPrototypeOf(order.startup['success']).constructor.name === "Function") {
103                    order.startup.success();
104                }
105            }).catch(function (e) {
106                console.log(">>>>> 초기화 인터페이스 오류 <<<<<", e);
107                if (order.startup['error'] !== undefined &&
108                    Object.getPrototypeOf(order.startup['error']).constructor.name === "Function") {
109                    order.startup.error();
110                }
111            });
112        } else {
113            console.log(">>>>> 초기화 인터페이스 없음 <<<<<");
114        }
115
116    }; // initializeCall()
117
118    let _interfaces = {
119        /*
120        pdtImgUri: 상품이미지(원본)
121            - pdtImgUri + "/" + {상품코드(cmdtcode)}.jpg
122            - 상품코드(cmdtcode)가 없는 경우 (ex> 결합상품)에는 판매상품ID(saleCmdtid)로 조합
123        pdtResizeImgUri: 상품이미지(Serverless Image Handler 통해서 Resize된 이미지)
124            - pdtResizeImgUri + "/" + {이미지크기} + "/" + {상품코드(cmdtcode)}.jpg
125            - 이미지크기는 "가로픽셀x세로픽셀" (ex> 800x1146)
126
127        사용법:
128            - order.common.getProductImageBase()
129            - order.common.getProductResizeImageBase()
130        */
131        getProductImageBase: () => {
132            return params.pdtImgUri;
133        },
134        getProductResizeImageBase: () => {
135            return params.pdtResizeImgUri;
136        },
137    };
138
139    startupMain();
140});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.