spoclip-kit 1.0.15 → 1.0.16

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/README.md CHANGED
@@ -46,6 +46,53 @@ npm run release:minor
46
46
  npm run release:major
47
47
  ```
48
48
 
49
+ ## 새로운 진입점 정의
50
+
51
+ 1. src/new-module
52
+
53
+ 1. Update tsup.config.ts
54
+
55
+ ```ts
56
+ export default defineConfig({
57
+ entry: {
58
+ index: 'src/index.ts',
59
+ libs: 'src/libs/index.ts',
60
+ types: 'src/types/index.ts',
61
+ 'new-module': 'src/new-module/index.ts',
62
+ },
63
+
64
+ // ...
65
+ });
66
+ ```
67
+
68
+ 2. Update package.json
69
+
70
+ ```json
71
+ {
72
+ "name": "spoclip-kit",
73
+ // ...
74
+ "exports": {
75
+ ".": {
76
+ "types": "./dist/index.d.ts",
77
+ "require": "./dist/index.cjs",
78
+ "import": "./dist/index.js"
79
+ },
80
+ "./libs": {
81
+ "types": "./dist/libs.d.ts",
82
+ "require": "./dist/libs.cjs",
83
+ "import": "./dist/libs.js"
84
+ },
85
+
86
+ "./new-module": {
87
+ "types": "./dist/new-module.d.ts",
88
+ "require": "./dist/new-module.cjs",
89
+ "import": "./dist/new-module.js"
90
+ }
91
+ }
92
+ // ...
93
+ }
94
+ ```
95
+
49
96
  ## License
50
97
 
51
98
  MIT
package/dist/index.cjs CHANGED
@@ -28,8 +28,8 @@ module.exports = __toCommonJS(src_exports);
28
28
  function getVideoDownloadCost({
29
29
  duration,
30
30
  quality,
31
- ticketCode,
32
- remainingFreeDownloads
31
+ ticketCode = "FREE",
32
+ remainingFreeDownloads = 0
33
33
  }) {
34
34
  if (quality === "4K") {
35
35
  return { cost: 20, isPlusFree: false };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/libs/cost.ts"],"sourcesContent":["// Main entry point for spoclip-kit\nexport * from './libs';\n","import type { TicketCode } from '@/types/membership';\n\n/**\n * 비디오 다운로드 비용을 계산합니다.\n *\n * @description\n * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨\n * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료\n * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작\n * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨\n * - 59초부터는 1.98xx 이므로 반올림 시 2톨\n * - 60초부터는 2.00xx 이므로 반올림 시 2톨\n * - 62초부터는 2.03xx 이므로 반올림 시 2톨\n * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨\n *\n */\n\ntype GetVideoDownloadCostParams = {\n duration: number;\n quality: '2K' | '4K';\n ticketCode: TicketCode;\n remainingFreeDownloads: number;\n\n /** @deprecated 이 파라미터는 더이상 사용되지 않습니다. */\n isFullTime?: boolean;\n};\nexport function getVideoDownloadCost({\n duration,\n quality,\n ticketCode,\n remainingFreeDownloads,\n}: GetVideoDownloadCostParams) {\n if (quality === '4K') {\n return { cost: 20, isPlusFree: false };\n }\n\n const durationInSeconds = duration / 1000;\n const isUnder61 = durationInSeconds < 61;\n const isPlus = ticketCode === 'PLUS';\n\n if (isPlus && remainingFreeDownloads > 0 && isUnder61) {\n return { cost: 0, isPlusFree: true };\n }\n\n const costPerSecond = 1 / 60;\n const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10;\n return { cost, isPlusFree: false };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC0BO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA+B;AAC7B,MAAI,YAAY,MAAM;AACpB,WAAO,EAAE,MAAM,IAAI,YAAY,MAAM;AAAA,EACvC;AAEA,QAAM,oBAAoB,WAAW;AACrC,QAAM,YAAY,oBAAoB;AACtC,QAAM,SAAS,eAAe;AAE9B,MAAI,UAAU,yBAAyB,KAAK,WAAW;AACrD,WAAO,EAAE,MAAM,GAAG,YAAY,KAAK;AAAA,EACrC;AAEA,QAAM,gBAAgB,IAAI;AAC1B,QAAM,OAAO,KAAK,MAAM,oBAAoB,gBAAgB,EAAE,IAAI;AAClE,SAAO,EAAE,MAAM,YAAY,MAAM;AACnC;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/libs/cost.ts"],"sourcesContent":["// Main entry point for spoclip-kit\nexport * from './libs';\nexport * from './types';\n","import type { TicketCode } from '@/types/membership';\n\n/**\n * 비디오 다운로드 비용을 계산합니다.\n *\n * @description\n * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨\n * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료\n * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작\n * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨\n * - 59초부터는 1.98xx 이므로 반올림 시 2톨\n * - 60초부터는 2.00xx 이므로 반올림 시 2톨\n * - 62초부터는 2.03xx 이므로 반올림 시 2톨\n * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨\n *\n */\n\ntype GetVideoDownloadCostParams = {\n duration: number;\n quality: '2K' | '4K';\n ticketCode?: TicketCode;\n remainingFreeDownloads?: number;\n\n /** @deprecated 이 파라미터는 더이상 사용되지 않습니다. */\n isFullTime?: boolean;\n};\nexport function getVideoDownloadCost({\n duration,\n quality,\n ticketCode = 'FREE',\n remainingFreeDownloads = 0,\n}: GetVideoDownloadCostParams) {\n if (quality === '4K') {\n return { cost: 20, isPlusFree: false };\n }\n\n const durationInSeconds = duration / 1000;\n const isUnder61 = durationInSeconds < 61;\n const isPlus = ticketCode === 'PLUS';\n\n if (isPlus && remainingFreeDownloads > 0 && isUnder61) {\n return { cost: 0, isPlusFree: true };\n }\n\n const costPerSecond = 1 / 60;\n const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10;\n return { cost, isPlusFree: false };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC0BO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,yBAAyB;AAC3B,GAA+B;AAC7B,MAAI,YAAY,MAAM;AACpB,WAAO,EAAE,MAAM,IAAI,YAAY,MAAM;AAAA,EACvC;AAEA,QAAM,oBAAoB,WAAW;AACrC,QAAM,YAAY,oBAAoB;AACtC,QAAM,SAAS,eAAe;AAE9B,MAAI,UAAU,yBAAyB,KAAK,WAAW;AACrD,WAAO,EAAE,MAAM,GAAG,YAAY,KAAK;AAAA,EACrC;AAEA,QAAM,gBAAgB,IAAI;AAC1B,QAAM,OAAO,KAAK,MAAM,oBAAoB,gBAAgB,EAAE,IAAI;AAClE,SAAO,EAAE,MAAM,YAAY,MAAM;AACnC;","names":[]}
package/dist/index.d.cts CHANGED
@@ -1 +1,2 @@
1
1
  export { getVideoDownloadCost } from './libs.cjs';
2
+ export { TicketCode } from './types.cjs';
package/dist/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export { getVideoDownloadCost } from './libs.js';
2
+ export { TicketCode } from './types.js';
package/dist/index.js CHANGED
@@ -2,8 +2,8 @@
2
2
  function getVideoDownloadCost({
3
3
  duration,
4
4
  quality,
5
- ticketCode,
6
- remainingFreeDownloads
5
+ ticketCode = "FREE",
6
+ remainingFreeDownloads = 0
7
7
  }) {
8
8
  if (quality === "4K") {
9
9
  return { cost: 20, isPlusFree: false };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/libs/cost.ts"],"sourcesContent":["import type { TicketCode } from '@/types/membership';\n\n/**\n * 비디오 다운로드 비용을 계산합니다.\n *\n * @description\n * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨\n * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료\n * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작\n * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨\n * - 59초부터는 1.98xx 이므로 반올림 시 2톨\n * - 60초부터는 2.00xx 이므로 반올림 시 2톨\n * - 62초부터는 2.03xx 이므로 반올림 시 2톨\n * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨\n *\n */\n\ntype GetVideoDownloadCostParams = {\n duration: number;\n quality: '2K' | '4K';\n ticketCode: TicketCode;\n remainingFreeDownloads: number;\n\n /** @deprecated 이 파라미터는 더이상 사용되지 않습니다. */\n isFullTime?: boolean;\n};\nexport function getVideoDownloadCost({\n duration,\n quality,\n ticketCode,\n remainingFreeDownloads,\n}: GetVideoDownloadCostParams) {\n if (quality === '4K') {\n return { cost: 20, isPlusFree: false };\n }\n\n const durationInSeconds = duration / 1000;\n const isUnder61 = durationInSeconds < 61;\n const isPlus = ticketCode === 'PLUS';\n\n if (isPlus && remainingFreeDownloads > 0 && isUnder61) {\n return { cost: 0, isPlusFree: true };\n }\n\n const costPerSecond = 1 / 60;\n const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10;\n return { cost, isPlusFree: false };\n}\n"],"mappings":";AA0BO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA+B;AAC7B,MAAI,YAAY,MAAM;AACpB,WAAO,EAAE,MAAM,IAAI,YAAY,MAAM;AAAA,EACvC;AAEA,QAAM,oBAAoB,WAAW;AACrC,QAAM,YAAY,oBAAoB;AACtC,QAAM,SAAS,eAAe;AAE9B,MAAI,UAAU,yBAAyB,KAAK,WAAW;AACrD,WAAO,EAAE,MAAM,GAAG,YAAY,KAAK;AAAA,EACrC;AAEA,QAAM,gBAAgB,IAAI;AAC1B,QAAM,OAAO,KAAK,MAAM,oBAAoB,gBAAgB,EAAE,IAAI;AAClE,SAAO,EAAE,MAAM,YAAY,MAAM;AACnC;","names":[]}
1
+ {"version":3,"sources":["../src/libs/cost.ts"],"sourcesContent":["import type { TicketCode } from '@/types/membership';\n\n/**\n * 비디오 다운로드 비용을 계산합니다.\n *\n * @description\n * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨\n * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료\n * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작\n * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨\n * - 59초부터는 1.98xx 이므로 반올림 시 2톨\n * - 60초부터는 2.00xx 이므로 반올림 시 2톨\n * - 62초부터는 2.03xx 이므로 반올림 시 2톨\n * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨\n *\n */\n\ntype GetVideoDownloadCostParams = {\n duration: number;\n quality: '2K' | '4K';\n ticketCode?: TicketCode;\n remainingFreeDownloads?: number;\n\n /** @deprecated 이 파라미터는 더이상 사용되지 않습니다. */\n isFullTime?: boolean;\n};\nexport function getVideoDownloadCost({\n duration,\n quality,\n ticketCode = 'FREE',\n remainingFreeDownloads = 0,\n}: GetVideoDownloadCostParams) {\n if (quality === '4K') {\n return { cost: 20, isPlusFree: false };\n }\n\n const durationInSeconds = duration / 1000;\n const isUnder61 = durationInSeconds < 61;\n const isPlus = ticketCode === 'PLUS';\n\n if (isPlus && remainingFreeDownloads > 0 && isUnder61) {\n return { cost: 0, isPlusFree: true };\n }\n\n const costPerSecond = 1 / 60;\n const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10;\n return { cost, isPlusFree: false };\n}\n"],"mappings":";AA0BO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,yBAAyB;AAC3B,GAA+B;AAC7B,MAAI,YAAY,MAAM;AACpB,WAAO,EAAE,MAAM,IAAI,YAAY,MAAM;AAAA,EACvC;AAEA,QAAM,oBAAoB,WAAW;AACrC,QAAM,YAAY,oBAAoB;AACtC,QAAM,SAAS,eAAe;AAE9B,MAAI,UAAU,yBAAyB,KAAK,WAAW;AACrD,WAAO,EAAE,MAAM,GAAG,YAAY,KAAK;AAAA,EACrC;AAEA,QAAM,gBAAgB,IAAI;AAC1B,QAAM,OAAO,KAAK,MAAM,oBAAoB,gBAAgB,EAAE,IAAI;AAClE,SAAO,EAAE,MAAM,YAAY,MAAM;AACnC;","names":[]}
package/dist/libs.cjs CHANGED
@@ -28,8 +28,8 @@ module.exports = __toCommonJS(libs_exports);
28
28
  function getVideoDownloadCost({
29
29
  duration,
30
30
  quality,
31
- ticketCode,
32
- remainingFreeDownloads
31
+ ticketCode = "FREE",
32
+ remainingFreeDownloads = 0
33
33
  }) {
34
34
  if (quality === "4K") {
35
35
  return { cost: 20, isPlusFree: false };
package/dist/libs.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/libs/index.ts","../src/libs/cost.ts"],"sourcesContent":["export { getVideoDownloadCost } from './cost';\n","import type { TicketCode } from '@/types/membership';\n\n/**\n * 비디오 다운로드 비용을 계산합니다.\n *\n * @description\n * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨\n * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료\n * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작\n * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨\n * - 59초부터는 1.98xx 이므로 반올림 시 2톨\n * - 60초부터는 2.00xx 이므로 반올림 시 2톨\n * - 62초부터는 2.03xx 이므로 반올림 시 2톨\n * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨\n *\n */\n\ntype GetVideoDownloadCostParams = {\n duration: number;\n quality: '2K' | '4K';\n ticketCode: TicketCode;\n remainingFreeDownloads: number;\n\n /** @deprecated 이 파라미터는 더이상 사용되지 않습니다. */\n isFullTime?: boolean;\n};\nexport function getVideoDownloadCost({\n duration,\n quality,\n ticketCode,\n remainingFreeDownloads,\n}: GetVideoDownloadCostParams) {\n if (quality === '4K') {\n return { cost: 20, isPlusFree: false };\n }\n\n const durationInSeconds = duration / 1000;\n const isUnder61 = durationInSeconds < 61;\n const isPlus = ticketCode === 'PLUS';\n\n if (isPlus && remainingFreeDownloads > 0 && isUnder61) {\n return { cost: 0, isPlusFree: true };\n }\n\n const costPerSecond = 1 / 60;\n const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10;\n return { cost, isPlusFree: false };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC0BO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA+B;AAC7B,MAAI,YAAY,MAAM;AACpB,WAAO,EAAE,MAAM,IAAI,YAAY,MAAM;AAAA,EACvC;AAEA,QAAM,oBAAoB,WAAW;AACrC,QAAM,YAAY,oBAAoB;AACtC,QAAM,SAAS,eAAe;AAE9B,MAAI,UAAU,yBAAyB,KAAK,WAAW;AACrD,WAAO,EAAE,MAAM,GAAG,YAAY,KAAK;AAAA,EACrC;AAEA,QAAM,gBAAgB,IAAI;AAC1B,QAAM,OAAO,KAAK,MAAM,oBAAoB,gBAAgB,EAAE,IAAI;AAClE,SAAO,EAAE,MAAM,YAAY,MAAM;AACnC;","names":[]}
1
+ {"version":3,"sources":["../src/libs/index.ts","../src/libs/cost.ts"],"sourcesContent":["export { getVideoDownloadCost } from './cost';\n","import type { TicketCode } from '@/types/membership';\n\n/**\n * 비디오 다운로드 비용을 계산합니다.\n *\n * @description\n * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨\n * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료\n * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작\n * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨\n * - 59초부터는 1.98xx 이므로 반올림 시 2톨\n * - 60초부터는 2.00xx 이므로 반올림 시 2톨\n * - 62초부터는 2.03xx 이므로 반올림 시 2톨\n * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨\n *\n */\n\ntype GetVideoDownloadCostParams = {\n duration: number;\n quality: '2K' | '4K';\n ticketCode?: TicketCode;\n remainingFreeDownloads?: number;\n\n /** @deprecated 이 파라미터는 더이상 사용되지 않습니다. */\n isFullTime?: boolean;\n};\nexport function getVideoDownloadCost({\n duration,\n quality,\n ticketCode = 'FREE',\n remainingFreeDownloads = 0,\n}: GetVideoDownloadCostParams) {\n if (quality === '4K') {\n return { cost: 20, isPlusFree: false };\n }\n\n const durationInSeconds = duration / 1000;\n const isUnder61 = durationInSeconds < 61;\n const isPlus = ticketCode === 'PLUS';\n\n if (isPlus && remainingFreeDownloads > 0 && isUnder61) {\n return { cost: 0, isPlusFree: true };\n }\n\n const costPerSecond = 1 / 60;\n const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10;\n return { cost, isPlusFree: false };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC0BO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,yBAAyB;AAC3B,GAA+B;AAC7B,MAAI,YAAY,MAAM;AACpB,WAAO,EAAE,MAAM,IAAI,YAAY,MAAM;AAAA,EACvC;AAEA,QAAM,oBAAoB,WAAW;AACrC,QAAM,YAAY,oBAAoB;AACtC,QAAM,SAAS,eAAe;AAE9B,MAAI,UAAU,yBAAyB,KAAK,WAAW;AACrD,WAAO,EAAE,MAAM,GAAG,YAAY,KAAK;AAAA,EACrC;AAEA,QAAM,gBAAgB,IAAI;AAC1B,QAAM,OAAO,KAAK,MAAM,oBAAoB,gBAAgB,EAAE,IAAI;AAClE,SAAO,EAAE,MAAM,YAAY,MAAM;AACnC;","names":[]}
package/dist/libs.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- type TicketCode = 'PLUS' | 'FREE';
1
+ import { TicketCode } from './types.cjs';
2
2
 
3
3
  /**
4
4
  * 비디오 다운로드 비용을 계산합니다.
@@ -17,8 +17,8 @@ type TicketCode = 'PLUS' | 'FREE';
17
17
  type GetVideoDownloadCostParams = {
18
18
  duration: number;
19
19
  quality: '2K' | '4K';
20
- ticketCode: TicketCode;
21
- remainingFreeDownloads: number;
20
+ ticketCode?: TicketCode;
21
+ remainingFreeDownloads?: number;
22
22
  /** @deprecated 이 파라미터는 더이상 사용되지 않습니다. */
23
23
  isFullTime?: boolean;
24
24
  };
package/dist/libs.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- type TicketCode = 'PLUS' | 'FREE';
1
+ import { TicketCode } from './types.js';
2
2
 
3
3
  /**
4
4
  * 비디오 다운로드 비용을 계산합니다.
@@ -17,8 +17,8 @@ type TicketCode = 'PLUS' | 'FREE';
17
17
  type GetVideoDownloadCostParams = {
18
18
  duration: number;
19
19
  quality: '2K' | '4K';
20
- ticketCode: TicketCode;
21
- remainingFreeDownloads: number;
20
+ ticketCode?: TicketCode;
21
+ remainingFreeDownloads?: number;
22
22
  /** @deprecated 이 파라미터는 더이상 사용되지 않습니다. */
23
23
  isFullTime?: boolean;
24
24
  };
package/dist/libs.js CHANGED
@@ -2,8 +2,8 @@
2
2
  function getVideoDownloadCost({
3
3
  duration,
4
4
  quality,
5
- ticketCode,
6
- remainingFreeDownloads
5
+ ticketCode = "FREE",
6
+ remainingFreeDownloads = 0
7
7
  }) {
8
8
  if (quality === "4K") {
9
9
  return { cost: 20, isPlusFree: false };
package/dist/libs.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/libs/cost.ts"],"sourcesContent":["import type { TicketCode } from '@/types/membership';\n\n/**\n * 비디오 다운로드 비용을 계산합니다.\n *\n * @description\n * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨\n * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료\n * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작\n * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨\n * - 59초부터는 1.98xx 이므로 반올림 시 2톨\n * - 60초부터는 2.00xx 이므로 반올림 시 2톨\n * - 62초부터는 2.03xx 이므로 반올림 시 2톨\n * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨\n *\n */\n\ntype GetVideoDownloadCostParams = {\n duration: number;\n quality: '2K' | '4K';\n ticketCode: TicketCode;\n remainingFreeDownloads: number;\n\n /** @deprecated 이 파라미터는 더이상 사용되지 않습니다. */\n isFullTime?: boolean;\n};\nexport function getVideoDownloadCost({\n duration,\n quality,\n ticketCode,\n remainingFreeDownloads,\n}: GetVideoDownloadCostParams) {\n if (quality === '4K') {\n return { cost: 20, isPlusFree: false };\n }\n\n const durationInSeconds = duration / 1000;\n const isUnder61 = durationInSeconds < 61;\n const isPlus = ticketCode === 'PLUS';\n\n if (isPlus && remainingFreeDownloads > 0 && isUnder61) {\n return { cost: 0, isPlusFree: true };\n }\n\n const costPerSecond = 1 / 60;\n const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10;\n return { cost, isPlusFree: false };\n}\n"],"mappings":";AA0BO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA+B;AAC7B,MAAI,YAAY,MAAM;AACpB,WAAO,EAAE,MAAM,IAAI,YAAY,MAAM;AAAA,EACvC;AAEA,QAAM,oBAAoB,WAAW;AACrC,QAAM,YAAY,oBAAoB;AACtC,QAAM,SAAS,eAAe;AAE9B,MAAI,UAAU,yBAAyB,KAAK,WAAW;AACrD,WAAO,EAAE,MAAM,GAAG,YAAY,KAAK;AAAA,EACrC;AAEA,QAAM,gBAAgB,IAAI;AAC1B,QAAM,OAAO,KAAK,MAAM,oBAAoB,gBAAgB,EAAE,IAAI;AAClE,SAAO,EAAE,MAAM,YAAY,MAAM;AACnC;","names":[]}
1
+ {"version":3,"sources":["../src/libs/cost.ts"],"sourcesContent":["import type { TicketCode } from '@/types/membership';\n\n/**\n * 비디오 다운로드 비용을 계산합니다.\n *\n * @description\n * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨\n * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료\n * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작\n * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨\n * - 59초부터는 1.98xx 이므로 반올림 시 2톨\n * - 60초부터는 2.00xx 이므로 반올림 시 2톨\n * - 62초부터는 2.03xx 이므로 반올림 시 2톨\n * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨\n *\n */\n\ntype GetVideoDownloadCostParams = {\n duration: number;\n quality: '2K' | '4K';\n ticketCode?: TicketCode;\n remainingFreeDownloads?: number;\n\n /** @deprecated 이 파라미터는 더이상 사용되지 않습니다. */\n isFullTime?: boolean;\n};\nexport function getVideoDownloadCost({\n duration,\n quality,\n ticketCode = 'FREE',\n remainingFreeDownloads = 0,\n}: GetVideoDownloadCostParams) {\n if (quality === '4K') {\n return { cost: 20, isPlusFree: false };\n }\n\n const durationInSeconds = duration / 1000;\n const isUnder61 = durationInSeconds < 61;\n const isPlus = ticketCode === 'PLUS';\n\n if (isPlus && remainingFreeDownloads > 0 && isUnder61) {\n return { cost: 0, isPlusFree: true };\n }\n\n const costPerSecond = 1 / 60;\n const cost = Math.round(durationInSeconds * costPerSecond * 10) / 10;\n return { cost, isPlusFree: false };\n}\n"],"mappings":";AA0BO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,yBAAyB;AAC3B,GAA+B;AAC7B,MAAI,YAAY,MAAM;AACpB,WAAO,EAAE,MAAM,IAAI,YAAY,MAAM;AAAA,EACvC;AAEA,QAAM,oBAAoB,WAAW;AACrC,QAAM,YAAY,oBAAoB;AACtC,QAAM,SAAS,eAAe;AAE9B,MAAI,UAAU,yBAAyB,KAAK,WAAW;AACrD,WAAO,EAAE,MAAM,GAAG,YAAY,KAAK;AAAA,EACrC;AAEA,QAAM,gBAAgB,IAAI;AAC1B,QAAM,OAAO,KAAK,MAAM,oBAAoB,gBAAgB,EAAE,IAAI;AAClE,SAAO,EAAE,MAAM,YAAY,MAAM;AACnC;","names":[]}
package/dist/types.cjs ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/types/index.ts
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
19
+ //# sourceMappingURL=types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/index.ts"],"sourcesContent":["export * from './membership';\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,3 @@
1
+ type TicketCode = 'PLUS' | 'FREE';
2
+
3
+ export type { TicketCode };
@@ -0,0 +1,3 @@
1
+ type TicketCode = 'PLUS' | 'FREE';
2
+
3
+ export type { TicketCode };
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spoclip-kit",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "type": "module",
5
5
  "description": "TypeScript utility library for internal use",
6
6
  "files": [